index.full.mjs 1.9 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902
  1. /*! Element Plus v2.9.1 */
  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 {
  8086. result.push(child);
  8087. }
  8088. });
  8089. return result;
  8090. };
  8091. const unique = (arr) => [...new Set(arr)];
  8092. const castArray = (arr) => {
  8093. if (!arr && arr !== 0)
  8094. return [];
  8095. return isArray$1(arr) ? arr : [arr];
  8096. };
  8097. const isKorean = (text) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text);
  8098. const mutable = (val) => val;
  8099. function throttleByRaf(cb) {
  8100. let timer = 0;
  8101. const throttle = (...args) => {
  8102. if (timer) {
  8103. cAF(timer);
  8104. }
  8105. timer = rAF(() => {
  8106. cb(...args);
  8107. timer = 0;
  8108. });
  8109. };
  8110. throttle.cancel = () => {
  8111. cAF(timer);
  8112. timer = 0;
  8113. };
  8114. return throttle;
  8115. }
  8116. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  8117. const LISTENER_PREFIX = /^on[A-Z]/;
  8118. const useAttrs = (params = {}) => {
  8119. const { excludeListeners = false, excludeKeys } = params;
  8120. const allExcludeKeys = computed(() => {
  8121. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  8122. });
  8123. const instance = getCurrentInstance();
  8124. if (!instance) {
  8125. return computed(() => ({}));
  8126. }
  8127. return computed(() => {
  8128. var _a;
  8129. return fromPairs(Object.entries((_a = instance.proxy) == null ? void 0 : _a.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  8130. });
  8131. };
  8132. function useCalcInputWidth() {
  8133. const calculatorRef = shallowRef();
  8134. const calculatorWidth = ref(0);
  8135. const MINIMUM_INPUT_WIDTH = 11;
  8136. const inputStyle = computed(() => ({
  8137. minWidth: `${Math.max(calculatorWidth.value, MINIMUM_INPUT_WIDTH)}px`
  8138. }));
  8139. const resetCalculatorWidth = () => {
  8140. var _a, _b;
  8141. calculatorWidth.value = (_b = (_a = calculatorRef.value) == null ? void 0 : _a.getBoundingClientRect().width) != null ? _b : 0;
  8142. };
  8143. useResizeObserver(calculatorRef, resetCalculatorWidth);
  8144. return {
  8145. calculatorRef,
  8146. calculatorWidth,
  8147. inputStyle
  8148. };
  8149. }
  8150. const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
  8151. watch(() => unref(condition), (val) => {
  8152. }, {
  8153. immediate: true
  8154. });
  8155. };
  8156. const useDraggable = (targetRef, dragRef, draggable, overflow) => {
  8157. let transform = {
  8158. offsetX: 0,
  8159. offsetY: 0
  8160. };
  8161. const onMousedown = (e) => {
  8162. const downX = e.clientX;
  8163. const downY = e.clientY;
  8164. const { offsetX, offsetY } = transform;
  8165. const targetRect = targetRef.value.getBoundingClientRect();
  8166. const targetLeft = targetRect.left;
  8167. const targetTop = targetRect.top;
  8168. const targetWidth = targetRect.width;
  8169. const targetHeight = targetRect.height;
  8170. const clientWidth = document.documentElement.clientWidth;
  8171. const clientHeight = document.documentElement.clientHeight;
  8172. const minLeft = -targetLeft + offsetX;
  8173. const minTop = -targetTop + offsetY;
  8174. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  8175. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  8176. const onMousemove = (e2) => {
  8177. let moveX = offsetX + e2.clientX - downX;
  8178. let moveY = offsetY + e2.clientY - downY;
  8179. if (!(overflow == null ? void 0 : overflow.value)) {
  8180. moveX = Math.min(Math.max(moveX, minLeft), maxLeft);
  8181. moveY = Math.min(Math.max(moveY, minTop), maxTop);
  8182. }
  8183. transform = {
  8184. offsetX: moveX,
  8185. offsetY: moveY
  8186. };
  8187. if (targetRef.value) {
  8188. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  8189. }
  8190. };
  8191. const onMouseup = () => {
  8192. document.removeEventListener("mousemove", onMousemove);
  8193. document.removeEventListener("mouseup", onMouseup);
  8194. };
  8195. document.addEventListener("mousemove", onMousemove);
  8196. document.addEventListener("mouseup", onMouseup);
  8197. };
  8198. const onDraggable = () => {
  8199. if (dragRef.value && targetRef.value) {
  8200. dragRef.value.addEventListener("mousedown", onMousedown);
  8201. }
  8202. };
  8203. const offDraggable = () => {
  8204. if (dragRef.value && targetRef.value) {
  8205. dragRef.value.removeEventListener("mousedown", onMousedown);
  8206. }
  8207. };
  8208. const resetPosition = () => {
  8209. transform = {
  8210. offsetX: 0,
  8211. offsetY: 0
  8212. };
  8213. if (targetRef.value) {
  8214. targetRef.value.style.transform = "none";
  8215. }
  8216. };
  8217. onMounted(() => {
  8218. watchEffect(() => {
  8219. if (draggable.value) {
  8220. onDraggable();
  8221. } else {
  8222. offDraggable();
  8223. }
  8224. });
  8225. });
  8226. onBeforeUnmount(() => {
  8227. offDraggable();
  8228. });
  8229. return {
  8230. resetPosition
  8231. };
  8232. };
  8233. const useFocus = (el) => {
  8234. return {
  8235. focus: () => {
  8236. var _a, _b;
  8237. (_b = (_a = el.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  8238. }
  8239. };
  8240. };
  8241. var English = {
  8242. name: "en",
  8243. el: {
  8244. breadcrumb: {
  8245. label: "Breadcrumb"
  8246. },
  8247. colorpicker: {
  8248. confirm: "OK",
  8249. clear: "Clear",
  8250. defaultLabel: "color picker",
  8251. description: "current color is {color}. press enter to select a new color.",
  8252. alphaLabel: "pick alpha value"
  8253. },
  8254. datepicker: {
  8255. now: "Now",
  8256. today: "Today",
  8257. cancel: "Cancel",
  8258. clear: "Clear",
  8259. confirm: "OK",
  8260. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  8261. monthTablePrompt: "Use the arrow keys and enter to select the month",
  8262. yearTablePrompt: "Use the arrow keys and enter to select the year",
  8263. selectedDate: "Selected date",
  8264. selectDate: "Select date",
  8265. selectTime: "Select time",
  8266. startDate: "Start Date",
  8267. startTime: "Start Time",
  8268. endDate: "End Date",
  8269. endTime: "End Time",
  8270. prevYear: "Previous Year",
  8271. nextYear: "Next Year",
  8272. prevMonth: "Previous Month",
  8273. nextMonth: "Next Month",
  8274. year: "",
  8275. month1: "January",
  8276. month2: "February",
  8277. month3: "March",
  8278. month4: "April",
  8279. month5: "May",
  8280. month6: "June",
  8281. month7: "July",
  8282. month8: "August",
  8283. month9: "September",
  8284. month10: "October",
  8285. month11: "November",
  8286. month12: "December",
  8287. week: "week",
  8288. weeks: {
  8289. sun: "Sun",
  8290. mon: "Mon",
  8291. tue: "Tue",
  8292. wed: "Wed",
  8293. thu: "Thu",
  8294. fri: "Fri",
  8295. sat: "Sat"
  8296. },
  8297. weeksFull: {
  8298. sun: "Sunday",
  8299. mon: "Monday",
  8300. tue: "Tuesday",
  8301. wed: "Wednesday",
  8302. thu: "Thursday",
  8303. fri: "Friday",
  8304. sat: "Saturday"
  8305. },
  8306. months: {
  8307. jan: "Jan",
  8308. feb: "Feb",
  8309. mar: "Mar",
  8310. apr: "Apr",
  8311. may: "May",
  8312. jun: "Jun",
  8313. jul: "Jul",
  8314. aug: "Aug",
  8315. sep: "Sep",
  8316. oct: "Oct",
  8317. nov: "Nov",
  8318. dec: "Dec"
  8319. }
  8320. },
  8321. inputNumber: {
  8322. decrease: "decrease number",
  8323. increase: "increase number"
  8324. },
  8325. select: {
  8326. loading: "Loading",
  8327. noMatch: "No matching data",
  8328. noData: "No data",
  8329. placeholder: "Select"
  8330. },
  8331. mention: {
  8332. loading: "Loading"
  8333. },
  8334. dropdown: {
  8335. toggleDropdown: "Toggle Dropdown"
  8336. },
  8337. cascader: {
  8338. noMatch: "No matching data",
  8339. loading: "Loading",
  8340. placeholder: "Select",
  8341. noData: "No data"
  8342. },
  8343. pagination: {
  8344. goto: "Go to",
  8345. pagesize: "/page",
  8346. total: "Total {total}",
  8347. pageClassifier: "",
  8348. page: "Page",
  8349. prev: "Go to previous page",
  8350. next: "Go to next page",
  8351. currentPage: "page {pager}",
  8352. prevPages: "Previous {pager} pages",
  8353. nextPages: "Next {pager} pages",
  8354. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  8355. },
  8356. dialog: {
  8357. close: "Close this dialog"
  8358. },
  8359. drawer: {
  8360. close: "Close this dialog"
  8361. },
  8362. messagebox: {
  8363. title: "Message",
  8364. confirm: "OK",
  8365. cancel: "Cancel",
  8366. error: "Illegal input",
  8367. close: "Close this dialog"
  8368. },
  8369. upload: {
  8370. deleteTip: "press delete to remove",
  8371. delete: "Delete",
  8372. preview: "Preview",
  8373. continue: "Continue"
  8374. },
  8375. slider: {
  8376. defaultLabel: "slider between {min} and {max}",
  8377. defaultRangeStartLabel: "pick start value",
  8378. defaultRangeEndLabel: "pick end value"
  8379. },
  8380. table: {
  8381. emptyText: "No Data",
  8382. confirmFilter: "Confirm",
  8383. resetFilter: "Reset",
  8384. clearFilter: "All",
  8385. sumText: "Sum"
  8386. },
  8387. tour: {
  8388. next: "Next",
  8389. previous: "Previous",
  8390. finish: "Finish"
  8391. },
  8392. tree: {
  8393. emptyText: "No Data"
  8394. },
  8395. transfer: {
  8396. noMatch: "No matching data",
  8397. noData: "No data",
  8398. titles: ["List 1", "List 2"],
  8399. filterPlaceholder: "Enter keyword",
  8400. noCheckedFormat: "{total} items",
  8401. hasCheckedFormat: "{checked}/{total} checked"
  8402. },
  8403. image: {
  8404. error: "FAILED"
  8405. },
  8406. pageHeader: {
  8407. title: "Back"
  8408. },
  8409. popconfirm: {
  8410. confirmButtonText: "Yes",
  8411. cancelButtonText: "No"
  8412. },
  8413. carousel: {
  8414. leftArrow: "Carousel arrow left",
  8415. rightArrow: "Carousel arrow right",
  8416. indicator: "Carousel switch to index {index}"
  8417. }
  8418. }
  8419. };
  8420. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  8421. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
  8422. var _a;
  8423. return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
  8424. });
  8425. const buildLocaleContext = (locale) => {
  8426. const lang = computed(() => unref(locale).name);
  8427. const localeRef = isRef(locale) ? locale : ref(locale);
  8428. return {
  8429. lang,
  8430. locale: localeRef,
  8431. t: buildTranslator(locale)
  8432. };
  8433. };
  8434. const localeContextKey = Symbol("localeContextKey");
  8435. const useLocale = (localeOverrides) => {
  8436. const locale = localeOverrides || inject(localeContextKey, ref());
  8437. return buildLocaleContext(computed(() => locale.value || English));
  8438. };
  8439. const defaultNamespace = "el";
  8440. const statePrefix = "is-";
  8441. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  8442. let cls = `${namespace}-${block}`;
  8443. if (blockSuffix) {
  8444. cls += `-${blockSuffix}`;
  8445. }
  8446. if (element) {
  8447. cls += `__${element}`;
  8448. }
  8449. if (modifier) {
  8450. cls += `--${modifier}`;
  8451. }
  8452. return cls;
  8453. };
  8454. const namespaceContextKey = Symbol("namespaceContextKey");
  8455. const useGetDerivedNamespace = (namespaceOverrides) => {
  8456. const derivedNamespace = namespaceOverrides || (getCurrentInstance() ? inject(namespaceContextKey, ref(defaultNamespace)) : ref(defaultNamespace));
  8457. const namespace = computed(() => {
  8458. return unref(derivedNamespace) || defaultNamespace;
  8459. });
  8460. return namespace;
  8461. };
  8462. const useNamespace = (block, namespaceOverrides) => {
  8463. const namespace = useGetDerivedNamespace(namespaceOverrides);
  8464. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  8465. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  8466. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  8467. const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  8468. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  8469. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  8470. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  8471. const is = (name, ...args) => {
  8472. const state = args.length >= 1 ? args[0] : true;
  8473. return name && state ? `${statePrefix}${name}` : "";
  8474. };
  8475. const cssVar = (object) => {
  8476. const styles = {};
  8477. for (const key in object) {
  8478. if (object[key]) {
  8479. styles[`--${namespace.value}-${key}`] = object[key];
  8480. }
  8481. }
  8482. return styles;
  8483. };
  8484. const cssVarBlock = (object) => {
  8485. const styles = {};
  8486. for (const key in object) {
  8487. if (object[key]) {
  8488. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  8489. }
  8490. }
  8491. return styles;
  8492. };
  8493. const cssVarName = (name) => `--${namespace.value}-${name}`;
  8494. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  8495. return {
  8496. namespace,
  8497. b,
  8498. e,
  8499. m,
  8500. be,
  8501. em,
  8502. bm,
  8503. bem,
  8504. is,
  8505. cssVar,
  8506. cssVarName,
  8507. cssVarBlock,
  8508. cssVarBlockName
  8509. };
  8510. };
  8511. const useLockscreen = (trigger, options = {}) => {
  8512. if (!isRef(trigger)) {
  8513. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  8514. }
  8515. const ns = options.ns || useNamespace("popup");
  8516. const hiddenCls = computed(() => ns.bm("parent", "hidden"));
  8517. if (!isClient || hasClass(document.body, hiddenCls.value)) {
  8518. return;
  8519. }
  8520. let scrollBarWidth = 0;
  8521. let withoutHiddenClass = false;
  8522. let bodyWidth = "0";
  8523. const cleanup = () => {
  8524. setTimeout(() => {
  8525. if (typeof document === "undefined")
  8526. return;
  8527. removeClass(document == null ? void 0 : document.body, hiddenCls.value);
  8528. if (withoutHiddenClass && document) {
  8529. document.body.style.width = bodyWidth;
  8530. }
  8531. }, 200);
  8532. };
  8533. watch(trigger, (val) => {
  8534. if (!val) {
  8535. cleanup();
  8536. return;
  8537. }
  8538. withoutHiddenClass = !hasClass(document.body, hiddenCls.value);
  8539. if (withoutHiddenClass) {
  8540. bodyWidth = document.body.style.width;
  8541. }
  8542. scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  8543. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  8544. const bodyOverflowY = getStyle(document.body, "overflowY");
  8545. if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  8546. document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
  8547. }
  8548. addClass(document.body, hiddenCls.value);
  8549. });
  8550. onScopeDispose(() => cleanup());
  8551. };
  8552. const modalStack = [];
  8553. const closeModal = (e) => {
  8554. if (modalStack.length === 0)
  8555. return;
  8556. if (e.code === EVENT_CODE.esc) {
  8557. e.stopPropagation();
  8558. const topModal = modalStack[modalStack.length - 1];
  8559. topModal.handleClose();
  8560. }
  8561. };
  8562. const useModal = (instance, visibleRef) => {
  8563. watch(visibleRef, (val) => {
  8564. if (val) {
  8565. modalStack.push(instance);
  8566. } else {
  8567. modalStack.splice(modalStack.indexOf(instance), 1);
  8568. }
  8569. });
  8570. };
  8571. if (isClient)
  8572. useEventListener(document, "keydown", closeModal);
  8573. const _prop = buildProp({
  8574. type: definePropType(Boolean),
  8575. default: null
  8576. });
  8577. const _event = buildProp({
  8578. type: definePropType(Function)
  8579. });
  8580. const createModelToggleComposable = (name) => {
  8581. const updateEventKey = `update:${name}`;
  8582. const updateEventKeyRaw = `onUpdate:${name}`;
  8583. const useModelToggleEmits2 = [updateEventKey];
  8584. const useModelToggleProps2 = {
  8585. [name]: _prop,
  8586. [updateEventKeyRaw]: _event
  8587. };
  8588. const useModelToggle2 = ({
  8589. indicator,
  8590. toggleReason,
  8591. shouldHideWhenRouteChanges,
  8592. shouldProceed,
  8593. onShow,
  8594. onHide
  8595. }) => {
  8596. const instance = getCurrentInstance();
  8597. const { emit } = instance;
  8598. const props = instance.props;
  8599. const hasUpdateHandler = computed(() => isFunction$1(props[updateEventKeyRaw]));
  8600. const isModelBindingAbsent = computed(() => props[name] === null);
  8601. const doShow = (event) => {
  8602. if (indicator.value === true) {
  8603. return;
  8604. }
  8605. indicator.value = true;
  8606. if (toggleReason) {
  8607. toggleReason.value = event;
  8608. }
  8609. if (isFunction$1(onShow)) {
  8610. onShow(event);
  8611. }
  8612. };
  8613. const doHide = (event) => {
  8614. if (indicator.value === false) {
  8615. return;
  8616. }
  8617. indicator.value = false;
  8618. if (toggleReason) {
  8619. toggleReason.value = event;
  8620. }
  8621. if (isFunction$1(onHide)) {
  8622. onHide(event);
  8623. }
  8624. };
  8625. const show = (event) => {
  8626. if (props.disabled === true || isFunction$1(shouldProceed) && !shouldProceed())
  8627. return;
  8628. const shouldEmit = hasUpdateHandler.value && isClient;
  8629. if (shouldEmit) {
  8630. emit(updateEventKey, true);
  8631. }
  8632. if (isModelBindingAbsent.value || !shouldEmit) {
  8633. doShow(event);
  8634. }
  8635. };
  8636. const hide = (event) => {
  8637. if (props.disabled === true || !isClient)
  8638. return;
  8639. const shouldEmit = hasUpdateHandler.value && isClient;
  8640. if (shouldEmit) {
  8641. emit(updateEventKey, false);
  8642. }
  8643. if (isModelBindingAbsent.value || !shouldEmit) {
  8644. doHide(event);
  8645. }
  8646. };
  8647. const onChange = (val) => {
  8648. if (!isBoolean(val))
  8649. return;
  8650. if (props.disabled && val) {
  8651. if (hasUpdateHandler.value) {
  8652. emit(updateEventKey, false);
  8653. }
  8654. } else if (indicator.value !== val) {
  8655. if (val) {
  8656. doShow();
  8657. } else {
  8658. doHide();
  8659. }
  8660. }
  8661. };
  8662. const toggle = () => {
  8663. if (indicator.value) {
  8664. hide();
  8665. } else {
  8666. show();
  8667. }
  8668. };
  8669. watch(() => props[name], onChange);
  8670. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  8671. watch(() => ({
  8672. ...instance.proxy.$route
  8673. }), () => {
  8674. if (shouldHideWhenRouteChanges.value && indicator.value) {
  8675. hide();
  8676. }
  8677. });
  8678. }
  8679. onMounted(() => {
  8680. onChange(props[name]);
  8681. });
  8682. return {
  8683. hide,
  8684. show,
  8685. toggle,
  8686. hasUpdateHandler
  8687. };
  8688. };
  8689. return {
  8690. useModelToggle: useModelToggle2,
  8691. useModelToggleProps: useModelToggleProps2,
  8692. useModelToggleEmits: useModelToggleEmits2
  8693. };
  8694. };
  8695. const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue");
  8696. const usePreventGlobal = (indicator, evt, cb) => {
  8697. const prevent = (e) => {
  8698. if (cb(e))
  8699. e.stopImmediatePropagation();
  8700. };
  8701. let stop = void 0;
  8702. watch(() => indicator.value, (val) => {
  8703. if (val) {
  8704. stop = useEventListener(document, evt, prevent, true);
  8705. } else {
  8706. stop == null ? void 0 : stop();
  8707. }
  8708. }, { immediate: true });
  8709. };
  8710. const useProp = (name) => {
  8711. const vm = getCurrentInstance();
  8712. return computed(() => {
  8713. var _a, _b;
  8714. return (_b = (_a = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a.$props) == null ? void 0 : _b[name];
  8715. });
  8716. };
  8717. 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});
  8718. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  8719. const stateUpdater = {
  8720. name: "updateState",
  8721. enabled: true,
  8722. phase: "write",
  8723. fn: ({ state }) => {
  8724. const derivedState = deriveState(state);
  8725. Object.assign(states.value, derivedState);
  8726. },
  8727. requires: ["computeStyles"]
  8728. };
  8729. const options = computed(() => {
  8730. const { onFirstUpdate, placement, strategy, modifiers } = unref(opts);
  8731. return {
  8732. onFirstUpdate,
  8733. placement: placement || "bottom",
  8734. strategy: strategy || "absolute",
  8735. modifiers: [
  8736. ...modifiers || [],
  8737. stateUpdater,
  8738. { name: "applyStyles", enabled: false }
  8739. ]
  8740. };
  8741. });
  8742. const instanceRef = shallowRef();
  8743. const states = ref({
  8744. styles: {
  8745. popper: {
  8746. position: unref(options).strategy,
  8747. left: "0",
  8748. top: "0"
  8749. },
  8750. arrow: {
  8751. position: "absolute"
  8752. }
  8753. },
  8754. attributes: {}
  8755. });
  8756. const destroy = () => {
  8757. if (!instanceRef.value)
  8758. return;
  8759. instanceRef.value.destroy();
  8760. instanceRef.value = void 0;
  8761. };
  8762. watch(options, (newOptions) => {
  8763. const instance = unref(instanceRef);
  8764. if (instance) {
  8765. instance.setOptions(newOptions);
  8766. }
  8767. }, {
  8768. deep: true
  8769. });
  8770. watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  8771. destroy();
  8772. if (!referenceElement || !popperElement)
  8773. return;
  8774. instanceRef.value = yn(referenceElement, popperElement, unref(options));
  8775. });
  8776. onBeforeUnmount(() => {
  8777. destroy();
  8778. });
  8779. return {
  8780. state: computed(() => {
  8781. var _a;
  8782. return { ...((_a = unref(instanceRef)) == null ? void 0 : _a.state) || {} };
  8783. }),
  8784. styles: computed(() => unref(states).styles),
  8785. attributes: computed(() => unref(states).attributes),
  8786. update: () => {
  8787. var _a;
  8788. return (_a = unref(instanceRef)) == null ? void 0 : _a.update();
  8789. },
  8790. forceUpdate: () => {
  8791. var _a;
  8792. return (_a = unref(instanceRef)) == null ? void 0 : _a.forceUpdate();
  8793. },
  8794. instanceRef: computed(() => unref(instanceRef))
  8795. };
  8796. };
  8797. function deriveState(state) {
  8798. const elements = Object.keys(state.elements);
  8799. const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
  8800. const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
  8801. return {
  8802. styles,
  8803. attributes
  8804. };
  8805. }
  8806. const useSameTarget = (handleClick) => {
  8807. if (!handleClick) {
  8808. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  8809. }
  8810. let mousedownTarget = false;
  8811. let mouseupTarget = false;
  8812. const onClick = (e) => {
  8813. if (mousedownTarget && mouseupTarget) {
  8814. handleClick(e);
  8815. }
  8816. mousedownTarget = mouseupTarget = false;
  8817. };
  8818. const onMousedown = (e) => {
  8819. mousedownTarget = e.target === e.currentTarget;
  8820. };
  8821. const onMouseup = (e) => {
  8822. mouseupTarget = e.target === e.currentTarget;
  8823. };
  8824. return { onClick, onMousedown, onMouseup };
  8825. };
  8826. const useTeleport = (contentRenderer, appendToBody) => {
  8827. const isTeleportVisible = ref(false);
  8828. if (!isClient) {
  8829. return {
  8830. isTeleportVisible,
  8831. showTeleport: NOOP,
  8832. hideTeleport: NOOP,
  8833. renderTeleport: NOOP
  8834. };
  8835. }
  8836. let $el = null;
  8837. const showTeleport = () => {
  8838. isTeleportVisible.value = true;
  8839. if ($el !== null)
  8840. return;
  8841. $el = createGlobalNode();
  8842. };
  8843. const hideTeleport = () => {
  8844. isTeleportVisible.value = false;
  8845. if ($el !== null) {
  8846. removeGlobalNode($el);
  8847. $el = null;
  8848. }
  8849. };
  8850. const renderTeleport = () => {
  8851. return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [h$1(Teleport$1, { to: $el }, contentRenderer())] : void 0;
  8852. };
  8853. onUnmounted(hideTeleport);
  8854. return {
  8855. isTeleportVisible,
  8856. showTeleport,
  8857. hideTeleport,
  8858. renderTeleport
  8859. };
  8860. };
  8861. const useThrottleRender = (loading, throttle = 0) => {
  8862. if (throttle === 0)
  8863. return loading;
  8864. const initVal = isObject$1(throttle) && Boolean(throttle.initVal);
  8865. const throttled = ref(initVal);
  8866. let timeoutHandle = null;
  8867. const dispatchThrottling = (timer) => {
  8868. if (isUndefined(timer)) {
  8869. throttled.value = loading.value;
  8870. return;
  8871. }
  8872. if (timeoutHandle) {
  8873. clearTimeout(timeoutHandle);
  8874. }
  8875. timeoutHandle = setTimeout(() => {
  8876. throttled.value = loading.value;
  8877. }, timer);
  8878. };
  8879. const dispatcher = (type) => {
  8880. if (type === "leading") {
  8881. if (isNumber(throttle)) {
  8882. dispatchThrottling(throttle);
  8883. } else {
  8884. dispatchThrottling(throttle.leading);
  8885. }
  8886. } else {
  8887. if (isObject$1(throttle)) {
  8888. dispatchThrottling(throttle.trailing);
  8889. } else {
  8890. throttled.value = false;
  8891. }
  8892. }
  8893. };
  8894. onMounted(() => dispatcher("leading"));
  8895. watch(() => loading.value, (val) => {
  8896. dispatcher(val ? "leading" : "trailing");
  8897. });
  8898. return throttled;
  8899. };
  8900. function useTimeout() {
  8901. let timeoutHandle;
  8902. const registerTimeout = (fn, delay) => {
  8903. cancelTimeout();
  8904. timeoutHandle = window.setTimeout(fn, delay);
  8905. };
  8906. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  8907. tryOnScopeDispose(() => cancelTimeout());
  8908. return {
  8909. registerTimeout,
  8910. cancelTimeout
  8911. };
  8912. }
  8913. const AFTER_APPEAR = "after-appear";
  8914. const AFTER_ENTER = "after-enter";
  8915. const AFTER_LEAVE = "after-leave";
  8916. const APPEAR = "appear";
  8917. const APPEAR_CANCELLED = "appear-cancelled";
  8918. const BEFORE_ENTER = "before-enter";
  8919. const BEFORE_LEAVE = "before-leave";
  8920. const ENTER = "enter";
  8921. const ENTER_CANCELLED = "enter-cancelled";
  8922. const LEAVE = "leave";
  8923. const LEAVE_CANCELLED = "leave-cancelled";
  8924. const useTransitionFallthroughEmits = [
  8925. AFTER_APPEAR,
  8926. AFTER_ENTER,
  8927. AFTER_LEAVE,
  8928. APPEAR,
  8929. APPEAR_CANCELLED,
  8930. BEFORE_ENTER,
  8931. BEFORE_LEAVE,
  8932. ENTER,
  8933. ENTER_CANCELLED,
  8934. LEAVE,
  8935. LEAVE_CANCELLED
  8936. ];
  8937. const useTransitionFallthrough = () => {
  8938. const { emit } = getCurrentInstance();
  8939. return {
  8940. onAfterAppear: () => {
  8941. emit(AFTER_APPEAR);
  8942. },
  8943. onAfterEnter: () => {
  8944. emit(AFTER_ENTER);
  8945. },
  8946. onAfterLeave: () => {
  8947. emit(AFTER_LEAVE);
  8948. },
  8949. onAppearCancelled: () => {
  8950. emit(APPEAR_CANCELLED);
  8951. },
  8952. onBeforeEnter: () => {
  8953. emit(BEFORE_ENTER);
  8954. },
  8955. onBeforeLeave: () => {
  8956. emit(BEFORE_LEAVE);
  8957. },
  8958. onEnter: () => {
  8959. emit(ENTER);
  8960. },
  8961. onEnterCancelled: () => {
  8962. emit(ENTER_CANCELLED);
  8963. },
  8964. onLeave: () => {
  8965. emit(LEAVE);
  8966. },
  8967. onLeaveCancelled: () => {
  8968. emit(LEAVE_CANCELLED);
  8969. }
  8970. };
  8971. };
  8972. const defaultIdInjection = {
  8973. prefix: Math.floor(Math.random() * 1e4),
  8974. current: 0
  8975. };
  8976. const ID_INJECTION_KEY = Symbol("elIdInjection");
  8977. const useIdInjection = () => {
  8978. return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  8979. };
  8980. const useId = (deterministicId) => {
  8981. const idInjection = useIdInjection();
  8982. const namespace = useGetDerivedNamespace();
  8983. const idRef = computedEager(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  8984. return idRef;
  8985. };
  8986. let registeredEscapeHandlers = [];
  8987. const cachedHandler = (event) => {
  8988. if (event.code === EVENT_CODE.esc) {
  8989. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  8990. }
  8991. };
  8992. const useEscapeKeydown = (handler) => {
  8993. onMounted(() => {
  8994. if (registeredEscapeHandlers.length === 0) {
  8995. document.addEventListener("keydown", cachedHandler);
  8996. }
  8997. if (isClient)
  8998. registeredEscapeHandlers.push(handler);
  8999. });
  9000. onBeforeUnmount(() => {
  9001. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  9002. if (registeredEscapeHandlers.length === 0) {
  9003. if (isClient)
  9004. document.removeEventListener("keydown", cachedHandler);
  9005. }
  9006. });
  9007. };
  9008. const usePopperContainerId = () => {
  9009. const namespace = useGetDerivedNamespace();
  9010. const idInjection = useIdInjection();
  9011. const id = computed(() => {
  9012. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  9013. });
  9014. const selector = computed(() => `#${id.value}`);
  9015. return {
  9016. id,
  9017. selector
  9018. };
  9019. };
  9020. const createContainer = (id) => {
  9021. const container = document.createElement("div");
  9022. container.id = id;
  9023. document.body.appendChild(container);
  9024. return container;
  9025. };
  9026. const usePopperContainer = () => {
  9027. const { id, selector } = usePopperContainerId();
  9028. onBeforeMount(() => {
  9029. if (!isClient)
  9030. return;
  9031. if (!document.body.querySelector(selector.value)) {
  9032. createContainer(id.value);
  9033. }
  9034. });
  9035. return {
  9036. id,
  9037. selector
  9038. };
  9039. };
  9040. const useDelayedRender = ({
  9041. indicator,
  9042. intermediateIndicator,
  9043. shouldSetIntermediate = () => true,
  9044. beforeShow,
  9045. afterShow,
  9046. afterHide,
  9047. beforeHide
  9048. }) => {
  9049. watch(() => unref(indicator), (val) => {
  9050. if (val) {
  9051. beforeShow == null ? void 0 : beforeShow();
  9052. nextTick(() => {
  9053. if (!unref(indicator))
  9054. return;
  9055. if (shouldSetIntermediate("show")) {
  9056. intermediateIndicator.value = true;
  9057. }
  9058. });
  9059. } else {
  9060. beforeHide == null ? void 0 : beforeHide();
  9061. nextTick(() => {
  9062. if (unref(indicator))
  9063. return;
  9064. if (shouldSetIntermediate("hide")) {
  9065. intermediateIndicator.value = false;
  9066. }
  9067. });
  9068. }
  9069. });
  9070. watch(() => intermediateIndicator.value, (val) => {
  9071. if (val) {
  9072. afterShow == null ? void 0 : afterShow();
  9073. } else {
  9074. afterHide == null ? void 0 : afterHide();
  9075. }
  9076. });
  9077. };
  9078. const useDelayedToggleProps = buildProps({
  9079. showAfter: {
  9080. type: Number,
  9081. default: 0
  9082. },
  9083. hideAfter: {
  9084. type: Number,
  9085. default: 200
  9086. },
  9087. autoClose: {
  9088. type: Number,
  9089. default: 0
  9090. }
  9091. });
  9092. const useDelayedToggle = ({
  9093. showAfter,
  9094. hideAfter,
  9095. autoClose,
  9096. open,
  9097. close
  9098. }) => {
  9099. const { registerTimeout } = useTimeout();
  9100. const {
  9101. registerTimeout: registerTimeoutForAutoClose,
  9102. cancelTimeout: cancelTimeoutForAutoClose
  9103. } = useTimeout();
  9104. const onOpen = (event) => {
  9105. registerTimeout(() => {
  9106. open(event);
  9107. const _autoClose = unref(autoClose);
  9108. if (isNumber(_autoClose) && _autoClose > 0) {
  9109. registerTimeoutForAutoClose(() => {
  9110. close(event);
  9111. }, _autoClose);
  9112. }
  9113. }, unref(showAfter));
  9114. };
  9115. const onClose = (event) => {
  9116. cancelTimeoutForAutoClose();
  9117. registerTimeout(() => {
  9118. close(event);
  9119. }, unref(hideAfter));
  9120. };
  9121. return {
  9122. onOpen,
  9123. onClose
  9124. };
  9125. };
  9126. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  9127. const useForwardRef = (forwardRef) => {
  9128. const setForwardRef = (el) => {
  9129. forwardRef.value = el;
  9130. };
  9131. provide(FORWARD_REF_INJECTION_KEY, {
  9132. setForwardRef
  9133. });
  9134. };
  9135. const useForwardRefDirective = (setForwardRef) => {
  9136. return {
  9137. mounted(el) {
  9138. setForwardRef(el);
  9139. },
  9140. updated(el) {
  9141. setForwardRef(el);
  9142. },
  9143. unmounted() {
  9144. setForwardRef(null);
  9145. }
  9146. };
  9147. };
  9148. const initial = {
  9149. current: 0
  9150. };
  9151. const zIndex = ref(0);
  9152. const defaultInitialZIndex = 2e3;
  9153. const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
  9154. const zIndexContextKey = Symbol("zIndexContextKey");
  9155. const useZIndex = (zIndexOverrides) => {
  9156. const increasingInjection = getCurrentInstance() ? inject(ZINDEX_INJECTION_KEY, initial) : initial;
  9157. const zIndexInjection = zIndexOverrides || (getCurrentInstance() ? inject(zIndexContextKey, void 0) : void 0);
  9158. const initialZIndex = computed(() => {
  9159. const zIndexFromInjection = unref(zIndexInjection);
  9160. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  9161. });
  9162. const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
  9163. const nextZIndex = () => {
  9164. increasingInjection.current++;
  9165. zIndex.value = increasingInjection.current;
  9166. return currentZIndex.value;
  9167. };
  9168. if (!isClient && !inject(ZINDEX_INJECTION_KEY)) ;
  9169. return {
  9170. initialZIndex,
  9171. currentZIndex,
  9172. nextZIndex
  9173. };
  9174. };
  9175. function getSide(placement) {
  9176. return placement.split('-')[0];
  9177. }
  9178. function getAlignment(placement) {
  9179. return placement.split('-')[1];
  9180. }
  9181. function getMainAxisFromPlacement(placement) {
  9182. return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
  9183. }
  9184. function getLengthFromAxis(axis) {
  9185. return axis === 'y' ? 'height' : 'width';
  9186. }
  9187. function computeCoordsFromPlacement(_ref, placement, rtl) {
  9188. let {
  9189. reference,
  9190. floating
  9191. } = _ref;
  9192. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  9193. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  9194. const mainAxis = getMainAxisFromPlacement(placement);
  9195. const length = getLengthFromAxis(mainAxis);
  9196. const commonAlign = reference[length] / 2 - floating[length] / 2;
  9197. const side = getSide(placement);
  9198. const isVertical = mainAxis === 'x';
  9199. let coords;
  9200. switch (side) {
  9201. case 'top':
  9202. coords = {
  9203. x: commonX,
  9204. y: reference.y - floating.height
  9205. };
  9206. break;
  9207. case 'bottom':
  9208. coords = {
  9209. x: commonX,
  9210. y: reference.y + reference.height
  9211. };
  9212. break;
  9213. case 'right':
  9214. coords = {
  9215. x: reference.x + reference.width,
  9216. y: commonY
  9217. };
  9218. break;
  9219. case 'left':
  9220. coords = {
  9221. x: reference.x - floating.width,
  9222. y: commonY
  9223. };
  9224. break;
  9225. default:
  9226. coords = {
  9227. x: reference.x,
  9228. y: reference.y
  9229. };
  9230. }
  9231. switch (getAlignment(placement)) {
  9232. case 'start':
  9233. coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  9234. break;
  9235. case 'end':
  9236. coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  9237. break;
  9238. }
  9239. return coords;
  9240. }
  9241. /**
  9242. * Computes the `x` and `y` coordinates that will place the floating element
  9243. * next to a reference element when it is given a certain positioning strategy.
  9244. *
  9245. * This export does not have any `platform` interface logic. You will need to
  9246. * write one for the platform you are using Floating UI with.
  9247. */
  9248. const computePosition$1 = async (reference, floating, config) => {
  9249. const {
  9250. placement = 'bottom',
  9251. strategy = 'absolute',
  9252. middleware = [],
  9253. platform
  9254. } = config;
  9255. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  9256. let rects = await platform.getElementRects({
  9257. reference,
  9258. floating,
  9259. strategy
  9260. });
  9261. let {
  9262. x,
  9263. y
  9264. } = computeCoordsFromPlacement(rects, placement, rtl);
  9265. let statefulPlacement = placement;
  9266. let middlewareData = {};
  9267. let resetCount = 0;
  9268. for (let i = 0; i < middleware.length; i++) {
  9269. const {
  9270. name,
  9271. fn
  9272. } = middleware[i];
  9273. const {
  9274. x: nextX,
  9275. y: nextY,
  9276. data,
  9277. reset
  9278. } = await fn({
  9279. x,
  9280. y,
  9281. initialPlacement: placement,
  9282. placement: statefulPlacement,
  9283. strategy,
  9284. middlewareData,
  9285. rects,
  9286. platform,
  9287. elements: {
  9288. reference,
  9289. floating
  9290. }
  9291. });
  9292. x = nextX != null ? nextX : x;
  9293. y = nextY != null ? nextY : y;
  9294. middlewareData = { ...middlewareData,
  9295. [name]: { ...middlewareData[name],
  9296. ...data
  9297. }
  9298. };
  9299. if (reset && resetCount <= 50) {
  9300. resetCount++;
  9301. if (typeof reset === 'object') {
  9302. if (reset.placement) {
  9303. statefulPlacement = reset.placement;
  9304. }
  9305. if (reset.rects) {
  9306. rects = reset.rects === true ? await platform.getElementRects({
  9307. reference,
  9308. floating,
  9309. strategy
  9310. }) : reset.rects;
  9311. }
  9312. ({
  9313. x,
  9314. y
  9315. } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  9316. }
  9317. i = -1;
  9318. continue;
  9319. }
  9320. }
  9321. return {
  9322. x,
  9323. y,
  9324. placement: statefulPlacement,
  9325. strategy,
  9326. middlewareData
  9327. };
  9328. };
  9329. function expandPaddingObject(padding) {
  9330. return {
  9331. top: 0,
  9332. right: 0,
  9333. bottom: 0,
  9334. left: 0,
  9335. ...padding
  9336. };
  9337. }
  9338. function getSideObjectFromPadding(padding) {
  9339. return typeof padding !== 'number' ? expandPaddingObject(padding) : {
  9340. top: padding,
  9341. right: padding,
  9342. bottom: padding,
  9343. left: padding
  9344. };
  9345. }
  9346. function rectToClientRect(rect) {
  9347. return { ...rect,
  9348. top: rect.y,
  9349. left: rect.x,
  9350. right: rect.x + rect.width,
  9351. bottom: rect.y + rect.height
  9352. };
  9353. }
  9354. /**
  9355. * Resolves with an object of overflow side offsets that determine how much the
  9356. * element is overflowing a given clipping boundary.
  9357. * - positive = overflowing the boundary by that number of pixels
  9358. * - negative = how many pixels left before it will overflow
  9359. * - 0 = lies flush with the boundary
  9360. * @see https://floating-ui.com/docs/detectOverflow
  9361. */
  9362. async function detectOverflow(middlewareArguments, options) {
  9363. var _await$platform$isEle;
  9364. if (options === void 0) {
  9365. options = {};
  9366. }
  9367. const {
  9368. x,
  9369. y,
  9370. platform,
  9371. rects,
  9372. elements,
  9373. strategy
  9374. } = middlewareArguments;
  9375. const {
  9376. boundary = 'clippingAncestors',
  9377. rootBoundary = 'viewport',
  9378. elementContext = 'floating',
  9379. altBoundary = false,
  9380. padding = 0
  9381. } = options;
  9382. const paddingObject = getSideObjectFromPadding(padding);
  9383. const altContext = elementContext === 'floating' ? 'reference' : 'floating';
  9384. const element = elements[altBoundary ? altContext : elementContext];
  9385. const clippingClientRect = rectToClientRect(await platform.getClippingRect({
  9386. 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))),
  9387. boundary,
  9388. rootBoundary,
  9389. strategy
  9390. }));
  9391. const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
  9392. rect: elementContext === 'floating' ? { ...rects.floating,
  9393. x,
  9394. y
  9395. } : rects.reference,
  9396. offsetParent: await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating)),
  9397. strategy
  9398. }) : rects[elementContext]);
  9399. return {
  9400. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  9401. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  9402. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  9403. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  9404. };
  9405. }
  9406. const min$2 = Math.min;
  9407. const max$2 = Math.max;
  9408. function within(min$1, value, max$1) {
  9409. return max$2(min$1, min$2(value, max$1));
  9410. }
  9411. /**
  9412. * Positions an inner element of the floating element such that it is centered
  9413. * to the reference element.
  9414. * @see https://floating-ui.com/docs/arrow
  9415. */
  9416. const arrow = options => ({
  9417. name: 'arrow',
  9418. options,
  9419. async fn(middlewareArguments) {
  9420. // Since `element` is required, we don't Partial<> the type
  9421. const {
  9422. element,
  9423. padding = 0
  9424. } = options != null ? options : {};
  9425. const {
  9426. x,
  9427. y,
  9428. placement,
  9429. rects,
  9430. platform
  9431. } = middlewareArguments;
  9432. if (element == null) {
  9433. return {};
  9434. }
  9435. const paddingObject = getSideObjectFromPadding(padding);
  9436. const coords = {
  9437. x,
  9438. y
  9439. };
  9440. const axis = getMainAxisFromPlacement(placement);
  9441. const alignment = getAlignment(placement);
  9442. const length = getLengthFromAxis(axis);
  9443. const arrowDimensions = await platform.getDimensions(element);
  9444. const minProp = axis === 'y' ? 'top' : 'left';
  9445. const maxProp = axis === 'y' ? 'bottom' : 'right';
  9446. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  9447. const startDiff = coords[axis] - rects.reference[axis];
  9448. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  9449. let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  9450. if (clientSize === 0) {
  9451. clientSize = rects.floating[length];
  9452. }
  9453. const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
  9454. // point is outside the floating element's bounds
  9455. const min = paddingObject[minProp];
  9456. const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
  9457. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  9458. const offset = within(min, center, max); // Make sure that arrow points at the reference
  9459. const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
  9460. const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
  9461. const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
  9462. return {
  9463. [axis]: coords[axis] - alignmentOffset,
  9464. data: {
  9465. [axis]: offset,
  9466. centerOffset: center - offset
  9467. }
  9468. };
  9469. }
  9470. });
  9471. const hash$1 = {
  9472. left: 'right',
  9473. right: 'left',
  9474. bottom: 'top',
  9475. top: 'bottom'
  9476. };
  9477. function getOppositePlacement(placement) {
  9478. return placement.replace(/left|right|bottom|top/g, matched => hash$1[matched]);
  9479. }
  9480. function getAlignmentSides(placement, rects, rtl) {
  9481. if (rtl === void 0) {
  9482. rtl = false;
  9483. }
  9484. const alignment = getAlignment(placement);
  9485. const mainAxis = getMainAxisFromPlacement(placement);
  9486. const length = getLengthFromAxis(mainAxis);
  9487. let mainAlignmentSide = mainAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
  9488. if (rects.reference[length] > rects.floating[length]) {
  9489. mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
  9490. }
  9491. return {
  9492. main: mainAlignmentSide,
  9493. cross: getOppositePlacement(mainAlignmentSide)
  9494. };
  9495. }
  9496. const hash = {
  9497. start: 'end',
  9498. end: 'start'
  9499. };
  9500. function getOppositeAlignmentPlacement(placement) {
  9501. return placement.replace(/start|end/g, matched => hash[matched]);
  9502. }
  9503. function getExpandedPlacements(placement) {
  9504. const oppositePlacement = getOppositePlacement(placement);
  9505. return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
  9506. }
  9507. /**
  9508. * Changes the placement of the floating element to one that will fit if the
  9509. * initially specified `placement` does not.
  9510. * @see https://floating-ui.com/docs/flip
  9511. */
  9512. const flip = function (options) {
  9513. if (options === void 0) {
  9514. options = {};
  9515. }
  9516. return {
  9517. name: 'flip',
  9518. options,
  9519. async fn(middlewareArguments) {
  9520. var _middlewareData$flip;
  9521. const {
  9522. placement,
  9523. middlewareData,
  9524. rects,
  9525. initialPlacement,
  9526. platform,
  9527. elements
  9528. } = middlewareArguments;
  9529. const {
  9530. mainAxis: checkMainAxis = true,
  9531. crossAxis: checkCrossAxis = true,
  9532. fallbackPlacements: specifiedFallbackPlacements,
  9533. fallbackStrategy = 'bestFit',
  9534. flipAlignment = true,
  9535. ...detectOverflowOptions
  9536. } = options;
  9537. const side = getSide(placement);
  9538. const isBasePlacement = side === initialPlacement;
  9539. const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
  9540. const placements = [initialPlacement, ...fallbackPlacements];
  9541. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  9542. const overflows = [];
  9543. let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
  9544. if (checkMainAxis) {
  9545. overflows.push(overflow[side]);
  9546. }
  9547. if (checkCrossAxis) {
  9548. const {
  9549. main,
  9550. cross
  9551. } = getAlignmentSides(placement, rects, await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating)));
  9552. overflows.push(overflow[main], overflow[cross]);
  9553. }
  9554. overflowsData = [...overflowsData, {
  9555. placement,
  9556. overflows
  9557. }]; // One or more sides is overflowing
  9558. if (!overflows.every(side => side <= 0)) {
  9559. var _middlewareData$flip$, _middlewareData$flip2;
  9560. const nextIndex = ((_middlewareData$flip$ = (_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) != null ? _middlewareData$flip$ : 0) + 1;
  9561. const nextPlacement = placements[nextIndex];
  9562. if (nextPlacement) {
  9563. // Try next placement and re-run the lifecycle
  9564. return {
  9565. data: {
  9566. index: nextIndex,
  9567. overflows: overflowsData
  9568. },
  9569. reset: {
  9570. placement: nextPlacement
  9571. }
  9572. };
  9573. }
  9574. let resetPlacement = 'bottom';
  9575. switch (fallbackStrategy) {
  9576. case 'bestFit':
  9577. {
  9578. var _overflowsData$map$so;
  9579. 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;
  9580. if (placement) {
  9581. resetPlacement = placement;
  9582. }
  9583. break;
  9584. }
  9585. case 'initialPlacement':
  9586. resetPlacement = initialPlacement;
  9587. break;
  9588. }
  9589. if (placement !== resetPlacement) {
  9590. return {
  9591. reset: {
  9592. placement: resetPlacement
  9593. }
  9594. };
  9595. }
  9596. }
  9597. return {};
  9598. }
  9599. };
  9600. };
  9601. async function convertValueToCoords(middlewareArguments, value) {
  9602. const {
  9603. placement,
  9604. platform,
  9605. elements
  9606. } = middlewareArguments;
  9607. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  9608. const side = getSide(placement);
  9609. const alignment = getAlignment(placement);
  9610. const isVertical = getMainAxisFromPlacement(placement) === 'x';
  9611. const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  9612. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  9613. const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
  9614. let {
  9615. mainAxis,
  9616. crossAxis,
  9617. alignmentAxis
  9618. } = typeof rawValue === 'number' ? {
  9619. mainAxis: rawValue,
  9620. crossAxis: 0,
  9621. alignmentAxis: null
  9622. } : {
  9623. mainAxis: 0,
  9624. crossAxis: 0,
  9625. alignmentAxis: null,
  9626. ...rawValue
  9627. };
  9628. if (alignment && typeof alignmentAxis === 'number') {
  9629. crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  9630. }
  9631. return isVertical ? {
  9632. x: crossAxis * crossAxisMulti,
  9633. y: mainAxis * mainAxisMulti
  9634. } : {
  9635. x: mainAxis * mainAxisMulti,
  9636. y: crossAxis * crossAxisMulti
  9637. };
  9638. }
  9639. /**
  9640. * Displaces the floating element from its reference element.
  9641. * @see https://floating-ui.com/docs/offset
  9642. */
  9643. const offset = function (value) {
  9644. if (value === void 0) {
  9645. value = 0;
  9646. }
  9647. return {
  9648. name: 'offset',
  9649. options: value,
  9650. async fn(middlewareArguments) {
  9651. const {
  9652. x,
  9653. y
  9654. } = middlewareArguments;
  9655. const diffCoords = await convertValueToCoords(middlewareArguments, value);
  9656. return {
  9657. x: x + diffCoords.x,
  9658. y: y + diffCoords.y,
  9659. data: diffCoords
  9660. };
  9661. }
  9662. };
  9663. };
  9664. function getCrossAxis(axis) {
  9665. return axis === 'x' ? 'y' : 'x';
  9666. }
  9667. /**
  9668. * Shifts the floating element in order to keep it in view when it will overflow
  9669. * a clipping boundary.
  9670. * @see https://floating-ui.com/docs/shift
  9671. */
  9672. const shift = function (options) {
  9673. if (options === void 0) {
  9674. options = {};
  9675. }
  9676. return {
  9677. name: 'shift',
  9678. options,
  9679. async fn(middlewareArguments) {
  9680. const {
  9681. x,
  9682. y,
  9683. placement
  9684. } = middlewareArguments;
  9685. const {
  9686. mainAxis: checkMainAxis = true,
  9687. crossAxis: checkCrossAxis = false,
  9688. limiter = {
  9689. fn: _ref => {
  9690. let {
  9691. x,
  9692. y
  9693. } = _ref;
  9694. return {
  9695. x,
  9696. y
  9697. };
  9698. }
  9699. },
  9700. ...detectOverflowOptions
  9701. } = options;
  9702. const coords = {
  9703. x,
  9704. y
  9705. };
  9706. const overflow = await detectOverflow(middlewareArguments, detectOverflowOptions);
  9707. const mainAxis = getMainAxisFromPlacement(getSide(placement));
  9708. const crossAxis = getCrossAxis(mainAxis);
  9709. let mainAxisCoord = coords[mainAxis];
  9710. let crossAxisCoord = coords[crossAxis];
  9711. if (checkMainAxis) {
  9712. const minSide = mainAxis === 'y' ? 'top' : 'left';
  9713. const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
  9714. const min = mainAxisCoord + overflow[minSide];
  9715. const max = mainAxisCoord - overflow[maxSide];
  9716. mainAxisCoord = within(min, mainAxisCoord, max);
  9717. }
  9718. if (checkCrossAxis) {
  9719. const minSide = crossAxis === 'y' ? 'top' : 'left';
  9720. const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
  9721. const min = crossAxisCoord + overflow[minSide];
  9722. const max = crossAxisCoord - overflow[maxSide];
  9723. crossAxisCoord = within(min, crossAxisCoord, max);
  9724. }
  9725. const limitedCoords = limiter.fn({ ...middlewareArguments,
  9726. [mainAxis]: mainAxisCoord,
  9727. [crossAxis]: crossAxisCoord
  9728. });
  9729. return { ...limitedCoords,
  9730. data: {
  9731. x: limitedCoords.x - x,
  9732. y: limitedCoords.y - y
  9733. }
  9734. };
  9735. }
  9736. };
  9737. };
  9738. function isWindow(value) {
  9739. return value && value.document && value.location && value.alert && value.setInterval;
  9740. }
  9741. function getWindow(node) {
  9742. if (node == null) {
  9743. return window;
  9744. }
  9745. if (!isWindow(node)) {
  9746. const ownerDocument = node.ownerDocument;
  9747. return ownerDocument ? ownerDocument.defaultView || window : window;
  9748. }
  9749. return node;
  9750. }
  9751. function getComputedStyle$1(element) {
  9752. return getWindow(element).getComputedStyle(element);
  9753. }
  9754. function getNodeName(node) {
  9755. return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
  9756. }
  9757. function getUAString() {
  9758. const uaData = navigator.userAgentData;
  9759. if (uaData != null && uaData.brands) {
  9760. return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
  9761. }
  9762. return navigator.userAgent;
  9763. }
  9764. function isHTMLElement(value) {
  9765. return value instanceof getWindow(value).HTMLElement;
  9766. }
  9767. function isElement(value) {
  9768. return value instanceof getWindow(value).Element;
  9769. }
  9770. function isNode(value) {
  9771. return value instanceof getWindow(value).Node;
  9772. }
  9773. function isShadowRoot(node) {
  9774. // Browsers without `ShadowRoot` support
  9775. if (typeof ShadowRoot === 'undefined') {
  9776. return false;
  9777. }
  9778. const OwnElement = getWindow(node).ShadowRoot;
  9779. return node instanceof OwnElement || node instanceof ShadowRoot;
  9780. }
  9781. function isOverflowElement(element) {
  9782. // Firefox wants us to check `-x` and `-y` variations as well
  9783. const {
  9784. overflow,
  9785. overflowX,
  9786. overflowY
  9787. } = getComputedStyle$1(element);
  9788. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  9789. }
  9790. function isTableElement(element) {
  9791. return ['table', 'td', 'th'].includes(getNodeName(element));
  9792. }
  9793. function isContainingBlock(element) {
  9794. // TODO: Try and use feature detection here instead
  9795. const isFirefox = /firefox/i.test(getUAString());
  9796. const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
  9797. // create a containing block.
  9798. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  9799. return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
  9800. css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
  9801. }
  9802. function isLayoutViewport() {
  9803. // Not Safari
  9804. return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
  9805. // • Always-visible scrollbar or not
  9806. // • Width of <html>, etc.
  9807. // const vV = win.visualViewport;
  9808. // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
  9809. }
  9810. const min$1 = Math.min;
  9811. const max$1 = Math.max;
  9812. const round = Math.round;
  9813. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  9814. var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
  9815. if (includeScale === void 0) {
  9816. includeScale = false;
  9817. }
  9818. if (isFixedStrategy === void 0) {
  9819. isFixedStrategy = false;
  9820. }
  9821. const clientRect = element.getBoundingClientRect();
  9822. let scaleX = 1;
  9823. let scaleY = 1;
  9824. if (includeScale && isHTMLElement(element)) {
  9825. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  9826. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  9827. }
  9828. const win = isElement(element) ? getWindow(element) : window;
  9829. const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  9830. 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;
  9831. 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;
  9832. const width = clientRect.width / scaleX;
  9833. const height = clientRect.height / scaleY;
  9834. return {
  9835. width,
  9836. height,
  9837. top: y,
  9838. right: x + width,
  9839. bottom: y + height,
  9840. left: x,
  9841. x,
  9842. y
  9843. };
  9844. }
  9845. function getDocumentElement(node) {
  9846. return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
  9847. }
  9848. function getNodeScroll(element) {
  9849. if (isElement(element)) {
  9850. return {
  9851. scrollLeft: element.scrollLeft,
  9852. scrollTop: element.scrollTop
  9853. };
  9854. }
  9855. return {
  9856. scrollLeft: element.pageXOffset,
  9857. scrollTop: element.pageYOffset
  9858. };
  9859. }
  9860. function getWindowScrollBarX(element) {
  9861. // If <html> has a CSS width greater than the viewport, then this will be
  9862. // incorrect for RTL.
  9863. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
  9864. }
  9865. function isScaled(element) {
  9866. const rect = getBoundingClientRect(element);
  9867. return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
  9868. }
  9869. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  9870. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9871. const documentElement = getDocumentElement(offsetParent);
  9872. const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
  9873. isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
  9874. let scroll = {
  9875. scrollLeft: 0,
  9876. scrollTop: 0
  9877. };
  9878. const offsets = {
  9879. x: 0,
  9880. y: 0
  9881. };
  9882. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  9883. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  9884. scroll = getNodeScroll(offsetParent);
  9885. }
  9886. if (isHTMLElement(offsetParent)) {
  9887. const offsetRect = getBoundingClientRect(offsetParent, true);
  9888. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9889. offsets.y = offsetRect.y + offsetParent.clientTop;
  9890. } else if (documentElement) {
  9891. offsets.x = getWindowScrollBarX(documentElement);
  9892. }
  9893. }
  9894. return {
  9895. x: rect.left + scroll.scrollLeft - offsets.x,
  9896. y: rect.top + scroll.scrollTop - offsets.y,
  9897. width: rect.width,
  9898. height: rect.height
  9899. };
  9900. }
  9901. function getParentNode(node) {
  9902. if (getNodeName(node) === 'html') {
  9903. return node;
  9904. }
  9905. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  9906. // @ts-ignore
  9907. node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  9908. node.parentNode || ( // DOM Element detected
  9909. isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
  9910. getDocumentElement(node) // fallback
  9911. );
  9912. }
  9913. function getTrueOffsetParent(element) {
  9914. if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
  9915. return null;
  9916. }
  9917. return composedOffsetParent(element);
  9918. }
  9919. /**
  9920. * Polyfills the old offsetParent behavior from before the spec was changed:
  9921. * https://github.com/w3c/csswg-drafts/issues/159
  9922. */
  9923. function composedOffsetParent(element) {
  9924. let {
  9925. offsetParent
  9926. } = element;
  9927. let ancestor = element;
  9928. let foundInsideSlot = false;
  9929. while (ancestor && ancestor !== offsetParent) {
  9930. const {
  9931. assignedSlot
  9932. } = ancestor;
  9933. if (assignedSlot) {
  9934. let newOffsetParent = assignedSlot.offsetParent;
  9935. if (getComputedStyle$1(assignedSlot).display === 'contents') {
  9936. const hadStyleAttribute = assignedSlot.hasAttribute('style');
  9937. const oldDisplay = assignedSlot.style.display;
  9938. assignedSlot.style.display = getComputedStyle$1(ancestor).display;
  9939. newOffsetParent = assignedSlot.offsetParent;
  9940. assignedSlot.style.display = oldDisplay;
  9941. if (!hadStyleAttribute) {
  9942. assignedSlot.removeAttribute('style');
  9943. }
  9944. }
  9945. ancestor = assignedSlot;
  9946. if (offsetParent !== newOffsetParent) {
  9947. offsetParent = newOffsetParent;
  9948. foundInsideSlot = true;
  9949. }
  9950. } else if (isShadowRoot(ancestor) && ancestor.host && foundInsideSlot) {
  9951. break;
  9952. }
  9953. ancestor = isShadowRoot(ancestor) && ancestor.host || ancestor.parentNode;
  9954. }
  9955. return offsetParent;
  9956. }
  9957. function getContainingBlock(element) {
  9958. let currentNode = getParentNode(element);
  9959. if (isShadowRoot(currentNode)) {
  9960. currentNode = currentNode.host;
  9961. }
  9962. while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
  9963. if (isContainingBlock(currentNode)) {
  9964. return currentNode;
  9965. } else {
  9966. const parent = currentNode.parentNode;
  9967. currentNode = isShadowRoot(parent) ? parent.host : parent;
  9968. }
  9969. }
  9970. return null;
  9971. } // Gets the closest ancestor positioned element. Handles some edge cases,
  9972. // such as table ancestors and cross browser bugs.
  9973. function getOffsetParent(element) {
  9974. const window = getWindow(element);
  9975. let offsetParent = getTrueOffsetParent(element);
  9976. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  9977. offsetParent = getTrueOffsetParent(offsetParent);
  9978. }
  9979. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
  9980. return window;
  9981. }
  9982. return offsetParent || getContainingBlock(element) || window;
  9983. }
  9984. function getDimensions(element) {
  9985. if (isHTMLElement(element)) {
  9986. return {
  9987. width: element.offsetWidth,
  9988. height: element.offsetHeight
  9989. };
  9990. }
  9991. const rect = getBoundingClientRect(element);
  9992. return {
  9993. width: rect.width,
  9994. height: rect.height
  9995. };
  9996. }
  9997. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  9998. let {
  9999. rect,
  10000. offsetParent,
  10001. strategy
  10002. } = _ref;
  10003. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  10004. const documentElement = getDocumentElement(offsetParent);
  10005. if (offsetParent === documentElement) {
  10006. return rect;
  10007. }
  10008. let scroll = {
  10009. scrollLeft: 0,
  10010. scrollTop: 0
  10011. };
  10012. const offsets = {
  10013. x: 0,
  10014. y: 0
  10015. };
  10016. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  10017. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  10018. scroll = getNodeScroll(offsetParent);
  10019. }
  10020. if (isHTMLElement(offsetParent)) {
  10021. const offsetRect = getBoundingClientRect(offsetParent, true);
  10022. offsets.x = offsetRect.x + offsetParent.clientLeft;
  10023. offsets.y = offsetRect.y + offsetParent.clientTop;
  10024. } // This doesn't appear to be need to be negated.
  10025. // else if (documentElement) {
  10026. // offsets.x = getWindowScrollBarX(documentElement);
  10027. // }
  10028. }
  10029. return { ...rect,
  10030. x: rect.x - scroll.scrollLeft + offsets.x,
  10031. y: rect.y - scroll.scrollTop + offsets.y
  10032. };
  10033. }
  10034. function getViewportRect(element, strategy) {
  10035. const win = getWindow(element);
  10036. const html = getDocumentElement(element);
  10037. const visualViewport = win.visualViewport;
  10038. let width = html.clientWidth;
  10039. let height = html.clientHeight;
  10040. let x = 0;
  10041. let y = 0;
  10042. if (visualViewport) {
  10043. width = visualViewport.width;
  10044. height = visualViewport.height;
  10045. const layoutViewport = isLayoutViewport();
  10046. if (layoutViewport || !layoutViewport && strategy === 'fixed') {
  10047. x = visualViewport.offsetLeft;
  10048. y = visualViewport.offsetTop;
  10049. }
  10050. }
  10051. return {
  10052. width,
  10053. height,
  10054. x,
  10055. y
  10056. };
  10057. }
  10058. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  10059. function getDocumentRect(element) {
  10060. var _element$ownerDocumen;
  10061. const html = getDocumentElement(element);
  10062. const scroll = getNodeScroll(element);
  10063. const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  10064. const width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  10065. const height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  10066. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  10067. const y = -scroll.scrollTop;
  10068. if (getComputedStyle$1(body || html).direction === 'rtl') {
  10069. x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width;
  10070. }
  10071. return {
  10072. width,
  10073. height,
  10074. x,
  10075. y
  10076. };
  10077. }
  10078. function getNearestOverflowAncestor(node) {
  10079. const parentNode = getParentNode(node);
  10080. if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
  10081. // @ts-ignore assume body is always available
  10082. return node.ownerDocument.body;
  10083. }
  10084. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
  10085. return parentNode;
  10086. }
  10087. return getNearestOverflowAncestor(parentNode);
  10088. }
  10089. function getOverflowAncestors(node, list) {
  10090. var _node$ownerDocument;
  10091. if (list === void 0) {
  10092. list = [];
  10093. }
  10094. const scrollableAncestor = getNearestOverflowAncestor(node);
  10095. const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
  10096. const win = getWindow(scrollableAncestor);
  10097. const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
  10098. const updatedList = list.concat(target);
  10099. return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
  10100. updatedList.concat(getOverflowAncestors(target));
  10101. }
  10102. function contains(parent, child) {
  10103. const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
  10104. if (parent.contains(child)) {
  10105. return true;
  10106. } // then fallback to custom implementation with Shadow DOM support
  10107. else if (rootNode && isShadowRoot(rootNode)) {
  10108. let next = child;
  10109. do {
  10110. // use `===` replace node.isSameNode()
  10111. if (next && parent === next) {
  10112. return true;
  10113. } // @ts-ignore: need a better way to handle this...
  10114. next = next.parentNode || next.host;
  10115. } while (next);
  10116. }
  10117. return false;
  10118. }
  10119. function getInnerBoundingClientRect(element, strategy) {
  10120. const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
  10121. const top = clientRect.top + element.clientTop;
  10122. const left = clientRect.left + element.clientLeft;
  10123. return {
  10124. top,
  10125. left,
  10126. x: left,
  10127. y: top,
  10128. right: left + element.clientWidth,
  10129. bottom: top + element.clientHeight,
  10130. width: element.clientWidth,
  10131. height: element.clientHeight
  10132. };
  10133. }
  10134. function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
  10135. if (clippingParent === 'viewport') {
  10136. return rectToClientRect(getViewportRect(element, strategy));
  10137. }
  10138. if (isElement(clippingParent)) {
  10139. return getInnerBoundingClientRect(clippingParent, strategy);
  10140. }
  10141. return rectToClientRect(getDocumentRect(getDocumentElement(element)));
  10142. } // A "clipping ancestor" is an overflowable container with the characteristic of
  10143. // clipping (or hiding) overflowing elements with a position different from
  10144. // `initial`
  10145. function getClippingAncestors(element) {
  10146. const clippingAncestors = getOverflowAncestors(element);
  10147. const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
  10148. const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  10149. if (!isElement(clipperElement)) {
  10150. return [];
  10151. } // @ts-ignore isElement check ensures we return Array<Element>
  10152. return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
  10153. } // Gets the maximum area that the element is visible in due to any number of
  10154. // clipping ancestors
  10155. function getClippingRect(_ref) {
  10156. let {
  10157. element,
  10158. boundary,
  10159. rootBoundary,
  10160. strategy
  10161. } = _ref;
  10162. const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
  10163. const clippingAncestors = [...mainClippingAncestors, rootBoundary];
  10164. const firstClippingAncestor = clippingAncestors[0];
  10165. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  10166. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  10167. accRect.top = max$1(rect.top, accRect.top);
  10168. accRect.right = min$1(rect.right, accRect.right);
  10169. accRect.bottom = min$1(rect.bottom, accRect.bottom);
  10170. accRect.left = max$1(rect.left, accRect.left);
  10171. return accRect;
  10172. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  10173. return {
  10174. width: clippingRect.right - clippingRect.left,
  10175. height: clippingRect.bottom - clippingRect.top,
  10176. x: clippingRect.left,
  10177. y: clippingRect.top
  10178. };
  10179. }
  10180. const platform = {
  10181. getClippingRect,
  10182. convertOffsetParentRelativeRectToViewportRelativeRect,
  10183. isElement,
  10184. getDimensions,
  10185. getOffsetParent,
  10186. getDocumentElement,
  10187. getElementRects: _ref => {
  10188. let {
  10189. reference,
  10190. floating,
  10191. strategy
  10192. } = _ref;
  10193. return {
  10194. reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
  10195. floating: { ...getDimensions(floating),
  10196. x: 0,
  10197. y: 0
  10198. }
  10199. };
  10200. },
  10201. getClientRects: element => Array.from(element.getClientRects()),
  10202. isRTL: element => getComputedStyle$1(element).direction === 'rtl'
  10203. };
  10204. /**
  10205. * Automatically updates the position of the floating element when necessary.
  10206. * @see https://floating-ui.com/docs/autoUpdate
  10207. */
  10208. function autoUpdate(reference, floating, update, options) {
  10209. if (options === void 0) {
  10210. options = {};
  10211. }
  10212. const {
  10213. ancestorScroll: _ancestorScroll = true,
  10214. ancestorResize: _ancestorResize = true,
  10215. elementResize = true,
  10216. animationFrame = false
  10217. } = options;
  10218. const ancestorScroll = _ancestorScroll && !animationFrame;
  10219. const ancestorResize = _ancestorResize && !animationFrame;
  10220. const ancestors = ancestorScroll || ancestorResize ? [...(isElement(reference) ? getOverflowAncestors(reference) : []), ...getOverflowAncestors(floating)] : [];
  10221. ancestors.forEach(ancestor => {
  10222. ancestorScroll && ancestor.addEventListener('scroll', update, {
  10223. passive: true
  10224. });
  10225. ancestorResize && ancestor.addEventListener('resize', update);
  10226. });
  10227. let observer = null;
  10228. if (elementResize) {
  10229. let initialUpdate = true;
  10230. observer = new ResizeObserver(() => {
  10231. if (!initialUpdate) {
  10232. update();
  10233. }
  10234. initialUpdate = false;
  10235. });
  10236. isElement(reference) && !animationFrame && observer.observe(reference);
  10237. observer.observe(floating);
  10238. }
  10239. let frameId;
  10240. let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
  10241. if (animationFrame) {
  10242. frameLoop();
  10243. }
  10244. function frameLoop() {
  10245. const nextRefRect = getBoundingClientRect(reference);
  10246. if (prevRefRect && (nextRefRect.x !== prevRefRect.x || nextRefRect.y !== prevRefRect.y || nextRefRect.width !== prevRefRect.width || nextRefRect.height !== prevRefRect.height)) {
  10247. update();
  10248. }
  10249. prevRefRect = nextRefRect;
  10250. frameId = requestAnimationFrame(frameLoop);
  10251. }
  10252. update();
  10253. return () => {
  10254. var _observer;
  10255. ancestors.forEach(ancestor => {
  10256. ancestorScroll && ancestor.removeEventListener('scroll', update);
  10257. ancestorResize && ancestor.removeEventListener('resize', update);
  10258. });
  10259. (_observer = observer) == null ? void 0 : _observer.disconnect();
  10260. observer = null;
  10261. if (animationFrame) {
  10262. cancelAnimationFrame(frameId);
  10263. }
  10264. };
  10265. }
  10266. /**
  10267. * Computes the `x` and `y` coordinates that will place the floating element
  10268. * next to a reference element when it is given a certain CSS positioning
  10269. * strategy.
  10270. */
  10271. const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
  10272. platform,
  10273. ...options
  10274. });
  10275. const useFloatingProps = buildProps({});
  10276. const unrefReference = (elRef) => {
  10277. if (!isClient)
  10278. return;
  10279. if (!elRef)
  10280. return elRef;
  10281. const unrefEl = unrefElement(elRef);
  10282. if (unrefEl)
  10283. return unrefEl;
  10284. return isRef(elRef) ? unrefEl : elRef;
  10285. };
  10286. const getPositionDataWithUnit = (record, key) => {
  10287. const value = record == null ? void 0 : record[key];
  10288. return isNil(value) ? "" : `${value}px`;
  10289. };
  10290. const useFloating$1 = ({
  10291. middleware,
  10292. placement,
  10293. strategy
  10294. }) => {
  10295. const referenceRef = ref();
  10296. const contentRef = ref();
  10297. const x = ref();
  10298. const y = ref();
  10299. const middlewareData = ref({});
  10300. const states = {
  10301. x,
  10302. y,
  10303. placement,
  10304. strategy,
  10305. middlewareData
  10306. };
  10307. const update = async () => {
  10308. if (!isClient)
  10309. return;
  10310. const referenceEl = unrefReference(referenceRef);
  10311. const contentEl = unrefElement(contentRef);
  10312. if (!referenceEl || !contentEl)
  10313. return;
  10314. const data = await computePosition(referenceEl, contentEl, {
  10315. placement: unref(placement),
  10316. strategy: unref(strategy),
  10317. middleware: unref(middleware)
  10318. });
  10319. keysOf(states).forEach((key) => {
  10320. states[key].value = data[key];
  10321. });
  10322. };
  10323. onMounted(() => {
  10324. watchEffect(() => {
  10325. update();
  10326. });
  10327. });
  10328. return {
  10329. ...states,
  10330. update,
  10331. referenceRef,
  10332. contentRef
  10333. };
  10334. };
  10335. const arrowMiddleware = ({
  10336. arrowRef,
  10337. padding
  10338. }) => {
  10339. return {
  10340. name: "arrow",
  10341. options: {
  10342. element: arrowRef,
  10343. padding
  10344. },
  10345. fn(args) {
  10346. const arrowEl = unref(arrowRef);
  10347. if (!arrowEl)
  10348. return {};
  10349. return arrow({
  10350. element: arrowEl,
  10351. padding
  10352. }).fn(args);
  10353. }
  10354. };
  10355. };
  10356. function useCursor(input) {
  10357. let selectionInfo;
  10358. function recordCursor() {
  10359. if (input.value == void 0)
  10360. return;
  10361. const { selectionStart, selectionEnd, value } = input.value;
  10362. if (selectionStart == null || selectionEnd == null)
  10363. return;
  10364. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  10365. const afterTxt = value.slice(Math.max(0, selectionEnd));
  10366. selectionInfo = {
  10367. selectionStart,
  10368. selectionEnd,
  10369. value,
  10370. beforeTxt,
  10371. afterTxt
  10372. };
  10373. }
  10374. function setCursor() {
  10375. if (input.value == void 0 || selectionInfo == void 0)
  10376. return;
  10377. const { value } = input.value;
  10378. const { beforeTxt, afterTxt, selectionStart } = selectionInfo;
  10379. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  10380. return;
  10381. let startPos = value.length;
  10382. if (value.endsWith(afterTxt)) {
  10383. startPos = value.length - afterTxt.length;
  10384. } else if (value.startsWith(beforeTxt)) {
  10385. startPos = beforeTxt.length;
  10386. } else {
  10387. const beforeLastChar = beforeTxt[selectionStart - 1];
  10388. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  10389. if (newIndex !== -1) {
  10390. startPos = newIndex + 1;
  10391. }
  10392. }
  10393. input.value.setSelectionRange(startPos, startPos);
  10394. }
  10395. return [recordCursor, setCursor];
  10396. }
  10397. const getOrderedChildren = (vm, childComponentName, children) => {
  10398. const nodes = flattedChildren(vm.subTree).filter((n) => {
  10399. var _a;
  10400. return isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
  10401. });
  10402. const uids = nodes.map((n) => n.component.uid);
  10403. return uids.map((uid) => children[uid]).filter((p) => !!p);
  10404. };
  10405. const useOrderedChildren = (vm, childComponentName) => {
  10406. const children = {};
  10407. const orderedChildren = shallowRef([]);
  10408. const addChild = (child) => {
  10409. children[child.uid] = child;
  10410. orderedChildren.value = getOrderedChildren(vm, childComponentName, children);
  10411. };
  10412. const removeChild = (uid) => {
  10413. delete children[uid];
  10414. orderedChildren.value = orderedChildren.value.filter((children2) => children2.uid !== uid);
  10415. };
  10416. return {
  10417. children: orderedChildren,
  10418. addChild,
  10419. removeChild
  10420. };
  10421. };
  10422. const useSizeProp = buildProp({
  10423. type: String,
  10424. values: componentSizes,
  10425. required: false
  10426. });
  10427. const useSizeProps = {
  10428. size: useSizeProp
  10429. };
  10430. const SIZE_INJECTION_KEY = Symbol("size");
  10431. const useGlobalSize = () => {
  10432. const injectedSize = inject(SIZE_INJECTION_KEY, {});
  10433. return computed(() => {
  10434. return unref(injectedSize.size) || "";
  10435. });
  10436. };
  10437. function useFocusController(target, {
  10438. beforeFocus,
  10439. afterFocus,
  10440. beforeBlur,
  10441. afterBlur
  10442. } = {}) {
  10443. const instance = getCurrentInstance();
  10444. const { emit } = instance;
  10445. const wrapperRef = shallowRef();
  10446. const isFocused = ref(false);
  10447. const handleFocus = (event) => {
  10448. const cancelFocus = isFunction$1(beforeFocus) ? beforeFocus(event) : false;
  10449. if (cancelFocus || isFocused.value)
  10450. return;
  10451. isFocused.value = true;
  10452. emit("focus", event);
  10453. afterFocus == null ? void 0 : afterFocus();
  10454. };
  10455. const handleBlur = (event) => {
  10456. var _a;
  10457. const cancelBlur = isFunction$1(beforeBlur) ? beforeBlur(event) : false;
  10458. if (cancelBlur || event.relatedTarget && ((_a = wrapperRef.value) == null ? void 0 : _a.contains(event.relatedTarget)))
  10459. return;
  10460. isFocused.value = false;
  10461. emit("blur", event);
  10462. afterBlur == null ? void 0 : afterBlur();
  10463. };
  10464. const handleClick = () => {
  10465. var _a, _b;
  10466. if (((_a = wrapperRef.value) == null ? void 0 : _a.contains(document.activeElement)) && wrapperRef.value !== document.activeElement)
  10467. return;
  10468. (_b = target.value) == null ? void 0 : _b.focus();
  10469. };
  10470. watch(wrapperRef, (el) => {
  10471. if (el) {
  10472. el.setAttribute("tabindex", "-1");
  10473. }
  10474. });
  10475. useEventListener(wrapperRef, "focus", handleFocus, true);
  10476. useEventListener(wrapperRef, "blur", handleBlur, true);
  10477. useEventListener(wrapperRef, "click", handleClick, true);
  10478. return {
  10479. isFocused,
  10480. wrapperRef,
  10481. handleFocus,
  10482. handleBlur
  10483. };
  10484. }
  10485. function useComposition({
  10486. afterComposition,
  10487. emit
  10488. }) {
  10489. const isComposing = ref(false);
  10490. const handleCompositionStart = (event) => {
  10491. emit == null ? void 0 : emit("compositionstart", event);
  10492. isComposing.value = true;
  10493. };
  10494. const handleCompositionUpdate = (event) => {
  10495. var _a;
  10496. emit == null ? void 0 : emit("compositionupdate", event);
  10497. const text = (_a = event.target) == null ? void 0 : _a.value;
  10498. const lastCharacter = text[text.length - 1] || "";
  10499. isComposing.value = !isKorean(lastCharacter);
  10500. };
  10501. const handleCompositionEnd = (event) => {
  10502. emit == null ? void 0 : emit("compositionend", event);
  10503. if (isComposing.value) {
  10504. isComposing.value = false;
  10505. nextTick(() => afterComposition(event));
  10506. }
  10507. };
  10508. const handleComposition = (event) => {
  10509. event.type === "compositionend" ? handleCompositionEnd(event) : handleCompositionUpdate(event);
  10510. };
  10511. return {
  10512. isComposing,
  10513. handleComposition,
  10514. handleCompositionStart,
  10515. handleCompositionUpdate,
  10516. handleCompositionEnd
  10517. };
  10518. }
  10519. const emptyValuesContextKey = Symbol("emptyValuesContextKey");
  10520. const SCOPE$3 = "use-empty-values";
  10521. const DEFAULT_EMPTY_VALUES = ["", void 0, null];
  10522. const DEFAULT_VALUE_ON_CLEAR = void 0;
  10523. const useEmptyValuesProps = buildProps({
  10524. emptyValues: Array,
  10525. valueOnClear: {
  10526. type: [String, Number, Boolean, Function],
  10527. default: void 0,
  10528. validator: (val) => isFunction$1(val) ? !val() : !val
  10529. }
  10530. });
  10531. const useEmptyValues = (props, defaultValue) => {
  10532. const config = getCurrentInstance() ? inject(emptyValuesContextKey, ref({})) : ref({});
  10533. const emptyValues = computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES);
  10534. const valueOnClear = computed(() => {
  10535. if (isFunction$1(props.valueOnClear)) {
  10536. return props.valueOnClear();
  10537. } else if (props.valueOnClear !== void 0) {
  10538. return props.valueOnClear;
  10539. } else if (isFunction$1(config.value.valueOnClear)) {
  10540. return config.value.valueOnClear();
  10541. } else if (config.value.valueOnClear !== void 0) {
  10542. return config.value.valueOnClear;
  10543. }
  10544. return defaultValue !== void 0 ? defaultValue : DEFAULT_VALUE_ON_CLEAR;
  10545. });
  10546. const isEmptyValue = (value) => {
  10547. return emptyValues.value.includes(value);
  10548. };
  10549. if (!emptyValues.value.includes(valueOnClear.value)) ;
  10550. return {
  10551. emptyValues,
  10552. valueOnClear,
  10553. isEmptyValue
  10554. };
  10555. };
  10556. const ariaProps = buildProps({
  10557. ariaLabel: String,
  10558. ariaOrientation: {
  10559. type: String,
  10560. values: ["horizontal", "vertical", "undefined"]
  10561. },
  10562. ariaControls: String
  10563. });
  10564. const useAriaProps = (arias) => {
  10565. return pick(ariaProps, arias);
  10566. };
  10567. const configProviderContextKey = Symbol();
  10568. const globalConfig = ref();
  10569. function useGlobalConfig(key, defaultValue = void 0) {
  10570. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  10571. if (key) {
  10572. return computed(() => {
  10573. var _a, _b;
  10574. return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue;
  10575. });
  10576. } else {
  10577. return config;
  10578. }
  10579. }
  10580. function useGlobalComponentSettings(block, sizeFallback) {
  10581. const config = useGlobalConfig();
  10582. const ns = useNamespace(block, computed(() => {
  10583. var _a;
  10584. return ((_a = config.value) == null ? void 0 : _a.namespace) || defaultNamespace;
  10585. }));
  10586. const locale = useLocale(computed(() => {
  10587. var _a;
  10588. return (_a = config.value) == null ? void 0 : _a.locale;
  10589. }));
  10590. const zIndex = useZIndex(computed(() => {
  10591. var _a;
  10592. return ((_a = config.value) == null ? void 0 : _a.zIndex) || defaultInitialZIndex;
  10593. }));
  10594. const size = computed(() => {
  10595. var _a;
  10596. return unref(sizeFallback) || ((_a = config.value) == null ? void 0 : _a.size) || "";
  10597. });
  10598. provideGlobalConfig(computed(() => unref(config) || {}));
  10599. return {
  10600. ns,
  10601. locale,
  10602. zIndex,
  10603. size
  10604. };
  10605. }
  10606. const provideGlobalConfig = (config, app, global = false) => {
  10607. var _a;
  10608. const inSetup = !!getCurrentInstance();
  10609. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  10610. const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? provide : void 0;
  10611. if (!provideFn) {
  10612. return;
  10613. }
  10614. const context = computed(() => {
  10615. const cfg = unref(config);
  10616. if (!(oldConfig == null ? void 0 : oldConfig.value))
  10617. return cfg;
  10618. return mergeConfig(oldConfig.value, cfg);
  10619. });
  10620. provideFn(configProviderContextKey, context);
  10621. provideFn(localeContextKey, computed(() => context.value.locale));
  10622. provideFn(namespaceContextKey, computed(() => context.value.namespace));
  10623. provideFn(zIndexContextKey, computed(() => context.value.zIndex));
  10624. provideFn(SIZE_INJECTION_KEY, {
  10625. size: computed(() => context.value.size || "")
  10626. });
  10627. provideFn(emptyValuesContextKey, computed(() => ({
  10628. emptyValues: context.value.emptyValues,
  10629. valueOnClear: context.value.valueOnClear
  10630. })));
  10631. if (global || !globalConfig.value) {
  10632. globalConfig.value = context.value;
  10633. }
  10634. return context;
  10635. };
  10636. const mergeConfig = (a, b) => {
  10637. const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
  10638. const obj = {};
  10639. for (const key of keys) {
  10640. obj[key] = b[key] !== void 0 ? b[key] : a[key];
  10641. }
  10642. return obj;
  10643. };
  10644. const configProviderProps = buildProps({
  10645. a11y: {
  10646. type: Boolean,
  10647. default: true
  10648. },
  10649. locale: {
  10650. type: definePropType(Object)
  10651. },
  10652. size: useSizeProp,
  10653. button: {
  10654. type: definePropType(Object)
  10655. },
  10656. experimentalFeatures: {
  10657. type: definePropType(Object)
  10658. },
  10659. keyboardNavigation: {
  10660. type: Boolean,
  10661. default: true
  10662. },
  10663. message: {
  10664. type: definePropType(Object)
  10665. },
  10666. zIndex: Number,
  10667. namespace: {
  10668. type: String,
  10669. default: "el"
  10670. },
  10671. ...useEmptyValuesProps
  10672. });
  10673. const messageConfig = {};
  10674. const ConfigProvider = defineComponent({
  10675. name: "ElConfigProvider",
  10676. props: configProviderProps,
  10677. setup(props, { slots }) {
  10678. watch(() => props.message, (val) => {
  10679. Object.assign(messageConfig, val != null ? val : {});
  10680. }, { immediate: true, deep: true });
  10681. const config = provideGlobalConfig(props);
  10682. return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  10683. }
  10684. });
  10685. const ElConfigProvider = withInstall(ConfigProvider);
  10686. const version$1 = "2.9.1";
  10687. const makeInstaller = (components = []) => {
  10688. const install = (app, options) => {
  10689. if (app[INSTALLED_KEY])
  10690. return;
  10691. app[INSTALLED_KEY] = true;
  10692. components.forEach((c) => app.use(c));
  10693. if (options)
  10694. provideGlobalConfig(options, app, true);
  10695. };
  10696. return {
  10697. version: version$1,
  10698. install
  10699. };
  10700. };
  10701. const affixProps = buildProps({
  10702. zIndex: {
  10703. type: definePropType([Number, String]),
  10704. default: 100
  10705. },
  10706. target: {
  10707. type: String,
  10708. default: ""
  10709. },
  10710. offset: {
  10711. type: Number,
  10712. default: 0
  10713. },
  10714. position: {
  10715. type: String,
  10716. values: ["top", "bottom"],
  10717. default: "top"
  10718. }
  10719. });
  10720. const affixEmits = {
  10721. scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed),
  10722. [CHANGE_EVENT]: (fixed) => isBoolean(fixed)
  10723. };
  10724. var _export_sfc = (sfc, props) => {
  10725. const target = sfc.__vccOpts || sfc;
  10726. for (const [key, val] of props) {
  10727. target[key] = val;
  10728. }
  10729. return target;
  10730. };
  10731. const COMPONENT_NAME$n = "ElAffix";
  10732. const __default__$1R = defineComponent({
  10733. name: COMPONENT_NAME$n
  10734. });
  10735. const _sfc_main$2x = /* @__PURE__ */ defineComponent({
  10736. ...__default__$1R,
  10737. props: affixProps,
  10738. emits: affixEmits,
  10739. setup(__props, { expose, emit }) {
  10740. const props = __props;
  10741. const ns = useNamespace("affix");
  10742. const target = shallowRef();
  10743. const root = shallowRef();
  10744. const scrollContainer = shallowRef();
  10745. const { height: windowHeight } = useWindowSize();
  10746. const {
  10747. height: rootHeight,
  10748. width: rootWidth,
  10749. top: rootTop,
  10750. bottom: rootBottom,
  10751. update: updateRoot
  10752. } = useElementBounding(root, { windowScroll: false });
  10753. const targetRect = useElementBounding(target);
  10754. const fixed = ref(false);
  10755. const scrollTop = ref(0);
  10756. const transform = ref(0);
  10757. const rootStyle = computed(() => {
  10758. return {
  10759. height: fixed.value ? `${rootHeight.value}px` : "",
  10760. width: fixed.value ? `${rootWidth.value}px` : ""
  10761. };
  10762. });
  10763. const affixStyle = computed(() => {
  10764. if (!fixed.value)
  10765. return {};
  10766. const offset = props.offset ? addUnit(props.offset) : 0;
  10767. return {
  10768. height: `${rootHeight.value}px`,
  10769. width: `${rootWidth.value}px`,
  10770. top: props.position === "top" ? offset : "",
  10771. bottom: props.position === "bottom" ? offset : "",
  10772. transform: transform.value ? `translateY(${transform.value}px)` : "",
  10773. zIndex: props.zIndex
  10774. };
  10775. });
  10776. const update = () => {
  10777. if (!scrollContainer.value)
  10778. return;
  10779. scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
  10780. const { position, target: target2, offset } = props;
  10781. const rootHeightOffset = offset + rootHeight.value;
  10782. if (position === "top") {
  10783. if (target2) {
  10784. const difference = targetRect.bottom.value - rootHeightOffset;
  10785. fixed.value = offset > rootTop.value && targetRect.bottom.value > 0;
  10786. transform.value = difference < 0 ? difference : 0;
  10787. } else {
  10788. fixed.value = offset > rootTop.value;
  10789. }
  10790. } else if (target2) {
  10791. const difference = windowHeight.value - targetRect.top.value - rootHeightOffset;
  10792. fixed.value = windowHeight.value - offset < rootBottom.value && windowHeight.value > targetRect.top.value;
  10793. transform.value = difference < 0 ? -difference : 0;
  10794. } else {
  10795. fixed.value = windowHeight.value - offset < rootBottom.value;
  10796. }
  10797. };
  10798. const handleScroll = () => {
  10799. updateRoot();
  10800. emit("scroll", {
  10801. scrollTop: scrollTop.value,
  10802. fixed: fixed.value
  10803. });
  10804. };
  10805. watch(fixed, (val) => emit("change", val));
  10806. onMounted(() => {
  10807. var _a;
  10808. if (props.target) {
  10809. target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  10810. if (!target.value)
  10811. throwError(COMPONENT_NAME$n, `Target does not exist: ${props.target}`);
  10812. } else {
  10813. target.value = document.documentElement;
  10814. }
  10815. scrollContainer.value = getScrollContainer(root.value, true);
  10816. updateRoot();
  10817. });
  10818. useEventListener(scrollContainer, "scroll", handleScroll);
  10819. watchEffect(update);
  10820. expose({
  10821. update,
  10822. updateRoot
  10823. });
  10824. return (_ctx, _cache) => {
  10825. return openBlock(), createElementBlock("div", {
  10826. ref_key: "root",
  10827. ref: root,
  10828. class: normalizeClass(unref(ns).b()),
  10829. style: normalizeStyle(unref(rootStyle))
  10830. }, [
  10831. createElementVNode("div", {
  10832. class: normalizeClass({ [unref(ns).m("fixed")]: fixed.value }),
  10833. style: normalizeStyle(unref(affixStyle))
  10834. }, [
  10835. renderSlot(_ctx.$slots, "default")
  10836. ], 6)
  10837. ], 6);
  10838. };
  10839. }
  10840. });
  10841. var Affix = /* @__PURE__ */ _export_sfc(_sfc_main$2x, [["__file", "affix.vue"]]);
  10842. const ElAffix = withInstall(Affix);
  10843. const iconProps = buildProps({
  10844. size: {
  10845. type: definePropType([Number, String])
  10846. },
  10847. color: {
  10848. type: String
  10849. }
  10850. });
  10851. const __default__$1Q = defineComponent({
  10852. name: "ElIcon",
  10853. inheritAttrs: false
  10854. });
  10855. const _sfc_main$2w = /* @__PURE__ */ defineComponent({
  10856. ...__default__$1Q,
  10857. props: iconProps,
  10858. setup(__props) {
  10859. const props = __props;
  10860. const ns = useNamespace("icon");
  10861. const style = computed(() => {
  10862. const { size, color } = props;
  10863. if (!size && !color)
  10864. return {};
  10865. return {
  10866. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  10867. "--color": color
  10868. };
  10869. });
  10870. return (_ctx, _cache) => {
  10871. return openBlock(), createElementBlock("i", mergeProps({
  10872. class: unref(ns).b(),
  10873. style: unref(style)
  10874. }, _ctx.$attrs), [
  10875. renderSlot(_ctx.$slots, "default")
  10876. ], 16);
  10877. };
  10878. }
  10879. });
  10880. var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$2w, [["__file", "icon.vue"]]);
  10881. const ElIcon = withInstall(Icon);
  10882. const alertEffects = ["light", "dark"];
  10883. const alertProps = buildProps({
  10884. title: {
  10885. type: String,
  10886. default: ""
  10887. },
  10888. description: {
  10889. type: String,
  10890. default: ""
  10891. },
  10892. type: {
  10893. type: String,
  10894. values: keysOf(TypeComponentsMap),
  10895. default: "info"
  10896. },
  10897. closable: {
  10898. type: Boolean,
  10899. default: true
  10900. },
  10901. closeText: {
  10902. type: String,
  10903. default: ""
  10904. },
  10905. showIcon: Boolean,
  10906. center: Boolean,
  10907. effect: {
  10908. type: String,
  10909. values: alertEffects,
  10910. default: "light"
  10911. }
  10912. });
  10913. const alertEmits = {
  10914. close: (evt) => evt instanceof MouseEvent
  10915. };
  10916. const __default__$1P = defineComponent({
  10917. name: "ElAlert"
  10918. });
  10919. const _sfc_main$2v = /* @__PURE__ */ defineComponent({
  10920. ...__default__$1P,
  10921. props: alertProps,
  10922. emits: alertEmits,
  10923. setup(__props, { emit }) {
  10924. const props = __props;
  10925. const { Close } = TypeComponents;
  10926. const slots = useSlots();
  10927. const ns = useNamespace("alert");
  10928. const visible = ref(true);
  10929. const iconComponent = computed(() => TypeComponentsMap[props.type]);
  10930. const hasDesc = computed(() => !!(props.description || slots.default));
  10931. const close = (evt) => {
  10932. visible.value = false;
  10933. emit("close", evt);
  10934. };
  10935. return (_ctx, _cache) => {
  10936. return openBlock(), createBlock(Transition, {
  10937. name: unref(ns).b("fade"),
  10938. persisted: ""
  10939. }, {
  10940. default: withCtx(() => [
  10941. withDirectives(createElementVNode("div", {
  10942. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.type), unref(ns).is("center", _ctx.center), unref(ns).is(_ctx.effect)]),
  10943. role: "alert"
  10944. }, [
  10945. _ctx.showIcon && unref(iconComponent) ? (openBlock(), createBlock(unref(ElIcon), {
  10946. key: 0,
  10947. class: normalizeClass([unref(ns).e("icon"), { [unref(ns).is("big")]: unref(hasDesc) }])
  10948. }, {
  10949. default: withCtx(() => [
  10950. (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent))))
  10951. ]),
  10952. _: 1
  10953. }, 8, ["class"])) : createCommentVNode("v-if", true),
  10954. createElementVNode("div", {
  10955. class: normalizeClass(unref(ns).e("content"))
  10956. }, [
  10957. _ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", {
  10958. key: 0,
  10959. class: normalizeClass([unref(ns).e("title"), { "with-description": unref(hasDesc) }])
  10960. }, [
  10961. renderSlot(_ctx.$slots, "title", {}, () => [
  10962. createTextVNode(toDisplayString(_ctx.title), 1)
  10963. ])
  10964. ], 2)) : createCommentVNode("v-if", true),
  10965. unref(hasDesc) ? (openBlock(), createElementBlock("p", {
  10966. key: 1,
  10967. class: normalizeClass(unref(ns).e("description"))
  10968. }, [
  10969. renderSlot(_ctx.$slots, "default", {}, () => [
  10970. createTextVNode(toDisplayString(_ctx.description), 1)
  10971. ])
  10972. ], 2)) : createCommentVNode("v-if", true),
  10973. _ctx.closable ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  10974. _ctx.closeText ? (openBlock(), createElementBlock("div", {
  10975. key: 0,
  10976. class: normalizeClass([unref(ns).e("close-btn"), unref(ns).is("customed")]),
  10977. onClick: close
  10978. }, toDisplayString(_ctx.closeText), 3)) : (openBlock(), createBlock(unref(ElIcon), {
  10979. key: 1,
  10980. class: normalizeClass(unref(ns).e("close-btn")),
  10981. onClick: close
  10982. }, {
  10983. default: withCtx(() => [
  10984. createVNode(unref(Close))
  10985. ]),
  10986. _: 1
  10987. }, 8, ["class"]))
  10988. ], 64)) : createCommentVNode("v-if", true)
  10989. ], 2)
  10990. ], 2), [
  10991. [vShow, visible.value]
  10992. ])
  10993. ]),
  10994. _: 3
  10995. }, 8, ["name"]);
  10996. };
  10997. }
  10998. });
  10999. var Alert = /* @__PURE__ */ _export_sfc(_sfc_main$2v, [["__file", "alert.vue"]]);
  11000. const ElAlert = withInstall(Alert);
  11001. const formContextKey = Symbol("formContextKey");
  11002. const formItemContextKey = Symbol("formItemContextKey");
  11003. const useFormSize = (fallback, ignore = {}) => {
  11004. const emptyRef = ref(void 0);
  11005. const size = ignore.prop ? emptyRef : useProp("size");
  11006. const globalConfig = ignore.global ? emptyRef : useGlobalSize();
  11007. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  11008. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  11009. return computed(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
  11010. };
  11011. const useFormDisabled = (fallback) => {
  11012. const disabled = useProp("disabled");
  11013. const form = inject(formContextKey, void 0);
  11014. return computed(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  11015. };
  11016. const useSize = useFormSize;
  11017. const useDisabled = useFormDisabled;
  11018. const useFormItem = () => {
  11019. const form = inject(formContextKey, void 0);
  11020. const formItem = inject(formItemContextKey, void 0);
  11021. return {
  11022. form,
  11023. formItem
  11024. };
  11025. };
  11026. const useFormItemInputId = (props, {
  11027. formItemContext,
  11028. disableIdGeneration,
  11029. disableIdManagement
  11030. }) => {
  11031. if (!disableIdGeneration) {
  11032. disableIdGeneration = ref(false);
  11033. }
  11034. if (!disableIdManagement) {
  11035. disableIdManagement = ref(false);
  11036. }
  11037. const inputId = ref();
  11038. let idUnwatch = void 0;
  11039. const isLabeledByFormItem = computed(() => {
  11040. var _a;
  11041. return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1);
  11042. });
  11043. onMounted(() => {
  11044. idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  11045. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  11046. if (newId !== inputId.value) {
  11047. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  11048. inputId.value && formItemContext.removeInputId(inputId.value);
  11049. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  11050. formItemContext.addInputId(newId);
  11051. }
  11052. }
  11053. inputId.value = newId;
  11054. }
  11055. }, { immediate: true });
  11056. });
  11057. onUnmounted(() => {
  11058. idUnwatch && idUnwatch();
  11059. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  11060. inputId.value && formItemContext.removeInputId(inputId.value);
  11061. }
  11062. });
  11063. return {
  11064. isLabeledByFormItem,
  11065. inputId
  11066. };
  11067. };
  11068. const formMetaProps = buildProps({
  11069. size: {
  11070. type: String,
  11071. values: componentSizes
  11072. },
  11073. disabled: Boolean
  11074. });
  11075. const formProps = buildProps({
  11076. ...formMetaProps,
  11077. model: Object,
  11078. rules: {
  11079. type: definePropType(Object)
  11080. },
  11081. labelPosition: {
  11082. type: String,
  11083. values: ["left", "right", "top"],
  11084. default: "right"
  11085. },
  11086. requireAsteriskPosition: {
  11087. type: String,
  11088. values: ["left", "right"],
  11089. default: "left"
  11090. },
  11091. labelWidth: {
  11092. type: [String, Number],
  11093. default: ""
  11094. },
  11095. labelSuffix: {
  11096. type: String,
  11097. default: ""
  11098. },
  11099. inline: Boolean,
  11100. inlineMessage: Boolean,
  11101. statusIcon: Boolean,
  11102. showMessage: {
  11103. type: Boolean,
  11104. default: true
  11105. },
  11106. validateOnRuleChange: {
  11107. type: Boolean,
  11108. default: true
  11109. },
  11110. hideRequiredAsterisk: Boolean,
  11111. scrollToError: Boolean,
  11112. scrollIntoViewOptions: {
  11113. type: [Object, Boolean]
  11114. }
  11115. });
  11116. const formEmits = {
  11117. validate: (prop, isValid, message) => (isArray$1(prop) || isString$1(prop)) && isBoolean(isValid) && isString$1(message)
  11118. };
  11119. function useFormLabelWidth() {
  11120. const potentialLabelWidthArr = ref([]);
  11121. const autoLabelWidth = computed(() => {
  11122. if (!potentialLabelWidthArr.value.length)
  11123. return "0";
  11124. const max = Math.max(...potentialLabelWidthArr.value);
  11125. return max ? `${max}px` : "";
  11126. });
  11127. function getLabelWidthIndex(width) {
  11128. const index = potentialLabelWidthArr.value.indexOf(width);
  11129. if (index === -1 && autoLabelWidth.value === "0") ;
  11130. return index;
  11131. }
  11132. function registerLabelWidth(val, oldVal) {
  11133. if (val && oldVal) {
  11134. const index = getLabelWidthIndex(oldVal);
  11135. potentialLabelWidthArr.value.splice(index, 1, val);
  11136. } else if (val) {
  11137. potentialLabelWidthArr.value.push(val);
  11138. }
  11139. }
  11140. function deregisterLabelWidth(val) {
  11141. const index = getLabelWidthIndex(val);
  11142. if (index > -1) {
  11143. potentialLabelWidthArr.value.splice(index, 1);
  11144. }
  11145. }
  11146. return {
  11147. autoLabelWidth,
  11148. registerLabelWidth,
  11149. deregisterLabelWidth
  11150. };
  11151. }
  11152. const filterFields = (fields, props) => {
  11153. const normalized = castArray$1(props);
  11154. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  11155. };
  11156. const COMPONENT_NAME$m = "ElForm";
  11157. const __default__$1O = defineComponent({
  11158. name: COMPONENT_NAME$m
  11159. });
  11160. const _sfc_main$2u = /* @__PURE__ */ defineComponent({
  11161. ...__default__$1O,
  11162. props: formProps,
  11163. emits: formEmits,
  11164. setup(__props, { expose, emit }) {
  11165. const props = __props;
  11166. const fields = [];
  11167. const formSize = useFormSize();
  11168. const ns = useNamespace("form");
  11169. const formClasses = computed(() => {
  11170. const { labelPosition, inline } = props;
  11171. return [
  11172. ns.b(),
  11173. ns.m(formSize.value || "default"),
  11174. {
  11175. [ns.m(`label-${labelPosition}`)]: labelPosition,
  11176. [ns.m("inline")]: inline
  11177. }
  11178. ];
  11179. });
  11180. const getField = (prop) => {
  11181. return fields.find((field) => field.prop === prop);
  11182. };
  11183. const addField = (field) => {
  11184. fields.push(field);
  11185. };
  11186. const removeField = (field) => {
  11187. if (field.prop) {
  11188. fields.splice(fields.indexOf(field), 1);
  11189. }
  11190. };
  11191. const resetFields = (properties = []) => {
  11192. if (!props.model) {
  11193. return;
  11194. }
  11195. filterFields(fields, properties).forEach((field) => field.resetField());
  11196. };
  11197. const clearValidate = (props2 = []) => {
  11198. filterFields(fields, props2).forEach((field) => field.clearValidate());
  11199. };
  11200. const isValidatable = computed(() => {
  11201. const hasModel = !!props.model;
  11202. return hasModel;
  11203. });
  11204. const obtainValidateFields = (props2) => {
  11205. if (fields.length === 0)
  11206. return [];
  11207. const filteredFields = filterFields(fields, props2);
  11208. if (!filteredFields.length) {
  11209. return [];
  11210. }
  11211. return filteredFields;
  11212. };
  11213. const validate = async (callback) => validateField(void 0, callback);
  11214. const doValidateField = async (props2 = []) => {
  11215. if (!isValidatable.value)
  11216. return false;
  11217. const fields2 = obtainValidateFields(props2);
  11218. if (fields2.length === 0)
  11219. return true;
  11220. let validationErrors = {};
  11221. for (const field of fields2) {
  11222. try {
  11223. await field.validate("");
  11224. } catch (fields3) {
  11225. validationErrors = {
  11226. ...validationErrors,
  11227. ...fields3
  11228. };
  11229. }
  11230. }
  11231. if (Object.keys(validationErrors).length === 0)
  11232. return true;
  11233. return Promise.reject(validationErrors);
  11234. };
  11235. const validateField = async (modelProps = [], callback) => {
  11236. const shouldThrow = !isFunction$1(callback);
  11237. try {
  11238. const result = await doValidateField(modelProps);
  11239. if (result === true) {
  11240. await (callback == null ? void 0 : callback(result));
  11241. }
  11242. return result;
  11243. } catch (e) {
  11244. if (e instanceof Error)
  11245. throw e;
  11246. const invalidFields = e;
  11247. if (props.scrollToError) {
  11248. scrollToField(Object.keys(invalidFields)[0]);
  11249. }
  11250. await (callback == null ? void 0 : callback(false, invalidFields));
  11251. return shouldThrow && Promise.reject(invalidFields);
  11252. }
  11253. };
  11254. const scrollToField = (prop) => {
  11255. var _a;
  11256. const field = filterFields(fields, prop)[0];
  11257. if (field) {
  11258. (_a = field.$el) == null ? void 0 : _a.scrollIntoView(props.scrollIntoViewOptions);
  11259. }
  11260. };
  11261. watch(() => props.rules, () => {
  11262. if (props.validateOnRuleChange) {
  11263. validate().catch((err) => debugWarn());
  11264. }
  11265. }, { deep: true });
  11266. provide(formContextKey, reactive({
  11267. ...toRefs(props),
  11268. emit,
  11269. resetFields,
  11270. clearValidate,
  11271. validateField,
  11272. getField,
  11273. addField,
  11274. removeField,
  11275. ...useFormLabelWidth()
  11276. }));
  11277. expose({
  11278. validate,
  11279. validateField,
  11280. resetFields,
  11281. clearValidate,
  11282. scrollToField,
  11283. fields
  11284. });
  11285. return (_ctx, _cache) => {
  11286. return openBlock(), createElementBlock("form", {
  11287. class: normalizeClass(unref(formClasses))
  11288. }, [
  11289. renderSlot(_ctx.$slots, "default")
  11290. ], 2);
  11291. };
  11292. }
  11293. });
  11294. var Form = /* @__PURE__ */ _export_sfc(_sfc_main$2u, [["__file", "form.vue"]]);
  11295. function _extends() {
  11296. _extends = Object.assign ? Object.assign.bind() : function(target) {
  11297. for (var i = 1; i < arguments.length; i++) {
  11298. var source = arguments[i];
  11299. for (var key in source) {
  11300. if (Object.prototype.hasOwnProperty.call(source, key)) {
  11301. target[key] = source[key];
  11302. }
  11303. }
  11304. }
  11305. return target;
  11306. };
  11307. return _extends.apply(this, arguments);
  11308. }
  11309. function _inheritsLoose(subClass, superClass) {
  11310. subClass.prototype = Object.create(superClass.prototype);
  11311. subClass.prototype.constructor = subClass;
  11312. _setPrototypeOf(subClass, superClass);
  11313. }
  11314. function _getPrototypeOf(o) {
  11315. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
  11316. return o2.__proto__ || Object.getPrototypeOf(o2);
  11317. };
  11318. return _getPrototypeOf(o);
  11319. }
  11320. function _setPrototypeOf(o, p) {
  11321. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
  11322. o2.__proto__ = p2;
  11323. return o2;
  11324. };
  11325. return _setPrototypeOf(o, p);
  11326. }
  11327. function _isNativeReflectConstruct() {
  11328. if (typeof Reflect === "undefined" || !Reflect.construct)
  11329. return false;
  11330. if (Reflect.construct.sham)
  11331. return false;
  11332. if (typeof Proxy === "function")
  11333. return true;
  11334. try {
  11335. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  11336. }));
  11337. return true;
  11338. } catch (e) {
  11339. return false;
  11340. }
  11341. }
  11342. function _construct(Parent, args, Class) {
  11343. if (_isNativeReflectConstruct()) {
  11344. _construct = Reflect.construct.bind();
  11345. } else {
  11346. _construct = function _construct2(Parent2, args2, Class2) {
  11347. var a = [null];
  11348. a.push.apply(a, args2);
  11349. var Constructor = Function.bind.apply(Parent2, a);
  11350. var instance = new Constructor();
  11351. if (Class2)
  11352. _setPrototypeOf(instance, Class2.prototype);
  11353. return instance;
  11354. };
  11355. }
  11356. return _construct.apply(null, arguments);
  11357. }
  11358. function _isNativeFunction(fn) {
  11359. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  11360. }
  11361. function _wrapNativeSuper(Class) {
  11362. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  11363. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  11364. if (Class2 === null || !_isNativeFunction(Class2))
  11365. return Class2;
  11366. if (typeof Class2 !== "function") {
  11367. throw new TypeError("Super expression must either be null or a function");
  11368. }
  11369. if (typeof _cache !== "undefined") {
  11370. if (_cache.has(Class2))
  11371. return _cache.get(Class2);
  11372. _cache.set(Class2, Wrapper);
  11373. }
  11374. function Wrapper() {
  11375. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  11376. }
  11377. Wrapper.prototype = Object.create(Class2.prototype, {
  11378. constructor: {
  11379. value: Wrapper,
  11380. enumerable: false,
  11381. writable: true,
  11382. configurable: true
  11383. }
  11384. });
  11385. return _setPrototypeOf(Wrapper, Class2);
  11386. };
  11387. return _wrapNativeSuper(Class);
  11388. }
  11389. var formatRegExp = /%[sdj%]/g;
  11390. var warning = function warning2() {
  11391. };
  11392. if (typeof process !== "undefined" && process.env && false) {
  11393. warning = function warning3(type4, errors) {
  11394. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  11395. if (errors.every(function(e) {
  11396. return typeof e === "string";
  11397. })) {
  11398. console.warn(type4, errors);
  11399. }
  11400. }
  11401. };
  11402. }
  11403. function convertFieldsError(errors) {
  11404. if (!errors || !errors.length)
  11405. return null;
  11406. var fields = {};
  11407. errors.forEach(function(error) {
  11408. var field = error.field;
  11409. fields[field] = fields[field] || [];
  11410. fields[field].push(error);
  11411. });
  11412. return fields;
  11413. }
  11414. function format(template) {
  11415. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  11416. args[_key - 1] = arguments[_key];
  11417. }
  11418. var i = 0;
  11419. var len = args.length;
  11420. if (typeof template === "function") {
  11421. return template.apply(null, args);
  11422. }
  11423. if (typeof template === "string") {
  11424. var str = template.replace(formatRegExp, function(x) {
  11425. if (x === "%%") {
  11426. return "%";
  11427. }
  11428. if (i >= len) {
  11429. return x;
  11430. }
  11431. switch (x) {
  11432. case "%s":
  11433. return String(args[i++]);
  11434. case "%d":
  11435. return Number(args[i++]);
  11436. case "%j":
  11437. try {
  11438. return JSON.stringify(args[i++]);
  11439. } catch (_) {
  11440. return "[Circular]";
  11441. }
  11442. break;
  11443. default:
  11444. return x;
  11445. }
  11446. });
  11447. return str;
  11448. }
  11449. return template;
  11450. }
  11451. function isNativeStringType(type4) {
  11452. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  11453. }
  11454. function isEmptyValue(value, type4) {
  11455. if (value === void 0 || value === null) {
  11456. return true;
  11457. }
  11458. if (type4 === "array" && Array.isArray(value) && !value.length) {
  11459. return true;
  11460. }
  11461. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  11462. return true;
  11463. }
  11464. return false;
  11465. }
  11466. function asyncParallelArray(arr, func, callback) {
  11467. var results = [];
  11468. var total = 0;
  11469. var arrLength = arr.length;
  11470. function count(errors) {
  11471. results.push.apply(results, errors || []);
  11472. total++;
  11473. if (total === arrLength) {
  11474. callback(results);
  11475. }
  11476. }
  11477. arr.forEach(function(a) {
  11478. func(a, count);
  11479. });
  11480. }
  11481. function asyncSerialArray(arr, func, callback) {
  11482. var index = 0;
  11483. var arrLength = arr.length;
  11484. function next(errors) {
  11485. if (errors && errors.length) {
  11486. callback(errors);
  11487. return;
  11488. }
  11489. var original = index;
  11490. index = index + 1;
  11491. if (original < arrLength) {
  11492. func(arr[original], next);
  11493. } else {
  11494. callback([]);
  11495. }
  11496. }
  11497. next([]);
  11498. }
  11499. function flattenObjArr(objArr) {
  11500. var ret = [];
  11501. Object.keys(objArr).forEach(function(k) {
  11502. ret.push.apply(ret, objArr[k] || []);
  11503. });
  11504. return ret;
  11505. }
  11506. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  11507. _inheritsLoose(AsyncValidationError2, _Error);
  11508. function AsyncValidationError2(errors, fields) {
  11509. var _this;
  11510. _this = _Error.call(this, "Async Validation Error") || this;
  11511. _this.errors = errors;
  11512. _this.fields = fields;
  11513. return _this;
  11514. }
  11515. return AsyncValidationError2;
  11516. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  11517. function asyncMap(objArr, option, func, callback, source) {
  11518. if (option.first) {
  11519. var _pending = new Promise(function(resolve, reject) {
  11520. var next = function next2(errors) {
  11521. callback(errors);
  11522. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  11523. };
  11524. var flattenArr = flattenObjArr(objArr);
  11525. asyncSerialArray(flattenArr, func, next);
  11526. });
  11527. _pending["catch"](function(e) {
  11528. return e;
  11529. });
  11530. return _pending;
  11531. }
  11532. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  11533. var objArrKeys = Object.keys(objArr);
  11534. var objArrLength = objArrKeys.length;
  11535. var total = 0;
  11536. var results = [];
  11537. var pending = new Promise(function(resolve, reject) {
  11538. var next = function next2(errors) {
  11539. results.push.apply(results, errors);
  11540. total++;
  11541. if (total === objArrLength) {
  11542. callback(results);
  11543. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  11544. }
  11545. };
  11546. if (!objArrKeys.length) {
  11547. callback(results);
  11548. resolve(source);
  11549. }
  11550. objArrKeys.forEach(function(key) {
  11551. var arr = objArr[key];
  11552. if (firstFields.indexOf(key) !== -1) {
  11553. asyncSerialArray(arr, func, next);
  11554. } else {
  11555. asyncParallelArray(arr, func, next);
  11556. }
  11557. });
  11558. });
  11559. pending["catch"](function(e) {
  11560. return e;
  11561. });
  11562. return pending;
  11563. }
  11564. function isErrorObj(obj) {
  11565. return !!(obj && obj.message !== void 0);
  11566. }
  11567. function getValue(value, path) {
  11568. var v = value;
  11569. for (var i = 0; i < path.length; i++) {
  11570. if (v == void 0) {
  11571. return v;
  11572. }
  11573. v = v[path[i]];
  11574. }
  11575. return v;
  11576. }
  11577. function complementError(rule, source) {
  11578. return function(oe) {
  11579. var fieldValue;
  11580. if (rule.fullFields) {
  11581. fieldValue = getValue(source, rule.fullFields);
  11582. } else {
  11583. fieldValue = source[oe.field || rule.fullField];
  11584. }
  11585. if (isErrorObj(oe)) {
  11586. oe.field = oe.field || rule.fullField;
  11587. oe.fieldValue = fieldValue;
  11588. return oe;
  11589. }
  11590. return {
  11591. message: typeof oe === "function" ? oe() : oe,
  11592. fieldValue,
  11593. field: oe.field || rule.fullField
  11594. };
  11595. };
  11596. }
  11597. function deepMerge(target, source) {
  11598. if (source) {
  11599. for (var s in source) {
  11600. if (source.hasOwnProperty(s)) {
  11601. var value = source[s];
  11602. if (typeof value === "object" && typeof target[s] === "object") {
  11603. target[s] = _extends({}, target[s], value);
  11604. } else {
  11605. target[s] = value;
  11606. }
  11607. }
  11608. }
  11609. }
  11610. return target;
  11611. }
  11612. var required$1 = function required(rule, value, source, errors, options, type4) {
  11613. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  11614. errors.push(format(options.messages.required, rule.fullField));
  11615. }
  11616. };
  11617. var whitespace = function whitespace2(rule, value, source, errors, options) {
  11618. if (/^\s+$/.test(value) || value === "") {
  11619. errors.push(format(options.messages.whitespace, rule.fullField));
  11620. }
  11621. };
  11622. var urlReg;
  11623. var getUrlRegex = function() {
  11624. if (urlReg) {
  11625. return urlReg;
  11626. }
  11627. var word = "[a-fA-F\\d:]";
  11628. var b = function b2(options) {
  11629. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  11630. };
  11631. 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}";
  11632. var v6seg = "[a-fA-F\\d]{1,4}";
  11633. 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();
  11634. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  11635. var v4exact = new RegExp("^" + v4 + "$");
  11636. var v6exact = new RegExp("^" + v6 + "$");
  11637. var ip = function ip2(options) {
  11638. return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g");
  11639. };
  11640. ip.v4 = function(options) {
  11641. return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g");
  11642. };
  11643. ip.v6 = function(options) {
  11644. return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g");
  11645. };
  11646. var protocol = "(?:(?:[a-z]+:)?//)";
  11647. var auth = "(?:\\S+(?::\\S*)?@)?";
  11648. var ipv4 = ip.v4().source;
  11649. var ipv6 = ip.v6().source;
  11650. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  11651. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  11652. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  11653. var port = "(?::\\d{2,5})?";
  11654. var path = '(?:[/?#][^\\s"]*)?';
  11655. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  11656. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  11657. return urlReg;
  11658. };
  11659. var pattern$2 = {
  11660. 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,}))$/,
  11661. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  11662. };
  11663. var types = {
  11664. integer: function integer(value) {
  11665. return types.number(value) && parseInt(value, 10) === value;
  11666. },
  11667. "float": function float(value) {
  11668. return types.number(value) && !types.integer(value);
  11669. },
  11670. array: function array(value) {
  11671. return Array.isArray(value);
  11672. },
  11673. regexp: function regexp(value) {
  11674. if (value instanceof RegExp) {
  11675. return true;
  11676. }
  11677. try {
  11678. return !!new RegExp(value);
  11679. } catch (e) {
  11680. return false;
  11681. }
  11682. },
  11683. date: function date(value) {
  11684. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  11685. },
  11686. number: function number(value) {
  11687. if (isNaN(value)) {
  11688. return false;
  11689. }
  11690. return typeof value === "number";
  11691. },
  11692. object: function object(value) {
  11693. return typeof value === "object" && !types.array(value);
  11694. },
  11695. method: function method(value) {
  11696. return typeof value === "function";
  11697. },
  11698. email: function email(value) {
  11699. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  11700. },
  11701. url: function url(value) {
  11702. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  11703. },
  11704. hex: function hex(value) {
  11705. return typeof value === "string" && !!value.match(pattern$2.hex);
  11706. }
  11707. };
  11708. var type$1 = function type(rule, value, source, errors, options) {
  11709. if (rule.required && value === void 0) {
  11710. required$1(rule, value, source, errors, options);
  11711. return;
  11712. }
  11713. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  11714. var ruleType = rule.type;
  11715. if (custom.indexOf(ruleType) > -1) {
  11716. if (!types[ruleType](value)) {
  11717. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11718. }
  11719. } else if (ruleType && typeof value !== rule.type) {
  11720. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  11721. }
  11722. };
  11723. var range = function range2(rule, value, source, errors, options) {
  11724. var len = typeof rule.len === "number";
  11725. var min = typeof rule.min === "number";
  11726. var max = typeof rule.max === "number";
  11727. var val = value;
  11728. var key = null;
  11729. var num = typeof value === "number";
  11730. var str = typeof value === "string";
  11731. var arr = Array.isArray(value);
  11732. if (num) {
  11733. key = "number";
  11734. } else if (str) {
  11735. key = "string";
  11736. } else if (arr) {
  11737. key = "array";
  11738. }
  11739. if (!key) {
  11740. return false;
  11741. }
  11742. if (arr) {
  11743. val = value.length;
  11744. }
  11745. if (str) {
  11746. val = value.length;
  11747. }
  11748. if (len) {
  11749. if (val !== rule.len) {
  11750. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  11751. }
  11752. } else if (min && !max && val < rule.min) {
  11753. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  11754. } else if (max && !min && val > rule.max) {
  11755. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  11756. } else if (min && max && (val < rule.min || val > rule.max)) {
  11757. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  11758. }
  11759. };
  11760. var ENUM$1 = "enum";
  11761. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  11762. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  11763. if (rule[ENUM$1].indexOf(value) === -1) {
  11764. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  11765. }
  11766. };
  11767. var pattern$1 = function pattern(rule, value, source, errors, options) {
  11768. if (rule.pattern) {
  11769. if (rule.pattern instanceof RegExp) {
  11770. rule.pattern.lastIndex = 0;
  11771. if (!rule.pattern.test(value)) {
  11772. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  11773. }
  11774. } else if (typeof rule.pattern === "string") {
  11775. var _pattern = new RegExp(rule.pattern);
  11776. if (!_pattern.test(value)) {
  11777. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  11778. }
  11779. }
  11780. }
  11781. };
  11782. var rules = {
  11783. required: required$1,
  11784. whitespace,
  11785. type: type$1,
  11786. range,
  11787. "enum": enumerable$1,
  11788. pattern: pattern$1
  11789. };
  11790. var string = function string2(rule, value, callback, source, options) {
  11791. var errors = [];
  11792. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11793. if (validate) {
  11794. if (isEmptyValue(value, "string") && !rule.required) {
  11795. return callback();
  11796. }
  11797. rules.required(rule, value, source, errors, options, "string");
  11798. if (!isEmptyValue(value, "string")) {
  11799. rules.type(rule, value, source, errors, options);
  11800. rules.range(rule, value, source, errors, options);
  11801. rules.pattern(rule, value, source, errors, options);
  11802. if (rule.whitespace === true) {
  11803. rules.whitespace(rule, value, source, errors, options);
  11804. }
  11805. }
  11806. }
  11807. callback(errors);
  11808. };
  11809. var method2 = function method3(rule, value, callback, source, options) {
  11810. var errors = [];
  11811. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11812. if (validate) {
  11813. if (isEmptyValue(value) && !rule.required) {
  11814. return callback();
  11815. }
  11816. rules.required(rule, value, source, errors, options);
  11817. if (value !== void 0) {
  11818. rules.type(rule, value, source, errors, options);
  11819. }
  11820. }
  11821. callback(errors);
  11822. };
  11823. var number2 = function number3(rule, value, callback, source, options) {
  11824. var errors = [];
  11825. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11826. if (validate) {
  11827. if (value === "") {
  11828. value = void 0;
  11829. }
  11830. if (isEmptyValue(value) && !rule.required) {
  11831. return callback();
  11832. }
  11833. rules.required(rule, value, source, errors, options);
  11834. if (value !== void 0) {
  11835. rules.type(rule, value, source, errors, options);
  11836. rules.range(rule, value, source, errors, options);
  11837. }
  11838. }
  11839. callback(errors);
  11840. };
  11841. var _boolean = function _boolean2(rule, value, callback, source, options) {
  11842. var errors = [];
  11843. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11844. if (validate) {
  11845. if (isEmptyValue(value) && !rule.required) {
  11846. return callback();
  11847. }
  11848. rules.required(rule, value, source, errors, options);
  11849. if (value !== void 0) {
  11850. rules.type(rule, value, source, errors, options);
  11851. }
  11852. }
  11853. callback(errors);
  11854. };
  11855. var regexp2 = function regexp3(rule, value, callback, source, options) {
  11856. var errors = [];
  11857. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11858. if (validate) {
  11859. if (isEmptyValue(value) && !rule.required) {
  11860. return callback();
  11861. }
  11862. rules.required(rule, value, source, errors, options);
  11863. if (!isEmptyValue(value)) {
  11864. rules.type(rule, value, source, errors, options);
  11865. }
  11866. }
  11867. callback(errors);
  11868. };
  11869. var integer2 = function integer3(rule, value, callback, source, options) {
  11870. var errors = [];
  11871. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11872. if (validate) {
  11873. if (isEmptyValue(value) && !rule.required) {
  11874. return callback();
  11875. }
  11876. rules.required(rule, value, source, errors, options);
  11877. if (value !== void 0) {
  11878. rules.type(rule, value, source, errors, options);
  11879. rules.range(rule, value, source, errors, options);
  11880. }
  11881. }
  11882. callback(errors);
  11883. };
  11884. var floatFn = function floatFn2(rule, value, callback, source, options) {
  11885. var errors = [];
  11886. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11887. if (validate) {
  11888. if (isEmptyValue(value) && !rule.required) {
  11889. return callback();
  11890. }
  11891. rules.required(rule, value, source, errors, options);
  11892. if (value !== void 0) {
  11893. rules.type(rule, value, source, errors, options);
  11894. rules.range(rule, value, source, errors, options);
  11895. }
  11896. }
  11897. callback(errors);
  11898. };
  11899. var array2 = function array3(rule, value, callback, source, options) {
  11900. var errors = [];
  11901. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11902. if (validate) {
  11903. if ((value === void 0 || value === null) && !rule.required) {
  11904. return callback();
  11905. }
  11906. rules.required(rule, value, source, errors, options, "array");
  11907. if (value !== void 0 && value !== null) {
  11908. rules.type(rule, value, source, errors, options);
  11909. rules.range(rule, value, source, errors, options);
  11910. }
  11911. }
  11912. callback(errors);
  11913. };
  11914. var object2 = function object3(rule, value, callback, source, options) {
  11915. var errors = [];
  11916. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11917. if (validate) {
  11918. if (isEmptyValue(value) && !rule.required) {
  11919. return callback();
  11920. }
  11921. rules.required(rule, value, source, errors, options);
  11922. if (value !== void 0) {
  11923. rules.type(rule, value, source, errors, options);
  11924. }
  11925. }
  11926. callback(errors);
  11927. };
  11928. var ENUM = "enum";
  11929. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  11930. var errors = [];
  11931. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11932. if (validate) {
  11933. if (isEmptyValue(value) && !rule.required) {
  11934. return callback();
  11935. }
  11936. rules.required(rule, value, source, errors, options);
  11937. if (value !== void 0) {
  11938. rules[ENUM](rule, value, source, errors, options);
  11939. }
  11940. }
  11941. callback(errors);
  11942. };
  11943. var pattern2 = function pattern3(rule, value, callback, source, options) {
  11944. var errors = [];
  11945. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11946. if (validate) {
  11947. if (isEmptyValue(value, "string") && !rule.required) {
  11948. return callback();
  11949. }
  11950. rules.required(rule, value, source, errors, options);
  11951. if (!isEmptyValue(value, "string")) {
  11952. rules.pattern(rule, value, source, errors, options);
  11953. }
  11954. }
  11955. callback(errors);
  11956. };
  11957. var date2 = function date3(rule, value, callback, source, options) {
  11958. var errors = [];
  11959. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11960. if (validate) {
  11961. if (isEmptyValue(value, "date") && !rule.required) {
  11962. return callback();
  11963. }
  11964. rules.required(rule, value, source, errors, options);
  11965. if (!isEmptyValue(value, "date")) {
  11966. var dateObject;
  11967. if (value instanceof Date) {
  11968. dateObject = value;
  11969. } else {
  11970. dateObject = new Date(value);
  11971. }
  11972. rules.type(rule, dateObject, source, errors, options);
  11973. if (dateObject) {
  11974. rules.range(rule, dateObject.getTime(), source, errors, options);
  11975. }
  11976. }
  11977. }
  11978. callback(errors);
  11979. };
  11980. var required2 = function required3(rule, value, callback, source, options) {
  11981. var errors = [];
  11982. var type4 = Array.isArray(value) ? "array" : typeof value;
  11983. rules.required(rule, value, source, errors, options, type4);
  11984. callback(errors);
  11985. };
  11986. var type2 = function type3(rule, value, callback, source, options) {
  11987. var ruleType = rule.type;
  11988. var errors = [];
  11989. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  11990. if (validate) {
  11991. if (isEmptyValue(value, ruleType) && !rule.required) {
  11992. return callback();
  11993. }
  11994. rules.required(rule, value, source, errors, options, ruleType);
  11995. if (!isEmptyValue(value, ruleType)) {
  11996. rules.type(rule, value, source, errors, options);
  11997. }
  11998. }
  11999. callback(errors);
  12000. };
  12001. var any = function any2(rule, value, callback, source, options) {
  12002. var errors = [];
  12003. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  12004. if (validate) {
  12005. if (isEmptyValue(value) && !rule.required) {
  12006. return callback();
  12007. }
  12008. rules.required(rule, value, source, errors, options);
  12009. }
  12010. callback(errors);
  12011. };
  12012. var validators = {
  12013. string,
  12014. method: method2,
  12015. number: number2,
  12016. "boolean": _boolean,
  12017. regexp: regexp2,
  12018. integer: integer2,
  12019. "float": floatFn,
  12020. array: array2,
  12021. object: object2,
  12022. "enum": enumerable2,
  12023. pattern: pattern2,
  12024. date: date2,
  12025. url: type2,
  12026. hex: type2,
  12027. email: type2,
  12028. required: required2,
  12029. any
  12030. };
  12031. function newMessages() {
  12032. return {
  12033. "default": "Validation error on field %s",
  12034. required: "%s is required",
  12035. "enum": "%s must be one of %s",
  12036. whitespace: "%s cannot be empty",
  12037. date: {
  12038. format: "%s date %s is invalid for format %s",
  12039. parse: "%s date could not be parsed, %s is invalid ",
  12040. invalid: "%s date %s is invalid"
  12041. },
  12042. types: {
  12043. string: "%s is not a %s",
  12044. method: "%s is not a %s (function)",
  12045. array: "%s is not an %s",
  12046. object: "%s is not an %s",
  12047. number: "%s is not a %s",
  12048. date: "%s is not a %s",
  12049. "boolean": "%s is not a %s",
  12050. integer: "%s is not an %s",
  12051. "float": "%s is not a %s",
  12052. regexp: "%s is not a valid %s",
  12053. email: "%s is not a valid %s",
  12054. url: "%s is not a valid %s",
  12055. hex: "%s is not a valid %s"
  12056. },
  12057. string: {
  12058. len: "%s must be exactly %s characters",
  12059. min: "%s must be at least %s characters",
  12060. max: "%s cannot be longer than %s characters",
  12061. range: "%s must be between %s and %s characters"
  12062. },
  12063. number: {
  12064. len: "%s must equal %s",
  12065. min: "%s cannot be less than %s",
  12066. max: "%s cannot be greater than %s",
  12067. range: "%s must be between %s and %s"
  12068. },
  12069. array: {
  12070. len: "%s must be exactly %s in length",
  12071. min: "%s cannot be less than %s in length",
  12072. max: "%s cannot be greater than %s in length",
  12073. range: "%s must be between %s and %s in length"
  12074. },
  12075. pattern: {
  12076. mismatch: "%s value %s does not match pattern %s"
  12077. },
  12078. clone: function clone() {
  12079. var cloned = JSON.parse(JSON.stringify(this));
  12080. cloned.clone = this.clone;
  12081. return cloned;
  12082. }
  12083. };
  12084. }
  12085. var messages = newMessages();
  12086. var Schema = /* @__PURE__ */ function() {
  12087. function Schema2(descriptor) {
  12088. this.rules = null;
  12089. this._messages = messages;
  12090. this.define(descriptor);
  12091. }
  12092. var _proto = Schema2.prototype;
  12093. _proto.define = function define(rules2) {
  12094. var _this = this;
  12095. if (!rules2) {
  12096. throw new Error("Cannot configure a schema with no rules");
  12097. }
  12098. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  12099. throw new Error("Rules must be an object");
  12100. }
  12101. this.rules = {};
  12102. Object.keys(rules2).forEach(function(name) {
  12103. var item = rules2[name];
  12104. _this.rules[name] = Array.isArray(item) ? item : [item];
  12105. });
  12106. };
  12107. _proto.messages = function messages2(_messages) {
  12108. if (_messages) {
  12109. this._messages = deepMerge(newMessages(), _messages);
  12110. }
  12111. return this._messages;
  12112. };
  12113. _proto.validate = function validate(source_, o, oc) {
  12114. var _this2 = this;
  12115. if (o === void 0) {
  12116. o = {};
  12117. }
  12118. if (oc === void 0) {
  12119. oc = function oc2() {
  12120. };
  12121. }
  12122. var source = source_;
  12123. var options = o;
  12124. var callback = oc;
  12125. if (typeof options === "function") {
  12126. callback = options;
  12127. options = {};
  12128. }
  12129. if (!this.rules || Object.keys(this.rules).length === 0) {
  12130. if (callback) {
  12131. callback(null, source);
  12132. }
  12133. return Promise.resolve(source);
  12134. }
  12135. function complete(results) {
  12136. var errors = [];
  12137. var fields = {};
  12138. function add(e) {
  12139. if (Array.isArray(e)) {
  12140. var _errors;
  12141. errors = (_errors = errors).concat.apply(_errors, e);
  12142. } else {
  12143. errors.push(e);
  12144. }
  12145. }
  12146. for (var i = 0; i < results.length; i++) {
  12147. add(results[i]);
  12148. }
  12149. if (!errors.length) {
  12150. callback(null, source);
  12151. } else {
  12152. fields = convertFieldsError(errors);
  12153. callback(errors, fields);
  12154. }
  12155. }
  12156. if (options.messages) {
  12157. var messages$1 = this.messages();
  12158. if (messages$1 === messages) {
  12159. messages$1 = newMessages();
  12160. }
  12161. deepMerge(messages$1, options.messages);
  12162. options.messages = messages$1;
  12163. } else {
  12164. options.messages = this.messages();
  12165. }
  12166. var series = {};
  12167. var keys = options.keys || Object.keys(this.rules);
  12168. keys.forEach(function(z) {
  12169. var arr = _this2.rules[z];
  12170. var value = source[z];
  12171. arr.forEach(function(r) {
  12172. var rule = r;
  12173. if (typeof rule.transform === "function") {
  12174. if (source === source_) {
  12175. source = _extends({}, source);
  12176. }
  12177. value = source[z] = rule.transform(value);
  12178. }
  12179. if (typeof rule === "function") {
  12180. rule = {
  12181. validator: rule
  12182. };
  12183. } else {
  12184. rule = _extends({}, rule);
  12185. }
  12186. rule.validator = _this2.getValidationMethod(rule);
  12187. if (!rule.validator) {
  12188. return;
  12189. }
  12190. rule.field = z;
  12191. rule.fullField = rule.fullField || z;
  12192. rule.type = _this2.getType(rule);
  12193. series[z] = series[z] || [];
  12194. series[z].push({
  12195. rule,
  12196. value,
  12197. source,
  12198. field: z
  12199. });
  12200. });
  12201. });
  12202. var errorFields = {};
  12203. return asyncMap(series, options, function(data, doIt) {
  12204. var rule = data.rule;
  12205. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  12206. deep = deep && (rule.required || !rule.required && data.value);
  12207. rule.field = data.field;
  12208. function addFullField(key, schema) {
  12209. return _extends({}, schema, {
  12210. fullField: rule.fullField + "." + key,
  12211. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  12212. });
  12213. }
  12214. function cb(e) {
  12215. if (e === void 0) {
  12216. e = [];
  12217. }
  12218. var errorList = Array.isArray(e) ? e : [e];
  12219. if (!options.suppressWarning && errorList.length) {
  12220. Schema2.warning("async-validator:", errorList);
  12221. }
  12222. if (errorList.length && rule.message !== void 0) {
  12223. errorList = [].concat(rule.message);
  12224. }
  12225. var filledErrors = errorList.map(complementError(rule, source));
  12226. if (options.first && filledErrors.length) {
  12227. errorFields[rule.field] = 1;
  12228. return doIt(filledErrors);
  12229. }
  12230. if (!deep) {
  12231. doIt(filledErrors);
  12232. } else {
  12233. if (rule.required && !data.value) {
  12234. if (rule.message !== void 0) {
  12235. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  12236. } else if (options.error) {
  12237. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  12238. }
  12239. return doIt(filledErrors);
  12240. }
  12241. var fieldsSchema = {};
  12242. if (rule.defaultField) {
  12243. Object.keys(data.value).map(function(key) {
  12244. fieldsSchema[key] = rule.defaultField;
  12245. });
  12246. }
  12247. fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
  12248. var paredFieldsSchema = {};
  12249. Object.keys(fieldsSchema).forEach(function(field) {
  12250. var fieldSchema = fieldsSchema[field];
  12251. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  12252. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  12253. });
  12254. var schema = new Schema2(paredFieldsSchema);
  12255. schema.messages(options.messages);
  12256. if (data.rule.options) {
  12257. data.rule.options.messages = options.messages;
  12258. data.rule.options.error = options.error;
  12259. }
  12260. schema.validate(data.value, data.rule.options || options, function(errs) {
  12261. var finalErrors = [];
  12262. if (filledErrors && filledErrors.length) {
  12263. finalErrors.push.apply(finalErrors, filledErrors);
  12264. }
  12265. if (errs && errs.length) {
  12266. finalErrors.push.apply(finalErrors, errs);
  12267. }
  12268. doIt(finalErrors.length ? finalErrors : null);
  12269. });
  12270. }
  12271. }
  12272. var res;
  12273. if (rule.asyncValidator) {
  12274. res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  12275. } else if (rule.validator) {
  12276. try {
  12277. res = rule.validator(rule, data.value, cb, data.source, options);
  12278. } catch (error) {
  12279. console.error == null ? void 0 : console.error(error);
  12280. if (!options.suppressValidatorError) {
  12281. setTimeout(function() {
  12282. throw error;
  12283. }, 0);
  12284. }
  12285. cb(error.message);
  12286. }
  12287. if (res === true) {
  12288. cb();
  12289. } else if (res === false) {
  12290. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  12291. } else if (res instanceof Array) {
  12292. cb(res);
  12293. } else if (res instanceof Error) {
  12294. cb(res.message);
  12295. }
  12296. }
  12297. if (res && res.then) {
  12298. res.then(function() {
  12299. return cb();
  12300. }, function(e) {
  12301. return cb(e);
  12302. });
  12303. }
  12304. }, function(results) {
  12305. complete(results);
  12306. }, source);
  12307. };
  12308. _proto.getType = function getType(rule) {
  12309. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  12310. rule.type = "pattern";
  12311. }
  12312. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  12313. throw new Error(format("Unknown rule type %s", rule.type));
  12314. }
  12315. return rule.type || "string";
  12316. };
  12317. _proto.getValidationMethod = function getValidationMethod(rule) {
  12318. if (typeof rule.validator === "function") {
  12319. return rule.validator;
  12320. }
  12321. var keys = Object.keys(rule);
  12322. var messageIndex = keys.indexOf("message");
  12323. if (messageIndex !== -1) {
  12324. keys.splice(messageIndex, 1);
  12325. }
  12326. if (keys.length === 1 && keys[0] === "required") {
  12327. return validators.required;
  12328. }
  12329. return validators[this.getType(rule)] || void 0;
  12330. };
  12331. return Schema2;
  12332. }();
  12333. Schema.register = function register(type4, validator) {
  12334. if (typeof validator !== "function") {
  12335. throw new Error("Cannot register a validator by type, validator is not a function");
  12336. }
  12337. validators[type4] = validator;
  12338. };
  12339. Schema.warning = warning;
  12340. Schema.messages = messages;
  12341. Schema.validators = validators;
  12342. const formItemValidateStates = [
  12343. "",
  12344. "error",
  12345. "validating",
  12346. "success"
  12347. ];
  12348. const formItemProps = buildProps({
  12349. label: String,
  12350. labelWidth: {
  12351. type: [String, Number],
  12352. default: ""
  12353. },
  12354. labelPosition: {
  12355. type: String,
  12356. values: ["left", "right", "top", ""],
  12357. default: ""
  12358. },
  12359. prop: {
  12360. type: definePropType([String, Array])
  12361. },
  12362. required: {
  12363. type: Boolean,
  12364. default: void 0
  12365. },
  12366. rules: {
  12367. type: definePropType([Object, Array])
  12368. },
  12369. error: String,
  12370. validateStatus: {
  12371. type: String,
  12372. values: formItemValidateStates
  12373. },
  12374. for: String,
  12375. inlineMessage: {
  12376. type: [String, Boolean],
  12377. default: ""
  12378. },
  12379. showMessage: {
  12380. type: Boolean,
  12381. default: true
  12382. },
  12383. size: {
  12384. type: String,
  12385. values: componentSizes
  12386. }
  12387. });
  12388. const COMPONENT_NAME$l = "ElLabelWrap";
  12389. var FormLabelWrap = defineComponent({
  12390. name: COMPONENT_NAME$l,
  12391. props: {
  12392. isAutoWidth: Boolean,
  12393. updateAll: Boolean
  12394. },
  12395. setup(props, {
  12396. slots
  12397. }) {
  12398. const formContext = inject(formContextKey, void 0);
  12399. const formItemContext = inject(formItemContextKey);
  12400. if (!formItemContext)
  12401. throwError(COMPONENT_NAME$l, "usage: <el-form-item><label-wrap /></el-form-item>");
  12402. const ns = useNamespace("form");
  12403. const el = ref();
  12404. const computedWidth = ref(0);
  12405. const getLabelWidth = () => {
  12406. var _a;
  12407. if ((_a = el.value) == null ? void 0 : _a.firstElementChild) {
  12408. const width = window.getComputedStyle(el.value.firstElementChild).width;
  12409. return Math.ceil(Number.parseFloat(width));
  12410. } else {
  12411. return 0;
  12412. }
  12413. };
  12414. const updateLabelWidth = (action = "update") => {
  12415. nextTick(() => {
  12416. if (slots.default && props.isAutoWidth) {
  12417. if (action === "update") {
  12418. computedWidth.value = getLabelWidth();
  12419. } else if (action === "remove") {
  12420. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  12421. }
  12422. }
  12423. });
  12424. };
  12425. const updateLabelWidthFn = () => updateLabelWidth("update");
  12426. onMounted(() => {
  12427. updateLabelWidthFn();
  12428. });
  12429. onBeforeUnmount(() => {
  12430. updateLabelWidth("remove");
  12431. });
  12432. onUpdated(() => updateLabelWidthFn());
  12433. watch(computedWidth, (val, oldVal) => {
  12434. if (props.updateAll) {
  12435. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  12436. }
  12437. });
  12438. useResizeObserver(computed(() => {
  12439. var _a, _b;
  12440. return (_b = (_a = el.value) == null ? void 0 : _a.firstElementChild) != null ? _b : null;
  12441. }), updateLabelWidthFn);
  12442. return () => {
  12443. var _a, _b;
  12444. if (!slots)
  12445. return null;
  12446. const {
  12447. isAutoWidth
  12448. } = props;
  12449. if (isAutoWidth) {
  12450. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  12451. const hasLabel = formItemContext == null ? void 0 : formItemContext.hasLabel;
  12452. const style = {};
  12453. if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") {
  12454. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  12455. const labelPosition = formItemContext.labelPosition || formContext.labelPosition;
  12456. const marginPosition = labelPosition === "left" ? "marginRight" : "marginLeft";
  12457. if (marginWidth) {
  12458. style[marginPosition] = `${marginWidth}px`;
  12459. }
  12460. }
  12461. return createVNode("div", {
  12462. "ref": el,
  12463. "class": [ns.be("item", "label-wrap")],
  12464. "style": style
  12465. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  12466. } else {
  12467. return createVNode(Fragment, {
  12468. "ref": el
  12469. }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]);
  12470. }
  12471. };
  12472. }
  12473. });
  12474. const __default__$1N = defineComponent({
  12475. name: "ElFormItem"
  12476. });
  12477. const _sfc_main$2t = /* @__PURE__ */ defineComponent({
  12478. ...__default__$1N,
  12479. props: formItemProps,
  12480. setup(__props, { expose }) {
  12481. const props = __props;
  12482. const slots = useSlots();
  12483. const formContext = inject(formContextKey, void 0);
  12484. const parentFormItemContext = inject(formItemContextKey, void 0);
  12485. const _size = useFormSize(void 0, { formItem: false });
  12486. const ns = useNamespace("form-item");
  12487. const labelId = useId().value;
  12488. const inputIds = ref([]);
  12489. const validateState = ref("");
  12490. const validateStateDebounced = refDebounced(validateState, 100);
  12491. const validateMessage = ref("");
  12492. const formItemRef = ref();
  12493. let initialValue = void 0;
  12494. let isResettingField = false;
  12495. const labelPosition = computed(() => props.labelPosition || (formContext == null ? void 0 : formContext.labelPosition));
  12496. const labelStyle = computed(() => {
  12497. if (labelPosition.value === "top") {
  12498. return {};
  12499. }
  12500. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  12501. if (labelWidth)
  12502. return { width: labelWidth };
  12503. return {};
  12504. });
  12505. const contentStyle = computed(() => {
  12506. if (labelPosition.value === "top" || (formContext == null ? void 0 : formContext.inline)) {
  12507. return {};
  12508. }
  12509. if (!props.label && !props.labelWidth && isNested) {
  12510. return {};
  12511. }
  12512. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  12513. if (!props.label && !slots.label) {
  12514. return { marginLeft: labelWidth };
  12515. }
  12516. return {};
  12517. });
  12518. const formItemClasses = computed(() => [
  12519. ns.b(),
  12520. ns.m(_size.value),
  12521. ns.is("error", validateState.value === "error"),
  12522. ns.is("validating", validateState.value === "validating"),
  12523. ns.is("success", validateState.value === "success"),
  12524. ns.is("required", isRequired.value || props.required),
  12525. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  12526. (formContext == null ? void 0 : formContext.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left",
  12527. {
  12528. [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon,
  12529. [ns.m(`label-${labelPosition.value}`)]: labelPosition.value
  12530. }
  12531. ]);
  12532. const _inlineMessage = computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  12533. const validateClasses = computed(() => [
  12534. ns.e("error"),
  12535. { [ns.em("error", "inline")]: _inlineMessage.value }
  12536. ]);
  12537. const propString = computed(() => {
  12538. if (!props.prop)
  12539. return "";
  12540. return isString$1(props.prop) ? props.prop : props.prop.join(".");
  12541. });
  12542. const hasLabel = computed(() => {
  12543. return !!(props.label || slots.label);
  12544. });
  12545. const labelFor = computed(() => {
  12546. return props.for || (inputIds.value.length === 1 ? inputIds.value[0] : void 0);
  12547. });
  12548. const isGroup = computed(() => {
  12549. return !labelFor.value && hasLabel.value;
  12550. });
  12551. const isNested = !!parentFormItemContext;
  12552. const fieldValue = computed(() => {
  12553. const model = formContext == null ? void 0 : formContext.model;
  12554. if (!model || !props.prop) {
  12555. return;
  12556. }
  12557. return getProp(model, props.prop).value;
  12558. });
  12559. const normalizedRules = computed(() => {
  12560. const { required } = props;
  12561. const rules = [];
  12562. if (props.rules) {
  12563. rules.push(...castArray$1(props.rules));
  12564. }
  12565. const formRules = formContext == null ? void 0 : formContext.rules;
  12566. if (formRules && props.prop) {
  12567. const _rules = getProp(formRules, props.prop).value;
  12568. if (_rules) {
  12569. rules.push(...castArray$1(_rules));
  12570. }
  12571. }
  12572. if (required !== void 0) {
  12573. const requiredRules = rules.map((rule, i) => [rule, i]).filter(([rule]) => Object.keys(rule).includes("required"));
  12574. if (requiredRules.length > 0) {
  12575. for (const [rule, i] of requiredRules) {
  12576. if (rule.required === required)
  12577. continue;
  12578. rules[i] = { ...rule, required };
  12579. }
  12580. } else {
  12581. rules.push({ required });
  12582. }
  12583. }
  12584. return rules;
  12585. });
  12586. const validateEnabled = computed(() => normalizedRules.value.length > 0);
  12587. const getFilteredRule = (trigger) => {
  12588. const rules = normalizedRules.value;
  12589. return rules.filter((rule) => {
  12590. if (!rule.trigger || !trigger)
  12591. return true;
  12592. if (isArray$1(rule.trigger)) {
  12593. return rule.trigger.includes(trigger);
  12594. } else {
  12595. return rule.trigger === trigger;
  12596. }
  12597. }).map(({ trigger: trigger2, ...rule }) => rule);
  12598. };
  12599. const isRequired = computed(() => normalizedRules.value.some((rule) => rule.required));
  12600. const shouldShowError = computed(() => {
  12601. var _a;
  12602. return validateStateDebounced.value === "error" && props.showMessage && ((_a = formContext == null ? void 0 : formContext.showMessage) != null ? _a : true);
  12603. });
  12604. const currentLabel = computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  12605. const setValidationState = (state) => {
  12606. validateState.value = state;
  12607. };
  12608. const onValidationFailed = (error) => {
  12609. var _a, _b;
  12610. const { errors, fields } = error;
  12611. if (!errors || !fields) {
  12612. console.error(error);
  12613. }
  12614. setValidationState("error");
  12615. validateMessage.value = errors ? (_b = (_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) != null ? _b : `${props.prop} is required` : "";
  12616. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  12617. };
  12618. const onValidationSucceeded = () => {
  12619. setValidationState("success");
  12620. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  12621. };
  12622. const doValidate = async (rules) => {
  12623. const modelName = propString.value;
  12624. const validator = new Schema({
  12625. [modelName]: rules
  12626. });
  12627. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  12628. onValidationSucceeded();
  12629. return true;
  12630. }).catch((err) => {
  12631. onValidationFailed(err);
  12632. return Promise.reject(err);
  12633. });
  12634. };
  12635. const validate = async (trigger, callback) => {
  12636. if (isResettingField || !props.prop) {
  12637. return false;
  12638. }
  12639. const hasCallback = isFunction$1(callback);
  12640. if (!validateEnabled.value) {
  12641. callback == null ? void 0 : callback(false);
  12642. return false;
  12643. }
  12644. const rules = getFilteredRule(trigger);
  12645. if (rules.length === 0) {
  12646. callback == null ? void 0 : callback(true);
  12647. return true;
  12648. }
  12649. setValidationState("validating");
  12650. return doValidate(rules).then(() => {
  12651. callback == null ? void 0 : callback(true);
  12652. return true;
  12653. }).catch((err) => {
  12654. const { fields } = err;
  12655. callback == null ? void 0 : callback(false, fields);
  12656. return hasCallback ? false : Promise.reject(fields);
  12657. });
  12658. };
  12659. const clearValidate = () => {
  12660. setValidationState("");
  12661. validateMessage.value = "";
  12662. isResettingField = false;
  12663. };
  12664. const resetField = async () => {
  12665. const model = formContext == null ? void 0 : formContext.model;
  12666. if (!model || !props.prop)
  12667. return;
  12668. const computedValue = getProp(model, props.prop);
  12669. isResettingField = true;
  12670. computedValue.value = clone(initialValue);
  12671. await nextTick();
  12672. clearValidate();
  12673. isResettingField = false;
  12674. };
  12675. const addInputId = (id) => {
  12676. if (!inputIds.value.includes(id)) {
  12677. inputIds.value.push(id);
  12678. }
  12679. };
  12680. const removeInputId = (id) => {
  12681. inputIds.value = inputIds.value.filter((listId) => listId !== id);
  12682. };
  12683. watch(() => props.error, (val) => {
  12684. validateMessage.value = val || "";
  12685. setValidationState(val ? "error" : "");
  12686. }, { immediate: true });
  12687. watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  12688. const context = reactive({
  12689. ...toRefs(props),
  12690. $el: formItemRef,
  12691. size: _size,
  12692. validateState,
  12693. labelId,
  12694. inputIds,
  12695. isGroup,
  12696. hasLabel,
  12697. fieldValue,
  12698. addInputId,
  12699. removeInputId,
  12700. resetField,
  12701. clearValidate,
  12702. validate
  12703. });
  12704. provide(formItemContextKey, context);
  12705. onMounted(() => {
  12706. if (props.prop) {
  12707. formContext == null ? void 0 : formContext.addField(context);
  12708. initialValue = clone(fieldValue.value);
  12709. }
  12710. });
  12711. onBeforeUnmount(() => {
  12712. formContext == null ? void 0 : formContext.removeField(context);
  12713. });
  12714. expose({
  12715. size: _size,
  12716. validateMessage,
  12717. validateState,
  12718. validate,
  12719. clearValidate,
  12720. resetField
  12721. });
  12722. return (_ctx, _cache) => {
  12723. var _a;
  12724. return openBlock(), createElementBlock("div", {
  12725. ref_key: "formItemRef",
  12726. ref: formItemRef,
  12727. class: normalizeClass(unref(formItemClasses)),
  12728. role: unref(isGroup) ? "group" : void 0,
  12729. "aria-labelledby": unref(isGroup) ? unref(labelId) : void 0
  12730. }, [
  12731. createVNode(unref(FormLabelWrap), {
  12732. "is-auto-width": unref(labelStyle).width === "auto",
  12733. "update-all": ((_a = unref(formContext)) == null ? void 0 : _a.labelWidth) === "auto"
  12734. }, {
  12735. default: withCtx(() => [
  12736. unref(hasLabel) ? (openBlock(), createBlock(resolveDynamicComponent(unref(labelFor) ? "label" : "div"), {
  12737. key: 0,
  12738. id: unref(labelId),
  12739. for: unref(labelFor),
  12740. class: normalizeClass(unref(ns).e("label")),
  12741. style: normalizeStyle(unref(labelStyle))
  12742. }, {
  12743. default: withCtx(() => [
  12744. renderSlot(_ctx.$slots, "label", { label: unref(currentLabel) }, () => [
  12745. createTextVNode(toDisplayString(unref(currentLabel)), 1)
  12746. ])
  12747. ]),
  12748. _: 3
  12749. }, 8, ["id", "for", "class", "style"])) : createCommentVNode("v-if", true)
  12750. ]),
  12751. _: 3
  12752. }, 8, ["is-auto-width", "update-all"]),
  12753. createElementVNode("div", {
  12754. class: normalizeClass(unref(ns).e("content")),
  12755. style: normalizeStyle(unref(contentStyle))
  12756. }, [
  12757. renderSlot(_ctx.$slots, "default"),
  12758. createVNode(TransitionGroup, {
  12759. name: `${unref(ns).namespace.value}-zoom-in-top`
  12760. }, {
  12761. default: withCtx(() => [
  12762. unref(shouldShowError) ? renderSlot(_ctx.$slots, "error", {
  12763. key: 0,
  12764. error: validateMessage.value
  12765. }, () => [
  12766. createElementVNode("div", {
  12767. class: normalizeClass(unref(validateClasses))
  12768. }, toDisplayString(validateMessage.value), 3)
  12769. ]) : createCommentVNode("v-if", true)
  12770. ]),
  12771. _: 3
  12772. }, 8, ["name"])
  12773. ], 6)
  12774. ], 10, ["role", "aria-labelledby"]);
  12775. };
  12776. }
  12777. });
  12778. var FormItem = /* @__PURE__ */ _export_sfc(_sfc_main$2t, [["__file", "form-item.vue"]]);
  12779. const ElForm = withInstall(Form, {
  12780. FormItem
  12781. });
  12782. const ElFormItem = withNoopInstall(FormItem);
  12783. let hiddenTextarea = void 0;
  12784. const HIDDEN_STYLE = `
  12785. height:0 !important;
  12786. visibility:hidden !important;
  12787. ${isFirefox() ? "" : "overflow:hidden !important;"}
  12788. position:absolute !important;
  12789. z-index:-1000 !important;
  12790. top:0 !important;
  12791. right:0 !important;
  12792. `;
  12793. const CONTEXT_STYLE = [
  12794. "letter-spacing",
  12795. "line-height",
  12796. "padding-top",
  12797. "padding-bottom",
  12798. "font-family",
  12799. "font-weight",
  12800. "font-size",
  12801. "text-rendering",
  12802. "text-transform",
  12803. "width",
  12804. "text-indent",
  12805. "padding-left",
  12806. "padding-right",
  12807. "border-width",
  12808. "box-sizing"
  12809. ];
  12810. function calculateNodeStyling(targetElement) {
  12811. const style = window.getComputedStyle(targetElement);
  12812. const boxSizing = style.getPropertyValue("box-sizing");
  12813. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  12814. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  12815. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  12816. return { contextStyle, paddingSize, borderSize, boxSizing };
  12817. }
  12818. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  12819. var _a;
  12820. if (!hiddenTextarea) {
  12821. hiddenTextarea = document.createElement("textarea");
  12822. document.body.appendChild(hiddenTextarea);
  12823. }
  12824. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  12825. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  12826. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  12827. let height = hiddenTextarea.scrollHeight;
  12828. const result = {};
  12829. if (boxSizing === "border-box") {
  12830. height = height + borderSize;
  12831. } else if (boxSizing === "content-box") {
  12832. height = height - paddingSize;
  12833. }
  12834. hiddenTextarea.value = "";
  12835. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  12836. if (isNumber(minRows)) {
  12837. let minHeight = singleRowHeight * minRows;
  12838. if (boxSizing === "border-box") {
  12839. minHeight = minHeight + paddingSize + borderSize;
  12840. }
  12841. height = Math.max(minHeight, height);
  12842. result.minHeight = `${minHeight}px`;
  12843. }
  12844. if (isNumber(maxRows)) {
  12845. let maxHeight = singleRowHeight * maxRows;
  12846. if (boxSizing === "border-box") {
  12847. maxHeight = maxHeight + paddingSize + borderSize;
  12848. }
  12849. height = Math.min(maxHeight, height);
  12850. }
  12851. result.height = `${height}px`;
  12852. (_a = hiddenTextarea.parentNode) == null ? void 0 : _a.removeChild(hiddenTextarea);
  12853. hiddenTextarea = void 0;
  12854. return result;
  12855. }
  12856. const inputProps = buildProps({
  12857. id: {
  12858. type: String,
  12859. default: void 0
  12860. },
  12861. size: useSizeProp,
  12862. disabled: Boolean,
  12863. modelValue: {
  12864. type: definePropType([
  12865. String,
  12866. Number,
  12867. Object
  12868. ]),
  12869. default: ""
  12870. },
  12871. maxlength: {
  12872. type: [String, Number]
  12873. },
  12874. minlength: {
  12875. type: [String, Number]
  12876. },
  12877. type: {
  12878. type: String,
  12879. default: "text"
  12880. },
  12881. resize: {
  12882. type: String,
  12883. values: ["none", "both", "horizontal", "vertical"]
  12884. },
  12885. autosize: {
  12886. type: definePropType([Boolean, Object]),
  12887. default: false
  12888. },
  12889. autocomplete: {
  12890. type: String,
  12891. default: "off"
  12892. },
  12893. formatter: {
  12894. type: Function
  12895. },
  12896. parser: {
  12897. type: Function
  12898. },
  12899. placeholder: {
  12900. type: String
  12901. },
  12902. form: {
  12903. type: String
  12904. },
  12905. readonly: Boolean,
  12906. clearable: Boolean,
  12907. showPassword: Boolean,
  12908. showWordLimit: Boolean,
  12909. suffixIcon: {
  12910. type: iconPropType
  12911. },
  12912. prefixIcon: {
  12913. type: iconPropType
  12914. },
  12915. containerRole: {
  12916. type: String,
  12917. default: void 0
  12918. },
  12919. tabindex: {
  12920. type: [String, Number],
  12921. default: 0
  12922. },
  12923. validateEvent: {
  12924. type: Boolean,
  12925. default: true
  12926. },
  12927. inputStyle: {
  12928. type: definePropType([Object, Array, String]),
  12929. default: () => mutable({})
  12930. },
  12931. autofocus: Boolean,
  12932. rows: {
  12933. type: Number,
  12934. default: 2
  12935. },
  12936. ...useAriaProps(["ariaLabel"])
  12937. });
  12938. const inputEmits = {
  12939. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  12940. input: (value) => isString$1(value),
  12941. change: (value) => isString$1(value),
  12942. focus: (evt) => evt instanceof FocusEvent,
  12943. blur: (evt) => evt instanceof FocusEvent,
  12944. clear: () => true,
  12945. mouseleave: (evt) => evt instanceof MouseEvent,
  12946. mouseenter: (evt) => evt instanceof MouseEvent,
  12947. keydown: (evt) => evt instanceof Event,
  12948. compositionstart: (evt) => evt instanceof CompositionEvent,
  12949. compositionupdate: (evt) => evt instanceof CompositionEvent,
  12950. compositionend: (evt) => evt instanceof CompositionEvent
  12951. };
  12952. const __default__$1M = defineComponent({
  12953. name: "ElInput",
  12954. inheritAttrs: false
  12955. });
  12956. const _sfc_main$2s = /* @__PURE__ */ defineComponent({
  12957. ...__default__$1M,
  12958. props: inputProps,
  12959. emits: inputEmits,
  12960. setup(__props, { expose, emit }) {
  12961. const props = __props;
  12962. const rawAttrs = useAttrs$1();
  12963. const attrs = useAttrs();
  12964. const slots = useSlots();
  12965. const containerKls = computed(() => [
  12966. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  12967. nsInput.m(inputSize.value),
  12968. nsInput.is("disabled", inputDisabled.value),
  12969. nsInput.is("exceed", inputExceed.value),
  12970. {
  12971. [nsInput.b("group")]: slots.prepend || slots.append,
  12972. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  12973. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  12974. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value,
  12975. [nsInput.b("hidden")]: props.type === "hidden"
  12976. },
  12977. rawAttrs.class
  12978. ]);
  12979. const wrapperKls = computed(() => [
  12980. nsInput.e("wrapper"),
  12981. nsInput.is("focus", isFocused.value)
  12982. ]);
  12983. const { form: elForm, formItem: elFormItem } = useFormItem();
  12984. const { inputId } = useFormItemInputId(props, {
  12985. formItemContext: elFormItem
  12986. });
  12987. const inputSize = useFormSize();
  12988. const inputDisabled = useFormDisabled();
  12989. const nsInput = useNamespace("input");
  12990. const nsTextarea = useNamespace("textarea");
  12991. const input = shallowRef();
  12992. const textarea = shallowRef();
  12993. const hovering = ref(false);
  12994. const passwordVisible = ref(false);
  12995. const countStyle = ref();
  12996. const textareaCalcStyle = shallowRef(props.inputStyle);
  12997. const _ref = computed(() => input.value || textarea.value);
  12998. const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(_ref, {
  12999. beforeFocus() {
  13000. return inputDisabled.value;
  13001. },
  13002. afterBlur() {
  13003. var _a;
  13004. if (props.validateEvent) {
  13005. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "blur").catch((err) => debugWarn());
  13006. }
  13007. }
  13008. });
  13009. const needStatusIcon = computed(() => {
  13010. var _a;
  13011. return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
  13012. });
  13013. const validateState = computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  13014. const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  13015. const passwordIcon = computed(() => passwordVisible.value ? view_default : hide_default);
  13016. const containerStyle = computed(() => [
  13017. rawAttrs.style
  13018. ]);
  13019. const textareaStyle = computed(() => [
  13020. props.inputStyle,
  13021. textareaCalcStyle.value,
  13022. { resize: props.resize }
  13023. ]);
  13024. const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  13025. const showClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (isFocused.value || hovering.value));
  13026. const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !!nativeInputValue.value && (!!nativeInputValue.value || isFocused.value));
  13027. const isWordLimitVisible = computed(() => props.showWordLimit && !!props.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  13028. const textLength = computed(() => nativeInputValue.value.length);
  13029. const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(props.maxlength));
  13030. const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  13031. const [recordCursor, setCursor] = useCursor(input);
  13032. useResizeObserver(textarea, (entries) => {
  13033. onceInitSizeTextarea();
  13034. if (!isWordLimitVisible.value || props.resize !== "both")
  13035. return;
  13036. const entry = entries[0];
  13037. const { width } = entry.contentRect;
  13038. countStyle.value = {
  13039. right: `calc(100% - ${width + 15 + 6}px)`
  13040. };
  13041. });
  13042. const resizeTextarea = () => {
  13043. const { type, autosize } = props;
  13044. if (!isClient || type !== "textarea" || !textarea.value)
  13045. return;
  13046. if (autosize) {
  13047. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  13048. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  13049. const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
  13050. textareaCalcStyle.value = {
  13051. overflowY: "hidden",
  13052. ...textareaStyle2
  13053. };
  13054. nextTick(() => {
  13055. textarea.value.offsetHeight;
  13056. textareaCalcStyle.value = textareaStyle2;
  13057. });
  13058. } else {
  13059. textareaCalcStyle.value = {
  13060. minHeight: calcTextareaHeight(textarea.value).minHeight
  13061. };
  13062. }
  13063. };
  13064. const createOnceInitResize = (resizeTextarea2) => {
  13065. let isInit = false;
  13066. return () => {
  13067. var _a;
  13068. if (isInit || !props.autosize)
  13069. return;
  13070. const isElHidden = ((_a = textarea.value) == null ? void 0 : _a.offsetParent) === null;
  13071. if (!isElHidden) {
  13072. resizeTextarea2();
  13073. isInit = true;
  13074. }
  13075. };
  13076. };
  13077. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  13078. const setNativeInputValue = () => {
  13079. const input2 = _ref.value;
  13080. const formatterValue = props.formatter ? props.formatter(nativeInputValue.value) : nativeInputValue.value;
  13081. if (!input2 || input2.value === formatterValue)
  13082. return;
  13083. input2.value = formatterValue;
  13084. };
  13085. const handleInput = async (event) => {
  13086. recordCursor();
  13087. let { value } = event.target;
  13088. if (props.formatter) {
  13089. value = props.parser ? props.parser(value) : value;
  13090. }
  13091. if (isComposing.value)
  13092. return;
  13093. if (value === nativeInputValue.value) {
  13094. setNativeInputValue();
  13095. return;
  13096. }
  13097. emit(UPDATE_MODEL_EVENT, value);
  13098. emit("input", value);
  13099. await nextTick();
  13100. setNativeInputValue();
  13101. setCursor();
  13102. };
  13103. const handleChange = (event) => {
  13104. emit("change", event.target.value);
  13105. };
  13106. const {
  13107. isComposing,
  13108. handleCompositionStart,
  13109. handleCompositionUpdate,
  13110. handleCompositionEnd
  13111. } = useComposition({ emit, afterComposition: handleInput });
  13112. const handlePasswordVisible = () => {
  13113. recordCursor();
  13114. passwordVisible.value = !passwordVisible.value;
  13115. setTimeout(setCursor);
  13116. };
  13117. const focus = () => {
  13118. var _a;
  13119. return (_a = _ref.value) == null ? void 0 : _a.focus();
  13120. };
  13121. const blur = () => {
  13122. var _a;
  13123. return (_a = _ref.value) == null ? void 0 : _a.blur();
  13124. };
  13125. const handleMouseLeave = (evt) => {
  13126. hovering.value = false;
  13127. emit("mouseleave", evt);
  13128. };
  13129. const handleMouseEnter = (evt) => {
  13130. hovering.value = true;
  13131. emit("mouseenter", evt);
  13132. };
  13133. const handleKeydown = (evt) => {
  13134. emit("keydown", evt);
  13135. };
  13136. const select = () => {
  13137. var _a;
  13138. (_a = _ref.value) == null ? void 0 : _a.select();
  13139. };
  13140. const clear = () => {
  13141. emit(UPDATE_MODEL_EVENT, "");
  13142. emit("change", "");
  13143. emit("clear");
  13144. emit("input", "");
  13145. };
  13146. watch(() => props.modelValue, () => {
  13147. var _a;
  13148. nextTick(() => resizeTextarea());
  13149. if (props.validateEvent) {
  13150. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  13151. }
  13152. });
  13153. watch(nativeInputValue, () => setNativeInputValue());
  13154. watch(() => props.type, async () => {
  13155. await nextTick();
  13156. setNativeInputValue();
  13157. resizeTextarea();
  13158. });
  13159. onMounted(() => {
  13160. if (!props.formatter && props.parser) ;
  13161. setNativeInputValue();
  13162. nextTick(resizeTextarea);
  13163. });
  13164. expose({
  13165. input,
  13166. textarea,
  13167. ref: _ref,
  13168. textareaStyle,
  13169. autosize: toRef(props, "autosize"),
  13170. isComposing,
  13171. focus,
  13172. blur,
  13173. select,
  13174. clear,
  13175. resizeTextarea
  13176. });
  13177. return (_ctx, _cache) => {
  13178. return openBlock(), createElementBlock("div", {
  13179. class: normalizeClass([
  13180. unref(containerKls),
  13181. {
  13182. [unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  13183. [unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend
  13184. }
  13185. ]),
  13186. style: normalizeStyle(unref(containerStyle)),
  13187. onMouseenter: handleMouseEnter,
  13188. onMouseleave: handleMouseLeave
  13189. }, [
  13190. createCommentVNode(" input "),
  13191. _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  13192. createCommentVNode(" prepend slot "),
  13193. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  13194. key: 0,
  13195. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  13196. }, [
  13197. renderSlot(_ctx.$slots, "prepend")
  13198. ], 2)) : createCommentVNode("v-if", true),
  13199. createElementVNode("div", {
  13200. ref_key: "wrapperRef",
  13201. ref: wrapperRef,
  13202. class: normalizeClass(unref(wrapperKls))
  13203. }, [
  13204. createCommentVNode(" prefix slot "),
  13205. _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
  13206. key: 0,
  13207. class: normalizeClass(unref(nsInput).e("prefix"))
  13208. }, [
  13209. createElementVNode("span", {
  13210. class: normalizeClass(unref(nsInput).e("prefix-inner"))
  13211. }, [
  13212. renderSlot(_ctx.$slots, "prefix"),
  13213. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  13214. key: 0,
  13215. class: normalizeClass(unref(nsInput).e("icon"))
  13216. }, {
  13217. default: withCtx(() => [
  13218. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  13219. ]),
  13220. _: 1
  13221. }, 8, ["class"])) : createCommentVNode("v-if", true)
  13222. ], 2)
  13223. ], 2)) : createCommentVNode("v-if", true),
  13224. createElementVNode("input", mergeProps({
  13225. id: unref(inputId),
  13226. ref_key: "input",
  13227. ref: input,
  13228. class: unref(nsInput).e("inner")
  13229. }, unref(attrs), {
  13230. minlength: _ctx.minlength,
  13231. maxlength: _ctx.maxlength,
  13232. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  13233. disabled: unref(inputDisabled),
  13234. readonly: _ctx.readonly,
  13235. autocomplete: _ctx.autocomplete,
  13236. tabindex: _ctx.tabindex,
  13237. "aria-label": _ctx.ariaLabel,
  13238. placeholder: _ctx.placeholder,
  13239. style: _ctx.inputStyle,
  13240. form: _ctx.form,
  13241. autofocus: _ctx.autofocus,
  13242. role: _ctx.containerRole,
  13243. onCompositionstart: unref(handleCompositionStart),
  13244. onCompositionupdate: unref(handleCompositionUpdate),
  13245. onCompositionend: unref(handleCompositionEnd),
  13246. onInput: handleInput,
  13247. onChange: handleChange,
  13248. onKeydown: handleKeydown
  13249. }), null, 16, ["id", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "role", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
  13250. createCommentVNode(" suffix slot "),
  13251. unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
  13252. key: 1,
  13253. class: normalizeClass(unref(nsInput).e("suffix"))
  13254. }, [
  13255. createElementVNode("span", {
  13256. class: normalizeClass(unref(nsInput).e("suffix-inner"))
  13257. }, [
  13258. !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  13259. renderSlot(_ctx.$slots, "suffix"),
  13260. _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  13261. key: 0,
  13262. class: normalizeClass(unref(nsInput).e("icon"))
  13263. }, {
  13264. default: withCtx(() => [
  13265. (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
  13266. ]),
  13267. _: 1
  13268. }, 8, ["class"])) : createCommentVNode("v-if", true)
  13269. ], 64)) : createCommentVNode("v-if", true),
  13270. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  13271. key: 1,
  13272. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  13273. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  13274. onClick: clear
  13275. }, {
  13276. default: withCtx(() => [
  13277. createVNode(unref(circle_close_default))
  13278. ]),
  13279. _: 1
  13280. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
  13281. unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  13282. key: 2,
  13283. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  13284. onClick: handlePasswordVisible
  13285. }, {
  13286. default: withCtx(() => [
  13287. (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
  13288. ]),
  13289. _: 1
  13290. }, 8, ["class"])) : createCommentVNode("v-if", true),
  13291. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  13292. key: 3,
  13293. class: normalizeClass(unref(nsInput).e("count"))
  13294. }, [
  13295. createElementVNode("span", {
  13296. class: normalizeClass(unref(nsInput).e("count-inner"))
  13297. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(_ctx.maxlength), 3)
  13298. ], 2)) : createCommentVNode("v-if", true),
  13299. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  13300. key: 4,
  13301. class: normalizeClass([
  13302. unref(nsInput).e("icon"),
  13303. unref(nsInput).e("validateIcon"),
  13304. unref(nsInput).is("loading", unref(validateState) === "validating")
  13305. ])
  13306. }, {
  13307. default: withCtx(() => [
  13308. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  13309. ]),
  13310. _: 1
  13311. }, 8, ["class"])) : createCommentVNode("v-if", true)
  13312. ], 2)
  13313. ], 2)) : createCommentVNode("v-if", true)
  13314. ], 2),
  13315. createCommentVNode(" append slot "),
  13316. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  13317. key: 1,
  13318. class: normalizeClass(unref(nsInput).be("group", "append"))
  13319. }, [
  13320. renderSlot(_ctx.$slots, "append")
  13321. ], 2)) : createCommentVNode("v-if", true)
  13322. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  13323. createCommentVNode(" textarea "),
  13324. createElementVNode("textarea", mergeProps({
  13325. id: unref(inputId),
  13326. ref_key: "textarea",
  13327. ref: textarea,
  13328. class: [unref(nsTextarea).e("inner"), unref(nsInput).is("focus", unref(isFocused))]
  13329. }, unref(attrs), {
  13330. minlength: _ctx.minlength,
  13331. maxlength: _ctx.maxlength,
  13332. tabindex: _ctx.tabindex,
  13333. disabled: unref(inputDisabled),
  13334. readonly: _ctx.readonly,
  13335. autocomplete: _ctx.autocomplete,
  13336. style: unref(textareaStyle),
  13337. "aria-label": _ctx.ariaLabel,
  13338. placeholder: _ctx.placeholder,
  13339. form: _ctx.form,
  13340. autofocus: _ctx.autofocus,
  13341. rows: _ctx.rows,
  13342. role: _ctx.containerRole,
  13343. onCompositionstart: unref(handleCompositionStart),
  13344. onCompositionupdate: unref(handleCompositionUpdate),
  13345. onCompositionend: unref(handleCompositionEnd),
  13346. onInput: handleInput,
  13347. onFocus: unref(handleFocus),
  13348. onBlur: unref(handleBlur),
  13349. onChange: handleChange,
  13350. onKeydown: handleKeydown
  13351. }), null, 16, ["id", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "role", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]),
  13352. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  13353. key: 0,
  13354. style: normalizeStyle(countStyle.value),
  13355. class: normalizeClass(unref(nsInput).e("count"))
  13356. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(_ctx.maxlength), 7)) : createCommentVNode("v-if", true)
  13357. ], 64))
  13358. ], 38);
  13359. };
  13360. }
  13361. });
  13362. var Input = /* @__PURE__ */ _export_sfc(_sfc_main$2s, [["__file", "input.vue"]]);
  13363. const ElInput = withInstall(Input);
  13364. const GAP = 4;
  13365. const BAR_MAP = {
  13366. vertical: {
  13367. offset: "offsetHeight",
  13368. scroll: "scrollTop",
  13369. scrollSize: "scrollHeight",
  13370. size: "height",
  13371. key: "vertical",
  13372. axis: "Y",
  13373. client: "clientY",
  13374. direction: "top"
  13375. },
  13376. horizontal: {
  13377. offset: "offsetWidth",
  13378. scroll: "scrollLeft",
  13379. scrollSize: "scrollWidth",
  13380. size: "width",
  13381. key: "horizontal",
  13382. axis: "X",
  13383. client: "clientX",
  13384. direction: "left"
  13385. }
  13386. };
  13387. const renderThumbStyle$1 = ({
  13388. move,
  13389. size,
  13390. bar
  13391. }) => ({
  13392. [bar.size]: size,
  13393. transform: `translate${bar.axis}(${move}%)`
  13394. });
  13395. const scrollbarContextKey = Symbol("scrollbarContextKey");
  13396. const thumbProps = buildProps({
  13397. vertical: Boolean,
  13398. size: String,
  13399. move: Number,
  13400. ratio: {
  13401. type: Number,
  13402. required: true
  13403. },
  13404. always: Boolean
  13405. });
  13406. const COMPONENT_NAME$k = "Thumb";
  13407. const _sfc_main$2r = /* @__PURE__ */ defineComponent({
  13408. __name: "thumb",
  13409. props: thumbProps,
  13410. setup(__props) {
  13411. const props = __props;
  13412. const scrollbar = inject(scrollbarContextKey);
  13413. const ns = useNamespace("scrollbar");
  13414. if (!scrollbar)
  13415. throwError(COMPONENT_NAME$k, "can not inject scrollbar context");
  13416. const instance = ref();
  13417. const thumb = ref();
  13418. const thumbState = ref({});
  13419. const visible = ref(false);
  13420. let cursorDown = false;
  13421. let cursorLeave = false;
  13422. let originalOnSelectStart = isClient ? document.onselectstart : null;
  13423. const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  13424. const thumbStyle = computed(() => renderThumbStyle$1({
  13425. size: props.size,
  13426. move: props.move,
  13427. bar: bar.value
  13428. }));
  13429. const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  13430. const clickThumbHandler = (e) => {
  13431. var _a;
  13432. e.stopPropagation();
  13433. if (e.ctrlKey || [1, 2].includes(e.button))
  13434. return;
  13435. (_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
  13436. startDrag(e);
  13437. const el = e.currentTarget;
  13438. if (!el)
  13439. return;
  13440. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  13441. };
  13442. const clickTrackHandler = (e) => {
  13443. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  13444. return;
  13445. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  13446. const thumbHalf = thumb.value[bar.value.offset] / 2;
  13447. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  13448. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  13449. };
  13450. const startDrag = (e) => {
  13451. e.stopImmediatePropagation();
  13452. cursorDown = true;
  13453. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  13454. document.addEventListener("mouseup", mouseUpDocumentHandler);
  13455. originalOnSelectStart = document.onselectstart;
  13456. document.onselectstart = () => false;
  13457. };
  13458. const mouseMoveDocumentHandler = (e) => {
  13459. if (!instance.value || !thumb.value)
  13460. return;
  13461. if (cursorDown === false)
  13462. return;
  13463. const prevPage = thumbState.value[bar.value.axis];
  13464. if (!prevPage)
  13465. return;
  13466. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  13467. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  13468. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  13469. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  13470. };
  13471. const mouseUpDocumentHandler = () => {
  13472. cursorDown = false;
  13473. thumbState.value[bar.value.axis] = 0;
  13474. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  13475. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  13476. restoreOnselectstart();
  13477. if (cursorLeave)
  13478. visible.value = false;
  13479. };
  13480. const mouseMoveScrollbarHandler = () => {
  13481. cursorLeave = false;
  13482. visible.value = !!props.size;
  13483. };
  13484. const mouseLeaveScrollbarHandler = () => {
  13485. cursorLeave = true;
  13486. visible.value = cursorDown;
  13487. };
  13488. onBeforeUnmount(() => {
  13489. restoreOnselectstart();
  13490. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  13491. });
  13492. const restoreOnselectstart = () => {
  13493. if (document.onselectstart !== originalOnSelectStart)
  13494. document.onselectstart = originalOnSelectStart;
  13495. };
  13496. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  13497. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  13498. return (_ctx, _cache) => {
  13499. return openBlock(), createBlock(Transition, {
  13500. name: unref(ns).b("fade"),
  13501. persisted: ""
  13502. }, {
  13503. default: withCtx(() => [
  13504. withDirectives(createElementVNode("div", {
  13505. ref_key: "instance",
  13506. ref: instance,
  13507. class: normalizeClass([unref(ns).e("bar"), unref(ns).is(unref(bar).key)]),
  13508. onMousedown: clickTrackHandler
  13509. }, [
  13510. createElementVNode("div", {
  13511. ref_key: "thumb",
  13512. ref: thumb,
  13513. class: normalizeClass(unref(ns).e("thumb")),
  13514. style: normalizeStyle(unref(thumbStyle)),
  13515. onMousedown: clickThumbHandler
  13516. }, null, 38)
  13517. ], 34), [
  13518. [vShow, _ctx.always || visible.value]
  13519. ])
  13520. ]),
  13521. _: 1
  13522. }, 8, ["name"]);
  13523. };
  13524. }
  13525. });
  13526. var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main$2r, [["__file", "thumb.vue"]]);
  13527. const barProps = buildProps({
  13528. always: {
  13529. type: Boolean,
  13530. default: true
  13531. },
  13532. minSize: {
  13533. type: Number,
  13534. required: true
  13535. }
  13536. });
  13537. const _sfc_main$2q = /* @__PURE__ */ defineComponent({
  13538. __name: "bar",
  13539. props: barProps,
  13540. setup(__props, { expose }) {
  13541. const props = __props;
  13542. const scrollbar = inject(scrollbarContextKey);
  13543. const moveX = ref(0);
  13544. const moveY = ref(0);
  13545. const sizeWidth = ref("");
  13546. const sizeHeight = ref("");
  13547. const ratioY = ref(1);
  13548. const ratioX = ref(1);
  13549. const handleScroll = (wrap) => {
  13550. if (wrap) {
  13551. const offsetHeight = wrap.offsetHeight - GAP;
  13552. const offsetWidth = wrap.offsetWidth - GAP;
  13553. moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
  13554. moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
  13555. }
  13556. };
  13557. const update = () => {
  13558. const wrap = scrollbar == null ? void 0 : scrollbar.wrapElement;
  13559. if (!wrap)
  13560. return;
  13561. const offsetHeight = wrap.offsetHeight - GAP;
  13562. const offsetWidth = wrap.offsetWidth - GAP;
  13563. const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
  13564. const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
  13565. const height = Math.max(originalHeight, props.minSize);
  13566. const width = Math.max(originalWidth, props.minSize);
  13567. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  13568. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  13569. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  13570. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  13571. };
  13572. expose({
  13573. handleScroll,
  13574. update
  13575. });
  13576. return (_ctx, _cache) => {
  13577. return openBlock(), createElementBlock(Fragment, null, [
  13578. createVNode(Thumb, {
  13579. move: moveX.value,
  13580. ratio: ratioX.value,
  13581. size: sizeWidth.value,
  13582. always: _ctx.always
  13583. }, null, 8, ["move", "ratio", "size", "always"]),
  13584. createVNode(Thumb, {
  13585. move: moveY.value,
  13586. ratio: ratioY.value,
  13587. size: sizeHeight.value,
  13588. vertical: "",
  13589. always: _ctx.always
  13590. }, null, 8, ["move", "ratio", "size", "always"])
  13591. ], 64);
  13592. };
  13593. }
  13594. });
  13595. var Bar = /* @__PURE__ */ _export_sfc(_sfc_main$2q, [["__file", "bar.vue"]]);
  13596. const scrollbarProps = buildProps({
  13597. height: {
  13598. type: [String, Number],
  13599. default: ""
  13600. },
  13601. maxHeight: {
  13602. type: [String, Number],
  13603. default: ""
  13604. },
  13605. native: {
  13606. type: Boolean,
  13607. default: false
  13608. },
  13609. wrapStyle: {
  13610. type: definePropType([String, Object, Array]),
  13611. default: ""
  13612. },
  13613. wrapClass: {
  13614. type: [String, Array],
  13615. default: ""
  13616. },
  13617. viewClass: {
  13618. type: [String, Array],
  13619. default: ""
  13620. },
  13621. viewStyle: {
  13622. type: [String, Array, Object],
  13623. default: ""
  13624. },
  13625. noresize: Boolean,
  13626. tag: {
  13627. type: String,
  13628. default: "div"
  13629. },
  13630. always: Boolean,
  13631. minSize: {
  13632. type: Number,
  13633. default: 20
  13634. },
  13635. tabindex: {
  13636. type: [String, Number],
  13637. default: void 0
  13638. },
  13639. id: String,
  13640. role: String,
  13641. ...useAriaProps(["ariaLabel", "ariaOrientation"])
  13642. });
  13643. const scrollbarEmits = {
  13644. scroll: ({
  13645. scrollTop,
  13646. scrollLeft
  13647. }) => [scrollTop, scrollLeft].every(isNumber)
  13648. };
  13649. const COMPONENT_NAME$j = "ElScrollbar";
  13650. const __default__$1L = defineComponent({
  13651. name: COMPONENT_NAME$j
  13652. });
  13653. const _sfc_main$2p = /* @__PURE__ */ defineComponent({
  13654. ...__default__$1L,
  13655. props: scrollbarProps,
  13656. emits: scrollbarEmits,
  13657. setup(__props, { expose, emit }) {
  13658. const props = __props;
  13659. const ns = useNamespace("scrollbar");
  13660. let stopResizeObserver = void 0;
  13661. let stopResizeListener = void 0;
  13662. let wrapScrollTop = 0;
  13663. let wrapScrollLeft = 0;
  13664. const scrollbarRef = ref();
  13665. const wrapRef = ref();
  13666. const resizeRef = ref();
  13667. const barRef = ref();
  13668. const wrapStyle = computed(() => {
  13669. const style = {};
  13670. if (props.height)
  13671. style.height = addUnit(props.height);
  13672. if (props.maxHeight)
  13673. style.maxHeight = addUnit(props.maxHeight);
  13674. return [props.wrapStyle, style];
  13675. });
  13676. const wrapKls = computed(() => {
  13677. return [
  13678. props.wrapClass,
  13679. ns.e("wrap"),
  13680. { [ns.em("wrap", "hidden-default")]: !props.native }
  13681. ];
  13682. });
  13683. const resizeKls = computed(() => {
  13684. return [ns.e("view"), props.viewClass];
  13685. });
  13686. const handleScroll = () => {
  13687. var _a;
  13688. if (wrapRef.value) {
  13689. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  13690. wrapScrollTop = wrapRef.value.scrollTop;
  13691. wrapScrollLeft = wrapRef.value.scrollLeft;
  13692. emit("scroll", {
  13693. scrollTop: wrapRef.value.scrollTop,
  13694. scrollLeft: wrapRef.value.scrollLeft
  13695. });
  13696. }
  13697. };
  13698. function scrollTo(arg1, arg2) {
  13699. if (isObject$1(arg1)) {
  13700. wrapRef.value.scrollTo(arg1);
  13701. } else if (isNumber(arg1) && isNumber(arg2)) {
  13702. wrapRef.value.scrollTo(arg1, arg2);
  13703. }
  13704. }
  13705. const setScrollTop = (value) => {
  13706. if (!isNumber(value)) {
  13707. return;
  13708. }
  13709. wrapRef.value.scrollTop = value;
  13710. };
  13711. const setScrollLeft = (value) => {
  13712. if (!isNumber(value)) {
  13713. return;
  13714. }
  13715. wrapRef.value.scrollLeft = value;
  13716. };
  13717. const update = () => {
  13718. var _a;
  13719. (_a = barRef.value) == null ? void 0 : _a.update();
  13720. };
  13721. watch(() => props.noresize, (noresize) => {
  13722. if (noresize) {
  13723. stopResizeObserver == null ? void 0 : stopResizeObserver();
  13724. stopResizeListener == null ? void 0 : stopResizeListener();
  13725. } else {
  13726. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  13727. stopResizeListener = useEventListener("resize", update);
  13728. }
  13729. }, { immediate: true });
  13730. watch(() => [props.maxHeight, props.height], () => {
  13731. if (!props.native)
  13732. nextTick(() => {
  13733. var _a;
  13734. update();
  13735. if (wrapRef.value) {
  13736. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrapRef.value);
  13737. }
  13738. });
  13739. });
  13740. provide(scrollbarContextKey, reactive({
  13741. scrollbarElement: scrollbarRef,
  13742. wrapElement: wrapRef
  13743. }));
  13744. onActivated(() => {
  13745. if (wrapRef.value) {
  13746. wrapRef.value.scrollTop = wrapScrollTop;
  13747. wrapRef.value.scrollLeft = wrapScrollLeft;
  13748. }
  13749. });
  13750. onMounted(() => {
  13751. if (!props.native)
  13752. nextTick(() => {
  13753. update();
  13754. });
  13755. });
  13756. onUpdated(() => update());
  13757. expose({
  13758. wrapRef,
  13759. update,
  13760. scrollTo,
  13761. setScrollTop,
  13762. setScrollLeft,
  13763. handleScroll
  13764. });
  13765. return (_ctx, _cache) => {
  13766. return openBlock(), createElementBlock("div", {
  13767. ref_key: "scrollbarRef",
  13768. ref: scrollbarRef,
  13769. class: normalizeClass(unref(ns).b())
  13770. }, [
  13771. createElementVNode("div", {
  13772. ref_key: "wrapRef",
  13773. ref: wrapRef,
  13774. class: normalizeClass(unref(wrapKls)),
  13775. style: normalizeStyle(unref(wrapStyle)),
  13776. tabindex: _ctx.tabindex,
  13777. onScroll: handleScroll
  13778. }, [
  13779. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  13780. id: _ctx.id,
  13781. ref_key: "resizeRef",
  13782. ref: resizeRef,
  13783. class: normalizeClass(unref(resizeKls)),
  13784. style: normalizeStyle(_ctx.viewStyle),
  13785. role: _ctx.role,
  13786. "aria-label": _ctx.ariaLabel,
  13787. "aria-orientation": _ctx.ariaOrientation
  13788. }, {
  13789. default: withCtx(() => [
  13790. renderSlot(_ctx.$slots, "default")
  13791. ]),
  13792. _: 3
  13793. }, 8, ["id", "class", "style", "role", "aria-label", "aria-orientation"]))
  13794. ], 46, ["tabindex"]),
  13795. !_ctx.native ? (openBlock(), createBlock(Bar, {
  13796. key: 0,
  13797. ref_key: "barRef",
  13798. ref: barRef,
  13799. always: _ctx.always,
  13800. "min-size": _ctx.minSize
  13801. }, null, 8, ["always", "min-size"])) : createCommentVNode("v-if", true)
  13802. ], 2);
  13803. };
  13804. }
  13805. });
  13806. var Scrollbar$1 = /* @__PURE__ */ _export_sfc(_sfc_main$2p, [["__file", "scrollbar.vue"]]);
  13807. const ElScrollbar = withInstall(Scrollbar$1);
  13808. const POPPER_INJECTION_KEY = Symbol("popper");
  13809. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  13810. const Effect = {
  13811. LIGHT: "light",
  13812. DARK: "dark"
  13813. };
  13814. const roleTypes = [
  13815. "dialog",
  13816. "grid",
  13817. "group",
  13818. "listbox",
  13819. "menu",
  13820. "navigation",
  13821. "tooltip",
  13822. "tree"
  13823. ];
  13824. const popperProps = buildProps({
  13825. role: {
  13826. type: String,
  13827. values: roleTypes,
  13828. default: "tooltip"
  13829. }
  13830. });
  13831. const usePopperProps = popperProps;
  13832. const __default__$1K = defineComponent({
  13833. name: "ElPopper",
  13834. inheritAttrs: false
  13835. });
  13836. const _sfc_main$2o = /* @__PURE__ */ defineComponent({
  13837. ...__default__$1K,
  13838. props: popperProps,
  13839. setup(__props, { expose }) {
  13840. const props = __props;
  13841. const triggerRef = ref();
  13842. const popperInstanceRef = ref();
  13843. const contentRef = ref();
  13844. const referenceRef = ref();
  13845. const role = computed(() => props.role);
  13846. const popperProvides = {
  13847. triggerRef,
  13848. popperInstanceRef,
  13849. contentRef,
  13850. referenceRef,
  13851. role
  13852. };
  13853. expose(popperProvides);
  13854. provide(POPPER_INJECTION_KEY, popperProvides);
  13855. return (_ctx, _cache) => {
  13856. return renderSlot(_ctx.$slots, "default");
  13857. };
  13858. }
  13859. });
  13860. var Popper = /* @__PURE__ */ _export_sfc(_sfc_main$2o, [["__file", "popper.vue"]]);
  13861. const popperArrowProps = buildProps({
  13862. arrowOffset: {
  13863. type: Number,
  13864. default: 5
  13865. }
  13866. });
  13867. const usePopperArrowProps = popperArrowProps;
  13868. const __default__$1J = defineComponent({
  13869. name: "ElPopperArrow",
  13870. inheritAttrs: false
  13871. });
  13872. const _sfc_main$2n = /* @__PURE__ */ defineComponent({
  13873. ...__default__$1J,
  13874. props: popperArrowProps,
  13875. setup(__props, { expose }) {
  13876. const props = __props;
  13877. const ns = useNamespace("popper");
  13878. const { arrowOffset, arrowRef, arrowStyle } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  13879. watch(() => props.arrowOffset, (val) => {
  13880. arrowOffset.value = val;
  13881. });
  13882. onBeforeUnmount(() => {
  13883. arrowRef.value = void 0;
  13884. });
  13885. expose({
  13886. arrowRef
  13887. });
  13888. return (_ctx, _cache) => {
  13889. return openBlock(), createElementBlock("span", {
  13890. ref_key: "arrowRef",
  13891. ref: arrowRef,
  13892. class: normalizeClass(unref(ns).e("arrow")),
  13893. style: normalizeStyle(unref(arrowStyle)),
  13894. "data-popper-arrow": ""
  13895. }, null, 6);
  13896. };
  13897. }
  13898. });
  13899. var ElPopperArrow = /* @__PURE__ */ _export_sfc(_sfc_main$2n, [["__file", "arrow.vue"]]);
  13900. const NAME = "ElOnlyChild";
  13901. const OnlyChild = defineComponent({
  13902. name: NAME,
  13903. setup(_, {
  13904. slots,
  13905. attrs
  13906. }) {
  13907. var _a;
  13908. const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
  13909. const forwardRefDirective = useForwardRefDirective((_a = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a : NOOP);
  13910. return () => {
  13911. var _a2;
  13912. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots, attrs);
  13913. if (!defaultSlot)
  13914. return null;
  13915. if (defaultSlot.length > 1) {
  13916. return null;
  13917. }
  13918. const firstLegitNode = findFirstLegitChild(defaultSlot);
  13919. if (!firstLegitNode) {
  13920. return null;
  13921. }
  13922. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  13923. };
  13924. }
  13925. });
  13926. function findFirstLegitChild(node) {
  13927. if (!node)
  13928. return null;
  13929. const children = node;
  13930. for (const child of children) {
  13931. if (isObject$1(child)) {
  13932. switch (child.type) {
  13933. case Comment:
  13934. continue;
  13935. case Text$1:
  13936. case "svg":
  13937. return wrapTextContent(child);
  13938. case Fragment:
  13939. return findFirstLegitChild(child.children);
  13940. default:
  13941. return child;
  13942. }
  13943. }
  13944. return wrapTextContent(child);
  13945. }
  13946. return null;
  13947. }
  13948. function wrapTextContent(s) {
  13949. const ns = useNamespace("only-child");
  13950. return createVNode("span", {
  13951. "class": ns.e("content")
  13952. }, [s]);
  13953. }
  13954. const popperTriggerProps = buildProps({
  13955. virtualRef: {
  13956. type: definePropType(Object)
  13957. },
  13958. virtualTriggering: Boolean,
  13959. onMouseenter: {
  13960. type: definePropType(Function)
  13961. },
  13962. onMouseleave: {
  13963. type: definePropType(Function)
  13964. },
  13965. onClick: {
  13966. type: definePropType(Function)
  13967. },
  13968. onKeydown: {
  13969. type: definePropType(Function)
  13970. },
  13971. onFocus: {
  13972. type: definePropType(Function)
  13973. },
  13974. onBlur: {
  13975. type: definePropType(Function)
  13976. },
  13977. onContextmenu: {
  13978. type: definePropType(Function)
  13979. },
  13980. id: String,
  13981. open: Boolean
  13982. });
  13983. const usePopperTriggerProps = popperTriggerProps;
  13984. const __default__$1I = defineComponent({
  13985. name: "ElPopperTrigger",
  13986. inheritAttrs: false
  13987. });
  13988. const _sfc_main$2m = /* @__PURE__ */ defineComponent({
  13989. ...__default__$1I,
  13990. props: popperTriggerProps,
  13991. setup(__props, { expose }) {
  13992. const props = __props;
  13993. const { role, triggerRef } = inject(POPPER_INJECTION_KEY, void 0);
  13994. useForwardRef(triggerRef);
  13995. const ariaControls = computed(() => {
  13996. return ariaHaspopup.value ? props.id : void 0;
  13997. });
  13998. const ariaDescribedby = computed(() => {
  13999. if (role && role.value === "tooltip") {
  14000. return props.open && props.id ? props.id : void 0;
  14001. }
  14002. return void 0;
  14003. });
  14004. const ariaHaspopup = computed(() => {
  14005. if (role && role.value !== "tooltip") {
  14006. return role.value;
  14007. }
  14008. return void 0;
  14009. });
  14010. const ariaExpanded = computed(() => {
  14011. return ariaHaspopup.value ? `${props.open}` : void 0;
  14012. });
  14013. let virtualTriggerAriaStopWatch = void 0;
  14014. const TRIGGER_ELE_EVENTS = [
  14015. "onMouseenter",
  14016. "onMouseleave",
  14017. "onClick",
  14018. "onKeydown",
  14019. "onFocus",
  14020. "onBlur",
  14021. "onContextmenu"
  14022. ];
  14023. onMounted(() => {
  14024. watch(() => props.virtualRef, (virtualEl) => {
  14025. if (virtualEl) {
  14026. triggerRef.value = unrefElement(virtualEl);
  14027. }
  14028. }, {
  14029. immediate: true
  14030. });
  14031. watch(triggerRef, (el, prevEl) => {
  14032. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  14033. virtualTriggerAriaStopWatch = void 0;
  14034. if (isElement$1(el)) {
  14035. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  14036. var _a;
  14037. const handler = props[eventName];
  14038. if (handler) {
  14039. el.addEventListener(eventName.slice(2).toLowerCase(), handler);
  14040. (_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler);
  14041. }
  14042. });
  14043. if (isFocusable(el)) {
  14044. virtualTriggerAriaStopWatch = watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  14045. [
  14046. "aria-controls",
  14047. "aria-describedby",
  14048. "aria-haspopup",
  14049. "aria-expanded"
  14050. ].forEach((key, idx) => {
  14051. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  14052. });
  14053. }, { immediate: true });
  14054. }
  14055. }
  14056. if (isElement$1(prevEl) && isFocusable(prevEl)) {
  14057. [
  14058. "aria-controls",
  14059. "aria-describedby",
  14060. "aria-haspopup",
  14061. "aria-expanded"
  14062. ].forEach((key) => prevEl.removeAttribute(key));
  14063. }
  14064. }, {
  14065. immediate: true
  14066. });
  14067. });
  14068. onBeforeUnmount(() => {
  14069. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  14070. virtualTriggerAriaStopWatch = void 0;
  14071. if (triggerRef.value && isElement$1(triggerRef.value)) {
  14072. const el = triggerRef.value;
  14073. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  14074. const handler = props[eventName];
  14075. if (handler) {
  14076. el.removeEventListener(eventName.slice(2).toLowerCase(), handler);
  14077. }
  14078. });
  14079. triggerRef.value = void 0;
  14080. }
  14081. });
  14082. expose({
  14083. triggerRef
  14084. });
  14085. return (_ctx, _cache) => {
  14086. return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  14087. "aria-controls": unref(ariaControls),
  14088. "aria-describedby": unref(ariaDescribedby),
  14089. "aria-expanded": unref(ariaExpanded),
  14090. "aria-haspopup": unref(ariaHaspopup)
  14091. }), {
  14092. default: withCtx(() => [
  14093. renderSlot(_ctx.$slots, "default")
  14094. ]),
  14095. _: 3
  14096. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : createCommentVNode("v-if", true);
  14097. };
  14098. }
  14099. });
  14100. var ElPopperTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2m, [["__file", "trigger.vue"]]);
  14101. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  14102. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  14103. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  14104. const FOCUS_AFTER_TRAPPED_OPTS = {
  14105. cancelable: true,
  14106. bubbles: false
  14107. };
  14108. const FOCUSOUT_PREVENTED_OPTS = {
  14109. cancelable: true,
  14110. bubbles: false
  14111. };
  14112. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  14113. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  14114. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  14115. const focusReason = ref();
  14116. const lastUserFocusTimestamp = ref(0);
  14117. const lastAutomatedFocusTimestamp = ref(0);
  14118. let focusReasonUserCount = 0;
  14119. const obtainAllFocusableElements = (element) => {
  14120. const nodes = [];
  14121. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  14122. acceptNode: (node) => {
  14123. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  14124. if (node.disabled || node.hidden || isHiddenInput)
  14125. return NodeFilter.FILTER_SKIP;
  14126. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  14127. }
  14128. });
  14129. while (walker.nextNode())
  14130. nodes.push(walker.currentNode);
  14131. return nodes;
  14132. };
  14133. const getVisibleElement = (elements, container) => {
  14134. for (const element of elements) {
  14135. if (!isHidden(element, container))
  14136. return element;
  14137. }
  14138. };
  14139. const isHidden = (element, container) => {
  14140. if (getComputedStyle(element).visibility === "hidden")
  14141. return true;
  14142. while (element) {
  14143. if (container && element === container)
  14144. return false;
  14145. if (getComputedStyle(element).display === "none")
  14146. return true;
  14147. element = element.parentElement;
  14148. }
  14149. return false;
  14150. };
  14151. const getEdges = (container) => {
  14152. const focusable = obtainAllFocusableElements(container);
  14153. const first = getVisibleElement(focusable, container);
  14154. const last = getVisibleElement(focusable.reverse(), container);
  14155. return [first, last];
  14156. };
  14157. const isSelectable = (element) => {
  14158. return element instanceof HTMLInputElement && "select" in element;
  14159. };
  14160. const tryFocus = (element, shouldSelect) => {
  14161. if (element && element.focus) {
  14162. const prevFocusedElement = document.activeElement;
  14163. element.focus({ preventScroll: true });
  14164. lastAutomatedFocusTimestamp.value = window.performance.now();
  14165. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  14166. element.select();
  14167. }
  14168. }
  14169. };
  14170. function removeFromStack(list, item) {
  14171. const copy = [...list];
  14172. const idx = list.indexOf(item);
  14173. if (idx !== -1) {
  14174. copy.splice(idx, 1);
  14175. }
  14176. return copy;
  14177. }
  14178. const createFocusableStack = () => {
  14179. let stack = [];
  14180. const push = (layer) => {
  14181. const currentLayer = stack[0];
  14182. if (currentLayer && layer !== currentLayer) {
  14183. currentLayer.pause();
  14184. }
  14185. stack = removeFromStack(stack, layer);
  14186. stack.unshift(layer);
  14187. };
  14188. const remove = (layer) => {
  14189. var _a, _b;
  14190. stack = removeFromStack(stack, layer);
  14191. (_b = (_a = stack[0]) == null ? void 0 : _a.resume) == null ? void 0 : _b.call(_a);
  14192. };
  14193. return {
  14194. push,
  14195. remove
  14196. };
  14197. };
  14198. const focusFirstDescendant = (elements, shouldSelect = false) => {
  14199. const prevFocusedElement = document.activeElement;
  14200. for (const element of elements) {
  14201. tryFocus(element, shouldSelect);
  14202. if (document.activeElement !== prevFocusedElement)
  14203. return;
  14204. }
  14205. };
  14206. const focusableStack = createFocusableStack();
  14207. const isFocusCausedByUserEvent = () => {
  14208. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  14209. };
  14210. const notifyFocusReasonPointer = () => {
  14211. focusReason.value = "pointer";
  14212. lastUserFocusTimestamp.value = window.performance.now();
  14213. };
  14214. const notifyFocusReasonKeydown = () => {
  14215. focusReason.value = "keyboard";
  14216. lastUserFocusTimestamp.value = window.performance.now();
  14217. };
  14218. const useFocusReason = () => {
  14219. onMounted(() => {
  14220. if (focusReasonUserCount === 0) {
  14221. document.addEventListener("mousedown", notifyFocusReasonPointer);
  14222. document.addEventListener("touchstart", notifyFocusReasonPointer);
  14223. document.addEventListener("keydown", notifyFocusReasonKeydown);
  14224. }
  14225. focusReasonUserCount++;
  14226. });
  14227. onBeforeUnmount(() => {
  14228. focusReasonUserCount--;
  14229. if (focusReasonUserCount <= 0) {
  14230. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  14231. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  14232. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  14233. }
  14234. });
  14235. return {
  14236. focusReason,
  14237. lastUserFocusTimestamp,
  14238. lastAutomatedFocusTimestamp
  14239. };
  14240. };
  14241. const createFocusOutPreventedEvent = (detail) => {
  14242. return new CustomEvent(FOCUSOUT_PREVENTED, {
  14243. ...FOCUSOUT_PREVENTED_OPTS,
  14244. detail
  14245. });
  14246. };
  14247. const _sfc_main$2l = defineComponent({
  14248. name: "ElFocusTrap",
  14249. inheritAttrs: false,
  14250. props: {
  14251. loop: Boolean,
  14252. trapped: Boolean,
  14253. focusTrapEl: Object,
  14254. focusStartEl: {
  14255. type: [Object, String],
  14256. default: "first"
  14257. }
  14258. },
  14259. emits: [
  14260. ON_TRAP_FOCUS_EVT,
  14261. ON_RELEASE_FOCUS_EVT,
  14262. "focusin",
  14263. "focusout",
  14264. "focusout-prevented",
  14265. "release-requested"
  14266. ],
  14267. setup(props, { emit }) {
  14268. const forwardRef = ref();
  14269. let lastFocusBeforeTrapped;
  14270. let lastFocusAfterTrapped;
  14271. const { focusReason } = useFocusReason();
  14272. useEscapeKeydown((event) => {
  14273. if (props.trapped && !focusLayer.paused) {
  14274. emit("release-requested", event);
  14275. }
  14276. });
  14277. const focusLayer = {
  14278. paused: false,
  14279. pause() {
  14280. this.paused = true;
  14281. },
  14282. resume() {
  14283. this.paused = false;
  14284. }
  14285. };
  14286. const onKeydown = (e) => {
  14287. if (!props.loop && !props.trapped)
  14288. return;
  14289. if (focusLayer.paused)
  14290. return;
  14291. const { code, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  14292. const { loop } = props;
  14293. const isTabbing = code === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  14294. const currentFocusingEl = document.activeElement;
  14295. if (isTabbing && currentFocusingEl) {
  14296. const container = currentTarget;
  14297. const [first, last] = getEdges(container);
  14298. const isTabbable = first && last;
  14299. if (!isTabbable) {
  14300. if (currentFocusingEl === container) {
  14301. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14302. focusReason: focusReason.value
  14303. });
  14304. emit("focusout-prevented", focusoutPreventedEvent);
  14305. if (!focusoutPreventedEvent.defaultPrevented) {
  14306. e.preventDefault();
  14307. }
  14308. }
  14309. } else {
  14310. if (!shiftKey && currentFocusingEl === last) {
  14311. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14312. focusReason: focusReason.value
  14313. });
  14314. emit("focusout-prevented", focusoutPreventedEvent);
  14315. if (!focusoutPreventedEvent.defaultPrevented) {
  14316. e.preventDefault();
  14317. if (loop)
  14318. tryFocus(first, true);
  14319. }
  14320. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  14321. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14322. focusReason: focusReason.value
  14323. });
  14324. emit("focusout-prevented", focusoutPreventedEvent);
  14325. if (!focusoutPreventedEvent.defaultPrevented) {
  14326. e.preventDefault();
  14327. if (loop)
  14328. tryFocus(last, true);
  14329. }
  14330. }
  14331. }
  14332. }
  14333. };
  14334. provide(FOCUS_TRAP_INJECTION_KEY, {
  14335. focusTrapRef: forwardRef,
  14336. onKeydown
  14337. });
  14338. watch(() => props.focusTrapEl, (focusTrapEl) => {
  14339. if (focusTrapEl) {
  14340. forwardRef.value = focusTrapEl;
  14341. }
  14342. }, { immediate: true });
  14343. watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  14344. if (forwardRef2) {
  14345. forwardRef2.addEventListener("keydown", onKeydown);
  14346. forwardRef2.addEventListener("focusin", onFocusIn);
  14347. forwardRef2.addEventListener("focusout", onFocusOut);
  14348. }
  14349. if (oldForwardRef) {
  14350. oldForwardRef.removeEventListener("keydown", onKeydown);
  14351. oldForwardRef.removeEventListener("focusin", onFocusIn);
  14352. oldForwardRef.removeEventListener("focusout", onFocusOut);
  14353. }
  14354. });
  14355. const trapOnFocus = (e) => {
  14356. emit(ON_TRAP_FOCUS_EVT, e);
  14357. };
  14358. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  14359. const onFocusIn = (e) => {
  14360. const trapContainer = unref(forwardRef);
  14361. if (!trapContainer)
  14362. return;
  14363. const target = e.target;
  14364. const relatedTarget = e.relatedTarget;
  14365. const isFocusedInTrap = target && trapContainer.contains(target);
  14366. if (!props.trapped) {
  14367. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  14368. if (!isPrevFocusedInTrap) {
  14369. lastFocusBeforeTrapped = relatedTarget;
  14370. }
  14371. }
  14372. if (isFocusedInTrap)
  14373. emit("focusin", e);
  14374. if (focusLayer.paused)
  14375. return;
  14376. if (props.trapped) {
  14377. if (isFocusedInTrap) {
  14378. lastFocusAfterTrapped = target;
  14379. } else {
  14380. tryFocus(lastFocusAfterTrapped, true);
  14381. }
  14382. }
  14383. };
  14384. const onFocusOut = (e) => {
  14385. const trapContainer = unref(forwardRef);
  14386. if (focusLayer.paused || !trapContainer)
  14387. return;
  14388. if (props.trapped) {
  14389. const relatedTarget = e.relatedTarget;
  14390. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  14391. setTimeout(() => {
  14392. if (!focusLayer.paused && props.trapped) {
  14393. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  14394. focusReason: focusReason.value
  14395. });
  14396. emit("focusout-prevented", focusoutPreventedEvent);
  14397. if (!focusoutPreventedEvent.defaultPrevented) {
  14398. tryFocus(lastFocusAfterTrapped, true);
  14399. }
  14400. }
  14401. }, 0);
  14402. }
  14403. } else {
  14404. const target = e.target;
  14405. const isFocusedInTrap = target && trapContainer.contains(target);
  14406. if (!isFocusedInTrap)
  14407. emit("focusout", e);
  14408. }
  14409. };
  14410. async function startTrap() {
  14411. await nextTick();
  14412. const trapContainer = unref(forwardRef);
  14413. if (trapContainer) {
  14414. focusableStack.push(focusLayer);
  14415. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  14416. lastFocusBeforeTrapped = prevFocusedElement;
  14417. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  14418. if (!isPrevFocusContained) {
  14419. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  14420. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  14421. trapContainer.dispatchEvent(focusEvent);
  14422. if (!focusEvent.defaultPrevented) {
  14423. nextTick(() => {
  14424. let focusStartEl = props.focusStartEl;
  14425. if (!isString$1(focusStartEl)) {
  14426. tryFocus(focusStartEl);
  14427. if (document.activeElement !== focusStartEl) {
  14428. focusStartEl = "first";
  14429. }
  14430. }
  14431. if (focusStartEl === "first") {
  14432. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  14433. }
  14434. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  14435. tryFocus(trapContainer);
  14436. }
  14437. });
  14438. }
  14439. }
  14440. }
  14441. }
  14442. function stopTrap() {
  14443. const trapContainer = unref(forwardRef);
  14444. if (trapContainer) {
  14445. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  14446. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  14447. ...FOCUS_AFTER_TRAPPED_OPTS,
  14448. detail: {
  14449. focusReason: focusReason.value
  14450. }
  14451. });
  14452. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  14453. trapContainer.dispatchEvent(releasedEvent);
  14454. if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
  14455. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
  14456. }
  14457. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  14458. focusableStack.remove(focusLayer);
  14459. }
  14460. }
  14461. onMounted(() => {
  14462. if (props.trapped) {
  14463. startTrap();
  14464. }
  14465. watch(() => props.trapped, (trapped) => {
  14466. if (trapped) {
  14467. startTrap();
  14468. } else {
  14469. stopTrap();
  14470. }
  14471. });
  14472. });
  14473. onBeforeUnmount(() => {
  14474. if (props.trapped) {
  14475. stopTrap();
  14476. }
  14477. if (forwardRef.value) {
  14478. forwardRef.value.removeEventListener("keydown", onKeydown);
  14479. forwardRef.value.removeEventListener("focusin", onFocusIn);
  14480. forwardRef.value.removeEventListener("focusout", onFocusOut);
  14481. forwardRef.value = void 0;
  14482. }
  14483. });
  14484. return {
  14485. onKeydown
  14486. };
  14487. }
  14488. });
  14489. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  14490. return renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  14491. }
  14492. var ElFocusTrap = /* @__PURE__ */ _export_sfc(_sfc_main$2l, [["render", _sfc_render$u], ["__file", "focus-trap.vue"]]);
  14493. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  14494. const popperCoreConfigProps = buildProps({
  14495. boundariesPadding: {
  14496. type: Number,
  14497. default: 0
  14498. },
  14499. fallbackPlacements: {
  14500. type: definePropType(Array),
  14501. default: void 0
  14502. },
  14503. gpuAcceleration: {
  14504. type: Boolean,
  14505. default: true
  14506. },
  14507. offset: {
  14508. type: Number,
  14509. default: 12
  14510. },
  14511. placement: {
  14512. type: String,
  14513. values: Ee,
  14514. default: "bottom"
  14515. },
  14516. popperOptions: {
  14517. type: definePropType(Object),
  14518. default: () => ({})
  14519. },
  14520. strategy: {
  14521. type: String,
  14522. values: POSITIONING_STRATEGIES,
  14523. default: "absolute"
  14524. }
  14525. });
  14526. const popperContentProps = buildProps({
  14527. ...popperCoreConfigProps,
  14528. id: String,
  14529. style: {
  14530. type: definePropType([String, Array, Object])
  14531. },
  14532. className: {
  14533. type: definePropType([String, Array, Object])
  14534. },
  14535. effect: {
  14536. type: definePropType(String),
  14537. default: "dark"
  14538. },
  14539. visible: Boolean,
  14540. enterable: {
  14541. type: Boolean,
  14542. default: true
  14543. },
  14544. pure: Boolean,
  14545. focusOnShow: {
  14546. type: Boolean,
  14547. default: false
  14548. },
  14549. trapping: {
  14550. type: Boolean,
  14551. default: false
  14552. },
  14553. popperClass: {
  14554. type: definePropType([String, Array, Object])
  14555. },
  14556. popperStyle: {
  14557. type: definePropType([String, Array, Object])
  14558. },
  14559. referenceEl: {
  14560. type: definePropType(Object)
  14561. },
  14562. triggerTargetEl: {
  14563. type: definePropType(Object)
  14564. },
  14565. stopPopperMouseEvent: {
  14566. type: Boolean,
  14567. default: true
  14568. },
  14569. virtualTriggering: Boolean,
  14570. zIndex: Number,
  14571. ...useAriaProps(["ariaLabel"])
  14572. });
  14573. const popperContentEmits = {
  14574. mouseenter: (evt) => evt instanceof MouseEvent,
  14575. mouseleave: (evt) => evt instanceof MouseEvent,
  14576. focus: () => true,
  14577. blur: () => true,
  14578. close: () => true
  14579. };
  14580. const usePopperCoreConfigProps = popperCoreConfigProps;
  14581. const usePopperContentProps = popperContentProps;
  14582. const usePopperContentEmits = popperContentEmits;
  14583. const buildPopperOptions = (props, modifiers = []) => {
  14584. const { placement, strategy, popperOptions } = props;
  14585. const options = {
  14586. placement,
  14587. strategy,
  14588. ...popperOptions,
  14589. modifiers: [...genModifiers(props), ...modifiers]
  14590. };
  14591. deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
  14592. return options;
  14593. };
  14594. const unwrapMeasurableEl = ($el) => {
  14595. if (!isClient)
  14596. return;
  14597. return unrefElement($el);
  14598. };
  14599. function genModifiers(options) {
  14600. const { offset, gpuAcceleration, fallbackPlacements } = options;
  14601. return [
  14602. {
  14603. name: "offset",
  14604. options: {
  14605. offset: [0, offset != null ? offset : 12]
  14606. }
  14607. },
  14608. {
  14609. name: "preventOverflow",
  14610. options: {
  14611. padding: {
  14612. top: 2,
  14613. bottom: 2,
  14614. left: 5,
  14615. right: 5
  14616. }
  14617. }
  14618. },
  14619. {
  14620. name: "flip",
  14621. options: {
  14622. padding: 5,
  14623. fallbackPlacements
  14624. }
  14625. },
  14626. {
  14627. name: "computeStyles",
  14628. options: {
  14629. gpuAcceleration
  14630. }
  14631. }
  14632. ];
  14633. }
  14634. function deriveExtraModifiers(options, modifiers) {
  14635. if (modifiers) {
  14636. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  14637. }
  14638. }
  14639. const DEFAULT_ARROW_OFFSET = 0;
  14640. const usePopperContent = (props) => {
  14641. const { popperInstanceRef, contentRef, triggerRef, role } = inject(POPPER_INJECTION_KEY, void 0);
  14642. const arrowRef = ref();
  14643. const arrowOffset = ref();
  14644. const eventListenerModifier = computed(() => {
  14645. return {
  14646. name: "eventListeners",
  14647. enabled: !!props.visible
  14648. };
  14649. });
  14650. const arrowModifier = computed(() => {
  14651. var _a;
  14652. const arrowEl = unref(arrowRef);
  14653. const offset = (_a = unref(arrowOffset)) != null ? _a : DEFAULT_ARROW_OFFSET;
  14654. return {
  14655. name: "arrow",
  14656. enabled: !isUndefined$1(arrowEl),
  14657. options: {
  14658. element: arrowEl,
  14659. padding: offset
  14660. }
  14661. };
  14662. });
  14663. const options = computed(() => {
  14664. return {
  14665. onFirstUpdate: () => {
  14666. update();
  14667. },
  14668. ...buildPopperOptions(props, [
  14669. unref(arrowModifier),
  14670. unref(eventListenerModifier)
  14671. ])
  14672. };
  14673. });
  14674. const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef));
  14675. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
  14676. watch(instanceRef, (instance) => popperInstanceRef.value = instance);
  14677. onMounted(() => {
  14678. watch(() => {
  14679. var _a;
  14680. return (_a = unref(computedReference)) == null ? void 0 : _a.getBoundingClientRect();
  14681. }, () => {
  14682. update();
  14683. });
  14684. });
  14685. return {
  14686. attributes,
  14687. arrowRef,
  14688. contentRef,
  14689. instanceRef,
  14690. state,
  14691. styles,
  14692. role,
  14693. forceUpdate,
  14694. update
  14695. };
  14696. };
  14697. const usePopperContentDOM = (props, {
  14698. attributes,
  14699. styles,
  14700. role
  14701. }) => {
  14702. const { nextZIndex } = useZIndex();
  14703. const ns = useNamespace("popper");
  14704. const contentAttrs = computed(() => unref(attributes).popper);
  14705. const contentZIndex = ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
  14706. const contentClass = computed(() => [
  14707. ns.b(),
  14708. ns.is("pure", props.pure),
  14709. ns.is(props.effect),
  14710. props.popperClass
  14711. ]);
  14712. const contentStyle = computed(() => {
  14713. return [
  14714. { zIndex: unref(contentZIndex) },
  14715. unref(styles).popper,
  14716. props.popperStyle || {}
  14717. ];
  14718. });
  14719. const ariaModal = computed(() => role.value === "dialog" ? "false" : void 0);
  14720. const arrowStyle = computed(() => unref(styles).arrow || {});
  14721. const updateZIndex = () => {
  14722. contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  14723. };
  14724. return {
  14725. ariaModal,
  14726. arrowStyle,
  14727. contentAttrs,
  14728. contentClass,
  14729. contentStyle,
  14730. contentZIndex,
  14731. updateZIndex
  14732. };
  14733. };
  14734. const usePopperContentFocusTrap = (props, emit) => {
  14735. const trapped = ref(false);
  14736. const focusStartRef = ref();
  14737. const onFocusAfterTrapped = () => {
  14738. emit("focus");
  14739. };
  14740. const onFocusAfterReleased = (event) => {
  14741. var _a;
  14742. if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") {
  14743. focusStartRef.value = "first";
  14744. emit("blur");
  14745. }
  14746. };
  14747. const onFocusInTrap = (event) => {
  14748. if (props.visible && !trapped.value) {
  14749. if (event.target) {
  14750. focusStartRef.value = event.target;
  14751. }
  14752. trapped.value = true;
  14753. }
  14754. };
  14755. const onFocusoutPrevented = (event) => {
  14756. if (!props.trapping) {
  14757. if (event.detail.focusReason === "pointer") {
  14758. event.preventDefault();
  14759. }
  14760. trapped.value = false;
  14761. }
  14762. };
  14763. const onReleaseRequested = () => {
  14764. trapped.value = false;
  14765. emit("close");
  14766. };
  14767. return {
  14768. focusStartRef,
  14769. trapped,
  14770. onFocusAfterReleased,
  14771. onFocusAfterTrapped,
  14772. onFocusInTrap,
  14773. onFocusoutPrevented,
  14774. onReleaseRequested
  14775. };
  14776. };
  14777. const __default__$1H = defineComponent({
  14778. name: "ElPopperContent"
  14779. });
  14780. const _sfc_main$2k = /* @__PURE__ */ defineComponent({
  14781. ...__default__$1H,
  14782. props: popperContentProps,
  14783. emits: popperContentEmits,
  14784. setup(__props, { expose, emit }) {
  14785. const props = __props;
  14786. const {
  14787. focusStartRef,
  14788. trapped,
  14789. onFocusAfterReleased,
  14790. onFocusAfterTrapped,
  14791. onFocusInTrap,
  14792. onFocusoutPrevented,
  14793. onReleaseRequested
  14794. } = usePopperContentFocusTrap(props, emit);
  14795. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  14796. const {
  14797. ariaModal,
  14798. arrowStyle,
  14799. contentAttrs,
  14800. contentClass,
  14801. contentStyle,
  14802. updateZIndex
  14803. } = usePopperContentDOM(props, {
  14804. styles,
  14805. attributes,
  14806. role
  14807. });
  14808. const formItemContext = inject(formItemContextKey, void 0);
  14809. const arrowOffset = ref();
  14810. provide(POPPER_CONTENT_INJECTION_KEY, {
  14811. arrowStyle,
  14812. arrowRef,
  14813. arrowOffset
  14814. });
  14815. if (formItemContext) {
  14816. provide(formItemContextKey, {
  14817. ...formItemContext,
  14818. addInputId: NOOP,
  14819. removeInputId: NOOP
  14820. });
  14821. }
  14822. let triggerTargetAriaStopWatch = void 0;
  14823. const updatePopper = (shouldUpdateZIndex = true) => {
  14824. update();
  14825. shouldUpdateZIndex && updateZIndex();
  14826. };
  14827. const togglePopperAlive = () => {
  14828. updatePopper(false);
  14829. if (props.visible && props.focusOnShow) {
  14830. trapped.value = true;
  14831. } else if (props.visible === false) {
  14832. trapped.value = false;
  14833. }
  14834. };
  14835. onMounted(() => {
  14836. watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  14837. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  14838. triggerTargetAriaStopWatch = void 0;
  14839. const el = unref(triggerTargetEl || contentRef.value);
  14840. const prevEl = unref(prevTriggerTargetEl || contentRef.value);
  14841. if (isElement$1(el)) {
  14842. triggerTargetAriaStopWatch = watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  14843. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  14844. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  14845. });
  14846. }, { immediate: true });
  14847. }
  14848. if (prevEl !== el && isElement$1(prevEl)) {
  14849. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  14850. prevEl.removeAttribute(key);
  14851. });
  14852. }
  14853. }, { immediate: true });
  14854. watch(() => props.visible, togglePopperAlive, { immediate: true });
  14855. });
  14856. onBeforeUnmount(() => {
  14857. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  14858. triggerTargetAriaStopWatch = void 0;
  14859. });
  14860. expose({
  14861. popperContentRef: contentRef,
  14862. popperInstanceRef: instanceRef,
  14863. updatePopper,
  14864. contentStyle
  14865. });
  14866. return (_ctx, _cache) => {
  14867. return openBlock(), createElementBlock("div", mergeProps({
  14868. ref_key: "contentRef",
  14869. ref: contentRef
  14870. }, unref(contentAttrs), {
  14871. style: unref(contentStyle),
  14872. class: unref(contentClass),
  14873. tabindex: "-1",
  14874. onMouseenter: (e) => _ctx.$emit("mouseenter", e),
  14875. onMouseleave: (e) => _ctx.$emit("mouseleave", e)
  14876. }), [
  14877. createVNode(unref(ElFocusTrap), {
  14878. trapped: unref(trapped),
  14879. "trap-on-focus-in": true,
  14880. "focus-trap-el": unref(contentRef),
  14881. "focus-start-el": unref(focusStartRef),
  14882. onFocusAfterTrapped: unref(onFocusAfterTrapped),
  14883. onFocusAfterReleased: unref(onFocusAfterReleased),
  14884. onFocusin: unref(onFocusInTrap),
  14885. onFocusoutPrevented: unref(onFocusoutPrevented),
  14886. onReleaseRequested: unref(onReleaseRequested)
  14887. }, {
  14888. default: withCtx(() => [
  14889. renderSlot(_ctx.$slots, "default")
  14890. ]),
  14891. _: 3
  14892. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
  14893. ], 16, ["onMouseenter", "onMouseleave"]);
  14894. };
  14895. }
  14896. });
  14897. var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$2k, [["__file", "content.vue"]]);
  14898. const ElPopper = withInstall(Popper);
  14899. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  14900. const useTooltipContentProps = buildProps({
  14901. ...useDelayedToggleProps,
  14902. ...popperContentProps,
  14903. appendTo: {
  14904. type: definePropType([String, Object])
  14905. },
  14906. content: {
  14907. type: String,
  14908. default: ""
  14909. },
  14910. rawContent: Boolean,
  14911. persistent: Boolean,
  14912. visible: {
  14913. type: definePropType(Boolean),
  14914. default: null
  14915. },
  14916. transition: String,
  14917. teleported: {
  14918. type: Boolean,
  14919. default: true
  14920. },
  14921. disabled: Boolean,
  14922. ...useAriaProps(["ariaLabel"])
  14923. });
  14924. const useTooltipTriggerProps = buildProps({
  14925. ...popperTriggerProps,
  14926. disabled: Boolean,
  14927. trigger: {
  14928. type: definePropType([String, Array]),
  14929. default: "hover"
  14930. },
  14931. triggerKeys: {
  14932. type: definePropType(Array),
  14933. default: () => [EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space]
  14934. }
  14935. });
  14936. const {
  14937. useModelToggleProps: useTooltipModelToggleProps,
  14938. useModelToggleEmits: useTooltipModelToggleEmits,
  14939. useModelToggle: useTooltipModelToggle
  14940. } = createModelToggleComposable("visible");
  14941. const useTooltipProps = buildProps({
  14942. ...popperProps,
  14943. ...useTooltipModelToggleProps,
  14944. ...useTooltipContentProps,
  14945. ...useTooltipTriggerProps,
  14946. ...popperArrowProps,
  14947. showArrow: {
  14948. type: Boolean,
  14949. default: true
  14950. }
  14951. });
  14952. const tooltipEmits = [
  14953. ...useTooltipModelToggleEmits,
  14954. "before-show",
  14955. "before-hide",
  14956. "show",
  14957. "hide",
  14958. "open",
  14959. "close"
  14960. ];
  14961. const isTriggerType = (trigger, type) => {
  14962. if (isArray$1(trigger)) {
  14963. return trigger.includes(type);
  14964. }
  14965. return trigger === type;
  14966. };
  14967. const whenTrigger = (trigger, type, handler) => {
  14968. return (e) => {
  14969. isTriggerType(unref(trigger), type) && handler(e);
  14970. };
  14971. };
  14972. const __default__$1G = defineComponent({
  14973. name: "ElTooltipTrigger"
  14974. });
  14975. const _sfc_main$2j = /* @__PURE__ */ defineComponent({
  14976. ...__default__$1G,
  14977. props: useTooltipTriggerProps,
  14978. setup(__props, { expose }) {
  14979. const props = __props;
  14980. const ns = useNamespace("tooltip");
  14981. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  14982. const triggerRef = ref(null);
  14983. const stopWhenControlledOrDisabled = () => {
  14984. if (unref(controlled) || props.disabled) {
  14985. return true;
  14986. }
  14987. };
  14988. const trigger = toRef(props, "trigger");
  14989. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  14990. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  14991. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  14992. if (e.button === 0) {
  14993. onToggle(e);
  14994. }
  14995. }));
  14996. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  14997. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  14998. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  14999. e.preventDefault();
  15000. onToggle(e);
  15001. }));
  15002. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  15003. const { code } = e;
  15004. if (props.triggerKeys.includes(code)) {
  15005. e.preventDefault();
  15006. onToggle(e);
  15007. }
  15008. });
  15009. expose({
  15010. triggerRef
  15011. });
  15012. return (_ctx, _cache) => {
  15013. return openBlock(), createBlock(unref(ElPopperTrigger), {
  15014. id: unref(id),
  15015. "virtual-ref": _ctx.virtualRef,
  15016. open: unref(open),
  15017. "virtual-triggering": _ctx.virtualTriggering,
  15018. class: normalizeClass(unref(ns).e("trigger")),
  15019. onBlur: unref(onBlur),
  15020. onClick: unref(onClick),
  15021. onContextmenu: unref(onContextMenu),
  15022. onFocus: unref(onFocus),
  15023. onMouseenter: unref(onMouseenter),
  15024. onMouseleave: unref(onMouseleave),
  15025. onKeydown: unref(onKeydown)
  15026. }, {
  15027. default: withCtx(() => [
  15028. renderSlot(_ctx.$slots, "default")
  15029. ]),
  15030. _: 3
  15031. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  15032. };
  15033. }
  15034. });
  15035. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$2j, [["__file", "trigger.vue"]]);
  15036. const teleportProps = buildProps({
  15037. to: {
  15038. type: definePropType([String, Object]),
  15039. required: true
  15040. },
  15041. disabled: Boolean
  15042. });
  15043. const _sfc_main$2i = /* @__PURE__ */ defineComponent({
  15044. __name: "teleport",
  15045. props: teleportProps,
  15046. setup(__props) {
  15047. return (_ctx, _cache) => {
  15048. return _ctx.disabled ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createBlock(Teleport$1, {
  15049. key: 1,
  15050. to: _ctx.to
  15051. }, [
  15052. renderSlot(_ctx.$slots, "default")
  15053. ], 8, ["to"]));
  15054. };
  15055. }
  15056. });
  15057. var Teleport = /* @__PURE__ */ _export_sfc(_sfc_main$2i, [["__file", "teleport.vue"]]);
  15058. const ElTeleport = withInstall(Teleport);
  15059. var ElTeleport$1 = ElTeleport;
  15060. const __default__$1F = defineComponent({
  15061. name: "ElTooltipContent",
  15062. inheritAttrs: false
  15063. });
  15064. const _sfc_main$2h = /* @__PURE__ */ defineComponent({
  15065. ...__default__$1F,
  15066. props: useTooltipContentProps,
  15067. setup(__props, { expose }) {
  15068. const props = __props;
  15069. const { selector } = usePopperContainerId();
  15070. const ns = useNamespace("tooltip");
  15071. const contentRef = ref();
  15072. let stopHandle;
  15073. const {
  15074. controlled,
  15075. id,
  15076. open,
  15077. trigger,
  15078. onClose,
  15079. onOpen,
  15080. onShow,
  15081. onHide,
  15082. onBeforeShow,
  15083. onBeforeHide
  15084. } = inject(TOOLTIP_INJECTION_KEY, void 0);
  15085. const transitionClass = computed(() => {
  15086. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  15087. });
  15088. const persistentRef = computed(() => {
  15089. return props.persistent;
  15090. });
  15091. onBeforeUnmount(() => {
  15092. stopHandle == null ? void 0 : stopHandle();
  15093. });
  15094. const shouldRender = computed(() => {
  15095. return unref(persistentRef) ? true : unref(open);
  15096. });
  15097. const shouldShow = computed(() => {
  15098. return props.disabled ? false : unref(open);
  15099. });
  15100. const appendTo = computed(() => {
  15101. return props.appendTo || selector.value;
  15102. });
  15103. const contentStyle = computed(() => {
  15104. var _a;
  15105. return (_a = props.style) != null ? _a : {};
  15106. });
  15107. const ariaHidden = ref(true);
  15108. const onTransitionLeave = () => {
  15109. onHide();
  15110. ariaHidden.value = true;
  15111. };
  15112. const stopWhenControlled = () => {
  15113. if (unref(controlled))
  15114. return true;
  15115. };
  15116. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  15117. if (props.enterable && unref(trigger) === "hover") {
  15118. onOpen();
  15119. }
  15120. });
  15121. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  15122. if (unref(trigger) === "hover") {
  15123. onClose();
  15124. }
  15125. });
  15126. const onBeforeEnter = () => {
  15127. var _a, _b;
  15128. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  15129. onBeforeShow == null ? void 0 : onBeforeShow();
  15130. };
  15131. const onBeforeLeave = () => {
  15132. onBeforeHide == null ? void 0 : onBeforeHide();
  15133. };
  15134. const onAfterShow = () => {
  15135. onShow();
  15136. stopHandle = onClickOutside(computed(() => {
  15137. var _a;
  15138. return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  15139. }), () => {
  15140. if (unref(controlled))
  15141. return;
  15142. const $trigger = unref(trigger);
  15143. if ($trigger !== "hover") {
  15144. onClose();
  15145. }
  15146. });
  15147. };
  15148. const onBlur = () => {
  15149. if (!props.virtualTriggering) {
  15150. onClose();
  15151. }
  15152. };
  15153. watch(() => unref(open), (val) => {
  15154. if (!val) {
  15155. stopHandle == null ? void 0 : stopHandle();
  15156. } else {
  15157. ariaHidden.value = false;
  15158. }
  15159. }, {
  15160. flush: "post"
  15161. });
  15162. watch(() => props.content, () => {
  15163. var _a, _b;
  15164. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  15165. });
  15166. expose({
  15167. contentRef
  15168. });
  15169. return (_ctx, _cache) => {
  15170. return openBlock(), createBlock(unref(ElTeleport$1), {
  15171. disabled: !_ctx.teleported,
  15172. to: unref(appendTo)
  15173. }, {
  15174. default: withCtx(() => [
  15175. createVNode(Transition, {
  15176. name: unref(transitionClass),
  15177. onAfterLeave: onTransitionLeave,
  15178. onBeforeEnter,
  15179. onAfterEnter: onAfterShow,
  15180. onBeforeLeave
  15181. }, {
  15182. default: withCtx(() => [
  15183. unref(shouldRender) ? withDirectives((openBlock(), createBlock(unref(ElPopperContent), mergeProps({
  15184. key: 0,
  15185. id: unref(id),
  15186. ref_key: "contentRef",
  15187. ref: contentRef
  15188. }, _ctx.$attrs, {
  15189. "aria-label": _ctx.ariaLabel,
  15190. "aria-hidden": ariaHidden.value,
  15191. "boundaries-padding": _ctx.boundariesPadding,
  15192. "fallback-placements": _ctx.fallbackPlacements,
  15193. "gpu-acceleration": _ctx.gpuAcceleration,
  15194. offset: _ctx.offset,
  15195. placement: _ctx.placement,
  15196. "popper-options": _ctx.popperOptions,
  15197. strategy: _ctx.strategy,
  15198. effect: _ctx.effect,
  15199. enterable: _ctx.enterable,
  15200. pure: _ctx.pure,
  15201. "popper-class": _ctx.popperClass,
  15202. "popper-style": [_ctx.popperStyle, unref(contentStyle)],
  15203. "reference-el": _ctx.referenceEl,
  15204. "trigger-target-el": _ctx.triggerTargetEl,
  15205. visible: unref(shouldShow),
  15206. "z-index": _ctx.zIndex,
  15207. onMouseenter: unref(onContentEnter),
  15208. onMouseleave: unref(onContentLeave),
  15209. onBlur,
  15210. onClose: unref(onClose)
  15211. }), {
  15212. default: withCtx(() => [
  15213. renderSlot(_ctx.$slots, "default")
  15214. ]),
  15215. _: 3
  15216. }, 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"])), [
  15217. [vShow, unref(shouldShow)]
  15218. ]) : createCommentVNode("v-if", true)
  15219. ]),
  15220. _: 3
  15221. }, 8, ["name"])
  15222. ]),
  15223. _: 3
  15224. }, 8, ["disabled", "to"]);
  15225. };
  15226. }
  15227. });
  15228. var ElTooltipContent = /* @__PURE__ */ _export_sfc(_sfc_main$2h, [["__file", "content.vue"]]);
  15229. const __default__$1E = defineComponent({
  15230. name: "ElTooltip"
  15231. });
  15232. const _sfc_main$2g = /* @__PURE__ */ defineComponent({
  15233. ...__default__$1E,
  15234. props: useTooltipProps,
  15235. emits: tooltipEmits,
  15236. setup(__props, { expose, emit }) {
  15237. const props = __props;
  15238. usePopperContainer();
  15239. const id = useId();
  15240. const popperRef = ref();
  15241. const contentRef = ref();
  15242. const updatePopper = () => {
  15243. var _a;
  15244. const popperComponent = unref(popperRef);
  15245. if (popperComponent) {
  15246. (_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update();
  15247. }
  15248. };
  15249. const open = ref(false);
  15250. const toggleReason = ref();
  15251. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  15252. indicator: open,
  15253. toggleReason
  15254. });
  15255. const { onOpen, onClose } = useDelayedToggle({
  15256. showAfter: toRef(props, "showAfter"),
  15257. hideAfter: toRef(props, "hideAfter"),
  15258. autoClose: toRef(props, "autoClose"),
  15259. open: show,
  15260. close: hide
  15261. });
  15262. const controlled = computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  15263. provide(TOOLTIP_INJECTION_KEY, {
  15264. controlled,
  15265. id,
  15266. open: readonly(open),
  15267. trigger: toRef(props, "trigger"),
  15268. onOpen: (event) => {
  15269. onOpen(event);
  15270. },
  15271. onClose: (event) => {
  15272. onClose(event);
  15273. },
  15274. onToggle: (event) => {
  15275. if (unref(open)) {
  15276. onClose(event);
  15277. } else {
  15278. onOpen(event);
  15279. }
  15280. },
  15281. onShow: () => {
  15282. emit("show", toggleReason.value);
  15283. },
  15284. onHide: () => {
  15285. emit("hide", toggleReason.value);
  15286. },
  15287. onBeforeShow: () => {
  15288. emit("before-show", toggleReason.value);
  15289. },
  15290. onBeforeHide: () => {
  15291. emit("before-hide", toggleReason.value);
  15292. },
  15293. updatePopper
  15294. });
  15295. watch(() => props.disabled, (disabled) => {
  15296. if (disabled && open.value) {
  15297. open.value = false;
  15298. }
  15299. });
  15300. const isFocusInsideContent = (event) => {
  15301. var _a, _b;
  15302. const popperContent = (_b = (_a = contentRef.value) == null ? void 0 : _a.contentRef) == null ? void 0 : _b.popperContentRef;
  15303. const activeElement = (event == null ? void 0 : event.relatedTarget) || document.activeElement;
  15304. return popperContent && popperContent.contains(activeElement);
  15305. };
  15306. onDeactivated(() => open.value && hide());
  15307. expose({
  15308. popperRef,
  15309. contentRef,
  15310. isFocusInsideContent,
  15311. updatePopper,
  15312. onOpen,
  15313. onClose,
  15314. hide
  15315. });
  15316. return (_ctx, _cache) => {
  15317. return openBlock(), createBlock(unref(ElPopper), {
  15318. ref_key: "popperRef",
  15319. ref: popperRef,
  15320. role: _ctx.role
  15321. }, {
  15322. default: withCtx(() => [
  15323. createVNode(ElTooltipTrigger, {
  15324. disabled: _ctx.disabled,
  15325. trigger: _ctx.trigger,
  15326. "trigger-keys": _ctx.triggerKeys,
  15327. "virtual-ref": _ctx.virtualRef,
  15328. "virtual-triggering": _ctx.virtualTriggering
  15329. }, {
  15330. default: withCtx(() => [
  15331. _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  15332. ]),
  15333. _: 3
  15334. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
  15335. createVNode(ElTooltipContent, {
  15336. ref_key: "contentRef",
  15337. ref: contentRef,
  15338. "aria-label": _ctx.ariaLabel,
  15339. "boundaries-padding": _ctx.boundariesPadding,
  15340. content: _ctx.content,
  15341. disabled: _ctx.disabled,
  15342. effect: _ctx.effect,
  15343. enterable: _ctx.enterable,
  15344. "fallback-placements": _ctx.fallbackPlacements,
  15345. "hide-after": _ctx.hideAfter,
  15346. "gpu-acceleration": _ctx.gpuAcceleration,
  15347. offset: _ctx.offset,
  15348. persistent: _ctx.persistent,
  15349. "popper-class": _ctx.popperClass,
  15350. "popper-style": _ctx.popperStyle,
  15351. placement: _ctx.placement,
  15352. "popper-options": _ctx.popperOptions,
  15353. pure: _ctx.pure,
  15354. "raw-content": _ctx.rawContent,
  15355. "reference-el": _ctx.referenceEl,
  15356. "trigger-target-el": _ctx.triggerTargetEl,
  15357. "show-after": _ctx.showAfter,
  15358. strategy: _ctx.strategy,
  15359. teleported: _ctx.teleported,
  15360. transition: _ctx.transition,
  15361. "virtual-triggering": _ctx.virtualTriggering,
  15362. "z-index": _ctx.zIndex,
  15363. "append-to": _ctx.appendTo
  15364. }, {
  15365. default: withCtx(() => [
  15366. renderSlot(_ctx.$slots, "content", {}, () => [
  15367. _ctx.rawContent ? (openBlock(), createElementBlock("span", {
  15368. key: 0,
  15369. innerHTML: _ctx.content
  15370. }, null, 8, ["innerHTML"])) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(_ctx.content), 1))
  15371. ]),
  15372. _ctx.showArrow ? (openBlock(), createBlock(unref(ElPopperArrow), {
  15373. key: 0,
  15374. "arrow-offset": _ctx.arrowOffset
  15375. }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
  15376. ]),
  15377. _: 3
  15378. }, 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"])
  15379. ]),
  15380. _: 3
  15381. }, 8, ["role"]);
  15382. };
  15383. }
  15384. });
  15385. var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$2g, [["__file", "tooltip.vue"]]);
  15386. const ElTooltip = withInstall(Tooltip);
  15387. const autocompleteProps = buildProps({
  15388. valueKey: {
  15389. type: String,
  15390. default: "value"
  15391. },
  15392. modelValue: {
  15393. type: [String, Number],
  15394. default: ""
  15395. },
  15396. debounce: {
  15397. type: Number,
  15398. default: 300
  15399. },
  15400. placement: {
  15401. type: definePropType(String),
  15402. values: [
  15403. "top",
  15404. "top-start",
  15405. "top-end",
  15406. "bottom",
  15407. "bottom-start",
  15408. "bottom-end"
  15409. ],
  15410. default: "bottom-start"
  15411. },
  15412. fetchSuggestions: {
  15413. type: definePropType([Function, Array]),
  15414. default: NOOP
  15415. },
  15416. popperClass: {
  15417. type: String,
  15418. default: ""
  15419. },
  15420. triggerOnFocus: {
  15421. type: Boolean,
  15422. default: true
  15423. },
  15424. selectWhenUnmatched: {
  15425. type: Boolean,
  15426. default: false
  15427. },
  15428. hideLoading: {
  15429. type: Boolean,
  15430. default: false
  15431. },
  15432. teleported: useTooltipContentProps.teleported,
  15433. highlightFirstItem: {
  15434. type: Boolean,
  15435. default: false
  15436. },
  15437. fitInputWidth: {
  15438. type: Boolean,
  15439. default: false
  15440. },
  15441. clearable: {
  15442. type: Boolean,
  15443. default: false
  15444. },
  15445. disabled: {
  15446. type: Boolean,
  15447. default: false
  15448. },
  15449. name: String,
  15450. ...useAriaProps(["ariaLabel"])
  15451. });
  15452. const autocompleteEmits = {
  15453. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  15454. [INPUT_EVENT]: (value) => isString$1(value),
  15455. [CHANGE_EVENT]: (value) => isString$1(value),
  15456. focus: (evt) => evt instanceof FocusEvent,
  15457. blur: (evt) => evt instanceof FocusEvent,
  15458. clear: () => true,
  15459. select: (item) => isObject$1(item)
  15460. };
  15461. const COMPONENT_NAME$i = "ElAutocomplete";
  15462. const __default__$1D = defineComponent({
  15463. name: COMPONENT_NAME$i,
  15464. inheritAttrs: false
  15465. });
  15466. const _sfc_main$2f = /* @__PURE__ */ defineComponent({
  15467. ...__default__$1D,
  15468. props: autocompleteProps,
  15469. emits: autocompleteEmits,
  15470. setup(__props, { expose, emit }) {
  15471. const props = __props;
  15472. const attrs = useAttrs();
  15473. const rawAttrs = useAttrs$1();
  15474. const disabled = useFormDisabled();
  15475. const ns = useNamespace("autocomplete");
  15476. const inputRef = ref();
  15477. const regionRef = ref();
  15478. const popperRef = ref();
  15479. const listboxRef = ref();
  15480. let readonly = false;
  15481. let ignoreFocusEvent = false;
  15482. const suggestions = ref([]);
  15483. const highlightedIndex = ref(-1);
  15484. const dropdownWidth = ref("");
  15485. const activated = ref(false);
  15486. const suggestionDisabled = ref(false);
  15487. const loading = ref(false);
  15488. const listboxId = useId();
  15489. const styles = computed(() => rawAttrs.style);
  15490. const suggestionVisible = computed(() => {
  15491. const isValidData = suggestions.value.length > 0;
  15492. return (isValidData || loading.value) && activated.value;
  15493. });
  15494. const suggestionLoading = computed(() => !props.hideLoading && loading.value);
  15495. const refInput = computed(() => {
  15496. if (inputRef.value) {
  15497. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  15498. }
  15499. return [];
  15500. });
  15501. const onSuggestionShow = () => {
  15502. if (suggestionVisible.value) {
  15503. dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
  15504. }
  15505. };
  15506. const onHide = () => {
  15507. highlightedIndex.value = -1;
  15508. };
  15509. const getData = async (queryString) => {
  15510. if (suggestionDisabled.value)
  15511. return;
  15512. const cb = (suggestionList) => {
  15513. loading.value = false;
  15514. if (suggestionDisabled.value)
  15515. return;
  15516. if (isArray$1(suggestionList)) {
  15517. suggestions.value = suggestionList;
  15518. highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
  15519. } else {
  15520. throwError(COMPONENT_NAME$i, "autocomplete suggestions must be an array");
  15521. }
  15522. };
  15523. loading.value = true;
  15524. if (isArray$1(props.fetchSuggestions)) {
  15525. cb(props.fetchSuggestions);
  15526. } else {
  15527. const result = await props.fetchSuggestions(queryString, cb);
  15528. if (isArray$1(result))
  15529. cb(result);
  15530. }
  15531. };
  15532. const debouncedGetData = debounce(getData, props.debounce);
  15533. const handleInput = (value) => {
  15534. const valuePresented = !!value;
  15535. emit(INPUT_EVENT, value);
  15536. emit(UPDATE_MODEL_EVENT, value);
  15537. suggestionDisabled.value = false;
  15538. activated.value || (activated.value = valuePresented);
  15539. if (!props.triggerOnFocus && !value) {
  15540. suggestionDisabled.value = true;
  15541. suggestions.value = [];
  15542. return;
  15543. }
  15544. debouncedGetData(value);
  15545. };
  15546. const handleMouseDown = (event) => {
  15547. var _a;
  15548. if (disabled.value)
  15549. return;
  15550. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  15551. activated.value = true;
  15552. }
  15553. };
  15554. const handleChange = (value) => {
  15555. emit(CHANGE_EVENT, value);
  15556. };
  15557. const handleFocus = (evt) => {
  15558. if (!ignoreFocusEvent) {
  15559. activated.value = true;
  15560. emit("focus", evt);
  15561. if (props.triggerOnFocus && !readonly) {
  15562. debouncedGetData(String(props.modelValue));
  15563. }
  15564. } else {
  15565. ignoreFocusEvent = false;
  15566. }
  15567. };
  15568. const handleBlur = (evt) => {
  15569. setTimeout(() => {
  15570. var _a;
  15571. if ((_a = popperRef.value) == null ? void 0 : _a.isFocusInsideContent()) {
  15572. ignoreFocusEvent = true;
  15573. return;
  15574. }
  15575. activated.value && close();
  15576. emit("blur", evt);
  15577. });
  15578. };
  15579. const handleClear = () => {
  15580. activated.value = false;
  15581. emit(UPDATE_MODEL_EVENT, "");
  15582. emit("clear");
  15583. };
  15584. const handleKeyEnter = async () => {
  15585. if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) {
  15586. handleSelect(suggestions.value[highlightedIndex.value]);
  15587. } else if (props.selectWhenUnmatched) {
  15588. emit("select", { value: props.modelValue });
  15589. suggestions.value = [];
  15590. highlightedIndex.value = -1;
  15591. }
  15592. };
  15593. const handleKeyEscape = (evt) => {
  15594. if (suggestionVisible.value) {
  15595. evt.preventDefault();
  15596. evt.stopPropagation();
  15597. close();
  15598. }
  15599. };
  15600. const close = () => {
  15601. activated.value = false;
  15602. };
  15603. const focus = () => {
  15604. var _a;
  15605. (_a = inputRef.value) == null ? void 0 : _a.focus();
  15606. };
  15607. const blur = () => {
  15608. var _a;
  15609. (_a = inputRef.value) == null ? void 0 : _a.blur();
  15610. };
  15611. const handleSelect = async (item) => {
  15612. emit(INPUT_EVENT, item[props.valueKey]);
  15613. emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
  15614. emit("select", item);
  15615. suggestions.value = [];
  15616. highlightedIndex.value = -1;
  15617. };
  15618. const highlight = (index) => {
  15619. if (!suggestionVisible.value || loading.value)
  15620. return;
  15621. if (index < 0) {
  15622. highlightedIndex.value = -1;
  15623. return;
  15624. }
  15625. if (index >= suggestions.value.length) {
  15626. index = suggestions.value.length - 1;
  15627. }
  15628. const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
  15629. const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`);
  15630. const highlightItem = suggestionList[index];
  15631. const scrollTop = suggestion.scrollTop;
  15632. const { offsetTop, scrollHeight } = highlightItem;
  15633. if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) {
  15634. suggestion.scrollTop += scrollHeight;
  15635. }
  15636. if (offsetTop < scrollTop) {
  15637. suggestion.scrollTop -= scrollHeight;
  15638. }
  15639. highlightedIndex.value = index;
  15640. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  15641. };
  15642. const stopHandle = onClickOutside(listboxRef, () => {
  15643. suggestionVisible.value && close();
  15644. });
  15645. onBeforeUnmount(() => {
  15646. stopHandle == null ? void 0 : stopHandle();
  15647. });
  15648. onMounted(() => {
  15649. inputRef.value.ref.setAttribute("role", "textbox");
  15650. inputRef.value.ref.setAttribute("aria-autocomplete", "list");
  15651. inputRef.value.ref.setAttribute("aria-controls", "id");
  15652. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  15653. readonly = inputRef.value.ref.hasAttribute("readonly");
  15654. });
  15655. expose({
  15656. highlightedIndex,
  15657. activated,
  15658. loading,
  15659. inputRef,
  15660. popperRef,
  15661. suggestions,
  15662. handleSelect,
  15663. handleKeyEnter,
  15664. focus,
  15665. blur,
  15666. close,
  15667. highlight,
  15668. getData
  15669. });
  15670. return (_ctx, _cache) => {
  15671. return openBlock(), createBlock(unref(ElTooltip), {
  15672. ref_key: "popperRef",
  15673. ref: popperRef,
  15674. visible: unref(suggestionVisible),
  15675. placement: _ctx.placement,
  15676. "fallback-placements": ["bottom-start", "top-start"],
  15677. "popper-class": [unref(ns).e("popper"), _ctx.popperClass],
  15678. teleported: _ctx.teleported,
  15679. "gpu-acceleration": false,
  15680. pure: "",
  15681. "manual-mode": "",
  15682. effect: "light",
  15683. trigger: "click",
  15684. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  15685. persistent: "",
  15686. role: "listbox",
  15687. onBeforeShow: onSuggestionShow,
  15688. onHide
  15689. }, {
  15690. content: withCtx(() => [
  15691. createElementVNode("div", {
  15692. ref_key: "regionRef",
  15693. ref: regionRef,
  15694. class: normalizeClass([unref(ns).b("suggestion"), unref(ns).is("loading", unref(suggestionLoading))]),
  15695. style: normalizeStyle({
  15696. [_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
  15697. outline: "none"
  15698. }),
  15699. role: "region"
  15700. }, [
  15701. createVNode(unref(ElScrollbar), {
  15702. id: unref(listboxId),
  15703. tag: "ul",
  15704. "wrap-class": unref(ns).be("suggestion", "wrap"),
  15705. "view-class": unref(ns).be("suggestion", "list"),
  15706. role: "listbox"
  15707. }, {
  15708. default: withCtx(() => [
  15709. unref(suggestionLoading) ? (openBlock(), createElementBlock("li", { key: 0 }, [
  15710. renderSlot(_ctx.$slots, "loading", {}, () => [
  15711. createVNode(unref(ElIcon), {
  15712. class: normalizeClass(unref(ns).is("loading"))
  15713. }, {
  15714. default: withCtx(() => [
  15715. createVNode(unref(loading_default))
  15716. ]),
  15717. _: 1
  15718. }, 8, ["class"])
  15719. ])
  15720. ])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(suggestions.value, (item, index) => {
  15721. return openBlock(), createElementBlock("li", {
  15722. id: `${unref(listboxId)}-item-${index}`,
  15723. key: index,
  15724. class: normalizeClass({ highlighted: highlightedIndex.value === index }),
  15725. role: "option",
  15726. "aria-selected": highlightedIndex.value === index,
  15727. onClick: ($event) => handleSelect(item)
  15728. }, [
  15729. renderSlot(_ctx.$slots, "default", { item }, () => [
  15730. createTextVNode(toDisplayString(item[_ctx.valueKey]), 1)
  15731. ])
  15732. ], 10, ["id", "aria-selected", "onClick"]);
  15733. }), 128))
  15734. ]),
  15735. _: 3
  15736. }, 8, ["id", "wrap-class", "view-class"])
  15737. ], 6)
  15738. ]),
  15739. default: withCtx(() => [
  15740. createElementVNode("div", {
  15741. ref_key: "listboxRef",
  15742. ref: listboxRef,
  15743. class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
  15744. style: normalizeStyle(unref(styles)),
  15745. role: "combobox",
  15746. "aria-haspopup": "listbox",
  15747. "aria-expanded": unref(suggestionVisible),
  15748. "aria-owns": unref(listboxId)
  15749. }, [
  15750. createVNode(unref(ElInput), mergeProps({
  15751. ref_key: "inputRef",
  15752. ref: inputRef
  15753. }, unref(attrs), {
  15754. clearable: _ctx.clearable,
  15755. disabled: unref(disabled),
  15756. name: _ctx.name,
  15757. "model-value": _ctx.modelValue,
  15758. "aria-label": _ctx.ariaLabel,
  15759. onInput: handleInput,
  15760. onChange: handleChange,
  15761. onFocus: handleFocus,
  15762. onBlur: handleBlur,
  15763. onClear: handleClear,
  15764. onKeydown: [
  15765. withKeys(withModifiers(($event) => highlight(highlightedIndex.value - 1), ["prevent"]), ["up"]),
  15766. withKeys(withModifiers(($event) => highlight(highlightedIndex.value + 1), ["prevent"]), ["down"]),
  15767. withKeys(handleKeyEnter, ["enter"]),
  15768. withKeys(close, ["tab"]),
  15769. withKeys(handleKeyEscape, ["esc"])
  15770. ],
  15771. onMousedown: handleMouseDown
  15772. }), createSlots({
  15773. _: 2
  15774. }, [
  15775. _ctx.$slots.prepend ? {
  15776. name: "prepend",
  15777. fn: withCtx(() => [
  15778. renderSlot(_ctx.$slots, "prepend")
  15779. ])
  15780. } : void 0,
  15781. _ctx.$slots.append ? {
  15782. name: "append",
  15783. fn: withCtx(() => [
  15784. renderSlot(_ctx.$slots, "append")
  15785. ])
  15786. } : void 0,
  15787. _ctx.$slots.prefix ? {
  15788. name: "prefix",
  15789. fn: withCtx(() => [
  15790. renderSlot(_ctx.$slots, "prefix")
  15791. ])
  15792. } : void 0,
  15793. _ctx.$slots.suffix ? {
  15794. name: "suffix",
  15795. fn: withCtx(() => [
  15796. renderSlot(_ctx.$slots, "suffix")
  15797. ])
  15798. } : void 0
  15799. ]), 1040, ["clearable", "disabled", "name", "model-value", "aria-label", "onKeydown"])
  15800. ], 14, ["aria-expanded", "aria-owns"])
  15801. ]),
  15802. _: 3
  15803. }, 8, ["visible", "placement", "popper-class", "teleported", "transition"]);
  15804. };
  15805. }
  15806. });
  15807. var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$2f, [["__file", "autocomplete.vue"]]);
  15808. const ElAutocomplete = withInstall(Autocomplete);
  15809. const avatarProps = buildProps({
  15810. size: {
  15811. type: [Number, String],
  15812. values: componentSizes,
  15813. default: "",
  15814. validator: (val) => isNumber(val)
  15815. },
  15816. shape: {
  15817. type: String,
  15818. values: ["circle", "square"],
  15819. default: "circle"
  15820. },
  15821. icon: {
  15822. type: iconPropType
  15823. },
  15824. src: {
  15825. type: String,
  15826. default: ""
  15827. },
  15828. alt: String,
  15829. srcSet: String,
  15830. fit: {
  15831. type: definePropType(String),
  15832. default: "cover"
  15833. }
  15834. });
  15835. const avatarEmits = {
  15836. error: (evt) => evt instanceof Event
  15837. };
  15838. const __default__$1C = defineComponent({
  15839. name: "ElAvatar"
  15840. });
  15841. const _sfc_main$2e = /* @__PURE__ */ defineComponent({
  15842. ...__default__$1C,
  15843. props: avatarProps,
  15844. emits: avatarEmits,
  15845. setup(__props, { emit }) {
  15846. const props = __props;
  15847. const ns = useNamespace("avatar");
  15848. const hasLoadError = ref(false);
  15849. const avatarClass = computed(() => {
  15850. const { size, icon, shape } = props;
  15851. const classList = [ns.b()];
  15852. if (isString$1(size))
  15853. classList.push(ns.m(size));
  15854. if (icon)
  15855. classList.push(ns.m("icon"));
  15856. if (shape)
  15857. classList.push(ns.m(shape));
  15858. return classList;
  15859. });
  15860. const sizeStyle = computed(() => {
  15861. const { size } = props;
  15862. return isNumber(size) ? ns.cssVarBlock({
  15863. size: addUnit(size) || ""
  15864. }) : void 0;
  15865. });
  15866. const fitStyle = computed(() => ({
  15867. objectFit: props.fit
  15868. }));
  15869. watch(() => props.src, () => hasLoadError.value = false);
  15870. function handleError(e) {
  15871. hasLoadError.value = true;
  15872. emit("error", e);
  15873. }
  15874. return (_ctx, _cache) => {
  15875. return openBlock(), createElementBlock("span", {
  15876. class: normalizeClass(unref(avatarClass)),
  15877. style: normalizeStyle(unref(sizeStyle))
  15878. }, [
  15879. (_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (openBlock(), createElementBlock("img", {
  15880. key: 0,
  15881. src: _ctx.src,
  15882. alt: _ctx.alt,
  15883. srcset: _ctx.srcSet,
  15884. style: normalizeStyle(unref(fitStyle)),
  15885. onError: handleError
  15886. }, null, 44, ["src", "alt", "srcset"])) : _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  15887. default: withCtx(() => [
  15888. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  15889. ]),
  15890. _: 1
  15891. })) : renderSlot(_ctx.$slots, "default", { key: 2 })
  15892. ], 6);
  15893. };
  15894. }
  15895. });
  15896. var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$2e, [["__file", "avatar.vue"]]);
  15897. const ElAvatar = withInstall(Avatar);
  15898. const backtopProps = {
  15899. visibilityHeight: {
  15900. type: Number,
  15901. default: 200
  15902. },
  15903. target: {
  15904. type: String,
  15905. default: ""
  15906. },
  15907. right: {
  15908. type: Number,
  15909. default: 40
  15910. },
  15911. bottom: {
  15912. type: Number,
  15913. default: 40
  15914. }
  15915. };
  15916. const backtopEmits = {
  15917. click: (evt) => evt instanceof MouseEvent
  15918. };
  15919. const useBackTop = (props, emit, componentName) => {
  15920. const el = shallowRef();
  15921. const container = shallowRef();
  15922. const visible = ref(false);
  15923. const handleScroll = () => {
  15924. if (el.value)
  15925. visible.value = el.value.scrollTop >= props.visibilityHeight;
  15926. };
  15927. const handleClick = (event) => {
  15928. var _a;
  15929. (_a = el.value) == null ? void 0 : _a.scrollTo({ top: 0, behavior: "smooth" });
  15930. emit("click", event);
  15931. };
  15932. const handleScrollThrottled = useThrottleFn(handleScroll, 300, true);
  15933. useEventListener(container, "scroll", handleScrollThrottled);
  15934. onMounted(() => {
  15935. var _a;
  15936. container.value = document;
  15937. el.value = document.documentElement;
  15938. if (props.target) {
  15939. el.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  15940. if (!el.value) {
  15941. throwError(componentName, `target does not exist: ${props.target}`);
  15942. }
  15943. container.value = el.value;
  15944. }
  15945. handleScroll();
  15946. });
  15947. return {
  15948. visible,
  15949. handleClick
  15950. };
  15951. };
  15952. const COMPONENT_NAME$h = "ElBacktop";
  15953. const __default__$1B = defineComponent({
  15954. name: COMPONENT_NAME$h
  15955. });
  15956. const _sfc_main$2d = /* @__PURE__ */ defineComponent({
  15957. ...__default__$1B,
  15958. props: backtopProps,
  15959. emits: backtopEmits,
  15960. setup(__props, { emit }) {
  15961. const props = __props;
  15962. const ns = useNamespace("backtop");
  15963. const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$h);
  15964. const backTopStyle = computed(() => ({
  15965. right: `${props.right}px`,
  15966. bottom: `${props.bottom}px`
  15967. }));
  15968. return (_ctx, _cache) => {
  15969. return openBlock(), createBlock(Transition, {
  15970. name: `${unref(ns).namespace.value}-fade-in`
  15971. }, {
  15972. default: withCtx(() => [
  15973. unref(visible) ? (openBlock(), createElementBlock("div", {
  15974. key: 0,
  15975. style: normalizeStyle(unref(backTopStyle)),
  15976. class: normalizeClass(unref(ns).b()),
  15977. onClick: withModifiers(unref(handleClick), ["stop"])
  15978. }, [
  15979. renderSlot(_ctx.$slots, "default", {}, () => [
  15980. createVNode(unref(ElIcon), {
  15981. class: normalizeClass(unref(ns).e("icon"))
  15982. }, {
  15983. default: withCtx(() => [
  15984. createVNode(unref(caret_top_default))
  15985. ]),
  15986. _: 1
  15987. }, 8, ["class"])
  15988. ])
  15989. ], 14, ["onClick"])) : createCommentVNode("v-if", true)
  15990. ]),
  15991. _: 3
  15992. }, 8, ["name"]);
  15993. };
  15994. }
  15995. });
  15996. var Backtop = /* @__PURE__ */ _export_sfc(_sfc_main$2d, [["__file", "backtop.vue"]]);
  15997. const ElBacktop = withInstall(Backtop);
  15998. const badgeProps = buildProps({
  15999. value: {
  16000. type: [String, Number],
  16001. default: ""
  16002. },
  16003. max: {
  16004. type: Number,
  16005. default: 99
  16006. },
  16007. isDot: Boolean,
  16008. hidden: Boolean,
  16009. type: {
  16010. type: String,
  16011. values: ["primary", "success", "warning", "info", "danger"],
  16012. default: "danger"
  16013. },
  16014. showZero: {
  16015. type: Boolean,
  16016. default: true
  16017. },
  16018. color: String,
  16019. badgeStyle: {
  16020. type: definePropType([String, Object, Array])
  16021. },
  16022. offset: {
  16023. type: definePropType(Array),
  16024. default: [0, 0]
  16025. },
  16026. badgeClass: {
  16027. type: String
  16028. }
  16029. });
  16030. const __default__$1A = defineComponent({
  16031. name: "ElBadge"
  16032. });
  16033. const _sfc_main$2c = /* @__PURE__ */ defineComponent({
  16034. ...__default__$1A,
  16035. props: badgeProps,
  16036. setup(__props, { expose }) {
  16037. const props = __props;
  16038. const ns = useNamespace("badge");
  16039. const content = computed(() => {
  16040. if (props.isDot)
  16041. return "";
  16042. if (isNumber(props.value) && isNumber(props.max)) {
  16043. return props.max < props.value ? `${props.max}+` : `${props.value}`;
  16044. }
  16045. return `${props.value}`;
  16046. });
  16047. const style = computed(() => {
  16048. var _a, _b, _c, _d, _e;
  16049. return [
  16050. {
  16051. backgroundColor: props.color,
  16052. marginRight: addUnit(-((_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : 0)),
  16053. marginTop: addUnit((_d = (_c = props.offset) == null ? void 0 : _c[1]) != null ? _d : 0)
  16054. },
  16055. (_e = props.badgeStyle) != null ? _e : {}
  16056. ];
  16057. });
  16058. expose({
  16059. content
  16060. });
  16061. return (_ctx, _cache) => {
  16062. return openBlock(), createElementBlock("div", {
  16063. class: normalizeClass(unref(ns).b())
  16064. }, [
  16065. renderSlot(_ctx.$slots, "default"),
  16066. createVNode(Transition, {
  16067. name: `${unref(ns).namespace.value}-zoom-in-center`,
  16068. persisted: ""
  16069. }, {
  16070. default: withCtx(() => [
  16071. withDirectives(createElementVNode("sup", {
  16072. class: normalizeClass([
  16073. unref(ns).e("content"),
  16074. unref(ns).em("content", _ctx.type),
  16075. unref(ns).is("fixed", !!_ctx.$slots.default),
  16076. unref(ns).is("dot", _ctx.isDot),
  16077. unref(ns).is("hide-zero", !_ctx.showZero && props.value === 0),
  16078. _ctx.badgeClass
  16079. ]),
  16080. style: normalizeStyle(unref(style))
  16081. }, [
  16082. renderSlot(_ctx.$slots, "content", { value: unref(content) }, () => [
  16083. createTextVNode(toDisplayString(unref(content)), 1)
  16084. ])
  16085. ], 6), [
  16086. [vShow, !_ctx.hidden && (unref(content) || _ctx.isDot || _ctx.$slots.content)]
  16087. ])
  16088. ]),
  16089. _: 3
  16090. }, 8, ["name"])
  16091. ], 2);
  16092. };
  16093. }
  16094. });
  16095. var Badge = /* @__PURE__ */ _export_sfc(_sfc_main$2c, [["__file", "badge.vue"]]);
  16096. const ElBadge = withInstall(Badge);
  16097. const breadcrumbKey = Symbol("breadcrumbKey");
  16098. const breadcrumbProps = buildProps({
  16099. separator: {
  16100. type: String,
  16101. default: "/"
  16102. },
  16103. separatorIcon: {
  16104. type: iconPropType
  16105. }
  16106. });
  16107. const __default__$1z = defineComponent({
  16108. name: "ElBreadcrumb"
  16109. });
  16110. const _sfc_main$2b = /* @__PURE__ */ defineComponent({
  16111. ...__default__$1z,
  16112. props: breadcrumbProps,
  16113. setup(__props) {
  16114. const props = __props;
  16115. const { t } = useLocale();
  16116. const ns = useNamespace("breadcrumb");
  16117. const breadcrumb = ref();
  16118. provide(breadcrumbKey, props);
  16119. onMounted(() => {
  16120. const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
  16121. if (items.length) {
  16122. items[items.length - 1].setAttribute("aria-current", "page");
  16123. }
  16124. });
  16125. return (_ctx, _cache) => {
  16126. return openBlock(), createElementBlock("div", {
  16127. ref_key: "breadcrumb",
  16128. ref: breadcrumb,
  16129. class: normalizeClass(unref(ns).b()),
  16130. "aria-label": unref(t)("el.breadcrumb.label"),
  16131. role: "navigation"
  16132. }, [
  16133. renderSlot(_ctx.$slots, "default")
  16134. ], 10, ["aria-label"]);
  16135. };
  16136. }
  16137. });
  16138. var Breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$2b, [["__file", "breadcrumb.vue"]]);
  16139. const breadcrumbItemProps = buildProps({
  16140. to: {
  16141. type: definePropType([String, Object]),
  16142. default: ""
  16143. },
  16144. replace: Boolean
  16145. });
  16146. const __default__$1y = defineComponent({
  16147. name: "ElBreadcrumbItem"
  16148. });
  16149. const _sfc_main$2a = /* @__PURE__ */ defineComponent({
  16150. ...__default__$1y,
  16151. props: breadcrumbItemProps,
  16152. setup(__props) {
  16153. const props = __props;
  16154. const instance = getCurrentInstance();
  16155. const breadcrumbContext = inject(breadcrumbKey, void 0);
  16156. const ns = useNamespace("breadcrumb");
  16157. const router = instance.appContext.config.globalProperties.$router;
  16158. const link = ref();
  16159. const onClick = () => {
  16160. if (!props.to || !router)
  16161. return;
  16162. props.replace ? router.replace(props.to) : router.push(props.to);
  16163. };
  16164. return (_ctx, _cache) => {
  16165. var _a, _b;
  16166. return openBlock(), createElementBlock("span", {
  16167. class: normalizeClass(unref(ns).e("item"))
  16168. }, [
  16169. createElementVNode("span", {
  16170. ref_key: "link",
  16171. ref: link,
  16172. class: normalizeClass([unref(ns).e("inner"), unref(ns).is("link", !!_ctx.to)]),
  16173. role: "link",
  16174. onClick
  16175. }, [
  16176. renderSlot(_ctx.$slots, "default")
  16177. ], 2),
  16178. ((_a = unref(breadcrumbContext)) == null ? void 0 : _a.separatorIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  16179. key: 0,
  16180. class: normalizeClass(unref(ns).e("separator"))
  16181. }, {
  16182. default: withCtx(() => [
  16183. (openBlock(), createBlock(resolveDynamicComponent(unref(breadcrumbContext).separatorIcon)))
  16184. ]),
  16185. _: 1
  16186. }, 8, ["class"])) : (openBlock(), createElementBlock("span", {
  16187. key: 1,
  16188. class: normalizeClass(unref(ns).e("separator")),
  16189. role: "presentation"
  16190. }, toDisplayString((_b = unref(breadcrumbContext)) == null ? void 0 : _b.separator), 3))
  16191. ], 2);
  16192. };
  16193. }
  16194. });
  16195. var BreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$2a, [["__file", "breadcrumb-item.vue"]]);
  16196. const ElBreadcrumb = withInstall(Breadcrumb, {
  16197. BreadcrumbItem
  16198. });
  16199. const ElBreadcrumbItem = withNoopInstall(BreadcrumbItem);
  16200. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  16201. const useButton = (props, emit) => {
  16202. useDeprecated({
  16203. from: "type.text",
  16204. replacement: "link",
  16205. version: "3.0.0",
  16206. scope: "props",
  16207. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  16208. }, computed(() => props.type === "text"));
  16209. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  16210. const globalConfig = useGlobalConfig("button");
  16211. const { form } = useFormItem();
  16212. const _size = useFormSize(computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  16213. const _disabled = useFormDisabled();
  16214. const _ref = ref();
  16215. const slots = useSlots();
  16216. const _type = computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  16217. const autoInsertSpace = computed(() => {
  16218. var _a, _b, _c;
  16219. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
  16220. });
  16221. const _props = computed(() => {
  16222. if (props.tag === "button") {
  16223. return {
  16224. ariaDisabled: _disabled.value || props.loading,
  16225. disabled: _disabled.value || props.loading,
  16226. autofocus: props.autofocus,
  16227. type: props.nativeType
  16228. };
  16229. }
  16230. return {};
  16231. });
  16232. const shouldAddSpace = computed(() => {
  16233. var _a;
  16234. const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
  16235. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  16236. const slot = defaultSlot[0];
  16237. if ((slot == null ? void 0 : slot.type) === Text$1) {
  16238. const text = slot.children;
  16239. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  16240. }
  16241. }
  16242. return false;
  16243. });
  16244. const handleClick = (evt) => {
  16245. if (_disabled.value || props.loading) {
  16246. evt.stopPropagation();
  16247. return;
  16248. }
  16249. if (props.nativeType === "reset") {
  16250. form == null ? void 0 : form.resetFields();
  16251. }
  16252. emit("click", evt);
  16253. };
  16254. return {
  16255. _disabled,
  16256. _size,
  16257. _type,
  16258. _ref,
  16259. _props,
  16260. shouldAddSpace,
  16261. handleClick
  16262. };
  16263. };
  16264. const buttonTypes = [
  16265. "default",
  16266. "primary",
  16267. "success",
  16268. "warning",
  16269. "info",
  16270. "danger",
  16271. "text",
  16272. ""
  16273. ];
  16274. const buttonNativeTypes = ["button", "submit", "reset"];
  16275. const buttonProps = buildProps({
  16276. size: useSizeProp,
  16277. disabled: Boolean,
  16278. type: {
  16279. type: String,
  16280. values: buttonTypes,
  16281. default: ""
  16282. },
  16283. icon: {
  16284. type: iconPropType
  16285. },
  16286. nativeType: {
  16287. type: String,
  16288. values: buttonNativeTypes,
  16289. default: "button"
  16290. },
  16291. loading: Boolean,
  16292. loadingIcon: {
  16293. type: iconPropType,
  16294. default: () => loading_default
  16295. },
  16296. plain: Boolean,
  16297. text: Boolean,
  16298. link: Boolean,
  16299. bg: Boolean,
  16300. autofocus: Boolean,
  16301. round: Boolean,
  16302. circle: Boolean,
  16303. color: String,
  16304. dark: Boolean,
  16305. autoInsertSpace: {
  16306. type: Boolean,
  16307. default: void 0
  16308. },
  16309. tag: {
  16310. type: definePropType([String, Object]),
  16311. default: "button"
  16312. }
  16313. });
  16314. const buttonEmits = {
  16315. click: (evt) => evt instanceof MouseEvent
  16316. };
  16317. function bound01$1(n, max) {
  16318. if (isOnePointZero$1(n)) {
  16319. n = "100%";
  16320. }
  16321. var isPercent = isPercentage$1(n);
  16322. n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
  16323. if (isPercent) {
  16324. n = parseInt(String(n * max), 10) / 100;
  16325. }
  16326. if (Math.abs(n - max) < 1e-6) {
  16327. return 1;
  16328. }
  16329. if (max === 360) {
  16330. n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
  16331. } else {
  16332. n = n % max / parseFloat(String(max));
  16333. }
  16334. return n;
  16335. }
  16336. function clamp01(val) {
  16337. return Math.min(1, Math.max(0, val));
  16338. }
  16339. function isOnePointZero$1(n) {
  16340. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  16341. }
  16342. function isPercentage$1(n) {
  16343. return typeof n === "string" && n.indexOf("%") !== -1;
  16344. }
  16345. function boundAlpha(a) {
  16346. a = parseFloat(a);
  16347. if (isNaN(a) || a < 0 || a > 1) {
  16348. a = 1;
  16349. }
  16350. return a;
  16351. }
  16352. function convertToPercentage(n) {
  16353. if (n <= 1) {
  16354. return "".concat(Number(n) * 100, "%");
  16355. }
  16356. return n;
  16357. }
  16358. function pad2(c) {
  16359. return c.length === 1 ? "0" + c : String(c);
  16360. }
  16361. function rgbToRgb(r, g, b) {
  16362. return {
  16363. r: bound01$1(r, 255) * 255,
  16364. g: bound01$1(g, 255) * 255,
  16365. b: bound01$1(b, 255) * 255
  16366. };
  16367. }
  16368. function rgbToHsl(r, g, b) {
  16369. r = bound01$1(r, 255);
  16370. g = bound01$1(g, 255);
  16371. b = bound01$1(b, 255);
  16372. var max = Math.max(r, g, b);
  16373. var min = Math.min(r, g, b);
  16374. var h = 0;
  16375. var s = 0;
  16376. var l = (max + min) / 2;
  16377. if (max === min) {
  16378. s = 0;
  16379. h = 0;
  16380. } else {
  16381. var d = max - min;
  16382. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  16383. switch (max) {
  16384. case r:
  16385. h = (g - b) / d + (g < b ? 6 : 0);
  16386. break;
  16387. case g:
  16388. h = (b - r) / d + 2;
  16389. break;
  16390. case b:
  16391. h = (r - g) / d + 4;
  16392. break;
  16393. }
  16394. h /= 6;
  16395. }
  16396. return { h, s, l };
  16397. }
  16398. function hue2rgb(p, q, t) {
  16399. if (t < 0) {
  16400. t += 1;
  16401. }
  16402. if (t > 1) {
  16403. t -= 1;
  16404. }
  16405. if (t < 1 / 6) {
  16406. return p + (q - p) * (6 * t);
  16407. }
  16408. if (t < 1 / 2) {
  16409. return q;
  16410. }
  16411. if (t < 2 / 3) {
  16412. return p + (q - p) * (2 / 3 - t) * 6;
  16413. }
  16414. return p;
  16415. }
  16416. function hslToRgb(h, s, l) {
  16417. var r;
  16418. var g;
  16419. var b;
  16420. h = bound01$1(h, 360);
  16421. s = bound01$1(s, 100);
  16422. l = bound01$1(l, 100);
  16423. if (s === 0) {
  16424. g = l;
  16425. b = l;
  16426. r = l;
  16427. } else {
  16428. var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  16429. var p = 2 * l - q;
  16430. r = hue2rgb(p, q, h + 1 / 3);
  16431. g = hue2rgb(p, q, h);
  16432. b = hue2rgb(p, q, h - 1 / 3);
  16433. }
  16434. return { r: r * 255, g: g * 255, b: b * 255 };
  16435. }
  16436. function rgbToHsv(r, g, b) {
  16437. r = bound01$1(r, 255);
  16438. g = bound01$1(g, 255);
  16439. b = bound01$1(b, 255);
  16440. var max = Math.max(r, g, b);
  16441. var min = Math.min(r, g, b);
  16442. var h = 0;
  16443. var v = max;
  16444. var d = max - min;
  16445. var s = max === 0 ? 0 : d / max;
  16446. if (max === min) {
  16447. h = 0;
  16448. } else {
  16449. switch (max) {
  16450. case r:
  16451. h = (g - b) / d + (g < b ? 6 : 0);
  16452. break;
  16453. case g:
  16454. h = (b - r) / d + 2;
  16455. break;
  16456. case b:
  16457. h = (r - g) / d + 4;
  16458. break;
  16459. }
  16460. h /= 6;
  16461. }
  16462. return { h, s, v };
  16463. }
  16464. function hsvToRgb(h, s, v) {
  16465. h = bound01$1(h, 360) * 6;
  16466. s = bound01$1(s, 100);
  16467. v = bound01$1(v, 100);
  16468. var i = Math.floor(h);
  16469. var f = h - i;
  16470. var p = v * (1 - s);
  16471. var q = v * (1 - f * s);
  16472. var t = v * (1 - (1 - f) * s);
  16473. var mod = i % 6;
  16474. var r = [v, q, p, p, t, v][mod];
  16475. var g = [t, v, v, q, p, p][mod];
  16476. var b = [p, p, t, v, v, q][mod];
  16477. return { r: r * 255, g: g * 255, b: b * 255 };
  16478. }
  16479. function rgbToHex(r, g, b, allow3Char) {
  16480. var hex = [
  16481. pad2(Math.round(r).toString(16)),
  16482. pad2(Math.round(g).toString(16)),
  16483. pad2(Math.round(b).toString(16))
  16484. ];
  16485. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  16486. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  16487. }
  16488. return hex.join("");
  16489. }
  16490. function rgbaToHex(r, g, b, a, allow4Char) {
  16491. var hex = [
  16492. pad2(Math.round(r).toString(16)),
  16493. pad2(Math.round(g).toString(16)),
  16494. pad2(Math.round(b).toString(16)),
  16495. pad2(convertDecimalToHex(a))
  16496. ];
  16497. 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))) {
  16498. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  16499. }
  16500. return hex.join("");
  16501. }
  16502. function convertDecimalToHex(d) {
  16503. return Math.round(parseFloat(d) * 255).toString(16);
  16504. }
  16505. function convertHexToDecimal(h) {
  16506. return parseIntFromHex(h) / 255;
  16507. }
  16508. function parseIntFromHex(val) {
  16509. return parseInt(val, 16);
  16510. }
  16511. function numberInputToObject(color) {
  16512. return {
  16513. r: color >> 16,
  16514. g: (color & 65280) >> 8,
  16515. b: color & 255
  16516. };
  16517. }
  16518. var names = {
  16519. aliceblue: "#f0f8ff",
  16520. antiquewhite: "#faebd7",
  16521. aqua: "#00ffff",
  16522. aquamarine: "#7fffd4",
  16523. azure: "#f0ffff",
  16524. beige: "#f5f5dc",
  16525. bisque: "#ffe4c4",
  16526. black: "#000000",
  16527. blanchedalmond: "#ffebcd",
  16528. blue: "#0000ff",
  16529. blueviolet: "#8a2be2",
  16530. brown: "#a52a2a",
  16531. burlywood: "#deb887",
  16532. cadetblue: "#5f9ea0",
  16533. chartreuse: "#7fff00",
  16534. chocolate: "#d2691e",
  16535. coral: "#ff7f50",
  16536. cornflowerblue: "#6495ed",
  16537. cornsilk: "#fff8dc",
  16538. crimson: "#dc143c",
  16539. cyan: "#00ffff",
  16540. darkblue: "#00008b",
  16541. darkcyan: "#008b8b",
  16542. darkgoldenrod: "#b8860b",
  16543. darkgray: "#a9a9a9",
  16544. darkgreen: "#006400",
  16545. darkgrey: "#a9a9a9",
  16546. darkkhaki: "#bdb76b",
  16547. darkmagenta: "#8b008b",
  16548. darkolivegreen: "#556b2f",
  16549. darkorange: "#ff8c00",
  16550. darkorchid: "#9932cc",
  16551. darkred: "#8b0000",
  16552. darksalmon: "#e9967a",
  16553. darkseagreen: "#8fbc8f",
  16554. darkslateblue: "#483d8b",
  16555. darkslategray: "#2f4f4f",
  16556. darkslategrey: "#2f4f4f",
  16557. darkturquoise: "#00ced1",
  16558. darkviolet: "#9400d3",
  16559. deeppink: "#ff1493",
  16560. deepskyblue: "#00bfff",
  16561. dimgray: "#696969",
  16562. dimgrey: "#696969",
  16563. dodgerblue: "#1e90ff",
  16564. firebrick: "#b22222",
  16565. floralwhite: "#fffaf0",
  16566. forestgreen: "#228b22",
  16567. fuchsia: "#ff00ff",
  16568. gainsboro: "#dcdcdc",
  16569. ghostwhite: "#f8f8ff",
  16570. goldenrod: "#daa520",
  16571. gold: "#ffd700",
  16572. gray: "#808080",
  16573. green: "#008000",
  16574. greenyellow: "#adff2f",
  16575. grey: "#808080",
  16576. honeydew: "#f0fff0",
  16577. hotpink: "#ff69b4",
  16578. indianred: "#cd5c5c",
  16579. indigo: "#4b0082",
  16580. ivory: "#fffff0",
  16581. khaki: "#f0e68c",
  16582. lavenderblush: "#fff0f5",
  16583. lavender: "#e6e6fa",
  16584. lawngreen: "#7cfc00",
  16585. lemonchiffon: "#fffacd",
  16586. lightblue: "#add8e6",
  16587. lightcoral: "#f08080",
  16588. lightcyan: "#e0ffff",
  16589. lightgoldenrodyellow: "#fafad2",
  16590. lightgray: "#d3d3d3",
  16591. lightgreen: "#90ee90",
  16592. lightgrey: "#d3d3d3",
  16593. lightpink: "#ffb6c1",
  16594. lightsalmon: "#ffa07a",
  16595. lightseagreen: "#20b2aa",
  16596. lightskyblue: "#87cefa",
  16597. lightslategray: "#778899",
  16598. lightslategrey: "#778899",
  16599. lightsteelblue: "#b0c4de",
  16600. lightyellow: "#ffffe0",
  16601. lime: "#00ff00",
  16602. limegreen: "#32cd32",
  16603. linen: "#faf0e6",
  16604. magenta: "#ff00ff",
  16605. maroon: "#800000",
  16606. mediumaquamarine: "#66cdaa",
  16607. mediumblue: "#0000cd",
  16608. mediumorchid: "#ba55d3",
  16609. mediumpurple: "#9370db",
  16610. mediumseagreen: "#3cb371",
  16611. mediumslateblue: "#7b68ee",
  16612. mediumspringgreen: "#00fa9a",
  16613. mediumturquoise: "#48d1cc",
  16614. mediumvioletred: "#c71585",
  16615. midnightblue: "#191970",
  16616. mintcream: "#f5fffa",
  16617. mistyrose: "#ffe4e1",
  16618. moccasin: "#ffe4b5",
  16619. navajowhite: "#ffdead",
  16620. navy: "#000080",
  16621. oldlace: "#fdf5e6",
  16622. olive: "#808000",
  16623. olivedrab: "#6b8e23",
  16624. orange: "#ffa500",
  16625. orangered: "#ff4500",
  16626. orchid: "#da70d6",
  16627. palegoldenrod: "#eee8aa",
  16628. palegreen: "#98fb98",
  16629. paleturquoise: "#afeeee",
  16630. palevioletred: "#db7093",
  16631. papayawhip: "#ffefd5",
  16632. peachpuff: "#ffdab9",
  16633. peru: "#cd853f",
  16634. pink: "#ffc0cb",
  16635. plum: "#dda0dd",
  16636. powderblue: "#b0e0e6",
  16637. purple: "#800080",
  16638. rebeccapurple: "#663399",
  16639. red: "#ff0000",
  16640. rosybrown: "#bc8f8f",
  16641. royalblue: "#4169e1",
  16642. saddlebrown: "#8b4513",
  16643. salmon: "#fa8072",
  16644. sandybrown: "#f4a460",
  16645. seagreen: "#2e8b57",
  16646. seashell: "#fff5ee",
  16647. sienna: "#a0522d",
  16648. silver: "#c0c0c0",
  16649. skyblue: "#87ceeb",
  16650. slateblue: "#6a5acd",
  16651. slategray: "#708090",
  16652. slategrey: "#708090",
  16653. snow: "#fffafa",
  16654. springgreen: "#00ff7f",
  16655. steelblue: "#4682b4",
  16656. tan: "#d2b48c",
  16657. teal: "#008080",
  16658. thistle: "#d8bfd8",
  16659. tomato: "#ff6347",
  16660. turquoise: "#40e0d0",
  16661. violet: "#ee82ee",
  16662. wheat: "#f5deb3",
  16663. white: "#ffffff",
  16664. whitesmoke: "#f5f5f5",
  16665. yellow: "#ffff00",
  16666. yellowgreen: "#9acd32"
  16667. };
  16668. function inputToRGB(color) {
  16669. var rgb = { r: 0, g: 0, b: 0 };
  16670. var a = 1;
  16671. var s = null;
  16672. var v = null;
  16673. var l = null;
  16674. var ok = false;
  16675. var format = false;
  16676. if (typeof color === "string") {
  16677. color = stringInputToObject(color);
  16678. }
  16679. if (typeof color === "object") {
  16680. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  16681. rgb = rgbToRgb(color.r, color.g, color.b);
  16682. ok = true;
  16683. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  16684. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  16685. s = convertToPercentage(color.s);
  16686. v = convertToPercentage(color.v);
  16687. rgb = hsvToRgb(color.h, s, v);
  16688. ok = true;
  16689. format = "hsv";
  16690. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  16691. s = convertToPercentage(color.s);
  16692. l = convertToPercentage(color.l);
  16693. rgb = hslToRgb(color.h, s, l);
  16694. ok = true;
  16695. format = "hsl";
  16696. }
  16697. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  16698. a = color.a;
  16699. }
  16700. }
  16701. a = boundAlpha(a);
  16702. return {
  16703. ok,
  16704. format: color.format || format,
  16705. r: Math.min(255, Math.max(rgb.r, 0)),
  16706. g: Math.min(255, Math.max(rgb.g, 0)),
  16707. b: Math.min(255, Math.max(rgb.b, 0)),
  16708. a
  16709. };
  16710. }
  16711. var CSS_INTEGER = "[-\\+]?\\d+%?";
  16712. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  16713. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  16714. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  16715. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  16716. var matchers = {
  16717. CSS_UNIT: new RegExp(CSS_UNIT),
  16718. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  16719. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  16720. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  16721. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  16722. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  16723. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  16724. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16725. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  16726. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  16727. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  16728. };
  16729. function stringInputToObject(color) {
  16730. color = color.trim().toLowerCase();
  16731. if (color.length === 0) {
  16732. return false;
  16733. }
  16734. var named = false;
  16735. if (names[color]) {
  16736. color = names[color];
  16737. named = true;
  16738. } else if (color === "transparent") {
  16739. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  16740. }
  16741. var match = matchers.rgb.exec(color);
  16742. if (match) {
  16743. return { r: match[1], g: match[2], b: match[3] };
  16744. }
  16745. match = matchers.rgba.exec(color);
  16746. if (match) {
  16747. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  16748. }
  16749. match = matchers.hsl.exec(color);
  16750. if (match) {
  16751. return { h: match[1], s: match[2], l: match[3] };
  16752. }
  16753. match = matchers.hsla.exec(color);
  16754. if (match) {
  16755. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  16756. }
  16757. match = matchers.hsv.exec(color);
  16758. if (match) {
  16759. return { h: match[1], s: match[2], v: match[3] };
  16760. }
  16761. match = matchers.hsva.exec(color);
  16762. if (match) {
  16763. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  16764. }
  16765. match = matchers.hex8.exec(color);
  16766. if (match) {
  16767. return {
  16768. r: parseIntFromHex(match[1]),
  16769. g: parseIntFromHex(match[2]),
  16770. b: parseIntFromHex(match[3]),
  16771. a: convertHexToDecimal(match[4]),
  16772. format: named ? "name" : "hex8"
  16773. };
  16774. }
  16775. match = matchers.hex6.exec(color);
  16776. if (match) {
  16777. return {
  16778. r: parseIntFromHex(match[1]),
  16779. g: parseIntFromHex(match[2]),
  16780. b: parseIntFromHex(match[3]),
  16781. format: named ? "name" : "hex"
  16782. };
  16783. }
  16784. match = matchers.hex4.exec(color);
  16785. if (match) {
  16786. return {
  16787. r: parseIntFromHex(match[1] + match[1]),
  16788. g: parseIntFromHex(match[2] + match[2]),
  16789. b: parseIntFromHex(match[3] + match[3]),
  16790. a: convertHexToDecimal(match[4] + match[4]),
  16791. format: named ? "name" : "hex8"
  16792. };
  16793. }
  16794. match = matchers.hex3.exec(color);
  16795. if (match) {
  16796. return {
  16797. r: parseIntFromHex(match[1] + match[1]),
  16798. g: parseIntFromHex(match[2] + match[2]),
  16799. b: parseIntFromHex(match[3] + match[3]),
  16800. format: named ? "name" : "hex"
  16801. };
  16802. }
  16803. return false;
  16804. }
  16805. function isValidCSSUnit(color) {
  16806. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  16807. }
  16808. var TinyColor = function() {
  16809. function TinyColor2(color, opts) {
  16810. if (color === void 0) {
  16811. color = "";
  16812. }
  16813. if (opts === void 0) {
  16814. opts = {};
  16815. }
  16816. var _a;
  16817. if (color instanceof TinyColor2) {
  16818. return color;
  16819. }
  16820. if (typeof color === "number") {
  16821. color = numberInputToObject(color);
  16822. }
  16823. this.originalInput = color;
  16824. var rgb = inputToRGB(color);
  16825. this.originalInput = color;
  16826. this.r = rgb.r;
  16827. this.g = rgb.g;
  16828. this.b = rgb.b;
  16829. this.a = rgb.a;
  16830. this.roundA = Math.round(100 * this.a) / 100;
  16831. this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
  16832. this.gradientType = opts.gradientType;
  16833. if (this.r < 1) {
  16834. this.r = Math.round(this.r);
  16835. }
  16836. if (this.g < 1) {
  16837. this.g = Math.round(this.g);
  16838. }
  16839. if (this.b < 1) {
  16840. this.b = Math.round(this.b);
  16841. }
  16842. this.isValid = rgb.ok;
  16843. }
  16844. TinyColor2.prototype.isDark = function() {
  16845. return this.getBrightness() < 128;
  16846. };
  16847. TinyColor2.prototype.isLight = function() {
  16848. return !this.isDark();
  16849. };
  16850. TinyColor2.prototype.getBrightness = function() {
  16851. var rgb = this.toRgb();
  16852. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  16853. };
  16854. TinyColor2.prototype.getLuminance = function() {
  16855. var rgb = this.toRgb();
  16856. var R;
  16857. var G;
  16858. var B;
  16859. var RsRGB = rgb.r / 255;
  16860. var GsRGB = rgb.g / 255;
  16861. var BsRGB = rgb.b / 255;
  16862. if (RsRGB <= 0.03928) {
  16863. R = RsRGB / 12.92;
  16864. } else {
  16865. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  16866. }
  16867. if (GsRGB <= 0.03928) {
  16868. G = GsRGB / 12.92;
  16869. } else {
  16870. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  16871. }
  16872. if (BsRGB <= 0.03928) {
  16873. B = BsRGB / 12.92;
  16874. } else {
  16875. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  16876. }
  16877. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  16878. };
  16879. TinyColor2.prototype.getAlpha = function() {
  16880. return this.a;
  16881. };
  16882. TinyColor2.prototype.setAlpha = function(alpha) {
  16883. this.a = boundAlpha(alpha);
  16884. this.roundA = Math.round(100 * this.a) / 100;
  16885. return this;
  16886. };
  16887. TinyColor2.prototype.toHsv = function() {
  16888. var hsv = rgbToHsv(this.r, this.g, this.b);
  16889. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  16890. };
  16891. TinyColor2.prototype.toHsvString = function() {
  16892. var hsv = rgbToHsv(this.r, this.g, this.b);
  16893. var h = Math.round(hsv.h * 360);
  16894. var s = Math.round(hsv.s * 100);
  16895. var v = Math.round(hsv.v * 100);
  16896. return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
  16897. };
  16898. TinyColor2.prototype.toHsl = function() {
  16899. var hsl = rgbToHsl(this.r, this.g, this.b);
  16900. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  16901. };
  16902. TinyColor2.prototype.toHslString = function() {
  16903. var hsl = rgbToHsl(this.r, this.g, this.b);
  16904. var h = Math.round(hsl.h * 360);
  16905. var s = Math.round(hsl.s * 100);
  16906. var l = Math.round(hsl.l * 100);
  16907. return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
  16908. };
  16909. TinyColor2.prototype.toHex = function(allow3Char) {
  16910. if (allow3Char === void 0) {
  16911. allow3Char = false;
  16912. }
  16913. return rgbToHex(this.r, this.g, this.b, allow3Char);
  16914. };
  16915. TinyColor2.prototype.toHexString = function(allow3Char) {
  16916. if (allow3Char === void 0) {
  16917. allow3Char = false;
  16918. }
  16919. return "#" + this.toHex(allow3Char);
  16920. };
  16921. TinyColor2.prototype.toHex8 = function(allow4Char) {
  16922. if (allow4Char === void 0) {
  16923. allow4Char = false;
  16924. }
  16925. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  16926. };
  16927. TinyColor2.prototype.toHex8String = function(allow4Char) {
  16928. if (allow4Char === void 0) {
  16929. allow4Char = false;
  16930. }
  16931. return "#" + this.toHex8(allow4Char);
  16932. };
  16933. TinyColor2.prototype.toRgb = function() {
  16934. return {
  16935. r: Math.round(this.r),
  16936. g: Math.round(this.g),
  16937. b: Math.round(this.b),
  16938. a: this.a
  16939. };
  16940. };
  16941. TinyColor2.prototype.toRgbString = function() {
  16942. var r = Math.round(this.r);
  16943. var g = Math.round(this.g);
  16944. var b = Math.round(this.b);
  16945. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
  16946. };
  16947. TinyColor2.prototype.toPercentageRgb = function() {
  16948. var fmt = function(x) {
  16949. return "".concat(Math.round(bound01$1(x, 255) * 100), "%");
  16950. };
  16951. return {
  16952. r: fmt(this.r),
  16953. g: fmt(this.g),
  16954. b: fmt(this.b),
  16955. a: this.a
  16956. };
  16957. };
  16958. TinyColor2.prototype.toPercentageRgbString = function() {
  16959. var rnd = function(x) {
  16960. return Math.round(bound01$1(x, 255) * 100);
  16961. };
  16962. 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, ")");
  16963. };
  16964. TinyColor2.prototype.toName = function() {
  16965. if (this.a === 0) {
  16966. return "transparent";
  16967. }
  16968. if (this.a < 1) {
  16969. return false;
  16970. }
  16971. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  16972. for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
  16973. var _b = _a[_i], key = _b[0], value = _b[1];
  16974. if (hex === value) {
  16975. return key;
  16976. }
  16977. }
  16978. return false;
  16979. };
  16980. TinyColor2.prototype.toString = function(format) {
  16981. var formatSet = Boolean(format);
  16982. format = format !== null && format !== void 0 ? format : this.format;
  16983. var formattedString = false;
  16984. var hasAlpha = this.a < 1 && this.a >= 0;
  16985. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  16986. if (needsAlphaFormat) {
  16987. if (format === "name" && this.a === 0) {
  16988. return this.toName();
  16989. }
  16990. return this.toRgbString();
  16991. }
  16992. if (format === "rgb") {
  16993. formattedString = this.toRgbString();
  16994. }
  16995. if (format === "prgb") {
  16996. formattedString = this.toPercentageRgbString();
  16997. }
  16998. if (format === "hex" || format === "hex6") {
  16999. formattedString = this.toHexString();
  17000. }
  17001. if (format === "hex3") {
  17002. formattedString = this.toHexString(true);
  17003. }
  17004. if (format === "hex4") {
  17005. formattedString = this.toHex8String(true);
  17006. }
  17007. if (format === "hex8") {
  17008. formattedString = this.toHex8String();
  17009. }
  17010. if (format === "name") {
  17011. formattedString = this.toName();
  17012. }
  17013. if (format === "hsl") {
  17014. formattedString = this.toHslString();
  17015. }
  17016. if (format === "hsv") {
  17017. formattedString = this.toHsvString();
  17018. }
  17019. return formattedString || this.toHexString();
  17020. };
  17021. TinyColor2.prototype.toNumber = function() {
  17022. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  17023. };
  17024. TinyColor2.prototype.clone = function() {
  17025. return new TinyColor2(this.toString());
  17026. };
  17027. TinyColor2.prototype.lighten = function(amount) {
  17028. if (amount === void 0) {
  17029. amount = 10;
  17030. }
  17031. var hsl = this.toHsl();
  17032. hsl.l += amount / 100;
  17033. hsl.l = clamp01(hsl.l);
  17034. return new TinyColor2(hsl);
  17035. };
  17036. TinyColor2.prototype.brighten = function(amount) {
  17037. if (amount === void 0) {
  17038. amount = 10;
  17039. }
  17040. var rgb = this.toRgb();
  17041. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  17042. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  17043. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  17044. return new TinyColor2(rgb);
  17045. };
  17046. TinyColor2.prototype.darken = function(amount) {
  17047. if (amount === void 0) {
  17048. amount = 10;
  17049. }
  17050. var hsl = this.toHsl();
  17051. hsl.l -= amount / 100;
  17052. hsl.l = clamp01(hsl.l);
  17053. return new TinyColor2(hsl);
  17054. };
  17055. TinyColor2.prototype.tint = function(amount) {
  17056. if (amount === void 0) {
  17057. amount = 10;
  17058. }
  17059. return this.mix("white", amount);
  17060. };
  17061. TinyColor2.prototype.shade = function(amount) {
  17062. if (amount === void 0) {
  17063. amount = 10;
  17064. }
  17065. return this.mix("black", amount);
  17066. };
  17067. TinyColor2.prototype.desaturate = function(amount) {
  17068. if (amount === void 0) {
  17069. amount = 10;
  17070. }
  17071. var hsl = this.toHsl();
  17072. hsl.s -= amount / 100;
  17073. hsl.s = clamp01(hsl.s);
  17074. return new TinyColor2(hsl);
  17075. };
  17076. TinyColor2.prototype.saturate = function(amount) {
  17077. if (amount === void 0) {
  17078. amount = 10;
  17079. }
  17080. var hsl = this.toHsl();
  17081. hsl.s += amount / 100;
  17082. hsl.s = clamp01(hsl.s);
  17083. return new TinyColor2(hsl);
  17084. };
  17085. TinyColor2.prototype.greyscale = function() {
  17086. return this.desaturate(100);
  17087. };
  17088. TinyColor2.prototype.spin = function(amount) {
  17089. var hsl = this.toHsl();
  17090. var hue = (hsl.h + amount) % 360;
  17091. hsl.h = hue < 0 ? 360 + hue : hue;
  17092. return new TinyColor2(hsl);
  17093. };
  17094. TinyColor2.prototype.mix = function(color, amount) {
  17095. if (amount === void 0) {
  17096. amount = 50;
  17097. }
  17098. var rgb1 = this.toRgb();
  17099. var rgb2 = new TinyColor2(color).toRgb();
  17100. var p = amount / 100;
  17101. var rgba = {
  17102. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  17103. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  17104. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  17105. a: (rgb2.a - rgb1.a) * p + rgb1.a
  17106. };
  17107. return new TinyColor2(rgba);
  17108. };
  17109. TinyColor2.prototype.analogous = function(results, slices) {
  17110. if (results === void 0) {
  17111. results = 6;
  17112. }
  17113. if (slices === void 0) {
  17114. slices = 30;
  17115. }
  17116. var hsl = this.toHsl();
  17117. var part = 360 / slices;
  17118. var ret = [this];
  17119. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  17120. hsl.h = (hsl.h + part) % 360;
  17121. ret.push(new TinyColor2(hsl));
  17122. }
  17123. return ret;
  17124. };
  17125. TinyColor2.prototype.complement = function() {
  17126. var hsl = this.toHsl();
  17127. hsl.h = (hsl.h + 180) % 360;
  17128. return new TinyColor2(hsl);
  17129. };
  17130. TinyColor2.prototype.monochromatic = function(results) {
  17131. if (results === void 0) {
  17132. results = 6;
  17133. }
  17134. var hsv = this.toHsv();
  17135. var h = hsv.h;
  17136. var s = hsv.s;
  17137. var v = hsv.v;
  17138. var res = [];
  17139. var modification = 1 / results;
  17140. while (results--) {
  17141. res.push(new TinyColor2({ h, s, v }));
  17142. v = (v + modification) % 1;
  17143. }
  17144. return res;
  17145. };
  17146. TinyColor2.prototype.splitcomplement = function() {
  17147. var hsl = this.toHsl();
  17148. var h = hsl.h;
  17149. return [
  17150. this,
  17151. new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
  17152. new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
  17153. ];
  17154. };
  17155. TinyColor2.prototype.onBackground = function(background) {
  17156. var fg = this.toRgb();
  17157. var bg = new TinyColor2(background).toRgb();
  17158. return new TinyColor2({
  17159. r: bg.r + (fg.r - bg.r) * fg.a,
  17160. g: bg.g + (fg.g - bg.g) * fg.a,
  17161. b: bg.b + (fg.b - bg.b) * fg.a
  17162. });
  17163. };
  17164. TinyColor2.prototype.triad = function() {
  17165. return this.polyad(3);
  17166. };
  17167. TinyColor2.prototype.tetrad = function() {
  17168. return this.polyad(4);
  17169. };
  17170. TinyColor2.prototype.polyad = function(n) {
  17171. var hsl = this.toHsl();
  17172. var h = hsl.h;
  17173. var result = [this];
  17174. var increment = 360 / n;
  17175. for (var i = 1; i < n; i++) {
  17176. result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
  17177. }
  17178. return result;
  17179. };
  17180. TinyColor2.prototype.equals = function(color) {
  17181. return this.toRgbString() === new TinyColor2(color).toRgbString();
  17182. };
  17183. return TinyColor2;
  17184. }();
  17185. function darken(color, amount = 20) {
  17186. return color.mix("#141414", amount).toString();
  17187. }
  17188. function useButtonCustomStyle(props) {
  17189. const _disabled = useFormDisabled();
  17190. const ns = useNamespace("button");
  17191. return computed(() => {
  17192. let styles = {};
  17193. let buttonColor = props.color;
  17194. if (buttonColor) {
  17195. const match = buttonColor.match(/var\((.*?)\)/);
  17196. if (match) {
  17197. buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
  17198. }
  17199. const color = new TinyColor(buttonColor);
  17200. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  17201. if (props.plain) {
  17202. styles = ns.cssVarBlock({
  17203. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  17204. "text-color": buttonColor,
  17205. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  17206. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  17207. "hover-bg-color": buttonColor,
  17208. "hover-border-color": buttonColor,
  17209. "active-bg-color": activeBgColor,
  17210. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  17211. "active-border-color": activeBgColor
  17212. });
  17213. if (_disabled.value) {
  17214. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  17215. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  17216. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  17217. }
  17218. } else {
  17219. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  17220. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  17221. styles = ns.cssVarBlock({
  17222. "bg-color": buttonColor,
  17223. "text-color": textColor,
  17224. "border-color": buttonColor,
  17225. "hover-bg-color": hoverBgColor,
  17226. "hover-text-color": textColor,
  17227. "hover-border-color": hoverBgColor,
  17228. "active-bg-color": activeBgColor,
  17229. "active-border-color": activeBgColor
  17230. });
  17231. if (_disabled.value) {
  17232. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  17233. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  17234. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  17235. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  17236. }
  17237. }
  17238. }
  17239. return styles;
  17240. });
  17241. }
  17242. const __default__$1x = defineComponent({
  17243. name: "ElButton"
  17244. });
  17245. const _sfc_main$29 = /* @__PURE__ */ defineComponent({
  17246. ...__default__$1x,
  17247. props: buttonProps,
  17248. emits: buttonEmits,
  17249. setup(__props, { expose, emit }) {
  17250. const props = __props;
  17251. const buttonStyle = useButtonCustomStyle(props);
  17252. const ns = useNamespace("button");
  17253. const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit);
  17254. const buttonKls = computed(() => [
  17255. ns.b(),
  17256. ns.m(_type.value),
  17257. ns.m(_size.value),
  17258. ns.is("disabled", _disabled.value),
  17259. ns.is("loading", props.loading),
  17260. ns.is("plain", props.plain),
  17261. ns.is("round", props.round),
  17262. ns.is("circle", props.circle),
  17263. ns.is("text", props.text),
  17264. ns.is("link", props.link),
  17265. ns.is("has-bg", props.bg)
  17266. ]);
  17267. expose({
  17268. ref: _ref,
  17269. size: _size,
  17270. type: _type,
  17271. disabled: _disabled,
  17272. shouldAddSpace
  17273. });
  17274. return (_ctx, _cache) => {
  17275. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
  17276. ref_key: "_ref",
  17277. ref: _ref
  17278. }, unref(_props), {
  17279. class: unref(buttonKls),
  17280. style: unref(buttonStyle),
  17281. onClick: unref(handleClick)
  17282. }), {
  17283. default: withCtx(() => [
  17284. _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  17285. _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  17286. key: 1,
  17287. class: normalizeClass(unref(ns).is("loading"))
  17288. }, {
  17289. default: withCtx(() => [
  17290. (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
  17291. ]),
  17292. _: 1
  17293. }, 8, ["class"]))
  17294. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  17295. default: withCtx(() => [
  17296. _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
  17297. ]),
  17298. _: 3
  17299. })) : createCommentVNode("v-if", true),
  17300. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  17301. key: 2,
  17302. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  17303. }, [
  17304. renderSlot(_ctx.$slots, "default")
  17305. ], 2)) : createCommentVNode("v-if", true)
  17306. ]),
  17307. _: 3
  17308. }, 16, ["class", "style", "onClick"]);
  17309. };
  17310. }
  17311. });
  17312. var Button = /* @__PURE__ */ _export_sfc(_sfc_main$29, [["__file", "button.vue"]]);
  17313. const buttonGroupProps = {
  17314. size: buttonProps.size,
  17315. type: buttonProps.type
  17316. };
  17317. const __default__$1w = defineComponent({
  17318. name: "ElButtonGroup"
  17319. });
  17320. const _sfc_main$28 = /* @__PURE__ */ defineComponent({
  17321. ...__default__$1w,
  17322. props: buttonGroupProps,
  17323. setup(__props) {
  17324. const props = __props;
  17325. provide(buttonGroupContextKey, reactive({
  17326. size: toRef(props, "size"),
  17327. type: toRef(props, "type")
  17328. }));
  17329. const ns = useNamespace("button");
  17330. return (_ctx, _cache) => {
  17331. return openBlock(), createElementBlock("div", {
  17332. class: normalizeClass(unref(ns).b("group"))
  17333. }, [
  17334. renderSlot(_ctx.$slots, "default")
  17335. ], 2);
  17336. };
  17337. }
  17338. });
  17339. var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$28, [["__file", "button-group.vue"]]);
  17340. const ElButton = withInstall(Button, {
  17341. ButtonGroup
  17342. });
  17343. const ElButtonGroup$1 = withNoopInstall(ButtonGroup);
  17344. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  17345. var dayjs_min = {exports: {}};
  17346. (function(module, exports) {
  17347. !function(t, e) {
  17348. module.exports = e() ;
  17349. }(commonjsGlobal, function() {
  17350. 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) {
  17351. var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
  17352. return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
  17353. } }, m = function(t2, e2, n2) {
  17354. var r2 = String(t2);
  17355. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  17356. }, v = { s: m, z: function(t2) {
  17357. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  17358. return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
  17359. }, m: function t2(e2, n2) {
  17360. if (e2.date() < n2.date())
  17361. return -t2(n2, e2);
  17362. 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);
  17363. return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
  17364. }, a: function(t2) {
  17365. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  17366. }, p: function(t2) {
  17367. 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$/, "");
  17368. }, u: function(t2) {
  17369. return t2 === void 0;
  17370. } }, g = "en", D = {};
  17371. D[g] = M;
  17372. var p = "$isDayjsObject", S = function(t2) {
  17373. return t2 instanceof _ || !(!t2 || !t2[p]);
  17374. }, w = function t2(e2, n2, r2) {
  17375. var i2;
  17376. if (!e2)
  17377. return g;
  17378. if (typeof e2 == "string") {
  17379. var s2 = e2.toLowerCase();
  17380. D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
  17381. var u2 = e2.split("-");
  17382. if (!i2 && u2.length > 1)
  17383. return t2(u2[0]);
  17384. } else {
  17385. var a2 = e2.name;
  17386. D[a2] = e2, i2 = a2;
  17387. }
  17388. return !r2 && i2 && (g = i2), i2 || !r2 && g;
  17389. }, O = function(t2, e2) {
  17390. if (S(t2))
  17391. return t2.clone();
  17392. var n2 = typeof e2 == "object" ? e2 : {};
  17393. return n2.date = t2, n2.args = arguments, new _(n2);
  17394. }, b = v;
  17395. b.l = w, b.i = S, b.w = function(t2, e2) {
  17396. return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  17397. };
  17398. var _ = function() {
  17399. function M2(t2) {
  17400. this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
  17401. }
  17402. var m2 = M2.prototype;
  17403. return m2.parse = function(t2) {
  17404. this.$d = function(t3) {
  17405. var e2 = t3.date, n2 = t3.utc;
  17406. if (e2 === null)
  17407. return new Date(NaN);
  17408. if (b.u(e2))
  17409. return new Date();
  17410. if (e2 instanceof Date)
  17411. return new Date(e2);
  17412. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  17413. var r2 = e2.match($);
  17414. if (r2) {
  17415. var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
  17416. 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);
  17417. }
  17418. }
  17419. return new Date(e2);
  17420. }(t2), this.init();
  17421. }, m2.init = function() {
  17422. var t2 = this.$d;
  17423. 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();
  17424. }, m2.$utils = function() {
  17425. return b;
  17426. }, m2.isValid = function() {
  17427. return !(this.$d.toString() === l);
  17428. }, m2.isSame = function(t2, e2) {
  17429. var n2 = O(t2);
  17430. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  17431. }, m2.isAfter = function(t2, e2) {
  17432. return O(t2) < this.startOf(e2);
  17433. }, m2.isBefore = function(t2, e2) {
  17434. return this.endOf(e2) < O(t2);
  17435. }, m2.$g = function(t2, e2, n2) {
  17436. return b.u(t2) ? this[e2] : this.set(n2, t2);
  17437. }, m2.unix = function() {
  17438. return Math.floor(this.valueOf() / 1e3);
  17439. }, m2.valueOf = function() {
  17440. return this.$d.getTime();
  17441. }, m2.startOf = function(t2, e2) {
  17442. var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
  17443. var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  17444. return r2 ? i2 : i2.endOf(a);
  17445. }, $2 = function(t3, e3) {
  17446. return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  17447. }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
  17448. switch (f2) {
  17449. case h:
  17450. return r2 ? l2(1, 0) : l2(31, 11);
  17451. case c:
  17452. return r2 ? l2(1, M3) : l2(0, M3 + 1);
  17453. case o:
  17454. var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
  17455. return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
  17456. case a:
  17457. case d:
  17458. return $2(v2 + "Hours", 0);
  17459. case u:
  17460. return $2(v2 + "Minutes", 1);
  17461. case s:
  17462. return $2(v2 + "Seconds", 2);
  17463. case i:
  17464. return $2(v2 + "Milliseconds", 3);
  17465. default:
  17466. return this.clone();
  17467. }
  17468. }, m2.endOf = function(t2) {
  17469. return this.startOf(t2, false);
  17470. }, m2.$set = function(t2, e2) {
  17471. 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;
  17472. if (o2 === c || o2 === h) {
  17473. var y2 = this.clone().set(d, 1);
  17474. y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
  17475. } else
  17476. l2 && this.$d[l2]($2);
  17477. return this.init(), this;
  17478. }, m2.set = function(t2, e2) {
  17479. return this.clone().$set(t2, e2);
  17480. }, m2.get = function(t2) {
  17481. return this[b.p(t2)]();
  17482. }, m2.add = function(r2, f2) {
  17483. var d2, l2 = this;
  17484. r2 = Number(r2);
  17485. var $2 = b.p(f2), y2 = function(t2) {
  17486. var e2 = O(l2);
  17487. return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
  17488. };
  17489. if ($2 === c)
  17490. return this.set(c, this.$M + r2);
  17491. if ($2 === h)
  17492. return this.set(h, this.$y + r2);
  17493. if ($2 === a)
  17494. return y2(1);
  17495. if ($2 === o)
  17496. return y2(7);
  17497. var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
  17498. return b.w(m3, this);
  17499. }, m2.subtract = function(t2, e2) {
  17500. return this.add(-1 * t2, e2);
  17501. }, m2.format = function(t2) {
  17502. var e2 = this, n2 = this.$locale();
  17503. if (!this.isValid())
  17504. return n2.invalidDate || l;
  17505. 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) {
  17506. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
  17507. }, d2 = function(t3) {
  17508. return b.s(s2 % 12 || 12, t3, "0");
  17509. }, $2 = f2 || function(t3, e3, n3) {
  17510. var r3 = t3 < 12 ? "AM" : "PM";
  17511. return n3 ? r3.toLowerCase() : r3;
  17512. };
  17513. return r2.replace(y, function(t3, r3) {
  17514. return r3 || function(t4) {
  17515. switch (t4) {
  17516. case "YY":
  17517. return String(e2.$y).slice(-2);
  17518. case "YYYY":
  17519. return b.s(e2.$y, 4, "0");
  17520. case "M":
  17521. return a2 + 1;
  17522. case "MM":
  17523. return b.s(a2 + 1, 2, "0");
  17524. case "MMM":
  17525. return h2(n2.monthsShort, a2, c2, 3);
  17526. case "MMMM":
  17527. return h2(c2, a2);
  17528. case "D":
  17529. return e2.$D;
  17530. case "DD":
  17531. return b.s(e2.$D, 2, "0");
  17532. case "d":
  17533. return String(e2.$W);
  17534. case "dd":
  17535. return h2(n2.weekdaysMin, e2.$W, o2, 2);
  17536. case "ddd":
  17537. return h2(n2.weekdaysShort, e2.$W, o2, 3);
  17538. case "dddd":
  17539. return o2[e2.$W];
  17540. case "H":
  17541. return String(s2);
  17542. case "HH":
  17543. return b.s(s2, 2, "0");
  17544. case "h":
  17545. return d2(1);
  17546. case "hh":
  17547. return d2(2);
  17548. case "a":
  17549. return $2(s2, u2, true);
  17550. case "A":
  17551. return $2(s2, u2, false);
  17552. case "m":
  17553. return String(u2);
  17554. case "mm":
  17555. return b.s(u2, 2, "0");
  17556. case "s":
  17557. return String(e2.$s);
  17558. case "ss":
  17559. return b.s(e2.$s, 2, "0");
  17560. case "SSS":
  17561. return b.s(e2.$ms, 3, "0");
  17562. case "Z":
  17563. return i2;
  17564. }
  17565. return null;
  17566. }(t3) || i2.replace(":", "");
  17567. });
  17568. }, m2.utcOffset = function() {
  17569. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  17570. }, m2.diff = function(r2, d2, l2) {
  17571. var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
  17572. return b.m(y2, m3);
  17573. };
  17574. switch (M3) {
  17575. case h:
  17576. $2 = D2() / 12;
  17577. break;
  17578. case c:
  17579. $2 = D2();
  17580. break;
  17581. case f:
  17582. $2 = D2() / 3;
  17583. break;
  17584. case o:
  17585. $2 = (g2 - v2) / 6048e5;
  17586. break;
  17587. case a:
  17588. $2 = (g2 - v2) / 864e5;
  17589. break;
  17590. case u:
  17591. $2 = g2 / n;
  17592. break;
  17593. case s:
  17594. $2 = g2 / e;
  17595. break;
  17596. case i:
  17597. $2 = g2 / t;
  17598. break;
  17599. default:
  17600. $2 = g2;
  17601. }
  17602. return l2 ? $2 : b.a($2);
  17603. }, m2.daysInMonth = function() {
  17604. return this.endOf(c).$D;
  17605. }, m2.$locale = function() {
  17606. return D[this.$L];
  17607. }, m2.locale = function(t2, e2) {
  17608. if (!t2)
  17609. return this.$L;
  17610. var n2 = this.clone(), r2 = w(t2, e2, true);
  17611. return r2 && (n2.$L = r2), n2;
  17612. }, m2.clone = function() {
  17613. return b.w(this.$d, this);
  17614. }, m2.toDate = function() {
  17615. return new Date(this.valueOf());
  17616. }, m2.toJSON = function() {
  17617. return this.isValid() ? this.toISOString() : null;
  17618. }, m2.toISOString = function() {
  17619. return this.$d.toISOString();
  17620. }, m2.toString = function() {
  17621. return this.$d.toUTCString();
  17622. }, M2;
  17623. }(), k = _.prototype;
  17624. return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
  17625. k[t2[1]] = function(e2) {
  17626. return this.$g(e2, t2[0], t2[1]);
  17627. };
  17628. }), O.extend = function(t2, e2) {
  17629. return t2.$i || (t2(e2, _, O), t2.$i = true), O;
  17630. }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
  17631. return O(1e3 * t2);
  17632. }, O.en = D[g], O.Ls = D, O.p = {}, O;
  17633. });
  17634. })(dayjs_min);
  17635. var dayjs = dayjs_min.exports;
  17636. var customParseFormat$1 = {exports: {}};
  17637. (function(module, exports) {
  17638. !function(e, t) {
  17639. module.exports = t() ;
  17640. }(commonjsGlobal, function() {
  17641. 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) {
  17642. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  17643. };
  17644. var f = function(e2) {
  17645. return function(t2) {
  17646. this[e2] = +t2;
  17647. };
  17648. }, h = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  17649. (this.zone || (this.zone = {})).offset = function(e3) {
  17650. if (!e3)
  17651. return 0;
  17652. if (e3 === "Z")
  17653. return 0;
  17654. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  17655. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  17656. }(e2);
  17657. }], u = function(e2) {
  17658. var t2 = s[e2];
  17659. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  17660. }, d = function(e2, t2) {
  17661. var n2, r2 = s.meridiem;
  17662. if (r2) {
  17663. for (var i2 = 1; i2 <= 24; i2 += 1)
  17664. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  17665. n2 = i2 > 12;
  17666. break;
  17667. }
  17668. } else
  17669. n2 = e2 === (t2 ? "pm" : "PM");
  17670. return n2;
  17671. }, c = { A: [o, function(e2) {
  17672. this.afternoon = d(e2, false);
  17673. }], a: [o, function(e2) {
  17674. this.afternoon = d(e2, true);
  17675. }], Q: [n, function(e2) {
  17676. this.month = 3 * (e2 - 1) + 1;
  17677. }], S: [n, function(e2) {
  17678. this.milliseconds = 100 * +e2;
  17679. }], SS: [r, function(e2) {
  17680. this.milliseconds = 10 * +e2;
  17681. }], SSS: [/\d{3}/, function(e2) {
  17682. this.milliseconds = +e2;
  17683. }], 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) {
  17684. var t2 = s.ordinal, n2 = e2.match(/\d+/);
  17685. if (this.day = n2[0], t2)
  17686. for (var r2 = 1; r2 <= 31; r2 += 1)
  17687. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  17688. }], w: [i, f("week")], ww: [r, f("week")], M: [i, f("month")], MM: [r, f("month")], MMM: [o, function(e2) {
  17689. var t2 = u("months"), n2 = (u("monthsShort") || t2.map(function(e3) {
  17690. return e3.slice(0, 3);
  17691. })).indexOf(e2) + 1;
  17692. if (n2 < 1)
  17693. throw new Error();
  17694. this.month = n2 % 12 || n2;
  17695. }], MMMM: [o, function(e2) {
  17696. var t2 = u("months").indexOf(e2) + 1;
  17697. if (t2 < 1)
  17698. throw new Error();
  17699. this.month = t2 % 12 || t2;
  17700. }], Y: [/[+-]?\d+/, f("year")], YY: [r, function(e2) {
  17701. this.year = a(e2);
  17702. }], YYYY: [/\d{4}/, f("year")], Z: h, ZZ: h };
  17703. function l(n2) {
  17704. var r2, i2;
  17705. r2 = n2, i2 = s && s.formats;
  17706. for (var o2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  17707. var o3 = r3 && r3.toUpperCase();
  17708. return n3 || i2[r3] || e[r3] || i2[o3].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  17709. return t3 || n4.slice(1);
  17710. });
  17711. })).match(t), a2 = o2.length, f2 = 0; f2 < a2; f2 += 1) {
  17712. var h2 = o2[f2], u2 = c[h2], d2 = u2 && u2[0], l2 = u2 && u2[1];
  17713. o2[f2] = l2 ? { regex: d2, parser: l2 } : h2.replace(/^\[|\]$/g, "");
  17714. }
  17715. return function(e2) {
  17716. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
  17717. var i3 = o2[n3];
  17718. if (typeof i3 == "string")
  17719. r3 += i3.length;
  17720. else {
  17721. var s2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = s2.exec(h3)[0];
  17722. f3.call(t2, u3), e2 = e2.replace(u3, "");
  17723. }
  17724. }
  17725. return function(e3) {
  17726. var t3 = e3.afternoon;
  17727. if (t3 !== void 0) {
  17728. var n4 = e3.hours;
  17729. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  17730. }
  17731. }(t2), t2;
  17732. };
  17733. }
  17734. return function(e2, t2, n2) {
  17735. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (a = e2.parseTwoDigitYear);
  17736. var r2 = t2.prototype, i2 = r2.parse;
  17737. r2.parse = function(e3) {
  17738. var t3 = e3.date, r3 = e3.utc, o2 = e3.args;
  17739. this.$u = r3;
  17740. var a2 = o2[1];
  17741. if (typeof a2 == "string") {
  17742. var f2 = o2[2] === true, h2 = o2[3] === true, u2 = f2 || h2, d2 = o2[2];
  17743. h2 && (d2 = o2[2]), s = this.$locale(), !f2 && d2 && (s = n2.Ls[d2]), this.$d = function(e4, t4, n3, r4) {
  17744. try {
  17745. if (["x", "X"].indexOf(t4) > -1)
  17746. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  17747. 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;
  17748. o3 && !s2 || (v = s2 > 0 ? s2 - 1 : M2.getMonth());
  17749. var D, w = f3 || 0, g = h3 || 0, y = u3 || 0, L = d3 || 0;
  17750. 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);
  17751. } catch (e5) {
  17752. return new Date("");
  17753. }
  17754. }(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 = {};
  17755. } else if (a2 instanceof Array)
  17756. for (var c2 = a2.length, m = 1; m <= c2; m += 1) {
  17757. o2[1] = a2[m - 1];
  17758. var M = n2.apply(this, o2);
  17759. if (M.isValid()) {
  17760. this.$d = M.$d, this.$L = M.$L, this.init();
  17761. break;
  17762. }
  17763. m === c2 && (this.$d = new Date(""));
  17764. }
  17765. else
  17766. i2.call(this, e3);
  17767. };
  17768. };
  17769. });
  17770. })(customParseFormat$1);
  17771. var customParseFormat = customParseFormat$1.exports;
  17772. const timeUnits$1 = ["hours", "minutes", "seconds"];
  17773. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  17774. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  17775. const DEFAULT_FORMATS_DATEPICKER = {
  17776. date: DEFAULT_FORMATS_DATE,
  17777. dates: DEFAULT_FORMATS_DATE,
  17778. week: "gggg[w]ww",
  17779. year: "YYYY",
  17780. years: "YYYY",
  17781. month: "YYYY-MM",
  17782. months: "YYYY-MM",
  17783. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  17784. monthrange: "YYYY-MM",
  17785. yearrange: "YYYY",
  17786. daterange: DEFAULT_FORMATS_DATE,
  17787. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  17788. };
  17789. const buildTimeList = (value, bound) => {
  17790. return [
  17791. value > 0 ? value - 1 : void 0,
  17792. value,
  17793. value < bound ? value + 1 : void 0
  17794. ];
  17795. };
  17796. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  17797. const extractDateFormat = (format) => {
  17798. return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  17799. };
  17800. const extractTimeFormat = (format) => {
  17801. return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  17802. };
  17803. const dateEquals = function(a, b) {
  17804. const aIsDate = isDate$1(a);
  17805. const bIsDate = isDate$1(b);
  17806. if (aIsDate && bIsDate) {
  17807. return a.getTime() === b.getTime();
  17808. }
  17809. if (!aIsDate && !bIsDate) {
  17810. return a === b;
  17811. }
  17812. return false;
  17813. };
  17814. const valueEquals = function(a, b) {
  17815. const aIsArray = isArray$1(a);
  17816. const bIsArray = isArray$1(b);
  17817. if (aIsArray && bIsArray) {
  17818. if (a.length !== b.length) {
  17819. return false;
  17820. }
  17821. return a.every((item, index) => dateEquals(item, b[index]));
  17822. }
  17823. if (!aIsArray && !bIsArray) {
  17824. return dateEquals(a, b);
  17825. }
  17826. return false;
  17827. };
  17828. const parseDate = function(date, format, lang) {
  17829. const day = isEmpty(format) || format === "x" ? dayjs(date).locale(lang) : dayjs(date, format).locale(lang);
  17830. return day.isValid() ? day : void 0;
  17831. };
  17832. const formatter = function(date, format, lang) {
  17833. if (isEmpty(format))
  17834. return date;
  17835. if (format === "x")
  17836. return +date;
  17837. return dayjs(date).locale(lang).format(format);
  17838. };
  17839. const makeList = (total, method) => {
  17840. var _a;
  17841. const arr = [];
  17842. const disabledArr = method == null ? void 0 : method();
  17843. for (let i = 0; i < total; i++) {
  17844. arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
  17845. }
  17846. return arr;
  17847. };
  17848. const dayOrDaysToDate = (dayOrDays) => {
  17849. return isArray$1(dayOrDays) ? dayOrDays.map((d) => d.toDate()) : dayOrDays.toDate();
  17850. };
  17851. const disabledTimeListsProps = buildProps({
  17852. disabledHours: {
  17853. type: definePropType(Function)
  17854. },
  17855. disabledMinutes: {
  17856. type: definePropType(Function)
  17857. },
  17858. disabledSeconds: {
  17859. type: definePropType(Function)
  17860. }
  17861. });
  17862. const timePanelSharedProps = buildProps({
  17863. visible: Boolean,
  17864. actualVisible: {
  17865. type: Boolean,
  17866. default: void 0
  17867. },
  17868. format: {
  17869. type: String,
  17870. default: ""
  17871. }
  17872. });
  17873. const timePickerDefaultProps = buildProps({
  17874. id: {
  17875. type: definePropType([Array, String])
  17876. },
  17877. name: {
  17878. type: definePropType([Array, String])
  17879. },
  17880. popperClass: {
  17881. type: String,
  17882. default: ""
  17883. },
  17884. format: String,
  17885. valueFormat: String,
  17886. dateFormat: String,
  17887. timeFormat: String,
  17888. type: {
  17889. type: String,
  17890. default: ""
  17891. },
  17892. clearable: {
  17893. type: Boolean,
  17894. default: true
  17895. },
  17896. clearIcon: {
  17897. type: definePropType([String, Object]),
  17898. default: circle_close_default
  17899. },
  17900. editable: {
  17901. type: Boolean,
  17902. default: true
  17903. },
  17904. prefixIcon: {
  17905. type: definePropType([String, Object]),
  17906. default: ""
  17907. },
  17908. size: useSizeProp,
  17909. readonly: Boolean,
  17910. disabled: Boolean,
  17911. placeholder: {
  17912. type: String,
  17913. default: ""
  17914. },
  17915. popperOptions: {
  17916. type: definePropType(Object),
  17917. default: () => ({})
  17918. },
  17919. modelValue: {
  17920. type: definePropType([Date, Array, String, Number]),
  17921. default: ""
  17922. },
  17923. rangeSeparator: {
  17924. type: String,
  17925. default: "-"
  17926. },
  17927. startPlaceholder: String,
  17928. endPlaceholder: String,
  17929. defaultValue: {
  17930. type: definePropType([Date, Array])
  17931. },
  17932. defaultTime: {
  17933. type: definePropType([Date, Array])
  17934. },
  17935. isRange: Boolean,
  17936. ...disabledTimeListsProps,
  17937. disabledDate: {
  17938. type: Function
  17939. },
  17940. cellClassName: {
  17941. type: Function
  17942. },
  17943. shortcuts: {
  17944. type: Array,
  17945. default: () => []
  17946. },
  17947. arrowControl: Boolean,
  17948. tabindex: {
  17949. type: definePropType([String, Number]),
  17950. default: 0
  17951. },
  17952. validateEvent: {
  17953. type: Boolean,
  17954. default: true
  17955. },
  17956. unlinkPanels: Boolean,
  17957. placement: {
  17958. type: definePropType(String),
  17959. values: Ee,
  17960. default: "bottom"
  17961. },
  17962. fallbackPlacements: {
  17963. type: definePropType(Array),
  17964. default: ["bottom", "top", "right", "left"]
  17965. },
  17966. ...useEmptyValuesProps,
  17967. ...useAriaProps(["ariaLabel"]),
  17968. showNow: {
  17969. type: Boolean,
  17970. default: true
  17971. }
  17972. });
  17973. const timePickerRngeTriggerProps = buildProps({
  17974. id: {
  17975. type: definePropType(Array)
  17976. },
  17977. name: {
  17978. type: definePropType(Array)
  17979. },
  17980. modelValue: {
  17981. type: definePropType([Array, String])
  17982. },
  17983. startPlaceholder: String,
  17984. endPlaceholder: String
  17985. });
  17986. const __default__$1v = defineComponent({
  17987. name: "PickerRangeTrigger",
  17988. inheritAttrs: false
  17989. });
  17990. const _sfc_main$27 = /* @__PURE__ */ defineComponent({
  17991. ...__default__$1v,
  17992. props: timePickerRngeTriggerProps,
  17993. emits: [
  17994. "mouseenter",
  17995. "mouseleave",
  17996. "click",
  17997. "touchstart",
  17998. "focus",
  17999. "blur",
  18000. "startInput",
  18001. "endInput",
  18002. "startChange",
  18003. "endChange"
  18004. ],
  18005. setup(__props, { expose, emit }) {
  18006. const attrs = useAttrs();
  18007. const nsDate = useNamespace("date");
  18008. const nsRange = useNamespace("range");
  18009. const inputRef = ref();
  18010. const endInputRef = ref();
  18011. const { wrapperRef, isFocused } = useFocusController(inputRef);
  18012. const handleClick = (evt) => {
  18013. emit("click", evt);
  18014. };
  18015. const handleMouseEnter = (evt) => {
  18016. emit("mouseenter", evt);
  18017. };
  18018. const handleMouseLeave = (evt) => {
  18019. emit("mouseleave", evt);
  18020. };
  18021. const handleTouchStart = (evt) => {
  18022. emit("mouseenter", evt);
  18023. };
  18024. const handleStartInput = (evt) => {
  18025. emit("startInput", evt);
  18026. };
  18027. const handleEndInput = (evt) => {
  18028. emit("endInput", evt);
  18029. };
  18030. const handleStartChange = (evt) => {
  18031. emit("startChange", evt);
  18032. };
  18033. const handleEndChange = (evt) => {
  18034. emit("endChange", evt);
  18035. };
  18036. const focus = () => {
  18037. var _a;
  18038. (_a = inputRef.value) == null ? void 0 : _a.focus();
  18039. };
  18040. const blur = () => {
  18041. var _a, _b;
  18042. (_a = inputRef.value) == null ? void 0 : _a.blur();
  18043. (_b = endInputRef.value) == null ? void 0 : _b.blur();
  18044. };
  18045. expose({
  18046. focus,
  18047. blur
  18048. });
  18049. return (_ctx, _cache) => {
  18050. return openBlock(), createElementBlock("div", {
  18051. ref_key: "wrapperRef",
  18052. ref: wrapperRef,
  18053. class: normalizeClass([unref(nsDate).is("active", unref(isFocused)), _ctx.$attrs.class]),
  18054. style: normalizeStyle(_ctx.$attrs.style),
  18055. onClick: handleClick,
  18056. onMouseenter: handleMouseEnter,
  18057. onMouseleave: handleMouseLeave,
  18058. onTouchstartPassive: handleTouchStart
  18059. }, [
  18060. renderSlot(_ctx.$slots, "prefix"),
  18061. createElementVNode("input", mergeProps(unref(attrs), {
  18062. id: _ctx.id && _ctx.id[0],
  18063. ref_key: "inputRef",
  18064. ref: inputRef,
  18065. name: _ctx.name && _ctx.name[0],
  18066. placeholder: _ctx.startPlaceholder,
  18067. value: _ctx.modelValue && _ctx.modelValue[0],
  18068. class: unref(nsRange).b("input"),
  18069. onInput: handleStartInput,
  18070. onChange: handleStartChange
  18071. }), null, 16, ["id", "name", "placeholder", "value"]),
  18072. renderSlot(_ctx.$slots, "range-separator"),
  18073. createElementVNode("input", mergeProps(unref(attrs), {
  18074. id: _ctx.id && _ctx.id[1],
  18075. ref_key: "endInputRef",
  18076. ref: endInputRef,
  18077. name: _ctx.name && _ctx.name[1],
  18078. placeholder: _ctx.endPlaceholder,
  18079. value: _ctx.modelValue && _ctx.modelValue[1],
  18080. class: unref(nsRange).b("input"),
  18081. onInput: handleEndInput,
  18082. onChange: handleEndChange
  18083. }), null, 16, ["id", "name", "placeholder", "value"]),
  18084. renderSlot(_ctx.$slots, "suffix")
  18085. ], 38);
  18086. };
  18087. }
  18088. });
  18089. var PickerRangeTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$27, [["__file", "picker-range-trigger.vue"]]);
  18090. const __default__$1u = defineComponent({
  18091. name: "Picker"
  18092. });
  18093. const _sfc_main$26 = /* @__PURE__ */ defineComponent({
  18094. ...__default__$1u,
  18095. props: timePickerDefaultProps,
  18096. emits: [
  18097. "update:modelValue",
  18098. "change",
  18099. "focus",
  18100. "blur",
  18101. "clear",
  18102. "calendar-change",
  18103. "panel-change",
  18104. "visible-change",
  18105. "keydown"
  18106. ],
  18107. setup(__props, { expose, emit }) {
  18108. const props = __props;
  18109. const attrs = useAttrs$1();
  18110. const { lang } = useLocale();
  18111. const nsDate = useNamespace("date");
  18112. const nsInput = useNamespace("input");
  18113. const nsRange = useNamespace("range");
  18114. const { form, formItem } = useFormItem();
  18115. const elPopperOptions = inject("ElPopperOptions", {});
  18116. const { valueOnClear } = useEmptyValues(props, null);
  18117. const refPopper = ref();
  18118. const inputRef = ref();
  18119. const pickerVisible = ref(false);
  18120. const pickerActualVisible = ref(false);
  18121. const valueOnOpen = ref(null);
  18122. let hasJustTabExitedInput = false;
  18123. const { isFocused, handleFocus, handleBlur } = useFocusController(inputRef, {
  18124. beforeFocus() {
  18125. return props.readonly || pickerDisabled.value;
  18126. },
  18127. afterFocus() {
  18128. pickerVisible.value = true;
  18129. },
  18130. beforeBlur(event) {
  18131. var _a;
  18132. return !hasJustTabExitedInput && ((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent(event));
  18133. },
  18134. afterBlur() {
  18135. handleChange();
  18136. pickerVisible.value = false;
  18137. hasJustTabExitedInput = false;
  18138. props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn()));
  18139. }
  18140. });
  18141. const rangeInputKls = computed(() => [
  18142. nsDate.b("editor"),
  18143. nsDate.bm("editor", props.type),
  18144. nsInput.e("wrapper"),
  18145. nsDate.is("disabled", pickerDisabled.value),
  18146. nsDate.is("active", pickerVisible.value),
  18147. nsRange.b("editor"),
  18148. pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
  18149. attrs.class
  18150. ]);
  18151. const clearIconKls = computed(() => [
  18152. nsInput.e("icon"),
  18153. nsRange.e("close-icon"),
  18154. !showClose.value ? nsRange.e("close-icon--hidden") : ""
  18155. ]);
  18156. watch(pickerVisible, (val) => {
  18157. if (!val) {
  18158. userInput.value = null;
  18159. nextTick(() => {
  18160. emitChange(props.modelValue);
  18161. });
  18162. } else {
  18163. nextTick(() => {
  18164. if (val) {
  18165. valueOnOpen.value = props.modelValue;
  18166. }
  18167. });
  18168. }
  18169. });
  18170. const emitChange = (val, isClear) => {
  18171. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  18172. emit("change", val);
  18173. props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  18174. }
  18175. };
  18176. const emitInput = (input) => {
  18177. if (!valueEquals(props.modelValue, input)) {
  18178. let formatted;
  18179. if (isArray$1(input)) {
  18180. formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
  18181. } else if (input) {
  18182. formatted = formatter(input, props.valueFormat, lang.value);
  18183. }
  18184. emit("update:modelValue", input ? formatted : input, lang.value);
  18185. }
  18186. };
  18187. const emitKeydown = (e) => {
  18188. emit("keydown", e);
  18189. };
  18190. const refInput = computed(() => {
  18191. if (inputRef.value) {
  18192. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  18193. }
  18194. return [];
  18195. });
  18196. const setSelectionRange = (start, end, pos) => {
  18197. const _inputs = refInput.value;
  18198. if (!_inputs.length)
  18199. return;
  18200. if (!pos || pos === "min") {
  18201. _inputs[0].setSelectionRange(start, end);
  18202. _inputs[0].focus();
  18203. } else if (pos === "max") {
  18204. _inputs[1].setSelectionRange(start, end);
  18205. _inputs[1].focus();
  18206. }
  18207. };
  18208. const onPick = (date = "", visible = false) => {
  18209. pickerVisible.value = visible;
  18210. let result;
  18211. if (isArray$1(date)) {
  18212. result = date.map((_) => _.toDate());
  18213. } else {
  18214. result = date ? date.toDate() : date;
  18215. }
  18216. userInput.value = null;
  18217. emitInput(result);
  18218. };
  18219. const onBeforeShow = () => {
  18220. pickerActualVisible.value = true;
  18221. };
  18222. const onShow = () => {
  18223. emit("visible-change", true);
  18224. };
  18225. const onHide = () => {
  18226. pickerActualVisible.value = false;
  18227. pickerVisible.value = false;
  18228. emit("visible-change", false);
  18229. };
  18230. const handleOpen = () => {
  18231. pickerVisible.value = true;
  18232. };
  18233. const handleClose = () => {
  18234. pickerVisible.value = false;
  18235. };
  18236. const pickerDisabled = computed(() => {
  18237. return props.disabled || (form == null ? void 0 : form.disabled);
  18238. });
  18239. const parsedValue = computed(() => {
  18240. let dayOrDays;
  18241. if (valueIsEmpty.value) {
  18242. if (pickerOptions.value.getDefaultValue) {
  18243. dayOrDays = pickerOptions.value.getDefaultValue();
  18244. }
  18245. } else {
  18246. if (isArray$1(props.modelValue)) {
  18247. dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
  18248. } else {
  18249. dayOrDays = parseDate(props.modelValue, props.valueFormat, lang.value);
  18250. }
  18251. }
  18252. if (pickerOptions.value.getRangeAvailableTime) {
  18253. const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
  18254. if (!isEqual$1(availableResult, dayOrDays)) {
  18255. dayOrDays = availableResult;
  18256. if (!valueIsEmpty.value) {
  18257. emitInput(dayOrDaysToDate(dayOrDays));
  18258. }
  18259. }
  18260. }
  18261. if (isArray$1(dayOrDays) && dayOrDays.some((day) => !day)) {
  18262. dayOrDays = [];
  18263. }
  18264. return dayOrDays;
  18265. });
  18266. const displayValue = computed(() => {
  18267. if (!pickerOptions.value.panelReady)
  18268. return "";
  18269. const formattedValue = formatDayjsToString(parsedValue.value);
  18270. if (isArray$1(userInput.value)) {
  18271. return [
  18272. userInput.value[0] || formattedValue && formattedValue[0] || "",
  18273. userInput.value[1] || formattedValue && formattedValue[1] || ""
  18274. ];
  18275. } else if (userInput.value !== null) {
  18276. return userInput.value;
  18277. }
  18278. if (!isTimePicker.value && valueIsEmpty.value)
  18279. return "";
  18280. if (!pickerVisible.value && valueIsEmpty.value)
  18281. return "";
  18282. if (formattedValue) {
  18283. return isDatesPicker.value || isMonthsPicker.value || isYearsPicker.value ? formattedValue.join(", ") : formattedValue;
  18284. }
  18285. return "";
  18286. });
  18287. const isTimeLikePicker = computed(() => props.type.includes("time"));
  18288. const isTimePicker = computed(() => props.type.startsWith("time"));
  18289. const isDatesPicker = computed(() => props.type === "dates");
  18290. const isMonthsPicker = computed(() => props.type === "months");
  18291. const isYearsPicker = computed(() => props.type === "years");
  18292. const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
  18293. const showClose = ref(false);
  18294. const onClearIconClick = (event) => {
  18295. if (props.readonly || pickerDisabled.value)
  18296. return;
  18297. if (showClose.value) {
  18298. event.stopPropagation();
  18299. if (pickerOptions.value.handleClear) {
  18300. pickerOptions.value.handleClear();
  18301. } else {
  18302. emitInput(valueOnClear.value);
  18303. }
  18304. emitChange(valueOnClear.value, true);
  18305. showClose.value = false;
  18306. onHide();
  18307. }
  18308. emit("clear");
  18309. };
  18310. const valueIsEmpty = computed(() => {
  18311. const { modelValue } = props;
  18312. return !modelValue || isArray$1(modelValue) && !modelValue.filter(Boolean).length;
  18313. });
  18314. const onMouseDownInput = async (event) => {
  18315. var _a;
  18316. if (props.readonly || pickerDisabled.value)
  18317. return;
  18318. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value) {
  18319. pickerVisible.value = true;
  18320. }
  18321. };
  18322. const onMouseEnter = () => {
  18323. if (props.readonly || pickerDisabled.value)
  18324. return;
  18325. if (!valueIsEmpty.value && props.clearable) {
  18326. showClose.value = true;
  18327. }
  18328. };
  18329. const onMouseLeave = () => {
  18330. showClose.value = false;
  18331. };
  18332. const onTouchStartInput = (event) => {
  18333. var _a;
  18334. if (props.readonly || pickerDisabled.value)
  18335. return;
  18336. if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || isFocused.value) {
  18337. pickerVisible.value = true;
  18338. }
  18339. };
  18340. const isRangeInput = computed(() => {
  18341. return props.type.includes("range");
  18342. });
  18343. const pickerSize = useFormSize();
  18344. const popperEl = computed(() => {
  18345. var _a, _b;
  18346. return (_b = (_a = unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  18347. });
  18348. const stophandle = onClickOutside(inputRef, (e) => {
  18349. const unrefedPopperEl = unref(popperEl);
  18350. const inputEl = unrefElement(inputRef);
  18351. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || inputEl && e.composedPath().includes(inputEl))
  18352. return;
  18353. pickerVisible.value = false;
  18354. });
  18355. onBeforeUnmount(() => {
  18356. stophandle == null ? void 0 : stophandle();
  18357. });
  18358. const userInput = ref(null);
  18359. const handleChange = () => {
  18360. if (userInput.value) {
  18361. const value = parseUserInputToDayjs(displayValue.value);
  18362. if (value) {
  18363. if (isValidValue(value)) {
  18364. emitInput(dayOrDaysToDate(value));
  18365. userInput.value = null;
  18366. }
  18367. }
  18368. }
  18369. if (userInput.value === "") {
  18370. emitInput(valueOnClear.value);
  18371. emitChange(valueOnClear.value);
  18372. userInput.value = null;
  18373. }
  18374. };
  18375. const parseUserInputToDayjs = (value) => {
  18376. if (!value)
  18377. return null;
  18378. return pickerOptions.value.parseUserInput(value);
  18379. };
  18380. const formatDayjsToString = (value) => {
  18381. if (!value)
  18382. return null;
  18383. return pickerOptions.value.formatToString(value);
  18384. };
  18385. const isValidValue = (value) => {
  18386. return pickerOptions.value.isValidValue(value);
  18387. };
  18388. const handleKeydownInput = async (event) => {
  18389. if (props.readonly || pickerDisabled.value)
  18390. return;
  18391. const { code } = event;
  18392. emitKeydown(event);
  18393. if (code === EVENT_CODE.esc) {
  18394. if (pickerVisible.value === true) {
  18395. pickerVisible.value = false;
  18396. event.preventDefault();
  18397. event.stopPropagation();
  18398. }
  18399. return;
  18400. }
  18401. if (code === EVENT_CODE.down) {
  18402. if (pickerOptions.value.handleFocusPicker) {
  18403. event.preventDefault();
  18404. event.stopPropagation();
  18405. }
  18406. if (pickerVisible.value === false) {
  18407. pickerVisible.value = true;
  18408. await nextTick();
  18409. }
  18410. if (pickerOptions.value.handleFocusPicker) {
  18411. pickerOptions.value.handleFocusPicker();
  18412. return;
  18413. }
  18414. }
  18415. if (code === EVENT_CODE.tab) {
  18416. hasJustTabExitedInput = true;
  18417. return;
  18418. }
  18419. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  18420. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  18421. handleChange();
  18422. pickerVisible.value = false;
  18423. }
  18424. event.stopPropagation();
  18425. return;
  18426. }
  18427. if (userInput.value) {
  18428. event.stopPropagation();
  18429. return;
  18430. }
  18431. if (pickerOptions.value.handleKeydownInput) {
  18432. pickerOptions.value.handleKeydownInput(event);
  18433. }
  18434. };
  18435. const onUserInput = (e) => {
  18436. userInput.value = e;
  18437. if (!pickerVisible.value) {
  18438. pickerVisible.value = true;
  18439. }
  18440. };
  18441. const handleStartInput = (event) => {
  18442. const target = event.target;
  18443. if (userInput.value) {
  18444. userInput.value = [target.value, userInput.value[1]];
  18445. } else {
  18446. userInput.value = [target.value, null];
  18447. }
  18448. };
  18449. const handleEndInput = (event) => {
  18450. const target = event.target;
  18451. if (userInput.value) {
  18452. userInput.value = [userInput.value[0], target.value];
  18453. } else {
  18454. userInput.value = [null, target.value];
  18455. }
  18456. };
  18457. const handleStartChange = () => {
  18458. var _a;
  18459. const values = userInput.value;
  18460. const value = parseUserInputToDayjs(values && values[0]);
  18461. const parsedVal = unref(parsedValue);
  18462. if (value && value.isValid()) {
  18463. userInput.value = [
  18464. formatDayjsToString(value),
  18465. ((_a = displayValue.value) == null ? void 0 : _a[1]) || null
  18466. ];
  18467. const newValue = [value, parsedVal && (parsedVal[1] || null)];
  18468. if (isValidValue(newValue)) {
  18469. emitInput(dayOrDaysToDate(newValue));
  18470. userInput.value = null;
  18471. }
  18472. }
  18473. };
  18474. const handleEndChange = () => {
  18475. var _a;
  18476. const values = unref(userInput);
  18477. const value = parseUserInputToDayjs(values && values[1]);
  18478. const parsedVal = unref(parsedValue);
  18479. if (value && value.isValid()) {
  18480. userInput.value = [
  18481. ((_a = unref(displayValue)) == null ? void 0 : _a[0]) || null,
  18482. formatDayjsToString(value)
  18483. ];
  18484. const newValue = [parsedVal && parsedVal[0], value];
  18485. if (isValidValue(newValue)) {
  18486. emitInput(dayOrDaysToDate(newValue));
  18487. userInput.value = null;
  18488. }
  18489. }
  18490. };
  18491. const pickerOptions = ref({});
  18492. const onSetPickerOption = (e) => {
  18493. pickerOptions.value[e[0]] = e[1];
  18494. pickerOptions.value.panelReady = true;
  18495. };
  18496. const onCalendarChange = (e) => {
  18497. emit("calendar-change", e);
  18498. };
  18499. const onPanelChange = (value, mode, view) => {
  18500. emit("panel-change", value, mode, view);
  18501. };
  18502. const focus = () => {
  18503. var _a;
  18504. (_a = inputRef.value) == null ? void 0 : _a.focus();
  18505. };
  18506. const blur = () => {
  18507. var _a;
  18508. (_a = inputRef.value) == null ? void 0 : _a.blur();
  18509. };
  18510. provide("EP_PICKER_BASE", {
  18511. props
  18512. });
  18513. expose({
  18514. focus,
  18515. blur,
  18516. handleOpen,
  18517. handleClose,
  18518. onPick
  18519. });
  18520. return (_ctx, _cache) => {
  18521. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  18522. ref_key: "refPopper",
  18523. ref: refPopper,
  18524. visible: pickerVisible.value,
  18525. effect: "light",
  18526. pure: "",
  18527. trigger: "click"
  18528. }, _ctx.$attrs, {
  18529. role: "dialog",
  18530. teleported: "",
  18531. transition: `${unref(nsDate).namespace.value}-zoom-in-top`,
  18532. "popper-class": [`${unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
  18533. "popper-options": unref(elPopperOptions),
  18534. "fallback-placements": _ctx.fallbackPlacements,
  18535. "gpu-acceleration": false,
  18536. placement: _ctx.placement,
  18537. "stop-popper-mouse-event": false,
  18538. "hide-after": 0,
  18539. persistent: "",
  18540. onBeforeShow,
  18541. onShow,
  18542. onHide
  18543. }), {
  18544. default: withCtx(() => [
  18545. !unref(isRangeInput) ? (openBlock(), createBlock(unref(ElInput), {
  18546. key: 0,
  18547. id: _ctx.id,
  18548. ref_key: "inputRef",
  18549. ref: inputRef,
  18550. "container-role": "combobox",
  18551. "model-value": unref(displayValue),
  18552. name: _ctx.name,
  18553. size: unref(pickerSize),
  18554. disabled: unref(pickerDisabled),
  18555. placeholder: _ctx.placeholder,
  18556. class: normalizeClass([unref(nsDate).b("editor"), unref(nsDate).bm("editor", _ctx.type), _ctx.$attrs.class]),
  18557. style: normalizeStyle(_ctx.$attrs.style),
  18558. readonly: !_ctx.editable || _ctx.readonly || unref(isDatesPicker) || unref(isMonthsPicker) || unref(isYearsPicker) || _ctx.type === "week",
  18559. "aria-label": _ctx.ariaLabel,
  18560. tabindex: _ctx.tabindex,
  18561. "validate-event": false,
  18562. onInput: onUserInput,
  18563. onFocus: unref(handleFocus),
  18564. onBlur: unref(handleBlur),
  18565. onKeydown: handleKeydownInput,
  18566. onChange: handleChange,
  18567. onMousedown: onMouseDownInput,
  18568. onMouseenter: onMouseEnter,
  18569. onMouseleave: onMouseLeave,
  18570. onTouchstartPassive: onTouchStartInput,
  18571. onClick: withModifiers(() => {
  18572. }, ["stop"])
  18573. }, {
  18574. prefix: withCtx(() => [
  18575. unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  18576. key: 0,
  18577. class: normalizeClass(unref(nsInput).e("icon")),
  18578. onMousedown: withModifiers(onMouseDownInput, ["prevent"]),
  18579. onTouchstartPassive: onTouchStartInput
  18580. }, {
  18581. default: withCtx(() => [
  18582. (openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))
  18583. ]),
  18584. _: 1
  18585. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
  18586. ]),
  18587. suffix: withCtx(() => [
  18588. showClose.value && _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
  18589. key: 0,
  18590. class: normalizeClass(`${unref(nsInput).e("icon")} clear-icon`),
  18591. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  18592. onClick: onClearIconClick
  18593. }, {
  18594. default: withCtx(() => [
  18595. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  18596. ]),
  18597. _: 1
  18598. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
  18599. ]),
  18600. _: 1
  18601. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "aria-label", "tabindex", "onFocus", "onBlur", "onClick"])) : (openBlock(), createBlock(PickerRangeTrigger, {
  18602. key: 1,
  18603. id: _ctx.id,
  18604. ref_key: "inputRef",
  18605. ref: inputRef,
  18606. "model-value": unref(displayValue),
  18607. name: _ctx.name,
  18608. disabled: unref(pickerDisabled),
  18609. readonly: !_ctx.editable || _ctx.readonly,
  18610. "start-placeholder": _ctx.startPlaceholder,
  18611. "end-placeholder": _ctx.endPlaceholder,
  18612. class: normalizeClass(unref(rangeInputKls)),
  18613. style: normalizeStyle(_ctx.$attrs.style),
  18614. "aria-label": _ctx.ariaLabel,
  18615. tabindex: _ctx.tabindex,
  18616. autocomplete: "off",
  18617. role: "combobox",
  18618. onClick: onMouseDownInput,
  18619. onFocus: unref(handleFocus),
  18620. onBlur: unref(handleBlur),
  18621. onStartInput: handleStartInput,
  18622. onStartChange: handleStartChange,
  18623. onEndInput: handleEndInput,
  18624. onEndChange: handleEndChange,
  18625. onMousedown: onMouseDownInput,
  18626. onMouseenter: onMouseEnter,
  18627. onMouseleave: onMouseLeave,
  18628. onTouchstartPassive: onTouchStartInput,
  18629. onKeydown: handleKeydownInput
  18630. }, {
  18631. prefix: withCtx(() => [
  18632. unref(triggerIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  18633. key: 0,
  18634. class: normalizeClass([unref(nsInput).e("icon"), unref(nsRange).e("icon")])
  18635. }, {
  18636. default: withCtx(() => [
  18637. (openBlock(), createBlock(resolveDynamicComponent(unref(triggerIcon))))
  18638. ]),
  18639. _: 1
  18640. }, 8, ["class"])) : createCommentVNode("v-if", true)
  18641. ]),
  18642. "range-separator": withCtx(() => [
  18643. renderSlot(_ctx.$slots, "range-separator", {}, () => [
  18644. createElementVNode("span", {
  18645. class: normalizeClass(unref(nsRange).b("separator"))
  18646. }, toDisplayString(_ctx.rangeSeparator), 3)
  18647. ])
  18648. ]),
  18649. suffix: withCtx(() => [
  18650. _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
  18651. key: 0,
  18652. class: normalizeClass(unref(clearIconKls)),
  18653. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  18654. onClick: onClearIconClick
  18655. }, {
  18656. default: withCtx(() => [
  18657. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  18658. ]),
  18659. _: 1
  18660. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)
  18661. ]),
  18662. _: 3
  18663. }, 8, ["id", "model-value", "name", "disabled", "readonly", "start-placeholder", "end-placeholder", "class", "style", "aria-label", "tabindex", "onFocus", "onBlur"]))
  18664. ]),
  18665. content: withCtx(() => [
  18666. renderSlot(_ctx.$slots, "default", {
  18667. visible: pickerVisible.value,
  18668. actualVisible: pickerActualVisible.value,
  18669. parsedValue: unref(parsedValue),
  18670. format: _ctx.format,
  18671. dateFormat: _ctx.dateFormat,
  18672. timeFormat: _ctx.timeFormat,
  18673. unlinkPanels: _ctx.unlinkPanels,
  18674. type: _ctx.type,
  18675. defaultValue: _ctx.defaultValue,
  18676. showNow: _ctx.showNow,
  18677. onPick,
  18678. onSelectRange: setSelectionRange,
  18679. onSetPickerOption,
  18680. onCalendarChange,
  18681. onPanelChange,
  18682. onMousedown: withModifiers(() => {
  18683. }, ["stop"])
  18684. })
  18685. ]),
  18686. _: 3
  18687. }, 16, ["visible", "transition", "popper-class", "popper-options", "fallback-placements", "placement"]);
  18688. };
  18689. }
  18690. });
  18691. var CommonPicker = /* @__PURE__ */ _export_sfc(_sfc_main$26, [["__file", "picker.vue"]]);
  18692. const panelTimePickerProps = buildProps({
  18693. ...timePanelSharedProps,
  18694. datetimeRole: String,
  18695. parsedValue: {
  18696. type: definePropType(Object)
  18697. }
  18698. });
  18699. const useTimePanel = ({
  18700. getAvailableHours,
  18701. getAvailableMinutes,
  18702. getAvailableSeconds
  18703. }) => {
  18704. const getAvailableTime = (date, role, first, compareDate) => {
  18705. const availableTimeGetters = {
  18706. hour: getAvailableHours,
  18707. minute: getAvailableMinutes,
  18708. second: getAvailableSeconds
  18709. };
  18710. let result = date;
  18711. ["hour", "minute", "second"].forEach((type) => {
  18712. if (availableTimeGetters[type]) {
  18713. let availableTimeSlots;
  18714. const method = availableTimeGetters[type];
  18715. switch (type) {
  18716. case "minute": {
  18717. availableTimeSlots = method(result.hour(), role, compareDate);
  18718. break;
  18719. }
  18720. case "second": {
  18721. availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
  18722. break;
  18723. }
  18724. default: {
  18725. availableTimeSlots = method(role, compareDate);
  18726. break;
  18727. }
  18728. }
  18729. if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {
  18730. const pos = first ? 0 : availableTimeSlots.length - 1;
  18731. result = result[type](availableTimeSlots[pos]);
  18732. }
  18733. }
  18734. });
  18735. return result;
  18736. };
  18737. const timePickerOptions = {};
  18738. const onSetOption = ([key, val]) => {
  18739. timePickerOptions[key] = val;
  18740. };
  18741. return {
  18742. timePickerOptions,
  18743. getAvailableTime,
  18744. onSetOption
  18745. };
  18746. };
  18747. const makeAvailableArr = (disabledList) => {
  18748. const trueOrNumber = (isDisabled, index) => isDisabled || index;
  18749. const getNumber = (predicate) => predicate !== true;
  18750. return disabledList.map(trueOrNumber).filter(getNumber);
  18751. };
  18752. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  18753. const getHoursList = (role, compare) => {
  18754. return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
  18755. };
  18756. const getMinutesList = (hour, role, compare) => {
  18757. return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
  18758. };
  18759. const getSecondsList = (hour, minute, role, compare) => {
  18760. return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
  18761. };
  18762. return {
  18763. getHoursList,
  18764. getMinutesList,
  18765. getSecondsList
  18766. };
  18767. };
  18768. const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
  18769. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  18770. const getAvailableHours = (role, compare) => {
  18771. return makeAvailableArr(getHoursList(role, compare));
  18772. };
  18773. const getAvailableMinutes = (hour, role, compare) => {
  18774. return makeAvailableArr(getMinutesList(hour, role, compare));
  18775. };
  18776. const getAvailableSeconds = (hour, minute, role, compare) => {
  18777. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  18778. };
  18779. return {
  18780. getAvailableHours,
  18781. getAvailableMinutes,
  18782. getAvailableSeconds
  18783. };
  18784. };
  18785. const useOldValue = (props) => {
  18786. const oldValue = ref(props.parsedValue);
  18787. watch(() => props.visible, (val) => {
  18788. if (!val) {
  18789. oldValue.value = props.parsedValue;
  18790. }
  18791. });
  18792. return oldValue;
  18793. };
  18794. const nodeList = /* @__PURE__ */ new Map();
  18795. if (isClient) {
  18796. let startClick;
  18797. document.addEventListener("mousedown", (e) => startClick = e);
  18798. document.addEventListener("mouseup", (e) => {
  18799. if (startClick) {
  18800. for (const handlers of nodeList.values()) {
  18801. for (const { documentHandler } of handlers) {
  18802. documentHandler(e, startClick);
  18803. }
  18804. }
  18805. startClick = void 0;
  18806. }
  18807. });
  18808. }
  18809. function createDocumentHandler(el, binding) {
  18810. let excludes = [];
  18811. if (isArray$1(binding.arg)) {
  18812. excludes = binding.arg;
  18813. } else if (isElement$1(binding.arg)) {
  18814. excludes.push(binding.arg);
  18815. }
  18816. return function(mouseup, mousedown) {
  18817. const popperRef = binding.instance.popperRef;
  18818. const mouseUpTarget = mouseup.target;
  18819. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  18820. const isBound = !binding || !binding.instance;
  18821. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  18822. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  18823. const isSelf = el === mouseUpTarget;
  18824. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  18825. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  18826. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  18827. return;
  18828. }
  18829. binding.value(mouseup, mousedown);
  18830. };
  18831. }
  18832. const ClickOutside = {
  18833. beforeMount(el, binding) {
  18834. if (!nodeList.has(el)) {
  18835. nodeList.set(el, []);
  18836. }
  18837. nodeList.get(el).push({
  18838. documentHandler: createDocumentHandler(el, binding),
  18839. bindingFn: binding.value
  18840. });
  18841. },
  18842. updated(el, binding) {
  18843. if (!nodeList.has(el)) {
  18844. nodeList.set(el, []);
  18845. }
  18846. const handlers = nodeList.get(el);
  18847. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  18848. const newHandler = {
  18849. documentHandler: createDocumentHandler(el, binding),
  18850. bindingFn: binding.value
  18851. };
  18852. if (oldHandlerIndex >= 0) {
  18853. handlers.splice(oldHandlerIndex, 1, newHandler);
  18854. } else {
  18855. handlers.push(newHandler);
  18856. }
  18857. },
  18858. unmounted(el) {
  18859. nodeList.delete(el);
  18860. }
  18861. };
  18862. const REPEAT_INTERVAL = 100;
  18863. const REPEAT_DELAY = 600;
  18864. const vRepeatClick = {
  18865. beforeMount(el, binding) {
  18866. const value = binding.value;
  18867. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$1(value) ? {} : value;
  18868. let intervalId;
  18869. let delayId;
  18870. const handler = () => isFunction$1(value) ? value() : value.handler();
  18871. const clear = () => {
  18872. if (delayId) {
  18873. clearTimeout(delayId);
  18874. delayId = void 0;
  18875. }
  18876. if (intervalId) {
  18877. clearInterval(intervalId);
  18878. intervalId = void 0;
  18879. }
  18880. };
  18881. el.addEventListener("mousedown", (evt) => {
  18882. if (evt.button !== 0)
  18883. return;
  18884. clear();
  18885. handler();
  18886. document.addEventListener("mouseup", () => clear(), {
  18887. once: true
  18888. });
  18889. delayId = setTimeout(() => {
  18890. intervalId = setInterval(() => {
  18891. handler();
  18892. }, interval);
  18893. }, delay);
  18894. });
  18895. }
  18896. };
  18897. const FOCUSABLE_CHILDREN = "_trap-focus-children";
  18898. const FOCUS_STACK = [];
  18899. const FOCUS_HANDLER = (e) => {
  18900. if (FOCUS_STACK.length === 0)
  18901. return;
  18902. const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN];
  18903. if (focusableElement.length > 0 && e.code === EVENT_CODE.tab) {
  18904. if (focusableElement.length === 1) {
  18905. e.preventDefault();
  18906. if (document.activeElement !== focusableElement[0]) {
  18907. focusableElement[0].focus();
  18908. }
  18909. return;
  18910. }
  18911. const goingBackward = e.shiftKey;
  18912. const isFirst = e.target === focusableElement[0];
  18913. const isLast = e.target === focusableElement[focusableElement.length - 1];
  18914. if (isFirst && goingBackward) {
  18915. e.preventDefault();
  18916. focusableElement[focusableElement.length - 1].focus();
  18917. }
  18918. if (isLast && !goingBackward) {
  18919. e.preventDefault();
  18920. focusableElement[0].focus();
  18921. }
  18922. }
  18923. };
  18924. const TrapFocus = {
  18925. beforeMount(el) {
  18926. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18927. FOCUS_STACK.push(el);
  18928. if (FOCUS_STACK.length <= 1) {
  18929. document.addEventListener("keydown", FOCUS_HANDLER);
  18930. }
  18931. },
  18932. updated(el) {
  18933. nextTick(() => {
  18934. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  18935. });
  18936. },
  18937. unmounted() {
  18938. FOCUS_STACK.shift();
  18939. if (FOCUS_STACK.length === 0) {
  18940. document.removeEventListener("keydown", FOCUS_HANDLER);
  18941. }
  18942. }
  18943. };
  18944. 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;/**
  18945. * Checks if an event is supported in the current execution environment.
  18946. *
  18947. * NOTE: This will not work correctly for non-generic events such as `change`,
  18948. * `reset`, `load`, `error`, and `select`.
  18949. *
  18950. * Borrows from Modernizr.
  18951. *
  18952. * @param {string} eventNameSuffix Event name, e.g. "click".
  18953. * @param {?boolean} capture Check if the capture phase is supported.
  18954. * @return {boolean} True if the event is supported.
  18955. * @internal
  18956. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  18957. */
  18958. const mousewheel = function(element, callback) {
  18959. if (element && element.addEventListener) {
  18960. const fn = function(event) {
  18961. const normalized = Y(event);
  18962. callback && Reflect.apply(callback, this, [event, normalized]);
  18963. };
  18964. element.addEventListener("wheel", fn, { passive: true });
  18965. }
  18966. };
  18967. const Mousewheel = {
  18968. beforeMount(el, binding) {
  18969. mousewheel(el, binding.value);
  18970. }
  18971. };
  18972. const basicTimeSpinnerProps = buildProps({
  18973. role: {
  18974. type: String,
  18975. required: true
  18976. },
  18977. spinnerDate: {
  18978. type: definePropType(Object),
  18979. required: true
  18980. },
  18981. showSeconds: {
  18982. type: Boolean,
  18983. default: true
  18984. },
  18985. arrowControl: Boolean,
  18986. amPmMode: {
  18987. type: definePropType(String),
  18988. default: ""
  18989. },
  18990. ...disabledTimeListsProps
  18991. });
  18992. const _sfc_main$25 = /* @__PURE__ */ defineComponent({
  18993. __name: "basic-time-spinner",
  18994. props: basicTimeSpinnerProps,
  18995. emits: ["change", "select-range", "set-option"],
  18996. setup(__props, { emit }) {
  18997. const props = __props;
  18998. const pickerBase = inject("EP_PICKER_BASE");
  18999. const { isRange } = pickerBase.props;
  19000. const ns = useNamespace("time");
  19001. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  19002. let isScrolling = false;
  19003. const currentScrollbar = ref();
  19004. const listHoursRef = ref();
  19005. const listMinutesRef = ref();
  19006. const listSecondsRef = ref();
  19007. const listRefsMap = {
  19008. hours: listHoursRef,
  19009. minutes: listMinutesRef,
  19010. seconds: listSecondsRef
  19011. };
  19012. const spinnerItems = computed(() => {
  19013. return props.showSeconds ? timeUnits$1 : timeUnits$1.slice(0, 2);
  19014. });
  19015. const timePartials = computed(() => {
  19016. const { spinnerDate } = props;
  19017. const hours = spinnerDate.hour();
  19018. const minutes = spinnerDate.minute();
  19019. const seconds = spinnerDate.second();
  19020. return { hours, minutes, seconds };
  19021. });
  19022. const timeList = computed(() => {
  19023. const { hours, minutes } = unref(timePartials);
  19024. const { role, spinnerDate } = props;
  19025. const compare = !isRange ? spinnerDate : void 0;
  19026. return {
  19027. hours: getHoursList(role, compare),
  19028. minutes: getMinutesList(hours, role, compare),
  19029. seconds: getSecondsList(hours, minutes, role, compare)
  19030. };
  19031. });
  19032. const arrowControlTimeList = computed(() => {
  19033. const { hours, minutes, seconds } = unref(timePartials);
  19034. return {
  19035. hours: buildTimeList(hours, 23),
  19036. minutes: buildTimeList(minutes, 59),
  19037. seconds: buildTimeList(seconds, 59)
  19038. };
  19039. });
  19040. const debouncedResetScroll = debounce((type) => {
  19041. isScrolling = false;
  19042. adjustCurrentSpinner(type);
  19043. }, 200);
  19044. const getAmPmFlag = (hour) => {
  19045. const shouldShowAmPm = !!props.amPmMode;
  19046. if (!shouldShowAmPm)
  19047. return "";
  19048. const isCapital = props.amPmMode === "A";
  19049. let content = hour < 12 ? " am" : " pm";
  19050. if (isCapital)
  19051. content = content.toUpperCase();
  19052. return content;
  19053. };
  19054. const emitSelectRange = (type) => {
  19055. let range;
  19056. switch (type) {
  19057. case "hours":
  19058. range = [0, 2];
  19059. break;
  19060. case "minutes":
  19061. range = [3, 5];
  19062. break;
  19063. case "seconds":
  19064. range = [6, 8];
  19065. break;
  19066. }
  19067. const [left, right] = range;
  19068. emit("select-range", left, right);
  19069. currentScrollbar.value = type;
  19070. };
  19071. const adjustCurrentSpinner = (type) => {
  19072. adjustSpinner(type, unref(timePartials)[type]);
  19073. };
  19074. const adjustSpinners = () => {
  19075. adjustCurrentSpinner("hours");
  19076. adjustCurrentSpinner("minutes");
  19077. adjustCurrentSpinner("seconds");
  19078. };
  19079. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  19080. const adjustSpinner = (type, value) => {
  19081. if (props.arrowControl)
  19082. return;
  19083. const scrollbar = unref(listRefsMap[type]);
  19084. if (scrollbar && scrollbar.$el) {
  19085. getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
  19086. }
  19087. };
  19088. const typeItemHeight = (type) => {
  19089. const scrollbar = unref(listRefsMap[type]);
  19090. const listItem = scrollbar == null ? void 0 : scrollbar.$el.querySelector("li");
  19091. if (listItem) {
  19092. return Number.parseFloat(getStyle(listItem, "height")) || 0;
  19093. }
  19094. return 0;
  19095. };
  19096. const onIncrement = () => {
  19097. scrollDown(1);
  19098. };
  19099. const onDecrement = () => {
  19100. scrollDown(-1);
  19101. };
  19102. const scrollDown = (step) => {
  19103. if (!currentScrollbar.value) {
  19104. emitSelectRange("hours");
  19105. }
  19106. const label = currentScrollbar.value;
  19107. const now = unref(timePartials)[label];
  19108. const total = currentScrollbar.value === "hours" ? 24 : 60;
  19109. const next = findNextUnDisabled(label, now, step, total);
  19110. modifyDateField(label, next);
  19111. adjustSpinner(label, next);
  19112. nextTick(() => emitSelectRange(label));
  19113. };
  19114. const findNextUnDisabled = (type, now, step, total) => {
  19115. let next = (now + step + total) % total;
  19116. const list = unref(timeList)[type];
  19117. while (list[next] && next !== now) {
  19118. next = (next + step + total) % total;
  19119. }
  19120. return next;
  19121. };
  19122. const modifyDateField = (type, value) => {
  19123. const list = unref(timeList)[type];
  19124. const isDisabled = list[value];
  19125. if (isDisabled)
  19126. return;
  19127. const { hours, minutes, seconds } = unref(timePartials);
  19128. let changeTo;
  19129. switch (type) {
  19130. case "hours":
  19131. changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
  19132. break;
  19133. case "minutes":
  19134. changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
  19135. break;
  19136. case "seconds":
  19137. changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
  19138. break;
  19139. }
  19140. emit("change", changeTo);
  19141. };
  19142. const handleClick = (type, { value, disabled }) => {
  19143. if (!disabled) {
  19144. modifyDateField(type, value);
  19145. emitSelectRange(type);
  19146. adjustSpinner(type, value);
  19147. }
  19148. };
  19149. const handleScroll = (type) => {
  19150. const scrollbar = unref(listRefsMap[type]);
  19151. if (!scrollbar)
  19152. return;
  19153. isScrolling = true;
  19154. debouncedResetScroll(type);
  19155. const value = Math.min(Math.round((getScrollbarElement(scrollbar.$el).scrollTop - (scrollBarHeight(type) * 0.5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59);
  19156. modifyDateField(type, value);
  19157. };
  19158. const scrollBarHeight = (type) => {
  19159. return unref(listRefsMap[type]).$el.offsetHeight;
  19160. };
  19161. const bindScrollEvent = () => {
  19162. const bindFunction = (type) => {
  19163. const scrollbar = unref(listRefsMap[type]);
  19164. if (scrollbar && scrollbar.$el) {
  19165. getScrollbarElement(scrollbar.$el).onscroll = () => {
  19166. handleScroll(type);
  19167. };
  19168. }
  19169. };
  19170. bindFunction("hours");
  19171. bindFunction("minutes");
  19172. bindFunction("seconds");
  19173. };
  19174. onMounted(() => {
  19175. nextTick(() => {
  19176. !props.arrowControl && bindScrollEvent();
  19177. adjustSpinners();
  19178. if (props.role === "start")
  19179. emitSelectRange("hours");
  19180. });
  19181. });
  19182. const setRef = (scrollbar, type) => {
  19183. listRefsMap[type].value = scrollbar != null ? scrollbar : void 0;
  19184. };
  19185. emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  19186. emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  19187. watch(() => props.spinnerDate, () => {
  19188. if (isScrolling)
  19189. return;
  19190. adjustSpinners();
  19191. });
  19192. return (_ctx, _cache) => {
  19193. return openBlock(), createElementBlock("div", {
  19194. class: normalizeClass([unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }])
  19195. }, [
  19196. !_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(spinnerItems), (item) => {
  19197. return openBlock(), createBlock(unref(ElScrollbar), {
  19198. key: item,
  19199. ref_for: true,
  19200. ref: (scrollbar) => setRef(scrollbar, item),
  19201. class: normalizeClass(unref(ns).be("spinner", "wrapper")),
  19202. "wrap-style": "max-height: inherit;",
  19203. "view-class": unref(ns).be("spinner", "list"),
  19204. noresize: "",
  19205. tag: "ul",
  19206. onMouseenter: ($event) => emitSelectRange(item),
  19207. onMousemove: ($event) => adjustCurrentSpinner(item)
  19208. }, {
  19209. default: withCtx(() => [
  19210. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(timeList)[item], (disabled, key) => {
  19211. return openBlock(), createElementBlock("li", {
  19212. key,
  19213. class: normalizeClass([
  19214. unref(ns).be("spinner", "item"),
  19215. unref(ns).is("active", key === unref(timePartials)[item]),
  19216. unref(ns).is("disabled", disabled)
  19217. ]),
  19218. onClick: ($event) => handleClick(item, { value: key, disabled })
  19219. }, [
  19220. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  19221. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(getAmPmFlag(key)), 1)
  19222. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  19223. createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)
  19224. ], 64))
  19225. ], 10, ["onClick"]);
  19226. }), 128))
  19227. ]),
  19228. _: 2
  19229. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  19230. }), 128)) : createCommentVNode("v-if", true),
  19231. _ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(spinnerItems), (item) => {
  19232. return openBlock(), createElementBlock("div", {
  19233. key: item,
  19234. class: normalizeClass([unref(ns).be("spinner", "wrapper"), unref(ns).is("arrow")]),
  19235. onMouseenter: ($event) => emitSelectRange(item)
  19236. }, [
  19237. withDirectives((openBlock(), createBlock(unref(ElIcon), {
  19238. class: normalizeClass(["arrow-up", unref(ns).be("spinner", "arrow")])
  19239. }, {
  19240. default: withCtx(() => [
  19241. createVNode(unref(arrow_up_default))
  19242. ]),
  19243. _: 1
  19244. }, 8, ["class"])), [
  19245. [unref(vRepeatClick), onDecrement]
  19246. ]),
  19247. withDirectives((openBlock(), createBlock(unref(ElIcon), {
  19248. class: normalizeClass(["arrow-down", unref(ns).be("spinner", "arrow")])
  19249. }, {
  19250. default: withCtx(() => [
  19251. createVNode(unref(arrow_down_default))
  19252. ]),
  19253. _: 1
  19254. }, 8, ["class"])), [
  19255. [unref(vRepeatClick), onIncrement]
  19256. ]),
  19257. createElementVNode("ul", {
  19258. class: normalizeClass(unref(ns).be("spinner", "list"))
  19259. }, [
  19260. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(arrowControlTimeList)[item], (time, key) => {
  19261. return openBlock(), createElementBlock("li", {
  19262. key,
  19263. class: normalizeClass([
  19264. unref(ns).be("spinner", "item"),
  19265. unref(ns).is("active", time === unref(timePartials)[item]),
  19266. unref(ns).is("disabled", unref(timeList)[item][time])
  19267. ])
  19268. }, [
  19269. unref(isNumber)(time) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  19270. item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  19271. createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(getAmPmFlag(time)), 1)
  19272. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  19273. createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)
  19274. ], 64))
  19275. ], 64)) : createCommentVNode("v-if", true)
  19276. ], 2);
  19277. }), 128))
  19278. ], 2)
  19279. ], 42, ["onMouseenter"]);
  19280. }), 128)) : createCommentVNode("v-if", true)
  19281. ], 2);
  19282. };
  19283. }
  19284. });
  19285. var TimeSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$25, [["__file", "basic-time-spinner.vue"]]);
  19286. const _sfc_main$24 = /* @__PURE__ */ defineComponent({
  19287. __name: "panel-time-pick",
  19288. props: panelTimePickerProps,
  19289. emits: ["pick", "select-range", "set-picker-option"],
  19290. setup(__props, { emit }) {
  19291. const props = __props;
  19292. const pickerBase = inject("EP_PICKER_BASE");
  19293. const {
  19294. arrowControl,
  19295. disabledHours,
  19296. disabledMinutes,
  19297. disabledSeconds,
  19298. defaultValue
  19299. } = pickerBase.props;
  19300. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
  19301. const ns = useNamespace("time");
  19302. const { t, lang } = useLocale();
  19303. const selectionRange = ref([0, 2]);
  19304. const oldValue = useOldValue(props);
  19305. const transitionName = computed(() => {
  19306. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  19307. });
  19308. const showSeconds = computed(() => {
  19309. return props.format.includes("ss");
  19310. });
  19311. const amPmMode = computed(() => {
  19312. if (props.format.includes("A"))
  19313. return "A";
  19314. if (props.format.includes("a"))
  19315. return "a";
  19316. return "";
  19317. });
  19318. const isValidValue = (_date) => {
  19319. const parsedDate = dayjs(_date).locale(lang.value);
  19320. const result = getRangeAvailableTime(parsedDate);
  19321. return parsedDate.isSame(result);
  19322. };
  19323. const handleCancel = () => {
  19324. emit("pick", oldValue.value, false);
  19325. };
  19326. const handleConfirm = (visible = false, first = false) => {
  19327. if (first)
  19328. return;
  19329. emit("pick", props.parsedValue, visible);
  19330. };
  19331. const handleChange = (_date) => {
  19332. if (!props.visible) {
  19333. return;
  19334. }
  19335. const result = getRangeAvailableTime(_date).millisecond(0);
  19336. emit("pick", result, true);
  19337. };
  19338. const setSelectionRange = (start, end) => {
  19339. emit("select-range", start, end);
  19340. selectionRange.value = [start, end];
  19341. };
  19342. const changeSelectionRange = (step) => {
  19343. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  19344. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  19345. const index = list.indexOf(selectionRange.value[0]);
  19346. const next = (index + step + list.length) % list.length;
  19347. timePickerOptions["start_emitSelectRange"](mapping[next]);
  19348. };
  19349. const handleKeydown = (event) => {
  19350. const code = event.code;
  19351. const { left, right, up, down } = EVENT_CODE;
  19352. if ([left, right].includes(code)) {
  19353. const step = code === left ? -1 : 1;
  19354. changeSelectionRange(step);
  19355. event.preventDefault();
  19356. return;
  19357. }
  19358. if ([up, down].includes(code)) {
  19359. const step = code === up ? -1 : 1;
  19360. timePickerOptions["start_scrollDown"](step);
  19361. event.preventDefault();
  19362. return;
  19363. }
  19364. };
  19365. const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
  19366. getAvailableHours,
  19367. getAvailableMinutes,
  19368. getAvailableSeconds
  19369. });
  19370. const getRangeAvailableTime = (date) => {
  19371. return getAvailableTime(date, props.datetimeRole || "", true);
  19372. };
  19373. const parseUserInput = (value) => {
  19374. if (!value)
  19375. return null;
  19376. return dayjs(value, props.format).locale(lang.value);
  19377. };
  19378. const formatToString = (value) => {
  19379. if (!value)
  19380. return null;
  19381. return value.format(props.format);
  19382. };
  19383. const getDefaultValue = () => {
  19384. return dayjs(defaultValue).locale(lang.value);
  19385. };
  19386. emit("set-picker-option", ["isValidValue", isValidValue]);
  19387. emit("set-picker-option", ["formatToString", formatToString]);
  19388. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19389. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19390. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19391. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19392. return (_ctx, _cache) => {
  19393. return openBlock(), createBlock(Transition, { name: unref(transitionName) }, {
  19394. default: withCtx(() => [
  19395. _ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
  19396. key: 0,
  19397. class: normalizeClass(unref(ns).b("panel"))
  19398. }, [
  19399. createElementVNode("div", {
  19400. class: normalizeClass([unref(ns).be("panel", "content"), { "has-seconds": unref(showSeconds) }])
  19401. }, [
  19402. createVNode(TimeSpinner, {
  19403. ref: "spinner",
  19404. role: _ctx.datetimeRole || "start",
  19405. "arrow-control": unref(arrowControl),
  19406. "show-seconds": unref(showSeconds),
  19407. "am-pm-mode": unref(amPmMode),
  19408. "spinner-date": _ctx.parsedValue,
  19409. "disabled-hours": unref(disabledHours),
  19410. "disabled-minutes": unref(disabledMinutes),
  19411. "disabled-seconds": unref(disabledSeconds),
  19412. onChange: handleChange,
  19413. onSetOption: unref(onSetOption),
  19414. onSelectRange: setSelectionRange
  19415. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
  19416. ], 2),
  19417. createElementVNode("div", {
  19418. class: normalizeClass(unref(ns).be("panel", "footer"))
  19419. }, [
  19420. createElementVNode("button", {
  19421. type: "button",
  19422. class: normalizeClass([unref(ns).be("panel", "btn"), "cancel"]),
  19423. onClick: handleCancel
  19424. }, toDisplayString(unref(t)("el.datepicker.cancel")), 3),
  19425. createElementVNode("button", {
  19426. type: "button",
  19427. class: normalizeClass([unref(ns).be("panel", "btn"), "confirm"]),
  19428. onClick: ($event) => handleConfirm()
  19429. }, toDisplayString(unref(t)("el.datepicker.confirm")), 11, ["onClick"])
  19430. ], 2)
  19431. ], 2)) : createCommentVNode("v-if", true)
  19432. ]),
  19433. _: 1
  19434. }, 8, ["name"]);
  19435. };
  19436. }
  19437. });
  19438. var TimePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$24, [["__file", "panel-time-pick.vue"]]);
  19439. const panelTimeRangeProps = buildProps({
  19440. ...timePanelSharedProps,
  19441. parsedValue: {
  19442. type: definePropType(Array)
  19443. }
  19444. });
  19445. const _sfc_main$23 = /* @__PURE__ */ defineComponent({
  19446. __name: "panel-time-range",
  19447. props: panelTimeRangeProps,
  19448. emits: ["pick", "select-range", "set-picker-option"],
  19449. setup(__props, { emit }) {
  19450. const props = __props;
  19451. const makeSelectRange = (start, end) => {
  19452. const result = [];
  19453. for (let i = start; i <= end; i++) {
  19454. result.push(i);
  19455. }
  19456. return result;
  19457. };
  19458. const { t, lang } = useLocale();
  19459. const nsTime = useNamespace("time");
  19460. const nsPicker = useNamespace("picker");
  19461. const pickerBase = inject("EP_PICKER_BASE");
  19462. const {
  19463. arrowControl,
  19464. disabledHours,
  19465. disabledMinutes,
  19466. disabledSeconds,
  19467. defaultValue
  19468. } = pickerBase.props;
  19469. const startContainerKls = computed(() => [
  19470. nsTime.be("range-picker", "body"),
  19471. nsTime.be("panel", "content"),
  19472. nsTime.is("arrow", arrowControl),
  19473. showSeconds.value ? "has-seconds" : ""
  19474. ]);
  19475. const endContainerKls = computed(() => [
  19476. nsTime.be("range-picker", "body"),
  19477. nsTime.be("panel", "content"),
  19478. nsTime.is("arrow", arrowControl),
  19479. showSeconds.value ? "has-seconds" : ""
  19480. ]);
  19481. const startTime = computed(() => props.parsedValue[0]);
  19482. const endTime = computed(() => props.parsedValue[1]);
  19483. const oldValue = useOldValue(props);
  19484. const handleCancel = () => {
  19485. emit("pick", oldValue.value, false);
  19486. };
  19487. const showSeconds = computed(() => {
  19488. return props.format.includes("ss");
  19489. });
  19490. const amPmMode = computed(() => {
  19491. if (props.format.includes("A"))
  19492. return "A";
  19493. if (props.format.includes("a"))
  19494. return "a";
  19495. return "";
  19496. });
  19497. const handleConfirm = (visible = false) => {
  19498. emit("pick", [startTime.value, endTime.value], visible);
  19499. };
  19500. const handleMinChange = (date) => {
  19501. handleChange(date.millisecond(0), endTime.value);
  19502. };
  19503. const handleMaxChange = (date) => {
  19504. handleChange(startTime.value, date.millisecond(0));
  19505. };
  19506. const isValidValue = (_date) => {
  19507. const parsedDate = _date.map((_) => dayjs(_).locale(lang.value));
  19508. const result = getRangeAvailableTime(parsedDate);
  19509. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  19510. };
  19511. const handleChange = (start, end) => {
  19512. if (!props.visible) {
  19513. return;
  19514. }
  19515. emit("pick", [start, end], true);
  19516. };
  19517. const btnConfirmDisabled = computed(() => {
  19518. return startTime.value > endTime.value;
  19519. });
  19520. const selectionRange = ref([0, 2]);
  19521. const setMinSelectionRange = (start, end) => {
  19522. emit("select-range", start, end, "min");
  19523. selectionRange.value = [start, end];
  19524. };
  19525. const offset = computed(() => showSeconds.value ? 11 : 8);
  19526. const setMaxSelectionRange = (start, end) => {
  19527. emit("select-range", start, end, "max");
  19528. const _offset = unref(offset);
  19529. selectionRange.value = [start + _offset, end + _offset];
  19530. };
  19531. const changeSelectionRange = (step) => {
  19532. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  19533. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  19534. const index = list.indexOf(selectionRange.value[0]);
  19535. const next = (index + step + list.length) % list.length;
  19536. const half = list.length / 2;
  19537. if (next < half) {
  19538. timePickerOptions["start_emitSelectRange"](mapping[next]);
  19539. } else {
  19540. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  19541. }
  19542. };
  19543. const handleKeydown = (event) => {
  19544. const code = event.code;
  19545. const { left, right, up, down } = EVENT_CODE;
  19546. if ([left, right].includes(code)) {
  19547. const step = code === left ? -1 : 1;
  19548. changeSelectionRange(step);
  19549. event.preventDefault();
  19550. return;
  19551. }
  19552. if ([up, down].includes(code)) {
  19553. const step = code === up ? -1 : 1;
  19554. const role = selectionRange.value[0] < offset.value ? "start" : "end";
  19555. timePickerOptions[`${role}_scrollDown`](step);
  19556. event.preventDefault();
  19557. return;
  19558. }
  19559. };
  19560. const disabledHours_ = (role, compare) => {
  19561. const defaultDisable = disabledHours ? disabledHours(role) : [];
  19562. const isStart = role === "start";
  19563. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19564. const compareHour = compareDate.hour();
  19565. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  19566. return union(defaultDisable, nextDisable);
  19567. };
  19568. const disabledMinutes_ = (hour, role, compare) => {
  19569. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  19570. const isStart = role === "start";
  19571. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19572. const compareHour = compareDate.hour();
  19573. if (hour !== compareHour) {
  19574. return defaultDisable;
  19575. }
  19576. const compareMinute = compareDate.minute();
  19577. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  19578. return union(defaultDisable, nextDisable);
  19579. };
  19580. const disabledSeconds_ = (hour, minute, role, compare) => {
  19581. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  19582. const isStart = role === "start";
  19583. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  19584. const compareHour = compareDate.hour();
  19585. const compareMinute = compareDate.minute();
  19586. if (hour !== compareHour || minute !== compareMinute) {
  19587. return defaultDisable;
  19588. }
  19589. const compareSecond = compareDate.second();
  19590. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  19591. return union(defaultDisable, nextDisable);
  19592. };
  19593. const getRangeAvailableTime = ([start, end]) => {
  19594. return [
  19595. getAvailableTime(start, "start", true, end),
  19596. getAvailableTime(end, "end", false, start)
  19597. ];
  19598. };
  19599. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
  19600. const {
  19601. timePickerOptions,
  19602. getAvailableTime,
  19603. onSetOption
  19604. } = useTimePanel({
  19605. getAvailableHours,
  19606. getAvailableMinutes,
  19607. getAvailableSeconds
  19608. });
  19609. const parseUserInput = (days) => {
  19610. if (!days)
  19611. return null;
  19612. if (isArray$1(days)) {
  19613. return days.map((d) => dayjs(d, props.format).locale(lang.value));
  19614. }
  19615. return dayjs(days, props.format).locale(lang.value);
  19616. };
  19617. const formatToString = (days) => {
  19618. if (!days)
  19619. return null;
  19620. if (isArray$1(days)) {
  19621. return days.map((d) => d.format(props.format));
  19622. }
  19623. return days.format(props.format);
  19624. };
  19625. const getDefaultValue = () => {
  19626. if (isArray$1(defaultValue)) {
  19627. return defaultValue.map((d) => dayjs(d).locale(lang.value));
  19628. }
  19629. const defaultDay = dayjs(defaultValue).locale(lang.value);
  19630. return [defaultDay, defaultDay.add(60, "m")];
  19631. };
  19632. emit("set-picker-option", ["formatToString", formatToString]);
  19633. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  19634. emit("set-picker-option", ["isValidValue", isValidValue]);
  19635. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  19636. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  19637. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  19638. return (_ctx, _cache) => {
  19639. return _ctx.actualVisible ? (openBlock(), createElementBlock("div", {
  19640. key: 0,
  19641. class: normalizeClass([unref(nsTime).b("range-picker"), unref(nsPicker).b("panel")])
  19642. }, [
  19643. createElementVNode("div", {
  19644. class: normalizeClass(unref(nsTime).be("range-picker", "content"))
  19645. }, [
  19646. createElementVNode("div", {
  19647. class: normalizeClass(unref(nsTime).be("range-picker", "cell"))
  19648. }, [
  19649. createElementVNode("div", {
  19650. class: normalizeClass(unref(nsTime).be("range-picker", "header"))
  19651. }, toDisplayString(unref(t)("el.datepicker.startTime")), 3),
  19652. createElementVNode("div", {
  19653. class: normalizeClass(unref(startContainerKls))
  19654. }, [
  19655. createVNode(TimeSpinner, {
  19656. ref: "minSpinner",
  19657. role: "start",
  19658. "show-seconds": unref(showSeconds),
  19659. "am-pm-mode": unref(amPmMode),
  19660. "arrow-control": unref(arrowControl),
  19661. "spinner-date": unref(startTime),
  19662. "disabled-hours": disabledHours_,
  19663. "disabled-minutes": disabledMinutes_,
  19664. "disabled-seconds": disabledSeconds_,
  19665. onChange: handleMinChange,
  19666. onSetOption: unref(onSetOption),
  19667. onSelectRange: setMinSelectionRange
  19668. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  19669. ], 2)
  19670. ], 2),
  19671. createElementVNode("div", {
  19672. class: normalizeClass(unref(nsTime).be("range-picker", "cell"))
  19673. }, [
  19674. createElementVNode("div", {
  19675. class: normalizeClass(unref(nsTime).be("range-picker", "header"))
  19676. }, toDisplayString(unref(t)("el.datepicker.endTime")), 3),
  19677. createElementVNode("div", {
  19678. class: normalizeClass(unref(endContainerKls))
  19679. }, [
  19680. createVNode(TimeSpinner, {
  19681. ref: "maxSpinner",
  19682. role: "end",
  19683. "show-seconds": unref(showSeconds),
  19684. "am-pm-mode": unref(amPmMode),
  19685. "arrow-control": unref(arrowControl),
  19686. "spinner-date": unref(endTime),
  19687. "disabled-hours": disabledHours_,
  19688. "disabled-minutes": disabledMinutes_,
  19689. "disabled-seconds": disabledSeconds_,
  19690. onChange: handleMaxChange,
  19691. onSetOption: unref(onSetOption),
  19692. onSelectRange: setMaxSelectionRange
  19693. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  19694. ], 2)
  19695. ], 2)
  19696. ], 2),
  19697. createElementVNode("div", {
  19698. class: normalizeClass(unref(nsTime).be("panel", "footer"))
  19699. }, [
  19700. createElementVNode("button", {
  19701. type: "button",
  19702. class: normalizeClass([unref(nsTime).be("panel", "btn"), "cancel"]),
  19703. onClick: ($event) => handleCancel()
  19704. }, toDisplayString(unref(t)("el.datepicker.cancel")), 11, ["onClick"]),
  19705. createElementVNode("button", {
  19706. type: "button",
  19707. class: normalizeClass([unref(nsTime).be("panel", "btn"), "confirm"]),
  19708. disabled: unref(btnConfirmDisabled),
  19709. onClick: ($event) => handleConfirm()
  19710. }, toDisplayString(unref(t)("el.datepicker.confirm")), 11, ["disabled", "onClick"])
  19711. ], 2)
  19712. ], 2)) : createCommentVNode("v-if", true);
  19713. };
  19714. }
  19715. });
  19716. var TimeRangePanel = /* @__PURE__ */ _export_sfc(_sfc_main$23, [["__file", "panel-time-range.vue"]]);
  19717. dayjs.extend(customParseFormat);
  19718. var TimePicker = defineComponent({
  19719. name: "ElTimePicker",
  19720. install: null,
  19721. props: {
  19722. ...timePickerDefaultProps,
  19723. isRange: {
  19724. type: Boolean,
  19725. default: false
  19726. }
  19727. },
  19728. emits: ["update:modelValue"],
  19729. setup(props, ctx) {
  19730. const commonPicker = ref();
  19731. const [type, Panel] = props.isRange ? ["timerange", TimeRangePanel] : ["time", TimePickPanel];
  19732. const modelUpdater = (value) => ctx.emit("update:modelValue", value);
  19733. provide("ElPopperOptions", props.popperOptions);
  19734. ctx.expose({
  19735. focus: () => {
  19736. var _a;
  19737. (_a = commonPicker.value) == null ? void 0 : _a.focus();
  19738. },
  19739. blur: () => {
  19740. var _a;
  19741. (_a = commonPicker.value) == null ? void 0 : _a.blur();
  19742. },
  19743. handleOpen: () => {
  19744. var _a;
  19745. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  19746. },
  19747. handleClose: () => {
  19748. var _a;
  19749. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  19750. }
  19751. });
  19752. return () => {
  19753. var _a;
  19754. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_TIME;
  19755. return createVNode(CommonPicker, mergeProps(props, {
  19756. "ref": commonPicker,
  19757. "type": type,
  19758. "format": format,
  19759. "onUpdate:modelValue": modelUpdater
  19760. }), {
  19761. default: (props2) => createVNode(Panel, props2, null)
  19762. });
  19763. };
  19764. }
  19765. });
  19766. const ElTimePicker = withInstall(TimePicker);
  19767. const getPrevMonthLastDays = (date, count) => {
  19768. const lastDay = date.subtract(1, "month").endOf("month").date();
  19769. return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
  19770. };
  19771. const getMonthDays = (date) => {
  19772. const days = date.daysInMonth();
  19773. return rangeArr(days).map((_, index) => index + 1);
  19774. };
  19775. const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
  19776. const start = index * 7;
  19777. return days.slice(start, start + 7);
  19778. });
  19779. const dateTableProps = buildProps({
  19780. selectedDay: {
  19781. type: definePropType(Object)
  19782. },
  19783. range: {
  19784. type: definePropType(Array)
  19785. },
  19786. date: {
  19787. type: definePropType(Object),
  19788. required: true
  19789. },
  19790. hideHeader: {
  19791. type: Boolean
  19792. }
  19793. });
  19794. const dateTableEmits = {
  19795. pick: (value) => isObject$1(value)
  19796. };
  19797. var localeData$1 = {exports: {}};
  19798. (function(module, exports) {
  19799. !function(n, e) {
  19800. module.exports = e() ;
  19801. }(commonjsGlobal, function() {
  19802. return function(n, e, t) {
  19803. var r = e.prototype, o = function(n2) {
  19804. return n2 && (n2.indexOf ? n2 : n2.s);
  19805. }, u = function(n2, e2, t2, r2, u2) {
  19806. var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map(function(n3) {
  19807. return n3.slice(0, r2);
  19808. });
  19809. if (!u2)
  19810. return f;
  19811. var d = i2.weekStart;
  19812. return f.map(function(n3, e3) {
  19813. return f[(e3 + (d || 0)) % 7];
  19814. });
  19815. }, i = function() {
  19816. return t.Ls[t.locale()];
  19817. }, a = function(n2, e2) {
  19818. return n2.formats[e2] || function(n3) {
  19819. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  19820. return e3 || t2.slice(1);
  19821. });
  19822. }(n2.formats[e2.toUpperCase()]);
  19823. }, s = function() {
  19824. var n2 = this;
  19825. return { months: function(e2) {
  19826. return e2 ? e2.format("MMMM") : u(n2, "months");
  19827. }, monthsShort: function(e2) {
  19828. return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3);
  19829. }, firstDayOfWeek: function() {
  19830. return n2.$locale().weekStart || 0;
  19831. }, weekdays: function(e2) {
  19832. return e2 ? e2.format("dddd") : u(n2, "weekdays");
  19833. }, weekdaysMin: function(e2) {
  19834. return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2);
  19835. }, weekdaysShort: function(e2) {
  19836. return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3);
  19837. }, longDateFormat: function(e2) {
  19838. return a(n2.$locale(), e2);
  19839. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  19840. };
  19841. r.localeData = function() {
  19842. return s.bind(this)();
  19843. }, t.localeData = function() {
  19844. var n2 = i();
  19845. return { firstDayOfWeek: function() {
  19846. return n2.weekStart || 0;
  19847. }, weekdays: function() {
  19848. return t.weekdays();
  19849. }, weekdaysShort: function() {
  19850. return t.weekdaysShort();
  19851. }, weekdaysMin: function() {
  19852. return t.weekdaysMin();
  19853. }, months: function() {
  19854. return t.months();
  19855. }, monthsShort: function() {
  19856. return t.monthsShort();
  19857. }, longDateFormat: function(e2) {
  19858. return a(n2, e2);
  19859. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  19860. }, t.months = function() {
  19861. return u(i(), "months");
  19862. }, t.monthsShort = function() {
  19863. return u(i(), "monthsShort", "months", 3);
  19864. }, t.weekdays = function(n2) {
  19865. return u(i(), "weekdays", null, null, n2);
  19866. }, t.weekdaysShort = function(n2) {
  19867. return u(i(), "weekdaysShort", "weekdays", 3, n2);
  19868. }, t.weekdaysMin = function(n2) {
  19869. return u(i(), "weekdaysMin", "weekdays", 2, n2);
  19870. };
  19871. };
  19872. });
  19873. })(localeData$1);
  19874. var localeData = localeData$1.exports;
  19875. const useDateTable = (props, emit) => {
  19876. dayjs.extend(localeData);
  19877. const firstDayOfWeek = dayjs.localeData().firstDayOfWeek();
  19878. const { t, lang } = useLocale();
  19879. const now = dayjs().locale(lang.value);
  19880. const isInRange = computed(() => !!props.range && !!props.range.length);
  19881. const rows = computed(() => {
  19882. let days = [];
  19883. if (isInRange.value) {
  19884. const [start, end] = props.range;
  19885. const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
  19886. text: start.date() + index,
  19887. type: "current"
  19888. }));
  19889. let remaining = currentMonthRange.length % 7;
  19890. remaining = remaining === 0 ? 0 : 7 - remaining;
  19891. const nextMonthRange = rangeArr(remaining).map((_, index) => ({
  19892. text: index + 1,
  19893. type: "next"
  19894. }));
  19895. days = currentMonthRange.concat(nextMonthRange);
  19896. } else {
  19897. const firstDay = props.date.startOf("month").day();
  19898. const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
  19899. text: day,
  19900. type: "prev"
  19901. }));
  19902. const currentMonthDays = getMonthDays(props.date).map((day) => ({
  19903. text: day,
  19904. type: "current"
  19905. }));
  19906. days = [...prevMonthDays, ...currentMonthDays];
  19907. const remaining = 7 - (days.length % 7 || 7);
  19908. const nextMonthDays = rangeArr(remaining).map((_, index) => ({
  19909. text: index + 1,
  19910. type: "next"
  19911. }));
  19912. days = days.concat(nextMonthDays);
  19913. }
  19914. return toNestedArr(days);
  19915. });
  19916. const weekDays = computed(() => {
  19917. const start = firstDayOfWeek;
  19918. if (start === 0) {
  19919. return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
  19920. } else {
  19921. return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
  19922. }
  19923. });
  19924. const getFormattedDate = (day, type) => {
  19925. switch (type) {
  19926. case "prev":
  19927. return props.date.startOf("month").subtract(1, "month").date(day);
  19928. case "next":
  19929. return props.date.startOf("month").add(1, "month").date(day);
  19930. case "current":
  19931. return props.date.date(day);
  19932. }
  19933. };
  19934. const handlePickDay = ({ text, type }) => {
  19935. const date = getFormattedDate(text, type);
  19936. emit("pick", date);
  19937. };
  19938. const getSlotData = ({ text, type }) => {
  19939. const day = getFormattedDate(text, type);
  19940. return {
  19941. isSelected: day.isSame(props.selectedDay),
  19942. type: `${type}-month`,
  19943. day: day.format("YYYY-MM-DD"),
  19944. date: day.toDate()
  19945. };
  19946. };
  19947. return {
  19948. now,
  19949. isInRange,
  19950. rows,
  19951. weekDays,
  19952. getFormattedDate,
  19953. handlePickDay,
  19954. getSlotData
  19955. };
  19956. };
  19957. const __default__$1t = defineComponent({
  19958. name: "DateTable"
  19959. });
  19960. const _sfc_main$22 = /* @__PURE__ */ defineComponent({
  19961. ...__default__$1t,
  19962. props: dateTableProps,
  19963. emits: dateTableEmits,
  19964. setup(__props, { expose, emit }) {
  19965. const props = __props;
  19966. const {
  19967. isInRange,
  19968. now,
  19969. rows,
  19970. weekDays,
  19971. getFormattedDate,
  19972. handlePickDay,
  19973. getSlotData
  19974. } = useDateTable(props, emit);
  19975. const nsTable = useNamespace("calendar-table");
  19976. const nsDay = useNamespace("calendar-day");
  19977. const getCellClass = ({ text, type }) => {
  19978. const classes = [type];
  19979. if (type === "current") {
  19980. const date = getFormattedDate(text, type);
  19981. if (date.isSame(props.selectedDay, "day")) {
  19982. classes.push(nsDay.is("selected"));
  19983. }
  19984. if (date.isSame(now, "day")) {
  19985. classes.push(nsDay.is("today"));
  19986. }
  19987. }
  19988. return classes;
  19989. };
  19990. expose({
  19991. getFormattedDate
  19992. });
  19993. return (_ctx, _cache) => {
  19994. return openBlock(), createElementBlock("table", {
  19995. class: normalizeClass([unref(nsTable).b(), unref(nsTable).is("range", unref(isInRange))]),
  19996. cellspacing: "0",
  19997. cellpadding: "0"
  19998. }, [
  19999. !_ctx.hideHeader ? (openBlock(), createElementBlock("thead", { key: 0 }, [
  20000. createElementVNode("tr", null, [
  20001. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(weekDays), (day) => {
  20002. return openBlock(), createElementBlock("th", {
  20003. key: day,
  20004. scope: "col"
  20005. }, toDisplayString(day), 1);
  20006. }), 128))
  20007. ])
  20008. ])) : createCommentVNode("v-if", true),
  20009. createElementVNode("tbody", null, [
  20010. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, index) => {
  20011. return openBlock(), createElementBlock("tr", {
  20012. key: index,
  20013. class: normalizeClass({
  20014. [unref(nsTable).e("row")]: true,
  20015. [unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader
  20016. })
  20017. }, [
  20018. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key) => {
  20019. return openBlock(), createElementBlock("td", {
  20020. key,
  20021. class: normalizeClass(getCellClass(cell)),
  20022. onClick: ($event) => unref(handlePickDay)(cell)
  20023. }, [
  20024. createElementVNode("div", {
  20025. class: normalizeClass(unref(nsDay).b())
  20026. }, [
  20027. renderSlot(_ctx.$slots, "date-cell", {
  20028. data: unref(getSlotData)(cell)
  20029. }, () => [
  20030. createElementVNode("span", null, toDisplayString(cell.text), 1)
  20031. ])
  20032. ], 2)
  20033. ], 10, ["onClick"]);
  20034. }), 128))
  20035. ], 2);
  20036. }), 128))
  20037. ])
  20038. ], 2);
  20039. };
  20040. }
  20041. });
  20042. var DateTable$1 = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__file", "date-table.vue"]]);
  20043. const adjacentMonth = (start, end) => {
  20044. const firstMonthLastDay = start.endOf("month");
  20045. const lastMonthFirstDay = end.startOf("month");
  20046. const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
  20047. const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  20048. return [
  20049. [start, firstMonthLastDay],
  20050. [lastMonthStartDay.startOf("week"), end]
  20051. ];
  20052. };
  20053. const threeConsecutiveMonth = (start, end) => {
  20054. const firstMonthLastDay = start.endOf("month");
  20055. const secondMonthFirstDay = start.add(1, "month").startOf("month");
  20056. const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
  20057. const secondMonthLastDay = secondMonthStartDay.endOf("month");
  20058. const lastMonthFirstDay = end.startOf("month");
  20059. const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  20060. return [
  20061. [start, firstMonthLastDay],
  20062. [secondMonthStartDay.startOf("week"), secondMonthLastDay],
  20063. [lastMonthStartDay.startOf("week"), end]
  20064. ];
  20065. };
  20066. const useCalendar = (props, emit, componentName) => {
  20067. const { lang } = useLocale();
  20068. const selectedDay = ref();
  20069. const now = dayjs().locale(lang.value);
  20070. const realSelectedDay = computed({
  20071. get() {
  20072. if (!props.modelValue)
  20073. return selectedDay.value;
  20074. return date.value;
  20075. },
  20076. set(val) {
  20077. if (!val)
  20078. return;
  20079. selectedDay.value = val;
  20080. const result = val.toDate();
  20081. emit(INPUT_EVENT, result);
  20082. emit(UPDATE_MODEL_EVENT, result);
  20083. }
  20084. });
  20085. const validatedRange = computed(() => {
  20086. if (!props.range || !isArray$1(props.range) || props.range.length !== 2 || props.range.some((item) => !isDate$1(item)))
  20087. return [];
  20088. const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value));
  20089. const [startDayjs, endDayjs] = rangeArrDayjs;
  20090. if (startDayjs.isAfter(endDayjs)) {
  20091. return [];
  20092. }
  20093. if (startDayjs.isSame(endDayjs, "month")) {
  20094. return calculateValidatedDateRange(startDayjs, endDayjs);
  20095. } else {
  20096. if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
  20097. return [];
  20098. }
  20099. return calculateValidatedDateRange(startDayjs, endDayjs);
  20100. }
  20101. });
  20102. const date = computed(() => {
  20103. if (!props.modelValue) {
  20104. return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
  20105. } else {
  20106. return dayjs(props.modelValue).locale(lang.value);
  20107. }
  20108. });
  20109. const prevMonthDayjs = computed(() => date.value.subtract(1, "month").date(1));
  20110. const nextMonthDayjs = computed(() => date.value.add(1, "month").date(1));
  20111. const prevYearDayjs = computed(() => date.value.subtract(1, "year").date(1));
  20112. const nextYearDayjs = computed(() => date.value.add(1, "year").date(1));
  20113. const calculateValidatedDateRange = (startDayjs, endDayjs) => {
  20114. const firstDay = startDayjs.startOf("week");
  20115. const lastDay = endDayjs.endOf("week");
  20116. const firstMonth = firstDay.get("month");
  20117. const lastMonth = lastDay.get("month");
  20118. if (firstMonth === lastMonth) {
  20119. return [[firstDay, lastDay]];
  20120. } else if ((firstMonth + 1) % 12 === lastMonth) {
  20121. return adjacentMonth(firstDay, lastDay);
  20122. } else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
  20123. return threeConsecutiveMonth(firstDay, lastDay);
  20124. } else {
  20125. return [];
  20126. }
  20127. };
  20128. const pickDay = (day) => {
  20129. realSelectedDay.value = day;
  20130. };
  20131. const selectDate = (type) => {
  20132. const dateMap = {
  20133. "prev-month": prevMonthDayjs.value,
  20134. "next-month": nextMonthDayjs.value,
  20135. "prev-year": prevYearDayjs.value,
  20136. "next-year": nextYearDayjs.value,
  20137. today: now
  20138. };
  20139. const day = dateMap[type];
  20140. if (!day.isSame(date.value, "day")) {
  20141. pickDay(day);
  20142. }
  20143. };
  20144. return {
  20145. calculateValidatedDateRange,
  20146. date,
  20147. realSelectedDay,
  20148. pickDay,
  20149. selectDate,
  20150. validatedRange
  20151. };
  20152. };
  20153. const isValidRange$1 = (range) => isArray$1(range) && range.length === 2 && range.every((item) => isDate$1(item));
  20154. const calendarProps = buildProps({
  20155. modelValue: {
  20156. type: Date
  20157. },
  20158. range: {
  20159. type: definePropType(Array),
  20160. validator: isValidRange$1
  20161. }
  20162. });
  20163. const calendarEmits = {
  20164. [UPDATE_MODEL_EVENT]: (value) => isDate$1(value),
  20165. [INPUT_EVENT]: (value) => isDate$1(value)
  20166. };
  20167. const COMPONENT_NAME$g = "ElCalendar";
  20168. const __default__$1s = defineComponent({
  20169. name: COMPONENT_NAME$g
  20170. });
  20171. const _sfc_main$21 = /* @__PURE__ */ defineComponent({
  20172. ...__default__$1s,
  20173. props: calendarProps,
  20174. emits: calendarEmits,
  20175. setup(__props, { expose, emit }) {
  20176. const props = __props;
  20177. const ns = useNamespace("calendar");
  20178. const {
  20179. calculateValidatedDateRange,
  20180. date,
  20181. pickDay,
  20182. realSelectedDay,
  20183. selectDate,
  20184. validatedRange
  20185. } = useCalendar(props, emit);
  20186. const { t } = useLocale();
  20187. const i18nDate = computed(() => {
  20188. const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
  20189. return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
  20190. });
  20191. expose({
  20192. selectedDay: realSelectedDay,
  20193. pickDay,
  20194. selectDate,
  20195. calculateValidatedDateRange
  20196. });
  20197. return (_ctx, _cache) => {
  20198. return openBlock(), createElementBlock("div", {
  20199. class: normalizeClass(unref(ns).b())
  20200. }, [
  20201. createElementVNode("div", {
  20202. class: normalizeClass(unref(ns).e("header"))
  20203. }, [
  20204. renderSlot(_ctx.$slots, "header", { date: unref(i18nDate) }, () => [
  20205. createElementVNode("div", {
  20206. class: normalizeClass(unref(ns).e("title"))
  20207. }, toDisplayString(unref(i18nDate)), 3),
  20208. unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
  20209. key: 0,
  20210. class: normalizeClass(unref(ns).e("button-group"))
  20211. }, [
  20212. createVNode(unref(ElButtonGroup$1), null, {
  20213. default: withCtx(() => [
  20214. createVNode(unref(ElButton), {
  20215. size: "small",
  20216. onClick: ($event) => unref(selectDate)("prev-month")
  20217. }, {
  20218. default: withCtx(() => [
  20219. createTextVNode(toDisplayString(unref(t)("el.datepicker.prevMonth")), 1)
  20220. ]),
  20221. _: 1
  20222. }, 8, ["onClick"]),
  20223. createVNode(unref(ElButton), {
  20224. size: "small",
  20225. onClick: ($event) => unref(selectDate)("today")
  20226. }, {
  20227. default: withCtx(() => [
  20228. createTextVNode(toDisplayString(unref(t)("el.datepicker.today")), 1)
  20229. ]),
  20230. _: 1
  20231. }, 8, ["onClick"]),
  20232. createVNode(unref(ElButton), {
  20233. size: "small",
  20234. onClick: ($event) => unref(selectDate)("next-month")
  20235. }, {
  20236. default: withCtx(() => [
  20237. createTextVNode(toDisplayString(unref(t)("el.datepicker.nextMonth")), 1)
  20238. ]),
  20239. _: 1
  20240. }, 8, ["onClick"])
  20241. ]),
  20242. _: 1
  20243. })
  20244. ], 2)) : createCommentVNode("v-if", true)
  20245. ])
  20246. ], 2),
  20247. unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
  20248. key: 0,
  20249. class: normalizeClass(unref(ns).e("body"))
  20250. }, [
  20251. createVNode(DateTable$1, {
  20252. date: unref(date),
  20253. "selected-day": unref(realSelectedDay),
  20254. onPick: unref(pickDay)
  20255. }, createSlots({
  20256. _: 2
  20257. }, [
  20258. _ctx.$slots["date-cell"] ? {
  20259. name: "date-cell",
  20260. fn: withCtx((data) => [
  20261. renderSlot(_ctx.$slots, "date-cell", normalizeProps(guardReactiveProps(data)))
  20262. ])
  20263. } : void 0
  20264. ]), 1032, ["date", "selected-day", "onPick"])
  20265. ], 2)) : (openBlock(), createElementBlock("div", {
  20266. key: 1,
  20267. class: normalizeClass(unref(ns).e("body"))
  20268. }, [
  20269. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(validatedRange), (range_, index) => {
  20270. return openBlock(), createBlock(DateTable$1, {
  20271. key: index,
  20272. date: range_[0],
  20273. "selected-day": unref(realSelectedDay),
  20274. range: range_,
  20275. "hide-header": index !== 0,
  20276. onPick: unref(pickDay)
  20277. }, createSlots({
  20278. _: 2
  20279. }, [
  20280. _ctx.$slots["date-cell"] ? {
  20281. name: "date-cell",
  20282. fn: withCtx((data) => [
  20283. renderSlot(_ctx.$slots, "date-cell", normalizeProps(guardReactiveProps(data)))
  20284. ])
  20285. } : void 0
  20286. ]), 1032, ["date", "selected-day", "range", "hide-header", "onPick"]);
  20287. }), 128))
  20288. ], 2))
  20289. ], 2);
  20290. };
  20291. }
  20292. });
  20293. var Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$21, [["__file", "calendar.vue"]]);
  20294. const ElCalendar = withInstall(Calendar);
  20295. const cardProps = buildProps({
  20296. header: {
  20297. type: String,
  20298. default: ""
  20299. },
  20300. footer: {
  20301. type: String,
  20302. default: ""
  20303. },
  20304. bodyStyle: {
  20305. type: definePropType([String, Object, Array]),
  20306. default: ""
  20307. },
  20308. bodyClass: String,
  20309. shadow: {
  20310. type: String,
  20311. values: ["always", "hover", "never"],
  20312. default: "always"
  20313. }
  20314. });
  20315. const __default__$1r = defineComponent({
  20316. name: "ElCard"
  20317. });
  20318. const _sfc_main$20 = /* @__PURE__ */ defineComponent({
  20319. ...__default__$1r,
  20320. props: cardProps,
  20321. setup(__props) {
  20322. const ns = useNamespace("card");
  20323. return (_ctx, _cache) => {
  20324. return openBlock(), createElementBlock("div", {
  20325. class: normalizeClass([unref(ns).b(), unref(ns).is(`${_ctx.shadow}-shadow`)])
  20326. }, [
  20327. _ctx.$slots.header || _ctx.header ? (openBlock(), createElementBlock("div", {
  20328. key: 0,
  20329. class: normalizeClass(unref(ns).e("header"))
  20330. }, [
  20331. renderSlot(_ctx.$slots, "header", {}, () => [
  20332. createTextVNode(toDisplayString(_ctx.header), 1)
  20333. ])
  20334. ], 2)) : createCommentVNode("v-if", true),
  20335. createElementVNode("div", {
  20336. class: normalizeClass([unref(ns).e("body"), _ctx.bodyClass]),
  20337. style: normalizeStyle(_ctx.bodyStyle)
  20338. }, [
  20339. renderSlot(_ctx.$slots, "default")
  20340. ], 6),
  20341. _ctx.$slots.footer || _ctx.footer ? (openBlock(), createElementBlock("div", {
  20342. key: 1,
  20343. class: normalizeClass(unref(ns).e("footer"))
  20344. }, [
  20345. renderSlot(_ctx.$slots, "footer", {}, () => [
  20346. createTextVNode(toDisplayString(_ctx.footer), 1)
  20347. ])
  20348. ], 2)) : createCommentVNode("v-if", true)
  20349. ], 2);
  20350. };
  20351. }
  20352. });
  20353. var Card = /* @__PURE__ */ _export_sfc(_sfc_main$20, [["__file", "card.vue"]]);
  20354. const ElCard = withInstall(Card);
  20355. const carouselProps = buildProps({
  20356. initialIndex: {
  20357. type: Number,
  20358. default: 0
  20359. },
  20360. height: {
  20361. type: String,
  20362. default: ""
  20363. },
  20364. trigger: {
  20365. type: String,
  20366. values: ["hover", "click"],
  20367. default: "hover"
  20368. },
  20369. autoplay: {
  20370. type: Boolean,
  20371. default: true
  20372. },
  20373. interval: {
  20374. type: Number,
  20375. default: 3e3
  20376. },
  20377. indicatorPosition: {
  20378. type: String,
  20379. values: ["", "none", "outside"],
  20380. default: ""
  20381. },
  20382. arrow: {
  20383. type: String,
  20384. values: ["always", "hover", "never"],
  20385. default: "hover"
  20386. },
  20387. type: {
  20388. type: String,
  20389. values: ["", "card"],
  20390. default: ""
  20391. },
  20392. cardScale: {
  20393. type: Number,
  20394. default: 0.83
  20395. },
  20396. loop: {
  20397. type: Boolean,
  20398. default: true
  20399. },
  20400. direction: {
  20401. type: String,
  20402. values: ["horizontal", "vertical"],
  20403. default: "horizontal"
  20404. },
  20405. pauseOnHover: {
  20406. type: Boolean,
  20407. default: true
  20408. },
  20409. motionBlur: Boolean
  20410. });
  20411. const carouselEmits = {
  20412. change: (current, prev) => [current, prev].every(isNumber)
  20413. };
  20414. const carouselContextKey = Symbol("carouselContextKey");
  20415. const CAROUSEL_ITEM_NAME = "ElCarouselItem";
  20416. const THROTTLE_TIME = 300;
  20417. const useCarousel = (props, emit, componentName) => {
  20418. const {
  20419. children: items,
  20420. addChild: addItem,
  20421. removeChild: removeItem
  20422. } = useOrderedChildren(getCurrentInstance(), CAROUSEL_ITEM_NAME);
  20423. const slots = useSlots();
  20424. const activeIndex = ref(-1);
  20425. const timer = ref(null);
  20426. const hover = ref(false);
  20427. const root = ref();
  20428. const containerHeight = ref(0);
  20429. const isItemsTwoLength = ref(true);
  20430. const isFirstCall = ref(true);
  20431. const isTransitioning = ref(false);
  20432. const arrowDisplay = computed(() => props.arrow !== "never" && !unref(isVertical));
  20433. const hasLabel = computed(() => {
  20434. return items.value.some((item) => item.props.label.toString().length > 0);
  20435. });
  20436. const isCardType = computed(() => props.type === "card");
  20437. const isVertical = computed(() => props.direction === "vertical");
  20438. const containerStyle = computed(() => {
  20439. if (props.height !== "auto") {
  20440. return {
  20441. height: props.height
  20442. };
  20443. }
  20444. return {
  20445. height: `${containerHeight.value}px`,
  20446. overflow: "hidden"
  20447. };
  20448. });
  20449. const throttledArrowClick = throttle((index) => {
  20450. setActiveItem(index);
  20451. }, THROTTLE_TIME, { trailing: true });
  20452. const throttledIndicatorHover = throttle((index) => {
  20453. handleIndicatorHover(index);
  20454. }, THROTTLE_TIME);
  20455. const isTwoLengthShow = (index) => {
  20456. if (!isItemsTwoLength.value)
  20457. return true;
  20458. return activeIndex.value <= 1 ? index <= 1 : index > 1;
  20459. };
  20460. function pauseTimer() {
  20461. if (timer.value) {
  20462. clearInterval(timer.value);
  20463. timer.value = null;
  20464. }
  20465. }
  20466. function startTimer() {
  20467. if (props.interval <= 0 || !props.autoplay || timer.value)
  20468. return;
  20469. timer.value = setInterval(() => playSlides(), props.interval);
  20470. }
  20471. const playSlides = () => {
  20472. if (!isFirstCall.value) {
  20473. isTransitioning.value = true;
  20474. }
  20475. isFirstCall.value = false;
  20476. if (activeIndex.value < items.value.length - 1) {
  20477. activeIndex.value = activeIndex.value + 1;
  20478. } else if (props.loop) {
  20479. activeIndex.value = 0;
  20480. } else {
  20481. isTransitioning.value = false;
  20482. }
  20483. };
  20484. function setActiveItem(index) {
  20485. if (!isFirstCall.value) {
  20486. isTransitioning.value = true;
  20487. }
  20488. isFirstCall.value = false;
  20489. if (isString$1(index)) {
  20490. const filteredItems = items.value.filter((item) => item.props.name === index);
  20491. if (filteredItems.length > 0) {
  20492. index = items.value.indexOf(filteredItems[0]);
  20493. }
  20494. }
  20495. index = Number(index);
  20496. if (Number.isNaN(index) || index !== Math.floor(index)) {
  20497. return;
  20498. }
  20499. const itemCount = items.value.length;
  20500. const oldIndex = activeIndex.value;
  20501. if (index < 0) {
  20502. activeIndex.value = props.loop ? itemCount - 1 : 0;
  20503. } else if (index >= itemCount) {
  20504. activeIndex.value = props.loop ? 0 : itemCount - 1;
  20505. } else {
  20506. activeIndex.value = index;
  20507. }
  20508. if (oldIndex === activeIndex.value) {
  20509. resetItemPosition(oldIndex);
  20510. }
  20511. resetTimer();
  20512. }
  20513. function resetItemPosition(oldIndex) {
  20514. items.value.forEach((item, index) => {
  20515. item.translateItem(index, activeIndex.value, oldIndex);
  20516. });
  20517. }
  20518. function itemInStage(item, index) {
  20519. var _a, _b, _c, _d;
  20520. const _items = unref(items);
  20521. const itemCount = _items.length;
  20522. if (itemCount === 0 || !item.states.inStage)
  20523. return false;
  20524. const nextItemIndex = index + 1;
  20525. const prevItemIndex = index - 1;
  20526. const lastItemIndex = itemCount - 1;
  20527. const isLastItemActive = _items[lastItemIndex].states.active;
  20528. const isFirstItemActive = _items[0].states.active;
  20529. const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
  20530. const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
  20531. if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
  20532. return "left";
  20533. } else if (index === 0 && isLastItemActive || isPrevItemActive) {
  20534. return "right";
  20535. }
  20536. return false;
  20537. }
  20538. function handleMouseEnter() {
  20539. hover.value = true;
  20540. if (props.pauseOnHover) {
  20541. pauseTimer();
  20542. }
  20543. }
  20544. function handleMouseLeave() {
  20545. hover.value = false;
  20546. startTimer();
  20547. }
  20548. function handleTransitionEnd() {
  20549. isTransitioning.value = false;
  20550. }
  20551. function handleButtonEnter(arrow) {
  20552. if (unref(isVertical))
  20553. return;
  20554. items.value.forEach((item, index) => {
  20555. if (arrow === itemInStage(item, index)) {
  20556. item.states.hover = true;
  20557. }
  20558. });
  20559. }
  20560. function handleButtonLeave() {
  20561. if (unref(isVertical))
  20562. return;
  20563. items.value.forEach((item) => {
  20564. item.states.hover = false;
  20565. });
  20566. }
  20567. function handleIndicatorClick(index) {
  20568. if (index !== activeIndex.value) {
  20569. if (!isFirstCall.value) {
  20570. isTransitioning.value = true;
  20571. }
  20572. }
  20573. activeIndex.value = index;
  20574. }
  20575. function handleIndicatorHover(index) {
  20576. if (props.trigger === "hover" && index !== activeIndex.value) {
  20577. activeIndex.value = index;
  20578. if (!isFirstCall.value) {
  20579. isTransitioning.value = true;
  20580. }
  20581. }
  20582. }
  20583. function prev() {
  20584. setActiveItem(activeIndex.value - 1);
  20585. }
  20586. function next() {
  20587. setActiveItem(activeIndex.value + 1);
  20588. }
  20589. function resetTimer() {
  20590. pauseTimer();
  20591. if (!props.pauseOnHover)
  20592. startTimer();
  20593. }
  20594. function setContainerHeight(height) {
  20595. if (props.height !== "auto")
  20596. return;
  20597. containerHeight.value = height;
  20598. }
  20599. function PlaceholderItem() {
  20600. var _a;
  20601. const defaultSlots = (_a = slots.default) == null ? void 0 : _a.call(slots);
  20602. if (!defaultSlots)
  20603. return null;
  20604. const flatSlots = flattedChildren(defaultSlots);
  20605. const normalizeSlots = flatSlots.filter((slot) => {
  20606. return isVNode(slot) && slot.type.name === CAROUSEL_ITEM_NAME;
  20607. });
  20608. if ((normalizeSlots == null ? void 0 : normalizeSlots.length) === 2 && props.loop && !isCardType.value) {
  20609. isItemsTwoLength.value = true;
  20610. return normalizeSlots;
  20611. }
  20612. isItemsTwoLength.value = false;
  20613. return null;
  20614. }
  20615. watch(() => activeIndex.value, (current, prev2) => {
  20616. resetItemPosition(prev2);
  20617. if (isItemsTwoLength.value) {
  20618. current = current % 2;
  20619. prev2 = prev2 % 2;
  20620. }
  20621. if (prev2 > -1) {
  20622. emit("change", current, prev2);
  20623. }
  20624. });
  20625. watch(() => props.autoplay, (autoplay) => {
  20626. autoplay ? startTimer() : pauseTimer();
  20627. });
  20628. watch(() => props.loop, () => {
  20629. setActiveItem(activeIndex.value);
  20630. });
  20631. watch(() => props.interval, () => {
  20632. resetTimer();
  20633. });
  20634. const resizeObserver = shallowRef();
  20635. onMounted(() => {
  20636. watch(() => items.value, () => {
  20637. if (items.value.length > 0)
  20638. setActiveItem(props.initialIndex);
  20639. }, {
  20640. immediate: true
  20641. });
  20642. resizeObserver.value = useResizeObserver(root.value, () => {
  20643. resetItemPosition();
  20644. });
  20645. startTimer();
  20646. });
  20647. onBeforeUnmount(() => {
  20648. pauseTimer();
  20649. if (root.value && resizeObserver.value)
  20650. resizeObserver.value.stop();
  20651. });
  20652. provide(carouselContextKey, {
  20653. root,
  20654. isCardType,
  20655. isVertical,
  20656. items,
  20657. loop: props.loop,
  20658. cardScale: props.cardScale,
  20659. addItem,
  20660. removeItem,
  20661. setActiveItem,
  20662. setContainerHeight
  20663. });
  20664. return {
  20665. root,
  20666. activeIndex,
  20667. arrowDisplay,
  20668. hasLabel,
  20669. hover,
  20670. isCardType,
  20671. isTransitioning,
  20672. items,
  20673. isVertical,
  20674. containerStyle,
  20675. isItemsTwoLength,
  20676. handleButtonEnter,
  20677. handleTransitionEnd,
  20678. handleButtonLeave,
  20679. handleIndicatorClick,
  20680. handleMouseEnter,
  20681. handleMouseLeave,
  20682. setActiveItem,
  20683. prev,
  20684. next,
  20685. PlaceholderItem,
  20686. isTwoLengthShow,
  20687. throttledArrowClick,
  20688. throttledIndicatorHover
  20689. };
  20690. };
  20691. const COMPONENT_NAME$f = "ElCarousel";
  20692. const __default__$1q = defineComponent({
  20693. name: COMPONENT_NAME$f
  20694. });
  20695. const _sfc_main$1$ = /* @__PURE__ */ defineComponent({
  20696. ...__default__$1q,
  20697. props: carouselProps,
  20698. emits: carouselEmits,
  20699. setup(__props, { expose, emit }) {
  20700. const props = __props;
  20701. const {
  20702. root,
  20703. activeIndex,
  20704. arrowDisplay,
  20705. hasLabel,
  20706. hover,
  20707. isCardType,
  20708. items,
  20709. isVertical,
  20710. containerStyle,
  20711. handleButtonEnter,
  20712. handleButtonLeave,
  20713. isTransitioning,
  20714. handleIndicatorClick,
  20715. handleMouseEnter,
  20716. handleMouseLeave,
  20717. handleTransitionEnd,
  20718. setActiveItem,
  20719. prev,
  20720. next,
  20721. PlaceholderItem,
  20722. isTwoLengthShow,
  20723. throttledArrowClick,
  20724. throttledIndicatorHover
  20725. } = useCarousel(props, emit);
  20726. const ns = useNamespace("carousel");
  20727. const { t } = useLocale();
  20728. const carouselClasses = computed(() => {
  20729. const classes = [ns.b(), ns.m(props.direction)];
  20730. if (unref(isCardType)) {
  20731. classes.push(ns.m("card"));
  20732. }
  20733. return classes;
  20734. });
  20735. const carouselContainer = computed(() => {
  20736. const classes = [ns.e("container")];
  20737. if (props.motionBlur && unref(isTransitioning) && items.value.length > 1) {
  20738. classes.push(unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`);
  20739. }
  20740. return classes;
  20741. });
  20742. const indicatorsClasses = computed(() => {
  20743. const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
  20744. if (unref(hasLabel)) {
  20745. classes.push(ns.em("indicators", "labels"));
  20746. }
  20747. if (props.indicatorPosition === "outside") {
  20748. classes.push(ns.em("indicators", "outside"));
  20749. }
  20750. if (unref(isVertical)) {
  20751. classes.push(ns.em("indicators", "right"));
  20752. }
  20753. return classes;
  20754. });
  20755. expose({
  20756. activeIndex,
  20757. setActiveItem,
  20758. prev,
  20759. next
  20760. });
  20761. return (_ctx, _cache) => {
  20762. return openBlock(), createElementBlock("div", {
  20763. ref_key: "root",
  20764. ref: root,
  20765. class: normalizeClass(unref(carouselClasses)),
  20766. onMouseenter: withModifiers(unref(handleMouseEnter), ["stop"]),
  20767. onMouseleave: withModifiers(unref(handleMouseLeave), ["stop"])
  20768. }, [
  20769. unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
  20770. key: 0,
  20771. name: "carousel-arrow-left",
  20772. persisted: ""
  20773. }, {
  20774. default: withCtx(() => [
  20775. withDirectives(createElementVNode("button", {
  20776. type: "button",
  20777. class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "left")]),
  20778. "aria-label": unref(t)("el.carousel.leftArrow"),
  20779. onMouseenter: ($event) => unref(handleButtonEnter)("left"),
  20780. onMouseleave: unref(handleButtonLeave),
  20781. onClick: withModifiers(($event) => unref(throttledArrowClick)(unref(activeIndex) - 1), ["stop"])
  20782. }, [
  20783. createVNode(unref(ElIcon), null, {
  20784. default: withCtx(() => [
  20785. createVNode(unref(arrow_left_default))
  20786. ]),
  20787. _: 1
  20788. })
  20789. ], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
  20790. [
  20791. vShow,
  20792. (_ctx.arrow === "always" || unref(hover)) && (props.loop || unref(activeIndex) > 0)
  20793. ]
  20794. ])
  20795. ]),
  20796. _: 1
  20797. })) : createCommentVNode("v-if", true),
  20798. unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
  20799. key: 1,
  20800. name: "carousel-arrow-right",
  20801. persisted: ""
  20802. }, {
  20803. default: withCtx(() => [
  20804. withDirectives(createElementVNode("button", {
  20805. type: "button",
  20806. class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "right")]),
  20807. "aria-label": unref(t)("el.carousel.rightArrow"),
  20808. onMouseenter: ($event) => unref(handleButtonEnter)("right"),
  20809. onMouseleave: unref(handleButtonLeave),
  20810. onClick: withModifiers(($event) => unref(throttledArrowClick)(unref(activeIndex) + 1), ["stop"])
  20811. }, [
  20812. createVNode(unref(ElIcon), null, {
  20813. default: withCtx(() => [
  20814. createVNode(unref(arrow_right_default))
  20815. ]),
  20816. _: 1
  20817. })
  20818. ], 42, ["aria-label", "onMouseenter", "onMouseleave", "onClick"]), [
  20819. [
  20820. vShow,
  20821. (_ctx.arrow === "always" || unref(hover)) && (props.loop || unref(activeIndex) < unref(items).length - 1)
  20822. ]
  20823. ])
  20824. ]),
  20825. _: 1
  20826. })) : createCommentVNode("v-if", true),
  20827. createElementVNode("div", {
  20828. class: normalizeClass(unref(carouselContainer)),
  20829. style: normalizeStyle(unref(containerStyle)),
  20830. onTransitionend: unref(handleTransitionEnd)
  20831. }, [
  20832. createVNode(unref(PlaceholderItem)),
  20833. renderSlot(_ctx.$slots, "default")
  20834. ], 46, ["onTransitionend"]),
  20835. _ctx.indicatorPosition !== "none" ? (openBlock(), createElementBlock("ul", {
  20836. key: 2,
  20837. class: normalizeClass(unref(indicatorsClasses))
  20838. }, [
  20839. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item, index) => {
  20840. return withDirectives((openBlock(), createElementBlock("li", {
  20841. key: index,
  20842. class: normalizeClass([
  20843. unref(ns).e("indicator"),
  20844. unref(ns).em("indicator", _ctx.direction),
  20845. unref(ns).is("active", index === unref(activeIndex))
  20846. ]),
  20847. onMouseenter: ($event) => unref(throttledIndicatorHover)(index),
  20848. onClick: withModifiers(($event) => unref(handleIndicatorClick)(index), ["stop"])
  20849. }, [
  20850. createElementVNode("button", {
  20851. class: normalizeClass(unref(ns).e("button")),
  20852. "aria-label": unref(t)("el.carousel.indicator", { index: index + 1 })
  20853. }, [
  20854. unref(hasLabel) ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(item.props.label), 1)) : createCommentVNode("v-if", true)
  20855. ], 10, ["aria-label"])
  20856. ], 42, ["onMouseenter", "onClick"])), [
  20857. [vShow, unref(isTwoLengthShow)(index)]
  20858. ]);
  20859. }), 128))
  20860. ], 2)) : createCommentVNode("v-if", true),
  20861. props.motionBlur ? (openBlock(), createElementBlock("svg", {
  20862. key: 3,
  20863. xmlns: "http://www.w3.org/2000/svg",
  20864. version: "1.1",
  20865. style: { "display": "none" }
  20866. }, [
  20867. createElementVNode("defs", null, [
  20868. createElementVNode("filter", { id: "elCarouselHorizontal" }, [
  20869. createElementVNode("feGaussianBlur", {
  20870. in: "SourceGraphic",
  20871. stdDeviation: "12,0"
  20872. })
  20873. ]),
  20874. createElementVNode("filter", { id: "elCarouselVertical" }, [
  20875. createElementVNode("feGaussianBlur", {
  20876. in: "SourceGraphic",
  20877. stdDeviation: "0,10"
  20878. })
  20879. ])
  20880. ])
  20881. ])) : createCommentVNode("v-if", true)
  20882. ], 42, ["onMouseenter", "onMouseleave"]);
  20883. };
  20884. }
  20885. });
  20886. var Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$1$, [["__file", "carousel.vue"]]);
  20887. const carouselItemProps = buildProps({
  20888. name: { type: String, default: "" },
  20889. label: {
  20890. type: [String, Number],
  20891. default: ""
  20892. }
  20893. });
  20894. const useCarouselItem = (props) => {
  20895. const carouselContext = inject(carouselContextKey);
  20896. const instance = getCurrentInstance();
  20897. const carouselItemRef = ref();
  20898. const hover = ref(false);
  20899. const translate = ref(0);
  20900. const scale = ref(1);
  20901. const active = ref(false);
  20902. const ready = ref(false);
  20903. const inStage = ref(false);
  20904. const animating = ref(false);
  20905. const { isCardType, isVertical, cardScale } = carouselContext;
  20906. function processIndex(index, activeIndex, length) {
  20907. const lastItemIndex = length - 1;
  20908. const prevItemIndex = activeIndex - 1;
  20909. const nextItemIndex = activeIndex + 1;
  20910. const halfItemIndex = length / 2;
  20911. if (activeIndex === 0 && index === lastItemIndex) {
  20912. return -1;
  20913. } else if (activeIndex === lastItemIndex && index === 0) {
  20914. return length;
  20915. } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {
  20916. return length + 1;
  20917. } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {
  20918. return -2;
  20919. }
  20920. return index;
  20921. }
  20922. function calcCardTranslate(index, activeIndex) {
  20923. var _a, _b;
  20924. const parentWidth = unref(isVertical) ? ((_a = carouselContext.root.value) == null ? void 0 : _a.offsetHeight) || 0 : ((_b = carouselContext.root.value) == null ? void 0 : _b.offsetWidth) || 0;
  20925. if (inStage.value) {
  20926. return parentWidth * ((2 - cardScale) * (index - activeIndex) + 1) / 4;
  20927. } else if (index < activeIndex) {
  20928. return -(1 + cardScale) * parentWidth / 4;
  20929. } else {
  20930. return (3 + cardScale) * parentWidth / 4;
  20931. }
  20932. }
  20933. function calcTranslate(index, activeIndex, isVertical2) {
  20934. const rootEl = carouselContext.root.value;
  20935. if (!rootEl)
  20936. return 0;
  20937. const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0;
  20938. return distance * (index - activeIndex);
  20939. }
  20940. const translateItem = (index, activeIndex, oldIndex) => {
  20941. var _a;
  20942. const _isCardType = unref(isCardType);
  20943. const carouselItemLength = (_a = carouselContext.items.value.length) != null ? _a : Number.NaN;
  20944. const isActive = index === activeIndex;
  20945. if (!_isCardType && !isUndefined(oldIndex)) {
  20946. animating.value = isActive || index === oldIndex;
  20947. }
  20948. if (!isActive && carouselItemLength > 2 && carouselContext.loop) {
  20949. index = processIndex(index, activeIndex, carouselItemLength);
  20950. }
  20951. const _isVertical = unref(isVertical);
  20952. active.value = isActive;
  20953. if (_isCardType) {
  20954. inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
  20955. translate.value = calcCardTranslate(index, activeIndex);
  20956. scale.value = unref(active) ? 1 : cardScale;
  20957. } else {
  20958. translate.value = calcTranslate(index, activeIndex, _isVertical);
  20959. }
  20960. ready.value = true;
  20961. if (isActive && carouselItemRef.value) {
  20962. carouselContext.setContainerHeight(carouselItemRef.value.offsetHeight);
  20963. }
  20964. };
  20965. function handleItemClick() {
  20966. if (carouselContext && unref(isCardType)) {
  20967. const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
  20968. carouselContext.setActiveItem(index);
  20969. }
  20970. }
  20971. onMounted(() => {
  20972. carouselContext.addItem({
  20973. props,
  20974. states: reactive({
  20975. hover,
  20976. translate,
  20977. scale,
  20978. active,
  20979. ready,
  20980. inStage,
  20981. animating
  20982. }),
  20983. uid: instance.uid,
  20984. translateItem
  20985. });
  20986. });
  20987. onUnmounted(() => {
  20988. carouselContext.removeItem(instance.uid);
  20989. });
  20990. return {
  20991. carouselItemRef,
  20992. active,
  20993. animating,
  20994. hover,
  20995. inStage,
  20996. isVertical,
  20997. translate,
  20998. isCardType,
  20999. scale,
  21000. ready,
  21001. handleItemClick
  21002. };
  21003. };
  21004. const __default__$1p = defineComponent({
  21005. name: CAROUSEL_ITEM_NAME
  21006. });
  21007. const _sfc_main$1_ = /* @__PURE__ */ defineComponent({
  21008. ...__default__$1p,
  21009. props: carouselItemProps,
  21010. setup(__props) {
  21011. const props = __props;
  21012. const ns = useNamespace("carousel");
  21013. const {
  21014. carouselItemRef,
  21015. active,
  21016. animating,
  21017. hover,
  21018. inStage,
  21019. isVertical,
  21020. translate,
  21021. isCardType,
  21022. scale,
  21023. ready,
  21024. handleItemClick
  21025. } = useCarouselItem(props);
  21026. const itemKls = computed(() => [
  21027. ns.e("item"),
  21028. ns.is("active", active.value),
  21029. ns.is("in-stage", inStage.value),
  21030. ns.is("hover", hover.value),
  21031. ns.is("animating", animating.value),
  21032. {
  21033. [ns.em("item", "card")]: isCardType.value,
  21034. [ns.em("item", "card-vertical")]: isCardType.value && isVertical.value
  21035. }
  21036. ]);
  21037. const itemStyle = computed(() => {
  21038. const translateType = `translate${unref(isVertical) ? "Y" : "X"}`;
  21039. const _translate = `${translateType}(${unref(translate)}px)`;
  21040. const _scale = `scale(${unref(scale)})`;
  21041. const transform = [_translate, _scale].join(" ");
  21042. return {
  21043. transform
  21044. };
  21045. });
  21046. return (_ctx, _cache) => {
  21047. return withDirectives((openBlock(), createElementBlock("div", {
  21048. ref_key: "carouselItemRef",
  21049. ref: carouselItemRef,
  21050. class: normalizeClass(unref(itemKls)),
  21051. style: normalizeStyle(unref(itemStyle)),
  21052. onClick: unref(handleItemClick)
  21053. }, [
  21054. unref(isCardType) ? withDirectives((openBlock(), createElementBlock("div", {
  21055. key: 0,
  21056. class: normalizeClass(unref(ns).e("mask"))
  21057. }, null, 2)), [
  21058. [vShow, !unref(active)]
  21059. ]) : createCommentVNode("v-if", true),
  21060. renderSlot(_ctx.$slots, "default")
  21061. ], 14, ["onClick"])), [
  21062. [vShow, unref(ready)]
  21063. ]);
  21064. };
  21065. }
  21066. });
  21067. var CarouselItem = /* @__PURE__ */ _export_sfc(_sfc_main$1_, [["__file", "carousel-item.vue"]]);
  21068. const ElCarousel = withInstall(Carousel, {
  21069. CarouselItem
  21070. });
  21071. const ElCarouselItem = withNoopInstall(CarouselItem);
  21072. const checkboxProps = {
  21073. modelValue: {
  21074. type: [Number, String, Boolean],
  21075. default: void 0
  21076. },
  21077. label: {
  21078. type: [String, Boolean, Number, Object],
  21079. default: void 0
  21080. },
  21081. value: {
  21082. type: [String, Boolean, Number, Object],
  21083. default: void 0
  21084. },
  21085. indeterminate: Boolean,
  21086. disabled: Boolean,
  21087. checked: Boolean,
  21088. name: {
  21089. type: String,
  21090. default: void 0
  21091. },
  21092. trueValue: {
  21093. type: [String, Number],
  21094. default: void 0
  21095. },
  21096. falseValue: {
  21097. type: [String, Number],
  21098. default: void 0
  21099. },
  21100. trueLabel: {
  21101. type: [String, Number],
  21102. default: void 0
  21103. },
  21104. falseLabel: {
  21105. type: [String, Number],
  21106. default: void 0
  21107. },
  21108. id: {
  21109. type: String,
  21110. default: void 0
  21111. },
  21112. border: Boolean,
  21113. size: useSizeProp,
  21114. tabindex: [String, Number],
  21115. validateEvent: {
  21116. type: Boolean,
  21117. default: true
  21118. },
  21119. ...useAriaProps(["ariaControls"])
  21120. };
  21121. const checkboxEmits = {
  21122. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  21123. change: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  21124. };
  21125. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  21126. const useCheckboxDisabled = ({
  21127. model,
  21128. isChecked
  21129. }) => {
  21130. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21131. const isLimitDisabled = computed(() => {
  21132. var _a, _b;
  21133. const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
  21134. const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
  21135. return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
  21136. });
  21137. const isDisabled = useFormDisabled(computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
  21138. return {
  21139. isDisabled,
  21140. isLimitDisabled
  21141. };
  21142. };
  21143. const useCheckboxEvent = (props, {
  21144. model,
  21145. isLimitExceeded,
  21146. hasOwnLabel,
  21147. isDisabled,
  21148. isLabeledByFormItem
  21149. }) => {
  21150. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21151. const { formItem } = useFormItem();
  21152. const { emit } = getCurrentInstance();
  21153. function getLabeledValue(value) {
  21154. var _a, _b, _c, _d;
  21155. 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;
  21156. }
  21157. function emitChangeEvent(checked, e) {
  21158. emit("change", getLabeledValue(checked), e);
  21159. }
  21160. function handleChange(e) {
  21161. if (isLimitExceeded.value)
  21162. return;
  21163. const target = e.target;
  21164. emit("change", getLabeledValue(target.checked), e);
  21165. }
  21166. async function onClickRoot(e) {
  21167. if (isLimitExceeded.value)
  21168. return;
  21169. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  21170. const eventTargets = e.composedPath();
  21171. const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
  21172. if (!hasLabel) {
  21173. model.value = getLabeledValue([false, props.falseValue, props.falseLabel].includes(model.value));
  21174. await nextTick();
  21175. emitChangeEvent(model.value, e);
  21176. }
  21177. }
  21178. }
  21179. const validateEvent = computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
  21180. watch(() => props.modelValue, () => {
  21181. if (validateEvent.value) {
  21182. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21183. }
  21184. });
  21185. return {
  21186. handleChange,
  21187. onClickRoot
  21188. };
  21189. };
  21190. const useCheckboxModel = (props) => {
  21191. const selfModel = ref(false);
  21192. const { emit } = getCurrentInstance();
  21193. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21194. const isGroup = computed(() => isUndefined(checkboxGroup) === false);
  21195. const isLimitExceeded = ref(false);
  21196. const model = computed({
  21197. get() {
  21198. var _a, _b;
  21199. return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
  21200. },
  21201. set(val) {
  21202. var _a, _b;
  21203. if (isGroup.value && isArray$1(val)) {
  21204. 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;
  21205. isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
  21206. } else {
  21207. emit(UPDATE_MODEL_EVENT, val);
  21208. selfModel.value = val;
  21209. }
  21210. }
  21211. });
  21212. return {
  21213. model,
  21214. isGroup,
  21215. isLimitExceeded
  21216. };
  21217. };
  21218. const useCheckboxStatus = (props, slots, { model }) => {
  21219. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21220. const isFocused = ref(false);
  21221. const actualValue = computed(() => {
  21222. if (!isPropAbsent(props.value)) {
  21223. return props.value;
  21224. }
  21225. return props.label;
  21226. });
  21227. const isChecked = computed(() => {
  21228. const value = model.value;
  21229. if (isBoolean(value)) {
  21230. return value;
  21231. } else if (isArray$1(value)) {
  21232. if (isObject$1(actualValue.value)) {
  21233. return value.map(toRaw).some((o) => isEqual$1(o, actualValue.value));
  21234. } else {
  21235. return value.map(toRaw).includes(actualValue.value);
  21236. }
  21237. } else if (value !== null && value !== void 0) {
  21238. return value === props.trueValue || value === props.trueLabel;
  21239. } else {
  21240. return !!value;
  21241. }
  21242. });
  21243. const checkboxButtonSize = useFormSize(computed(() => {
  21244. var _a;
  21245. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  21246. }), {
  21247. prop: true
  21248. });
  21249. const checkboxSize = useFormSize(computed(() => {
  21250. var _a;
  21251. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  21252. }));
  21253. const hasOwnLabel = computed(() => {
  21254. return !!slots.default || !isPropAbsent(actualValue.value);
  21255. });
  21256. return {
  21257. checkboxButtonSize,
  21258. isChecked,
  21259. isFocused,
  21260. checkboxSize,
  21261. hasOwnLabel,
  21262. actualValue
  21263. };
  21264. };
  21265. const useCheckbox = (props, slots) => {
  21266. const { formItem: elFormItem } = useFormItem();
  21267. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  21268. const {
  21269. isFocused,
  21270. isChecked,
  21271. checkboxButtonSize,
  21272. checkboxSize,
  21273. hasOwnLabel,
  21274. actualValue
  21275. } = useCheckboxStatus(props, slots, { model });
  21276. const { isDisabled } = useCheckboxDisabled({ model, isChecked });
  21277. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  21278. formItemContext: elFormItem,
  21279. disableIdGeneration: hasOwnLabel,
  21280. disableIdManagement: isGroup
  21281. });
  21282. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  21283. model,
  21284. isLimitExceeded,
  21285. hasOwnLabel,
  21286. isDisabled,
  21287. isLabeledByFormItem
  21288. });
  21289. const setStoreValue = () => {
  21290. function addToStore() {
  21291. var _a, _b;
  21292. if (isArray$1(model.value) && !model.value.includes(actualValue.value)) {
  21293. model.value.push(actualValue.value);
  21294. } else {
  21295. model.value = (_b = (_a = props.trueValue) != null ? _a : props.trueLabel) != null ? _b : true;
  21296. }
  21297. }
  21298. props.checked && addToStore();
  21299. };
  21300. setStoreValue();
  21301. useDeprecated({
  21302. from: "label act as value",
  21303. replacement: "value",
  21304. version: "3.0.0",
  21305. scope: "el-checkbox",
  21306. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21307. }, computed(() => isGroup.value && isPropAbsent(props.value)));
  21308. useDeprecated({
  21309. from: "true-label",
  21310. replacement: "true-value",
  21311. version: "3.0.0",
  21312. scope: "el-checkbox",
  21313. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21314. }, computed(() => !!props.trueLabel));
  21315. useDeprecated({
  21316. from: "false-label",
  21317. replacement: "false-value",
  21318. version: "3.0.0",
  21319. scope: "el-checkbox",
  21320. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21321. }, computed(() => !!props.falseLabel));
  21322. return {
  21323. inputId,
  21324. isLabeledByFormItem,
  21325. isChecked,
  21326. isDisabled,
  21327. isFocused,
  21328. checkboxButtonSize,
  21329. checkboxSize,
  21330. hasOwnLabel,
  21331. model,
  21332. actualValue,
  21333. handleChange,
  21334. onClickRoot
  21335. };
  21336. };
  21337. const __default__$1o = defineComponent({
  21338. name: "ElCheckbox"
  21339. });
  21340. const _sfc_main$1Z = /* @__PURE__ */ defineComponent({
  21341. ...__default__$1o,
  21342. props: checkboxProps,
  21343. emits: checkboxEmits,
  21344. setup(__props) {
  21345. const props = __props;
  21346. const slots = useSlots();
  21347. const {
  21348. inputId,
  21349. isLabeledByFormItem,
  21350. isChecked,
  21351. isDisabled,
  21352. isFocused,
  21353. checkboxSize,
  21354. hasOwnLabel,
  21355. model,
  21356. actualValue,
  21357. handleChange,
  21358. onClickRoot
  21359. } = useCheckbox(props, slots);
  21360. const ns = useNamespace("checkbox");
  21361. const compKls = computed(() => {
  21362. return [
  21363. ns.b(),
  21364. ns.m(checkboxSize.value),
  21365. ns.is("disabled", isDisabled.value),
  21366. ns.is("bordered", props.border),
  21367. ns.is("checked", isChecked.value)
  21368. ];
  21369. });
  21370. const spanKls = computed(() => {
  21371. return [
  21372. ns.e("input"),
  21373. ns.is("disabled", isDisabled.value),
  21374. ns.is("checked", isChecked.value),
  21375. ns.is("indeterminate", props.indeterminate),
  21376. ns.is("focus", isFocused.value)
  21377. ];
  21378. });
  21379. return (_ctx, _cache) => {
  21380. return openBlock(), createBlock(resolveDynamicComponent(!unref(hasOwnLabel) && unref(isLabeledByFormItem) ? "span" : "label"), {
  21381. class: normalizeClass(unref(compKls)),
  21382. "aria-controls": _ctx.indeterminate ? _ctx.ariaControls : null,
  21383. onClick: unref(onClickRoot)
  21384. }, {
  21385. default: withCtx(() => {
  21386. var _a, _b, _c, _d;
  21387. return [
  21388. createElementVNode("span", {
  21389. class: normalizeClass(unref(spanKls))
  21390. }, [
  21391. _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  21392. key: 0,
  21393. id: unref(inputId),
  21394. "onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
  21395. class: normalizeClass(unref(ns).e("original")),
  21396. type: "checkbox",
  21397. indeterminate: _ctx.indeterminate,
  21398. name: _ctx.name,
  21399. tabindex: _ctx.tabindex,
  21400. disabled: unref(isDisabled),
  21401. "true-value": (_b = (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel) != null ? _b : true,
  21402. "false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
  21403. onChange: unref(handleChange),
  21404. onFocus: ($event) => isFocused.value = true,
  21405. onBlur: ($event) => isFocused.value = false,
  21406. onClick: withModifiers(() => {
  21407. }, ["stop"])
  21408. }, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21409. [vModelCheckbox, unref(model)]
  21410. ]) : withDirectives((openBlock(), createElementBlock("input", {
  21411. key: 1,
  21412. id: unref(inputId),
  21413. "onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
  21414. class: normalizeClass(unref(ns).e("original")),
  21415. type: "checkbox",
  21416. indeterminate: _ctx.indeterminate,
  21417. disabled: unref(isDisabled),
  21418. value: unref(actualValue),
  21419. name: _ctx.name,
  21420. tabindex: _ctx.tabindex,
  21421. onChange: unref(handleChange),
  21422. onFocus: ($event) => isFocused.value = true,
  21423. onBlur: ($event) => isFocused.value = false,
  21424. onClick: withModifiers(() => {
  21425. }, ["stop"])
  21426. }, null, 42, ["id", "onUpdate:modelValue", "indeterminate", "disabled", "value", "name", "tabindex", "onChange", "onFocus", "onBlur", "onClick"])), [
  21427. [vModelCheckbox, unref(model)]
  21428. ]),
  21429. createElementVNode("span", {
  21430. class: normalizeClass(unref(ns).e("inner"))
  21431. }, null, 2)
  21432. ], 2),
  21433. unref(hasOwnLabel) ? (openBlock(), createElementBlock("span", {
  21434. key: 0,
  21435. class: normalizeClass(unref(ns).e("label"))
  21436. }, [
  21437. renderSlot(_ctx.$slots, "default"),
  21438. !_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  21439. createTextVNode(toDisplayString(_ctx.label), 1)
  21440. ], 64)) : createCommentVNode("v-if", true)
  21441. ], 2)) : createCommentVNode("v-if", true)
  21442. ];
  21443. }),
  21444. _: 3
  21445. }, 8, ["class", "aria-controls", "onClick"]);
  21446. };
  21447. }
  21448. });
  21449. var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$1Z, [["__file", "checkbox.vue"]]);
  21450. const __default__$1n = defineComponent({
  21451. name: "ElCheckboxButton"
  21452. });
  21453. const _sfc_main$1Y = /* @__PURE__ */ defineComponent({
  21454. ...__default__$1n,
  21455. props: checkboxProps,
  21456. emits: checkboxEmits,
  21457. setup(__props) {
  21458. const props = __props;
  21459. const slots = useSlots();
  21460. const {
  21461. isFocused,
  21462. isChecked,
  21463. isDisabled,
  21464. checkboxButtonSize,
  21465. model,
  21466. actualValue,
  21467. handleChange
  21468. } = useCheckbox(props, slots);
  21469. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21470. const ns = useNamespace("checkbox");
  21471. const activeStyle = computed(() => {
  21472. var _a, _b, _c, _d;
  21473. const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
  21474. return {
  21475. backgroundColor: fillValue,
  21476. borderColor: fillValue,
  21477. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  21478. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  21479. };
  21480. });
  21481. const labelKls = computed(() => {
  21482. return [
  21483. ns.b("button"),
  21484. ns.bm("button", checkboxButtonSize.value),
  21485. ns.is("disabled", isDisabled.value),
  21486. ns.is("checked", isChecked.value),
  21487. ns.is("focus", isFocused.value)
  21488. ];
  21489. });
  21490. return (_ctx, _cache) => {
  21491. var _a, _b, _c, _d;
  21492. return openBlock(), createElementBlock("label", {
  21493. class: normalizeClass(unref(labelKls))
  21494. }, [
  21495. _ctx.trueValue || _ctx.falseValue || _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
  21496. key: 0,
  21497. "onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
  21498. class: normalizeClass(unref(ns).be("button", "original")),
  21499. type: "checkbox",
  21500. name: _ctx.name,
  21501. tabindex: _ctx.tabindex,
  21502. disabled: unref(isDisabled),
  21503. "true-value": (_b = (_a = _ctx.trueValue) != null ? _a : _ctx.trueLabel) != null ? _b : true,
  21504. "false-value": (_d = (_c = _ctx.falseValue) != null ? _c : _ctx.falseLabel) != null ? _d : false,
  21505. onChange: unref(handleChange),
  21506. onFocus: ($event) => isFocused.value = true,
  21507. onBlur: ($event) => isFocused.value = false,
  21508. onClick: withModifiers(() => {
  21509. }, ["stop"])
  21510. }, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "true-value", "false-value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21511. [vModelCheckbox, unref(model)]
  21512. ]) : withDirectives((openBlock(), createElementBlock("input", {
  21513. key: 1,
  21514. "onUpdate:modelValue": ($event) => isRef(model) ? model.value = $event : null,
  21515. class: normalizeClass(unref(ns).be("button", "original")),
  21516. type: "checkbox",
  21517. name: _ctx.name,
  21518. tabindex: _ctx.tabindex,
  21519. disabled: unref(isDisabled),
  21520. value: unref(actualValue),
  21521. onChange: unref(handleChange),
  21522. onFocus: ($event) => isFocused.value = true,
  21523. onBlur: ($event) => isFocused.value = false,
  21524. onClick: withModifiers(() => {
  21525. }, ["stop"])
  21526. }, null, 42, ["onUpdate:modelValue", "name", "tabindex", "disabled", "value", "onChange", "onFocus", "onBlur", "onClick"])), [
  21527. [vModelCheckbox, unref(model)]
  21528. ]),
  21529. _ctx.$slots.default || _ctx.label ? (openBlock(), createElementBlock("span", {
  21530. key: 2,
  21531. class: normalizeClass(unref(ns).be("button", "inner")),
  21532. style: normalizeStyle(unref(isChecked) ? unref(activeStyle) : void 0)
  21533. }, [
  21534. renderSlot(_ctx.$slots, "default", {}, () => [
  21535. createTextVNode(toDisplayString(_ctx.label), 1)
  21536. ])
  21537. ], 6)) : createCommentVNode("v-if", true)
  21538. ], 2);
  21539. };
  21540. }
  21541. });
  21542. var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1Y, [["__file", "checkbox-button.vue"]]);
  21543. const checkboxGroupProps = buildProps({
  21544. modelValue: {
  21545. type: definePropType(Array),
  21546. default: () => []
  21547. },
  21548. disabled: Boolean,
  21549. min: Number,
  21550. max: Number,
  21551. size: useSizeProp,
  21552. fill: String,
  21553. textColor: String,
  21554. tag: {
  21555. type: String,
  21556. default: "div"
  21557. },
  21558. validateEvent: {
  21559. type: Boolean,
  21560. default: true
  21561. },
  21562. ...useAriaProps(["ariaLabel"])
  21563. });
  21564. const checkboxGroupEmits = {
  21565. [UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
  21566. change: (val) => isArray$1(val)
  21567. };
  21568. const __default__$1m = defineComponent({
  21569. name: "ElCheckboxGroup"
  21570. });
  21571. const _sfc_main$1X = /* @__PURE__ */ defineComponent({
  21572. ...__default__$1m,
  21573. props: checkboxGroupProps,
  21574. emits: checkboxGroupEmits,
  21575. setup(__props, { emit }) {
  21576. const props = __props;
  21577. const ns = useNamespace("checkbox");
  21578. const { formItem } = useFormItem();
  21579. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  21580. formItemContext: formItem
  21581. });
  21582. const changeEvent = async (value) => {
  21583. emit(UPDATE_MODEL_EVENT, value);
  21584. await nextTick();
  21585. emit("change", value);
  21586. };
  21587. const modelValue = computed({
  21588. get() {
  21589. return props.modelValue;
  21590. },
  21591. set(val) {
  21592. changeEvent(val);
  21593. }
  21594. });
  21595. provide(checkboxGroupContextKey, {
  21596. ...pick(toRefs(props), [
  21597. "size",
  21598. "min",
  21599. "max",
  21600. "disabled",
  21601. "validateEvent",
  21602. "fill",
  21603. "textColor"
  21604. ]),
  21605. modelValue,
  21606. changeEvent
  21607. });
  21608. watch(() => props.modelValue, () => {
  21609. if (props.validateEvent) {
  21610. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21611. }
  21612. });
  21613. return (_ctx, _cache) => {
  21614. var _a;
  21615. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  21616. id: unref(groupId),
  21617. class: normalizeClass(unref(ns).b("group")),
  21618. role: "group",
  21619. "aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "checkbox-group" : void 0,
  21620. "aria-labelledby": unref(isLabeledByFormItem) ? (_a = unref(formItem)) == null ? void 0 : _a.labelId : void 0
  21621. }, {
  21622. default: withCtx(() => [
  21623. renderSlot(_ctx.$slots, "default")
  21624. ]),
  21625. _: 3
  21626. }, 8, ["id", "class", "aria-label", "aria-labelledby"]);
  21627. };
  21628. }
  21629. });
  21630. var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1X, [["__file", "checkbox-group.vue"]]);
  21631. const ElCheckbox = withInstall(Checkbox, {
  21632. CheckboxButton,
  21633. CheckboxGroup
  21634. });
  21635. const ElCheckboxButton = withNoopInstall(CheckboxButton);
  21636. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  21637. const radioPropsBase = buildProps({
  21638. modelValue: {
  21639. type: [String, Number, Boolean],
  21640. default: void 0
  21641. },
  21642. size: useSizeProp,
  21643. disabled: Boolean,
  21644. label: {
  21645. type: [String, Number, Boolean],
  21646. default: void 0
  21647. },
  21648. value: {
  21649. type: [String, Number, Boolean],
  21650. default: void 0
  21651. },
  21652. name: {
  21653. type: String,
  21654. default: void 0
  21655. }
  21656. });
  21657. const radioProps = buildProps({
  21658. ...radioPropsBase,
  21659. border: Boolean
  21660. });
  21661. const radioEmits = {
  21662. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  21663. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  21664. };
  21665. const radioGroupKey = Symbol("radioGroupKey");
  21666. const useRadio = (props, emit) => {
  21667. const radioRef = ref();
  21668. const radioGroup = inject(radioGroupKey, void 0);
  21669. const isGroup = computed(() => !!radioGroup);
  21670. const actualValue = computed(() => {
  21671. if (!isPropAbsent(props.value)) {
  21672. return props.value;
  21673. }
  21674. return props.label;
  21675. });
  21676. const modelValue = computed({
  21677. get() {
  21678. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  21679. },
  21680. set(val) {
  21681. if (isGroup.value) {
  21682. radioGroup.changeEvent(val);
  21683. } else {
  21684. emit && emit(UPDATE_MODEL_EVENT, val);
  21685. }
  21686. radioRef.value.checked = props.modelValue === actualValue.value;
  21687. }
  21688. });
  21689. const size = useFormSize(computed(() => radioGroup == null ? void 0 : radioGroup.size));
  21690. const disabled = useFormDisabled(computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  21691. const focus = ref(false);
  21692. const tabIndex = computed(() => {
  21693. return disabled.value || isGroup.value && modelValue.value !== actualValue.value ? -1 : 0;
  21694. });
  21695. useDeprecated({
  21696. from: "label act as value",
  21697. replacement: "value",
  21698. version: "3.0.0",
  21699. scope: "el-radio",
  21700. ref: "https://element-plus.org/en-US/component/radio.html"
  21701. }, computed(() => isGroup.value && isPropAbsent(props.value)));
  21702. return {
  21703. radioRef,
  21704. isGroup,
  21705. radioGroup,
  21706. focus,
  21707. size,
  21708. disabled,
  21709. tabIndex,
  21710. modelValue,
  21711. actualValue
  21712. };
  21713. };
  21714. const __default__$1l = defineComponent({
  21715. name: "ElRadio"
  21716. });
  21717. const _sfc_main$1W = /* @__PURE__ */ defineComponent({
  21718. ...__default__$1l,
  21719. props: radioProps,
  21720. emits: radioEmits,
  21721. setup(__props, { emit }) {
  21722. const props = __props;
  21723. const ns = useNamespace("radio");
  21724. const { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } = useRadio(props, emit);
  21725. function handleChange() {
  21726. nextTick(() => emit("change", modelValue.value));
  21727. }
  21728. return (_ctx, _cache) => {
  21729. var _a;
  21730. return openBlock(), createElementBlock("label", {
  21731. class: normalizeClass([
  21732. unref(ns).b(),
  21733. unref(ns).is("disabled", unref(disabled)),
  21734. unref(ns).is("focus", unref(focus)),
  21735. unref(ns).is("bordered", _ctx.border),
  21736. unref(ns).is("checked", unref(modelValue) === unref(actualValue)),
  21737. unref(ns).m(unref(size))
  21738. ])
  21739. }, [
  21740. createElementVNode("span", {
  21741. class: normalizeClass([
  21742. unref(ns).e("input"),
  21743. unref(ns).is("disabled", unref(disabled)),
  21744. unref(ns).is("checked", unref(modelValue) === unref(actualValue))
  21745. ])
  21746. }, [
  21747. withDirectives(createElementVNode("input", {
  21748. ref_key: "radioRef",
  21749. ref: radioRef,
  21750. "onUpdate:modelValue": ($event) => isRef(modelValue) ? modelValue.value = $event : null,
  21751. class: normalizeClass(unref(ns).e("original")),
  21752. value: unref(actualValue),
  21753. name: _ctx.name || ((_a = unref(radioGroup)) == null ? void 0 : _a.name),
  21754. disabled: unref(disabled),
  21755. checked: unref(modelValue) === unref(actualValue),
  21756. type: "radio",
  21757. onFocus: ($event) => focus.value = true,
  21758. onBlur: ($event) => focus.value = false,
  21759. onChange: handleChange,
  21760. onClick: withModifiers(() => {
  21761. }, ["stop"])
  21762. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
  21763. [vModelRadio, unref(modelValue)]
  21764. ]),
  21765. createElementVNode("span", {
  21766. class: normalizeClass(unref(ns).e("inner"))
  21767. }, null, 2)
  21768. ], 2),
  21769. createElementVNode("span", {
  21770. class: normalizeClass(unref(ns).e("label")),
  21771. onKeydown: withModifiers(() => {
  21772. }, ["stop"])
  21773. }, [
  21774. renderSlot(_ctx.$slots, "default", {}, () => [
  21775. createTextVNode(toDisplayString(_ctx.label), 1)
  21776. ])
  21777. ], 42, ["onKeydown"])
  21778. ], 2);
  21779. };
  21780. }
  21781. });
  21782. var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$1W, [["__file", "radio.vue"]]);
  21783. const radioButtonProps = buildProps({
  21784. ...radioPropsBase
  21785. });
  21786. const __default__$1k = defineComponent({
  21787. name: "ElRadioButton"
  21788. });
  21789. const _sfc_main$1V = /* @__PURE__ */ defineComponent({
  21790. ...__default__$1k,
  21791. props: radioButtonProps,
  21792. setup(__props) {
  21793. const props = __props;
  21794. const ns = useNamespace("radio");
  21795. const { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } = useRadio(props);
  21796. const activeStyle = computed(() => {
  21797. return {
  21798. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  21799. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  21800. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  21801. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  21802. };
  21803. });
  21804. return (_ctx, _cache) => {
  21805. var _a;
  21806. return openBlock(), createElementBlock("label", {
  21807. class: normalizeClass([
  21808. unref(ns).b("button"),
  21809. unref(ns).is("active", unref(modelValue) === unref(actualValue)),
  21810. unref(ns).is("disabled", unref(disabled)),
  21811. unref(ns).is("focus", unref(focus)),
  21812. unref(ns).bm("button", unref(size))
  21813. ])
  21814. }, [
  21815. withDirectives(createElementVNode("input", {
  21816. ref_key: "radioRef",
  21817. ref: radioRef,
  21818. "onUpdate:modelValue": ($event) => isRef(modelValue) ? modelValue.value = $event : null,
  21819. class: normalizeClass(unref(ns).be("button", "original-radio")),
  21820. value: unref(actualValue),
  21821. type: "radio",
  21822. name: _ctx.name || ((_a = unref(radioGroup)) == null ? void 0 : _a.name),
  21823. disabled: unref(disabled),
  21824. onFocus: ($event) => focus.value = true,
  21825. onBlur: ($event) => focus.value = false,
  21826. onClick: withModifiers(() => {
  21827. }, ["stop"])
  21828. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "onFocus", "onBlur", "onClick"]), [
  21829. [vModelRadio, unref(modelValue)]
  21830. ]),
  21831. createElementVNode("span", {
  21832. class: normalizeClass(unref(ns).be("button", "inner")),
  21833. style: normalizeStyle(unref(modelValue) === unref(actualValue) ? unref(activeStyle) : {}),
  21834. onKeydown: withModifiers(() => {
  21835. }, ["stop"])
  21836. }, [
  21837. renderSlot(_ctx.$slots, "default", {}, () => [
  21838. createTextVNode(toDisplayString(_ctx.label), 1)
  21839. ])
  21840. ], 46, ["onKeydown"])
  21841. ], 2);
  21842. };
  21843. }
  21844. });
  21845. var RadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$1V, [["__file", "radio-button.vue"]]);
  21846. const radioGroupProps = buildProps({
  21847. id: {
  21848. type: String,
  21849. default: void 0
  21850. },
  21851. size: useSizeProp,
  21852. disabled: Boolean,
  21853. modelValue: {
  21854. type: [String, Number, Boolean],
  21855. default: void 0
  21856. },
  21857. fill: {
  21858. type: String,
  21859. default: ""
  21860. },
  21861. textColor: {
  21862. type: String,
  21863. default: ""
  21864. },
  21865. name: {
  21866. type: String,
  21867. default: void 0
  21868. },
  21869. validateEvent: {
  21870. type: Boolean,
  21871. default: true
  21872. },
  21873. ...useAriaProps(["ariaLabel"])
  21874. });
  21875. const radioGroupEmits = radioEmits;
  21876. const __default__$1j = defineComponent({
  21877. name: "ElRadioGroup"
  21878. });
  21879. const _sfc_main$1U = /* @__PURE__ */ defineComponent({
  21880. ...__default__$1j,
  21881. props: radioGroupProps,
  21882. emits: radioGroupEmits,
  21883. setup(__props, { emit }) {
  21884. const props = __props;
  21885. const ns = useNamespace("radio");
  21886. const radioId = useId();
  21887. const radioGroupRef = ref();
  21888. const { formItem } = useFormItem();
  21889. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  21890. formItemContext: formItem
  21891. });
  21892. const changeEvent = (value) => {
  21893. emit(UPDATE_MODEL_EVENT, value);
  21894. nextTick(() => emit("change", value));
  21895. };
  21896. onMounted(() => {
  21897. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  21898. const firstLabel = radios[0];
  21899. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  21900. firstLabel.tabIndex = 0;
  21901. }
  21902. });
  21903. const name = computed(() => {
  21904. return props.name || radioId.value;
  21905. });
  21906. provide(radioGroupKey, reactive({
  21907. ...toRefs(props),
  21908. changeEvent,
  21909. name
  21910. }));
  21911. watch(() => props.modelValue, () => {
  21912. if (props.validateEvent) {
  21913. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  21914. }
  21915. });
  21916. return (_ctx, _cache) => {
  21917. return openBlock(), createElementBlock("div", {
  21918. id: unref(groupId),
  21919. ref_key: "radioGroupRef",
  21920. ref: radioGroupRef,
  21921. class: normalizeClass(unref(ns).b("group")),
  21922. role: "radiogroup",
  21923. "aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "radio-group" : void 0,
  21924. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
  21925. }, [
  21926. renderSlot(_ctx.$slots, "default")
  21927. ], 10, ["id", "aria-label", "aria-labelledby"]);
  21928. };
  21929. }
  21930. });
  21931. var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1U, [["__file", "radio-group.vue"]]);
  21932. const ElRadio = withInstall(Radio, {
  21933. RadioButton,
  21934. RadioGroup
  21935. });
  21936. const ElRadioGroup = withNoopInstall(RadioGroup);
  21937. const ElRadioButton = withNoopInstall(RadioButton);
  21938. var NodeContent$1 = defineComponent({
  21939. name: "NodeContent",
  21940. setup() {
  21941. const ns = useNamespace("cascader-node");
  21942. return {
  21943. ns
  21944. };
  21945. },
  21946. render() {
  21947. const { ns } = this;
  21948. const { node, panel } = this.$parent;
  21949. const { data, label } = node;
  21950. const { renderLabelFn } = panel;
  21951. return h$1("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data }) : label);
  21952. }
  21953. });
  21954. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  21955. const _sfc_main$1T = defineComponent({
  21956. name: "ElCascaderNode",
  21957. components: {
  21958. ElCheckbox,
  21959. ElRadio,
  21960. NodeContent: NodeContent$1,
  21961. ElIcon,
  21962. Check: check_default,
  21963. Loading: loading_default,
  21964. ArrowRight: arrow_right_default
  21965. },
  21966. props: {
  21967. node: {
  21968. type: Object,
  21969. required: true
  21970. },
  21971. menuId: String
  21972. },
  21973. emits: ["expand"],
  21974. setup(props, { emit }) {
  21975. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  21976. const ns = useNamespace("cascader-node");
  21977. const isHoverMenu = computed(() => panel.isHoverMenu);
  21978. const multiple = computed(() => panel.config.multiple);
  21979. const checkStrictly = computed(() => panel.config.checkStrictly);
  21980. const checkedNodeId = computed(() => {
  21981. var _a;
  21982. return (_a = panel.checkedNodes[0]) == null ? void 0 : _a.uid;
  21983. });
  21984. const isDisabled = computed(() => props.node.isDisabled);
  21985. const isLeaf = computed(() => props.node.isLeaf);
  21986. const expandable = computed(() => checkStrictly.value && !isLeaf.value || !isDisabled.value);
  21987. const inExpandingPath = computed(() => isInPath(panel.expandingNode));
  21988. const inCheckedPath = computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  21989. const isInPath = (node) => {
  21990. var _a;
  21991. const { level, uid } = props.node;
  21992. return ((_a = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a.uid) === uid;
  21993. };
  21994. const doExpand = () => {
  21995. if (inExpandingPath.value)
  21996. return;
  21997. panel.expandNode(props.node);
  21998. };
  21999. const doCheck = (checked) => {
  22000. const { node } = props;
  22001. if (checked === node.checked)
  22002. return;
  22003. panel.handleCheckChange(node, checked);
  22004. };
  22005. const doLoad = () => {
  22006. panel.lazyLoad(props.node, () => {
  22007. if (!isLeaf.value)
  22008. doExpand();
  22009. });
  22010. };
  22011. const handleHoverExpand = (e) => {
  22012. if (!isHoverMenu.value)
  22013. return;
  22014. handleExpand();
  22015. !isLeaf.value && emit("expand", e);
  22016. };
  22017. const handleExpand = () => {
  22018. const { node } = props;
  22019. if (!expandable.value || node.loading)
  22020. return;
  22021. node.loaded ? doExpand() : doLoad();
  22022. };
  22023. const handleClick = () => {
  22024. if (isHoverMenu.value && !isLeaf.value)
  22025. return;
  22026. if (isLeaf.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  22027. handleCheck(true);
  22028. } else {
  22029. handleExpand();
  22030. }
  22031. };
  22032. const handleSelectCheck = (checked) => {
  22033. if (checkStrictly.value) {
  22034. doCheck(checked);
  22035. if (props.node.loaded) {
  22036. doExpand();
  22037. }
  22038. } else {
  22039. handleCheck(checked);
  22040. }
  22041. };
  22042. const handleCheck = (checked) => {
  22043. if (!props.node.loaded) {
  22044. doLoad();
  22045. } else {
  22046. doCheck(checked);
  22047. !checkStrictly.value && doExpand();
  22048. }
  22049. };
  22050. return {
  22051. panel,
  22052. isHoverMenu,
  22053. multiple,
  22054. checkStrictly,
  22055. checkedNodeId,
  22056. isDisabled,
  22057. isLeaf,
  22058. expandable,
  22059. inExpandingPath,
  22060. inCheckedPath,
  22061. ns,
  22062. handleHoverExpand,
  22063. handleExpand,
  22064. handleClick,
  22065. handleCheck,
  22066. handleSelectCheck
  22067. };
  22068. }
  22069. });
  22070. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  22071. const _component_el_checkbox = resolveComponent("el-checkbox");
  22072. const _component_el_radio = resolveComponent("el-radio");
  22073. const _component_check = resolveComponent("check");
  22074. const _component_el_icon = resolveComponent("el-icon");
  22075. const _component_node_content = resolveComponent("node-content");
  22076. const _component_loading = resolveComponent("loading");
  22077. const _component_arrow_right = resolveComponent("arrow-right");
  22078. return openBlock(), createElementBlock("li", {
  22079. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  22080. role: "menuitem",
  22081. "aria-haspopup": !_ctx.isLeaf,
  22082. "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
  22083. "aria-expanded": _ctx.inExpandingPath,
  22084. tabindex: _ctx.expandable ? -1 : void 0,
  22085. class: normalizeClass([
  22086. _ctx.ns.b(),
  22087. _ctx.ns.is("selectable", _ctx.checkStrictly),
  22088. _ctx.ns.is("active", _ctx.node.checked),
  22089. _ctx.ns.is("disabled", !_ctx.expandable),
  22090. _ctx.inExpandingPath && "in-active-path",
  22091. _ctx.inCheckedPath && "in-checked-path"
  22092. ]),
  22093. onMouseenter: _ctx.handleHoverExpand,
  22094. onFocus: _ctx.handleHoverExpand,
  22095. onClick: _ctx.handleClick
  22096. }, [
  22097. createCommentVNode(" prefix "),
  22098. _ctx.multiple ? (openBlock(), createBlock(_component_el_checkbox, {
  22099. key: 0,
  22100. "model-value": _ctx.node.checked,
  22101. indeterminate: _ctx.node.indeterminate,
  22102. disabled: _ctx.isDisabled,
  22103. onClick: withModifiers(() => {
  22104. }, ["stop"]),
  22105. "onUpdate:modelValue": _ctx.handleSelectCheck
  22106. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (openBlock(), createBlock(_component_el_radio, {
  22107. key: 1,
  22108. "model-value": _ctx.checkedNodeId,
  22109. label: _ctx.node.uid,
  22110. disabled: _ctx.isDisabled,
  22111. "onUpdate:modelValue": _ctx.handleSelectCheck,
  22112. onClick: withModifiers(() => {
  22113. }, ["stop"])
  22114. }, {
  22115. default: withCtx(() => [
  22116. 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 "),
  22117. createElementVNode("span")
  22118. ]),
  22119. _: 1
  22120. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue", "onClick"])) : _ctx.isLeaf && _ctx.node.checked ? (openBlock(), createBlock(_component_el_icon, {
  22121. key: 2,
  22122. class: normalizeClass(_ctx.ns.e("prefix"))
  22123. }, {
  22124. default: withCtx(() => [
  22125. createVNode(_component_check)
  22126. ]),
  22127. _: 1
  22128. }, 8, ["class"])) : createCommentVNode("v-if", true),
  22129. createCommentVNode(" content "),
  22130. createVNode(_component_node_content),
  22131. createCommentVNode(" postfix "),
  22132. !_ctx.isLeaf ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
  22133. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  22134. key: 0,
  22135. class: normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  22136. }, {
  22137. default: withCtx(() => [
  22138. createVNode(_component_loading)
  22139. ]),
  22140. _: 1
  22141. }, 8, ["class"])) : (openBlock(), createBlock(_component_el_icon, {
  22142. key: 1,
  22143. class: normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  22144. }, {
  22145. default: withCtx(() => [
  22146. createVNode(_component_arrow_right)
  22147. ]),
  22148. _: 1
  22149. }, 8, ["class"]))
  22150. ], 64)) : createCommentVNode("v-if", true)
  22151. ], 42, ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex", "onMouseenter", "onFocus", "onClick"]);
  22152. }
  22153. var ElCascaderNode = /* @__PURE__ */ _export_sfc(_sfc_main$1T, [["render", _sfc_render$t], ["__file", "node.vue"]]);
  22154. const _sfc_main$1S = defineComponent({
  22155. name: "ElCascaderMenu",
  22156. components: {
  22157. Loading: loading_default,
  22158. ElIcon,
  22159. ElScrollbar,
  22160. ElCascaderNode
  22161. },
  22162. props: {
  22163. nodes: {
  22164. type: Array,
  22165. required: true
  22166. },
  22167. index: {
  22168. type: Number,
  22169. required: true
  22170. }
  22171. },
  22172. setup(props) {
  22173. const instance = getCurrentInstance();
  22174. const ns = useNamespace("cascader-menu");
  22175. const { t } = useLocale();
  22176. const id = useId();
  22177. let activeNode = null;
  22178. let hoverTimer = null;
  22179. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  22180. const hoverZone = ref(null);
  22181. const isEmpty = computed(() => !props.nodes.length);
  22182. const isLoading = computed(() => !panel.initialLoaded);
  22183. const menuId = computed(() => `${id.value}-${props.index}`);
  22184. const handleExpand = (e) => {
  22185. activeNode = e.target;
  22186. };
  22187. const handleMouseMove = (e) => {
  22188. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  22189. return;
  22190. if (activeNode.contains(e.target)) {
  22191. clearHoverTimer();
  22192. const el = instance.vnode.el;
  22193. const { left } = el.getBoundingClientRect();
  22194. const { offsetWidth, offsetHeight } = el;
  22195. const startX = e.clientX - left;
  22196. const top = activeNode.offsetTop;
  22197. const bottom = top + activeNode.offsetHeight;
  22198. hoverZone.value.innerHTML = `
  22199. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} 0 V${top} Z" />
  22200. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" />
  22201. `;
  22202. } else if (!hoverTimer) {
  22203. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  22204. }
  22205. };
  22206. const clearHoverTimer = () => {
  22207. if (!hoverTimer)
  22208. return;
  22209. clearTimeout(hoverTimer);
  22210. hoverTimer = null;
  22211. };
  22212. const clearHoverZone = () => {
  22213. if (!hoverZone.value)
  22214. return;
  22215. hoverZone.value.innerHTML = "";
  22216. clearHoverTimer();
  22217. };
  22218. return {
  22219. ns,
  22220. panel,
  22221. hoverZone,
  22222. isEmpty,
  22223. isLoading,
  22224. menuId,
  22225. t,
  22226. handleExpand,
  22227. handleMouseMove,
  22228. clearHoverZone
  22229. };
  22230. }
  22231. });
  22232. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  22233. const _component_el_cascader_node = resolveComponent("el-cascader-node");
  22234. const _component_loading = resolveComponent("loading");
  22235. const _component_el_icon = resolveComponent("el-icon");
  22236. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  22237. return openBlock(), createBlock(_component_el_scrollbar, {
  22238. key: _ctx.menuId,
  22239. tag: "ul",
  22240. role: "menu",
  22241. class: normalizeClass(_ctx.ns.b()),
  22242. "wrap-class": _ctx.ns.e("wrap"),
  22243. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  22244. onMousemove: _ctx.handleMouseMove,
  22245. onMouseleave: _ctx.clearHoverZone
  22246. }, {
  22247. default: withCtx(() => {
  22248. var _a;
  22249. return [
  22250. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.nodes, (node) => {
  22251. return openBlock(), createBlock(_component_el_cascader_node, {
  22252. key: node.uid,
  22253. node,
  22254. "menu-id": _ctx.menuId,
  22255. onExpand: _ctx.handleExpand
  22256. }, null, 8, ["node", "menu-id", "onExpand"]);
  22257. }), 128)),
  22258. _ctx.isLoading ? (openBlock(), createElementBlock("div", {
  22259. key: 0,
  22260. class: normalizeClass(_ctx.ns.e("empty-text"))
  22261. }, [
  22262. createVNode(_component_el_icon, {
  22263. size: "14",
  22264. class: normalizeClass(_ctx.ns.is("loading"))
  22265. }, {
  22266. default: withCtx(() => [
  22267. createVNode(_component_loading)
  22268. ]),
  22269. _: 1
  22270. }, 8, ["class"]),
  22271. createTextVNode(" " + toDisplayString(_ctx.t("el.cascader.loading")), 1)
  22272. ], 2)) : _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  22273. key: 1,
  22274. class: normalizeClass(_ctx.ns.e("empty-text"))
  22275. }, [
  22276. renderSlot(_ctx.$slots, "empty", {}, () => [
  22277. createTextVNode(toDisplayString(_ctx.t("el.cascader.noData")), 1)
  22278. ])
  22279. ], 2)) : ((_a = _ctx.panel) == null ? void 0 : _a.isHoverMenu) ? (openBlock(), createElementBlock("svg", {
  22280. key: 2,
  22281. ref: "hoverZone",
  22282. class: normalizeClass(_ctx.ns.e("hover-zone"))
  22283. }, null, 2)) : createCommentVNode("v-if", true)
  22284. ];
  22285. }),
  22286. _: 3
  22287. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  22288. }
  22289. var ElCascaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1S, [["render", _sfc_render$s], ["__file", "menu.vue"]]);
  22290. let uid = 0;
  22291. const calculatePathNodes = (node) => {
  22292. const nodes = [node];
  22293. let { parent } = node;
  22294. while (parent) {
  22295. nodes.unshift(parent);
  22296. parent = parent.parent;
  22297. }
  22298. return nodes;
  22299. };
  22300. class Node$2 {
  22301. constructor(data, config, parent, root = false) {
  22302. this.data = data;
  22303. this.config = config;
  22304. this.parent = parent;
  22305. this.root = root;
  22306. this.uid = uid++;
  22307. this.checked = false;
  22308. this.indeterminate = false;
  22309. this.loading = false;
  22310. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  22311. const childrenData = data[childrenKey];
  22312. const pathNodes = calculatePathNodes(this);
  22313. this.level = root ? 0 : parent ? parent.level + 1 : 1;
  22314. this.value = data[valueKey];
  22315. this.label = data[labelKey];
  22316. this.pathNodes = pathNodes;
  22317. this.pathValues = pathNodes.map((node) => node.value);
  22318. this.pathLabels = pathNodes.map((node) => node.label);
  22319. this.childrenData = childrenData;
  22320. this.children = (childrenData || []).map((child) => new Node$2(child, config, this));
  22321. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  22322. }
  22323. get isDisabled() {
  22324. const { data, parent, config } = this;
  22325. const { disabled, checkStrictly } = config;
  22326. const isDisabled = isFunction$1(disabled) ? disabled(data, this) : !!data[disabled];
  22327. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  22328. }
  22329. get isLeaf() {
  22330. const { data, config, childrenData, loaded } = this;
  22331. const { lazy, leaf } = config;
  22332. const isLeaf = isFunction$1(leaf) ? leaf(data, this) : data[leaf];
  22333. return isUndefined(isLeaf) ? lazy && !loaded ? false : !(isArray$1(childrenData) && childrenData.length) : !!isLeaf;
  22334. }
  22335. get valueByOption() {
  22336. return this.config.emitPath ? this.pathValues : this.value;
  22337. }
  22338. appendChild(childData) {
  22339. const { childrenData, children } = this;
  22340. const node = new Node$2(childData, this.config, this);
  22341. if (isArray$1(childrenData)) {
  22342. childrenData.push(childData);
  22343. } else {
  22344. this.childrenData = [childData];
  22345. }
  22346. children.push(node);
  22347. return node;
  22348. }
  22349. calcText(allLevels, separator) {
  22350. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  22351. this.text = text;
  22352. return text;
  22353. }
  22354. broadcast(event, ...args) {
  22355. const handlerName = `onParent${capitalize(event)}`;
  22356. this.children.forEach((child) => {
  22357. if (child) {
  22358. child.broadcast(event, ...args);
  22359. child[handlerName] && child[handlerName](...args);
  22360. }
  22361. });
  22362. }
  22363. emit(event, ...args) {
  22364. const { parent } = this;
  22365. const handlerName = `onChild${capitalize(event)}`;
  22366. if (parent) {
  22367. parent[handlerName] && parent[handlerName](...args);
  22368. parent.emit(event, ...args);
  22369. }
  22370. }
  22371. onParentCheck(checked) {
  22372. if (!this.isDisabled) {
  22373. this.setCheckState(checked);
  22374. }
  22375. }
  22376. onChildCheck() {
  22377. const { children } = this;
  22378. const validChildren = children.filter((child) => !child.isDisabled);
  22379. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  22380. this.setCheckState(checked);
  22381. }
  22382. setCheckState(checked) {
  22383. const totalNum = this.children.length;
  22384. const checkedNum = this.children.reduce((c, p) => {
  22385. const num = p.checked ? 1 : p.indeterminate ? 0.5 : 0;
  22386. return c + num;
  22387. }, 0);
  22388. this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked;
  22389. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  22390. }
  22391. doCheck(checked) {
  22392. if (this.checked === checked)
  22393. return;
  22394. const { checkStrictly, multiple } = this.config;
  22395. if (checkStrictly || !multiple) {
  22396. this.checked = checked;
  22397. } else {
  22398. this.broadcast("check", checked);
  22399. this.setCheckState(checked);
  22400. this.emit("check");
  22401. }
  22402. }
  22403. }
  22404. var Node$3 = Node$2;
  22405. const flatNodes = (nodes, leafOnly) => {
  22406. return nodes.reduce((res, node) => {
  22407. if (node.isLeaf) {
  22408. res.push(node);
  22409. } else {
  22410. !leafOnly && res.push(node);
  22411. res = res.concat(flatNodes(node.children, leafOnly));
  22412. }
  22413. return res;
  22414. }, []);
  22415. };
  22416. class Store {
  22417. constructor(data, config) {
  22418. this.config = config;
  22419. const nodes = (data || []).map((nodeData) => new Node$3(nodeData, this.config));
  22420. this.nodes = nodes;
  22421. this.allNodes = flatNodes(nodes, false);
  22422. this.leafNodes = flatNodes(nodes, true);
  22423. }
  22424. getNodes() {
  22425. return this.nodes;
  22426. }
  22427. getFlattedNodes(leafOnly) {
  22428. return leafOnly ? this.leafNodes : this.allNodes;
  22429. }
  22430. appendNode(nodeData, parentNode) {
  22431. const node = parentNode ? parentNode.appendChild(nodeData) : new Node$3(nodeData, this.config);
  22432. if (!parentNode)
  22433. this.nodes.push(node);
  22434. this.allNodes.push(node);
  22435. node.isLeaf && this.leafNodes.push(node);
  22436. }
  22437. appendNodes(nodeDataList, parentNode) {
  22438. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  22439. }
  22440. getNodeByValue(value, leafOnly = false) {
  22441. if (!value && value !== 0)
  22442. return null;
  22443. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual$1(node2.value, value) || isEqual$1(node2.pathValues, value));
  22444. return node || null;
  22445. }
  22446. getSameNode(node) {
  22447. if (!node)
  22448. return null;
  22449. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level);
  22450. return node_ || null;
  22451. }
  22452. }
  22453. const CommonProps = buildProps({
  22454. modelValue: {
  22455. type: definePropType([Number, String, Array])
  22456. },
  22457. options: {
  22458. type: definePropType(Array),
  22459. default: () => []
  22460. },
  22461. props: {
  22462. type: definePropType(Object),
  22463. default: () => ({})
  22464. }
  22465. });
  22466. const DefaultProps = {
  22467. expandTrigger: "click",
  22468. multiple: false,
  22469. checkStrictly: false,
  22470. emitPath: true,
  22471. lazy: false,
  22472. lazyLoad: NOOP,
  22473. value: "value",
  22474. label: "label",
  22475. children: "children",
  22476. leaf: "leaf",
  22477. disabled: "disabled",
  22478. hoverThreshold: 500
  22479. };
  22480. const useCascaderConfig = (props) => {
  22481. return computed(() => ({
  22482. ...DefaultProps,
  22483. ...props.props
  22484. }));
  22485. };
  22486. const getMenuIndex = (el) => {
  22487. if (!el)
  22488. return 0;
  22489. const pieces = el.id.split("-");
  22490. return Number(pieces[pieces.length - 2]);
  22491. };
  22492. const checkNode = (el) => {
  22493. if (!el)
  22494. return;
  22495. const input = el.querySelector("input");
  22496. if (input) {
  22497. input.click();
  22498. } else if (isLeaf(el)) {
  22499. el.click();
  22500. }
  22501. };
  22502. const sortByOriginalOrder = (oldNodes, newNodes) => {
  22503. const newNodesCopy = newNodes.slice(0);
  22504. const newIds = newNodesCopy.map((node) => node.uid);
  22505. const res = oldNodes.reduce((acc, item) => {
  22506. const index = newIds.indexOf(item.uid);
  22507. if (index > -1) {
  22508. acc.push(item);
  22509. newNodesCopy.splice(index, 1);
  22510. newIds.splice(index, 1);
  22511. }
  22512. return acc;
  22513. }, []);
  22514. res.push(...newNodesCopy);
  22515. return res;
  22516. };
  22517. const _sfc_main$1R = defineComponent({
  22518. name: "ElCascaderPanel",
  22519. components: {
  22520. ElCascaderMenu
  22521. },
  22522. props: {
  22523. ...CommonProps,
  22524. border: {
  22525. type: Boolean,
  22526. default: true
  22527. },
  22528. renderLabel: Function
  22529. },
  22530. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  22531. setup(props, { emit, slots }) {
  22532. let manualChecked = false;
  22533. const ns = useNamespace("cascader");
  22534. const config = useCascaderConfig(props);
  22535. let store = null;
  22536. const initialLoaded = ref(true);
  22537. const menuList = ref([]);
  22538. const checkedValue = ref(null);
  22539. const menus = ref([]);
  22540. const expandingNode = ref(null);
  22541. const checkedNodes = ref([]);
  22542. const isHoverMenu = computed(() => config.value.expandTrigger === "hover");
  22543. const renderLabelFn = computed(() => props.renderLabel || slots.default);
  22544. const initStore = () => {
  22545. const { options } = props;
  22546. const cfg = config.value;
  22547. manualChecked = false;
  22548. store = new Store(options, cfg);
  22549. menus.value = [store.getNodes()];
  22550. if (cfg.lazy && isEmpty(props.options)) {
  22551. initialLoaded.value = false;
  22552. lazyLoad(void 0, (list) => {
  22553. if (list) {
  22554. store = new Store(list, cfg);
  22555. menus.value = [store.getNodes()];
  22556. }
  22557. initialLoaded.value = true;
  22558. syncCheckedValue(false, true);
  22559. });
  22560. } else {
  22561. syncCheckedValue(false, true);
  22562. }
  22563. };
  22564. const lazyLoad = (node, cb) => {
  22565. const cfg = config.value;
  22566. node = node || new Node$3({}, cfg, void 0, true);
  22567. node.loading = true;
  22568. const resolve = (dataList) => {
  22569. const _node = node;
  22570. const parent = _node.root ? null : _node;
  22571. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  22572. _node.loading = false;
  22573. _node.loaded = true;
  22574. _node.childrenData = _node.childrenData || [];
  22575. cb && cb(dataList);
  22576. };
  22577. cfg.lazyLoad(node, resolve);
  22578. };
  22579. const expandNode = (node, silent) => {
  22580. var _a;
  22581. const { level } = node;
  22582. const newMenus = menus.value.slice(0, level);
  22583. let newExpandingNode;
  22584. if (node.isLeaf) {
  22585. newExpandingNode = node.pathNodes[level - 2];
  22586. } else {
  22587. newExpandingNode = node;
  22588. newMenus.push(node.children);
  22589. }
  22590. if (((_a = expandingNode.value) == null ? void 0 : _a.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  22591. expandingNode.value = node;
  22592. menus.value = newMenus;
  22593. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  22594. }
  22595. };
  22596. const handleCheckChange = (node, checked, emitClose = true) => {
  22597. const { checkStrictly, multiple } = config.value;
  22598. const oldNode = checkedNodes.value[0];
  22599. manualChecked = true;
  22600. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  22601. node.doCheck(checked);
  22602. calculateCheckedValue();
  22603. emitClose && !multiple && !checkStrictly && emit("close");
  22604. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  22605. };
  22606. const expandParentNode = (node) => {
  22607. if (!node)
  22608. return;
  22609. node = node.parent;
  22610. expandParentNode(node);
  22611. node && expandNode(node);
  22612. };
  22613. const getFlattedNodes = (leafOnly) => {
  22614. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  22615. };
  22616. const getCheckedNodes = (leafOnly) => {
  22617. var _a;
  22618. return (_a = getFlattedNodes(leafOnly)) == null ? void 0 : _a.filter((node) => node.checked !== false);
  22619. };
  22620. const clearCheckedNodes = () => {
  22621. checkedNodes.value.forEach((node) => node.doCheck(false));
  22622. calculateCheckedValue();
  22623. menus.value = menus.value.slice(0, 1);
  22624. expandingNode.value = null;
  22625. emit("expand-change", []);
  22626. };
  22627. const calculateCheckedValue = () => {
  22628. var _a;
  22629. const { checkStrictly, multiple } = config.value;
  22630. const oldNodes = checkedNodes.value;
  22631. const newNodes = getCheckedNodes(!checkStrictly);
  22632. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  22633. const values = nodes.map((node) => node.valueByOption);
  22634. checkedNodes.value = nodes;
  22635. checkedValue.value = multiple ? values : (_a = values[0]) != null ? _a : null;
  22636. };
  22637. const syncCheckedValue = (loaded = false, forced = false) => {
  22638. const { modelValue } = props;
  22639. const { lazy, multiple, checkStrictly } = config.value;
  22640. const leafOnly = !checkStrictly;
  22641. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value))
  22642. return;
  22643. if (lazy && !loaded) {
  22644. const values = unique(flattenDeep(castArray(modelValue)));
  22645. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  22646. if (nodes.length) {
  22647. nodes.forEach((node) => {
  22648. lazyLoad(node, () => syncCheckedValue(false, forced));
  22649. });
  22650. } else {
  22651. syncCheckedValue(true, forced);
  22652. }
  22653. } else {
  22654. const values = multiple ? castArray(modelValue) : [modelValue];
  22655. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  22656. syncMenuState(nodes, forced);
  22657. checkedValue.value = cloneDeep(modelValue);
  22658. }
  22659. };
  22660. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  22661. const { checkStrictly } = config.value;
  22662. const oldNodes = checkedNodes.value;
  22663. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  22664. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  22665. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  22666. if (newExpandingNode) {
  22667. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  22668. } else {
  22669. expandingNode.value = null;
  22670. }
  22671. oldNodes.forEach((node) => node.doCheck(false));
  22672. reactive(newNodes).forEach((node) => node.doCheck(true));
  22673. checkedNodes.value = newNodes;
  22674. nextTick(scrollToExpandingNode);
  22675. };
  22676. const scrollToExpandingNode = () => {
  22677. if (!isClient)
  22678. return;
  22679. menuList.value.forEach((menu) => {
  22680. const menuElement = menu == null ? void 0 : menu.$el;
  22681. if (menuElement) {
  22682. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  22683. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  22684. scrollIntoView(container, activeNode);
  22685. }
  22686. });
  22687. };
  22688. const handleKeyDown = (e) => {
  22689. const target = e.target;
  22690. const { code } = e;
  22691. switch (code) {
  22692. case EVENT_CODE.up:
  22693. case EVENT_CODE.down: {
  22694. e.preventDefault();
  22695. const distance = code === EVENT_CODE.up ? -1 : 1;
  22696. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  22697. break;
  22698. }
  22699. case EVENT_CODE.left: {
  22700. e.preventDefault();
  22701. const preMenu = menuList.value[getMenuIndex(target) - 1];
  22702. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  22703. focusNode(expandedNode);
  22704. break;
  22705. }
  22706. case EVENT_CODE.right: {
  22707. e.preventDefault();
  22708. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  22709. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  22710. focusNode(firstNode);
  22711. break;
  22712. }
  22713. case EVENT_CODE.enter:
  22714. case EVENT_CODE.numpadEnter:
  22715. checkNode(target);
  22716. break;
  22717. }
  22718. };
  22719. provide(CASCADER_PANEL_INJECTION_KEY, reactive({
  22720. config,
  22721. expandingNode,
  22722. checkedNodes,
  22723. isHoverMenu,
  22724. initialLoaded,
  22725. renderLabelFn,
  22726. lazyLoad,
  22727. expandNode,
  22728. handleCheckChange
  22729. }));
  22730. watch([config, () => props.options], initStore, {
  22731. deep: true,
  22732. immediate: true
  22733. });
  22734. watch(() => props.modelValue, () => {
  22735. manualChecked = false;
  22736. syncCheckedValue();
  22737. }, {
  22738. deep: true
  22739. });
  22740. watch(() => checkedValue.value, (val) => {
  22741. if (!isEqual$1(val, props.modelValue)) {
  22742. emit(UPDATE_MODEL_EVENT, val);
  22743. emit(CHANGE_EVENT, val);
  22744. }
  22745. });
  22746. onBeforeUpdate(() => menuList.value = []);
  22747. onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  22748. return {
  22749. ns,
  22750. menuList,
  22751. menus,
  22752. checkedNodes,
  22753. handleKeyDown,
  22754. handleCheckChange,
  22755. getFlattedNodes,
  22756. getCheckedNodes,
  22757. clearCheckedNodes,
  22758. calculateCheckedValue,
  22759. scrollToExpandingNode
  22760. };
  22761. }
  22762. });
  22763. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  22764. const _component_el_cascader_menu = resolveComponent("el-cascader-menu");
  22765. return openBlock(), createElementBlock("div", {
  22766. class: normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  22767. onKeydown: _ctx.handleKeyDown
  22768. }, [
  22769. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menus, (menu, index) => {
  22770. return openBlock(), createBlock(_component_el_cascader_menu, {
  22771. key: index,
  22772. ref_for: true,
  22773. ref: (item) => _ctx.menuList[index] = item,
  22774. index,
  22775. nodes: [...menu]
  22776. }, {
  22777. empty: withCtx(() => [
  22778. renderSlot(_ctx.$slots, "empty")
  22779. ]),
  22780. _: 2
  22781. }, 1032, ["index", "nodes"]);
  22782. }), 128))
  22783. ], 42, ["onKeydown"]);
  22784. }
  22785. var CascaderPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1R, [["render", _sfc_render$r], ["__file", "index.vue"]]);
  22786. const ElCascaderPanel = withInstall(CascaderPanel);
  22787. const tagProps = buildProps({
  22788. type: {
  22789. type: String,
  22790. values: ["primary", "success", "info", "warning", "danger"],
  22791. default: "primary"
  22792. },
  22793. closable: Boolean,
  22794. disableTransitions: Boolean,
  22795. hit: Boolean,
  22796. color: String,
  22797. size: {
  22798. type: String,
  22799. values: componentSizes
  22800. },
  22801. effect: {
  22802. type: String,
  22803. values: ["dark", "light", "plain"],
  22804. default: "light"
  22805. },
  22806. round: Boolean
  22807. });
  22808. const tagEmits = {
  22809. close: (evt) => evt instanceof MouseEvent,
  22810. click: (evt) => evt instanceof MouseEvent
  22811. };
  22812. const __default__$1i = defineComponent({
  22813. name: "ElTag"
  22814. });
  22815. const _sfc_main$1Q = /* @__PURE__ */ defineComponent({
  22816. ...__default__$1i,
  22817. props: tagProps,
  22818. emits: tagEmits,
  22819. setup(__props, { emit }) {
  22820. const props = __props;
  22821. const tagSize = useFormSize();
  22822. const ns = useNamespace("tag");
  22823. const containerKls = computed(() => {
  22824. const { type, hit, effect, closable, round } = props;
  22825. return [
  22826. ns.b(),
  22827. ns.is("closable", closable),
  22828. ns.m(type || "primary"),
  22829. ns.m(tagSize.value),
  22830. ns.m(effect),
  22831. ns.is("hit", hit),
  22832. ns.is("round", round)
  22833. ];
  22834. });
  22835. const handleClose = (event) => {
  22836. emit("close", event);
  22837. };
  22838. const handleClick = (event) => {
  22839. emit("click", event);
  22840. };
  22841. const handleVNodeMounted = (vnode) => {
  22842. var _a, _b, _c;
  22843. 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) {
  22844. vnode.component.subTree.component.bum = null;
  22845. }
  22846. };
  22847. return (_ctx, _cache) => {
  22848. return _ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
  22849. key: 0,
  22850. class: normalizeClass(unref(containerKls)),
  22851. style: normalizeStyle({ backgroundColor: _ctx.color }),
  22852. onClick: handleClick
  22853. }, [
  22854. createElementVNode("span", {
  22855. class: normalizeClass(unref(ns).e("content"))
  22856. }, [
  22857. renderSlot(_ctx.$slots, "default")
  22858. ], 2),
  22859. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  22860. key: 0,
  22861. class: normalizeClass(unref(ns).e("close")),
  22862. onClick: withModifiers(handleClose, ["stop"])
  22863. }, {
  22864. default: withCtx(() => [
  22865. createVNode(unref(close_default))
  22866. ]),
  22867. _: 1
  22868. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  22869. ], 6)) : (openBlock(), createBlock(Transition, {
  22870. key: 1,
  22871. name: `${unref(ns).namespace.value}-zoom-in-center`,
  22872. appear: "",
  22873. onVnodeMounted: handleVNodeMounted
  22874. }, {
  22875. default: withCtx(() => [
  22876. createElementVNode("span", {
  22877. class: normalizeClass(unref(containerKls)),
  22878. style: normalizeStyle({ backgroundColor: _ctx.color }),
  22879. onClick: handleClick
  22880. }, [
  22881. createElementVNode("span", {
  22882. class: normalizeClass(unref(ns).e("content"))
  22883. }, [
  22884. renderSlot(_ctx.$slots, "default")
  22885. ], 2),
  22886. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  22887. key: 0,
  22888. class: normalizeClass(unref(ns).e("close")),
  22889. onClick: withModifiers(handleClose, ["stop"])
  22890. }, {
  22891. default: withCtx(() => [
  22892. createVNode(unref(close_default))
  22893. ]),
  22894. _: 1
  22895. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  22896. ], 6)
  22897. ]),
  22898. _: 3
  22899. }, 8, ["name"]));
  22900. };
  22901. }
  22902. });
  22903. var Tag = /* @__PURE__ */ _export_sfc(_sfc_main$1Q, [["__file", "tag.vue"]]);
  22904. const ElTag = withInstall(Tag);
  22905. const cascaderProps = buildProps({
  22906. ...CommonProps,
  22907. size: useSizeProp,
  22908. placeholder: String,
  22909. disabled: Boolean,
  22910. clearable: Boolean,
  22911. filterable: Boolean,
  22912. filterMethod: {
  22913. type: definePropType(Function),
  22914. default: (node, keyword) => node.text.includes(keyword)
  22915. },
  22916. separator: {
  22917. type: String,
  22918. default: " / "
  22919. },
  22920. showAllLevels: {
  22921. type: Boolean,
  22922. default: true
  22923. },
  22924. collapseTags: Boolean,
  22925. maxCollapseTags: {
  22926. type: Number,
  22927. default: 1
  22928. },
  22929. collapseTagsTooltip: {
  22930. type: Boolean,
  22931. default: false
  22932. },
  22933. debounce: {
  22934. type: Number,
  22935. default: 300
  22936. },
  22937. beforeFilter: {
  22938. type: definePropType(Function),
  22939. default: () => true
  22940. },
  22941. placement: {
  22942. type: definePropType(String),
  22943. values: Ee,
  22944. default: "bottom-start"
  22945. },
  22946. fallbackPlacements: {
  22947. type: definePropType(Array),
  22948. default: ["bottom-start", "bottom", "top-start", "top", "right", "left"]
  22949. },
  22950. popperClass: {
  22951. type: String,
  22952. default: ""
  22953. },
  22954. teleported: useTooltipContentProps.teleported,
  22955. tagType: { ...tagProps.type, default: "info" },
  22956. tagEffect: { ...tagProps.effect, default: "light" },
  22957. validateEvent: {
  22958. type: Boolean,
  22959. default: true
  22960. },
  22961. persistent: {
  22962. type: Boolean,
  22963. default: true
  22964. },
  22965. ...useEmptyValuesProps
  22966. });
  22967. const cascaderEmits = {
  22968. [UPDATE_MODEL_EVENT]: (_) => true,
  22969. [CHANGE_EVENT]: (_) => true,
  22970. focus: (evt) => evt instanceof FocusEvent,
  22971. blur: (evt) => evt instanceof FocusEvent,
  22972. clear: () => true,
  22973. visibleChange: (val) => isBoolean(val),
  22974. expandChange: (val) => !!val,
  22975. removeTag: (val) => !!val
  22976. };
  22977. const COMPONENT_NAME$e = "ElCascader";
  22978. const __default__$1h = defineComponent({
  22979. name: COMPONENT_NAME$e
  22980. });
  22981. const _sfc_main$1P = /* @__PURE__ */ defineComponent({
  22982. ...__default__$1h,
  22983. props: cascaderProps,
  22984. emits: cascaderEmits,
  22985. setup(__props, { expose, emit }) {
  22986. const props = __props;
  22987. const popperOptions = {
  22988. modifiers: [
  22989. {
  22990. name: "arrowPosition",
  22991. enabled: true,
  22992. phase: "main",
  22993. fn: ({ state }) => {
  22994. const { modifiersData, placement } = state;
  22995. if (["right", "left", "bottom", "top"].includes(placement))
  22996. return;
  22997. modifiersData.arrow.x = 35;
  22998. },
  22999. requires: ["arrow"]
  23000. }
  23001. ]
  23002. };
  23003. const attrs = useAttrs$1();
  23004. let inputInitialHeight = 0;
  23005. let pressDeleteCount = 0;
  23006. const nsCascader = useNamespace("cascader");
  23007. const nsInput = useNamespace("input");
  23008. const { t } = useLocale();
  23009. const { form, formItem } = useFormItem();
  23010. const { valueOnClear } = useEmptyValues(props);
  23011. const { isComposing, handleComposition } = useComposition({
  23012. afterComposition(event) {
  23013. var _a;
  23014. const text = (_a = event.target) == null ? void 0 : _a.value;
  23015. handleInput(text);
  23016. }
  23017. });
  23018. const tooltipRef = ref(null);
  23019. const input = ref(null);
  23020. const tagWrapper = ref(null);
  23021. const cascaderPanelRef = ref(null);
  23022. const suggestionPanel = ref(null);
  23023. const popperVisible = ref(false);
  23024. const inputHover = ref(false);
  23025. const filtering = ref(false);
  23026. const filterFocus = ref(false);
  23027. const inputValue = ref("");
  23028. const searchInputValue = ref("");
  23029. const presentTags = ref([]);
  23030. const allPresentTags = ref([]);
  23031. const suggestions = ref([]);
  23032. const cascaderStyle = computed(() => {
  23033. return attrs.style;
  23034. });
  23035. const isDisabled = computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  23036. const inputPlaceholder = computed(() => props.placeholder || t("el.cascader.placeholder"));
  23037. const currentPlaceholder = computed(() => searchInputValue.value || presentTags.value.length > 0 || isComposing.value ? "" : inputPlaceholder.value);
  23038. const realSize = useFormSize();
  23039. const tagSize = computed(() => realSize.value === "small" ? "small" : "default");
  23040. const multiple = computed(() => !!props.props.multiple);
  23041. const readonly = computed(() => !props.filterable || multiple.value);
  23042. const searchKeyword = computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  23043. const checkedNodes = computed(() => {
  23044. var _a;
  23045. return ((_a = cascaderPanelRef.value) == null ? void 0 : _a.checkedNodes) || [];
  23046. });
  23047. const clearBtnVisible = computed(() => {
  23048. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  23049. return false;
  23050. return !!checkedNodes.value.length;
  23051. });
  23052. const presentText = computed(() => {
  23053. const { showAllLevels, separator } = props;
  23054. const nodes = checkedNodes.value;
  23055. return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
  23056. });
  23057. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  23058. const checkedValue = computed({
  23059. get() {
  23060. return cloneDeep(props.modelValue);
  23061. },
  23062. set(val) {
  23063. const value = val != null ? val : valueOnClear.value;
  23064. emit(UPDATE_MODEL_EVENT, value);
  23065. emit(CHANGE_EVENT, value);
  23066. if (props.validateEvent) {
  23067. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  23068. }
  23069. }
  23070. });
  23071. const cascaderKls = computed(() => {
  23072. return [
  23073. nsCascader.b(),
  23074. nsCascader.m(realSize.value),
  23075. nsCascader.is("disabled", isDisabled.value),
  23076. attrs.class
  23077. ];
  23078. });
  23079. const cascaderIconKls = computed(() => {
  23080. return [
  23081. nsInput.e("icon"),
  23082. "icon-arrow-down",
  23083. nsCascader.is("reverse", popperVisible.value)
  23084. ];
  23085. });
  23086. const inputClass = computed(() => {
  23087. return nsCascader.is("focus", popperVisible.value || filterFocus.value);
  23088. });
  23089. const contentRef = computed(() => {
  23090. var _a, _b;
  23091. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  23092. });
  23093. const togglePopperVisible = (visible) => {
  23094. var _a, _b, _c;
  23095. if (isDisabled.value)
  23096. return;
  23097. visible = visible != null ? visible : !popperVisible.value;
  23098. if (visible !== popperVisible.value) {
  23099. popperVisible.value = visible;
  23100. (_b = (_a = input.value) == null ? void 0 : _a.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`);
  23101. if (visible) {
  23102. updatePopperPosition();
  23103. nextTick((_c = cascaderPanelRef.value) == null ? void 0 : _c.scrollToExpandingNode);
  23104. } else if (props.filterable) {
  23105. syncPresentTextValue();
  23106. }
  23107. emit("visibleChange", visible);
  23108. }
  23109. };
  23110. const updatePopperPosition = () => {
  23111. nextTick(() => {
  23112. var _a;
  23113. (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  23114. });
  23115. };
  23116. const hideSuggestionPanel = () => {
  23117. filtering.value = false;
  23118. };
  23119. const genTag = (node) => {
  23120. const { showAllLevels, separator } = props;
  23121. return {
  23122. node,
  23123. key: node.uid,
  23124. text: node.calcText(showAllLevels, separator),
  23125. hitState: false,
  23126. closable: !isDisabled.value && !node.isDisabled,
  23127. isCollapseTag: false
  23128. };
  23129. };
  23130. const deleteTag = (tag) => {
  23131. var _a;
  23132. const node = tag.node;
  23133. node.doCheck(false);
  23134. (_a = cascaderPanelRef.value) == null ? void 0 : _a.calculateCheckedValue();
  23135. emit("removeTag", node.valueByOption);
  23136. };
  23137. const calculatePresentTags = () => {
  23138. if (!multiple.value)
  23139. return;
  23140. const nodes = checkedNodes.value;
  23141. const tags = [];
  23142. const allTags = [];
  23143. nodes.forEach((node) => allTags.push(genTag(node)));
  23144. allPresentTags.value = allTags;
  23145. if (nodes.length) {
  23146. nodes.slice(0, props.maxCollapseTags).forEach((node) => tags.push(genTag(node)));
  23147. const rest = nodes.slice(props.maxCollapseTags);
  23148. const restCount = rest.length;
  23149. if (restCount) {
  23150. if (props.collapseTags) {
  23151. tags.push({
  23152. key: -1,
  23153. text: `+ ${restCount}`,
  23154. closable: false,
  23155. isCollapseTag: true
  23156. });
  23157. } else {
  23158. rest.forEach((node) => tags.push(genTag(node)));
  23159. }
  23160. }
  23161. }
  23162. presentTags.value = tags;
  23163. };
  23164. const calculateSuggestions = () => {
  23165. var _a, _b;
  23166. const { filterMethod, showAllLevels, separator } = props;
  23167. const res = (_b = (_a = cascaderPanelRef.value) == null ? void 0 : _a.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b.filter((node) => {
  23168. if (node.isDisabled)
  23169. return false;
  23170. node.calcText(showAllLevels, separator);
  23171. return filterMethod(node, searchKeyword.value);
  23172. });
  23173. if (multiple.value) {
  23174. presentTags.value.forEach((tag) => {
  23175. tag.hitState = false;
  23176. });
  23177. allPresentTags.value.forEach((tag) => {
  23178. tag.hitState = false;
  23179. });
  23180. }
  23181. filtering.value = true;
  23182. suggestions.value = res;
  23183. updatePopperPosition();
  23184. };
  23185. const focusFirstNode = () => {
  23186. var _a;
  23187. let firstNode;
  23188. if (filtering.value && suggestionPanel.value) {
  23189. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  23190. } else {
  23191. firstNode = (_a = cascaderPanelRef.value) == null ? void 0 : _a.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  23192. }
  23193. if (firstNode) {
  23194. firstNode.focus();
  23195. !filtering.value && firstNode.click();
  23196. }
  23197. };
  23198. const updateStyle = () => {
  23199. var _a, _b;
  23200. const inputInner = (_a = input.value) == null ? void 0 : _a.input;
  23201. const tagWrapperEl = tagWrapper.value;
  23202. const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el;
  23203. if (!isClient || !inputInner)
  23204. return;
  23205. if (suggestionPanelEl) {
  23206. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  23207. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  23208. }
  23209. if (tagWrapperEl) {
  23210. const { offsetHeight } = tagWrapperEl;
  23211. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight, inputInitialHeight) - 2}px` : `${inputInitialHeight}px`;
  23212. inputInner.style.height = height;
  23213. updatePopperPosition();
  23214. }
  23215. };
  23216. const getCheckedNodes = (leafOnly) => {
  23217. var _a;
  23218. return (_a = cascaderPanelRef.value) == null ? void 0 : _a.getCheckedNodes(leafOnly);
  23219. };
  23220. const handleExpandChange = (value) => {
  23221. updatePopperPosition();
  23222. emit("expandChange", value);
  23223. };
  23224. const handleKeyDown = (e) => {
  23225. if (isComposing.value)
  23226. return;
  23227. switch (e.code) {
  23228. case EVENT_CODE.enter:
  23229. case EVENT_CODE.numpadEnter:
  23230. togglePopperVisible();
  23231. break;
  23232. case EVENT_CODE.down:
  23233. togglePopperVisible(true);
  23234. nextTick(focusFirstNode);
  23235. e.preventDefault();
  23236. break;
  23237. case EVENT_CODE.esc:
  23238. if (popperVisible.value === true) {
  23239. e.preventDefault();
  23240. e.stopPropagation();
  23241. togglePopperVisible(false);
  23242. }
  23243. break;
  23244. case EVENT_CODE.tab:
  23245. togglePopperVisible(false);
  23246. break;
  23247. }
  23248. };
  23249. const handleClear = () => {
  23250. var _a;
  23251. (_a = cascaderPanelRef.value) == null ? void 0 : _a.clearCheckedNodes();
  23252. if (!popperVisible.value && props.filterable) {
  23253. syncPresentTextValue();
  23254. }
  23255. togglePopperVisible(false);
  23256. emit("clear");
  23257. };
  23258. const syncPresentTextValue = () => {
  23259. const { value } = presentText;
  23260. inputValue.value = value;
  23261. searchInputValue.value = value;
  23262. };
  23263. const handleSuggestionClick = (node) => {
  23264. var _a, _b;
  23265. const { checked } = node;
  23266. if (multiple.value) {
  23267. (_a = cascaderPanelRef.value) == null ? void 0 : _a.handleCheckChange(node, !checked, false);
  23268. } else {
  23269. !checked && ((_b = cascaderPanelRef.value) == null ? void 0 : _b.handleCheckChange(node, true, false));
  23270. togglePopperVisible(false);
  23271. }
  23272. };
  23273. const handleSuggestionKeyDown = (e) => {
  23274. const target = e.target;
  23275. const { code } = e;
  23276. switch (code) {
  23277. case EVENT_CODE.up:
  23278. case EVENT_CODE.down: {
  23279. const distance = code === EVENT_CODE.up ? -1 : 1;
  23280. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  23281. break;
  23282. }
  23283. case EVENT_CODE.enter:
  23284. case EVENT_CODE.numpadEnter:
  23285. target.click();
  23286. break;
  23287. }
  23288. };
  23289. const handleDelete = () => {
  23290. const tags = presentTags.value;
  23291. const lastTag = tags[tags.length - 1];
  23292. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  23293. if (!lastTag || !pressDeleteCount || props.collapseTags && tags.length > 1)
  23294. return;
  23295. if (lastTag.hitState) {
  23296. deleteTag(lastTag);
  23297. } else {
  23298. lastTag.hitState = true;
  23299. }
  23300. };
  23301. const handleFocus = (e) => {
  23302. const el = e.target;
  23303. const name = nsCascader.e("search-input");
  23304. if (el.className === name) {
  23305. filterFocus.value = true;
  23306. }
  23307. emit("focus", e);
  23308. };
  23309. const handleBlur = (e) => {
  23310. filterFocus.value = false;
  23311. emit("blur", e);
  23312. };
  23313. const handleFilter = debounce(() => {
  23314. const { value } = searchKeyword;
  23315. if (!value)
  23316. return;
  23317. const passed = props.beforeFilter(value);
  23318. if (isPromise(passed)) {
  23319. passed.then(calculateSuggestions).catch(() => {
  23320. });
  23321. } else if (passed !== false) {
  23322. calculateSuggestions();
  23323. } else {
  23324. hideSuggestionPanel();
  23325. }
  23326. }, props.debounce);
  23327. const handleInput = (val, e) => {
  23328. !popperVisible.value && togglePopperVisible(true);
  23329. if (e == null ? void 0 : e.isComposing)
  23330. return;
  23331. val ? handleFilter() : hideSuggestionPanel();
  23332. };
  23333. const getInputInnerHeight = (inputInner) => Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
  23334. watch(filtering, updatePopperPosition);
  23335. watch([checkedNodes, isDisabled, () => props.collapseTags], calculatePresentTags);
  23336. watch(presentTags, () => {
  23337. nextTick(() => updateStyle());
  23338. });
  23339. watch(realSize, async () => {
  23340. await nextTick();
  23341. const inputInner = input.value.input;
  23342. inputInitialHeight = getInputInnerHeight(inputInner) || inputInitialHeight;
  23343. updateStyle();
  23344. });
  23345. watch(presentText, syncPresentTextValue, { immediate: true });
  23346. onMounted(() => {
  23347. const inputInner = input.value.input;
  23348. const inputInnerHeight = getInputInnerHeight(inputInner);
  23349. inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
  23350. useResizeObserver(inputInner, updateStyle);
  23351. });
  23352. expose({
  23353. getCheckedNodes,
  23354. cascaderPanelRef,
  23355. togglePopperVisible,
  23356. contentRef,
  23357. presentText
  23358. });
  23359. return (_ctx, _cache) => {
  23360. return openBlock(), createBlock(unref(ElTooltip), {
  23361. ref_key: "tooltipRef",
  23362. ref: tooltipRef,
  23363. visible: popperVisible.value,
  23364. teleported: _ctx.teleported,
  23365. "popper-class": [unref(nsCascader).e("dropdown"), _ctx.popperClass],
  23366. "popper-options": popperOptions,
  23367. "fallback-placements": _ctx.fallbackPlacements,
  23368. "stop-popper-mouse-event": false,
  23369. "gpu-acceleration": false,
  23370. placement: _ctx.placement,
  23371. transition: `${unref(nsCascader).namespace.value}-zoom-in-top`,
  23372. effect: "light",
  23373. pure: "",
  23374. persistent: _ctx.persistent,
  23375. onHide: hideSuggestionPanel
  23376. }, {
  23377. default: withCtx(() => [
  23378. withDirectives((openBlock(), createElementBlock("div", {
  23379. class: normalizeClass(unref(cascaderKls)),
  23380. style: normalizeStyle(unref(cascaderStyle)),
  23381. onClick: () => togglePopperVisible(unref(readonly) ? void 0 : true),
  23382. onKeydown: handleKeyDown,
  23383. onMouseenter: ($event) => inputHover.value = true,
  23384. onMouseleave: ($event) => inputHover.value = false
  23385. }, [
  23386. createVNode(unref(ElInput), {
  23387. ref_key: "input",
  23388. ref: input,
  23389. modelValue: inputValue.value,
  23390. "onUpdate:modelValue": ($event) => inputValue.value = $event,
  23391. placeholder: unref(currentPlaceholder),
  23392. readonly: unref(readonly),
  23393. disabled: unref(isDisabled),
  23394. "validate-event": false,
  23395. size: unref(realSize),
  23396. class: normalizeClass(unref(inputClass)),
  23397. tabindex: unref(multiple) && _ctx.filterable && !unref(isDisabled) ? -1 : void 0,
  23398. onCompositionstart: unref(handleComposition),
  23399. onCompositionupdate: unref(handleComposition),
  23400. onCompositionend: unref(handleComposition),
  23401. onFocus: handleFocus,
  23402. onBlur: handleBlur,
  23403. onInput: handleInput
  23404. }, {
  23405. suffix: withCtx(() => [
  23406. unref(clearBtnVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  23407. key: "clear",
  23408. class: normalizeClass([unref(nsInput).e("icon"), "icon-circle-close"]),
  23409. onClick: withModifiers(handleClear, ["stop"])
  23410. }, {
  23411. default: withCtx(() => [
  23412. createVNode(unref(circle_close_default))
  23413. ]),
  23414. _: 1
  23415. }, 8, ["class", "onClick"])) : (openBlock(), createBlock(unref(ElIcon), {
  23416. key: "arrow-down",
  23417. class: normalizeClass(unref(cascaderIconKls)),
  23418. onClick: withModifiers(($event) => togglePopperVisible(), ["stop"])
  23419. }, {
  23420. default: withCtx(() => [
  23421. createVNode(unref(arrow_down_default))
  23422. ]),
  23423. _: 1
  23424. }, 8, ["class", "onClick"]))
  23425. ]),
  23426. _: 1
  23427. }, 8, ["modelValue", "onUpdate:modelValue", "placeholder", "readonly", "disabled", "size", "class", "tabindex", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
  23428. unref(multiple) ? (openBlock(), createElementBlock("div", {
  23429. key: 0,
  23430. ref_key: "tagWrapper",
  23431. ref: tagWrapper,
  23432. class: normalizeClass([
  23433. unref(nsCascader).e("tags"),
  23434. unref(nsCascader).is("validate", Boolean(unref(validateState)))
  23435. ])
  23436. }, [
  23437. (openBlock(true), createElementBlock(Fragment, null, renderList(presentTags.value, (tag) => {
  23438. return openBlock(), createBlock(unref(ElTag), {
  23439. key: tag.key,
  23440. type: _ctx.tagType,
  23441. size: unref(tagSize),
  23442. effect: _ctx.tagEffect,
  23443. hit: tag.hitState,
  23444. closable: tag.closable,
  23445. "disable-transitions": "",
  23446. onClose: ($event) => deleteTag(tag)
  23447. }, {
  23448. default: withCtx(() => [
  23449. tag.isCollapseTag === false ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(tag.text), 1)) : (openBlock(), createBlock(unref(ElTooltip), {
  23450. key: 1,
  23451. disabled: popperVisible.value || !_ctx.collapseTagsTooltip,
  23452. "fallback-placements": ["bottom", "top", "right", "left"],
  23453. placement: "bottom",
  23454. effect: "light"
  23455. }, {
  23456. default: withCtx(() => [
  23457. createElementVNode("span", null, toDisplayString(tag.text), 1)
  23458. ]),
  23459. content: withCtx(() => [
  23460. createElementVNode("div", {
  23461. class: normalizeClass(unref(nsCascader).e("collapse-tags"))
  23462. }, [
  23463. (openBlock(true), createElementBlock(Fragment, null, renderList(allPresentTags.value.slice(_ctx.maxCollapseTags), (tag2, idx) => {
  23464. return openBlock(), createElementBlock("div", {
  23465. key: idx,
  23466. class: normalizeClass(unref(nsCascader).e("collapse-tag"))
  23467. }, [
  23468. (openBlock(), createBlock(unref(ElTag), {
  23469. key: tag2.key,
  23470. class: "in-tooltip",
  23471. type: _ctx.tagType,
  23472. size: unref(tagSize),
  23473. effect: _ctx.tagEffect,
  23474. hit: tag2.hitState,
  23475. closable: tag2.closable,
  23476. "disable-transitions": "",
  23477. onClose: ($event) => deleteTag(tag2)
  23478. }, {
  23479. default: withCtx(() => [
  23480. createElementVNode("span", null, toDisplayString(tag2.text), 1)
  23481. ]),
  23482. _: 2
  23483. }, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]))
  23484. ], 2);
  23485. }), 128))
  23486. ], 2)
  23487. ]),
  23488. _: 2
  23489. }, 1032, ["disabled"]))
  23490. ]),
  23491. _: 2
  23492. }, 1032, ["type", "size", "effect", "hit", "closable", "onClose"]);
  23493. }), 128)),
  23494. _ctx.filterable && !unref(isDisabled) ? withDirectives((openBlock(), createElementBlock("input", {
  23495. key: 0,
  23496. "onUpdate:modelValue": ($event) => searchInputValue.value = $event,
  23497. type: "text",
  23498. class: normalizeClass(unref(nsCascader).e("search-input")),
  23499. placeholder: unref(presentText) ? "" : unref(inputPlaceholder),
  23500. onInput: (e) => handleInput(searchInputValue.value, e),
  23501. onClick: withModifiers(($event) => togglePopperVisible(true), ["stop"]),
  23502. onKeydown: withKeys(handleDelete, ["delete"]),
  23503. onCompositionstart: unref(handleComposition),
  23504. onCompositionupdate: unref(handleComposition),
  23505. onCompositionend: unref(handleComposition),
  23506. onFocus: handleFocus,
  23507. onBlur: handleBlur
  23508. }, null, 42, ["onUpdate:modelValue", "placeholder", "onInput", "onClick", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend"])), [
  23509. [vModelText, searchInputValue.value]
  23510. ]) : createCommentVNode("v-if", true)
  23511. ], 2)) : createCommentVNode("v-if", true)
  23512. ], 46, ["onClick", "onMouseenter", "onMouseleave"])), [
  23513. [unref(ClickOutside), () => togglePopperVisible(false), unref(contentRef)]
  23514. ])
  23515. ]),
  23516. content: withCtx(() => [
  23517. withDirectives(createVNode(unref(ElCascaderPanel), {
  23518. ref_key: "cascaderPanelRef",
  23519. ref: cascaderPanelRef,
  23520. modelValue: unref(checkedValue),
  23521. "onUpdate:modelValue": ($event) => isRef(checkedValue) ? checkedValue.value = $event : null,
  23522. options: _ctx.options,
  23523. props: props.props,
  23524. border: false,
  23525. "render-label": _ctx.$slots.default,
  23526. onExpandChange: handleExpandChange,
  23527. onClose: ($event) => _ctx.$nextTick(() => togglePopperVisible(false))
  23528. }, {
  23529. empty: withCtx(() => [
  23530. renderSlot(_ctx.$slots, "empty")
  23531. ]),
  23532. _: 3
  23533. }, 8, ["modelValue", "onUpdate:modelValue", "options", "props", "render-label", "onClose"]), [
  23534. [vShow, !filtering.value]
  23535. ]),
  23536. _ctx.filterable ? withDirectives((openBlock(), createBlock(unref(ElScrollbar), {
  23537. key: 0,
  23538. ref_key: "suggestionPanel",
  23539. ref: suggestionPanel,
  23540. tag: "ul",
  23541. class: normalizeClass(unref(nsCascader).e("suggestion-panel")),
  23542. "view-class": unref(nsCascader).e("suggestion-list"),
  23543. onKeydown: handleSuggestionKeyDown
  23544. }, {
  23545. default: withCtx(() => [
  23546. suggestions.value.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(suggestions.value, (item) => {
  23547. return openBlock(), createElementBlock("li", {
  23548. key: item.uid,
  23549. class: normalizeClass([
  23550. unref(nsCascader).e("suggestion-item"),
  23551. unref(nsCascader).is("checked", item.checked)
  23552. ]),
  23553. tabindex: -1,
  23554. onClick: ($event) => handleSuggestionClick(item)
  23555. }, [
  23556. createElementVNode("span", null, toDisplayString(item.text), 1),
  23557. item.checked ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  23558. default: withCtx(() => [
  23559. createVNode(unref(check_default))
  23560. ]),
  23561. _: 1
  23562. })) : createCommentVNode("v-if", true)
  23563. ], 10, ["onClick"]);
  23564. }), 128)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  23565. createElementVNode("li", {
  23566. class: normalizeClass(unref(nsCascader).e("empty-text"))
  23567. }, toDisplayString(unref(t)("el.cascader.noMatch")), 3)
  23568. ])
  23569. ]),
  23570. _: 3
  23571. }, 8, ["class", "view-class"])), [
  23572. [vShow, filtering.value]
  23573. ]) : createCommentVNode("v-if", true)
  23574. ]),
  23575. _: 3
  23576. }, 8, ["visible", "teleported", "popper-class", "fallback-placements", "placement", "transition", "persistent"]);
  23577. };
  23578. }
  23579. });
  23580. var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$1P, [["__file", "cascader.vue"]]);
  23581. const ElCascader = withInstall(Cascader);
  23582. const checkTagProps = buildProps({
  23583. checked: Boolean,
  23584. disabled: Boolean,
  23585. type: {
  23586. type: String,
  23587. values: ["primary", "success", "info", "warning", "danger"],
  23588. default: "primary"
  23589. }
  23590. });
  23591. const checkTagEmits = {
  23592. "update:checked": (value) => isBoolean(value),
  23593. [CHANGE_EVENT]: (value) => isBoolean(value)
  23594. };
  23595. const __default__$1g = defineComponent({
  23596. name: "ElCheckTag"
  23597. });
  23598. const _sfc_main$1O = /* @__PURE__ */ defineComponent({
  23599. ...__default__$1g,
  23600. props: checkTagProps,
  23601. emits: checkTagEmits,
  23602. setup(__props, { emit }) {
  23603. const props = __props;
  23604. const ns = useNamespace("check-tag");
  23605. const isDisabled = computed(() => props.disabled);
  23606. const containerKls = computed(() => [
  23607. ns.b(),
  23608. ns.is("checked", props.checked),
  23609. ns.is("disabled", isDisabled.value),
  23610. ns.m(props.type || "primary")
  23611. ]);
  23612. const handleChange = () => {
  23613. if (isDisabled.value)
  23614. return;
  23615. const checked = !props.checked;
  23616. emit(CHANGE_EVENT, checked);
  23617. emit("update:checked", checked);
  23618. };
  23619. return (_ctx, _cache) => {
  23620. return openBlock(), createElementBlock("span", {
  23621. class: normalizeClass(unref(containerKls)),
  23622. onClick: handleChange
  23623. }, [
  23624. renderSlot(_ctx.$slots, "default")
  23625. ], 2);
  23626. };
  23627. }
  23628. });
  23629. var CheckTag = /* @__PURE__ */ _export_sfc(_sfc_main$1O, [["__file", "check-tag.vue"]]);
  23630. const ElCheckTag = withInstall(CheckTag);
  23631. const rowContextKey = Symbol("rowContextKey");
  23632. const RowJustify = [
  23633. "start",
  23634. "center",
  23635. "end",
  23636. "space-around",
  23637. "space-between",
  23638. "space-evenly"
  23639. ];
  23640. const RowAlign = ["top", "middle", "bottom"];
  23641. const rowProps = buildProps({
  23642. tag: {
  23643. type: String,
  23644. default: "div"
  23645. },
  23646. gutter: {
  23647. type: Number,
  23648. default: 0
  23649. },
  23650. justify: {
  23651. type: String,
  23652. values: RowJustify,
  23653. default: "start"
  23654. },
  23655. align: {
  23656. type: String,
  23657. values: RowAlign
  23658. }
  23659. });
  23660. const __default__$1f = defineComponent({
  23661. name: "ElRow"
  23662. });
  23663. const _sfc_main$1N = /* @__PURE__ */ defineComponent({
  23664. ...__default__$1f,
  23665. props: rowProps,
  23666. setup(__props) {
  23667. const props = __props;
  23668. const ns = useNamespace("row");
  23669. const gutter = computed(() => props.gutter);
  23670. provide(rowContextKey, {
  23671. gutter
  23672. });
  23673. const style = computed(() => {
  23674. const styles = {};
  23675. if (!props.gutter) {
  23676. return styles;
  23677. }
  23678. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  23679. return styles;
  23680. });
  23681. const rowKls = computed(() => [
  23682. ns.b(),
  23683. ns.is(`justify-${props.justify}`, props.justify !== "start"),
  23684. ns.is(`align-${props.align}`, !!props.align)
  23685. ]);
  23686. return (_ctx, _cache) => {
  23687. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  23688. class: normalizeClass(unref(rowKls)),
  23689. style: normalizeStyle(unref(style))
  23690. }, {
  23691. default: withCtx(() => [
  23692. renderSlot(_ctx.$slots, "default")
  23693. ]),
  23694. _: 3
  23695. }, 8, ["class", "style"]);
  23696. };
  23697. }
  23698. });
  23699. var Row$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1N, [["__file", "row.vue"]]);
  23700. const ElRow = withInstall(Row$1);
  23701. const colProps = buildProps({
  23702. tag: {
  23703. type: String,
  23704. default: "div"
  23705. },
  23706. span: {
  23707. type: Number,
  23708. default: 24
  23709. },
  23710. offset: {
  23711. type: Number,
  23712. default: 0
  23713. },
  23714. pull: {
  23715. type: Number,
  23716. default: 0
  23717. },
  23718. push: {
  23719. type: Number,
  23720. default: 0
  23721. },
  23722. xs: {
  23723. type: definePropType([Number, Object]),
  23724. default: () => mutable({})
  23725. },
  23726. sm: {
  23727. type: definePropType([Number, Object]),
  23728. default: () => mutable({})
  23729. },
  23730. md: {
  23731. type: definePropType([Number, Object]),
  23732. default: () => mutable({})
  23733. },
  23734. lg: {
  23735. type: definePropType([Number, Object]),
  23736. default: () => mutable({})
  23737. },
  23738. xl: {
  23739. type: definePropType([Number, Object]),
  23740. default: () => mutable({})
  23741. }
  23742. });
  23743. const __default__$1e = defineComponent({
  23744. name: "ElCol"
  23745. });
  23746. const _sfc_main$1M = /* @__PURE__ */ defineComponent({
  23747. ...__default__$1e,
  23748. props: colProps,
  23749. setup(__props) {
  23750. const props = __props;
  23751. const { gutter } = inject(rowContextKey, { gutter: computed(() => 0) });
  23752. const ns = useNamespace("col");
  23753. const style = computed(() => {
  23754. const styles = {};
  23755. if (gutter.value) {
  23756. styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
  23757. }
  23758. return styles;
  23759. });
  23760. const colKls = computed(() => {
  23761. const classes = [];
  23762. const pos = ["span", "offset", "pull", "push"];
  23763. pos.forEach((prop) => {
  23764. const size = props[prop];
  23765. if (isNumber(size)) {
  23766. if (prop === "span")
  23767. classes.push(ns.b(`${props[prop]}`));
  23768. else if (size > 0)
  23769. classes.push(ns.b(`${prop}-${props[prop]}`));
  23770. }
  23771. });
  23772. const sizes = ["xs", "sm", "md", "lg", "xl"];
  23773. sizes.forEach((size) => {
  23774. if (isNumber(props[size])) {
  23775. classes.push(ns.b(`${size}-${props[size]}`));
  23776. } else if (isObject$1(props[size])) {
  23777. Object.entries(props[size]).forEach(([prop, sizeProp]) => {
  23778. classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
  23779. });
  23780. }
  23781. });
  23782. if (gutter.value) {
  23783. classes.push(ns.is("guttered"));
  23784. }
  23785. return [ns.b(), classes];
  23786. });
  23787. return (_ctx, _cache) => {
  23788. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  23789. class: normalizeClass(unref(colKls)),
  23790. style: normalizeStyle(unref(style))
  23791. }, {
  23792. default: withCtx(() => [
  23793. renderSlot(_ctx.$slots, "default")
  23794. ]),
  23795. _: 3
  23796. }, 8, ["class", "style"]);
  23797. };
  23798. }
  23799. });
  23800. var Col = /* @__PURE__ */ _export_sfc(_sfc_main$1M, [["__file", "col.vue"]]);
  23801. const ElCol = withInstall(Col);
  23802. const emitChangeFn = (value) => isNumber(value) || isString$1(value) || isArray$1(value);
  23803. const collapseProps = buildProps({
  23804. accordion: Boolean,
  23805. modelValue: {
  23806. type: definePropType([Array, String, Number]),
  23807. default: () => mutable([])
  23808. }
  23809. });
  23810. const collapseEmits = {
  23811. [UPDATE_MODEL_EVENT]: emitChangeFn,
  23812. [CHANGE_EVENT]: emitChangeFn
  23813. };
  23814. const collapseContextKey = Symbol("collapseContextKey");
  23815. const useCollapse = (props, emit) => {
  23816. const activeNames = ref(castArray$1(props.modelValue));
  23817. const setActiveNames = (_activeNames) => {
  23818. activeNames.value = _activeNames;
  23819. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  23820. emit(UPDATE_MODEL_EVENT, value);
  23821. emit(CHANGE_EVENT, value);
  23822. };
  23823. const handleItemClick = (name) => {
  23824. if (props.accordion) {
  23825. setActiveNames([activeNames.value[0] === name ? "" : name]);
  23826. } else {
  23827. const _activeNames = [...activeNames.value];
  23828. const index = _activeNames.indexOf(name);
  23829. if (index > -1) {
  23830. _activeNames.splice(index, 1);
  23831. } else {
  23832. _activeNames.push(name);
  23833. }
  23834. setActiveNames(_activeNames);
  23835. }
  23836. };
  23837. watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true });
  23838. provide(collapseContextKey, {
  23839. activeNames,
  23840. handleItemClick
  23841. });
  23842. return {
  23843. activeNames,
  23844. setActiveNames
  23845. };
  23846. };
  23847. const useCollapseDOM = () => {
  23848. const ns = useNamespace("collapse");
  23849. const rootKls = computed(() => ns.b());
  23850. return {
  23851. rootKls
  23852. };
  23853. };
  23854. const __default__$1d = defineComponent({
  23855. name: "ElCollapse"
  23856. });
  23857. const _sfc_main$1L = /* @__PURE__ */ defineComponent({
  23858. ...__default__$1d,
  23859. props: collapseProps,
  23860. emits: collapseEmits,
  23861. setup(__props, { expose, emit }) {
  23862. const props = __props;
  23863. const { activeNames, setActiveNames } = useCollapse(props, emit);
  23864. const { rootKls } = useCollapseDOM();
  23865. expose({
  23866. activeNames,
  23867. setActiveNames
  23868. });
  23869. return (_ctx, _cache) => {
  23870. return openBlock(), createElementBlock("div", {
  23871. class: normalizeClass(unref(rootKls))
  23872. }, [
  23873. renderSlot(_ctx.$slots, "default")
  23874. ], 2);
  23875. };
  23876. }
  23877. });
  23878. var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main$1L, [["__file", "collapse.vue"]]);
  23879. const __default__$1c = defineComponent({
  23880. name: "ElCollapseTransition"
  23881. });
  23882. const _sfc_main$1K = /* @__PURE__ */ defineComponent({
  23883. ...__default__$1c,
  23884. setup(__props) {
  23885. const ns = useNamespace("collapse-transition");
  23886. const reset = (el) => {
  23887. el.style.maxHeight = "";
  23888. el.style.overflow = el.dataset.oldOverflow;
  23889. el.style.paddingTop = el.dataset.oldPaddingTop;
  23890. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23891. };
  23892. const on = {
  23893. beforeEnter(el) {
  23894. if (!el.dataset)
  23895. el.dataset = {};
  23896. el.dataset.oldPaddingTop = el.style.paddingTop;
  23897. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  23898. if (el.style.height)
  23899. el.dataset.elExistsHeight = el.style.height;
  23900. el.style.maxHeight = 0;
  23901. el.style.paddingTop = 0;
  23902. el.style.paddingBottom = 0;
  23903. },
  23904. enter(el) {
  23905. requestAnimationFrame(() => {
  23906. el.dataset.oldOverflow = el.style.overflow;
  23907. if (el.dataset.elExistsHeight) {
  23908. el.style.maxHeight = el.dataset.elExistsHeight;
  23909. } else if (el.scrollHeight !== 0) {
  23910. el.style.maxHeight = `${el.scrollHeight}px`;
  23911. } else {
  23912. el.style.maxHeight = 0;
  23913. }
  23914. el.style.paddingTop = el.dataset.oldPaddingTop;
  23915. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  23916. el.style.overflow = "hidden";
  23917. });
  23918. },
  23919. afterEnter(el) {
  23920. el.style.maxHeight = "";
  23921. el.style.overflow = el.dataset.oldOverflow;
  23922. },
  23923. enterCancelled(el) {
  23924. reset(el);
  23925. },
  23926. beforeLeave(el) {
  23927. if (!el.dataset)
  23928. el.dataset = {};
  23929. el.dataset.oldPaddingTop = el.style.paddingTop;
  23930. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  23931. el.dataset.oldOverflow = el.style.overflow;
  23932. el.style.maxHeight = `${el.scrollHeight}px`;
  23933. el.style.overflow = "hidden";
  23934. },
  23935. leave(el) {
  23936. if (el.scrollHeight !== 0) {
  23937. el.style.maxHeight = 0;
  23938. el.style.paddingTop = 0;
  23939. el.style.paddingBottom = 0;
  23940. }
  23941. },
  23942. afterLeave(el) {
  23943. reset(el);
  23944. },
  23945. leaveCancelled(el) {
  23946. reset(el);
  23947. }
  23948. };
  23949. return (_ctx, _cache) => {
  23950. return openBlock(), createBlock(Transition, mergeProps({
  23951. name: unref(ns).b()
  23952. }, toHandlers(on)), {
  23953. default: withCtx(() => [
  23954. renderSlot(_ctx.$slots, "default")
  23955. ]),
  23956. _: 3
  23957. }, 16, ["name"]);
  23958. };
  23959. }
  23960. });
  23961. var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$1K, [["__file", "collapse-transition.vue"]]);
  23962. const ElCollapseTransition = withInstall(CollapseTransition);
  23963. const collapseItemProps = buildProps({
  23964. title: {
  23965. type: String,
  23966. default: ""
  23967. },
  23968. name: {
  23969. type: definePropType([String, Number]),
  23970. default: void 0
  23971. },
  23972. icon: {
  23973. type: iconPropType,
  23974. default: arrow_right_default
  23975. },
  23976. disabled: Boolean
  23977. });
  23978. const useCollapseItem = (props) => {
  23979. const collapse = inject(collapseContextKey);
  23980. const { namespace } = useNamespace("collapse");
  23981. const focusing = ref(false);
  23982. const isClick = ref(false);
  23983. const idInjection = useIdInjection();
  23984. const id = computed(() => idInjection.current++);
  23985. const name = computed(() => {
  23986. var _a;
  23987. return (_a = props.name) != null ? _a : `${namespace.value}-id-${idInjection.prefix}-${unref(id)}`;
  23988. });
  23989. const isActive = computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(unref(name)));
  23990. const handleFocus = () => {
  23991. setTimeout(() => {
  23992. if (!isClick.value) {
  23993. focusing.value = true;
  23994. } else {
  23995. isClick.value = false;
  23996. }
  23997. }, 50);
  23998. };
  23999. const handleHeaderClick = () => {
  24000. if (props.disabled)
  24001. return;
  24002. collapse == null ? void 0 : collapse.handleItemClick(unref(name));
  24003. focusing.value = false;
  24004. isClick.value = true;
  24005. };
  24006. const handleEnterClick = () => {
  24007. collapse == null ? void 0 : collapse.handleItemClick(unref(name));
  24008. };
  24009. return {
  24010. focusing,
  24011. id,
  24012. isActive,
  24013. handleFocus,
  24014. handleHeaderClick,
  24015. handleEnterClick
  24016. };
  24017. };
  24018. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  24019. const ns = useNamespace("collapse");
  24020. const rootKls = computed(() => [
  24021. ns.b("item"),
  24022. ns.is("active", unref(isActive)),
  24023. ns.is("disabled", props.disabled)
  24024. ]);
  24025. const headKls = computed(() => [
  24026. ns.be("item", "header"),
  24027. ns.is("active", unref(isActive)),
  24028. { focusing: unref(focusing) && !props.disabled }
  24029. ]);
  24030. const arrowKls = computed(() => [
  24031. ns.be("item", "arrow"),
  24032. ns.is("active", unref(isActive))
  24033. ]);
  24034. const itemWrapperKls = computed(() => ns.be("item", "wrap"));
  24035. const itemContentKls = computed(() => ns.be("item", "content"));
  24036. const scopedContentId = computed(() => ns.b(`content-${unref(id)}`));
  24037. const scopedHeadId = computed(() => ns.b(`head-${unref(id)}`));
  24038. return {
  24039. arrowKls,
  24040. headKls,
  24041. rootKls,
  24042. itemWrapperKls,
  24043. itemContentKls,
  24044. scopedContentId,
  24045. scopedHeadId
  24046. };
  24047. };
  24048. const __default__$1b = defineComponent({
  24049. name: "ElCollapseItem"
  24050. });
  24051. const _sfc_main$1J = /* @__PURE__ */ defineComponent({
  24052. ...__default__$1b,
  24053. props: collapseItemProps,
  24054. setup(__props, { expose }) {
  24055. const props = __props;
  24056. const {
  24057. focusing,
  24058. id,
  24059. isActive,
  24060. handleFocus,
  24061. handleHeaderClick,
  24062. handleEnterClick
  24063. } = useCollapseItem(props);
  24064. const {
  24065. arrowKls,
  24066. headKls,
  24067. rootKls,
  24068. itemWrapperKls,
  24069. itemContentKls,
  24070. scopedContentId,
  24071. scopedHeadId
  24072. } = useCollapseItemDOM(props, { focusing, isActive, id });
  24073. expose({
  24074. isActive
  24075. });
  24076. return (_ctx, _cache) => {
  24077. return openBlock(), createElementBlock("div", {
  24078. class: normalizeClass(unref(rootKls))
  24079. }, [
  24080. createElementVNode("button", {
  24081. id: unref(scopedHeadId),
  24082. class: normalizeClass(unref(headKls)),
  24083. "aria-expanded": unref(isActive),
  24084. "aria-controls": unref(scopedContentId),
  24085. "aria-describedby": unref(scopedContentId),
  24086. tabindex: _ctx.disabled ? -1 : 0,
  24087. type: "button",
  24088. onClick: unref(handleHeaderClick),
  24089. onKeydown: withKeys(withModifiers(unref(handleEnterClick), ["stop", "prevent"]), ["space", "enter"]),
  24090. onFocus: unref(handleFocus),
  24091. onBlur: ($event) => focusing.value = false
  24092. }, [
  24093. renderSlot(_ctx.$slots, "title", {}, () => [
  24094. createTextVNode(toDisplayString(_ctx.title), 1)
  24095. ]),
  24096. renderSlot(_ctx.$slots, "icon", { isActive: unref(isActive) }, () => [
  24097. createVNode(unref(ElIcon), {
  24098. class: normalizeClass(unref(arrowKls))
  24099. }, {
  24100. default: withCtx(() => [
  24101. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  24102. ]),
  24103. _: 1
  24104. }, 8, ["class"])
  24105. ])
  24106. ], 42, ["id", "aria-expanded", "aria-controls", "aria-describedby", "tabindex", "onClick", "onKeydown", "onFocus", "onBlur"]),
  24107. createVNode(unref(ElCollapseTransition), null, {
  24108. default: withCtx(() => [
  24109. withDirectives(createElementVNode("div", {
  24110. id: unref(scopedContentId),
  24111. role: "region",
  24112. class: normalizeClass(unref(itemWrapperKls)),
  24113. "aria-hidden": !unref(isActive),
  24114. "aria-labelledby": unref(scopedHeadId)
  24115. }, [
  24116. createElementVNode("div", {
  24117. class: normalizeClass(unref(itemContentKls))
  24118. }, [
  24119. renderSlot(_ctx.$slots, "default")
  24120. ], 2)
  24121. ], 10, ["id", "aria-hidden", "aria-labelledby"]), [
  24122. [vShow, unref(isActive)]
  24123. ])
  24124. ]),
  24125. _: 3
  24126. })
  24127. ], 2);
  24128. };
  24129. }
  24130. });
  24131. var CollapseItem = /* @__PURE__ */ _export_sfc(_sfc_main$1J, [["__file", "collapse-item.vue"]]);
  24132. const ElCollapse = withInstall(Collapse, {
  24133. CollapseItem
  24134. });
  24135. const ElCollapseItem = withNoopInstall(CollapseItem);
  24136. const alphaSliderProps = buildProps({
  24137. color: {
  24138. type: definePropType(Object),
  24139. required: true
  24140. },
  24141. vertical: {
  24142. type: Boolean,
  24143. default: false
  24144. }
  24145. });
  24146. let isDragging = false;
  24147. function draggable(element, options) {
  24148. if (!isClient)
  24149. return;
  24150. const moveFn = function(event) {
  24151. var _a;
  24152. (_a = options.drag) == null ? void 0 : _a.call(options, event);
  24153. };
  24154. const upFn = function(event) {
  24155. var _a;
  24156. document.removeEventListener("mousemove", moveFn);
  24157. document.removeEventListener("mouseup", upFn);
  24158. document.removeEventListener("touchmove", moveFn);
  24159. document.removeEventListener("touchend", upFn);
  24160. document.onselectstart = null;
  24161. document.ondragstart = null;
  24162. isDragging = false;
  24163. (_a = options.end) == null ? void 0 : _a.call(options, event);
  24164. };
  24165. const downFn = function(event) {
  24166. var _a;
  24167. if (isDragging)
  24168. return;
  24169. event.preventDefault();
  24170. document.onselectstart = () => false;
  24171. document.ondragstart = () => false;
  24172. document.addEventListener("mousemove", moveFn);
  24173. document.addEventListener("mouseup", upFn);
  24174. document.addEventListener("touchmove", moveFn);
  24175. document.addEventListener("touchend", upFn);
  24176. isDragging = true;
  24177. (_a = options.start) == null ? void 0 : _a.call(options, event);
  24178. };
  24179. element.addEventListener("mousedown", downFn);
  24180. element.addEventListener("touchstart", downFn, { passive: false });
  24181. }
  24182. const useAlphaSlider = (props) => {
  24183. const instance = getCurrentInstance();
  24184. const { t } = useLocale();
  24185. const thumb = shallowRef();
  24186. const bar = shallowRef();
  24187. const alpha = computed(() => props.color.get("alpha"));
  24188. const alphaLabel = computed(() => t("el.colorpicker.alphaLabel"));
  24189. function handleClick(event) {
  24190. var _a;
  24191. const target = event.target;
  24192. if (target !== thumb.value) {
  24193. handleDrag(event);
  24194. }
  24195. (_a = thumb.value) == null ? void 0 : _a.focus();
  24196. }
  24197. function handleDrag(event) {
  24198. if (!bar.value || !thumb.value)
  24199. return;
  24200. const el = instance.vnode.el;
  24201. const rect = el.getBoundingClientRect();
  24202. const { clientX, clientY } = getClientXY(event);
  24203. if (!props.vertical) {
  24204. let left = clientX - rect.left;
  24205. left = Math.max(thumb.value.offsetWidth / 2, left);
  24206. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  24207. props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
  24208. } else {
  24209. let top = clientY - rect.top;
  24210. top = Math.max(thumb.value.offsetHeight / 2, top);
  24211. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  24212. props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
  24213. }
  24214. }
  24215. function handleKeydown(event) {
  24216. const { code, shiftKey } = event;
  24217. const step = shiftKey ? 10 : 1;
  24218. switch (code) {
  24219. case EVENT_CODE.left:
  24220. case EVENT_CODE.down:
  24221. event.preventDefault();
  24222. event.stopPropagation();
  24223. incrementPosition(-step);
  24224. break;
  24225. case EVENT_CODE.right:
  24226. case EVENT_CODE.up:
  24227. event.preventDefault();
  24228. event.stopPropagation();
  24229. incrementPosition(step);
  24230. break;
  24231. }
  24232. }
  24233. function incrementPosition(step) {
  24234. let next = alpha.value + step;
  24235. next = next < 0 ? 0 : next > 100 ? 100 : next;
  24236. props.color.set("alpha", next);
  24237. }
  24238. return {
  24239. thumb,
  24240. bar,
  24241. alpha,
  24242. alphaLabel,
  24243. handleDrag,
  24244. handleClick,
  24245. handleKeydown
  24246. };
  24247. };
  24248. const useAlphaSliderDOM = (props, {
  24249. bar,
  24250. thumb,
  24251. handleDrag
  24252. }) => {
  24253. const instance = getCurrentInstance();
  24254. const ns = useNamespace("color-alpha-slider");
  24255. const thumbLeft = ref(0);
  24256. const thumbTop = ref(0);
  24257. const background = ref();
  24258. function getThumbLeft() {
  24259. if (!thumb.value)
  24260. return 0;
  24261. if (props.vertical)
  24262. return 0;
  24263. const el = instance.vnode.el;
  24264. const alpha = props.color.get("alpha");
  24265. if (!el)
  24266. return 0;
  24267. return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
  24268. }
  24269. function getThumbTop() {
  24270. if (!thumb.value)
  24271. return 0;
  24272. const el = instance.vnode.el;
  24273. if (!props.vertical)
  24274. return 0;
  24275. const alpha = props.color.get("alpha");
  24276. if (!el)
  24277. return 0;
  24278. return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
  24279. }
  24280. function getBackground() {
  24281. if (props.color && props.color.value) {
  24282. const { r, g, b } = props.color.toRgb();
  24283. return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
  24284. }
  24285. return "";
  24286. }
  24287. function update() {
  24288. thumbLeft.value = getThumbLeft();
  24289. thumbTop.value = getThumbTop();
  24290. background.value = getBackground();
  24291. }
  24292. onMounted(() => {
  24293. if (!bar.value || !thumb.value)
  24294. return;
  24295. const dragConfig = {
  24296. drag: (event) => {
  24297. handleDrag(event);
  24298. },
  24299. end: (event) => {
  24300. handleDrag(event);
  24301. }
  24302. };
  24303. draggable(bar.value, dragConfig);
  24304. draggable(thumb.value, dragConfig);
  24305. update();
  24306. });
  24307. watch(() => props.color.get("alpha"), () => update());
  24308. watch(() => props.color.value, () => update());
  24309. const rootKls = computed(() => [ns.b(), ns.is("vertical", props.vertical)]);
  24310. const barKls = computed(() => ns.e("bar"));
  24311. const thumbKls = computed(() => ns.e("thumb"));
  24312. const barStyle = computed(() => ({ background: background.value }));
  24313. const thumbStyle = computed(() => ({
  24314. left: addUnit(thumbLeft.value),
  24315. top: addUnit(thumbTop.value)
  24316. }));
  24317. return { rootKls, barKls, barStyle, thumbKls, thumbStyle, update };
  24318. };
  24319. const COMPONENT_NAME$d = "ElColorAlphaSlider";
  24320. const __default__$1a = defineComponent({
  24321. name: COMPONENT_NAME$d
  24322. });
  24323. const _sfc_main$1I = /* @__PURE__ */ defineComponent({
  24324. ...__default__$1a,
  24325. props: alphaSliderProps,
  24326. setup(__props, { expose }) {
  24327. const props = __props;
  24328. const {
  24329. alpha,
  24330. alphaLabel,
  24331. bar,
  24332. thumb,
  24333. handleDrag,
  24334. handleClick,
  24335. handleKeydown
  24336. } = useAlphaSlider(props);
  24337. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, {
  24338. bar,
  24339. thumb,
  24340. handleDrag
  24341. });
  24342. expose({
  24343. update,
  24344. bar,
  24345. thumb
  24346. });
  24347. return (_ctx, _cache) => {
  24348. return openBlock(), createElementBlock("div", {
  24349. class: normalizeClass(unref(rootKls))
  24350. }, [
  24351. createElementVNode("div", {
  24352. ref_key: "bar",
  24353. ref: bar,
  24354. class: normalizeClass(unref(barKls)),
  24355. style: normalizeStyle(unref(barStyle)),
  24356. onClick: unref(handleClick)
  24357. }, null, 14, ["onClick"]),
  24358. createElementVNode("div", {
  24359. ref_key: "thumb",
  24360. ref: thumb,
  24361. class: normalizeClass(unref(thumbKls)),
  24362. style: normalizeStyle(unref(thumbStyle)),
  24363. "aria-label": unref(alphaLabel),
  24364. "aria-valuenow": unref(alpha),
  24365. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  24366. "aria-valuemin": "0",
  24367. "aria-valuemax": "100",
  24368. role: "slider",
  24369. tabindex: "0",
  24370. onKeydown: unref(handleKeydown)
  24371. }, null, 46, ["aria-label", "aria-valuenow", "aria-orientation", "onKeydown"])
  24372. ], 2);
  24373. };
  24374. }
  24375. });
  24376. var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1I, [["__file", "alpha-slider.vue"]]);
  24377. const _sfc_main$1H = defineComponent({
  24378. name: "ElColorHueSlider",
  24379. props: {
  24380. color: {
  24381. type: Object,
  24382. required: true
  24383. },
  24384. vertical: Boolean
  24385. },
  24386. setup(props) {
  24387. const ns = useNamespace("color-hue-slider");
  24388. const instance = getCurrentInstance();
  24389. const thumb = ref();
  24390. const bar = ref();
  24391. const thumbLeft = ref(0);
  24392. const thumbTop = ref(0);
  24393. const hueValue = computed(() => {
  24394. return props.color.get("hue");
  24395. });
  24396. watch(() => hueValue.value, () => {
  24397. update();
  24398. });
  24399. function handleClick(event) {
  24400. const target = event.target;
  24401. if (target !== thumb.value) {
  24402. handleDrag(event);
  24403. }
  24404. }
  24405. function handleDrag(event) {
  24406. if (!bar.value || !thumb.value)
  24407. return;
  24408. const el = instance.vnode.el;
  24409. const rect = el.getBoundingClientRect();
  24410. const { clientX, clientY } = getClientXY(event);
  24411. let hue;
  24412. if (!props.vertical) {
  24413. let left = clientX - rect.left;
  24414. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  24415. left = Math.max(thumb.value.offsetWidth / 2, left);
  24416. hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
  24417. } else {
  24418. let top = clientY - rect.top;
  24419. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  24420. top = Math.max(thumb.value.offsetHeight / 2, top);
  24421. hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
  24422. }
  24423. props.color.set("hue", hue);
  24424. }
  24425. function getThumbLeft() {
  24426. if (!thumb.value)
  24427. return 0;
  24428. const el = instance.vnode.el;
  24429. if (props.vertical)
  24430. return 0;
  24431. const hue = props.color.get("hue");
  24432. if (!el)
  24433. return 0;
  24434. return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
  24435. }
  24436. function getThumbTop() {
  24437. if (!thumb.value)
  24438. return 0;
  24439. const el = instance.vnode.el;
  24440. if (!props.vertical)
  24441. return 0;
  24442. const hue = props.color.get("hue");
  24443. if (!el)
  24444. return 0;
  24445. return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
  24446. }
  24447. function update() {
  24448. thumbLeft.value = getThumbLeft();
  24449. thumbTop.value = getThumbTop();
  24450. }
  24451. onMounted(() => {
  24452. if (!bar.value || !thumb.value)
  24453. return;
  24454. const dragConfig = {
  24455. drag: (event) => {
  24456. handleDrag(event);
  24457. },
  24458. end: (event) => {
  24459. handleDrag(event);
  24460. }
  24461. };
  24462. draggable(bar.value, dragConfig);
  24463. draggable(thumb.value, dragConfig);
  24464. update();
  24465. });
  24466. return {
  24467. bar,
  24468. thumb,
  24469. thumbLeft,
  24470. thumbTop,
  24471. hueValue,
  24472. handleClick,
  24473. update,
  24474. ns
  24475. };
  24476. }
  24477. });
  24478. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  24479. return openBlock(), createElementBlock("div", {
  24480. class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  24481. }, [
  24482. createElementVNode("div", {
  24483. ref: "bar",
  24484. class: normalizeClass(_ctx.ns.e("bar")),
  24485. onClick: _ctx.handleClick
  24486. }, null, 10, ["onClick"]),
  24487. createElementVNode("div", {
  24488. ref: "thumb",
  24489. class: normalizeClass(_ctx.ns.e("thumb")),
  24490. style: normalizeStyle({
  24491. left: _ctx.thumbLeft + "px",
  24492. top: _ctx.thumbTop + "px"
  24493. })
  24494. }, null, 6)
  24495. ], 2);
  24496. }
  24497. var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1H, [["render", _sfc_render$q], ["__file", "hue-slider.vue"]]);
  24498. const colorPickerProps = buildProps({
  24499. modelValue: String,
  24500. id: String,
  24501. showAlpha: Boolean,
  24502. colorFormat: String,
  24503. disabled: Boolean,
  24504. size: useSizeProp,
  24505. popperClass: {
  24506. type: String,
  24507. default: ""
  24508. },
  24509. tabindex: {
  24510. type: [String, Number],
  24511. default: 0
  24512. },
  24513. teleported: useTooltipContentProps.teleported,
  24514. predefine: {
  24515. type: definePropType(Array)
  24516. },
  24517. validateEvent: {
  24518. type: Boolean,
  24519. default: true
  24520. },
  24521. ...useAriaProps(["ariaLabel"])
  24522. });
  24523. const colorPickerEmits = {
  24524. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNil(val),
  24525. [CHANGE_EVENT]: (val) => isString$1(val) || isNil(val),
  24526. activeChange: (val) => isString$1(val) || isNil(val),
  24527. focus: (evt) => evt instanceof FocusEvent,
  24528. blur: (evt) => evt instanceof FocusEvent
  24529. };
  24530. const colorPickerContextKey = Symbol("colorPickerContextKey");
  24531. const hsv2hsl = function(hue, sat, val) {
  24532. return [
  24533. hue,
  24534. sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
  24535. hue / 2
  24536. ];
  24537. };
  24538. const isOnePointZero = function(n) {
  24539. return isString$1(n) && n.includes(".") && Number.parseFloat(n) === 1;
  24540. };
  24541. const isPercentage = function(n) {
  24542. return isString$1(n) && n.includes("%");
  24543. };
  24544. const bound01 = function(value, max) {
  24545. if (isOnePointZero(value))
  24546. value = "100%";
  24547. const processPercent = isPercentage(value);
  24548. value = Math.min(max, Math.max(0, Number.parseFloat(`${value}`)));
  24549. if (processPercent) {
  24550. value = Number.parseInt(`${value * max}`, 10) / 100;
  24551. }
  24552. if (Math.abs(value - max) < 1e-6) {
  24553. return 1;
  24554. }
  24555. return value % max / Number.parseFloat(max);
  24556. };
  24557. const INT_HEX_MAP = {
  24558. 10: "A",
  24559. 11: "B",
  24560. 12: "C",
  24561. 13: "D",
  24562. 14: "E",
  24563. 15: "F"
  24564. };
  24565. const hexOne = (value) => {
  24566. value = Math.min(Math.round(value), 255);
  24567. const high = Math.floor(value / 16);
  24568. const low = value % 16;
  24569. return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
  24570. };
  24571. const toHex = function({ r, g, b }) {
  24572. if (Number.isNaN(+r) || Number.isNaN(+g) || Number.isNaN(+b))
  24573. return "";
  24574. return `#${hexOne(r)}${hexOne(g)}${hexOne(b)}`;
  24575. };
  24576. const HEX_INT_MAP = {
  24577. A: 10,
  24578. B: 11,
  24579. C: 12,
  24580. D: 13,
  24581. E: 14,
  24582. F: 15
  24583. };
  24584. const parseHexChannel = function(hex) {
  24585. if (hex.length === 2) {
  24586. return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
  24587. }
  24588. return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
  24589. };
  24590. const hsl2hsv = function(hue, sat, light) {
  24591. sat = sat / 100;
  24592. light = light / 100;
  24593. let smin = sat;
  24594. const lmin = Math.max(light, 0.01);
  24595. light *= 2;
  24596. sat *= light <= 1 ? light : 2 - light;
  24597. smin *= lmin <= 1 ? lmin : 2 - lmin;
  24598. const v = (light + sat) / 2;
  24599. const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
  24600. return {
  24601. h: hue,
  24602. s: sv * 100,
  24603. v: v * 100
  24604. };
  24605. };
  24606. const rgb2hsv = (r, g, b) => {
  24607. r = bound01(r, 255);
  24608. g = bound01(g, 255);
  24609. b = bound01(b, 255);
  24610. const max = Math.max(r, g, b);
  24611. const min = Math.min(r, g, b);
  24612. let h;
  24613. const v = max;
  24614. const d = max - min;
  24615. const s = max === 0 ? 0 : d / max;
  24616. if (max === min) {
  24617. h = 0;
  24618. } else {
  24619. switch (max) {
  24620. case r: {
  24621. h = (g - b) / d + (g < b ? 6 : 0);
  24622. break;
  24623. }
  24624. case g: {
  24625. h = (b - r) / d + 2;
  24626. break;
  24627. }
  24628. case b: {
  24629. h = (r - g) / d + 4;
  24630. break;
  24631. }
  24632. }
  24633. h /= 6;
  24634. }
  24635. return { h: h * 360, s: s * 100, v: v * 100 };
  24636. };
  24637. const hsv2rgb = function(h, s, v) {
  24638. h = bound01(h, 360) * 6;
  24639. s = bound01(s, 100);
  24640. v = bound01(v, 100);
  24641. const i = Math.floor(h);
  24642. const f = h - i;
  24643. const p = v * (1 - s);
  24644. const q = v * (1 - f * s);
  24645. const t = v * (1 - (1 - f) * s);
  24646. const mod = i % 6;
  24647. const r = [v, q, p, p, t, v][mod];
  24648. const g = [t, v, v, q, p, p][mod];
  24649. const b = [p, p, t, v, v, q][mod];
  24650. return {
  24651. r: Math.round(r * 255),
  24652. g: Math.round(g * 255),
  24653. b: Math.round(b * 255)
  24654. };
  24655. };
  24656. class Color {
  24657. constructor(options = {}) {
  24658. this._hue = 0;
  24659. this._saturation = 100;
  24660. this._value = 100;
  24661. this._alpha = 100;
  24662. this.enableAlpha = false;
  24663. this.format = "hex";
  24664. this.value = "";
  24665. for (const option in options) {
  24666. if (hasOwn(options, option)) {
  24667. this[option] = options[option];
  24668. }
  24669. }
  24670. if (options.value) {
  24671. this.fromString(options.value);
  24672. } else {
  24673. this.doOnChange();
  24674. }
  24675. }
  24676. set(prop, value) {
  24677. if (arguments.length === 1 && typeof prop === "object") {
  24678. for (const p in prop) {
  24679. if (hasOwn(prop, p)) {
  24680. this.set(p, prop[p]);
  24681. }
  24682. }
  24683. return;
  24684. }
  24685. this[`_${prop}`] = value;
  24686. this.doOnChange();
  24687. }
  24688. get(prop) {
  24689. if (prop === "alpha") {
  24690. return Math.floor(this[`_${prop}`]);
  24691. }
  24692. return this[`_${prop}`];
  24693. }
  24694. toRgb() {
  24695. return hsv2rgb(this._hue, this._saturation, this._value);
  24696. }
  24697. fromString(value) {
  24698. if (!value) {
  24699. this._hue = 0;
  24700. this._saturation = 100;
  24701. this._value = 100;
  24702. this.doOnChange();
  24703. return;
  24704. }
  24705. const fromHSV = (h, s, v) => {
  24706. this._hue = Math.max(0, Math.min(360, h));
  24707. this._saturation = Math.max(0, Math.min(100, s));
  24708. this._value = Math.max(0, Math.min(100, v));
  24709. this.doOnChange();
  24710. };
  24711. if (value.includes("hsl")) {
  24712. 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));
  24713. if (parts.length === 4) {
  24714. this._alpha = Number.parseFloat(parts[3]) * 100;
  24715. } else if (parts.length === 3) {
  24716. this._alpha = 100;
  24717. }
  24718. if (parts.length >= 3) {
  24719. const { h, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
  24720. fromHSV(h, s, v);
  24721. }
  24722. } else if (value.includes("hsv")) {
  24723. 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));
  24724. if (parts.length === 4) {
  24725. this._alpha = Number.parseFloat(parts[3]) * 100;
  24726. } else if (parts.length === 3) {
  24727. this._alpha = 100;
  24728. }
  24729. if (parts.length >= 3) {
  24730. fromHSV(parts[0], parts[1], parts[2]);
  24731. }
  24732. } else if (value.includes("rgb")) {
  24733. 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));
  24734. if (parts.length === 4) {
  24735. this._alpha = Number.parseFloat(parts[3]) * 100;
  24736. } else if (parts.length === 3) {
  24737. this._alpha = 100;
  24738. }
  24739. if (parts.length >= 3) {
  24740. const { h, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
  24741. fromHSV(h, s, v);
  24742. }
  24743. } else if (value.includes("#")) {
  24744. const hex = value.replace("#", "").trim();
  24745. if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
  24746. return;
  24747. let r, g, b;
  24748. if (hex.length === 3) {
  24749. r = parseHexChannel(hex[0] + hex[0]);
  24750. g = parseHexChannel(hex[1] + hex[1]);
  24751. b = parseHexChannel(hex[2] + hex[2]);
  24752. } else if (hex.length === 6 || hex.length === 8) {
  24753. r = parseHexChannel(hex.slice(0, 2));
  24754. g = parseHexChannel(hex.slice(2, 4));
  24755. b = parseHexChannel(hex.slice(4, 6));
  24756. }
  24757. if (hex.length === 8) {
  24758. this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
  24759. } else if (hex.length === 3 || hex.length === 6) {
  24760. this._alpha = 100;
  24761. }
  24762. const { h, s, v } = rgb2hsv(r, g, b);
  24763. fromHSV(h, s, v);
  24764. }
  24765. }
  24766. compare(color) {
  24767. 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;
  24768. }
  24769. doOnChange() {
  24770. const { _hue, _saturation, _value, _alpha, format } = this;
  24771. if (this.enableAlpha) {
  24772. switch (format) {
  24773. case "hsl": {
  24774. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  24775. this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
  24776. break;
  24777. }
  24778. case "hsv": {
  24779. this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
  24780. break;
  24781. }
  24782. case "hex": {
  24783. this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
  24784. break;
  24785. }
  24786. default: {
  24787. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  24788. this.value = `rgba(${r}, ${g}, ${b}, ${this.get("alpha") / 100})`;
  24789. }
  24790. }
  24791. } else {
  24792. switch (format) {
  24793. case "hsl": {
  24794. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  24795. this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
  24796. break;
  24797. }
  24798. case "hsv": {
  24799. this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
  24800. break;
  24801. }
  24802. case "rgb": {
  24803. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  24804. this.value = `rgb(${r}, ${g}, ${b})`;
  24805. break;
  24806. }
  24807. default: {
  24808. this.value = toHex(hsv2rgb(_hue, _saturation, _value));
  24809. }
  24810. }
  24811. }
  24812. }
  24813. }
  24814. const _sfc_main$1G = defineComponent({
  24815. props: {
  24816. colors: {
  24817. type: Array,
  24818. required: true
  24819. },
  24820. color: {
  24821. type: Object,
  24822. required: true
  24823. },
  24824. enableAlpha: {
  24825. type: Boolean,
  24826. required: true
  24827. }
  24828. },
  24829. setup(props) {
  24830. const ns = useNamespace("color-predefine");
  24831. const { currentColor } = inject(colorPickerContextKey);
  24832. const rgbaColors = ref(parseColors(props.colors, props.color));
  24833. watch(() => currentColor.value, (val) => {
  24834. const color = new Color();
  24835. color.fromString(val);
  24836. rgbaColors.value.forEach((item) => {
  24837. item.selected = color.compare(item);
  24838. });
  24839. });
  24840. watchEffect(() => {
  24841. rgbaColors.value = parseColors(props.colors, props.color);
  24842. });
  24843. function handleSelect(index) {
  24844. props.color.fromString(props.colors[index]);
  24845. }
  24846. function parseColors(colors, color) {
  24847. return colors.map((value) => {
  24848. const c = new Color();
  24849. c.enableAlpha = props.enableAlpha;
  24850. c.format = "rgba";
  24851. c.fromString(value);
  24852. c.selected = c.value === color.value;
  24853. return c;
  24854. });
  24855. }
  24856. return {
  24857. rgbaColors,
  24858. handleSelect,
  24859. ns
  24860. };
  24861. }
  24862. });
  24863. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  24864. return openBlock(), createElementBlock("div", {
  24865. class: normalizeClass(_ctx.ns.b())
  24866. }, [
  24867. createElementVNode("div", {
  24868. class: normalizeClass(_ctx.ns.e("colors"))
  24869. }, [
  24870. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rgbaColors, (item, index) => {
  24871. return openBlock(), createElementBlock("div", {
  24872. key: _ctx.colors[index],
  24873. class: normalizeClass([
  24874. _ctx.ns.e("color-selector"),
  24875. _ctx.ns.is("alpha", item._alpha < 100),
  24876. { selected: item.selected }
  24877. ]),
  24878. onClick: ($event) => _ctx.handleSelect(index)
  24879. }, [
  24880. createElementVNode("div", {
  24881. style: normalizeStyle({ backgroundColor: item.value })
  24882. }, null, 4)
  24883. ], 10, ["onClick"]);
  24884. }), 128))
  24885. ], 2)
  24886. ], 2);
  24887. }
  24888. var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$1G, [["render", _sfc_render$p], ["__file", "predefine.vue"]]);
  24889. const _sfc_main$1F = defineComponent({
  24890. name: "ElSlPanel",
  24891. props: {
  24892. color: {
  24893. type: Object,
  24894. required: true
  24895. }
  24896. },
  24897. setup(props) {
  24898. const ns = useNamespace("color-svpanel");
  24899. const instance = getCurrentInstance();
  24900. const cursorTop = ref(0);
  24901. const cursorLeft = ref(0);
  24902. const background = ref("hsl(0, 100%, 50%)");
  24903. const colorValue = computed(() => {
  24904. const hue = props.color.get("hue");
  24905. const value = props.color.get("value");
  24906. return { hue, value };
  24907. });
  24908. function update() {
  24909. const saturation = props.color.get("saturation");
  24910. const value = props.color.get("value");
  24911. const el = instance.vnode.el;
  24912. const { clientWidth: width, clientHeight: height } = el;
  24913. cursorLeft.value = saturation * width / 100;
  24914. cursorTop.value = (100 - value) * height / 100;
  24915. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  24916. }
  24917. function handleDrag(event) {
  24918. const el = instance.vnode.el;
  24919. const rect = el.getBoundingClientRect();
  24920. const { clientX, clientY } = getClientXY(event);
  24921. let left = clientX - rect.left;
  24922. let top = clientY - rect.top;
  24923. left = Math.max(0, left);
  24924. left = Math.min(left, rect.width);
  24925. top = Math.max(0, top);
  24926. top = Math.min(top, rect.height);
  24927. cursorLeft.value = left;
  24928. cursorTop.value = top;
  24929. props.color.set({
  24930. saturation: left / rect.width * 100,
  24931. value: 100 - top / rect.height * 100
  24932. });
  24933. }
  24934. watch(() => colorValue.value, () => {
  24935. update();
  24936. });
  24937. onMounted(() => {
  24938. draggable(instance.vnode.el, {
  24939. drag: (event) => {
  24940. handleDrag(event);
  24941. },
  24942. end: (event) => {
  24943. handleDrag(event);
  24944. }
  24945. });
  24946. update();
  24947. });
  24948. return {
  24949. cursorTop,
  24950. cursorLeft,
  24951. background,
  24952. colorValue,
  24953. handleDrag,
  24954. update,
  24955. ns
  24956. };
  24957. }
  24958. });
  24959. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  24960. return openBlock(), createElementBlock("div", {
  24961. class: normalizeClass(_ctx.ns.b()),
  24962. style: normalizeStyle({
  24963. backgroundColor: _ctx.background
  24964. })
  24965. }, [
  24966. createElementVNode("div", {
  24967. class: normalizeClass(_ctx.ns.e("white"))
  24968. }, null, 2),
  24969. createElementVNode("div", {
  24970. class: normalizeClass(_ctx.ns.e("black"))
  24971. }, null, 2),
  24972. createElementVNode("div", {
  24973. class: normalizeClass(_ctx.ns.e("cursor")),
  24974. style: normalizeStyle({
  24975. top: _ctx.cursorTop + "px",
  24976. left: _ctx.cursorLeft + "px"
  24977. })
  24978. }, [
  24979. createElementVNode("div")
  24980. ], 6)
  24981. ], 6);
  24982. }
  24983. var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["render", _sfc_render$o], ["__file", "sv-panel.vue"]]);
  24984. const __default__$19 = defineComponent({
  24985. name: "ElColorPicker"
  24986. });
  24987. const _sfc_main$1E = /* @__PURE__ */ defineComponent({
  24988. ...__default__$19,
  24989. props: colorPickerProps,
  24990. emits: colorPickerEmits,
  24991. setup(__props, { expose, emit }) {
  24992. const props = __props;
  24993. const { t } = useLocale();
  24994. const ns = useNamespace("color");
  24995. const { formItem } = useFormItem();
  24996. const colorSize = useFormSize();
  24997. const colorDisabled = useFormDisabled();
  24998. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  24999. formItemContext: formItem
  25000. });
  25001. const hue = ref();
  25002. const sv = ref();
  25003. const alpha = ref();
  25004. const popper = ref();
  25005. const triggerRef = ref();
  25006. const inputRef = ref();
  25007. const { isFocused, handleFocus, handleBlur } = useFocusController(triggerRef, {
  25008. beforeFocus() {
  25009. return colorDisabled.value;
  25010. },
  25011. beforeBlur(event) {
  25012. var _a;
  25013. return (_a = popper.value) == null ? void 0 : _a.isFocusInsideContent(event);
  25014. },
  25015. afterBlur() {
  25016. setShowPicker(false);
  25017. resetColor();
  25018. }
  25019. });
  25020. let shouldActiveChange = true;
  25021. const color = reactive(new Color({
  25022. enableAlpha: props.showAlpha,
  25023. format: props.colorFormat || "",
  25024. value: props.modelValue
  25025. }));
  25026. const showPicker = ref(false);
  25027. const showPanelColor = ref(false);
  25028. const customInput = ref("");
  25029. const displayedColor = computed(() => {
  25030. if (!props.modelValue && !showPanelColor.value) {
  25031. return "transparent";
  25032. }
  25033. return displayedRgb(color, props.showAlpha);
  25034. });
  25035. const currentColor = computed(() => {
  25036. return !props.modelValue && !showPanelColor.value ? "" : color.value;
  25037. });
  25038. const buttonAriaLabel = computed(() => {
  25039. return !isLabeledByFormItem.value ? props.ariaLabel || t("el.colorpicker.defaultLabel") : void 0;
  25040. });
  25041. const buttonAriaLabelledby = computed(() => {
  25042. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  25043. });
  25044. const btnKls = computed(() => {
  25045. return [
  25046. ns.b("picker"),
  25047. ns.is("disabled", colorDisabled.value),
  25048. ns.bm("picker", colorSize.value),
  25049. ns.is("focused", isFocused.value)
  25050. ];
  25051. });
  25052. function displayedRgb(color2, showAlpha) {
  25053. if (!(color2 instanceof Color)) {
  25054. throw new TypeError("color should be instance of _color Class");
  25055. }
  25056. const { r, g, b } = color2.toRgb();
  25057. return showAlpha ? `rgba(${r}, ${g}, ${b}, ${color2.get("alpha") / 100})` : `rgb(${r}, ${g}, ${b})`;
  25058. }
  25059. function setShowPicker(value) {
  25060. showPicker.value = value;
  25061. }
  25062. const debounceSetShowPicker = debounce(setShowPicker, 100, { leading: true });
  25063. function show() {
  25064. if (colorDisabled.value)
  25065. return;
  25066. setShowPicker(true);
  25067. }
  25068. function hide() {
  25069. debounceSetShowPicker(false);
  25070. resetColor();
  25071. }
  25072. function resetColor() {
  25073. nextTick(() => {
  25074. if (props.modelValue) {
  25075. color.fromString(props.modelValue);
  25076. } else {
  25077. color.value = "";
  25078. nextTick(() => {
  25079. showPanelColor.value = false;
  25080. });
  25081. }
  25082. });
  25083. }
  25084. function handleTrigger() {
  25085. if (colorDisabled.value)
  25086. return;
  25087. debounceSetShowPicker(!showPicker.value);
  25088. }
  25089. function handleConfirm() {
  25090. color.fromString(customInput.value);
  25091. }
  25092. function confirmValue() {
  25093. const value = color.value;
  25094. emit(UPDATE_MODEL_EVENT, value);
  25095. emit("change", value);
  25096. if (props.validateEvent) {
  25097. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  25098. }
  25099. debounceSetShowPicker(false);
  25100. nextTick(() => {
  25101. const newColor = new Color({
  25102. enableAlpha: props.showAlpha,
  25103. format: props.colorFormat || "",
  25104. value: props.modelValue
  25105. });
  25106. if (!color.compare(newColor)) {
  25107. resetColor();
  25108. }
  25109. });
  25110. }
  25111. function clear() {
  25112. debounceSetShowPicker(false);
  25113. emit(UPDATE_MODEL_EVENT, null);
  25114. emit("change", null);
  25115. if (props.modelValue !== null && props.validateEvent) {
  25116. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  25117. }
  25118. resetColor();
  25119. }
  25120. function handleClickOutside() {
  25121. if (!showPicker.value)
  25122. return;
  25123. hide();
  25124. isFocused.value && focus();
  25125. }
  25126. function handleEsc(event) {
  25127. event.preventDefault();
  25128. event.stopPropagation();
  25129. setShowPicker(false);
  25130. resetColor();
  25131. }
  25132. function handleKeyDown(event) {
  25133. switch (event.code) {
  25134. case EVENT_CODE.enter:
  25135. case EVENT_CODE.numpadEnter:
  25136. case EVENT_CODE.space:
  25137. event.preventDefault();
  25138. event.stopPropagation();
  25139. show();
  25140. inputRef.value.focus();
  25141. break;
  25142. case EVENT_CODE.esc:
  25143. handleEsc(event);
  25144. break;
  25145. }
  25146. }
  25147. function focus() {
  25148. triggerRef.value.focus();
  25149. }
  25150. function blur() {
  25151. triggerRef.value.blur();
  25152. }
  25153. onMounted(() => {
  25154. if (props.modelValue) {
  25155. customInput.value = currentColor.value;
  25156. }
  25157. });
  25158. watch(() => props.modelValue, (newVal) => {
  25159. if (!newVal) {
  25160. showPanelColor.value = false;
  25161. } else if (newVal && newVal !== color.value) {
  25162. shouldActiveChange = false;
  25163. color.fromString(newVal);
  25164. }
  25165. });
  25166. watch(() => [props.colorFormat, props.showAlpha], () => {
  25167. color.enableAlpha = props.showAlpha;
  25168. color.format = props.colorFormat || color.format;
  25169. color.doOnChange();
  25170. emit(UPDATE_MODEL_EVENT, color.value);
  25171. });
  25172. watch(() => currentColor.value, (val) => {
  25173. customInput.value = val;
  25174. shouldActiveChange && emit("activeChange", val);
  25175. shouldActiveChange = true;
  25176. });
  25177. watch(() => color.value, () => {
  25178. if (!props.modelValue && !showPanelColor.value) {
  25179. showPanelColor.value = true;
  25180. }
  25181. });
  25182. watch(() => showPicker.value, () => {
  25183. nextTick(() => {
  25184. var _a, _b, _c;
  25185. (_a = hue.value) == null ? void 0 : _a.update();
  25186. (_b = sv.value) == null ? void 0 : _b.update();
  25187. (_c = alpha.value) == null ? void 0 : _c.update();
  25188. });
  25189. });
  25190. provide(colorPickerContextKey, {
  25191. currentColor
  25192. });
  25193. expose({
  25194. color,
  25195. show,
  25196. hide,
  25197. focus,
  25198. blur
  25199. });
  25200. return (_ctx, _cache) => {
  25201. return openBlock(), createBlock(unref(ElTooltip), {
  25202. ref_key: "popper",
  25203. ref: popper,
  25204. visible: showPicker.value,
  25205. "show-arrow": false,
  25206. "fallback-placements": ["bottom", "top", "right", "left"],
  25207. offset: 0,
  25208. "gpu-acceleration": false,
  25209. "popper-class": [unref(ns).be("picker", "panel"), unref(ns).b("dropdown"), _ctx.popperClass],
  25210. "stop-popper-mouse-event": false,
  25211. effect: "light",
  25212. trigger: "click",
  25213. teleported: _ctx.teleported,
  25214. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  25215. persistent: "",
  25216. onHide: ($event) => setShowPicker(false)
  25217. }, {
  25218. content: withCtx(() => [
  25219. withDirectives((openBlock(), createElementBlock("div", {
  25220. onKeydown: withKeys(handleEsc, ["esc"])
  25221. }, [
  25222. createElementVNode("div", {
  25223. class: normalizeClass(unref(ns).be("dropdown", "main-wrapper"))
  25224. }, [
  25225. createVNode(HueSlider, {
  25226. ref_key: "hue",
  25227. ref: hue,
  25228. class: "hue-slider",
  25229. color: unref(color),
  25230. vertical: ""
  25231. }, null, 8, ["color"]),
  25232. createVNode(SvPanel, {
  25233. ref_key: "sv",
  25234. ref: sv,
  25235. color: unref(color)
  25236. }, null, 8, ["color"])
  25237. ], 2),
  25238. _ctx.showAlpha ? (openBlock(), createBlock(AlphaSlider, {
  25239. key: 0,
  25240. ref_key: "alpha",
  25241. ref: alpha,
  25242. color: unref(color)
  25243. }, null, 8, ["color"])) : createCommentVNode("v-if", true),
  25244. _ctx.predefine ? (openBlock(), createBlock(Predefine, {
  25245. key: 1,
  25246. ref: "predefine",
  25247. "enable-alpha": _ctx.showAlpha,
  25248. color: unref(color),
  25249. colors: _ctx.predefine
  25250. }, null, 8, ["enable-alpha", "color", "colors"])) : createCommentVNode("v-if", true),
  25251. createElementVNode("div", {
  25252. class: normalizeClass(unref(ns).be("dropdown", "btns"))
  25253. }, [
  25254. createElementVNode("span", {
  25255. class: normalizeClass(unref(ns).be("dropdown", "value"))
  25256. }, [
  25257. createVNode(unref(ElInput), {
  25258. ref_key: "inputRef",
  25259. ref: inputRef,
  25260. modelValue: customInput.value,
  25261. "onUpdate:modelValue": ($event) => customInput.value = $event,
  25262. "validate-event": false,
  25263. size: "small",
  25264. onKeyup: withKeys(handleConfirm, ["enter"]),
  25265. onBlur: handleConfirm
  25266. }, null, 8, ["modelValue", "onUpdate:modelValue", "onKeyup"])
  25267. ], 2),
  25268. createVNode(unref(ElButton), {
  25269. class: normalizeClass(unref(ns).be("dropdown", "link-btn")),
  25270. text: "",
  25271. size: "small",
  25272. onClick: clear
  25273. }, {
  25274. default: withCtx(() => [
  25275. createTextVNode(toDisplayString(unref(t)("el.colorpicker.clear")), 1)
  25276. ]),
  25277. _: 1
  25278. }, 8, ["class"]),
  25279. createVNode(unref(ElButton), {
  25280. plain: "",
  25281. size: "small",
  25282. class: normalizeClass(unref(ns).be("dropdown", "btn")),
  25283. onClick: confirmValue
  25284. }, {
  25285. default: withCtx(() => [
  25286. createTextVNode(toDisplayString(unref(t)("el.colorpicker.confirm")), 1)
  25287. ]),
  25288. _: 1
  25289. }, 8, ["class"])
  25290. ], 2)
  25291. ], 40, ["onKeydown"])), [
  25292. [unref(ClickOutside), handleClickOutside]
  25293. ])
  25294. ]),
  25295. default: withCtx(() => [
  25296. createElementVNode("div", mergeProps({
  25297. id: unref(buttonId),
  25298. ref_key: "triggerRef",
  25299. ref: triggerRef
  25300. }, _ctx.$attrs, {
  25301. class: unref(btnKls),
  25302. role: "button",
  25303. "aria-label": unref(buttonAriaLabel),
  25304. "aria-labelledby": unref(buttonAriaLabelledby),
  25305. "aria-description": unref(t)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  25306. "aria-disabled": unref(colorDisabled),
  25307. tabindex: unref(colorDisabled) ? -1 : _ctx.tabindex,
  25308. onKeydown: handleKeyDown,
  25309. onFocus: unref(handleFocus),
  25310. onBlur: unref(handleBlur)
  25311. }), [
  25312. unref(colorDisabled) ? (openBlock(), createElementBlock("div", {
  25313. key: 0,
  25314. class: normalizeClass(unref(ns).be("picker", "mask"))
  25315. }, null, 2)) : createCommentVNode("v-if", true),
  25316. createElementVNode("div", {
  25317. class: normalizeClass(unref(ns).be("picker", "trigger")),
  25318. onClick: handleTrigger
  25319. }, [
  25320. createElementVNode("span", {
  25321. class: normalizeClass([unref(ns).be("picker", "color"), unref(ns).is("alpha", _ctx.showAlpha)])
  25322. }, [
  25323. createElementVNode("span", {
  25324. class: normalizeClass(unref(ns).be("picker", "color-inner")),
  25325. style: normalizeStyle({
  25326. backgroundColor: unref(displayedColor)
  25327. })
  25328. }, [
  25329. withDirectives(createVNode(unref(ElIcon), {
  25330. class: normalizeClass([unref(ns).be("picker", "icon"), unref(ns).is("icon-arrow-down")])
  25331. }, {
  25332. default: withCtx(() => [
  25333. createVNode(unref(arrow_down_default))
  25334. ]),
  25335. _: 1
  25336. }, 8, ["class"]), [
  25337. [vShow, _ctx.modelValue || showPanelColor.value]
  25338. ]),
  25339. withDirectives(createVNode(unref(ElIcon), {
  25340. class: normalizeClass([unref(ns).be("picker", "empty"), unref(ns).is("icon-close")])
  25341. }, {
  25342. default: withCtx(() => [
  25343. createVNode(unref(close_default))
  25344. ]),
  25345. _: 1
  25346. }, 8, ["class"]), [
  25347. [vShow, !_ctx.modelValue && !showPanelColor.value]
  25348. ])
  25349. ], 6)
  25350. ], 2)
  25351. ], 2)
  25352. ], 16, ["id", "aria-label", "aria-labelledby", "aria-description", "aria-disabled", "tabindex", "onFocus", "onBlur"])
  25353. ]),
  25354. _: 1
  25355. }, 8, ["visible", "popper-class", "teleported", "transition", "onHide"]);
  25356. };
  25357. }
  25358. });
  25359. var ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["__file", "color-picker.vue"]]);
  25360. const ElColorPicker = withInstall(ColorPicker);
  25361. const __default__$18 = defineComponent({
  25362. name: "ElContainer"
  25363. });
  25364. const _sfc_main$1D = /* @__PURE__ */ defineComponent({
  25365. ...__default__$18,
  25366. props: {
  25367. direction: {
  25368. type: String
  25369. }
  25370. },
  25371. setup(__props) {
  25372. const props = __props;
  25373. const slots = useSlots();
  25374. const ns = useNamespace("container");
  25375. const isVertical = computed(() => {
  25376. if (props.direction === "vertical") {
  25377. return true;
  25378. } else if (props.direction === "horizontal") {
  25379. return false;
  25380. }
  25381. if (slots && slots.default) {
  25382. const vNodes = slots.default();
  25383. return vNodes.some((vNode) => {
  25384. const tag = vNode.type.name;
  25385. return tag === "ElHeader" || tag === "ElFooter";
  25386. });
  25387. } else {
  25388. return false;
  25389. }
  25390. });
  25391. return (_ctx, _cache) => {
  25392. return openBlock(), createElementBlock("section", {
  25393. class: normalizeClass([unref(ns).b(), unref(ns).is("vertical", unref(isVertical))])
  25394. }, [
  25395. renderSlot(_ctx.$slots, "default")
  25396. ], 2);
  25397. };
  25398. }
  25399. });
  25400. var Container = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["__file", "container.vue"]]);
  25401. const __default__$17 = defineComponent({
  25402. name: "ElAside"
  25403. });
  25404. const _sfc_main$1C = /* @__PURE__ */ defineComponent({
  25405. ...__default__$17,
  25406. props: {
  25407. width: {
  25408. type: String,
  25409. default: null
  25410. }
  25411. },
  25412. setup(__props) {
  25413. const props = __props;
  25414. const ns = useNamespace("aside");
  25415. const style = computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
  25416. return (_ctx, _cache) => {
  25417. return openBlock(), createElementBlock("aside", {
  25418. class: normalizeClass(unref(ns).b()),
  25419. style: normalizeStyle(unref(style))
  25420. }, [
  25421. renderSlot(_ctx.$slots, "default")
  25422. ], 6);
  25423. };
  25424. }
  25425. });
  25426. var Aside = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__file", "aside.vue"]]);
  25427. const __default__$16 = defineComponent({
  25428. name: "ElFooter"
  25429. });
  25430. const _sfc_main$1B = /* @__PURE__ */ defineComponent({
  25431. ...__default__$16,
  25432. props: {
  25433. height: {
  25434. type: String,
  25435. default: null
  25436. }
  25437. },
  25438. setup(__props) {
  25439. const props = __props;
  25440. const ns = useNamespace("footer");
  25441. const style = computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
  25442. return (_ctx, _cache) => {
  25443. return openBlock(), createElementBlock("footer", {
  25444. class: normalizeClass(unref(ns).b()),
  25445. style: normalizeStyle(unref(style))
  25446. }, [
  25447. renderSlot(_ctx.$slots, "default")
  25448. ], 6);
  25449. };
  25450. }
  25451. });
  25452. var Footer$2 = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["__file", "footer.vue"]]);
  25453. const __default__$15 = defineComponent({
  25454. name: "ElHeader"
  25455. });
  25456. const _sfc_main$1A = /* @__PURE__ */ defineComponent({
  25457. ...__default__$15,
  25458. props: {
  25459. height: {
  25460. type: String,
  25461. default: null
  25462. }
  25463. },
  25464. setup(__props) {
  25465. const props = __props;
  25466. const ns = useNamespace("header");
  25467. const style = computed(() => {
  25468. return props.height ? ns.cssVarBlock({
  25469. height: props.height
  25470. }) : {};
  25471. });
  25472. return (_ctx, _cache) => {
  25473. return openBlock(), createElementBlock("header", {
  25474. class: normalizeClass(unref(ns).b()),
  25475. style: normalizeStyle(unref(style))
  25476. }, [
  25477. renderSlot(_ctx.$slots, "default")
  25478. ], 6);
  25479. };
  25480. }
  25481. });
  25482. var Header$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__file", "header.vue"]]);
  25483. const __default__$14 = defineComponent({
  25484. name: "ElMain"
  25485. });
  25486. const _sfc_main$1z = /* @__PURE__ */ defineComponent({
  25487. ...__default__$14,
  25488. setup(__props) {
  25489. const ns = useNamespace("main");
  25490. return (_ctx, _cache) => {
  25491. return openBlock(), createElementBlock("main", {
  25492. class: normalizeClass(unref(ns).b())
  25493. }, [
  25494. renderSlot(_ctx.$slots, "default")
  25495. ], 2);
  25496. };
  25497. }
  25498. });
  25499. var Main = /* @__PURE__ */ _export_sfc(_sfc_main$1z, [["__file", "main.vue"]]);
  25500. const ElContainer = withInstall(Container, {
  25501. Aside,
  25502. Footer: Footer$2,
  25503. Header: Header$1,
  25504. Main
  25505. });
  25506. const ElAside = withNoopInstall(Aside);
  25507. const ElFooter = withNoopInstall(Footer$2);
  25508. const ElHeader = withNoopInstall(Header$1);
  25509. const ElMain = withNoopInstall(Main);
  25510. var advancedFormat$1 = {exports: {}};
  25511. (function(module, exports) {
  25512. !function(e, t) {
  25513. module.exports = t() ;
  25514. }(commonjsGlobal, function() {
  25515. return function(e, t) {
  25516. var r = t.prototype, n = r.format;
  25517. r.format = function(e2) {
  25518. var t2 = this, r2 = this.$locale();
  25519. if (!this.isValid())
  25520. return n.bind(this)(e2);
  25521. 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) {
  25522. switch (e3) {
  25523. case "Q":
  25524. return Math.ceil((t2.$M + 1) / 3);
  25525. case "Do":
  25526. return r2.ordinal(t2.$D);
  25527. case "gggg":
  25528. return t2.weekYear();
  25529. case "GGGG":
  25530. return t2.isoWeekYear();
  25531. case "wo":
  25532. return r2.ordinal(t2.week(), "W");
  25533. case "w":
  25534. case "ww":
  25535. return s.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  25536. case "W":
  25537. case "WW":
  25538. return s.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  25539. case "k":
  25540. case "kk":
  25541. return s.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  25542. case "X":
  25543. return Math.floor(t2.$d.getTime() / 1e3);
  25544. case "x":
  25545. return t2.$d.getTime();
  25546. case "z":
  25547. return "[" + t2.offsetName() + "]";
  25548. case "zzz":
  25549. return "[" + t2.offsetName("long") + "]";
  25550. default:
  25551. return e3;
  25552. }
  25553. });
  25554. return n.bind(this)(a);
  25555. };
  25556. };
  25557. });
  25558. })(advancedFormat$1);
  25559. var advancedFormat = advancedFormat$1.exports;
  25560. var weekOfYear$1 = {exports: {}};
  25561. (function(module, exports) {
  25562. !function(e, t) {
  25563. module.exports = t() ;
  25564. }(commonjsGlobal, function() {
  25565. var e = "week", t = "year";
  25566. return function(i, n, r) {
  25567. var f = n.prototype;
  25568. f.week = function(i2) {
  25569. if (i2 === void 0 && (i2 = null), i2 !== null)
  25570. return this.add(7 * (i2 - this.week()), "day");
  25571. var n2 = this.$locale().yearStart || 1;
  25572. if (this.month() === 11 && this.date() > 25) {
  25573. var f2 = r(this).startOf(t).add(1, t).date(n2), s = r(this).endOf(e);
  25574. if (f2.isBefore(s))
  25575. return 1;
  25576. }
  25577. var a = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, true);
  25578. return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
  25579. }, f.weeks = function(e2) {
  25580. return e2 === void 0 && (e2 = null), this.week(e2);
  25581. };
  25582. };
  25583. });
  25584. })(weekOfYear$1);
  25585. var weekOfYear = weekOfYear$1.exports;
  25586. var weekYear$1 = {exports: {}};
  25587. (function(module, exports) {
  25588. !function(e, t) {
  25589. module.exports = t() ;
  25590. }(commonjsGlobal, function() {
  25591. return function(e, t) {
  25592. t.prototype.weekYear = function() {
  25593. var e2 = this.month(), t2 = this.week(), n = this.year();
  25594. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  25595. };
  25596. };
  25597. });
  25598. })(weekYear$1);
  25599. var weekYear = weekYear$1.exports;
  25600. var dayOfYear$1 = {exports: {}};
  25601. (function(module, exports) {
  25602. !function(e, t) {
  25603. module.exports = t() ;
  25604. }(commonjsGlobal, function() {
  25605. return function(e, t, n) {
  25606. t.prototype.dayOfYear = function(e2) {
  25607. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  25608. return e2 == null ? t2 : this.add(e2 - t2, "day");
  25609. };
  25610. };
  25611. });
  25612. })(dayOfYear$1);
  25613. var dayOfYear = dayOfYear$1.exports;
  25614. var isSameOrAfter$1 = {exports: {}};
  25615. (function(module, exports) {
  25616. !function(e, t) {
  25617. module.exports = t() ;
  25618. }(commonjsGlobal, function() {
  25619. return function(e, t) {
  25620. t.prototype.isSameOrAfter = function(e2, t2) {
  25621. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  25622. };
  25623. };
  25624. });
  25625. })(isSameOrAfter$1);
  25626. var isSameOrAfter = isSameOrAfter$1.exports;
  25627. var isSameOrBefore$1 = {exports: {}};
  25628. (function(module, exports) {
  25629. !function(e, i) {
  25630. module.exports = i() ;
  25631. }(commonjsGlobal, function() {
  25632. return function(e, i) {
  25633. i.prototype.isSameOrBefore = function(e2, i2) {
  25634. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  25635. };
  25636. };
  25637. });
  25638. })(isSameOrBefore$1);
  25639. var isSameOrBefore = isSameOrBefore$1.exports;
  25640. const ROOT_PICKER_INJECTION_KEY = Symbol();
  25641. const datePickerProps = buildProps({
  25642. ...timePickerDefaultProps,
  25643. type: {
  25644. type: definePropType(String),
  25645. default: "date"
  25646. }
  25647. });
  25648. const selectionModes = [
  25649. "date",
  25650. "dates",
  25651. "year",
  25652. "years",
  25653. "month",
  25654. "months",
  25655. "week",
  25656. "range"
  25657. ];
  25658. const datePickerSharedProps = buildProps({
  25659. disabledDate: {
  25660. type: definePropType(Function)
  25661. },
  25662. date: {
  25663. type: definePropType(Object),
  25664. required: true
  25665. },
  25666. minDate: {
  25667. type: definePropType(Object)
  25668. },
  25669. maxDate: {
  25670. type: definePropType(Object)
  25671. },
  25672. parsedValue: {
  25673. type: definePropType([Object, Array])
  25674. },
  25675. rangeState: {
  25676. type: definePropType(Object),
  25677. default: () => ({
  25678. endDate: null,
  25679. selecting: false
  25680. })
  25681. }
  25682. });
  25683. const panelSharedProps = buildProps({
  25684. type: {
  25685. type: definePropType(String),
  25686. required: true,
  25687. values: datePickTypes
  25688. },
  25689. dateFormat: String,
  25690. timeFormat: String,
  25691. showNow: {
  25692. type: Boolean,
  25693. default: true
  25694. }
  25695. });
  25696. const panelRangeSharedProps = buildProps({
  25697. unlinkPanels: Boolean,
  25698. parsedValue: {
  25699. type: definePropType(Array)
  25700. }
  25701. });
  25702. const selectionModeWithDefault = (mode) => {
  25703. return {
  25704. type: String,
  25705. values: selectionModes,
  25706. default: mode
  25707. };
  25708. };
  25709. const panelDatePickProps = buildProps({
  25710. ...panelSharedProps,
  25711. parsedValue: {
  25712. type: definePropType([Object, Array])
  25713. },
  25714. visible: {
  25715. type: Boolean
  25716. },
  25717. format: {
  25718. type: String,
  25719. default: ""
  25720. }
  25721. });
  25722. const isValidRange = (range) => {
  25723. if (!isArray$1(range))
  25724. return false;
  25725. const [left, right] = range;
  25726. return dayjs.isDayjs(left) && dayjs.isDayjs(right) && left.isSameOrBefore(right);
  25727. };
  25728. const getDefaultValue = (defaultValue, { lang, unit, unlinkPanels }) => {
  25729. let start;
  25730. if (isArray$1(defaultValue)) {
  25731. let [left, right] = defaultValue.map((d) => dayjs(d).locale(lang));
  25732. if (!unlinkPanels) {
  25733. right = left.add(1, unit);
  25734. }
  25735. return [left, right];
  25736. } else if (defaultValue) {
  25737. start = dayjs(defaultValue);
  25738. } else {
  25739. start = dayjs();
  25740. }
  25741. start = start.locale(lang);
  25742. return [start, start.add(1, unit)];
  25743. };
  25744. const buildPickerTable = (dimension, rows, {
  25745. columnIndexOffset,
  25746. startDate,
  25747. nextEndDate,
  25748. now,
  25749. unit,
  25750. relativeDateGetter,
  25751. setCellMetadata,
  25752. setRowMetadata
  25753. }) => {
  25754. for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
  25755. const row = rows[rowIndex];
  25756. for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
  25757. let cell = row[columnIndex + columnIndexOffset];
  25758. if (!cell) {
  25759. cell = {
  25760. row: rowIndex,
  25761. column: columnIndex,
  25762. type: "normal",
  25763. inRange: false,
  25764. start: false,
  25765. end: false
  25766. };
  25767. }
  25768. const index = rowIndex * dimension.column + columnIndex;
  25769. const nextStartDate = relativeDateGetter(index);
  25770. cell.dayjs = nextStartDate;
  25771. cell.date = nextStartDate.toDate();
  25772. cell.timestamp = nextStartDate.valueOf();
  25773. cell.type = "normal";
  25774. cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit));
  25775. if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
  25776. cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  25777. cell.end = startDate && nextStartDate.isSame(startDate, unit);
  25778. } else {
  25779. cell.start = !!startDate && nextStartDate.isSame(startDate, unit);
  25780. cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  25781. }
  25782. const isToday = nextStartDate.isSame(now, unit);
  25783. if (isToday) {
  25784. cell.type = "today";
  25785. }
  25786. setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex });
  25787. row[columnIndex + columnIndexOffset] = cell;
  25788. }
  25789. setRowMetadata == null ? void 0 : setRowMetadata(row);
  25790. }
  25791. };
  25792. const datesInMonth = (year, month, lang) => {
  25793. const firstDay = dayjs().locale(lang).startOf("month").month(month).year(year);
  25794. const numOfDays = firstDay.daysInMonth();
  25795. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  25796. };
  25797. const getValidDateOfMonth = (year, month, lang, disabledDate) => {
  25798. const _value = dayjs().year(year).month(month).startOf("month");
  25799. const _date = datesInMonth(year, month, lang).find((date) => {
  25800. return !(disabledDate == null ? void 0 : disabledDate(date));
  25801. });
  25802. if (_date) {
  25803. return dayjs(_date).locale(lang);
  25804. }
  25805. return _value.locale(lang);
  25806. };
  25807. const getValidDateOfYear = (value, lang, disabledDate) => {
  25808. const year = value.year();
  25809. if (!(disabledDate == null ? void 0 : disabledDate(value.toDate()))) {
  25810. return value.locale(lang);
  25811. }
  25812. const month = value.month();
  25813. if (!datesInMonth(year, month, lang).every(disabledDate)) {
  25814. return getValidDateOfMonth(year, month, lang, disabledDate);
  25815. }
  25816. for (let i = 0; i < 12; i++) {
  25817. if (!datesInMonth(year, i, lang).every(disabledDate)) {
  25818. return getValidDateOfMonth(year, i, lang, disabledDate);
  25819. }
  25820. }
  25821. return value;
  25822. };
  25823. const basicDateTableProps = buildProps({
  25824. ...datePickerSharedProps,
  25825. cellClassName: {
  25826. type: definePropType(Function)
  25827. },
  25828. showWeekNumber: Boolean,
  25829. selectionMode: selectionModeWithDefault("date")
  25830. });
  25831. const basicDateTableEmits = ["changerange", "pick", "select"];
  25832. const isNormalDay = (type = "") => {
  25833. return ["normal", "today"].includes(type);
  25834. };
  25835. const useBasicDateTable = (props, emit) => {
  25836. const { lang } = useLocale();
  25837. const tbodyRef = ref();
  25838. const currentCellRef = ref();
  25839. const lastRow = ref();
  25840. const lastColumn = ref();
  25841. const tableRows = ref([[], [], [], [], [], []]);
  25842. let focusWithClick = false;
  25843. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  25844. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
  25845. const offsetDay = computed(() => {
  25846. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  25847. });
  25848. const startDate = computed(() => {
  25849. const startDayOfMonth = props.date.startOf("month");
  25850. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  25851. });
  25852. const WEEKS = computed(() => {
  25853. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  25854. });
  25855. const hasCurrent = computed(() => {
  25856. return flatten(unref(rows)).some((row) => {
  25857. return row.isCurrent;
  25858. });
  25859. });
  25860. const days = computed(() => {
  25861. const startOfMonth = props.date.startOf("month");
  25862. const startOfMonthDay = startOfMonth.day() || 7;
  25863. const dateCountOfMonth = startOfMonth.daysInMonth();
  25864. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  25865. return {
  25866. startOfMonthDay,
  25867. dateCountOfMonth,
  25868. dateCountOfLastMonth
  25869. };
  25870. });
  25871. const selectedDate = computed(() => {
  25872. return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  25873. });
  25874. const setDateText = (cell, { count, rowIndex, columnIndex }) => {
  25875. const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = unref(days);
  25876. const offset = unref(offsetDay);
  25877. if (rowIndex >= 0 && rowIndex <= 1) {
  25878. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  25879. if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
  25880. cell.text = count;
  25881. return true;
  25882. } else {
  25883. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
  25884. cell.type = "prev-month";
  25885. }
  25886. } else {
  25887. if (count <= dateCountOfMonth) {
  25888. cell.text = count;
  25889. } else {
  25890. cell.text = count - dateCountOfMonth;
  25891. cell.type = "next-month";
  25892. }
  25893. return true;
  25894. }
  25895. return false;
  25896. };
  25897. const setCellMetadata = (cell, { columnIndex, rowIndex }, count) => {
  25898. const { disabledDate, cellClassName } = props;
  25899. const _selectedDate = unref(selectedDate);
  25900. const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex });
  25901. const cellDate = cell.dayjs.toDate();
  25902. cell.selected = _selectedDate.find((d) => d.isSame(cell.dayjs, "day"));
  25903. cell.isSelected = !!cell.selected;
  25904. cell.isCurrent = isCurrent(cell);
  25905. cell.disabled = disabledDate == null ? void 0 : disabledDate(cellDate);
  25906. cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
  25907. return shouldIncrement;
  25908. };
  25909. const setRowMetadata = (row) => {
  25910. if (props.selectionMode === "week") {
  25911. const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
  25912. const isActive = isWeekActive(row[start + 1]);
  25913. row[start].inRange = isActive;
  25914. row[start].start = isActive;
  25915. row[end].inRange = isActive;
  25916. row[end].end = isActive;
  25917. }
  25918. };
  25919. const rows = computed(() => {
  25920. const { minDate, maxDate, rangeState, showWeekNumber } = props;
  25921. const offset = unref(offsetDay);
  25922. const rows_ = unref(tableRows);
  25923. const dateUnit = "day";
  25924. let count = 1;
  25925. if (showWeekNumber) {
  25926. for (let rowIndex = 0; rowIndex < 6; rowIndex++) {
  25927. if (!rows_[rowIndex][0]) {
  25928. rows_[rowIndex][0] = {
  25929. type: "week",
  25930. text: unref(startDate).add(rowIndex * 7 + 1, dateUnit).week()
  25931. };
  25932. }
  25933. }
  25934. }
  25935. buildPickerTable({ row: 6, column: 7 }, rows_, {
  25936. startDate: minDate,
  25937. columnIndexOffset: showWeekNumber ? 1 : 0,
  25938. nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
  25939. now: dayjs().locale(unref(lang)).startOf(dateUnit),
  25940. unit: dateUnit,
  25941. relativeDateGetter: (idx) => unref(startDate).add(idx - offset, dateUnit),
  25942. setCellMetadata: (...args) => {
  25943. if (setCellMetadata(...args, count)) {
  25944. count += 1;
  25945. }
  25946. },
  25947. setRowMetadata
  25948. });
  25949. return rows_;
  25950. });
  25951. watch(() => props.date, async () => {
  25952. var _a;
  25953. if ((_a = unref(tbodyRef)) == null ? void 0 : _a.contains(document.activeElement)) {
  25954. await nextTick();
  25955. await focus();
  25956. }
  25957. });
  25958. const focus = async () => {
  25959. var _a;
  25960. return (_a = unref(currentCellRef)) == null ? void 0 : _a.focus();
  25961. };
  25962. const isCurrent = (cell) => {
  25963. return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
  25964. };
  25965. const cellMatchesDate = (cell, date) => {
  25966. if (!date)
  25967. return false;
  25968. return dayjs(date).locale(unref(lang)).isSame(props.date.date(Number(cell.text)), "day");
  25969. };
  25970. const getDateOfCell = (row, column) => {
  25971. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - unref(offsetDay);
  25972. return unref(startDate).add(offsetFromStart, "day");
  25973. };
  25974. const handleMouseMove = (event) => {
  25975. var _a;
  25976. if (!props.rangeState.selecting)
  25977. return;
  25978. let target = event.target;
  25979. if (target.tagName === "SPAN") {
  25980. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  25981. }
  25982. if (target.tagName === "DIV") {
  25983. target = target.parentNode;
  25984. }
  25985. if (target.tagName !== "TD")
  25986. return;
  25987. const row = target.parentNode.rowIndex - 1;
  25988. const column = target.cellIndex;
  25989. if (unref(rows)[row][column].disabled)
  25990. return;
  25991. if (row !== unref(lastRow) || column !== unref(lastColumn)) {
  25992. lastRow.value = row;
  25993. lastColumn.value = column;
  25994. emit("changerange", {
  25995. selecting: true,
  25996. endDate: getDateOfCell(row, column)
  25997. });
  25998. }
  25999. };
  26000. const isSelectedCell = (cell) => {
  26001. return !unref(hasCurrent) && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
  26002. };
  26003. const handleFocus = (event) => {
  26004. if (focusWithClick || unref(hasCurrent) || props.selectionMode !== "date")
  26005. return;
  26006. handlePickDate(event, true);
  26007. };
  26008. const handleMouseDown = (event) => {
  26009. const target = event.target.closest("td");
  26010. if (!target)
  26011. return;
  26012. focusWithClick = true;
  26013. };
  26014. const handleMouseUp = (event) => {
  26015. const target = event.target.closest("td");
  26016. if (!target)
  26017. return;
  26018. focusWithClick = false;
  26019. };
  26020. const handleRangePick = (newDate) => {
  26021. if (!props.rangeState.selecting || !props.minDate) {
  26022. emit("pick", { minDate: newDate, maxDate: null });
  26023. emit("select", true);
  26024. } else {
  26025. if (newDate >= props.minDate) {
  26026. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26027. } else {
  26028. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26029. }
  26030. emit("select", false);
  26031. }
  26032. };
  26033. const handleWeekPick = (newDate) => {
  26034. const weekNumber = newDate.week();
  26035. const value = `${newDate.year()}w${weekNumber}`;
  26036. emit("pick", {
  26037. year: newDate.year(),
  26038. week: weekNumber,
  26039. value,
  26040. date: newDate.startOf("week")
  26041. });
  26042. };
  26043. const handleDatesPick = (newDate, selected) => {
  26044. const newValue = selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  26045. emit("pick", newValue);
  26046. };
  26047. const handlePickDate = (event, isKeyboardMovement = false) => {
  26048. const target = event.target.closest("td");
  26049. if (!target)
  26050. return;
  26051. const row = target.parentNode.rowIndex - 1;
  26052. const column = target.cellIndex;
  26053. const cell = unref(rows)[row][column];
  26054. if (cell.disabled || cell.type === "week")
  26055. return;
  26056. const newDate = getDateOfCell(row, column);
  26057. switch (props.selectionMode) {
  26058. case "range": {
  26059. handleRangePick(newDate);
  26060. break;
  26061. }
  26062. case "date": {
  26063. emit("pick", newDate, isKeyboardMovement);
  26064. break;
  26065. }
  26066. case "week": {
  26067. handleWeekPick(newDate);
  26068. break;
  26069. }
  26070. case "dates": {
  26071. handleDatesPick(newDate, !!cell.selected);
  26072. break;
  26073. }
  26074. }
  26075. };
  26076. const isWeekActive = (cell) => {
  26077. if (props.selectionMode !== "week")
  26078. return false;
  26079. let newDate = props.date.startOf("day");
  26080. if (cell.type === "prev-month") {
  26081. newDate = newDate.subtract(1, "month");
  26082. }
  26083. if (cell.type === "next-month") {
  26084. newDate = newDate.add(1, "month");
  26085. }
  26086. newDate = newDate.date(Number.parseInt(cell.text, 10));
  26087. if (props.parsedValue && !isArray$1(props.parsedValue)) {
  26088. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  26089. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  26090. return weekDate.isSame(newDate, "day");
  26091. }
  26092. return false;
  26093. };
  26094. return {
  26095. WEEKS,
  26096. rows,
  26097. tbodyRef,
  26098. currentCellRef,
  26099. focus,
  26100. isCurrent,
  26101. isWeekActive,
  26102. isSelectedCell,
  26103. handlePickDate,
  26104. handleMouseUp,
  26105. handleMouseDown,
  26106. handleMouseMove,
  26107. handleFocus
  26108. };
  26109. };
  26110. const useBasicDateTableDOM = (props, {
  26111. isCurrent,
  26112. isWeekActive
  26113. }) => {
  26114. const ns = useNamespace("date-table");
  26115. const { t } = useLocale();
  26116. const tableKls = computed(() => [
  26117. ns.b(),
  26118. { "is-week-mode": props.selectionMode === "week" }
  26119. ]);
  26120. const tableLabel = computed(() => t("el.datepicker.dateTablePrompt"));
  26121. const weekLabel = computed(() => t("el.datepicker.week"));
  26122. const getCellClasses = (cell) => {
  26123. const classes = [];
  26124. if (isNormalDay(cell.type) && !cell.disabled) {
  26125. classes.push("available");
  26126. if (cell.type === "today") {
  26127. classes.push("today");
  26128. }
  26129. } else {
  26130. classes.push(cell.type);
  26131. }
  26132. if (isCurrent(cell)) {
  26133. classes.push("current");
  26134. }
  26135. if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
  26136. classes.push("in-range");
  26137. if (cell.start) {
  26138. classes.push("start-date");
  26139. }
  26140. if (cell.end) {
  26141. classes.push("end-date");
  26142. }
  26143. }
  26144. if (cell.disabled) {
  26145. classes.push("disabled");
  26146. }
  26147. if (cell.selected) {
  26148. classes.push("selected");
  26149. }
  26150. if (cell.customClass) {
  26151. classes.push(cell.customClass);
  26152. }
  26153. return classes.join(" ");
  26154. };
  26155. const getRowKls = (cell) => [
  26156. ns.e("row"),
  26157. { current: isWeekActive(cell) }
  26158. ];
  26159. return {
  26160. tableKls,
  26161. tableLabel,
  26162. weekLabel,
  26163. getCellClasses,
  26164. getRowKls,
  26165. t
  26166. };
  26167. };
  26168. const basicCellProps = buildProps({
  26169. cell: {
  26170. type: definePropType(Object)
  26171. }
  26172. });
  26173. var ElDatePickerCell = defineComponent({
  26174. name: "ElDatePickerCell",
  26175. props: basicCellProps,
  26176. setup(props) {
  26177. const ns = useNamespace("date-table-cell");
  26178. const {
  26179. slots
  26180. } = inject(ROOT_PICKER_INJECTION_KEY);
  26181. return () => {
  26182. const {
  26183. cell
  26184. } = props;
  26185. return renderSlot(slots, "default", {
  26186. ...cell
  26187. }, () => {
  26188. var _a;
  26189. return [createVNode("div", {
  26190. "class": ns.b()
  26191. }, [createVNode("span", {
  26192. "class": ns.e("text")
  26193. }, [(_a = cell == null ? void 0 : cell.renderText) != null ? _a : cell == null ? void 0 : cell.text])])];
  26194. });
  26195. };
  26196. }
  26197. });
  26198. const _sfc_main$1y = /* @__PURE__ */ defineComponent({
  26199. __name: "basic-date-table",
  26200. props: basicDateTableProps,
  26201. emits: basicDateTableEmits,
  26202. setup(__props, { expose, emit }) {
  26203. const props = __props;
  26204. const {
  26205. WEEKS,
  26206. rows,
  26207. tbodyRef,
  26208. currentCellRef,
  26209. focus,
  26210. isCurrent,
  26211. isWeekActive,
  26212. isSelectedCell,
  26213. handlePickDate,
  26214. handleMouseUp,
  26215. handleMouseDown,
  26216. handleMouseMove,
  26217. handleFocus
  26218. } = useBasicDateTable(props, emit);
  26219. const { tableLabel, tableKls, weekLabel, getCellClasses, getRowKls, t } = useBasicDateTableDOM(props, {
  26220. isCurrent,
  26221. isWeekActive
  26222. });
  26223. expose({
  26224. focus
  26225. });
  26226. return (_ctx, _cache) => {
  26227. return openBlock(), createElementBlock("table", {
  26228. "aria-label": unref(tableLabel),
  26229. class: normalizeClass(unref(tableKls)),
  26230. cellspacing: "0",
  26231. cellpadding: "0",
  26232. role: "grid",
  26233. onClick: unref(handlePickDate),
  26234. onMousemove: unref(handleMouseMove),
  26235. onMousedown: withModifiers(unref(handleMouseDown), ["prevent"]),
  26236. onMouseup: unref(handleMouseUp)
  26237. }, [
  26238. createElementVNode("tbody", {
  26239. ref_key: "tbodyRef",
  26240. ref: tbodyRef
  26241. }, [
  26242. createElementVNode("tr", null, [
  26243. _ctx.showWeekNumber ? (openBlock(), createElementBlock("th", {
  26244. key: 0,
  26245. scope: "col"
  26246. }, toDisplayString(unref(weekLabel)), 1)) : createCommentVNode("v-if", true),
  26247. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(WEEKS), (week, key) => {
  26248. return openBlock(), createElementBlock("th", {
  26249. key,
  26250. "aria-label": unref(t)("el.datepicker.weeksFull." + week),
  26251. scope: "col"
  26252. }, toDisplayString(unref(t)("el.datepicker.weeks." + week)), 9, ["aria-label"]);
  26253. }), 128))
  26254. ]),
  26255. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, rowKey) => {
  26256. return openBlock(), createElementBlock("tr", {
  26257. key: rowKey,
  26258. class: normalizeClass(unref(getRowKls)(row[1]))
  26259. }, [
  26260. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, columnKey) => {
  26261. return openBlock(), createElementBlock("td", {
  26262. key: `${rowKey}.${columnKey}`,
  26263. ref_for: true,
  26264. ref: (el) => unref(isSelectedCell)(cell) && (currentCellRef.value = el),
  26265. class: normalizeClass(unref(getCellClasses)(cell)),
  26266. "aria-current": cell.isCurrent ? "date" : void 0,
  26267. "aria-selected": cell.isCurrent,
  26268. tabindex: unref(isSelectedCell)(cell) ? 0 : -1,
  26269. onFocus: unref(handleFocus)
  26270. }, [
  26271. createVNode(unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  26272. ], 42, ["aria-current", "aria-selected", "tabindex", "onFocus"]);
  26273. }), 128))
  26274. ], 2);
  26275. }), 128))
  26276. ], 512)
  26277. ], 42, ["aria-label", "onClick", "onMousemove", "onMousedown", "onMouseup"]);
  26278. };
  26279. }
  26280. });
  26281. var DateTable = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__file", "basic-date-table.vue"]]);
  26282. const basicMonthTableProps = buildProps({
  26283. ...datePickerSharedProps,
  26284. selectionMode: selectionModeWithDefault("month")
  26285. });
  26286. const _sfc_main$1x = /* @__PURE__ */ defineComponent({
  26287. __name: "basic-month-table",
  26288. props: basicMonthTableProps,
  26289. emits: ["changerange", "pick", "select"],
  26290. setup(__props, { expose, emit }) {
  26291. const props = __props;
  26292. const ns = useNamespace("month-table");
  26293. const { t, lang } = useLocale();
  26294. const tbodyRef = ref();
  26295. const currentCellRef = ref();
  26296. const months = ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
  26297. const tableRows = ref([
  26298. [],
  26299. [],
  26300. []
  26301. ]);
  26302. const lastRow = ref();
  26303. const lastColumn = ref();
  26304. const rows = computed(() => {
  26305. var _a, _b;
  26306. const rows2 = tableRows.value;
  26307. const now = dayjs().locale(lang.value).startOf("month");
  26308. for (let i = 0; i < 3; i++) {
  26309. const row = rows2[i];
  26310. for (let j = 0; j < 4; j++) {
  26311. const cell = row[j] || (row[j] = {
  26312. row: i,
  26313. column: j,
  26314. type: "normal",
  26315. inRange: false,
  26316. start: false,
  26317. end: false,
  26318. text: -1,
  26319. disabled: false
  26320. });
  26321. cell.type = "normal";
  26322. const index = i * 4 + j;
  26323. const calTime = props.date.startOf("year").month(index);
  26324. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  26325. 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"));
  26326. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  26327. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  26328. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  26329. } else {
  26330. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
  26331. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  26332. }
  26333. const isToday = now.isSame(calTime);
  26334. if (isToday) {
  26335. cell.type = "today";
  26336. }
  26337. cell.text = index;
  26338. cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, calTime.toDate())) || false;
  26339. }
  26340. }
  26341. return rows2;
  26342. });
  26343. const focus = () => {
  26344. var _a;
  26345. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  26346. };
  26347. const getCellStyle = (cell) => {
  26348. const style = {};
  26349. const year = props.date.year();
  26350. const today = /* @__PURE__ */ new Date();
  26351. const month = cell.text;
  26352. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  26353. style.current = castArray(props.parsedValue).findIndex((date) => dayjs.isDayjs(date) && date.year() === year && date.month() === month) >= 0;
  26354. style.today = today.getFullYear() === year && today.getMonth() === month;
  26355. if (cell.inRange) {
  26356. style["in-range"] = true;
  26357. if (cell.start) {
  26358. style["start-date"] = true;
  26359. }
  26360. if (cell.end) {
  26361. style["end-date"] = true;
  26362. }
  26363. }
  26364. return style;
  26365. };
  26366. const isSelectedCell = (cell) => {
  26367. const year = props.date.year();
  26368. const month = cell.text;
  26369. return castArray(props.date).findIndex((date) => date.year() === year && date.month() === month) >= 0;
  26370. };
  26371. const handleMouseMove = (event) => {
  26372. var _a;
  26373. if (!props.rangeState.selecting)
  26374. return;
  26375. let target = event.target;
  26376. if (target.tagName === "SPAN") {
  26377. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  26378. }
  26379. if (target.tagName === "DIV") {
  26380. target = target.parentNode;
  26381. }
  26382. if (target.tagName !== "TD")
  26383. return;
  26384. const row = target.parentNode.rowIndex;
  26385. const column = target.cellIndex;
  26386. if (rows.value[row][column].disabled)
  26387. return;
  26388. if (row !== lastRow.value || column !== lastColumn.value) {
  26389. lastRow.value = row;
  26390. lastColumn.value = column;
  26391. emit("changerange", {
  26392. selecting: true,
  26393. endDate: props.date.startOf("year").month(row * 4 + column)
  26394. });
  26395. }
  26396. };
  26397. const handleMonthTableClick = (event) => {
  26398. var _a;
  26399. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26400. if ((target == null ? void 0 : target.tagName) !== "TD")
  26401. return;
  26402. if (hasClass(target, "disabled"))
  26403. return;
  26404. const column = target.cellIndex;
  26405. const row = target.parentNode.rowIndex;
  26406. const month = row * 4 + column;
  26407. const newDate = props.date.startOf("year").month(month);
  26408. if (props.selectionMode === "months") {
  26409. if (event.type === "keydown") {
  26410. emit("pick", castArray(props.parsedValue), false);
  26411. return;
  26412. }
  26413. const newMonth = getValidDateOfMonth(props.date.year(), month, lang.value, props.disabledDate);
  26414. const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.month()) !== newMonth.month()) : castArray(props.parsedValue).concat([dayjs(newMonth)]);
  26415. emit("pick", newValue);
  26416. } else if (props.selectionMode === "range") {
  26417. if (!props.rangeState.selecting) {
  26418. emit("pick", { minDate: newDate, maxDate: null });
  26419. emit("select", true);
  26420. } else {
  26421. if (props.minDate && newDate >= props.minDate) {
  26422. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26423. } else {
  26424. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26425. }
  26426. emit("select", false);
  26427. }
  26428. } else {
  26429. emit("pick", month);
  26430. }
  26431. };
  26432. watch(() => props.date, async () => {
  26433. var _a, _b;
  26434. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  26435. await nextTick();
  26436. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  26437. }
  26438. });
  26439. expose({
  26440. focus
  26441. });
  26442. return (_ctx, _cache) => {
  26443. return openBlock(), createElementBlock("table", {
  26444. role: "grid",
  26445. "aria-label": unref(t)("el.datepicker.monthTablePrompt"),
  26446. class: normalizeClass(unref(ns).b()),
  26447. onClick: handleMonthTableClick,
  26448. onMousemove: handleMouseMove
  26449. }, [
  26450. createElementVNode("tbody", {
  26451. ref_key: "tbodyRef",
  26452. ref: tbodyRef
  26453. }, [
  26454. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, key) => {
  26455. return openBlock(), createElementBlock("tr", { key }, [
  26456. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  26457. return openBlock(), createElementBlock("td", {
  26458. key: key_,
  26459. ref_for: true,
  26460. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  26461. class: normalizeClass(getCellStyle(cell)),
  26462. "aria-selected": `${isSelectedCell(cell)}`,
  26463. "aria-label": unref(t)(`el.datepicker.month${+cell.text + 1}`),
  26464. tabindex: isSelectedCell(cell) ? 0 : -1,
  26465. onKeydown: [
  26466. withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]),
  26467. withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])
  26468. ]
  26469. }, [
  26470. createVNode(unref(ElDatePickerCell), {
  26471. cell: {
  26472. ...cell,
  26473. renderText: unref(t)("el.datepicker.months." + months.value[cell.text])
  26474. }
  26475. }, null, 8, ["cell"])
  26476. ], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
  26477. }), 128))
  26478. ]);
  26479. }), 128))
  26480. ], 512)
  26481. ], 42, ["aria-label"]);
  26482. };
  26483. }
  26484. });
  26485. var MonthTable = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["__file", "basic-month-table.vue"]]);
  26486. const basicYearTableProps = buildProps({
  26487. ...datePickerSharedProps,
  26488. selectionMode: selectionModeWithDefault("year")
  26489. });
  26490. const _sfc_main$1w = /* @__PURE__ */ defineComponent({
  26491. __name: "basic-year-table",
  26492. props: basicYearTableProps,
  26493. emits: ["changerange", "pick", "select"],
  26494. setup(__props, { expose, emit }) {
  26495. const props = __props;
  26496. const datesInYear = (year, lang2) => {
  26497. const firstDay = dayjs(String(year)).locale(lang2).startOf("year");
  26498. const lastDay = firstDay.endOf("year");
  26499. const numOfDays = lastDay.dayOfYear();
  26500. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  26501. };
  26502. const ns = useNamespace("year-table");
  26503. const { t, lang } = useLocale();
  26504. const tbodyRef = ref();
  26505. const currentCellRef = ref();
  26506. const startYear = computed(() => {
  26507. return Math.floor(props.date.year() / 10) * 10;
  26508. });
  26509. const tableRows = ref([[], [], []]);
  26510. const lastRow = ref();
  26511. const lastColumn = ref();
  26512. const rows = computed(() => {
  26513. var _a;
  26514. const rows2 = tableRows.value;
  26515. const now = dayjs().locale(lang.value).startOf("year");
  26516. for (let i = 0; i < 3; i++) {
  26517. const row = rows2[i];
  26518. for (let j = 0; j < 4; j++) {
  26519. if (i * 4 + j >= 10) {
  26520. break;
  26521. }
  26522. let cell = row[j];
  26523. if (!cell) {
  26524. cell = {
  26525. row: i,
  26526. column: j,
  26527. type: "normal",
  26528. inRange: false,
  26529. start: false,
  26530. end: false,
  26531. text: -1,
  26532. disabled: false
  26533. };
  26534. }
  26535. cell.type = "normal";
  26536. const index = i * 4 + j + startYear.value;
  26537. const calTime = dayjs().year(index);
  26538. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  26539. 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"));
  26540. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  26541. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  26542. cell.end = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  26543. } else {
  26544. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  26545. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  26546. }
  26547. const isToday = now.isSame(calTime);
  26548. if (isToday) {
  26549. cell.type = "today";
  26550. }
  26551. cell.text = index;
  26552. const cellDate = calTime.toDate();
  26553. cell.disabled = props.disabledDate && props.disabledDate(cellDate) || false;
  26554. row[j] = cell;
  26555. }
  26556. }
  26557. return rows2;
  26558. });
  26559. const focus = () => {
  26560. var _a;
  26561. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  26562. };
  26563. const getCellKls = (cell) => {
  26564. const kls = {};
  26565. const today = dayjs().locale(lang.value);
  26566. const year = cell.text;
  26567. kls.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  26568. kls.today = today.year() === year;
  26569. kls.current = castArray(props.parsedValue).findIndex((d) => d.year() === year) >= 0;
  26570. if (cell.inRange) {
  26571. kls["in-range"] = true;
  26572. if (cell.start) {
  26573. kls["start-date"] = true;
  26574. }
  26575. if (cell.end) {
  26576. kls["end-date"] = true;
  26577. }
  26578. }
  26579. return kls;
  26580. };
  26581. const isSelectedCell = (cell) => {
  26582. const year = cell.text;
  26583. return castArray(props.date).findIndex((date) => date.year() === year) >= 0;
  26584. };
  26585. const handleYearTableClick = (event) => {
  26586. var _a;
  26587. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26588. if (!target || !target.textContent || hasClass(target, "disabled"))
  26589. return;
  26590. const column = target.cellIndex;
  26591. const row = target.parentNode.rowIndex;
  26592. const selectedYear = row * 4 + column + startYear.value;
  26593. const newDate = dayjs().year(selectedYear);
  26594. if (props.selectionMode === "range") {
  26595. if (!props.rangeState.selecting) {
  26596. emit("pick", { minDate: newDate, maxDate: null });
  26597. emit("select", true);
  26598. } else {
  26599. if (props.minDate && newDate >= props.minDate) {
  26600. emit("pick", { minDate: props.minDate, maxDate: newDate });
  26601. } else {
  26602. emit("pick", { minDate: newDate, maxDate: props.minDate });
  26603. }
  26604. emit("select", false);
  26605. }
  26606. } else if (props.selectionMode === "years") {
  26607. if (event.type === "keydown") {
  26608. emit("pick", castArray(props.parsedValue), false);
  26609. return;
  26610. }
  26611. const vaildYear = getValidDateOfYear(newDate.startOf("year"), lang.value, props.disabledDate);
  26612. const newValue = hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.year()) !== selectedYear) : castArray(props.parsedValue).concat([vaildYear]);
  26613. emit("pick", newValue);
  26614. } else {
  26615. emit("pick", selectedYear);
  26616. }
  26617. };
  26618. const handleMouseMove = (event) => {
  26619. var _a;
  26620. if (!props.rangeState.selecting)
  26621. return;
  26622. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  26623. if (!target)
  26624. return;
  26625. const row = target.parentNode.rowIndex;
  26626. const column = target.cellIndex;
  26627. if (rows.value[row][column].disabled)
  26628. return;
  26629. if (row !== lastRow.value || column !== lastColumn.value) {
  26630. lastRow.value = row;
  26631. lastColumn.value = column;
  26632. emit("changerange", {
  26633. selecting: true,
  26634. endDate: dayjs().year(startYear.value).add(row * 4 + column, "year")
  26635. });
  26636. }
  26637. };
  26638. watch(() => props.date, async () => {
  26639. var _a, _b;
  26640. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  26641. await nextTick();
  26642. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  26643. }
  26644. });
  26645. expose({
  26646. focus
  26647. });
  26648. return (_ctx, _cache) => {
  26649. return openBlock(), createElementBlock("table", {
  26650. role: "grid",
  26651. "aria-label": unref(t)("el.datepicker.yearTablePrompt"),
  26652. class: normalizeClass(unref(ns).b()),
  26653. onClick: handleYearTableClick,
  26654. onMousemove: handleMouseMove
  26655. }, [
  26656. createElementVNode("tbody", {
  26657. ref_key: "tbodyRef",
  26658. ref: tbodyRef
  26659. }, [
  26660. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, rowKey) => {
  26661. return openBlock(), createElementBlock("tr", { key: rowKey }, [
  26662. (openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, cellKey) => {
  26663. return openBlock(), createElementBlock("td", {
  26664. key: `${rowKey}_${cellKey}`,
  26665. ref_for: true,
  26666. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  26667. class: normalizeClass(["available", getCellKls(cell)]),
  26668. "aria-selected": isSelectedCell(cell),
  26669. "aria-label": String(cell.text),
  26670. tabindex: isSelectedCell(cell) ? 0 : -1,
  26671. onKeydown: [
  26672. withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
  26673. withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
  26674. ]
  26675. }, [
  26676. createVNode(unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  26677. ], 42, ["aria-selected", "aria-label", "tabindex", "onKeydown"]);
  26678. }), 128))
  26679. ]);
  26680. }), 128))
  26681. ], 512)
  26682. ], 42, ["aria-label"]);
  26683. };
  26684. }
  26685. });
  26686. var YearTable = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__file", "basic-year-table.vue"]]);
  26687. const _sfc_main$1v = /* @__PURE__ */ defineComponent({
  26688. __name: "panel-date-pick",
  26689. props: panelDatePickProps,
  26690. emits: ["pick", "set-picker-option", "panel-change"],
  26691. setup(__props, { emit: contextEmit }) {
  26692. const props = __props;
  26693. const timeWithinRange = (_, __, ___) => true;
  26694. const ppNs = useNamespace("picker-panel");
  26695. const dpNs = useNamespace("date-picker");
  26696. const attrs = useAttrs$1();
  26697. const slots = useSlots();
  26698. const { t, lang } = useLocale();
  26699. const pickerBase = inject("EP_PICKER_BASE");
  26700. const popper = inject(TOOLTIP_INJECTION_KEY);
  26701. const { shortcuts, disabledDate, cellClassName, defaultTime } = pickerBase.props;
  26702. const defaultValue = toRef(pickerBase.props, "defaultValue");
  26703. const currentViewRef = ref();
  26704. const innerDate = ref(dayjs().locale(lang.value));
  26705. const isChangeToNow = ref(false);
  26706. let isShortcut = false;
  26707. const defaultTimeD = computed(() => {
  26708. return dayjs(defaultTime).locale(lang.value);
  26709. });
  26710. const month = computed(() => {
  26711. return innerDate.value.month();
  26712. });
  26713. const year = computed(() => {
  26714. return innerDate.value.year();
  26715. });
  26716. const selectableRange = ref([]);
  26717. const userInputDate = ref(null);
  26718. const userInputTime = ref(null);
  26719. const checkDateWithinRange = (date) => {
  26720. return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
  26721. };
  26722. const formatEmit = (emitDayjs) => {
  26723. if (defaultTime && !visibleTime.value && !isChangeToNow.value && !isShortcut) {
  26724. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  26725. }
  26726. if (showTime.value)
  26727. return emitDayjs.millisecond(0);
  26728. return emitDayjs.startOf("day");
  26729. };
  26730. const emit = (value, ...args) => {
  26731. if (!value) {
  26732. contextEmit("pick", value, ...args);
  26733. } else if (isArray$1(value)) {
  26734. const dates = value.map(formatEmit);
  26735. contextEmit("pick", dates, ...args);
  26736. } else {
  26737. contextEmit("pick", formatEmit(value), ...args);
  26738. }
  26739. userInputDate.value = null;
  26740. userInputTime.value = null;
  26741. isChangeToNow.value = false;
  26742. isShortcut = false;
  26743. };
  26744. const handleDatePick = async (value, keepOpen) => {
  26745. if (selectionMode.value === "date") {
  26746. value = value;
  26747. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  26748. if (!checkDateWithinRange(newDate)) {
  26749. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  26750. }
  26751. innerDate.value = newDate;
  26752. emit(newDate, showTime.value || keepOpen);
  26753. if (props.type === "datetime") {
  26754. await nextTick();
  26755. handleFocusPicker();
  26756. }
  26757. } else if (selectionMode.value === "week") {
  26758. emit(value.date);
  26759. } else if (selectionMode.value === "dates") {
  26760. emit(value, true);
  26761. }
  26762. };
  26763. const moveByMonth = (forward) => {
  26764. const action = forward ? "add" : "subtract";
  26765. innerDate.value = innerDate.value[action](1, "month");
  26766. handlePanelChange("month");
  26767. };
  26768. const moveByYear = (forward) => {
  26769. const currentDate = innerDate.value;
  26770. const action = forward ? "add" : "subtract";
  26771. innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
  26772. handlePanelChange("year");
  26773. };
  26774. const currentView = ref("date");
  26775. const yearLabel = computed(() => {
  26776. const yearTranslation = t("el.datepicker.year");
  26777. if (currentView.value === "year") {
  26778. const startYear = Math.floor(year.value / 10) * 10;
  26779. if (yearTranslation) {
  26780. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  26781. }
  26782. return `${startYear} - ${startYear + 9}`;
  26783. }
  26784. return `${year.value} ${yearTranslation}`;
  26785. });
  26786. const handleShortcutClick = (shortcut) => {
  26787. const shortcutValue = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  26788. if (shortcutValue) {
  26789. isShortcut = true;
  26790. emit(dayjs(shortcutValue).locale(lang.value));
  26791. return;
  26792. }
  26793. if (shortcut.onClick) {
  26794. shortcut.onClick({
  26795. attrs,
  26796. slots,
  26797. emit: contextEmit
  26798. });
  26799. }
  26800. };
  26801. const selectionMode = computed(() => {
  26802. const { type } = props;
  26803. if (["week", "month", "months", "year", "years", "dates"].includes(type))
  26804. return type;
  26805. return "date";
  26806. });
  26807. const isMultipleType = computed(() => {
  26808. return selectionMode.value === "dates" || selectionMode.value === "months" || selectionMode.value === "years";
  26809. });
  26810. const keyboardMode = computed(() => {
  26811. return selectionMode.value === "date" ? currentView.value : selectionMode.value;
  26812. });
  26813. const hasShortcuts = computed(() => !!shortcuts.length);
  26814. const handleMonthPick = async (month2, keepOpen) => {
  26815. if (selectionMode.value === "month") {
  26816. innerDate.value = getValidDateOfMonth(innerDate.value.year(), month2, lang.value, disabledDate);
  26817. emit(innerDate.value, false);
  26818. } else if (selectionMode.value === "months") {
  26819. emit(month2, keepOpen != null ? keepOpen : true);
  26820. } else {
  26821. innerDate.value = getValidDateOfMonth(innerDate.value.year(), month2, lang.value, disabledDate);
  26822. currentView.value = "date";
  26823. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  26824. emit(innerDate.value, true);
  26825. await nextTick();
  26826. handleFocusPicker();
  26827. }
  26828. }
  26829. handlePanelChange("month");
  26830. };
  26831. const handleYearPick = async (year2, keepOpen) => {
  26832. if (selectionMode.value === "year") {
  26833. const data = innerDate.value.startOf("year").year(year2);
  26834. innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  26835. emit(innerDate.value, false);
  26836. } else if (selectionMode.value === "years") {
  26837. emit(year2, keepOpen != null ? keepOpen : true);
  26838. } else {
  26839. const data = innerDate.value.year(year2);
  26840. innerDate.value = getValidDateOfYear(data, lang.value, disabledDate);
  26841. currentView.value = "month";
  26842. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  26843. emit(innerDate.value, true);
  26844. await nextTick();
  26845. handleFocusPicker();
  26846. }
  26847. }
  26848. handlePanelChange("year");
  26849. };
  26850. const showPicker = async (view) => {
  26851. currentView.value = view;
  26852. await nextTick();
  26853. handleFocusPicker();
  26854. };
  26855. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  26856. const footerVisible = computed(() => {
  26857. const showDateFooter = showTime.value || selectionMode.value === "dates";
  26858. const showYearFooter = selectionMode.value === "years";
  26859. const showMonthFooter = selectionMode.value === "months";
  26860. const isDateView = currentView.value === "date";
  26861. const isYearView = currentView.value === "year";
  26862. const isMonthView = currentView.value === "month";
  26863. return showDateFooter && isDateView || showYearFooter && isYearView || showMonthFooter && isMonthView;
  26864. });
  26865. const disabledConfirm = computed(() => {
  26866. if (!disabledDate)
  26867. return false;
  26868. if (!props.parsedValue)
  26869. return true;
  26870. if (isArray$1(props.parsedValue)) {
  26871. return disabledDate(props.parsedValue[0].toDate());
  26872. }
  26873. return disabledDate(props.parsedValue.toDate());
  26874. });
  26875. const onConfirm = () => {
  26876. if (isMultipleType.value) {
  26877. emit(props.parsedValue);
  26878. } else {
  26879. let result = props.parsedValue;
  26880. if (!result) {
  26881. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  26882. const defaultValueD = getDefaultValue();
  26883. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  26884. }
  26885. innerDate.value = result;
  26886. emit(result);
  26887. }
  26888. };
  26889. const disabledNow = computed(() => {
  26890. if (!disabledDate)
  26891. return false;
  26892. return disabledDate(dayjs().locale(lang.value).toDate());
  26893. });
  26894. const changeToNow = () => {
  26895. const now = dayjs().locale(lang.value);
  26896. const nowDate = now.toDate();
  26897. isChangeToNow.value = true;
  26898. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  26899. innerDate.value = dayjs().locale(lang.value);
  26900. emit(innerDate.value);
  26901. }
  26902. };
  26903. const timeFormat = computed(() => {
  26904. return props.timeFormat || extractTimeFormat(props.format);
  26905. });
  26906. const dateFormat = computed(() => {
  26907. return props.dateFormat || extractDateFormat(props.format);
  26908. });
  26909. const visibleTime = computed(() => {
  26910. if (userInputTime.value)
  26911. return userInputTime.value;
  26912. if (!props.parsedValue && !defaultValue.value)
  26913. return;
  26914. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  26915. });
  26916. const visibleDate = computed(() => {
  26917. if (userInputDate.value)
  26918. return userInputDate.value;
  26919. if (!props.parsedValue && !defaultValue.value)
  26920. return;
  26921. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  26922. });
  26923. const timePickerVisible = ref(false);
  26924. const onTimePickerInputFocus = () => {
  26925. timePickerVisible.value = true;
  26926. };
  26927. const handleTimePickClose = () => {
  26928. timePickerVisible.value = false;
  26929. };
  26930. const getUnits = (date) => {
  26931. return {
  26932. hour: date.hour(),
  26933. minute: date.minute(),
  26934. second: date.second(),
  26935. year: date.year(),
  26936. month: date.month(),
  26937. date: date.date()
  26938. };
  26939. };
  26940. const handleTimePick = (value, visible, first) => {
  26941. const { hour, minute, second } = getUnits(value);
  26942. const newDate = props.parsedValue ? props.parsedValue.hour(hour).minute(minute).second(second) : value;
  26943. innerDate.value = newDate;
  26944. emit(innerDate.value, true);
  26945. if (!first) {
  26946. timePickerVisible.value = visible;
  26947. }
  26948. };
  26949. const handleVisibleTimeChange = (value) => {
  26950. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  26951. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  26952. const { year: year2, month: month2, date } = getUnits(innerDate.value);
  26953. innerDate.value = newDate.year(year2).month(month2).date(date);
  26954. userInputTime.value = null;
  26955. timePickerVisible.value = false;
  26956. emit(innerDate.value, true);
  26957. }
  26958. };
  26959. const handleVisibleDateChange = (value) => {
  26960. const newDate = dayjs(value, dateFormat.value).locale(lang.value);
  26961. if (newDate.isValid()) {
  26962. if (disabledDate && disabledDate(newDate.toDate())) {
  26963. return;
  26964. }
  26965. const { hour, minute, second } = getUnits(innerDate.value);
  26966. innerDate.value = newDate.hour(hour).minute(minute).second(second);
  26967. userInputDate.value = null;
  26968. emit(innerDate.value, true);
  26969. }
  26970. };
  26971. const isValidValue = (date) => {
  26972. return dayjs.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
  26973. };
  26974. const formatToString = (value) => {
  26975. return isArray$1(value) ? value.map((_) => _.format(props.format)) : value.format(props.format);
  26976. };
  26977. const parseUserInput = (value) => {
  26978. return dayjs(value, props.format).locale(lang.value);
  26979. };
  26980. const getDefaultValue = () => {
  26981. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  26982. if (!defaultValue.value) {
  26983. const defaultTimeDValue = defaultTimeD.value;
  26984. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  26985. }
  26986. return parseDate;
  26987. };
  26988. const handleFocusPicker = async () => {
  26989. var _a;
  26990. if (["week", "month", "year", "date"].includes(selectionMode.value)) {
  26991. (_a = currentViewRef.value) == null ? void 0 : _a.focus();
  26992. if (selectionMode.value === "week") {
  26993. handleKeyControl(EVENT_CODE.down);
  26994. }
  26995. }
  26996. };
  26997. const handleKeydownTable = (event) => {
  26998. const { code } = event;
  26999. const validCode = [
  27000. EVENT_CODE.up,
  27001. EVENT_CODE.down,
  27002. EVENT_CODE.left,
  27003. EVENT_CODE.right,
  27004. EVENT_CODE.home,
  27005. EVENT_CODE.end,
  27006. EVENT_CODE.pageUp,
  27007. EVENT_CODE.pageDown
  27008. ];
  27009. if (validCode.includes(code)) {
  27010. handleKeyControl(code);
  27011. event.stopPropagation();
  27012. event.preventDefault();
  27013. }
  27014. if ([EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.numpadEnter].includes(code) && userInputDate.value === null && userInputTime.value === null) {
  27015. event.preventDefault();
  27016. emit(innerDate.value, false);
  27017. }
  27018. };
  27019. const handleKeyControl = (code) => {
  27020. var _a;
  27021. const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
  27022. const mapping = {
  27023. year: {
  27024. [up]: -4,
  27025. [down]: 4,
  27026. [left]: -1,
  27027. [right]: 1,
  27028. offset: (date, step) => date.setFullYear(date.getFullYear() + step)
  27029. },
  27030. month: {
  27031. [up]: -4,
  27032. [down]: 4,
  27033. [left]: -1,
  27034. [right]: 1,
  27035. offset: (date, step) => date.setMonth(date.getMonth() + step)
  27036. },
  27037. week: {
  27038. [up]: -1,
  27039. [down]: 1,
  27040. [left]: -1,
  27041. [right]: 1,
  27042. offset: (date, step) => date.setDate(date.getDate() + step * 7)
  27043. },
  27044. date: {
  27045. [up]: -7,
  27046. [down]: 7,
  27047. [left]: -1,
  27048. [right]: 1,
  27049. [home]: (date) => -date.getDay(),
  27050. [end]: (date) => -date.getDay() + 6,
  27051. [pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
  27052. [pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
  27053. offset: (date, step) => date.setDate(date.getDate() + step)
  27054. }
  27055. };
  27056. const newDate = innerDate.value.toDate();
  27057. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  27058. const map = mapping[keyboardMode.value];
  27059. if (!map)
  27060. return;
  27061. map.offset(newDate, isFunction$1(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0);
  27062. if (disabledDate && disabledDate(newDate)) {
  27063. break;
  27064. }
  27065. const result = dayjs(newDate).locale(lang.value);
  27066. innerDate.value = result;
  27067. contextEmit("pick", result, true);
  27068. break;
  27069. }
  27070. };
  27071. const handlePanelChange = (mode) => {
  27072. contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  27073. };
  27074. watch(() => selectionMode.value, (val) => {
  27075. if (["month", "year"].includes(val)) {
  27076. currentView.value = val;
  27077. return;
  27078. } else if (val === "years") {
  27079. currentView.value = "year";
  27080. return;
  27081. } else if (val === "months") {
  27082. currentView.value = "month";
  27083. return;
  27084. }
  27085. currentView.value = "date";
  27086. }, { immediate: true });
  27087. watch(() => currentView.value, () => {
  27088. popper == null ? void 0 : popper.updatePopper();
  27089. });
  27090. watch(() => defaultValue.value, (val) => {
  27091. if (val) {
  27092. innerDate.value = getDefaultValue();
  27093. }
  27094. }, { immediate: true });
  27095. watch(() => props.parsedValue, (val) => {
  27096. if (val) {
  27097. if (isMultipleType.value)
  27098. return;
  27099. if (isArray$1(val))
  27100. return;
  27101. innerDate.value = val;
  27102. } else {
  27103. innerDate.value = getDefaultValue();
  27104. }
  27105. }, { immediate: true });
  27106. contextEmit("set-picker-option", ["isValidValue", isValidValue]);
  27107. contextEmit("set-picker-option", ["formatToString", formatToString]);
  27108. contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
  27109. contextEmit("set-picker-option", ["handleFocusPicker", handleFocusPicker]);
  27110. return (_ctx, _cache) => {
  27111. return openBlock(), createElementBlock("div", {
  27112. class: normalizeClass([
  27113. unref(ppNs).b(),
  27114. unref(dpNs).b(),
  27115. {
  27116. "has-sidebar": _ctx.$slots.sidebar || unref(hasShortcuts),
  27117. "has-time": unref(showTime)
  27118. }
  27119. ])
  27120. }, [
  27121. createElementVNode("div", {
  27122. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  27123. }, [
  27124. renderSlot(_ctx.$slots, "sidebar", {
  27125. class: normalizeClass(unref(ppNs).e("sidebar"))
  27126. }),
  27127. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  27128. key: 0,
  27129. class: normalizeClass(unref(ppNs).e("sidebar"))
  27130. }, [
  27131. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  27132. return openBlock(), createElementBlock("button", {
  27133. key,
  27134. type: "button",
  27135. class: normalizeClass(unref(ppNs).e("shortcut")),
  27136. onClick: ($event) => handleShortcutClick(shortcut)
  27137. }, toDisplayString(shortcut.text), 11, ["onClick"]);
  27138. }), 128))
  27139. ], 2)) : createCommentVNode("v-if", true),
  27140. createElementVNode("div", {
  27141. class: normalizeClass(unref(ppNs).e("body"))
  27142. }, [
  27143. unref(showTime) ? (openBlock(), createElementBlock("div", {
  27144. key: 0,
  27145. class: normalizeClass(unref(dpNs).e("time-header"))
  27146. }, [
  27147. createElementVNode("span", {
  27148. class: normalizeClass(unref(dpNs).e("editor-wrap"))
  27149. }, [
  27150. createVNode(unref(ElInput), {
  27151. placeholder: unref(t)("el.datepicker.selectDate"),
  27152. "model-value": unref(visibleDate),
  27153. size: "small",
  27154. "validate-event": false,
  27155. onInput: (val) => userInputDate.value = val,
  27156. onChange: handleVisibleDateChange
  27157. }, null, 8, ["placeholder", "model-value", "onInput"])
  27158. ], 2),
  27159. withDirectives((openBlock(), createElementBlock("span", {
  27160. class: normalizeClass(unref(dpNs).e("editor-wrap"))
  27161. }, [
  27162. createVNode(unref(ElInput), {
  27163. placeholder: unref(t)("el.datepicker.selectTime"),
  27164. "model-value": unref(visibleTime),
  27165. size: "small",
  27166. "validate-event": false,
  27167. onFocus: onTimePickerInputFocus,
  27168. onInput: (val) => userInputTime.value = val,
  27169. onChange: handleVisibleTimeChange
  27170. }, null, 8, ["placeholder", "model-value", "onInput"]),
  27171. createVNode(unref(TimePickPanel), {
  27172. visible: timePickerVisible.value,
  27173. format: unref(timeFormat),
  27174. "parsed-value": innerDate.value,
  27175. onPick: handleTimePick
  27176. }, null, 8, ["visible", "format", "parsed-value"])
  27177. ], 2)), [
  27178. [unref(ClickOutside), handleTimePickClose]
  27179. ])
  27180. ], 2)) : createCommentVNode("v-if", true),
  27181. withDirectives(createElementVNode("div", {
  27182. class: normalizeClass([
  27183. unref(dpNs).e("header"),
  27184. (currentView.value === "year" || currentView.value === "month") && unref(dpNs).e("header--bordered")
  27185. ])
  27186. }, [
  27187. createElementVNode("span", {
  27188. class: normalizeClass(unref(dpNs).e("prev-btn"))
  27189. }, [
  27190. createElementVNode("button", {
  27191. type: "button",
  27192. "aria-label": unref(t)(`el.datepicker.prevYear`),
  27193. class: normalizeClass(["d-arrow-left", unref(ppNs).e("icon-btn")]),
  27194. onClick: ($event) => moveByYear(false)
  27195. }, [
  27196. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  27197. createVNode(unref(ElIcon), null, {
  27198. default: withCtx(() => [
  27199. createVNode(unref(d_arrow_left_default))
  27200. ]),
  27201. _: 1
  27202. })
  27203. ])
  27204. ], 10, ["aria-label", "onClick"]),
  27205. withDirectives(createElementVNode("button", {
  27206. type: "button",
  27207. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  27208. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
  27209. onClick: ($event) => moveByMonth(false)
  27210. }, [
  27211. renderSlot(_ctx.$slots, "prev-month", {}, () => [
  27212. createVNode(unref(ElIcon), null, {
  27213. default: withCtx(() => [
  27214. createVNode(unref(arrow_left_default))
  27215. ]),
  27216. _: 1
  27217. })
  27218. ])
  27219. ], 10, ["aria-label", "onClick"]), [
  27220. [vShow, currentView.value === "date"]
  27221. ])
  27222. ], 2),
  27223. createElementVNode("span", {
  27224. role: "button",
  27225. class: normalizeClass(unref(dpNs).e("header-label")),
  27226. "aria-live": "polite",
  27227. tabindex: "0",
  27228. onKeydown: withKeys(($event) => showPicker("year"), ["enter"]),
  27229. onClick: ($event) => showPicker("year")
  27230. }, toDisplayString(unref(yearLabel)), 43, ["onKeydown", "onClick"]),
  27231. withDirectives(createElementVNode("span", {
  27232. role: "button",
  27233. "aria-live": "polite",
  27234. tabindex: "0",
  27235. class: normalizeClass([
  27236. unref(dpNs).e("header-label"),
  27237. { active: currentView.value === "month" }
  27238. ]),
  27239. onKeydown: withKeys(($event) => showPicker("month"), ["enter"]),
  27240. onClick: ($event) => showPicker("month")
  27241. }, toDisplayString(unref(t)(`el.datepicker.month${unref(month) + 1}`)), 43, ["onKeydown", "onClick"]), [
  27242. [vShow, currentView.value === "date"]
  27243. ]),
  27244. createElementVNode("span", {
  27245. class: normalizeClass(unref(dpNs).e("next-btn"))
  27246. }, [
  27247. withDirectives(createElementVNode("button", {
  27248. type: "button",
  27249. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  27250. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
  27251. onClick: ($event) => moveByMonth(true)
  27252. }, [
  27253. renderSlot(_ctx.$slots, "next-month", {}, () => [
  27254. createVNode(unref(ElIcon), null, {
  27255. default: withCtx(() => [
  27256. createVNode(unref(arrow_right_default))
  27257. ]),
  27258. _: 1
  27259. })
  27260. ])
  27261. ], 10, ["aria-label", "onClick"]), [
  27262. [vShow, currentView.value === "date"]
  27263. ]),
  27264. createElementVNode("button", {
  27265. type: "button",
  27266. "aria-label": unref(t)(`el.datepicker.nextYear`),
  27267. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  27268. onClick: ($event) => moveByYear(true)
  27269. }, [
  27270. renderSlot(_ctx.$slots, "next-year", {}, () => [
  27271. createVNode(unref(ElIcon), null, {
  27272. default: withCtx(() => [
  27273. createVNode(unref(d_arrow_right_default))
  27274. ]),
  27275. _: 1
  27276. })
  27277. ])
  27278. ], 10, ["aria-label", "onClick"])
  27279. ], 2)
  27280. ], 2), [
  27281. [vShow, currentView.value !== "time"]
  27282. ]),
  27283. createElementVNode("div", {
  27284. class: normalizeClass(unref(ppNs).e("content")),
  27285. onKeydown: handleKeydownTable
  27286. }, [
  27287. currentView.value === "date" ? (openBlock(), createBlock(DateTable, {
  27288. key: 0,
  27289. ref_key: "currentViewRef",
  27290. ref: currentViewRef,
  27291. "selection-mode": unref(selectionMode),
  27292. date: innerDate.value,
  27293. "parsed-value": _ctx.parsedValue,
  27294. "disabled-date": unref(disabledDate),
  27295. "cell-class-name": unref(cellClassName),
  27296. onPick: handleDatePick
  27297. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name"])) : createCommentVNode("v-if", true),
  27298. currentView.value === "year" ? (openBlock(), createBlock(YearTable, {
  27299. key: 1,
  27300. ref_key: "currentViewRef",
  27301. ref: currentViewRef,
  27302. "selection-mode": unref(selectionMode),
  27303. date: innerDate.value,
  27304. "disabled-date": unref(disabledDate),
  27305. "parsed-value": _ctx.parsedValue,
  27306. onPick: handleYearPick
  27307. }, null, 8, ["selection-mode", "date", "disabled-date", "parsed-value"])) : createCommentVNode("v-if", true),
  27308. currentView.value === "month" ? (openBlock(), createBlock(MonthTable, {
  27309. key: 2,
  27310. ref_key: "currentViewRef",
  27311. ref: currentViewRef,
  27312. "selection-mode": unref(selectionMode),
  27313. date: innerDate.value,
  27314. "parsed-value": _ctx.parsedValue,
  27315. "disabled-date": unref(disabledDate),
  27316. onPick: handleMonthPick
  27317. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date"])) : createCommentVNode("v-if", true)
  27318. ], 34)
  27319. ], 2)
  27320. ], 2),
  27321. withDirectives(createElementVNode("div", {
  27322. class: normalizeClass(unref(ppNs).e("footer"))
  27323. }, [
  27324. withDirectives(createVNode(unref(ElButton), {
  27325. text: "",
  27326. size: "small",
  27327. class: normalizeClass(unref(ppNs).e("link-btn")),
  27328. disabled: unref(disabledNow),
  27329. onClick: changeToNow
  27330. }, {
  27331. default: withCtx(() => [
  27332. createTextVNode(toDisplayString(unref(t)("el.datepicker.now")), 1)
  27333. ]),
  27334. _: 1
  27335. }, 8, ["class", "disabled"]), [
  27336. [vShow, !unref(isMultipleType) && _ctx.showNow]
  27337. ]),
  27338. createVNode(unref(ElButton), {
  27339. plain: "",
  27340. size: "small",
  27341. class: normalizeClass(unref(ppNs).e("link-btn")),
  27342. disabled: unref(disabledConfirm),
  27343. onClick: onConfirm
  27344. }, {
  27345. default: withCtx(() => [
  27346. createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)
  27347. ]),
  27348. _: 1
  27349. }, 8, ["class", "disabled"])
  27350. ], 2), [
  27351. [vShow, unref(footerVisible)]
  27352. ])
  27353. ], 2);
  27354. };
  27355. }
  27356. });
  27357. var DatePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1v, [["__file", "panel-date-pick.vue"]]);
  27358. const panelDateRangeProps = buildProps({
  27359. ...panelSharedProps,
  27360. ...panelRangeSharedProps,
  27361. visible: Boolean
  27362. });
  27363. const useShortcut = (lang) => {
  27364. const { emit } = getCurrentInstance();
  27365. const attrs = useAttrs$1();
  27366. const slots = useSlots();
  27367. const handleShortcutClick = (shortcut) => {
  27368. const shortcutValues = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  27369. if (shortcutValues) {
  27370. emit("pick", [
  27371. dayjs(shortcutValues[0]).locale(lang.value),
  27372. dayjs(shortcutValues[1]).locale(lang.value)
  27373. ]);
  27374. return;
  27375. }
  27376. if (shortcut.onClick) {
  27377. shortcut.onClick({
  27378. attrs,
  27379. slots,
  27380. emit
  27381. });
  27382. }
  27383. };
  27384. return handleShortcutClick;
  27385. };
  27386. const useRangePicker = (props, {
  27387. defaultValue,
  27388. leftDate,
  27389. rightDate,
  27390. unit,
  27391. onParsedValueChanged
  27392. }) => {
  27393. const { emit } = getCurrentInstance();
  27394. const { pickerNs } = inject(ROOT_PICKER_INJECTION_KEY);
  27395. const drpNs = useNamespace("date-range-picker");
  27396. const { t, lang } = useLocale();
  27397. const handleShortcutClick = useShortcut(lang);
  27398. const minDate = ref();
  27399. const maxDate = ref();
  27400. const rangeState = ref({
  27401. endDate: null,
  27402. selecting: false
  27403. });
  27404. const handleChangeRange = (val) => {
  27405. rangeState.value = val;
  27406. };
  27407. const handleRangeConfirm = (visible = false) => {
  27408. const _minDate = unref(minDate);
  27409. const _maxDate = unref(maxDate);
  27410. if (isValidRange([_minDate, _maxDate])) {
  27411. emit("pick", [_minDate, _maxDate], visible);
  27412. }
  27413. };
  27414. const onSelect = (selecting) => {
  27415. rangeState.value.selecting = selecting;
  27416. if (!selecting) {
  27417. rangeState.value.endDate = null;
  27418. }
  27419. };
  27420. const onReset = (parsedValue) => {
  27421. if (isArray$1(parsedValue) && parsedValue.length === 2) {
  27422. const [start, end] = parsedValue;
  27423. minDate.value = start;
  27424. leftDate.value = start;
  27425. maxDate.value = end;
  27426. onParsedValueChanged(unref(minDate), unref(maxDate));
  27427. } else {
  27428. restoreDefault();
  27429. }
  27430. };
  27431. const restoreDefault = () => {
  27432. const [start, end] = getDefaultValue(unref(defaultValue), {
  27433. lang: unref(lang),
  27434. unit,
  27435. unlinkPanels: props.unlinkPanels
  27436. });
  27437. minDate.value = void 0;
  27438. maxDate.value = void 0;
  27439. leftDate.value = start;
  27440. rightDate.value = end;
  27441. };
  27442. watch(defaultValue, (val) => {
  27443. if (val) {
  27444. restoreDefault();
  27445. }
  27446. }, { immediate: true });
  27447. watch(() => props.parsedValue, onReset, { immediate: true });
  27448. return {
  27449. minDate,
  27450. maxDate,
  27451. rangeState,
  27452. lang,
  27453. ppNs: pickerNs,
  27454. drpNs,
  27455. handleChangeRange,
  27456. handleRangeConfirm,
  27457. handleShortcutClick,
  27458. onSelect,
  27459. onReset,
  27460. t
  27461. };
  27462. };
  27463. const unit$2 = "month";
  27464. const _sfc_main$1u = /* @__PURE__ */ defineComponent({
  27465. __name: "panel-date-range",
  27466. props: panelDateRangeProps,
  27467. emits: [
  27468. "pick",
  27469. "set-picker-option",
  27470. "calendar-change",
  27471. "panel-change"
  27472. ],
  27473. setup(__props, { emit }) {
  27474. const props = __props;
  27475. const pickerBase = inject("EP_PICKER_BASE");
  27476. const { disabledDate, cellClassName, defaultTime, clearable } = pickerBase.props;
  27477. const format = toRef(pickerBase.props, "format");
  27478. const shortcuts = toRef(pickerBase.props, "shortcuts");
  27479. const defaultValue = toRef(pickerBase.props, "defaultValue");
  27480. const { lang } = useLocale();
  27481. const leftDate = ref(dayjs().locale(lang.value));
  27482. const rightDate = ref(dayjs().locale(lang.value).add(1, unit$2));
  27483. const {
  27484. minDate,
  27485. maxDate,
  27486. rangeState,
  27487. ppNs,
  27488. drpNs,
  27489. handleChangeRange,
  27490. handleRangeConfirm,
  27491. handleShortcutClick,
  27492. onSelect,
  27493. onReset,
  27494. t
  27495. } = useRangePicker(props, {
  27496. defaultValue,
  27497. leftDate,
  27498. rightDate,
  27499. unit: unit$2,
  27500. onParsedValueChanged
  27501. });
  27502. watch(() => props.visible, (visible) => {
  27503. if (!visible && rangeState.value.selecting) {
  27504. onReset(props.parsedValue);
  27505. onSelect(false);
  27506. }
  27507. });
  27508. const dateUserInput = ref({
  27509. min: null,
  27510. max: null
  27511. });
  27512. const timeUserInput = ref({
  27513. min: null,
  27514. max: null
  27515. });
  27516. const leftLabel = computed(() => {
  27517. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  27518. });
  27519. const rightLabel = computed(() => {
  27520. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  27521. });
  27522. const leftYear = computed(() => {
  27523. return leftDate.value.year();
  27524. });
  27525. const leftMonth = computed(() => {
  27526. return leftDate.value.month();
  27527. });
  27528. const rightYear = computed(() => {
  27529. return rightDate.value.year();
  27530. });
  27531. const rightMonth = computed(() => {
  27532. return rightDate.value.month();
  27533. });
  27534. const hasShortcuts = computed(() => !!shortcuts.value.length);
  27535. const minVisibleDate = computed(() => {
  27536. if (dateUserInput.value.min !== null)
  27537. return dateUserInput.value.min;
  27538. if (minDate.value)
  27539. return minDate.value.format(dateFormat.value);
  27540. return "";
  27541. });
  27542. const maxVisibleDate = computed(() => {
  27543. if (dateUserInput.value.max !== null)
  27544. return dateUserInput.value.max;
  27545. if (maxDate.value || minDate.value)
  27546. return (maxDate.value || minDate.value).format(dateFormat.value);
  27547. return "";
  27548. });
  27549. const minVisibleTime = computed(() => {
  27550. if (timeUserInput.value.min !== null)
  27551. return timeUserInput.value.min;
  27552. if (minDate.value)
  27553. return minDate.value.format(timeFormat.value);
  27554. return "";
  27555. });
  27556. const maxVisibleTime = computed(() => {
  27557. if (timeUserInput.value.max !== null)
  27558. return timeUserInput.value.max;
  27559. if (maxDate.value || minDate.value)
  27560. return (maxDate.value || minDate.value).format(timeFormat.value);
  27561. return "";
  27562. });
  27563. const timeFormat = computed(() => {
  27564. return props.timeFormat || extractTimeFormat(format.value);
  27565. });
  27566. const dateFormat = computed(() => {
  27567. return props.dateFormat || extractDateFormat(format.value);
  27568. });
  27569. const isValidValue = (date) => {
  27570. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  27571. };
  27572. const leftPrevYear = () => {
  27573. leftDate.value = leftDate.value.subtract(1, "year");
  27574. if (!props.unlinkPanels) {
  27575. rightDate.value = leftDate.value.add(1, "month");
  27576. }
  27577. handlePanelChange("year");
  27578. };
  27579. const leftPrevMonth = () => {
  27580. leftDate.value = leftDate.value.subtract(1, "month");
  27581. if (!props.unlinkPanels) {
  27582. rightDate.value = leftDate.value.add(1, "month");
  27583. }
  27584. handlePanelChange("month");
  27585. };
  27586. const rightNextYear = () => {
  27587. if (!props.unlinkPanels) {
  27588. leftDate.value = leftDate.value.add(1, "year");
  27589. rightDate.value = leftDate.value.add(1, "month");
  27590. } else {
  27591. rightDate.value = rightDate.value.add(1, "year");
  27592. }
  27593. handlePanelChange("year");
  27594. };
  27595. const rightNextMonth = () => {
  27596. if (!props.unlinkPanels) {
  27597. leftDate.value = leftDate.value.add(1, "month");
  27598. rightDate.value = leftDate.value.add(1, "month");
  27599. } else {
  27600. rightDate.value = rightDate.value.add(1, "month");
  27601. }
  27602. handlePanelChange("month");
  27603. };
  27604. const leftNextYear = () => {
  27605. leftDate.value = leftDate.value.add(1, "year");
  27606. handlePanelChange("year");
  27607. };
  27608. const leftNextMonth = () => {
  27609. leftDate.value = leftDate.value.add(1, "month");
  27610. handlePanelChange("month");
  27611. };
  27612. const rightPrevYear = () => {
  27613. rightDate.value = rightDate.value.subtract(1, "year");
  27614. handlePanelChange("year");
  27615. };
  27616. const rightPrevMonth = () => {
  27617. rightDate.value = rightDate.value.subtract(1, "month");
  27618. handlePanelChange("month");
  27619. };
  27620. const handlePanelChange = (mode) => {
  27621. emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  27622. };
  27623. const enableMonthArrow = computed(() => {
  27624. const nextMonth = (leftMonth.value + 1) % 12;
  27625. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  27626. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  27627. });
  27628. const enableYearArrow = computed(() => {
  27629. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  27630. });
  27631. const btnDisabled = computed(() => {
  27632. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
  27633. });
  27634. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  27635. const formatEmit = (emitDayjs, index) => {
  27636. if (!emitDayjs)
  27637. return;
  27638. if (defaultTime) {
  27639. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  27640. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  27641. }
  27642. return emitDayjs;
  27643. };
  27644. const handleRangePick = (val, close = true) => {
  27645. const min_ = val.minDate;
  27646. const max_ = val.maxDate;
  27647. const minDate_ = formatEmit(min_, 0);
  27648. const maxDate_ = formatEmit(max_, 1);
  27649. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  27650. return;
  27651. }
  27652. emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  27653. maxDate.value = maxDate_;
  27654. minDate.value = minDate_;
  27655. if (!close || showTime.value)
  27656. return;
  27657. handleRangeConfirm();
  27658. };
  27659. const minTimePickerVisible = ref(false);
  27660. const maxTimePickerVisible = ref(false);
  27661. const handleMinTimeClose = () => {
  27662. minTimePickerVisible.value = false;
  27663. };
  27664. const handleMaxTimeClose = () => {
  27665. maxTimePickerVisible.value = false;
  27666. };
  27667. const handleDateInput = (value, type) => {
  27668. dateUserInput.value[type] = value;
  27669. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  27670. if (parsedValueD.isValid()) {
  27671. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  27672. return;
  27673. }
  27674. if (type === "min") {
  27675. leftDate.value = parsedValueD;
  27676. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  27677. if (!props.unlinkPanels && (!maxDate.value || maxDate.value.isBefore(minDate.value))) {
  27678. rightDate.value = parsedValueD.add(1, "month");
  27679. maxDate.value = minDate.value.add(1, "month");
  27680. }
  27681. } else {
  27682. rightDate.value = parsedValueD;
  27683. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  27684. if (!props.unlinkPanels && (!minDate.value || minDate.value.isAfter(maxDate.value))) {
  27685. leftDate.value = parsedValueD.subtract(1, "month");
  27686. minDate.value = maxDate.value.subtract(1, "month");
  27687. }
  27688. }
  27689. }
  27690. };
  27691. const handleDateChange = (_, type) => {
  27692. dateUserInput.value[type] = null;
  27693. };
  27694. const handleTimeInput = (value, type) => {
  27695. timeUserInput.value[type] = value;
  27696. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  27697. if (parsedValueD.isValid()) {
  27698. if (type === "min") {
  27699. minTimePickerVisible.value = true;
  27700. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  27701. } else {
  27702. maxTimePickerVisible.value = true;
  27703. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  27704. rightDate.value = maxDate.value;
  27705. }
  27706. }
  27707. };
  27708. const handleTimeChange = (value, type) => {
  27709. timeUserInput.value[type] = null;
  27710. if (type === "min") {
  27711. leftDate.value = minDate.value;
  27712. minTimePickerVisible.value = false;
  27713. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  27714. maxDate.value = minDate.value;
  27715. }
  27716. } else {
  27717. rightDate.value = maxDate.value;
  27718. maxTimePickerVisible.value = false;
  27719. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  27720. minDate.value = maxDate.value;
  27721. }
  27722. }
  27723. };
  27724. const handleMinTimePick = (value, visible, first) => {
  27725. if (timeUserInput.value.min)
  27726. return;
  27727. if (value) {
  27728. leftDate.value = value;
  27729. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  27730. }
  27731. if (!first) {
  27732. minTimePickerVisible.value = visible;
  27733. }
  27734. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  27735. maxDate.value = minDate.value;
  27736. rightDate.value = value;
  27737. }
  27738. };
  27739. const handleMaxTimePick = (value, visible, first) => {
  27740. if (timeUserInput.value.max)
  27741. return;
  27742. if (value) {
  27743. rightDate.value = value;
  27744. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  27745. }
  27746. if (!first) {
  27747. maxTimePickerVisible.value = visible;
  27748. }
  27749. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  27750. minDate.value = maxDate.value;
  27751. }
  27752. };
  27753. const handleClear = () => {
  27754. leftDate.value = getDefaultValue(unref(defaultValue), {
  27755. lang: unref(lang),
  27756. unit: "month",
  27757. unlinkPanels: props.unlinkPanels
  27758. })[0];
  27759. rightDate.value = leftDate.value.add(1, "month");
  27760. maxDate.value = void 0;
  27761. minDate.value = void 0;
  27762. emit("pick", null);
  27763. };
  27764. const formatToString = (value) => {
  27765. return isArray$1(value) ? value.map((_) => _.format(format.value)) : value.format(format.value);
  27766. };
  27767. const parseUserInput = (value) => {
  27768. return isArray$1(value) ? value.map((_) => dayjs(_, format.value).locale(lang.value)) : dayjs(value, format.value).locale(lang.value);
  27769. };
  27770. function onParsedValueChanged(minDate2, maxDate2) {
  27771. if (props.unlinkPanels && maxDate2) {
  27772. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  27773. const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
  27774. const maxDateYear = maxDate2.year();
  27775. const maxDateMonth = maxDate2.month();
  27776. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$2) : maxDate2;
  27777. } else {
  27778. rightDate.value = leftDate.value.add(1, unit$2);
  27779. if (maxDate2) {
  27780. rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
  27781. }
  27782. }
  27783. }
  27784. emit("set-picker-option", ["isValidValue", isValidValue]);
  27785. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  27786. emit("set-picker-option", ["formatToString", formatToString]);
  27787. emit("set-picker-option", ["handleClear", handleClear]);
  27788. return (_ctx, _cache) => {
  27789. return openBlock(), createElementBlock("div", {
  27790. class: normalizeClass([
  27791. unref(ppNs).b(),
  27792. unref(drpNs).b(),
  27793. {
  27794. "has-sidebar": _ctx.$slots.sidebar || unref(hasShortcuts),
  27795. "has-time": unref(showTime)
  27796. }
  27797. ])
  27798. }, [
  27799. createElementVNode("div", {
  27800. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  27801. }, [
  27802. renderSlot(_ctx.$slots, "sidebar", {
  27803. class: normalizeClass(unref(ppNs).e("sidebar"))
  27804. }),
  27805. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  27806. key: 0,
  27807. class: normalizeClass(unref(ppNs).e("sidebar"))
  27808. }, [
  27809. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  27810. return openBlock(), createElementBlock("button", {
  27811. key,
  27812. type: "button",
  27813. class: normalizeClass(unref(ppNs).e("shortcut")),
  27814. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  27815. }, toDisplayString(shortcut.text), 11, ["onClick"]);
  27816. }), 128))
  27817. ], 2)) : createCommentVNode("v-if", true),
  27818. createElementVNode("div", {
  27819. class: normalizeClass(unref(ppNs).e("body"))
  27820. }, [
  27821. unref(showTime) ? (openBlock(), createElementBlock("div", {
  27822. key: 0,
  27823. class: normalizeClass(unref(drpNs).e("time-header"))
  27824. }, [
  27825. createElementVNode("span", {
  27826. class: normalizeClass(unref(drpNs).e("editors-wrap"))
  27827. }, [
  27828. createElementVNode("span", {
  27829. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  27830. }, [
  27831. createVNode(unref(ElInput), {
  27832. size: "small",
  27833. disabled: unref(rangeState).selecting,
  27834. placeholder: unref(t)("el.datepicker.startDate"),
  27835. class: normalizeClass(unref(drpNs).e("editor")),
  27836. "model-value": unref(minVisibleDate),
  27837. "validate-event": false,
  27838. onInput: (val) => handleDateInput(val, "min"),
  27839. onChange: (val) => handleDateChange(val, "min")
  27840. }, null, 8, ["disabled", "placeholder", "class", "model-value", "onInput", "onChange"])
  27841. ], 2),
  27842. withDirectives((openBlock(), createElementBlock("span", {
  27843. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  27844. }, [
  27845. createVNode(unref(ElInput), {
  27846. size: "small",
  27847. class: normalizeClass(unref(drpNs).e("editor")),
  27848. disabled: unref(rangeState).selecting,
  27849. placeholder: unref(t)("el.datepicker.startTime"),
  27850. "model-value": unref(minVisibleTime),
  27851. "validate-event": false,
  27852. onFocus: ($event) => minTimePickerVisible.value = true,
  27853. onInput: (val) => handleTimeInput(val, "min"),
  27854. onChange: (val) => handleTimeChange(val, "min")
  27855. }, null, 8, ["class", "disabled", "placeholder", "model-value", "onFocus", "onInput", "onChange"]),
  27856. createVNode(unref(TimePickPanel), {
  27857. visible: minTimePickerVisible.value,
  27858. format: unref(timeFormat),
  27859. "datetime-role": "start",
  27860. "parsed-value": leftDate.value,
  27861. onPick: handleMinTimePick
  27862. }, null, 8, ["visible", "format", "parsed-value"])
  27863. ], 2)), [
  27864. [unref(ClickOutside), handleMinTimeClose]
  27865. ])
  27866. ], 2),
  27867. createElementVNode("span", null, [
  27868. createVNode(unref(ElIcon), null, {
  27869. default: withCtx(() => [
  27870. createVNode(unref(arrow_right_default))
  27871. ]),
  27872. _: 1
  27873. })
  27874. ]),
  27875. createElementVNode("span", {
  27876. class: normalizeClass([unref(drpNs).e("editors-wrap"), "is-right"])
  27877. }, [
  27878. createElementVNode("span", {
  27879. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  27880. }, [
  27881. createVNode(unref(ElInput), {
  27882. size: "small",
  27883. class: normalizeClass(unref(drpNs).e("editor")),
  27884. disabled: unref(rangeState).selecting,
  27885. placeholder: unref(t)("el.datepicker.endDate"),
  27886. "model-value": unref(maxVisibleDate),
  27887. readonly: !unref(minDate),
  27888. "validate-event": false,
  27889. onInput: (val) => handleDateInput(val, "max"),
  27890. onChange: (val) => handleDateChange(val, "max")
  27891. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onInput", "onChange"])
  27892. ], 2),
  27893. withDirectives((openBlock(), createElementBlock("span", {
  27894. class: normalizeClass(unref(drpNs).e("time-picker-wrap"))
  27895. }, [
  27896. createVNode(unref(ElInput), {
  27897. size: "small",
  27898. class: normalizeClass(unref(drpNs).e("editor")),
  27899. disabled: unref(rangeState).selecting,
  27900. placeholder: unref(t)("el.datepicker.endTime"),
  27901. "model-value": unref(maxVisibleTime),
  27902. readonly: !unref(minDate),
  27903. "validate-event": false,
  27904. onFocus: ($event) => unref(minDate) && (maxTimePickerVisible.value = true),
  27905. onInput: (val) => handleTimeInput(val, "max"),
  27906. onChange: (val) => handleTimeChange(val, "max")
  27907. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly", "onFocus", "onInput", "onChange"]),
  27908. createVNode(unref(TimePickPanel), {
  27909. "datetime-role": "end",
  27910. visible: maxTimePickerVisible.value,
  27911. format: unref(timeFormat),
  27912. "parsed-value": rightDate.value,
  27913. onPick: handleMaxTimePick
  27914. }, null, 8, ["visible", "format", "parsed-value"])
  27915. ], 2)), [
  27916. [unref(ClickOutside), handleMaxTimeClose]
  27917. ])
  27918. ], 2)
  27919. ], 2)) : createCommentVNode("v-if", true),
  27920. createElementVNode("div", {
  27921. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"])
  27922. }, [
  27923. createElementVNode("div", {
  27924. class: normalizeClass(unref(drpNs).e("header"))
  27925. }, [
  27926. createElementVNode("button", {
  27927. type: "button",
  27928. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  27929. "aria-label": unref(t)(`el.datepicker.prevYear`),
  27930. onClick: leftPrevYear
  27931. }, [
  27932. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  27933. createVNode(unref(ElIcon), null, {
  27934. default: withCtx(() => [
  27935. createVNode(unref(d_arrow_left_default))
  27936. ]),
  27937. _: 1
  27938. })
  27939. ])
  27940. ], 10, ["aria-label"]),
  27941. createElementVNode("button", {
  27942. type: "button",
  27943. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
  27944. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  27945. onClick: leftPrevMonth
  27946. }, [
  27947. renderSlot(_ctx.$slots, "prev-month", {}, () => [
  27948. createVNode(unref(ElIcon), null, {
  27949. default: withCtx(() => [
  27950. createVNode(unref(arrow_left_default))
  27951. ]),
  27952. _: 1
  27953. })
  27954. ])
  27955. ], 10, ["aria-label"]),
  27956. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  27957. key: 0,
  27958. type: "button",
  27959. disabled: !unref(enableYearArrow),
  27960. class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-right"]),
  27961. "aria-label": unref(t)(`el.datepicker.nextYear`),
  27962. onClick: leftNextYear
  27963. }, [
  27964. renderSlot(_ctx.$slots, "next-year", {}, () => [
  27965. createVNode(unref(ElIcon), null, {
  27966. default: withCtx(() => [
  27967. createVNode(unref(d_arrow_right_default))
  27968. ]),
  27969. _: 1
  27970. })
  27971. ])
  27972. ], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
  27973. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  27974. key: 1,
  27975. type: "button",
  27976. disabled: !unref(enableMonthArrow),
  27977. class: normalizeClass([[
  27978. unref(ppNs).e("icon-btn"),
  27979. { "is-disabled": !unref(enableMonthArrow) }
  27980. ], "arrow-right"]),
  27981. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  27982. onClick: leftNextMonth
  27983. }, [
  27984. renderSlot(_ctx.$slots, "next-month", {}, () => [
  27985. createVNode(unref(ElIcon), null, {
  27986. default: withCtx(() => [
  27987. createVNode(unref(arrow_right_default))
  27988. ]),
  27989. _: 1
  27990. })
  27991. ])
  27992. ], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
  27993. createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
  27994. ], 2),
  27995. createVNode(DateTable, {
  27996. "selection-mode": "range",
  27997. date: leftDate.value,
  27998. "min-date": unref(minDate),
  27999. "max-date": unref(maxDate),
  28000. "range-state": unref(rangeState),
  28001. "disabled-date": unref(disabledDate),
  28002. "cell-class-name": unref(cellClassName),
  28003. onChangerange: unref(handleChangeRange),
  28004. onPick: handleRangePick,
  28005. onSelect: unref(onSelect)
  28006. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  28007. ], 2),
  28008. createElementVNode("div", {
  28009. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"])
  28010. }, [
  28011. createElementVNode("div", {
  28012. class: normalizeClass(unref(drpNs).e("header"))
  28013. }, [
  28014. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28015. key: 0,
  28016. type: "button",
  28017. disabled: !unref(enableYearArrow),
  28018. class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-left"]),
  28019. "aria-label": unref(t)(`el.datepicker.prevYear`),
  28020. onClick: rightPrevYear
  28021. }, [
  28022. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28023. createVNode(unref(ElIcon), null, {
  28024. default: withCtx(() => [
  28025. createVNode(unref(d_arrow_left_default))
  28026. ]),
  28027. _: 1
  28028. })
  28029. ])
  28030. ], 10, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
  28031. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28032. key: 1,
  28033. type: "button",
  28034. disabled: !unref(enableMonthArrow),
  28035. class: normalizeClass([[
  28036. unref(ppNs).e("icon-btn"),
  28037. { "is-disabled": !unref(enableMonthArrow) }
  28038. ], "arrow-left"]),
  28039. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  28040. onClick: rightPrevMonth
  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, ["disabled", "aria-label"])) : createCommentVNode("v-if", true),
  28051. createElementVNode("button", {
  28052. type: "button",
  28053. "aria-label": unref(t)(`el.datepicker.nextYear`),
  28054. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  28055. onClick: rightNextYear
  28056. }, [
  28057. renderSlot(_ctx.$slots, "next-year", {}, () => [
  28058. createVNode(unref(ElIcon), null, {
  28059. default: withCtx(() => [
  28060. createVNode(unref(d_arrow_right_default))
  28061. ]),
  28062. _: 1
  28063. })
  28064. ])
  28065. ], 10, ["aria-label"]),
  28066. createElementVNode("button", {
  28067. type: "button",
  28068. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
  28069. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  28070. onClick: rightNextMonth
  28071. }, [
  28072. renderSlot(_ctx.$slots, "next-month", {}, () => [
  28073. createVNode(unref(ElIcon), null, {
  28074. default: withCtx(() => [
  28075. createVNode(unref(arrow_right_default))
  28076. ]),
  28077. _: 1
  28078. })
  28079. ])
  28080. ], 10, ["aria-label"]),
  28081. createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
  28082. ], 2),
  28083. createVNode(DateTable, {
  28084. "selection-mode": "range",
  28085. date: rightDate.value,
  28086. "min-date": unref(minDate),
  28087. "max-date": unref(maxDate),
  28088. "range-state": unref(rangeState),
  28089. "disabled-date": unref(disabledDate),
  28090. "cell-class-name": unref(cellClassName),
  28091. onChangerange: unref(handleChangeRange),
  28092. onPick: handleRangePick,
  28093. onSelect: unref(onSelect)
  28094. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  28095. ], 2)
  28096. ], 2)
  28097. ], 2),
  28098. unref(showTime) ? (openBlock(), createElementBlock("div", {
  28099. key: 0,
  28100. class: normalizeClass(unref(ppNs).e("footer"))
  28101. }, [
  28102. unref(clearable) ? (openBlock(), createBlock(unref(ElButton), {
  28103. key: 0,
  28104. text: "",
  28105. size: "small",
  28106. class: normalizeClass(unref(ppNs).e("link-btn")),
  28107. onClick: handleClear
  28108. }, {
  28109. default: withCtx(() => [
  28110. createTextVNode(toDisplayString(unref(t)("el.datepicker.clear")), 1)
  28111. ]),
  28112. _: 1
  28113. }, 8, ["class"])) : createCommentVNode("v-if", true),
  28114. createVNode(unref(ElButton), {
  28115. plain: "",
  28116. size: "small",
  28117. class: normalizeClass(unref(ppNs).e("link-btn")),
  28118. disabled: unref(btnDisabled),
  28119. onClick: ($event) => unref(handleRangeConfirm)(false)
  28120. }, {
  28121. default: withCtx(() => [
  28122. createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)
  28123. ]),
  28124. _: 1
  28125. }, 8, ["class", "disabled", "onClick"])
  28126. ], 2)) : createCommentVNode("v-if", true)
  28127. ], 2);
  28128. };
  28129. }
  28130. });
  28131. var DateRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1u, [["__file", "panel-date-range.vue"]]);
  28132. const panelMonthRangeProps = buildProps({
  28133. ...panelRangeSharedProps
  28134. });
  28135. const panelMonthRangeEmits = [
  28136. "pick",
  28137. "set-picker-option",
  28138. "calendar-change"
  28139. ];
  28140. const useMonthRangeHeader = ({
  28141. unlinkPanels,
  28142. leftDate,
  28143. rightDate
  28144. }) => {
  28145. const { t } = useLocale();
  28146. const leftPrevYear = () => {
  28147. leftDate.value = leftDate.value.subtract(1, "year");
  28148. if (!unlinkPanels.value) {
  28149. rightDate.value = rightDate.value.subtract(1, "year");
  28150. }
  28151. };
  28152. const rightNextYear = () => {
  28153. if (!unlinkPanels.value) {
  28154. leftDate.value = leftDate.value.add(1, "year");
  28155. }
  28156. rightDate.value = rightDate.value.add(1, "year");
  28157. };
  28158. const leftNextYear = () => {
  28159. leftDate.value = leftDate.value.add(1, "year");
  28160. };
  28161. const rightPrevYear = () => {
  28162. rightDate.value = rightDate.value.subtract(1, "year");
  28163. };
  28164. const leftLabel = computed(() => {
  28165. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  28166. });
  28167. const rightLabel = computed(() => {
  28168. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  28169. });
  28170. const leftYear = computed(() => {
  28171. return leftDate.value.year();
  28172. });
  28173. const rightYear = computed(() => {
  28174. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  28175. });
  28176. return {
  28177. leftPrevYear,
  28178. rightNextYear,
  28179. leftNextYear,
  28180. rightPrevYear,
  28181. leftLabel,
  28182. rightLabel,
  28183. leftYear,
  28184. rightYear
  28185. };
  28186. };
  28187. const unit$1 = "year";
  28188. const __default__$13 = defineComponent({
  28189. name: "DatePickerMonthRange"
  28190. });
  28191. const _sfc_main$1t = /* @__PURE__ */ defineComponent({
  28192. ...__default__$13,
  28193. props: panelMonthRangeProps,
  28194. emits: panelMonthRangeEmits,
  28195. setup(__props, { emit }) {
  28196. const props = __props;
  28197. const { lang } = useLocale();
  28198. const pickerBase = inject("EP_PICKER_BASE");
  28199. const { shortcuts, disabledDate } = pickerBase.props;
  28200. const format = toRef(pickerBase.props, "format");
  28201. const defaultValue = toRef(pickerBase.props, "defaultValue");
  28202. const leftDate = ref(dayjs().locale(lang.value));
  28203. const rightDate = ref(dayjs().locale(lang.value).add(1, unit$1));
  28204. const {
  28205. minDate,
  28206. maxDate,
  28207. rangeState,
  28208. ppNs,
  28209. drpNs,
  28210. handleChangeRange,
  28211. handleRangeConfirm,
  28212. handleShortcutClick,
  28213. onSelect
  28214. } = useRangePicker(props, {
  28215. defaultValue,
  28216. leftDate,
  28217. rightDate,
  28218. unit: unit$1,
  28219. onParsedValueChanged
  28220. });
  28221. const hasShortcuts = computed(() => !!shortcuts.length);
  28222. const {
  28223. leftPrevYear,
  28224. rightNextYear,
  28225. leftNextYear,
  28226. rightPrevYear,
  28227. leftLabel,
  28228. rightLabel,
  28229. leftYear,
  28230. rightYear
  28231. } = useMonthRangeHeader({
  28232. unlinkPanels: toRef(props, "unlinkPanels"),
  28233. leftDate,
  28234. rightDate
  28235. });
  28236. const enableYearArrow = computed(() => {
  28237. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  28238. });
  28239. const handleRangePick = (val, close = true) => {
  28240. const minDate_ = val.minDate;
  28241. const maxDate_ = val.maxDate;
  28242. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  28243. return;
  28244. }
  28245. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  28246. maxDate.value = maxDate_;
  28247. minDate.value = minDate_;
  28248. if (!close)
  28249. return;
  28250. handleRangeConfirm();
  28251. };
  28252. const handleClear = () => {
  28253. leftDate.value = getDefaultValue(unref(defaultValue), {
  28254. lang: unref(lang),
  28255. unit: "year",
  28256. unlinkPanels: props.unlinkPanels
  28257. })[0];
  28258. rightDate.value = leftDate.value.add(1, "year");
  28259. emit("pick", null);
  28260. };
  28261. const formatToString = (value) => {
  28262. return isArray$1(value) ? value.map((_) => _.format(format.value)) : value.format(format.value);
  28263. };
  28264. const parseUserInput = (value) => {
  28265. return isArray$1(value) ? value.map((_) => dayjs(_, format.value).locale(lang.value)) : dayjs(value, format.value).locale(lang.value);
  28266. };
  28267. function onParsedValueChanged(minDate2, maxDate2) {
  28268. if (props.unlinkPanels && maxDate2) {
  28269. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  28270. const maxDateYear = maxDate2.year();
  28271. rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit$1) : maxDate2;
  28272. } else {
  28273. rightDate.value = leftDate.value.add(1, unit$1);
  28274. }
  28275. }
  28276. emit("set-picker-option", ["isValidValue", isValidRange]);
  28277. emit("set-picker-option", ["formatToString", formatToString]);
  28278. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  28279. emit("set-picker-option", ["handleClear", handleClear]);
  28280. return (_ctx, _cache) => {
  28281. return openBlock(), createElementBlock("div", {
  28282. class: normalizeClass([
  28283. unref(ppNs).b(),
  28284. unref(drpNs).b(),
  28285. {
  28286. "has-sidebar": Boolean(_ctx.$slots.sidebar) || unref(hasShortcuts)
  28287. }
  28288. ])
  28289. }, [
  28290. createElementVNode("div", {
  28291. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  28292. }, [
  28293. renderSlot(_ctx.$slots, "sidebar", {
  28294. class: normalizeClass(unref(ppNs).e("sidebar"))
  28295. }),
  28296. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  28297. key: 0,
  28298. class: normalizeClass(unref(ppNs).e("sidebar"))
  28299. }, [
  28300. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  28301. return openBlock(), createElementBlock("button", {
  28302. key,
  28303. type: "button",
  28304. class: normalizeClass(unref(ppNs).e("shortcut")),
  28305. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  28306. }, toDisplayString(shortcut.text), 11, ["onClick"]);
  28307. }), 128))
  28308. ], 2)) : createCommentVNode("v-if", true),
  28309. createElementVNode("div", {
  28310. class: normalizeClass(unref(ppNs).e("body"))
  28311. }, [
  28312. createElementVNode("div", {
  28313. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-left"])
  28314. }, [
  28315. createElementVNode("div", {
  28316. class: normalizeClass(unref(drpNs).e("header"))
  28317. }, [
  28318. createElementVNode("button", {
  28319. type: "button",
  28320. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  28321. onClick: unref(leftPrevYear)
  28322. }, [
  28323. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28324. createVNode(unref(ElIcon), null, {
  28325. default: withCtx(() => [
  28326. createVNode(unref(d_arrow_left_default))
  28327. ]),
  28328. _: 1
  28329. })
  28330. ])
  28331. ], 10, ["onClick"]),
  28332. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28333. key: 0,
  28334. type: "button",
  28335. disabled: !unref(enableYearArrow),
  28336. class: normalizeClass([[
  28337. unref(ppNs).e("icon-btn"),
  28338. { [unref(ppNs).is("disabled")]: !unref(enableYearArrow) }
  28339. ], "d-arrow-right"]),
  28340. onClick: unref(leftNextYear)
  28341. }, [
  28342. renderSlot(_ctx.$slots, "next-year", {}, () => [
  28343. createVNode(unref(ElIcon), null, {
  28344. default: withCtx(() => [
  28345. createVNode(unref(d_arrow_right_default))
  28346. ]),
  28347. _: 1
  28348. })
  28349. ])
  28350. ], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
  28351. createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
  28352. ], 2),
  28353. createVNode(MonthTable, {
  28354. "selection-mode": "range",
  28355. date: leftDate.value,
  28356. "min-date": unref(minDate),
  28357. "max-date": unref(maxDate),
  28358. "range-state": unref(rangeState),
  28359. "disabled-date": unref(disabledDate),
  28360. onChangerange: unref(handleChangeRange),
  28361. onPick: handleRangePick,
  28362. onSelect: unref(onSelect)
  28363. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  28364. ], 2),
  28365. createElementVNode("div", {
  28366. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"])
  28367. }, [
  28368. createElementVNode("div", {
  28369. class: normalizeClass(unref(drpNs).e("header"))
  28370. }, [
  28371. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28372. key: 0,
  28373. type: "button",
  28374. disabled: !unref(enableYearArrow),
  28375. class: normalizeClass([[unref(ppNs).e("icon-btn"), { "is-disabled": !unref(enableYearArrow) }], "d-arrow-left"]),
  28376. onClick: unref(rightPrevYear)
  28377. }, [
  28378. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28379. createVNode(unref(ElIcon), null, {
  28380. default: withCtx(() => [
  28381. createVNode(unref(d_arrow_left_default))
  28382. ]),
  28383. _: 1
  28384. })
  28385. ])
  28386. ], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
  28387. createElementVNode("button", {
  28388. type: "button",
  28389. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  28390. onClick: unref(rightNextYear)
  28391. }, [
  28392. renderSlot(_ctx.$slots, "next-year", {}, () => [
  28393. createVNode(unref(ElIcon), null, {
  28394. default: withCtx(() => [
  28395. createVNode(unref(d_arrow_right_default))
  28396. ]),
  28397. _: 1
  28398. })
  28399. ])
  28400. ], 10, ["onClick"]),
  28401. createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
  28402. ], 2),
  28403. createVNode(MonthTable, {
  28404. "selection-mode": "range",
  28405. date: rightDate.value,
  28406. "min-date": unref(minDate),
  28407. "max-date": unref(maxDate),
  28408. "range-state": unref(rangeState),
  28409. "disabled-date": unref(disabledDate),
  28410. onChangerange: unref(handleChangeRange),
  28411. onPick: handleRangePick,
  28412. onSelect: unref(onSelect)
  28413. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  28414. ], 2)
  28415. ], 2)
  28416. ], 2)
  28417. ], 2);
  28418. };
  28419. }
  28420. });
  28421. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["__file", "panel-month-range.vue"]]);
  28422. const panelYearRangeProps = buildProps({
  28423. ...panelRangeSharedProps
  28424. });
  28425. const panelYearRangeEmits = [
  28426. "pick",
  28427. "set-picker-option",
  28428. "calendar-change"
  28429. ];
  28430. const useYearRangeHeader = ({
  28431. unlinkPanels,
  28432. leftDate,
  28433. rightDate
  28434. }) => {
  28435. const leftPrevYear = () => {
  28436. leftDate.value = leftDate.value.subtract(10, "year");
  28437. if (!unlinkPanels.value) {
  28438. rightDate.value = rightDate.value.subtract(10, "year");
  28439. }
  28440. };
  28441. const rightNextYear = () => {
  28442. if (!unlinkPanels.value) {
  28443. leftDate.value = leftDate.value.add(10, "year");
  28444. }
  28445. rightDate.value = rightDate.value.add(10, "year");
  28446. };
  28447. const leftNextYear = () => {
  28448. leftDate.value = leftDate.value.add(10, "year");
  28449. };
  28450. const rightPrevYear = () => {
  28451. rightDate.value = rightDate.value.subtract(10, "year");
  28452. };
  28453. const leftLabel = computed(() => {
  28454. const leftStartDate = Math.floor(leftDate.value.year() / 10) * 10;
  28455. return `${leftStartDate}-${leftStartDate + 9}`;
  28456. });
  28457. const rightLabel = computed(() => {
  28458. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  28459. return `${rightStartDate}-${rightStartDate + 9}`;
  28460. });
  28461. const leftYear = computed(() => {
  28462. const leftEndDate = Math.floor(leftDate.value.year() / 10) * 10 + 9;
  28463. return leftEndDate;
  28464. });
  28465. const rightYear = computed(() => {
  28466. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  28467. return rightStartDate;
  28468. });
  28469. return {
  28470. leftPrevYear,
  28471. rightNextYear,
  28472. leftNextYear,
  28473. rightPrevYear,
  28474. leftLabel,
  28475. rightLabel,
  28476. leftYear,
  28477. rightYear
  28478. };
  28479. };
  28480. const unit = "year";
  28481. const __default__$12 = defineComponent({
  28482. name: "DatePickerYearRange"
  28483. });
  28484. const _sfc_main$1s = /* @__PURE__ */ defineComponent({
  28485. ...__default__$12,
  28486. props: panelYearRangeProps,
  28487. emits: panelYearRangeEmits,
  28488. setup(__props, { emit }) {
  28489. const props = __props;
  28490. const { lang } = useLocale();
  28491. const leftDate = ref(dayjs().locale(lang.value));
  28492. const rightDate = ref(leftDate.value.add(10, "year"));
  28493. const { pickerNs: ppNs } = inject(ROOT_PICKER_INJECTION_KEY);
  28494. const drpNs = useNamespace("date-range-picker");
  28495. const hasShortcuts = computed(() => !!shortcuts.length);
  28496. const panelKls = computed(() => [
  28497. ppNs.b(),
  28498. drpNs.b(),
  28499. {
  28500. "has-sidebar": Boolean(useSlots().sidebar) || hasShortcuts.value
  28501. }
  28502. ]);
  28503. const leftPanelKls = computed(() => {
  28504. return {
  28505. content: [ppNs.e("content"), drpNs.e("content"), "is-left"],
  28506. arrowLeftBtn: [ppNs.e("icon-btn"), "d-arrow-left"],
  28507. arrowRightBtn: [
  28508. ppNs.e("icon-btn"),
  28509. { [ppNs.is("disabled")]: !enableYearArrow.value },
  28510. "d-arrow-right"
  28511. ]
  28512. };
  28513. });
  28514. const rightPanelKls = computed(() => {
  28515. return {
  28516. content: [ppNs.e("content"), drpNs.e("content"), "is-right"],
  28517. arrowLeftBtn: [
  28518. ppNs.e("icon-btn"),
  28519. { "is-disabled": !enableYearArrow.value },
  28520. "d-arrow-left"
  28521. ],
  28522. arrowRightBtn: [ppNs.e("icon-btn"), "d-arrow-right"]
  28523. };
  28524. });
  28525. const handleShortcutClick = useShortcut(lang);
  28526. const {
  28527. leftPrevYear,
  28528. rightNextYear,
  28529. leftNextYear,
  28530. rightPrevYear,
  28531. leftLabel,
  28532. rightLabel,
  28533. leftYear,
  28534. rightYear
  28535. } = useYearRangeHeader({
  28536. unlinkPanels: toRef(props, "unlinkPanels"),
  28537. leftDate,
  28538. rightDate
  28539. });
  28540. const enableYearArrow = computed(() => {
  28541. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  28542. });
  28543. const minDate = ref();
  28544. const maxDate = ref();
  28545. const rangeState = ref({
  28546. endDate: null,
  28547. selecting: false
  28548. });
  28549. const handleChangeRange = (val) => {
  28550. rangeState.value = val;
  28551. };
  28552. const handleRangePick = (val, close = true) => {
  28553. const minDate_ = val.minDate;
  28554. const maxDate_ = val.maxDate;
  28555. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  28556. return;
  28557. }
  28558. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  28559. maxDate.value = maxDate_;
  28560. minDate.value = minDate_;
  28561. if (!close)
  28562. return;
  28563. handleConfirm();
  28564. };
  28565. const handleConfirm = (visible = false) => {
  28566. if (isValidRange([minDate.value, maxDate.value])) {
  28567. emit("pick", [minDate.value, maxDate.value], visible);
  28568. }
  28569. };
  28570. const onSelect = (selecting) => {
  28571. rangeState.value.selecting = selecting;
  28572. if (!selecting) {
  28573. rangeState.value.endDate = null;
  28574. }
  28575. };
  28576. const pickerBase = inject("EP_PICKER_BASE");
  28577. const { shortcuts, disabledDate } = pickerBase.props;
  28578. const format = toRef(pickerBase.props, "format");
  28579. const defaultValue = toRef(pickerBase.props, "defaultValue");
  28580. const getDefaultValue = () => {
  28581. let start;
  28582. if (isArray$1(defaultValue.value)) {
  28583. const left = dayjs(defaultValue.value[0]);
  28584. let right = dayjs(defaultValue.value[1]);
  28585. if (!props.unlinkPanels) {
  28586. right = left.add(10, unit);
  28587. }
  28588. return [left, right];
  28589. } else if (defaultValue.value) {
  28590. start = dayjs(defaultValue.value);
  28591. } else {
  28592. start = dayjs();
  28593. }
  28594. start = start.locale(lang.value);
  28595. return [start, start.add(10, unit)];
  28596. };
  28597. watch(() => defaultValue.value, (val) => {
  28598. if (val) {
  28599. const defaultArr = getDefaultValue();
  28600. leftDate.value = defaultArr[0];
  28601. rightDate.value = defaultArr[1];
  28602. }
  28603. }, { immediate: true });
  28604. watch(() => props.parsedValue, (newVal) => {
  28605. if (newVal && newVal.length === 2) {
  28606. minDate.value = newVal[0];
  28607. maxDate.value = newVal[1];
  28608. leftDate.value = minDate.value;
  28609. if (props.unlinkPanels && maxDate.value) {
  28610. const minDateYear = minDate.value.year();
  28611. const maxDateYear = maxDate.value.year();
  28612. rightDate.value = minDateYear === maxDateYear ? maxDate.value.add(10, "year") : maxDate.value;
  28613. } else {
  28614. rightDate.value = leftDate.value.add(10, "year");
  28615. }
  28616. } else {
  28617. const defaultArr = getDefaultValue();
  28618. minDate.value = void 0;
  28619. maxDate.value = void 0;
  28620. leftDate.value = defaultArr[0];
  28621. rightDate.value = defaultArr[1];
  28622. }
  28623. }, { immediate: true });
  28624. const parseUserInput = (value) => {
  28625. return isArray$1(value) ? value.map((_) => dayjs(_, format.value).locale(lang.value)) : dayjs(value, format.value).locale(lang.value);
  28626. };
  28627. const formatToString = (value) => {
  28628. return isArray$1(value) ? value.map((day) => day.format(format.value)) : value.format(format.value);
  28629. };
  28630. const isValidValue = (date) => {
  28631. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  28632. };
  28633. const handleClear = () => {
  28634. const defaultArr = getDefaultValue();
  28635. leftDate.value = defaultArr[0];
  28636. rightDate.value = defaultArr[1];
  28637. maxDate.value = void 0;
  28638. minDate.value = void 0;
  28639. emit("pick", null);
  28640. };
  28641. emit("set-picker-option", ["isValidValue", isValidValue]);
  28642. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  28643. emit("set-picker-option", ["formatToString", formatToString]);
  28644. emit("set-picker-option", ["handleClear", handleClear]);
  28645. return (_ctx, _cache) => {
  28646. return openBlock(), createElementBlock("div", {
  28647. class: normalizeClass(unref(panelKls))
  28648. }, [
  28649. createElementVNode("div", {
  28650. class: normalizeClass(unref(ppNs).e("body-wrapper"))
  28651. }, [
  28652. renderSlot(_ctx.$slots, "sidebar", {
  28653. class: normalizeClass(unref(ppNs).e("sidebar"))
  28654. }),
  28655. unref(hasShortcuts) ? (openBlock(), createElementBlock("div", {
  28656. key: 0,
  28657. class: normalizeClass(unref(ppNs).e("sidebar"))
  28658. }, [
  28659. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  28660. return openBlock(), createElementBlock("button", {
  28661. key,
  28662. type: "button",
  28663. class: normalizeClass(unref(ppNs).e("shortcut")),
  28664. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  28665. }, toDisplayString(shortcut.text), 11, ["onClick"]);
  28666. }), 128))
  28667. ], 2)) : createCommentVNode("v-if", true),
  28668. createElementVNode("div", {
  28669. class: normalizeClass(unref(ppNs).e("body"))
  28670. }, [
  28671. createElementVNode("div", {
  28672. class: normalizeClass(unref(leftPanelKls).content)
  28673. }, [
  28674. createElementVNode("div", {
  28675. class: normalizeClass(unref(drpNs).e("header"))
  28676. }, [
  28677. createElementVNode("button", {
  28678. type: "button",
  28679. class: normalizeClass(unref(leftPanelKls).arrowLeftBtn),
  28680. onClick: unref(leftPrevYear)
  28681. }, [
  28682. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28683. createVNode(unref(ElIcon), null, {
  28684. default: withCtx(() => [
  28685. createVNode(unref(d_arrow_left_default))
  28686. ]),
  28687. _: 1
  28688. })
  28689. ])
  28690. ], 10, ["onClick"]),
  28691. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28692. key: 0,
  28693. type: "button",
  28694. disabled: !unref(enableYearArrow),
  28695. class: normalizeClass(unref(leftPanelKls).arrowRightBtn),
  28696. onClick: unref(leftNextYear)
  28697. }, [
  28698. renderSlot(_ctx.$slots, "next-year", {}, () => [
  28699. createVNode(unref(ElIcon), null, {
  28700. default: withCtx(() => [
  28701. createVNode(unref(d_arrow_right_default))
  28702. ]),
  28703. _: 1
  28704. })
  28705. ])
  28706. ], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
  28707. createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
  28708. ], 2),
  28709. createVNode(YearTable, {
  28710. "selection-mode": "range",
  28711. date: leftDate.value,
  28712. "min-date": minDate.value,
  28713. "max-date": maxDate.value,
  28714. "range-state": rangeState.value,
  28715. "disabled-date": unref(disabledDate),
  28716. onChangerange: handleChangeRange,
  28717. onPick: handleRangePick,
  28718. onSelect
  28719. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date"])
  28720. ], 2),
  28721. createElementVNode("div", {
  28722. class: normalizeClass(unref(rightPanelKls).content)
  28723. }, [
  28724. createElementVNode("div", {
  28725. class: normalizeClass(unref(drpNs).e("header"))
  28726. }, [
  28727. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28728. key: 0,
  28729. type: "button",
  28730. disabled: !unref(enableYearArrow),
  28731. class: normalizeClass(unref(rightPanelKls).arrowLeftBtn),
  28732. onClick: unref(rightPrevYear)
  28733. }, [
  28734. renderSlot(_ctx.$slots, "prev-year", {}, () => [
  28735. createVNode(unref(ElIcon), null, {
  28736. default: withCtx(() => [
  28737. createVNode(unref(d_arrow_left_default))
  28738. ]),
  28739. _: 1
  28740. })
  28741. ])
  28742. ], 10, ["disabled", "onClick"])) : createCommentVNode("v-if", true),
  28743. createElementVNode("button", {
  28744. type: "button",
  28745. class: normalizeClass(unref(rightPanelKls).arrowRightBtn),
  28746. onClick: unref(rightNextYear)
  28747. }, [
  28748. renderSlot(_ctx.$slots, "next-year", {}, () => [
  28749. createVNode(unref(ElIcon), null, {
  28750. default: withCtx(() => [
  28751. createVNode(unref(d_arrow_right_default))
  28752. ]),
  28753. _: 1
  28754. })
  28755. ])
  28756. ], 10, ["onClick"]),
  28757. createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
  28758. ], 2),
  28759. createVNode(YearTable, {
  28760. "selection-mode": "range",
  28761. date: rightDate.value,
  28762. "min-date": minDate.value,
  28763. "max-date": maxDate.value,
  28764. "range-state": rangeState.value,
  28765. "disabled-date": unref(disabledDate),
  28766. onChangerange: handleChangeRange,
  28767. onPick: handleRangePick,
  28768. onSelect
  28769. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date"])
  28770. ], 2)
  28771. ], 2)
  28772. ], 2)
  28773. ], 2);
  28774. };
  28775. }
  28776. });
  28777. var YearRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1s, [["__file", "panel-year-range.vue"]]);
  28778. const getPanel = function(type) {
  28779. switch (type) {
  28780. case "daterange":
  28781. case "datetimerange": {
  28782. return DateRangePickPanel;
  28783. }
  28784. case "monthrange": {
  28785. return MonthRangePickPanel;
  28786. }
  28787. case "yearrange": {
  28788. return YearRangePickPanel;
  28789. }
  28790. default: {
  28791. return DatePickPanel;
  28792. }
  28793. }
  28794. };
  28795. dayjs.extend(localeData);
  28796. dayjs.extend(advancedFormat);
  28797. dayjs.extend(customParseFormat);
  28798. dayjs.extend(weekOfYear);
  28799. dayjs.extend(weekYear);
  28800. dayjs.extend(dayOfYear);
  28801. dayjs.extend(isSameOrAfter);
  28802. dayjs.extend(isSameOrBefore);
  28803. var DatePicker = defineComponent({
  28804. name: "ElDatePicker",
  28805. install: null,
  28806. props: datePickerProps,
  28807. emits: ["update:modelValue"],
  28808. setup(props, {
  28809. expose,
  28810. emit,
  28811. slots
  28812. }) {
  28813. const ns = useNamespace("picker-panel");
  28814. provide("ElPopperOptions", reactive(toRef(props, "popperOptions")));
  28815. provide(ROOT_PICKER_INJECTION_KEY, {
  28816. slots,
  28817. pickerNs: ns
  28818. });
  28819. const commonPicker = ref();
  28820. const refProps = {
  28821. focus: () => {
  28822. var _a;
  28823. (_a = commonPicker.value) == null ? void 0 : _a.focus();
  28824. },
  28825. blur: () => {
  28826. var _a;
  28827. (_a = commonPicker.value) == null ? void 0 : _a.blur();
  28828. },
  28829. handleOpen: () => {
  28830. var _a;
  28831. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  28832. },
  28833. handleClose: () => {
  28834. var _a;
  28835. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  28836. }
  28837. };
  28838. expose(refProps);
  28839. const onModelValueUpdated = (val) => {
  28840. emit("update:modelValue", val);
  28841. };
  28842. return () => {
  28843. var _a;
  28844. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  28845. const Component = getPanel(props.type);
  28846. return createVNode(CommonPicker, mergeProps(props, {
  28847. "format": format,
  28848. "type": props.type,
  28849. "ref": commonPicker,
  28850. "onUpdate:modelValue": onModelValueUpdated
  28851. }), {
  28852. default: (scopedProps) => createVNode(Component, scopedProps, {
  28853. "prev-month": slots["prev-month"],
  28854. "next-month": slots["next-month"],
  28855. "prev-year": slots["prev-year"],
  28856. "next-year": slots["next-year"]
  28857. }),
  28858. "range-separator": slots["range-separator"]
  28859. });
  28860. };
  28861. }
  28862. });
  28863. const ElDatePicker = withInstall(DatePicker);
  28864. const descriptionsKey = Symbol("elDescriptions");
  28865. var ElDescriptionsCell = defineComponent({
  28866. name: "ElDescriptionsCell",
  28867. props: {
  28868. cell: {
  28869. type: Object
  28870. },
  28871. tag: {
  28872. type: String,
  28873. default: "td"
  28874. },
  28875. type: {
  28876. type: String
  28877. }
  28878. },
  28879. setup() {
  28880. const descriptions = inject(descriptionsKey, {});
  28881. return {
  28882. descriptions
  28883. };
  28884. },
  28885. render() {
  28886. var _a;
  28887. const item = getNormalizedProps(this.cell);
  28888. const directives = (((_a = this.cell) == null ? void 0 : _a.dirs) || []).map((dire) => {
  28889. const { dir, arg, modifiers, value } = dire;
  28890. return [dir, value, arg, modifiers];
  28891. });
  28892. const { border, direction } = this.descriptions;
  28893. const isVertical = direction === "vertical";
  28894. const renderLabel = () => {
  28895. var _a2, _b, _c;
  28896. return ((_c = (_b = (_a2 = this.cell) == null ? void 0 : _a2.children) == null ? void 0 : _b.label) == null ? void 0 : _c.call(_b)) || item.label;
  28897. };
  28898. const renderContent = () => {
  28899. var _a2, _b, _c;
  28900. return (_c = (_b = (_a2 = this.cell) == null ? void 0 : _a2.children) == null ? void 0 : _b.default) == null ? void 0 : _c.call(_b);
  28901. };
  28902. const span = item.span;
  28903. const rowspan = item.rowspan;
  28904. const align = item.align ? `is-${item.align}` : "";
  28905. const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align;
  28906. const className = item.className;
  28907. const labelClassName = item.labelClassName;
  28908. const width = this.type === "label" ? item.labelWidth || this.descriptions.labelWidth || item.width : item.width;
  28909. const style = {
  28910. width: addUnit(width),
  28911. minWidth: addUnit(item.minWidth)
  28912. };
  28913. const ns = useNamespace("descriptions");
  28914. switch (this.type) {
  28915. case "label":
  28916. return withDirectives(h$1(this.tag, {
  28917. style,
  28918. class: [
  28919. ns.e("cell"),
  28920. ns.e("label"),
  28921. ns.is("bordered-label", border),
  28922. ns.is("vertical-label", isVertical),
  28923. labelAlign,
  28924. labelClassName
  28925. ],
  28926. colSpan: isVertical ? span : 1,
  28927. rowspan: isVertical ? 1 : rowspan
  28928. }, renderLabel()), directives);
  28929. case "content":
  28930. return withDirectives(h$1(this.tag, {
  28931. style,
  28932. class: [
  28933. ns.e("cell"),
  28934. ns.e("content"),
  28935. ns.is("bordered-content", border),
  28936. ns.is("vertical-content", isVertical),
  28937. align,
  28938. className
  28939. ],
  28940. colSpan: isVertical ? span : span * 2 - 1,
  28941. rowspan: isVertical ? rowspan * 2 - 1 : rowspan
  28942. }, renderContent()), directives);
  28943. default: {
  28944. const label = renderLabel();
  28945. return withDirectives(h$1("td", {
  28946. style,
  28947. class: [ns.e("cell"), align],
  28948. colSpan: span,
  28949. rowspan
  28950. }, [
  28951. !isNil(label) ? h$1("span", {
  28952. class: [ns.e("label"), labelClassName]
  28953. }, label) : void 0,
  28954. h$1("span", {
  28955. class: [ns.e("content"), className]
  28956. }, renderContent())
  28957. ]), directives);
  28958. }
  28959. }
  28960. }
  28961. });
  28962. const descriptionsRowProps = buildProps({
  28963. row: {
  28964. type: definePropType(Array),
  28965. default: () => []
  28966. }
  28967. });
  28968. const __default__$11 = defineComponent({
  28969. name: "ElDescriptionsRow"
  28970. });
  28971. const _sfc_main$1r = /* @__PURE__ */ defineComponent({
  28972. ...__default__$11,
  28973. props: descriptionsRowProps,
  28974. setup(__props) {
  28975. const descriptions = inject(descriptionsKey, {});
  28976. return (_ctx, _cache) => {
  28977. return unref(descriptions).direction === "vertical" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  28978. createElementVNode("tr", null, [
  28979. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.row, (cell, _index) => {
  28980. return openBlock(), createBlock(unref(ElDescriptionsCell), {
  28981. key: `tr1-${_index}`,
  28982. cell,
  28983. tag: "th",
  28984. type: "label"
  28985. }, null, 8, ["cell"]);
  28986. }), 128))
  28987. ]),
  28988. createElementVNode("tr", null, [
  28989. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.row, (cell, _index) => {
  28990. return openBlock(), createBlock(unref(ElDescriptionsCell), {
  28991. key: `tr2-${_index}`,
  28992. cell,
  28993. tag: "td",
  28994. type: "content"
  28995. }, null, 8, ["cell"]);
  28996. }), 128))
  28997. ])
  28998. ], 64)) : (openBlock(), createElementBlock("tr", { key: 1 }, [
  28999. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.row, (cell, _index) => {
  29000. return openBlock(), createElementBlock(Fragment, {
  29001. key: `tr3-${_index}`
  29002. }, [
  29003. unref(descriptions).border ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  29004. createVNode(unref(ElDescriptionsCell), {
  29005. cell,
  29006. tag: "td",
  29007. type: "label"
  29008. }, null, 8, ["cell"]),
  29009. createVNode(unref(ElDescriptionsCell), {
  29010. cell,
  29011. tag: "td",
  29012. type: "content"
  29013. }, null, 8, ["cell"])
  29014. ], 64)) : (openBlock(), createBlock(unref(ElDescriptionsCell), {
  29015. key: 1,
  29016. cell,
  29017. tag: "td",
  29018. type: "both"
  29019. }, null, 8, ["cell"]))
  29020. ], 64);
  29021. }), 128))
  29022. ]));
  29023. };
  29024. }
  29025. });
  29026. var ElDescriptionsRow = /* @__PURE__ */ _export_sfc(_sfc_main$1r, [["__file", "descriptions-row.vue"]]);
  29027. const descriptionProps = buildProps({
  29028. border: Boolean,
  29029. column: {
  29030. type: Number,
  29031. default: 3
  29032. },
  29033. direction: {
  29034. type: String,
  29035. values: ["horizontal", "vertical"],
  29036. default: "horizontal"
  29037. },
  29038. size: useSizeProp,
  29039. title: {
  29040. type: String,
  29041. default: ""
  29042. },
  29043. extra: {
  29044. type: String,
  29045. default: ""
  29046. },
  29047. labelWidth: {
  29048. type: [String, Number],
  29049. default: ""
  29050. }
  29051. });
  29052. const __default__$10 = defineComponent({
  29053. name: "ElDescriptions"
  29054. });
  29055. const _sfc_main$1q = /* @__PURE__ */ defineComponent({
  29056. ...__default__$10,
  29057. props: descriptionProps,
  29058. setup(__props) {
  29059. const props = __props;
  29060. const ns = useNamespace("descriptions");
  29061. const descriptionsSize = useFormSize();
  29062. const slots = useSlots();
  29063. provide(descriptionsKey, props);
  29064. const descriptionKls = computed(() => [ns.b(), ns.m(descriptionsSize.value)]);
  29065. const filledNode = (node, span, count, isLast = false) => {
  29066. if (!node.props) {
  29067. node.props = {};
  29068. }
  29069. if (span > count) {
  29070. node.props.span = count;
  29071. }
  29072. if (isLast) {
  29073. node.props.span = span;
  29074. }
  29075. return node;
  29076. };
  29077. const getRows = () => {
  29078. if (!slots.default)
  29079. return [];
  29080. const children = flattedChildren(slots.default()).filter((node) => {
  29081. var _a;
  29082. return ((_a = node == null ? void 0 : node.type) == null ? void 0 : _a.name) === "ElDescriptionsItem";
  29083. });
  29084. const rows = [];
  29085. let temp = [];
  29086. let count = props.column;
  29087. let totalSpan = 0;
  29088. const rowspanTemp = [];
  29089. children.forEach((node, index) => {
  29090. var _a, _b, _c;
  29091. const span = ((_a = node.props) == null ? void 0 : _a.span) || 1;
  29092. const rowspan = ((_b = node.props) == null ? void 0 : _b.rowspan) || 1;
  29093. const rowNo = rows.length;
  29094. rowspanTemp[rowNo] || (rowspanTemp[rowNo] = 0);
  29095. if (rowspan > 1) {
  29096. for (let i = 1; i < rowspan; i++) {
  29097. rowspanTemp[_c = rowNo + i] || (rowspanTemp[_c] = 0);
  29098. rowspanTemp[rowNo + i]++;
  29099. totalSpan++;
  29100. }
  29101. }
  29102. if (rowspanTemp[rowNo] > 0) {
  29103. count -= rowspanTemp[rowNo];
  29104. rowspanTemp[rowNo] = 0;
  29105. }
  29106. if (index < children.length - 1) {
  29107. totalSpan += span > count ? count : span;
  29108. }
  29109. if (index === children.length - 1) {
  29110. const lastSpan = props.column - totalSpan % props.column;
  29111. temp.push(filledNode(node, lastSpan, count, true));
  29112. rows.push(temp);
  29113. return;
  29114. }
  29115. if (span < count) {
  29116. count -= span;
  29117. temp.push(node);
  29118. } else {
  29119. temp.push(filledNode(node, span, count));
  29120. rows.push(temp);
  29121. count = props.column;
  29122. temp = [];
  29123. }
  29124. });
  29125. return rows;
  29126. };
  29127. return (_ctx, _cache) => {
  29128. return openBlock(), createElementBlock("div", {
  29129. class: normalizeClass(unref(descriptionKls))
  29130. }, [
  29131. _ctx.title || _ctx.extra || _ctx.$slots.title || _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  29132. key: 0,
  29133. class: normalizeClass(unref(ns).e("header"))
  29134. }, [
  29135. createElementVNode("div", {
  29136. class: normalizeClass(unref(ns).e("title"))
  29137. }, [
  29138. renderSlot(_ctx.$slots, "title", {}, () => [
  29139. createTextVNode(toDisplayString(_ctx.title), 1)
  29140. ])
  29141. ], 2),
  29142. createElementVNode("div", {
  29143. class: normalizeClass(unref(ns).e("extra"))
  29144. }, [
  29145. renderSlot(_ctx.$slots, "extra", {}, () => [
  29146. createTextVNode(toDisplayString(_ctx.extra), 1)
  29147. ])
  29148. ], 2)
  29149. ], 2)) : createCommentVNode("v-if", true),
  29150. createElementVNode("div", {
  29151. class: normalizeClass(unref(ns).e("body"))
  29152. }, [
  29153. createElementVNode("table", {
  29154. class: normalizeClass([unref(ns).e("table"), unref(ns).is("bordered", _ctx.border)])
  29155. }, [
  29156. createElementVNode("tbody", null, [
  29157. (openBlock(true), createElementBlock(Fragment, null, renderList(getRows(), (row, _index) => {
  29158. return openBlock(), createBlock(ElDescriptionsRow, {
  29159. key: _index,
  29160. row
  29161. }, null, 8, ["row"]);
  29162. }), 128))
  29163. ])
  29164. ], 2)
  29165. ], 2)
  29166. ], 2);
  29167. };
  29168. }
  29169. });
  29170. var Descriptions = /* @__PURE__ */ _export_sfc(_sfc_main$1q, [["__file", "description.vue"]]);
  29171. const descriptionItemProps = buildProps({
  29172. label: {
  29173. type: String,
  29174. default: ""
  29175. },
  29176. span: {
  29177. type: Number,
  29178. default: 1
  29179. },
  29180. rowspan: {
  29181. type: Number,
  29182. default: 1
  29183. },
  29184. width: {
  29185. type: [String, Number],
  29186. default: ""
  29187. },
  29188. minWidth: {
  29189. type: [String, Number],
  29190. default: ""
  29191. },
  29192. labelWidth: {
  29193. type: [String, Number],
  29194. default: ""
  29195. },
  29196. align: {
  29197. type: String,
  29198. default: "left"
  29199. },
  29200. labelAlign: {
  29201. type: String,
  29202. default: ""
  29203. },
  29204. className: {
  29205. type: String,
  29206. default: ""
  29207. },
  29208. labelClassName: {
  29209. type: String,
  29210. default: ""
  29211. }
  29212. });
  29213. const DescriptionItem = defineComponent({
  29214. name: "ElDescriptionsItem",
  29215. props: descriptionItemProps
  29216. });
  29217. const ElDescriptions = withInstall(Descriptions, {
  29218. DescriptionsItem: DescriptionItem
  29219. });
  29220. const ElDescriptionsItem = withNoopInstall(DescriptionItem);
  29221. const overlayProps = buildProps({
  29222. mask: {
  29223. type: Boolean,
  29224. default: true
  29225. },
  29226. customMaskEvent: Boolean,
  29227. overlayClass: {
  29228. type: definePropType([
  29229. String,
  29230. Array,
  29231. Object
  29232. ])
  29233. },
  29234. zIndex: {
  29235. type: definePropType([String, Number])
  29236. }
  29237. });
  29238. const overlayEmits = {
  29239. click: (evt) => evt instanceof MouseEvent
  29240. };
  29241. const BLOCK = "overlay";
  29242. var Overlay$1 = defineComponent({
  29243. name: "ElOverlay",
  29244. props: overlayProps,
  29245. emits: overlayEmits,
  29246. setup(props, { slots, emit }) {
  29247. const ns = useNamespace(BLOCK);
  29248. const onMaskClick = (e) => {
  29249. emit("click", e);
  29250. };
  29251. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  29252. return () => {
  29253. return props.mask ? createVNode("div", {
  29254. class: [ns.b(), props.overlayClass],
  29255. style: {
  29256. zIndex: props.zIndex
  29257. },
  29258. onClick,
  29259. onMousedown,
  29260. onMouseup
  29261. }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h$1("div", {
  29262. class: props.overlayClass,
  29263. style: {
  29264. zIndex: props.zIndex,
  29265. position: "fixed",
  29266. top: "0px",
  29267. right: "0px",
  29268. bottom: "0px",
  29269. left: "0px"
  29270. }
  29271. }, [renderSlot(slots, "default")]);
  29272. };
  29273. }
  29274. });
  29275. const ElOverlay = Overlay$1;
  29276. const dialogInjectionKey = Symbol("dialogInjectionKey");
  29277. const dialogContentProps = buildProps({
  29278. center: Boolean,
  29279. alignCenter: Boolean,
  29280. closeIcon: {
  29281. type: iconPropType
  29282. },
  29283. draggable: Boolean,
  29284. overflow: Boolean,
  29285. fullscreen: Boolean,
  29286. showClose: {
  29287. type: Boolean,
  29288. default: true
  29289. },
  29290. title: {
  29291. type: String,
  29292. default: ""
  29293. },
  29294. ariaLevel: {
  29295. type: String,
  29296. default: "2"
  29297. }
  29298. });
  29299. const dialogContentEmits = {
  29300. close: () => true
  29301. };
  29302. const __default__$$ = defineComponent({ name: "ElDialogContent" });
  29303. const _sfc_main$1p = /* @__PURE__ */ defineComponent({
  29304. ...__default__$$,
  29305. props: dialogContentProps,
  29306. emits: dialogContentEmits,
  29307. setup(__props, { expose }) {
  29308. const props = __props;
  29309. const { t } = useLocale();
  29310. const { Close } = CloseComponents;
  29311. const { dialogRef, headerRef, bodyId, ns, style } = inject(dialogInjectionKey);
  29312. const { focusTrapRef } = inject(FOCUS_TRAP_INJECTION_KEY);
  29313. const dialogKls = computed(() => [
  29314. ns.b(),
  29315. ns.is("fullscreen", props.fullscreen),
  29316. ns.is("draggable", props.draggable),
  29317. ns.is("align-center", props.alignCenter),
  29318. { [ns.m("center")]: props.center }
  29319. ]);
  29320. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  29321. const draggable = computed(() => props.draggable);
  29322. const overflow = computed(() => props.overflow);
  29323. const { resetPosition } = useDraggable(dialogRef, headerRef, draggable, overflow);
  29324. expose({
  29325. resetPosition
  29326. });
  29327. return (_ctx, _cache) => {
  29328. return openBlock(), createElementBlock("div", {
  29329. ref: unref(composedDialogRef),
  29330. class: normalizeClass(unref(dialogKls)),
  29331. style: normalizeStyle(unref(style)),
  29332. tabindex: "-1"
  29333. }, [
  29334. createElementVNode("header", {
  29335. ref_key: "headerRef",
  29336. ref: headerRef,
  29337. class: normalizeClass([unref(ns).e("header"), { "show-close": _ctx.showClose }])
  29338. }, [
  29339. renderSlot(_ctx.$slots, "header", {}, () => [
  29340. createElementVNode("span", {
  29341. role: "heading",
  29342. "aria-level": _ctx.ariaLevel,
  29343. class: normalizeClass(unref(ns).e("title"))
  29344. }, toDisplayString(_ctx.title), 11, ["aria-level"])
  29345. ]),
  29346. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  29347. key: 0,
  29348. "aria-label": unref(t)("el.dialog.close"),
  29349. class: normalizeClass(unref(ns).e("headerbtn")),
  29350. type: "button",
  29351. onClick: ($event) => _ctx.$emit("close")
  29352. }, [
  29353. createVNode(unref(ElIcon), {
  29354. class: normalizeClass(unref(ns).e("close"))
  29355. }, {
  29356. default: withCtx(() => [
  29357. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
  29358. ]),
  29359. _: 1
  29360. }, 8, ["class"])
  29361. ], 10, ["aria-label", "onClick"])) : createCommentVNode("v-if", true)
  29362. ], 2),
  29363. createElementVNode("div", {
  29364. id: unref(bodyId),
  29365. class: normalizeClass(unref(ns).e("body"))
  29366. }, [
  29367. renderSlot(_ctx.$slots, "default")
  29368. ], 10, ["id"]),
  29369. _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", {
  29370. key: 0,
  29371. class: normalizeClass(unref(ns).e("footer"))
  29372. }, [
  29373. renderSlot(_ctx.$slots, "footer")
  29374. ], 2)) : createCommentVNode("v-if", true)
  29375. ], 6);
  29376. };
  29377. }
  29378. });
  29379. var ElDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$1p, [["__file", "dialog-content.vue"]]);
  29380. const dialogProps = buildProps({
  29381. ...dialogContentProps,
  29382. appendToBody: Boolean,
  29383. appendTo: {
  29384. type: definePropType([String, Object]),
  29385. default: "body"
  29386. },
  29387. beforeClose: {
  29388. type: definePropType(Function)
  29389. },
  29390. destroyOnClose: Boolean,
  29391. closeOnClickModal: {
  29392. type: Boolean,
  29393. default: true
  29394. },
  29395. closeOnPressEscape: {
  29396. type: Boolean,
  29397. default: true
  29398. },
  29399. lockScroll: {
  29400. type: Boolean,
  29401. default: true
  29402. },
  29403. modal: {
  29404. type: Boolean,
  29405. default: true
  29406. },
  29407. openDelay: {
  29408. type: Number,
  29409. default: 0
  29410. },
  29411. closeDelay: {
  29412. type: Number,
  29413. default: 0
  29414. },
  29415. top: {
  29416. type: String
  29417. },
  29418. modelValue: Boolean,
  29419. modalClass: String,
  29420. width: {
  29421. type: [String, Number]
  29422. },
  29423. zIndex: {
  29424. type: Number
  29425. },
  29426. trapFocus: Boolean,
  29427. headerAriaLevel: {
  29428. type: String,
  29429. default: "2"
  29430. }
  29431. });
  29432. const dialogEmits = {
  29433. open: () => true,
  29434. opened: () => true,
  29435. close: () => true,
  29436. closed: () => true,
  29437. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  29438. openAutoFocus: () => true,
  29439. closeAutoFocus: () => true
  29440. };
  29441. const useDialog = (props, targetRef) => {
  29442. var _a;
  29443. const instance = getCurrentInstance();
  29444. const emit = instance.emit;
  29445. const { nextZIndex } = useZIndex();
  29446. let lastPosition = "";
  29447. const titleId = useId();
  29448. const bodyId = useId();
  29449. const visible = ref(false);
  29450. const closed = ref(false);
  29451. const rendered = ref(false);
  29452. const zIndex = ref((_a = props.zIndex) != null ? _a : nextZIndex());
  29453. let openTimer = void 0;
  29454. let closeTimer = void 0;
  29455. const namespace = useGlobalConfig("namespace", defaultNamespace);
  29456. const style = computed(() => {
  29457. const style2 = {};
  29458. const varPrefix = `--${namespace.value}-dialog`;
  29459. if (!props.fullscreen) {
  29460. if (props.top) {
  29461. style2[`${varPrefix}-margin-top`] = props.top;
  29462. }
  29463. if (props.width) {
  29464. style2[`${varPrefix}-width`] = addUnit(props.width);
  29465. }
  29466. }
  29467. return style2;
  29468. });
  29469. const overlayDialogStyle = computed(() => {
  29470. if (props.alignCenter) {
  29471. return { display: "flex" };
  29472. }
  29473. return {};
  29474. });
  29475. function afterEnter() {
  29476. emit("opened");
  29477. }
  29478. function afterLeave() {
  29479. emit("closed");
  29480. emit(UPDATE_MODEL_EVENT, false);
  29481. if (props.destroyOnClose) {
  29482. rendered.value = false;
  29483. }
  29484. }
  29485. function beforeLeave() {
  29486. emit("close");
  29487. }
  29488. function open() {
  29489. closeTimer == null ? void 0 : closeTimer();
  29490. openTimer == null ? void 0 : openTimer();
  29491. if (props.openDelay && props.openDelay > 0) {
  29492. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  29493. } else {
  29494. doOpen();
  29495. }
  29496. }
  29497. function close() {
  29498. openTimer == null ? void 0 : openTimer();
  29499. closeTimer == null ? void 0 : closeTimer();
  29500. if (props.closeDelay && props.closeDelay > 0) {
  29501. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  29502. } else {
  29503. doClose();
  29504. }
  29505. }
  29506. function handleClose() {
  29507. function hide(shouldCancel) {
  29508. if (shouldCancel)
  29509. return;
  29510. closed.value = true;
  29511. visible.value = false;
  29512. }
  29513. if (props.beforeClose) {
  29514. props.beforeClose(hide);
  29515. } else {
  29516. close();
  29517. }
  29518. }
  29519. function onModalClick() {
  29520. if (props.closeOnClickModal) {
  29521. handleClose();
  29522. }
  29523. }
  29524. function doOpen() {
  29525. if (!isClient)
  29526. return;
  29527. visible.value = true;
  29528. }
  29529. function doClose() {
  29530. visible.value = false;
  29531. }
  29532. function onOpenAutoFocus() {
  29533. emit("openAutoFocus");
  29534. }
  29535. function onCloseAutoFocus() {
  29536. emit("closeAutoFocus");
  29537. }
  29538. function onFocusoutPrevented(event) {
  29539. var _a2;
  29540. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  29541. event.preventDefault();
  29542. }
  29543. }
  29544. if (props.lockScroll) {
  29545. useLockscreen(visible);
  29546. }
  29547. function onCloseRequested() {
  29548. if (props.closeOnPressEscape) {
  29549. handleClose();
  29550. }
  29551. }
  29552. watch(() => props.modelValue, (val) => {
  29553. if (val) {
  29554. closed.value = false;
  29555. open();
  29556. rendered.value = true;
  29557. zIndex.value = isUndefined$1(props.zIndex) ? nextZIndex() : zIndex.value++;
  29558. nextTick(() => {
  29559. emit("open");
  29560. if (targetRef.value) {
  29561. targetRef.value.scrollTop = 0;
  29562. }
  29563. });
  29564. } else {
  29565. if (visible.value) {
  29566. close();
  29567. }
  29568. }
  29569. });
  29570. watch(() => props.fullscreen, (val) => {
  29571. if (!targetRef.value)
  29572. return;
  29573. if (val) {
  29574. lastPosition = targetRef.value.style.transform;
  29575. targetRef.value.style.transform = "";
  29576. } else {
  29577. targetRef.value.style.transform = lastPosition;
  29578. }
  29579. });
  29580. onMounted(() => {
  29581. if (props.modelValue) {
  29582. visible.value = true;
  29583. rendered.value = true;
  29584. open();
  29585. }
  29586. });
  29587. return {
  29588. afterEnter,
  29589. afterLeave,
  29590. beforeLeave,
  29591. handleClose,
  29592. onModalClick,
  29593. close,
  29594. doClose,
  29595. onOpenAutoFocus,
  29596. onCloseAutoFocus,
  29597. onCloseRequested,
  29598. onFocusoutPrevented,
  29599. titleId,
  29600. bodyId,
  29601. closed,
  29602. style,
  29603. overlayDialogStyle,
  29604. rendered,
  29605. visible,
  29606. zIndex
  29607. };
  29608. };
  29609. const __default__$_ = defineComponent({
  29610. name: "ElDialog",
  29611. inheritAttrs: false
  29612. });
  29613. const _sfc_main$1o = /* @__PURE__ */ defineComponent({
  29614. ...__default__$_,
  29615. props: dialogProps,
  29616. emits: dialogEmits,
  29617. setup(__props, { expose }) {
  29618. const props = __props;
  29619. const slots = useSlots();
  29620. useDeprecated({
  29621. scope: "el-dialog",
  29622. from: "the title slot",
  29623. replacement: "the header slot",
  29624. version: "3.0.0",
  29625. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  29626. }, computed(() => !!slots.title));
  29627. const ns = useNamespace("dialog");
  29628. const dialogRef = ref();
  29629. const headerRef = ref();
  29630. const dialogContentRef = ref();
  29631. const {
  29632. visible,
  29633. titleId,
  29634. bodyId,
  29635. style,
  29636. overlayDialogStyle,
  29637. rendered,
  29638. zIndex,
  29639. afterEnter,
  29640. afterLeave,
  29641. beforeLeave,
  29642. handleClose,
  29643. onModalClick,
  29644. onOpenAutoFocus,
  29645. onCloseAutoFocus,
  29646. onCloseRequested,
  29647. onFocusoutPrevented
  29648. } = useDialog(props, dialogRef);
  29649. provide(dialogInjectionKey, {
  29650. dialogRef,
  29651. headerRef,
  29652. bodyId,
  29653. ns,
  29654. rendered,
  29655. style
  29656. });
  29657. const overlayEvent = useSameTarget(onModalClick);
  29658. const draggable = computed(() => props.draggable && !props.fullscreen);
  29659. const resetPosition = () => {
  29660. var _a;
  29661. (_a = dialogContentRef.value) == null ? void 0 : _a.resetPosition();
  29662. };
  29663. expose({
  29664. visible,
  29665. dialogContentRef,
  29666. resetPosition
  29667. });
  29668. return (_ctx, _cache) => {
  29669. return openBlock(), createBlock(unref(ElTeleport$1), {
  29670. to: _ctx.appendTo,
  29671. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  29672. }, {
  29673. default: withCtx(() => [
  29674. createVNode(Transition, {
  29675. name: "dialog-fade",
  29676. onAfterEnter: unref(afterEnter),
  29677. onAfterLeave: unref(afterLeave),
  29678. onBeforeLeave: unref(beforeLeave),
  29679. persisted: ""
  29680. }, {
  29681. default: withCtx(() => [
  29682. withDirectives(createVNode(unref(ElOverlay), {
  29683. "custom-mask-event": "",
  29684. mask: _ctx.modal,
  29685. "overlay-class": _ctx.modalClass,
  29686. "z-index": unref(zIndex)
  29687. }, {
  29688. default: withCtx(() => [
  29689. createElementVNode("div", {
  29690. role: "dialog",
  29691. "aria-modal": "true",
  29692. "aria-label": _ctx.title || void 0,
  29693. "aria-labelledby": !_ctx.title ? unref(titleId) : void 0,
  29694. "aria-describedby": unref(bodyId),
  29695. class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
  29696. style: normalizeStyle(unref(overlayDialogStyle)),
  29697. onClick: unref(overlayEvent).onClick,
  29698. onMousedown: unref(overlayEvent).onMousedown,
  29699. onMouseup: unref(overlayEvent).onMouseup
  29700. }, [
  29701. createVNode(unref(ElFocusTrap), {
  29702. loop: "",
  29703. trapped: unref(visible),
  29704. "focus-start-el": "container",
  29705. onFocusAfterTrapped: unref(onOpenAutoFocus),
  29706. onFocusAfterReleased: unref(onCloseAutoFocus),
  29707. onFocusoutPrevented: unref(onFocusoutPrevented),
  29708. onReleaseRequested: unref(onCloseRequested)
  29709. }, {
  29710. default: withCtx(() => [
  29711. unref(rendered) ? (openBlock(), createBlock(ElDialogContent, mergeProps({
  29712. key: 0,
  29713. ref_key: "dialogContentRef",
  29714. ref: dialogContentRef
  29715. }, _ctx.$attrs, {
  29716. center: _ctx.center,
  29717. "align-center": _ctx.alignCenter,
  29718. "close-icon": _ctx.closeIcon,
  29719. draggable: unref(draggable),
  29720. overflow: _ctx.overflow,
  29721. fullscreen: _ctx.fullscreen,
  29722. "show-close": _ctx.showClose,
  29723. title: _ctx.title,
  29724. "aria-level": _ctx.headerAriaLevel,
  29725. onClose: unref(handleClose)
  29726. }), createSlots({
  29727. header: withCtx(() => [
  29728. !_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  29729. key: 0,
  29730. close: unref(handleClose),
  29731. titleId: unref(titleId),
  29732. titleClass: unref(ns).e("title")
  29733. }) : renderSlot(_ctx.$slots, "title", { key: 1 })
  29734. ]),
  29735. default: withCtx(() => [
  29736. renderSlot(_ctx.$slots, "default")
  29737. ]),
  29738. _: 2
  29739. }, [
  29740. _ctx.$slots.footer ? {
  29741. name: "footer",
  29742. fn: withCtx(() => [
  29743. renderSlot(_ctx.$slots, "footer")
  29744. ])
  29745. } : void 0
  29746. ]), 1040, ["center", "align-center", "close-icon", "draggable", "overflow", "fullscreen", "show-close", "title", "aria-level", "onClose"])) : createCommentVNode("v-if", true)
  29747. ]),
  29748. _: 3
  29749. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  29750. ], 46, ["aria-label", "aria-labelledby", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
  29751. ]),
  29752. _: 3
  29753. }, 8, ["mask", "overlay-class", "z-index"]), [
  29754. [vShow, unref(visible)]
  29755. ])
  29756. ]),
  29757. _: 3
  29758. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  29759. ]),
  29760. _: 3
  29761. }, 8, ["to", "disabled"]);
  29762. };
  29763. }
  29764. });
  29765. var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$1o, [["__file", "dialog.vue"]]);
  29766. const ElDialog = withInstall(Dialog);
  29767. const dividerProps = buildProps({
  29768. direction: {
  29769. type: String,
  29770. values: ["horizontal", "vertical"],
  29771. default: "horizontal"
  29772. },
  29773. contentPosition: {
  29774. type: String,
  29775. values: ["left", "center", "right"],
  29776. default: "center"
  29777. },
  29778. borderStyle: {
  29779. type: definePropType(String),
  29780. default: "solid"
  29781. }
  29782. });
  29783. const __default__$Z = defineComponent({
  29784. name: "ElDivider"
  29785. });
  29786. const _sfc_main$1n = /* @__PURE__ */ defineComponent({
  29787. ...__default__$Z,
  29788. props: dividerProps,
  29789. setup(__props) {
  29790. const props = __props;
  29791. const ns = useNamespace("divider");
  29792. const dividerStyle = computed(() => {
  29793. return ns.cssVar({
  29794. "border-style": props.borderStyle
  29795. });
  29796. });
  29797. return (_ctx, _cache) => {
  29798. return openBlock(), createElementBlock("div", {
  29799. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.direction)]),
  29800. style: normalizeStyle(unref(dividerStyle)),
  29801. role: "separator"
  29802. }, [
  29803. _ctx.$slots.default && _ctx.direction !== "vertical" ? (openBlock(), createElementBlock("div", {
  29804. key: 0,
  29805. class: normalizeClass([unref(ns).e("text"), unref(ns).is(_ctx.contentPosition)])
  29806. }, [
  29807. renderSlot(_ctx.$slots, "default")
  29808. ], 2)) : createCommentVNode("v-if", true)
  29809. ], 6);
  29810. };
  29811. }
  29812. });
  29813. var Divider = /* @__PURE__ */ _export_sfc(_sfc_main$1n, [["__file", "divider.vue"]]);
  29814. const ElDivider = withInstall(Divider);
  29815. const drawerProps = buildProps({
  29816. ...dialogProps,
  29817. direction: {
  29818. type: String,
  29819. default: "rtl",
  29820. values: ["ltr", "rtl", "ttb", "btt"]
  29821. },
  29822. size: {
  29823. type: [String, Number],
  29824. default: "30%"
  29825. },
  29826. withHeader: {
  29827. type: Boolean,
  29828. default: true
  29829. },
  29830. modalFade: {
  29831. type: Boolean,
  29832. default: true
  29833. },
  29834. headerAriaLevel: {
  29835. type: String,
  29836. default: "2"
  29837. }
  29838. });
  29839. const drawerEmits = dialogEmits;
  29840. const __default__$Y = defineComponent({
  29841. name: "ElDrawer",
  29842. inheritAttrs: false
  29843. });
  29844. const _sfc_main$1m = /* @__PURE__ */ defineComponent({
  29845. ...__default__$Y,
  29846. props: drawerProps,
  29847. emits: drawerEmits,
  29848. setup(__props, { expose }) {
  29849. const props = __props;
  29850. const slots = useSlots();
  29851. useDeprecated({
  29852. scope: "el-drawer",
  29853. from: "the title slot",
  29854. replacement: "the header slot",
  29855. version: "3.0.0",
  29856. ref: "https://element-plus.org/en-US/component/drawer.html#slots"
  29857. }, computed(() => !!slots.title));
  29858. const drawerRef = ref();
  29859. const focusStartRef = ref();
  29860. const ns = useNamespace("drawer");
  29861. const { t } = useLocale();
  29862. const {
  29863. afterEnter,
  29864. afterLeave,
  29865. beforeLeave,
  29866. visible,
  29867. rendered,
  29868. titleId,
  29869. bodyId,
  29870. zIndex,
  29871. onModalClick,
  29872. onOpenAutoFocus,
  29873. onCloseAutoFocus,
  29874. onFocusoutPrevented,
  29875. onCloseRequested,
  29876. handleClose
  29877. } = useDialog(props, drawerRef);
  29878. const isHorizontal = computed(() => props.direction === "rtl" || props.direction === "ltr");
  29879. const drawerSize = computed(() => addUnit(props.size));
  29880. expose({
  29881. handleClose,
  29882. afterEnter,
  29883. afterLeave
  29884. });
  29885. return (_ctx, _cache) => {
  29886. return openBlock(), createBlock(unref(ElTeleport$1), {
  29887. to: _ctx.appendTo,
  29888. disabled: _ctx.appendTo !== "body" ? false : !_ctx.appendToBody
  29889. }, {
  29890. default: withCtx(() => [
  29891. createVNode(Transition, {
  29892. name: unref(ns).b("fade"),
  29893. onAfterEnter: unref(afterEnter),
  29894. onAfterLeave: unref(afterLeave),
  29895. onBeforeLeave: unref(beforeLeave),
  29896. persisted: ""
  29897. }, {
  29898. default: withCtx(() => [
  29899. withDirectives(createVNode(unref(ElOverlay), {
  29900. mask: _ctx.modal,
  29901. "overlay-class": _ctx.modalClass,
  29902. "z-index": unref(zIndex),
  29903. onClick: unref(onModalClick)
  29904. }, {
  29905. default: withCtx(() => [
  29906. createVNode(unref(ElFocusTrap), {
  29907. loop: "",
  29908. trapped: unref(visible),
  29909. "focus-trap-el": drawerRef.value,
  29910. "focus-start-el": focusStartRef.value,
  29911. onFocusAfterTrapped: unref(onOpenAutoFocus),
  29912. onFocusAfterReleased: unref(onCloseAutoFocus),
  29913. onFocusoutPrevented: unref(onFocusoutPrevented),
  29914. onReleaseRequested: unref(onCloseRequested)
  29915. }, {
  29916. default: withCtx(() => [
  29917. createElementVNode("div", mergeProps({
  29918. ref_key: "drawerRef",
  29919. ref: drawerRef,
  29920. "aria-modal": "true",
  29921. "aria-label": _ctx.title || void 0,
  29922. "aria-labelledby": !_ctx.title ? unref(titleId) : void 0,
  29923. "aria-describedby": unref(bodyId)
  29924. }, _ctx.$attrs, {
  29925. class: [unref(ns).b(), _ctx.direction, unref(visible) && "open"],
  29926. style: unref(isHorizontal) ? "width: " + unref(drawerSize) : "height: " + unref(drawerSize),
  29927. role: "dialog",
  29928. onClick: withModifiers(() => {
  29929. }, ["stop"])
  29930. }), [
  29931. createElementVNode("span", {
  29932. ref_key: "focusStartRef",
  29933. ref: focusStartRef,
  29934. class: normalizeClass(unref(ns).e("sr-focus")),
  29935. tabindex: "-1"
  29936. }, null, 2),
  29937. _ctx.withHeader ? (openBlock(), createElementBlock("header", {
  29938. key: 0,
  29939. class: normalizeClass(unref(ns).e("header"))
  29940. }, [
  29941. !_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  29942. key: 0,
  29943. close: unref(handleClose),
  29944. titleId: unref(titleId),
  29945. titleClass: unref(ns).e("title")
  29946. }, () => [
  29947. !_ctx.$slots.title ? (openBlock(), createElementBlock("span", {
  29948. key: 0,
  29949. id: unref(titleId),
  29950. role: "heading",
  29951. "aria-level": _ctx.headerAriaLevel,
  29952. class: normalizeClass(unref(ns).e("title"))
  29953. }, toDisplayString(_ctx.title), 11, ["id", "aria-level"])) : createCommentVNode("v-if", true)
  29954. ]) : renderSlot(_ctx.$slots, "title", { key: 1 }, () => [
  29955. createCommentVNode(" DEPRECATED SLOT ")
  29956. ]),
  29957. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  29958. key: 2,
  29959. "aria-label": unref(t)("el.drawer.close"),
  29960. class: normalizeClass(unref(ns).e("close-btn")),
  29961. type: "button",
  29962. onClick: unref(handleClose)
  29963. }, [
  29964. createVNode(unref(ElIcon), {
  29965. class: normalizeClass(unref(ns).e("close"))
  29966. }, {
  29967. default: withCtx(() => [
  29968. createVNode(unref(close_default))
  29969. ]),
  29970. _: 1
  29971. }, 8, ["class"])
  29972. ], 10, ["aria-label", "onClick"])) : createCommentVNode("v-if", true)
  29973. ], 2)) : createCommentVNode("v-if", true),
  29974. unref(rendered) ? (openBlock(), createElementBlock("div", {
  29975. key: 1,
  29976. id: unref(bodyId),
  29977. class: normalizeClass(unref(ns).e("body"))
  29978. }, [
  29979. renderSlot(_ctx.$slots, "default")
  29980. ], 10, ["id"])) : createCommentVNode("v-if", true),
  29981. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  29982. key: 2,
  29983. class: normalizeClass(unref(ns).e("footer"))
  29984. }, [
  29985. renderSlot(_ctx.$slots, "footer")
  29986. ], 2)) : createCommentVNode("v-if", true)
  29987. ], 16, ["aria-label", "aria-labelledby", "aria-describedby", "onClick"])
  29988. ]),
  29989. _: 3
  29990. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  29991. ]),
  29992. _: 3
  29993. }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
  29994. [vShow, unref(visible)]
  29995. ])
  29996. ]),
  29997. _: 3
  29998. }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  29999. ]),
  30000. _: 3
  30001. }, 8, ["to", "disabled"]);
  30002. };
  30003. }
  30004. });
  30005. var Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$1m, [["__file", "drawer.vue"]]);
  30006. const ElDrawer = withInstall(Drawer);
  30007. const _sfc_main$1l = /* @__PURE__ */ defineComponent({
  30008. inheritAttrs: false
  30009. });
  30010. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  30011. return renderSlot(_ctx.$slots, "default");
  30012. }
  30013. var Collection = /* @__PURE__ */ _export_sfc(_sfc_main$1l, [["render", _sfc_render$n], ["__file", "collection.vue"]]);
  30014. const _sfc_main$1k = /* @__PURE__ */ defineComponent({
  30015. name: "ElCollectionItem",
  30016. inheritAttrs: false
  30017. });
  30018. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  30019. return renderSlot(_ctx.$slots, "default");
  30020. }
  30021. var CollectionItem = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["render", _sfc_render$m], ["__file", "collection-item.vue"]]);
  30022. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  30023. const createCollectionWithScope = (name) => {
  30024. const COLLECTION_NAME = `El${name}Collection`;
  30025. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  30026. const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
  30027. const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
  30028. const ElCollection = {
  30029. ...Collection,
  30030. name: COLLECTION_NAME,
  30031. setup() {
  30032. const collectionRef = ref(null);
  30033. const itemMap = /* @__PURE__ */ new Map();
  30034. const getItems = () => {
  30035. const collectionEl = unref(collectionRef);
  30036. if (!collectionEl)
  30037. return [];
  30038. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  30039. const items = [...itemMap.values()];
  30040. return items.sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
  30041. };
  30042. provide(COLLECTION_INJECTION_KEY, {
  30043. itemMap,
  30044. getItems,
  30045. collectionRef
  30046. });
  30047. }
  30048. };
  30049. const ElCollectionItem = {
  30050. ...CollectionItem,
  30051. name: COLLECTION_ITEM_NAME,
  30052. setup(_, { attrs }) {
  30053. const collectionItemRef = ref(null);
  30054. const collectionInjection = inject(COLLECTION_INJECTION_KEY, void 0);
  30055. provide(COLLECTION_ITEM_INJECTION_KEY, {
  30056. collectionItemRef
  30057. });
  30058. onMounted(() => {
  30059. const collectionItemEl = unref(collectionItemRef);
  30060. if (collectionItemEl) {
  30061. collectionInjection.itemMap.set(collectionItemEl, {
  30062. ref: collectionItemEl,
  30063. ...attrs
  30064. });
  30065. }
  30066. });
  30067. onBeforeUnmount(() => {
  30068. const collectionItemEl = unref(collectionItemRef);
  30069. collectionInjection.itemMap.delete(collectionItemEl);
  30070. });
  30071. }
  30072. };
  30073. return {
  30074. COLLECTION_INJECTION_KEY,
  30075. COLLECTION_ITEM_INJECTION_KEY,
  30076. ElCollection,
  30077. ElCollectionItem
  30078. };
  30079. };
  30080. const rovingFocusGroupProps = buildProps({
  30081. style: { type: definePropType([String, Array, Object]) },
  30082. currentTabId: {
  30083. type: definePropType(String)
  30084. },
  30085. defaultCurrentTabId: String,
  30086. loop: Boolean,
  30087. dir: {
  30088. type: String,
  30089. values: ["ltr", "rtl"],
  30090. default: "ltr"
  30091. },
  30092. orientation: {
  30093. type: definePropType(String)
  30094. },
  30095. onBlur: Function,
  30096. onFocus: Function,
  30097. onMousedown: Function
  30098. });
  30099. const {
  30100. ElCollection: ElCollection$1,
  30101. ElCollectionItem: ElCollectionItem$1,
  30102. COLLECTION_INJECTION_KEY: COLLECTION_INJECTION_KEY$1,
  30103. COLLECTION_ITEM_INJECTION_KEY: COLLECTION_ITEM_INJECTION_KEY$1
  30104. } = createCollectionWithScope("RovingFocusGroup");
  30105. const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
  30106. const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
  30107. const MAP_KEY_TO_FOCUS_INTENT = {
  30108. ArrowLeft: "prev",
  30109. ArrowUp: "prev",
  30110. ArrowRight: "next",
  30111. ArrowDown: "next",
  30112. PageUp: "first",
  30113. Home: "first",
  30114. PageDown: "last",
  30115. End: "last"
  30116. };
  30117. const getDirectionAwareKey = (key, dir) => {
  30118. if (dir !== "rtl")
  30119. return key;
  30120. switch (key) {
  30121. case EVENT_CODE.right:
  30122. return EVENT_CODE.left;
  30123. case EVENT_CODE.left:
  30124. return EVENT_CODE.right;
  30125. default:
  30126. return key;
  30127. }
  30128. };
  30129. const getFocusIntent = (event, orientation, dir) => {
  30130. const key = getDirectionAwareKey(event.code, dir);
  30131. if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key))
  30132. return void 0;
  30133. if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key))
  30134. return void 0;
  30135. return MAP_KEY_TO_FOCUS_INTENT[key];
  30136. };
  30137. const reorderArray = (array, atIdx) => {
  30138. return array.map((_, idx) => array[(idx + atIdx) % array.length]);
  30139. };
  30140. const focusFirst = (elements) => {
  30141. const { activeElement: prevActive } = document;
  30142. for (const element of elements) {
  30143. if (element === prevActive)
  30144. return;
  30145. element.focus();
  30146. if (prevActive !== document.activeElement)
  30147. return;
  30148. }
  30149. };
  30150. const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
  30151. const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
  30152. const EVT_OPTS = { bubbles: false, cancelable: true };
  30153. const _sfc_main$1j = defineComponent({
  30154. name: "ElRovingFocusGroupImpl",
  30155. inheritAttrs: false,
  30156. props: rovingFocusGroupProps,
  30157. emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
  30158. setup(props, { emit }) {
  30159. var _a;
  30160. const currentTabbedId = ref((_a = props.currentTabId || props.defaultCurrentTabId) != null ? _a : null);
  30161. const isBackingOut = ref(false);
  30162. const isClickFocus = ref(false);
  30163. const rovingFocusGroupRef = ref(null);
  30164. const { getItems } = inject(COLLECTION_INJECTION_KEY$1, void 0);
  30165. const rovingFocusGroupRootStyle = computed(() => {
  30166. return [
  30167. {
  30168. outline: "none"
  30169. },
  30170. props.style
  30171. ];
  30172. });
  30173. const onItemFocus = (tabbedId) => {
  30174. emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
  30175. };
  30176. const onItemShiftTab = () => {
  30177. isBackingOut.value = true;
  30178. };
  30179. const onMousedown = composeEventHandlers((e) => {
  30180. var _a2;
  30181. (_a2 = props.onMousedown) == null ? void 0 : _a2.call(props, e);
  30182. }, () => {
  30183. isClickFocus.value = true;
  30184. });
  30185. const onFocus = composeEventHandlers((e) => {
  30186. var _a2;
  30187. (_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
  30188. }, (e) => {
  30189. const isKeyboardFocus = !unref(isClickFocus);
  30190. const { target, currentTarget } = e;
  30191. if (target === currentTarget && isKeyboardFocus && !unref(isBackingOut)) {
  30192. const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
  30193. currentTarget == null ? void 0 : currentTarget.dispatchEvent(entryFocusEvt);
  30194. if (!entryFocusEvt.defaultPrevented) {
  30195. const items = getItems().filter((item) => item.focusable);
  30196. const activeItem = items.find((item) => item.active);
  30197. const currentItem = items.find((item) => item.id === unref(currentTabbedId));
  30198. const candidates = [activeItem, currentItem, ...items].filter(Boolean);
  30199. const candidateNodes = candidates.map((item) => item.ref);
  30200. focusFirst(candidateNodes);
  30201. }
  30202. }
  30203. isClickFocus.value = false;
  30204. });
  30205. const onBlur = composeEventHandlers((e) => {
  30206. var _a2;
  30207. (_a2 = props.onBlur) == null ? void 0 : _a2.call(props, e);
  30208. }, () => {
  30209. isBackingOut.value = false;
  30210. });
  30211. const handleEntryFocus = (...args) => {
  30212. emit("entryFocus", ...args);
  30213. };
  30214. provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
  30215. currentTabbedId: readonly(currentTabbedId),
  30216. loop: toRef(props, "loop"),
  30217. tabIndex: computed(() => {
  30218. return unref(isBackingOut) ? -1 : 0;
  30219. }),
  30220. rovingFocusGroupRef,
  30221. rovingFocusGroupRootStyle,
  30222. orientation: toRef(props, "orientation"),
  30223. dir: toRef(props, "dir"),
  30224. onItemFocus,
  30225. onItemShiftTab,
  30226. onBlur,
  30227. onFocus,
  30228. onMousedown
  30229. });
  30230. watch(() => props.currentTabId, (val) => {
  30231. currentTabbedId.value = val != null ? val : null;
  30232. });
  30233. useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
  30234. }
  30235. });
  30236. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  30237. return renderSlot(_ctx.$slots, "default");
  30238. }
  30239. var ElRovingFocusGroupImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["render", _sfc_render$l], ["__file", "roving-focus-group-impl.vue"]]);
  30240. const _sfc_main$1i = defineComponent({
  30241. name: "ElRovingFocusGroup",
  30242. components: {
  30243. ElFocusGroupCollection: ElCollection$1,
  30244. ElRovingFocusGroupImpl
  30245. }
  30246. });
  30247. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  30248. const _component_el_roving_focus_group_impl = resolveComponent("el-roving-focus-group-impl");
  30249. const _component_el_focus_group_collection = resolveComponent("el-focus-group-collection");
  30250. return openBlock(), createBlock(_component_el_focus_group_collection, null, {
  30251. default: withCtx(() => [
  30252. createVNode(_component_el_roving_focus_group_impl, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
  30253. default: withCtx(() => [
  30254. renderSlot(_ctx.$slots, "default")
  30255. ]),
  30256. _: 3
  30257. }, 16)
  30258. ]),
  30259. _: 3
  30260. });
  30261. }
  30262. var ElRovingFocusGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["render", _sfc_render$k], ["__file", "roving-focus-group.vue"]]);
  30263. const _sfc_main$1h = defineComponent({
  30264. components: {
  30265. ElRovingFocusCollectionItem: ElCollectionItem$1
  30266. },
  30267. props: {
  30268. focusable: {
  30269. type: Boolean,
  30270. default: true
  30271. },
  30272. active: {
  30273. type: Boolean,
  30274. default: false
  30275. }
  30276. },
  30277. emits: ["mousedown", "focus", "keydown"],
  30278. setup(props, { emit }) {
  30279. const { currentTabbedId, loop, onItemFocus, onItemShiftTab } = inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  30280. const { getItems } = inject(COLLECTION_INJECTION_KEY$1, void 0);
  30281. const id = useId();
  30282. const rovingFocusGroupItemRef = ref(null);
  30283. const handleMousedown = composeEventHandlers((e) => {
  30284. emit("mousedown", e);
  30285. }, (e) => {
  30286. if (!props.focusable) {
  30287. e.preventDefault();
  30288. } else {
  30289. onItemFocus(unref(id));
  30290. }
  30291. });
  30292. const handleFocus = composeEventHandlers((e) => {
  30293. emit("focus", e);
  30294. }, () => {
  30295. onItemFocus(unref(id));
  30296. });
  30297. const handleKeydown = composeEventHandlers((e) => {
  30298. emit("keydown", e);
  30299. }, (e) => {
  30300. const { code, shiftKey, target, currentTarget } = e;
  30301. if (code === EVENT_CODE.tab && shiftKey) {
  30302. onItemShiftTab();
  30303. return;
  30304. }
  30305. if (target !== currentTarget)
  30306. return;
  30307. const focusIntent = getFocusIntent(e);
  30308. if (focusIntent) {
  30309. e.preventDefault();
  30310. const items = getItems().filter((item) => item.focusable);
  30311. let elements = items.map((item) => item.ref);
  30312. switch (focusIntent) {
  30313. case "last": {
  30314. elements.reverse();
  30315. break;
  30316. }
  30317. case "prev":
  30318. case "next": {
  30319. if (focusIntent === "prev") {
  30320. elements.reverse();
  30321. }
  30322. const currentIdx = elements.indexOf(currentTarget);
  30323. elements = loop.value ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
  30324. break;
  30325. }
  30326. }
  30327. nextTick(() => {
  30328. focusFirst(elements);
  30329. });
  30330. }
  30331. });
  30332. const isCurrentTab = computed(() => currentTabbedId.value === unref(id));
  30333. provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
  30334. rovingFocusGroupItemRef,
  30335. tabIndex: computed(() => unref(isCurrentTab) ? 0 : -1),
  30336. handleMousedown,
  30337. handleFocus,
  30338. handleKeydown
  30339. });
  30340. return {
  30341. id,
  30342. handleKeydown,
  30343. handleFocus,
  30344. handleMousedown
  30345. };
  30346. }
  30347. });
  30348. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  30349. const _component_el_roving_focus_collection_item = resolveComponent("el-roving-focus-collection-item");
  30350. return openBlock(), createBlock(_component_el_roving_focus_collection_item, {
  30351. id: _ctx.id,
  30352. focusable: _ctx.focusable,
  30353. active: _ctx.active
  30354. }, {
  30355. default: withCtx(() => [
  30356. renderSlot(_ctx.$slots, "default")
  30357. ]),
  30358. _: 3
  30359. }, 8, ["id", "focusable", "active"]);
  30360. }
  30361. var ElRovingFocusItem = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["render", _sfc_render$j], ["__file", "roving-focus-item.vue"]]);
  30362. const dropdownProps = buildProps({
  30363. trigger: useTooltipTriggerProps.trigger,
  30364. triggerKeys: {
  30365. type: definePropType(Array),
  30366. default: () => [
  30367. EVENT_CODE.enter,
  30368. EVENT_CODE.numpadEnter,
  30369. EVENT_CODE.space,
  30370. EVENT_CODE.down
  30371. ]
  30372. },
  30373. effect: {
  30374. ...useTooltipContentProps.effect,
  30375. default: "light"
  30376. },
  30377. type: {
  30378. type: definePropType(String)
  30379. },
  30380. placement: {
  30381. type: definePropType(String),
  30382. default: "bottom"
  30383. },
  30384. popperOptions: {
  30385. type: definePropType(Object),
  30386. default: () => ({})
  30387. },
  30388. id: String,
  30389. size: {
  30390. type: String,
  30391. default: ""
  30392. },
  30393. splitButton: Boolean,
  30394. hideOnClick: {
  30395. type: Boolean,
  30396. default: true
  30397. },
  30398. loop: {
  30399. type: Boolean,
  30400. default: true
  30401. },
  30402. showTimeout: {
  30403. type: Number,
  30404. default: 150
  30405. },
  30406. hideTimeout: {
  30407. type: Number,
  30408. default: 150
  30409. },
  30410. tabindex: {
  30411. type: definePropType([Number, String]),
  30412. default: 0
  30413. },
  30414. maxHeight: {
  30415. type: definePropType([Number, String]),
  30416. default: ""
  30417. },
  30418. popperClass: {
  30419. type: String,
  30420. default: ""
  30421. },
  30422. disabled: Boolean,
  30423. role: {
  30424. type: String,
  30425. default: "menu"
  30426. },
  30427. buttonProps: {
  30428. type: definePropType(Object)
  30429. },
  30430. teleported: useTooltipContentProps.teleported
  30431. });
  30432. const dropdownItemProps = buildProps({
  30433. command: {
  30434. type: [Object, String, Number],
  30435. default: () => ({})
  30436. },
  30437. disabled: Boolean,
  30438. divided: Boolean,
  30439. textValue: String,
  30440. icon: {
  30441. type: iconPropType
  30442. }
  30443. });
  30444. const dropdownMenuProps = buildProps({
  30445. onKeydown: { type: definePropType(Function) }
  30446. });
  30447. const FIRST_KEYS = [
  30448. EVENT_CODE.down,
  30449. EVENT_CODE.pageDown,
  30450. EVENT_CODE.home
  30451. ];
  30452. const LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end];
  30453. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  30454. const {
  30455. ElCollection,
  30456. ElCollectionItem,
  30457. COLLECTION_INJECTION_KEY,
  30458. COLLECTION_ITEM_INJECTION_KEY
  30459. } = createCollectionWithScope("Dropdown");
  30460. const DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
  30461. const { ButtonGroup: ElButtonGroup } = ElButton;
  30462. const _sfc_main$1g = defineComponent({
  30463. name: "ElDropdown",
  30464. components: {
  30465. ElButton,
  30466. ElButtonGroup,
  30467. ElScrollbar,
  30468. ElDropdownCollection: ElCollection,
  30469. ElTooltip,
  30470. ElRovingFocusGroup,
  30471. ElOnlyChild: OnlyChild,
  30472. ElIcon,
  30473. ArrowDown: arrow_down_default
  30474. },
  30475. props: dropdownProps,
  30476. emits: ["visible-change", "click", "command"],
  30477. setup(props, { emit }) {
  30478. const _instance = getCurrentInstance();
  30479. const ns = useNamespace("dropdown");
  30480. const { t } = useLocale();
  30481. const triggeringElementRef = ref();
  30482. const referenceElementRef = ref();
  30483. const popperRef = ref(null);
  30484. const contentRef = ref(null);
  30485. const scrollbar = ref(null);
  30486. const currentTabId = ref(null);
  30487. const isUsingKeyboard = ref(false);
  30488. const wrapStyle = computed(() => ({
  30489. maxHeight: addUnit(props.maxHeight)
  30490. }));
  30491. const dropdownTriggerKls = computed(() => [ns.m(dropdownSize.value)]);
  30492. const trigger = computed(() => castArray$1(props.trigger));
  30493. const defaultTriggerId = useId().value;
  30494. const triggerId = computed(() => props.id || defaultTriggerId);
  30495. watch([triggeringElementRef, trigger], ([triggeringElement, trigger2], [prevTriggeringElement]) => {
  30496. var _a, _b, _c;
  30497. if ((_a = prevTriggeringElement == null ? void 0 : prevTriggeringElement.$el) == null ? void 0 : _a.removeEventListener) {
  30498. prevTriggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30499. }
  30500. if ((_b = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _b.removeEventListener) {
  30501. triggeringElement.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30502. }
  30503. if (((_c = triggeringElement == null ? void 0 : triggeringElement.$el) == null ? void 0 : _c.addEventListener) && trigger2.includes("hover")) {
  30504. triggeringElement.$el.addEventListener("pointerenter", onAutofocusTriggerEnter);
  30505. }
  30506. }, { immediate: true });
  30507. onBeforeUnmount(() => {
  30508. var _a, _b;
  30509. if ((_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.removeEventListener) {
  30510. triggeringElementRef.value.$el.removeEventListener("pointerenter", onAutofocusTriggerEnter);
  30511. }
  30512. });
  30513. function handleClick() {
  30514. handleClose();
  30515. }
  30516. function handleClose() {
  30517. var _a;
  30518. (_a = popperRef.value) == null ? void 0 : _a.onClose();
  30519. }
  30520. function handleOpen() {
  30521. var _a;
  30522. (_a = popperRef.value) == null ? void 0 : _a.onOpen();
  30523. }
  30524. const dropdownSize = useFormSize();
  30525. function commandHandler(...args) {
  30526. emit("command", ...args);
  30527. }
  30528. function onAutofocusTriggerEnter() {
  30529. var _a, _b;
  30530. (_b = (_a = triggeringElementRef.value) == null ? void 0 : _a.$el) == null ? void 0 : _b.focus();
  30531. }
  30532. function onItemEnter() {
  30533. }
  30534. function onItemLeave() {
  30535. const contentEl = unref(contentRef);
  30536. trigger.value.includes("hover") && (contentEl == null ? void 0 : contentEl.focus());
  30537. currentTabId.value = null;
  30538. }
  30539. function handleCurrentTabIdChange(id) {
  30540. currentTabId.value = id;
  30541. }
  30542. function handleEntryFocus(e) {
  30543. if (!isUsingKeyboard.value) {
  30544. e.preventDefault();
  30545. e.stopImmediatePropagation();
  30546. }
  30547. }
  30548. function handleBeforeShowTooltip() {
  30549. emit("visible-change", true);
  30550. }
  30551. function handleShowTooltip(event) {
  30552. if ((event == null ? void 0 : event.type) === "keydown") {
  30553. contentRef.value.focus();
  30554. }
  30555. }
  30556. function handleBeforeHideTooltip() {
  30557. emit("visible-change", false);
  30558. }
  30559. provide(DROPDOWN_INJECTION_KEY, {
  30560. contentRef,
  30561. role: computed(() => props.role),
  30562. triggerId,
  30563. isUsingKeyboard,
  30564. onItemEnter,
  30565. onItemLeave
  30566. });
  30567. provide("elDropdown", {
  30568. instance: _instance,
  30569. dropdownSize,
  30570. handleClick,
  30571. commandHandler,
  30572. trigger: toRef(props, "trigger"),
  30573. hideOnClick: toRef(props, "hideOnClick")
  30574. });
  30575. const onFocusAfterTrapped = (e) => {
  30576. var _a, _b;
  30577. e.preventDefault();
  30578. (_b = (_a = contentRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a, {
  30579. preventScroll: true
  30580. });
  30581. };
  30582. const handlerMainButtonClick = (event) => {
  30583. emit("click", event);
  30584. };
  30585. return {
  30586. t,
  30587. ns,
  30588. scrollbar,
  30589. wrapStyle,
  30590. dropdownTriggerKls,
  30591. dropdownSize,
  30592. triggerId,
  30593. currentTabId,
  30594. handleCurrentTabIdChange,
  30595. handlerMainButtonClick,
  30596. handleEntryFocus,
  30597. handleClose,
  30598. handleOpen,
  30599. handleBeforeShowTooltip,
  30600. handleShowTooltip,
  30601. handleBeforeHideTooltip,
  30602. onFocusAfterTrapped,
  30603. popperRef,
  30604. contentRef,
  30605. triggeringElementRef,
  30606. referenceElementRef
  30607. };
  30608. }
  30609. });
  30610. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  30611. var _a;
  30612. const _component_el_dropdown_collection = resolveComponent("el-dropdown-collection");
  30613. const _component_el_roving_focus_group = resolveComponent("el-roving-focus-group");
  30614. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  30615. const _component_el_only_child = resolveComponent("el-only-child");
  30616. const _component_el_tooltip = resolveComponent("el-tooltip");
  30617. const _component_el_button = resolveComponent("el-button");
  30618. const _component_arrow_down = resolveComponent("arrow-down");
  30619. const _component_el_icon = resolveComponent("el-icon");
  30620. const _component_el_button_group = resolveComponent("el-button-group");
  30621. return openBlock(), createElementBlock("div", {
  30622. class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)])
  30623. }, [
  30624. createVNode(_component_el_tooltip, {
  30625. ref: "popperRef",
  30626. role: _ctx.role,
  30627. effect: _ctx.effect,
  30628. "fallback-placements": ["bottom", "top"],
  30629. "popper-options": _ctx.popperOptions,
  30630. "gpu-acceleration": false,
  30631. "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
  30632. "manual-mode": true,
  30633. placement: _ctx.placement,
  30634. "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
  30635. "reference-element": (_a = _ctx.referenceElementRef) == null ? void 0 : _a.$el,
  30636. trigger: _ctx.trigger,
  30637. "trigger-keys": _ctx.triggerKeys,
  30638. "trigger-target-el": _ctx.contentRef,
  30639. "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
  30640. "stop-popper-mouse-event": false,
  30641. "virtual-ref": _ctx.triggeringElementRef,
  30642. "virtual-triggering": _ctx.splitButton,
  30643. disabled: _ctx.disabled,
  30644. transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
  30645. teleported: _ctx.teleported,
  30646. pure: "",
  30647. persistent: "",
  30648. onBeforeShow: _ctx.handleBeforeShowTooltip,
  30649. onShow: _ctx.handleShowTooltip,
  30650. onBeforeHide: _ctx.handleBeforeHideTooltip
  30651. }, createSlots({
  30652. content: withCtx(() => [
  30653. createVNode(_component_el_scrollbar, {
  30654. ref: "scrollbar",
  30655. "wrap-style": _ctx.wrapStyle,
  30656. tag: "div",
  30657. "view-class": _ctx.ns.e("list")
  30658. }, {
  30659. default: withCtx(() => [
  30660. createVNode(_component_el_roving_focus_group, {
  30661. loop: _ctx.loop,
  30662. "current-tab-id": _ctx.currentTabId,
  30663. orientation: "horizontal",
  30664. onCurrentTabIdChange: _ctx.handleCurrentTabIdChange,
  30665. onEntryFocus: _ctx.handleEntryFocus
  30666. }, {
  30667. default: withCtx(() => [
  30668. createVNode(_component_el_dropdown_collection, null, {
  30669. default: withCtx(() => [
  30670. renderSlot(_ctx.$slots, "dropdown")
  30671. ]),
  30672. _: 3
  30673. })
  30674. ]),
  30675. _: 3
  30676. }, 8, ["loop", "current-tab-id", "onCurrentTabIdChange", "onEntryFocus"])
  30677. ]),
  30678. _: 3
  30679. }, 8, ["wrap-style", "view-class"])
  30680. ]),
  30681. _: 2
  30682. }, [
  30683. !_ctx.splitButton ? {
  30684. name: "default",
  30685. fn: withCtx(() => [
  30686. createVNode(_component_el_only_child, {
  30687. id: _ctx.triggerId,
  30688. ref: "triggeringElementRef",
  30689. role: "button",
  30690. tabindex: _ctx.tabindex
  30691. }, {
  30692. default: withCtx(() => [
  30693. renderSlot(_ctx.$slots, "default")
  30694. ]),
  30695. _: 3
  30696. }, 8, ["id", "tabindex"])
  30697. ])
  30698. } : void 0
  30699. ]), 1032, ["role", "effect", "popper-options", "hide-after", "placement", "popper-class", "reference-element", "trigger", "trigger-keys", "trigger-target-el", "show-after", "virtual-ref", "virtual-triggering", "disabled", "transition", "teleported", "onBeforeShow", "onShow", "onBeforeHide"]),
  30700. _ctx.splitButton ? (openBlock(), createBlock(_component_el_button_group, { key: 0 }, {
  30701. default: withCtx(() => [
  30702. createVNode(_component_el_button, mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
  30703. size: _ctx.dropdownSize,
  30704. type: _ctx.type,
  30705. disabled: _ctx.disabled,
  30706. tabindex: _ctx.tabindex,
  30707. onClick: _ctx.handlerMainButtonClick
  30708. }), {
  30709. default: withCtx(() => [
  30710. renderSlot(_ctx.$slots, "default")
  30711. ]),
  30712. _: 3
  30713. }, 16, ["size", "type", "disabled", "tabindex", "onClick"]),
  30714. createVNode(_component_el_button, mergeProps({
  30715. id: _ctx.triggerId,
  30716. ref: "triggeringElementRef"
  30717. }, _ctx.buttonProps, {
  30718. role: "button",
  30719. size: _ctx.dropdownSize,
  30720. type: _ctx.type,
  30721. class: _ctx.ns.e("caret-button"),
  30722. disabled: _ctx.disabled,
  30723. tabindex: _ctx.tabindex,
  30724. "aria-label": _ctx.t("el.dropdown.toggleDropdown")
  30725. }), {
  30726. default: withCtx(() => [
  30727. createVNode(_component_el_icon, {
  30728. class: normalizeClass(_ctx.ns.e("icon"))
  30729. }, {
  30730. default: withCtx(() => [
  30731. createVNode(_component_arrow_down)
  30732. ]),
  30733. _: 1
  30734. }, 8, ["class"])
  30735. ]),
  30736. _: 1
  30737. }, 16, ["id", "size", "type", "class", "disabled", "tabindex", "aria-label"])
  30738. ]),
  30739. _: 3
  30740. })) : createCommentVNode("v-if", true)
  30741. ], 2);
  30742. }
  30743. var Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["render", _sfc_render$i], ["__file", "dropdown.vue"]]);
  30744. const _sfc_main$1f = defineComponent({
  30745. name: "DropdownItemImpl",
  30746. components: {
  30747. ElIcon
  30748. },
  30749. props: dropdownItemProps,
  30750. emits: ["pointermove", "pointerleave", "click", "clickimpl"],
  30751. setup(_, { emit }) {
  30752. const ns = useNamespace("dropdown");
  30753. const { role: menuRole } = inject(DROPDOWN_INJECTION_KEY, void 0);
  30754. const { collectionItemRef: dropdownCollectionItemRef } = inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
  30755. const { collectionItemRef: rovingFocusCollectionItemRef } = inject(COLLECTION_ITEM_INJECTION_KEY$1, void 0);
  30756. const {
  30757. rovingFocusGroupItemRef,
  30758. tabIndex,
  30759. handleFocus,
  30760. handleKeydown: handleItemKeydown,
  30761. handleMousedown
  30762. } = inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
  30763. const itemRef = composeRefs(dropdownCollectionItemRef, rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
  30764. const role = computed(() => {
  30765. if (menuRole.value === "menu") {
  30766. return "menuitem";
  30767. } else if (menuRole.value === "navigation") {
  30768. return "link";
  30769. }
  30770. return "button";
  30771. });
  30772. const handleKeydown = composeEventHandlers((e) => {
  30773. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(e.code)) {
  30774. e.preventDefault();
  30775. e.stopImmediatePropagation();
  30776. emit("clickimpl", e);
  30777. return true;
  30778. }
  30779. }, handleItemKeydown);
  30780. return {
  30781. ns,
  30782. itemRef,
  30783. dataset: {
  30784. [COLLECTION_ITEM_SIGN]: ""
  30785. },
  30786. role,
  30787. tabIndex,
  30788. handleFocus,
  30789. handleKeydown,
  30790. handleMousedown
  30791. };
  30792. }
  30793. });
  30794. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  30795. const _component_el_icon = resolveComponent("el-icon");
  30796. return openBlock(), createElementBlock(Fragment, null, [
  30797. _ctx.divided ? (openBlock(), createElementBlock("li", {
  30798. key: 0,
  30799. role: "separator",
  30800. class: normalizeClass(_ctx.ns.bem("menu", "item", "divided"))
  30801. }, null, 2)) : createCommentVNode("v-if", true),
  30802. createElementVNode("li", mergeProps({ ref: _ctx.itemRef }, { ..._ctx.dataset, ..._ctx.$attrs }, {
  30803. "aria-disabled": _ctx.disabled,
  30804. class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
  30805. tabindex: _ctx.tabIndex,
  30806. role: _ctx.role,
  30807. onClick: (e) => _ctx.$emit("clickimpl", e),
  30808. onFocus: _ctx.handleFocus,
  30809. onKeydown: withModifiers(_ctx.handleKeydown, ["self"]),
  30810. onMousedown: _ctx.handleMousedown,
  30811. onPointermove: (e) => _ctx.$emit("pointermove", e),
  30812. onPointerleave: (e) => _ctx.$emit("pointerleave", e)
  30813. }), [
  30814. _ctx.icon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  30815. default: withCtx(() => [
  30816. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  30817. ]),
  30818. _: 1
  30819. })) : createCommentVNode("v-if", true),
  30820. renderSlot(_ctx.$slots, "default")
  30821. ], 16, ["aria-disabled", "tabindex", "role", "onClick", "onFocus", "onKeydown", "onMousedown", "onPointermove", "onPointerleave"])
  30822. ], 64);
  30823. }
  30824. var ElDropdownItemImpl = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["render", _sfc_render$h], ["__file", "dropdown-item-impl.vue"]]);
  30825. const useDropdown = () => {
  30826. const elDropdown = inject("elDropdown", {});
  30827. const _elDropdownSize = computed(() => elDropdown == null ? void 0 : elDropdown.dropdownSize);
  30828. return {
  30829. elDropdown,
  30830. _elDropdownSize
  30831. };
  30832. };
  30833. const _sfc_main$1e = defineComponent({
  30834. name: "ElDropdownItem",
  30835. components: {
  30836. ElDropdownCollectionItem: ElCollectionItem,
  30837. ElRovingFocusItem,
  30838. ElDropdownItemImpl
  30839. },
  30840. inheritAttrs: false,
  30841. props: dropdownItemProps,
  30842. emits: ["pointermove", "pointerleave", "click"],
  30843. setup(props, { emit, attrs }) {
  30844. const { elDropdown } = useDropdown();
  30845. const _instance = getCurrentInstance();
  30846. const itemRef = ref(null);
  30847. const textContent = computed(() => {
  30848. var _a, _b;
  30849. return (_b = (_a = unref(itemRef)) == null ? void 0 : _a.textContent) != null ? _b : "";
  30850. });
  30851. const { onItemEnter, onItemLeave } = inject(DROPDOWN_INJECTION_KEY, void 0);
  30852. const handlePointerMove = composeEventHandlers((e) => {
  30853. emit("pointermove", e);
  30854. return e.defaultPrevented;
  30855. }, whenMouse((e) => {
  30856. if (props.disabled) {
  30857. onItemLeave(e);
  30858. return;
  30859. }
  30860. const target = e.currentTarget;
  30861. if (target === document.activeElement || target.contains(document.activeElement)) {
  30862. return;
  30863. }
  30864. onItemEnter(e);
  30865. if (!e.defaultPrevented) {
  30866. target == null ? void 0 : target.focus();
  30867. }
  30868. }));
  30869. const handlePointerLeave = composeEventHandlers((e) => {
  30870. emit("pointerleave", e);
  30871. return e.defaultPrevented;
  30872. }, whenMouse(onItemLeave));
  30873. const handleClick = composeEventHandlers((e) => {
  30874. if (props.disabled) {
  30875. return;
  30876. }
  30877. emit("click", e);
  30878. return e.type !== "keydown" && e.defaultPrevented;
  30879. }, (e) => {
  30880. var _a, _b, _c;
  30881. if (props.disabled) {
  30882. e.stopImmediatePropagation();
  30883. return;
  30884. }
  30885. if ((_a = elDropdown == null ? void 0 : elDropdown.hideOnClick) == null ? void 0 : _a.value) {
  30886. (_b = elDropdown.handleClick) == null ? void 0 : _b.call(elDropdown);
  30887. }
  30888. (_c = elDropdown.commandHandler) == null ? void 0 : _c.call(elDropdown, props.command, _instance, e);
  30889. });
  30890. const propsAndAttrs = computed(() => ({ ...props, ...attrs }));
  30891. return {
  30892. handleClick,
  30893. handlePointerMove,
  30894. handlePointerLeave,
  30895. textContent,
  30896. propsAndAttrs
  30897. };
  30898. }
  30899. });
  30900. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  30901. var _a;
  30902. const _component_el_dropdown_item_impl = resolveComponent("el-dropdown-item-impl");
  30903. const _component_el_roving_focus_item = resolveComponent("el-roving-focus-item");
  30904. const _component_el_dropdown_collection_item = resolveComponent("el-dropdown-collection-item");
  30905. return openBlock(), createBlock(_component_el_dropdown_collection_item, {
  30906. disabled: _ctx.disabled,
  30907. "text-value": (_a = _ctx.textValue) != null ? _a : _ctx.textContent
  30908. }, {
  30909. default: withCtx(() => [
  30910. createVNode(_component_el_roving_focus_item, {
  30911. focusable: !_ctx.disabled
  30912. }, {
  30913. default: withCtx(() => [
  30914. createVNode(_component_el_dropdown_item_impl, mergeProps(_ctx.propsAndAttrs, {
  30915. onPointerleave: _ctx.handlePointerLeave,
  30916. onPointermove: _ctx.handlePointerMove,
  30917. onClickimpl: _ctx.handleClick
  30918. }), {
  30919. default: withCtx(() => [
  30920. renderSlot(_ctx.$slots, "default")
  30921. ]),
  30922. _: 3
  30923. }, 16, ["onPointerleave", "onPointermove", "onClickimpl"])
  30924. ]),
  30925. _: 3
  30926. }, 8, ["focusable"])
  30927. ]),
  30928. _: 3
  30929. }, 8, ["disabled", "text-value"]);
  30930. }
  30931. var DropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["render", _sfc_render$g], ["__file", "dropdown-item.vue"]]);
  30932. const _sfc_main$1d = defineComponent({
  30933. name: "ElDropdownMenu",
  30934. props: dropdownMenuProps,
  30935. setup(props) {
  30936. const ns = useNamespace("dropdown");
  30937. const { _elDropdownSize } = useDropdown();
  30938. const size = _elDropdownSize.value;
  30939. const { focusTrapRef, onKeydown } = inject(FOCUS_TRAP_INJECTION_KEY, void 0);
  30940. const { contentRef, role, triggerId } = inject(DROPDOWN_INJECTION_KEY, void 0);
  30941. const { collectionRef: dropdownCollectionRef, getItems } = inject(COLLECTION_INJECTION_KEY, void 0);
  30942. const {
  30943. rovingFocusGroupRef,
  30944. rovingFocusGroupRootStyle,
  30945. tabIndex,
  30946. onBlur,
  30947. onFocus,
  30948. onMousedown
  30949. } = inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  30950. const { collectionRef: rovingFocusGroupCollectionRef } = inject(COLLECTION_INJECTION_KEY$1, void 0);
  30951. const dropdownKls = computed(() => {
  30952. return [ns.b("menu"), ns.bm("menu", size == null ? void 0 : size.value)];
  30953. });
  30954. const dropdownListWrapperRef = composeRefs(contentRef, dropdownCollectionRef, focusTrapRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
  30955. const composedKeydown = composeEventHandlers((e) => {
  30956. var _a;
  30957. (_a = props.onKeydown) == null ? void 0 : _a.call(props, e);
  30958. }, (e) => {
  30959. const { currentTarget, code, target } = e;
  30960. currentTarget.contains(target);
  30961. if (EVENT_CODE.tab === code) {
  30962. e.stopImmediatePropagation();
  30963. }
  30964. e.preventDefault();
  30965. if (target !== unref(contentRef) || !FIRST_LAST_KEYS.includes(code))
  30966. return;
  30967. const items = getItems().filter((item) => !item.disabled);
  30968. const targets = items.map((item) => item.ref);
  30969. if (LAST_KEYS.includes(code)) {
  30970. targets.reverse();
  30971. }
  30972. focusFirst(targets);
  30973. });
  30974. const handleKeydown = (e) => {
  30975. composedKeydown(e);
  30976. onKeydown(e);
  30977. };
  30978. return {
  30979. size,
  30980. rovingFocusGroupRootStyle,
  30981. tabIndex,
  30982. dropdownKls,
  30983. role,
  30984. triggerId,
  30985. dropdownListWrapperRef,
  30986. handleKeydown,
  30987. onBlur,
  30988. onFocus,
  30989. onMousedown
  30990. };
  30991. }
  30992. });
  30993. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  30994. return openBlock(), createElementBlock("ul", {
  30995. ref: _ctx.dropdownListWrapperRef,
  30996. class: normalizeClass(_ctx.dropdownKls),
  30997. style: normalizeStyle(_ctx.rovingFocusGroupRootStyle),
  30998. tabindex: -1,
  30999. role: _ctx.role,
  31000. "aria-labelledby": _ctx.triggerId,
  31001. onBlur: _ctx.onBlur,
  31002. onFocus: _ctx.onFocus,
  31003. onKeydown: withModifiers(_ctx.handleKeydown, ["self"]),
  31004. onMousedown: withModifiers(_ctx.onMousedown, ["self"])
  31005. }, [
  31006. renderSlot(_ctx.$slots, "default")
  31007. ], 46, ["role", "aria-labelledby", "onBlur", "onFocus", "onKeydown", "onMousedown"]);
  31008. }
  31009. var DropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["render", _sfc_render$f], ["__file", "dropdown-menu.vue"]]);
  31010. const ElDropdown = withInstall(Dropdown, {
  31011. DropdownItem,
  31012. DropdownMenu
  31013. });
  31014. const ElDropdownItem = withNoopInstall(DropdownItem);
  31015. const ElDropdownMenu = withNoopInstall(DropdownMenu);
  31016. const __default__$X = defineComponent({
  31017. name: "ImgEmpty"
  31018. });
  31019. const _sfc_main$1c = /* @__PURE__ */ defineComponent({
  31020. ...__default__$X,
  31021. setup(__props) {
  31022. const ns = useNamespace("empty");
  31023. const id = useId();
  31024. return (_ctx, _cache) => {
  31025. return openBlock(), createElementBlock("svg", {
  31026. viewBox: "0 0 79 86",
  31027. version: "1.1",
  31028. xmlns: "http://www.w3.org/2000/svg",
  31029. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  31030. }, [
  31031. createElementVNode("defs", null, [
  31032. createElementVNode("linearGradient", {
  31033. id: `linearGradient-1-${unref(id)}`,
  31034. x1: "38.8503086%",
  31035. y1: "0%",
  31036. x2: "61.1496914%",
  31037. y2: "100%"
  31038. }, [
  31039. createElementVNode("stop", {
  31040. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-1")})`,
  31041. offset: "0%"
  31042. }, null, 8, ["stop-color"]),
  31043. createElementVNode("stop", {
  31044. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-4")})`,
  31045. offset: "100%"
  31046. }, null, 8, ["stop-color"])
  31047. ], 8, ["id"]),
  31048. createElementVNode("linearGradient", {
  31049. id: `linearGradient-2-${unref(id)}`,
  31050. x1: "0%",
  31051. y1: "9.5%",
  31052. x2: "100%",
  31053. y2: "90.5%"
  31054. }, [
  31055. createElementVNode("stop", {
  31056. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-1")})`,
  31057. offset: "0%"
  31058. }, null, 8, ["stop-color"]),
  31059. createElementVNode("stop", {
  31060. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-6")})`,
  31061. offset: "100%"
  31062. }, null, 8, ["stop-color"])
  31063. ], 8, ["id"]),
  31064. createElementVNode("rect", {
  31065. id: `path-3-${unref(id)}`,
  31066. x: "0",
  31067. y: "0",
  31068. width: "17",
  31069. height: "36"
  31070. }, null, 8, ["id"])
  31071. ]),
  31072. createElementVNode("g", {
  31073. id: "Illustrations",
  31074. stroke: "none",
  31075. "stroke-width": "1",
  31076. fill: "none",
  31077. "fill-rule": "evenodd"
  31078. }, [
  31079. createElementVNode("g", {
  31080. id: "B-type",
  31081. transform: "translate(-1268.000000, -535.000000)"
  31082. }, [
  31083. createElementVNode("g", {
  31084. id: "Group-2",
  31085. transform: "translate(1268.000000, 535.000000)"
  31086. }, [
  31087. createElementVNode("path", {
  31088. id: "Oval-Copy-2",
  31089. 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",
  31090. fill: `var(${unref(ns).cssVarBlockName("fill-color-3")})`
  31091. }, null, 8, ["fill"]),
  31092. createElementVNode("polygon", {
  31093. id: "Rectangle-Copy-14",
  31094. fill: `var(${unref(ns).cssVarBlockName("fill-color-7")})`,
  31095. transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",
  31096. points: "13 58 53 58 42 45 2 45"
  31097. }, null, 8, ["fill"]),
  31098. createElementVNode("g", {
  31099. id: "Group-Copy",
  31100. transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)"
  31101. }, [
  31102. createElementVNode("polygon", {
  31103. id: "Rectangle-Copy-10",
  31104. fill: `var(${unref(ns).cssVarBlockName("fill-color-7")})`,
  31105. transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",
  31106. points: "2.84078316e-14 3 18 3 23 7 5 7"
  31107. }, null, 8, ["fill"]),
  31108. createElementVNode("polygon", {
  31109. id: "Rectangle-Copy-11",
  31110. fill: `var(${unref(ns).cssVarBlockName("fill-color-5")})`,
  31111. points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"
  31112. }, null, 8, ["fill"]),
  31113. createElementVNode("rect", {
  31114. id: "Rectangle-Copy-12",
  31115. fill: `url(#linearGradient-1-${unref(id)})`,
  31116. transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",
  31117. x: "38",
  31118. y: "7",
  31119. width: "17",
  31120. height: "36"
  31121. }, null, 8, ["fill"]),
  31122. createElementVNode("polygon", {
  31123. id: "Rectangle-Copy-13",
  31124. fill: `var(${unref(ns).cssVarBlockName("fill-color-2")})`,
  31125. transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",
  31126. points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"
  31127. }, null, 8, ["fill"])
  31128. ]),
  31129. createElementVNode("rect", {
  31130. id: "Rectangle-Copy-15",
  31131. fill: `url(#linearGradient-2-${unref(id)})`,
  31132. x: "13",
  31133. y: "45",
  31134. width: "40",
  31135. height: "36"
  31136. }, null, 8, ["fill"]),
  31137. createElementVNode("g", {
  31138. id: "Rectangle-Copy-17",
  31139. transform: "translate(53.000000, 45.000000)"
  31140. }, [
  31141. createElementVNode("use", {
  31142. id: "Mask",
  31143. fill: `var(${unref(ns).cssVarBlockName("fill-color-8")})`,
  31144. transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",
  31145. "xlink:href": `#path-3-${unref(id)}`
  31146. }, null, 8, ["fill", "xlink:href"]),
  31147. createElementVNode("polygon", {
  31148. id: "Rectangle-Copy",
  31149. fill: `var(${unref(ns).cssVarBlockName("fill-color-9")})`,
  31150. mask: `url(#mask-4-${unref(id)})`,
  31151. transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",
  31152. points: "7 0 24 0 20 18 7 16.5"
  31153. }, null, 8, ["fill", "mask"])
  31154. ]),
  31155. createElementVNode("polygon", {
  31156. id: "Rectangle-Copy-18",
  31157. fill: `var(${unref(ns).cssVarBlockName("fill-color-2")})`,
  31158. transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",
  31159. points: "62 45 79 45 70 58 53 58"
  31160. }, null, 8, ["fill"])
  31161. ])
  31162. ])
  31163. ])
  31164. ]);
  31165. };
  31166. }
  31167. });
  31168. var ImgEmpty = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["__file", "img-empty.vue"]]);
  31169. const emptyProps = buildProps({
  31170. image: {
  31171. type: String,
  31172. default: ""
  31173. },
  31174. imageSize: Number,
  31175. description: {
  31176. type: String,
  31177. default: ""
  31178. }
  31179. });
  31180. const __default__$W = defineComponent({
  31181. name: "ElEmpty"
  31182. });
  31183. const _sfc_main$1b = /* @__PURE__ */ defineComponent({
  31184. ...__default__$W,
  31185. props: emptyProps,
  31186. setup(__props) {
  31187. const props = __props;
  31188. const { t } = useLocale();
  31189. const ns = useNamespace("empty");
  31190. const emptyDescription = computed(() => props.description || t("el.table.emptyText"));
  31191. const imageStyle = computed(() => ({
  31192. width: addUnit(props.imageSize)
  31193. }));
  31194. return (_ctx, _cache) => {
  31195. return openBlock(), createElementBlock("div", {
  31196. class: normalizeClass(unref(ns).b())
  31197. }, [
  31198. createElementVNode("div", {
  31199. class: normalizeClass(unref(ns).e("image")),
  31200. style: normalizeStyle(unref(imageStyle))
  31201. }, [
  31202. _ctx.image ? (openBlock(), createElementBlock("img", {
  31203. key: 0,
  31204. src: _ctx.image,
  31205. ondragstart: "return false"
  31206. }, null, 8, ["src"])) : renderSlot(_ctx.$slots, "image", { key: 1 }, () => [
  31207. createVNode(ImgEmpty)
  31208. ])
  31209. ], 6),
  31210. createElementVNode("div", {
  31211. class: normalizeClass(unref(ns).e("description"))
  31212. }, [
  31213. _ctx.$slots.description ? renderSlot(_ctx.$slots, "description", { key: 0 }) : (openBlock(), createElementBlock("p", { key: 1 }, toDisplayString(unref(emptyDescription)), 1))
  31214. ], 2),
  31215. _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
  31216. key: 0,
  31217. class: normalizeClass(unref(ns).e("bottom"))
  31218. }, [
  31219. renderSlot(_ctx.$slots, "default")
  31220. ], 2)) : createCommentVNode("v-if", true)
  31221. ], 2);
  31222. };
  31223. }
  31224. });
  31225. var Empty = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["__file", "empty.vue"]]);
  31226. const ElEmpty = withInstall(Empty);
  31227. const imageViewerProps = buildProps({
  31228. urlList: {
  31229. type: definePropType(Array),
  31230. default: () => mutable([])
  31231. },
  31232. zIndex: {
  31233. type: Number
  31234. },
  31235. initialIndex: {
  31236. type: Number,
  31237. default: 0
  31238. },
  31239. infinite: {
  31240. type: Boolean,
  31241. default: true
  31242. },
  31243. hideOnClickModal: Boolean,
  31244. teleported: Boolean,
  31245. closeOnPressEscape: {
  31246. type: Boolean,
  31247. default: true
  31248. },
  31249. zoomRate: {
  31250. type: Number,
  31251. default: 1.2
  31252. },
  31253. minScale: {
  31254. type: Number,
  31255. default: 0.2
  31256. },
  31257. maxScale: {
  31258. type: Number,
  31259. default: 7
  31260. },
  31261. crossorigin: {
  31262. type: definePropType(String)
  31263. }
  31264. });
  31265. const imageViewerEmits = {
  31266. close: () => true,
  31267. switch: (index) => isNumber(index),
  31268. rotate: (deg) => isNumber(deg)
  31269. };
  31270. const __default__$V = defineComponent({
  31271. name: "ElImageViewer"
  31272. });
  31273. const _sfc_main$1a = /* @__PURE__ */ defineComponent({
  31274. ...__default__$V,
  31275. props: imageViewerProps,
  31276. emits: imageViewerEmits,
  31277. setup(__props, { expose, emit }) {
  31278. var _a;
  31279. const props = __props;
  31280. const modes = {
  31281. CONTAIN: {
  31282. name: "contain",
  31283. icon: markRaw(full_screen_default)
  31284. },
  31285. ORIGINAL: {
  31286. name: "original",
  31287. icon: markRaw(scale_to_original_default)
  31288. }
  31289. };
  31290. const { t } = useLocale();
  31291. const ns = useNamespace("image-viewer");
  31292. const { nextZIndex } = useZIndex();
  31293. const wrapper = ref();
  31294. const imgRefs = ref([]);
  31295. const scopeEventListener = effectScope();
  31296. const loading = ref(true);
  31297. const activeIndex = ref(props.initialIndex);
  31298. const mode = shallowRef(modes.CONTAIN);
  31299. const transform = ref({
  31300. scale: 1,
  31301. deg: 0,
  31302. offsetX: 0,
  31303. offsetY: 0,
  31304. enableTransition: false
  31305. });
  31306. const zIndex = ref((_a = props.zIndex) != null ? _a : nextZIndex());
  31307. const isSingle = computed(() => {
  31308. const { urlList } = props;
  31309. return urlList.length <= 1;
  31310. });
  31311. const isFirst = computed(() => {
  31312. return activeIndex.value === 0;
  31313. });
  31314. const isLast = computed(() => {
  31315. return activeIndex.value === props.urlList.length - 1;
  31316. });
  31317. const currentImg = computed(() => {
  31318. return props.urlList[activeIndex.value];
  31319. });
  31320. const arrowPrevKls = computed(() => [
  31321. ns.e("btn"),
  31322. ns.e("prev"),
  31323. ns.is("disabled", !props.infinite && isFirst.value)
  31324. ]);
  31325. const arrowNextKls = computed(() => [
  31326. ns.e("btn"),
  31327. ns.e("next"),
  31328. ns.is("disabled", !props.infinite && isLast.value)
  31329. ]);
  31330. const imgStyle = computed(() => {
  31331. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  31332. let translateX = offsetX / scale;
  31333. let translateY = offsetY / scale;
  31334. const radian = deg * Math.PI / 180;
  31335. const cosRadian = Math.cos(radian);
  31336. const sinRadian = Math.sin(radian);
  31337. translateX = translateX * cosRadian + translateY * sinRadian;
  31338. translateY = translateY * cosRadian - offsetX / scale * sinRadian;
  31339. const style = {
  31340. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  31341. transition: enableTransition ? "transform .3s" : ""
  31342. };
  31343. if (mode.value.name === modes.CONTAIN.name) {
  31344. style.maxWidth = style.maxHeight = "100%";
  31345. }
  31346. return style;
  31347. });
  31348. function hide() {
  31349. unregisterEventListener();
  31350. emit("close");
  31351. }
  31352. function registerEventListener() {
  31353. const keydownHandler = throttle((e) => {
  31354. switch (e.code) {
  31355. case EVENT_CODE.esc:
  31356. props.closeOnPressEscape && hide();
  31357. break;
  31358. case EVENT_CODE.space:
  31359. toggleMode();
  31360. break;
  31361. case EVENT_CODE.left:
  31362. prev();
  31363. break;
  31364. case EVENT_CODE.up:
  31365. handleActions("zoomIn");
  31366. break;
  31367. case EVENT_CODE.right:
  31368. next();
  31369. break;
  31370. case EVENT_CODE.down:
  31371. handleActions("zoomOut");
  31372. break;
  31373. }
  31374. });
  31375. const mousewheelHandler = throttle((e) => {
  31376. const delta = e.deltaY || e.deltaX;
  31377. handleActions(delta < 0 ? "zoomIn" : "zoomOut", {
  31378. zoomRate: props.zoomRate,
  31379. enableTransition: false
  31380. });
  31381. });
  31382. scopeEventListener.run(() => {
  31383. useEventListener(document, "keydown", keydownHandler);
  31384. useEventListener(document, "wheel", mousewheelHandler);
  31385. });
  31386. }
  31387. function unregisterEventListener() {
  31388. scopeEventListener.stop();
  31389. }
  31390. function handleImgLoad() {
  31391. loading.value = false;
  31392. }
  31393. function handleImgError(e) {
  31394. loading.value = false;
  31395. e.target.alt = t("el.image.error");
  31396. }
  31397. function handleMouseDown(e) {
  31398. if (loading.value || e.button !== 0 || !wrapper.value)
  31399. return;
  31400. transform.value.enableTransition = false;
  31401. const { offsetX, offsetY } = transform.value;
  31402. const startX = e.pageX;
  31403. const startY = e.pageY;
  31404. const dragHandler = throttle((ev) => {
  31405. transform.value = {
  31406. ...transform.value,
  31407. offsetX: offsetX + ev.pageX - startX,
  31408. offsetY: offsetY + ev.pageY - startY
  31409. };
  31410. });
  31411. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  31412. useEventListener(document, "mouseup", () => {
  31413. removeMousemove();
  31414. });
  31415. e.preventDefault();
  31416. }
  31417. function reset() {
  31418. transform.value = {
  31419. scale: 1,
  31420. deg: 0,
  31421. offsetX: 0,
  31422. offsetY: 0,
  31423. enableTransition: false
  31424. };
  31425. }
  31426. function toggleMode() {
  31427. if (loading.value)
  31428. return;
  31429. const modeNames = keysOf(modes);
  31430. const modeValues = Object.values(modes);
  31431. const currentMode = mode.value.name;
  31432. const index = modeValues.findIndex((i) => i.name === currentMode);
  31433. const nextIndex = (index + 1) % modeNames.length;
  31434. mode.value = modes[modeNames[nextIndex]];
  31435. reset();
  31436. }
  31437. function setActiveItem(index) {
  31438. const len = props.urlList.length;
  31439. activeIndex.value = (index + len) % len;
  31440. }
  31441. function prev() {
  31442. if (isFirst.value && !props.infinite)
  31443. return;
  31444. setActiveItem(activeIndex.value - 1);
  31445. }
  31446. function next() {
  31447. if (isLast.value && !props.infinite)
  31448. return;
  31449. setActiveItem(activeIndex.value + 1);
  31450. }
  31451. function handleActions(action, options = {}) {
  31452. if (loading.value)
  31453. return;
  31454. const { minScale, maxScale } = props;
  31455. const { zoomRate, rotateDeg, enableTransition } = {
  31456. zoomRate: props.zoomRate,
  31457. rotateDeg: 90,
  31458. enableTransition: true,
  31459. ...options
  31460. };
  31461. switch (action) {
  31462. case "zoomOut":
  31463. if (transform.value.scale > minScale) {
  31464. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  31465. }
  31466. break;
  31467. case "zoomIn":
  31468. if (transform.value.scale < maxScale) {
  31469. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  31470. }
  31471. break;
  31472. case "clockwise":
  31473. transform.value.deg += rotateDeg;
  31474. emit("rotate", transform.value.deg);
  31475. break;
  31476. case "anticlockwise":
  31477. transform.value.deg -= rotateDeg;
  31478. emit("rotate", transform.value.deg);
  31479. break;
  31480. }
  31481. transform.value.enableTransition = enableTransition;
  31482. }
  31483. function onFocusoutPrevented(event) {
  31484. var _a2;
  31485. if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  31486. event.preventDefault();
  31487. }
  31488. }
  31489. function onCloseRequested() {
  31490. if (props.closeOnPressEscape) {
  31491. hide();
  31492. }
  31493. }
  31494. watch(currentImg, () => {
  31495. nextTick(() => {
  31496. const $img = imgRefs.value[0];
  31497. if (!($img == null ? void 0 : $img.complete)) {
  31498. loading.value = true;
  31499. }
  31500. });
  31501. });
  31502. watch(activeIndex, (val) => {
  31503. reset();
  31504. emit("switch", val);
  31505. });
  31506. onMounted(() => {
  31507. registerEventListener();
  31508. });
  31509. expose({
  31510. setActiveItem
  31511. });
  31512. return (_ctx, _cache) => {
  31513. return openBlock(), createBlock(unref(ElTeleport$1), {
  31514. to: "body",
  31515. disabled: !_ctx.teleported
  31516. }, {
  31517. default: withCtx(() => [
  31518. createVNode(Transition, {
  31519. name: "viewer-fade",
  31520. appear: ""
  31521. }, {
  31522. default: withCtx(() => [
  31523. createElementVNode("div", {
  31524. ref_key: "wrapper",
  31525. ref: wrapper,
  31526. tabindex: -1,
  31527. class: normalizeClass(unref(ns).e("wrapper")),
  31528. style: normalizeStyle({ zIndex: zIndex.value })
  31529. }, [
  31530. createVNode(unref(ElFocusTrap), {
  31531. loop: "",
  31532. trapped: "",
  31533. "focus-trap-el": wrapper.value,
  31534. "focus-start-el": "container",
  31535. onFocusoutPrevented,
  31536. onReleaseRequested: onCloseRequested
  31537. }, {
  31538. default: withCtx(() => [
  31539. createElementVNode("div", {
  31540. class: normalizeClass(unref(ns).e("mask")),
  31541. onClick: withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"])
  31542. }, null, 10, ["onClick"]),
  31543. createCommentVNode(" CLOSE "),
  31544. createElementVNode("span", {
  31545. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
  31546. onClick: hide
  31547. }, [
  31548. createVNode(unref(ElIcon), null, {
  31549. default: withCtx(() => [
  31550. createVNode(unref(close_default))
  31551. ]),
  31552. _: 1
  31553. })
  31554. ], 2),
  31555. createCommentVNode(" ARROW "),
  31556. !unref(isSingle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  31557. createElementVNode("span", {
  31558. class: normalizeClass(unref(arrowPrevKls)),
  31559. onClick: prev
  31560. }, [
  31561. createVNode(unref(ElIcon), null, {
  31562. default: withCtx(() => [
  31563. createVNode(unref(arrow_left_default))
  31564. ]),
  31565. _: 1
  31566. })
  31567. ], 2),
  31568. createElementVNode("span", {
  31569. class: normalizeClass(unref(arrowNextKls)),
  31570. onClick: next
  31571. }, [
  31572. createVNode(unref(ElIcon), null, {
  31573. default: withCtx(() => [
  31574. createVNode(unref(arrow_right_default))
  31575. ]),
  31576. _: 1
  31577. })
  31578. ], 2)
  31579. ], 64)) : createCommentVNode("v-if", true),
  31580. createCommentVNode(" ACTIONS "),
  31581. createElementVNode("div", {
  31582. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")])
  31583. }, [
  31584. createElementVNode("div", {
  31585. class: normalizeClass(unref(ns).e("actions__inner"))
  31586. }, [
  31587. createVNode(unref(ElIcon), {
  31588. onClick: ($event) => handleActions("zoomOut")
  31589. }, {
  31590. default: withCtx(() => [
  31591. createVNode(unref(zoom_out_default))
  31592. ]),
  31593. _: 1
  31594. }, 8, ["onClick"]),
  31595. createVNode(unref(ElIcon), {
  31596. onClick: ($event) => handleActions("zoomIn")
  31597. }, {
  31598. default: withCtx(() => [
  31599. createVNode(unref(zoom_in_default))
  31600. ]),
  31601. _: 1
  31602. }, 8, ["onClick"]),
  31603. createElementVNode("i", {
  31604. class: normalizeClass(unref(ns).e("actions__divider"))
  31605. }, null, 2),
  31606. createVNode(unref(ElIcon), { onClick: toggleMode }, {
  31607. default: withCtx(() => [
  31608. (openBlock(), createBlock(resolveDynamicComponent(unref(mode).icon)))
  31609. ]),
  31610. _: 1
  31611. }),
  31612. createElementVNode("i", {
  31613. class: normalizeClass(unref(ns).e("actions__divider"))
  31614. }, null, 2),
  31615. createVNode(unref(ElIcon), {
  31616. onClick: ($event) => handleActions("anticlockwise")
  31617. }, {
  31618. default: withCtx(() => [
  31619. createVNode(unref(refresh_left_default))
  31620. ]),
  31621. _: 1
  31622. }, 8, ["onClick"]),
  31623. createVNode(unref(ElIcon), {
  31624. onClick: ($event) => handleActions("clockwise")
  31625. }, {
  31626. default: withCtx(() => [
  31627. createVNode(unref(refresh_right_default))
  31628. ]),
  31629. _: 1
  31630. }, 8, ["onClick"])
  31631. ], 2)
  31632. ], 2),
  31633. createCommentVNode(" CANVAS "),
  31634. createElementVNode("div", {
  31635. class: normalizeClass(unref(ns).e("canvas"))
  31636. }, [
  31637. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.urlList, (url, i) => {
  31638. return withDirectives((openBlock(), createElementBlock("img", {
  31639. ref_for: true,
  31640. ref: (el) => imgRefs.value[i] = el,
  31641. key: url,
  31642. src: url,
  31643. style: normalizeStyle(unref(imgStyle)),
  31644. class: normalizeClass(unref(ns).e("img")),
  31645. crossorigin: _ctx.crossorigin,
  31646. onLoad: handleImgLoad,
  31647. onError: handleImgError,
  31648. onMousedown: handleMouseDown
  31649. }, null, 46, ["src", "crossorigin"])), [
  31650. [vShow, i === activeIndex.value]
  31651. ]);
  31652. }), 128))
  31653. ], 2),
  31654. renderSlot(_ctx.$slots, "default")
  31655. ]),
  31656. _: 3
  31657. }, 8, ["focus-trap-el"])
  31658. ], 6)
  31659. ]),
  31660. _: 3
  31661. })
  31662. ]),
  31663. _: 3
  31664. }, 8, ["disabled"]);
  31665. };
  31666. }
  31667. });
  31668. var ImageViewer = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["__file", "image-viewer.vue"]]);
  31669. const ElImageViewer = withInstall(ImageViewer);
  31670. const imageProps = buildProps({
  31671. hideOnClickModal: Boolean,
  31672. src: {
  31673. type: String,
  31674. default: ""
  31675. },
  31676. fit: {
  31677. type: String,
  31678. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  31679. default: ""
  31680. },
  31681. loading: {
  31682. type: String,
  31683. values: ["eager", "lazy"]
  31684. },
  31685. lazy: Boolean,
  31686. scrollContainer: {
  31687. type: definePropType([String, Object])
  31688. },
  31689. previewSrcList: {
  31690. type: definePropType(Array),
  31691. default: () => mutable([])
  31692. },
  31693. previewTeleported: Boolean,
  31694. zIndex: {
  31695. type: Number
  31696. },
  31697. initialIndex: {
  31698. type: Number,
  31699. default: 0
  31700. },
  31701. infinite: {
  31702. type: Boolean,
  31703. default: true
  31704. },
  31705. closeOnPressEscape: {
  31706. type: Boolean,
  31707. default: true
  31708. },
  31709. zoomRate: {
  31710. type: Number,
  31711. default: 1.2
  31712. },
  31713. minScale: {
  31714. type: Number,
  31715. default: 0.2
  31716. },
  31717. maxScale: {
  31718. type: Number,
  31719. default: 7
  31720. },
  31721. crossorigin: {
  31722. type: definePropType(String)
  31723. }
  31724. });
  31725. const imageEmits = {
  31726. load: (evt) => evt instanceof Event,
  31727. error: (evt) => evt instanceof Event,
  31728. switch: (val) => isNumber(val),
  31729. close: () => true,
  31730. show: () => true
  31731. };
  31732. const __default__$U = defineComponent({
  31733. name: "ElImage",
  31734. inheritAttrs: false
  31735. });
  31736. const _sfc_main$19 = /* @__PURE__ */ defineComponent({
  31737. ...__default__$U,
  31738. props: imageProps,
  31739. emits: imageEmits,
  31740. setup(__props, { emit }) {
  31741. const props = __props;
  31742. let prevOverflow = "";
  31743. const { t } = useLocale();
  31744. const ns = useNamespace("image");
  31745. const rawAttrs = useAttrs$1();
  31746. const containerAttrs = computed(() => {
  31747. return fromPairs(Object.entries(rawAttrs).filter(([key]) => /^(data-|on[A-Z])/i.test(key) || ["id", "style"].includes(key)));
  31748. });
  31749. const imgAttrs = useAttrs({
  31750. excludeListeners: true,
  31751. excludeKeys: computed(() => {
  31752. return Object.keys(containerAttrs.value);
  31753. })
  31754. });
  31755. const imageSrc = ref();
  31756. const hasLoadError = ref(false);
  31757. const isLoading = ref(true);
  31758. const showViewer = ref(false);
  31759. const container = ref();
  31760. const _scrollContainer = ref();
  31761. const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
  31762. let stopScrollListener;
  31763. let stopWheelListener;
  31764. const imageKls = computed(() => [
  31765. ns.e("inner"),
  31766. preview.value && ns.e("preview"),
  31767. isLoading.value && ns.is("loading")
  31768. ]);
  31769. const imageStyle = computed(() => {
  31770. const { fit } = props;
  31771. if (isClient && fit) {
  31772. return { objectFit: fit };
  31773. }
  31774. return {};
  31775. });
  31776. const preview = computed(() => {
  31777. const { previewSrcList } = props;
  31778. return isArray$1(previewSrcList) && previewSrcList.length > 0;
  31779. });
  31780. const imageIndex = computed(() => {
  31781. const { previewSrcList, initialIndex } = props;
  31782. let previewIndex = initialIndex;
  31783. if (initialIndex > previewSrcList.length - 1) {
  31784. previewIndex = 0;
  31785. }
  31786. return previewIndex;
  31787. });
  31788. const isManual = computed(() => {
  31789. if (props.loading === "eager")
  31790. return false;
  31791. return !supportLoading && props.loading === "lazy" || props.lazy;
  31792. });
  31793. const loadImage = () => {
  31794. if (!isClient)
  31795. return;
  31796. isLoading.value = true;
  31797. hasLoadError.value = false;
  31798. imageSrc.value = props.src;
  31799. };
  31800. function handleLoad(event) {
  31801. isLoading.value = false;
  31802. hasLoadError.value = false;
  31803. emit("load", event);
  31804. }
  31805. function handleError(event) {
  31806. isLoading.value = false;
  31807. hasLoadError.value = true;
  31808. emit("error", event);
  31809. }
  31810. function handleLazyLoad() {
  31811. if (isInContainer(container.value, _scrollContainer.value)) {
  31812. loadImage();
  31813. removeLazyLoadListener();
  31814. }
  31815. }
  31816. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200, true);
  31817. async function addLazyLoadListener() {
  31818. var _a;
  31819. if (!isClient)
  31820. return;
  31821. await nextTick();
  31822. const { scrollContainer } = props;
  31823. if (isElement$1(scrollContainer)) {
  31824. _scrollContainer.value = scrollContainer;
  31825. } else if (isString$1(scrollContainer) && scrollContainer !== "") {
  31826. _scrollContainer.value = (_a = document.querySelector(scrollContainer)) != null ? _a : void 0;
  31827. } else if (container.value) {
  31828. _scrollContainer.value = getScrollContainer(container.value);
  31829. }
  31830. if (_scrollContainer.value) {
  31831. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  31832. setTimeout(() => handleLazyLoad(), 100);
  31833. }
  31834. }
  31835. function removeLazyLoadListener() {
  31836. if (!isClient || !_scrollContainer.value || !lazyLoadHandler)
  31837. return;
  31838. stopScrollListener == null ? void 0 : stopScrollListener();
  31839. _scrollContainer.value = void 0;
  31840. }
  31841. function wheelHandler(e) {
  31842. if (!e.ctrlKey)
  31843. return;
  31844. if (e.deltaY < 0) {
  31845. e.preventDefault();
  31846. return false;
  31847. } else if (e.deltaY > 0) {
  31848. e.preventDefault();
  31849. return false;
  31850. }
  31851. }
  31852. function clickHandler() {
  31853. if (!preview.value)
  31854. return;
  31855. stopWheelListener = useEventListener("wheel", wheelHandler, {
  31856. passive: false
  31857. });
  31858. prevOverflow = document.body.style.overflow;
  31859. document.body.style.overflow = "hidden";
  31860. showViewer.value = true;
  31861. emit("show");
  31862. }
  31863. function closeViewer() {
  31864. stopWheelListener == null ? void 0 : stopWheelListener();
  31865. document.body.style.overflow = prevOverflow;
  31866. showViewer.value = false;
  31867. emit("close");
  31868. }
  31869. function switchViewer(val) {
  31870. emit("switch", val);
  31871. }
  31872. watch(() => props.src, () => {
  31873. if (isManual.value) {
  31874. isLoading.value = true;
  31875. hasLoadError.value = false;
  31876. removeLazyLoadListener();
  31877. addLazyLoadListener();
  31878. } else {
  31879. loadImage();
  31880. }
  31881. });
  31882. onMounted(() => {
  31883. if (isManual.value) {
  31884. addLazyLoadListener();
  31885. } else {
  31886. loadImage();
  31887. }
  31888. });
  31889. return (_ctx, _cache) => {
  31890. return openBlock(), createElementBlock("div", mergeProps({
  31891. ref_key: "container",
  31892. ref: container
  31893. }, unref(containerAttrs), {
  31894. class: [unref(ns).b(), _ctx.$attrs.class]
  31895. }), [
  31896. hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 0 }, () => [
  31897. createElementVNode("div", {
  31898. class: normalizeClass(unref(ns).e("error"))
  31899. }, toDisplayString(unref(t)("el.image.error")), 3)
  31900. ]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  31901. imageSrc.value !== void 0 ? (openBlock(), createElementBlock("img", mergeProps({ key: 0 }, unref(imgAttrs), {
  31902. src: imageSrc.value,
  31903. loading: _ctx.loading,
  31904. style: unref(imageStyle),
  31905. class: unref(imageKls),
  31906. crossorigin: _ctx.crossorigin,
  31907. onClick: clickHandler,
  31908. onLoad: handleLoad,
  31909. onError: handleError
  31910. }), null, 16, ["src", "loading", "crossorigin"])) : createCommentVNode("v-if", true),
  31911. isLoading.value ? (openBlock(), createElementBlock("div", {
  31912. key: 1,
  31913. class: normalizeClass(unref(ns).e("wrapper"))
  31914. }, [
  31915. renderSlot(_ctx.$slots, "placeholder", {}, () => [
  31916. createElementVNode("div", {
  31917. class: normalizeClass(unref(ns).e("placeholder"))
  31918. }, null, 2)
  31919. ])
  31920. ], 2)) : createCommentVNode("v-if", true)
  31921. ], 64)),
  31922. unref(preview) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  31923. showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
  31924. key: 0,
  31925. "z-index": _ctx.zIndex,
  31926. "initial-index": unref(imageIndex),
  31927. infinite: _ctx.infinite,
  31928. "zoom-rate": _ctx.zoomRate,
  31929. "min-scale": _ctx.minScale,
  31930. "max-scale": _ctx.maxScale,
  31931. "url-list": _ctx.previewSrcList,
  31932. crossorigin: _ctx.crossorigin,
  31933. "hide-on-click-modal": _ctx.hideOnClickModal,
  31934. teleported: _ctx.previewTeleported,
  31935. "close-on-press-escape": _ctx.closeOnPressEscape,
  31936. onClose: closeViewer,
  31937. onSwitch: switchViewer
  31938. }, {
  31939. default: withCtx(() => [
  31940. _ctx.$slots.viewer ? (openBlock(), createElementBlock("div", { key: 0 }, [
  31941. renderSlot(_ctx.$slots, "viewer")
  31942. ])) : createCommentVNode("v-if", true)
  31943. ]),
  31944. _: 3
  31945. }, 8, ["z-index", "initial-index", "infinite", "zoom-rate", "min-scale", "max-scale", "url-list", "crossorigin", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : createCommentVNode("v-if", true)
  31946. ], 64)) : createCommentVNode("v-if", true)
  31947. ], 16);
  31948. };
  31949. }
  31950. });
  31951. var Image$1 = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["__file", "image.vue"]]);
  31952. const ElImage = withInstall(Image$1);
  31953. const inputNumberProps = buildProps({
  31954. id: {
  31955. type: String,
  31956. default: void 0
  31957. },
  31958. step: {
  31959. type: Number,
  31960. default: 1
  31961. },
  31962. stepStrictly: Boolean,
  31963. max: {
  31964. type: Number,
  31965. default: Number.POSITIVE_INFINITY
  31966. },
  31967. min: {
  31968. type: Number,
  31969. default: Number.NEGATIVE_INFINITY
  31970. },
  31971. modelValue: Number,
  31972. readonly: Boolean,
  31973. disabled: Boolean,
  31974. size: useSizeProp,
  31975. controls: {
  31976. type: Boolean,
  31977. default: true
  31978. },
  31979. controlsPosition: {
  31980. type: String,
  31981. default: "",
  31982. values: ["", "right"]
  31983. },
  31984. valueOnClear: {
  31985. type: [String, Number, null],
  31986. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  31987. default: null
  31988. },
  31989. name: String,
  31990. placeholder: String,
  31991. precision: {
  31992. type: Number,
  31993. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  31994. },
  31995. validateEvent: {
  31996. type: Boolean,
  31997. default: true
  31998. },
  31999. ...useAriaProps(["ariaLabel"])
  32000. });
  32001. const inputNumberEmits = {
  32002. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  32003. blur: (e) => e instanceof FocusEvent,
  32004. focus: (e) => e instanceof FocusEvent,
  32005. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  32006. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  32007. };
  32008. const __default__$T = defineComponent({
  32009. name: "ElInputNumber"
  32010. });
  32011. const _sfc_main$18 = /* @__PURE__ */ defineComponent({
  32012. ...__default__$T,
  32013. props: inputNumberProps,
  32014. emits: inputNumberEmits,
  32015. setup(__props, { expose, emit }) {
  32016. const props = __props;
  32017. const { t } = useLocale();
  32018. const ns = useNamespace("input-number");
  32019. const input = ref();
  32020. const data = reactive({
  32021. currentValue: props.modelValue,
  32022. userInput: null
  32023. });
  32024. const { formItem } = useFormItem();
  32025. const minDisabled = computed(() => isNumber(props.modelValue) && props.modelValue <= props.min);
  32026. const maxDisabled = computed(() => isNumber(props.modelValue) && props.modelValue >= props.max);
  32027. const numPrecision = computed(() => {
  32028. const stepPrecision = getPrecision(props.step);
  32029. if (!isUndefined(props.precision)) {
  32030. if (stepPrecision > props.precision) ;
  32031. return props.precision;
  32032. } else {
  32033. return Math.max(getPrecision(props.modelValue), stepPrecision);
  32034. }
  32035. });
  32036. const controlsAtRight = computed(() => {
  32037. return props.controls && props.controlsPosition === "right";
  32038. });
  32039. const inputNumberSize = useFormSize();
  32040. const inputNumberDisabled = useFormDisabled();
  32041. const displayValue = computed(() => {
  32042. if (data.userInput !== null) {
  32043. return data.userInput;
  32044. }
  32045. let currentValue = data.currentValue;
  32046. if (isNil(currentValue))
  32047. return "";
  32048. if (isNumber(currentValue)) {
  32049. if (Number.isNaN(currentValue))
  32050. return "";
  32051. if (!isUndefined(props.precision)) {
  32052. currentValue = currentValue.toFixed(props.precision);
  32053. }
  32054. }
  32055. return currentValue;
  32056. });
  32057. const toPrecision = (num, pre) => {
  32058. if (isUndefined(pre))
  32059. pre = numPrecision.value;
  32060. if (pre === 0)
  32061. return Math.round(num);
  32062. let snum = String(num);
  32063. const pointPos = snum.indexOf(".");
  32064. if (pointPos === -1)
  32065. return num;
  32066. const nums = snum.replace(".", "").split("");
  32067. const datum = nums[pointPos + pre];
  32068. if (!datum)
  32069. return num;
  32070. const length = snum.length;
  32071. if (snum.charAt(length - 1) === "5") {
  32072. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  32073. }
  32074. return Number.parseFloat(Number(snum).toFixed(pre));
  32075. };
  32076. const getPrecision = (value) => {
  32077. if (isNil(value))
  32078. return 0;
  32079. const valueString = value.toString();
  32080. const dotPosition = valueString.indexOf(".");
  32081. let precision = 0;
  32082. if (dotPosition !== -1) {
  32083. precision = valueString.length - dotPosition - 1;
  32084. }
  32085. return precision;
  32086. };
  32087. const ensurePrecision = (val, coefficient = 1) => {
  32088. if (!isNumber(val))
  32089. return data.currentValue;
  32090. return toPrecision(val + props.step * coefficient);
  32091. };
  32092. const increase = () => {
  32093. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  32094. return;
  32095. const value = Number(displayValue.value) || 0;
  32096. const newVal = ensurePrecision(value);
  32097. setCurrentValue(newVal);
  32098. emit(INPUT_EVENT, data.currentValue);
  32099. setCurrentValueToModelValue();
  32100. };
  32101. const decrease = () => {
  32102. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  32103. return;
  32104. const value = Number(displayValue.value) || 0;
  32105. const newVal = ensurePrecision(value, -1);
  32106. setCurrentValue(newVal);
  32107. emit(INPUT_EVENT, data.currentValue);
  32108. setCurrentValueToModelValue();
  32109. };
  32110. const verifyValue = (value, update) => {
  32111. const { max, min, step, precision, stepStrictly, valueOnClear } = props;
  32112. if (max < min) {
  32113. throwError("InputNumber", "min should not be greater than max.");
  32114. }
  32115. let newVal = Number(value);
  32116. if (isNil(value) || Number.isNaN(newVal)) {
  32117. return null;
  32118. }
  32119. if (value === "") {
  32120. if (valueOnClear === null) {
  32121. return null;
  32122. }
  32123. newVal = isString$1(valueOnClear) ? { min, max }[valueOnClear] : valueOnClear;
  32124. }
  32125. if (stepStrictly) {
  32126. newVal = toPrecision(Math.round(newVal / step) * step, precision);
  32127. if (newVal !== value) {
  32128. update && emit(UPDATE_MODEL_EVENT, newVal);
  32129. }
  32130. }
  32131. if (!isUndefined(precision)) {
  32132. newVal = toPrecision(newVal, precision);
  32133. }
  32134. if (newVal > max || newVal < min) {
  32135. newVal = newVal > max ? max : min;
  32136. update && emit(UPDATE_MODEL_EVENT, newVal);
  32137. }
  32138. return newVal;
  32139. };
  32140. const setCurrentValue = (value, emitChange = true) => {
  32141. var _a;
  32142. const oldVal = data.currentValue;
  32143. const newVal = verifyValue(value);
  32144. if (!emitChange) {
  32145. emit(UPDATE_MODEL_EVENT, newVal);
  32146. return;
  32147. }
  32148. if (oldVal === newVal && value)
  32149. return;
  32150. data.userInput = null;
  32151. emit(UPDATE_MODEL_EVENT, newVal);
  32152. if (oldVal !== newVal) {
  32153. emit(CHANGE_EVENT, newVal, oldVal);
  32154. }
  32155. if (props.validateEvent) {
  32156. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  32157. }
  32158. data.currentValue = newVal;
  32159. };
  32160. const handleInput = (value) => {
  32161. data.userInput = value;
  32162. const newVal = value === "" ? null : Number(value);
  32163. emit(INPUT_EVENT, newVal);
  32164. setCurrentValue(newVal, false);
  32165. };
  32166. const handleInputChange = (value) => {
  32167. const newVal = value !== "" ? Number(value) : "";
  32168. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  32169. setCurrentValue(newVal);
  32170. }
  32171. setCurrentValueToModelValue();
  32172. data.userInput = null;
  32173. };
  32174. const focus = () => {
  32175. var _a, _b;
  32176. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  32177. };
  32178. const blur = () => {
  32179. var _a, _b;
  32180. (_b = (_a = input.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  32181. };
  32182. const handleFocus = (event) => {
  32183. emit("focus", event);
  32184. };
  32185. const handleBlur = (event) => {
  32186. var _a, _b;
  32187. data.userInput = null;
  32188. if (isFirefox() && data.currentValue === null && ((_a = input.value) == null ? void 0 : _a.input)) {
  32189. input.value.input.value = "";
  32190. }
  32191. emit("blur", event);
  32192. if (props.validateEvent) {
  32193. (_b = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _b.call(formItem, "blur").catch((err) => debugWarn());
  32194. }
  32195. };
  32196. const setCurrentValueToModelValue = () => {
  32197. if (data.currentValue !== props.modelValue) {
  32198. data.currentValue = props.modelValue;
  32199. }
  32200. };
  32201. const handleWheel = (e) => {
  32202. if (document.activeElement === e.target)
  32203. e.preventDefault();
  32204. };
  32205. watch(() => props.modelValue, (value, oldValue) => {
  32206. const newValue = verifyValue(value, true);
  32207. if (data.userInput === null && newValue !== oldValue) {
  32208. data.currentValue = newValue;
  32209. }
  32210. }, { immediate: true });
  32211. onMounted(() => {
  32212. var _a;
  32213. const { min, max, modelValue } = props;
  32214. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  32215. innerInput.setAttribute("role", "spinbutton");
  32216. if (Number.isFinite(max)) {
  32217. innerInput.setAttribute("aria-valuemax", String(max));
  32218. } else {
  32219. innerInput.removeAttribute("aria-valuemax");
  32220. }
  32221. if (Number.isFinite(min)) {
  32222. innerInput.setAttribute("aria-valuemin", String(min));
  32223. } else {
  32224. innerInput.removeAttribute("aria-valuemin");
  32225. }
  32226. innerInput.setAttribute("aria-valuenow", data.currentValue || data.currentValue === 0 ? String(data.currentValue) : "");
  32227. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  32228. if (!isNumber(modelValue) && modelValue != null) {
  32229. let val = Number(modelValue);
  32230. if (Number.isNaN(val)) {
  32231. val = null;
  32232. }
  32233. emit(UPDATE_MODEL_EVENT, val);
  32234. }
  32235. innerInput.addEventListener("wheel", handleWheel, { passive: false });
  32236. });
  32237. onUpdated(() => {
  32238. var _a, _b;
  32239. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  32240. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${(_b = data.currentValue) != null ? _b : ""}`);
  32241. });
  32242. expose({
  32243. focus,
  32244. blur
  32245. });
  32246. return (_ctx, _cache) => {
  32247. return openBlock(), createElementBlock("div", {
  32248. class: normalizeClass([
  32249. unref(ns).b(),
  32250. unref(ns).m(unref(inputNumberSize)),
  32251. unref(ns).is("disabled", unref(inputNumberDisabled)),
  32252. unref(ns).is("without-controls", !_ctx.controls),
  32253. unref(ns).is("controls-right", unref(controlsAtRight))
  32254. ]),
  32255. onDragstart: withModifiers(() => {
  32256. }, ["prevent"])
  32257. }, [
  32258. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  32259. key: 0,
  32260. role: "button",
  32261. "aria-label": unref(t)("el.inputNumber.decrease"),
  32262. class: normalizeClass([unref(ns).e("decrease"), unref(ns).is("disabled", unref(minDisabled))]),
  32263. onKeydown: withKeys(decrease, ["enter"])
  32264. }, [
  32265. renderSlot(_ctx.$slots, "decrease-icon", {}, () => [
  32266. createVNode(unref(ElIcon), null, {
  32267. default: withCtx(() => [
  32268. unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_down_default), { key: 0 })) : (openBlock(), createBlock(unref(minus_default), { key: 1 }))
  32269. ]),
  32270. _: 1
  32271. })
  32272. ])
  32273. ], 42, ["aria-label", "onKeydown"])), [
  32274. [unref(vRepeatClick), decrease]
  32275. ]) : createCommentVNode("v-if", true),
  32276. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  32277. key: 1,
  32278. role: "button",
  32279. "aria-label": unref(t)("el.inputNumber.increase"),
  32280. class: normalizeClass([unref(ns).e("increase"), unref(ns).is("disabled", unref(maxDisabled))]),
  32281. onKeydown: withKeys(increase, ["enter"])
  32282. }, [
  32283. renderSlot(_ctx.$slots, "increase-icon", {}, () => [
  32284. createVNode(unref(ElIcon), null, {
  32285. default: withCtx(() => [
  32286. unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_up_default), { key: 0 })) : (openBlock(), createBlock(unref(plus_default), { key: 1 }))
  32287. ]),
  32288. _: 1
  32289. })
  32290. ])
  32291. ], 42, ["aria-label", "onKeydown"])), [
  32292. [unref(vRepeatClick), increase]
  32293. ]) : createCommentVNode("v-if", true),
  32294. createVNode(unref(ElInput), {
  32295. id: _ctx.id,
  32296. ref_key: "input",
  32297. ref: input,
  32298. type: "number",
  32299. step: _ctx.step,
  32300. "model-value": unref(displayValue),
  32301. placeholder: _ctx.placeholder,
  32302. readonly: _ctx.readonly,
  32303. disabled: unref(inputNumberDisabled),
  32304. size: unref(inputNumberSize),
  32305. max: _ctx.max,
  32306. min: _ctx.min,
  32307. name: _ctx.name,
  32308. "aria-label": _ctx.ariaLabel,
  32309. "validate-event": false,
  32310. onKeydown: [
  32311. withKeys(withModifiers(increase, ["prevent"]), ["up"]),
  32312. withKeys(withModifiers(decrease, ["prevent"]), ["down"])
  32313. ],
  32314. onBlur: handleBlur,
  32315. onFocus: handleFocus,
  32316. onInput: handleInput,
  32317. onChange: handleInputChange
  32318. }, createSlots({
  32319. _: 2
  32320. }, [
  32321. _ctx.$slots.prefix ? {
  32322. name: "prefix",
  32323. fn: withCtx(() => [
  32324. renderSlot(_ctx.$slots, "prefix")
  32325. ])
  32326. } : void 0,
  32327. _ctx.$slots.suffix ? {
  32328. name: "suffix",
  32329. fn: withCtx(() => [
  32330. renderSlot(_ctx.$slots, "suffix")
  32331. ])
  32332. } : void 0
  32333. ]), 1032, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "aria-label", "onKeydown"])
  32334. ], 42, ["onDragstart"]);
  32335. };
  32336. }
  32337. });
  32338. var InputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["__file", "input-number.vue"]]);
  32339. const ElInputNumber = withInstall(InputNumber);
  32340. const inputTagProps = buildProps({
  32341. modelValue: {
  32342. type: definePropType(Array)
  32343. },
  32344. max: Number,
  32345. tagType: { ...tagProps.type, default: "info" },
  32346. tagEffect: tagProps.effect,
  32347. trigger: {
  32348. type: definePropType(String),
  32349. default: EVENT_CODE.enter
  32350. },
  32351. draggable: {
  32352. type: Boolean,
  32353. default: false
  32354. },
  32355. size: useSizeProp,
  32356. clearable: Boolean,
  32357. disabled: {
  32358. type: Boolean,
  32359. default: void 0
  32360. },
  32361. validateEvent: {
  32362. type: Boolean,
  32363. default: true
  32364. },
  32365. readonly: Boolean,
  32366. autofocus: Boolean,
  32367. id: {
  32368. type: String,
  32369. default: void 0
  32370. },
  32371. tabindex: {
  32372. type: [String, Number],
  32373. default: 0
  32374. },
  32375. maxlength: {
  32376. type: [String, Number]
  32377. },
  32378. minlength: {
  32379. type: [String, Number]
  32380. },
  32381. placeholder: String,
  32382. autocomplete: {
  32383. type: String,
  32384. default: "off"
  32385. },
  32386. ariaLabel: String
  32387. });
  32388. const inputTagEmits = {
  32389. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  32390. [CHANGE_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  32391. [INPUT_EVENT]: (value) => isString$1(value),
  32392. "add-tag": (value) => isString$1(value),
  32393. "remove-tag": (value) => isString$1(value),
  32394. focus: (evt) => evt instanceof FocusEvent,
  32395. blur: (evt) => evt instanceof FocusEvent,
  32396. clear: () => true
  32397. };
  32398. function useDragTag({
  32399. wrapperRef,
  32400. handleDragged,
  32401. afterDragged
  32402. }) {
  32403. const ns = useNamespace("input-tag");
  32404. const dropIndicatorRef = shallowRef();
  32405. const showDropIndicator = ref(false);
  32406. let draggingIndex;
  32407. let draggingTag;
  32408. let dropIndex;
  32409. let dropType;
  32410. function getTagClassName(index) {
  32411. return `.${ns.e("inner")} .${ns.namespace.value}-tag:nth-child(${index + 1})`;
  32412. }
  32413. function handleDragStart(event, index) {
  32414. draggingIndex = index;
  32415. draggingTag = wrapperRef.value.querySelector(getTagClassName(index));
  32416. if (draggingTag) {
  32417. draggingTag.style.opacity = "0.5";
  32418. }
  32419. event.dataTransfer.effectAllowed = "move";
  32420. }
  32421. function handleDragOver(event, index) {
  32422. dropIndex = index;
  32423. event.preventDefault();
  32424. event.dataTransfer.dropEffect = "move";
  32425. if (isUndefined(draggingIndex) || draggingIndex === index) {
  32426. showDropIndicator.value = false;
  32427. return;
  32428. }
  32429. const dropPosition = wrapperRef.value.querySelector(getTagClassName(index)).getBoundingClientRect();
  32430. const dropPrev = !(draggingIndex + 1 === index);
  32431. const dropNext = !(draggingIndex - 1 === index);
  32432. const distance = event.clientX - dropPosition.left;
  32433. const prevPercent = dropPrev ? dropNext ? 0.5 : 1 : -1;
  32434. const nextPercent = dropNext ? dropPrev ? 0.5 : 0 : 1;
  32435. if (distance <= dropPosition.width * prevPercent) {
  32436. dropType = "before";
  32437. } else if (distance > dropPosition.width * nextPercent) {
  32438. dropType = "after";
  32439. } else {
  32440. dropType = void 0;
  32441. }
  32442. const innerEl = wrapperRef.value.querySelector(`.${ns.e("inner")}`);
  32443. const innerPosition = innerEl.getBoundingClientRect();
  32444. const gap = Number.parseFloat(getStyle(innerEl, "gap")) / 2;
  32445. const indicatorTop = dropPosition.top - innerPosition.top;
  32446. let indicatorLeft = -9999;
  32447. if (dropType === "before") {
  32448. indicatorLeft = Math.max(dropPosition.left - innerPosition.left - gap, Math.floor(-gap / 2));
  32449. } else if (dropType === "after") {
  32450. const left = dropPosition.right - innerPosition.left;
  32451. indicatorLeft = left + (innerPosition.width === left ? Math.floor(gap / 2) : gap);
  32452. }
  32453. setStyle(dropIndicatorRef.value, {
  32454. top: `${indicatorTop}px`,
  32455. left: `${indicatorLeft}px`
  32456. });
  32457. showDropIndicator.value = !!dropType;
  32458. }
  32459. function handleDragEnd(event) {
  32460. event.preventDefault();
  32461. if (draggingTag) {
  32462. draggingTag.style.opacity = "";
  32463. }
  32464. if (dropType && !isUndefined(draggingIndex) && !isUndefined(dropIndex) && draggingIndex !== dropIndex) {
  32465. handleDragged(draggingIndex, dropIndex, dropType);
  32466. }
  32467. showDropIndicator.value = false;
  32468. draggingIndex = void 0;
  32469. draggingTag = null;
  32470. dropIndex = void 0;
  32471. dropType = void 0;
  32472. afterDragged == null ? void 0 : afterDragged();
  32473. }
  32474. return {
  32475. dropIndicatorRef,
  32476. showDropIndicator,
  32477. handleDragStart,
  32478. handleDragOver,
  32479. handleDragEnd
  32480. };
  32481. }
  32482. function useHovering() {
  32483. const hovering = ref(false);
  32484. const handleMouseEnter = () => {
  32485. hovering.value = true;
  32486. };
  32487. const handleMouseLeave = () => {
  32488. hovering.value = false;
  32489. };
  32490. return {
  32491. hovering,
  32492. handleMouseEnter,
  32493. handleMouseLeave
  32494. };
  32495. }
  32496. function useInputTag({ props, emit, formItem }) {
  32497. const disabled = useFormDisabled();
  32498. const size = useFormSize();
  32499. const inputRef = shallowRef();
  32500. const inputValue = ref();
  32501. const tagSize = computed(() => {
  32502. return ["small"].includes(size.value) ? "small" : "default";
  32503. });
  32504. const placeholder = computed(() => {
  32505. var _a;
  32506. return ((_a = props.modelValue) == null ? void 0 : _a.length) ? void 0 : props.placeholder;
  32507. });
  32508. const closable = computed(() => !(props.readonly || disabled.value));
  32509. const inputLimit = computed(() => {
  32510. var _a, _b;
  32511. return isUndefined(props.max) ? false : ((_b = (_a = props.modelValue) == null ? void 0 : _a.length) != null ? _b : 0) >= props.max;
  32512. });
  32513. const handleInput = (event) => {
  32514. if (inputLimit.value) {
  32515. inputValue.value = void 0;
  32516. return;
  32517. }
  32518. if (isComposing.value)
  32519. return;
  32520. emit(INPUT_EVENT, event.target.value);
  32521. };
  32522. const handleKeydown = (event) => {
  32523. var _a;
  32524. if (isComposing.value)
  32525. return;
  32526. switch (event.code) {
  32527. case props.trigger:
  32528. event.preventDefault();
  32529. event.stopPropagation();
  32530. handleAddTag();
  32531. break;
  32532. case EVENT_CODE.numpadEnter:
  32533. if (props.trigger === EVENT_CODE.enter) {
  32534. event.preventDefault();
  32535. event.stopPropagation();
  32536. handleAddTag();
  32537. }
  32538. break;
  32539. case EVENT_CODE.backspace:
  32540. if (!inputValue.value && ((_a = props.modelValue) == null ? void 0 : _a.length)) {
  32541. event.preventDefault();
  32542. event.stopPropagation();
  32543. handleRemoveTag(props.modelValue.length - 1);
  32544. }
  32545. break;
  32546. }
  32547. };
  32548. const handleAddTag = () => {
  32549. var _a, _b;
  32550. const value = (_a = inputValue.value) == null ? void 0 : _a.trim();
  32551. if (!value || inputLimit.value)
  32552. return;
  32553. const list = [...(_b = props.modelValue) != null ? _b : [], value];
  32554. emit(UPDATE_MODEL_EVENT, list);
  32555. emit(CHANGE_EVENT, list);
  32556. emit("add-tag", value);
  32557. inputValue.value = void 0;
  32558. };
  32559. const handleRemoveTag = (index) => {
  32560. var _a;
  32561. const value = ((_a = props.modelValue) != null ? _a : []).slice();
  32562. const [item] = value.splice(index, 1);
  32563. emit(UPDATE_MODEL_EVENT, value);
  32564. emit(CHANGE_EVENT, value);
  32565. emit("remove-tag", item);
  32566. };
  32567. const handleClear = () => {
  32568. inputValue.value = void 0;
  32569. emit(UPDATE_MODEL_EVENT, void 0);
  32570. emit(CHANGE_EVENT, void 0);
  32571. emit("clear");
  32572. };
  32573. const handleDragged = (draggingIndex, dropIndex, type) => {
  32574. var _a;
  32575. const value = ((_a = props.modelValue) != null ? _a : []).slice();
  32576. const [draggedItem] = value.splice(draggingIndex, 1);
  32577. const step = dropIndex > draggingIndex && type === "before" ? -1 : dropIndex < draggingIndex && type === "after" ? 1 : 0;
  32578. value.splice(dropIndex + step, 0, draggedItem);
  32579. emit(UPDATE_MODEL_EVENT, value);
  32580. emit(CHANGE_EVENT, value);
  32581. };
  32582. const focus = () => {
  32583. var _a;
  32584. (_a = inputRef.value) == null ? void 0 : _a.focus();
  32585. };
  32586. const blur = () => {
  32587. var _a;
  32588. (_a = inputRef.value) == null ? void 0 : _a.blur();
  32589. };
  32590. const { wrapperRef, isFocused } = useFocusController(inputRef, {
  32591. beforeFocus() {
  32592. return disabled.value;
  32593. },
  32594. afterBlur() {
  32595. var _a;
  32596. handleAddTag();
  32597. if (props.validateEvent) {
  32598. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn());
  32599. }
  32600. }
  32601. });
  32602. const {
  32603. isComposing,
  32604. handleCompositionStart,
  32605. handleCompositionUpdate,
  32606. handleCompositionEnd
  32607. } = useComposition({ afterComposition: handleInput });
  32608. watch(() => props.modelValue, () => {
  32609. var _a;
  32610. if (props.validateEvent) {
  32611. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, CHANGE_EVENT).catch((err) => debugWarn());
  32612. }
  32613. });
  32614. return {
  32615. inputRef,
  32616. wrapperRef,
  32617. isFocused,
  32618. isComposing,
  32619. inputValue,
  32620. size,
  32621. tagSize,
  32622. placeholder,
  32623. closable,
  32624. disabled,
  32625. inputLimit,
  32626. handleDragged,
  32627. handleInput,
  32628. handleKeydown,
  32629. handleAddTag,
  32630. handleRemoveTag,
  32631. handleClear,
  32632. handleCompositionStart,
  32633. handleCompositionUpdate,
  32634. handleCompositionEnd,
  32635. focus,
  32636. blur
  32637. };
  32638. }
  32639. function useInputTagDom({
  32640. props,
  32641. isFocused,
  32642. hovering,
  32643. disabled,
  32644. inputValue,
  32645. size,
  32646. validateState,
  32647. validateIcon,
  32648. needStatusIcon
  32649. }) {
  32650. const attrs = useAttrs$1();
  32651. const slots = useSlots();
  32652. const ns = useNamespace("input-tag");
  32653. const nsInput = useNamespace("input");
  32654. const containerKls = computed(() => [
  32655. ns.b(),
  32656. ns.is("focused", isFocused.value),
  32657. ns.is("hovering", hovering.value),
  32658. ns.is("disabled", disabled.value),
  32659. ns.m(size.value),
  32660. ns.e("wrapper"),
  32661. attrs.class
  32662. ]);
  32663. const containerStyle = computed(() => [attrs.style]);
  32664. const innerKls = computed(() => {
  32665. var _a, _b;
  32666. return [
  32667. ns.e("inner"),
  32668. ns.is("draggable", props.draggable),
  32669. ns.is("left-space", !((_a = props.modelValue) == null ? void 0 : _a.length) && !slots.prefix),
  32670. ns.is("right-space", !((_b = props.modelValue) == null ? void 0 : _b.length) && !showSuffix.value)
  32671. ];
  32672. });
  32673. const showClear = computed(() => {
  32674. var _a;
  32675. return props.clearable && !disabled.value && !props.readonly && (((_a = props.modelValue) == null ? void 0 : _a.length) || inputValue.value) && (isFocused.value || hovering.value);
  32676. });
  32677. const showSuffix = computed(() => {
  32678. return slots.suffix || showClear.value || validateState.value && validateIcon.value && needStatusIcon.value;
  32679. });
  32680. return {
  32681. ns,
  32682. nsInput,
  32683. containerKls,
  32684. containerStyle,
  32685. innerKls,
  32686. showClear,
  32687. showSuffix
  32688. };
  32689. }
  32690. const __default__$S = defineComponent({
  32691. name: "ElInputTag",
  32692. inheritAttrs: false
  32693. });
  32694. const _sfc_main$17 = /* @__PURE__ */ defineComponent({
  32695. ...__default__$S,
  32696. props: inputTagProps,
  32697. emits: inputTagEmits,
  32698. setup(__props, { expose, emit }) {
  32699. const props = __props;
  32700. const attrs = useAttrs();
  32701. const slots = useSlots();
  32702. const { form, formItem } = useFormItem();
  32703. const { inputId } = useFormItemInputId(props, { formItemContext: formItem });
  32704. const needStatusIcon = computed(() => {
  32705. var _a;
  32706. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  32707. });
  32708. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  32709. const validateIcon = computed(() => {
  32710. return validateState.value && ValidateComponentsMap[validateState.value];
  32711. });
  32712. const {
  32713. inputRef,
  32714. wrapperRef,
  32715. isFocused,
  32716. inputValue,
  32717. size,
  32718. tagSize,
  32719. placeholder,
  32720. closable,
  32721. disabled,
  32722. handleDragged,
  32723. handleInput,
  32724. handleKeydown,
  32725. handleRemoveTag,
  32726. handleClear,
  32727. handleCompositionStart,
  32728. handleCompositionUpdate,
  32729. handleCompositionEnd,
  32730. focus,
  32731. blur
  32732. } = useInputTag({ props, emit, formItem });
  32733. const { hovering, handleMouseEnter, handleMouseLeave } = useHovering();
  32734. const { calculatorRef, inputStyle } = useCalcInputWidth();
  32735. const {
  32736. dropIndicatorRef,
  32737. showDropIndicator,
  32738. handleDragStart,
  32739. handleDragOver,
  32740. handleDragEnd
  32741. } = useDragTag({ wrapperRef, handleDragged, afterDragged: focus });
  32742. const {
  32743. ns,
  32744. nsInput,
  32745. containerKls,
  32746. containerStyle,
  32747. innerKls,
  32748. showClear,
  32749. showSuffix
  32750. } = useInputTagDom({
  32751. props,
  32752. hovering,
  32753. isFocused,
  32754. inputValue,
  32755. disabled,
  32756. size,
  32757. validateState,
  32758. validateIcon,
  32759. needStatusIcon
  32760. });
  32761. expose({
  32762. focus,
  32763. blur
  32764. });
  32765. return (_ctx, _cache) => {
  32766. return openBlock(), createElementBlock("div", {
  32767. ref_key: "wrapperRef",
  32768. ref: wrapperRef,
  32769. class: normalizeClass(unref(containerKls)),
  32770. style: normalizeStyle(unref(containerStyle)),
  32771. onMouseenter: unref(handleMouseEnter),
  32772. onMouseleave: unref(handleMouseLeave)
  32773. }, [
  32774. unref(slots).prefix ? (openBlock(), createElementBlock("div", {
  32775. key: 0,
  32776. class: normalizeClass(unref(ns).e("prefix"))
  32777. }, [
  32778. renderSlot(_ctx.$slots, "prefix")
  32779. ], 2)) : createCommentVNode("v-if", true),
  32780. createElementVNode("div", {
  32781. class: normalizeClass(unref(innerKls))
  32782. }, [
  32783. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.modelValue, (item, index) => {
  32784. return openBlock(), createBlock(unref(ElTag), {
  32785. key: index,
  32786. size: unref(tagSize),
  32787. closable: unref(closable),
  32788. type: _ctx.tagType,
  32789. effect: _ctx.tagEffect,
  32790. draggable: unref(closable) && _ctx.draggable,
  32791. "disable-transitions": "",
  32792. onClose: ($event) => unref(handleRemoveTag)(index),
  32793. onDragstart: (event) => unref(handleDragStart)(event, index),
  32794. onDragover: (event) => unref(handleDragOver)(event, index),
  32795. onDragend: unref(handleDragEnd),
  32796. onDrop: withModifiers(() => {
  32797. }, ["stop"])
  32798. }, {
  32799. default: withCtx(() => [
  32800. renderSlot(_ctx.$slots, "tag", {
  32801. value: item,
  32802. index
  32803. }, () => [
  32804. createTextVNode(toDisplayString(item), 1)
  32805. ])
  32806. ]),
  32807. _: 2
  32808. }, 1032, ["size", "closable", "type", "effect", "draggable", "onClose", "onDragstart", "onDragover", "onDragend", "onDrop"]);
  32809. }), 128)),
  32810. createElementVNode("div", {
  32811. class: normalizeClass(unref(ns).e("input-wrapper"))
  32812. }, [
  32813. withDirectives(createElementVNode("input", mergeProps({
  32814. id: unref(inputId),
  32815. ref_key: "inputRef",
  32816. ref: inputRef,
  32817. "onUpdate:modelValue": ($event) => isRef(inputValue) ? inputValue.value = $event : null
  32818. }, unref(attrs), {
  32819. type: "text",
  32820. minlength: _ctx.minlength,
  32821. maxlength: _ctx.maxlength,
  32822. disabled: unref(disabled),
  32823. readonly: _ctx.readonly,
  32824. autocomplete: _ctx.autocomplete,
  32825. tabindex: _ctx.tabindex,
  32826. placeholder: unref(placeholder),
  32827. autofocus: _ctx.autofocus,
  32828. ariaLabel: _ctx.ariaLabel,
  32829. class: unref(ns).e("input"),
  32830. style: unref(inputStyle),
  32831. onCompositionstart: unref(handleCompositionStart),
  32832. onCompositionupdate: unref(handleCompositionUpdate),
  32833. onCompositionend: unref(handleCompositionEnd),
  32834. onInput: unref(handleInput),
  32835. onKeydown: unref(handleKeydown)
  32836. }), null, 16, ["id", "onUpdate:modelValue", "minlength", "maxlength", "disabled", "readonly", "autocomplete", "tabindex", "placeholder", "autofocus", "ariaLabel", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onKeydown"]), [
  32837. [vModelText, unref(inputValue)]
  32838. ]),
  32839. createElementVNode("span", {
  32840. ref_key: "calculatorRef",
  32841. ref: calculatorRef,
  32842. "aria-hidden": "true",
  32843. class: normalizeClass(unref(ns).e("input-calculator")),
  32844. textContent: toDisplayString(unref(inputValue))
  32845. }, null, 10, ["textContent"])
  32846. ], 2),
  32847. withDirectives(createElementVNode("div", {
  32848. ref_key: "dropIndicatorRef",
  32849. ref: dropIndicatorRef,
  32850. class: normalizeClass(unref(ns).e("drop-indicator"))
  32851. }, null, 2), [
  32852. [vShow, unref(showDropIndicator)]
  32853. ])
  32854. ], 2),
  32855. unref(showSuffix) ? (openBlock(), createElementBlock("div", {
  32856. key: 1,
  32857. class: normalizeClass(unref(ns).e("suffix"))
  32858. }, [
  32859. renderSlot(_ctx.$slots, "suffix"),
  32860. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  32861. key: 0,
  32862. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("clear")]),
  32863. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  32864. onClick: unref(handleClear)
  32865. }, {
  32866. default: withCtx(() => [
  32867. createVNode(unref(circle_close_default))
  32868. ]),
  32869. _: 1
  32870. }, 8, ["class", "onMousedown", "onClick"])) : createCommentVNode("v-if", true),
  32871. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  32872. key: 1,
  32873. class: normalizeClass([
  32874. unref(nsInput).e("icon"),
  32875. unref(nsInput).e("validateIcon"),
  32876. unref(nsInput).is("loading", unref(validateState) === "validating")
  32877. ])
  32878. }, {
  32879. default: withCtx(() => [
  32880. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  32881. ]),
  32882. _: 1
  32883. }, 8, ["class"])) : createCommentVNode("v-if", true)
  32884. ], 2)) : createCommentVNode("v-if", true)
  32885. ], 46, ["onMouseenter", "onMouseleave"]);
  32886. };
  32887. }
  32888. });
  32889. var InputTag = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["__file", "input-tag.vue"]]);
  32890. const ElInputTag = withInstall(InputTag);
  32891. const linkProps = buildProps({
  32892. type: {
  32893. type: String,
  32894. values: ["primary", "success", "warning", "info", "danger", "default"],
  32895. default: "default"
  32896. },
  32897. underline: {
  32898. type: Boolean,
  32899. default: true
  32900. },
  32901. disabled: Boolean,
  32902. href: { type: String, default: "" },
  32903. target: {
  32904. type: String,
  32905. default: "_self"
  32906. },
  32907. icon: {
  32908. type: iconPropType
  32909. }
  32910. });
  32911. const linkEmits = {
  32912. click: (evt) => evt instanceof MouseEvent
  32913. };
  32914. const __default__$R = defineComponent({
  32915. name: "ElLink"
  32916. });
  32917. const _sfc_main$16 = /* @__PURE__ */ defineComponent({
  32918. ...__default__$R,
  32919. props: linkProps,
  32920. emits: linkEmits,
  32921. setup(__props, { emit }) {
  32922. const props = __props;
  32923. const ns = useNamespace("link");
  32924. const linkKls = computed(() => [
  32925. ns.b(),
  32926. ns.m(props.type),
  32927. ns.is("disabled", props.disabled),
  32928. ns.is("underline", props.underline && !props.disabled)
  32929. ]);
  32930. function handleClick(event) {
  32931. if (!props.disabled)
  32932. emit("click", event);
  32933. }
  32934. return (_ctx, _cache) => {
  32935. return openBlock(), createElementBlock("a", {
  32936. class: normalizeClass(unref(linkKls)),
  32937. href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href,
  32938. target: _ctx.disabled || !_ctx.href ? void 0 : _ctx.target,
  32939. onClick: handleClick
  32940. }, [
  32941. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  32942. default: withCtx(() => [
  32943. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  32944. ]),
  32945. _: 1
  32946. })) : createCommentVNode("v-if", true),
  32947. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  32948. key: 1,
  32949. class: normalizeClass(unref(ns).e("inner"))
  32950. }, [
  32951. renderSlot(_ctx.$slots, "default")
  32952. ], 2)) : createCommentVNode("v-if", true),
  32953. _ctx.$slots.icon ? renderSlot(_ctx.$slots, "icon", { key: 2 }) : createCommentVNode("v-if", true)
  32954. ], 10, ["href", "target"]);
  32955. };
  32956. }
  32957. });
  32958. var Link = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["__file", "link.vue"]]);
  32959. const ElLink = withInstall(Link);
  32960. class SubMenu$1 {
  32961. constructor(parent, domNode) {
  32962. this.parent = parent;
  32963. this.domNode = domNode;
  32964. this.subIndex = 0;
  32965. this.subIndex = 0;
  32966. this.init();
  32967. }
  32968. init() {
  32969. this.subMenuItems = this.domNode.querySelectorAll("li");
  32970. this.addListeners();
  32971. }
  32972. gotoSubIndex(idx) {
  32973. if (idx === this.subMenuItems.length) {
  32974. idx = 0;
  32975. } else if (idx < 0) {
  32976. idx = this.subMenuItems.length - 1;
  32977. }
  32978. this.subMenuItems[idx].focus();
  32979. this.subIndex = idx;
  32980. }
  32981. addListeners() {
  32982. const parentNode = this.parent.domNode;
  32983. Array.prototype.forEach.call(this.subMenuItems, (el) => {
  32984. el.addEventListener("keydown", (event) => {
  32985. let prevDef = false;
  32986. switch (event.code) {
  32987. case EVENT_CODE.down: {
  32988. this.gotoSubIndex(this.subIndex + 1);
  32989. prevDef = true;
  32990. break;
  32991. }
  32992. case EVENT_CODE.up: {
  32993. this.gotoSubIndex(this.subIndex - 1);
  32994. prevDef = true;
  32995. break;
  32996. }
  32997. case EVENT_CODE.tab: {
  32998. triggerEvent(parentNode, "mouseleave");
  32999. break;
  33000. }
  33001. case EVENT_CODE.enter:
  33002. case EVENT_CODE.numpadEnter:
  33003. case EVENT_CODE.space: {
  33004. prevDef = true;
  33005. event.currentTarget.click();
  33006. break;
  33007. }
  33008. }
  33009. if (prevDef) {
  33010. event.preventDefault();
  33011. event.stopPropagation();
  33012. }
  33013. return false;
  33014. });
  33015. });
  33016. }
  33017. }
  33018. var SubMenu$2 = SubMenu$1;
  33019. class MenuItem$1 {
  33020. constructor(domNode, namespace) {
  33021. this.domNode = domNode;
  33022. this.submenu = null;
  33023. this.submenu = null;
  33024. this.init(namespace);
  33025. }
  33026. init(namespace) {
  33027. this.domNode.setAttribute("tabindex", "0");
  33028. const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
  33029. if (menuChild) {
  33030. this.submenu = new SubMenu$2(this, menuChild);
  33031. }
  33032. this.addListeners();
  33033. }
  33034. addListeners() {
  33035. this.domNode.addEventListener("keydown", (event) => {
  33036. let prevDef = false;
  33037. switch (event.code) {
  33038. case EVENT_CODE.down: {
  33039. triggerEvent(event.currentTarget, "mouseenter");
  33040. this.submenu && this.submenu.gotoSubIndex(0);
  33041. prevDef = true;
  33042. break;
  33043. }
  33044. case EVENT_CODE.up: {
  33045. triggerEvent(event.currentTarget, "mouseenter");
  33046. this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1);
  33047. prevDef = true;
  33048. break;
  33049. }
  33050. case EVENT_CODE.tab: {
  33051. triggerEvent(event.currentTarget, "mouseleave");
  33052. break;
  33053. }
  33054. case EVENT_CODE.enter:
  33055. case EVENT_CODE.numpadEnter:
  33056. case EVENT_CODE.space: {
  33057. prevDef = true;
  33058. event.currentTarget.click();
  33059. break;
  33060. }
  33061. }
  33062. if (prevDef) {
  33063. event.preventDefault();
  33064. }
  33065. });
  33066. }
  33067. }
  33068. var MenuItem$2 = MenuItem$1;
  33069. class Menu$1 {
  33070. constructor(domNode, namespace) {
  33071. this.domNode = domNode;
  33072. this.init(namespace);
  33073. }
  33074. init(namespace) {
  33075. const menuChildren = this.domNode.childNodes;
  33076. Array.from(menuChildren).forEach((child) => {
  33077. if (child.nodeType === 1) {
  33078. new MenuItem$2(child, namespace);
  33079. }
  33080. });
  33081. }
  33082. }
  33083. var Menubar = Menu$1;
  33084. const _sfc_main$15 = defineComponent({
  33085. name: "ElMenuCollapseTransition",
  33086. setup() {
  33087. const ns = useNamespace("menu");
  33088. const listeners = {
  33089. onBeforeEnter: (el) => el.style.opacity = "0.2",
  33090. onEnter(el, done) {
  33091. addClass(el, `${ns.namespace.value}-opacity-transition`);
  33092. el.style.opacity = "1";
  33093. done();
  33094. },
  33095. onAfterEnter(el) {
  33096. removeClass(el, `${ns.namespace.value}-opacity-transition`);
  33097. el.style.opacity = "";
  33098. },
  33099. onBeforeLeave(el) {
  33100. if (!el.dataset) {
  33101. el.dataset = {};
  33102. }
  33103. if (hasClass(el, ns.m("collapse"))) {
  33104. removeClass(el, ns.m("collapse"));
  33105. el.dataset.oldOverflow = el.style.overflow;
  33106. el.dataset.scrollWidth = el.clientWidth.toString();
  33107. addClass(el, ns.m("collapse"));
  33108. } else {
  33109. addClass(el, ns.m("collapse"));
  33110. el.dataset.oldOverflow = el.style.overflow;
  33111. el.dataset.scrollWidth = el.clientWidth.toString();
  33112. removeClass(el, ns.m("collapse"));
  33113. }
  33114. el.style.width = `${el.scrollWidth}px`;
  33115. el.style.overflow = "hidden";
  33116. },
  33117. onLeave(el) {
  33118. addClass(el, "horizontal-collapse-transition");
  33119. el.style.width = `${el.dataset.scrollWidth}px`;
  33120. }
  33121. };
  33122. return {
  33123. listeners
  33124. };
  33125. }
  33126. });
  33127. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  33128. return openBlock(), createBlock(Transition, mergeProps({ mode: "out-in" }, _ctx.listeners), {
  33129. default: withCtx(() => [
  33130. renderSlot(_ctx.$slots, "default")
  33131. ]),
  33132. _: 3
  33133. }, 16);
  33134. }
  33135. var ElMenuCollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["render", _sfc_render$e], ["__file", "menu-collapse-transition.vue"]]);
  33136. function useMenu(instance, currentIndex) {
  33137. const indexPath = computed(() => {
  33138. let parent = instance.parent;
  33139. const path = [currentIndex.value];
  33140. while (parent.type.name !== "ElMenu") {
  33141. if (parent.props.index) {
  33142. path.unshift(parent.props.index);
  33143. }
  33144. parent = parent.parent;
  33145. }
  33146. return path;
  33147. });
  33148. const parentMenu = computed(() => {
  33149. let parent = instance.parent;
  33150. while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) {
  33151. parent = parent.parent;
  33152. }
  33153. return parent;
  33154. });
  33155. return {
  33156. parentMenu,
  33157. indexPath
  33158. };
  33159. }
  33160. function useMenuColor(props) {
  33161. const menuBarColor = computed(() => {
  33162. const color = props.backgroundColor;
  33163. if (!color) {
  33164. return "";
  33165. } else {
  33166. return new TinyColor(color).shade(20).toString();
  33167. }
  33168. });
  33169. return menuBarColor;
  33170. }
  33171. const useMenuCssVar = (props, level) => {
  33172. const ns = useNamespace("menu");
  33173. return computed(() => {
  33174. return ns.cssVarBlock({
  33175. "text-color": props.textColor || "",
  33176. "hover-text-color": props.textColor || "",
  33177. "bg-color": props.backgroundColor || "",
  33178. "hover-bg-color": useMenuColor(props).value || "",
  33179. "active-color": props.activeTextColor || "",
  33180. level: `${level}`
  33181. });
  33182. });
  33183. };
  33184. const subMenuProps = buildProps({
  33185. index: {
  33186. type: String,
  33187. required: true
  33188. },
  33189. showTimeout: Number,
  33190. hideTimeout: Number,
  33191. popperClass: String,
  33192. disabled: Boolean,
  33193. teleported: {
  33194. type: Boolean,
  33195. default: void 0
  33196. },
  33197. popperOffset: Number,
  33198. expandCloseIcon: {
  33199. type: iconPropType
  33200. },
  33201. expandOpenIcon: {
  33202. type: iconPropType
  33203. },
  33204. collapseCloseIcon: {
  33205. type: iconPropType
  33206. },
  33207. collapseOpenIcon: {
  33208. type: iconPropType
  33209. }
  33210. });
  33211. const COMPONENT_NAME$c = "ElSubMenu";
  33212. var SubMenu = defineComponent({
  33213. name: COMPONENT_NAME$c,
  33214. props: subMenuProps,
  33215. setup(props, { slots, expose }) {
  33216. const instance = getCurrentInstance();
  33217. const { indexPath, parentMenu } = useMenu(instance, computed(() => props.index));
  33218. const nsMenu = useNamespace("menu");
  33219. const nsSubMenu = useNamespace("sub-menu");
  33220. const rootMenu = inject("rootMenu");
  33221. if (!rootMenu)
  33222. throwError(COMPONENT_NAME$c, "can not inject root menu");
  33223. const subMenu = inject(`subMenu:${parentMenu.value.uid}`);
  33224. if (!subMenu)
  33225. throwError(COMPONENT_NAME$c, "can not inject sub menu");
  33226. const items = ref({});
  33227. const subMenus = ref({});
  33228. let timeout;
  33229. const mouseInChild = ref(false);
  33230. const verticalTitleRef = ref();
  33231. const vPopper = ref(null);
  33232. const currentPlacement = computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
  33233. const subMenuTitleIcon = computed(() => {
  33234. 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;
  33235. });
  33236. const isFirstLevel = computed(() => {
  33237. return subMenu.level === 0;
  33238. });
  33239. const appendToBody = computed(() => {
  33240. const value = props.teleported;
  33241. return value === void 0 ? isFirstLevel.value : value;
  33242. });
  33243. const menuTransitionName = computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
  33244. const fallbackPlacements = computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
  33245. "bottom-start",
  33246. "bottom-end",
  33247. "top-start",
  33248. "top-end",
  33249. "right-start",
  33250. "left-start"
  33251. ] : [
  33252. "right-start",
  33253. "right",
  33254. "right-end",
  33255. "left-start",
  33256. "bottom-start",
  33257. "bottom-end",
  33258. "top-start",
  33259. "top-end"
  33260. ]);
  33261. const opened = computed(() => rootMenu.openedMenus.includes(props.index));
  33262. const active = computed(() => {
  33263. let isActive = false;
  33264. Object.values(items.value).forEach((item2) => {
  33265. if (item2.active) {
  33266. isActive = true;
  33267. }
  33268. });
  33269. Object.values(subMenus.value).forEach((subItem) => {
  33270. if (subItem.active) {
  33271. isActive = true;
  33272. }
  33273. });
  33274. return isActive;
  33275. });
  33276. const mode = computed(() => rootMenu.props.mode);
  33277. const item = reactive({
  33278. index: props.index,
  33279. indexPath,
  33280. active
  33281. });
  33282. const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
  33283. const subMenuPopperOffset = computed(() => {
  33284. var _a;
  33285. return (_a = props.popperOffset) != null ? _a : rootMenu.props.popperOffset;
  33286. });
  33287. const subMenuPopperClass = computed(() => {
  33288. var _a;
  33289. return (_a = props.popperClass) != null ? _a : rootMenu.props.popperClass;
  33290. });
  33291. const subMenuShowTimeout = computed(() => {
  33292. var _a;
  33293. return (_a = props.showTimeout) != null ? _a : rootMenu.props.showTimeout;
  33294. });
  33295. const subMenuHideTimeout = computed(() => {
  33296. var _a;
  33297. return (_a = props.hideTimeout) != null ? _a : rootMenu.props.hideTimeout;
  33298. });
  33299. const doDestroy = () => {
  33300. var _a, _b, _c;
  33301. return (_c = (_b = (_a = vPopper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.popperInstanceRef) == null ? void 0 : _c.destroy();
  33302. };
  33303. const handleCollapseToggle = (value) => {
  33304. if (!value) {
  33305. doDestroy();
  33306. }
  33307. };
  33308. const handleClick = () => {
  33309. if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled)
  33310. return;
  33311. rootMenu.handleSubMenuClick({
  33312. index: props.index,
  33313. indexPath: indexPath.value,
  33314. active: active.value
  33315. });
  33316. };
  33317. const handleMouseenter = (event, showTimeout = subMenuShowTimeout.value) => {
  33318. var _a;
  33319. if (event.type === "focus") {
  33320. return;
  33321. }
  33322. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
  33323. subMenu.mouseInChild.value = true;
  33324. return;
  33325. }
  33326. subMenu.mouseInChild.value = true;
  33327. timeout == null ? void 0 : timeout();
  33328. ({ stop: timeout } = useTimeoutFn(() => {
  33329. rootMenu.openMenu(props.index, indexPath.value);
  33330. }, showTimeout));
  33331. if (appendToBody.value) {
  33332. (_a = parentMenu.value.vnode.el) == null ? void 0 : _a.dispatchEvent(new MouseEvent("mouseenter"));
  33333. }
  33334. };
  33335. const handleMouseleave = (deepDispatch = false) => {
  33336. var _a;
  33337. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
  33338. subMenu.mouseInChild.value = false;
  33339. return;
  33340. }
  33341. timeout == null ? void 0 : timeout();
  33342. subMenu.mouseInChild.value = false;
  33343. ({ stop: timeout } = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), subMenuHideTimeout.value));
  33344. if (appendToBody.value && deepDispatch) {
  33345. (_a = subMenu.handleMouseleave) == null ? void 0 : _a.call(subMenu, true);
  33346. }
  33347. };
  33348. watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
  33349. {
  33350. const addSubMenu = (item2) => {
  33351. subMenus.value[item2.index] = item2;
  33352. };
  33353. const removeSubMenu = (item2) => {
  33354. delete subMenus.value[item2.index];
  33355. };
  33356. provide(`subMenu:${instance.uid}`, {
  33357. addSubMenu,
  33358. removeSubMenu,
  33359. handleMouseleave,
  33360. mouseInChild,
  33361. level: subMenu.level + 1
  33362. });
  33363. }
  33364. expose({
  33365. opened
  33366. });
  33367. onMounted(() => {
  33368. rootMenu.addSubMenu(item);
  33369. subMenu.addSubMenu(item);
  33370. });
  33371. onBeforeUnmount(() => {
  33372. subMenu.removeSubMenu(item);
  33373. rootMenu.removeSubMenu(item);
  33374. });
  33375. return () => {
  33376. var _a;
  33377. const titleTag = [
  33378. (_a = slots.title) == null ? void 0 : _a.call(slots),
  33379. h$1(ElIcon, {
  33380. class: nsSubMenu.e("icon-arrow"),
  33381. style: {
  33382. transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none"
  33383. }
  33384. }, {
  33385. default: () => isString$1(subMenuTitleIcon.value) ? h$1(instance.appContext.components[subMenuTitleIcon.value]) : h$1(subMenuTitleIcon.value)
  33386. })
  33387. ];
  33388. const child = rootMenu.isMenuPopup ? h$1(ElTooltip, {
  33389. ref: vPopper,
  33390. visible: opened.value,
  33391. effect: "light",
  33392. pure: true,
  33393. offset: subMenuPopperOffset.value,
  33394. showArrow: false,
  33395. persistent: true,
  33396. popperClass: subMenuPopperClass.value,
  33397. placement: currentPlacement.value,
  33398. teleported: appendToBody.value,
  33399. fallbackPlacements: fallbackPlacements.value,
  33400. transition: menuTransitionName.value,
  33401. gpuAcceleration: false
  33402. }, {
  33403. content: () => {
  33404. var _a2;
  33405. return h$1("div", {
  33406. class: [
  33407. nsMenu.m(mode.value),
  33408. nsMenu.m("popup-container"),
  33409. subMenuPopperClass.value
  33410. ],
  33411. onMouseenter: (evt) => handleMouseenter(evt, 100),
  33412. onMouseleave: () => handleMouseleave(true),
  33413. onFocus: (evt) => handleMouseenter(evt, 100)
  33414. }, [
  33415. h$1("ul", {
  33416. class: [
  33417. nsMenu.b(),
  33418. nsMenu.m("popup"),
  33419. nsMenu.m(`popup-${currentPlacement.value}`)
  33420. ],
  33421. style: ulStyle.value
  33422. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])
  33423. ]);
  33424. },
  33425. default: () => h$1("div", {
  33426. class: nsSubMenu.e("title"),
  33427. onClick: handleClick
  33428. }, titleTag)
  33429. }) : h$1(Fragment, {}, [
  33430. h$1("div", {
  33431. class: nsSubMenu.e("title"),
  33432. ref: verticalTitleRef,
  33433. onClick: handleClick
  33434. }, titleTag),
  33435. h$1(ElCollapseTransition, {}, {
  33436. default: () => {
  33437. var _a2;
  33438. return withDirectives(h$1("ul", {
  33439. role: "menu",
  33440. class: [nsMenu.b(), nsMenu.m("inline")],
  33441. style: ulStyle.value
  33442. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]), [[vShow, opened.value]]);
  33443. }
  33444. })
  33445. ]);
  33446. return h$1("li", {
  33447. class: [
  33448. nsSubMenu.b(),
  33449. nsSubMenu.is("active", active.value),
  33450. nsSubMenu.is("opened", opened.value),
  33451. nsSubMenu.is("disabled", props.disabled)
  33452. ],
  33453. role: "menuitem",
  33454. ariaHaspopup: true,
  33455. ariaExpanded: opened.value,
  33456. onMouseenter: handleMouseenter,
  33457. onMouseleave: () => handleMouseleave(),
  33458. onFocus: handleMouseenter
  33459. }, [child]);
  33460. };
  33461. }
  33462. });
  33463. const menuProps = buildProps({
  33464. mode: {
  33465. type: String,
  33466. values: ["horizontal", "vertical"],
  33467. default: "vertical"
  33468. },
  33469. defaultActive: {
  33470. type: String,
  33471. default: ""
  33472. },
  33473. defaultOpeneds: {
  33474. type: definePropType(Array),
  33475. default: () => mutable([])
  33476. },
  33477. uniqueOpened: Boolean,
  33478. router: Boolean,
  33479. menuTrigger: {
  33480. type: String,
  33481. values: ["hover", "click"],
  33482. default: "hover"
  33483. },
  33484. collapse: Boolean,
  33485. backgroundColor: String,
  33486. textColor: String,
  33487. activeTextColor: String,
  33488. closeOnClickOutside: Boolean,
  33489. collapseTransition: {
  33490. type: Boolean,
  33491. default: true
  33492. },
  33493. ellipsis: {
  33494. type: Boolean,
  33495. default: true
  33496. },
  33497. popperOffset: {
  33498. type: Number,
  33499. default: 6
  33500. },
  33501. ellipsisIcon: {
  33502. type: iconPropType,
  33503. default: () => more_default
  33504. },
  33505. popperEffect: {
  33506. type: definePropType(String),
  33507. default: "dark"
  33508. },
  33509. popperClass: String,
  33510. showTimeout: {
  33511. type: Number,
  33512. default: 300
  33513. },
  33514. hideTimeout: {
  33515. type: Number,
  33516. default: 300
  33517. }
  33518. });
  33519. const checkIndexPath = (indexPath) => isArray$1(indexPath) && indexPath.every((path) => isString$1(path));
  33520. const menuEmits = {
  33521. close: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  33522. open: (index, indexPath) => isString$1(index) && checkIndexPath(indexPath),
  33523. select: (index, indexPath, item, routerResult) => isString$1(index) && checkIndexPath(indexPath) && isObject$1(item) && (routerResult === void 0 || routerResult instanceof Promise)
  33524. };
  33525. var Menu = defineComponent({
  33526. name: "ElMenu",
  33527. props: menuProps,
  33528. emits: menuEmits,
  33529. setup(props, { emit, slots, expose }) {
  33530. const instance = getCurrentInstance();
  33531. const router = instance.appContext.config.globalProperties.$router;
  33532. const menu = ref();
  33533. const nsMenu = useNamespace("menu");
  33534. const nsSubMenu = useNamespace("sub-menu");
  33535. const sliceIndex = ref(-1);
  33536. const openedMenus = ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
  33537. const activeIndex = ref(props.defaultActive);
  33538. const items = ref({});
  33539. const subMenus = ref({});
  33540. const isMenuPopup = computed(() => {
  33541. return props.mode === "horizontal" || props.mode === "vertical" && props.collapse;
  33542. });
  33543. const initMenu = () => {
  33544. const activeItem = activeIndex.value && items.value[activeIndex.value];
  33545. if (!activeItem || props.mode === "horizontal" || props.collapse)
  33546. return;
  33547. const indexPath = activeItem.indexPath;
  33548. indexPath.forEach((index) => {
  33549. const subMenu = subMenus.value[index];
  33550. subMenu && openMenu(index, subMenu.indexPath);
  33551. });
  33552. };
  33553. const openMenu = (index, indexPath) => {
  33554. if (openedMenus.value.includes(index))
  33555. return;
  33556. if (props.uniqueOpened) {
  33557. openedMenus.value = openedMenus.value.filter((index2) => indexPath.includes(index2));
  33558. }
  33559. openedMenus.value.push(index);
  33560. emit("open", index, indexPath);
  33561. };
  33562. const close = (index) => {
  33563. const i = openedMenus.value.indexOf(index);
  33564. if (i !== -1) {
  33565. openedMenus.value.splice(i, 1);
  33566. }
  33567. };
  33568. const closeMenu = (index, indexPath) => {
  33569. close(index);
  33570. emit("close", index, indexPath);
  33571. };
  33572. const handleSubMenuClick = ({
  33573. index,
  33574. indexPath
  33575. }) => {
  33576. const isOpened = openedMenus.value.includes(index);
  33577. if (isOpened) {
  33578. closeMenu(index, indexPath);
  33579. } else {
  33580. openMenu(index, indexPath);
  33581. }
  33582. };
  33583. const handleMenuItemClick = (menuItem) => {
  33584. if (props.mode === "horizontal" || props.collapse) {
  33585. openedMenus.value = [];
  33586. }
  33587. const { index, indexPath } = menuItem;
  33588. if (isNil(index) || isNil(indexPath))
  33589. return;
  33590. if (props.router && router) {
  33591. const route = menuItem.route || index;
  33592. const routerResult = router.push(route).then((res) => {
  33593. if (!res)
  33594. activeIndex.value = index;
  33595. return res;
  33596. });
  33597. emit("select", index, indexPath, { index, indexPath, route }, routerResult);
  33598. } else {
  33599. activeIndex.value = index;
  33600. emit("select", index, indexPath, { index, indexPath });
  33601. }
  33602. };
  33603. const updateActiveIndex = (val) => {
  33604. const itemsInData = items.value;
  33605. const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive];
  33606. if (item) {
  33607. activeIndex.value = item.index;
  33608. } else {
  33609. activeIndex.value = val;
  33610. }
  33611. };
  33612. const calcMenuItemWidth = (menuItem) => {
  33613. const computedStyle = getComputedStyle(menuItem);
  33614. const marginLeft = Number.parseInt(computedStyle.marginLeft, 10);
  33615. const marginRight = Number.parseInt(computedStyle.marginRight, 10);
  33616. return menuItem.offsetWidth + marginLeft + marginRight || 0;
  33617. };
  33618. const calcSliceIndex = () => {
  33619. var _a, _b;
  33620. if (!menu.value)
  33621. return -1;
  33622. const items2 = Array.from((_b = (_a = menu.value) == null ? void 0 : _a.childNodes) != null ? _b : []).filter((item) => item.nodeName !== "#comment" && (item.nodeName !== "#text" || item.nodeValue));
  33623. const moreItemWidth = 64;
  33624. const computedMenuStyle = getComputedStyle(menu.value);
  33625. const paddingLeft = Number.parseInt(computedMenuStyle.paddingLeft, 10);
  33626. const paddingRight = Number.parseInt(computedMenuStyle.paddingRight, 10);
  33627. const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
  33628. let calcWidth = 0;
  33629. let sliceIndex2 = 0;
  33630. items2.forEach((item, index) => {
  33631. calcWidth += calcMenuItemWidth(item);
  33632. if (calcWidth <= menuWidth - moreItemWidth) {
  33633. sliceIndex2 = index + 1;
  33634. }
  33635. });
  33636. return sliceIndex2 === items2.length ? -1 : sliceIndex2;
  33637. };
  33638. const getIndexPath = (index) => subMenus.value[index].indexPath;
  33639. const debounce = (fn, wait = 33.34) => {
  33640. let timmer;
  33641. return () => {
  33642. timmer && clearTimeout(timmer);
  33643. timmer = setTimeout(() => {
  33644. fn();
  33645. }, wait);
  33646. };
  33647. };
  33648. let isFirstTimeRender = true;
  33649. const handleResize = () => {
  33650. if (sliceIndex.value === calcSliceIndex())
  33651. return;
  33652. const callback = () => {
  33653. sliceIndex.value = -1;
  33654. nextTick(() => {
  33655. sliceIndex.value = calcSliceIndex();
  33656. });
  33657. };
  33658. isFirstTimeRender ? callback() : debounce(callback)();
  33659. isFirstTimeRender = false;
  33660. };
  33661. watch(() => props.defaultActive, (currentActive) => {
  33662. if (!items.value[currentActive]) {
  33663. activeIndex.value = "";
  33664. }
  33665. updateActiveIndex(currentActive);
  33666. });
  33667. watch(() => props.collapse, (value) => {
  33668. if (value)
  33669. openedMenus.value = [];
  33670. });
  33671. watch(items.value, initMenu);
  33672. let resizeStopper;
  33673. watchEffect(() => {
  33674. if (props.mode === "horizontal" && props.ellipsis)
  33675. resizeStopper = useResizeObserver(menu, handleResize).stop;
  33676. else
  33677. resizeStopper == null ? void 0 : resizeStopper();
  33678. });
  33679. const mouseInChild = ref(false);
  33680. {
  33681. const addSubMenu = (item) => {
  33682. subMenus.value[item.index] = item;
  33683. };
  33684. const removeSubMenu = (item) => {
  33685. delete subMenus.value[item.index];
  33686. };
  33687. const addMenuItem = (item) => {
  33688. items.value[item.index] = item;
  33689. };
  33690. const removeMenuItem = (item) => {
  33691. delete items.value[item.index];
  33692. };
  33693. provide("rootMenu", reactive({
  33694. props,
  33695. openedMenus,
  33696. items,
  33697. subMenus,
  33698. activeIndex,
  33699. isMenuPopup,
  33700. addMenuItem,
  33701. removeMenuItem,
  33702. addSubMenu,
  33703. removeSubMenu,
  33704. openMenu,
  33705. closeMenu,
  33706. handleMenuItemClick,
  33707. handleSubMenuClick
  33708. }));
  33709. provide(`subMenu:${instance.uid}`, {
  33710. addSubMenu,
  33711. removeSubMenu,
  33712. mouseInChild,
  33713. level: 0
  33714. });
  33715. }
  33716. onMounted(() => {
  33717. if (props.mode === "horizontal") {
  33718. new Menubar(instance.vnode.el, nsMenu.namespace.value);
  33719. }
  33720. });
  33721. {
  33722. const open = (index) => {
  33723. const { indexPath } = subMenus.value[index];
  33724. indexPath.forEach((i) => openMenu(i, indexPath));
  33725. };
  33726. expose({
  33727. open,
  33728. close,
  33729. handleResize
  33730. });
  33731. }
  33732. const ulStyle = useMenuCssVar(props, 0);
  33733. return () => {
  33734. var _a, _b;
  33735. let slot = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : [];
  33736. const vShowMore = [];
  33737. if (props.mode === "horizontal" && menu.value) {
  33738. const originalSlot = flattedChildren(slot);
  33739. const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
  33740. const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
  33741. if ((slotMore == null ? void 0 : slotMore.length) && props.ellipsis) {
  33742. slot = slotDefault;
  33743. vShowMore.push(h$1(SubMenu, {
  33744. index: "sub-menu-more",
  33745. class: nsSubMenu.e("hide-arrow"),
  33746. popperOffset: props.popperOffset
  33747. }, {
  33748. title: () => h$1(ElIcon, {
  33749. class: nsSubMenu.e("icon-more")
  33750. }, {
  33751. default: () => h$1(props.ellipsisIcon)
  33752. }),
  33753. default: () => slotMore
  33754. }));
  33755. }
  33756. }
  33757. const directives = props.closeOnClickOutside ? [
  33758. [
  33759. ClickOutside,
  33760. () => {
  33761. if (!openedMenus.value.length)
  33762. return;
  33763. if (!mouseInChild.value) {
  33764. openedMenus.value.forEach((openedMenu) => emit("close", openedMenu, getIndexPath(openedMenu)));
  33765. openedMenus.value = [];
  33766. }
  33767. }
  33768. ]
  33769. ] : [];
  33770. const vMenu = withDirectives(h$1("ul", {
  33771. key: String(props.collapse),
  33772. role: "menubar",
  33773. ref: menu,
  33774. style: ulStyle.value,
  33775. class: {
  33776. [nsMenu.b()]: true,
  33777. [nsMenu.m(props.mode)]: true,
  33778. [nsMenu.m("collapse")]: props.collapse
  33779. }
  33780. }, [...slot, ...vShowMore]), directives);
  33781. if (props.collapseTransition && props.mode === "vertical") {
  33782. return h$1(ElMenuCollapseTransition, () => vMenu);
  33783. }
  33784. return vMenu;
  33785. };
  33786. }
  33787. });
  33788. const menuItemProps = buildProps({
  33789. index: {
  33790. type: definePropType([String, null]),
  33791. default: null
  33792. },
  33793. route: {
  33794. type: definePropType([String, Object])
  33795. },
  33796. disabled: Boolean
  33797. });
  33798. const menuItemEmits = {
  33799. click: (item) => isString$1(item.index) && isArray$1(item.indexPath)
  33800. };
  33801. const COMPONENT_NAME$b = "ElMenuItem";
  33802. const _sfc_main$14 = defineComponent({
  33803. name: COMPONENT_NAME$b,
  33804. components: {
  33805. ElTooltip
  33806. },
  33807. props: menuItemProps,
  33808. emits: menuItemEmits,
  33809. setup(props, { emit }) {
  33810. const instance = getCurrentInstance();
  33811. const rootMenu = inject("rootMenu");
  33812. const nsMenu = useNamespace("menu");
  33813. const nsMenuItem = useNamespace("menu-item");
  33814. if (!rootMenu)
  33815. throwError(COMPONENT_NAME$b, "can not inject root menu");
  33816. const { parentMenu, indexPath } = useMenu(instance, toRef(props, "index"));
  33817. const subMenu = inject(`subMenu:${parentMenu.value.uid}`);
  33818. if (!subMenu)
  33819. throwError(COMPONENT_NAME$b, "can not inject sub menu");
  33820. const active = computed(() => props.index === rootMenu.activeIndex);
  33821. const item = reactive({
  33822. index: props.index,
  33823. indexPath,
  33824. active
  33825. });
  33826. const handleClick = () => {
  33827. if (!props.disabled) {
  33828. rootMenu.handleMenuItemClick({
  33829. index: props.index,
  33830. indexPath: indexPath.value,
  33831. route: props.route
  33832. });
  33833. emit("click", item);
  33834. }
  33835. };
  33836. onMounted(() => {
  33837. subMenu.addSubMenu(item);
  33838. rootMenu.addMenuItem(item);
  33839. });
  33840. onBeforeUnmount(() => {
  33841. subMenu.removeSubMenu(item);
  33842. rootMenu.removeMenuItem(item);
  33843. });
  33844. return {
  33845. parentMenu,
  33846. rootMenu,
  33847. active,
  33848. nsMenu,
  33849. nsMenuItem,
  33850. handleClick
  33851. };
  33852. }
  33853. });
  33854. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  33855. const _component_el_tooltip = resolveComponent("el-tooltip");
  33856. return openBlock(), createElementBlock("li", {
  33857. class: normalizeClass([
  33858. _ctx.nsMenuItem.b(),
  33859. _ctx.nsMenuItem.is("active", _ctx.active),
  33860. _ctx.nsMenuItem.is("disabled", _ctx.disabled)
  33861. ]),
  33862. role: "menuitem",
  33863. tabindex: "-1",
  33864. onClick: _ctx.handleClick
  33865. }, [
  33866. _ctx.parentMenu.type.name === "ElMenu" && _ctx.rootMenu.props.collapse && _ctx.$slots.title ? (openBlock(), createBlock(_component_el_tooltip, {
  33867. key: 0,
  33868. effect: _ctx.rootMenu.props.popperEffect,
  33869. placement: "right",
  33870. "fallback-placements": ["left"],
  33871. persistent: ""
  33872. }, {
  33873. content: withCtx(() => [
  33874. renderSlot(_ctx.$slots, "title")
  33875. ]),
  33876. default: withCtx(() => [
  33877. createElementVNode("div", {
  33878. class: normalizeClass(_ctx.nsMenu.be("tooltip", "trigger"))
  33879. }, [
  33880. renderSlot(_ctx.$slots, "default")
  33881. ], 2)
  33882. ]),
  33883. _: 3
  33884. }, 8, ["effect"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  33885. renderSlot(_ctx.$slots, "default"),
  33886. renderSlot(_ctx.$slots, "title")
  33887. ], 64))
  33888. ], 10, ["onClick"]);
  33889. }
  33890. var MenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["render", _sfc_render$d], ["__file", "menu-item.vue"]]);
  33891. const menuItemGroupProps = {
  33892. title: String
  33893. };
  33894. const COMPONENT_NAME$a = "ElMenuItemGroup";
  33895. const _sfc_main$13 = defineComponent({
  33896. name: COMPONENT_NAME$a,
  33897. props: menuItemGroupProps,
  33898. setup() {
  33899. const ns = useNamespace("menu-item-group");
  33900. return {
  33901. ns
  33902. };
  33903. }
  33904. });
  33905. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  33906. return openBlock(), createElementBlock("li", {
  33907. class: normalizeClass(_ctx.ns.b())
  33908. }, [
  33909. createElementVNode("div", {
  33910. class: normalizeClass(_ctx.ns.e("title"))
  33911. }, [
  33912. !_ctx.$slots.title ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  33913. createTextVNode(toDisplayString(_ctx.title), 1)
  33914. ], 64)) : renderSlot(_ctx.$slots, "title", { key: 1 })
  33915. ], 2),
  33916. createElementVNode("ul", null, [
  33917. renderSlot(_ctx.$slots, "default")
  33918. ])
  33919. ], 2);
  33920. }
  33921. var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["render", _sfc_render$c], ["__file", "menu-item-group.vue"]]);
  33922. const ElMenu = withInstall(Menu, {
  33923. MenuItem,
  33924. MenuItemGroup,
  33925. SubMenu
  33926. });
  33927. const ElMenuItem = withNoopInstall(MenuItem);
  33928. const ElMenuItemGroup = withNoopInstall(MenuItemGroup);
  33929. const ElSubMenu = withNoopInstall(SubMenu);
  33930. const pageHeaderProps = buildProps({
  33931. icon: {
  33932. type: iconPropType,
  33933. default: () => back_default
  33934. },
  33935. title: String,
  33936. content: {
  33937. type: String,
  33938. default: ""
  33939. }
  33940. });
  33941. const pageHeaderEmits = {
  33942. back: () => true
  33943. };
  33944. const __default__$Q = defineComponent({
  33945. name: "ElPageHeader"
  33946. });
  33947. const _sfc_main$12 = /* @__PURE__ */ defineComponent({
  33948. ...__default__$Q,
  33949. props: pageHeaderProps,
  33950. emits: pageHeaderEmits,
  33951. setup(__props, { emit }) {
  33952. const slots = useSlots();
  33953. const { t } = useLocale();
  33954. const ns = useNamespace("page-header");
  33955. const kls = computed(() => {
  33956. return [
  33957. ns.b(),
  33958. {
  33959. [ns.m("has-breadcrumb")]: !!slots.breadcrumb,
  33960. [ns.m("has-extra")]: !!slots.extra,
  33961. [ns.is("contentful")]: !!slots.default
  33962. }
  33963. ];
  33964. });
  33965. function handleClick() {
  33966. emit("back");
  33967. }
  33968. return (_ctx, _cache) => {
  33969. return openBlock(), createElementBlock("div", {
  33970. class: normalizeClass(unref(kls))
  33971. }, [
  33972. _ctx.$slots.breadcrumb ? (openBlock(), createElementBlock("div", {
  33973. key: 0,
  33974. class: normalizeClass(unref(ns).e("breadcrumb"))
  33975. }, [
  33976. renderSlot(_ctx.$slots, "breadcrumb")
  33977. ], 2)) : createCommentVNode("v-if", true),
  33978. createElementVNode("div", {
  33979. class: normalizeClass(unref(ns).e("header"))
  33980. }, [
  33981. createElementVNode("div", {
  33982. class: normalizeClass(unref(ns).e("left"))
  33983. }, [
  33984. createElementVNode("div", {
  33985. class: normalizeClass(unref(ns).e("back")),
  33986. role: "button",
  33987. tabindex: "0",
  33988. onClick: handleClick
  33989. }, [
  33990. _ctx.icon || _ctx.$slots.icon ? (openBlock(), createElementBlock("div", {
  33991. key: 0,
  33992. "aria-label": _ctx.title || unref(t)("el.pageHeader.title"),
  33993. class: normalizeClass(unref(ns).e("icon"))
  33994. }, [
  33995. renderSlot(_ctx.$slots, "icon", {}, () => [
  33996. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  33997. default: withCtx(() => [
  33998. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  33999. ]),
  34000. _: 1
  34001. })) : createCommentVNode("v-if", true)
  34002. ])
  34003. ], 10, ["aria-label"])) : createCommentVNode("v-if", true),
  34004. createElementVNode("div", {
  34005. class: normalizeClass(unref(ns).e("title"))
  34006. }, [
  34007. renderSlot(_ctx.$slots, "title", {}, () => [
  34008. createTextVNode(toDisplayString(_ctx.title || unref(t)("el.pageHeader.title")), 1)
  34009. ])
  34010. ], 2)
  34011. ], 2),
  34012. createVNode(unref(ElDivider), { direction: "vertical" }),
  34013. createElementVNode("div", {
  34014. class: normalizeClass(unref(ns).e("content"))
  34015. }, [
  34016. renderSlot(_ctx.$slots, "content", {}, () => [
  34017. createTextVNode(toDisplayString(_ctx.content), 1)
  34018. ])
  34019. ], 2)
  34020. ], 2),
  34021. _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  34022. key: 0,
  34023. class: normalizeClass(unref(ns).e("extra"))
  34024. }, [
  34025. renderSlot(_ctx.$slots, "extra")
  34026. ], 2)) : createCommentVNode("v-if", true)
  34027. ], 2),
  34028. _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
  34029. key: 1,
  34030. class: normalizeClass(unref(ns).e("main"))
  34031. }, [
  34032. renderSlot(_ctx.$slots, "default")
  34033. ], 2)) : createCommentVNode("v-if", true)
  34034. ], 2);
  34035. };
  34036. }
  34037. });
  34038. var PageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["__file", "page-header.vue"]]);
  34039. const ElPageHeader = withInstall(PageHeader);
  34040. const elPaginationKey = Symbol("elPaginationKey");
  34041. const paginationPrevProps = buildProps({
  34042. disabled: Boolean,
  34043. currentPage: {
  34044. type: Number,
  34045. default: 1
  34046. },
  34047. prevText: {
  34048. type: String
  34049. },
  34050. prevIcon: {
  34051. type: iconPropType
  34052. }
  34053. });
  34054. const paginationPrevEmits = {
  34055. click: (evt) => evt instanceof MouseEvent
  34056. };
  34057. const __default__$P = defineComponent({
  34058. name: "ElPaginationPrev"
  34059. });
  34060. const _sfc_main$11 = /* @__PURE__ */ defineComponent({
  34061. ...__default__$P,
  34062. props: paginationPrevProps,
  34063. emits: paginationPrevEmits,
  34064. setup(__props) {
  34065. const props = __props;
  34066. const { t } = useLocale();
  34067. const internalDisabled = computed(() => props.disabled || props.currentPage <= 1);
  34068. return (_ctx, _cache) => {
  34069. return openBlock(), createElementBlock("button", {
  34070. type: "button",
  34071. class: "btn-prev",
  34072. disabled: unref(internalDisabled),
  34073. "aria-label": _ctx.prevText || unref(t)("el.pagination.prev"),
  34074. "aria-disabled": unref(internalDisabled),
  34075. onClick: ($event) => _ctx.$emit("click", $event)
  34076. }, [
  34077. _ctx.prevText ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(_ctx.prevText), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  34078. default: withCtx(() => [
  34079. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prevIcon)))
  34080. ]),
  34081. _: 1
  34082. }))
  34083. ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
  34084. };
  34085. }
  34086. });
  34087. var Prev = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["__file", "prev.vue"]]);
  34088. const paginationNextProps = buildProps({
  34089. disabled: Boolean,
  34090. currentPage: {
  34091. type: Number,
  34092. default: 1
  34093. },
  34094. pageCount: {
  34095. type: Number,
  34096. default: 50
  34097. },
  34098. nextText: {
  34099. type: String
  34100. },
  34101. nextIcon: {
  34102. type: iconPropType
  34103. }
  34104. });
  34105. const __default__$O = defineComponent({
  34106. name: "ElPaginationNext"
  34107. });
  34108. const _sfc_main$10 = /* @__PURE__ */ defineComponent({
  34109. ...__default__$O,
  34110. props: paginationNextProps,
  34111. emits: ["click"],
  34112. setup(__props) {
  34113. const props = __props;
  34114. const { t } = useLocale();
  34115. const internalDisabled = computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
  34116. return (_ctx, _cache) => {
  34117. return openBlock(), createElementBlock("button", {
  34118. type: "button",
  34119. class: "btn-next",
  34120. disabled: unref(internalDisabled),
  34121. "aria-label": _ctx.nextText || unref(t)("el.pagination.next"),
  34122. "aria-disabled": unref(internalDisabled),
  34123. onClick: ($event) => _ctx.$emit("click", $event)
  34124. }, [
  34125. _ctx.nextText ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(_ctx.nextText), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  34126. default: withCtx(() => [
  34127. (openBlock(), createBlock(resolveDynamicComponent(_ctx.nextIcon)))
  34128. ]),
  34129. _: 1
  34130. }))
  34131. ], 8, ["disabled", "aria-label", "aria-disabled", "onClick"]);
  34132. };
  34133. }
  34134. });
  34135. var Next = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["__file", "next.vue"]]);
  34136. const selectGroupKey = Symbol("ElSelectGroup");
  34137. const selectKey = Symbol("ElSelect");
  34138. function useOption$1(props, states) {
  34139. const select = inject(selectKey);
  34140. const selectGroup = inject(selectGroupKey, { disabled: false });
  34141. const itemSelected = computed(() => {
  34142. return contains(castArray$1(select.props.modelValue), props.value);
  34143. });
  34144. const limitReached = computed(() => {
  34145. var _a;
  34146. if (select.props.multiple) {
  34147. const modelValue = castArray$1((_a = select.props.modelValue) != null ? _a : []);
  34148. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  34149. } else {
  34150. return false;
  34151. }
  34152. });
  34153. const currentLabel = computed(() => {
  34154. return props.label || (isObject$1(props.value) ? "" : props.value);
  34155. });
  34156. const currentValue = computed(() => {
  34157. return props.value || props.label || "";
  34158. });
  34159. const isDisabled = computed(() => {
  34160. return props.disabled || states.groupDisabled || limitReached.value;
  34161. });
  34162. const instance = getCurrentInstance();
  34163. const contains = (arr = [], target) => {
  34164. if (!isObject$1(props.value)) {
  34165. return arr && arr.includes(target);
  34166. } else {
  34167. const valueKey = select.props.valueKey;
  34168. return arr && arr.some((item) => {
  34169. return toRaw(get(item, valueKey)) === get(target, valueKey);
  34170. });
  34171. }
  34172. };
  34173. const hoverItem = () => {
  34174. if (!props.disabled && !selectGroup.disabled) {
  34175. select.states.hoveringIndex = select.optionsArray.indexOf(instance.proxy);
  34176. }
  34177. };
  34178. const updateOption = (query) => {
  34179. const regexp = new RegExp(escapeStringRegexp(query), "i");
  34180. states.visible = regexp.test(currentLabel.value) || props.created;
  34181. };
  34182. watch(() => currentLabel.value, () => {
  34183. if (!props.created && !select.props.remote)
  34184. select.setSelected();
  34185. });
  34186. watch(() => props.value, (val, oldVal) => {
  34187. const { remote, valueKey } = select.props;
  34188. if (val !== oldVal) {
  34189. select.onOptionDestroy(oldVal, instance.proxy);
  34190. select.onOptionCreate(instance.proxy);
  34191. }
  34192. if (!props.created && !remote) {
  34193. if (valueKey && isObject$1(val) && isObject$1(oldVal) && val[valueKey] === oldVal[valueKey]) {
  34194. return;
  34195. }
  34196. select.setSelected();
  34197. }
  34198. });
  34199. watch(() => selectGroup.disabled, () => {
  34200. states.groupDisabled = selectGroup.disabled;
  34201. }, { immediate: true });
  34202. return {
  34203. select,
  34204. currentLabel,
  34205. currentValue,
  34206. itemSelected,
  34207. isDisabled,
  34208. hoverItem,
  34209. updateOption
  34210. };
  34211. }
  34212. const _sfc_main$$ = defineComponent({
  34213. name: "ElOption",
  34214. componentName: "ElOption",
  34215. props: {
  34216. value: {
  34217. required: true,
  34218. type: [String, Number, Boolean, Object]
  34219. },
  34220. label: [String, Number],
  34221. created: Boolean,
  34222. disabled: Boolean
  34223. },
  34224. setup(props) {
  34225. const ns = useNamespace("select");
  34226. const id = useId();
  34227. const containerKls = computed(() => [
  34228. ns.be("dropdown", "item"),
  34229. ns.is("disabled", unref(isDisabled)),
  34230. ns.is("selected", unref(itemSelected)),
  34231. ns.is("hovering", unref(hover))
  34232. ]);
  34233. const states = reactive({
  34234. index: -1,
  34235. groupDisabled: false,
  34236. visible: true,
  34237. hover: false
  34238. });
  34239. const {
  34240. currentLabel,
  34241. itemSelected,
  34242. isDisabled,
  34243. select,
  34244. hoverItem,
  34245. updateOption
  34246. } = useOption$1(props, states);
  34247. const { visible, hover } = toRefs(states);
  34248. const vm = getCurrentInstance().proxy;
  34249. select.onOptionCreate(vm);
  34250. onBeforeUnmount(() => {
  34251. const key = vm.value;
  34252. const { selected: selectedOptions } = select.states;
  34253. const doesSelected = selectedOptions.some((item) => {
  34254. return item.value === vm.value;
  34255. });
  34256. nextTick(() => {
  34257. if (select.states.cachedOptions.get(key) === vm && !doesSelected) {
  34258. select.states.cachedOptions.delete(key);
  34259. }
  34260. });
  34261. select.onOptionDestroy(key, vm);
  34262. });
  34263. function selectOptionClick() {
  34264. if (!isDisabled.value) {
  34265. select.handleOptionSelect(vm);
  34266. }
  34267. }
  34268. return {
  34269. ns,
  34270. id,
  34271. containerKls,
  34272. currentLabel,
  34273. itemSelected,
  34274. isDisabled,
  34275. select,
  34276. hoverItem,
  34277. updateOption,
  34278. visible,
  34279. hover,
  34280. selectOptionClick,
  34281. states
  34282. };
  34283. }
  34284. });
  34285. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  34286. return withDirectives((openBlock(), createElementBlock("li", {
  34287. id: _ctx.id,
  34288. class: normalizeClass(_ctx.containerKls),
  34289. role: "option",
  34290. "aria-disabled": _ctx.isDisabled || void 0,
  34291. "aria-selected": _ctx.itemSelected,
  34292. onMousemove: _ctx.hoverItem,
  34293. onClick: withModifiers(_ctx.selectOptionClick, ["stop"])
  34294. }, [
  34295. renderSlot(_ctx.$slots, "default", {}, () => [
  34296. createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
  34297. ])
  34298. ], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"])), [
  34299. [vShow, _ctx.visible]
  34300. ]);
  34301. }
  34302. var Option = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["render", _sfc_render$b], ["__file", "option.vue"]]);
  34303. const _sfc_main$_ = defineComponent({
  34304. name: "ElSelectDropdown",
  34305. componentName: "ElSelectDropdown",
  34306. setup() {
  34307. const select = inject(selectKey);
  34308. const ns = useNamespace("select");
  34309. const popperClass = computed(() => select.props.popperClass);
  34310. const isMultiple = computed(() => select.props.multiple);
  34311. const isFitInputWidth = computed(() => select.props.fitInputWidth);
  34312. const minWidth = ref("");
  34313. function updateMinWidth() {
  34314. var _a;
  34315. minWidth.value = `${(_a = select.selectRef) == null ? void 0 : _a.offsetWidth}px`;
  34316. }
  34317. onMounted(() => {
  34318. updateMinWidth();
  34319. useResizeObserver(select.selectRef, updateMinWidth);
  34320. });
  34321. return {
  34322. ns,
  34323. minWidth,
  34324. popperClass,
  34325. isMultiple,
  34326. isFitInputWidth
  34327. };
  34328. }
  34329. });
  34330. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  34331. return openBlock(), createElementBlock("div", {
  34332. class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  34333. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  34334. }, [
  34335. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  34336. key: 0,
  34337. class: normalizeClass(_ctx.ns.be("dropdown", "header"))
  34338. }, [
  34339. renderSlot(_ctx.$slots, "header")
  34340. ], 2)) : createCommentVNode("v-if", true),
  34341. renderSlot(_ctx.$slots, "default"),
  34342. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  34343. key: 1,
  34344. class: normalizeClass(_ctx.ns.be("dropdown", "footer"))
  34345. }, [
  34346. renderSlot(_ctx.$slots, "footer")
  34347. ], 2)) : createCommentVNode("v-if", true)
  34348. ], 6);
  34349. }
  34350. var ElSelectMenu$1 = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["render", _sfc_render$a], ["__file", "select-dropdown.vue"]]);
  34351. const MINIMUM_INPUT_WIDTH$1 = 11;
  34352. const useSelect$3 = (props, emit) => {
  34353. const { t } = useLocale();
  34354. const contentId = useId();
  34355. const nsSelect = useNamespace("select");
  34356. const nsInput = useNamespace("input");
  34357. const states = reactive({
  34358. inputValue: "",
  34359. options: /* @__PURE__ */ new Map(),
  34360. cachedOptions: /* @__PURE__ */ new Map(),
  34361. optionValues: [],
  34362. selected: [],
  34363. selectionWidth: 0,
  34364. calculatorWidth: 0,
  34365. collapseItemWidth: 0,
  34366. selectedLabel: "",
  34367. hoveringIndex: -1,
  34368. previousQuery: null,
  34369. inputHovering: false,
  34370. menuVisibleOnFocus: false,
  34371. isBeforeHide: false
  34372. });
  34373. const selectRef = ref(null);
  34374. const selectionRef = ref(null);
  34375. const tooltipRef = ref(null);
  34376. const tagTooltipRef = ref(null);
  34377. const inputRef = ref(null);
  34378. const calculatorRef = ref(null);
  34379. const prefixRef = ref(null);
  34380. const suffixRef = ref(null);
  34381. const menuRef = ref(null);
  34382. const tagMenuRef = ref(null);
  34383. const collapseItemRef = ref(null);
  34384. const scrollbarRef = ref(null);
  34385. const {
  34386. isComposing,
  34387. handleCompositionStart,
  34388. handleCompositionUpdate,
  34389. handleCompositionEnd
  34390. } = useComposition({
  34391. afterComposition: (e) => onInput(e)
  34392. });
  34393. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  34394. beforeFocus() {
  34395. return selectDisabled.value;
  34396. },
  34397. afterFocus() {
  34398. if (props.automaticDropdown && !expanded.value) {
  34399. expanded.value = true;
  34400. states.menuVisibleOnFocus = true;
  34401. }
  34402. },
  34403. beforeBlur(event) {
  34404. var _a, _b;
  34405. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  34406. },
  34407. afterBlur() {
  34408. expanded.value = false;
  34409. states.menuVisibleOnFocus = false;
  34410. }
  34411. });
  34412. const expanded = ref(false);
  34413. const hoverOption = ref();
  34414. const { form, formItem } = useFormItem();
  34415. const { inputId } = useFormItemInputId(props, {
  34416. formItemContext: formItem
  34417. });
  34418. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  34419. const selectDisabled = computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  34420. const hasModelValue = computed(() => {
  34421. return isArray$1(props.modelValue) ? props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  34422. });
  34423. const needStatusIcon = computed(() => {
  34424. var _a;
  34425. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  34426. });
  34427. const showClose = computed(() => {
  34428. return props.clearable && !selectDisabled.value && states.inputHovering && hasModelValue.value;
  34429. });
  34430. const iconComponent = computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  34431. const iconReverse = computed(() => nsSelect.is("reverse", iconComponent.value && expanded.value));
  34432. const validateState = computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  34433. const validateIcon = computed(() => ValidateComponentsMap[validateState.value]);
  34434. const debounce$1 = computed(() => props.remote ? 300 : 0);
  34435. const emptyText = computed(() => {
  34436. if (props.loading) {
  34437. return props.loadingText || t("el.select.loading");
  34438. } else {
  34439. if (props.remote && !states.inputValue && states.options.size === 0)
  34440. return false;
  34441. if (props.filterable && states.inputValue && states.options.size > 0 && filteredOptionsCount.value === 0) {
  34442. return props.noMatchText || t("el.select.noMatch");
  34443. }
  34444. if (states.options.size === 0) {
  34445. return props.noDataText || t("el.select.noData");
  34446. }
  34447. }
  34448. return null;
  34449. });
  34450. const filteredOptionsCount = computed(() => optionsArray.value.filter((option) => option.visible).length);
  34451. const optionsArray = computed(() => {
  34452. const list = Array.from(states.options.values());
  34453. const newList = [];
  34454. states.optionValues.forEach((item) => {
  34455. const index = list.findIndex((i) => i.value === item);
  34456. if (index > -1) {
  34457. newList.push(list[index]);
  34458. }
  34459. });
  34460. return newList.length >= list.length ? newList : list;
  34461. });
  34462. const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
  34463. const showNewOption = computed(() => {
  34464. const hasExistingOption = optionsArray.value.filter((option) => {
  34465. return !option.created;
  34466. }).some((option) => {
  34467. return option.currentLabel === states.inputValue;
  34468. });
  34469. return props.filterable && props.allowCreate && states.inputValue !== "" && !hasExistingOption;
  34470. });
  34471. const updateOptions = () => {
  34472. if (props.filterable && isFunction$1(props.filterMethod))
  34473. return;
  34474. if (props.filterable && props.remote && isFunction$1(props.remoteMethod))
  34475. return;
  34476. optionsArray.value.forEach((option) => {
  34477. var _a;
  34478. (_a = option.updateOption) == null ? void 0 : _a.call(option, states.inputValue);
  34479. });
  34480. };
  34481. const selectSize = useFormSize();
  34482. const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  34483. const dropdownMenuVisible = computed({
  34484. get() {
  34485. return expanded.value && emptyText.value !== false;
  34486. },
  34487. set(val) {
  34488. expanded.value = val;
  34489. }
  34490. });
  34491. const shouldShowPlaceholder = computed(() => {
  34492. if (props.multiple && !isUndefined(props.modelValue)) {
  34493. return castArray$1(props.modelValue).length === 0 && !states.inputValue;
  34494. }
  34495. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  34496. return props.filterable || isUndefined(value) ? !states.inputValue : true;
  34497. });
  34498. const currentPlaceholder = computed(() => {
  34499. var _a;
  34500. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  34501. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  34502. });
  34503. const mouseEnterEventName = computed(() => isIOS ? null : "mouseenter");
  34504. watch(() => props.modelValue, (val, oldVal) => {
  34505. if (props.multiple) {
  34506. if (props.filterable && !props.reserveKeyword) {
  34507. states.inputValue = "";
  34508. handleQueryChange("");
  34509. }
  34510. }
  34511. setSelected();
  34512. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  34513. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  34514. }
  34515. }, {
  34516. flush: "post",
  34517. deep: true
  34518. });
  34519. watch(() => expanded.value, (val) => {
  34520. if (val) {
  34521. handleQueryChange(states.inputValue);
  34522. } else {
  34523. states.inputValue = "";
  34524. states.previousQuery = null;
  34525. states.isBeforeHide = true;
  34526. }
  34527. emit("visible-change", val);
  34528. });
  34529. watch(() => states.options.entries(), () => {
  34530. if (!isClient)
  34531. return;
  34532. setSelected();
  34533. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  34534. checkDefaultFirstOption();
  34535. }
  34536. }, {
  34537. flush: "post"
  34538. });
  34539. watch(() => states.hoveringIndex, (val) => {
  34540. if (isNumber(val) && val > -1) {
  34541. hoverOption.value = optionsArray.value[val] || {};
  34542. } else {
  34543. hoverOption.value = {};
  34544. }
  34545. optionsArray.value.forEach((option) => {
  34546. option.hover = hoverOption.value === option;
  34547. });
  34548. });
  34549. watchEffect(() => {
  34550. if (states.isBeforeHide)
  34551. return;
  34552. updateOptions();
  34553. });
  34554. const handleQueryChange = (val) => {
  34555. if (states.previousQuery === val || isComposing.value) {
  34556. return;
  34557. }
  34558. states.previousQuery = val;
  34559. if (props.filterable && isFunction$1(props.filterMethod)) {
  34560. props.filterMethod(val);
  34561. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  34562. props.remoteMethod(val);
  34563. }
  34564. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) {
  34565. nextTick(checkDefaultFirstOption);
  34566. } else {
  34567. nextTick(updateHoveringIndex);
  34568. }
  34569. };
  34570. const checkDefaultFirstOption = () => {
  34571. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  34572. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  34573. const firstOriginOption = optionsInDropdown[0];
  34574. const valueList = optionsArray.value.map((item) => item.value);
  34575. states.hoveringIndex = getValueIndex(valueList, userCreatedOption || firstOriginOption);
  34576. };
  34577. const setSelected = () => {
  34578. if (!props.multiple) {
  34579. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  34580. const option = getOption(value);
  34581. states.selectedLabel = option.currentLabel;
  34582. states.selected = [option];
  34583. return;
  34584. } else {
  34585. states.selectedLabel = "";
  34586. }
  34587. const result = [];
  34588. if (!isUndefined(props.modelValue)) {
  34589. castArray$1(props.modelValue).forEach((value) => {
  34590. result.push(getOption(value));
  34591. });
  34592. }
  34593. states.selected = result;
  34594. };
  34595. const getOption = (value) => {
  34596. let option;
  34597. const isObjectValue = isPlainObject$1(value);
  34598. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  34599. const cachedOption = cachedOptionsArray.value[i];
  34600. const isEqualValue = isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  34601. if (isEqualValue) {
  34602. option = {
  34603. value,
  34604. currentLabel: cachedOption.currentLabel,
  34605. get isDisabled() {
  34606. return cachedOption.isDisabled;
  34607. }
  34608. };
  34609. break;
  34610. }
  34611. }
  34612. if (option)
  34613. return option;
  34614. const label = isObjectValue ? value.label : value != null ? value : "";
  34615. const newOption = {
  34616. value,
  34617. currentLabel: label
  34618. };
  34619. return newOption;
  34620. };
  34621. const updateHoveringIndex = () => {
  34622. states.hoveringIndex = optionsArray.value.findIndex((item) => states.selected.some((selected) => getValueKey(selected) === getValueKey(item)));
  34623. };
  34624. const resetSelectionWidth = () => {
  34625. states.selectionWidth = selectionRef.value.getBoundingClientRect().width;
  34626. };
  34627. const resetCalculatorWidth = () => {
  34628. states.calculatorWidth = calculatorRef.value.getBoundingClientRect().width;
  34629. };
  34630. const resetCollapseItemWidth = () => {
  34631. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  34632. };
  34633. const updateTooltip = () => {
  34634. var _a, _b;
  34635. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  34636. };
  34637. const updateTagTooltip = () => {
  34638. var _a, _b;
  34639. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  34640. };
  34641. const onInputChange = () => {
  34642. if (states.inputValue.length > 0 && !expanded.value) {
  34643. expanded.value = true;
  34644. }
  34645. handleQueryChange(states.inputValue);
  34646. };
  34647. const onInput = (event) => {
  34648. states.inputValue = event.target.value;
  34649. if (props.remote) {
  34650. debouncedOnInputChange();
  34651. } else {
  34652. return onInputChange();
  34653. }
  34654. };
  34655. const debouncedOnInputChange = debounce(() => {
  34656. onInputChange();
  34657. }, debounce$1.value);
  34658. const emitChange = (val) => {
  34659. if (!isEqual$1(props.modelValue, val)) {
  34660. emit(CHANGE_EVENT, val);
  34661. }
  34662. };
  34663. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => {
  34664. const option = states.cachedOptions.get(it);
  34665. return option && !option.disabled && !option.states.groupDisabled;
  34666. });
  34667. const deletePrevTag = (e) => {
  34668. if (!props.multiple)
  34669. return;
  34670. if (e.code === EVENT_CODE.delete)
  34671. return;
  34672. if (e.target.value.length <= 0) {
  34673. const value = castArray$1(props.modelValue).slice();
  34674. const lastNotDisabledIndex = getLastNotDisabledIndex(value);
  34675. if (lastNotDisabledIndex < 0)
  34676. return;
  34677. const removeTagValue = value[lastNotDisabledIndex];
  34678. value.splice(lastNotDisabledIndex, 1);
  34679. emit(UPDATE_MODEL_EVENT, value);
  34680. emitChange(value);
  34681. emit("remove-tag", removeTagValue);
  34682. }
  34683. };
  34684. const deleteTag = (event, tag) => {
  34685. const index = states.selected.indexOf(tag);
  34686. if (index > -1 && !selectDisabled.value) {
  34687. const value = castArray$1(props.modelValue).slice();
  34688. value.splice(index, 1);
  34689. emit(UPDATE_MODEL_EVENT, value);
  34690. emitChange(value);
  34691. emit("remove-tag", tag.value);
  34692. }
  34693. event.stopPropagation();
  34694. focus();
  34695. };
  34696. const deleteSelected = (event) => {
  34697. event.stopPropagation();
  34698. const value = props.multiple ? [] : valueOnClear.value;
  34699. if (props.multiple) {
  34700. for (const item of states.selected) {
  34701. if (item.isDisabled)
  34702. value.push(item.value);
  34703. }
  34704. }
  34705. emit(UPDATE_MODEL_EVENT, value);
  34706. emitChange(value);
  34707. states.hoveringIndex = -1;
  34708. expanded.value = false;
  34709. emit("clear");
  34710. focus();
  34711. };
  34712. const handleOptionSelect = (option) => {
  34713. var _a;
  34714. if (props.multiple) {
  34715. const value = castArray$1((_a = props.modelValue) != null ? _a : []).slice();
  34716. const optionIndex = getValueIndex(value, option);
  34717. if (optionIndex > -1) {
  34718. value.splice(optionIndex, 1);
  34719. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  34720. value.push(option.value);
  34721. }
  34722. emit(UPDATE_MODEL_EVENT, value);
  34723. emitChange(value);
  34724. if (option.created) {
  34725. handleQueryChange("");
  34726. }
  34727. if (props.filterable && !props.reserveKeyword) {
  34728. states.inputValue = "";
  34729. }
  34730. } else {
  34731. emit(UPDATE_MODEL_EVENT, option.value);
  34732. emitChange(option.value);
  34733. expanded.value = false;
  34734. }
  34735. focus();
  34736. if (expanded.value)
  34737. return;
  34738. nextTick(() => {
  34739. scrollToOption(option);
  34740. });
  34741. };
  34742. const getValueIndex = (arr = [], option) => {
  34743. if (isUndefined(option))
  34744. return -1;
  34745. if (!isObject$1(option.value))
  34746. return arr.indexOf(option.value);
  34747. return arr.findIndex((item) => {
  34748. return isEqual$1(get(item, props.valueKey), getValueKey(option));
  34749. });
  34750. };
  34751. const scrollToOption = (option) => {
  34752. var _a, _b, _c, _d, _e;
  34753. const targetOption = isArray$1(option) ? option[0] : option;
  34754. let target = null;
  34755. if (targetOption == null ? void 0 : targetOption.value) {
  34756. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  34757. if (options.length > 0) {
  34758. target = options[0].$el;
  34759. }
  34760. }
  34761. if (tooltipRef.value && target) {
  34762. 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")}`);
  34763. if (menu) {
  34764. scrollIntoView(menu, target);
  34765. }
  34766. }
  34767. (_e = scrollbarRef.value) == null ? void 0 : _e.handleScroll();
  34768. };
  34769. const onOptionCreate = (vm) => {
  34770. states.options.set(vm.value, vm);
  34771. states.cachedOptions.set(vm.value, vm);
  34772. };
  34773. const onOptionDestroy = (key, vm) => {
  34774. if (states.options.get(key) === vm) {
  34775. states.options.delete(key);
  34776. }
  34777. };
  34778. const popperRef = computed(() => {
  34779. var _a, _b;
  34780. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  34781. });
  34782. const handleMenuEnter = () => {
  34783. states.isBeforeHide = false;
  34784. nextTick(() => scrollToOption(states.selected));
  34785. };
  34786. const focus = () => {
  34787. var _a;
  34788. (_a = inputRef.value) == null ? void 0 : _a.focus();
  34789. };
  34790. const blur = () => {
  34791. var _a;
  34792. if (expanded.value) {
  34793. expanded.value = false;
  34794. nextTick(() => {
  34795. var _a2;
  34796. return (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
  34797. });
  34798. return;
  34799. }
  34800. (_a = inputRef.value) == null ? void 0 : _a.blur();
  34801. };
  34802. const handleClearClick = (event) => {
  34803. deleteSelected(event);
  34804. };
  34805. const handleClickOutside = (event) => {
  34806. expanded.value = false;
  34807. if (isFocused.value) {
  34808. const _event = new FocusEvent("focus", event);
  34809. nextTick(() => handleBlur(_event));
  34810. }
  34811. };
  34812. const handleEsc = () => {
  34813. if (states.inputValue.length > 0) {
  34814. states.inputValue = "";
  34815. } else {
  34816. expanded.value = false;
  34817. }
  34818. };
  34819. const toggleMenu = () => {
  34820. if (selectDisabled.value)
  34821. return;
  34822. if (isIOS)
  34823. states.inputHovering = true;
  34824. if (states.menuVisibleOnFocus) {
  34825. states.menuVisibleOnFocus = false;
  34826. } else {
  34827. expanded.value = !expanded.value;
  34828. }
  34829. };
  34830. const selectOption = () => {
  34831. if (!expanded.value) {
  34832. toggleMenu();
  34833. } else {
  34834. const option = optionsArray.value[states.hoveringIndex];
  34835. if (option && !option.isDisabled) {
  34836. handleOptionSelect(option);
  34837. }
  34838. }
  34839. };
  34840. const getValueKey = (item) => {
  34841. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  34842. };
  34843. const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.isDisabled));
  34844. const showTagList = computed(() => {
  34845. if (!props.multiple) {
  34846. return [];
  34847. }
  34848. return props.collapseTags ? states.selected.slice(0, props.maxCollapseTags) : states.selected;
  34849. });
  34850. const collapseTagList = computed(() => {
  34851. if (!props.multiple) {
  34852. return [];
  34853. }
  34854. return props.collapseTags ? states.selected.slice(props.maxCollapseTags) : [];
  34855. });
  34856. const navigateOptions = (direction) => {
  34857. if (!expanded.value) {
  34858. expanded.value = true;
  34859. return;
  34860. }
  34861. if (states.options.size === 0 || filteredOptionsCount.value === 0 || isComposing.value)
  34862. return;
  34863. if (!optionsAllDisabled.value) {
  34864. if (direction === "next") {
  34865. states.hoveringIndex++;
  34866. if (states.hoveringIndex === states.options.size) {
  34867. states.hoveringIndex = 0;
  34868. }
  34869. } else if (direction === "prev") {
  34870. states.hoveringIndex--;
  34871. if (states.hoveringIndex < 0) {
  34872. states.hoveringIndex = states.options.size - 1;
  34873. }
  34874. }
  34875. const option = optionsArray.value[states.hoveringIndex];
  34876. if (option.isDisabled || !option.visible) {
  34877. navigateOptions(direction);
  34878. }
  34879. nextTick(() => scrollToOption(hoverOption.value));
  34880. }
  34881. };
  34882. const getGapWidth = () => {
  34883. if (!selectionRef.value)
  34884. return 0;
  34885. const style = window.getComputedStyle(selectionRef.value);
  34886. return Number.parseFloat(style.gap || "6px");
  34887. };
  34888. const tagStyle = computed(() => {
  34889. const gapWidth = getGapWidth();
  34890. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth : states.selectionWidth;
  34891. return { maxWidth: `${maxWidth}px` };
  34892. });
  34893. const collapseTagStyle = computed(() => {
  34894. return { maxWidth: `${states.selectionWidth}px` };
  34895. });
  34896. const inputStyle = computed(() => ({
  34897. width: `${Math.max(states.calculatorWidth, MINIMUM_INPUT_WIDTH$1)}px`
  34898. }));
  34899. useResizeObserver(selectionRef, resetSelectionWidth);
  34900. useResizeObserver(calculatorRef, resetCalculatorWidth);
  34901. useResizeObserver(menuRef, updateTooltip);
  34902. useResizeObserver(wrapperRef, updateTooltip);
  34903. useResizeObserver(tagMenuRef, updateTagTooltip);
  34904. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  34905. onMounted(() => {
  34906. setSelected();
  34907. });
  34908. return {
  34909. inputId,
  34910. contentId,
  34911. nsSelect,
  34912. nsInput,
  34913. states,
  34914. isFocused,
  34915. expanded,
  34916. optionsArray,
  34917. hoverOption,
  34918. selectSize,
  34919. filteredOptionsCount,
  34920. resetCalculatorWidth,
  34921. updateTooltip,
  34922. updateTagTooltip,
  34923. debouncedOnInputChange,
  34924. onInput,
  34925. deletePrevTag,
  34926. deleteTag,
  34927. deleteSelected,
  34928. handleOptionSelect,
  34929. scrollToOption,
  34930. hasModelValue,
  34931. shouldShowPlaceholder,
  34932. currentPlaceholder,
  34933. mouseEnterEventName,
  34934. needStatusIcon,
  34935. showClose,
  34936. iconComponent,
  34937. iconReverse,
  34938. validateState,
  34939. validateIcon,
  34940. showNewOption,
  34941. updateOptions,
  34942. collapseTagSize,
  34943. setSelected,
  34944. selectDisabled,
  34945. emptyText,
  34946. handleCompositionStart,
  34947. handleCompositionUpdate,
  34948. handleCompositionEnd,
  34949. onOptionCreate,
  34950. onOptionDestroy,
  34951. handleMenuEnter,
  34952. focus,
  34953. blur,
  34954. handleClearClick,
  34955. handleClickOutside,
  34956. handleEsc,
  34957. toggleMenu,
  34958. selectOption,
  34959. getValueKey,
  34960. navigateOptions,
  34961. dropdownMenuVisible,
  34962. showTagList,
  34963. collapseTagList,
  34964. tagStyle,
  34965. collapseTagStyle,
  34966. inputStyle,
  34967. popperRef,
  34968. inputRef,
  34969. tooltipRef,
  34970. tagTooltipRef,
  34971. calculatorRef,
  34972. prefixRef,
  34973. suffixRef,
  34974. selectRef,
  34975. wrapperRef,
  34976. selectionRef,
  34977. scrollbarRef,
  34978. menuRef,
  34979. tagMenuRef,
  34980. collapseItemRef
  34981. };
  34982. };
  34983. var ElOptions = defineComponent({
  34984. name: "ElOptions",
  34985. setup(_, { slots }) {
  34986. const select = inject(selectKey);
  34987. let cachedValueList = [];
  34988. return () => {
  34989. var _a, _b;
  34990. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  34991. const valueList = [];
  34992. function filterOptions(children2) {
  34993. if (!isArray$1(children2))
  34994. return;
  34995. children2.forEach((item) => {
  34996. var _a2, _b2, _c, _d;
  34997. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  34998. if (name === "ElOptionGroup") {
  34999. 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);
  35000. } else if (name === "ElOption") {
  35001. valueList.push((_d = item.props) == null ? void 0 : _d.value);
  35002. } else if (isArray$1(item.children)) {
  35003. filterOptions(item.children);
  35004. }
  35005. });
  35006. }
  35007. if (children.length) {
  35008. filterOptions((_b = children[0]) == null ? void 0 : _b.children);
  35009. }
  35010. if (!isEqual$1(valueList, cachedValueList)) {
  35011. cachedValueList = valueList;
  35012. if (select) {
  35013. select.states.optionValues = valueList;
  35014. }
  35015. }
  35016. return children;
  35017. };
  35018. }
  35019. });
  35020. const SelectProps$1 = buildProps({
  35021. name: String,
  35022. id: String,
  35023. modelValue: {
  35024. type: [Array, String, Number, Boolean, Object],
  35025. default: void 0
  35026. },
  35027. autocomplete: {
  35028. type: String,
  35029. default: "off"
  35030. },
  35031. automaticDropdown: Boolean,
  35032. size: useSizeProp,
  35033. effect: {
  35034. type: definePropType(String),
  35035. default: "light"
  35036. },
  35037. disabled: Boolean,
  35038. clearable: Boolean,
  35039. filterable: Boolean,
  35040. allowCreate: Boolean,
  35041. loading: Boolean,
  35042. popperClass: {
  35043. type: String,
  35044. default: ""
  35045. },
  35046. popperOptions: {
  35047. type: definePropType(Object),
  35048. default: () => ({})
  35049. },
  35050. remote: Boolean,
  35051. loadingText: String,
  35052. noMatchText: String,
  35053. noDataText: String,
  35054. remoteMethod: Function,
  35055. filterMethod: Function,
  35056. multiple: Boolean,
  35057. multipleLimit: {
  35058. type: Number,
  35059. default: 0
  35060. },
  35061. placeholder: {
  35062. type: String
  35063. },
  35064. defaultFirstOption: Boolean,
  35065. reserveKeyword: {
  35066. type: Boolean,
  35067. default: true
  35068. },
  35069. valueKey: {
  35070. type: String,
  35071. default: "value"
  35072. },
  35073. collapseTags: Boolean,
  35074. collapseTagsTooltip: Boolean,
  35075. maxCollapseTags: {
  35076. type: Number,
  35077. default: 1
  35078. },
  35079. teleported: useTooltipContentProps.teleported,
  35080. persistent: {
  35081. type: Boolean,
  35082. default: true
  35083. },
  35084. clearIcon: {
  35085. type: iconPropType,
  35086. default: circle_close_default
  35087. },
  35088. fitInputWidth: Boolean,
  35089. suffixIcon: {
  35090. type: iconPropType,
  35091. default: arrow_down_default
  35092. },
  35093. tagType: { ...tagProps.type, default: "info" },
  35094. tagEffect: { ...tagProps.effect, default: "light" },
  35095. validateEvent: {
  35096. type: Boolean,
  35097. default: true
  35098. },
  35099. remoteShowSuffix: Boolean,
  35100. showArrow: {
  35101. type: Boolean,
  35102. default: true
  35103. },
  35104. offset: {
  35105. type: Number,
  35106. default: 12
  35107. },
  35108. placement: {
  35109. type: definePropType(String),
  35110. values: Ee,
  35111. default: "bottom-start"
  35112. },
  35113. fallbackPlacements: {
  35114. type: definePropType(Array),
  35115. default: ["bottom-start", "top-start", "right", "left"]
  35116. },
  35117. tabindex: {
  35118. type: [String, Number],
  35119. default: 0
  35120. },
  35121. appendTo: String,
  35122. ...useEmptyValuesProps,
  35123. ...useAriaProps(["ariaLabel"])
  35124. });
  35125. const COMPONENT_NAME$9 = "ElSelect";
  35126. const _sfc_main$Z = defineComponent({
  35127. name: COMPONENT_NAME$9,
  35128. componentName: COMPONENT_NAME$9,
  35129. components: {
  35130. ElSelectMenu: ElSelectMenu$1,
  35131. ElOption: Option,
  35132. ElOptions,
  35133. ElTag,
  35134. ElScrollbar,
  35135. ElTooltip,
  35136. ElIcon
  35137. },
  35138. directives: { ClickOutside },
  35139. props: SelectProps$1,
  35140. emits: [
  35141. UPDATE_MODEL_EVENT,
  35142. CHANGE_EVENT,
  35143. "remove-tag",
  35144. "clear",
  35145. "visible-change",
  35146. "focus",
  35147. "blur"
  35148. ],
  35149. setup(props, { emit }) {
  35150. const modelValue = computed(() => {
  35151. const { modelValue: rawModelValue, multiple } = props;
  35152. const fallback = multiple ? [] : void 0;
  35153. if (isArray$1(rawModelValue)) {
  35154. return multiple ? rawModelValue : fallback;
  35155. }
  35156. return multiple ? fallback : rawModelValue;
  35157. });
  35158. const _props = reactive({
  35159. ...toRefs(props),
  35160. modelValue
  35161. });
  35162. const API = useSelect$3(_props, emit);
  35163. provide(selectKey, reactive({
  35164. props: _props,
  35165. states: API.states,
  35166. optionsArray: API.optionsArray,
  35167. handleOptionSelect: API.handleOptionSelect,
  35168. onOptionCreate: API.onOptionCreate,
  35169. onOptionDestroy: API.onOptionDestroy,
  35170. selectRef: API.selectRef,
  35171. setSelected: API.setSelected
  35172. }));
  35173. const selectedLabel = computed(() => {
  35174. if (!props.multiple) {
  35175. return API.states.selectedLabel;
  35176. }
  35177. return API.states.selected.map((i) => i.currentLabel);
  35178. });
  35179. return {
  35180. ...API,
  35181. modelValue,
  35182. selectedLabel
  35183. };
  35184. }
  35185. });
  35186. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  35187. const _component_el_tag = resolveComponent("el-tag");
  35188. const _component_el_tooltip = resolveComponent("el-tooltip");
  35189. const _component_el_icon = resolveComponent("el-icon");
  35190. const _component_el_option = resolveComponent("el-option");
  35191. const _component_el_options = resolveComponent("el-options");
  35192. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  35193. const _component_el_select_menu = resolveComponent("el-select-menu");
  35194. const _directive_click_outside = resolveDirective("click-outside");
  35195. return withDirectives((openBlock(), createElementBlock("div", {
  35196. ref: "selectRef",
  35197. class: normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  35198. [toHandlerKey(_ctx.mouseEnterEventName)]: ($event) => _ctx.states.inputHovering = true,
  35199. onMouseleave: ($event) => _ctx.states.inputHovering = false
  35200. }, [
  35201. createVNode(_component_el_tooltip, {
  35202. ref: "tooltipRef",
  35203. visible: _ctx.dropdownMenuVisible,
  35204. placement: _ctx.placement,
  35205. teleported: _ctx.teleported,
  35206. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  35207. "popper-options": _ctx.popperOptions,
  35208. "fallback-placements": _ctx.fallbackPlacements,
  35209. effect: _ctx.effect,
  35210. pure: "",
  35211. trigger: "click",
  35212. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  35213. "stop-popper-mouse-event": false,
  35214. "gpu-acceleration": false,
  35215. persistent: _ctx.persistent,
  35216. "append-to": _ctx.appendTo,
  35217. "show-arrow": _ctx.showArrow,
  35218. offset: _ctx.offset,
  35219. onBeforeShow: _ctx.handleMenuEnter,
  35220. onHide: ($event) => _ctx.states.isBeforeHide = false
  35221. }, {
  35222. default: withCtx(() => {
  35223. var _a;
  35224. return [
  35225. createElementVNode("div", {
  35226. ref: "wrapperRef",
  35227. class: normalizeClass([
  35228. _ctx.nsSelect.e("wrapper"),
  35229. _ctx.nsSelect.is("focused", _ctx.isFocused),
  35230. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  35231. _ctx.nsSelect.is("filterable", _ctx.filterable),
  35232. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  35233. ]),
  35234. onClick: withModifiers(_ctx.toggleMenu, ["prevent"])
  35235. }, [
  35236. _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
  35237. key: 0,
  35238. ref: "prefixRef",
  35239. class: normalizeClass(_ctx.nsSelect.e("prefix"))
  35240. }, [
  35241. renderSlot(_ctx.$slots, "prefix")
  35242. ], 2)) : createCommentVNode("v-if", true),
  35243. createElementVNode("div", {
  35244. ref: "selectionRef",
  35245. class: normalizeClass([
  35246. _ctx.nsSelect.e("selection"),
  35247. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.states.selected.length)
  35248. ])
  35249. }, [
  35250. _ctx.multiple ? renderSlot(_ctx.$slots, "tag", { key: 0 }, () => [
  35251. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  35252. return openBlock(), createElementBlock("div", {
  35253. key: _ctx.getValueKey(item),
  35254. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  35255. }, [
  35256. createVNode(_component_el_tag, {
  35257. closable: !_ctx.selectDisabled && !item.isDisabled,
  35258. size: _ctx.collapseTagSize,
  35259. type: _ctx.tagType,
  35260. effect: _ctx.tagEffect,
  35261. "disable-transitions": "",
  35262. style: normalizeStyle(_ctx.tagStyle),
  35263. onClose: ($event) => _ctx.deleteTag($event, item)
  35264. }, {
  35265. default: withCtx(() => [
  35266. createElementVNode("span", {
  35267. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  35268. }, [
  35269. renderSlot(_ctx.$slots, "label", {
  35270. label: item.currentLabel,
  35271. value: item.value
  35272. }, () => [
  35273. createTextVNode(toDisplayString(item.currentLabel), 1)
  35274. ])
  35275. ], 2)
  35276. ]),
  35277. _: 2
  35278. }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
  35279. ], 2);
  35280. }), 128)),
  35281. _ctx.collapseTags && _ctx.states.selected.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tooltip, {
  35282. key: 0,
  35283. ref: "tagTooltipRef",
  35284. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  35285. "fallback-placements": ["bottom", "top", "right", "left"],
  35286. effect: _ctx.effect,
  35287. placement: "bottom",
  35288. teleported: _ctx.teleported
  35289. }, {
  35290. default: withCtx(() => [
  35291. createElementVNode("div", {
  35292. ref: "collapseItemRef",
  35293. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  35294. }, [
  35295. createVNode(_component_el_tag, {
  35296. closable: false,
  35297. size: _ctx.collapseTagSize,
  35298. type: _ctx.tagType,
  35299. effect: _ctx.tagEffect,
  35300. "disable-transitions": "",
  35301. style: normalizeStyle(_ctx.collapseTagStyle)
  35302. }, {
  35303. default: withCtx(() => [
  35304. createElementVNode("span", {
  35305. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  35306. }, " + " + toDisplayString(_ctx.states.selected.length - _ctx.maxCollapseTags), 3)
  35307. ]),
  35308. _: 1
  35309. }, 8, ["size", "type", "effect", "style"])
  35310. ], 2)
  35311. ]),
  35312. content: withCtx(() => [
  35313. createElementVNode("div", {
  35314. ref: "tagMenuRef",
  35315. class: normalizeClass(_ctx.nsSelect.e("selection"))
  35316. }, [
  35317. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (item) => {
  35318. return openBlock(), createElementBlock("div", {
  35319. key: _ctx.getValueKey(item),
  35320. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  35321. }, [
  35322. createVNode(_component_el_tag, {
  35323. class: "in-tooltip",
  35324. closable: !_ctx.selectDisabled && !item.isDisabled,
  35325. size: _ctx.collapseTagSize,
  35326. type: _ctx.tagType,
  35327. effect: _ctx.tagEffect,
  35328. "disable-transitions": "",
  35329. onClose: ($event) => _ctx.deleteTag($event, item)
  35330. }, {
  35331. default: withCtx(() => [
  35332. createElementVNode("span", {
  35333. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  35334. }, [
  35335. renderSlot(_ctx.$slots, "label", {
  35336. label: item.currentLabel,
  35337. value: item.value
  35338. }, () => [
  35339. createTextVNode(toDisplayString(item.currentLabel), 1)
  35340. ])
  35341. ], 2)
  35342. ]),
  35343. _: 2
  35344. }, 1032, ["closable", "size", "type", "effect", "onClose"])
  35345. ], 2);
  35346. }), 128))
  35347. ], 2)
  35348. ]),
  35349. _: 3
  35350. }, 8, ["disabled", "effect", "teleported"])) : createCommentVNode("v-if", true)
  35351. ]) : createCommentVNode("v-if", true),
  35352. createElementVNode("div", {
  35353. class: normalizeClass([
  35354. _ctx.nsSelect.e("selected-item"),
  35355. _ctx.nsSelect.e("input-wrapper"),
  35356. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  35357. ])
  35358. }, [
  35359. withDirectives(createElementVNode("input", {
  35360. id: _ctx.inputId,
  35361. ref: "inputRef",
  35362. "onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
  35363. type: "text",
  35364. name: _ctx.name,
  35365. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  35366. disabled: _ctx.selectDisabled,
  35367. autocomplete: _ctx.autocomplete,
  35368. style: normalizeStyle(_ctx.inputStyle),
  35369. tabindex: _ctx.tabindex,
  35370. role: "combobox",
  35371. readonly: !_ctx.filterable,
  35372. spellcheck: "false",
  35373. "aria-activedescendant": ((_a = _ctx.hoverOption) == null ? void 0 : _a.id) || "",
  35374. "aria-controls": _ctx.contentId,
  35375. "aria-expanded": _ctx.dropdownMenuVisible,
  35376. "aria-label": _ctx.ariaLabel,
  35377. "aria-autocomplete": "none",
  35378. "aria-haspopup": "listbox",
  35379. onKeydown: [
  35380. withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"]),
  35381. withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"]),
  35382. withKeys(withModifiers(_ctx.handleEsc, ["stop", "prevent"]), ["esc"]),
  35383. withKeys(withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  35384. withKeys(withModifiers(_ctx.deletePrevTag, ["stop"]), ["delete"])
  35385. ],
  35386. onCompositionstart: _ctx.handleCompositionStart,
  35387. onCompositionupdate: _ctx.handleCompositionUpdate,
  35388. onCompositionend: _ctx.handleCompositionEnd,
  35389. onInput: _ctx.onInput,
  35390. onClick: withModifiers(_ctx.toggleMenu, ["stop"])
  35391. }, null, 46, ["id", "onUpdate:modelValue", "name", "disabled", "autocomplete", "tabindex", "readonly", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "onKeydown", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput", "onClick"]), [
  35392. [vModelText, _ctx.states.inputValue]
  35393. ]),
  35394. _ctx.filterable ? (openBlock(), createElementBlock("span", {
  35395. key: 0,
  35396. ref: "calculatorRef",
  35397. "aria-hidden": "true",
  35398. class: normalizeClass(_ctx.nsSelect.e("input-calculator")),
  35399. textContent: toDisplayString(_ctx.states.inputValue)
  35400. }, null, 10, ["textContent"])) : createCommentVNode("v-if", true)
  35401. ], 2),
  35402. _ctx.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", {
  35403. key: 1,
  35404. class: normalizeClass([
  35405. _ctx.nsSelect.e("selected-item"),
  35406. _ctx.nsSelect.e("placeholder"),
  35407. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  35408. ])
  35409. }, [
  35410. _ctx.hasModelValue ? renderSlot(_ctx.$slots, "label", {
  35411. key: 0,
  35412. label: _ctx.currentPlaceholder,
  35413. value: _ctx.modelValue
  35414. }, () => [
  35415. createElementVNode("span", null, toDisplayString(_ctx.currentPlaceholder), 1)
  35416. ]) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(_ctx.currentPlaceholder), 1))
  35417. ], 2)) : createCommentVNode("v-if", true)
  35418. ], 2),
  35419. createElementVNode("div", {
  35420. ref: "suffixRef",
  35421. class: normalizeClass(_ctx.nsSelect.e("suffix"))
  35422. }, [
  35423. _ctx.iconComponent && !_ctx.showClose ? (openBlock(), createBlock(_component_el_icon, {
  35424. key: 0,
  35425. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  35426. }, {
  35427. default: withCtx(() => [
  35428. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  35429. ]),
  35430. _: 1
  35431. }, 8, ["class"])) : createCommentVNode("v-if", true),
  35432. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  35433. key: 1,
  35434. class: normalizeClass([
  35435. _ctx.nsSelect.e("caret"),
  35436. _ctx.nsSelect.e("icon"),
  35437. _ctx.nsSelect.e("clear")
  35438. ]),
  35439. onClick: _ctx.handleClearClick
  35440. }, {
  35441. default: withCtx(() => [
  35442. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  35443. ]),
  35444. _: 1
  35445. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  35446. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (openBlock(), createBlock(_component_el_icon, {
  35447. key: 2,
  35448. class: normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsInput.e("validateIcon")])
  35449. }, {
  35450. default: withCtx(() => [
  35451. (openBlock(), createBlock(resolveDynamicComponent(_ctx.validateIcon)))
  35452. ]),
  35453. _: 1
  35454. }, 8, ["class"])) : createCommentVNode("v-if", true)
  35455. ], 2)
  35456. ], 10, ["onClick"])
  35457. ];
  35458. }),
  35459. content: withCtx(() => [
  35460. createVNode(_component_el_select_menu, { ref: "menuRef" }, {
  35461. default: withCtx(() => [
  35462. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  35463. key: 0,
  35464. class: normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
  35465. onClick: withModifiers(() => {
  35466. }, ["stop"])
  35467. }, [
  35468. renderSlot(_ctx.$slots, "header")
  35469. ], 10, ["onClick"])) : createCommentVNode("v-if", true),
  35470. withDirectives(createVNode(_component_el_scrollbar, {
  35471. id: _ctx.contentId,
  35472. ref: "scrollbarRef",
  35473. tag: "ul",
  35474. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  35475. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  35476. class: normalizeClass([_ctx.nsSelect.is("empty", _ctx.filteredOptionsCount === 0)]),
  35477. role: "listbox",
  35478. "aria-label": _ctx.ariaLabel,
  35479. "aria-orientation": "vertical"
  35480. }, {
  35481. default: withCtx(() => [
  35482. _ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  35483. key: 0,
  35484. value: _ctx.states.inputValue,
  35485. created: true
  35486. }, null, 8, ["value"])) : createCommentVNode("v-if", true),
  35487. createVNode(_component_el_options, null, {
  35488. default: withCtx(() => [
  35489. renderSlot(_ctx.$slots, "default")
  35490. ]),
  35491. _: 3
  35492. })
  35493. ]),
  35494. _: 3
  35495. }, 8, ["id", "wrap-class", "view-class", "class", "aria-label"]), [
  35496. [vShow, _ctx.states.options.size > 0 && !_ctx.loading]
  35497. ]),
  35498. _ctx.$slots.loading && _ctx.loading ? (openBlock(), createElementBlock("div", {
  35499. key: 1,
  35500. class: normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  35501. }, [
  35502. renderSlot(_ctx.$slots, "loading")
  35503. ], 2)) : _ctx.loading || _ctx.filteredOptionsCount === 0 ? (openBlock(), createElementBlock("div", {
  35504. key: 2,
  35505. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  35506. }, [
  35507. renderSlot(_ctx.$slots, "empty", {}, () => [
  35508. createElementVNode("span", null, toDisplayString(_ctx.emptyText), 1)
  35509. ])
  35510. ], 2)) : createCommentVNode("v-if", true),
  35511. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  35512. key: 3,
  35513. class: normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
  35514. onClick: withModifiers(() => {
  35515. }, ["stop"])
  35516. }, [
  35517. renderSlot(_ctx.$slots, "footer")
  35518. ], 10, ["onClick"])) : createCommentVNode("v-if", true)
  35519. ]),
  35520. _: 3
  35521. }, 512)
  35522. ]),
  35523. _: 3
  35524. }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "transition", "persistent", "append-to", "show-arrow", "offset", "onBeforeShow", "onHide"])
  35525. ], 16, ["onMouseleave"])), [
  35526. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  35527. ]);
  35528. }
  35529. var Select$1 = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["render", _sfc_render$9], ["__file", "select.vue"]]);
  35530. const _sfc_main$Y = defineComponent({
  35531. name: "ElOptionGroup",
  35532. componentName: "ElOptionGroup",
  35533. props: {
  35534. label: String,
  35535. disabled: Boolean
  35536. },
  35537. setup(props) {
  35538. const ns = useNamespace("select");
  35539. const groupRef = ref(null);
  35540. const instance = getCurrentInstance();
  35541. const children = ref([]);
  35542. provide(selectGroupKey, reactive({
  35543. ...toRefs(props)
  35544. }));
  35545. const visible = computed(() => children.value.some((option) => option.visible === true));
  35546. const isOption = (node) => {
  35547. var _a, _b;
  35548. return ((_a = node.type) == null ? void 0 : _a.name) === "ElOption" && !!((_b = node.component) == null ? void 0 : _b.proxy);
  35549. };
  35550. const flattedChildren = (node) => {
  35551. const Nodes = castArray$1(node);
  35552. const children2 = [];
  35553. Nodes.forEach((child) => {
  35554. var _a, _b;
  35555. if (isOption(child)) {
  35556. children2.push(child.component.proxy);
  35557. } else if ((_a = child.children) == null ? void 0 : _a.length) {
  35558. children2.push(...flattedChildren(child.children));
  35559. } else if ((_b = child.component) == null ? void 0 : _b.subTree) {
  35560. children2.push(...flattedChildren(child.component.subTree));
  35561. }
  35562. });
  35563. return children2;
  35564. };
  35565. const updateChildren = () => {
  35566. children.value = flattedChildren(instance.subTree);
  35567. };
  35568. onMounted(() => {
  35569. updateChildren();
  35570. });
  35571. useMutationObserver(groupRef, updateChildren, {
  35572. attributes: true,
  35573. subtree: true,
  35574. childList: true
  35575. });
  35576. return {
  35577. groupRef,
  35578. visible,
  35579. ns
  35580. };
  35581. }
  35582. });
  35583. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  35584. return withDirectives((openBlock(), createElementBlock("ul", {
  35585. ref: "groupRef",
  35586. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  35587. }, [
  35588. createElementVNode("li", {
  35589. class: normalizeClass(_ctx.ns.be("group", "title"))
  35590. }, toDisplayString(_ctx.label), 3),
  35591. createElementVNode("li", null, [
  35592. createElementVNode("ul", {
  35593. class: normalizeClass(_ctx.ns.b("group"))
  35594. }, [
  35595. renderSlot(_ctx.$slots, "default")
  35596. ], 2)
  35597. ])
  35598. ], 2)), [
  35599. [vShow, _ctx.visible]
  35600. ]);
  35601. }
  35602. var OptionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["render", _sfc_render$8], ["__file", "option-group.vue"]]);
  35603. const ElSelect = withInstall(Select$1, {
  35604. Option,
  35605. OptionGroup
  35606. });
  35607. const ElOption = withNoopInstall(Option);
  35608. const ElOptionGroup = withNoopInstall(OptionGroup);
  35609. const usePagination = () => inject(elPaginationKey, {});
  35610. const paginationSizesProps = buildProps({
  35611. pageSize: {
  35612. type: Number,
  35613. required: true
  35614. },
  35615. pageSizes: {
  35616. type: definePropType(Array),
  35617. default: () => mutable([10, 20, 30, 40, 50, 100])
  35618. },
  35619. popperClass: {
  35620. type: String
  35621. },
  35622. disabled: Boolean,
  35623. teleported: Boolean,
  35624. size: {
  35625. type: String,
  35626. values: componentSizes
  35627. },
  35628. appendSizeTo: String
  35629. });
  35630. const __default__$N = defineComponent({
  35631. name: "ElPaginationSizes"
  35632. });
  35633. const _sfc_main$X = /* @__PURE__ */ defineComponent({
  35634. ...__default__$N,
  35635. props: paginationSizesProps,
  35636. emits: ["page-size-change"],
  35637. setup(__props, { emit }) {
  35638. const props = __props;
  35639. const { t } = useLocale();
  35640. const ns = useNamespace("pagination");
  35641. const pagination = usePagination();
  35642. const innerPageSize = ref(props.pageSize);
  35643. watch(() => props.pageSizes, (newVal, oldVal) => {
  35644. if (isEqual$1(newVal, oldVal))
  35645. return;
  35646. if (isArray$1(newVal)) {
  35647. const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
  35648. emit("page-size-change", pageSize);
  35649. }
  35650. });
  35651. watch(() => props.pageSize, (newVal) => {
  35652. innerPageSize.value = newVal;
  35653. });
  35654. const innerPageSizes = computed(() => props.pageSizes);
  35655. function handleChange(val) {
  35656. var _a;
  35657. if (val !== innerPageSize.value) {
  35658. innerPageSize.value = val;
  35659. (_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));
  35660. }
  35661. }
  35662. return (_ctx, _cache) => {
  35663. return openBlock(), createElementBlock("span", {
  35664. class: normalizeClass(unref(ns).e("sizes"))
  35665. }, [
  35666. createVNode(unref(ElSelect), {
  35667. "model-value": innerPageSize.value,
  35668. disabled: _ctx.disabled,
  35669. "popper-class": _ctx.popperClass,
  35670. size: _ctx.size,
  35671. teleported: _ctx.teleported,
  35672. "validate-event": false,
  35673. "append-to": _ctx.appendSizeTo,
  35674. onChange: handleChange
  35675. }, {
  35676. default: withCtx(() => [
  35677. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(innerPageSizes), (item) => {
  35678. return openBlock(), createBlock(unref(ElOption), {
  35679. key: item,
  35680. value: item,
  35681. label: item + unref(t)("el.pagination.pagesize")
  35682. }, null, 8, ["value", "label"]);
  35683. }), 128))
  35684. ]),
  35685. _: 1
  35686. }, 8, ["model-value", "disabled", "popper-class", "size", "teleported", "append-to"])
  35687. ], 2);
  35688. };
  35689. }
  35690. });
  35691. var Sizes = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__file", "sizes.vue"]]);
  35692. const paginationJumperProps = buildProps({
  35693. size: {
  35694. type: String,
  35695. values: componentSizes
  35696. }
  35697. });
  35698. const __default__$M = defineComponent({
  35699. name: "ElPaginationJumper"
  35700. });
  35701. const _sfc_main$W = /* @__PURE__ */ defineComponent({
  35702. ...__default__$M,
  35703. props: paginationJumperProps,
  35704. setup(__props) {
  35705. const { t } = useLocale();
  35706. const ns = useNamespace("pagination");
  35707. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  35708. const userInput = ref();
  35709. const innerValue = computed(() => {
  35710. var _a;
  35711. return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value;
  35712. });
  35713. function handleInput(val) {
  35714. userInput.value = val ? +val : "";
  35715. }
  35716. function handleChange(val) {
  35717. val = Math.trunc(+val);
  35718. changeEvent == null ? void 0 : changeEvent(val);
  35719. userInput.value = void 0;
  35720. }
  35721. return (_ctx, _cache) => {
  35722. return openBlock(), createElementBlock("span", {
  35723. class: normalizeClass(unref(ns).e("jump")),
  35724. disabled: unref(disabled)
  35725. }, [
  35726. createElementVNode("span", {
  35727. class: normalizeClass([unref(ns).e("goto")])
  35728. }, toDisplayString(unref(t)("el.pagination.goto")), 3),
  35729. createVNode(unref(ElInput), {
  35730. size: _ctx.size,
  35731. class: normalizeClass([unref(ns).e("editor"), unref(ns).is("in-pagination")]),
  35732. min: 1,
  35733. max: unref(pageCount),
  35734. disabled: unref(disabled),
  35735. "model-value": unref(innerValue),
  35736. "validate-event": false,
  35737. "aria-label": unref(t)("el.pagination.page"),
  35738. type: "number",
  35739. "onUpdate:modelValue": handleInput,
  35740. onChange: handleChange
  35741. }, null, 8, ["size", "class", "max", "disabled", "model-value", "aria-label"]),
  35742. createElementVNode("span", {
  35743. class: normalizeClass([unref(ns).e("classifier")])
  35744. }, toDisplayString(unref(t)("el.pagination.pageClassifier")), 3)
  35745. ], 10, ["disabled"]);
  35746. };
  35747. }
  35748. });
  35749. var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["__file", "jumper.vue"]]);
  35750. const paginationTotalProps = buildProps({
  35751. total: {
  35752. type: Number,
  35753. default: 1e3
  35754. }
  35755. });
  35756. const __default__$L = defineComponent({
  35757. name: "ElPaginationTotal"
  35758. });
  35759. const _sfc_main$V = /* @__PURE__ */ defineComponent({
  35760. ...__default__$L,
  35761. props: paginationTotalProps,
  35762. setup(__props) {
  35763. const { t } = useLocale();
  35764. const ns = useNamespace("pagination");
  35765. const { disabled } = usePagination();
  35766. return (_ctx, _cache) => {
  35767. return openBlock(), createElementBlock("span", {
  35768. class: normalizeClass(unref(ns).e("total")),
  35769. disabled: unref(disabled)
  35770. }, toDisplayString(unref(t)("el.pagination.total", {
  35771. total: _ctx.total
  35772. })), 11, ["disabled"]);
  35773. };
  35774. }
  35775. });
  35776. var Total = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["__file", "total.vue"]]);
  35777. const paginationPagerProps = buildProps({
  35778. currentPage: {
  35779. type: Number,
  35780. default: 1
  35781. },
  35782. pageCount: {
  35783. type: Number,
  35784. required: true
  35785. },
  35786. pagerCount: {
  35787. type: Number,
  35788. default: 7
  35789. },
  35790. disabled: Boolean
  35791. });
  35792. const __default__$K = defineComponent({
  35793. name: "ElPaginationPager"
  35794. });
  35795. const _sfc_main$U = /* @__PURE__ */ defineComponent({
  35796. ...__default__$K,
  35797. props: paginationPagerProps,
  35798. emits: ["change"],
  35799. setup(__props, { emit }) {
  35800. const props = __props;
  35801. const nsPager = useNamespace("pager");
  35802. const nsIcon = useNamespace("icon");
  35803. const { t } = useLocale();
  35804. const showPrevMore = ref(false);
  35805. const showNextMore = ref(false);
  35806. const quickPrevHover = ref(false);
  35807. const quickNextHover = ref(false);
  35808. const quickPrevFocus = ref(false);
  35809. const quickNextFocus = ref(false);
  35810. const pagers = computed(() => {
  35811. const pagerCount = props.pagerCount;
  35812. const halfPagerCount = (pagerCount - 1) / 2;
  35813. const currentPage = Number(props.currentPage);
  35814. const pageCount = Number(props.pageCount);
  35815. let showPrevMore2 = false;
  35816. let showNextMore2 = false;
  35817. if (pageCount > pagerCount) {
  35818. if (currentPage > pagerCount - halfPagerCount) {
  35819. showPrevMore2 = true;
  35820. }
  35821. if (currentPage < pageCount - halfPagerCount) {
  35822. showNextMore2 = true;
  35823. }
  35824. }
  35825. const array = [];
  35826. if (showPrevMore2 && !showNextMore2) {
  35827. const startPage = pageCount - (pagerCount - 2);
  35828. for (let i = startPage; i < pageCount; i++) {
  35829. array.push(i);
  35830. }
  35831. } else if (!showPrevMore2 && showNextMore2) {
  35832. for (let i = 2; i < pagerCount; i++) {
  35833. array.push(i);
  35834. }
  35835. } else if (showPrevMore2 && showNextMore2) {
  35836. const offset = Math.floor(pagerCount / 2) - 1;
  35837. for (let i = currentPage - offset; i <= currentPage + offset; i++) {
  35838. array.push(i);
  35839. }
  35840. } else {
  35841. for (let i = 2; i < pageCount; i++) {
  35842. array.push(i);
  35843. }
  35844. }
  35845. return array;
  35846. });
  35847. const prevMoreKls = computed(() => [
  35848. "more",
  35849. "btn-quickprev",
  35850. nsIcon.b(),
  35851. nsPager.is("disabled", props.disabled)
  35852. ]);
  35853. const nextMoreKls = computed(() => [
  35854. "more",
  35855. "btn-quicknext",
  35856. nsIcon.b(),
  35857. nsPager.is("disabled", props.disabled)
  35858. ]);
  35859. const tabindex = computed(() => props.disabled ? -1 : 0);
  35860. watchEffect(() => {
  35861. const halfPagerCount = (props.pagerCount - 1) / 2;
  35862. showPrevMore.value = false;
  35863. showNextMore.value = false;
  35864. if (props.pageCount > props.pagerCount) {
  35865. if (props.currentPage > props.pagerCount - halfPagerCount) {
  35866. showPrevMore.value = true;
  35867. }
  35868. if (props.currentPage < props.pageCount - halfPagerCount) {
  35869. showNextMore.value = true;
  35870. }
  35871. }
  35872. });
  35873. function onMouseEnter(forward = false) {
  35874. if (props.disabled)
  35875. return;
  35876. if (forward) {
  35877. quickPrevHover.value = true;
  35878. } else {
  35879. quickNextHover.value = true;
  35880. }
  35881. }
  35882. function onFocus(forward = false) {
  35883. if (forward) {
  35884. quickPrevFocus.value = true;
  35885. } else {
  35886. quickNextFocus.value = true;
  35887. }
  35888. }
  35889. function onEnter(e) {
  35890. const target = e.target;
  35891. if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
  35892. const newPage = Number(target.textContent);
  35893. if (newPage !== props.currentPage) {
  35894. emit("change", newPage);
  35895. }
  35896. } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
  35897. onPagerClick(e);
  35898. }
  35899. }
  35900. function onPagerClick(event) {
  35901. const target = event.target;
  35902. if (target.tagName.toLowerCase() === "ul" || props.disabled) {
  35903. return;
  35904. }
  35905. let newPage = Number(target.textContent);
  35906. const pageCount = props.pageCount;
  35907. const currentPage = props.currentPage;
  35908. const pagerCountOffset = props.pagerCount - 2;
  35909. if (target.className.includes("more")) {
  35910. if (target.className.includes("quickprev")) {
  35911. newPage = currentPage - pagerCountOffset;
  35912. } else if (target.className.includes("quicknext")) {
  35913. newPage = currentPage + pagerCountOffset;
  35914. }
  35915. }
  35916. if (!Number.isNaN(+newPage)) {
  35917. if (newPage < 1) {
  35918. newPage = 1;
  35919. }
  35920. if (newPage > pageCount) {
  35921. newPage = pageCount;
  35922. }
  35923. }
  35924. if (newPage !== currentPage) {
  35925. emit("change", newPage);
  35926. }
  35927. }
  35928. return (_ctx, _cache) => {
  35929. return openBlock(), createElementBlock("ul", {
  35930. class: normalizeClass(unref(nsPager).b()),
  35931. onClick: onPagerClick,
  35932. onKeyup: withKeys(onEnter, ["enter"])
  35933. }, [
  35934. _ctx.pageCount > 0 ? (openBlock(), createElementBlock("li", {
  35935. key: 0,
  35936. class: normalizeClass([[
  35937. unref(nsPager).is("active", _ctx.currentPage === 1),
  35938. unref(nsPager).is("disabled", _ctx.disabled)
  35939. ], "number"]),
  35940. "aria-current": _ctx.currentPage === 1,
  35941. "aria-label": unref(t)("el.pagination.currentPage", { pager: 1 }),
  35942. tabindex: unref(tabindex)
  35943. }, " 1 ", 10, ["aria-current", "aria-label", "tabindex"])) : createCommentVNode("v-if", true),
  35944. showPrevMore.value ? (openBlock(), createElementBlock("li", {
  35945. key: 1,
  35946. class: normalizeClass(unref(prevMoreKls)),
  35947. tabindex: unref(tabindex),
  35948. "aria-label": unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
  35949. onMouseenter: ($event) => onMouseEnter(true),
  35950. onMouseleave: ($event) => quickPrevHover.value = false,
  35951. onFocus: ($event) => onFocus(true),
  35952. onBlur: ($event) => quickPrevFocus.value = false
  35953. }, [
  35954. (quickPrevHover.value || quickPrevFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(d_arrow_left_default), { key: 0 })) : (openBlock(), createBlock(unref(more_filled_default), { key: 1 }))
  35955. ], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : createCommentVNode("v-if", true),
  35956. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(pagers), (pager) => {
  35957. return openBlock(), createElementBlock("li", {
  35958. key: pager,
  35959. class: normalizeClass([[
  35960. unref(nsPager).is("active", _ctx.currentPage === pager),
  35961. unref(nsPager).is("disabled", _ctx.disabled)
  35962. ], "number"]),
  35963. "aria-current": _ctx.currentPage === pager,
  35964. "aria-label": unref(t)("el.pagination.currentPage", { pager }),
  35965. tabindex: unref(tabindex)
  35966. }, toDisplayString(pager), 11, ["aria-current", "aria-label", "tabindex"]);
  35967. }), 128)),
  35968. showNextMore.value ? (openBlock(), createElementBlock("li", {
  35969. key: 2,
  35970. class: normalizeClass(unref(nextMoreKls)),
  35971. tabindex: unref(tabindex),
  35972. "aria-label": unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
  35973. onMouseenter: ($event) => onMouseEnter(),
  35974. onMouseleave: ($event) => quickNextHover.value = false,
  35975. onFocus: ($event) => onFocus(),
  35976. onBlur: ($event) => quickNextFocus.value = false
  35977. }, [
  35978. (quickNextHover.value || quickNextFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(d_arrow_right_default), { key: 0 })) : (openBlock(), createBlock(unref(more_filled_default), { key: 1 }))
  35979. ], 42, ["tabindex", "aria-label", "onMouseenter", "onMouseleave", "onFocus", "onBlur"])) : createCommentVNode("v-if", true),
  35980. _ctx.pageCount > 1 ? (openBlock(), createElementBlock("li", {
  35981. key: 3,
  35982. class: normalizeClass([[
  35983. unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
  35984. unref(nsPager).is("disabled", _ctx.disabled)
  35985. ], "number"]),
  35986. "aria-current": _ctx.currentPage === _ctx.pageCount,
  35987. "aria-label": unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
  35988. tabindex: unref(tabindex)
  35989. }, toDisplayString(_ctx.pageCount), 11, ["aria-current", "aria-label", "tabindex"])) : createCommentVNode("v-if", true)
  35990. ], 42, ["onKeyup"]);
  35991. };
  35992. }
  35993. });
  35994. var Pager = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["__file", "pager.vue"]]);
  35995. const isAbsent = (v) => typeof v !== "number";
  35996. const paginationProps = buildProps({
  35997. pageSize: Number,
  35998. defaultPageSize: Number,
  35999. total: Number,
  36000. pageCount: Number,
  36001. pagerCount: {
  36002. type: Number,
  36003. validator: (value) => {
  36004. return isNumber(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
  36005. },
  36006. default: 7
  36007. },
  36008. currentPage: Number,
  36009. defaultCurrentPage: Number,
  36010. layout: {
  36011. type: String,
  36012. default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ")
  36013. },
  36014. pageSizes: {
  36015. type: definePropType(Array),
  36016. default: () => mutable([10, 20, 30, 40, 50, 100])
  36017. },
  36018. popperClass: {
  36019. type: String,
  36020. default: ""
  36021. },
  36022. prevText: {
  36023. type: String,
  36024. default: ""
  36025. },
  36026. prevIcon: {
  36027. type: iconPropType,
  36028. default: () => arrow_left_default
  36029. },
  36030. nextText: {
  36031. type: String,
  36032. default: ""
  36033. },
  36034. nextIcon: {
  36035. type: iconPropType,
  36036. default: () => arrow_right_default
  36037. },
  36038. teleported: {
  36039. type: Boolean,
  36040. default: true
  36041. },
  36042. small: Boolean,
  36043. size: useSizeProp,
  36044. background: Boolean,
  36045. disabled: Boolean,
  36046. hideOnSinglePage: Boolean,
  36047. appendSizeTo: String
  36048. });
  36049. const paginationEmits = {
  36050. "update:current-page": (val) => isNumber(val),
  36051. "update:page-size": (val) => isNumber(val),
  36052. "size-change": (val) => isNumber(val),
  36053. change: (currentPage, pageSize) => isNumber(currentPage) && isNumber(pageSize),
  36054. "current-change": (val) => isNumber(val),
  36055. "prev-click": (val) => isNumber(val),
  36056. "next-click": (val) => isNumber(val)
  36057. };
  36058. const componentName = "ElPagination";
  36059. var Pagination = defineComponent({
  36060. name: componentName,
  36061. props: paginationProps,
  36062. emits: paginationEmits,
  36063. setup(props, { emit, slots }) {
  36064. const { t } = useLocale();
  36065. const ns = useNamespace("pagination");
  36066. const vnodeProps = getCurrentInstance().vnode.props || {};
  36067. const _globalSize = useGlobalSize();
  36068. const _size = computed(() => {
  36069. var _a;
  36070. return props.small ? "small" : (_a = props.size) != null ? _a : _globalSize.value;
  36071. });
  36072. useDeprecated({
  36073. from: "small",
  36074. replacement: "size",
  36075. version: "3.0.0",
  36076. scope: "el-pagination",
  36077. ref: "https://element-plus.org/zh-CN/component/pagination.html"
  36078. }, computed(() => !!props.small));
  36079. const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
  36080. const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
  36081. const assertValidUsage = computed(() => {
  36082. if (isAbsent(props.total) && isAbsent(props.pageCount))
  36083. return false;
  36084. if (!isAbsent(props.currentPage) && !hasCurrentPageListener)
  36085. return false;
  36086. if (props.layout.includes("sizes")) {
  36087. if (!isAbsent(props.pageCount)) {
  36088. if (!hasPageSizeListener)
  36089. return false;
  36090. } else if (!isAbsent(props.total)) {
  36091. if (!isAbsent(props.pageSize)) {
  36092. if (!hasPageSizeListener) {
  36093. return false;
  36094. }
  36095. }
  36096. }
  36097. }
  36098. return true;
  36099. });
  36100. const innerPageSize = ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
  36101. const innerCurrentPage = ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
  36102. const pageSizeBridge = computed({
  36103. get() {
  36104. return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
  36105. },
  36106. set(v) {
  36107. if (isAbsent(props.pageSize)) {
  36108. innerPageSize.value = v;
  36109. }
  36110. if (hasPageSizeListener) {
  36111. emit("update:page-size", v);
  36112. emit("size-change", v);
  36113. }
  36114. }
  36115. });
  36116. const pageCountBridge = computed(() => {
  36117. let pageCount = 0;
  36118. if (!isAbsent(props.pageCount)) {
  36119. pageCount = props.pageCount;
  36120. } else if (!isAbsent(props.total)) {
  36121. pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
  36122. }
  36123. return pageCount;
  36124. });
  36125. const currentPageBridge = computed({
  36126. get() {
  36127. return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
  36128. },
  36129. set(v) {
  36130. let newCurrentPage = v;
  36131. if (v < 1) {
  36132. newCurrentPage = 1;
  36133. } else if (v > pageCountBridge.value) {
  36134. newCurrentPage = pageCountBridge.value;
  36135. }
  36136. if (isAbsent(props.currentPage)) {
  36137. innerCurrentPage.value = newCurrentPage;
  36138. }
  36139. if (hasCurrentPageListener) {
  36140. emit("update:current-page", newCurrentPage);
  36141. emit("current-change", newCurrentPage);
  36142. }
  36143. }
  36144. });
  36145. watch(pageCountBridge, (val) => {
  36146. if (currentPageBridge.value > val)
  36147. currentPageBridge.value = val;
  36148. });
  36149. watch([currentPageBridge, pageSizeBridge], (value) => {
  36150. emit("change", ...value);
  36151. }, { flush: "post" });
  36152. function handleCurrentChange(val) {
  36153. currentPageBridge.value = val;
  36154. }
  36155. function handleSizeChange(val) {
  36156. pageSizeBridge.value = val;
  36157. const newPageCount = pageCountBridge.value;
  36158. if (currentPageBridge.value > newPageCount) {
  36159. currentPageBridge.value = newPageCount;
  36160. }
  36161. }
  36162. function prev() {
  36163. if (props.disabled)
  36164. return;
  36165. currentPageBridge.value -= 1;
  36166. emit("prev-click", currentPageBridge.value);
  36167. }
  36168. function next() {
  36169. if (props.disabled)
  36170. return;
  36171. currentPageBridge.value += 1;
  36172. emit("next-click", currentPageBridge.value);
  36173. }
  36174. function addClass(element, cls) {
  36175. if (element) {
  36176. if (!element.props) {
  36177. element.props = {};
  36178. }
  36179. element.props.class = [element.props.class, cls].join(" ");
  36180. }
  36181. }
  36182. provide(elPaginationKey, {
  36183. pageCount: pageCountBridge,
  36184. disabled: computed(() => props.disabled),
  36185. currentPage: currentPageBridge,
  36186. changeEvent: handleCurrentChange,
  36187. handleSizeChange
  36188. });
  36189. return () => {
  36190. var _a, _b;
  36191. if (!assertValidUsage.value) {
  36192. debugWarn(componentName, t("el.pagination.deprecationWarning"));
  36193. return null;
  36194. }
  36195. if (!props.layout)
  36196. return null;
  36197. if (props.hideOnSinglePage && pageCountBridge.value <= 1)
  36198. return null;
  36199. const rootChildren = [];
  36200. const rightWrapperChildren = [];
  36201. const rightWrapperRoot = h$1("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
  36202. const TEMPLATE_MAP = {
  36203. prev: h$1(Prev, {
  36204. disabled: props.disabled,
  36205. currentPage: currentPageBridge.value,
  36206. prevText: props.prevText,
  36207. prevIcon: props.prevIcon,
  36208. onClick: prev
  36209. }),
  36210. jumper: h$1(Jumper, {
  36211. size: _size.value
  36212. }),
  36213. pager: h$1(Pager, {
  36214. currentPage: currentPageBridge.value,
  36215. pageCount: pageCountBridge.value,
  36216. pagerCount: props.pagerCount,
  36217. onChange: handleCurrentChange,
  36218. disabled: props.disabled
  36219. }),
  36220. next: h$1(Next, {
  36221. disabled: props.disabled,
  36222. currentPage: currentPageBridge.value,
  36223. pageCount: pageCountBridge.value,
  36224. nextText: props.nextText,
  36225. nextIcon: props.nextIcon,
  36226. onClick: next
  36227. }),
  36228. sizes: h$1(Sizes, {
  36229. pageSize: pageSizeBridge.value,
  36230. pageSizes: props.pageSizes,
  36231. popperClass: props.popperClass,
  36232. disabled: props.disabled,
  36233. teleported: props.teleported,
  36234. size: _size.value,
  36235. appendSizeTo: props.appendSizeTo
  36236. }),
  36237. slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null,
  36238. total: h$1(Total, { total: isAbsent(props.total) ? 0 : props.total })
  36239. };
  36240. const components = props.layout.split(",").map((item) => item.trim());
  36241. let haveRightWrapper = false;
  36242. components.forEach((c) => {
  36243. if (c === "->") {
  36244. haveRightWrapper = true;
  36245. return;
  36246. }
  36247. if (!haveRightWrapper) {
  36248. rootChildren.push(TEMPLATE_MAP[c]);
  36249. } else {
  36250. rightWrapperChildren.push(TEMPLATE_MAP[c]);
  36251. }
  36252. });
  36253. addClass(rootChildren[0], ns.is("first"));
  36254. addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
  36255. if (haveRightWrapper && rightWrapperChildren.length > 0) {
  36256. addClass(rightWrapperChildren[0], ns.is("first"));
  36257. addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
  36258. rootChildren.push(rightWrapperRoot);
  36259. }
  36260. return h$1("div", {
  36261. class: [
  36262. ns.b(),
  36263. ns.is("background", props.background),
  36264. ns.m(_size.value)
  36265. ]
  36266. }, rootChildren);
  36267. };
  36268. }
  36269. });
  36270. const ElPagination = withInstall(Pagination);
  36271. const popconfirmProps = buildProps({
  36272. title: String,
  36273. confirmButtonText: String,
  36274. cancelButtonText: String,
  36275. confirmButtonType: {
  36276. type: String,
  36277. values: buttonTypes,
  36278. default: "primary"
  36279. },
  36280. cancelButtonType: {
  36281. type: String,
  36282. values: buttonTypes,
  36283. default: "text"
  36284. },
  36285. icon: {
  36286. type: iconPropType,
  36287. default: () => question_filled_default
  36288. },
  36289. iconColor: {
  36290. type: String,
  36291. default: "#f90"
  36292. },
  36293. hideIcon: {
  36294. type: Boolean,
  36295. default: false
  36296. },
  36297. hideAfter: {
  36298. type: Number,
  36299. default: 200
  36300. },
  36301. teleported: useTooltipContentProps.teleported,
  36302. persistent: useTooltipContentProps.persistent,
  36303. width: {
  36304. type: [String, Number],
  36305. default: 150
  36306. }
  36307. });
  36308. const popconfirmEmits = {
  36309. confirm: (e) => e instanceof MouseEvent,
  36310. cancel: (e) => e instanceof MouseEvent
  36311. };
  36312. const __default__$J = defineComponent({
  36313. name: "ElPopconfirm"
  36314. });
  36315. const _sfc_main$T = /* @__PURE__ */ defineComponent({
  36316. ...__default__$J,
  36317. props: popconfirmProps,
  36318. emits: popconfirmEmits,
  36319. setup(__props, { emit }) {
  36320. const props = __props;
  36321. const { t } = useLocale();
  36322. const ns = useNamespace("popconfirm");
  36323. const tooltipRef = ref();
  36324. const hidePopper = () => {
  36325. var _a, _b;
  36326. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);
  36327. };
  36328. const style = computed(() => {
  36329. return {
  36330. width: addUnit(props.width)
  36331. };
  36332. });
  36333. const confirm = (e) => {
  36334. emit("confirm", e);
  36335. hidePopper();
  36336. };
  36337. const cancel = (e) => {
  36338. emit("cancel", e);
  36339. hidePopper();
  36340. };
  36341. const finalConfirmButtonText = computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
  36342. const finalCancelButtonText = computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
  36343. return (_ctx, _cache) => {
  36344. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  36345. ref_key: "tooltipRef",
  36346. ref: tooltipRef,
  36347. trigger: "click",
  36348. effect: "light"
  36349. }, _ctx.$attrs, {
  36350. "popper-class": `${unref(ns).namespace.value}-popover`,
  36351. "popper-style": unref(style),
  36352. teleported: _ctx.teleported,
  36353. "fallback-placements": ["bottom", "top", "right", "left"],
  36354. "hide-after": _ctx.hideAfter,
  36355. persistent: _ctx.persistent
  36356. }), {
  36357. content: withCtx(() => [
  36358. createElementVNode("div", {
  36359. class: normalizeClass(unref(ns).b())
  36360. }, [
  36361. createElementVNode("div", {
  36362. class: normalizeClass(unref(ns).e("main"))
  36363. }, [
  36364. !_ctx.hideIcon && _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
  36365. key: 0,
  36366. class: normalizeClass(unref(ns).e("icon")),
  36367. style: normalizeStyle({ color: _ctx.iconColor })
  36368. }, {
  36369. default: withCtx(() => [
  36370. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  36371. ]),
  36372. _: 1
  36373. }, 8, ["class", "style"])) : createCommentVNode("v-if", true),
  36374. createTextVNode(" " + toDisplayString(_ctx.title), 1)
  36375. ], 2),
  36376. createElementVNode("div", {
  36377. class: normalizeClass(unref(ns).e("action"))
  36378. }, [
  36379. renderSlot(_ctx.$slots, "actions", {
  36380. confirm,
  36381. cancel
  36382. }, () => [
  36383. createVNode(unref(ElButton), {
  36384. size: "small",
  36385. type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
  36386. text: _ctx.cancelButtonType === "text",
  36387. onClick: cancel
  36388. }, {
  36389. default: withCtx(() => [
  36390. createTextVNode(toDisplayString(unref(finalCancelButtonText)), 1)
  36391. ]),
  36392. _: 1
  36393. }, 8, ["type", "text"]),
  36394. createVNode(unref(ElButton), {
  36395. size: "small",
  36396. type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
  36397. text: _ctx.confirmButtonType === "text",
  36398. onClick: confirm
  36399. }, {
  36400. default: withCtx(() => [
  36401. createTextVNode(toDisplayString(unref(finalConfirmButtonText)), 1)
  36402. ]),
  36403. _: 1
  36404. }, 8, ["type", "text"])
  36405. ])
  36406. ], 2)
  36407. ], 2)
  36408. ]),
  36409. default: withCtx(() => [
  36410. _ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)
  36411. ]),
  36412. _: 3
  36413. }, 16, ["popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
  36414. };
  36415. }
  36416. });
  36417. var Popconfirm = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["__file", "popconfirm.vue"]]);
  36418. const ElPopconfirm = withInstall(Popconfirm);
  36419. const popoverProps = buildProps({
  36420. trigger: useTooltipTriggerProps.trigger,
  36421. placement: dropdownProps.placement,
  36422. disabled: useTooltipTriggerProps.disabled,
  36423. visible: useTooltipContentProps.visible,
  36424. transition: useTooltipContentProps.transition,
  36425. popperOptions: dropdownProps.popperOptions,
  36426. tabindex: dropdownProps.tabindex,
  36427. content: useTooltipContentProps.content,
  36428. popperStyle: useTooltipContentProps.popperStyle,
  36429. popperClass: useTooltipContentProps.popperClass,
  36430. enterable: {
  36431. ...useTooltipContentProps.enterable,
  36432. default: true
  36433. },
  36434. effect: {
  36435. ...useTooltipContentProps.effect,
  36436. default: "light"
  36437. },
  36438. teleported: useTooltipContentProps.teleported,
  36439. title: String,
  36440. width: {
  36441. type: [String, Number],
  36442. default: 150
  36443. },
  36444. offset: {
  36445. type: Number,
  36446. default: void 0
  36447. },
  36448. showAfter: {
  36449. type: Number,
  36450. default: 0
  36451. },
  36452. hideAfter: {
  36453. type: Number,
  36454. default: 200
  36455. },
  36456. autoClose: {
  36457. type: Number,
  36458. default: 0
  36459. },
  36460. showArrow: {
  36461. type: Boolean,
  36462. default: true
  36463. },
  36464. persistent: {
  36465. type: Boolean,
  36466. default: true
  36467. },
  36468. "onUpdate:visible": {
  36469. type: Function
  36470. }
  36471. });
  36472. const popoverEmits = {
  36473. "update:visible": (value) => isBoolean(value),
  36474. "before-enter": () => true,
  36475. "before-leave": () => true,
  36476. "after-enter": () => true,
  36477. "after-leave": () => true
  36478. };
  36479. const updateEventKeyRaw = `onUpdate:visible`;
  36480. const __default__$I = defineComponent({
  36481. name: "ElPopover"
  36482. });
  36483. const _sfc_main$S = /* @__PURE__ */ defineComponent({
  36484. ...__default__$I,
  36485. props: popoverProps,
  36486. emits: popoverEmits,
  36487. setup(__props, { expose, emit }) {
  36488. const props = __props;
  36489. const onUpdateVisible = computed(() => {
  36490. return props[updateEventKeyRaw];
  36491. });
  36492. const ns = useNamespace("popover");
  36493. const tooltipRef = ref();
  36494. const popperRef = computed(() => {
  36495. var _a;
  36496. return (_a = unref(tooltipRef)) == null ? void 0 : _a.popperRef;
  36497. });
  36498. const style = computed(() => {
  36499. return [
  36500. {
  36501. width: addUnit(props.width)
  36502. },
  36503. props.popperStyle
  36504. ];
  36505. });
  36506. const kls = computed(() => {
  36507. return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
  36508. });
  36509. const gpuAcceleration = computed(() => {
  36510. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  36511. });
  36512. const hide = () => {
  36513. var _a;
  36514. (_a = tooltipRef.value) == null ? void 0 : _a.hide();
  36515. };
  36516. const beforeEnter = () => {
  36517. emit("before-enter");
  36518. };
  36519. const beforeLeave = () => {
  36520. emit("before-leave");
  36521. };
  36522. const afterEnter = () => {
  36523. emit("after-enter");
  36524. };
  36525. const afterLeave = () => {
  36526. emit("update:visible", false);
  36527. emit("after-leave");
  36528. };
  36529. expose({
  36530. popperRef,
  36531. hide
  36532. });
  36533. return (_ctx, _cache) => {
  36534. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  36535. ref_key: "tooltipRef",
  36536. ref: tooltipRef
  36537. }, _ctx.$attrs, {
  36538. trigger: _ctx.trigger,
  36539. placement: _ctx.placement,
  36540. disabled: _ctx.disabled,
  36541. visible: _ctx.visible,
  36542. transition: _ctx.transition,
  36543. "popper-options": _ctx.popperOptions,
  36544. tabindex: _ctx.tabindex,
  36545. content: _ctx.content,
  36546. offset: _ctx.offset,
  36547. "show-after": _ctx.showAfter,
  36548. "hide-after": _ctx.hideAfter,
  36549. "auto-close": _ctx.autoClose,
  36550. "show-arrow": _ctx.showArrow,
  36551. "aria-label": _ctx.title,
  36552. effect: _ctx.effect,
  36553. enterable: _ctx.enterable,
  36554. "popper-class": unref(kls),
  36555. "popper-style": unref(style),
  36556. teleported: _ctx.teleported,
  36557. persistent: _ctx.persistent,
  36558. "gpu-acceleration": unref(gpuAcceleration),
  36559. "onUpdate:visible": unref(onUpdateVisible),
  36560. onBeforeShow: beforeEnter,
  36561. onBeforeHide: beforeLeave,
  36562. onShow: afterEnter,
  36563. onHide: afterLeave
  36564. }), {
  36565. content: withCtx(() => [
  36566. _ctx.title ? (openBlock(), createElementBlock("div", {
  36567. key: 0,
  36568. class: normalizeClass(unref(ns).e("title")),
  36569. role: "title"
  36570. }, toDisplayString(_ctx.title), 3)) : createCommentVNode("v-if", true),
  36571. renderSlot(_ctx.$slots, "default", {}, () => [
  36572. createTextVNode(toDisplayString(_ctx.content), 1)
  36573. ])
  36574. ]),
  36575. default: withCtx(() => [
  36576. _ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)
  36577. ]),
  36578. _: 3
  36579. }, 16, ["trigger", "placement", "disabled", "visible", "transition", "popper-options", "tabindex", "content", "offset", "show-after", "hide-after", "auto-close", "show-arrow", "aria-label", "effect", "enterable", "popper-class", "popper-style", "teleported", "persistent", "gpu-acceleration", "onUpdate:visible"]);
  36580. };
  36581. }
  36582. });
  36583. var Popover = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["__file", "popover.vue"]]);
  36584. const attachEvents = (el, binding) => {
  36585. const popperComponent = binding.arg || binding.value;
  36586. const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
  36587. if (popover) {
  36588. popover.triggerRef = el;
  36589. }
  36590. };
  36591. var PopoverDirective = {
  36592. mounted(el, binding) {
  36593. attachEvents(el, binding);
  36594. },
  36595. updated(el, binding) {
  36596. attachEvents(el, binding);
  36597. }
  36598. };
  36599. const VPopover = "popover";
  36600. const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
  36601. const ElPopover = withInstall(Popover, {
  36602. directive: ElPopoverDirective
  36603. });
  36604. const progressProps = buildProps({
  36605. type: {
  36606. type: String,
  36607. default: "line",
  36608. values: ["line", "circle", "dashboard"]
  36609. },
  36610. percentage: {
  36611. type: Number,
  36612. default: 0,
  36613. validator: (val) => val >= 0 && val <= 100
  36614. },
  36615. status: {
  36616. type: String,
  36617. default: "",
  36618. values: ["", "success", "exception", "warning"]
  36619. },
  36620. indeterminate: Boolean,
  36621. duration: {
  36622. type: Number,
  36623. default: 3
  36624. },
  36625. strokeWidth: {
  36626. type: Number,
  36627. default: 6
  36628. },
  36629. strokeLinecap: {
  36630. type: definePropType(String),
  36631. default: "round"
  36632. },
  36633. textInside: Boolean,
  36634. width: {
  36635. type: Number,
  36636. default: 126
  36637. },
  36638. showText: {
  36639. type: Boolean,
  36640. default: true
  36641. },
  36642. color: {
  36643. type: definePropType([
  36644. String,
  36645. Array,
  36646. Function
  36647. ]),
  36648. default: ""
  36649. },
  36650. striped: Boolean,
  36651. stripedFlow: Boolean,
  36652. format: {
  36653. type: definePropType(Function),
  36654. default: (percentage) => `${percentage}%`
  36655. }
  36656. });
  36657. const __default__$H = defineComponent({
  36658. name: "ElProgress"
  36659. });
  36660. const _sfc_main$R = /* @__PURE__ */ defineComponent({
  36661. ...__default__$H,
  36662. props: progressProps,
  36663. setup(__props) {
  36664. const props = __props;
  36665. const STATUS_COLOR_MAP = {
  36666. success: "#13ce66",
  36667. exception: "#ff4949",
  36668. warning: "#e6a23c",
  36669. default: "#20a0ff"
  36670. };
  36671. const ns = useNamespace("progress");
  36672. const barStyle = computed(() => {
  36673. const barStyle2 = {
  36674. width: `${props.percentage}%`,
  36675. animationDuration: `${props.duration}s`
  36676. };
  36677. const color = getCurrentColor(props.percentage);
  36678. if (color.includes("gradient")) {
  36679. barStyle2.background = color;
  36680. } else {
  36681. barStyle2.backgroundColor = color;
  36682. }
  36683. return barStyle2;
  36684. });
  36685. const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  36686. const radius = computed(() => {
  36687. if (["circle", "dashboard"].includes(props.type)) {
  36688. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  36689. }
  36690. return 0;
  36691. });
  36692. const trackPath = computed(() => {
  36693. const r = radius.value;
  36694. const isDashboard = props.type === "dashboard";
  36695. return `
  36696. M 50 50
  36697. m 0 ${isDashboard ? "" : "-"}${r}
  36698. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  36699. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  36700. `;
  36701. });
  36702. const perimeter = computed(() => 2 * Math.PI * radius.value);
  36703. const rate = computed(() => props.type === "dashboard" ? 0.75 : 1);
  36704. const strokeDashoffset = computed(() => {
  36705. const offset = -1 * perimeter.value * (1 - rate.value) / 2;
  36706. return `${offset}px`;
  36707. });
  36708. const trailPathStyle = computed(() => ({
  36709. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  36710. strokeDashoffset: strokeDashoffset.value
  36711. }));
  36712. const circlePathStyle = computed(() => ({
  36713. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  36714. strokeDashoffset: strokeDashoffset.value,
  36715. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
  36716. }));
  36717. const stroke = computed(() => {
  36718. let ret;
  36719. if (props.color) {
  36720. ret = getCurrentColor(props.percentage);
  36721. } else {
  36722. ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
  36723. }
  36724. return ret;
  36725. });
  36726. const statusIcon = computed(() => {
  36727. if (props.status === "warning") {
  36728. return warning_filled_default;
  36729. }
  36730. if (props.type === "line") {
  36731. return props.status === "success" ? circle_check_default : circle_close_default;
  36732. } else {
  36733. return props.status === "success" ? check_default : close_default;
  36734. }
  36735. });
  36736. const progressTextSize = computed(() => {
  36737. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  36738. });
  36739. const content = computed(() => props.format(props.percentage));
  36740. function getColors(color) {
  36741. const span = 100 / color.length;
  36742. const seriesColors = color.map((seriesColor, index) => {
  36743. if (isString$1(seriesColor)) {
  36744. return {
  36745. color: seriesColor,
  36746. percentage: (index + 1) * span
  36747. };
  36748. }
  36749. return seriesColor;
  36750. });
  36751. return seriesColors.sort((a, b) => a.percentage - b.percentage);
  36752. }
  36753. const getCurrentColor = (percentage) => {
  36754. var _a;
  36755. const { color } = props;
  36756. if (isFunction$1(color)) {
  36757. return color(percentage);
  36758. } else if (isString$1(color)) {
  36759. return color;
  36760. } else {
  36761. const colors = getColors(color);
  36762. for (const color2 of colors) {
  36763. if (color2.percentage > percentage)
  36764. return color2.color;
  36765. }
  36766. return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color;
  36767. }
  36768. };
  36769. return (_ctx, _cache) => {
  36770. return openBlock(), createElementBlock("div", {
  36771. class: normalizeClass([
  36772. unref(ns).b(),
  36773. unref(ns).m(_ctx.type),
  36774. unref(ns).is(_ctx.status),
  36775. {
  36776. [unref(ns).m("without-text")]: !_ctx.showText,
  36777. [unref(ns).m("text-inside")]: _ctx.textInside
  36778. }
  36779. ]),
  36780. role: "progressbar",
  36781. "aria-valuenow": _ctx.percentage,
  36782. "aria-valuemin": "0",
  36783. "aria-valuemax": "100"
  36784. }, [
  36785. _ctx.type === "line" ? (openBlock(), createElementBlock("div", {
  36786. key: 0,
  36787. class: normalizeClass(unref(ns).b("bar"))
  36788. }, [
  36789. createElementVNode("div", {
  36790. class: normalizeClass(unref(ns).be("bar", "outer")),
  36791. style: normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  36792. }, [
  36793. createElementVNode("div", {
  36794. class: normalizeClass([
  36795. unref(ns).be("bar", "inner"),
  36796. { [unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate },
  36797. { [unref(ns).bem("bar", "inner", "striped")]: _ctx.striped },
  36798. { [unref(ns).bem("bar", "inner", "striped-flow")]: _ctx.stripedFlow }
  36799. ]),
  36800. style: normalizeStyle(unref(barStyle))
  36801. }, [
  36802. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock("div", {
  36803. key: 0,
  36804. class: normalizeClass(unref(ns).be("bar", "innerText"))
  36805. }, [
  36806. renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  36807. createElementVNode("span", null, toDisplayString(unref(content)), 1)
  36808. ])
  36809. ], 2)) : createCommentVNode("v-if", true)
  36810. ], 6)
  36811. ], 6)
  36812. ], 2)) : (openBlock(), createElementBlock("div", {
  36813. key: 1,
  36814. class: normalizeClass(unref(ns).b("circle")),
  36815. style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  36816. }, [
  36817. (openBlock(), createElementBlock("svg", { viewBox: "0 0 100 100" }, [
  36818. createElementVNode("path", {
  36819. class: normalizeClass(unref(ns).be("circle", "track")),
  36820. d: unref(trackPath),
  36821. stroke: `var(${unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
  36822. "stroke-linecap": _ctx.strokeLinecap,
  36823. "stroke-width": unref(relativeStrokeWidth),
  36824. fill: "none",
  36825. style: normalizeStyle(unref(trailPathStyle))
  36826. }, null, 14, ["d", "stroke", "stroke-linecap", "stroke-width"]),
  36827. createElementVNode("path", {
  36828. class: normalizeClass(unref(ns).be("circle", "path")),
  36829. d: unref(trackPath),
  36830. stroke: unref(stroke),
  36831. fill: "none",
  36832. opacity: _ctx.percentage ? 1 : 0,
  36833. "stroke-linecap": _ctx.strokeLinecap,
  36834. "stroke-width": unref(relativeStrokeWidth),
  36835. style: normalizeStyle(unref(circlePathStyle))
  36836. }, null, 14, ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"])
  36837. ]))
  36838. ], 6)),
  36839. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock("div", {
  36840. key: 2,
  36841. class: normalizeClass(unref(ns).e("text")),
  36842. style: normalizeStyle({ fontSize: `${unref(progressTextSize)}px` })
  36843. }, [
  36844. renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  36845. !_ctx.status ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(unref(content)), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  36846. default: withCtx(() => [
  36847. (openBlock(), createBlock(resolveDynamicComponent(unref(statusIcon))))
  36848. ]),
  36849. _: 1
  36850. }))
  36851. ])
  36852. ], 6)) : createCommentVNode("v-if", true)
  36853. ], 10, ["aria-valuenow"]);
  36854. };
  36855. }
  36856. });
  36857. var Progress = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__file", "progress.vue"]]);
  36858. const ElProgress = withInstall(Progress);
  36859. const rateProps = buildProps({
  36860. modelValue: {
  36861. type: Number,
  36862. default: 0
  36863. },
  36864. id: {
  36865. type: String,
  36866. default: void 0
  36867. },
  36868. lowThreshold: {
  36869. type: Number,
  36870. default: 2
  36871. },
  36872. highThreshold: {
  36873. type: Number,
  36874. default: 4
  36875. },
  36876. max: {
  36877. type: Number,
  36878. default: 5
  36879. },
  36880. colors: {
  36881. type: definePropType([Array, Object]),
  36882. default: () => mutable(["", "", ""])
  36883. },
  36884. voidColor: {
  36885. type: String,
  36886. default: ""
  36887. },
  36888. disabledVoidColor: {
  36889. type: String,
  36890. default: ""
  36891. },
  36892. icons: {
  36893. type: definePropType([Array, Object]),
  36894. default: () => [star_filled_default, star_filled_default, star_filled_default]
  36895. },
  36896. voidIcon: {
  36897. type: iconPropType,
  36898. default: () => star_default
  36899. },
  36900. disabledVoidIcon: {
  36901. type: iconPropType,
  36902. default: () => star_filled_default
  36903. },
  36904. disabled: Boolean,
  36905. allowHalf: Boolean,
  36906. showText: Boolean,
  36907. showScore: Boolean,
  36908. textColor: {
  36909. type: String,
  36910. default: ""
  36911. },
  36912. texts: {
  36913. type: definePropType(Array),
  36914. default: () => mutable([
  36915. "Extremely bad",
  36916. "Disappointed",
  36917. "Fair",
  36918. "Satisfied",
  36919. "Surprise"
  36920. ])
  36921. },
  36922. scoreTemplate: {
  36923. type: String,
  36924. default: "{value}"
  36925. },
  36926. size: useSizeProp,
  36927. clearable: Boolean,
  36928. ...useAriaProps(["ariaLabel"])
  36929. });
  36930. const rateEmits = {
  36931. [CHANGE_EVENT]: (value) => isNumber(value),
  36932. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  36933. };
  36934. const __default__$G = defineComponent({
  36935. name: "ElRate"
  36936. });
  36937. const _sfc_main$Q = /* @__PURE__ */ defineComponent({
  36938. ...__default__$G,
  36939. props: rateProps,
  36940. emits: rateEmits,
  36941. setup(__props, { expose, emit }) {
  36942. const props = __props;
  36943. function getValueFromMap(value, map) {
  36944. const isExcludedObject = (val) => isObject$1(val);
  36945. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  36946. const val = map[key];
  36947. const excluded = isExcludedObject(val) ? val.excluded : false;
  36948. return excluded ? value < key : value <= key;
  36949. }).sort((a, b) => a - b);
  36950. const matchedValue = map[matchedKeys[0]];
  36951. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  36952. }
  36953. const formContext = inject(formContextKey, void 0);
  36954. const formItemContext = inject(formItemContextKey, void 0);
  36955. const rateSize = useFormSize();
  36956. const ns = useNamespace("rate");
  36957. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  36958. formItemContext
  36959. });
  36960. const currentValue = ref(props.modelValue);
  36961. const hoverIndex = ref(-1);
  36962. const pointerAtLeftHalf = ref(true);
  36963. const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
  36964. const rateDisabled = computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  36965. const rateStyles = computed(() => {
  36966. return ns.cssVarBlock({
  36967. "void-color": props.voidColor,
  36968. "disabled-void-color": props.disabledVoidColor,
  36969. "fill-color": activeColor.value
  36970. });
  36971. });
  36972. const text = computed(() => {
  36973. let result = "";
  36974. if (props.showScore) {
  36975. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  36976. } else if (props.showText) {
  36977. result = props.texts[Math.ceil(currentValue.value) - 1];
  36978. }
  36979. return result;
  36980. });
  36981. const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  36982. const colorMap = computed(() => isArray$1(props.colors) ? {
  36983. [props.lowThreshold]: props.colors[0],
  36984. [props.highThreshold]: { value: props.colors[1], excluded: true },
  36985. [props.max]: props.colors[2]
  36986. } : props.colors);
  36987. const activeColor = computed(() => {
  36988. const color = getValueFromMap(currentValue.value, colorMap.value);
  36989. return isObject$1(color) ? "" : color;
  36990. });
  36991. const decimalStyle = computed(() => {
  36992. let width = "";
  36993. if (rateDisabled.value) {
  36994. width = `${valueDecimal.value}%`;
  36995. } else if (props.allowHalf) {
  36996. width = "50%";
  36997. }
  36998. return {
  36999. color: activeColor.value,
  37000. width
  37001. };
  37002. });
  37003. const componentMap = computed(() => {
  37004. let icons = isArray$1(props.icons) ? [...props.icons] : { ...props.icons };
  37005. icons = markRaw(icons);
  37006. return isArray$1(icons) ? {
  37007. [props.lowThreshold]: icons[0],
  37008. [props.highThreshold]: {
  37009. value: icons[1],
  37010. excluded: true
  37011. },
  37012. [props.max]: icons[2]
  37013. } : icons;
  37014. });
  37015. const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
  37016. const voidComponent = computed(() => rateDisabled.value ? isString$1(props.disabledVoidIcon) ? props.disabledVoidIcon : markRaw(props.disabledVoidIcon) : isString$1(props.voidIcon) ? props.voidIcon : markRaw(props.voidIcon));
  37017. const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
  37018. function showDecimalIcon(item) {
  37019. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  37020. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  37021. return showWhenDisabled || showWhenAllowHalf;
  37022. }
  37023. function emitValue(value) {
  37024. if (props.clearable && value === props.modelValue) {
  37025. value = 0;
  37026. }
  37027. emit(UPDATE_MODEL_EVENT, value);
  37028. if (props.modelValue !== value) {
  37029. emit("change", value);
  37030. }
  37031. }
  37032. function selectValue(value) {
  37033. if (rateDisabled.value) {
  37034. return;
  37035. }
  37036. if (props.allowHalf && pointerAtLeftHalf.value) {
  37037. emitValue(currentValue.value);
  37038. } else {
  37039. emitValue(value);
  37040. }
  37041. }
  37042. function handleKey(e) {
  37043. if (rateDisabled.value) {
  37044. return;
  37045. }
  37046. let _currentValue = currentValue.value;
  37047. const code = e.code;
  37048. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  37049. if (props.allowHalf) {
  37050. _currentValue += 0.5;
  37051. } else {
  37052. _currentValue += 1;
  37053. }
  37054. e.stopPropagation();
  37055. e.preventDefault();
  37056. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  37057. if (props.allowHalf) {
  37058. _currentValue -= 0.5;
  37059. } else {
  37060. _currentValue -= 1;
  37061. }
  37062. e.stopPropagation();
  37063. e.preventDefault();
  37064. }
  37065. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  37066. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  37067. emit(UPDATE_MODEL_EVENT, _currentValue);
  37068. emit("change", _currentValue);
  37069. return _currentValue;
  37070. }
  37071. function setCurrentValue(value, event) {
  37072. if (rateDisabled.value) {
  37073. return;
  37074. }
  37075. if (props.allowHalf && event) {
  37076. let target = event.target;
  37077. if (hasClass(target, ns.e("item"))) {
  37078. target = target.querySelector(`.${ns.e("icon")}`);
  37079. }
  37080. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  37081. target = target.parentNode;
  37082. }
  37083. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  37084. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  37085. } else {
  37086. currentValue.value = value;
  37087. }
  37088. hoverIndex.value = value;
  37089. }
  37090. function resetCurrentValue() {
  37091. if (rateDisabled.value) {
  37092. return;
  37093. }
  37094. if (props.allowHalf) {
  37095. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  37096. }
  37097. currentValue.value = props.modelValue;
  37098. hoverIndex.value = -1;
  37099. }
  37100. watch(() => props.modelValue, (val) => {
  37101. currentValue.value = val;
  37102. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  37103. });
  37104. if (!props.modelValue) {
  37105. emit(UPDATE_MODEL_EVENT, 0);
  37106. }
  37107. expose({
  37108. setCurrentValue,
  37109. resetCurrentValue
  37110. });
  37111. return (_ctx, _cache) => {
  37112. var _a;
  37113. return openBlock(), createElementBlock("div", {
  37114. id: unref(inputId),
  37115. class: normalizeClass([unref(rateClasses), unref(ns).is("disabled", unref(rateDisabled))]),
  37116. role: "slider",
  37117. "aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "rating" : void 0,
  37118. "aria-labelledby": unref(isLabeledByFormItem) ? (_a = unref(formItemContext)) == null ? void 0 : _a.labelId : void 0,
  37119. "aria-valuenow": currentValue.value,
  37120. "aria-valuetext": unref(text) || void 0,
  37121. "aria-valuemin": "0",
  37122. "aria-valuemax": _ctx.max,
  37123. tabindex: "0",
  37124. style: normalizeStyle(unref(rateStyles)),
  37125. onKeydown: handleKey
  37126. }, [
  37127. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.max, (item, key) => {
  37128. return openBlock(), createElementBlock("span", {
  37129. key,
  37130. class: normalizeClass(unref(ns).e("item")),
  37131. onMousemove: ($event) => setCurrentValue(item, $event),
  37132. onMouseleave: resetCurrentValue,
  37133. onClick: ($event) => selectValue(item)
  37134. }, [
  37135. createVNode(unref(ElIcon), {
  37136. class: normalizeClass([
  37137. unref(ns).e("icon"),
  37138. { hover: hoverIndex.value === item },
  37139. unref(ns).is("active", item <= currentValue.value)
  37140. ])
  37141. }, {
  37142. default: withCtx(() => [
  37143. !showDecimalIcon(item) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  37144. withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(activeComponent)), null, null, 512)), [
  37145. [vShow, item <= currentValue.value]
  37146. ]),
  37147. withDirectives((openBlock(), createBlock(resolveDynamicComponent(unref(voidComponent)), null, null, 512)), [
  37148. [vShow, !(item <= currentValue.value)]
  37149. ])
  37150. ], 64)) : createCommentVNode("v-if", true),
  37151. showDecimalIcon(item) ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  37152. (openBlock(), createBlock(resolveDynamicComponent(unref(voidComponent)), {
  37153. class: normalizeClass([unref(ns).em("decimal", "box")])
  37154. }, null, 8, ["class"])),
  37155. createVNode(unref(ElIcon), {
  37156. style: normalizeStyle(unref(decimalStyle)),
  37157. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
  37158. }, {
  37159. default: withCtx(() => [
  37160. (openBlock(), createBlock(resolveDynamicComponent(unref(decimalIconComponent))))
  37161. ]),
  37162. _: 1
  37163. }, 8, ["style", "class"])
  37164. ], 64)) : createCommentVNode("v-if", true)
  37165. ]),
  37166. _: 2
  37167. }, 1032, ["class"])
  37168. ], 42, ["onMousemove", "onClick"]);
  37169. }), 128)),
  37170. _ctx.showText || _ctx.showScore ? (openBlock(), createElementBlock("span", {
  37171. key: 0,
  37172. class: normalizeClass(unref(ns).e("text")),
  37173. style: normalizeStyle({ color: _ctx.textColor })
  37174. }, toDisplayString(unref(text)), 7)) : createCommentVNode("v-if", true)
  37175. ], 46, ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"]);
  37176. };
  37177. }
  37178. });
  37179. var Rate = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__file", "rate.vue"]]);
  37180. const ElRate = withInstall(Rate);
  37181. const IconMap = {
  37182. success: "icon-success",
  37183. warning: "icon-warning",
  37184. error: "icon-error",
  37185. info: "icon-info"
  37186. };
  37187. const IconComponentMap = {
  37188. [IconMap.success]: circle_check_filled_default,
  37189. [IconMap.warning]: warning_filled_default,
  37190. [IconMap.error]: circle_close_filled_default,
  37191. [IconMap.info]: info_filled_default
  37192. };
  37193. const resultProps = buildProps({
  37194. title: {
  37195. type: String,
  37196. default: ""
  37197. },
  37198. subTitle: {
  37199. type: String,
  37200. default: ""
  37201. },
  37202. icon: {
  37203. type: String,
  37204. values: ["success", "warning", "info", "error"],
  37205. default: "info"
  37206. }
  37207. });
  37208. const __default__$F = defineComponent({
  37209. name: "ElResult"
  37210. });
  37211. const _sfc_main$P = /* @__PURE__ */ defineComponent({
  37212. ...__default__$F,
  37213. props: resultProps,
  37214. setup(__props) {
  37215. const props = __props;
  37216. const ns = useNamespace("result");
  37217. const resultIcon = computed(() => {
  37218. const icon = props.icon;
  37219. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  37220. const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
  37221. return {
  37222. class: iconClass,
  37223. component: iconComponent
  37224. };
  37225. });
  37226. return (_ctx, _cache) => {
  37227. return openBlock(), createElementBlock("div", {
  37228. class: normalizeClass(unref(ns).b())
  37229. }, [
  37230. createElementVNode("div", {
  37231. class: normalizeClass(unref(ns).e("icon"))
  37232. }, [
  37233. renderSlot(_ctx.$slots, "icon", {}, () => [
  37234. unref(resultIcon).component ? (openBlock(), createBlock(resolveDynamicComponent(unref(resultIcon).component), {
  37235. key: 0,
  37236. class: normalizeClass(unref(resultIcon).class)
  37237. }, null, 8, ["class"])) : createCommentVNode("v-if", true)
  37238. ])
  37239. ], 2),
  37240. _ctx.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", {
  37241. key: 0,
  37242. class: normalizeClass(unref(ns).e("title"))
  37243. }, [
  37244. renderSlot(_ctx.$slots, "title", {}, () => [
  37245. createElementVNode("p", null, toDisplayString(_ctx.title), 1)
  37246. ])
  37247. ], 2)) : createCommentVNode("v-if", true),
  37248. _ctx.subTitle || _ctx.$slots["sub-title"] ? (openBlock(), createElementBlock("div", {
  37249. key: 1,
  37250. class: normalizeClass(unref(ns).e("subtitle"))
  37251. }, [
  37252. renderSlot(_ctx.$slots, "sub-title", {}, () => [
  37253. createElementVNode("p", null, toDisplayString(_ctx.subTitle), 1)
  37254. ])
  37255. ], 2)) : createCommentVNode("v-if", true),
  37256. _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  37257. key: 2,
  37258. class: normalizeClass(unref(ns).e("extra"))
  37259. }, [
  37260. renderSlot(_ctx.$slots, "extra")
  37261. ], 2)) : createCommentVNode("v-if", true)
  37262. ], 2);
  37263. };
  37264. }
  37265. });
  37266. var Result = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__file", "result.vue"]]);
  37267. const ElResult = withInstall(Result);
  37268. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  37269. return typeof value === "number" && value !== value;
  37270. };
  37271. function isEqual(first, second) {
  37272. if (first === second) {
  37273. return true;
  37274. }
  37275. if (safeIsNaN(first) && safeIsNaN(second)) {
  37276. return true;
  37277. }
  37278. return false;
  37279. }
  37280. function areInputsEqual(newInputs, lastInputs) {
  37281. if (newInputs.length !== lastInputs.length) {
  37282. return false;
  37283. }
  37284. for (var i = 0; i < newInputs.length; i++) {
  37285. if (!isEqual(newInputs[i], lastInputs[i])) {
  37286. return false;
  37287. }
  37288. }
  37289. return true;
  37290. }
  37291. function memoizeOne(resultFn, isEqual2) {
  37292. if (isEqual2 === void 0) {
  37293. isEqual2 = areInputsEqual;
  37294. }
  37295. var cache = null;
  37296. function memoized() {
  37297. var newArgs = [];
  37298. for (var _i = 0; _i < arguments.length; _i++) {
  37299. newArgs[_i] = arguments[_i];
  37300. }
  37301. if (cache && cache.lastThis === this && isEqual2(newArgs, cache.lastArgs)) {
  37302. return cache.lastResult;
  37303. }
  37304. var lastResult = resultFn.apply(this, newArgs);
  37305. cache = {
  37306. lastResult,
  37307. lastArgs: newArgs,
  37308. lastThis: this
  37309. };
  37310. return lastResult;
  37311. }
  37312. memoized.clear = function clear() {
  37313. cache = null;
  37314. };
  37315. return memoized;
  37316. }
  37317. const useCache = () => {
  37318. const vm = getCurrentInstance();
  37319. const props = vm.proxy.$props;
  37320. return computed(() => {
  37321. const _getItemStyleCache = (_, __, ___) => ({});
  37322. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  37323. });
  37324. };
  37325. const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50;
  37326. const ITEM_RENDER_EVT = "itemRendered";
  37327. const SCROLL_EVT = "scroll";
  37328. const FORWARD = "forward";
  37329. const BACKWARD = "backward";
  37330. const AUTO_ALIGNMENT = "auto";
  37331. const SMART_ALIGNMENT = "smart";
  37332. const START_ALIGNMENT = "start";
  37333. const CENTERED_ALIGNMENT = "center";
  37334. const END_ALIGNMENT = "end";
  37335. const HORIZONTAL = "horizontal";
  37336. const VERTICAL = "vertical";
  37337. const LTR = "ltr";
  37338. const RTL = "rtl";
  37339. const RTL_OFFSET_NAG = "negative";
  37340. const RTL_OFFSET_POS_ASC = "positive-ascending";
  37341. const RTL_OFFSET_POS_DESC = "positive-descending";
  37342. const ScrollbarDirKey = {
  37343. [HORIZONTAL]: "left",
  37344. [VERTICAL]: "top"
  37345. };
  37346. const SCROLLBAR_MIN_SIZE = 20;
  37347. const LayoutKeys = {
  37348. [HORIZONTAL]: "deltaX",
  37349. [VERTICAL]: "deltaY"
  37350. };
  37351. const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
  37352. let frameHandle;
  37353. let offset = 0;
  37354. const hasReachedEdge = (offset2) => {
  37355. const edgeReached = offset2 < 0 && atStartEdge.value || offset2 > 0 && atEndEdge.value;
  37356. return edgeReached;
  37357. };
  37358. const onWheel = (e) => {
  37359. cAF(frameHandle);
  37360. const newOffset = e[LayoutKeys[layout.value]];
  37361. if (hasReachedEdge(offset) && hasReachedEdge(offset + newOffset))
  37362. return;
  37363. offset += newOffset;
  37364. if (!isFirefox()) {
  37365. e.preventDefault();
  37366. }
  37367. frameHandle = rAF(() => {
  37368. onWheelDelta(offset);
  37369. offset = 0;
  37370. });
  37371. };
  37372. return {
  37373. hasReachedEdge,
  37374. onWheel
  37375. };
  37376. };
  37377. var useWheel$1 = useWheel;
  37378. const itemSize$1 = buildProp({
  37379. type: definePropType([Number, Function]),
  37380. required: true
  37381. });
  37382. const estimatedItemSize = buildProp({
  37383. type: Number
  37384. });
  37385. const cache = buildProp({
  37386. type: Number,
  37387. default: 2
  37388. });
  37389. const direction = buildProp({
  37390. type: String,
  37391. values: ["ltr", "rtl"],
  37392. default: "ltr"
  37393. });
  37394. const initScrollOffset = buildProp({
  37395. type: Number,
  37396. default: 0
  37397. });
  37398. const total = buildProp({
  37399. type: Number,
  37400. required: true
  37401. });
  37402. const layout = buildProp({
  37403. type: String,
  37404. values: ["horizontal", "vertical"],
  37405. default: VERTICAL
  37406. });
  37407. const virtualizedProps = buildProps({
  37408. className: {
  37409. type: String,
  37410. default: ""
  37411. },
  37412. containerElement: {
  37413. type: definePropType([String, Object]),
  37414. default: "div"
  37415. },
  37416. data: {
  37417. type: definePropType(Array),
  37418. default: () => mutable([])
  37419. },
  37420. direction,
  37421. height: {
  37422. type: [String, Number],
  37423. required: true
  37424. },
  37425. innerElement: {
  37426. type: [String, Object],
  37427. default: "div"
  37428. },
  37429. style: {
  37430. type: definePropType([Object, String, Array])
  37431. },
  37432. useIsScrolling: {
  37433. type: Boolean,
  37434. default: false
  37435. },
  37436. width: {
  37437. type: [Number, String],
  37438. required: false
  37439. },
  37440. perfMode: {
  37441. type: Boolean,
  37442. default: true
  37443. },
  37444. scrollbarAlwaysOn: {
  37445. type: Boolean,
  37446. default: false
  37447. }
  37448. });
  37449. const virtualizedListProps = buildProps({
  37450. cache,
  37451. estimatedItemSize,
  37452. layout,
  37453. initScrollOffset,
  37454. total,
  37455. itemSize: itemSize$1,
  37456. ...virtualizedProps
  37457. });
  37458. const scrollbarSize = {
  37459. type: Number,
  37460. default: 6
  37461. };
  37462. const startGap = { type: Number, default: 0 };
  37463. const endGap = { type: Number, default: 2 };
  37464. const virtualizedGridProps = buildProps({
  37465. columnCache: cache,
  37466. columnWidth: itemSize$1,
  37467. estimatedColumnWidth: estimatedItemSize,
  37468. estimatedRowHeight: estimatedItemSize,
  37469. initScrollLeft: initScrollOffset,
  37470. initScrollTop: initScrollOffset,
  37471. itemKey: {
  37472. type: definePropType(Function),
  37473. default: ({
  37474. columnIndex,
  37475. rowIndex
  37476. }) => `${rowIndex}:${columnIndex}`
  37477. },
  37478. rowCache: cache,
  37479. rowHeight: itemSize$1,
  37480. totalColumn: total,
  37481. totalRow: total,
  37482. hScrollbarSize: scrollbarSize,
  37483. vScrollbarSize: scrollbarSize,
  37484. scrollbarStartGap: startGap,
  37485. scrollbarEndGap: endGap,
  37486. role: String,
  37487. ...virtualizedProps
  37488. });
  37489. const virtualizedScrollbarProps = buildProps({
  37490. alwaysOn: Boolean,
  37491. class: String,
  37492. layout,
  37493. total,
  37494. ratio: {
  37495. type: Number,
  37496. required: true
  37497. },
  37498. clientSize: {
  37499. type: Number,
  37500. required: true
  37501. },
  37502. scrollFrom: {
  37503. type: Number,
  37504. required: true
  37505. },
  37506. scrollbarSize,
  37507. startGap,
  37508. endGap,
  37509. visible: Boolean
  37510. });
  37511. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  37512. const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL;
  37513. const isRTL = (dir) => dir === RTL;
  37514. let cachedRTLResult = null;
  37515. function getRTLOffsetType(recalculate = false) {
  37516. if (cachedRTLResult === null || recalculate) {
  37517. const outerDiv = document.createElement("div");
  37518. const outerStyle = outerDiv.style;
  37519. outerStyle.width = "50px";
  37520. outerStyle.height = "50px";
  37521. outerStyle.overflow = "scroll";
  37522. outerStyle.direction = "rtl";
  37523. const innerDiv = document.createElement("div");
  37524. const innerStyle = innerDiv.style;
  37525. innerStyle.width = "100px";
  37526. innerStyle.height = "100px";
  37527. outerDiv.appendChild(innerDiv);
  37528. document.body.appendChild(outerDiv);
  37529. if (outerDiv.scrollLeft > 0) {
  37530. cachedRTLResult = RTL_OFFSET_POS_DESC;
  37531. } else {
  37532. outerDiv.scrollLeft = 1;
  37533. if (outerDiv.scrollLeft === 0) {
  37534. cachedRTLResult = RTL_OFFSET_NAG;
  37535. } else {
  37536. cachedRTLResult = RTL_OFFSET_POS_ASC;
  37537. }
  37538. }
  37539. document.body.removeChild(outerDiv);
  37540. return cachedRTLResult;
  37541. }
  37542. return cachedRTLResult;
  37543. }
  37544. function renderThumbStyle({ move, size, bar }, layout) {
  37545. const style = {};
  37546. const translate = `translate${bar.axis}(${move}px)`;
  37547. style[bar.size] = size;
  37548. style.transform = translate;
  37549. style.msTransform = translate;
  37550. style.webkitTransform = translate;
  37551. if (layout === "horizontal") {
  37552. style.height = "100%";
  37553. } else {
  37554. style.width = "100%";
  37555. }
  37556. return style;
  37557. }
  37558. const ScrollBar = defineComponent({
  37559. name: "ElVirtualScrollBar",
  37560. props: virtualizedScrollbarProps,
  37561. emits: ["scroll", "start-move", "stop-move"],
  37562. setup(props, { emit }) {
  37563. const GAP = computed(() => props.startGap + props.endGap);
  37564. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  37565. const nsScrollbar = useNamespace("scrollbar");
  37566. const trackRef = ref();
  37567. const thumbRef = ref();
  37568. let frameHandle = null;
  37569. let onselectstartStore = null;
  37570. const state = reactive({
  37571. isDragging: false,
  37572. traveled: 0
  37573. });
  37574. const bar = computed(() => BAR_MAP[props.layout]);
  37575. const trackSize = computed(() => props.clientSize - unref(GAP));
  37576. const trackStyle = computed(() => ({
  37577. position: "absolute",
  37578. width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`,
  37579. height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`,
  37580. [ScrollbarDirKey[props.layout]]: "2px",
  37581. right: "2px",
  37582. bottom: "2px",
  37583. borderRadius: "4px"
  37584. }));
  37585. const thumbSize = computed(() => {
  37586. const ratio = props.ratio;
  37587. const clientSize = props.clientSize;
  37588. if (ratio >= 100) {
  37589. return Number.POSITIVE_INFINITY;
  37590. }
  37591. if (ratio >= 50) {
  37592. return ratio * clientSize / 100;
  37593. }
  37594. const SCROLLBAR_MAX_SIZE = clientSize / 3;
  37595. return Math.floor(Math.min(Math.max(ratio * clientSize, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE));
  37596. });
  37597. const thumbStyle = computed(() => {
  37598. if (!Number.isFinite(thumbSize.value)) {
  37599. return {
  37600. display: "none"
  37601. };
  37602. }
  37603. const thumb = `${thumbSize.value}px`;
  37604. const style = renderThumbStyle({
  37605. bar: bar.value,
  37606. size: thumb,
  37607. move: state.traveled
  37608. }, props.layout);
  37609. return style;
  37610. });
  37611. const totalSteps = computed(() => Math.floor(props.clientSize - thumbSize.value - unref(GAP)));
  37612. const attachEvents = () => {
  37613. window.addEventListener("mousemove", onMouseMove);
  37614. window.addEventListener("mouseup", onMouseUp);
  37615. const thumbEl = unref(thumbRef);
  37616. if (!thumbEl)
  37617. return;
  37618. onselectstartStore = document.onselectstart;
  37619. document.onselectstart = () => false;
  37620. thumbEl.addEventListener("touchmove", onMouseMove, { passive: true });
  37621. thumbEl.addEventListener("touchend", onMouseUp);
  37622. };
  37623. const detachEvents = () => {
  37624. window.removeEventListener("mousemove", onMouseMove);
  37625. window.removeEventListener("mouseup", onMouseUp);
  37626. document.onselectstart = onselectstartStore;
  37627. onselectstartStore = null;
  37628. const thumbEl = unref(thumbRef);
  37629. if (!thumbEl)
  37630. return;
  37631. thumbEl.removeEventListener("touchmove", onMouseMove);
  37632. thumbEl.removeEventListener("touchend", onMouseUp);
  37633. };
  37634. const onThumbMouseDown = (e) => {
  37635. e.stopImmediatePropagation();
  37636. if (e.ctrlKey || [1, 2].includes(e.button)) {
  37637. return;
  37638. }
  37639. state.isDragging = true;
  37640. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  37641. emit("start-move");
  37642. attachEvents();
  37643. };
  37644. const onMouseUp = () => {
  37645. state.isDragging = false;
  37646. state[bar.value.axis] = 0;
  37647. emit("stop-move");
  37648. detachEvents();
  37649. };
  37650. const onMouseMove = (e) => {
  37651. const { isDragging } = state;
  37652. if (!isDragging)
  37653. return;
  37654. if (!thumbRef.value || !trackRef.value)
  37655. return;
  37656. const prevPage = state[bar.value.axis];
  37657. if (!prevPage)
  37658. return;
  37659. cAF(frameHandle);
  37660. const offset = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  37661. const thumbClickPosition = thumbRef.value[bar.value.offset] - prevPage;
  37662. const distance = offset - thumbClickPosition;
  37663. frameHandle = rAF(() => {
  37664. state.traveled = Math.max(props.startGap, Math.min(distance, totalSteps.value));
  37665. emit("scroll", distance, totalSteps.value);
  37666. });
  37667. };
  37668. const clickTrackHandler = (e) => {
  37669. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  37670. const thumbHalf = thumbRef.value[bar.value.offset] / 2;
  37671. const distance = offset - thumbHalf;
  37672. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  37673. emit("scroll", distance, totalSteps.value);
  37674. };
  37675. watch(() => props.scrollFrom, (v) => {
  37676. if (state.isDragging)
  37677. return;
  37678. state.traveled = Math.ceil(v * totalSteps.value);
  37679. });
  37680. onBeforeUnmount(() => {
  37681. detachEvents();
  37682. });
  37683. return () => {
  37684. return h$1("div", {
  37685. role: "presentation",
  37686. ref: trackRef,
  37687. class: [
  37688. nsVirtualScrollbar.b(),
  37689. props.class,
  37690. (props.alwaysOn || state.isDragging) && "always-on"
  37691. ],
  37692. style: trackStyle.value,
  37693. onMousedown: withModifiers(clickTrackHandler, ["stop", "prevent"]),
  37694. onTouchstartPrevent: onThumbMouseDown
  37695. }, h$1("div", {
  37696. ref: thumbRef,
  37697. class: nsScrollbar.e("thumb"),
  37698. style: thumbStyle.value,
  37699. onMousedown: onThumbMouseDown
  37700. }, []));
  37701. };
  37702. }
  37703. });
  37704. var Scrollbar = ScrollBar;
  37705. const createList = ({
  37706. name,
  37707. getOffset,
  37708. getItemSize,
  37709. getItemOffset,
  37710. getEstimatedTotalSize,
  37711. getStartIndexForOffset,
  37712. getStopIndexForStartIndex,
  37713. initCache,
  37714. clearCache,
  37715. validateProps
  37716. }) => {
  37717. return defineComponent({
  37718. name: name != null ? name : "ElVirtualList",
  37719. props: virtualizedListProps,
  37720. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  37721. setup(props, { emit, expose }) {
  37722. validateProps(props);
  37723. const instance = getCurrentInstance();
  37724. const ns = useNamespace("vl");
  37725. const dynamicSizeCache = ref(initCache(props, instance));
  37726. const getItemStyleCache = useCache();
  37727. const windowRef = ref();
  37728. const innerRef = ref();
  37729. const scrollbarRef = ref();
  37730. const states = ref({
  37731. isScrolling: false,
  37732. scrollDir: "forward",
  37733. scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0,
  37734. updateRequested: false,
  37735. isScrollbarDragging: false,
  37736. scrollbarAlwaysOn: props.scrollbarAlwaysOn
  37737. });
  37738. const itemsToRender = computed(() => {
  37739. const { total, cache } = props;
  37740. const { isScrolling, scrollDir, scrollOffset } = unref(states);
  37741. if (total === 0) {
  37742. return [0, 0, 0, 0];
  37743. }
  37744. const startIndex = getStartIndexForOffset(props, scrollOffset, unref(dynamicSizeCache));
  37745. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, unref(dynamicSizeCache));
  37746. const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache) : 1;
  37747. const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache) : 1;
  37748. return [
  37749. Math.max(0, startIndex - cacheBackward),
  37750. Math.max(0, Math.min(total - 1, stopIndex + cacheForward)),
  37751. startIndex,
  37752. stopIndex
  37753. ];
  37754. });
  37755. const estimatedTotalSize = computed(() => getEstimatedTotalSize(props, unref(dynamicSizeCache)));
  37756. const _isHorizontal = computed(() => isHorizontal(props.layout));
  37757. const windowStyle = computed(() => [
  37758. {
  37759. position: "relative",
  37760. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  37761. WebkitOverflowScrolling: "touch",
  37762. willChange: "transform"
  37763. },
  37764. {
  37765. direction: props.direction,
  37766. height: isNumber(props.height) ? `${props.height}px` : props.height,
  37767. width: isNumber(props.width) ? `${props.width}px` : props.width
  37768. },
  37769. props.style
  37770. ]);
  37771. const innerStyle = computed(() => {
  37772. const size = unref(estimatedTotalSize);
  37773. const horizontal = unref(_isHorizontal);
  37774. return {
  37775. height: horizontal ? "100%" : `${size}px`,
  37776. pointerEvents: unref(states).isScrolling ? "none" : void 0,
  37777. width: horizontal ? `${size}px` : "100%"
  37778. };
  37779. });
  37780. const clientSize = computed(() => _isHorizontal.value ? props.width : props.height);
  37781. const { onWheel } = useWheel$1({
  37782. atStartEdge: computed(() => states.value.scrollOffset <= 0),
  37783. atEndEdge: computed(() => states.value.scrollOffset >= estimatedTotalSize.value),
  37784. layout: computed(() => props.layout)
  37785. }, (offset) => {
  37786. var _a, _b;
  37787. (_b = (_a = scrollbarRef.value).onMouseUp) == null ? void 0 : _b.call(_a);
  37788. scrollTo(Math.min(states.value.scrollOffset + offset, estimatedTotalSize.value - clientSize.value));
  37789. });
  37790. useEventListener(windowRef, "wheel", onWheel, {
  37791. passive: false
  37792. });
  37793. const emitEvents = () => {
  37794. const { total } = props;
  37795. if (total > 0) {
  37796. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = unref(itemsToRender);
  37797. emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  37798. }
  37799. const { scrollDir, scrollOffset, updateRequested } = unref(states);
  37800. emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  37801. };
  37802. const scrollVertically = (e) => {
  37803. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  37804. const _states = unref(states);
  37805. if (_states.scrollOffset === scrollTop) {
  37806. return;
  37807. }
  37808. const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
  37809. states.value = {
  37810. ..._states,
  37811. isScrolling: true,
  37812. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  37813. scrollOffset,
  37814. updateRequested: false
  37815. };
  37816. nextTick(resetIsScrolling);
  37817. };
  37818. const scrollHorizontally = (e) => {
  37819. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  37820. const _states = unref(states);
  37821. if (_states.scrollOffset === scrollLeft) {
  37822. return;
  37823. }
  37824. const { direction } = props;
  37825. let scrollOffset = scrollLeft;
  37826. if (direction === RTL) {
  37827. switch (getRTLOffsetType()) {
  37828. case RTL_OFFSET_NAG: {
  37829. scrollOffset = -scrollLeft;
  37830. break;
  37831. }
  37832. case RTL_OFFSET_POS_DESC: {
  37833. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  37834. break;
  37835. }
  37836. }
  37837. }
  37838. scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
  37839. states.value = {
  37840. ..._states,
  37841. isScrolling: true,
  37842. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  37843. scrollOffset,
  37844. updateRequested: false
  37845. };
  37846. nextTick(resetIsScrolling);
  37847. };
  37848. const onScroll = (e) => {
  37849. unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  37850. emitEvents();
  37851. };
  37852. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  37853. const offset = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo;
  37854. scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset));
  37855. };
  37856. const scrollTo = (offset) => {
  37857. offset = Math.max(offset, 0);
  37858. if (offset === unref(states).scrollOffset) {
  37859. return;
  37860. }
  37861. states.value = {
  37862. ...unref(states),
  37863. scrollOffset: offset,
  37864. scrollDir: getScrollDir(unref(states).scrollOffset, offset),
  37865. updateRequested: true
  37866. };
  37867. nextTick(resetIsScrolling);
  37868. };
  37869. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  37870. const { scrollOffset } = unref(states);
  37871. idx = Math.max(0, Math.min(idx, props.total - 1));
  37872. scrollTo(getOffset(props, idx, alignment, scrollOffset, unref(dynamicSizeCache)));
  37873. };
  37874. const getItemStyle = (idx) => {
  37875. const { direction, itemSize, layout } = props;
  37876. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize, clearCache && layout, clearCache && direction);
  37877. let style;
  37878. if (hasOwn(itemStyleCache, String(idx))) {
  37879. style = itemStyleCache[idx];
  37880. } else {
  37881. const offset = getItemOffset(props, idx, unref(dynamicSizeCache));
  37882. const size = getItemSize(props, idx, unref(dynamicSizeCache));
  37883. const horizontal = unref(_isHorizontal);
  37884. const isRtl = direction === RTL;
  37885. const offsetHorizontal = horizontal ? offset : 0;
  37886. itemStyleCache[idx] = style = {
  37887. position: "absolute",
  37888. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  37889. right: isRtl ? `${offsetHorizontal}px` : void 0,
  37890. top: !horizontal ? `${offset}px` : 0,
  37891. height: !horizontal ? `${size}px` : "100%",
  37892. width: horizontal ? `${size}px` : "100%"
  37893. };
  37894. }
  37895. return style;
  37896. };
  37897. const resetIsScrolling = () => {
  37898. states.value.isScrolling = false;
  37899. nextTick(() => {
  37900. getItemStyleCache.value(-1, null, null);
  37901. });
  37902. };
  37903. const resetScrollTop = () => {
  37904. const window = windowRef.value;
  37905. if (window) {
  37906. window.scrollTop = 0;
  37907. }
  37908. };
  37909. onMounted(() => {
  37910. if (!isClient)
  37911. return;
  37912. const { initScrollOffset } = props;
  37913. const windowElement = unref(windowRef);
  37914. if (isNumber(initScrollOffset) && windowElement) {
  37915. if (unref(_isHorizontal)) {
  37916. windowElement.scrollLeft = initScrollOffset;
  37917. } else {
  37918. windowElement.scrollTop = initScrollOffset;
  37919. }
  37920. }
  37921. emitEvents();
  37922. });
  37923. onUpdated(() => {
  37924. const { direction, layout } = props;
  37925. const { scrollOffset, updateRequested } = unref(states);
  37926. const windowElement = unref(windowRef);
  37927. if (updateRequested && windowElement) {
  37928. if (layout === HORIZONTAL) {
  37929. if (direction === RTL) {
  37930. switch (getRTLOffsetType()) {
  37931. case RTL_OFFSET_NAG: {
  37932. windowElement.scrollLeft = -scrollOffset;
  37933. break;
  37934. }
  37935. case RTL_OFFSET_POS_ASC: {
  37936. windowElement.scrollLeft = scrollOffset;
  37937. break;
  37938. }
  37939. default: {
  37940. const { clientWidth, scrollWidth } = windowElement;
  37941. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  37942. break;
  37943. }
  37944. }
  37945. } else {
  37946. windowElement.scrollLeft = scrollOffset;
  37947. }
  37948. } else {
  37949. windowElement.scrollTop = scrollOffset;
  37950. }
  37951. }
  37952. });
  37953. onActivated(() => {
  37954. unref(windowRef).scrollTop = unref(states).scrollOffset;
  37955. });
  37956. const api = {
  37957. ns,
  37958. clientSize,
  37959. estimatedTotalSize,
  37960. windowStyle,
  37961. windowRef,
  37962. innerRef,
  37963. innerStyle,
  37964. itemsToRender,
  37965. scrollbarRef,
  37966. states,
  37967. getItemStyle,
  37968. onScroll,
  37969. onScrollbarScroll,
  37970. onWheel,
  37971. scrollTo,
  37972. scrollToItem,
  37973. resetScrollTop
  37974. };
  37975. expose({
  37976. windowRef,
  37977. innerRef,
  37978. getItemStyleCache,
  37979. scrollTo,
  37980. scrollToItem,
  37981. resetScrollTop,
  37982. states
  37983. });
  37984. return api;
  37985. },
  37986. render(ctx) {
  37987. var _a;
  37988. const {
  37989. $slots,
  37990. className,
  37991. clientSize,
  37992. containerElement,
  37993. data,
  37994. getItemStyle,
  37995. innerElement,
  37996. itemsToRender,
  37997. innerStyle,
  37998. layout,
  37999. total,
  38000. onScroll,
  38001. onScrollbarScroll,
  38002. states,
  38003. useIsScrolling,
  38004. windowStyle,
  38005. ns
  38006. } = ctx;
  38007. const [start, end] = itemsToRender;
  38008. const Container = resolveDynamicComponent(containerElement);
  38009. const Inner = resolveDynamicComponent(innerElement);
  38010. const children = [];
  38011. if (total > 0) {
  38012. for (let i = start; i <= end; i++) {
  38013. children.push(h$1(Fragment, { key: i }, (_a = $slots.default) == null ? void 0 : _a.call($slots, {
  38014. data,
  38015. index: i,
  38016. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  38017. style: getItemStyle(i)
  38018. })));
  38019. }
  38020. }
  38021. const InnerNode = [
  38022. h$1(Inner, {
  38023. style: innerStyle,
  38024. ref: "innerRef"
  38025. }, !isString$1(Inner) ? {
  38026. default: () => children
  38027. } : children)
  38028. ];
  38029. const scrollbar = h$1(Scrollbar, {
  38030. ref: "scrollbarRef",
  38031. clientSize,
  38032. layout,
  38033. onScroll: onScrollbarScroll,
  38034. ratio: clientSize * 100 / this.estimatedTotalSize,
  38035. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  38036. total
  38037. });
  38038. const listContainer = h$1(Container, {
  38039. class: [ns.e("window"), className],
  38040. style: windowStyle,
  38041. onScroll,
  38042. ref: "windowRef",
  38043. key: 0
  38044. }, !isString$1(Container) ? { default: () => [InnerNode] } : [InnerNode]);
  38045. return h$1("div", {
  38046. key: 0,
  38047. class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""]
  38048. }, [listContainer, scrollbar]);
  38049. }
  38050. });
  38051. };
  38052. var createList$1 = createList;
  38053. const FixedSizeList = createList$1({
  38054. name: "ElFixedSizeList",
  38055. getItemOffset: ({ itemSize }, index) => index * itemSize,
  38056. getItemSize: ({ itemSize }) => itemSize,
  38057. getEstimatedTotalSize: ({ total, itemSize }) => itemSize * total,
  38058. getOffset: ({ height, total, itemSize, layout, width }, index, alignment, scrollOffset) => {
  38059. const size = isHorizontal(layout) ? width : height;
  38060. const lastItemOffset = Math.max(0, total * itemSize - size);
  38061. const maxOffset = Math.min(lastItemOffset, index * itemSize);
  38062. const minOffset = Math.max(0, (index + 1) * itemSize - size);
  38063. if (alignment === SMART_ALIGNMENT) {
  38064. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  38065. alignment = AUTO_ALIGNMENT;
  38066. } else {
  38067. alignment = CENTERED_ALIGNMENT;
  38068. }
  38069. }
  38070. switch (alignment) {
  38071. case START_ALIGNMENT: {
  38072. return maxOffset;
  38073. }
  38074. case END_ALIGNMENT: {
  38075. return minOffset;
  38076. }
  38077. case CENTERED_ALIGNMENT: {
  38078. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38079. if (middleOffset < Math.ceil(size / 2)) {
  38080. return 0;
  38081. } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
  38082. return lastItemOffset;
  38083. } else {
  38084. return middleOffset;
  38085. }
  38086. }
  38087. case AUTO_ALIGNMENT:
  38088. default: {
  38089. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  38090. return scrollOffset;
  38091. } else if (scrollOffset < minOffset) {
  38092. return minOffset;
  38093. } else {
  38094. return maxOffset;
  38095. }
  38096. }
  38097. }
  38098. },
  38099. getStartIndexForOffset: ({ total, itemSize }, offset) => Math.max(0, Math.min(total - 1, Math.floor(offset / itemSize))),
  38100. getStopIndexForStartIndex: ({ height, total, itemSize, layout, width }, startIndex, scrollOffset) => {
  38101. const offset = startIndex * itemSize;
  38102. const size = isHorizontal(layout) ? width : height;
  38103. const numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
  38104. return Math.max(0, Math.min(total - 1, startIndex + numVisibleItems - 1));
  38105. },
  38106. initCache() {
  38107. return void 0;
  38108. },
  38109. clearCache: true,
  38110. validateProps() {
  38111. }
  38112. });
  38113. var FixedSizeList$1 = FixedSizeList;
  38114. const getItemFromCache$1 = (props, index, listCache) => {
  38115. const { itemSize } = props;
  38116. const { items, lastVisitedIndex } = listCache;
  38117. if (index > lastVisitedIndex) {
  38118. let offset = 0;
  38119. if (lastVisitedIndex >= 0) {
  38120. const item = items[lastVisitedIndex];
  38121. offset = item.offset + item.size;
  38122. }
  38123. for (let i = lastVisitedIndex + 1; i <= index; i++) {
  38124. const size = itemSize(i);
  38125. items[i] = {
  38126. offset,
  38127. size
  38128. };
  38129. offset += size;
  38130. }
  38131. listCache.lastVisitedIndex = index;
  38132. }
  38133. return items[index];
  38134. };
  38135. const findItem$1 = (props, listCache, offset) => {
  38136. const { items, lastVisitedIndex } = listCache;
  38137. const lastVisitedOffset = lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0;
  38138. if (lastVisitedOffset >= offset) {
  38139. return bs$1(props, listCache, 0, lastVisitedIndex, offset);
  38140. }
  38141. return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset);
  38142. };
  38143. const bs$1 = (props, listCache, low, high, offset) => {
  38144. while (low <= high) {
  38145. const mid = low + Math.floor((high - low) / 2);
  38146. const currentOffset = getItemFromCache$1(props, mid, listCache).offset;
  38147. if (currentOffset === offset) {
  38148. return mid;
  38149. } else if (currentOffset < offset) {
  38150. low = mid + 1;
  38151. } else if (currentOffset > offset) {
  38152. high = mid - 1;
  38153. }
  38154. }
  38155. return Math.max(0, low - 1);
  38156. };
  38157. const es$1 = (props, listCache, index, offset) => {
  38158. const { total } = props;
  38159. let exponent = 1;
  38160. while (index < total && getItemFromCache$1(props, index, listCache).offset < offset) {
  38161. index += exponent;
  38162. exponent *= 2;
  38163. }
  38164. return bs$1(props, listCache, Math.floor(index / 2), Math.min(index, total - 1), offset);
  38165. };
  38166. const getEstimatedTotalSize = ({ total }, { items, estimatedItemSize, lastVisitedIndex }) => {
  38167. let totalSizeOfMeasuredItems = 0;
  38168. if (lastVisitedIndex >= total) {
  38169. lastVisitedIndex = total - 1;
  38170. }
  38171. if (lastVisitedIndex >= 0) {
  38172. const item = items[lastVisitedIndex];
  38173. totalSizeOfMeasuredItems = item.offset + item.size;
  38174. }
  38175. const numUnmeasuredItems = total - lastVisitedIndex - 1;
  38176. const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize;
  38177. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  38178. };
  38179. const DynamicSizeList = createList$1({
  38180. name: "ElDynamicSizeList",
  38181. getItemOffset: (props, index, listCache) => getItemFromCache$1(props, index, listCache).offset,
  38182. getItemSize: (_, index, { items }) => items[index].size,
  38183. getEstimatedTotalSize,
  38184. getOffset: (props, index, alignment, scrollOffset, listCache) => {
  38185. const { height, layout, width } = props;
  38186. const size = isHorizontal(layout) ? width : height;
  38187. const item = getItemFromCache$1(props, index, listCache);
  38188. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  38189. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset));
  38190. const minOffset = Math.max(0, item.offset - size + item.size);
  38191. if (alignment === SMART_ALIGNMENT) {
  38192. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  38193. alignment = AUTO_ALIGNMENT;
  38194. } else {
  38195. alignment = CENTERED_ALIGNMENT;
  38196. }
  38197. }
  38198. switch (alignment) {
  38199. case START_ALIGNMENT: {
  38200. return maxOffset;
  38201. }
  38202. case END_ALIGNMENT: {
  38203. return minOffset;
  38204. }
  38205. case CENTERED_ALIGNMENT: {
  38206. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  38207. }
  38208. case AUTO_ALIGNMENT:
  38209. default: {
  38210. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  38211. return scrollOffset;
  38212. } else if (scrollOffset < minOffset) {
  38213. return minOffset;
  38214. } else {
  38215. return maxOffset;
  38216. }
  38217. }
  38218. }
  38219. },
  38220. getStartIndexForOffset: (props, offset, listCache) => findItem$1(props, listCache, offset),
  38221. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  38222. const { height, total, layout, width } = props;
  38223. const size = isHorizontal(layout) ? width : height;
  38224. const item = getItemFromCache$1(props, startIndex, listCache);
  38225. const maxOffset = scrollOffset + size;
  38226. let offset = item.offset + item.size;
  38227. let stopIndex = startIndex;
  38228. while (stopIndex < total - 1 && offset < maxOffset) {
  38229. stopIndex++;
  38230. offset += getItemFromCache$1(props, stopIndex, listCache).size;
  38231. }
  38232. return stopIndex;
  38233. },
  38234. initCache({ estimatedItemSize = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) {
  38235. const cache = {
  38236. items: {},
  38237. estimatedItemSize,
  38238. lastVisitedIndex: -1
  38239. };
  38240. cache.clearCacheAfterIndex = (index, forceUpdate = true) => {
  38241. var _a, _b;
  38242. cache.lastVisitedIndex = Math.min(cache.lastVisitedIndex, index - 1);
  38243. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache(-1);
  38244. if (forceUpdate) {
  38245. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  38246. }
  38247. };
  38248. return cache;
  38249. },
  38250. clearCache: false,
  38251. validateProps: ({ itemSize }) => {
  38252. }
  38253. });
  38254. var DynamicSizeList$1 = DynamicSizeList;
  38255. const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => {
  38256. let frameHandle = null;
  38257. let xOffset = 0;
  38258. let yOffset = 0;
  38259. const hasReachedEdge = (x, y) => {
  38260. const xEdgeReached = x <= 0 && atXStartEdge.value || x >= 0 && atXEndEdge.value;
  38261. const yEdgeReached = y <= 0 && atYStartEdge.value || y >= 0 && atYEndEdge.value;
  38262. return xEdgeReached && yEdgeReached;
  38263. };
  38264. const onWheel = (e) => {
  38265. cAF(frameHandle);
  38266. let x = e.deltaX;
  38267. let y = e.deltaY;
  38268. if (Math.abs(x) > Math.abs(y)) {
  38269. y = 0;
  38270. } else {
  38271. x = 0;
  38272. }
  38273. if (e.shiftKey && y !== 0) {
  38274. x = y;
  38275. y = 0;
  38276. }
  38277. if (hasReachedEdge(xOffset, yOffset) && hasReachedEdge(xOffset + x, yOffset + y))
  38278. return;
  38279. xOffset += x;
  38280. yOffset += y;
  38281. e.preventDefault();
  38282. frameHandle = rAF(() => {
  38283. onWheelDelta(xOffset, yOffset);
  38284. xOffset = 0;
  38285. yOffset = 0;
  38286. });
  38287. };
  38288. return {
  38289. hasReachedEdge,
  38290. onWheel
  38291. };
  38292. };
  38293. const createGrid = ({
  38294. name,
  38295. clearCache,
  38296. getColumnPosition,
  38297. getColumnStartIndexForOffset,
  38298. getColumnStopIndexForStartIndex,
  38299. getEstimatedTotalHeight,
  38300. getEstimatedTotalWidth,
  38301. getColumnOffset,
  38302. getRowOffset,
  38303. getRowPosition,
  38304. getRowStartIndexForOffset,
  38305. getRowStopIndexForStartIndex,
  38306. initCache,
  38307. injectToInstance,
  38308. validateProps
  38309. }) => {
  38310. return defineComponent({
  38311. name: name != null ? name : "ElVirtualList",
  38312. props: virtualizedGridProps,
  38313. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  38314. setup(props, { emit, expose, slots }) {
  38315. const ns = useNamespace("vl");
  38316. validateProps(props);
  38317. const instance = getCurrentInstance();
  38318. const cache = ref(initCache(props, instance));
  38319. injectToInstance == null ? void 0 : injectToInstance(instance, cache);
  38320. const windowRef = ref();
  38321. const hScrollbar = ref();
  38322. const vScrollbar = ref();
  38323. const innerRef = ref(null);
  38324. const states = ref({
  38325. isScrolling: false,
  38326. scrollLeft: isNumber(props.initScrollLeft) ? props.initScrollLeft : 0,
  38327. scrollTop: isNumber(props.initScrollTop) ? props.initScrollTop : 0,
  38328. updateRequested: false,
  38329. xAxisScrollDir: FORWARD,
  38330. yAxisScrollDir: FORWARD
  38331. });
  38332. const getItemStyleCache = useCache();
  38333. const parsedHeight = computed(() => Number.parseInt(`${props.height}`, 10));
  38334. const parsedWidth = computed(() => Number.parseInt(`${props.width}`, 10));
  38335. const columnsToRender = computed(() => {
  38336. const { totalColumn, totalRow, columnCache } = props;
  38337. const { isScrolling, xAxisScrollDir, scrollLeft } = unref(states);
  38338. if (totalColumn === 0 || totalRow === 0) {
  38339. return [0, 0, 0, 0];
  38340. }
  38341. const startIndex = getColumnStartIndexForOffset(props, scrollLeft, unref(cache));
  38342. const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, unref(cache));
  38343. const cacheBackward = !isScrolling || xAxisScrollDir === BACKWARD ? Math.max(1, columnCache) : 1;
  38344. const cacheForward = !isScrolling || xAxisScrollDir === FORWARD ? Math.max(1, columnCache) : 1;
  38345. return [
  38346. Math.max(0, startIndex - cacheBackward),
  38347. Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)),
  38348. startIndex,
  38349. stopIndex
  38350. ];
  38351. });
  38352. const rowsToRender = computed(() => {
  38353. const { totalColumn, totalRow, rowCache } = props;
  38354. const { isScrolling, yAxisScrollDir, scrollTop } = unref(states);
  38355. if (totalColumn === 0 || totalRow === 0) {
  38356. return [0, 0, 0, 0];
  38357. }
  38358. const startIndex = getRowStartIndexForOffset(props, scrollTop, unref(cache));
  38359. const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, unref(cache));
  38360. const cacheBackward = !isScrolling || yAxisScrollDir === BACKWARD ? Math.max(1, rowCache) : 1;
  38361. const cacheForward = !isScrolling || yAxisScrollDir === FORWARD ? Math.max(1, rowCache) : 1;
  38362. return [
  38363. Math.max(0, startIndex - cacheBackward),
  38364. Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)),
  38365. startIndex,
  38366. stopIndex
  38367. ];
  38368. });
  38369. const estimatedTotalHeight = computed(() => getEstimatedTotalHeight(props, unref(cache)));
  38370. const estimatedTotalWidth = computed(() => getEstimatedTotalWidth(props, unref(cache)));
  38371. const windowStyle = computed(() => {
  38372. var _a;
  38373. return [
  38374. {
  38375. position: "relative",
  38376. overflow: "hidden",
  38377. WebkitOverflowScrolling: "touch",
  38378. willChange: "transform"
  38379. },
  38380. {
  38381. direction: props.direction,
  38382. height: isNumber(props.height) ? `${props.height}px` : props.height,
  38383. width: isNumber(props.width) ? `${props.width}px` : props.width
  38384. },
  38385. (_a = props.style) != null ? _a : {}
  38386. ];
  38387. });
  38388. const innerStyle = computed(() => {
  38389. const width = `${unref(estimatedTotalWidth)}px`;
  38390. const height = `${unref(estimatedTotalHeight)}px`;
  38391. return {
  38392. height,
  38393. pointerEvents: unref(states).isScrolling ? "none" : void 0,
  38394. width
  38395. };
  38396. });
  38397. const emitEvents = () => {
  38398. const { totalColumn, totalRow } = props;
  38399. if (totalColumn > 0 && totalRow > 0) {
  38400. const [
  38401. columnCacheStart,
  38402. columnCacheEnd,
  38403. columnVisibleStart,
  38404. columnVisibleEnd
  38405. ] = unref(columnsToRender);
  38406. const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = unref(rowsToRender);
  38407. emit(ITEM_RENDER_EVT, {
  38408. columnCacheStart,
  38409. columnCacheEnd,
  38410. rowCacheStart,
  38411. rowCacheEnd,
  38412. columnVisibleStart,
  38413. columnVisibleEnd,
  38414. rowVisibleStart,
  38415. rowVisibleEnd
  38416. });
  38417. }
  38418. const {
  38419. scrollLeft,
  38420. scrollTop,
  38421. updateRequested,
  38422. xAxisScrollDir,
  38423. yAxisScrollDir
  38424. } = unref(states);
  38425. emit(SCROLL_EVT, {
  38426. xAxisScrollDir,
  38427. scrollLeft,
  38428. yAxisScrollDir,
  38429. scrollTop,
  38430. updateRequested
  38431. });
  38432. };
  38433. const onScroll = (e) => {
  38434. const {
  38435. clientHeight,
  38436. clientWidth,
  38437. scrollHeight,
  38438. scrollLeft,
  38439. scrollTop,
  38440. scrollWidth
  38441. } = e.currentTarget;
  38442. const _states = unref(states);
  38443. if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) {
  38444. return;
  38445. }
  38446. let _scrollLeft = scrollLeft;
  38447. if (isRTL(props.direction)) {
  38448. switch (getRTLOffsetType()) {
  38449. case RTL_OFFSET_NAG:
  38450. _scrollLeft = -scrollLeft;
  38451. break;
  38452. case RTL_OFFSET_POS_DESC:
  38453. _scrollLeft = scrollWidth - clientWidth - scrollLeft;
  38454. break;
  38455. }
  38456. }
  38457. states.value = {
  38458. ..._states,
  38459. isScrolling: true,
  38460. scrollLeft: _scrollLeft,
  38461. scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)),
  38462. updateRequested: true,
  38463. xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft),
  38464. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop)
  38465. };
  38466. nextTick(() => resetIsScrolling());
  38467. onUpdated();
  38468. emitEvents();
  38469. };
  38470. const onVerticalScroll = (distance, totalSteps) => {
  38471. const height = unref(parsedHeight);
  38472. const offset = (estimatedTotalHeight.value - height) / totalSteps * distance;
  38473. scrollTo({
  38474. scrollTop: Math.min(estimatedTotalHeight.value - height, offset)
  38475. });
  38476. };
  38477. const onHorizontalScroll = (distance, totalSteps) => {
  38478. const width = unref(parsedWidth);
  38479. const offset = (estimatedTotalWidth.value - width) / totalSteps * distance;
  38480. scrollTo({
  38481. scrollLeft: Math.min(estimatedTotalWidth.value - width, offset)
  38482. });
  38483. };
  38484. const { onWheel } = useGridWheel({
  38485. atXStartEdge: computed(() => states.value.scrollLeft <= 0),
  38486. atXEndEdge: computed(() => states.value.scrollLeft >= estimatedTotalWidth.value - unref(parsedWidth)),
  38487. atYStartEdge: computed(() => states.value.scrollTop <= 0),
  38488. atYEndEdge: computed(() => states.value.scrollTop >= estimatedTotalHeight.value - unref(parsedHeight))
  38489. }, (x, y) => {
  38490. var _a, _b, _c, _d;
  38491. (_b = (_a = hScrollbar.value) == null ? void 0 : _a.onMouseUp) == null ? void 0 : _b.call(_a);
  38492. (_d = (_c = vScrollbar.value) == null ? void 0 : _c.onMouseUp) == null ? void 0 : _d.call(_c);
  38493. const width = unref(parsedWidth);
  38494. const height = unref(parsedHeight);
  38495. scrollTo({
  38496. scrollLeft: Math.min(states.value.scrollLeft + x, estimatedTotalWidth.value - width),
  38497. scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height)
  38498. });
  38499. });
  38500. useEventListener(windowRef, "wheel", onWheel, {
  38501. passive: false
  38502. });
  38503. const scrollTo = ({
  38504. scrollLeft = states.value.scrollLeft,
  38505. scrollTop = states.value.scrollTop
  38506. }) => {
  38507. scrollLeft = Math.max(scrollLeft, 0);
  38508. scrollTop = Math.max(scrollTop, 0);
  38509. const _states = unref(states);
  38510. if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) {
  38511. return;
  38512. }
  38513. states.value = {
  38514. ..._states,
  38515. xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft),
  38516. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop),
  38517. scrollLeft,
  38518. scrollTop,
  38519. updateRequested: true
  38520. };
  38521. nextTick(() => resetIsScrolling());
  38522. onUpdated();
  38523. emitEvents();
  38524. };
  38525. const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => {
  38526. const _states = unref(states);
  38527. columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1));
  38528. rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1));
  38529. const scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  38530. const _cache = unref(cache);
  38531. const estimatedHeight = getEstimatedTotalHeight(props, _cache);
  38532. const estimatedWidth = getEstimatedTotalWidth(props, _cache);
  38533. scrollTo({
  38534. scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth : 0),
  38535. scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth : 0)
  38536. });
  38537. };
  38538. const getItemStyle = (rowIndex, columnIndex) => {
  38539. const { columnWidth, direction, rowHeight } = props;
  38540. const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction);
  38541. const key = `${rowIndex},${columnIndex}`;
  38542. if (hasOwn(itemStyleCache, key)) {
  38543. return itemStyleCache[key];
  38544. } else {
  38545. const [, left] = getColumnPosition(props, columnIndex, unref(cache));
  38546. const _cache = unref(cache);
  38547. const rtl = isRTL(direction);
  38548. const [height, top] = getRowPosition(props, rowIndex, _cache);
  38549. const [width] = getColumnPosition(props, columnIndex, _cache);
  38550. itemStyleCache[key] = {
  38551. position: "absolute",
  38552. left: rtl ? void 0 : `${left}px`,
  38553. right: rtl ? `${left}px` : void 0,
  38554. top: `${top}px`,
  38555. height: `${height}px`,
  38556. width: `${width}px`
  38557. };
  38558. return itemStyleCache[key];
  38559. }
  38560. };
  38561. const resetIsScrolling = () => {
  38562. states.value.isScrolling = false;
  38563. nextTick(() => {
  38564. getItemStyleCache.value(-1, null, null);
  38565. });
  38566. };
  38567. onMounted(() => {
  38568. if (!isClient)
  38569. return;
  38570. const { initScrollLeft, initScrollTop } = props;
  38571. const windowElement = unref(windowRef);
  38572. if (windowElement) {
  38573. if (isNumber(initScrollLeft)) {
  38574. windowElement.scrollLeft = initScrollLeft;
  38575. }
  38576. if (isNumber(initScrollTop)) {
  38577. windowElement.scrollTop = initScrollTop;
  38578. }
  38579. }
  38580. emitEvents();
  38581. });
  38582. const onUpdated = () => {
  38583. const { direction } = props;
  38584. const { scrollLeft, scrollTop, updateRequested } = unref(states);
  38585. const windowElement = unref(windowRef);
  38586. if (updateRequested && windowElement) {
  38587. if (direction === RTL) {
  38588. switch (getRTLOffsetType()) {
  38589. case RTL_OFFSET_NAG: {
  38590. windowElement.scrollLeft = -scrollLeft;
  38591. break;
  38592. }
  38593. case RTL_OFFSET_POS_ASC: {
  38594. windowElement.scrollLeft = scrollLeft;
  38595. break;
  38596. }
  38597. default: {
  38598. const { clientWidth, scrollWidth } = windowElement;
  38599. windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft;
  38600. break;
  38601. }
  38602. }
  38603. } else {
  38604. windowElement.scrollLeft = Math.max(0, scrollLeft);
  38605. }
  38606. windowElement.scrollTop = Math.max(0, scrollTop);
  38607. }
  38608. };
  38609. const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy;
  38610. expose({
  38611. windowRef,
  38612. innerRef,
  38613. getItemStyleCache,
  38614. scrollTo,
  38615. scrollToItem,
  38616. states,
  38617. resetAfterColumnIndex,
  38618. resetAfterRowIndex,
  38619. resetAfter
  38620. });
  38621. const renderScrollbars = () => {
  38622. const {
  38623. scrollbarAlwaysOn,
  38624. scrollbarStartGap,
  38625. scrollbarEndGap,
  38626. totalColumn,
  38627. totalRow
  38628. } = props;
  38629. const width = unref(parsedWidth);
  38630. const height = unref(parsedHeight);
  38631. const estimatedWidth = unref(estimatedTotalWidth);
  38632. const estimatedHeight = unref(estimatedTotalHeight);
  38633. const { scrollLeft, scrollTop } = unref(states);
  38634. const horizontalScrollbar = h$1(Scrollbar, {
  38635. ref: hScrollbar,
  38636. alwaysOn: scrollbarAlwaysOn,
  38637. startGap: scrollbarStartGap,
  38638. endGap: scrollbarEndGap,
  38639. class: ns.e("horizontal"),
  38640. clientSize: width,
  38641. layout: "horizontal",
  38642. onScroll: onHorizontalScroll,
  38643. ratio: width * 100 / estimatedWidth,
  38644. scrollFrom: scrollLeft / (estimatedWidth - width),
  38645. total: totalRow,
  38646. visible: true
  38647. });
  38648. const verticalScrollbar = h$1(Scrollbar, {
  38649. ref: vScrollbar,
  38650. alwaysOn: scrollbarAlwaysOn,
  38651. startGap: scrollbarStartGap,
  38652. endGap: scrollbarEndGap,
  38653. class: ns.e("vertical"),
  38654. clientSize: height,
  38655. layout: "vertical",
  38656. onScroll: onVerticalScroll,
  38657. ratio: height * 100 / estimatedHeight,
  38658. scrollFrom: scrollTop / (estimatedHeight - height),
  38659. total: totalColumn,
  38660. visible: true
  38661. });
  38662. return {
  38663. horizontalScrollbar,
  38664. verticalScrollbar
  38665. };
  38666. };
  38667. const renderItems = () => {
  38668. var _a;
  38669. const [columnStart, columnEnd] = unref(columnsToRender);
  38670. const [rowStart, rowEnd] = unref(rowsToRender);
  38671. const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props;
  38672. const children = [];
  38673. if (totalRow > 0 && totalColumn > 0) {
  38674. for (let row = rowStart; row <= rowEnd; row++) {
  38675. for (let column = columnStart; column <= columnEnd; column++) {
  38676. const key = itemKey({ columnIndex: column, data, rowIndex: row });
  38677. children.push(h$1(Fragment, { key }, (_a = slots.default) == null ? void 0 : _a.call(slots, {
  38678. columnIndex: column,
  38679. data,
  38680. isScrolling: useIsScrolling ? unref(states).isScrolling : void 0,
  38681. style: getItemStyle(row, column),
  38682. rowIndex: row
  38683. })));
  38684. }
  38685. }
  38686. }
  38687. return children;
  38688. };
  38689. const renderInner = () => {
  38690. const Inner = resolveDynamicComponent(props.innerElement);
  38691. const children = renderItems();
  38692. return [
  38693. h$1(Inner, {
  38694. style: unref(innerStyle),
  38695. ref: innerRef
  38696. }, !isString$1(Inner) ? {
  38697. default: () => children
  38698. } : children)
  38699. ];
  38700. };
  38701. const renderWindow = () => {
  38702. const Container = resolveDynamicComponent(props.containerElement);
  38703. const { horizontalScrollbar, verticalScrollbar } = renderScrollbars();
  38704. const Inner = renderInner();
  38705. return h$1("div", {
  38706. key: 0,
  38707. class: ns.e("wrapper"),
  38708. role: props.role
  38709. }, [
  38710. h$1(Container, {
  38711. class: props.className,
  38712. style: unref(windowStyle),
  38713. onScroll,
  38714. ref: windowRef
  38715. }, !isString$1(Container) ? { default: () => Inner } : Inner),
  38716. horizontalScrollbar,
  38717. verticalScrollbar
  38718. ]);
  38719. };
  38720. return renderWindow;
  38721. }
  38722. });
  38723. };
  38724. var createGrid$1 = createGrid;
  38725. const FixedSizeGrid = createGrid$1({
  38726. name: "ElFixedSizeGrid",
  38727. getColumnPosition: ({ columnWidth }, index) => [
  38728. columnWidth,
  38729. index * columnWidth
  38730. ],
  38731. getRowPosition: ({ rowHeight }, index) => [
  38732. rowHeight,
  38733. index * rowHeight
  38734. ],
  38735. getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow,
  38736. getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn,
  38737. getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _, scrollBarWidth) => {
  38738. width = Number(width);
  38739. const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width);
  38740. const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
  38741. const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth + columnWidth);
  38742. if (alignment === "smart") {
  38743. if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) {
  38744. alignment = AUTO_ALIGNMENT;
  38745. } else {
  38746. alignment = CENTERED_ALIGNMENT;
  38747. }
  38748. }
  38749. switch (alignment) {
  38750. case START_ALIGNMENT:
  38751. return maxOffset;
  38752. case END_ALIGNMENT:
  38753. return minOffset;
  38754. case CENTERED_ALIGNMENT: {
  38755. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38756. if (middleOffset < Math.ceil(width / 2)) {
  38757. return 0;
  38758. } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) {
  38759. return lastColumnOffset;
  38760. } else {
  38761. return middleOffset;
  38762. }
  38763. }
  38764. case AUTO_ALIGNMENT:
  38765. default:
  38766. if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
  38767. return scrollLeft;
  38768. } else if (minOffset > maxOffset) {
  38769. return minOffset;
  38770. } else if (scrollLeft < minOffset) {
  38771. return minOffset;
  38772. } else {
  38773. return maxOffset;
  38774. }
  38775. }
  38776. },
  38777. getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _, scrollBarWidth) => {
  38778. height = Number(height);
  38779. const lastRowOffset = Math.max(0, totalRow * rowHeight - height);
  38780. const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
  38781. const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth + rowHeight);
  38782. if (align === SMART_ALIGNMENT) {
  38783. if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) {
  38784. align = AUTO_ALIGNMENT;
  38785. } else {
  38786. align = CENTERED_ALIGNMENT;
  38787. }
  38788. }
  38789. switch (align) {
  38790. case START_ALIGNMENT:
  38791. return maxOffset;
  38792. case END_ALIGNMENT:
  38793. return minOffset;
  38794. case CENTERED_ALIGNMENT: {
  38795. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  38796. if (middleOffset < Math.ceil(height / 2)) {
  38797. return 0;
  38798. } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) {
  38799. return lastRowOffset;
  38800. } else {
  38801. return middleOffset;
  38802. }
  38803. }
  38804. case AUTO_ALIGNMENT:
  38805. default:
  38806. if (scrollTop >= minOffset && scrollTop <= maxOffset) {
  38807. return scrollTop;
  38808. } else if (minOffset > maxOffset) {
  38809. return minOffset;
  38810. } else if (scrollTop < minOffset) {
  38811. return minOffset;
  38812. } else {
  38813. return maxOffset;
  38814. }
  38815. }
  38816. },
  38817. getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))),
  38818. getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => {
  38819. const left = startIndex * columnWidth;
  38820. const visibleColumnsCount = Math.ceil((width + scrollLeft - left) / columnWidth);
  38821. return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1));
  38822. },
  38823. getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))),
  38824. getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => {
  38825. const top = startIndex * rowHeight;
  38826. const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
  38827. return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1));
  38828. },
  38829. initCache: () => void 0,
  38830. clearCache: true,
  38831. validateProps: ({ columnWidth, rowHeight }) => {
  38832. }
  38833. });
  38834. var FixedSizeGrid$1 = FixedSizeGrid;
  38835. const { max, min, floor } = Math;
  38836. const ACCESS_SIZER_KEY_MAP = {
  38837. column: "columnWidth",
  38838. row: "rowHeight"
  38839. };
  38840. const ACCESS_LAST_VISITED_KEY_MAP = {
  38841. column: "lastVisitedColumnIndex",
  38842. row: "lastVisitedRowIndex"
  38843. };
  38844. const getItemFromCache = (props, index, gridCache, type) => {
  38845. const [cachedItems, sizer, lastVisited] = [
  38846. gridCache[type],
  38847. props[ACCESS_SIZER_KEY_MAP[type]],
  38848. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  38849. ];
  38850. if (index > lastVisited) {
  38851. let offset = 0;
  38852. if (lastVisited >= 0) {
  38853. const item = cachedItems[lastVisited];
  38854. offset = item.offset + item.size;
  38855. }
  38856. for (let i = lastVisited + 1; i <= index; i++) {
  38857. const size = sizer(i);
  38858. cachedItems[i] = {
  38859. offset,
  38860. size
  38861. };
  38862. offset += size;
  38863. }
  38864. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] = index;
  38865. }
  38866. return cachedItems[index];
  38867. };
  38868. const bs = (props, gridCache, low, high, offset, type) => {
  38869. while (low <= high) {
  38870. const mid = low + floor((high - low) / 2);
  38871. const currentOffset = getItemFromCache(props, mid, gridCache, type).offset;
  38872. if (currentOffset === offset) {
  38873. return mid;
  38874. } else if (currentOffset < offset) {
  38875. low = mid + 1;
  38876. } else {
  38877. high = mid - 1;
  38878. }
  38879. }
  38880. return max(0, low - 1);
  38881. };
  38882. const es = (props, gridCache, idx, offset, type) => {
  38883. const total = type === "column" ? props.totalColumn : props.totalRow;
  38884. let exponent = 1;
  38885. while (idx < total && getItemFromCache(props, idx, gridCache, type).offset < offset) {
  38886. idx += exponent;
  38887. exponent *= 2;
  38888. }
  38889. return bs(props, gridCache, floor(idx / 2), min(idx, total - 1), offset, type);
  38890. };
  38891. const findItem = (props, gridCache, offset, type) => {
  38892. const [cache, lastVisitedIndex] = [
  38893. gridCache[type],
  38894. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  38895. ];
  38896. const lastVisitedItemOffset = lastVisitedIndex > 0 ? cache[lastVisitedIndex].offset : 0;
  38897. if (lastVisitedItemOffset >= offset) {
  38898. return bs(props, gridCache, 0, lastVisitedIndex, offset, type);
  38899. }
  38900. return es(props, gridCache, max(0, lastVisitedIndex), offset, type);
  38901. };
  38902. const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => {
  38903. let sizeOfVisitedRows = 0;
  38904. if (lastVisitedRowIndex >= totalRow) {
  38905. lastVisitedRowIndex = totalRow - 1;
  38906. }
  38907. if (lastVisitedRowIndex >= 0) {
  38908. const item = row[lastVisitedRowIndex];
  38909. sizeOfVisitedRows = item.offset + item.size;
  38910. }
  38911. const unvisitedItems = totalRow - lastVisitedRowIndex - 1;
  38912. const sizeOfUnvisitedItems = unvisitedItems * estimatedRowHeight;
  38913. return sizeOfVisitedRows + sizeOfUnvisitedItems;
  38914. };
  38915. const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => {
  38916. let sizeOfVisitedColumns = 0;
  38917. if (lastVisitedColumnIndex > totalColumn) {
  38918. lastVisitedColumnIndex = totalColumn - 1;
  38919. }
  38920. if (lastVisitedColumnIndex >= 0) {
  38921. const item = column[lastVisitedColumnIndex];
  38922. sizeOfVisitedColumns = item.offset + item.size;
  38923. }
  38924. const unvisitedItems = totalColumn - lastVisitedColumnIndex - 1;
  38925. const sizeOfUnvisitedItems = unvisitedItems * estimatedColumnWidth;
  38926. return sizeOfVisitedColumns + sizeOfUnvisitedItems;
  38927. };
  38928. const ACCESS_ESTIMATED_SIZE_KEY_MAP = {
  38929. column: getEstimatedTotalWidth,
  38930. row: getEstimatedTotalHeight
  38931. };
  38932. const getOffset$1 = (props, index, alignment, scrollOffset, cache, type, scrollBarWidth) => {
  38933. const [size, estimatedSizeAssociates] = [
  38934. type === "row" ? props.height : props.width,
  38935. ACCESS_ESTIMATED_SIZE_KEY_MAP[type]
  38936. ];
  38937. const item = getItemFromCache(props, index, cache, type);
  38938. const estimatedSize = estimatedSizeAssociates(props, cache);
  38939. const maxOffset = max(0, min(estimatedSize - size, item.offset));
  38940. const minOffset = max(0, item.offset - size + scrollBarWidth + item.size);
  38941. if (alignment === SMART_ALIGNMENT) {
  38942. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  38943. alignment = AUTO_ALIGNMENT;
  38944. } else {
  38945. alignment = CENTERED_ALIGNMENT;
  38946. }
  38947. }
  38948. switch (alignment) {
  38949. case START_ALIGNMENT: {
  38950. return maxOffset;
  38951. }
  38952. case END_ALIGNMENT: {
  38953. return minOffset;
  38954. }
  38955. case CENTERED_ALIGNMENT: {
  38956. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  38957. }
  38958. case AUTO_ALIGNMENT:
  38959. default: {
  38960. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  38961. return scrollOffset;
  38962. } else if (minOffset > maxOffset) {
  38963. return minOffset;
  38964. } else if (scrollOffset < minOffset) {
  38965. return minOffset;
  38966. } else {
  38967. return maxOffset;
  38968. }
  38969. }
  38970. }
  38971. };
  38972. const DynamicSizeGrid = createGrid$1({
  38973. name: "ElDynamicSizeGrid",
  38974. getColumnPosition: (props, idx, cache) => {
  38975. const item = getItemFromCache(props, idx, cache, "column");
  38976. return [item.size, item.offset];
  38977. },
  38978. getRowPosition: (props, idx, cache) => {
  38979. const item = getItemFromCache(props, idx, cache, "row");
  38980. return [item.size, item.offset];
  38981. },
  38982. getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache, scrollBarWidth) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache, "column", scrollBarWidth),
  38983. getRowOffset: (props, rowIndex, alignment, scrollTop, cache, scrollBarWidth) => getOffset$1(props, rowIndex, alignment, scrollTop, cache, "row", scrollBarWidth),
  38984. getColumnStartIndexForOffset: (props, scrollLeft, cache) => findItem(props, cache, scrollLeft, "column"),
  38985. getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache) => {
  38986. const item = getItemFromCache(props, startIndex, cache, "column");
  38987. const maxOffset = scrollLeft + props.width;
  38988. let offset = item.offset + item.size;
  38989. let stopIndex = startIndex;
  38990. while (stopIndex < props.totalColumn - 1 && offset < maxOffset) {
  38991. stopIndex++;
  38992. offset += getItemFromCache(props, startIndex, cache, "column").size;
  38993. }
  38994. return stopIndex;
  38995. },
  38996. getEstimatedTotalHeight,
  38997. getEstimatedTotalWidth,
  38998. getRowStartIndexForOffset: (props, scrollTop, cache) => findItem(props, cache, scrollTop, "row"),
  38999. getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache) => {
  39000. const { totalRow, height } = props;
  39001. const item = getItemFromCache(props, startIndex, cache, "row");
  39002. const maxOffset = scrollTop + height;
  39003. let offset = item.size + item.offset;
  39004. let stopIndex = startIndex;
  39005. while (stopIndex < totalRow - 1 && offset < maxOffset) {
  39006. stopIndex++;
  39007. offset += getItemFromCache(props, stopIndex, cache, "row").size;
  39008. }
  39009. return stopIndex;
  39010. },
  39011. injectToInstance: (instance, cache) => {
  39012. const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => {
  39013. var _a, _b;
  39014. forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate;
  39015. if (isNumber(columnIndex)) {
  39016. cache.value.lastVisitedColumnIndex = Math.min(cache.value.lastVisitedColumnIndex, columnIndex - 1);
  39017. }
  39018. if (isNumber(rowIndex)) {
  39019. cache.value.lastVisitedRowIndex = Math.min(cache.value.lastVisitedRowIndex, rowIndex - 1);
  39020. }
  39021. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache.value(-1, null, null);
  39022. if (forceUpdate)
  39023. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  39024. };
  39025. const resetAfterColumnIndex = (columnIndex, forceUpdate) => {
  39026. resetAfter({
  39027. columnIndex
  39028. }, forceUpdate);
  39029. };
  39030. const resetAfterRowIndex = (rowIndex, forceUpdate) => {
  39031. resetAfter({
  39032. rowIndex
  39033. }, forceUpdate);
  39034. };
  39035. Object.assign(instance.proxy, {
  39036. resetAfterColumnIndex,
  39037. resetAfterRowIndex,
  39038. resetAfter
  39039. });
  39040. },
  39041. initCache: ({
  39042. estimatedColumnWidth = DEFAULT_DYNAMIC_LIST_ITEM_SIZE,
  39043. estimatedRowHeight = DEFAULT_DYNAMIC_LIST_ITEM_SIZE
  39044. }) => {
  39045. const cache = {
  39046. column: {},
  39047. estimatedColumnWidth,
  39048. estimatedRowHeight,
  39049. lastVisitedColumnIndex: -1,
  39050. lastVisitedRowIndex: -1,
  39051. row: {}
  39052. };
  39053. return cache;
  39054. },
  39055. clearCache: false,
  39056. validateProps: ({ columnWidth, rowHeight }) => {
  39057. }
  39058. });
  39059. var DynamicSizeGrid$1 = DynamicSizeGrid;
  39060. const _sfc_main$O = defineComponent({
  39061. props: {
  39062. item: {
  39063. type: Object,
  39064. required: true
  39065. },
  39066. style: {
  39067. type: Object
  39068. },
  39069. height: Number
  39070. },
  39071. setup() {
  39072. const ns = useNamespace("select");
  39073. return {
  39074. ns
  39075. };
  39076. }
  39077. });
  39078. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  39079. return openBlock(), createElementBlock("div", {
  39080. class: normalizeClass(_ctx.ns.be("group", "title")),
  39081. style: normalizeStyle({ ..._ctx.style, lineHeight: `${_ctx.height}px` })
  39082. }, toDisplayString(_ctx.item.label), 7);
  39083. }
  39084. var GroupItem = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", _sfc_render$7], ["__file", "group-item.vue"]]);
  39085. function useOption(props, { emit }) {
  39086. return {
  39087. hoverItem: () => {
  39088. if (!props.disabled) {
  39089. emit("hover", props.index);
  39090. }
  39091. },
  39092. selectOptionClick: () => {
  39093. if (!props.disabled) {
  39094. emit("select", props.item, props.index);
  39095. }
  39096. }
  39097. };
  39098. }
  39099. const defaultProps$4 = {
  39100. label: "label",
  39101. value: "value",
  39102. disabled: "disabled",
  39103. options: "options"
  39104. };
  39105. function useProps(props) {
  39106. const aliasProps = computed(() => ({ ...defaultProps$4, ...props.props }));
  39107. const getLabel = (option) => get(option, aliasProps.value.label);
  39108. const getValue = (option) => get(option, aliasProps.value.value);
  39109. const getDisabled = (option) => get(option, aliasProps.value.disabled);
  39110. const getOptions = (option) => get(option, aliasProps.value.options);
  39111. return {
  39112. aliasProps,
  39113. getLabel,
  39114. getValue,
  39115. getDisabled,
  39116. getOptions
  39117. };
  39118. }
  39119. const SelectProps = buildProps({
  39120. allowCreate: Boolean,
  39121. autocomplete: {
  39122. type: definePropType(String),
  39123. default: "none"
  39124. },
  39125. automaticDropdown: Boolean,
  39126. clearable: Boolean,
  39127. clearIcon: {
  39128. type: iconPropType,
  39129. default: circle_close_default
  39130. },
  39131. effect: {
  39132. type: definePropType(String),
  39133. default: "light"
  39134. },
  39135. collapseTags: Boolean,
  39136. collapseTagsTooltip: Boolean,
  39137. maxCollapseTags: {
  39138. type: Number,
  39139. default: 1
  39140. },
  39141. defaultFirstOption: Boolean,
  39142. disabled: Boolean,
  39143. estimatedOptionHeight: {
  39144. type: Number,
  39145. default: void 0
  39146. },
  39147. filterable: Boolean,
  39148. filterMethod: Function,
  39149. height: {
  39150. type: Number,
  39151. default: 274
  39152. },
  39153. itemHeight: {
  39154. type: Number,
  39155. default: 34
  39156. },
  39157. id: String,
  39158. loading: Boolean,
  39159. loadingText: String,
  39160. modelValue: {
  39161. type: definePropType([Array, String, Number, Boolean, Object])
  39162. },
  39163. multiple: Boolean,
  39164. multipleLimit: {
  39165. type: Number,
  39166. default: 0
  39167. },
  39168. name: String,
  39169. noDataText: String,
  39170. noMatchText: String,
  39171. remoteMethod: Function,
  39172. reserveKeyword: {
  39173. type: Boolean,
  39174. default: true
  39175. },
  39176. options: {
  39177. type: definePropType(Array),
  39178. required: true
  39179. },
  39180. placeholder: {
  39181. type: String
  39182. },
  39183. teleported: useTooltipContentProps.teleported,
  39184. persistent: {
  39185. type: Boolean,
  39186. default: true
  39187. },
  39188. popperClass: {
  39189. type: String,
  39190. default: ""
  39191. },
  39192. popperOptions: {
  39193. type: definePropType(Object),
  39194. default: () => ({})
  39195. },
  39196. remote: Boolean,
  39197. size: useSizeProp,
  39198. props: {
  39199. type: definePropType(Object),
  39200. default: () => defaultProps$4
  39201. },
  39202. valueKey: {
  39203. type: String,
  39204. default: "value"
  39205. },
  39206. scrollbarAlwaysOn: Boolean,
  39207. validateEvent: {
  39208. type: Boolean,
  39209. default: true
  39210. },
  39211. offset: {
  39212. type: Number,
  39213. default: 12
  39214. },
  39215. showArrow: {
  39216. type: Boolean,
  39217. default: true
  39218. },
  39219. placement: {
  39220. type: definePropType(String),
  39221. values: Ee,
  39222. default: "bottom-start"
  39223. },
  39224. fallbackPlacements: {
  39225. type: definePropType(Array),
  39226. default: ["bottom-start", "top-start", "right", "left"]
  39227. },
  39228. tagType: { ...tagProps.type, default: "info" },
  39229. tagEffect: { ...tagProps.effect, default: "light" },
  39230. tabindex: {
  39231. type: [String, Number],
  39232. default: 0
  39233. },
  39234. appendTo: String,
  39235. ...useEmptyValuesProps,
  39236. ...useAriaProps(["ariaLabel"])
  39237. });
  39238. const OptionProps = buildProps({
  39239. data: Array,
  39240. disabled: Boolean,
  39241. hovering: Boolean,
  39242. item: {
  39243. type: definePropType(Object),
  39244. required: true
  39245. },
  39246. index: Number,
  39247. style: Object,
  39248. selected: Boolean,
  39249. created: Boolean
  39250. });
  39251. const selectEmits = {
  39252. [UPDATE_MODEL_EVENT]: (val) => true,
  39253. [CHANGE_EVENT]: (val) => true,
  39254. "remove-tag": (val) => true,
  39255. "visible-change": (visible) => true,
  39256. focus: (evt) => evt instanceof FocusEvent,
  39257. blur: (evt) => evt instanceof FocusEvent,
  39258. clear: () => true
  39259. };
  39260. const optionEmits = {
  39261. hover: (index) => isNumber(index),
  39262. select: (val, index) => true
  39263. };
  39264. const selectV2InjectionKey = Symbol("ElSelectV2Injection");
  39265. const _sfc_main$N = defineComponent({
  39266. props: OptionProps,
  39267. emits: optionEmits,
  39268. setup(props, { emit }) {
  39269. const select = inject(selectV2InjectionKey);
  39270. const ns = useNamespace("select");
  39271. const { hoverItem, selectOptionClick } = useOption(props, { emit });
  39272. const { getLabel } = useProps(select.props);
  39273. return {
  39274. ns,
  39275. hoverItem,
  39276. selectOptionClick,
  39277. getLabel
  39278. };
  39279. }
  39280. });
  39281. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  39282. return openBlock(), createElementBlock("li", {
  39283. "aria-selected": _ctx.selected,
  39284. style: normalizeStyle(_ctx.style),
  39285. class: normalizeClass([
  39286. _ctx.ns.be("dropdown", "item"),
  39287. _ctx.ns.is("selected", _ctx.selected),
  39288. _ctx.ns.is("disabled", _ctx.disabled),
  39289. _ctx.ns.is("created", _ctx.created),
  39290. _ctx.ns.is("hovering", _ctx.hovering)
  39291. ]),
  39292. onMousemove: _ctx.hoverItem,
  39293. onClick: withModifiers(_ctx.selectOptionClick, ["stop"])
  39294. }, [
  39295. renderSlot(_ctx.$slots, "default", {
  39296. item: _ctx.item,
  39297. index: _ctx.index,
  39298. disabled: _ctx.disabled
  39299. }, () => [
  39300. createElementVNode("span", null, toDisplayString(_ctx.getLabel(_ctx.item)), 1)
  39301. ])
  39302. ], 46, ["aria-selected", "onMousemove", "onClick"]);
  39303. }
  39304. var OptionItem = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$6], ["__file", "option-item.vue"]]);
  39305. const props = {
  39306. loading: Boolean,
  39307. data: {
  39308. type: Array,
  39309. required: true
  39310. },
  39311. hoveringIndex: Number,
  39312. width: Number
  39313. };
  39314. var ElSelectMenu = defineComponent({
  39315. name: "ElSelectDropdown",
  39316. props,
  39317. setup(props2, {
  39318. slots,
  39319. expose
  39320. }) {
  39321. const select = inject(selectV2InjectionKey);
  39322. const ns = useNamespace("select");
  39323. const {
  39324. getLabel,
  39325. getValue,
  39326. getDisabled
  39327. } = useProps(select.props);
  39328. const cachedHeights = ref([]);
  39329. const listRef = ref();
  39330. const size = computed(() => props2.data.length);
  39331. watch(() => size.value, () => {
  39332. var _a, _b;
  39333. (_b = (_a = select.tooltipRef.value).updatePopper) == null ? void 0 : _b.call(_a);
  39334. });
  39335. const isSized = computed(() => isUndefined(select.props.estimatedOptionHeight));
  39336. const listProps = computed(() => {
  39337. if (isSized.value) {
  39338. return {
  39339. itemSize: select.props.itemHeight
  39340. };
  39341. }
  39342. return {
  39343. estimatedSize: select.props.estimatedOptionHeight,
  39344. itemSize: (idx) => cachedHeights.value[idx]
  39345. };
  39346. });
  39347. const contains = (arr = [], target) => {
  39348. const {
  39349. props: {
  39350. valueKey
  39351. }
  39352. } = select;
  39353. if (!isObject$1(target)) {
  39354. return arr.includes(target);
  39355. }
  39356. return arr && arr.some((item) => {
  39357. return toRaw(get(item, valueKey)) === get(target, valueKey);
  39358. });
  39359. };
  39360. const isEqual = (selected, target) => {
  39361. if (!isObject$1(target)) {
  39362. return selected === target;
  39363. } else {
  39364. const {
  39365. valueKey
  39366. } = select.props;
  39367. return get(selected, valueKey) === get(target, valueKey);
  39368. }
  39369. };
  39370. const isItemSelected = (modelValue, target) => {
  39371. if (select.props.multiple) {
  39372. return contains(modelValue, getValue(target));
  39373. }
  39374. return isEqual(modelValue, getValue(target));
  39375. };
  39376. const isItemDisabled = (modelValue, selected) => {
  39377. const {
  39378. disabled,
  39379. multiple,
  39380. multipleLimit
  39381. } = select.props;
  39382. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  39383. };
  39384. const isItemHovering = (target) => props2.hoveringIndex === target;
  39385. const scrollToItem = (index) => {
  39386. const list = listRef.value;
  39387. if (list) {
  39388. list.scrollToItem(index);
  39389. }
  39390. };
  39391. const resetScrollTop = () => {
  39392. const list = listRef.value;
  39393. if (list) {
  39394. list.resetScrollTop();
  39395. }
  39396. };
  39397. const exposed = {
  39398. listRef,
  39399. isSized,
  39400. isItemDisabled,
  39401. isItemHovering,
  39402. isItemSelected,
  39403. scrollToItem,
  39404. resetScrollTop
  39405. };
  39406. expose(exposed);
  39407. const Item = (itemProps) => {
  39408. const {
  39409. index,
  39410. data,
  39411. style
  39412. } = itemProps;
  39413. const sized = unref(isSized);
  39414. const {
  39415. itemSize,
  39416. estimatedSize
  39417. } = unref(listProps);
  39418. const {
  39419. modelValue
  39420. } = select.props;
  39421. const {
  39422. onSelect,
  39423. onHover
  39424. } = select;
  39425. const item = data[index];
  39426. if (item.type === "Group") {
  39427. return createVNode(GroupItem, {
  39428. "item": item,
  39429. "style": style,
  39430. "height": sized ? itemSize : estimatedSize
  39431. }, null);
  39432. }
  39433. const isSelected = isItemSelected(modelValue, item);
  39434. const isDisabled = isItemDisabled(modelValue, isSelected);
  39435. const isHovering = isItemHovering(index);
  39436. return createVNode(OptionItem, mergeProps(itemProps, {
  39437. "selected": isSelected,
  39438. "disabled": getDisabled(item) || isDisabled,
  39439. "created": !!item.created,
  39440. "hovering": isHovering,
  39441. "item": item,
  39442. "onSelect": onSelect,
  39443. "onHover": onHover
  39444. }), {
  39445. default: (props3) => {
  39446. var _a;
  39447. return ((_a = slots.default) == null ? void 0 : _a.call(slots, props3)) || createVNode("span", null, [getLabel(item)]);
  39448. }
  39449. });
  39450. };
  39451. const {
  39452. onKeyboardNavigate,
  39453. onKeyboardSelect
  39454. } = select;
  39455. const onForward = () => {
  39456. onKeyboardNavigate("forward");
  39457. };
  39458. const onBackward = () => {
  39459. onKeyboardNavigate("backward");
  39460. };
  39461. const onKeydown = (e) => {
  39462. const {
  39463. code
  39464. } = e;
  39465. const {
  39466. tab,
  39467. esc,
  39468. down,
  39469. up,
  39470. enter,
  39471. numpadEnter
  39472. } = EVENT_CODE;
  39473. if (code !== tab) {
  39474. e.preventDefault();
  39475. e.stopPropagation();
  39476. }
  39477. switch (code) {
  39478. case tab:
  39479. case esc:
  39480. break;
  39481. case down:
  39482. onForward();
  39483. break;
  39484. case up:
  39485. onBackward();
  39486. break;
  39487. case enter:
  39488. case numpadEnter:
  39489. onKeyboardSelect();
  39490. break;
  39491. }
  39492. };
  39493. return () => {
  39494. var _a, _b, _c, _d;
  39495. const {
  39496. data,
  39497. width
  39498. } = props2;
  39499. const {
  39500. height,
  39501. multiple,
  39502. scrollbarAlwaysOn
  39503. } = select.props;
  39504. const List = unref(isSized) ? FixedSizeList$1 : DynamicSizeList$1;
  39505. return createVNode("div", {
  39506. "class": [ns.b("dropdown"), ns.is("multiple", multiple)],
  39507. "style": {
  39508. width: `${width}px`
  39509. }
  39510. }, [(_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({
  39511. "ref": listRef
  39512. }, unref(listProps), {
  39513. "className": ns.be("dropdown", "list"),
  39514. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  39515. "data": data,
  39516. "height": height,
  39517. "width": width,
  39518. "total": data.length,
  39519. "onKeydown": onKeydown
  39520. }), {
  39521. default: (props3) => createVNode(Item, props3, null)
  39522. }), (_d = slots.footer) == null ? void 0 : _d.call(slots)]);
  39523. };
  39524. }
  39525. });
  39526. function useAllowCreate(props, states) {
  39527. const { aliasProps, getLabel, getValue } = useProps(props);
  39528. const createOptionCount = ref(0);
  39529. const cachedSelectedOption = ref();
  39530. const enableAllowCreateMode = computed(() => {
  39531. return props.allowCreate && props.filterable;
  39532. });
  39533. function hasExistingOption(query) {
  39534. const hasOption = (option) => getLabel(option) === query;
  39535. return props.options && props.options.some(hasOption) || states.createdOptions.some(hasOption);
  39536. }
  39537. function selectNewOption(option) {
  39538. if (!enableAllowCreateMode.value) {
  39539. return;
  39540. }
  39541. if (props.multiple && option.created) {
  39542. createOptionCount.value++;
  39543. } else {
  39544. cachedSelectedOption.value = option;
  39545. }
  39546. }
  39547. function createNewOption(query) {
  39548. if (enableAllowCreateMode.value) {
  39549. if (query && query.length > 0) {
  39550. if (hasExistingOption(query)) {
  39551. return;
  39552. }
  39553. const newOption = {
  39554. [aliasProps.value.value]: query,
  39555. [aliasProps.value.label]: query,
  39556. created: true,
  39557. [aliasProps.value.disabled]: false
  39558. };
  39559. if (states.createdOptions.length >= createOptionCount.value) {
  39560. states.createdOptions[createOptionCount.value] = newOption;
  39561. } else {
  39562. states.createdOptions.push(newOption);
  39563. }
  39564. } else {
  39565. if (props.multiple) {
  39566. states.createdOptions.length = createOptionCount.value;
  39567. } else {
  39568. const selectedOption = cachedSelectedOption.value;
  39569. states.createdOptions.length = 0;
  39570. if (selectedOption && selectedOption.created) {
  39571. states.createdOptions.push(selectedOption);
  39572. }
  39573. }
  39574. }
  39575. }
  39576. }
  39577. function removeNewOption(option) {
  39578. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === getLabel(option)) {
  39579. return;
  39580. }
  39581. const idx = states.createdOptions.findIndex((it) => getValue(it) === getValue(option));
  39582. if (~idx) {
  39583. states.createdOptions.splice(idx, 1);
  39584. createOptionCount.value--;
  39585. }
  39586. }
  39587. function clearAllNewOption() {
  39588. if (enableAllowCreateMode.value) {
  39589. states.createdOptions.length = 0;
  39590. createOptionCount.value = 0;
  39591. }
  39592. }
  39593. return {
  39594. createNewOption,
  39595. removeNewOption,
  39596. selectNewOption,
  39597. clearAllNewOption
  39598. };
  39599. }
  39600. const MINIMUM_INPUT_WIDTH = 11;
  39601. const useSelect$1 = (props, emit) => {
  39602. const { t } = useLocale();
  39603. const nsSelect = useNamespace("select");
  39604. const nsInput = useNamespace("input");
  39605. const { form: elForm, formItem: elFormItem } = useFormItem();
  39606. const { inputId } = useFormItemInputId(props, {
  39607. formItemContext: elFormItem
  39608. });
  39609. const { aliasProps, getLabel, getValue, getDisabled, getOptions } = useProps(props);
  39610. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  39611. const states = reactive({
  39612. inputValue: "",
  39613. cachedOptions: [],
  39614. createdOptions: [],
  39615. hoveringIndex: -1,
  39616. inputHovering: false,
  39617. selectionWidth: 0,
  39618. calculatorWidth: 0,
  39619. collapseItemWidth: 0,
  39620. previousQuery: null,
  39621. previousValue: void 0,
  39622. selectedLabel: "",
  39623. menuVisibleOnFocus: false,
  39624. isBeforeHide: false
  39625. });
  39626. const popperSize = ref(-1);
  39627. const selectRef = ref();
  39628. const selectionRef = ref();
  39629. const tooltipRef = ref();
  39630. const tagTooltipRef = ref();
  39631. const inputRef = ref();
  39632. const calculatorRef = ref();
  39633. const prefixRef = ref();
  39634. const suffixRef = ref();
  39635. const menuRef = ref();
  39636. const tagMenuRef = ref();
  39637. const collapseItemRef = ref();
  39638. const {
  39639. isComposing,
  39640. handleCompositionStart,
  39641. handleCompositionEnd,
  39642. handleCompositionUpdate
  39643. } = useComposition({
  39644. afterComposition: (e) => onInput(e)
  39645. });
  39646. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  39647. beforeFocus() {
  39648. return selectDisabled.value;
  39649. },
  39650. afterFocus() {
  39651. if (props.automaticDropdown && !expanded.value) {
  39652. expanded.value = true;
  39653. states.menuVisibleOnFocus = true;
  39654. }
  39655. },
  39656. beforeBlur(event) {
  39657. var _a, _b;
  39658. return ((_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event)) || ((_b = tagTooltipRef.value) == null ? void 0 : _b.isFocusInsideContent(event));
  39659. },
  39660. afterBlur() {
  39661. expanded.value = false;
  39662. states.menuVisibleOnFocus = false;
  39663. }
  39664. });
  39665. const allOptions = ref([]);
  39666. const filteredOptions = ref([]);
  39667. const expanded = ref(false);
  39668. const selectDisabled = computed(() => props.disabled || (elForm == null ? void 0 : elForm.disabled));
  39669. const needStatusIcon = computed(() => {
  39670. var _a;
  39671. return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
  39672. });
  39673. const popupHeight = computed(() => {
  39674. const totalHeight = filteredOptions.value.length * props.itemHeight;
  39675. return totalHeight > props.height ? props.height : totalHeight;
  39676. });
  39677. const hasModelValue = computed(() => {
  39678. return props.multiple ? isArray$1(props.modelValue) && props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  39679. });
  39680. const showClearBtn = computed(() => {
  39681. return props.clearable && !selectDisabled.value && states.inputHovering && hasModelValue.value;
  39682. });
  39683. const iconComponent = computed(() => props.remote && props.filterable ? "" : arrow_down_default);
  39684. const iconReverse = computed(() => iconComponent.value && nsSelect.is("reverse", expanded.value));
  39685. const validateState = computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  39686. const validateIcon = computed(() => {
  39687. if (!validateState.value)
  39688. return;
  39689. return ValidateComponentsMap[validateState.value];
  39690. });
  39691. const debounce$1 = computed(() => props.remote ? 300 : 0);
  39692. const emptyText = computed(() => {
  39693. if (props.loading) {
  39694. return props.loadingText || t("el.select.loading");
  39695. } else {
  39696. if (props.remote && !states.inputValue && allOptions.value.length === 0)
  39697. return false;
  39698. if (props.filterable && states.inputValue && allOptions.value.length > 0 && filteredOptions.value.length === 0) {
  39699. return props.noMatchText || t("el.select.noMatch");
  39700. }
  39701. if (allOptions.value.length === 0) {
  39702. return props.noDataText || t("el.select.noData");
  39703. }
  39704. }
  39705. return null;
  39706. });
  39707. const filterOptions = (query) => {
  39708. const isValidOption = (o) => {
  39709. if (props.filterable && isFunction$1(props.filterMethod))
  39710. return true;
  39711. if (props.filterable && props.remote && isFunction$1(props.remoteMethod))
  39712. return true;
  39713. const regexp = new RegExp(escapeStringRegexp(query), "i");
  39714. return query ? regexp.test(getLabel(o) || "") : true;
  39715. };
  39716. if (props.loading) {
  39717. return [];
  39718. }
  39719. return [...states.createdOptions, ...props.options].reduce((all, item) => {
  39720. const options = getOptions(item);
  39721. if (isArray$1(options)) {
  39722. const filtered = options.filter(isValidOption);
  39723. if (filtered.length > 0) {
  39724. all.push({
  39725. label: getLabel(item),
  39726. type: "Group"
  39727. }, ...filtered);
  39728. }
  39729. } else if (props.remote || isValidOption(item)) {
  39730. all.push(item);
  39731. }
  39732. return all;
  39733. }, []);
  39734. };
  39735. const updateOptions = () => {
  39736. allOptions.value = filterOptions("");
  39737. filteredOptions.value = filterOptions(states.inputValue);
  39738. };
  39739. const allOptionsValueMap = computed(() => {
  39740. const valueMap = /* @__PURE__ */ new Map();
  39741. allOptions.value.forEach((option, index) => {
  39742. valueMap.set(getValueKey(getValue(option)), { option, index });
  39743. });
  39744. return valueMap;
  39745. });
  39746. const filteredOptionsValueMap = computed(() => {
  39747. const valueMap = /* @__PURE__ */ new Map();
  39748. filteredOptions.value.forEach((option, index) => {
  39749. valueMap.set(getValueKey(getValue(option)), { option, index });
  39750. });
  39751. return valueMap;
  39752. });
  39753. const optionsAllDisabled = computed(() => filteredOptions.value.every((option) => getDisabled(option)));
  39754. const selectSize = useFormSize();
  39755. const collapseTagSize = computed(() => selectSize.value === "small" ? "small" : "default");
  39756. const calculatePopperSize = () => {
  39757. var _a;
  39758. popperSize.value = ((_a = selectRef.value) == null ? void 0 : _a.offsetWidth) || 200;
  39759. };
  39760. const getGapWidth = () => {
  39761. if (!selectionRef.value)
  39762. return 0;
  39763. const style = window.getComputedStyle(selectionRef.value);
  39764. return Number.parseFloat(style.gap || "6px");
  39765. };
  39766. const tagStyle = computed(() => {
  39767. const gapWidth = getGapWidth();
  39768. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth : states.selectionWidth;
  39769. return { maxWidth: `${maxWidth}px` };
  39770. });
  39771. const collapseTagStyle = computed(() => {
  39772. return { maxWidth: `${states.selectionWidth}px` };
  39773. });
  39774. const inputStyle = computed(() => ({
  39775. width: `${Math.max(states.calculatorWidth, MINIMUM_INPUT_WIDTH)}px`
  39776. }));
  39777. const shouldShowPlaceholder = computed(() => {
  39778. if (isArray$1(props.modelValue)) {
  39779. return props.modelValue.length === 0 && !states.inputValue;
  39780. }
  39781. return props.filterable ? !states.inputValue : true;
  39782. });
  39783. const currentPlaceholder = computed(() => {
  39784. var _a;
  39785. const _placeholder = (_a = props.placeholder) != null ? _a : t("el.select.placeholder");
  39786. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  39787. });
  39788. const popperRef = computed(() => {
  39789. var _a, _b;
  39790. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  39791. });
  39792. const indexRef = computed(() => {
  39793. if (props.multiple) {
  39794. const len = props.modelValue.length;
  39795. if (props.modelValue.length > 0 && filteredOptionsValueMap.value.has(props.modelValue[len - 1])) {
  39796. const { index } = filteredOptionsValueMap.value.get(props.modelValue[len - 1]);
  39797. return index;
  39798. }
  39799. } else {
  39800. if (!isEmptyValue(props.modelValue) && filteredOptionsValueMap.value.has(props.modelValue)) {
  39801. const { index } = filteredOptionsValueMap.value.get(props.modelValue);
  39802. return index;
  39803. }
  39804. }
  39805. return -1;
  39806. });
  39807. const dropdownMenuVisible = computed({
  39808. get() {
  39809. return expanded.value && emptyText.value !== false;
  39810. },
  39811. set(val) {
  39812. expanded.value = val;
  39813. }
  39814. });
  39815. const showTagList = computed(() => {
  39816. if (!props.multiple) {
  39817. return [];
  39818. }
  39819. return props.collapseTags ? states.cachedOptions.slice(0, props.maxCollapseTags) : states.cachedOptions;
  39820. });
  39821. const collapseTagList = computed(() => {
  39822. if (!props.multiple) {
  39823. return [];
  39824. }
  39825. return props.collapseTags ? states.cachedOptions.slice(props.maxCollapseTags) : [];
  39826. });
  39827. const {
  39828. createNewOption,
  39829. removeNewOption,
  39830. selectNewOption,
  39831. clearAllNewOption
  39832. } = useAllowCreate(props, states);
  39833. const toggleMenu = () => {
  39834. if (selectDisabled.value)
  39835. return;
  39836. if (states.menuVisibleOnFocus) {
  39837. states.menuVisibleOnFocus = false;
  39838. } else {
  39839. expanded.value = !expanded.value;
  39840. }
  39841. };
  39842. const onInputChange = () => {
  39843. if (states.inputValue.length > 0 && !expanded.value) {
  39844. expanded.value = true;
  39845. }
  39846. createNewOption(states.inputValue);
  39847. handleQueryChange(states.inputValue);
  39848. };
  39849. const debouncedOnInputChange = debounce(onInputChange, debounce$1.value);
  39850. const handleQueryChange = (val) => {
  39851. if (states.previousQuery === val || isComposing.value) {
  39852. return;
  39853. }
  39854. states.previousQuery = val;
  39855. if (props.filterable && isFunction$1(props.filterMethod)) {
  39856. props.filterMethod(val);
  39857. } else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) {
  39858. props.remoteMethod(val);
  39859. }
  39860. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptions.value.length) {
  39861. nextTick(checkDefaultFirstOption);
  39862. } else {
  39863. nextTick(updateHoveringIndex);
  39864. }
  39865. };
  39866. const checkDefaultFirstOption = () => {
  39867. const optionsInDropdown = filteredOptions.value.filter((n) => !n.disabled && n.type !== "Group");
  39868. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  39869. const firstOriginOption = optionsInDropdown[0];
  39870. states.hoveringIndex = getValueIndex(filteredOptions.value, userCreatedOption || firstOriginOption);
  39871. };
  39872. const emitChange = (val) => {
  39873. if (!isEqual$1(props.modelValue, val)) {
  39874. emit(CHANGE_EVENT, val);
  39875. }
  39876. };
  39877. const update = (val) => {
  39878. emit(UPDATE_MODEL_EVENT, val);
  39879. emitChange(val);
  39880. states.previousValue = props.multiple ? String(val) : val;
  39881. };
  39882. const getValueIndex = (arr = [], value) => {
  39883. if (!isObject$1(value)) {
  39884. return arr.indexOf(value);
  39885. }
  39886. const valueKey = props.valueKey;
  39887. let index = -1;
  39888. arr.some((item, i) => {
  39889. if (get(item, valueKey) === get(value, valueKey)) {
  39890. index = i;
  39891. return true;
  39892. }
  39893. return false;
  39894. });
  39895. return index;
  39896. };
  39897. const getValueKey = (item) => {
  39898. return isObject$1(item) ? get(item, props.valueKey) : item;
  39899. };
  39900. const handleResize = () => {
  39901. calculatePopperSize();
  39902. };
  39903. const resetSelectionWidth = () => {
  39904. states.selectionWidth = selectionRef.value.getBoundingClientRect().width;
  39905. };
  39906. const resetCalculatorWidth = () => {
  39907. states.calculatorWidth = calculatorRef.value.getBoundingClientRect().width;
  39908. };
  39909. const resetCollapseItemWidth = () => {
  39910. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  39911. };
  39912. const updateTooltip = () => {
  39913. var _a, _b;
  39914. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  39915. };
  39916. const updateTagTooltip = () => {
  39917. var _a, _b;
  39918. (_b = (_a = tagTooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  39919. };
  39920. const onSelect = (option) => {
  39921. if (props.multiple) {
  39922. let selectedOptions = props.modelValue.slice();
  39923. const index = getValueIndex(selectedOptions, getValue(option));
  39924. if (index > -1) {
  39925. selectedOptions = [
  39926. ...selectedOptions.slice(0, index),
  39927. ...selectedOptions.slice(index + 1)
  39928. ];
  39929. states.cachedOptions.splice(index, 1);
  39930. removeNewOption(option);
  39931. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  39932. selectedOptions = [...selectedOptions, getValue(option)];
  39933. states.cachedOptions.push(option);
  39934. selectNewOption(option);
  39935. }
  39936. update(selectedOptions);
  39937. if (option.created) {
  39938. handleQueryChange("");
  39939. }
  39940. if (props.filterable && !props.reserveKeyword) {
  39941. states.inputValue = "";
  39942. }
  39943. } else {
  39944. states.selectedLabel = getLabel(option);
  39945. update(getValue(option));
  39946. expanded.value = false;
  39947. selectNewOption(option);
  39948. if (!option.created) {
  39949. clearAllNewOption();
  39950. }
  39951. }
  39952. focus();
  39953. };
  39954. const deleteTag = (event, option) => {
  39955. let selectedOptions = props.modelValue.slice();
  39956. const index = getValueIndex(selectedOptions, getValue(option));
  39957. if (index > -1 && !selectDisabled.value) {
  39958. selectedOptions = [
  39959. ...props.modelValue.slice(0, index),
  39960. ...props.modelValue.slice(index + 1)
  39961. ];
  39962. states.cachedOptions.splice(index, 1);
  39963. update(selectedOptions);
  39964. emit("remove-tag", getValue(option));
  39965. removeNewOption(option);
  39966. }
  39967. event.stopPropagation();
  39968. focus();
  39969. };
  39970. const focus = () => {
  39971. var _a;
  39972. (_a = inputRef.value) == null ? void 0 : _a.focus();
  39973. };
  39974. const blur = () => {
  39975. var _a;
  39976. if (expanded.value) {
  39977. expanded.value = false;
  39978. nextTick(() => {
  39979. var _a2;
  39980. return (_a2 = inputRef.value) == null ? void 0 : _a2.blur();
  39981. });
  39982. return;
  39983. }
  39984. (_a = inputRef.value) == null ? void 0 : _a.blur();
  39985. };
  39986. const handleEsc = () => {
  39987. if (states.inputValue.length > 0) {
  39988. states.inputValue = "";
  39989. } else {
  39990. expanded.value = false;
  39991. }
  39992. };
  39993. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => !states.cachedOptions.some((option) => getValue(option) === it && getDisabled(option)));
  39994. const handleDel = (e) => {
  39995. if (!props.multiple)
  39996. return;
  39997. if (e.code === EVENT_CODE.delete)
  39998. return;
  39999. if (states.inputValue.length === 0) {
  40000. e.preventDefault();
  40001. const selected = props.modelValue.slice();
  40002. const lastNotDisabledIndex = getLastNotDisabledIndex(selected);
  40003. if (lastNotDisabledIndex < 0)
  40004. return;
  40005. const removeTagValue = selected[lastNotDisabledIndex];
  40006. selected.splice(lastNotDisabledIndex, 1);
  40007. const option = states.cachedOptions[lastNotDisabledIndex];
  40008. states.cachedOptions.splice(lastNotDisabledIndex, 1);
  40009. removeNewOption(option);
  40010. update(selected);
  40011. emit("remove-tag", removeTagValue);
  40012. }
  40013. };
  40014. const handleClear = () => {
  40015. let emptyValue;
  40016. if (isArray$1(props.modelValue)) {
  40017. emptyValue = [];
  40018. } else {
  40019. emptyValue = valueOnClear.value;
  40020. }
  40021. if (props.multiple) {
  40022. states.cachedOptions = [];
  40023. } else {
  40024. states.selectedLabel = "";
  40025. }
  40026. expanded.value = false;
  40027. update(emptyValue);
  40028. emit("clear");
  40029. clearAllNewOption();
  40030. focus();
  40031. };
  40032. const onKeyboardNavigate = (direction, hoveringIndex = void 0) => {
  40033. const options = filteredOptions.value;
  40034. if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value || isComposing.value) {
  40035. return;
  40036. }
  40037. if (!expanded.value) {
  40038. return toggleMenu();
  40039. }
  40040. if (hoveringIndex === void 0) {
  40041. hoveringIndex = states.hoveringIndex;
  40042. }
  40043. let newIndex = -1;
  40044. if (direction === "forward") {
  40045. newIndex = hoveringIndex + 1;
  40046. if (newIndex >= options.length) {
  40047. newIndex = 0;
  40048. }
  40049. } else if (direction === "backward") {
  40050. newIndex = hoveringIndex - 1;
  40051. if (newIndex < 0 || newIndex >= options.length) {
  40052. newIndex = options.length - 1;
  40053. }
  40054. }
  40055. const option = options[newIndex];
  40056. if (getDisabled(option) || option.type === "Group") {
  40057. return onKeyboardNavigate(direction, newIndex);
  40058. } else {
  40059. states.hoveringIndex = newIndex;
  40060. scrollToItem(newIndex);
  40061. }
  40062. };
  40063. const onKeyboardSelect = () => {
  40064. if (!expanded.value) {
  40065. return toggleMenu();
  40066. } else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) {
  40067. onSelect(filteredOptions.value[states.hoveringIndex]);
  40068. }
  40069. };
  40070. const onHoverOption = (idx) => {
  40071. states.hoveringIndex = idx != null ? idx : -1;
  40072. };
  40073. const updateHoveringIndex = () => {
  40074. if (!props.multiple) {
  40075. states.hoveringIndex = filteredOptions.value.findIndex((item) => {
  40076. return getValueKey(item) === getValueKey(props.modelValue);
  40077. });
  40078. } else {
  40079. states.hoveringIndex = filteredOptions.value.findIndex((item) => props.modelValue.some((modelValue) => getValueKey(modelValue) === getValueKey(item)));
  40080. }
  40081. };
  40082. const onInput = (event) => {
  40083. states.inputValue = event.target.value;
  40084. if (props.remote) {
  40085. debouncedOnInputChange();
  40086. } else {
  40087. return onInputChange();
  40088. }
  40089. };
  40090. const handleClickOutside = (event) => {
  40091. expanded.value = false;
  40092. if (isFocused.value) {
  40093. const _event = new FocusEvent("focus", event);
  40094. handleBlur(_event);
  40095. }
  40096. };
  40097. const handleMenuEnter = () => {
  40098. states.isBeforeHide = false;
  40099. return nextTick(() => {
  40100. if (~indexRef.value) {
  40101. scrollToItem(states.hoveringIndex);
  40102. }
  40103. });
  40104. };
  40105. const scrollToItem = (index) => {
  40106. menuRef.value.scrollToItem(index);
  40107. };
  40108. const getOption = (value, cachedOptions) => {
  40109. const selectValue = getValueKey(value);
  40110. if (allOptionsValueMap.value.has(selectValue)) {
  40111. const { option } = allOptionsValueMap.value.get(selectValue);
  40112. return option;
  40113. }
  40114. if (cachedOptions && cachedOptions.length) {
  40115. const option = cachedOptions.find((option2) => getValueKey(getValue(option2)) === selectValue);
  40116. if (option) {
  40117. return option;
  40118. }
  40119. }
  40120. return {
  40121. [aliasProps.value.value]: value,
  40122. [aliasProps.value.label]: value
  40123. };
  40124. };
  40125. const initStates = (needUpdateSelectedLabel = false) => {
  40126. if (props.multiple) {
  40127. if (props.modelValue.length > 0) {
  40128. const cachedOptions = states.cachedOptions.slice();
  40129. states.cachedOptions.length = 0;
  40130. states.previousValue = props.modelValue.toString();
  40131. for (const value of props.modelValue) {
  40132. const option = getOption(value, cachedOptions);
  40133. states.cachedOptions.push(option);
  40134. }
  40135. } else {
  40136. states.cachedOptions = [];
  40137. states.previousValue = void 0;
  40138. }
  40139. } else {
  40140. if (hasModelValue.value) {
  40141. states.previousValue = props.modelValue;
  40142. const options = filteredOptions.value;
  40143. const selectedItemIndex = options.findIndex((option) => getValueKey(getValue(option)) === getValueKey(props.modelValue));
  40144. if (~selectedItemIndex) {
  40145. states.selectedLabel = getLabel(options[selectedItemIndex]);
  40146. } else {
  40147. if (!states.selectedLabel || needUpdateSelectedLabel) {
  40148. states.selectedLabel = getValueKey(props.modelValue);
  40149. }
  40150. }
  40151. } else {
  40152. states.selectedLabel = "";
  40153. states.previousValue = void 0;
  40154. }
  40155. }
  40156. clearAllNewOption();
  40157. calculatePopperSize();
  40158. };
  40159. watch(expanded, (val) => {
  40160. if (val) {
  40161. handleQueryChange("");
  40162. } else {
  40163. states.inputValue = "";
  40164. states.previousQuery = null;
  40165. states.isBeforeHide = true;
  40166. createNewOption("");
  40167. }
  40168. emit("visible-change", val);
  40169. });
  40170. watch(() => props.modelValue, (val, oldVal) => {
  40171. var _a;
  40172. const isValEmpty = !val || isArray$1(val) && val.length === 0;
  40173. if (isValEmpty || props.multiple && !isEqual$1(val.toString(), states.previousValue) || !props.multiple && getValueKey(val) !== getValueKey(states.previousValue)) {
  40174. initStates(true);
  40175. }
  40176. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  40177. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  40178. }
  40179. }, {
  40180. deep: true
  40181. });
  40182. watch(() => props.options, () => {
  40183. const input = inputRef.value;
  40184. if (!input || input && document.activeElement !== input) {
  40185. initStates();
  40186. }
  40187. }, {
  40188. deep: true,
  40189. flush: "post"
  40190. });
  40191. watch(() => filteredOptions.value, () => {
  40192. return menuRef.value && nextTick(menuRef.value.resetScrollTop);
  40193. });
  40194. watchEffect(() => {
  40195. if (states.isBeforeHide)
  40196. return;
  40197. updateOptions();
  40198. });
  40199. watchEffect(() => {
  40200. const { valueKey, options } = props;
  40201. const duplicateValue = /* @__PURE__ */ new Map();
  40202. for (const item of options) {
  40203. const optionValue = getValue(item);
  40204. let v = optionValue;
  40205. if (isObject$1(v)) {
  40206. v = get(optionValue, valueKey);
  40207. }
  40208. if (duplicateValue.get(v)) {
  40209. break;
  40210. } else {
  40211. duplicateValue.set(v, true);
  40212. }
  40213. }
  40214. });
  40215. onMounted(() => {
  40216. initStates();
  40217. });
  40218. useResizeObserver(selectRef, handleResize);
  40219. useResizeObserver(selectionRef, resetSelectionWidth);
  40220. useResizeObserver(calculatorRef, resetCalculatorWidth);
  40221. useResizeObserver(menuRef, updateTooltip);
  40222. useResizeObserver(wrapperRef, updateTooltip);
  40223. useResizeObserver(tagMenuRef, updateTagTooltip);
  40224. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  40225. return {
  40226. inputId,
  40227. collapseTagSize,
  40228. currentPlaceholder,
  40229. expanded,
  40230. emptyText,
  40231. popupHeight,
  40232. debounce: debounce$1,
  40233. allOptions,
  40234. filteredOptions,
  40235. iconComponent,
  40236. iconReverse,
  40237. tagStyle,
  40238. collapseTagStyle,
  40239. inputStyle,
  40240. popperSize,
  40241. dropdownMenuVisible,
  40242. hasModelValue,
  40243. shouldShowPlaceholder,
  40244. selectDisabled,
  40245. selectSize,
  40246. needStatusIcon,
  40247. showClearBtn,
  40248. states,
  40249. isFocused,
  40250. nsSelect,
  40251. nsInput,
  40252. calculatorRef,
  40253. inputRef,
  40254. menuRef,
  40255. tagMenuRef,
  40256. tooltipRef,
  40257. tagTooltipRef,
  40258. selectRef,
  40259. wrapperRef,
  40260. selectionRef,
  40261. prefixRef,
  40262. suffixRef,
  40263. collapseItemRef,
  40264. popperRef,
  40265. validateState,
  40266. validateIcon,
  40267. showTagList,
  40268. collapseTagList,
  40269. debouncedOnInputChange,
  40270. deleteTag,
  40271. getLabel,
  40272. getValue,
  40273. getDisabled,
  40274. getValueKey,
  40275. handleClear,
  40276. handleClickOutside,
  40277. handleDel,
  40278. handleEsc,
  40279. focus,
  40280. blur,
  40281. handleMenuEnter,
  40282. handleResize,
  40283. resetSelectionWidth,
  40284. resetCalculatorWidth,
  40285. updateTooltip,
  40286. updateTagTooltip,
  40287. updateOptions,
  40288. toggleMenu,
  40289. scrollTo: scrollToItem,
  40290. onInput,
  40291. onKeyboardNavigate,
  40292. onKeyboardSelect,
  40293. onSelect,
  40294. onHover: onHoverOption,
  40295. handleCompositionStart,
  40296. handleCompositionEnd,
  40297. handleCompositionUpdate
  40298. };
  40299. };
  40300. var useSelect$2 = useSelect$1;
  40301. const _sfc_main$M = defineComponent({
  40302. name: "ElSelectV2",
  40303. components: {
  40304. ElSelectMenu,
  40305. ElTag,
  40306. ElTooltip,
  40307. ElIcon
  40308. },
  40309. directives: { ClickOutside },
  40310. props: SelectProps,
  40311. emits: selectEmits,
  40312. setup(props, { emit }) {
  40313. const modelValue = computed(() => {
  40314. const { modelValue: rawModelValue, multiple } = props;
  40315. const fallback = multiple ? [] : void 0;
  40316. if (isArray$1(rawModelValue)) {
  40317. return multiple ? rawModelValue : fallback;
  40318. }
  40319. return multiple ? fallback : rawModelValue;
  40320. });
  40321. const API = useSelect$2(reactive({
  40322. ...toRefs(props),
  40323. modelValue
  40324. }), emit);
  40325. provide(selectV2InjectionKey, {
  40326. props: reactive({
  40327. ...toRefs(props),
  40328. height: API.popupHeight,
  40329. modelValue
  40330. }),
  40331. expanded: API.expanded,
  40332. tooltipRef: API.tooltipRef,
  40333. onSelect: API.onSelect,
  40334. onHover: API.onHover,
  40335. onKeyboardNavigate: API.onKeyboardNavigate,
  40336. onKeyboardSelect: API.onKeyboardSelect
  40337. });
  40338. const selectedLabel = computed(() => {
  40339. if (!props.multiple) {
  40340. return API.states.selectedLabel;
  40341. }
  40342. return API.states.cachedOptions.map((i) => i.label);
  40343. });
  40344. return {
  40345. ...API,
  40346. modelValue,
  40347. selectedLabel
  40348. };
  40349. }
  40350. });
  40351. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  40352. const _component_el_tag = resolveComponent("el-tag");
  40353. const _component_el_tooltip = resolveComponent("el-tooltip");
  40354. const _component_el_icon = resolveComponent("el-icon");
  40355. const _component_el_select_menu = resolveComponent("el-select-menu");
  40356. const _directive_click_outside = resolveDirective("click-outside");
  40357. return withDirectives((openBlock(), createElementBlock("div", {
  40358. ref: "selectRef",
  40359. class: normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  40360. onMouseenter: ($event) => _ctx.states.inputHovering = true,
  40361. onMouseleave: ($event) => _ctx.states.inputHovering = false
  40362. }, [
  40363. createVNode(_component_el_tooltip, {
  40364. ref: "tooltipRef",
  40365. visible: _ctx.dropdownMenuVisible,
  40366. teleported: _ctx.teleported,
  40367. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  40368. "gpu-acceleration": false,
  40369. "stop-popper-mouse-event": false,
  40370. "popper-options": _ctx.popperOptions,
  40371. "fallback-placements": _ctx.fallbackPlacements,
  40372. effect: _ctx.effect,
  40373. placement: _ctx.placement,
  40374. pure: "",
  40375. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  40376. trigger: "click",
  40377. persistent: _ctx.persistent,
  40378. "append-to": _ctx.appendTo,
  40379. "show-arrow": _ctx.showArrow,
  40380. offset: _ctx.offset,
  40381. onBeforeShow: _ctx.handleMenuEnter,
  40382. onHide: ($event) => _ctx.states.isBeforeHide = false
  40383. }, {
  40384. default: withCtx(() => [
  40385. createElementVNode("div", {
  40386. ref: "wrapperRef",
  40387. class: normalizeClass([
  40388. _ctx.nsSelect.e("wrapper"),
  40389. _ctx.nsSelect.is("focused", _ctx.isFocused),
  40390. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  40391. _ctx.nsSelect.is("filterable", _ctx.filterable),
  40392. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  40393. ]),
  40394. onClick: withModifiers(_ctx.toggleMenu, ["prevent"])
  40395. }, [
  40396. _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
  40397. key: 0,
  40398. ref: "prefixRef",
  40399. class: normalizeClass(_ctx.nsSelect.e("prefix"))
  40400. }, [
  40401. renderSlot(_ctx.$slots, "prefix")
  40402. ], 2)) : createCommentVNode("v-if", true),
  40403. createElementVNode("div", {
  40404. ref: "selectionRef",
  40405. class: normalizeClass([
  40406. _ctx.nsSelect.e("selection"),
  40407. _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.modelValue.length)
  40408. ])
  40409. }, [
  40410. _ctx.multiple ? renderSlot(_ctx.$slots, "tag", { key: 0 }, () => [
  40411. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  40412. return openBlock(), createElementBlock("div", {
  40413. key: _ctx.getValueKey(_ctx.getValue(item)),
  40414. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  40415. }, [
  40416. createVNode(_component_el_tag, {
  40417. closable: !_ctx.selectDisabled && !_ctx.getDisabled(item),
  40418. size: _ctx.collapseTagSize,
  40419. type: _ctx.tagType,
  40420. effect: _ctx.tagEffect,
  40421. "disable-transitions": "",
  40422. style: normalizeStyle(_ctx.tagStyle),
  40423. onClose: ($event) => _ctx.deleteTag($event, item)
  40424. }, {
  40425. default: withCtx(() => [
  40426. createElementVNode("span", {
  40427. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  40428. }, [
  40429. renderSlot(_ctx.$slots, "label", {
  40430. label: _ctx.getLabel(item),
  40431. value: _ctx.getValue(item)
  40432. }, () => [
  40433. createTextVNode(toDisplayString(_ctx.getLabel(item)), 1)
  40434. ])
  40435. ], 2)
  40436. ]),
  40437. _: 2
  40438. }, 1032, ["closable", "size", "type", "effect", "style", "onClose"])
  40439. ], 2);
  40440. }), 128)),
  40441. _ctx.collapseTags && _ctx.modelValue.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tooltip, {
  40442. key: 0,
  40443. ref: "tagTooltipRef",
  40444. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  40445. "fallback-placements": ["bottom", "top", "right", "left"],
  40446. effect: _ctx.effect,
  40447. placement: "bottom",
  40448. teleported: _ctx.teleported
  40449. }, {
  40450. default: withCtx(() => [
  40451. createElementVNode("div", {
  40452. ref: "collapseItemRef",
  40453. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  40454. }, [
  40455. createVNode(_component_el_tag, {
  40456. closable: false,
  40457. size: _ctx.collapseTagSize,
  40458. type: _ctx.tagType,
  40459. effect: _ctx.tagEffect,
  40460. style: normalizeStyle(_ctx.collapseTagStyle),
  40461. "disable-transitions": ""
  40462. }, {
  40463. default: withCtx(() => [
  40464. createElementVNode("span", {
  40465. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  40466. }, " + " + toDisplayString(_ctx.modelValue.length - _ctx.maxCollapseTags), 3)
  40467. ]),
  40468. _: 1
  40469. }, 8, ["size", "type", "effect", "style"])
  40470. ], 2)
  40471. ]),
  40472. content: withCtx(() => [
  40473. createElementVNode("div", {
  40474. ref: "tagMenuRef",
  40475. class: normalizeClass(_ctx.nsSelect.e("selection"))
  40476. }, [
  40477. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (selected) => {
  40478. return openBlock(), createElementBlock("div", {
  40479. key: _ctx.getValueKey(_ctx.getValue(selected)),
  40480. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  40481. }, [
  40482. createVNode(_component_el_tag, {
  40483. class: "in-tooltip",
  40484. closable: !_ctx.selectDisabled && !_ctx.getDisabled(selected),
  40485. size: _ctx.collapseTagSize,
  40486. type: _ctx.tagType,
  40487. effect: _ctx.tagEffect,
  40488. "disable-transitions": "",
  40489. onClose: ($event) => _ctx.deleteTag($event, selected)
  40490. }, {
  40491. default: withCtx(() => [
  40492. createElementVNode("span", {
  40493. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  40494. }, [
  40495. renderSlot(_ctx.$slots, "label", {
  40496. label: _ctx.getLabel(selected),
  40497. value: _ctx.getValue(selected)
  40498. }, () => [
  40499. createTextVNode(toDisplayString(_ctx.getLabel(selected)), 1)
  40500. ])
  40501. ], 2)
  40502. ]),
  40503. _: 2
  40504. }, 1032, ["closable", "size", "type", "effect", "onClose"])
  40505. ], 2);
  40506. }), 128))
  40507. ], 2)
  40508. ]),
  40509. _: 3
  40510. }, 8, ["disabled", "effect", "teleported"])) : createCommentVNode("v-if", true)
  40511. ]) : createCommentVNode("v-if", true),
  40512. createElementVNode("div", {
  40513. class: normalizeClass([
  40514. _ctx.nsSelect.e("selected-item"),
  40515. _ctx.nsSelect.e("input-wrapper"),
  40516. _ctx.nsSelect.is("hidden", !_ctx.filterable)
  40517. ])
  40518. }, [
  40519. withDirectives(createElementVNode("input", {
  40520. id: _ctx.inputId,
  40521. ref: "inputRef",
  40522. "onUpdate:modelValue": ($event) => _ctx.states.inputValue = $event,
  40523. style: normalizeStyle(_ctx.inputStyle),
  40524. autocomplete: _ctx.autocomplete,
  40525. tabindex: _ctx.tabindex,
  40526. "aria-autocomplete": "list",
  40527. "aria-haspopup": "listbox",
  40528. autocapitalize: "off",
  40529. "aria-expanded": _ctx.expanded,
  40530. "aria-label": _ctx.ariaLabel,
  40531. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  40532. disabled: _ctx.selectDisabled,
  40533. role: "combobox",
  40534. readonly: !_ctx.filterable,
  40535. spellcheck: "false",
  40536. type: "text",
  40537. name: _ctx.name,
  40538. onInput: _ctx.onInput,
  40539. onCompositionstart: _ctx.handleCompositionStart,
  40540. onCompositionupdate: _ctx.handleCompositionUpdate,
  40541. onCompositionend: _ctx.handleCompositionEnd,
  40542. onKeydown: [
  40543. withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"]),
  40544. withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"]),
  40545. withKeys(withModifiers(_ctx.onKeyboardSelect, ["stop", "prevent"]), ["enter"]),
  40546. withKeys(withModifiers(_ctx.handleEsc, ["stop", "prevent"]), ["esc"]),
  40547. withKeys(withModifiers(_ctx.handleDel, ["stop"]), ["delete"])
  40548. ],
  40549. onClick: withModifiers(_ctx.toggleMenu, ["stop"])
  40550. }, null, 46, ["id", "onUpdate:modelValue", "autocomplete", "tabindex", "aria-expanded", "aria-label", "disabled", "readonly", "name", "onInput", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown", "onClick"]), [
  40551. [vModelText, _ctx.states.inputValue]
  40552. ]),
  40553. _ctx.filterable ? (openBlock(), createElementBlock("span", {
  40554. key: 0,
  40555. ref: "calculatorRef",
  40556. "aria-hidden": "true",
  40557. class: normalizeClass(_ctx.nsSelect.e("input-calculator")),
  40558. textContent: toDisplayString(_ctx.states.inputValue)
  40559. }, null, 10, ["textContent"])) : createCommentVNode("v-if", true)
  40560. ], 2),
  40561. _ctx.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", {
  40562. key: 1,
  40563. class: normalizeClass([
  40564. _ctx.nsSelect.e("selected-item"),
  40565. _ctx.nsSelect.e("placeholder"),
  40566. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  40567. ])
  40568. }, [
  40569. _ctx.hasModelValue ? renderSlot(_ctx.$slots, "label", {
  40570. key: 0,
  40571. label: _ctx.currentPlaceholder,
  40572. value: _ctx.modelValue
  40573. }, () => [
  40574. createElementVNode("span", null, toDisplayString(_ctx.currentPlaceholder), 1)
  40575. ]) : (openBlock(), createElementBlock("span", { key: 1 }, toDisplayString(_ctx.currentPlaceholder), 1))
  40576. ], 2)) : createCommentVNode("v-if", true)
  40577. ], 2),
  40578. createElementVNode("div", {
  40579. ref: "suffixRef",
  40580. class: normalizeClass(_ctx.nsSelect.e("suffix"))
  40581. }, [
  40582. _ctx.iconComponent ? withDirectives((openBlock(), createBlock(_component_el_icon, {
  40583. key: 0,
  40584. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsInput.e("icon"), _ctx.iconReverse])
  40585. }, {
  40586. default: withCtx(() => [
  40587. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  40588. ]),
  40589. _: 1
  40590. }, 8, ["class"])), [
  40591. [vShow, !_ctx.showClearBtn]
  40592. ]) : createCommentVNode("v-if", true),
  40593. _ctx.showClearBtn && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  40594. key: 1,
  40595. class: normalizeClass([
  40596. _ctx.nsSelect.e("caret"),
  40597. _ctx.nsInput.e("icon"),
  40598. _ctx.nsSelect.e("clear")
  40599. ]),
  40600. onClick: withModifiers(_ctx.handleClear, ["prevent", "stop"])
  40601. }, {
  40602. default: withCtx(() => [
  40603. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  40604. ]),
  40605. _: 1
  40606. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  40607. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (openBlock(), createBlock(_component_el_icon, {
  40608. key: 2,
  40609. class: normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsInput.e("validateIcon")])
  40610. }, {
  40611. default: withCtx(() => [
  40612. (openBlock(), createBlock(resolveDynamicComponent(_ctx.validateIcon)))
  40613. ]),
  40614. _: 1
  40615. }, 8, ["class"])) : createCommentVNode("v-if", true)
  40616. ], 2)
  40617. ], 10, ["onClick"])
  40618. ]),
  40619. content: withCtx(() => [
  40620. createVNode(_component_el_select_menu, {
  40621. ref: "menuRef",
  40622. data: _ctx.filteredOptions,
  40623. width: _ctx.popperSize,
  40624. "hovering-index": _ctx.states.hoveringIndex,
  40625. "scrollbar-always-on": _ctx.scrollbarAlwaysOn
  40626. }, createSlots({
  40627. default: withCtx((scope) => [
  40628. renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(scope)))
  40629. ]),
  40630. _: 2
  40631. }, [
  40632. _ctx.$slots.header ? {
  40633. name: "header",
  40634. fn: withCtx(() => [
  40635. createElementVNode("div", {
  40636. class: normalizeClass(_ctx.nsSelect.be("dropdown", "header"))
  40637. }, [
  40638. renderSlot(_ctx.$slots, "header")
  40639. ], 2)
  40640. ])
  40641. } : void 0,
  40642. _ctx.$slots.loading && _ctx.loading ? {
  40643. name: "loading",
  40644. fn: withCtx(() => [
  40645. createElementVNode("div", {
  40646. class: normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  40647. }, [
  40648. renderSlot(_ctx.$slots, "loading")
  40649. ], 2)
  40650. ])
  40651. } : _ctx.loading || _ctx.filteredOptions.length === 0 ? {
  40652. name: "empty",
  40653. fn: withCtx(() => [
  40654. createElementVNode("div", {
  40655. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  40656. }, [
  40657. renderSlot(_ctx.$slots, "empty", {}, () => [
  40658. createElementVNode("span", null, toDisplayString(_ctx.emptyText), 1)
  40659. ])
  40660. ], 2)
  40661. ])
  40662. } : void 0,
  40663. _ctx.$slots.footer ? {
  40664. name: "footer",
  40665. fn: withCtx(() => [
  40666. createElementVNode("div", {
  40667. class: normalizeClass(_ctx.nsSelect.be("dropdown", "footer"))
  40668. }, [
  40669. renderSlot(_ctx.$slots, "footer")
  40670. ], 2)
  40671. ])
  40672. } : void 0
  40673. ]), 1032, ["data", "width", "hovering-index", "scrollbar-always-on"])
  40674. ]),
  40675. _: 3
  40676. }, 8, ["visible", "teleported", "popper-class", "popper-options", "fallback-placements", "effect", "placement", "transition", "persistent", "append-to", "show-arrow", "offset", "onBeforeShow", "onHide"])
  40677. ], 42, ["onMouseenter", "onMouseleave"])), [
  40678. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  40679. ]);
  40680. }
  40681. var Select = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["render", _sfc_render$5], ["__file", "select.vue"]]);
  40682. const ElSelectV2 = withInstall(Select);
  40683. const skeletonProps = buildProps({
  40684. animated: {
  40685. type: Boolean,
  40686. default: false
  40687. },
  40688. count: {
  40689. type: Number,
  40690. default: 1
  40691. },
  40692. rows: {
  40693. type: Number,
  40694. default: 3
  40695. },
  40696. loading: {
  40697. type: Boolean,
  40698. default: true
  40699. },
  40700. throttle: {
  40701. type: definePropType([Number, Object])
  40702. }
  40703. });
  40704. const skeletonItemProps = buildProps({
  40705. variant: {
  40706. type: String,
  40707. values: [
  40708. "circle",
  40709. "rect",
  40710. "h1",
  40711. "h3",
  40712. "text",
  40713. "caption",
  40714. "p",
  40715. "image",
  40716. "button"
  40717. ],
  40718. default: "text"
  40719. }
  40720. });
  40721. const __default__$E = defineComponent({
  40722. name: "ElSkeletonItem"
  40723. });
  40724. const _sfc_main$L = /* @__PURE__ */ defineComponent({
  40725. ...__default__$E,
  40726. props: skeletonItemProps,
  40727. setup(__props) {
  40728. const ns = useNamespace("skeleton");
  40729. return (_ctx, _cache) => {
  40730. return openBlock(), createElementBlock("div", {
  40731. class: normalizeClass([unref(ns).e("item"), unref(ns).e(_ctx.variant)])
  40732. }, [
  40733. _ctx.variant === "image" ? (openBlock(), createBlock(unref(picture_filled_default), { key: 0 })) : createCommentVNode("v-if", true)
  40734. ], 2);
  40735. };
  40736. }
  40737. });
  40738. var SkeletonItem = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["__file", "skeleton-item.vue"]]);
  40739. const __default__$D = defineComponent({
  40740. name: "ElSkeleton"
  40741. });
  40742. const _sfc_main$K = /* @__PURE__ */ defineComponent({
  40743. ...__default__$D,
  40744. props: skeletonProps,
  40745. setup(__props, { expose }) {
  40746. const props = __props;
  40747. const ns = useNamespace("skeleton");
  40748. const uiLoading = useThrottleRender(toRef(props, "loading"), props.throttle);
  40749. expose({
  40750. uiLoading
  40751. });
  40752. return (_ctx, _cache) => {
  40753. return unref(uiLoading) ? (openBlock(), createElementBlock("div", mergeProps({
  40754. key: 0,
  40755. class: [unref(ns).b(), unref(ns).is("animated", _ctx.animated)]
  40756. }, _ctx.$attrs), [
  40757. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.count, (i) => {
  40758. return openBlock(), createElementBlock(Fragment, { key: i }, [
  40759. unref(uiLoading) ? renderSlot(_ctx.$slots, "template", { key: i }, () => [
  40760. createVNode(SkeletonItem, {
  40761. class: normalizeClass(unref(ns).is("first")),
  40762. variant: "p"
  40763. }, null, 8, ["class"]),
  40764. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rows, (item) => {
  40765. return openBlock(), createBlock(SkeletonItem, {
  40766. key: item,
  40767. class: normalizeClass([
  40768. unref(ns).e("paragraph"),
  40769. unref(ns).is("last", item === _ctx.rows && _ctx.rows > 1)
  40770. ]),
  40771. variant: "p"
  40772. }, null, 8, ["class"]);
  40773. }), 128))
  40774. ]) : createCommentVNode("v-if", true)
  40775. ], 64);
  40776. }), 128))
  40777. ], 16)) : renderSlot(_ctx.$slots, "default", normalizeProps(mergeProps({ key: 1 }, _ctx.$attrs)));
  40778. };
  40779. }
  40780. });
  40781. var Skeleton = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__file", "skeleton.vue"]]);
  40782. const ElSkeleton = withInstall(Skeleton, {
  40783. SkeletonItem
  40784. });
  40785. const ElSkeletonItem = withNoopInstall(SkeletonItem);
  40786. const sliderContextKey = Symbol("sliderContextKey");
  40787. const sliderProps = buildProps({
  40788. modelValue: {
  40789. type: definePropType([Number, Array]),
  40790. default: 0
  40791. },
  40792. id: {
  40793. type: String,
  40794. default: void 0
  40795. },
  40796. min: {
  40797. type: Number,
  40798. default: 0
  40799. },
  40800. max: {
  40801. type: Number,
  40802. default: 100
  40803. },
  40804. step: {
  40805. type: Number,
  40806. default: 1
  40807. },
  40808. showInput: Boolean,
  40809. showInputControls: {
  40810. type: Boolean,
  40811. default: true
  40812. },
  40813. size: useSizeProp,
  40814. inputSize: useSizeProp,
  40815. showStops: Boolean,
  40816. showTooltip: {
  40817. type: Boolean,
  40818. default: true
  40819. },
  40820. formatTooltip: {
  40821. type: definePropType(Function),
  40822. default: void 0
  40823. },
  40824. disabled: Boolean,
  40825. range: Boolean,
  40826. vertical: Boolean,
  40827. height: String,
  40828. debounce: {
  40829. type: Number,
  40830. default: 300
  40831. },
  40832. rangeStartLabel: {
  40833. type: String,
  40834. default: void 0
  40835. },
  40836. rangeEndLabel: {
  40837. type: String,
  40838. default: void 0
  40839. },
  40840. formatValueText: {
  40841. type: definePropType(Function),
  40842. default: void 0
  40843. },
  40844. tooltipClass: {
  40845. type: String,
  40846. default: void 0
  40847. },
  40848. placement: {
  40849. type: String,
  40850. values: Ee,
  40851. default: "top"
  40852. },
  40853. marks: {
  40854. type: definePropType(Object)
  40855. },
  40856. validateEvent: {
  40857. type: Boolean,
  40858. default: true
  40859. },
  40860. ...useAriaProps(["ariaLabel"])
  40861. });
  40862. const isValidValue$1 = (value) => isNumber(value) || isArray$1(value) && value.every(isNumber);
  40863. const sliderEmits = {
  40864. [UPDATE_MODEL_EVENT]: isValidValue$1,
  40865. [INPUT_EVENT]: isValidValue$1,
  40866. [CHANGE_EVENT]: isValidValue$1
  40867. };
  40868. const useLifecycle = (props, initData, resetSize) => {
  40869. const sliderWrapper = ref();
  40870. onMounted(async () => {
  40871. if (props.range) {
  40872. if (isArray$1(props.modelValue)) {
  40873. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  40874. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  40875. } else {
  40876. initData.firstValue = props.min;
  40877. initData.secondValue = props.max;
  40878. }
  40879. initData.oldValue = [initData.firstValue, initData.secondValue];
  40880. } else {
  40881. if (!isNumber(props.modelValue) || Number.isNaN(props.modelValue)) {
  40882. initData.firstValue = props.min;
  40883. } else {
  40884. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  40885. }
  40886. initData.oldValue = initData.firstValue;
  40887. }
  40888. useEventListener(window, "resize", resetSize);
  40889. await nextTick();
  40890. resetSize();
  40891. });
  40892. return {
  40893. sliderWrapper
  40894. };
  40895. };
  40896. const useMarks = (props) => {
  40897. return computed(() => {
  40898. if (!props.marks) {
  40899. return [];
  40900. }
  40901. const marksKeys = Object.keys(props.marks);
  40902. return marksKeys.map(Number.parseFloat).sort((a, b) => a - b).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  40903. point,
  40904. position: (point - props.min) * 100 / (props.max - props.min),
  40905. mark: props.marks[point]
  40906. }));
  40907. });
  40908. };
  40909. const useSlide = (props, initData, emit) => {
  40910. const { form: elForm, formItem: elFormItem } = useFormItem();
  40911. const slider = shallowRef();
  40912. const firstButton = ref();
  40913. const secondButton = ref();
  40914. const buttonRefs = {
  40915. firstButton,
  40916. secondButton
  40917. };
  40918. const sliderDisabled = computed(() => {
  40919. return props.disabled || (elForm == null ? void 0 : elForm.disabled) || false;
  40920. });
  40921. const minValue = computed(() => {
  40922. return Math.min(initData.firstValue, initData.secondValue);
  40923. });
  40924. const maxValue = computed(() => {
  40925. return Math.max(initData.firstValue, initData.secondValue);
  40926. });
  40927. const barSize = computed(() => {
  40928. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  40929. });
  40930. const barStart = computed(() => {
  40931. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  40932. });
  40933. const runwayStyle = computed(() => {
  40934. return props.vertical ? { height: props.height } : {};
  40935. });
  40936. const barStyle = computed(() => {
  40937. return props.vertical ? {
  40938. height: barSize.value,
  40939. bottom: barStart.value
  40940. } : {
  40941. width: barSize.value,
  40942. left: barStart.value
  40943. };
  40944. });
  40945. const resetSize = () => {
  40946. if (slider.value) {
  40947. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  40948. }
  40949. };
  40950. const getButtonRefByPercent = (percent) => {
  40951. const targetValue = props.min + percent * (props.max - props.min) / 100;
  40952. if (!props.range) {
  40953. return firstButton;
  40954. }
  40955. let buttonRefName;
  40956. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  40957. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  40958. } else {
  40959. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  40960. }
  40961. return buttonRefs[buttonRefName];
  40962. };
  40963. const setPosition = (percent) => {
  40964. const buttonRef = getButtonRefByPercent(percent);
  40965. buttonRef.value.setPosition(percent);
  40966. return buttonRef;
  40967. };
  40968. const setFirstValue = (firstValue) => {
  40969. initData.firstValue = firstValue != null ? firstValue : props.min;
  40970. _emit(props.range ? [minValue.value, maxValue.value] : firstValue != null ? firstValue : props.min);
  40971. };
  40972. const setSecondValue = (secondValue) => {
  40973. initData.secondValue = secondValue;
  40974. if (props.range) {
  40975. _emit([minValue.value, maxValue.value]);
  40976. }
  40977. };
  40978. const _emit = (val) => {
  40979. emit(UPDATE_MODEL_EVENT, val);
  40980. emit(INPUT_EVENT, val);
  40981. };
  40982. const emitChange = async () => {
  40983. await nextTick();
  40984. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  40985. };
  40986. const handleSliderPointerEvent = (event) => {
  40987. var _a, _b, _c, _d, _e, _f;
  40988. if (sliderDisabled.value || initData.dragging)
  40989. return;
  40990. resetSize();
  40991. let newPercent = 0;
  40992. if (props.vertical) {
  40993. const clientY = (_c = (_b = (_a = event.touches) == null ? void 0 : _a.item(0)) == null ? void 0 : _b.clientY) != null ? _c : event.clientY;
  40994. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  40995. newPercent = (sliderOffsetBottom - clientY) / initData.sliderSize * 100;
  40996. } else {
  40997. const clientX = (_f = (_e = (_d = event.touches) == null ? void 0 : _d.item(0)) == null ? void 0 : _e.clientX) != null ? _f : event.clientX;
  40998. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  40999. newPercent = (clientX - sliderOffsetLeft) / initData.sliderSize * 100;
  41000. }
  41001. if (newPercent < 0 || newPercent > 100)
  41002. return;
  41003. return setPosition(newPercent);
  41004. };
  41005. const onSliderWrapperPrevent = (event) => {
  41006. var _a, _b;
  41007. if (((_a = buttonRefs["firstButton"].value) == null ? void 0 : _a.dragging) || ((_b = buttonRefs["secondButton"].value) == null ? void 0 : _b.dragging)) {
  41008. event.preventDefault();
  41009. }
  41010. };
  41011. const onSliderDown = async (event) => {
  41012. const buttonRef = handleSliderPointerEvent(event);
  41013. if (buttonRef) {
  41014. await nextTick();
  41015. buttonRef.value.onButtonDown(event);
  41016. }
  41017. };
  41018. const onSliderClick = (event) => {
  41019. const buttonRef = handleSliderPointerEvent(event);
  41020. if (buttonRef) {
  41021. emitChange();
  41022. }
  41023. };
  41024. const onSliderMarkerDown = (position) => {
  41025. if (sliderDisabled.value || initData.dragging)
  41026. return;
  41027. setPosition(position);
  41028. };
  41029. return {
  41030. elFormItem,
  41031. slider,
  41032. firstButton,
  41033. secondButton,
  41034. sliderDisabled,
  41035. minValue,
  41036. maxValue,
  41037. runwayStyle,
  41038. barStyle,
  41039. resetSize,
  41040. setPosition,
  41041. emitChange,
  41042. onSliderWrapperPrevent,
  41043. onSliderClick,
  41044. onSliderDown,
  41045. onSliderMarkerDown,
  41046. setFirstValue,
  41047. setSecondValue
  41048. };
  41049. };
  41050. const useTooltip = (props, formatTooltip, showTooltip) => {
  41051. const tooltip = ref();
  41052. const tooltipVisible = ref(false);
  41053. const enableFormat = computed(() => {
  41054. return formatTooltip.value instanceof Function;
  41055. });
  41056. const formatValue = computed(() => {
  41057. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  41058. });
  41059. const displayTooltip = debounce(() => {
  41060. showTooltip.value && (tooltipVisible.value = true);
  41061. }, 50);
  41062. const hideTooltip = debounce(() => {
  41063. showTooltip.value && (tooltipVisible.value = false);
  41064. }, 50);
  41065. return {
  41066. tooltip,
  41067. tooltipVisible,
  41068. formatValue,
  41069. displayTooltip,
  41070. hideTooltip
  41071. };
  41072. };
  41073. const useSliderButton = (props, initData, emit) => {
  41074. const {
  41075. disabled,
  41076. min,
  41077. max,
  41078. step,
  41079. showTooltip,
  41080. precision,
  41081. sliderSize,
  41082. formatTooltip,
  41083. emitChange,
  41084. resetSize,
  41085. updateDragging
  41086. } = inject(sliderContextKey);
  41087. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  41088. const button = ref();
  41089. const currentPosition = computed(() => {
  41090. return `${(props.modelValue - min.value) / (max.value - min.value) * 100}%`;
  41091. });
  41092. const wrapperStyle = computed(() => {
  41093. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  41094. });
  41095. const handleMouseEnter = () => {
  41096. initData.hovering = true;
  41097. displayTooltip();
  41098. };
  41099. const handleMouseLeave = () => {
  41100. initData.hovering = false;
  41101. if (!initData.dragging) {
  41102. hideTooltip();
  41103. }
  41104. };
  41105. const onButtonDown = (event) => {
  41106. if (disabled.value)
  41107. return;
  41108. event.preventDefault();
  41109. onDragStart(event);
  41110. window.addEventListener("mousemove", onDragging);
  41111. window.addEventListener("touchmove", onDragging);
  41112. window.addEventListener("mouseup", onDragEnd);
  41113. window.addEventListener("touchend", onDragEnd);
  41114. window.addEventListener("contextmenu", onDragEnd);
  41115. button.value.focus();
  41116. };
  41117. const incrementPosition = (amount) => {
  41118. if (disabled.value)
  41119. return;
  41120. initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max.value - min.value) * 100;
  41121. setPosition(initData.newPosition);
  41122. emitChange();
  41123. };
  41124. const onLeftKeyDown = () => {
  41125. incrementPosition(-step.value);
  41126. };
  41127. const onRightKeyDown = () => {
  41128. incrementPosition(step.value);
  41129. };
  41130. const onPageDownKeyDown = () => {
  41131. incrementPosition(-step.value * 4);
  41132. };
  41133. const onPageUpKeyDown = () => {
  41134. incrementPosition(step.value * 4);
  41135. };
  41136. const onHomeKeyDown = () => {
  41137. if (disabled.value)
  41138. return;
  41139. setPosition(0);
  41140. emitChange();
  41141. };
  41142. const onEndKeyDown = () => {
  41143. if (disabled.value)
  41144. return;
  41145. setPosition(100);
  41146. emitChange();
  41147. };
  41148. const onKeyDown = (event) => {
  41149. let isPreventDefault = true;
  41150. switch (event.code) {
  41151. case EVENT_CODE.left:
  41152. case EVENT_CODE.down:
  41153. onLeftKeyDown();
  41154. break;
  41155. case EVENT_CODE.right:
  41156. case EVENT_CODE.up:
  41157. onRightKeyDown();
  41158. break;
  41159. case EVENT_CODE.home:
  41160. onHomeKeyDown();
  41161. break;
  41162. case EVENT_CODE.end:
  41163. onEndKeyDown();
  41164. break;
  41165. case EVENT_CODE.pageDown:
  41166. onPageDownKeyDown();
  41167. break;
  41168. case EVENT_CODE.pageUp:
  41169. onPageUpKeyDown();
  41170. break;
  41171. default:
  41172. isPreventDefault = false;
  41173. break;
  41174. }
  41175. isPreventDefault && event.preventDefault();
  41176. };
  41177. const getClientXY = (event) => {
  41178. let clientX;
  41179. let clientY;
  41180. if (event.type.startsWith("touch")) {
  41181. clientY = event.touches[0].clientY;
  41182. clientX = event.touches[0].clientX;
  41183. } else {
  41184. clientY = event.clientY;
  41185. clientX = event.clientX;
  41186. }
  41187. return {
  41188. clientX,
  41189. clientY
  41190. };
  41191. };
  41192. const onDragStart = (event) => {
  41193. initData.dragging = true;
  41194. initData.isClick = true;
  41195. const { clientX, clientY } = getClientXY(event);
  41196. if (props.vertical) {
  41197. initData.startY = clientY;
  41198. } else {
  41199. initData.startX = clientX;
  41200. }
  41201. initData.startPosition = Number.parseFloat(currentPosition.value);
  41202. initData.newPosition = initData.startPosition;
  41203. };
  41204. const onDragging = (event) => {
  41205. if (initData.dragging) {
  41206. initData.isClick = false;
  41207. displayTooltip();
  41208. resetSize();
  41209. let diff;
  41210. const { clientX, clientY } = getClientXY(event);
  41211. if (props.vertical) {
  41212. initData.currentY = clientY;
  41213. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  41214. } else {
  41215. initData.currentX = clientX;
  41216. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  41217. }
  41218. initData.newPosition = initData.startPosition + diff;
  41219. setPosition(initData.newPosition);
  41220. }
  41221. };
  41222. const onDragEnd = () => {
  41223. if (initData.dragging) {
  41224. setTimeout(() => {
  41225. initData.dragging = false;
  41226. if (!initData.hovering) {
  41227. hideTooltip();
  41228. }
  41229. if (!initData.isClick) {
  41230. setPosition(initData.newPosition);
  41231. }
  41232. emitChange();
  41233. }, 0);
  41234. window.removeEventListener("mousemove", onDragging);
  41235. window.removeEventListener("touchmove", onDragging);
  41236. window.removeEventListener("mouseup", onDragEnd);
  41237. window.removeEventListener("touchend", onDragEnd);
  41238. window.removeEventListener("contextmenu", onDragEnd);
  41239. }
  41240. };
  41241. const setPosition = async (newPosition) => {
  41242. if (newPosition === null || Number.isNaN(+newPosition))
  41243. return;
  41244. if (newPosition < 0) {
  41245. newPosition = 0;
  41246. } else if (newPosition > 100) {
  41247. newPosition = 100;
  41248. }
  41249. const lengthPerStep = 100 / ((max.value - min.value) / step.value);
  41250. const steps = Math.round(newPosition / lengthPerStep);
  41251. let value = steps * lengthPerStep * (max.value - min.value) * 0.01 + min.value;
  41252. value = Number.parseFloat(value.toFixed(precision.value));
  41253. if (value !== props.modelValue) {
  41254. emit(UPDATE_MODEL_EVENT, value);
  41255. }
  41256. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  41257. initData.oldValue = props.modelValue;
  41258. }
  41259. await nextTick();
  41260. initData.dragging && displayTooltip();
  41261. tooltip.value.updatePopper();
  41262. };
  41263. watch(() => initData.dragging, (val) => {
  41264. updateDragging(val);
  41265. });
  41266. useEventListener(button, "touchstart", onButtonDown, { passive: false });
  41267. return {
  41268. disabled,
  41269. button,
  41270. tooltip,
  41271. tooltipVisible,
  41272. showTooltip,
  41273. wrapperStyle,
  41274. formatValue,
  41275. handleMouseEnter,
  41276. handleMouseLeave,
  41277. onButtonDown,
  41278. onKeyDown,
  41279. setPosition
  41280. };
  41281. };
  41282. const useStops = (props, initData, minValue, maxValue) => {
  41283. const stops = computed(() => {
  41284. if (!props.showStops || props.min > props.max)
  41285. return [];
  41286. if (props.step === 0) {
  41287. return [];
  41288. }
  41289. const stopCount = (props.max - props.min) / props.step;
  41290. const stepWidth = 100 * props.step / (props.max - props.min);
  41291. const result = Array.from({ length: stopCount - 1 }).map((_, index) => (index + 1) * stepWidth);
  41292. if (props.range) {
  41293. return result.filter((step) => {
  41294. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  41295. });
  41296. } else {
  41297. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  41298. }
  41299. });
  41300. const getStopStyle = (position) => {
  41301. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  41302. };
  41303. return {
  41304. stops,
  41305. getStopStyle
  41306. };
  41307. };
  41308. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem) => {
  41309. const _emit = (val) => {
  41310. emit(UPDATE_MODEL_EVENT, val);
  41311. emit(INPUT_EVENT, val);
  41312. };
  41313. const valueChanged = () => {
  41314. if (props.range) {
  41315. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  41316. } else {
  41317. return props.modelValue !== initData.oldValue;
  41318. }
  41319. };
  41320. const setValues = () => {
  41321. var _a, _b;
  41322. if (props.min > props.max) {
  41323. throwError("Slider", "min should not be greater than max.");
  41324. }
  41325. const val = props.modelValue;
  41326. if (props.range && isArray$1(val)) {
  41327. if (val[1] < props.min) {
  41328. _emit([props.min, props.min]);
  41329. } else if (val[0] > props.max) {
  41330. _emit([props.max, props.max]);
  41331. } else if (val[0] < props.min) {
  41332. _emit([props.min, val[1]]);
  41333. } else if (val[1] > props.max) {
  41334. _emit([val[0], props.max]);
  41335. } else {
  41336. initData.firstValue = val[0];
  41337. initData.secondValue = val[1];
  41338. if (valueChanged()) {
  41339. if (props.validateEvent) {
  41340. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  41341. }
  41342. initData.oldValue = val.slice();
  41343. }
  41344. }
  41345. } else if (!props.range && isNumber(val) && !Number.isNaN(val)) {
  41346. if (val < props.min) {
  41347. _emit(props.min);
  41348. } else if (val > props.max) {
  41349. _emit(props.max);
  41350. } else {
  41351. initData.firstValue = val;
  41352. if (valueChanged()) {
  41353. if (props.validateEvent) {
  41354. (_b = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _b.call(elFormItem, "change").catch((err) => debugWarn());
  41355. }
  41356. initData.oldValue = val;
  41357. }
  41358. }
  41359. }
  41360. };
  41361. setValues();
  41362. watch(() => initData.dragging, (val) => {
  41363. if (!val) {
  41364. setValues();
  41365. }
  41366. });
  41367. watch(() => props.modelValue, (val, oldVal) => {
  41368. if (initData.dragging || isArray$1(val) && isArray$1(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  41369. return;
  41370. }
  41371. setValues();
  41372. }, {
  41373. deep: true
  41374. });
  41375. watch(() => [props.min, props.max], () => {
  41376. setValues();
  41377. });
  41378. };
  41379. const sliderButtonProps = buildProps({
  41380. modelValue: {
  41381. type: Number,
  41382. default: 0
  41383. },
  41384. vertical: Boolean,
  41385. tooltipClass: String,
  41386. placement: {
  41387. type: String,
  41388. values: Ee,
  41389. default: "top"
  41390. }
  41391. });
  41392. const sliderButtonEmits = {
  41393. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  41394. };
  41395. const __default__$C = defineComponent({
  41396. name: "ElSliderButton"
  41397. });
  41398. const _sfc_main$J = /* @__PURE__ */ defineComponent({
  41399. ...__default__$C,
  41400. props: sliderButtonProps,
  41401. emits: sliderButtonEmits,
  41402. setup(__props, { expose, emit }) {
  41403. const props = __props;
  41404. const ns = useNamespace("slider");
  41405. const initData = reactive({
  41406. hovering: false,
  41407. dragging: false,
  41408. isClick: false,
  41409. startX: 0,
  41410. currentX: 0,
  41411. startY: 0,
  41412. currentY: 0,
  41413. startPosition: 0,
  41414. newPosition: 0,
  41415. oldValue: props.modelValue
  41416. });
  41417. const {
  41418. disabled,
  41419. button,
  41420. tooltip,
  41421. showTooltip,
  41422. tooltipVisible,
  41423. wrapperStyle,
  41424. formatValue,
  41425. handleMouseEnter,
  41426. handleMouseLeave,
  41427. onButtonDown,
  41428. onKeyDown,
  41429. setPosition
  41430. } = useSliderButton(props, initData, emit);
  41431. const { hovering, dragging } = toRefs(initData);
  41432. expose({
  41433. onButtonDown,
  41434. onKeyDown,
  41435. setPosition,
  41436. hovering,
  41437. dragging
  41438. });
  41439. return (_ctx, _cache) => {
  41440. return openBlock(), createElementBlock("div", {
  41441. ref_key: "button",
  41442. ref: button,
  41443. class: normalizeClass([unref(ns).e("button-wrapper"), { hover: unref(hovering), dragging: unref(dragging) }]),
  41444. style: normalizeStyle(unref(wrapperStyle)),
  41445. tabindex: unref(disabled) ? -1 : 0,
  41446. onMouseenter: unref(handleMouseEnter),
  41447. onMouseleave: unref(handleMouseLeave),
  41448. onMousedown: unref(onButtonDown),
  41449. onFocus: unref(handleMouseEnter),
  41450. onBlur: unref(handleMouseLeave),
  41451. onKeydown: unref(onKeyDown)
  41452. }, [
  41453. createVNode(unref(ElTooltip), {
  41454. ref_key: "tooltip",
  41455. ref: tooltip,
  41456. visible: unref(tooltipVisible),
  41457. placement: _ctx.placement,
  41458. "fallback-placements": ["top", "bottom", "right", "left"],
  41459. "stop-popper-mouse-event": false,
  41460. "popper-class": _ctx.tooltipClass,
  41461. disabled: !unref(showTooltip),
  41462. persistent: unref(showTooltip)
  41463. }, {
  41464. content: withCtx(() => [
  41465. createElementVNode("span", null, toDisplayString(unref(formatValue)), 1)
  41466. ]),
  41467. default: withCtx(() => [
  41468. createElementVNode("div", {
  41469. class: normalizeClass([unref(ns).e("button"), { hover: unref(hovering), dragging: unref(dragging) }])
  41470. }, null, 2)
  41471. ]),
  41472. _: 1
  41473. }, 8, ["visible", "placement", "popper-class", "disabled", "persistent"])
  41474. ], 46, ["tabindex", "onMouseenter", "onMouseleave", "onMousedown", "onFocus", "onBlur", "onKeydown"]);
  41475. };
  41476. }
  41477. });
  41478. var SliderButton = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__file", "button.vue"]]);
  41479. const sliderMarkerProps = buildProps({
  41480. mark: {
  41481. type: definePropType([String, Object]),
  41482. default: void 0
  41483. }
  41484. });
  41485. var SliderMarker = defineComponent({
  41486. name: "ElSliderMarker",
  41487. props: sliderMarkerProps,
  41488. setup(props) {
  41489. const ns = useNamespace("slider");
  41490. const label = computed(() => {
  41491. return isString$1(props.mark) ? props.mark : props.mark.label;
  41492. });
  41493. const style = computed(() => isString$1(props.mark) ? void 0 : props.mark.style);
  41494. return () => h$1("div", {
  41495. class: ns.e("marks-text"),
  41496. style: style.value
  41497. }, label.value);
  41498. }
  41499. });
  41500. const __default__$B = defineComponent({
  41501. name: "ElSlider"
  41502. });
  41503. const _sfc_main$I = /* @__PURE__ */ defineComponent({
  41504. ...__default__$B,
  41505. props: sliderProps,
  41506. emits: sliderEmits,
  41507. setup(__props, { expose, emit }) {
  41508. const props = __props;
  41509. const ns = useNamespace("slider");
  41510. const { t } = useLocale();
  41511. const initData = reactive({
  41512. firstValue: 0,
  41513. secondValue: 0,
  41514. oldValue: 0,
  41515. dragging: false,
  41516. sliderSize: 1
  41517. });
  41518. const {
  41519. elFormItem,
  41520. slider,
  41521. firstButton,
  41522. secondButton,
  41523. sliderDisabled,
  41524. minValue,
  41525. maxValue,
  41526. runwayStyle,
  41527. barStyle,
  41528. resetSize,
  41529. emitChange,
  41530. onSliderWrapperPrevent,
  41531. onSliderClick,
  41532. onSliderDown,
  41533. onSliderMarkerDown,
  41534. setFirstValue,
  41535. setSecondValue
  41536. } = useSlide(props, initData, emit);
  41537. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  41538. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  41539. formItemContext: elFormItem
  41540. });
  41541. const sliderWrapperSize = useFormSize();
  41542. const sliderInputSize = computed(() => props.inputSize || sliderWrapperSize.value);
  41543. const groupLabel = computed(() => {
  41544. return props.ariaLabel || t("el.slider.defaultLabel", {
  41545. min: props.min,
  41546. max: props.max
  41547. });
  41548. });
  41549. const firstButtonLabel = computed(() => {
  41550. if (props.range) {
  41551. return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel");
  41552. } else {
  41553. return groupLabel.value;
  41554. }
  41555. });
  41556. const firstValueText = computed(() => {
  41557. return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`;
  41558. });
  41559. const secondButtonLabel = computed(() => {
  41560. return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel");
  41561. });
  41562. const secondValueText = computed(() => {
  41563. return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`;
  41564. });
  41565. const sliderKls = computed(() => [
  41566. ns.b(),
  41567. ns.m(sliderWrapperSize.value),
  41568. ns.is("vertical", props.vertical),
  41569. { [ns.m("with-input")]: props.showInput }
  41570. ]);
  41571. const markList = useMarks(props);
  41572. useWatch(props, initData, minValue, maxValue, emit, elFormItem);
  41573. const precision = computed(() => {
  41574. const precisions = [props.min, props.max, props.step].map((item) => {
  41575. const decimal = `${item}`.split(".")[1];
  41576. return decimal ? decimal.length : 0;
  41577. });
  41578. return Math.max.apply(null, precisions);
  41579. });
  41580. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  41581. const { firstValue, secondValue, sliderSize } = toRefs(initData);
  41582. const updateDragging = (val) => {
  41583. initData.dragging = val;
  41584. };
  41585. useEventListener(sliderWrapper, "touchstart", onSliderWrapperPrevent, {
  41586. passive: false
  41587. });
  41588. useEventListener(sliderWrapper, "touchmove", onSliderWrapperPrevent, {
  41589. passive: false
  41590. });
  41591. provide(sliderContextKey, {
  41592. ...toRefs(props),
  41593. sliderSize,
  41594. disabled: sliderDisabled,
  41595. precision,
  41596. emitChange,
  41597. resetSize,
  41598. updateDragging
  41599. });
  41600. expose({
  41601. onSliderClick
  41602. });
  41603. return (_ctx, _cache) => {
  41604. var _a, _b;
  41605. return openBlock(), createElementBlock("div", {
  41606. id: _ctx.range ? unref(inputId) : void 0,
  41607. ref_key: "sliderWrapper",
  41608. ref: sliderWrapper,
  41609. class: normalizeClass(unref(sliderKls)),
  41610. role: _ctx.range ? "group" : void 0,
  41611. "aria-label": _ctx.range && !unref(isLabeledByFormItem) ? unref(groupLabel) : void 0,
  41612. "aria-labelledby": _ctx.range && unref(isLabeledByFormItem) ? (_a = unref(elFormItem)) == null ? void 0 : _a.labelId : void 0
  41613. }, [
  41614. createElementVNode("div", {
  41615. ref_key: "slider",
  41616. ref: slider,
  41617. class: normalizeClass([
  41618. unref(ns).e("runway"),
  41619. { "show-input": _ctx.showInput && !_ctx.range },
  41620. unref(ns).is("disabled", unref(sliderDisabled))
  41621. ]),
  41622. style: normalizeStyle(unref(runwayStyle)),
  41623. onMousedown: unref(onSliderDown),
  41624. onTouchstartPassive: unref(onSliderDown)
  41625. }, [
  41626. createElementVNode("div", {
  41627. class: normalizeClass(unref(ns).e("bar")),
  41628. style: normalizeStyle(unref(barStyle))
  41629. }, null, 6),
  41630. createVNode(SliderButton, {
  41631. id: !_ctx.range ? unref(inputId) : void 0,
  41632. ref_key: "firstButton",
  41633. ref: firstButton,
  41634. "model-value": unref(firstValue),
  41635. vertical: _ctx.vertical,
  41636. "tooltip-class": _ctx.tooltipClass,
  41637. placement: _ctx.placement,
  41638. role: "slider",
  41639. "aria-label": _ctx.range || !unref(isLabeledByFormItem) ? unref(firstButtonLabel) : void 0,
  41640. "aria-labelledby": !_ctx.range && unref(isLabeledByFormItem) ? (_b = unref(elFormItem)) == null ? void 0 : _b.labelId : void 0,
  41641. "aria-valuemin": _ctx.min,
  41642. "aria-valuemax": _ctx.range ? unref(secondValue) : _ctx.max,
  41643. "aria-valuenow": unref(firstValue),
  41644. "aria-valuetext": unref(firstValueText),
  41645. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  41646. "aria-disabled": unref(sliderDisabled),
  41647. "onUpdate:modelValue": unref(setFirstValue)
  41648. }, 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"]),
  41649. _ctx.range ? (openBlock(), createBlock(SliderButton, {
  41650. key: 0,
  41651. ref_key: "secondButton",
  41652. ref: secondButton,
  41653. "model-value": unref(secondValue),
  41654. vertical: _ctx.vertical,
  41655. "tooltip-class": _ctx.tooltipClass,
  41656. placement: _ctx.placement,
  41657. role: "slider",
  41658. "aria-label": unref(secondButtonLabel),
  41659. "aria-valuemin": unref(firstValue),
  41660. "aria-valuemax": _ctx.max,
  41661. "aria-valuenow": unref(secondValue),
  41662. "aria-valuetext": unref(secondValueText),
  41663. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  41664. "aria-disabled": unref(sliderDisabled),
  41665. "onUpdate:modelValue": unref(setSecondValue)
  41666. }, 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),
  41667. _ctx.showStops ? (openBlock(), createElementBlock("div", { key: 1 }, [
  41668. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(stops), (item, key) => {
  41669. return openBlock(), createElementBlock("div", {
  41670. key,
  41671. class: normalizeClass(unref(ns).e("stop")),
  41672. style: normalizeStyle(unref(getStopStyle)(item))
  41673. }, null, 6);
  41674. }), 128))
  41675. ])) : createCommentVNode("v-if", true),
  41676. unref(markList).length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
  41677. createElementVNode("div", null, [
  41678. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(markList), (item, key) => {
  41679. return openBlock(), createElementBlock("div", {
  41680. key,
  41681. style: normalizeStyle(unref(getStopStyle)(item.position)),
  41682. class: normalizeClass([unref(ns).e("stop"), unref(ns).e("marks-stop")])
  41683. }, null, 6);
  41684. }), 128))
  41685. ]),
  41686. createElementVNode("div", {
  41687. class: normalizeClass(unref(ns).e("marks"))
  41688. }, [
  41689. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(markList), (item, key) => {
  41690. return openBlock(), createBlock(unref(SliderMarker), {
  41691. key,
  41692. mark: item.mark,
  41693. style: normalizeStyle(unref(getStopStyle)(item.position)),
  41694. onMousedown: withModifiers(($event) => unref(onSliderMarkerDown)(item.position), ["stop"])
  41695. }, null, 8, ["mark", "style", "onMousedown"]);
  41696. }), 128))
  41697. ], 2)
  41698. ], 64)) : createCommentVNode("v-if", true)
  41699. ], 46, ["onMousedown", "onTouchstartPassive"]),
  41700. _ctx.showInput && !_ctx.range ? (openBlock(), createBlock(unref(ElInputNumber), {
  41701. key: 0,
  41702. ref: "input",
  41703. "model-value": unref(firstValue),
  41704. class: normalizeClass(unref(ns).e("input")),
  41705. step: _ctx.step,
  41706. disabled: unref(sliderDisabled),
  41707. controls: _ctx.showInputControls,
  41708. min: _ctx.min,
  41709. max: _ctx.max,
  41710. precision: unref(precision),
  41711. debounce: _ctx.debounce,
  41712. size: unref(sliderInputSize),
  41713. "onUpdate:modelValue": unref(setFirstValue),
  41714. onChange: unref(emitChange)
  41715. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "precision", "debounce", "size", "onUpdate:modelValue", "onChange"])) : createCommentVNode("v-if", true)
  41716. ], 10, ["id", "role", "aria-label", "aria-labelledby"]);
  41717. };
  41718. }
  41719. });
  41720. var Slider = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__file", "slider.vue"]]);
  41721. const ElSlider = withInstall(Slider);
  41722. const spaceItemProps = buildProps({
  41723. prefixCls: {
  41724. type: String
  41725. }
  41726. });
  41727. const SpaceItem = defineComponent({
  41728. name: "ElSpaceItem",
  41729. props: spaceItemProps,
  41730. setup(props, { slots }) {
  41731. const ns = useNamespace("space");
  41732. const classes = computed(() => `${props.prefixCls || ns.b()}__item`);
  41733. return () => h$1("div", { class: classes.value }, renderSlot(slots, "default"));
  41734. }
  41735. });
  41736. const SIZE_MAP = {
  41737. small: 8,
  41738. default: 12,
  41739. large: 16
  41740. };
  41741. function useSpace(props) {
  41742. const ns = useNamespace("space");
  41743. const classes = computed(() => [ns.b(), ns.m(props.direction), props.class]);
  41744. const horizontalSize = ref(0);
  41745. const verticalSize = ref(0);
  41746. const containerStyle = computed(() => {
  41747. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap" } : {};
  41748. const alignment = {
  41749. alignItems: props.alignment
  41750. };
  41751. const gap = {
  41752. rowGap: `${verticalSize.value}px`,
  41753. columnGap: `${horizontalSize.value}px`
  41754. };
  41755. return [wrapKls, alignment, gap, props.style];
  41756. });
  41757. const itemStyle = computed(() => {
  41758. return props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  41759. });
  41760. watchEffect(() => {
  41761. const { size = "small", wrap, direction: dir, fill } = props;
  41762. if (isArray$1(size)) {
  41763. const [h = 0, v = 0] = size;
  41764. horizontalSize.value = h;
  41765. verticalSize.value = v;
  41766. } else {
  41767. let val;
  41768. if (isNumber(size)) {
  41769. val = size;
  41770. } else {
  41771. val = SIZE_MAP[size || "small"] || SIZE_MAP.small;
  41772. }
  41773. if ((wrap || fill) && dir === "horizontal") {
  41774. horizontalSize.value = verticalSize.value = val;
  41775. } else {
  41776. if (dir === "horizontal") {
  41777. horizontalSize.value = val;
  41778. verticalSize.value = 0;
  41779. } else {
  41780. verticalSize.value = val;
  41781. horizontalSize.value = 0;
  41782. }
  41783. }
  41784. }
  41785. });
  41786. return {
  41787. classes,
  41788. containerStyle,
  41789. itemStyle
  41790. };
  41791. }
  41792. const spaceProps = buildProps({
  41793. direction: {
  41794. type: String,
  41795. values: ["horizontal", "vertical"],
  41796. default: "horizontal"
  41797. },
  41798. class: {
  41799. type: definePropType([
  41800. String,
  41801. Object,
  41802. Array
  41803. ]),
  41804. default: ""
  41805. },
  41806. style: {
  41807. type: definePropType([String, Array, Object]),
  41808. default: ""
  41809. },
  41810. alignment: {
  41811. type: definePropType(String),
  41812. default: "center"
  41813. },
  41814. prefixCls: {
  41815. type: String
  41816. },
  41817. spacer: {
  41818. type: definePropType([Object, String, Number, Array]),
  41819. default: null,
  41820. validator: (val) => isVNode(val) || isNumber(val) || isString$1(val)
  41821. },
  41822. wrap: Boolean,
  41823. fill: Boolean,
  41824. fillRatio: {
  41825. type: Number,
  41826. default: 100
  41827. },
  41828. size: {
  41829. type: [String, Array, Number],
  41830. values: componentSizes,
  41831. validator: (val) => {
  41832. return isNumber(val) || isArray$1(val) && val.length === 2 && val.every(isNumber);
  41833. }
  41834. }
  41835. });
  41836. const Space = defineComponent({
  41837. name: "ElSpace",
  41838. props: spaceProps,
  41839. setup(props, { slots }) {
  41840. const { classes, containerStyle, itemStyle } = useSpace(props);
  41841. function extractChildren(children, parentKey = "", extractedChildren = []) {
  41842. const { prefixCls } = props;
  41843. children.forEach((child, loopKey) => {
  41844. if (isFragment(child)) {
  41845. if (isArray$1(child.children)) {
  41846. child.children.forEach((nested, key) => {
  41847. if (isFragment(nested) && isArray$1(nested.children)) {
  41848. extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
  41849. } else {
  41850. extractedChildren.push(createVNode(SpaceItem, {
  41851. style: itemStyle.value,
  41852. prefixCls,
  41853. key: `nested-${parentKey + key}`
  41854. }, {
  41855. default: () => [nested]
  41856. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  41857. }
  41858. });
  41859. }
  41860. } else if (isValidElementNode(child)) {
  41861. extractedChildren.push(createVNode(SpaceItem, {
  41862. style: itemStyle.value,
  41863. prefixCls,
  41864. key: `LoopKey${parentKey + loopKey}`
  41865. }, {
  41866. default: () => [child]
  41867. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  41868. }
  41869. });
  41870. return extractedChildren;
  41871. }
  41872. return () => {
  41873. var _a;
  41874. const { spacer, direction } = props;
  41875. const children = renderSlot(slots, "default", { key: 0 }, () => []);
  41876. if (((_a = children.children) != null ? _a : []).length === 0)
  41877. return null;
  41878. if (isArray$1(children.children)) {
  41879. let extractedChildren = extractChildren(children.children);
  41880. if (spacer) {
  41881. const len = extractedChildren.length - 1;
  41882. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  41883. const children2 = [...acc, child];
  41884. if (idx !== len) {
  41885. children2.push(createVNode("span", {
  41886. style: [
  41887. itemStyle.value,
  41888. direction === "vertical" ? "width: 100%" : null
  41889. ],
  41890. key: idx
  41891. }, [
  41892. isVNode(spacer) ? spacer : createTextVNode(spacer, PatchFlags.TEXT)
  41893. ], PatchFlags.STYLE));
  41894. }
  41895. return children2;
  41896. }, []);
  41897. }
  41898. return createVNode("div", {
  41899. class: classes.value,
  41900. style: containerStyle.value
  41901. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  41902. }
  41903. return children.children;
  41904. };
  41905. }
  41906. });
  41907. const ElSpace = withInstall(Space);
  41908. const statisticProps = buildProps({
  41909. decimalSeparator: {
  41910. type: String,
  41911. default: "."
  41912. },
  41913. groupSeparator: {
  41914. type: String,
  41915. default: ","
  41916. },
  41917. precision: {
  41918. type: Number,
  41919. default: 0
  41920. },
  41921. formatter: Function,
  41922. value: {
  41923. type: definePropType([Number, Object]),
  41924. default: 0
  41925. },
  41926. prefix: String,
  41927. suffix: String,
  41928. title: String,
  41929. valueStyle: {
  41930. type: definePropType([String, Object, Array])
  41931. }
  41932. });
  41933. const __default__$A = defineComponent({
  41934. name: "ElStatistic"
  41935. });
  41936. const _sfc_main$H = /* @__PURE__ */ defineComponent({
  41937. ...__default__$A,
  41938. props: statisticProps,
  41939. setup(__props, { expose }) {
  41940. const props = __props;
  41941. const ns = useNamespace("statistic");
  41942. const displayValue = computed(() => {
  41943. const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
  41944. if (isFunction$1(formatter))
  41945. return formatter(value);
  41946. if (!isNumber(value) || Number.isNaN(value))
  41947. return value;
  41948. let [integer, decimal = ""] = String(value).split(".");
  41949. decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
  41950. integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
  41951. return [integer, decimal].join(decimal ? decimalSeparator : "");
  41952. });
  41953. expose({
  41954. displayValue
  41955. });
  41956. return (_ctx, _cache) => {
  41957. return openBlock(), createElementBlock("div", {
  41958. class: normalizeClass(unref(ns).b())
  41959. }, [
  41960. _ctx.$slots.title || _ctx.title ? (openBlock(), createElementBlock("div", {
  41961. key: 0,
  41962. class: normalizeClass(unref(ns).e("head"))
  41963. }, [
  41964. renderSlot(_ctx.$slots, "title", {}, () => [
  41965. createTextVNode(toDisplayString(_ctx.title), 1)
  41966. ])
  41967. ], 2)) : createCommentVNode("v-if", true),
  41968. createElementVNode("div", {
  41969. class: normalizeClass(unref(ns).e("content"))
  41970. }, [
  41971. _ctx.$slots.prefix || _ctx.prefix ? (openBlock(), createElementBlock("div", {
  41972. key: 0,
  41973. class: normalizeClass(unref(ns).e("prefix"))
  41974. }, [
  41975. renderSlot(_ctx.$slots, "prefix", {}, () => [
  41976. createElementVNode("span", null, toDisplayString(_ctx.prefix), 1)
  41977. ])
  41978. ], 2)) : createCommentVNode("v-if", true),
  41979. createElementVNode("span", {
  41980. class: normalizeClass(unref(ns).e("number")),
  41981. style: normalizeStyle(_ctx.valueStyle)
  41982. }, toDisplayString(unref(displayValue)), 7),
  41983. _ctx.$slots.suffix || _ctx.suffix ? (openBlock(), createElementBlock("div", {
  41984. key: 1,
  41985. class: normalizeClass(unref(ns).e("suffix"))
  41986. }, [
  41987. renderSlot(_ctx.$slots, "suffix", {}, () => [
  41988. createElementVNode("span", null, toDisplayString(_ctx.suffix), 1)
  41989. ])
  41990. ], 2)) : createCommentVNode("v-if", true)
  41991. ], 2)
  41992. ], 2);
  41993. };
  41994. }
  41995. });
  41996. var Statistic = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__file", "statistic.vue"]]);
  41997. const ElStatistic = withInstall(Statistic);
  41998. const countdownProps = buildProps({
  41999. format: {
  42000. type: String,
  42001. default: "HH:mm:ss"
  42002. },
  42003. prefix: String,
  42004. suffix: String,
  42005. title: String,
  42006. value: {
  42007. type: definePropType([Number, Object]),
  42008. default: 0
  42009. },
  42010. valueStyle: {
  42011. type: definePropType([String, Object, Array])
  42012. }
  42013. });
  42014. const countdownEmits = {
  42015. finish: () => true,
  42016. [CHANGE_EVENT]: (value) => isNumber(value)
  42017. };
  42018. const timeUnits = [
  42019. ["Y", 1e3 * 60 * 60 * 24 * 365],
  42020. ["M", 1e3 * 60 * 60 * 24 * 30],
  42021. ["D", 1e3 * 60 * 60 * 24],
  42022. ["H", 1e3 * 60 * 60],
  42023. ["m", 1e3 * 60],
  42024. ["s", 1e3],
  42025. ["S", 1]
  42026. ];
  42027. const getTime = (value) => {
  42028. return isNumber(value) ? new Date(value).getTime() : value.valueOf();
  42029. };
  42030. const formatTime$1 = (timestamp, format) => {
  42031. let timeLeft = timestamp;
  42032. const escapeRegex = /\[([^\]]*)]/g;
  42033. const replacedText = timeUnits.reduce((current, [name, unit]) => {
  42034. const replaceRegex = new RegExp(`${name}+(?![^\\[\\]]*\\])`, "g");
  42035. if (replaceRegex.test(current)) {
  42036. const value = Math.floor(timeLeft / unit);
  42037. timeLeft -= value * unit;
  42038. return current.replace(replaceRegex, (match) => String(value).padStart(match.length, "0"));
  42039. }
  42040. return current;
  42041. }, format);
  42042. return replacedText.replace(escapeRegex, "$1");
  42043. };
  42044. const __default__$z = defineComponent({
  42045. name: "ElCountdown"
  42046. });
  42047. const _sfc_main$G = /* @__PURE__ */ defineComponent({
  42048. ...__default__$z,
  42049. props: countdownProps,
  42050. emits: countdownEmits,
  42051. setup(__props, { expose, emit }) {
  42052. const props = __props;
  42053. let timer;
  42054. const rawValue = ref(0);
  42055. const displayValue = computed(() => formatTime$1(rawValue.value, props.format));
  42056. const formatter = (val) => formatTime$1(val, props.format);
  42057. const stopTimer = () => {
  42058. if (timer) {
  42059. cAF(timer);
  42060. timer = void 0;
  42061. }
  42062. };
  42063. const startTimer = () => {
  42064. const timestamp = getTime(props.value);
  42065. const frameFunc = () => {
  42066. let diff = timestamp - Date.now();
  42067. emit("change", diff);
  42068. if (diff <= 0) {
  42069. diff = 0;
  42070. stopTimer();
  42071. emit("finish");
  42072. } else {
  42073. timer = rAF(frameFunc);
  42074. }
  42075. rawValue.value = diff;
  42076. };
  42077. timer = rAF(frameFunc);
  42078. };
  42079. onMounted(() => {
  42080. rawValue.value = getTime(props.value) - Date.now();
  42081. watch(() => [props.value, props.format], () => {
  42082. stopTimer();
  42083. startTimer();
  42084. }, {
  42085. immediate: true
  42086. });
  42087. });
  42088. onBeforeUnmount(() => {
  42089. stopTimer();
  42090. });
  42091. expose({
  42092. displayValue
  42093. });
  42094. return (_ctx, _cache) => {
  42095. return openBlock(), createBlock(unref(ElStatistic), {
  42096. value: rawValue.value,
  42097. title: _ctx.title,
  42098. prefix: _ctx.prefix,
  42099. suffix: _ctx.suffix,
  42100. "value-style": _ctx.valueStyle,
  42101. formatter
  42102. }, createSlots({
  42103. _: 2
  42104. }, [
  42105. renderList(_ctx.$slots, (_, name) => {
  42106. return {
  42107. name,
  42108. fn: withCtx(() => [
  42109. renderSlot(_ctx.$slots, name)
  42110. ])
  42111. };
  42112. })
  42113. ]), 1032, ["value", "title", "prefix", "suffix", "value-style"]);
  42114. };
  42115. }
  42116. });
  42117. var Countdown = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__file", "countdown.vue"]]);
  42118. const ElCountdown = withInstall(Countdown);
  42119. const stepsProps = buildProps({
  42120. space: {
  42121. type: [Number, String],
  42122. default: ""
  42123. },
  42124. active: {
  42125. type: Number,
  42126. default: 0
  42127. },
  42128. direction: {
  42129. type: String,
  42130. default: "horizontal",
  42131. values: ["horizontal", "vertical"]
  42132. },
  42133. alignCenter: {
  42134. type: Boolean
  42135. },
  42136. simple: {
  42137. type: Boolean
  42138. },
  42139. finishStatus: {
  42140. type: String,
  42141. values: ["wait", "process", "finish", "error", "success"],
  42142. default: "finish"
  42143. },
  42144. processStatus: {
  42145. type: String,
  42146. values: ["wait", "process", "finish", "error", "success"],
  42147. default: "process"
  42148. }
  42149. });
  42150. const stepsEmits = {
  42151. [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber)
  42152. };
  42153. const __default__$y = defineComponent({
  42154. name: "ElSteps"
  42155. });
  42156. const _sfc_main$F = /* @__PURE__ */ defineComponent({
  42157. ...__default__$y,
  42158. props: stepsProps,
  42159. emits: stepsEmits,
  42160. setup(__props, { emit }) {
  42161. const props = __props;
  42162. const ns = useNamespace("steps");
  42163. const {
  42164. children: steps,
  42165. addChild: addStep,
  42166. removeChild: removeStep
  42167. } = useOrderedChildren(getCurrentInstance(), "ElStep");
  42168. watch(steps, () => {
  42169. steps.value.forEach((instance, index) => {
  42170. instance.setIndex(index);
  42171. });
  42172. });
  42173. provide("ElSteps", { props, steps, addStep, removeStep });
  42174. watch(() => props.active, (newVal, oldVal) => {
  42175. emit(CHANGE_EVENT, newVal, oldVal);
  42176. });
  42177. return (_ctx, _cache) => {
  42178. return openBlock(), createElementBlock("div", {
  42179. class: normalizeClass([unref(ns).b(), unref(ns).m(_ctx.simple ? "simple" : _ctx.direction)])
  42180. }, [
  42181. renderSlot(_ctx.$slots, "default")
  42182. ], 2);
  42183. };
  42184. }
  42185. });
  42186. var Steps = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__file", "steps.vue"]]);
  42187. const stepProps = buildProps({
  42188. title: {
  42189. type: String,
  42190. default: ""
  42191. },
  42192. icon: {
  42193. type: iconPropType
  42194. },
  42195. description: {
  42196. type: String,
  42197. default: ""
  42198. },
  42199. status: {
  42200. type: String,
  42201. values: ["", "wait", "process", "finish", "error", "success"],
  42202. default: ""
  42203. }
  42204. });
  42205. const __default__$x = defineComponent({
  42206. name: "ElStep"
  42207. });
  42208. const _sfc_main$E = defineComponent({
  42209. ...__default__$x,
  42210. props: stepProps,
  42211. setup(__props) {
  42212. const props = __props;
  42213. const ns = useNamespace("step");
  42214. const index = ref(-1);
  42215. const lineStyle = ref({});
  42216. const internalStatus = ref("");
  42217. const parent = inject("ElSteps");
  42218. const currentInstance = getCurrentInstance();
  42219. onMounted(() => {
  42220. watch([
  42221. () => parent.props.active,
  42222. () => parent.props.processStatus,
  42223. () => parent.props.finishStatus
  42224. ], ([active]) => {
  42225. updateStatus(active);
  42226. }, { immediate: true });
  42227. });
  42228. onBeforeUnmount(() => {
  42229. parent.removeStep(stepItemState.uid);
  42230. });
  42231. const currentStatus = computed(() => {
  42232. return props.status || internalStatus.value;
  42233. });
  42234. const prevStatus = computed(() => {
  42235. const prevStep = parent.steps.value[index.value - 1];
  42236. return prevStep ? prevStep.currentStatus : "wait";
  42237. });
  42238. const isCenter = computed(() => {
  42239. return parent.props.alignCenter;
  42240. });
  42241. const isVertical = computed(() => {
  42242. return parent.props.direction === "vertical";
  42243. });
  42244. const isSimple = computed(() => {
  42245. return parent.props.simple;
  42246. });
  42247. const stepsCount = computed(() => {
  42248. return parent.steps.value.length;
  42249. });
  42250. const isLast = computed(() => {
  42251. var _a;
  42252. return ((_a = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a.uid) === (currentInstance == null ? void 0 : currentInstance.uid);
  42253. });
  42254. const space = computed(() => {
  42255. return isSimple.value ? "" : parent.props.space;
  42256. });
  42257. const containerKls = computed(() => {
  42258. return [
  42259. ns.b(),
  42260. ns.is(isSimple.value ? "simple" : parent.props.direction),
  42261. ns.is("flex", isLast.value && !space.value && !isCenter.value),
  42262. ns.is("center", isCenter.value && !isVertical.value && !isSimple.value)
  42263. ];
  42264. });
  42265. const style = computed(() => {
  42266. const style2 = {
  42267. flexBasis: isNumber(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`
  42268. };
  42269. if (isVertical.value)
  42270. return style2;
  42271. if (isLast.value) {
  42272. style2.maxWidth = `${100 / stepsCount.value}%`;
  42273. }
  42274. return style2;
  42275. });
  42276. const setIndex = (val) => {
  42277. index.value = val;
  42278. };
  42279. const calcProgress = (status) => {
  42280. const isWait = status === "wait";
  42281. const style2 = {
  42282. transitionDelay: `${isWait ? "-" : ""}${150 * index.value}ms`
  42283. };
  42284. const step = status === parent.props.processStatus || isWait ? 0 : 100;
  42285. style2.borderWidth = step && !isSimple.value ? "1px" : 0;
  42286. style2[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
  42287. lineStyle.value = style2;
  42288. };
  42289. const updateStatus = (activeIndex) => {
  42290. if (activeIndex > index.value) {
  42291. internalStatus.value = parent.props.finishStatus;
  42292. } else if (activeIndex === index.value && prevStatus.value !== "error") {
  42293. internalStatus.value = parent.props.processStatus;
  42294. } else {
  42295. internalStatus.value = "wait";
  42296. }
  42297. const prevChild = parent.steps.value[index.value - 1];
  42298. if (prevChild)
  42299. prevChild.calcProgress(internalStatus.value);
  42300. };
  42301. const stepItemState = reactive({
  42302. uid: currentInstance.uid,
  42303. currentStatus,
  42304. setIndex,
  42305. calcProgress
  42306. });
  42307. parent.addStep(stepItemState);
  42308. return (_ctx, _cache) => {
  42309. return openBlock(), createElementBlock("div", {
  42310. style: normalizeStyle(unref(style)),
  42311. class: normalizeClass(unref(containerKls))
  42312. }, [
  42313. createCommentVNode(" icon & line "),
  42314. createElementVNode("div", {
  42315. class: normalizeClass([unref(ns).e("head"), unref(ns).is(unref(currentStatus))])
  42316. }, [
  42317. !unref(isSimple) ? (openBlock(), createElementBlock("div", {
  42318. key: 0,
  42319. class: normalizeClass(unref(ns).e("line"))
  42320. }, [
  42321. createElementVNode("i", {
  42322. class: normalizeClass(unref(ns).e("line-inner")),
  42323. style: normalizeStyle(lineStyle.value)
  42324. }, null, 6)
  42325. ], 2)) : createCommentVNode("v-if", true),
  42326. createElementVNode("div", {
  42327. class: normalizeClass([unref(ns).e("icon"), unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")])
  42328. }, [
  42329. renderSlot(_ctx.$slots, "icon", {}, () => [
  42330. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
  42331. key: 0,
  42332. class: normalizeClass(unref(ns).e("icon-inner"))
  42333. }, {
  42334. default: withCtx(() => [
  42335. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  42336. ]),
  42337. _: 1
  42338. }, 8, ["class"])) : unref(currentStatus) === "success" ? (openBlock(), createBlock(unref(ElIcon), {
  42339. key: 1,
  42340. class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
  42341. }, {
  42342. default: withCtx(() => [
  42343. createVNode(unref(check_default))
  42344. ]),
  42345. _: 1
  42346. }, 8, ["class"])) : unref(currentStatus) === "error" ? (openBlock(), createBlock(unref(ElIcon), {
  42347. key: 2,
  42348. class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
  42349. }, {
  42350. default: withCtx(() => [
  42351. createVNode(unref(close_default))
  42352. ]),
  42353. _: 1
  42354. }, 8, ["class"])) : !unref(isSimple) ? (openBlock(), createElementBlock("div", {
  42355. key: 3,
  42356. class: normalizeClass(unref(ns).e("icon-inner"))
  42357. }, toDisplayString(index.value + 1), 3)) : createCommentVNode("v-if", true)
  42358. ])
  42359. ], 2)
  42360. ], 2),
  42361. createCommentVNode(" title & description "),
  42362. createElementVNode("div", {
  42363. class: normalizeClass(unref(ns).e("main"))
  42364. }, [
  42365. createElementVNode("div", {
  42366. class: normalizeClass([unref(ns).e("title"), unref(ns).is(unref(currentStatus))])
  42367. }, [
  42368. renderSlot(_ctx.$slots, "title", {}, () => [
  42369. createTextVNode(toDisplayString(_ctx.title), 1)
  42370. ])
  42371. ], 2),
  42372. unref(isSimple) ? (openBlock(), createElementBlock("div", {
  42373. key: 0,
  42374. class: normalizeClass(unref(ns).e("arrow"))
  42375. }, null, 2)) : (openBlock(), createElementBlock("div", {
  42376. key: 1,
  42377. class: normalizeClass([unref(ns).e("description"), unref(ns).is(unref(currentStatus))])
  42378. }, [
  42379. renderSlot(_ctx.$slots, "description", {}, () => [
  42380. createTextVNode(toDisplayString(_ctx.description), 1)
  42381. ])
  42382. ], 2))
  42383. ], 2)
  42384. ], 6);
  42385. };
  42386. }
  42387. });
  42388. var Step = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__file", "item.vue"]]);
  42389. const ElSteps = withInstall(Steps, {
  42390. Step
  42391. });
  42392. const ElStep = withNoopInstall(Step);
  42393. const switchProps = buildProps({
  42394. modelValue: {
  42395. type: [Boolean, String, Number],
  42396. default: false
  42397. },
  42398. disabled: Boolean,
  42399. loading: Boolean,
  42400. size: {
  42401. type: String,
  42402. validator: isValidComponentSize
  42403. },
  42404. width: {
  42405. type: [String, Number],
  42406. default: ""
  42407. },
  42408. inlinePrompt: Boolean,
  42409. inactiveActionIcon: {
  42410. type: iconPropType
  42411. },
  42412. activeActionIcon: {
  42413. type: iconPropType
  42414. },
  42415. activeIcon: {
  42416. type: iconPropType
  42417. },
  42418. inactiveIcon: {
  42419. type: iconPropType
  42420. },
  42421. activeText: {
  42422. type: String,
  42423. default: ""
  42424. },
  42425. inactiveText: {
  42426. type: String,
  42427. default: ""
  42428. },
  42429. activeValue: {
  42430. type: [Boolean, String, Number],
  42431. default: true
  42432. },
  42433. inactiveValue: {
  42434. type: [Boolean, String, Number],
  42435. default: false
  42436. },
  42437. name: {
  42438. type: String,
  42439. default: ""
  42440. },
  42441. validateEvent: {
  42442. type: Boolean,
  42443. default: true
  42444. },
  42445. beforeChange: {
  42446. type: definePropType(Function)
  42447. },
  42448. id: String,
  42449. tabindex: {
  42450. type: [String, Number]
  42451. },
  42452. ...useAriaProps(["ariaLabel"])
  42453. });
  42454. const switchEmits = {
  42455. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  42456. [CHANGE_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val),
  42457. [INPUT_EVENT]: (val) => isBoolean(val) || isString$1(val) || isNumber(val)
  42458. };
  42459. const COMPONENT_NAME$8 = "ElSwitch";
  42460. const __default__$w = defineComponent({
  42461. name: COMPONENT_NAME$8
  42462. });
  42463. const _sfc_main$D = /* @__PURE__ */ defineComponent({
  42464. ...__default__$w,
  42465. props: switchProps,
  42466. emits: switchEmits,
  42467. setup(__props, { expose, emit }) {
  42468. const props = __props;
  42469. const { formItem } = useFormItem();
  42470. const switchSize = useFormSize();
  42471. const ns = useNamespace("switch");
  42472. const { inputId } = useFormItemInputId(props, {
  42473. formItemContext: formItem
  42474. });
  42475. const switchDisabled = useFormDisabled(computed(() => props.loading));
  42476. const isControlled = ref(props.modelValue !== false);
  42477. const input = ref();
  42478. const core = ref();
  42479. const switchKls = computed(() => [
  42480. ns.b(),
  42481. ns.m(switchSize.value),
  42482. ns.is("disabled", switchDisabled.value),
  42483. ns.is("checked", checked.value)
  42484. ]);
  42485. const labelLeftKls = computed(() => [
  42486. ns.e("label"),
  42487. ns.em("label", "left"),
  42488. ns.is("active", !checked.value)
  42489. ]);
  42490. const labelRightKls = computed(() => [
  42491. ns.e("label"),
  42492. ns.em("label", "right"),
  42493. ns.is("active", checked.value)
  42494. ]);
  42495. const coreStyle = computed(() => ({
  42496. width: addUnit(props.width)
  42497. }));
  42498. watch(() => props.modelValue, () => {
  42499. isControlled.value = true;
  42500. });
  42501. const actualValue = computed(() => {
  42502. return isControlled.value ? props.modelValue : false;
  42503. });
  42504. const checked = computed(() => actualValue.value === props.activeValue);
  42505. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  42506. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  42507. emit(CHANGE_EVENT, props.inactiveValue);
  42508. emit(INPUT_EVENT, props.inactiveValue);
  42509. }
  42510. watch(checked, (val) => {
  42511. var _a;
  42512. input.value.checked = val;
  42513. if (props.validateEvent) {
  42514. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  42515. }
  42516. });
  42517. const handleChange = () => {
  42518. const val = checked.value ? props.inactiveValue : props.activeValue;
  42519. emit(UPDATE_MODEL_EVENT, val);
  42520. emit(CHANGE_EVENT, val);
  42521. emit(INPUT_EVENT, val);
  42522. nextTick(() => {
  42523. input.value.checked = checked.value;
  42524. });
  42525. };
  42526. const switchValue = () => {
  42527. if (switchDisabled.value)
  42528. return;
  42529. const { beforeChange } = props;
  42530. if (!beforeChange) {
  42531. handleChange();
  42532. return;
  42533. }
  42534. const shouldChange = beforeChange();
  42535. const isPromiseOrBool = [
  42536. isPromise(shouldChange),
  42537. isBoolean(shouldChange)
  42538. ].includes(true);
  42539. if (!isPromiseOrBool) {
  42540. throwError(COMPONENT_NAME$8, "beforeChange must return type `Promise<boolean>` or `boolean`");
  42541. }
  42542. if (isPromise(shouldChange)) {
  42543. shouldChange.then((result) => {
  42544. if (result) {
  42545. handleChange();
  42546. }
  42547. }).catch((e) => {
  42548. });
  42549. } else if (shouldChange) {
  42550. handleChange();
  42551. }
  42552. };
  42553. const focus = () => {
  42554. var _a, _b;
  42555. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  42556. };
  42557. onMounted(() => {
  42558. input.value.checked = checked.value;
  42559. });
  42560. expose({
  42561. focus,
  42562. checked
  42563. });
  42564. return (_ctx, _cache) => {
  42565. return openBlock(), createElementBlock("div", {
  42566. class: normalizeClass(unref(switchKls)),
  42567. onClick: withModifiers(switchValue, ["prevent"])
  42568. }, [
  42569. createElementVNode("input", {
  42570. id: unref(inputId),
  42571. ref_key: "input",
  42572. ref: input,
  42573. class: normalizeClass(unref(ns).e("input")),
  42574. type: "checkbox",
  42575. role: "switch",
  42576. "aria-checked": unref(checked),
  42577. "aria-disabled": unref(switchDisabled),
  42578. "aria-label": _ctx.ariaLabel,
  42579. name: _ctx.name,
  42580. "true-value": _ctx.activeValue,
  42581. "false-value": _ctx.inactiveValue,
  42582. disabled: unref(switchDisabled),
  42583. tabindex: _ctx.tabindex,
  42584. onChange: handleChange,
  42585. onKeydown: withKeys(switchValue, ["enter"])
  42586. }, null, 42, ["id", "aria-checked", "aria-disabled", "aria-label", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"]),
  42587. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
  42588. key: 0,
  42589. class: normalizeClass(unref(labelLeftKls))
  42590. }, [
  42591. _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  42592. default: withCtx(() => [
  42593. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  42594. ]),
  42595. _: 1
  42596. })) : createCommentVNode("v-if", true),
  42597. !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  42598. key: 1,
  42599. "aria-hidden": unref(checked)
  42600. }, toDisplayString(_ctx.inactiveText), 9, ["aria-hidden"])) : createCommentVNode("v-if", true)
  42601. ], 2)) : createCommentVNode("v-if", true),
  42602. createElementVNode("span", {
  42603. ref_key: "core",
  42604. ref: core,
  42605. class: normalizeClass(unref(ns).e("core")),
  42606. style: normalizeStyle(unref(coreStyle))
  42607. }, [
  42608. _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
  42609. key: 0,
  42610. class: normalizeClass(unref(ns).e("inner"))
  42611. }, [
  42612. _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), {
  42613. key: 0,
  42614. class: normalizeClass(unref(ns).is("icon"))
  42615. }, {
  42616. default: withCtx(() => [
  42617. (openBlock(), createBlock(resolveDynamicComponent(unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  42618. ]),
  42619. _: 1
  42620. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  42621. key: 1,
  42622. class: normalizeClass(unref(ns).is("text")),
  42623. "aria-hidden": !unref(checked)
  42624. }, toDisplayString(unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, ["aria-hidden"])) : createCommentVNode("v-if", true)
  42625. ], 2)) : createCommentVNode("v-if", true),
  42626. createElementVNode("div", {
  42627. class: normalizeClass(unref(ns).e("action"))
  42628. }, [
  42629. _ctx.loading ? (openBlock(), createBlock(unref(ElIcon), {
  42630. key: 0,
  42631. class: normalizeClass(unref(ns).is("loading"))
  42632. }, {
  42633. default: withCtx(() => [
  42634. createVNode(unref(loading_default))
  42635. ]),
  42636. _: 1
  42637. }, 8, ["class"])) : unref(checked) ? renderSlot(_ctx.$slots, "active-action", { key: 1 }, () => [
  42638. _ctx.activeActionIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  42639. default: withCtx(() => [
  42640. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeActionIcon)))
  42641. ]),
  42642. _: 1
  42643. })) : createCommentVNode("v-if", true)
  42644. ]) : !unref(checked) ? renderSlot(_ctx.$slots, "inactive-action", { key: 2 }, () => [
  42645. _ctx.inactiveActionIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  42646. default: withCtx(() => [
  42647. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveActionIcon)))
  42648. ]),
  42649. _: 1
  42650. })) : createCommentVNode("v-if", true)
  42651. ]) : createCommentVNode("v-if", true)
  42652. ], 2)
  42653. ], 6),
  42654. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
  42655. key: 1,
  42656. class: normalizeClass(unref(labelRightKls))
  42657. }, [
  42658. _ctx.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  42659. default: withCtx(() => [
  42660. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  42661. ]),
  42662. _: 1
  42663. })) : createCommentVNode("v-if", true),
  42664. !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
  42665. key: 1,
  42666. "aria-hidden": !unref(checked)
  42667. }, toDisplayString(_ctx.activeText), 9, ["aria-hidden"])) : createCommentVNode("v-if", true)
  42668. ], 2)) : createCommentVNode("v-if", true)
  42669. ], 10, ["onClick"]);
  42670. };
  42671. }
  42672. });
  42673. var Switch = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__file", "switch.vue"]]);
  42674. const ElSwitch = withInstall(Switch);
  42675. const getCell = function(event) {
  42676. var _a;
  42677. return (_a = event.target) == null ? void 0 : _a.closest("td");
  42678. };
  42679. const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
  42680. if (!sortKey && !sortMethod && (!sortBy || isArray$1(sortBy) && !sortBy.length)) {
  42681. return array;
  42682. }
  42683. if (isString$1(reverse)) {
  42684. reverse = reverse === "descending" ? -1 : 1;
  42685. } else {
  42686. reverse = reverse && reverse < 0 ? -1 : 1;
  42687. }
  42688. const getKey = sortMethod ? null : function(value, index) {
  42689. if (sortBy) {
  42690. if (!isArray$1(sortBy)) {
  42691. sortBy = [sortBy];
  42692. }
  42693. return sortBy.map((by) => {
  42694. if (isString$1(by)) {
  42695. return get(value, by);
  42696. } else {
  42697. return by(value, index, array);
  42698. }
  42699. });
  42700. }
  42701. if (sortKey !== "$key") {
  42702. if (isObject$1(value) && "$value" in value)
  42703. value = value.$value;
  42704. }
  42705. return [isObject$1(value) ? get(value, sortKey) : value];
  42706. };
  42707. const compare = function(a, b) {
  42708. if (sortMethod) {
  42709. return sortMethod(a.value, b.value);
  42710. }
  42711. for (let i = 0, len = a.key.length; i < len; i++) {
  42712. if (a.key[i] < b.key[i]) {
  42713. return -1;
  42714. }
  42715. if (a.key[i] > b.key[i]) {
  42716. return 1;
  42717. }
  42718. }
  42719. return 0;
  42720. };
  42721. return array.map((value, index) => {
  42722. return {
  42723. value,
  42724. index,
  42725. key: getKey ? getKey(value, index) : null
  42726. };
  42727. }).sort((a, b) => {
  42728. let order = compare(a, b);
  42729. if (!order) {
  42730. order = a.index - b.index;
  42731. }
  42732. return order * +reverse;
  42733. }).map((item) => item.value);
  42734. };
  42735. const getColumnById = function(table, columnId) {
  42736. let column = null;
  42737. table.columns.forEach((item) => {
  42738. if (item.id === columnId) {
  42739. column = item;
  42740. }
  42741. });
  42742. return column;
  42743. };
  42744. const getColumnByKey = function(table, columnKey) {
  42745. let column = null;
  42746. for (let i = 0; i < table.columns.length; i++) {
  42747. const item = table.columns[i];
  42748. if (item.columnKey === columnKey) {
  42749. column = item;
  42750. break;
  42751. }
  42752. }
  42753. if (!column)
  42754. throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  42755. return column;
  42756. };
  42757. const getColumnByCell = function(table, cell, namespace) {
  42758. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  42759. if (matches) {
  42760. return getColumnById(table, matches[0]);
  42761. }
  42762. return null;
  42763. };
  42764. const getRowIdentity = (row, rowKey) => {
  42765. if (!row)
  42766. throw new Error("Row is required when get row identity");
  42767. if (isString$1(rowKey)) {
  42768. if (!rowKey.includes(".")) {
  42769. return `${row[rowKey]}`;
  42770. }
  42771. const key = rowKey.split(".");
  42772. let current = row;
  42773. for (const element of key) {
  42774. current = current[element];
  42775. }
  42776. return `${current}`;
  42777. } else if (isFunction$1(rowKey)) {
  42778. return rowKey.call(null, row);
  42779. }
  42780. };
  42781. const getKeysMap = function(array, rowKey) {
  42782. const arrayMap = {};
  42783. (array || []).forEach((row, index) => {
  42784. arrayMap[getRowIdentity(row, rowKey)] = { row, index };
  42785. });
  42786. return arrayMap;
  42787. };
  42788. function mergeOptions(defaults, config) {
  42789. const options = {};
  42790. let key;
  42791. for (key in defaults) {
  42792. options[key] = defaults[key];
  42793. }
  42794. for (key in config) {
  42795. if (hasOwn(config, key)) {
  42796. const value = config[key];
  42797. if (typeof value !== "undefined") {
  42798. options[key] = value;
  42799. }
  42800. }
  42801. }
  42802. return options;
  42803. }
  42804. function parseWidth(width) {
  42805. if (width === "")
  42806. return width;
  42807. if (width !== void 0) {
  42808. width = Number.parseInt(width, 10);
  42809. if (Number.isNaN(width)) {
  42810. width = "";
  42811. }
  42812. }
  42813. return width;
  42814. }
  42815. function parseMinWidth(minWidth) {
  42816. if (minWidth === "")
  42817. return minWidth;
  42818. if (minWidth !== void 0) {
  42819. minWidth = parseWidth(minWidth);
  42820. if (Number.isNaN(minWidth)) {
  42821. minWidth = 80;
  42822. }
  42823. }
  42824. return minWidth;
  42825. }
  42826. function parseHeight(height) {
  42827. if (isNumber(height)) {
  42828. return height;
  42829. }
  42830. if (isString$1(height)) {
  42831. if (/^\d+(?:px)?$/.test(height)) {
  42832. return Number.parseInt(height, 10);
  42833. } else {
  42834. return height;
  42835. }
  42836. }
  42837. return null;
  42838. }
  42839. function compose(...funcs) {
  42840. if (funcs.length === 0) {
  42841. return (arg) => arg;
  42842. }
  42843. if (funcs.length === 1) {
  42844. return funcs[0];
  42845. }
  42846. return funcs.reduce((a, b) => (...args) => a(b(...args)));
  42847. }
  42848. function toggleRowStatus(statusArr, row, newVal, tableTreeProps, selectable, rowIndex) {
  42849. let _rowIndex = rowIndex != null ? rowIndex : 0;
  42850. let changed = false;
  42851. const index = statusArr.indexOf(row);
  42852. const included = index !== -1;
  42853. const isRowSelectable = selectable == null ? void 0 : selectable.call(null, row, rowIndex);
  42854. const toggleStatus = (type) => {
  42855. if (type === "add") {
  42856. statusArr.push(row);
  42857. } else {
  42858. statusArr.splice(index, 1);
  42859. }
  42860. changed = true;
  42861. };
  42862. const getChildrenCount = (row2) => {
  42863. let count = 0;
  42864. const children = (tableTreeProps == null ? void 0 : tableTreeProps.children) && row2[tableTreeProps.children];
  42865. if (children && isArray$1(children)) {
  42866. count += children.length;
  42867. children.forEach((item) => {
  42868. count += getChildrenCount(item);
  42869. });
  42870. }
  42871. return count;
  42872. };
  42873. if (!selectable || isRowSelectable) {
  42874. if (isBoolean(newVal)) {
  42875. if (newVal && !included) {
  42876. toggleStatus("add");
  42877. } else if (!newVal && included) {
  42878. toggleStatus("remove");
  42879. }
  42880. } else {
  42881. included ? toggleStatus("remove") : toggleStatus("add");
  42882. }
  42883. }
  42884. if (!(tableTreeProps == null ? void 0 : tableTreeProps.checkStrictly) && (tableTreeProps == null ? void 0 : tableTreeProps.children) && isArray$1(row[tableTreeProps.children])) {
  42885. row[tableTreeProps.children].forEach((item) => {
  42886. toggleRowStatus(statusArr, item, newVal != null ? newVal : !included, tableTreeProps, selectable, _rowIndex + 1);
  42887. _rowIndex += getChildrenCount(item) + 1;
  42888. });
  42889. }
  42890. return changed;
  42891. }
  42892. function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren") {
  42893. const isNil = (array) => !(isArray$1(array) && array.length);
  42894. function _walker(parent, children, level) {
  42895. cb(parent, children, level);
  42896. children.forEach((item) => {
  42897. if (item[lazyKey]) {
  42898. cb(item, null, level + 1);
  42899. return;
  42900. }
  42901. const children2 = item[childrenKey];
  42902. if (!isNil(children2)) {
  42903. _walker(item, children2, level + 1);
  42904. }
  42905. });
  42906. }
  42907. root.forEach((item) => {
  42908. if (item[lazyKey]) {
  42909. cb(item, null, 0);
  42910. return;
  42911. }
  42912. const children = item[childrenKey];
  42913. if (!isNil(children)) {
  42914. _walker(item, children, 0);
  42915. }
  42916. });
  42917. }
  42918. const getTableOverflowTooltipProps = (props, content) => {
  42919. return {
  42920. content,
  42921. ...props,
  42922. popperOptions: {
  42923. strategy: "fixed",
  42924. ...props.popperOptions
  42925. }
  42926. };
  42927. };
  42928. let removePopper = null;
  42929. function createTablePopper(props, popperContent, trigger, table) {
  42930. if ((removePopper == null ? void 0 : removePopper.trigger) === trigger) {
  42931. merge(removePopper.vm.component.props, getTableOverflowTooltipProps(props, popperContent));
  42932. return;
  42933. }
  42934. removePopper == null ? void 0 : removePopper();
  42935. const parentNode = table == null ? void 0 : table.refs.tableWrapper;
  42936. const ns = parentNode == null ? void 0 : parentNode.dataset.prefix;
  42937. const vm = createVNode(ElTooltip, {
  42938. virtualTriggering: true,
  42939. virtualRef: trigger,
  42940. appendTo: parentNode,
  42941. placement: "top",
  42942. transition: "none",
  42943. offset: 0,
  42944. hideAfter: 0,
  42945. ...getTableOverflowTooltipProps(props, popperContent)
  42946. });
  42947. vm.appContext = { ...table.appContext, ...table };
  42948. const container = document.createElement("div");
  42949. render(vm, container);
  42950. vm.component.exposed.onOpen();
  42951. const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`);
  42952. removePopper = () => {
  42953. render(null, container);
  42954. scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", removePopper);
  42955. removePopper = null;
  42956. };
  42957. removePopper.trigger = trigger;
  42958. removePopper.vm = vm;
  42959. scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", removePopper);
  42960. }
  42961. function getCurrentColumns(column) {
  42962. if (column.children) {
  42963. return flatMap(column.children, getCurrentColumns);
  42964. } else {
  42965. return [column];
  42966. }
  42967. }
  42968. function getColSpan(colSpan, column) {
  42969. return colSpan + column.colSpan;
  42970. }
  42971. const isFixedColumn = (index, fixed, store, realColumns) => {
  42972. let start = 0;
  42973. let after = index;
  42974. const columns = store.states.columns.value;
  42975. if (realColumns) {
  42976. const curColumns = getCurrentColumns(realColumns[index]);
  42977. const preColumns = columns.slice(0, columns.indexOf(curColumns[0]));
  42978. start = preColumns.reduce(getColSpan, 0);
  42979. after = start + curColumns.reduce(getColSpan, 0) - 1;
  42980. } else {
  42981. start = index;
  42982. }
  42983. let fixedLayout;
  42984. switch (fixed) {
  42985. case "left":
  42986. if (after < store.states.fixedLeafColumnsLength.value) {
  42987. fixedLayout = "left";
  42988. }
  42989. break;
  42990. case "right":
  42991. if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  42992. fixedLayout = "right";
  42993. }
  42994. break;
  42995. default:
  42996. if (after < store.states.fixedLeafColumnsLength.value) {
  42997. fixedLayout = "left";
  42998. } else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  42999. fixedLayout = "right";
  43000. }
  43001. }
  43002. return fixedLayout ? {
  43003. direction: fixedLayout,
  43004. start,
  43005. after
  43006. } : {};
  43007. };
  43008. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
  43009. const classes = [];
  43010. const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
  43011. if (direction) {
  43012. const isLeft = direction === "left";
  43013. classes.push(`${namespace}-fixed-column--${direction}`);
  43014. if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) {
  43015. classes.push("is-last-column");
  43016. } else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  43017. classes.push("is-first-column");
  43018. }
  43019. }
  43020. return classes;
  43021. };
  43022. function getOffset(offset, column) {
  43023. return offset + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  43024. }
  43025. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  43026. const {
  43027. direction,
  43028. start = 0,
  43029. after = 0
  43030. } = isFixedColumn(index, fixed, store, realColumns);
  43031. if (!direction) {
  43032. return;
  43033. }
  43034. const styles = {};
  43035. const isLeft = direction === "left";
  43036. const columns = store.states.columns.value;
  43037. if (isLeft) {
  43038. styles.left = columns.slice(0, start).reduce(getOffset, 0);
  43039. } else {
  43040. styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
  43041. }
  43042. return styles;
  43043. };
  43044. const ensurePosition = (style, key) => {
  43045. if (!style)
  43046. return;
  43047. if (!Number.isNaN(style[key])) {
  43048. style[key] = `${style[key]}px`;
  43049. }
  43050. };
  43051. function useExpand(watcherData) {
  43052. const instance = getCurrentInstance();
  43053. const defaultExpandAll = ref(false);
  43054. const expandRows = ref([]);
  43055. const updateExpandRows = () => {
  43056. const data = watcherData.data.value || [];
  43057. const rowKey = watcherData.rowKey.value;
  43058. if (defaultExpandAll.value) {
  43059. expandRows.value = data.slice();
  43060. } else if (rowKey) {
  43061. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  43062. expandRows.value = data.reduce((prev, row) => {
  43063. const rowId = getRowIdentity(row, rowKey);
  43064. const rowInfo = expandRowsMap[rowId];
  43065. if (rowInfo) {
  43066. prev.push(row);
  43067. }
  43068. return prev;
  43069. }, []);
  43070. } else {
  43071. expandRows.value = [];
  43072. }
  43073. };
  43074. const toggleRowExpansion = (row, expanded) => {
  43075. const changed = toggleRowStatus(expandRows.value, row, expanded);
  43076. if (changed) {
  43077. instance.emit("expand-change", row, expandRows.value.slice());
  43078. }
  43079. };
  43080. const setExpandRowKeys = (rowKeys) => {
  43081. instance.store.assertRowKey();
  43082. const data = watcherData.data.value || [];
  43083. const rowKey = watcherData.rowKey.value;
  43084. const keysMap = getKeysMap(data, rowKey);
  43085. expandRows.value = rowKeys.reduce((prev, cur) => {
  43086. const info = keysMap[cur];
  43087. if (info) {
  43088. prev.push(info.row);
  43089. }
  43090. return prev;
  43091. }, []);
  43092. };
  43093. const isRowExpanded = (row) => {
  43094. const rowKey = watcherData.rowKey.value;
  43095. if (rowKey) {
  43096. const expandMap = getKeysMap(expandRows.value, rowKey);
  43097. return !!expandMap[getRowIdentity(row, rowKey)];
  43098. }
  43099. return expandRows.value.includes(row);
  43100. };
  43101. return {
  43102. updateExpandRows,
  43103. toggleRowExpansion,
  43104. setExpandRowKeys,
  43105. isRowExpanded,
  43106. states: {
  43107. expandRows,
  43108. defaultExpandAll
  43109. }
  43110. };
  43111. }
  43112. function useCurrent(watcherData) {
  43113. const instance = getCurrentInstance();
  43114. const _currentRowKey = ref(null);
  43115. const currentRow = ref(null);
  43116. const setCurrentRowKey = (key) => {
  43117. instance.store.assertRowKey();
  43118. _currentRowKey.value = key;
  43119. setCurrentRowByKey(key);
  43120. };
  43121. const restoreCurrentRowKey = () => {
  43122. _currentRowKey.value = null;
  43123. };
  43124. const setCurrentRowByKey = (key) => {
  43125. const { data, rowKey } = watcherData;
  43126. let _currentRow = null;
  43127. if (rowKey.value) {
  43128. _currentRow = (unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  43129. }
  43130. currentRow.value = _currentRow;
  43131. instance.emit("current-change", currentRow.value, null);
  43132. };
  43133. const updateCurrentRow = (_currentRow) => {
  43134. const oldCurrentRow = currentRow.value;
  43135. if (_currentRow && _currentRow !== oldCurrentRow) {
  43136. currentRow.value = _currentRow;
  43137. instance.emit("current-change", currentRow.value, oldCurrentRow);
  43138. return;
  43139. }
  43140. if (!_currentRow && oldCurrentRow) {
  43141. currentRow.value = null;
  43142. instance.emit("current-change", null, oldCurrentRow);
  43143. }
  43144. };
  43145. const updateCurrentRowData = () => {
  43146. const rowKey = watcherData.rowKey.value;
  43147. const data = watcherData.data.value || [];
  43148. const oldCurrentRow = currentRow.value;
  43149. if (!data.includes(oldCurrentRow) && oldCurrentRow) {
  43150. if (rowKey) {
  43151. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  43152. setCurrentRowByKey(currentRowKey);
  43153. } else {
  43154. currentRow.value = null;
  43155. }
  43156. if (currentRow.value === null) {
  43157. instance.emit("current-change", null, oldCurrentRow);
  43158. }
  43159. } else if (_currentRowKey.value) {
  43160. setCurrentRowByKey(_currentRowKey.value);
  43161. restoreCurrentRowKey();
  43162. }
  43163. };
  43164. return {
  43165. setCurrentRowKey,
  43166. restoreCurrentRowKey,
  43167. setCurrentRowByKey,
  43168. updateCurrentRow,
  43169. updateCurrentRowData,
  43170. states: {
  43171. _currentRowKey,
  43172. currentRow
  43173. }
  43174. };
  43175. }
  43176. function useTree$2(watcherData) {
  43177. const expandRowKeys = ref([]);
  43178. const treeData = ref({});
  43179. const indent = ref(16);
  43180. const lazy = ref(false);
  43181. const lazyTreeNodeMap = ref({});
  43182. const lazyColumnIdentifier = ref("hasChildren");
  43183. const childrenColumnName = ref("children");
  43184. const checkStrictly = ref(false);
  43185. const instance = getCurrentInstance();
  43186. const normalizedData = computed(() => {
  43187. if (!watcherData.rowKey.value)
  43188. return {};
  43189. const data = watcherData.data.value || [];
  43190. return normalize(data);
  43191. });
  43192. const normalizedLazyNode = computed(() => {
  43193. const rowKey = watcherData.rowKey.value;
  43194. const keys = Object.keys(lazyTreeNodeMap.value);
  43195. const res = {};
  43196. if (!keys.length)
  43197. return res;
  43198. keys.forEach((key) => {
  43199. if (lazyTreeNodeMap.value[key].length) {
  43200. const item = { children: [] };
  43201. lazyTreeNodeMap.value[key].forEach((row) => {
  43202. const currentRowKey = getRowIdentity(row, rowKey);
  43203. item.children.push(currentRowKey);
  43204. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  43205. res[currentRowKey] = { children: [] };
  43206. }
  43207. });
  43208. res[key] = item;
  43209. }
  43210. });
  43211. return res;
  43212. });
  43213. const normalize = (data) => {
  43214. const rowKey = watcherData.rowKey.value;
  43215. const res = {};
  43216. walkTreeNode(data, (parent, children, level) => {
  43217. const parentId = getRowIdentity(parent, rowKey);
  43218. if (isArray$1(children)) {
  43219. res[parentId] = {
  43220. children: children.map((row) => getRowIdentity(row, rowKey)),
  43221. level
  43222. };
  43223. } else if (lazy.value) {
  43224. res[parentId] = {
  43225. children: [],
  43226. lazy: true,
  43227. level
  43228. };
  43229. }
  43230. }, childrenColumnName.value, lazyColumnIdentifier.value);
  43231. return res;
  43232. };
  43233. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a) => (_a = instance.store) == null ? void 0 : _a.states.defaultExpandAll.value)()) => {
  43234. var _a2;
  43235. const nested = normalizedData.value;
  43236. const normalizedLazyNode_ = normalizedLazyNode.value;
  43237. const keys = Object.keys(nested);
  43238. const newTreeData = {};
  43239. if (keys.length) {
  43240. const oldTreeData = unref(treeData);
  43241. const rootLazyRowKeys = [];
  43242. const getExpanded = (oldValue, key) => {
  43243. if (ifChangeExpandRowKeys) {
  43244. if (expandRowKeys.value) {
  43245. return ifExpandAll || expandRowKeys.value.includes(key);
  43246. } else {
  43247. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  43248. }
  43249. } else {
  43250. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  43251. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  43252. }
  43253. };
  43254. keys.forEach((key) => {
  43255. const oldValue = oldTreeData[key];
  43256. const newValue = { ...nested[key] };
  43257. newValue.expanded = getExpanded(oldValue, key);
  43258. if (newValue.lazy) {
  43259. const { loaded = false, loading = false } = oldValue || {};
  43260. newValue.loaded = !!loaded;
  43261. newValue.loading = !!loading;
  43262. rootLazyRowKeys.push(key);
  43263. }
  43264. newTreeData[key] = newValue;
  43265. });
  43266. const lazyKeys = Object.keys(normalizedLazyNode_);
  43267. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  43268. lazyKeys.forEach((key) => {
  43269. const oldValue = oldTreeData[key];
  43270. const lazyNodeChildren = normalizedLazyNode_[key].children;
  43271. if (rootLazyRowKeys.includes(key)) {
  43272. if (newTreeData[key].children.length !== 0) {
  43273. throw new Error("[ElTable]children must be an empty array.");
  43274. }
  43275. newTreeData[key].children = lazyNodeChildren;
  43276. } else {
  43277. const { loaded = false, loading = false } = oldValue || {};
  43278. newTreeData[key] = {
  43279. lazy: true,
  43280. loaded: !!loaded,
  43281. loading: !!loading,
  43282. expanded: getExpanded(oldValue, key),
  43283. children: lazyNodeChildren,
  43284. level: ""
  43285. };
  43286. }
  43287. });
  43288. }
  43289. }
  43290. treeData.value = newTreeData;
  43291. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  43292. };
  43293. watch(() => expandRowKeys.value, () => {
  43294. updateTreeData(true);
  43295. });
  43296. watch(() => normalizedData.value, () => {
  43297. updateTreeData();
  43298. });
  43299. watch(() => normalizedLazyNode.value, () => {
  43300. updateTreeData();
  43301. });
  43302. const updateTreeExpandKeys = (value) => {
  43303. expandRowKeys.value = value;
  43304. updateTreeData();
  43305. };
  43306. const toggleTreeExpansion = (row, expanded) => {
  43307. instance.store.assertRowKey();
  43308. const rowKey = watcherData.rowKey.value;
  43309. const id = getRowIdentity(row, rowKey);
  43310. const data = id && treeData.value[id];
  43311. if (id && data && "expanded" in data) {
  43312. const oldExpanded = data.expanded;
  43313. expanded = isUndefined(expanded) ? !data.expanded : expanded;
  43314. treeData.value[id].expanded = expanded;
  43315. if (oldExpanded !== expanded) {
  43316. instance.emit("expand-change", row, expanded);
  43317. }
  43318. instance.store.updateTableScrollY();
  43319. }
  43320. };
  43321. const loadOrToggle = (row) => {
  43322. instance.store.assertRowKey();
  43323. const rowKey = watcherData.rowKey.value;
  43324. const id = getRowIdentity(row, rowKey);
  43325. const data = treeData.value[id];
  43326. if (lazy.value && data && "loaded" in data && !data.loaded) {
  43327. loadData(row, id, data);
  43328. } else {
  43329. toggleTreeExpansion(row, void 0);
  43330. }
  43331. };
  43332. const loadData = (row, key, treeNode) => {
  43333. const { load } = instance.props;
  43334. if (load && !treeData.value[key].loaded) {
  43335. treeData.value[key].loading = true;
  43336. load(row, treeNode, (data) => {
  43337. if (!isArray$1(data)) {
  43338. throw new TypeError("[ElTable] data must be an array");
  43339. }
  43340. treeData.value[key].loading = false;
  43341. treeData.value[key].loaded = true;
  43342. treeData.value[key].expanded = true;
  43343. if (data.length) {
  43344. lazyTreeNodeMap.value[key] = data;
  43345. }
  43346. instance.emit("expand-change", row, true);
  43347. });
  43348. }
  43349. };
  43350. const updateKeyChildren = (key, data) => {
  43351. const { lazy: lazy2, rowKey } = instance.props;
  43352. if (!lazy2)
  43353. return;
  43354. if (!rowKey)
  43355. throw new Error("[Table] rowKey is required in updateKeyChild");
  43356. if (lazyTreeNodeMap.value[key]) {
  43357. lazyTreeNodeMap.value[key] = data;
  43358. }
  43359. };
  43360. return {
  43361. loadData,
  43362. loadOrToggle,
  43363. toggleTreeExpansion,
  43364. updateTreeExpandKeys,
  43365. updateTreeData,
  43366. updateKeyChildren,
  43367. normalize,
  43368. states: {
  43369. expandRowKeys,
  43370. treeData,
  43371. indent,
  43372. lazy,
  43373. lazyTreeNodeMap,
  43374. lazyColumnIdentifier,
  43375. childrenColumnName,
  43376. checkStrictly
  43377. }
  43378. };
  43379. }
  43380. const sortData = (data, states) => {
  43381. const sortingColumn = states.sortingColumn;
  43382. if (!sortingColumn || isString$1(sortingColumn.sortable)) {
  43383. return data;
  43384. }
  43385. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  43386. };
  43387. const doFlattenColumns = (columns) => {
  43388. const result = [];
  43389. columns.forEach((column) => {
  43390. if (column.children && column.children.length > 0) {
  43391. result.push.apply(result, doFlattenColumns(column.children));
  43392. } else {
  43393. result.push(column);
  43394. }
  43395. });
  43396. return result;
  43397. };
  43398. function useWatcher$1() {
  43399. var _a;
  43400. const instance = getCurrentInstance();
  43401. const { size: tableSize } = toRefs((_a = instance.proxy) == null ? void 0 : _a.$props);
  43402. const rowKey = ref(null);
  43403. const data = ref([]);
  43404. const _data = ref([]);
  43405. const isComplex = ref(false);
  43406. const _columns = ref([]);
  43407. const originColumns = ref([]);
  43408. const columns = ref([]);
  43409. const fixedColumns = ref([]);
  43410. const rightFixedColumns = ref([]);
  43411. const leafColumns = ref([]);
  43412. const fixedLeafColumns = ref([]);
  43413. const rightFixedLeafColumns = ref([]);
  43414. const updateOrderFns = [];
  43415. const leafColumnsLength = ref(0);
  43416. const fixedLeafColumnsLength = ref(0);
  43417. const rightFixedLeafColumnsLength = ref(0);
  43418. const isAllSelected = ref(false);
  43419. const selection = ref([]);
  43420. const reserveSelection = ref(false);
  43421. const selectOnIndeterminate = ref(false);
  43422. const selectable = ref(null);
  43423. const filters = ref({});
  43424. const filteredData = ref(null);
  43425. const sortingColumn = ref(null);
  43426. const sortProp = ref(null);
  43427. const sortOrder = ref(null);
  43428. const hoverRow = ref(null);
  43429. watch(data, () => {
  43430. var _a2;
  43431. if (instance.state) {
  43432. scheduleLayout(false);
  43433. const needUpdateFixed = instance.props.tableLayout === "auto";
  43434. if (needUpdateFixed) {
  43435. (_a2 = instance.refs.tableHeaderRef) == null ? void 0 : _a2.updateFixedColumnStyle();
  43436. }
  43437. }
  43438. }, {
  43439. deep: true
  43440. });
  43441. const assertRowKey = () => {
  43442. if (!rowKey.value)
  43443. throw new Error("[ElTable] prop row-key is required");
  43444. };
  43445. const updateChildFixed = (column) => {
  43446. var _a2;
  43447. (_a2 = column.children) == null ? void 0 : _a2.forEach((childColumn) => {
  43448. childColumn.fixed = column.fixed;
  43449. updateChildFixed(childColumn);
  43450. });
  43451. };
  43452. let selectionInitialFixed = void 0;
  43453. const updateColumns = () => {
  43454. _columns.value.forEach((column) => {
  43455. updateChildFixed(column);
  43456. });
  43457. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  43458. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  43459. if (isUndefined(selectionInitialFixed) && _columns.value[0] && _columns.value[0].type === "selection") {
  43460. selectionInitialFixed = Boolean(_columns.value[0].fixed);
  43461. }
  43462. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection") {
  43463. if (!_columns.value[0].fixed) {
  43464. _columns.value[0].fixed = true;
  43465. fixedColumns.value.unshift(_columns.value[0]);
  43466. } else {
  43467. const hasNotSelectionColumns = fixedColumns.value.some((column) => column.type !== "selection");
  43468. if (!hasNotSelectionColumns) {
  43469. _columns.value[0].fixed = selectionInitialFixed;
  43470. if (!selectionInitialFixed)
  43471. fixedColumns.value.shift();
  43472. } else {
  43473. selectionInitialFixed = void 0;
  43474. }
  43475. }
  43476. }
  43477. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  43478. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  43479. const leafColumns2 = doFlattenColumns(notFixedColumns);
  43480. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  43481. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  43482. leafColumnsLength.value = leafColumns2.length;
  43483. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  43484. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  43485. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  43486. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  43487. };
  43488. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  43489. if (needUpdateColumns) {
  43490. updateColumns();
  43491. }
  43492. if (immediate) {
  43493. instance.state.doLayout();
  43494. } else {
  43495. instance.state.debouncedUpdateLayout();
  43496. }
  43497. };
  43498. const isSelected = (row) => {
  43499. return selection.value.some((item) => isEqual$1(item, row));
  43500. };
  43501. const clearSelection = () => {
  43502. isAllSelected.value = false;
  43503. const oldSelection = selection.value;
  43504. selection.value = [];
  43505. if (oldSelection.length) {
  43506. instance.emit("selection-change", []);
  43507. }
  43508. };
  43509. const cleanSelection = () => {
  43510. let deleted;
  43511. if (rowKey.value) {
  43512. deleted = [];
  43513. const selectedMap = getKeysMap(selection.value, rowKey.value);
  43514. const dataMap = getKeysMap(data.value, rowKey.value);
  43515. for (const key in selectedMap) {
  43516. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  43517. deleted.push(selectedMap[key].row);
  43518. }
  43519. }
  43520. } else {
  43521. deleted = selection.value.filter((item) => !data.value.includes(item));
  43522. }
  43523. if (deleted.length) {
  43524. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  43525. selection.value = newSelection;
  43526. instance.emit("selection-change", newSelection.slice());
  43527. }
  43528. };
  43529. const getSelectionRows = () => {
  43530. return (selection.value || []).slice();
  43531. };
  43532. const toggleRowSelection = (row, selected, emitChange = true, ignoreSelectable = false) => {
  43533. var _a2, _b, _c, _d;
  43534. const treeProps = {
  43535. children: (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.childrenColumnName.value,
  43536. checkStrictly: (_d = (_c = instance == null ? void 0 : instance.store) == null ? void 0 : _c.states) == null ? void 0 : _d.checkStrictly.value
  43537. };
  43538. const changed = toggleRowStatus(selection.value, row, selected, treeProps, ignoreSelectable ? void 0 : selectable.value);
  43539. if (changed) {
  43540. const newSelection = (selection.value || []).slice();
  43541. if (emitChange) {
  43542. instance.emit("select", newSelection, row);
  43543. }
  43544. instance.emit("selection-change", newSelection);
  43545. }
  43546. };
  43547. const _toggleAllSelection = () => {
  43548. var _a2, _b;
  43549. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  43550. isAllSelected.value = value;
  43551. let selectionChanged = false;
  43552. let childrenCount = 0;
  43553. const rowKey2 = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.rowKey.value;
  43554. const { childrenColumnName } = instance.store.states;
  43555. const treeProps = {
  43556. children: childrenColumnName.value,
  43557. checkStrictly: false
  43558. };
  43559. data.value.forEach((row, index) => {
  43560. const rowIndex = index + childrenCount;
  43561. if (toggleRowStatus(selection.value, row, value, treeProps, selectable.value, rowIndex)) {
  43562. selectionChanged = true;
  43563. }
  43564. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  43565. });
  43566. if (selectionChanged) {
  43567. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  43568. }
  43569. instance.emit("select-all", (selection.value || []).slice());
  43570. };
  43571. const updateSelectionByRowKey = () => {
  43572. const selectedMap = getKeysMap(selection.value, rowKey.value);
  43573. data.value.forEach((row) => {
  43574. const rowId = getRowIdentity(row, rowKey.value);
  43575. const rowInfo = selectedMap[rowId];
  43576. if (rowInfo) {
  43577. selection.value[rowInfo.index] = row;
  43578. }
  43579. });
  43580. };
  43581. const updateAllSelected = () => {
  43582. var _a2;
  43583. if (((_a2 = data.value) == null ? void 0 : _a2.length) === 0) {
  43584. isAllSelected.value = false;
  43585. return;
  43586. }
  43587. const { childrenColumnName } = instance.store.states;
  43588. const selectedMap = rowKey.value ? getKeysMap(selection.value, rowKey.value) : void 0;
  43589. let rowIndex = 0;
  43590. let selectedCount = 0;
  43591. const isSelected2 = (row) => {
  43592. if (selectedMap) {
  43593. return !!selectedMap[getRowIdentity(row, rowKey.value)];
  43594. } else {
  43595. return selection.value.includes(row);
  43596. }
  43597. };
  43598. const checkSelectedStatus = (data2) => {
  43599. var _a3;
  43600. for (const row of data2) {
  43601. const isRowSelectable = selectable.value && selectable.value.call(null, row, rowIndex);
  43602. if (!isSelected2(row)) {
  43603. if (!selectable.value || isRowSelectable) {
  43604. return false;
  43605. }
  43606. } else {
  43607. selectedCount++;
  43608. }
  43609. rowIndex++;
  43610. if (((_a3 = row[childrenColumnName.value]) == null ? void 0 : _a3.length) && !checkSelectedStatus(row[childrenColumnName.value])) {
  43611. return false;
  43612. }
  43613. }
  43614. return true;
  43615. };
  43616. const isAllSelected_ = checkSelectedStatus(data.value || []);
  43617. isAllSelected.value = selectedCount === 0 ? false : isAllSelected_;
  43618. };
  43619. const getChildrenCount = (rowKey2) => {
  43620. var _a2;
  43621. if (!instance || !instance.store)
  43622. return 0;
  43623. const { treeData } = instance.store.states;
  43624. let count = 0;
  43625. const children = (_a2 = treeData.value[rowKey2]) == null ? void 0 : _a2.children;
  43626. if (children) {
  43627. count += children.length;
  43628. children.forEach((childKey) => {
  43629. count += getChildrenCount(childKey);
  43630. });
  43631. }
  43632. return count;
  43633. };
  43634. const updateFilters = (columns2, values) => {
  43635. if (!isArray$1(columns2)) {
  43636. columns2 = [columns2];
  43637. }
  43638. const filters_ = {};
  43639. columns2.forEach((col) => {
  43640. filters.value[col.id] = values;
  43641. filters_[col.columnKey || col.id] = values;
  43642. });
  43643. return filters_;
  43644. };
  43645. const updateSort = (column, prop, order) => {
  43646. if (sortingColumn.value && sortingColumn.value !== column) {
  43647. sortingColumn.value.order = null;
  43648. }
  43649. sortingColumn.value = column;
  43650. sortProp.value = prop;
  43651. sortOrder.value = order;
  43652. };
  43653. const execFilter = () => {
  43654. let sourceData = unref(_data);
  43655. Object.keys(filters.value).forEach((columnId) => {
  43656. const values = filters.value[columnId];
  43657. if (!values || values.length === 0)
  43658. return;
  43659. const column = getColumnById({
  43660. columns: columns.value
  43661. }, columnId);
  43662. if (column && column.filterMethod) {
  43663. sourceData = sourceData.filter((row) => {
  43664. return values.some((value) => column.filterMethod.call(null, value, row, column));
  43665. });
  43666. }
  43667. });
  43668. filteredData.value = sourceData;
  43669. };
  43670. const execSort = () => {
  43671. data.value = sortData(filteredData.value, {
  43672. sortingColumn: sortingColumn.value,
  43673. sortProp: sortProp.value,
  43674. sortOrder: sortOrder.value
  43675. });
  43676. };
  43677. const execQuery = (ignore = void 0) => {
  43678. if (!(ignore && ignore.filter)) {
  43679. execFilter();
  43680. }
  43681. execSort();
  43682. };
  43683. const clearFilter = (columnKeys) => {
  43684. const { tableHeaderRef } = instance.refs;
  43685. if (!tableHeaderRef)
  43686. return;
  43687. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  43688. const keys = Object.keys(panels);
  43689. if (!keys.length)
  43690. return;
  43691. if (isString$1(columnKeys)) {
  43692. columnKeys = [columnKeys];
  43693. }
  43694. if (isArray$1(columnKeys)) {
  43695. const columns_ = columnKeys.map((key) => getColumnByKey({
  43696. columns: columns.value
  43697. }, key));
  43698. keys.forEach((key) => {
  43699. const column = columns_.find((col) => col.id === key);
  43700. if (column) {
  43701. column.filteredValue = [];
  43702. }
  43703. });
  43704. instance.store.commit("filterChange", {
  43705. column: columns_,
  43706. values: [],
  43707. silent: true,
  43708. multi: true
  43709. });
  43710. } else {
  43711. keys.forEach((key) => {
  43712. const column = columns.value.find((col) => col.id === key);
  43713. if (column) {
  43714. column.filteredValue = [];
  43715. }
  43716. });
  43717. filters.value = {};
  43718. instance.store.commit("filterChange", {
  43719. column: {},
  43720. values: [],
  43721. silent: true
  43722. });
  43723. }
  43724. };
  43725. const clearSort = () => {
  43726. if (!sortingColumn.value)
  43727. return;
  43728. updateSort(null, null, null);
  43729. instance.store.commit("changeSortCondition", {
  43730. silent: true
  43731. });
  43732. };
  43733. const {
  43734. setExpandRowKeys,
  43735. toggleRowExpansion,
  43736. updateExpandRows,
  43737. states: expandStates,
  43738. isRowExpanded
  43739. } = useExpand({
  43740. data,
  43741. rowKey
  43742. });
  43743. const {
  43744. updateTreeExpandKeys,
  43745. toggleTreeExpansion,
  43746. updateTreeData,
  43747. updateKeyChildren,
  43748. loadOrToggle,
  43749. states: treeStates
  43750. } = useTree$2({
  43751. data,
  43752. rowKey
  43753. });
  43754. const {
  43755. updateCurrentRowData,
  43756. updateCurrentRow,
  43757. setCurrentRowKey,
  43758. states: currentData
  43759. } = useCurrent({
  43760. data,
  43761. rowKey
  43762. });
  43763. const setExpandRowKeysAdapter = (val) => {
  43764. setExpandRowKeys(val);
  43765. updateTreeExpandKeys(val);
  43766. };
  43767. const toggleRowExpansionAdapter = (row, expanded) => {
  43768. const hasExpandColumn = columns.value.some(({ type }) => type === "expand");
  43769. if (hasExpandColumn) {
  43770. toggleRowExpansion(row, expanded);
  43771. } else {
  43772. toggleTreeExpansion(row, expanded);
  43773. }
  43774. };
  43775. return {
  43776. assertRowKey,
  43777. updateColumns,
  43778. scheduleLayout,
  43779. isSelected,
  43780. clearSelection,
  43781. cleanSelection,
  43782. getSelectionRows,
  43783. toggleRowSelection,
  43784. _toggleAllSelection,
  43785. toggleAllSelection: null,
  43786. updateSelectionByRowKey,
  43787. updateAllSelected,
  43788. updateFilters,
  43789. updateCurrentRow,
  43790. updateSort,
  43791. execFilter,
  43792. execSort,
  43793. execQuery,
  43794. clearFilter,
  43795. clearSort,
  43796. toggleRowExpansion,
  43797. setExpandRowKeysAdapter,
  43798. setCurrentRowKey,
  43799. toggleRowExpansionAdapter,
  43800. isRowExpanded,
  43801. updateExpandRows,
  43802. updateCurrentRowData,
  43803. loadOrToggle,
  43804. updateTreeData,
  43805. updateKeyChildren,
  43806. states: {
  43807. tableSize,
  43808. rowKey,
  43809. data,
  43810. _data,
  43811. isComplex,
  43812. _columns,
  43813. originColumns,
  43814. columns,
  43815. fixedColumns,
  43816. rightFixedColumns,
  43817. leafColumns,
  43818. fixedLeafColumns,
  43819. rightFixedLeafColumns,
  43820. updateOrderFns,
  43821. leafColumnsLength,
  43822. fixedLeafColumnsLength,
  43823. rightFixedLeafColumnsLength,
  43824. isAllSelected,
  43825. selection,
  43826. reserveSelection,
  43827. selectOnIndeterminate,
  43828. selectable,
  43829. filters,
  43830. filteredData,
  43831. sortingColumn,
  43832. sortProp,
  43833. sortOrder,
  43834. hoverRow,
  43835. ...expandStates,
  43836. ...treeStates,
  43837. ...currentData
  43838. }
  43839. };
  43840. }
  43841. function replaceColumn(array, column) {
  43842. return array.map((item) => {
  43843. var _a;
  43844. if (item.id === column.id) {
  43845. return column;
  43846. } else if ((_a = item.children) == null ? void 0 : _a.length) {
  43847. item.children = replaceColumn(item.children, column);
  43848. }
  43849. return item;
  43850. });
  43851. }
  43852. function sortColumn(array) {
  43853. array.forEach((item) => {
  43854. var _a, _b;
  43855. item.no = (_a = item.getColumnIndex) == null ? void 0 : _a.call(item);
  43856. if ((_b = item.children) == null ? void 0 : _b.length) {
  43857. sortColumn(item.children);
  43858. }
  43859. });
  43860. array.sort((cur, pre) => cur.no - pre.no);
  43861. }
  43862. function useStore() {
  43863. const instance = getCurrentInstance();
  43864. const watcher = useWatcher$1();
  43865. const ns = useNamespace("table");
  43866. const mutations = {
  43867. setData(states, data) {
  43868. const dataInstanceChanged = unref(states._data) !== data;
  43869. states.data.value = data;
  43870. states._data.value = data;
  43871. instance.store.execQuery();
  43872. instance.store.updateCurrentRowData();
  43873. instance.store.updateExpandRows();
  43874. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  43875. if (unref(states.reserveSelection)) {
  43876. instance.store.assertRowKey();
  43877. instance.store.updateSelectionByRowKey();
  43878. } else {
  43879. if (dataInstanceChanged) {
  43880. instance.store.clearSelection();
  43881. } else {
  43882. instance.store.cleanSelection();
  43883. }
  43884. }
  43885. instance.store.updateAllSelected();
  43886. if (instance.$ready) {
  43887. instance.store.scheduleLayout();
  43888. }
  43889. },
  43890. insertColumn(states, column, parent, updateColumnOrder) {
  43891. const array = unref(states._columns);
  43892. let newColumns = [];
  43893. if (!parent) {
  43894. array.push(column);
  43895. newColumns = array;
  43896. } else {
  43897. if (parent && !parent.children) {
  43898. parent.children = [];
  43899. }
  43900. parent.children.push(column);
  43901. newColumns = replaceColumn(array, parent);
  43902. }
  43903. sortColumn(newColumns);
  43904. states._columns.value = newColumns;
  43905. states.updateOrderFns.push(updateColumnOrder);
  43906. if (column.type === "selection") {
  43907. states.selectable.value = column.selectable;
  43908. states.reserveSelection.value = column.reserveSelection;
  43909. }
  43910. if (instance.$ready) {
  43911. instance.store.updateColumns();
  43912. instance.store.scheduleLayout();
  43913. }
  43914. },
  43915. updateColumnOrder(states, column) {
  43916. var _a;
  43917. const newColumnIndex = (_a = column.getColumnIndex) == null ? void 0 : _a.call(column);
  43918. if (newColumnIndex === column.no)
  43919. return;
  43920. sortColumn(states._columns.value);
  43921. if (instance.$ready) {
  43922. instance.store.updateColumns();
  43923. }
  43924. },
  43925. removeColumn(states, column, parent, updateColumnOrder) {
  43926. const array = unref(states._columns) || [];
  43927. if (parent) {
  43928. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  43929. nextTick(() => {
  43930. var _a;
  43931. if (((_a = parent.children) == null ? void 0 : _a.length) === 0) {
  43932. delete parent.children;
  43933. }
  43934. });
  43935. states._columns.value = replaceColumn(array, parent);
  43936. } else {
  43937. const index = array.indexOf(column);
  43938. if (index > -1) {
  43939. array.splice(index, 1);
  43940. states._columns.value = array;
  43941. }
  43942. }
  43943. const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder);
  43944. updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1);
  43945. if (instance.$ready) {
  43946. instance.store.updateColumns();
  43947. instance.store.scheduleLayout();
  43948. }
  43949. },
  43950. sort(states, options) {
  43951. const { prop, order, init } = options;
  43952. if (prop) {
  43953. const column = unref(states.columns).find((column2) => column2.property === prop);
  43954. if (column) {
  43955. column.order = order;
  43956. instance.store.updateSort(column, prop, order);
  43957. instance.store.commit("changeSortCondition", { init });
  43958. }
  43959. }
  43960. },
  43961. changeSortCondition(states, options) {
  43962. const { sortingColumn, sortProp, sortOrder } = states;
  43963. const columnValue = unref(sortingColumn), propValue = unref(sortProp), orderValue = unref(sortOrder);
  43964. if (orderValue === null) {
  43965. states.sortingColumn.value = null;
  43966. states.sortProp.value = null;
  43967. }
  43968. const ignore = { filter: true };
  43969. instance.store.execQuery(ignore);
  43970. if (!options || !(options.silent || options.init)) {
  43971. instance.emit("sort-change", {
  43972. column: columnValue,
  43973. prop: propValue,
  43974. order: orderValue
  43975. });
  43976. }
  43977. instance.store.updateTableScrollY();
  43978. },
  43979. filterChange(_states, options) {
  43980. const { column, values, silent } = options;
  43981. const newFilters = instance.store.updateFilters(column, values);
  43982. instance.store.execQuery();
  43983. if (!silent) {
  43984. instance.emit("filter-change", newFilters);
  43985. }
  43986. instance.store.updateTableScrollY();
  43987. },
  43988. toggleAllSelection() {
  43989. instance.store.toggleAllSelection();
  43990. },
  43991. rowSelectedChanged(_states, row) {
  43992. instance.store.toggleRowSelection(row);
  43993. instance.store.updateAllSelected();
  43994. },
  43995. setHoverRow(states, row) {
  43996. states.hoverRow.value = row;
  43997. },
  43998. setCurrentRow(_states, row) {
  43999. instance.store.updateCurrentRow(row);
  44000. }
  44001. };
  44002. const commit = function(name, ...args) {
  44003. const mutations2 = instance.store.mutations;
  44004. if (mutations2[name]) {
  44005. mutations2[name].apply(instance, [instance.store.states].concat(args));
  44006. } else {
  44007. throw new Error(`Action not found: ${name}`);
  44008. }
  44009. };
  44010. const updateTableScrollY = function() {
  44011. nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  44012. };
  44013. return {
  44014. ns,
  44015. ...watcher,
  44016. mutations,
  44017. commit,
  44018. updateTableScrollY
  44019. };
  44020. }
  44021. const InitialStateMap = {
  44022. rowKey: "rowKey",
  44023. defaultExpandAll: "defaultExpandAll",
  44024. selectOnIndeterminate: "selectOnIndeterminate",
  44025. indent: "indent",
  44026. lazy: "lazy",
  44027. data: "data",
  44028. ["treeProps.hasChildren"]: {
  44029. key: "lazyColumnIdentifier",
  44030. default: "hasChildren"
  44031. },
  44032. ["treeProps.children"]: {
  44033. key: "childrenColumnName",
  44034. default: "children"
  44035. },
  44036. ["treeProps.checkStrictly"]: {
  44037. key: "checkStrictly",
  44038. default: false
  44039. }
  44040. };
  44041. function createStore(table, props) {
  44042. if (!table) {
  44043. throw new Error("Table is required.");
  44044. }
  44045. const store = useStore();
  44046. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  44047. Object.keys(InitialStateMap).forEach((key) => {
  44048. handleValue(getArrKeysValue(props, key), key, store);
  44049. });
  44050. proxyTableProps(store, props);
  44051. return store;
  44052. }
  44053. function proxyTableProps(store, props) {
  44054. Object.keys(InitialStateMap).forEach((key) => {
  44055. watch(() => getArrKeysValue(props, key), (value) => {
  44056. handleValue(value, key, store);
  44057. });
  44058. });
  44059. }
  44060. function handleValue(value, propsKey, store) {
  44061. let newVal = value;
  44062. let storeKey = InitialStateMap[propsKey];
  44063. if (typeof InitialStateMap[propsKey] === "object") {
  44064. storeKey = storeKey.key;
  44065. newVal = newVal || InitialStateMap[propsKey].default;
  44066. }
  44067. store.states[storeKey].value = newVal;
  44068. }
  44069. function getArrKeysValue(props, keys) {
  44070. if (keys.includes(".")) {
  44071. const keyList = keys.split(".");
  44072. let value = props;
  44073. keyList.forEach((key) => {
  44074. value = value[key];
  44075. });
  44076. return value;
  44077. } else {
  44078. return props[keys];
  44079. }
  44080. }
  44081. class TableLayout {
  44082. constructor(options) {
  44083. this.observers = [];
  44084. this.table = null;
  44085. this.store = null;
  44086. this.columns = [];
  44087. this.fit = true;
  44088. this.showHeader = true;
  44089. this.height = ref(null);
  44090. this.scrollX = ref(false);
  44091. this.scrollY = ref(false);
  44092. this.bodyWidth = ref(null);
  44093. this.fixedWidth = ref(null);
  44094. this.rightFixedWidth = ref(null);
  44095. this.gutterWidth = 0;
  44096. for (const name in options) {
  44097. if (hasOwn(options, name)) {
  44098. if (isRef(this[name])) {
  44099. this[name].value = options[name];
  44100. } else {
  44101. this[name] = options[name];
  44102. }
  44103. }
  44104. }
  44105. if (!this.table) {
  44106. throw new Error("Table is required for Table Layout");
  44107. }
  44108. if (!this.store) {
  44109. throw new Error("Store is required for Table Layout");
  44110. }
  44111. }
  44112. updateScrollY() {
  44113. const height = this.height.value;
  44114. if (height === null)
  44115. return false;
  44116. const scrollBarRef = this.table.refs.scrollBarRef;
  44117. if (this.table.vnode.el && (scrollBarRef == null ? void 0 : scrollBarRef.wrapRef)) {
  44118. let scrollY = true;
  44119. const prevScrollY = this.scrollY.value;
  44120. scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
  44121. this.scrollY.value = scrollY;
  44122. return prevScrollY !== scrollY;
  44123. }
  44124. return false;
  44125. }
  44126. setHeight(value, prop = "height") {
  44127. if (!isClient)
  44128. return;
  44129. const el = this.table.vnode.el;
  44130. value = parseHeight(value);
  44131. this.height.value = Number(value);
  44132. if (!el && (value || value === 0))
  44133. return nextTick(() => this.setHeight(value, prop));
  44134. if (isNumber(value)) {
  44135. el.style[prop] = `${value}px`;
  44136. this.updateElsHeight();
  44137. } else if (isString$1(value)) {
  44138. el.style[prop] = value;
  44139. this.updateElsHeight();
  44140. }
  44141. }
  44142. setMaxHeight(value) {
  44143. this.setHeight(value, "max-height");
  44144. }
  44145. getFlattenColumns() {
  44146. const flattenColumns = [];
  44147. const columns = this.table.store.states.columns.value;
  44148. columns.forEach((column) => {
  44149. if (column.isColumnGroup) {
  44150. flattenColumns.push.apply(flattenColumns, column.columns);
  44151. } else {
  44152. flattenColumns.push(column);
  44153. }
  44154. });
  44155. return flattenColumns;
  44156. }
  44157. updateElsHeight() {
  44158. this.updateScrollY();
  44159. this.notifyObservers("scrollable");
  44160. }
  44161. headerDisplayNone(elm) {
  44162. if (!elm)
  44163. return true;
  44164. let headerChild = elm;
  44165. while (headerChild.tagName !== "DIV") {
  44166. if (getComputedStyle(headerChild).display === "none") {
  44167. return true;
  44168. }
  44169. headerChild = headerChild.parentElement;
  44170. }
  44171. return false;
  44172. }
  44173. updateColumnsWidth() {
  44174. if (!isClient)
  44175. return;
  44176. const fit = this.fit;
  44177. const bodyWidth = this.table.vnode.el.clientWidth;
  44178. let bodyMinWidth = 0;
  44179. const flattenColumns = this.getFlattenColumns();
  44180. const flexColumns = flattenColumns.filter((column) => !isNumber(column.width));
  44181. flattenColumns.forEach((column) => {
  44182. if (isNumber(column.width) && column.realWidth)
  44183. column.realWidth = null;
  44184. });
  44185. if (flexColumns.length > 0 && fit) {
  44186. flattenColumns.forEach((column) => {
  44187. bodyMinWidth += Number(column.width || column.minWidth || 80);
  44188. });
  44189. if (bodyMinWidth <= bodyWidth) {
  44190. this.scrollX.value = false;
  44191. const totalFlexWidth = bodyWidth - bodyMinWidth;
  44192. if (flexColumns.length === 1) {
  44193. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  44194. } else {
  44195. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  44196. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  44197. let noneFirstWidth = 0;
  44198. flexColumns.forEach((column, index) => {
  44199. if (index === 0)
  44200. return;
  44201. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  44202. noneFirstWidth += flexWidth;
  44203. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  44204. });
  44205. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  44206. }
  44207. } else {
  44208. this.scrollX.value = true;
  44209. flexColumns.forEach((column) => {
  44210. column.realWidth = Number(column.minWidth);
  44211. });
  44212. }
  44213. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  44214. this.table.state.resizeState.value.width = this.bodyWidth.value;
  44215. } else {
  44216. flattenColumns.forEach((column) => {
  44217. if (!column.width && !column.minWidth) {
  44218. column.realWidth = 80;
  44219. } else {
  44220. column.realWidth = Number(column.width || column.minWidth);
  44221. }
  44222. bodyMinWidth += column.realWidth;
  44223. });
  44224. this.scrollX.value = bodyMinWidth > bodyWidth;
  44225. this.bodyWidth.value = bodyMinWidth;
  44226. }
  44227. const fixedColumns = this.store.states.fixedColumns.value;
  44228. if (fixedColumns.length > 0) {
  44229. let fixedWidth = 0;
  44230. fixedColumns.forEach((column) => {
  44231. fixedWidth += Number(column.realWidth || column.width);
  44232. });
  44233. this.fixedWidth.value = fixedWidth;
  44234. }
  44235. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  44236. if (rightFixedColumns.length > 0) {
  44237. let rightFixedWidth = 0;
  44238. rightFixedColumns.forEach((column) => {
  44239. rightFixedWidth += Number(column.realWidth || column.width);
  44240. });
  44241. this.rightFixedWidth.value = rightFixedWidth;
  44242. }
  44243. this.notifyObservers("columns");
  44244. }
  44245. addObserver(observer) {
  44246. this.observers.push(observer);
  44247. }
  44248. removeObserver(observer) {
  44249. const index = this.observers.indexOf(observer);
  44250. if (index !== -1) {
  44251. this.observers.splice(index, 1);
  44252. }
  44253. }
  44254. notifyObservers(event) {
  44255. const observers = this.observers;
  44256. observers.forEach((observer) => {
  44257. var _a, _b;
  44258. switch (event) {
  44259. case "columns":
  44260. (_a = observer.state) == null ? void 0 : _a.onColumnsChange(this);
  44261. break;
  44262. case "scrollable":
  44263. (_b = observer.state) == null ? void 0 : _b.onScrollableChange(this);
  44264. break;
  44265. default:
  44266. throw new Error(`Table Layout don't have event ${event}.`);
  44267. }
  44268. });
  44269. }
  44270. }
  44271. var TableLayout$1 = TableLayout;
  44272. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  44273. const _sfc_main$C = defineComponent({
  44274. name: "ElTableFilterPanel",
  44275. components: {
  44276. ElCheckbox,
  44277. ElCheckboxGroup,
  44278. ElScrollbar,
  44279. ElTooltip,
  44280. ElIcon,
  44281. ArrowDown: arrow_down_default,
  44282. ArrowUp: arrow_up_default
  44283. },
  44284. directives: { ClickOutside },
  44285. props: {
  44286. placement: {
  44287. type: String,
  44288. default: "bottom-start"
  44289. },
  44290. store: {
  44291. type: Object
  44292. },
  44293. column: {
  44294. type: Object
  44295. },
  44296. upDataColumn: {
  44297. type: Function
  44298. },
  44299. appendTo: {
  44300. type: String
  44301. }
  44302. },
  44303. setup(props) {
  44304. const instance = getCurrentInstance();
  44305. const { t } = useLocale();
  44306. const ns = useNamespace("table-filter");
  44307. const parent = instance == null ? void 0 : instance.parent;
  44308. if (!parent.filterPanels.value[props.column.id]) {
  44309. parent.filterPanels.value[props.column.id] = instance;
  44310. }
  44311. const tooltipVisible = ref(false);
  44312. const tooltip = ref(null);
  44313. const filters = computed(() => {
  44314. return props.column && props.column.filters;
  44315. });
  44316. const filterClassName = computed(() => {
  44317. if (props.column.filterClassName) {
  44318. return `${ns.b()} ${props.column.filterClassName}`;
  44319. }
  44320. return ns.b();
  44321. });
  44322. const filterValue = computed({
  44323. get: () => {
  44324. var _a;
  44325. return (((_a = props.column) == null ? void 0 : _a.filteredValue) || [])[0];
  44326. },
  44327. set: (value) => {
  44328. if (filteredValue.value) {
  44329. if (typeof value !== "undefined" && value !== null) {
  44330. filteredValue.value.splice(0, 1, value);
  44331. } else {
  44332. filteredValue.value.splice(0, 1);
  44333. }
  44334. }
  44335. }
  44336. });
  44337. const filteredValue = computed({
  44338. get() {
  44339. if (props.column) {
  44340. return props.column.filteredValue || [];
  44341. }
  44342. return [];
  44343. },
  44344. set(value) {
  44345. if (props.column) {
  44346. props.upDataColumn("filteredValue", value);
  44347. }
  44348. }
  44349. });
  44350. const multiple = computed(() => {
  44351. if (props.column) {
  44352. return props.column.filterMultiple;
  44353. }
  44354. return true;
  44355. });
  44356. const isActive = (filter) => {
  44357. return filter.value === filterValue.value;
  44358. };
  44359. const hidden = () => {
  44360. tooltipVisible.value = false;
  44361. };
  44362. const showFilterPanel = (e) => {
  44363. e.stopPropagation();
  44364. tooltipVisible.value = !tooltipVisible.value;
  44365. };
  44366. const hideFilterPanel = () => {
  44367. tooltipVisible.value = false;
  44368. };
  44369. const handleConfirm = () => {
  44370. confirmFilter(filteredValue.value);
  44371. hidden();
  44372. };
  44373. const handleReset = () => {
  44374. filteredValue.value = [];
  44375. confirmFilter(filteredValue.value);
  44376. hidden();
  44377. };
  44378. const handleSelect = (_filterValue) => {
  44379. filterValue.value = _filterValue;
  44380. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  44381. confirmFilter(filteredValue.value);
  44382. } else {
  44383. confirmFilter([]);
  44384. }
  44385. hidden();
  44386. };
  44387. const confirmFilter = (filteredValue2) => {
  44388. props.store.commit("filterChange", {
  44389. column: props.column,
  44390. values: filteredValue2
  44391. });
  44392. props.store.updateAllSelected();
  44393. };
  44394. watch(tooltipVisible, (value) => {
  44395. if (props.column) {
  44396. props.upDataColumn("filterOpened", value);
  44397. }
  44398. }, {
  44399. immediate: true
  44400. });
  44401. const popperPaneRef = computed(() => {
  44402. var _a, _b;
  44403. return (_b = (_a = tooltip.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  44404. });
  44405. return {
  44406. tooltipVisible,
  44407. multiple,
  44408. filterClassName,
  44409. filteredValue,
  44410. filterValue,
  44411. filters,
  44412. handleConfirm,
  44413. handleReset,
  44414. handleSelect,
  44415. isActive,
  44416. t,
  44417. ns,
  44418. showFilterPanel,
  44419. hideFilterPanel,
  44420. popperPaneRef,
  44421. tooltip
  44422. };
  44423. }
  44424. });
  44425. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  44426. const _component_el_checkbox = resolveComponent("el-checkbox");
  44427. const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
  44428. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  44429. const _component_arrow_up = resolveComponent("arrow-up");
  44430. const _component_arrow_down = resolveComponent("arrow-down");
  44431. const _component_el_icon = resolveComponent("el-icon");
  44432. const _component_el_tooltip = resolveComponent("el-tooltip");
  44433. const _directive_click_outside = resolveDirective("click-outside");
  44434. return openBlock(), createBlock(_component_el_tooltip, {
  44435. ref: "tooltip",
  44436. visible: _ctx.tooltipVisible,
  44437. offset: 0,
  44438. placement: _ctx.placement,
  44439. "show-arrow": false,
  44440. "stop-popper-mouse-event": false,
  44441. teleported: "",
  44442. effect: "light",
  44443. pure: "",
  44444. "popper-class": _ctx.filterClassName,
  44445. persistent: "",
  44446. "append-to": _ctx.appendTo
  44447. }, {
  44448. content: withCtx(() => [
  44449. _ctx.multiple ? (openBlock(), createElementBlock("div", { key: 0 }, [
  44450. createElementVNode("div", {
  44451. class: normalizeClass(_ctx.ns.e("content"))
  44452. }, [
  44453. createVNode(_component_el_scrollbar, {
  44454. "wrap-class": _ctx.ns.e("wrap")
  44455. }, {
  44456. default: withCtx(() => [
  44457. createVNode(_component_el_checkbox_group, {
  44458. modelValue: _ctx.filteredValue,
  44459. "onUpdate:modelValue": ($event) => _ctx.filteredValue = $event,
  44460. class: normalizeClass(_ctx.ns.e("checkbox-group"))
  44461. }, {
  44462. default: withCtx(() => [
  44463. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  44464. return openBlock(), createBlock(_component_el_checkbox, {
  44465. key: filter.value,
  44466. value: filter.value
  44467. }, {
  44468. default: withCtx(() => [
  44469. createTextVNode(toDisplayString(filter.text), 1)
  44470. ]),
  44471. _: 2
  44472. }, 1032, ["value"]);
  44473. }), 128))
  44474. ]),
  44475. _: 1
  44476. }, 8, ["modelValue", "onUpdate:modelValue", "class"])
  44477. ]),
  44478. _: 1
  44479. }, 8, ["wrap-class"])
  44480. ], 2),
  44481. createElementVNode("div", {
  44482. class: normalizeClass(_ctx.ns.e("bottom"))
  44483. }, [
  44484. createElementVNode("button", {
  44485. class: normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  44486. disabled: _ctx.filteredValue.length === 0,
  44487. type: "button",
  44488. onClick: _ctx.handleConfirm
  44489. }, toDisplayString(_ctx.t("el.table.confirmFilter")), 11, ["disabled", "onClick"]),
  44490. createElementVNode("button", {
  44491. type: "button",
  44492. onClick: _ctx.handleReset
  44493. }, toDisplayString(_ctx.t("el.table.resetFilter")), 9, ["onClick"])
  44494. ], 2)
  44495. ])) : (openBlock(), createElementBlock("ul", {
  44496. key: 1,
  44497. class: normalizeClass(_ctx.ns.e("list"))
  44498. }, [
  44499. createElementVNode("li", {
  44500. class: normalizeClass([
  44501. _ctx.ns.e("list-item"),
  44502. {
  44503. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  44504. }
  44505. ]),
  44506. onClick: ($event) => _ctx.handleSelect(null)
  44507. }, toDisplayString(_ctx.t("el.table.clearFilter")), 11, ["onClick"]),
  44508. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  44509. return openBlock(), createElementBlock("li", {
  44510. key: filter.value,
  44511. class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  44512. label: filter.value,
  44513. onClick: ($event) => _ctx.handleSelect(filter.value)
  44514. }, toDisplayString(filter.text), 11, ["label", "onClick"]);
  44515. }), 128))
  44516. ], 2))
  44517. ]),
  44518. default: withCtx(() => [
  44519. withDirectives((openBlock(), createElementBlock("span", {
  44520. class: normalizeClass([
  44521. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  44522. `${_ctx.ns.namespace.value}-none-outline`
  44523. ]),
  44524. onClick: _ctx.showFilterPanel
  44525. }, [
  44526. createVNode(_component_el_icon, null, {
  44527. default: withCtx(() => [
  44528. renderSlot(_ctx.$slots, "filter-icon", {}, () => [
  44529. _ctx.column.filterOpened ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_arrow_down, { key: 1 }))
  44530. ])
  44531. ]),
  44532. _: 3
  44533. })
  44534. ], 10, ["onClick"])), [
  44535. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  44536. ])
  44537. ]),
  44538. _: 3
  44539. }, 8, ["visible", "placement", "popper-class", "append-to"]);
  44540. }
  44541. var FilterPanel = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["render", _sfc_render$4], ["__file", "filter-panel.vue"]]);
  44542. function useLayoutObserver(root) {
  44543. const instance = getCurrentInstance();
  44544. onBeforeMount(() => {
  44545. tableLayout.value.addObserver(instance);
  44546. });
  44547. onMounted(() => {
  44548. onColumnsChange(tableLayout.value);
  44549. onScrollableChange(tableLayout.value);
  44550. });
  44551. onUpdated(() => {
  44552. onColumnsChange(tableLayout.value);
  44553. onScrollableChange(tableLayout.value);
  44554. });
  44555. onUnmounted(() => {
  44556. tableLayout.value.removeObserver(instance);
  44557. });
  44558. const tableLayout = computed(() => {
  44559. const layout = root.layout;
  44560. if (!layout) {
  44561. throw new Error("Can not find table layout.");
  44562. }
  44563. return layout;
  44564. });
  44565. const onColumnsChange = (layout) => {
  44566. var _a;
  44567. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col")) || [];
  44568. if (!cols.length)
  44569. return;
  44570. const flattenColumns = layout.getFlattenColumns();
  44571. const columnsMap = {};
  44572. flattenColumns.forEach((column) => {
  44573. columnsMap[column.id] = column;
  44574. });
  44575. for (let i = 0, j = cols.length; i < j; i++) {
  44576. const col = cols[i];
  44577. const name = col.getAttribute("name");
  44578. const column = columnsMap[name];
  44579. if (column) {
  44580. col.setAttribute("width", column.realWidth || column.width);
  44581. }
  44582. }
  44583. };
  44584. const onScrollableChange = (layout) => {
  44585. var _a, _b;
  44586. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col[name=gutter]")) || [];
  44587. for (let i = 0, j = cols.length; i < j; i++) {
  44588. const col = cols[i];
  44589. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  44590. }
  44591. const ths = ((_b = root.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || [];
  44592. for (let i = 0, j = ths.length; i < j; i++) {
  44593. const th = ths[i];
  44594. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  44595. th.style.display = layout.scrollY.value ? "" : "none";
  44596. }
  44597. };
  44598. return {
  44599. tableLayout: tableLayout.value,
  44600. onColumnsChange,
  44601. onScrollableChange
  44602. };
  44603. }
  44604. const TABLE_INJECTION_KEY = Symbol("ElTable");
  44605. function useEvent(props, emit) {
  44606. const instance = getCurrentInstance();
  44607. const parent = inject(TABLE_INJECTION_KEY);
  44608. const handleFilterClick = (event) => {
  44609. event.stopPropagation();
  44610. return;
  44611. };
  44612. const handleHeaderClick = (event, column) => {
  44613. if (!column.filters && column.sortable) {
  44614. handleSortClick(event, column, false);
  44615. } else if (column.filterable && !column.sortable) {
  44616. handleFilterClick(event);
  44617. }
  44618. parent == null ? void 0 : parent.emit("header-click", column, event);
  44619. };
  44620. const handleHeaderContextMenu = (event, column) => {
  44621. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  44622. };
  44623. const draggingColumn = ref(null);
  44624. const dragging = ref(false);
  44625. const dragState = ref({});
  44626. const handleMouseDown = (event, column) => {
  44627. if (!isClient)
  44628. return;
  44629. if (column.children && column.children.length > 0)
  44630. return;
  44631. if (draggingColumn.value && props.border) {
  44632. dragging.value = true;
  44633. const table = parent;
  44634. emit("set-drag-visible", true);
  44635. const tableEl = table == null ? void 0 : table.vnode.el;
  44636. const tableLeft = tableEl.getBoundingClientRect().left;
  44637. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  44638. const columnRect = columnEl.getBoundingClientRect();
  44639. const minLeft = columnRect.left - tableLeft + 30;
  44640. addClass(columnEl, "noclick");
  44641. dragState.value = {
  44642. startMouseLeft: event.clientX,
  44643. startLeft: columnRect.right - tableLeft,
  44644. startColumnLeft: columnRect.left - tableLeft,
  44645. tableLeft
  44646. };
  44647. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  44648. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  44649. document.onselectstart = function() {
  44650. return false;
  44651. };
  44652. document.ondragstart = function() {
  44653. return false;
  44654. };
  44655. const handleMouseMove2 = (event2) => {
  44656. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  44657. const proxyLeft = dragState.value.startLeft + deltaLeft;
  44658. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  44659. };
  44660. const handleMouseUp = () => {
  44661. if (dragging.value) {
  44662. const { startColumnLeft, startLeft } = dragState.value;
  44663. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  44664. const columnWidth = finalLeft - startColumnLeft;
  44665. column.width = column.realWidth = columnWidth;
  44666. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  44667. requestAnimationFrame(() => {
  44668. props.store.scheduleLayout(false, true);
  44669. });
  44670. document.body.style.cursor = "";
  44671. dragging.value = false;
  44672. draggingColumn.value = null;
  44673. dragState.value = {};
  44674. emit("set-drag-visible", false);
  44675. }
  44676. document.removeEventListener("mousemove", handleMouseMove2);
  44677. document.removeEventListener("mouseup", handleMouseUp);
  44678. document.onselectstart = null;
  44679. document.ondragstart = null;
  44680. setTimeout(() => {
  44681. removeClass(columnEl, "noclick");
  44682. }, 0);
  44683. };
  44684. document.addEventListener("mousemove", handleMouseMove2);
  44685. document.addEventListener("mouseup", handleMouseUp);
  44686. }
  44687. };
  44688. const handleMouseMove = (event, column) => {
  44689. var _a;
  44690. if (column.children && column.children.length > 0)
  44691. return;
  44692. const el = event.target;
  44693. if (!isElement$1(el)) {
  44694. return;
  44695. }
  44696. const target = el == null ? void 0 : el.closest("th");
  44697. if (!column || !column.resizable || !target)
  44698. return;
  44699. if (!dragging.value && props.border) {
  44700. const rect = target.getBoundingClientRect();
  44701. const bodyStyle = document.body.style;
  44702. const isLastTh = ((_a = target.parentNode) == null ? void 0 : _a.lastElementChild) === target;
  44703. if (rect.width > 12 && rect.right - event.pageX < 8 && !isLastTh) {
  44704. bodyStyle.cursor = "col-resize";
  44705. if (hasClass(target, "is-sortable")) {
  44706. target.style.cursor = "col-resize";
  44707. }
  44708. draggingColumn.value = column;
  44709. } else if (!dragging.value) {
  44710. bodyStyle.cursor = "";
  44711. if (hasClass(target, "is-sortable")) {
  44712. target.style.cursor = "pointer";
  44713. }
  44714. draggingColumn.value = null;
  44715. }
  44716. }
  44717. };
  44718. const handleMouseOut = () => {
  44719. if (!isClient)
  44720. return;
  44721. document.body.style.cursor = "";
  44722. };
  44723. const toggleOrder = ({ order, sortOrders }) => {
  44724. if (order === "")
  44725. return sortOrders[0];
  44726. const index = sortOrders.indexOf(order || null);
  44727. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  44728. };
  44729. const handleSortClick = (event, column, givenOrder) => {
  44730. var _a;
  44731. event.stopPropagation();
  44732. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  44733. const target = (_a = event.target) == null ? void 0 : _a.closest("th");
  44734. if (target) {
  44735. if (hasClass(target, "noclick")) {
  44736. removeClass(target, "noclick");
  44737. return;
  44738. }
  44739. }
  44740. if (!column.sortable)
  44741. return;
  44742. const clickTarget = event.currentTarget;
  44743. if (["ascending", "descending"].some((str) => hasClass(clickTarget, str) && !column.sortOrders.includes(str))) {
  44744. return;
  44745. }
  44746. const states = props.store.states;
  44747. let sortProp = states.sortProp.value;
  44748. let sortOrder;
  44749. const sortingColumn = states.sortingColumn.value;
  44750. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  44751. if (sortingColumn) {
  44752. sortingColumn.order = null;
  44753. }
  44754. states.sortingColumn.value = column;
  44755. sortProp = column.property;
  44756. }
  44757. if (!order) {
  44758. sortOrder = column.order = null;
  44759. } else {
  44760. sortOrder = column.order = order;
  44761. }
  44762. states.sortProp.value = sortProp;
  44763. states.sortOrder.value = sortOrder;
  44764. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  44765. };
  44766. return {
  44767. handleHeaderClick,
  44768. handleHeaderContextMenu,
  44769. handleMouseDown,
  44770. handleMouseMove,
  44771. handleMouseOut,
  44772. handleSortClick,
  44773. handleFilterClick
  44774. };
  44775. }
  44776. function useStyle$2(props) {
  44777. const parent = inject(TABLE_INJECTION_KEY);
  44778. const ns = useNamespace("table");
  44779. const getHeaderRowStyle = (rowIndex) => {
  44780. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  44781. if (isFunction$1(headerRowStyle)) {
  44782. return headerRowStyle.call(null, { rowIndex });
  44783. }
  44784. return headerRowStyle;
  44785. };
  44786. const getHeaderRowClass = (rowIndex) => {
  44787. const classes = [];
  44788. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  44789. if (isString$1(headerRowClassName)) {
  44790. classes.push(headerRowClassName);
  44791. } else if (isFunction$1(headerRowClassName)) {
  44792. classes.push(headerRowClassName.call(null, { rowIndex }));
  44793. }
  44794. return classes.join(" ");
  44795. };
  44796. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  44797. var _a;
  44798. let headerCellStyles = (_a = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a : {};
  44799. if (isFunction$1(headerCellStyles)) {
  44800. headerCellStyles = headerCellStyles.call(null, {
  44801. rowIndex,
  44802. columnIndex,
  44803. row,
  44804. column
  44805. });
  44806. }
  44807. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  44808. ensurePosition(fixedStyle, "left");
  44809. ensurePosition(fixedStyle, "right");
  44810. return Object.assign({}, headerCellStyles, fixedStyle);
  44811. };
  44812. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  44813. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  44814. const classes = [
  44815. column.id,
  44816. column.order,
  44817. column.headerAlign,
  44818. column.className,
  44819. column.labelClassName,
  44820. ...fixedClasses
  44821. ];
  44822. if (!column.children) {
  44823. classes.push("is-leaf");
  44824. }
  44825. if (column.sortable) {
  44826. classes.push("is-sortable");
  44827. }
  44828. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  44829. if (isString$1(headerCellClassName)) {
  44830. classes.push(headerCellClassName);
  44831. } else if (isFunction$1(headerCellClassName)) {
  44832. classes.push(headerCellClassName.call(null, {
  44833. rowIndex,
  44834. columnIndex,
  44835. row,
  44836. column
  44837. }));
  44838. }
  44839. classes.push(ns.e("cell"));
  44840. return classes.filter((className) => Boolean(className)).join(" ");
  44841. };
  44842. return {
  44843. getHeaderRowStyle,
  44844. getHeaderRowClass,
  44845. getHeaderCellStyle,
  44846. getHeaderCellClass
  44847. };
  44848. }
  44849. const getAllColumns = (columns) => {
  44850. const result = [];
  44851. columns.forEach((column) => {
  44852. if (column.children) {
  44853. result.push(column);
  44854. result.push.apply(result, getAllColumns(column.children));
  44855. } else {
  44856. result.push(column);
  44857. }
  44858. });
  44859. return result;
  44860. };
  44861. const convertToRows = (originColumns) => {
  44862. let maxLevel = 1;
  44863. const traverse = (column, parent) => {
  44864. if (parent) {
  44865. column.level = parent.level + 1;
  44866. if (maxLevel < column.level) {
  44867. maxLevel = column.level;
  44868. }
  44869. }
  44870. if (column.children) {
  44871. let colSpan = 0;
  44872. column.children.forEach((subColumn) => {
  44873. traverse(subColumn, column);
  44874. colSpan += subColumn.colSpan;
  44875. });
  44876. column.colSpan = colSpan;
  44877. } else {
  44878. column.colSpan = 1;
  44879. }
  44880. };
  44881. originColumns.forEach((column) => {
  44882. column.level = 1;
  44883. traverse(column, void 0);
  44884. });
  44885. const rows = [];
  44886. for (let i = 0; i < maxLevel; i++) {
  44887. rows.push([]);
  44888. }
  44889. const allColumns = getAllColumns(originColumns);
  44890. allColumns.forEach((column) => {
  44891. if (!column.children) {
  44892. column.rowSpan = maxLevel - column.level + 1;
  44893. } else {
  44894. column.rowSpan = 1;
  44895. column.children.forEach((col) => col.isSubColumn = true);
  44896. }
  44897. rows[column.level - 1].push(column);
  44898. });
  44899. return rows;
  44900. };
  44901. function useUtils$1(props) {
  44902. const parent = inject(TABLE_INJECTION_KEY);
  44903. const columnRows = computed(() => {
  44904. return convertToRows(props.store.states.originColumns.value);
  44905. });
  44906. const isGroup = computed(() => {
  44907. const result = columnRows.value.length > 1;
  44908. if (result && parent) {
  44909. parent.state.isGroup.value = true;
  44910. }
  44911. return result;
  44912. });
  44913. const toggleAllSelection = (event) => {
  44914. event.stopPropagation();
  44915. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  44916. };
  44917. return {
  44918. isGroup,
  44919. toggleAllSelection,
  44920. columnRows
  44921. };
  44922. }
  44923. var TableHeader = defineComponent({
  44924. name: "ElTableHeader",
  44925. components: {
  44926. ElCheckbox
  44927. },
  44928. props: {
  44929. fixed: {
  44930. type: String,
  44931. default: ""
  44932. },
  44933. store: {
  44934. required: true,
  44935. type: Object
  44936. },
  44937. border: Boolean,
  44938. defaultSort: {
  44939. type: Object,
  44940. default: () => {
  44941. return {
  44942. prop: "",
  44943. order: ""
  44944. };
  44945. }
  44946. },
  44947. appendFilterPanelTo: {
  44948. type: String
  44949. }
  44950. },
  44951. setup(props, { emit }) {
  44952. const instance = getCurrentInstance();
  44953. const parent = inject(TABLE_INJECTION_KEY);
  44954. const ns = useNamespace("table");
  44955. const filterPanels = ref({});
  44956. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  44957. const isTableLayoutAuto = (parent == null ? void 0 : parent.props.tableLayout) === "auto";
  44958. const saveIndexSelection = reactive(/* @__PURE__ */ new Map());
  44959. const theadRef = ref();
  44960. const updateFixedColumnStyle = () => {
  44961. setTimeout(() => {
  44962. if (saveIndexSelection.size > 0) {
  44963. saveIndexSelection.forEach((column, key) => {
  44964. const el = theadRef.value.querySelector(`.${key.replace(/\s/g, ".")}`);
  44965. if (el) {
  44966. const width = el.getBoundingClientRect().width;
  44967. column.width = width;
  44968. }
  44969. });
  44970. saveIndexSelection.clear();
  44971. }
  44972. });
  44973. };
  44974. watch(saveIndexSelection, updateFixedColumnStyle);
  44975. onMounted(async () => {
  44976. await nextTick();
  44977. await nextTick();
  44978. const { prop, order } = props.defaultSort;
  44979. parent == null ? void 0 : parent.store.commit("sort", { prop, order, init: true });
  44980. updateFixedColumnStyle();
  44981. });
  44982. const {
  44983. handleHeaderClick,
  44984. handleHeaderContextMenu,
  44985. handleMouseDown,
  44986. handleMouseMove,
  44987. handleMouseOut,
  44988. handleSortClick,
  44989. handleFilterClick
  44990. } = useEvent(props, emit);
  44991. const {
  44992. getHeaderRowStyle,
  44993. getHeaderRowClass,
  44994. getHeaderCellStyle,
  44995. getHeaderCellClass
  44996. } = useStyle$2(props);
  44997. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  44998. instance.state = {
  44999. onColumnsChange,
  45000. onScrollableChange
  45001. };
  45002. instance.filterPanels = filterPanels;
  45003. return {
  45004. ns,
  45005. filterPanels,
  45006. onColumnsChange,
  45007. onScrollableChange,
  45008. columnRows,
  45009. getHeaderRowClass,
  45010. getHeaderRowStyle,
  45011. getHeaderCellClass,
  45012. getHeaderCellStyle,
  45013. handleHeaderClick,
  45014. handleHeaderContextMenu,
  45015. handleMouseDown,
  45016. handleMouseMove,
  45017. handleMouseOut,
  45018. handleSortClick,
  45019. handleFilterClick,
  45020. isGroup,
  45021. toggleAllSelection,
  45022. saveIndexSelection,
  45023. isTableLayoutAuto,
  45024. theadRef,
  45025. updateFixedColumnStyle
  45026. };
  45027. },
  45028. render() {
  45029. const {
  45030. ns,
  45031. isGroup,
  45032. columnRows,
  45033. getHeaderCellStyle,
  45034. getHeaderCellClass,
  45035. getHeaderRowClass,
  45036. getHeaderRowStyle,
  45037. handleHeaderClick,
  45038. handleHeaderContextMenu,
  45039. handleMouseDown,
  45040. handleMouseMove,
  45041. handleSortClick,
  45042. handleMouseOut,
  45043. store,
  45044. $parent,
  45045. saveIndexSelection,
  45046. isTableLayoutAuto
  45047. } = this;
  45048. let rowSpan = 1;
  45049. return h$1("thead", {
  45050. ref: "theadRef",
  45051. class: { [ns.is("group")]: isGroup }
  45052. }, columnRows.map((subColumns, rowIndex) => h$1("tr", {
  45053. class: getHeaderRowClass(rowIndex),
  45054. key: rowIndex,
  45055. style: getHeaderRowStyle(rowIndex)
  45056. }, subColumns.map((column, cellIndex) => {
  45057. if (column.rowSpan > rowSpan) {
  45058. rowSpan = column.rowSpan;
  45059. }
  45060. const _class = getHeaderCellClass(rowIndex, cellIndex, subColumns, column);
  45061. if (isTableLayoutAuto && column.fixed) {
  45062. saveIndexSelection.set(_class, column);
  45063. }
  45064. return h$1("th", {
  45065. class: _class,
  45066. colspan: column.colSpan,
  45067. key: `${column.id}-thead`,
  45068. rowspan: column.rowSpan,
  45069. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  45070. onClick: ($event) => {
  45071. if ($event.currentTarget.classList.contains("noclick")) {
  45072. return;
  45073. }
  45074. handleHeaderClick($event, column);
  45075. },
  45076. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  45077. onMousedown: ($event) => handleMouseDown($event, column),
  45078. onMousemove: ($event) => handleMouseMove($event, column),
  45079. onMouseout: handleMouseOut
  45080. }, [
  45081. h$1("div", {
  45082. class: [
  45083. "cell",
  45084. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""
  45085. ]
  45086. }, [
  45087. column.renderHeader ? column.renderHeader({
  45088. column,
  45089. $index: cellIndex,
  45090. store,
  45091. _self: $parent
  45092. }) : column.label,
  45093. column.sortable && h$1("span", {
  45094. onClick: ($event) => handleSortClick($event, column),
  45095. class: "caret-wrapper"
  45096. }, [
  45097. h$1("i", {
  45098. onClick: ($event) => handleSortClick($event, column, "ascending"),
  45099. class: "sort-caret ascending"
  45100. }),
  45101. h$1("i", {
  45102. onClick: ($event) => handleSortClick($event, column, "descending"),
  45103. class: "sort-caret descending"
  45104. })
  45105. ]),
  45106. column.filterable && h$1(FilterPanel, {
  45107. store,
  45108. placement: column.filterPlacement || "bottom-start",
  45109. appendTo: $parent.appendFilterPanelTo,
  45110. column,
  45111. upDataColumn: (key, value) => {
  45112. column[key] = value;
  45113. }
  45114. }, {
  45115. "filter-icon": () => column.renderFilterIcon ? column.renderFilterIcon({
  45116. filterOpened: column.filterOpened
  45117. }) : null
  45118. })
  45119. ])
  45120. ]);
  45121. }))));
  45122. }
  45123. });
  45124. function isGreaterThan(a, b, epsilon = 0.03) {
  45125. return a - b > epsilon;
  45126. }
  45127. function useEvents(props) {
  45128. const parent = inject(TABLE_INJECTION_KEY);
  45129. const tooltipContent = ref("");
  45130. const tooltipTrigger = ref(h$1("div"));
  45131. const handleEvent = (event, row, name) => {
  45132. var _a;
  45133. const table = parent;
  45134. const cell = getCell(event);
  45135. let column;
  45136. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  45137. if (cell) {
  45138. column = getColumnByCell({
  45139. columns: props.store.states.columns.value
  45140. }, cell, namespace);
  45141. if (column) {
  45142. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  45143. }
  45144. }
  45145. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  45146. };
  45147. const handleDoubleClick = (event, row) => {
  45148. handleEvent(event, row, "dblclick");
  45149. };
  45150. const handleClick = (event, row) => {
  45151. props.store.commit("setCurrentRow", row);
  45152. handleEvent(event, row, "click");
  45153. };
  45154. const handleContextMenu = (event, row) => {
  45155. handleEvent(event, row, "contextmenu");
  45156. };
  45157. const handleMouseEnter = debounce((index) => {
  45158. props.store.commit("setHoverRow", index);
  45159. }, 30);
  45160. const handleMouseLeave = debounce(() => {
  45161. props.store.commit("setHoverRow", null);
  45162. }, 30);
  45163. const getPadding = (el) => {
  45164. const style = window.getComputedStyle(el, null);
  45165. const paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
  45166. const paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
  45167. const paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
  45168. const paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
  45169. return {
  45170. left: paddingLeft,
  45171. right: paddingRight,
  45172. top: paddingTop,
  45173. bottom: paddingBottom
  45174. };
  45175. };
  45176. const toggleRowClassByCell = (rowSpan, event, toggle) => {
  45177. let node = event.target.parentNode;
  45178. while (rowSpan > 1) {
  45179. node = node == null ? void 0 : node.nextSibling;
  45180. if (!node || node.nodeName !== "TR")
  45181. break;
  45182. toggle(node, "hover-row hover-fixed-row");
  45183. rowSpan--;
  45184. }
  45185. };
  45186. const handleCellMouseEnter = (event, row, tooltipOptions) => {
  45187. var _a;
  45188. const table = parent;
  45189. const cell = getCell(event);
  45190. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  45191. if (cell) {
  45192. const column = getColumnByCell({
  45193. columns: props.store.states.columns.value
  45194. }, cell, namespace);
  45195. if (cell.rowSpan > 1) {
  45196. toggleRowClassByCell(cell.rowSpan, event, addClass);
  45197. }
  45198. const hoverState = table.hoverState = { cell, column, row };
  45199. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  45200. }
  45201. if (!tooltipOptions) {
  45202. return;
  45203. }
  45204. const cellChild = event.target.querySelector(".cell");
  45205. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  45206. return;
  45207. }
  45208. const range = document.createRange();
  45209. range.setStart(cellChild, 0);
  45210. range.setEnd(cellChild, cellChild.childNodes.length);
  45211. const { width: rangeWidth, height: rangeHeight } = range.getBoundingClientRect();
  45212. const { width: cellChildWidth, height: cellChildHeight } = cellChild.getBoundingClientRect();
  45213. const { top, left, right, bottom } = getPadding(cellChild);
  45214. const horizontalPadding = left + right;
  45215. const verticalPadding = top + bottom;
  45216. if (isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) || isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) || isGreaterThan(cellChild.scrollWidth, cellChildWidth)) {
  45217. createTablePopper(tooltipOptions, cell.innerText || cell.textContent, cell, table);
  45218. }
  45219. };
  45220. const handleCellMouseLeave = (event) => {
  45221. const cell = getCell(event);
  45222. if (!cell)
  45223. return;
  45224. if (cell.rowSpan > 1) {
  45225. toggleRowClassByCell(cell.rowSpan, event, removeClass);
  45226. }
  45227. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  45228. 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);
  45229. };
  45230. return {
  45231. handleDoubleClick,
  45232. handleClick,
  45233. handleContextMenu,
  45234. handleMouseEnter,
  45235. handleMouseLeave,
  45236. handleCellMouseEnter,
  45237. handleCellMouseLeave,
  45238. tooltipContent,
  45239. tooltipTrigger
  45240. };
  45241. }
  45242. function useStyles$1(props) {
  45243. const parent = inject(TABLE_INJECTION_KEY);
  45244. const ns = useNamespace("table");
  45245. const getRowStyle = (row, rowIndex) => {
  45246. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  45247. if (isFunction$1(rowStyle)) {
  45248. return rowStyle.call(null, {
  45249. row,
  45250. rowIndex
  45251. });
  45252. }
  45253. return rowStyle || null;
  45254. };
  45255. const getRowClass = (row, rowIndex) => {
  45256. const classes = [ns.e("row")];
  45257. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  45258. classes.push("current-row");
  45259. }
  45260. if (props.stripe && rowIndex % 2 === 1) {
  45261. classes.push(ns.em("row", "striped"));
  45262. }
  45263. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  45264. if (isString$1(rowClassName)) {
  45265. classes.push(rowClassName);
  45266. } else if (isFunction$1(rowClassName)) {
  45267. classes.push(rowClassName.call(null, {
  45268. row,
  45269. rowIndex
  45270. }));
  45271. }
  45272. return classes;
  45273. };
  45274. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  45275. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  45276. let cellStyles = cellStyle != null ? cellStyle : {};
  45277. if (isFunction$1(cellStyle)) {
  45278. cellStyles = cellStyle.call(null, {
  45279. rowIndex,
  45280. columnIndex,
  45281. row,
  45282. column
  45283. });
  45284. }
  45285. const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  45286. ensurePosition(fixedStyle, "left");
  45287. ensurePosition(fixedStyle, "right");
  45288. return Object.assign({}, cellStyles, fixedStyle);
  45289. };
  45290. const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
  45291. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset);
  45292. const classes = [column.id, column.align, column.className, ...fixedClasses];
  45293. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  45294. if (isString$1(cellClassName)) {
  45295. classes.push(cellClassName);
  45296. } else if (isFunction$1(cellClassName)) {
  45297. classes.push(cellClassName.call(null, {
  45298. rowIndex,
  45299. columnIndex,
  45300. row,
  45301. column
  45302. }));
  45303. }
  45304. classes.push(ns.e("cell"));
  45305. return classes.filter((className) => Boolean(className)).join(" ");
  45306. };
  45307. const getSpan = (row, column, rowIndex, columnIndex) => {
  45308. let rowspan = 1;
  45309. let colspan = 1;
  45310. const fn = parent == null ? void 0 : parent.props.spanMethod;
  45311. if (isFunction$1(fn)) {
  45312. const result = fn({
  45313. row,
  45314. column,
  45315. rowIndex,
  45316. columnIndex
  45317. });
  45318. if (isArray$1(result)) {
  45319. rowspan = result[0];
  45320. colspan = result[1];
  45321. } else if (typeof result === "object") {
  45322. rowspan = result.rowspan;
  45323. colspan = result.colspan;
  45324. }
  45325. }
  45326. return { rowspan, colspan };
  45327. };
  45328. const getColspanRealWidth = (columns, colspan, index) => {
  45329. if (colspan < 1) {
  45330. return columns[index].realWidth;
  45331. }
  45332. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  45333. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  45334. };
  45335. return {
  45336. getRowStyle,
  45337. getRowClass,
  45338. getCellStyle,
  45339. getCellClass,
  45340. getSpan,
  45341. getColspanRealWidth
  45342. };
  45343. }
  45344. const __default__$v = defineComponent({
  45345. name: "TableTdWrapper"
  45346. });
  45347. const _sfc_main$B = /* @__PURE__ */ defineComponent({
  45348. ...__default__$v,
  45349. props: {
  45350. colspan: {
  45351. type: Number,
  45352. default: 1
  45353. },
  45354. rowspan: {
  45355. type: Number,
  45356. default: 1
  45357. }
  45358. },
  45359. setup(__props) {
  45360. return (_ctx, _cache) => {
  45361. return openBlock(), createElementBlock("td", {
  45362. colspan: __props.colspan,
  45363. rowspan: __props.rowspan
  45364. }, [
  45365. renderSlot(_ctx.$slots, "default")
  45366. ], 8, ["colspan", "rowspan"]);
  45367. };
  45368. }
  45369. });
  45370. var TdWrapper = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__file", "td-wrapper.vue"]]);
  45371. function useRender$1(props) {
  45372. const parent = inject(TABLE_INJECTION_KEY);
  45373. const ns = useNamespace("table");
  45374. const {
  45375. handleDoubleClick,
  45376. handleClick,
  45377. handleContextMenu,
  45378. handleMouseEnter,
  45379. handleMouseLeave,
  45380. handleCellMouseEnter,
  45381. handleCellMouseLeave,
  45382. tooltipContent,
  45383. tooltipTrigger
  45384. } = useEvents(props);
  45385. const {
  45386. getRowStyle,
  45387. getRowClass,
  45388. getCellStyle,
  45389. getCellClass,
  45390. getSpan,
  45391. getColspanRealWidth
  45392. } = useStyles$1(props);
  45393. const firstDefaultColumnIndex = computed(() => {
  45394. return props.store.states.columns.value.findIndex(({ type }) => type === "default");
  45395. });
  45396. const getKeyOfRow = (row, index) => {
  45397. const rowKey = parent.props.rowKey;
  45398. if (rowKey) {
  45399. return getRowIdentity(row, rowKey);
  45400. }
  45401. return index;
  45402. };
  45403. const rowRender = (row, $index, treeRowData, expanded = false) => {
  45404. const { tooltipEffect, tooltipOptions, store } = props;
  45405. const { indent, columns } = store.states;
  45406. const rowClasses = getRowClass(row, $index);
  45407. let display = true;
  45408. if (treeRowData) {
  45409. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  45410. display = treeRowData.display;
  45411. }
  45412. const displayStyle = display ? null : {
  45413. display: "none"
  45414. };
  45415. return h$1("tr", {
  45416. style: [displayStyle, getRowStyle(row, $index)],
  45417. class: rowClasses,
  45418. key: getKeyOfRow(row, $index),
  45419. onDblclick: ($event) => handleDoubleClick($event, row),
  45420. onClick: ($event) => handleClick($event, row),
  45421. onContextmenu: ($event) => handleContextMenu($event, row),
  45422. onMouseenter: () => handleMouseEnter($index),
  45423. onMouseleave: handleMouseLeave
  45424. }, columns.value.map((column, cellIndex) => {
  45425. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  45426. if (!rowspan || !colspan) {
  45427. return null;
  45428. }
  45429. const columnData = Object.assign({}, column);
  45430. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  45431. const data = {
  45432. store: props.store,
  45433. _self: props.context || parent,
  45434. column: columnData,
  45435. row,
  45436. $index,
  45437. cellIndex,
  45438. expanded
  45439. };
  45440. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  45441. data.treeNode = {
  45442. indent: treeRowData.level * indent.value,
  45443. level: treeRowData.level
  45444. };
  45445. if (isBoolean(treeRowData.expanded)) {
  45446. data.treeNode.expanded = treeRowData.expanded;
  45447. if ("loading" in treeRowData) {
  45448. data.treeNode.loading = treeRowData.loading;
  45449. }
  45450. if ("noLazyChildren" in treeRowData) {
  45451. data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  45452. }
  45453. }
  45454. }
  45455. const baseKey = `${getKeyOfRow(row, $index)},${cellIndex}`;
  45456. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  45457. const mergedTooltipOptions = column.showOverflowTooltip && merge({
  45458. effect: tooltipEffect
  45459. }, tooltipOptions, column.showOverflowTooltip);
  45460. return h$1(TdWrapper, {
  45461. style: getCellStyle($index, cellIndex, row, column),
  45462. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  45463. key: `${patchKey}${baseKey}`,
  45464. rowspan,
  45465. colspan,
  45466. onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions),
  45467. onMouseleave: handleCellMouseLeave
  45468. }, {
  45469. default: () => cellChildren(cellIndex, column, data)
  45470. });
  45471. }));
  45472. };
  45473. const cellChildren = (cellIndex, column, data) => {
  45474. return column.renderCell(data);
  45475. };
  45476. const wrappedRowRender = (row, $index) => {
  45477. const store = props.store;
  45478. const { isRowExpanded, assertRowKey } = store;
  45479. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  45480. const columns = store.states.columns.value;
  45481. const hasExpandColumn = columns.some(({ type }) => type === "expand");
  45482. if (hasExpandColumn) {
  45483. const expanded = isRowExpanded(row);
  45484. const tr = rowRender(row, $index, void 0, expanded);
  45485. const renderExpanded = parent.renderExpanded;
  45486. if (expanded) {
  45487. if (!renderExpanded) {
  45488. console.error("[Element Error]renderExpanded is required.");
  45489. return tr;
  45490. }
  45491. return [
  45492. [
  45493. tr,
  45494. h$1("tr", {
  45495. key: `expanded-row__${tr.key}`
  45496. }, [
  45497. h$1("td", {
  45498. colspan: columns.length,
  45499. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  45500. }, [renderExpanded({ row, $index, store, expanded })])
  45501. ])
  45502. ]
  45503. ];
  45504. } else {
  45505. return [[tr]];
  45506. }
  45507. } else if (Object.keys(treeData.value).length) {
  45508. assertRowKey();
  45509. const key = getRowIdentity(row, rowKey.value);
  45510. let cur = treeData.value[key];
  45511. let treeRowData = null;
  45512. if (cur) {
  45513. treeRowData = {
  45514. expanded: cur.expanded,
  45515. level: cur.level,
  45516. display: true
  45517. };
  45518. if (isBoolean(cur.lazy)) {
  45519. if (isBoolean(cur.loaded) && cur.loaded) {
  45520. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  45521. }
  45522. treeRowData.loading = cur.loading;
  45523. }
  45524. }
  45525. const tmp = [rowRender(row, $index, treeRowData)];
  45526. if (cur) {
  45527. let i = 0;
  45528. const traverse = (children, parent2) => {
  45529. if (!(children && children.length && parent2))
  45530. return;
  45531. children.forEach((node) => {
  45532. const innerTreeRowData = {
  45533. display: parent2.display && parent2.expanded,
  45534. level: parent2.level + 1,
  45535. expanded: false,
  45536. noLazyChildren: false,
  45537. loading: false
  45538. };
  45539. const childKey = getRowIdentity(node, rowKey.value);
  45540. if (childKey === void 0 || childKey === null) {
  45541. throw new Error("For nested data item, row-key is required.");
  45542. }
  45543. cur = { ...treeData.value[childKey] };
  45544. if (cur) {
  45545. innerTreeRowData.expanded = cur.expanded;
  45546. cur.level = cur.level || innerTreeRowData.level;
  45547. cur.display = !!(cur.expanded && innerTreeRowData.display);
  45548. if (isBoolean(cur.lazy)) {
  45549. if (isBoolean(cur.loaded) && cur.loaded) {
  45550. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  45551. }
  45552. innerTreeRowData.loading = cur.loading;
  45553. }
  45554. }
  45555. i++;
  45556. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  45557. if (cur) {
  45558. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  45559. traverse(nodes2, cur);
  45560. }
  45561. });
  45562. };
  45563. cur.display = true;
  45564. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  45565. traverse(nodes, cur);
  45566. }
  45567. return tmp;
  45568. } else {
  45569. return rowRender(row, $index, void 0);
  45570. }
  45571. };
  45572. return {
  45573. wrappedRowRender,
  45574. tooltipContent,
  45575. tooltipTrigger
  45576. };
  45577. }
  45578. const defaultProps$2 = {
  45579. store: {
  45580. required: true,
  45581. type: Object
  45582. },
  45583. stripe: Boolean,
  45584. tooltipEffect: String,
  45585. tooltipOptions: {
  45586. type: Object
  45587. },
  45588. context: {
  45589. default: () => ({}),
  45590. type: Object
  45591. },
  45592. rowClassName: [String, Function],
  45593. rowStyle: [Object, Function],
  45594. fixed: {
  45595. type: String,
  45596. default: ""
  45597. },
  45598. highlight: Boolean
  45599. };
  45600. var defaultProps$3 = defaultProps$2;
  45601. var TableBody = defineComponent({
  45602. name: "ElTableBody",
  45603. props: defaultProps$3,
  45604. setup(props) {
  45605. const instance = getCurrentInstance();
  45606. const parent = inject(TABLE_INJECTION_KEY);
  45607. const ns = useNamespace("table");
  45608. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  45609. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  45610. const hoveredCellList = [];
  45611. watch(props.store.states.hoverRow, (newVal, oldVal) => {
  45612. var _a;
  45613. const el = instance == null ? void 0 : instance.vnode.el;
  45614. const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
  45615. let rowNum = newVal;
  45616. const childNodes = (_a = rows[rowNum]) == null ? void 0 : _a.childNodes;
  45617. if (childNodes == null ? void 0 : childNodes.length) {
  45618. let control = 0;
  45619. const indexes = Array.from(childNodes).reduce((acc, item, index) => {
  45620. var _a2, _b;
  45621. if (((_a2 = childNodes[index]) == null ? void 0 : _a2.colSpan) > 1) {
  45622. control = (_b = childNodes[index]) == null ? void 0 : _b.colSpan;
  45623. }
  45624. if (item.nodeName !== "TD" && control === 0) {
  45625. acc.push(index);
  45626. }
  45627. control > 0 && control--;
  45628. return acc;
  45629. }, []);
  45630. indexes.forEach((rowIndex) => {
  45631. var _a2;
  45632. rowNum = newVal;
  45633. while (rowNum > 0) {
  45634. const preChildNodes = (_a2 = rows[rowNum - 1]) == null ? void 0 : _a2.childNodes;
  45635. if (preChildNodes[rowIndex] && preChildNodes[rowIndex].nodeName === "TD" && preChildNodes[rowIndex].rowSpan > 1) {
  45636. addClass(preChildNodes[rowIndex], "hover-cell");
  45637. hoveredCellList.push(preChildNodes[rowIndex]);
  45638. break;
  45639. }
  45640. rowNum--;
  45641. }
  45642. });
  45643. } else {
  45644. hoveredCellList.forEach((item) => removeClass(item, "hover-cell"));
  45645. hoveredCellList.length = 0;
  45646. }
  45647. if (!props.store.states.isComplex.value || !isClient)
  45648. return;
  45649. rAF(() => {
  45650. const oldRow = rows[oldVal];
  45651. const newRow = rows[newVal];
  45652. if (oldRow && !oldRow.classList.contains("hover-fixed-row")) {
  45653. removeClass(oldRow, "hover-row");
  45654. }
  45655. if (newRow) {
  45656. addClass(newRow, "hover-row");
  45657. }
  45658. });
  45659. });
  45660. onUnmounted(() => {
  45661. var _a;
  45662. (_a = removePopper) == null ? void 0 : _a();
  45663. });
  45664. return {
  45665. ns,
  45666. onColumnsChange,
  45667. onScrollableChange,
  45668. wrappedRowRender,
  45669. tooltipContent,
  45670. tooltipTrigger
  45671. };
  45672. },
  45673. render() {
  45674. const { wrappedRowRender, store } = this;
  45675. const data = store.states.data.value || [];
  45676. return h$1("tbody", { tabIndex: -1 }, [
  45677. data.reduce((acc, row) => {
  45678. return acc.concat(wrappedRowRender(row, acc.length));
  45679. }, [])
  45680. ]);
  45681. }
  45682. });
  45683. function useMapState() {
  45684. const table = inject(TABLE_INJECTION_KEY);
  45685. const store = table == null ? void 0 : table.store;
  45686. const leftFixedLeafCount = computed(() => {
  45687. return store.states.fixedLeafColumnsLength.value;
  45688. });
  45689. const rightFixedLeafCount = computed(() => {
  45690. return store.states.rightFixedColumns.value.length;
  45691. });
  45692. const columnsCount = computed(() => {
  45693. return store.states.columns.value.length;
  45694. });
  45695. const leftFixedCount = computed(() => {
  45696. return store.states.fixedColumns.value.length;
  45697. });
  45698. const rightFixedCount = computed(() => {
  45699. return store.states.rightFixedColumns.value.length;
  45700. });
  45701. return {
  45702. leftFixedLeafCount,
  45703. rightFixedLeafCount,
  45704. columnsCount,
  45705. leftFixedCount,
  45706. rightFixedCount,
  45707. columns: store.states.columns
  45708. };
  45709. }
  45710. function useStyle$1(props) {
  45711. const { columns } = useMapState();
  45712. const ns = useNamespace("table");
  45713. const getCellClasses = (columns2, cellIndex) => {
  45714. const column = columns2[cellIndex];
  45715. const classes = [
  45716. ns.e("cell"),
  45717. column.id,
  45718. column.align,
  45719. column.labelClassName,
  45720. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  45721. ];
  45722. if (column.className) {
  45723. classes.push(column.className);
  45724. }
  45725. if (!column.children) {
  45726. classes.push(ns.is("leaf"));
  45727. }
  45728. return classes;
  45729. };
  45730. const getCellStyles = (column, cellIndex) => {
  45731. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  45732. ensurePosition(fixedStyle, "left");
  45733. ensurePosition(fixedStyle, "right");
  45734. return fixedStyle;
  45735. };
  45736. return {
  45737. getCellClasses,
  45738. getCellStyles,
  45739. columns
  45740. };
  45741. }
  45742. var TableFooter = defineComponent({
  45743. name: "ElTableFooter",
  45744. props: {
  45745. fixed: {
  45746. type: String,
  45747. default: ""
  45748. },
  45749. store: {
  45750. required: true,
  45751. type: Object
  45752. },
  45753. summaryMethod: Function,
  45754. sumText: String,
  45755. border: Boolean,
  45756. defaultSort: {
  45757. type: Object,
  45758. default: () => {
  45759. return {
  45760. prop: "",
  45761. order: ""
  45762. };
  45763. }
  45764. }
  45765. },
  45766. setup(props) {
  45767. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  45768. const ns = useNamespace("table");
  45769. return {
  45770. ns,
  45771. getCellClasses,
  45772. getCellStyles,
  45773. columns
  45774. };
  45775. },
  45776. render() {
  45777. const { columns, getCellStyles, getCellClasses, summaryMethod, sumText } = this;
  45778. const data = this.store.states.data.value;
  45779. let sums = [];
  45780. if (summaryMethod) {
  45781. sums = summaryMethod({
  45782. columns,
  45783. data
  45784. });
  45785. } else {
  45786. columns.forEach((column, index) => {
  45787. if (index === 0) {
  45788. sums[index] = sumText;
  45789. return;
  45790. }
  45791. const values = data.map((item) => Number(item[column.property]));
  45792. const precisions = [];
  45793. let notNumber = true;
  45794. values.forEach((value) => {
  45795. if (!Number.isNaN(+value)) {
  45796. notNumber = false;
  45797. const decimal = `${value}`.split(".")[1];
  45798. precisions.push(decimal ? decimal.length : 0);
  45799. }
  45800. });
  45801. const precision = Math.max.apply(null, precisions);
  45802. if (!notNumber) {
  45803. sums[index] = values.reduce((prev, curr) => {
  45804. const value = Number(curr);
  45805. if (!Number.isNaN(+value)) {
  45806. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  45807. } else {
  45808. return prev;
  45809. }
  45810. }, 0);
  45811. } else {
  45812. sums[index] = "";
  45813. }
  45814. });
  45815. }
  45816. return h$1(h$1("tfoot", [
  45817. h$1("tr", {}, [
  45818. ...columns.map((column, cellIndex) => h$1("td", {
  45819. key: cellIndex,
  45820. colspan: column.colSpan,
  45821. rowspan: column.rowSpan,
  45822. class: getCellClasses(columns, cellIndex),
  45823. style: getCellStyles(column, cellIndex)
  45824. }, [
  45825. h$1("div", {
  45826. class: ["cell", column.labelClassName]
  45827. }, [sums[cellIndex]])
  45828. ]))
  45829. ])
  45830. ]));
  45831. }
  45832. });
  45833. function useUtils(store) {
  45834. const setCurrentRow = (row) => {
  45835. store.commit("setCurrentRow", row);
  45836. };
  45837. const getSelectionRows = () => {
  45838. return store.getSelectionRows();
  45839. };
  45840. const toggleRowSelection = (row, selected, ignoreSelectable = true) => {
  45841. store.toggleRowSelection(row, selected, false, ignoreSelectable);
  45842. store.updateAllSelected();
  45843. };
  45844. const clearSelection = () => {
  45845. store.clearSelection();
  45846. };
  45847. const clearFilter = (columnKeys) => {
  45848. store.clearFilter(columnKeys);
  45849. };
  45850. const toggleAllSelection = () => {
  45851. store.commit("toggleAllSelection");
  45852. };
  45853. const toggleRowExpansion = (row, expanded) => {
  45854. store.toggleRowExpansionAdapter(row, expanded);
  45855. };
  45856. const clearSort = () => {
  45857. store.clearSort();
  45858. };
  45859. const sort = (prop, order) => {
  45860. store.commit("sort", { prop, order });
  45861. };
  45862. const updateKeyChildren = (key, data) => {
  45863. store.updateKeyChildren(key, data);
  45864. };
  45865. return {
  45866. setCurrentRow,
  45867. getSelectionRows,
  45868. toggleRowSelection,
  45869. clearSelection,
  45870. clearFilter,
  45871. toggleAllSelection,
  45872. toggleRowExpansion,
  45873. clearSort,
  45874. sort,
  45875. updateKeyChildren
  45876. };
  45877. }
  45878. function useStyle(props, layout, store, table) {
  45879. const isHidden = ref(false);
  45880. const renderExpanded = ref(null);
  45881. const resizeProxyVisible = ref(false);
  45882. const setDragVisible = (visible) => {
  45883. resizeProxyVisible.value = visible;
  45884. };
  45885. const resizeState = ref({
  45886. width: null,
  45887. height: null,
  45888. headerHeight: null
  45889. });
  45890. const isGroup = ref(false);
  45891. const scrollbarViewStyle = {
  45892. display: "inline-block",
  45893. verticalAlign: "middle"
  45894. };
  45895. const tableWidth = ref();
  45896. const tableScrollHeight = ref(0);
  45897. const bodyScrollHeight = ref(0);
  45898. const headerScrollHeight = ref(0);
  45899. const footerScrollHeight = ref(0);
  45900. const appendScrollHeight = ref(0);
  45901. watchEffect(() => {
  45902. layout.setHeight(props.height);
  45903. });
  45904. watchEffect(() => {
  45905. layout.setMaxHeight(props.maxHeight);
  45906. });
  45907. watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  45908. if (!unref(rowKey) || !unref(currentRowKey))
  45909. return;
  45910. store.setCurrentRowKey(`${currentRowKey}`);
  45911. }, {
  45912. immediate: true
  45913. });
  45914. watch(() => props.data, (data) => {
  45915. table.store.commit("setData", data);
  45916. }, {
  45917. immediate: true,
  45918. deep: true
  45919. });
  45920. watchEffect(() => {
  45921. if (props.expandRowKeys) {
  45922. store.setExpandRowKeysAdapter(props.expandRowKeys);
  45923. }
  45924. });
  45925. const handleMouseLeave = () => {
  45926. table.store.commit("setHoverRow", null);
  45927. if (table.hoverState)
  45928. table.hoverState = null;
  45929. };
  45930. const handleHeaderFooterMousewheel = (event, data) => {
  45931. const { pixelX, pixelY } = data;
  45932. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  45933. table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  45934. }
  45935. };
  45936. const shouldUpdateHeight = computed(() => {
  45937. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  45938. });
  45939. const tableBodyStyles = computed(() => {
  45940. return {
  45941. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  45942. };
  45943. });
  45944. const doLayout = () => {
  45945. if (shouldUpdateHeight.value) {
  45946. layout.updateElsHeight();
  45947. }
  45948. layout.updateColumnsWidth();
  45949. requestAnimationFrame(syncPosition);
  45950. };
  45951. onMounted(async () => {
  45952. await nextTick();
  45953. store.updateColumns();
  45954. bindEvents();
  45955. requestAnimationFrame(doLayout);
  45956. const el = table.vnode.el;
  45957. const tableHeader = table.refs.headerWrapper;
  45958. if (props.flexible && el && el.parentElement) {
  45959. el.parentElement.style.minWidth = "0";
  45960. }
  45961. resizeState.value = {
  45962. width: tableWidth.value = el.offsetWidth,
  45963. height: el.offsetHeight,
  45964. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  45965. };
  45966. store.states.columns.value.forEach((column) => {
  45967. if (column.filteredValue && column.filteredValue.length) {
  45968. table.store.commit("filterChange", {
  45969. column,
  45970. values: column.filteredValue,
  45971. silent: true
  45972. });
  45973. }
  45974. });
  45975. table.$ready = true;
  45976. });
  45977. const setScrollClassByEl = (el, className) => {
  45978. if (!el)
  45979. return;
  45980. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  45981. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  45982. el.className = classList.join(" ");
  45983. };
  45984. const setScrollClass = (className) => {
  45985. const { tableWrapper } = table.refs;
  45986. setScrollClassByEl(tableWrapper, className);
  45987. };
  45988. const hasScrollClass = (className) => {
  45989. const { tableWrapper } = table.refs;
  45990. return !!(tableWrapper && tableWrapper.classList.contains(className));
  45991. };
  45992. const syncPosition = function() {
  45993. if (!table.refs.scrollBarRef)
  45994. return;
  45995. if (!layout.scrollX.value) {
  45996. const scrollingNoneClass = "is-scrolling-none";
  45997. if (!hasScrollClass(scrollingNoneClass)) {
  45998. setScrollClass(scrollingNoneClass);
  45999. }
  46000. return;
  46001. }
  46002. const scrollContainer = table.refs.scrollBarRef.wrapRef;
  46003. if (!scrollContainer)
  46004. return;
  46005. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  46006. const { headerWrapper, footerWrapper } = table.refs;
  46007. if (headerWrapper)
  46008. headerWrapper.scrollLeft = scrollLeft;
  46009. if (footerWrapper)
  46010. footerWrapper.scrollLeft = scrollLeft;
  46011. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  46012. if (scrollLeft >= maxScrollLeftPosition) {
  46013. setScrollClass("is-scrolling-right");
  46014. } else if (scrollLeft === 0) {
  46015. setScrollClass("is-scrolling-left");
  46016. } else {
  46017. setScrollClass("is-scrolling-middle");
  46018. }
  46019. };
  46020. const bindEvents = () => {
  46021. if (!table.refs.scrollBarRef)
  46022. return;
  46023. if (table.refs.scrollBarRef.wrapRef) {
  46024. useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, {
  46025. passive: true
  46026. });
  46027. }
  46028. if (props.fit) {
  46029. useResizeObserver(table.vnode.el, resizeListener);
  46030. } else {
  46031. useEventListener(window, "resize", resizeListener);
  46032. }
  46033. useResizeObserver(table.refs.bodyWrapper, () => {
  46034. var _a, _b;
  46035. resizeListener();
  46036. (_b = (_a = table.refs) == null ? void 0 : _a.scrollBarRef) == null ? void 0 : _b.update();
  46037. });
  46038. };
  46039. const resizeListener = () => {
  46040. var _a, _b, _c, _d;
  46041. const el = table.vnode.el;
  46042. if (!table.$ready || !el)
  46043. return;
  46044. let shouldUpdateLayout = false;
  46045. const {
  46046. width: oldWidth,
  46047. height: oldHeight,
  46048. headerHeight: oldHeaderHeight
  46049. } = resizeState.value;
  46050. const width = tableWidth.value = el.offsetWidth;
  46051. if (oldWidth !== width) {
  46052. shouldUpdateLayout = true;
  46053. }
  46054. const height = el.offsetHeight;
  46055. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
  46056. shouldUpdateLayout = true;
  46057. }
  46058. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a = table.refs.tableHeaderRef) == null ? void 0 : _a.$el;
  46059. if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) {
  46060. shouldUpdateLayout = true;
  46061. }
  46062. tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0;
  46063. headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0;
  46064. footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0;
  46065. appendScrollHeight.value = ((_d = table.refs.appendWrapper) == null ? void 0 : _d.offsetHeight) || 0;
  46066. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value - appendScrollHeight.value;
  46067. if (shouldUpdateLayout) {
  46068. resizeState.value = {
  46069. width,
  46070. height,
  46071. headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0
  46072. };
  46073. doLayout();
  46074. }
  46075. };
  46076. const tableSize = useFormSize();
  46077. const bodyWidth = computed(() => {
  46078. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  46079. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  46080. });
  46081. const tableLayout = computed(() => {
  46082. if (props.maxHeight)
  46083. return "fixed";
  46084. return props.tableLayout;
  46085. });
  46086. const emptyBlockStyle = computed(() => {
  46087. if (props.data && props.data.length)
  46088. return null;
  46089. let height = "100%";
  46090. if (props.height && bodyScrollHeight.value) {
  46091. height = `${bodyScrollHeight.value}px`;
  46092. }
  46093. const width = tableWidth.value;
  46094. return {
  46095. width: width ? `${width}px` : "",
  46096. height
  46097. };
  46098. });
  46099. const scrollbarStyle = computed(() => {
  46100. if (props.height) {
  46101. return {
  46102. height: "100%"
  46103. };
  46104. }
  46105. if (props.maxHeight) {
  46106. if (!Number.isNaN(Number(props.maxHeight))) {
  46107. return {
  46108. maxHeight: `${props.maxHeight - headerScrollHeight.value - footerScrollHeight.value}px`
  46109. };
  46110. } else {
  46111. return {
  46112. maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)`
  46113. };
  46114. }
  46115. }
  46116. return {};
  46117. });
  46118. const handleFixedMousewheel = (event, data) => {
  46119. const bodyWrapper = table.refs.bodyWrapper;
  46120. if (Math.abs(data.spinY) > 0) {
  46121. const currentScrollTop = bodyWrapper.scrollTop;
  46122. if (data.pixelY < 0 && currentScrollTop !== 0) {
  46123. event.preventDefault();
  46124. }
  46125. if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  46126. event.preventDefault();
  46127. }
  46128. bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5);
  46129. } else {
  46130. bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5);
  46131. }
  46132. };
  46133. return {
  46134. isHidden,
  46135. renderExpanded,
  46136. setDragVisible,
  46137. isGroup,
  46138. handleMouseLeave,
  46139. handleHeaderFooterMousewheel,
  46140. tableSize,
  46141. emptyBlockStyle,
  46142. handleFixedMousewheel,
  46143. resizeProxyVisible,
  46144. bodyWidth,
  46145. resizeState,
  46146. doLayout,
  46147. tableBodyStyles,
  46148. tableLayout,
  46149. scrollbarViewStyle,
  46150. scrollbarStyle
  46151. };
  46152. }
  46153. function useKeyRender(table) {
  46154. const observer = ref();
  46155. const initWatchDom = () => {
  46156. const el = table.vnode.el;
  46157. const columnsWrapper = el.querySelector(".hidden-columns");
  46158. const config = { childList: true, subtree: true };
  46159. const updateOrderFns = table.store.states.updateOrderFns;
  46160. observer.value = new MutationObserver(() => {
  46161. updateOrderFns.forEach((fn) => fn());
  46162. });
  46163. observer.value.observe(columnsWrapper, config);
  46164. };
  46165. onMounted(() => {
  46166. initWatchDom();
  46167. });
  46168. onUnmounted(() => {
  46169. var _a;
  46170. (_a = observer.value) == null ? void 0 : _a.disconnect();
  46171. });
  46172. }
  46173. var defaultProps$1 = {
  46174. data: {
  46175. type: Array,
  46176. default: () => []
  46177. },
  46178. size: useSizeProp,
  46179. width: [String, Number],
  46180. height: [String, Number],
  46181. maxHeight: [String, Number],
  46182. fit: {
  46183. type: Boolean,
  46184. default: true
  46185. },
  46186. stripe: Boolean,
  46187. border: Boolean,
  46188. rowKey: [String, Function],
  46189. showHeader: {
  46190. type: Boolean,
  46191. default: true
  46192. },
  46193. showSummary: Boolean,
  46194. sumText: String,
  46195. summaryMethod: Function,
  46196. rowClassName: [String, Function],
  46197. rowStyle: [Object, Function],
  46198. cellClassName: [String, Function],
  46199. cellStyle: [Object, Function],
  46200. headerRowClassName: [String, Function],
  46201. headerRowStyle: [Object, Function],
  46202. headerCellClassName: [String, Function],
  46203. headerCellStyle: [Object, Function],
  46204. highlightCurrentRow: Boolean,
  46205. currentRowKey: [String, Number],
  46206. emptyText: String,
  46207. expandRowKeys: Array,
  46208. defaultExpandAll: Boolean,
  46209. defaultSort: Object,
  46210. tooltipEffect: String,
  46211. tooltipOptions: Object,
  46212. spanMethod: Function,
  46213. selectOnIndeterminate: {
  46214. type: Boolean,
  46215. default: true
  46216. },
  46217. indent: {
  46218. type: Number,
  46219. default: 16
  46220. },
  46221. treeProps: {
  46222. type: Object,
  46223. default: () => {
  46224. return {
  46225. hasChildren: "hasChildren",
  46226. children: "children",
  46227. checkStrictly: false
  46228. };
  46229. }
  46230. },
  46231. lazy: Boolean,
  46232. load: Function,
  46233. style: {
  46234. type: Object,
  46235. default: () => ({})
  46236. },
  46237. className: {
  46238. type: String,
  46239. default: ""
  46240. },
  46241. tableLayout: {
  46242. type: String,
  46243. default: "fixed"
  46244. },
  46245. scrollbarAlwaysOn: Boolean,
  46246. flexible: Boolean,
  46247. showOverflowTooltip: [Boolean, Object],
  46248. appendFilterPanelTo: String,
  46249. scrollbarTabindex: {
  46250. type: [Number, String],
  46251. default: void 0
  46252. }
  46253. };
  46254. function hColgroup(props) {
  46255. const isAuto = props.tableLayout === "auto";
  46256. let columns = props.columns || [];
  46257. if (isAuto) {
  46258. if (columns.every((column) => column.width === void 0)) {
  46259. columns = [];
  46260. }
  46261. }
  46262. const getPropsData = (column) => {
  46263. const propsData = {
  46264. key: `${props.tableLayout}_${column.id}`,
  46265. style: {},
  46266. name: void 0
  46267. };
  46268. if (isAuto) {
  46269. propsData.style = {
  46270. width: `${column.width}px`
  46271. };
  46272. } else {
  46273. propsData.name = column.id;
  46274. }
  46275. return propsData;
  46276. };
  46277. return h$1("colgroup", {}, columns.map((column) => h$1("col", getPropsData(column))));
  46278. }
  46279. hColgroup.props = ["columns", "tableLayout"];
  46280. const useScrollbar$1 = () => {
  46281. const scrollBarRef = ref();
  46282. const scrollTo = (options, yCoord) => {
  46283. const scrollbar = scrollBarRef.value;
  46284. if (scrollbar) {
  46285. scrollbar.scrollTo(options, yCoord);
  46286. }
  46287. };
  46288. const setScrollPosition = (position, offset) => {
  46289. const scrollbar = scrollBarRef.value;
  46290. if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) {
  46291. scrollbar[`setScroll${position}`](offset);
  46292. }
  46293. };
  46294. const setScrollTop = (top) => setScrollPosition("Top", top);
  46295. const setScrollLeft = (left) => setScrollPosition("Left", left);
  46296. return {
  46297. scrollBarRef,
  46298. scrollTo,
  46299. setScrollTop,
  46300. setScrollLeft
  46301. };
  46302. };
  46303. let tableIdSeed = 1;
  46304. const _sfc_main$A = defineComponent({
  46305. name: "ElTable",
  46306. directives: {
  46307. Mousewheel
  46308. },
  46309. components: {
  46310. TableHeader,
  46311. TableBody,
  46312. TableFooter,
  46313. ElScrollbar,
  46314. hColgroup
  46315. },
  46316. props: defaultProps$1,
  46317. emits: [
  46318. "select",
  46319. "select-all",
  46320. "selection-change",
  46321. "cell-mouse-enter",
  46322. "cell-mouse-leave",
  46323. "cell-contextmenu",
  46324. "cell-click",
  46325. "cell-dblclick",
  46326. "row-click",
  46327. "row-contextmenu",
  46328. "row-dblclick",
  46329. "header-click",
  46330. "header-contextmenu",
  46331. "sort-change",
  46332. "filter-change",
  46333. "current-change",
  46334. "header-dragend",
  46335. "expand-change",
  46336. "scroll"
  46337. ],
  46338. setup(props) {
  46339. const { t } = useLocale();
  46340. const ns = useNamespace("table");
  46341. const table = getCurrentInstance();
  46342. provide(TABLE_INJECTION_KEY, table);
  46343. const store = createStore(table, props);
  46344. table.store = store;
  46345. const layout = new TableLayout$1({
  46346. store: table.store,
  46347. table,
  46348. fit: props.fit,
  46349. showHeader: props.showHeader
  46350. });
  46351. table.layout = layout;
  46352. const isEmpty = computed(() => (store.states.data.value || []).length === 0);
  46353. const {
  46354. setCurrentRow,
  46355. getSelectionRows,
  46356. toggleRowSelection,
  46357. clearSelection,
  46358. clearFilter,
  46359. toggleAllSelection,
  46360. toggleRowExpansion,
  46361. clearSort,
  46362. sort,
  46363. updateKeyChildren
  46364. } = useUtils(store);
  46365. const {
  46366. isHidden,
  46367. renderExpanded,
  46368. setDragVisible,
  46369. isGroup,
  46370. handleMouseLeave,
  46371. handleHeaderFooterMousewheel,
  46372. tableSize,
  46373. emptyBlockStyle,
  46374. handleFixedMousewheel,
  46375. resizeProxyVisible,
  46376. bodyWidth,
  46377. resizeState,
  46378. doLayout,
  46379. tableBodyStyles,
  46380. tableLayout,
  46381. scrollbarViewStyle,
  46382. scrollbarStyle
  46383. } = useStyle(props, layout, store, table);
  46384. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1();
  46385. const debouncedUpdateLayout = debounce(doLayout, 50);
  46386. const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
  46387. table.tableId = tableId;
  46388. table.state = {
  46389. isGroup,
  46390. resizeState,
  46391. doLayout,
  46392. debouncedUpdateLayout
  46393. };
  46394. const computedSumText = computed(() => {
  46395. var _a;
  46396. return (_a = props.sumText) != null ? _a : t("el.table.sumText");
  46397. });
  46398. const computedEmptyText = computed(() => {
  46399. var _a;
  46400. return (_a = props.emptyText) != null ? _a : t("el.table.emptyText");
  46401. });
  46402. const columns = computed(() => {
  46403. return convertToRows(store.states.originColumns.value)[0];
  46404. });
  46405. useKeyRender(table);
  46406. onBeforeUnmount(() => {
  46407. debouncedUpdateLayout.cancel();
  46408. });
  46409. return {
  46410. ns,
  46411. layout,
  46412. store,
  46413. columns,
  46414. handleHeaderFooterMousewheel,
  46415. handleMouseLeave,
  46416. tableId,
  46417. tableSize,
  46418. isHidden,
  46419. isEmpty,
  46420. renderExpanded,
  46421. resizeProxyVisible,
  46422. resizeState,
  46423. isGroup,
  46424. bodyWidth,
  46425. tableBodyStyles,
  46426. emptyBlockStyle,
  46427. debouncedUpdateLayout,
  46428. handleFixedMousewheel,
  46429. setCurrentRow,
  46430. getSelectionRows,
  46431. toggleRowSelection,
  46432. clearSelection,
  46433. clearFilter,
  46434. toggleAllSelection,
  46435. toggleRowExpansion,
  46436. clearSort,
  46437. doLayout,
  46438. sort,
  46439. updateKeyChildren,
  46440. t,
  46441. setDragVisible,
  46442. context: table,
  46443. computedSumText,
  46444. computedEmptyText,
  46445. tableLayout,
  46446. scrollbarViewStyle,
  46447. scrollbarStyle,
  46448. scrollBarRef,
  46449. scrollTo,
  46450. setScrollLeft,
  46451. setScrollTop
  46452. };
  46453. }
  46454. });
  46455. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  46456. const _component_hColgroup = resolveComponent("hColgroup");
  46457. const _component_table_header = resolveComponent("table-header");
  46458. const _component_table_body = resolveComponent("table-body");
  46459. const _component_table_footer = resolveComponent("table-footer");
  46460. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  46461. const _directive_mousewheel = resolveDirective("mousewheel");
  46462. return openBlock(), createElementBlock("div", {
  46463. ref: "tableWrapper",
  46464. class: normalizeClass([
  46465. {
  46466. [_ctx.ns.m("fit")]: _ctx.fit,
  46467. [_ctx.ns.m("striped")]: _ctx.stripe,
  46468. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  46469. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  46470. [_ctx.ns.m("group")]: _ctx.isGroup,
  46471. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  46472. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  46473. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  46474. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  46475. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  46476. "has-footer": _ctx.showSummary
  46477. },
  46478. _ctx.ns.m(_ctx.tableSize),
  46479. _ctx.className,
  46480. _ctx.ns.b(),
  46481. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  46482. ]),
  46483. style: normalizeStyle(_ctx.style),
  46484. "data-prefix": _ctx.ns.namespace.value,
  46485. onMouseleave: _ctx.handleMouseLeave
  46486. }, [
  46487. createElementVNode("div", {
  46488. class: normalizeClass(_ctx.ns.e("inner-wrapper"))
  46489. }, [
  46490. createElementVNode("div", {
  46491. ref: "hiddenColumns",
  46492. class: "hidden-columns"
  46493. }, [
  46494. renderSlot(_ctx.$slots, "default")
  46495. ], 512),
  46496. _ctx.showHeader && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  46497. key: 0,
  46498. ref: "headerWrapper",
  46499. class: normalizeClass(_ctx.ns.e("header-wrapper"))
  46500. }, [
  46501. createElementVNode("table", {
  46502. ref: "tableHeader",
  46503. class: normalizeClass(_ctx.ns.e("header")),
  46504. style: normalizeStyle(_ctx.tableBodyStyles),
  46505. border: "0",
  46506. cellpadding: "0",
  46507. cellspacing: "0"
  46508. }, [
  46509. createVNode(_component_hColgroup, {
  46510. columns: _ctx.store.states.columns.value,
  46511. "table-layout": _ctx.tableLayout
  46512. }, null, 8, ["columns", "table-layout"]),
  46513. createVNode(_component_table_header, {
  46514. ref: "tableHeaderRef",
  46515. border: _ctx.border,
  46516. "default-sort": _ctx.defaultSort,
  46517. store: _ctx.store,
  46518. "append-filter-panel-to": _ctx.appendFilterPanelTo,
  46519. onSetDragVisible: _ctx.setDragVisible
  46520. }, null, 8, ["border", "default-sort", "store", "append-filter-panel-to", "onSetDragVisible"])
  46521. ], 6)
  46522. ], 2)), [
  46523. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  46524. ]) : createCommentVNode("v-if", true),
  46525. createElementVNode("div", {
  46526. ref: "bodyWrapper",
  46527. class: normalizeClass(_ctx.ns.e("body-wrapper"))
  46528. }, [
  46529. createVNode(_component_el_scrollbar, {
  46530. ref: "scrollBarRef",
  46531. "view-style": _ctx.scrollbarViewStyle,
  46532. "wrap-style": _ctx.scrollbarStyle,
  46533. always: _ctx.scrollbarAlwaysOn,
  46534. tabindex: _ctx.scrollbarTabindex,
  46535. onScroll: ($event) => _ctx.$emit("scroll", $event)
  46536. }, {
  46537. default: withCtx(() => [
  46538. createElementVNode("table", {
  46539. ref: "tableBody",
  46540. class: normalizeClass(_ctx.ns.e("body")),
  46541. cellspacing: "0",
  46542. cellpadding: "0",
  46543. border: "0",
  46544. style: normalizeStyle({
  46545. width: _ctx.bodyWidth,
  46546. tableLayout: _ctx.tableLayout
  46547. })
  46548. }, [
  46549. createVNode(_component_hColgroup, {
  46550. columns: _ctx.store.states.columns.value,
  46551. "table-layout": _ctx.tableLayout
  46552. }, null, 8, ["columns", "table-layout"]),
  46553. _ctx.showHeader && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_header, {
  46554. key: 0,
  46555. ref: "tableHeaderRef",
  46556. class: normalizeClass(_ctx.ns.e("body-header")),
  46557. border: _ctx.border,
  46558. "default-sort": _ctx.defaultSort,
  46559. store: _ctx.store,
  46560. "append-filter-panel-to": _ctx.appendFilterPanelTo,
  46561. onSetDragVisible: _ctx.setDragVisible
  46562. }, null, 8, ["class", "border", "default-sort", "store", "append-filter-panel-to", "onSetDragVisible"])) : createCommentVNode("v-if", true),
  46563. createVNode(_component_table_body, {
  46564. context: _ctx.context,
  46565. highlight: _ctx.highlightCurrentRow,
  46566. "row-class-name": _ctx.rowClassName,
  46567. "tooltip-effect": _ctx.tooltipEffect,
  46568. "tooltip-options": _ctx.tooltipOptions,
  46569. "row-style": _ctx.rowStyle,
  46570. store: _ctx.store,
  46571. stripe: _ctx.stripe
  46572. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "tooltip-options", "row-style", "store", "stripe"]),
  46573. _ctx.showSummary && _ctx.tableLayout === "auto" ? (openBlock(), createBlock(_component_table_footer, {
  46574. key: 1,
  46575. class: normalizeClass(_ctx.ns.e("body-footer")),
  46576. border: _ctx.border,
  46577. "default-sort": _ctx.defaultSort,
  46578. store: _ctx.store,
  46579. "sum-text": _ctx.computedSumText,
  46580. "summary-method": _ctx.summaryMethod
  46581. }, null, 8, ["class", "border", "default-sort", "store", "sum-text", "summary-method"])) : createCommentVNode("v-if", true)
  46582. ], 6),
  46583. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  46584. key: 0,
  46585. ref: "emptyBlock",
  46586. style: normalizeStyle(_ctx.emptyBlockStyle),
  46587. class: normalizeClass(_ctx.ns.e("empty-block"))
  46588. }, [
  46589. createElementVNode("span", {
  46590. class: normalizeClass(_ctx.ns.e("empty-text"))
  46591. }, [
  46592. renderSlot(_ctx.$slots, "empty", {}, () => [
  46593. createTextVNode(toDisplayString(_ctx.computedEmptyText), 1)
  46594. ])
  46595. ], 2)
  46596. ], 6)) : createCommentVNode("v-if", true),
  46597. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  46598. key: 1,
  46599. ref: "appendWrapper",
  46600. class: normalizeClass(_ctx.ns.e("append-wrapper"))
  46601. }, [
  46602. renderSlot(_ctx.$slots, "append")
  46603. ], 2)) : createCommentVNode("v-if", true)
  46604. ]),
  46605. _: 3
  46606. }, 8, ["view-style", "wrap-style", "always", "tabindex", "onScroll"])
  46607. ], 2),
  46608. _ctx.showSummary && _ctx.tableLayout === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  46609. key: 1,
  46610. ref: "footerWrapper",
  46611. class: normalizeClass(_ctx.ns.e("footer-wrapper"))
  46612. }, [
  46613. createElementVNode("table", {
  46614. class: normalizeClass(_ctx.ns.e("footer")),
  46615. cellspacing: "0",
  46616. cellpadding: "0",
  46617. border: "0",
  46618. style: normalizeStyle(_ctx.tableBodyStyles)
  46619. }, [
  46620. createVNode(_component_hColgroup, {
  46621. columns: _ctx.store.states.columns.value,
  46622. "table-layout": _ctx.tableLayout
  46623. }, null, 8, ["columns", "table-layout"]),
  46624. createVNode(_component_table_footer, {
  46625. border: _ctx.border,
  46626. "default-sort": _ctx.defaultSort,
  46627. store: _ctx.store,
  46628. "sum-text": _ctx.computedSumText,
  46629. "summary-method": _ctx.summaryMethod
  46630. }, null, 8, ["border", "default-sort", "store", "sum-text", "summary-method"])
  46631. ], 6)
  46632. ], 2)), [
  46633. [vShow, !_ctx.isEmpty],
  46634. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  46635. ]) : createCommentVNode("v-if", true),
  46636. _ctx.border || _ctx.isGroup ? (openBlock(), createElementBlock("div", {
  46637. key: 2,
  46638. class: normalizeClass(_ctx.ns.e("border-left-patch"))
  46639. }, null, 2)) : createCommentVNode("v-if", true)
  46640. ], 2),
  46641. withDirectives(createElementVNode("div", {
  46642. ref: "resizeProxy",
  46643. class: normalizeClass(_ctx.ns.e("column-resize-proxy"))
  46644. }, null, 2), [
  46645. [vShow, _ctx.resizeProxyVisible]
  46646. ])
  46647. ], 46, ["data-prefix", "onMouseleave"]);
  46648. }
  46649. var Table = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$3], ["__file", "table.vue"]]);
  46650. const defaultClassNames = {
  46651. selection: "table-column--selection",
  46652. expand: "table__expand-column"
  46653. };
  46654. const cellStarts = {
  46655. default: {
  46656. order: ""
  46657. },
  46658. selection: {
  46659. width: 48,
  46660. minWidth: 48,
  46661. realWidth: 48,
  46662. order: ""
  46663. },
  46664. expand: {
  46665. width: 48,
  46666. minWidth: 48,
  46667. realWidth: 48,
  46668. order: ""
  46669. },
  46670. index: {
  46671. width: 48,
  46672. minWidth: 48,
  46673. realWidth: 48,
  46674. order: ""
  46675. }
  46676. };
  46677. const getDefaultClassName = (type) => {
  46678. return defaultClassNames[type] || "";
  46679. };
  46680. const cellForced = {
  46681. selection: {
  46682. renderHeader({ store, column }) {
  46683. function isDisabled() {
  46684. return store.states.data.value && store.states.data.value.length === 0;
  46685. }
  46686. return h$1(ElCheckbox, {
  46687. disabled: isDisabled(),
  46688. size: store.states.tableSize.value,
  46689. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  46690. "onUpdate:modelValue": store.toggleAllSelection,
  46691. modelValue: store.states.isAllSelected.value,
  46692. ariaLabel: column.label
  46693. });
  46694. },
  46695. renderCell({
  46696. row,
  46697. column,
  46698. store,
  46699. $index
  46700. }) {
  46701. return h$1(ElCheckbox, {
  46702. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  46703. size: store.states.tableSize.value,
  46704. onChange: () => {
  46705. store.commit("rowSelectedChanged", row);
  46706. },
  46707. onClick: (event) => event.stopPropagation(),
  46708. modelValue: store.isSelected(row),
  46709. ariaLabel: column.label
  46710. });
  46711. },
  46712. sortable: false,
  46713. resizable: false
  46714. },
  46715. index: {
  46716. renderHeader({ column }) {
  46717. return column.label || "#";
  46718. },
  46719. renderCell({
  46720. column,
  46721. $index
  46722. }) {
  46723. let i = $index + 1;
  46724. const index = column.index;
  46725. if (isNumber(index)) {
  46726. i = $index + index;
  46727. } else if (isFunction$1(index)) {
  46728. i = index($index);
  46729. }
  46730. return h$1("div", {}, [i]);
  46731. },
  46732. sortable: false
  46733. },
  46734. expand: {
  46735. renderHeader({ column }) {
  46736. return column.label || "";
  46737. },
  46738. renderCell({
  46739. row,
  46740. store,
  46741. expanded
  46742. }) {
  46743. const { ns } = store;
  46744. const classes = [ns.e("expand-icon")];
  46745. if (expanded) {
  46746. classes.push(ns.em("expand-icon", "expanded"));
  46747. }
  46748. const callback = function(e) {
  46749. e.stopPropagation();
  46750. store.toggleRowExpansion(row);
  46751. };
  46752. return h$1("div", {
  46753. class: classes,
  46754. onClick: callback
  46755. }, {
  46756. default: () => {
  46757. return [
  46758. h$1(ElIcon, null, {
  46759. default: () => {
  46760. return [h$1(arrow_right_default)];
  46761. }
  46762. })
  46763. ];
  46764. }
  46765. });
  46766. },
  46767. sortable: false,
  46768. resizable: false
  46769. }
  46770. };
  46771. function defaultRenderCell({
  46772. row,
  46773. column,
  46774. $index
  46775. }) {
  46776. var _a;
  46777. const property = column.property;
  46778. const value = property && getProp(row, property).value;
  46779. if (column && column.formatter) {
  46780. return column.formatter(row, column, value, $index);
  46781. }
  46782. return ((_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) || "";
  46783. }
  46784. function treeCellPrefix({
  46785. row,
  46786. treeNode,
  46787. store
  46788. }, createPlaceholder = false) {
  46789. const { ns } = store;
  46790. if (!treeNode) {
  46791. if (createPlaceholder) {
  46792. return [
  46793. h$1("span", {
  46794. class: ns.e("placeholder")
  46795. })
  46796. ];
  46797. }
  46798. return null;
  46799. }
  46800. const ele = [];
  46801. const callback = function(e) {
  46802. e.stopPropagation();
  46803. if (treeNode.loading) {
  46804. return;
  46805. }
  46806. store.loadOrToggle(row);
  46807. };
  46808. if (treeNode.indent) {
  46809. ele.push(h$1("span", {
  46810. class: ns.e("indent"),
  46811. style: { "padding-left": `${treeNode.indent}px` }
  46812. }));
  46813. }
  46814. if (isBoolean(treeNode.expanded) && !treeNode.noLazyChildren) {
  46815. const expandClasses = [
  46816. ns.e("expand-icon"),
  46817. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  46818. ];
  46819. let icon = arrow_right_default;
  46820. if (treeNode.loading) {
  46821. icon = loading_default;
  46822. }
  46823. ele.push(h$1("div", {
  46824. class: expandClasses,
  46825. onClick: callback
  46826. }, {
  46827. default: () => {
  46828. return [
  46829. h$1(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  46830. default: () => [h$1(icon)]
  46831. })
  46832. ];
  46833. }
  46834. }));
  46835. } else {
  46836. ele.push(h$1("span", {
  46837. class: ns.e("placeholder")
  46838. }));
  46839. }
  46840. return ele;
  46841. }
  46842. function getAllAliases(props, aliases) {
  46843. return props.reduce((prev, cur) => {
  46844. prev[cur] = cur;
  46845. return prev;
  46846. }, aliases);
  46847. }
  46848. function useWatcher(owner, props_) {
  46849. const instance = getCurrentInstance();
  46850. const registerComplexWatchers = () => {
  46851. const props = ["fixed"];
  46852. const aliases = {
  46853. realWidth: "width",
  46854. realMinWidth: "minWidth"
  46855. };
  46856. const allAliases = getAllAliases(props, aliases);
  46857. Object.keys(allAliases).forEach((key) => {
  46858. const columnKey = aliases[key];
  46859. if (hasOwn(props_, columnKey)) {
  46860. watch(() => props_[columnKey], (newVal) => {
  46861. let value = newVal;
  46862. if (columnKey === "width" && key === "realWidth") {
  46863. value = parseWidth(newVal);
  46864. }
  46865. if (columnKey === "minWidth" && key === "realMinWidth") {
  46866. value = parseMinWidth(newVal);
  46867. }
  46868. instance.columnConfig.value[columnKey] = value;
  46869. instance.columnConfig.value[key] = value;
  46870. const updateColumns = columnKey === "fixed";
  46871. owner.value.store.scheduleLayout(updateColumns);
  46872. });
  46873. }
  46874. });
  46875. };
  46876. const registerNormalWatchers = () => {
  46877. const props = [
  46878. "label",
  46879. "filters",
  46880. "filterMultiple",
  46881. "filteredValue",
  46882. "sortable",
  46883. "index",
  46884. "formatter",
  46885. "className",
  46886. "labelClassName",
  46887. "filterClassName",
  46888. "showOverflowTooltip"
  46889. ];
  46890. const aliases = {
  46891. property: "prop",
  46892. align: "realAlign",
  46893. headerAlign: "realHeaderAlign"
  46894. };
  46895. const allAliases = getAllAliases(props, aliases);
  46896. Object.keys(allAliases).forEach((key) => {
  46897. const columnKey = aliases[key];
  46898. if (hasOwn(props_, columnKey)) {
  46899. watch(() => props_[columnKey], (newVal) => {
  46900. instance.columnConfig.value[key] = newVal;
  46901. });
  46902. }
  46903. });
  46904. };
  46905. return {
  46906. registerComplexWatchers,
  46907. registerNormalWatchers
  46908. };
  46909. }
  46910. function useRender(props, slots, owner) {
  46911. const instance = getCurrentInstance();
  46912. const columnId = ref("");
  46913. const isSubColumn = ref(false);
  46914. const realAlign = ref();
  46915. const realHeaderAlign = ref();
  46916. const ns = useNamespace("table");
  46917. watchEffect(() => {
  46918. realAlign.value = props.align ? `is-${props.align}` : null;
  46919. realAlign.value;
  46920. });
  46921. watchEffect(() => {
  46922. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  46923. realHeaderAlign.value;
  46924. });
  46925. const columnOrTableParent = computed(() => {
  46926. let parent = instance.vnode.vParent || instance.parent;
  46927. while (parent && !parent.tableId && !parent.columnId) {
  46928. parent = parent.vnode.vParent || parent.parent;
  46929. }
  46930. return parent;
  46931. });
  46932. const hasTreeColumn = computed(() => {
  46933. const { store } = instance.parent;
  46934. if (!store)
  46935. return false;
  46936. const { treeData } = store.states;
  46937. const treeDataValue = treeData.value;
  46938. return treeDataValue && Object.keys(treeDataValue).length > 0;
  46939. });
  46940. const realWidth = ref(parseWidth(props.width));
  46941. const realMinWidth = ref(parseMinWidth(props.minWidth));
  46942. const setColumnWidth = (column) => {
  46943. if (realWidth.value)
  46944. column.width = realWidth.value;
  46945. if (realMinWidth.value) {
  46946. column.minWidth = realMinWidth.value;
  46947. }
  46948. if (!realWidth.value && realMinWidth.value) {
  46949. column.width = void 0;
  46950. }
  46951. if (!column.minWidth) {
  46952. column.minWidth = 80;
  46953. }
  46954. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  46955. return column;
  46956. };
  46957. const setColumnForcedProps = (column) => {
  46958. const type = column.type;
  46959. const source = cellForced[type] || {};
  46960. Object.keys(source).forEach((prop) => {
  46961. const value = source[prop];
  46962. if (prop !== "className" && value !== void 0) {
  46963. column[prop] = value;
  46964. }
  46965. });
  46966. const className = getDefaultClassName(type);
  46967. if (className) {
  46968. const forceClass = `${unref(ns.namespace)}-${className}`;
  46969. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  46970. }
  46971. return column;
  46972. };
  46973. const checkSubColumn = (children) => {
  46974. if (isArray$1(children)) {
  46975. children.forEach((child) => check(child));
  46976. } else {
  46977. check(children);
  46978. }
  46979. function check(item) {
  46980. var _a;
  46981. if (((_a = item == null ? void 0 : item.type) == null ? void 0 : _a.name) === "ElTableColumn") {
  46982. item.vParent = instance;
  46983. }
  46984. }
  46985. };
  46986. const setColumnRenders = (column) => {
  46987. if (props.renderHeader) ; else if (column.type !== "selection") {
  46988. column.renderHeader = (scope) => {
  46989. instance.columnConfig.value["label"];
  46990. return renderSlot(slots, "header", scope, () => [column.label]);
  46991. };
  46992. }
  46993. if (slots["filter-icon"]) {
  46994. column.renderFilterIcon = (scope) => {
  46995. return renderSlot(slots, "filter-icon", scope);
  46996. };
  46997. }
  46998. let originRenderCell = column.renderCell;
  46999. if (column.type === "expand") {
  47000. column.renderCell = (data) => h$1("div", {
  47001. class: "cell"
  47002. }, [originRenderCell(data)]);
  47003. owner.value.renderExpanded = (data) => {
  47004. return slots.default ? slots.default(data) : slots.default;
  47005. };
  47006. } else {
  47007. originRenderCell = originRenderCell || defaultRenderCell;
  47008. column.renderCell = (data) => {
  47009. let children = null;
  47010. if (slots.default) {
  47011. const vnodes = slots.default(data);
  47012. children = vnodes.some((v) => v.type !== Comment) ? vnodes : originRenderCell(data);
  47013. } else {
  47014. children = originRenderCell(data);
  47015. }
  47016. const { columns } = owner.value.store.states;
  47017. const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default");
  47018. const shouldCreatePlaceholder = hasTreeColumn.value && data.cellIndex === firstUserColumnIndex;
  47019. const prefix = treeCellPrefix(data, shouldCreatePlaceholder);
  47020. const props2 = {
  47021. class: "cell",
  47022. style: {}
  47023. };
  47024. if (column.showOverflowTooltip) {
  47025. props2.class = `${props2.class} ${unref(ns.namespace)}-tooltip`;
  47026. props2.style = {
  47027. width: `${(data.column.realWidth || Number(data.column.width)) - 1}px`
  47028. };
  47029. }
  47030. checkSubColumn(children);
  47031. return h$1("div", props2, [prefix, children]);
  47032. };
  47033. }
  47034. return column;
  47035. };
  47036. const getPropsData = (...propsKey) => {
  47037. return propsKey.reduce((prev, cur) => {
  47038. if (isArray$1(cur)) {
  47039. cur.forEach((key) => {
  47040. prev[key] = props[key];
  47041. });
  47042. }
  47043. return prev;
  47044. }, {});
  47045. };
  47046. const getColumnElIndex = (children, child) => {
  47047. return Array.prototype.indexOf.call(children, child);
  47048. };
  47049. const updateColumnOrder = () => {
  47050. owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
  47051. };
  47052. return {
  47053. columnId,
  47054. realAlign,
  47055. isSubColumn,
  47056. realHeaderAlign,
  47057. columnOrTableParent,
  47058. setColumnWidth,
  47059. setColumnForcedProps,
  47060. setColumnRenders,
  47061. getPropsData,
  47062. getColumnElIndex,
  47063. updateColumnOrder
  47064. };
  47065. }
  47066. var defaultProps = {
  47067. type: {
  47068. type: String,
  47069. default: "default"
  47070. },
  47071. label: String,
  47072. className: String,
  47073. labelClassName: String,
  47074. property: String,
  47075. prop: String,
  47076. width: {
  47077. type: [String, Number],
  47078. default: ""
  47079. },
  47080. minWidth: {
  47081. type: [String, Number],
  47082. default: ""
  47083. },
  47084. renderHeader: Function,
  47085. sortable: {
  47086. type: [Boolean, String],
  47087. default: false
  47088. },
  47089. sortMethod: Function,
  47090. sortBy: [String, Function, Array],
  47091. resizable: {
  47092. type: Boolean,
  47093. default: true
  47094. },
  47095. columnKey: String,
  47096. align: String,
  47097. headerAlign: String,
  47098. showOverflowTooltip: {
  47099. type: [Boolean, Object],
  47100. default: void 0
  47101. },
  47102. fixed: [Boolean, String],
  47103. formatter: Function,
  47104. selectable: Function,
  47105. reserveSelection: Boolean,
  47106. filterMethod: Function,
  47107. filteredValue: Array,
  47108. filters: Array,
  47109. filterPlacement: String,
  47110. filterMultiple: {
  47111. type: Boolean,
  47112. default: true
  47113. },
  47114. filterClassName: String,
  47115. index: [Number, Function],
  47116. sortOrders: {
  47117. type: Array,
  47118. default: () => {
  47119. return ["ascending", "descending", null];
  47120. },
  47121. validator: (val) => {
  47122. return val.every((order) => ["ascending", "descending", null].includes(order));
  47123. }
  47124. }
  47125. };
  47126. let columnIdSeed = 1;
  47127. var ElTableColumn$1 = defineComponent({
  47128. name: "ElTableColumn",
  47129. components: {
  47130. ElCheckbox
  47131. },
  47132. props: defaultProps,
  47133. setup(props, { slots }) {
  47134. const instance = getCurrentInstance();
  47135. const columnConfig = ref({});
  47136. const owner = computed(() => {
  47137. let parent2 = instance.parent;
  47138. while (parent2 && !parent2.tableId) {
  47139. parent2 = parent2.parent;
  47140. }
  47141. return parent2;
  47142. });
  47143. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  47144. const {
  47145. columnId,
  47146. isSubColumn,
  47147. realHeaderAlign,
  47148. columnOrTableParent,
  47149. setColumnWidth,
  47150. setColumnForcedProps,
  47151. setColumnRenders,
  47152. getPropsData,
  47153. getColumnElIndex,
  47154. realAlign,
  47155. updateColumnOrder
  47156. } = useRender(props, slots, owner);
  47157. const parent = columnOrTableParent.value;
  47158. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  47159. onBeforeMount(() => {
  47160. isSubColumn.value = owner.value !== parent;
  47161. const type = props.type || "default";
  47162. const sortable = props.sortable === "" ? true : props.sortable;
  47163. const showOverflowTooltip = isUndefined(props.showOverflowTooltip) ? parent.props.showOverflowTooltip : props.showOverflowTooltip;
  47164. const defaults = {
  47165. ...cellStarts[type],
  47166. id: columnId.value,
  47167. type,
  47168. property: props.prop || props.property,
  47169. align: realAlign,
  47170. headerAlign: realHeaderAlign,
  47171. showOverflowTooltip,
  47172. filterable: props.filters || props.filterMethod,
  47173. filteredValue: [],
  47174. filterPlacement: "",
  47175. filterClassName: "",
  47176. isColumnGroup: false,
  47177. isSubColumn: false,
  47178. filterOpened: false,
  47179. sortable,
  47180. index: props.index,
  47181. rawColumnKey: instance.vnode.key
  47182. };
  47183. const basicProps = [
  47184. "columnKey",
  47185. "label",
  47186. "className",
  47187. "labelClassName",
  47188. "type",
  47189. "renderHeader",
  47190. "formatter",
  47191. "fixed",
  47192. "resizable"
  47193. ];
  47194. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  47195. const selectProps = ["selectable", "reserveSelection"];
  47196. const filterProps = [
  47197. "filterMethod",
  47198. "filters",
  47199. "filterMultiple",
  47200. "filterOpened",
  47201. "filteredValue",
  47202. "filterPlacement",
  47203. "filterClassName"
  47204. ];
  47205. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  47206. column = mergeOptions(defaults, column);
  47207. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  47208. column = chains(column);
  47209. columnConfig.value = column;
  47210. registerNormalWatchers();
  47211. registerComplexWatchers();
  47212. });
  47213. onMounted(() => {
  47214. var _a;
  47215. const parent2 = columnOrTableParent.value;
  47216. const children = isSubColumn.value ? parent2.vnode.el.children : (_a = parent2.refs.hiddenColumns) == null ? void 0 : _a.children;
  47217. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  47218. columnConfig.value.getColumnIndex = getColumnIndex;
  47219. const columnIndex = getColumnIndex();
  47220. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null, updateColumnOrder);
  47221. });
  47222. onBeforeUnmount(() => {
  47223. const getColumnIndex = columnConfig.value.getColumnIndex;
  47224. const columnIndex = getColumnIndex ? getColumnIndex() : -1;
  47225. columnIndex > -1 && owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null, updateColumnOrder);
  47226. });
  47227. instance.columnId = columnId.value;
  47228. instance.columnConfig = columnConfig;
  47229. return;
  47230. },
  47231. render() {
  47232. var _a, _b, _c;
  47233. try {
  47234. const renderDefault = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a, {
  47235. row: {},
  47236. column: {},
  47237. $index: -1
  47238. });
  47239. const children = [];
  47240. if (isArray$1(renderDefault)) {
  47241. for (const childNode of renderDefault) {
  47242. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  47243. children.push(childNode);
  47244. } else if (childNode.type === Fragment && isArray$1(childNode.children)) {
  47245. childNode.children.forEach((vnode2) => {
  47246. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString$1(vnode2 == null ? void 0 : vnode2.children)) {
  47247. children.push(vnode2);
  47248. }
  47249. });
  47250. }
  47251. }
  47252. }
  47253. const vnode = h$1("div", children);
  47254. return vnode;
  47255. } catch (e) {
  47256. return h$1("div", []);
  47257. }
  47258. }
  47259. });
  47260. const ElTable = withInstall(Table, {
  47261. TableColumn: ElTableColumn$1
  47262. });
  47263. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  47264. var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
  47265. SortOrder2["ASC"] = "asc";
  47266. SortOrder2["DESC"] = "desc";
  47267. return SortOrder2;
  47268. })(SortOrder || {});
  47269. var Alignment = /* @__PURE__ */ ((Alignment2) => {
  47270. Alignment2["CENTER"] = "center";
  47271. Alignment2["RIGHT"] = "right";
  47272. return Alignment2;
  47273. })(Alignment || {});
  47274. var FixedDir = /* @__PURE__ */ ((FixedDir2) => {
  47275. FixedDir2["LEFT"] = "left";
  47276. FixedDir2["RIGHT"] = "right";
  47277. return FixedDir2;
  47278. })(FixedDir || {});
  47279. const oppositeOrderMap = {
  47280. ["asc" /* ASC */]: "desc" /* DESC */,
  47281. ["desc" /* DESC */]: "asc" /* ASC */
  47282. };
  47283. const placeholderSign = Symbol("placeholder");
  47284. const calcColumnStyle = (column, fixedColumn, fixed) => {
  47285. var _a;
  47286. const flex = {
  47287. flexGrow: 0,
  47288. flexShrink: 0,
  47289. ...fixed ? {} : {
  47290. flexGrow: column.flexGrow || 0,
  47291. flexShrink: column.flexShrink || 1
  47292. }
  47293. };
  47294. if (!fixed) {
  47295. flex.flexShrink = 1;
  47296. }
  47297. const style = {
  47298. ...(_a = column.style) != null ? _a : {},
  47299. ...flex,
  47300. flexBasis: "auto",
  47301. width: column.width
  47302. };
  47303. if (!fixedColumn) {
  47304. if (column.maxWidth)
  47305. style.maxWidth = column.maxWidth;
  47306. if (column.minWidth)
  47307. style.minWidth = column.minWidth;
  47308. }
  47309. return style;
  47310. };
  47311. function useColumns(props, columns, fixed) {
  47312. const _columns = computed(() => unref(columns).map((column, index) => {
  47313. var _a, _b;
  47314. return {
  47315. ...column,
  47316. key: (_b = (_a = column.key) != null ? _a : column.dataKey) != null ? _b : index
  47317. };
  47318. }));
  47319. const visibleColumns = computed(() => {
  47320. return unref(_columns).filter((column) => !column.hidden);
  47321. });
  47322. const fixedColumnsOnLeft = computed(() => unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true));
  47323. const fixedColumnsOnRight = computed(() => unref(visibleColumns).filter((column) => column.fixed === "right"));
  47324. const normalColumns = computed(() => unref(visibleColumns).filter((column) => !column.fixed));
  47325. const mainColumns = computed(() => {
  47326. const ret = [];
  47327. unref(fixedColumnsOnLeft).forEach((column) => {
  47328. ret.push({
  47329. ...column,
  47330. placeholderSign
  47331. });
  47332. });
  47333. unref(normalColumns).forEach((column) => {
  47334. ret.push(column);
  47335. });
  47336. unref(fixedColumnsOnRight).forEach((column) => {
  47337. ret.push({
  47338. ...column,
  47339. placeholderSign
  47340. });
  47341. });
  47342. return ret;
  47343. });
  47344. const hasFixedColumns = computed(() => {
  47345. return unref(fixedColumnsOnLeft).length || unref(fixedColumnsOnRight).length;
  47346. });
  47347. const columnsStyles = computed(() => {
  47348. return unref(_columns).reduce((style, column) => {
  47349. style[column.key] = calcColumnStyle(column, unref(fixed), props.fixed);
  47350. return style;
  47351. }, {});
  47352. });
  47353. const columnsTotalWidth = computed(() => {
  47354. return unref(visibleColumns).reduce((width, column) => width + column.width, 0);
  47355. });
  47356. const getColumn = (key) => {
  47357. return unref(_columns).find((column) => column.key === key);
  47358. };
  47359. const getColumnStyle = (key) => {
  47360. return unref(columnsStyles)[key];
  47361. };
  47362. const updateColumnWidth = (column, width) => {
  47363. column.width = width;
  47364. };
  47365. function onColumnSorted(e) {
  47366. var _a;
  47367. const { key } = e.currentTarget.dataset;
  47368. if (!key)
  47369. return;
  47370. const { sortState, sortBy } = props;
  47371. let order = SortOrder.ASC;
  47372. if (isObject$1(sortState)) {
  47373. order = oppositeOrderMap[sortState[key]];
  47374. } else {
  47375. order = oppositeOrderMap[sortBy.order];
  47376. }
  47377. (_a = props.onColumnSort) == null ? void 0 : _a.call(props, { column: getColumn(key), key, order });
  47378. }
  47379. return {
  47380. columns: _columns,
  47381. columnsStyles,
  47382. columnsTotalWidth,
  47383. fixedColumnsOnLeft,
  47384. fixedColumnsOnRight,
  47385. hasFixedColumns,
  47386. mainColumns,
  47387. normalColumns,
  47388. visibleColumns,
  47389. getColumn,
  47390. getColumnStyle,
  47391. updateColumnWidth,
  47392. onColumnSorted
  47393. };
  47394. }
  47395. const useScrollbar = (props, {
  47396. mainTableRef,
  47397. leftTableRef,
  47398. rightTableRef,
  47399. onMaybeEndReached
  47400. }) => {
  47401. const scrollPos = ref({ scrollLeft: 0, scrollTop: 0 });
  47402. function doScroll(params) {
  47403. var _a, _b, _c;
  47404. const { scrollTop } = params;
  47405. (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo(params);
  47406. (_b = leftTableRef.value) == null ? void 0 : _b.scrollToTop(scrollTop);
  47407. (_c = rightTableRef.value) == null ? void 0 : _c.scrollToTop(scrollTop);
  47408. }
  47409. function scrollTo(params) {
  47410. scrollPos.value = params;
  47411. doScroll(params);
  47412. }
  47413. function scrollToTop(scrollTop) {
  47414. scrollPos.value.scrollTop = scrollTop;
  47415. doScroll(unref(scrollPos));
  47416. }
  47417. function scrollToLeft(scrollLeft) {
  47418. var _a, _b;
  47419. scrollPos.value.scrollLeft = scrollLeft;
  47420. (_b = (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, unref(scrollPos));
  47421. }
  47422. function onScroll(params) {
  47423. var _a;
  47424. scrollTo(params);
  47425. (_a = props.onScroll) == null ? void 0 : _a.call(props, params);
  47426. }
  47427. function onVerticalScroll({ scrollTop }) {
  47428. const { scrollTop: currentScrollTop } = unref(scrollPos);
  47429. if (scrollTop !== currentScrollTop)
  47430. scrollToTop(scrollTop);
  47431. }
  47432. function scrollToRow(row, strategy = "auto") {
  47433. var _a;
  47434. (_a = mainTableRef.value) == null ? void 0 : _a.scrollToRow(row, strategy);
  47435. }
  47436. watch(() => unref(scrollPos).scrollTop, (cur, prev) => {
  47437. if (cur > prev)
  47438. onMaybeEndReached();
  47439. });
  47440. return {
  47441. scrollPos,
  47442. scrollTo,
  47443. scrollToLeft,
  47444. scrollToTop,
  47445. scrollToRow,
  47446. onScroll,
  47447. onVerticalScroll
  47448. };
  47449. };
  47450. const useRow = (props, {
  47451. mainTableRef,
  47452. leftTableRef,
  47453. rightTableRef,
  47454. tableInstance,
  47455. ns,
  47456. isScrolling
  47457. }) => {
  47458. const vm = getCurrentInstance();
  47459. const { emit } = vm;
  47460. const isResetting = shallowRef(false);
  47461. const expandedRowKeys = ref(props.defaultExpandedRowKeys || []);
  47462. const lastRenderedRowIndex = ref(-1);
  47463. const resetIndex = shallowRef(null);
  47464. const rowHeights = ref({});
  47465. const pendingRowHeights = ref({});
  47466. const leftTableHeights = shallowRef({});
  47467. const mainTableHeights = shallowRef({});
  47468. const rightTableHeights = shallowRef({});
  47469. const isDynamic = computed(() => isNumber(props.estimatedRowHeight));
  47470. function onRowsRendered(params) {
  47471. var _a;
  47472. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, params);
  47473. if (params.rowCacheEnd > unref(lastRenderedRowIndex)) {
  47474. lastRenderedRowIndex.value = params.rowCacheEnd;
  47475. }
  47476. }
  47477. function onRowHovered({ hovered, rowKey }) {
  47478. if (isScrolling.value) {
  47479. return;
  47480. }
  47481. const tableRoot = tableInstance.vnode.el;
  47482. const rows = tableRoot.querySelectorAll(`[rowkey="${String(rowKey)}"]`);
  47483. rows.forEach((row) => {
  47484. if (hovered) {
  47485. row.classList.add(ns.is("hovered"));
  47486. } else {
  47487. row.classList.remove(ns.is("hovered"));
  47488. }
  47489. });
  47490. }
  47491. function onRowExpanded({
  47492. expanded,
  47493. rowData,
  47494. rowIndex,
  47495. rowKey
  47496. }) {
  47497. var _a, _b;
  47498. const _expandedRowKeys = [...unref(expandedRowKeys)];
  47499. const currentKeyIndex = _expandedRowKeys.indexOf(rowKey);
  47500. if (expanded) {
  47501. if (currentKeyIndex === -1)
  47502. _expandedRowKeys.push(rowKey);
  47503. } else {
  47504. if (currentKeyIndex > -1)
  47505. _expandedRowKeys.splice(currentKeyIndex, 1);
  47506. }
  47507. expandedRowKeys.value = _expandedRowKeys;
  47508. emit("update:expandedRowKeys", _expandedRowKeys);
  47509. (_a = props.onRowExpand) == null ? void 0 : _a.call(props, {
  47510. expanded,
  47511. rowData,
  47512. rowIndex,
  47513. rowKey
  47514. });
  47515. (_b = props.onExpandedRowsChange) == null ? void 0 : _b.call(props, _expandedRowKeys);
  47516. }
  47517. const flushingRowHeights = debounce(() => {
  47518. var _a, _b, _c, _d;
  47519. isResetting.value = true;
  47520. rowHeights.value = { ...unref(rowHeights), ...unref(pendingRowHeights) };
  47521. resetAfterIndex(unref(resetIndex), false);
  47522. pendingRowHeights.value = {};
  47523. resetIndex.value = null;
  47524. (_a = mainTableRef.value) == null ? void 0 : _a.forceUpdate();
  47525. (_b = leftTableRef.value) == null ? void 0 : _b.forceUpdate();
  47526. (_c = rightTableRef.value) == null ? void 0 : _c.forceUpdate();
  47527. (_d = vm.proxy) == null ? void 0 : _d.$forceUpdate();
  47528. isResetting.value = false;
  47529. }, 0);
  47530. function resetAfterIndex(index, forceUpdate = false) {
  47531. if (!unref(isDynamic))
  47532. return;
  47533. [mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => {
  47534. const table = unref(tableRef);
  47535. if (table)
  47536. table.resetAfterRowIndex(index, forceUpdate);
  47537. });
  47538. }
  47539. function resetHeights(rowKey, height, rowIdx) {
  47540. const resetIdx = unref(resetIndex);
  47541. if (resetIdx === null) {
  47542. resetIndex.value = rowIdx;
  47543. } else {
  47544. if (resetIdx > rowIdx) {
  47545. resetIndex.value = rowIdx;
  47546. }
  47547. }
  47548. pendingRowHeights.value[rowKey] = height;
  47549. }
  47550. function onRowHeightChange({ rowKey, height, rowIndex }, fixedDir) {
  47551. if (!fixedDir) {
  47552. mainTableHeights.value[rowKey] = height;
  47553. } else {
  47554. if (fixedDir === FixedDir.RIGHT) {
  47555. rightTableHeights.value[rowKey] = height;
  47556. } else {
  47557. leftTableHeights.value[rowKey] = height;
  47558. }
  47559. }
  47560. const maximumHeight = Math.max(...[leftTableHeights, rightTableHeights, mainTableHeights].map((records) => records.value[rowKey] || 0));
  47561. if (unref(rowHeights)[rowKey] !== maximumHeight) {
  47562. resetHeights(rowKey, maximumHeight, rowIndex);
  47563. flushingRowHeights();
  47564. }
  47565. }
  47566. return {
  47567. expandedRowKeys,
  47568. lastRenderedRowIndex,
  47569. isDynamic,
  47570. isResetting,
  47571. rowHeights,
  47572. resetAfterIndex,
  47573. onRowExpanded,
  47574. onRowHovered,
  47575. onRowsRendered,
  47576. onRowHeightChange
  47577. };
  47578. };
  47579. const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => {
  47580. const depthMap = ref({});
  47581. const flattenedData = computed(() => {
  47582. const depths = {};
  47583. const { data: data2, rowKey } = props;
  47584. const _expandedRowKeys = unref(expandedRowKeys);
  47585. if (!_expandedRowKeys || !_expandedRowKeys.length)
  47586. return data2;
  47587. const array = [];
  47588. const keysSet = /* @__PURE__ */ new Set();
  47589. _expandedRowKeys.forEach((x) => keysSet.add(x));
  47590. let copy = data2.slice();
  47591. copy.forEach((x) => depths[x[rowKey]] = 0);
  47592. while (copy.length > 0) {
  47593. const item = copy.shift();
  47594. array.push(item);
  47595. if (keysSet.has(item[rowKey]) && isArray$1(item.children) && item.children.length > 0) {
  47596. copy = [...item.children, ...copy];
  47597. item.children.forEach((child) => depths[child[rowKey]] = depths[item[rowKey]] + 1);
  47598. }
  47599. }
  47600. depthMap.value = depths;
  47601. return array;
  47602. });
  47603. const data = computed(() => {
  47604. const { data: data2, expandColumnKey } = props;
  47605. return expandColumnKey ? unref(flattenedData) : data2;
  47606. });
  47607. watch(data, (val, prev) => {
  47608. if (val !== prev) {
  47609. lastRenderedRowIndex.value = -1;
  47610. resetAfterIndex(0, true);
  47611. }
  47612. });
  47613. return {
  47614. data,
  47615. depthMap
  47616. };
  47617. };
  47618. const sumReducer = (sum2, num) => sum2 + num;
  47619. const sum = (listLike) => {
  47620. return isArray$1(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  47621. };
  47622. const tryCall = (fLike, params, defaultRet = {}) => {
  47623. return isFunction$1(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet;
  47624. };
  47625. const enforceUnit = (style) => {
  47626. ["width", "maxWidth", "minWidth", "height"].forEach((key) => {
  47627. style[key] = addUnit(style[key]);
  47628. });
  47629. return style;
  47630. };
  47631. const componentToSlot = (ComponentLike) => isVNode(ComponentLike) ? (props) => h$1(ComponentLike, props) : ComponentLike;
  47632. const useStyles = (props, {
  47633. columnsTotalWidth,
  47634. rowsHeight,
  47635. fixedColumnsOnLeft,
  47636. fixedColumnsOnRight
  47637. }) => {
  47638. const bodyWidth = computed(() => {
  47639. const { fixed, width, vScrollbarSize } = props;
  47640. const ret = width - vScrollbarSize;
  47641. return fixed ? Math.max(Math.round(unref(columnsTotalWidth)), ret) : ret;
  47642. });
  47643. const headerWidth = computed(() => unref(bodyWidth) + props.vScrollbarSize);
  47644. const mainTableHeight = computed(() => {
  47645. const { height = 0, maxHeight = 0, footerHeight: footerHeight2, hScrollbarSize } = props;
  47646. if (maxHeight > 0) {
  47647. const _fixedRowsHeight = unref(fixedRowsHeight);
  47648. const _rowsHeight = unref(rowsHeight);
  47649. const _headerHeight = unref(headerHeight);
  47650. const total = _headerHeight + _fixedRowsHeight + _rowsHeight + hScrollbarSize;
  47651. return Math.min(total, maxHeight - footerHeight2);
  47652. }
  47653. return height - footerHeight2;
  47654. });
  47655. const fixedTableHeight = computed(() => {
  47656. const { maxHeight } = props;
  47657. const tableHeight = unref(mainTableHeight);
  47658. if (isNumber(maxHeight) && maxHeight > 0)
  47659. return tableHeight;
  47660. const totalHeight = unref(rowsHeight) + unref(headerHeight) + unref(fixedRowsHeight);
  47661. return Math.min(tableHeight, totalHeight);
  47662. });
  47663. const mapColumn = (column) => column.width;
  47664. const leftTableWidth = computed(() => sum(unref(fixedColumnsOnLeft).map(mapColumn)));
  47665. const rightTableWidth = computed(() => sum(unref(fixedColumnsOnRight).map(mapColumn)));
  47666. const headerHeight = computed(() => sum(props.headerHeight));
  47667. const fixedRowsHeight = computed(() => {
  47668. var _a;
  47669. return (((_a = props.fixedData) == null ? void 0 : _a.length) || 0) * props.rowHeight;
  47670. });
  47671. const windowHeight = computed(() => {
  47672. return unref(mainTableHeight) - unref(headerHeight) - unref(fixedRowsHeight);
  47673. });
  47674. const rootStyle = computed(() => {
  47675. const { style = {}, height, width } = props;
  47676. return enforceUnit({
  47677. ...style,
  47678. height,
  47679. width
  47680. });
  47681. });
  47682. const footerHeight = computed(() => enforceUnit({ height: props.footerHeight }));
  47683. const emptyStyle = computed(() => ({
  47684. top: addUnit(unref(headerHeight)),
  47685. bottom: addUnit(props.footerHeight),
  47686. width: addUnit(props.width)
  47687. }));
  47688. return {
  47689. bodyWidth,
  47690. fixedTableHeight,
  47691. mainTableHeight,
  47692. leftTableWidth,
  47693. rightTableWidth,
  47694. headerWidth,
  47695. windowHeight,
  47696. footerHeight,
  47697. emptyStyle,
  47698. rootStyle,
  47699. headerHeight
  47700. };
  47701. };
  47702. const useAutoResize = (props) => {
  47703. const sizer = ref();
  47704. const width$ = ref(0);
  47705. const height$ = ref(0);
  47706. let resizerStopper;
  47707. onMounted(() => {
  47708. resizerStopper = useResizeObserver(sizer, ([entry]) => {
  47709. const { width, height } = entry.contentRect;
  47710. const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
  47711. const left = Number.parseInt(paddingLeft) || 0;
  47712. const right = Number.parseInt(paddingRight) || 0;
  47713. const top = Number.parseInt(paddingTop) || 0;
  47714. const bottom = Number.parseInt(paddingBottom) || 0;
  47715. width$.value = width - left - right;
  47716. height$.value = height - top - bottom;
  47717. }).stop;
  47718. });
  47719. onBeforeUnmount(() => {
  47720. resizerStopper == null ? void 0 : resizerStopper();
  47721. });
  47722. watch([width$, height$], ([width, height]) => {
  47723. var _a;
  47724. (_a = props.onResize) == null ? void 0 : _a.call(props, {
  47725. width,
  47726. height
  47727. });
  47728. });
  47729. return {
  47730. sizer,
  47731. width: width$,
  47732. height: height$
  47733. };
  47734. };
  47735. function useTable(props) {
  47736. const mainTableRef = ref();
  47737. const leftTableRef = ref();
  47738. const rightTableRef = ref();
  47739. const {
  47740. columns,
  47741. columnsStyles,
  47742. columnsTotalWidth,
  47743. fixedColumnsOnLeft,
  47744. fixedColumnsOnRight,
  47745. hasFixedColumns,
  47746. mainColumns,
  47747. onColumnSorted
  47748. } = useColumns(props, toRef(props, "columns"), toRef(props, "fixed"));
  47749. const {
  47750. scrollTo,
  47751. scrollToLeft,
  47752. scrollToTop,
  47753. scrollToRow,
  47754. onScroll,
  47755. onVerticalScroll,
  47756. scrollPos
  47757. } = useScrollbar(props, {
  47758. mainTableRef,
  47759. leftTableRef,
  47760. rightTableRef,
  47761. onMaybeEndReached
  47762. });
  47763. const ns = useNamespace("table-v2");
  47764. const instance = getCurrentInstance();
  47765. const isScrolling = shallowRef(false);
  47766. const {
  47767. expandedRowKeys,
  47768. lastRenderedRowIndex,
  47769. isDynamic,
  47770. isResetting,
  47771. rowHeights,
  47772. resetAfterIndex,
  47773. onRowExpanded,
  47774. onRowHeightChange,
  47775. onRowHovered,
  47776. onRowsRendered
  47777. } = useRow(props, {
  47778. mainTableRef,
  47779. leftTableRef,
  47780. rightTableRef,
  47781. tableInstance: instance,
  47782. ns,
  47783. isScrolling
  47784. });
  47785. const { data, depthMap } = useData(props, {
  47786. expandedRowKeys,
  47787. lastRenderedRowIndex,
  47788. resetAfterIndex
  47789. });
  47790. const rowsHeight = computed(() => {
  47791. const { estimatedRowHeight, rowHeight } = props;
  47792. const _data = unref(data);
  47793. if (isNumber(estimatedRowHeight)) {
  47794. return Object.values(unref(rowHeights)).reduce((acc, curr) => acc + curr, 0);
  47795. }
  47796. return _data.length * rowHeight;
  47797. });
  47798. const {
  47799. bodyWidth,
  47800. fixedTableHeight,
  47801. mainTableHeight,
  47802. leftTableWidth,
  47803. rightTableWidth,
  47804. headerWidth,
  47805. windowHeight,
  47806. footerHeight,
  47807. emptyStyle,
  47808. rootStyle,
  47809. headerHeight
  47810. } = useStyles(props, {
  47811. columnsTotalWidth,
  47812. fixedColumnsOnLeft,
  47813. fixedColumnsOnRight,
  47814. rowsHeight
  47815. });
  47816. const containerRef = ref();
  47817. const showEmpty = computed(() => {
  47818. const noData = unref(data).length === 0;
  47819. return isArray$1(props.fixedData) ? props.fixedData.length === 0 && noData : noData;
  47820. });
  47821. function getRowHeight(rowIndex) {
  47822. const { estimatedRowHeight, rowHeight, rowKey } = props;
  47823. if (!estimatedRowHeight)
  47824. return rowHeight;
  47825. return unref(rowHeights)[unref(data)[rowIndex][rowKey]] || estimatedRowHeight;
  47826. }
  47827. function onMaybeEndReached() {
  47828. const { onEndReached } = props;
  47829. if (!onEndReached)
  47830. return;
  47831. const { scrollTop } = unref(scrollPos);
  47832. const _totalHeight = unref(rowsHeight);
  47833. const clientHeight = unref(windowHeight);
  47834. const heightUntilEnd = _totalHeight - (scrollTop + clientHeight) + props.hScrollbarSize;
  47835. if (unref(lastRenderedRowIndex) >= 0 && _totalHeight === scrollTop + unref(mainTableHeight) - unref(headerHeight)) {
  47836. onEndReached(heightUntilEnd);
  47837. }
  47838. }
  47839. watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, {
  47840. deep: true
  47841. });
  47842. return {
  47843. columns,
  47844. containerRef,
  47845. mainTableRef,
  47846. leftTableRef,
  47847. rightTableRef,
  47848. isDynamic,
  47849. isResetting,
  47850. isScrolling,
  47851. hasFixedColumns,
  47852. columnsStyles,
  47853. columnsTotalWidth,
  47854. data,
  47855. expandedRowKeys,
  47856. depthMap,
  47857. fixedColumnsOnLeft,
  47858. fixedColumnsOnRight,
  47859. mainColumns,
  47860. bodyWidth,
  47861. emptyStyle,
  47862. rootStyle,
  47863. headerWidth,
  47864. footerHeight,
  47865. mainTableHeight,
  47866. fixedTableHeight,
  47867. leftTableWidth,
  47868. rightTableWidth,
  47869. showEmpty,
  47870. getRowHeight,
  47871. onColumnSorted,
  47872. onRowHovered,
  47873. onRowExpanded,
  47874. onRowsRendered,
  47875. onRowHeightChange,
  47876. scrollTo,
  47877. scrollToLeft,
  47878. scrollToTop,
  47879. scrollToRow,
  47880. onScroll,
  47881. onVerticalScroll
  47882. };
  47883. }
  47884. const TableV2InjectionKey = Symbol("tableV2");
  47885. const classType = String;
  47886. const columns = {
  47887. type: definePropType(Array),
  47888. required: true
  47889. };
  47890. const fixedDataType = {
  47891. type: definePropType(Array)
  47892. };
  47893. const dataType = {
  47894. ...fixedDataType,
  47895. required: true
  47896. };
  47897. const expandColumnKey = String;
  47898. const expandKeys = {
  47899. type: definePropType(Array),
  47900. default: () => mutable([])
  47901. };
  47902. const requiredNumber = {
  47903. type: Number,
  47904. required: true
  47905. };
  47906. const rowKey = {
  47907. type: definePropType([String, Number, Symbol]),
  47908. default: "id"
  47909. };
  47910. const styleType = {
  47911. type: definePropType(Object)
  47912. };
  47913. const tableV2RowProps = buildProps({
  47914. class: String,
  47915. columns,
  47916. columnsStyles: {
  47917. type: definePropType(Object),
  47918. required: true
  47919. },
  47920. depth: Number,
  47921. expandColumnKey,
  47922. estimatedRowHeight: {
  47923. ...virtualizedGridProps.estimatedRowHeight,
  47924. default: void 0
  47925. },
  47926. isScrolling: Boolean,
  47927. onRowExpand: {
  47928. type: definePropType(Function)
  47929. },
  47930. onRowHover: {
  47931. type: definePropType(Function)
  47932. },
  47933. onRowHeightChange: {
  47934. type: definePropType(Function)
  47935. },
  47936. rowData: {
  47937. type: definePropType(Object),
  47938. required: true
  47939. },
  47940. rowEventHandlers: {
  47941. type: definePropType(Object)
  47942. },
  47943. rowIndex: {
  47944. type: Number,
  47945. required: true
  47946. },
  47947. rowKey,
  47948. style: {
  47949. type: definePropType(Object)
  47950. }
  47951. });
  47952. const requiredNumberType = {
  47953. type: Number,
  47954. required: true
  47955. };
  47956. const tableV2HeaderProps = buildProps({
  47957. class: String,
  47958. columns,
  47959. fixedHeaderData: {
  47960. type: definePropType(Array)
  47961. },
  47962. headerData: {
  47963. type: definePropType(Array),
  47964. required: true
  47965. },
  47966. headerHeight: {
  47967. type: definePropType([Number, Array]),
  47968. default: 50
  47969. },
  47970. rowWidth: requiredNumberType,
  47971. rowHeight: {
  47972. type: Number,
  47973. default: 50
  47974. },
  47975. height: requiredNumberType,
  47976. width: requiredNumberType
  47977. });
  47978. const tableV2GridProps = buildProps({
  47979. columns,
  47980. data: dataType,
  47981. fixedData: fixedDataType,
  47982. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  47983. width: requiredNumber,
  47984. height: requiredNumber,
  47985. headerWidth: requiredNumber,
  47986. headerHeight: tableV2HeaderProps.headerHeight,
  47987. bodyWidth: requiredNumber,
  47988. rowHeight: requiredNumber,
  47989. cache: virtualizedListProps.cache,
  47990. useIsScrolling: Boolean,
  47991. scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
  47992. scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
  47993. scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
  47994. class: classType,
  47995. style: styleType,
  47996. containerStyle: styleType,
  47997. getRowHeight: {
  47998. type: definePropType(Function),
  47999. required: true
  48000. },
  48001. rowKey: tableV2RowProps.rowKey,
  48002. onRowsRendered: {
  48003. type: definePropType(Function)
  48004. },
  48005. onScroll: {
  48006. type: definePropType(Function)
  48007. }
  48008. });
  48009. const tableV2Props = buildProps({
  48010. cache: tableV2GridProps.cache,
  48011. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  48012. rowKey,
  48013. headerClass: {
  48014. type: definePropType([
  48015. String,
  48016. Function
  48017. ])
  48018. },
  48019. headerProps: {
  48020. type: definePropType([
  48021. Object,
  48022. Function
  48023. ])
  48024. },
  48025. headerCellProps: {
  48026. type: definePropType([
  48027. Object,
  48028. Function
  48029. ])
  48030. },
  48031. headerHeight: tableV2HeaderProps.headerHeight,
  48032. footerHeight: {
  48033. type: Number,
  48034. default: 0
  48035. },
  48036. rowClass: {
  48037. type: definePropType([String, Function])
  48038. },
  48039. rowProps: {
  48040. type: definePropType([Object, Function])
  48041. },
  48042. rowHeight: {
  48043. type: Number,
  48044. default: 50
  48045. },
  48046. cellProps: {
  48047. type: definePropType([
  48048. Object,
  48049. Function
  48050. ])
  48051. },
  48052. columns,
  48053. data: dataType,
  48054. dataGetter: {
  48055. type: definePropType(Function)
  48056. },
  48057. fixedData: fixedDataType,
  48058. expandColumnKey: tableV2RowProps.expandColumnKey,
  48059. expandedRowKeys: expandKeys,
  48060. defaultExpandedRowKeys: expandKeys,
  48061. class: classType,
  48062. fixed: Boolean,
  48063. style: {
  48064. type: definePropType(Object)
  48065. },
  48066. width: requiredNumber,
  48067. height: requiredNumber,
  48068. maxHeight: Number,
  48069. useIsScrolling: Boolean,
  48070. indentSize: {
  48071. type: Number,
  48072. default: 12
  48073. },
  48074. iconSize: {
  48075. type: Number,
  48076. default: 12
  48077. },
  48078. hScrollbarSize: virtualizedGridProps.hScrollbarSize,
  48079. vScrollbarSize: virtualizedGridProps.vScrollbarSize,
  48080. scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,
  48081. sortBy: {
  48082. type: definePropType(Object),
  48083. default: () => ({})
  48084. },
  48085. sortState: {
  48086. type: definePropType(Object),
  48087. default: void 0
  48088. },
  48089. onColumnSort: {
  48090. type: definePropType(Function)
  48091. },
  48092. onExpandedRowsChange: {
  48093. type: definePropType(Function)
  48094. },
  48095. onEndReached: {
  48096. type: definePropType(Function)
  48097. },
  48098. onRowExpand: tableV2RowProps.onRowExpand,
  48099. onScroll: tableV2GridProps.onScroll,
  48100. onRowsRendered: tableV2GridProps.onRowsRendered,
  48101. rowEventHandlers: tableV2RowProps.rowEventHandlers
  48102. });
  48103. const TableV2Cell = (props, {
  48104. slots
  48105. }) => {
  48106. var _a;
  48107. const {
  48108. cellData,
  48109. style
  48110. } = props;
  48111. const displayText = ((_a = cellData == null ? void 0 : cellData.toString) == null ? void 0 : _a.call(cellData)) || "";
  48112. const defaultSlot = renderSlot(slots, "default", props, () => [displayText]);
  48113. return createVNode("div", {
  48114. "class": props.class,
  48115. "title": displayText,
  48116. "style": style
  48117. }, [defaultSlot]);
  48118. };
  48119. TableV2Cell.displayName = "ElTableV2Cell";
  48120. TableV2Cell.inheritAttrs = false;
  48121. var TableCell = TableV2Cell;
  48122. const HeaderCell = (props, {
  48123. slots
  48124. }) => renderSlot(slots, "default", props, () => {
  48125. var _a, _b;
  48126. return [createVNode("div", {
  48127. "class": props.class,
  48128. "title": (_a = props.column) == null ? void 0 : _a.title
  48129. }, [(_b = props.column) == null ? void 0 : _b.title])];
  48130. });
  48131. HeaderCell.displayName = "ElTableV2HeaderCell";
  48132. HeaderCell.inheritAttrs = false;
  48133. var HeaderCell$1 = HeaderCell;
  48134. const tableV2HeaderRowProps = buildProps({
  48135. class: String,
  48136. columns,
  48137. columnsStyles: {
  48138. type: definePropType(Object),
  48139. required: true
  48140. },
  48141. headerIndex: Number,
  48142. style: { type: definePropType(Object) }
  48143. });
  48144. const TableV2HeaderRow = defineComponent({
  48145. name: "ElTableV2HeaderRow",
  48146. props: tableV2HeaderRowProps,
  48147. setup(props, {
  48148. slots
  48149. }) {
  48150. return () => {
  48151. const {
  48152. columns,
  48153. columnsStyles,
  48154. headerIndex,
  48155. style
  48156. } = props;
  48157. let Cells = columns.map((column, columnIndex) => {
  48158. return slots.cell({
  48159. columns,
  48160. column,
  48161. columnIndex,
  48162. headerIndex,
  48163. style: columnsStyles[column.key]
  48164. });
  48165. });
  48166. if (slots.header) {
  48167. Cells = slots.header({
  48168. cells: Cells.map((node) => {
  48169. if (isArray$1(node) && node.length === 1) {
  48170. return node[0];
  48171. }
  48172. return node;
  48173. }),
  48174. columns,
  48175. headerIndex
  48176. });
  48177. }
  48178. return createVNode("div", {
  48179. "class": props.class,
  48180. "style": style,
  48181. "role": "row"
  48182. }, [Cells]);
  48183. };
  48184. }
  48185. });
  48186. var HeaderRow = TableV2HeaderRow;
  48187. const COMPONENT_NAME$7 = "ElTableV2Header";
  48188. const TableV2Header = defineComponent({
  48189. name: COMPONENT_NAME$7,
  48190. props: tableV2HeaderProps,
  48191. setup(props, {
  48192. slots,
  48193. expose
  48194. }) {
  48195. const ns = useNamespace("table-v2");
  48196. const scrollLeftInfo = inject("tableV2GridScrollLeft");
  48197. const headerRef = ref();
  48198. const headerStyle = computed(() => enforceUnit({
  48199. width: props.width,
  48200. height: props.height
  48201. }));
  48202. const rowStyle = computed(() => enforceUnit({
  48203. width: props.rowWidth,
  48204. height: props.height
  48205. }));
  48206. const headerHeights = computed(() => castArray$1(unref(props.headerHeight)));
  48207. const scrollToLeft = (left) => {
  48208. const headerEl = unref(headerRef);
  48209. nextTick(() => {
  48210. (headerEl == null ? void 0 : headerEl.scroll) && headerEl.scroll({
  48211. left
  48212. });
  48213. });
  48214. };
  48215. const renderFixedRows = () => {
  48216. const fixedRowClassName = ns.e("fixed-header-row");
  48217. const {
  48218. columns,
  48219. fixedHeaderData,
  48220. rowHeight
  48221. } = props;
  48222. return fixedHeaderData == null ? void 0 : fixedHeaderData.map((fixedRowData, fixedRowIndex) => {
  48223. var _a;
  48224. const style = enforceUnit({
  48225. height: rowHeight,
  48226. width: "100%"
  48227. });
  48228. return (_a = slots.fixed) == null ? void 0 : _a.call(slots, {
  48229. class: fixedRowClassName,
  48230. columns,
  48231. rowData: fixedRowData,
  48232. rowIndex: -(fixedRowIndex + 1),
  48233. style
  48234. });
  48235. });
  48236. };
  48237. const renderDynamicRows = () => {
  48238. const dynamicRowClassName = ns.e("dynamic-header-row");
  48239. const {
  48240. columns
  48241. } = props;
  48242. return unref(headerHeights).map((rowHeight, rowIndex) => {
  48243. var _a;
  48244. const style = enforceUnit({
  48245. width: "100%",
  48246. height: rowHeight
  48247. });
  48248. return (_a = slots.dynamic) == null ? void 0 : _a.call(slots, {
  48249. class: dynamicRowClassName,
  48250. columns,
  48251. headerIndex: rowIndex,
  48252. style
  48253. });
  48254. });
  48255. };
  48256. onUpdated(() => {
  48257. if (scrollLeftInfo == null ? void 0 : scrollLeftInfo.value) {
  48258. scrollToLeft(scrollLeftInfo.value);
  48259. }
  48260. });
  48261. expose({
  48262. scrollToLeft
  48263. });
  48264. return () => {
  48265. if (props.height <= 0)
  48266. return;
  48267. return createVNode("div", {
  48268. "ref": headerRef,
  48269. "class": props.class,
  48270. "style": unref(headerStyle),
  48271. "role": "rowgroup"
  48272. }, [createVNode("div", {
  48273. "style": unref(rowStyle),
  48274. "class": ns.e("header")
  48275. }, [renderDynamicRows(), renderFixedRows()])]);
  48276. };
  48277. }
  48278. });
  48279. var Header = TableV2Header;
  48280. const useTableRow = (props) => {
  48281. const {
  48282. isScrolling
  48283. } = inject(TableV2InjectionKey);
  48284. const measured = ref(false);
  48285. const rowRef = ref();
  48286. const measurable = computed(() => {
  48287. return isNumber(props.estimatedRowHeight) && props.rowIndex >= 0;
  48288. });
  48289. const doMeasure = (isInit = false) => {
  48290. const $rowRef = unref(rowRef);
  48291. if (!$rowRef)
  48292. return;
  48293. const {
  48294. columns,
  48295. onRowHeightChange,
  48296. rowKey,
  48297. rowIndex,
  48298. style
  48299. } = props;
  48300. const {
  48301. height
  48302. } = $rowRef.getBoundingClientRect();
  48303. measured.value = true;
  48304. nextTick(() => {
  48305. if (isInit || height !== Number.parseInt(style.height)) {
  48306. const firstColumn = columns[0];
  48307. const isPlaceholder = (firstColumn == null ? void 0 : firstColumn.placeholderSign) === placeholderSign;
  48308. onRowHeightChange == null ? void 0 : onRowHeightChange({
  48309. rowKey,
  48310. height,
  48311. rowIndex
  48312. }, firstColumn && !isPlaceholder && firstColumn.fixed);
  48313. }
  48314. });
  48315. };
  48316. const eventHandlers = computed(() => {
  48317. const {
  48318. rowData,
  48319. rowIndex,
  48320. rowKey,
  48321. onRowHover
  48322. } = props;
  48323. const handlers = props.rowEventHandlers || {};
  48324. const eventHandlers2 = {};
  48325. Object.entries(handlers).forEach(([eventName, handler]) => {
  48326. if (isFunction$1(handler)) {
  48327. eventHandlers2[eventName] = (event) => {
  48328. handler({
  48329. event,
  48330. rowData,
  48331. rowIndex,
  48332. rowKey
  48333. });
  48334. };
  48335. }
  48336. });
  48337. if (onRowHover) {
  48338. [{
  48339. name: "onMouseleave",
  48340. hovered: false
  48341. }, {
  48342. name: "onMouseenter",
  48343. hovered: true
  48344. }].forEach(({
  48345. name,
  48346. hovered
  48347. }) => {
  48348. const existedHandler = eventHandlers2[name];
  48349. eventHandlers2[name] = (event) => {
  48350. onRowHover({
  48351. event,
  48352. hovered,
  48353. rowData,
  48354. rowIndex,
  48355. rowKey
  48356. });
  48357. existedHandler == null ? void 0 : existedHandler(event);
  48358. };
  48359. });
  48360. }
  48361. return eventHandlers2;
  48362. });
  48363. const onExpand = (expanded) => {
  48364. const {
  48365. onRowExpand,
  48366. rowData,
  48367. rowIndex,
  48368. rowKey
  48369. } = props;
  48370. onRowExpand == null ? void 0 : onRowExpand({
  48371. expanded,
  48372. rowData,
  48373. rowIndex,
  48374. rowKey
  48375. });
  48376. };
  48377. onMounted(() => {
  48378. if (unref(measurable)) {
  48379. doMeasure(true);
  48380. }
  48381. });
  48382. return {
  48383. isScrolling,
  48384. measurable,
  48385. measured,
  48386. rowRef,
  48387. eventHandlers,
  48388. onExpand
  48389. };
  48390. };
  48391. const COMPONENT_NAME$6 = "ElTableV2TableRow";
  48392. const TableV2Row = defineComponent({
  48393. name: COMPONENT_NAME$6,
  48394. props: tableV2RowProps,
  48395. setup(props, {
  48396. expose,
  48397. slots,
  48398. attrs
  48399. }) {
  48400. const {
  48401. eventHandlers,
  48402. isScrolling,
  48403. measurable,
  48404. measured,
  48405. rowRef,
  48406. onExpand
  48407. } = useTableRow(props);
  48408. expose({
  48409. onExpand
  48410. });
  48411. return () => {
  48412. const {
  48413. columns,
  48414. columnsStyles,
  48415. expandColumnKey,
  48416. depth,
  48417. rowData,
  48418. rowIndex,
  48419. style
  48420. } = props;
  48421. let ColumnCells = columns.map((column, columnIndex) => {
  48422. const expandable = isArray$1(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey;
  48423. return slots.cell({
  48424. column,
  48425. columns,
  48426. columnIndex,
  48427. depth,
  48428. style: columnsStyles[column.key],
  48429. rowData,
  48430. rowIndex,
  48431. isScrolling: unref(isScrolling),
  48432. expandIconProps: expandable ? {
  48433. rowData,
  48434. rowIndex,
  48435. onExpand
  48436. } : void 0
  48437. });
  48438. });
  48439. if (slots.row) {
  48440. ColumnCells = slots.row({
  48441. cells: ColumnCells.map((node) => {
  48442. if (isArray$1(node) && node.length === 1) {
  48443. return node[0];
  48444. }
  48445. return node;
  48446. }),
  48447. style,
  48448. columns,
  48449. depth,
  48450. rowData,
  48451. rowIndex,
  48452. isScrolling: unref(isScrolling)
  48453. });
  48454. }
  48455. if (unref(measurable)) {
  48456. const {
  48457. height,
  48458. ...exceptHeightStyle
  48459. } = style || {};
  48460. const _measured = unref(measured);
  48461. return createVNode("div", mergeProps({
  48462. "ref": rowRef,
  48463. "class": props.class,
  48464. "style": _measured ? style : exceptHeightStyle,
  48465. "role": "row"
  48466. }, attrs, unref(eventHandlers)), [ColumnCells]);
  48467. }
  48468. return createVNode("div", mergeProps(attrs, {
  48469. "ref": rowRef,
  48470. "class": props.class,
  48471. "style": style,
  48472. "role": "row"
  48473. }, unref(eventHandlers)), [ColumnCells]);
  48474. };
  48475. }
  48476. });
  48477. var Row = TableV2Row;
  48478. const SortIcon = (props) => {
  48479. const {
  48480. sortOrder
  48481. } = props;
  48482. return createVNode(ElIcon, {
  48483. "size": 14,
  48484. "class": props.class
  48485. }, {
  48486. default: () => [sortOrder === SortOrder.ASC ? createVNode(sort_up_default, null, null) : createVNode(sort_down_default, null, null)]
  48487. });
  48488. };
  48489. var SortIcon$1 = SortIcon;
  48490. const ExpandIcon = (props) => {
  48491. const {
  48492. expanded,
  48493. expandable,
  48494. onExpand,
  48495. style,
  48496. size
  48497. } = props;
  48498. const expandIconProps = {
  48499. onClick: expandable ? () => onExpand(!expanded) : void 0,
  48500. class: props.class
  48501. };
  48502. return createVNode(ElIcon, mergeProps(expandIconProps, {
  48503. "size": size,
  48504. "style": style
  48505. }), {
  48506. default: () => [createVNode(arrow_right_default, null, null)]
  48507. });
  48508. };
  48509. var ExpandIcon$1 = ExpandIcon;
  48510. const COMPONENT_NAME$5 = "ElTableV2Grid";
  48511. const useTableGrid = (props) => {
  48512. const headerRef = ref();
  48513. const bodyRef = ref();
  48514. const scrollLeft = ref(0);
  48515. const totalHeight = computed(() => {
  48516. const {
  48517. data,
  48518. rowHeight,
  48519. estimatedRowHeight
  48520. } = props;
  48521. if (estimatedRowHeight) {
  48522. return;
  48523. }
  48524. return data.length * rowHeight;
  48525. });
  48526. const fixedRowHeight = computed(() => {
  48527. const {
  48528. fixedData,
  48529. rowHeight
  48530. } = props;
  48531. return ((fixedData == null ? void 0 : fixedData.length) || 0) * rowHeight;
  48532. });
  48533. const headerHeight = computed(() => sum(props.headerHeight));
  48534. const gridHeight = computed(() => {
  48535. const {
  48536. height
  48537. } = props;
  48538. return Math.max(0, height - unref(headerHeight) - unref(fixedRowHeight));
  48539. });
  48540. const hasHeader = computed(() => {
  48541. return unref(headerHeight) + unref(fixedRowHeight) > 0;
  48542. });
  48543. const itemKey = ({
  48544. data,
  48545. rowIndex
  48546. }) => data[rowIndex][props.rowKey];
  48547. function onItemRendered({
  48548. rowCacheStart,
  48549. rowCacheEnd,
  48550. rowVisibleStart,
  48551. rowVisibleEnd
  48552. }) {
  48553. var _a;
  48554. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, {
  48555. rowCacheStart,
  48556. rowCacheEnd,
  48557. rowVisibleStart,
  48558. rowVisibleEnd
  48559. });
  48560. }
  48561. function resetAfterRowIndex(index, forceUpdate2) {
  48562. var _a;
  48563. (_a = bodyRef.value) == null ? void 0 : _a.resetAfterRowIndex(index, forceUpdate2);
  48564. }
  48565. function scrollTo(leftOrOptions, top) {
  48566. const header$ = unref(headerRef);
  48567. const body$ = unref(bodyRef);
  48568. if (isObject$1(leftOrOptions)) {
  48569. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions.scrollLeft);
  48570. scrollLeft.value = leftOrOptions.scrollLeft;
  48571. body$ == null ? void 0 : body$.scrollTo(leftOrOptions);
  48572. } else {
  48573. header$ == null ? void 0 : header$.scrollToLeft(leftOrOptions);
  48574. scrollLeft.value = leftOrOptions;
  48575. body$ == null ? void 0 : body$.scrollTo({
  48576. scrollLeft: leftOrOptions,
  48577. scrollTop: top
  48578. });
  48579. }
  48580. }
  48581. function scrollToTop(scrollTop) {
  48582. var _a;
  48583. (_a = unref(bodyRef)) == null ? void 0 : _a.scrollTo({
  48584. scrollTop
  48585. });
  48586. }
  48587. function scrollToRow(row, strategy) {
  48588. var _a;
  48589. (_a = unref(bodyRef)) == null ? void 0 : _a.scrollToItem(row, 1, strategy);
  48590. }
  48591. function forceUpdate() {
  48592. var _a, _b;
  48593. (_a = unref(bodyRef)) == null ? void 0 : _a.$forceUpdate();
  48594. (_b = unref(headerRef)) == null ? void 0 : _b.$forceUpdate();
  48595. }
  48596. return {
  48597. bodyRef,
  48598. forceUpdate,
  48599. fixedRowHeight,
  48600. gridHeight,
  48601. hasHeader,
  48602. headerHeight,
  48603. headerRef,
  48604. totalHeight,
  48605. itemKey,
  48606. onItemRendered,
  48607. resetAfterRowIndex,
  48608. scrollTo,
  48609. scrollToTop,
  48610. scrollToRow,
  48611. scrollLeft
  48612. };
  48613. };
  48614. const TableGrid = defineComponent({
  48615. name: COMPONENT_NAME$5,
  48616. props: tableV2GridProps,
  48617. setup(props, {
  48618. slots,
  48619. expose
  48620. }) {
  48621. const {
  48622. ns
  48623. } = inject(TableV2InjectionKey);
  48624. const {
  48625. bodyRef,
  48626. fixedRowHeight,
  48627. gridHeight,
  48628. hasHeader,
  48629. headerRef,
  48630. headerHeight,
  48631. totalHeight,
  48632. forceUpdate,
  48633. itemKey,
  48634. onItemRendered,
  48635. resetAfterRowIndex,
  48636. scrollTo,
  48637. scrollToTop,
  48638. scrollToRow,
  48639. scrollLeft
  48640. } = useTableGrid(props);
  48641. provide("tableV2GridScrollLeft", scrollLeft);
  48642. expose({
  48643. forceUpdate,
  48644. totalHeight,
  48645. scrollTo,
  48646. scrollToTop,
  48647. scrollToRow,
  48648. resetAfterRowIndex
  48649. });
  48650. const getColumnWidth = () => props.bodyWidth;
  48651. return () => {
  48652. const {
  48653. cache,
  48654. columns,
  48655. data,
  48656. fixedData,
  48657. useIsScrolling,
  48658. scrollbarAlwaysOn,
  48659. scrollbarEndGap,
  48660. scrollbarStartGap,
  48661. style,
  48662. rowHeight,
  48663. bodyWidth,
  48664. estimatedRowHeight,
  48665. headerWidth,
  48666. height,
  48667. width,
  48668. getRowHeight,
  48669. onScroll
  48670. } = props;
  48671. const isDynamicRowEnabled = isNumber(estimatedRowHeight);
  48672. const Grid = isDynamicRowEnabled ? DynamicSizeGrid$1 : FixedSizeGrid$1;
  48673. const _headerHeight = unref(headerHeight);
  48674. return createVNode("div", {
  48675. "role": "table",
  48676. "class": [ns.e("table"), props.class],
  48677. "style": style
  48678. }, [createVNode(Grid, {
  48679. "ref": bodyRef,
  48680. "data": data,
  48681. "useIsScrolling": useIsScrolling,
  48682. "itemKey": itemKey,
  48683. "columnCache": 0,
  48684. "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth,
  48685. "totalColumn": 1,
  48686. "totalRow": data.length,
  48687. "rowCache": cache,
  48688. "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight,
  48689. "width": width,
  48690. "height": unref(gridHeight),
  48691. "class": ns.e("body"),
  48692. "role": "rowgroup",
  48693. "scrollbarStartGap": scrollbarStartGap,
  48694. "scrollbarEndGap": scrollbarEndGap,
  48695. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  48696. "onScroll": onScroll,
  48697. "onItemRendered": onItemRendered,
  48698. "perfMode": false
  48699. }, {
  48700. default: (params) => {
  48701. var _a;
  48702. const rowData = data[params.rowIndex];
  48703. return (_a = slots.row) == null ? void 0 : _a.call(slots, {
  48704. ...params,
  48705. columns,
  48706. rowData
  48707. });
  48708. }
  48709. }), unref(hasHeader) && createVNode(Header, {
  48710. "ref": headerRef,
  48711. "class": ns.e("header-wrapper"),
  48712. "columns": columns,
  48713. "headerData": data,
  48714. "headerHeight": props.headerHeight,
  48715. "fixedHeaderData": fixedData,
  48716. "rowWidth": headerWidth,
  48717. "rowHeight": rowHeight,
  48718. "width": width,
  48719. "height": Math.min(_headerHeight + unref(fixedRowHeight), height)
  48720. }, {
  48721. dynamic: slots.header,
  48722. fixed: slots.row
  48723. })]);
  48724. };
  48725. }
  48726. });
  48727. function _isSlot$5(s) {
  48728. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  48729. }
  48730. const MainTable = (props, {
  48731. slots
  48732. }) => {
  48733. const {
  48734. mainTableRef,
  48735. ...rest
  48736. } = props;
  48737. return createVNode(TableGrid, mergeProps({
  48738. "ref": mainTableRef
  48739. }, rest), _isSlot$5(slots) ? slots : {
  48740. default: () => [slots]
  48741. });
  48742. };
  48743. function _isSlot$4(s) {
  48744. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  48745. }
  48746. const LeftTable$1 = (props, {
  48747. slots
  48748. }) => {
  48749. if (!props.columns.length)
  48750. return;
  48751. const {
  48752. leftTableRef,
  48753. ...rest
  48754. } = props;
  48755. return createVNode(TableGrid, mergeProps({
  48756. "ref": leftTableRef
  48757. }, rest), _isSlot$4(slots) ? slots : {
  48758. default: () => [slots]
  48759. });
  48760. };
  48761. function _isSlot$3(s) {
  48762. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  48763. }
  48764. const LeftTable = (props, {
  48765. slots
  48766. }) => {
  48767. if (!props.columns.length)
  48768. return;
  48769. const {
  48770. rightTableRef,
  48771. ...rest
  48772. } = props;
  48773. return createVNode(TableGrid, mergeProps({
  48774. "ref": rightTableRef
  48775. }, rest), _isSlot$3(slots) ? slots : {
  48776. default: () => [slots]
  48777. });
  48778. };
  48779. function _isSlot$2(s) {
  48780. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  48781. }
  48782. const RowRenderer = (props, {
  48783. slots
  48784. }) => {
  48785. const {
  48786. columns,
  48787. columnsStyles,
  48788. depthMap,
  48789. expandColumnKey,
  48790. expandedRowKeys,
  48791. estimatedRowHeight,
  48792. hasFixedColumns,
  48793. rowData,
  48794. rowIndex,
  48795. style,
  48796. isScrolling,
  48797. rowProps,
  48798. rowClass,
  48799. rowKey,
  48800. rowEventHandlers,
  48801. ns,
  48802. onRowHovered,
  48803. onRowExpanded
  48804. } = props;
  48805. const rowKls = tryCall(rowClass, {
  48806. columns,
  48807. rowData,
  48808. rowIndex
  48809. }, "");
  48810. const additionalProps = tryCall(rowProps, {
  48811. columns,
  48812. rowData,
  48813. rowIndex
  48814. });
  48815. const _rowKey = rowData[rowKey];
  48816. const depth = depthMap[_rowKey] || 0;
  48817. const canExpand = Boolean(expandColumnKey);
  48818. const isFixedRow = rowIndex < 0;
  48819. const kls = [ns.e("row"), rowKls, {
  48820. [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0,
  48821. [ns.is("expanded")]: canExpand && expandedRowKeys.includes(_rowKey),
  48822. [ns.is("fixed")]: !depth && isFixedRow,
  48823. [ns.is("customized")]: Boolean(slots.row)
  48824. }];
  48825. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  48826. const _rowProps = {
  48827. ...additionalProps,
  48828. columns,
  48829. columnsStyles,
  48830. class: kls,
  48831. depth,
  48832. expandColumnKey,
  48833. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  48834. isScrolling,
  48835. rowIndex,
  48836. rowData,
  48837. rowKey: _rowKey,
  48838. rowEventHandlers,
  48839. style
  48840. };
  48841. const handlerMosueEnter = (e) => {
  48842. onRowHover == null ? void 0 : onRowHover({
  48843. hovered: true,
  48844. rowKey: _rowKey,
  48845. event: e,
  48846. rowData,
  48847. rowIndex
  48848. });
  48849. };
  48850. const handlerMouseLeave = (e) => {
  48851. onRowHover == null ? void 0 : onRowHover({
  48852. hovered: false,
  48853. rowKey: _rowKey,
  48854. event: e,
  48855. rowData,
  48856. rowIndex
  48857. });
  48858. };
  48859. return createVNode(Row, mergeProps(_rowProps, {
  48860. "onRowExpand": onRowExpanded,
  48861. "onMouseenter": handlerMosueEnter,
  48862. "onMouseleave": handlerMouseLeave,
  48863. "rowkey": _rowKey
  48864. }), _isSlot$2(slots) ? slots : {
  48865. default: () => [slots]
  48866. });
  48867. };
  48868. const CellRenderer = ({
  48869. columns,
  48870. column,
  48871. columnIndex,
  48872. depth,
  48873. expandIconProps,
  48874. isScrolling,
  48875. rowData,
  48876. rowIndex,
  48877. style,
  48878. expandedRowKeys,
  48879. ns,
  48880. cellProps: _cellProps,
  48881. expandColumnKey,
  48882. indentSize,
  48883. iconSize,
  48884. rowKey
  48885. }, {
  48886. slots
  48887. }) => {
  48888. const cellStyle = enforceUnit(style);
  48889. if (column.placeholderSign === placeholderSign) {
  48890. return createVNode("div", {
  48891. "class": ns.em("row-cell", "placeholder"),
  48892. "style": cellStyle
  48893. }, null);
  48894. }
  48895. const {
  48896. cellRenderer,
  48897. dataKey,
  48898. dataGetter
  48899. } = column;
  48900. const cellData = isFunction$1(dataGetter) ? dataGetter({
  48901. columns,
  48902. column,
  48903. columnIndex,
  48904. rowData,
  48905. rowIndex
  48906. }) : get(rowData, dataKey != null ? dataKey : "");
  48907. const extraCellProps = tryCall(_cellProps, {
  48908. cellData,
  48909. columns,
  48910. column,
  48911. columnIndex,
  48912. rowIndex,
  48913. rowData
  48914. });
  48915. const cellProps = {
  48916. class: ns.e("cell-text"),
  48917. columns,
  48918. column,
  48919. columnIndex,
  48920. cellData,
  48921. isScrolling,
  48922. rowData,
  48923. rowIndex
  48924. };
  48925. const columnCellRenderer = componentToSlot(cellRenderer);
  48926. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : renderSlot(slots, "default", cellProps, () => [createVNode(TableCell, cellProps, null)]);
  48927. const kls = [ns.e("row-cell"), column.class, column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right")];
  48928. const expandable = rowIndex >= 0 && expandColumnKey && column.key === expandColumnKey;
  48929. const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]);
  48930. let IconOrPlaceholder;
  48931. const iconStyle = `margin-inline-start: ${depth * indentSize}px;`;
  48932. if (expandable) {
  48933. if (isObject$1(expandIconProps)) {
  48934. IconOrPlaceholder = createVNode(ExpandIcon$1, mergeProps(expandIconProps, {
  48935. "class": [ns.e("expand-icon"), ns.is("expanded", expanded)],
  48936. "size": iconSize,
  48937. "expanded": expanded,
  48938. "style": iconStyle,
  48939. "expandable": true
  48940. }), null);
  48941. } else {
  48942. IconOrPlaceholder = createVNode("div", {
  48943. "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ")
  48944. }, null);
  48945. }
  48946. }
  48947. return createVNode("div", mergeProps({
  48948. "class": kls,
  48949. "style": cellStyle
  48950. }, extraCellProps, {
  48951. "role": "cell"
  48952. }), [IconOrPlaceholder, Cell]);
  48953. };
  48954. CellRenderer.inheritAttrs = false;
  48955. function _isSlot$1(s) {
  48956. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  48957. }
  48958. const HeaderRenderer = ({
  48959. columns,
  48960. columnsStyles,
  48961. headerIndex,
  48962. style,
  48963. headerClass,
  48964. headerProps,
  48965. ns
  48966. }, {
  48967. slots
  48968. }) => {
  48969. const param = {
  48970. columns,
  48971. headerIndex
  48972. };
  48973. const kls = [ns.e("header-row"), tryCall(headerClass, param, ""), {
  48974. [ns.is("customized")]: Boolean(slots.header)
  48975. }];
  48976. const extraProps = {
  48977. ...tryCall(headerProps, param),
  48978. columnsStyles,
  48979. class: kls,
  48980. columns,
  48981. headerIndex,
  48982. style
  48983. };
  48984. return createVNode(HeaderRow, extraProps, _isSlot$1(slots) ? slots : {
  48985. default: () => [slots]
  48986. });
  48987. };
  48988. const HeaderCellRenderer = (props, {
  48989. slots
  48990. }) => {
  48991. const {
  48992. column,
  48993. ns,
  48994. style,
  48995. onColumnSorted
  48996. } = props;
  48997. const cellStyle = enforceUnit(style);
  48998. if (column.placeholderSign === placeholderSign) {
  48999. return createVNode("div", {
  49000. "class": ns.em("header-row-cell", "placeholder"),
  49001. "style": cellStyle
  49002. }, null);
  49003. }
  49004. const {
  49005. headerCellRenderer,
  49006. headerClass,
  49007. sortable
  49008. } = column;
  49009. const cellProps = {
  49010. ...props,
  49011. class: ns.e("header-cell-text")
  49012. };
  49013. const columnCellRenderer = componentToSlot(headerCellRenderer);
  49014. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : renderSlot(slots, "default", cellProps, () => [createVNode(HeaderCell$1, cellProps, null)]);
  49015. const {
  49016. sortBy,
  49017. sortState,
  49018. headerCellProps
  49019. } = props;
  49020. let sorting, sortOrder;
  49021. if (sortState) {
  49022. const order = sortState[column.key];
  49023. sorting = Boolean(oppositeOrderMap[order]);
  49024. sortOrder = sorting ? order : SortOrder.ASC;
  49025. } else {
  49026. sorting = column.key === sortBy.key;
  49027. sortOrder = sorting ? sortBy.order : SortOrder.ASC;
  49028. }
  49029. 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")];
  49030. const cellWrapperProps = {
  49031. ...tryCall(headerCellProps, props),
  49032. onClick: column.sortable ? onColumnSorted : void 0,
  49033. class: cellKls,
  49034. style: cellStyle,
  49035. ["data-key"]: column.key
  49036. };
  49037. return createVNode("div", mergeProps(cellWrapperProps, {
  49038. "role": "columnheader"
  49039. }), [Cell, sortable && createVNode(SortIcon$1, {
  49040. "class": [ns.e("sort-icon"), sorting && ns.is("sorting")],
  49041. "sortOrder": sortOrder
  49042. }, null)]);
  49043. };
  49044. const Footer$1 = (props, {
  49045. slots
  49046. }) => {
  49047. var _a;
  49048. return createVNode("div", {
  49049. "class": props.class,
  49050. "style": props.style
  49051. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  49052. };
  49053. Footer$1.displayName = "ElTableV2Footer";
  49054. const Footer = (props, {
  49055. slots
  49056. }) => {
  49057. const defaultSlot = renderSlot(slots, "default", {}, () => [createVNode(ElEmpty, null, null)]);
  49058. return createVNode("div", {
  49059. "class": props.class,
  49060. "style": props.style
  49061. }, [defaultSlot]);
  49062. };
  49063. Footer.displayName = "ElTableV2Empty";
  49064. const Overlay = (props, {
  49065. slots
  49066. }) => {
  49067. var _a;
  49068. return createVNode("div", {
  49069. "class": props.class,
  49070. "style": props.style
  49071. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  49072. };
  49073. Overlay.displayName = "ElTableV2Overlay";
  49074. function _isSlot(s) {
  49075. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  49076. }
  49077. const COMPONENT_NAME$4 = "ElTableV2";
  49078. const TableV2 = defineComponent({
  49079. name: COMPONENT_NAME$4,
  49080. props: tableV2Props,
  49081. setup(props, {
  49082. slots,
  49083. expose
  49084. }) {
  49085. const ns = useNamespace("table-v2");
  49086. const {
  49087. columnsStyles,
  49088. fixedColumnsOnLeft,
  49089. fixedColumnsOnRight,
  49090. mainColumns,
  49091. mainTableHeight,
  49092. fixedTableHeight,
  49093. leftTableWidth,
  49094. rightTableWidth,
  49095. data,
  49096. depthMap,
  49097. expandedRowKeys,
  49098. hasFixedColumns,
  49099. mainTableRef,
  49100. leftTableRef,
  49101. rightTableRef,
  49102. isDynamic,
  49103. isResetting,
  49104. isScrolling,
  49105. bodyWidth,
  49106. emptyStyle,
  49107. rootStyle,
  49108. headerWidth,
  49109. footerHeight,
  49110. showEmpty,
  49111. scrollTo,
  49112. scrollToLeft,
  49113. scrollToTop,
  49114. scrollToRow,
  49115. getRowHeight,
  49116. onColumnSorted,
  49117. onRowHeightChange,
  49118. onRowHovered,
  49119. onRowExpanded,
  49120. onRowsRendered,
  49121. onScroll,
  49122. onVerticalScroll
  49123. } = useTable(props);
  49124. expose({
  49125. scrollTo,
  49126. scrollToLeft,
  49127. scrollToTop,
  49128. scrollToRow
  49129. });
  49130. provide(TableV2InjectionKey, {
  49131. ns,
  49132. isResetting,
  49133. isScrolling
  49134. });
  49135. return () => {
  49136. const {
  49137. cache,
  49138. cellProps,
  49139. estimatedRowHeight,
  49140. expandColumnKey,
  49141. fixedData,
  49142. headerHeight,
  49143. headerClass,
  49144. headerProps,
  49145. headerCellProps,
  49146. sortBy,
  49147. sortState,
  49148. rowHeight,
  49149. rowClass,
  49150. rowEventHandlers,
  49151. rowKey,
  49152. rowProps,
  49153. scrollbarAlwaysOn,
  49154. indentSize,
  49155. iconSize,
  49156. useIsScrolling,
  49157. vScrollbarSize,
  49158. width
  49159. } = props;
  49160. const _data = unref(data);
  49161. const mainTableProps = {
  49162. cache,
  49163. class: ns.e("main"),
  49164. columns: unref(mainColumns),
  49165. data: _data,
  49166. fixedData,
  49167. estimatedRowHeight,
  49168. bodyWidth: unref(bodyWidth) + vScrollbarSize,
  49169. headerHeight,
  49170. headerWidth: unref(headerWidth),
  49171. height: unref(mainTableHeight),
  49172. mainTableRef,
  49173. rowKey,
  49174. rowHeight,
  49175. scrollbarAlwaysOn,
  49176. scrollbarStartGap: 2,
  49177. scrollbarEndGap: vScrollbarSize,
  49178. useIsScrolling,
  49179. width,
  49180. getRowHeight,
  49181. onRowsRendered,
  49182. onScroll
  49183. };
  49184. const leftColumnsWidth = unref(leftTableWidth);
  49185. const _fixedTableHeight = unref(fixedTableHeight);
  49186. const leftTableProps = {
  49187. cache,
  49188. class: ns.e("left"),
  49189. columns: unref(fixedColumnsOnLeft),
  49190. data: _data,
  49191. estimatedRowHeight,
  49192. leftTableRef,
  49193. rowHeight,
  49194. bodyWidth: leftColumnsWidth,
  49195. headerWidth: leftColumnsWidth,
  49196. headerHeight,
  49197. height: _fixedTableHeight,
  49198. rowKey,
  49199. scrollbarAlwaysOn,
  49200. scrollbarStartGap: 2,
  49201. scrollbarEndGap: vScrollbarSize,
  49202. useIsScrolling,
  49203. width: leftColumnsWidth,
  49204. getRowHeight,
  49205. onScroll: onVerticalScroll
  49206. };
  49207. const rightColumnsWidth = unref(rightTableWidth);
  49208. const rightColumnsWidthWithScrollbar = rightColumnsWidth + vScrollbarSize;
  49209. const rightTableProps = {
  49210. cache,
  49211. class: ns.e("right"),
  49212. columns: unref(fixedColumnsOnRight),
  49213. data: _data,
  49214. estimatedRowHeight,
  49215. rightTableRef,
  49216. rowHeight,
  49217. bodyWidth: rightColumnsWidthWithScrollbar,
  49218. headerWidth: rightColumnsWidthWithScrollbar,
  49219. headerHeight,
  49220. height: _fixedTableHeight,
  49221. rowKey,
  49222. scrollbarAlwaysOn,
  49223. scrollbarStartGap: 2,
  49224. scrollbarEndGap: vScrollbarSize,
  49225. width: rightColumnsWidthWithScrollbar,
  49226. style: `--${unref(ns.namespace)}-table-scrollbar-size: ${vScrollbarSize}px`,
  49227. useIsScrolling,
  49228. getRowHeight,
  49229. onScroll: onVerticalScroll
  49230. };
  49231. const _columnsStyles = unref(columnsStyles);
  49232. const tableRowProps = {
  49233. ns,
  49234. depthMap: unref(depthMap),
  49235. columnsStyles: _columnsStyles,
  49236. expandColumnKey,
  49237. expandedRowKeys: unref(expandedRowKeys),
  49238. estimatedRowHeight,
  49239. hasFixedColumns: unref(hasFixedColumns),
  49240. rowProps,
  49241. rowClass,
  49242. rowKey,
  49243. rowEventHandlers,
  49244. onRowHovered,
  49245. onRowExpanded,
  49246. onRowHeightChange
  49247. };
  49248. const tableCellProps = {
  49249. cellProps,
  49250. expandColumnKey,
  49251. indentSize,
  49252. iconSize,
  49253. rowKey,
  49254. expandedRowKeys: unref(expandedRowKeys),
  49255. ns
  49256. };
  49257. const tableHeaderProps = {
  49258. ns,
  49259. headerClass,
  49260. headerProps,
  49261. columnsStyles: _columnsStyles
  49262. };
  49263. const tableHeaderCellProps = {
  49264. ns,
  49265. sortBy,
  49266. sortState,
  49267. headerCellProps,
  49268. onColumnSorted
  49269. };
  49270. const tableSlots = {
  49271. row: (props2) => createVNode(RowRenderer, mergeProps(props2, tableRowProps), {
  49272. row: slots.row,
  49273. cell: (props3) => {
  49274. let _slot;
  49275. return slots.cell ? createVNode(CellRenderer, mergeProps(props3, tableCellProps, {
  49276. "style": _columnsStyles[props3.column.key]
  49277. }), _isSlot(_slot = slots.cell(props3)) ? _slot : {
  49278. default: () => [_slot]
  49279. }) : createVNode(CellRenderer, mergeProps(props3, tableCellProps, {
  49280. "style": _columnsStyles[props3.column.key]
  49281. }), null);
  49282. }
  49283. }),
  49284. header: (props2) => createVNode(HeaderRenderer, mergeProps(props2, tableHeaderProps), {
  49285. header: slots.header,
  49286. cell: (props3) => {
  49287. let _slot2;
  49288. return slots["header-cell"] ? createVNode(HeaderCellRenderer, mergeProps(props3, tableHeaderCellProps, {
  49289. "style": _columnsStyles[props3.column.key]
  49290. }), _isSlot(_slot2 = slots["header-cell"](props3)) ? _slot2 : {
  49291. default: () => [_slot2]
  49292. }) : createVNode(HeaderCellRenderer, mergeProps(props3, tableHeaderCellProps, {
  49293. "style": _columnsStyles[props3.column.key]
  49294. }), null);
  49295. }
  49296. })
  49297. };
  49298. const rootKls = [props.class, ns.b(), ns.e("root"), {
  49299. [ns.is("dynamic")]: unref(isDynamic)
  49300. }];
  49301. const footerProps = {
  49302. class: ns.e("footer"),
  49303. style: unref(footerHeight)
  49304. };
  49305. return createVNode("div", {
  49306. "class": rootKls,
  49307. "style": unref(rootStyle)
  49308. }, [createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : {
  49309. default: () => [tableSlots]
  49310. }), createVNode(LeftTable$1, leftTableProps, _isSlot(tableSlots) ? tableSlots : {
  49311. default: () => [tableSlots]
  49312. }), createVNode(LeftTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : {
  49313. default: () => [tableSlots]
  49314. }), slots.footer && createVNode(Footer$1, footerProps, {
  49315. default: slots.footer
  49316. }), unref(showEmpty) && createVNode(Footer, {
  49317. "class": ns.e("empty"),
  49318. "style": unref(emptyStyle)
  49319. }, {
  49320. default: slots.empty
  49321. }), slots.overlay && createVNode(Overlay, {
  49322. "class": ns.e("overlay")
  49323. }, {
  49324. default: slots.overlay
  49325. })]);
  49326. };
  49327. }
  49328. });
  49329. var TableV2$1 = TableV2;
  49330. const autoResizerProps = buildProps({
  49331. disableWidth: Boolean,
  49332. disableHeight: Boolean,
  49333. onResize: {
  49334. type: definePropType(Function)
  49335. }
  49336. });
  49337. const AutoResizer = defineComponent({
  49338. name: "ElAutoResizer",
  49339. props: autoResizerProps,
  49340. setup(props, {
  49341. slots
  49342. }) {
  49343. const ns = useNamespace("auto-resizer");
  49344. const {
  49345. height,
  49346. width,
  49347. sizer
  49348. } = useAutoResize(props);
  49349. const style = {
  49350. width: "100%",
  49351. height: "100%"
  49352. };
  49353. return () => {
  49354. var _a;
  49355. return createVNode("div", {
  49356. "ref": sizer,
  49357. "class": ns.b(),
  49358. "style": style
  49359. }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
  49360. height: height.value,
  49361. width: width.value
  49362. })]);
  49363. };
  49364. }
  49365. });
  49366. const ElTableV2 = withInstall(TableV2$1);
  49367. const ElAutoResizer = withInstall(AutoResizer);
  49368. const tabsRootContextKey = Symbol("tabsRootContextKey");
  49369. const tabBarProps = buildProps({
  49370. tabs: {
  49371. type: definePropType(Array),
  49372. default: () => mutable([])
  49373. }
  49374. });
  49375. const COMPONENT_NAME$3 = "ElTabBar";
  49376. const __default__$u = defineComponent({
  49377. name: COMPONENT_NAME$3
  49378. });
  49379. const _sfc_main$z = /* @__PURE__ */ defineComponent({
  49380. ...__default__$u,
  49381. props: tabBarProps,
  49382. setup(__props, { expose }) {
  49383. const props = __props;
  49384. const instance = getCurrentInstance();
  49385. const rootTabs = inject(tabsRootContextKey);
  49386. if (!rootTabs)
  49387. throwError(COMPONENT_NAME$3, "<el-tabs><el-tab-bar /></el-tabs>");
  49388. const ns = useNamespace("tabs");
  49389. const barRef = ref();
  49390. const barStyle = ref();
  49391. const getBarStyle = () => {
  49392. let offset = 0;
  49393. let tabSize = 0;
  49394. const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
  49395. const sizeDir = sizeName === "width" ? "x" : "y";
  49396. const position = sizeDir === "x" ? "left" : "top";
  49397. props.tabs.every((tab) => {
  49398. var _a, _b;
  49399. const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.uid}`];
  49400. if (!$el)
  49401. return false;
  49402. if (!tab.active) {
  49403. return true;
  49404. }
  49405. offset = $el[`offset${capitalize(position)}`];
  49406. tabSize = $el[`client${capitalize(sizeName)}`];
  49407. const tabStyles = window.getComputedStyle($el);
  49408. if (sizeName === "width") {
  49409. tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
  49410. offset += Number.parseFloat(tabStyles.paddingLeft);
  49411. }
  49412. return false;
  49413. });
  49414. return {
  49415. [sizeName]: `${tabSize}px`,
  49416. transform: `translate${capitalize(sizeDir)}(${offset}px)`
  49417. };
  49418. };
  49419. const update = () => barStyle.value = getBarStyle();
  49420. const saveObserver = [];
  49421. const observerTabs = () => {
  49422. var _a;
  49423. saveObserver.forEach((observer) => observer.stop());
  49424. saveObserver.length = 0;
  49425. const list = (_a = instance.parent) == null ? void 0 : _a.refs;
  49426. if (!list)
  49427. return;
  49428. for (const key in list) {
  49429. if (key.startsWith("tab-")) {
  49430. const _el = list[key];
  49431. if (_el) {
  49432. saveObserver.push(useResizeObserver(_el, update));
  49433. }
  49434. }
  49435. }
  49436. };
  49437. watch(() => props.tabs, async () => {
  49438. await nextTick();
  49439. update();
  49440. observerTabs();
  49441. }, { immediate: true });
  49442. const barObserever = useResizeObserver(barRef, () => update());
  49443. onBeforeUnmount(() => {
  49444. saveObserver.forEach((observer) => observer.stop());
  49445. saveObserver.length = 0;
  49446. barObserever.stop();
  49447. });
  49448. expose({
  49449. ref: barRef,
  49450. update
  49451. });
  49452. return (_ctx, _cache) => {
  49453. return openBlock(), createElementBlock("div", {
  49454. ref_key: "barRef",
  49455. ref: barRef,
  49456. class: normalizeClass([unref(ns).e("active-bar"), unref(ns).is(unref(rootTabs).props.tabPosition)]),
  49457. style: normalizeStyle(barStyle.value)
  49458. }, null, 6);
  49459. };
  49460. }
  49461. });
  49462. var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["__file", "tab-bar.vue"]]);
  49463. const tabNavProps = buildProps({
  49464. panes: {
  49465. type: definePropType(Array),
  49466. default: () => mutable([])
  49467. },
  49468. currentName: {
  49469. type: [String, Number],
  49470. default: ""
  49471. },
  49472. editable: Boolean,
  49473. type: {
  49474. type: String,
  49475. values: ["card", "border-card", ""],
  49476. default: ""
  49477. },
  49478. stretch: Boolean
  49479. });
  49480. const tabNavEmits = {
  49481. tabClick: (tab, tabName, ev) => ev instanceof Event,
  49482. tabRemove: (tab, ev) => ev instanceof Event
  49483. };
  49484. const COMPONENT_NAME$2 = "ElTabNav";
  49485. const TabNav = defineComponent({
  49486. name: COMPONENT_NAME$2,
  49487. props: tabNavProps,
  49488. emits: tabNavEmits,
  49489. setup(props, {
  49490. expose,
  49491. emit
  49492. }) {
  49493. const rootTabs = inject(tabsRootContextKey);
  49494. if (!rootTabs)
  49495. throwError(COMPONENT_NAME$2, `<el-tabs><tab-nav /></el-tabs>`);
  49496. const ns = useNamespace("tabs");
  49497. const visibility = useDocumentVisibility();
  49498. const focused = useWindowFocus();
  49499. const navScroll$ = ref();
  49500. const nav$ = ref();
  49501. const el$ = ref();
  49502. const tabBarRef = ref();
  49503. const scrollable = ref(false);
  49504. const navOffset = ref(0);
  49505. const isFocus = ref(false);
  49506. const focusable = ref(true);
  49507. const sizeName = computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height");
  49508. const navStyle = computed(() => {
  49509. const dir = sizeName.value === "width" ? "X" : "Y";
  49510. return {
  49511. transform: `translate${dir}(-${navOffset.value}px)`
  49512. };
  49513. });
  49514. const scrollPrev = () => {
  49515. if (!navScroll$.value)
  49516. return;
  49517. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  49518. const currentOffset = navOffset.value;
  49519. if (!currentOffset)
  49520. return;
  49521. const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
  49522. navOffset.value = newOffset;
  49523. };
  49524. const scrollNext = () => {
  49525. if (!navScroll$.value || !nav$.value)
  49526. return;
  49527. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  49528. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  49529. const currentOffset = navOffset.value;
  49530. if (navSize - currentOffset <= containerSize)
  49531. return;
  49532. const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
  49533. navOffset.value = newOffset;
  49534. };
  49535. const scrollToActiveTab = async () => {
  49536. const nav = nav$.value;
  49537. if (!scrollable.value || !el$.value || !navScroll$.value || !nav)
  49538. return;
  49539. await nextTick();
  49540. const activeTab = el$.value.querySelector(".is-active");
  49541. if (!activeTab)
  49542. return;
  49543. const navScroll = navScroll$.value;
  49544. const isHorizontal = ["top", "bottom"].includes(rootTabs.props.tabPosition);
  49545. const activeTabBounding = activeTab.getBoundingClientRect();
  49546. const navScrollBounding = navScroll.getBoundingClientRect();
  49547. const maxOffset = isHorizontal ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height;
  49548. const currentOffset = navOffset.value;
  49549. let newOffset = currentOffset;
  49550. if (isHorizontal) {
  49551. if (activeTabBounding.left < navScrollBounding.left) {
  49552. newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
  49553. }
  49554. if (activeTabBounding.right > navScrollBounding.right) {
  49555. newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
  49556. }
  49557. } else {
  49558. if (activeTabBounding.top < navScrollBounding.top) {
  49559. newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
  49560. }
  49561. if (activeTabBounding.bottom > navScrollBounding.bottom) {
  49562. newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
  49563. }
  49564. }
  49565. newOffset = Math.max(newOffset, 0);
  49566. navOffset.value = Math.min(newOffset, maxOffset);
  49567. };
  49568. const update = () => {
  49569. var _a;
  49570. if (!nav$.value || !navScroll$.value)
  49571. return;
  49572. props.stretch && ((_a = tabBarRef.value) == null ? void 0 : _a.update());
  49573. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  49574. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  49575. const currentOffset = navOffset.value;
  49576. if (containerSize < navSize) {
  49577. scrollable.value = scrollable.value || {};
  49578. scrollable.value.prev = currentOffset;
  49579. scrollable.value.next = currentOffset + containerSize < navSize;
  49580. if (navSize - currentOffset < containerSize) {
  49581. navOffset.value = navSize - containerSize;
  49582. }
  49583. } else {
  49584. scrollable.value = false;
  49585. if (currentOffset > 0) {
  49586. navOffset.value = 0;
  49587. }
  49588. }
  49589. };
  49590. const changeTab = (event) => {
  49591. let step = 0;
  49592. switch (event.code) {
  49593. case EVENT_CODE.left:
  49594. case EVENT_CODE.up:
  49595. step = -1;
  49596. break;
  49597. case EVENT_CODE.right:
  49598. case EVENT_CODE.down:
  49599. step = 1;
  49600. break;
  49601. default:
  49602. return;
  49603. }
  49604. const tabList = Array.from(event.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
  49605. const currentIndex = tabList.indexOf(event.target);
  49606. let nextIndex = currentIndex + step;
  49607. if (nextIndex < 0) {
  49608. nextIndex = tabList.length - 1;
  49609. } else if (nextIndex >= tabList.length) {
  49610. nextIndex = 0;
  49611. }
  49612. tabList[nextIndex].focus({
  49613. preventScroll: true
  49614. });
  49615. tabList[nextIndex].click();
  49616. setFocus();
  49617. };
  49618. const setFocus = () => {
  49619. if (focusable.value)
  49620. isFocus.value = true;
  49621. };
  49622. const removeFocus = () => isFocus.value = false;
  49623. watch(visibility, (visibility2) => {
  49624. if (visibility2 === "hidden") {
  49625. focusable.value = false;
  49626. } else if (visibility2 === "visible") {
  49627. setTimeout(() => focusable.value = true, 50);
  49628. }
  49629. });
  49630. watch(focused, (focused2) => {
  49631. if (focused2) {
  49632. setTimeout(() => focusable.value = true, 50);
  49633. } else {
  49634. focusable.value = false;
  49635. }
  49636. });
  49637. useResizeObserver(el$, update);
  49638. onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
  49639. onUpdated(() => update());
  49640. expose({
  49641. scrollToActiveTab,
  49642. removeFocus
  49643. });
  49644. return () => {
  49645. const scrollBtn = scrollable.value ? [createVNode("span", {
  49646. "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
  49647. "onClick": scrollPrev
  49648. }, [createVNode(ElIcon, null, {
  49649. default: () => [createVNode(arrow_left_default, null, null)]
  49650. })]), createVNode("span", {
  49651. "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
  49652. "onClick": scrollNext
  49653. }, [createVNode(ElIcon, null, {
  49654. default: () => [createVNode(arrow_right_default, null, null)]
  49655. })])] : null;
  49656. const tabs = props.panes.map((pane, index) => {
  49657. var _a, _b, _c, _d;
  49658. const uid = pane.uid;
  49659. const disabled = pane.props.disabled;
  49660. const tabName = (_b = (_a = pane.props.name) != null ? _a : pane.index) != null ? _b : `${index}`;
  49661. const closable = !disabled && (pane.isClosable || props.editable);
  49662. pane.index = `${index}`;
  49663. const btnClose = closable ? createVNode(ElIcon, {
  49664. "class": "is-icon-close",
  49665. "onClick": (ev) => emit("tabRemove", pane, ev)
  49666. }, {
  49667. default: () => [createVNode(close_default, null, null)]
  49668. }) : null;
  49669. const tabLabelContent = ((_d = (_c = pane.slots).label) == null ? void 0 : _d.call(_c)) || pane.props.label;
  49670. const tabindex = !disabled && pane.active ? 0 : -1;
  49671. return createVNode("div", {
  49672. "ref": `tab-${uid}`,
  49673. "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)],
  49674. "id": `tab-${tabName}`,
  49675. "key": `tab-${uid}`,
  49676. "aria-controls": `pane-${tabName}`,
  49677. "role": "tab",
  49678. "aria-selected": pane.active,
  49679. "tabindex": tabindex,
  49680. "onFocus": () => setFocus(),
  49681. "onBlur": () => removeFocus(),
  49682. "onClick": (ev) => {
  49683. removeFocus();
  49684. emit("tabClick", pane, tabName, ev);
  49685. },
  49686. "onKeydown": (ev) => {
  49687. if (closable && (ev.code === EVENT_CODE.delete || ev.code === EVENT_CODE.backspace)) {
  49688. emit("tabRemove", pane, ev);
  49689. }
  49690. }
  49691. }, [...[tabLabelContent, btnClose]]);
  49692. });
  49693. return createVNode("div", {
  49694. "ref": el$,
  49695. "class": [ns.e("nav-wrap"), ns.is("scrollable", !!scrollable.value), ns.is(rootTabs.props.tabPosition)]
  49696. }, [scrollBtn, createVNode("div", {
  49697. "class": ns.e("nav-scroll"),
  49698. "ref": navScroll$
  49699. }, [createVNode("div", {
  49700. "class": [ns.e("nav"), ns.is(rootTabs.props.tabPosition), ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))],
  49701. "ref": nav$,
  49702. "style": navStyle.value,
  49703. "role": "tablist",
  49704. "onKeydown": changeTab
  49705. }, [...[!props.type ? createVNode(TabBar, {
  49706. "ref": tabBarRef,
  49707. "tabs": [...props.panes]
  49708. }, null) : null, tabs]])])]);
  49709. };
  49710. }
  49711. });
  49712. const tabsProps = buildProps({
  49713. type: {
  49714. type: String,
  49715. values: ["card", "border-card", ""],
  49716. default: ""
  49717. },
  49718. closable: Boolean,
  49719. addable: Boolean,
  49720. modelValue: {
  49721. type: [String, Number]
  49722. },
  49723. editable: Boolean,
  49724. tabPosition: {
  49725. type: String,
  49726. values: ["top", "right", "bottom", "left"],
  49727. default: "top"
  49728. },
  49729. beforeLeave: {
  49730. type: definePropType(Function),
  49731. default: () => true
  49732. },
  49733. stretch: Boolean
  49734. });
  49735. const isPaneName = (value) => isString$1(value) || isNumber(value);
  49736. const tabsEmits = {
  49737. [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
  49738. tabClick: (pane, ev) => ev instanceof Event,
  49739. tabChange: (name) => isPaneName(name),
  49740. edit: (paneName, action) => ["remove", "add"].includes(action),
  49741. tabRemove: (name) => isPaneName(name),
  49742. tabAdd: () => true
  49743. };
  49744. const Tabs = defineComponent({
  49745. name: "ElTabs",
  49746. props: tabsProps,
  49747. emits: tabsEmits,
  49748. setup(props, {
  49749. emit,
  49750. slots,
  49751. expose
  49752. }) {
  49753. var _a;
  49754. const ns = useNamespace("tabs");
  49755. const isVertical = computed(() => ["left", "right"].includes(props.tabPosition));
  49756. const {
  49757. children: panes,
  49758. addChild: sortPane,
  49759. removeChild: unregisterPane
  49760. } = useOrderedChildren(getCurrentInstance(), "ElTabPane");
  49761. const nav$ = ref();
  49762. const currentName = ref((_a = props.modelValue) != null ? _a : "0");
  49763. const setCurrentName = async (value, trigger = false) => {
  49764. var _a2, _b, _c;
  49765. if (currentName.value === value || isUndefined(value))
  49766. return;
  49767. try {
  49768. const canLeave = await ((_a2 = props.beforeLeave) == null ? void 0 : _a2.call(props, value, currentName.value));
  49769. if (canLeave !== false) {
  49770. currentName.value = value;
  49771. if (trigger) {
  49772. emit(UPDATE_MODEL_EVENT, value);
  49773. emit("tabChange", value);
  49774. }
  49775. (_c = (_b = nav$.value) == null ? void 0 : _b.removeFocus) == null ? void 0 : _c.call(_b);
  49776. }
  49777. } catch (e) {
  49778. }
  49779. };
  49780. const handleTabClick = (tab, tabName, event) => {
  49781. if (tab.props.disabled)
  49782. return;
  49783. setCurrentName(tabName, true);
  49784. emit("tabClick", tab, event);
  49785. };
  49786. const handleTabRemove = (pane, ev) => {
  49787. if (pane.props.disabled || isUndefined(pane.props.name))
  49788. return;
  49789. ev.stopPropagation();
  49790. emit("edit", pane.props.name, "remove");
  49791. emit("tabRemove", pane.props.name);
  49792. };
  49793. const handleTabAdd = () => {
  49794. emit("edit", void 0, "add");
  49795. emit("tabAdd");
  49796. };
  49797. watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
  49798. watch(currentName, async () => {
  49799. var _a2;
  49800. await nextTick();
  49801. (_a2 = nav$.value) == null ? void 0 : _a2.scrollToActiveTab();
  49802. });
  49803. provide(tabsRootContextKey, {
  49804. props,
  49805. currentName,
  49806. registerPane: (pane) => {
  49807. panes.value.push(pane);
  49808. },
  49809. sortPane,
  49810. unregisterPane
  49811. });
  49812. expose({
  49813. currentName
  49814. });
  49815. const TabNavRenderer = ({
  49816. render
  49817. }) => {
  49818. return render();
  49819. };
  49820. return () => {
  49821. const addSlot = slots["add-icon"];
  49822. const newButton = props.editable || props.addable ? createVNode("div", {
  49823. "class": [ns.e("new-tab"), isVertical.value && ns.e("new-tab-vertical")],
  49824. "tabindex": "0",
  49825. "onClick": handleTabAdd,
  49826. "onKeydown": (ev) => {
  49827. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter].includes(ev.code))
  49828. handleTabAdd();
  49829. }
  49830. }, [addSlot ? renderSlot(slots, "add-icon") : createVNode(ElIcon, {
  49831. "class": ns.is("icon-plus")
  49832. }, {
  49833. default: () => [createVNode(plus_default, null, null)]
  49834. })]) : null;
  49835. const header = createVNode("div", {
  49836. "class": [ns.e("header"), isVertical.value && ns.e("header-vertical"), ns.is(props.tabPosition)]
  49837. }, [createVNode(TabNavRenderer, {
  49838. "render": () => {
  49839. const hasLabelSlot = panes.value.some((pane) => pane.slots.label);
  49840. return createVNode(TabNav, {
  49841. ref: nav$,
  49842. currentName: currentName.value,
  49843. editable: props.editable,
  49844. type: props.type,
  49845. panes: panes.value,
  49846. stretch: props.stretch,
  49847. onTabClick: handleTabClick,
  49848. onTabRemove: handleTabRemove
  49849. }, {
  49850. $stable: !hasLabelSlot
  49851. });
  49852. }
  49853. }, null), newButton]);
  49854. const panels = createVNode("div", {
  49855. "class": ns.e("content")
  49856. }, [renderSlot(slots, "default")]);
  49857. return createVNode("div", {
  49858. "class": [ns.b(), ns.m(props.tabPosition), {
  49859. [ns.m("card")]: props.type === "card",
  49860. [ns.m("border-card")]: props.type === "border-card"
  49861. }]
  49862. }, [panels, header]);
  49863. };
  49864. }
  49865. });
  49866. const tabPaneProps = buildProps({
  49867. label: {
  49868. type: String,
  49869. default: ""
  49870. },
  49871. name: {
  49872. type: [String, Number]
  49873. },
  49874. closable: Boolean,
  49875. disabled: Boolean,
  49876. lazy: Boolean
  49877. });
  49878. const COMPONENT_NAME$1 = "ElTabPane";
  49879. const __default__$t = defineComponent({
  49880. name: COMPONENT_NAME$1
  49881. });
  49882. const _sfc_main$y = /* @__PURE__ */ defineComponent({
  49883. ...__default__$t,
  49884. props: tabPaneProps,
  49885. setup(__props) {
  49886. const props = __props;
  49887. const instance = getCurrentInstance();
  49888. const slots = useSlots();
  49889. const tabsRoot = inject(tabsRootContextKey);
  49890. if (!tabsRoot)
  49891. throwError(COMPONENT_NAME$1, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
  49892. const ns = useNamespace("tab-pane");
  49893. const index = ref();
  49894. const isClosable = computed(() => props.closable || tabsRoot.props.closable);
  49895. const active = computedEager(() => {
  49896. var _a;
  49897. return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
  49898. });
  49899. const loaded = ref(active.value);
  49900. const paneName = computed(() => {
  49901. var _a;
  49902. return (_a = props.name) != null ? _a : index.value;
  49903. });
  49904. const shouldBeRender = computedEager(() => !props.lazy || loaded.value || active.value);
  49905. watch(active, (val) => {
  49906. if (val)
  49907. loaded.value = true;
  49908. });
  49909. const pane = reactive({
  49910. uid: instance.uid,
  49911. slots,
  49912. props,
  49913. paneName,
  49914. active,
  49915. index,
  49916. isClosable
  49917. });
  49918. tabsRoot.registerPane(pane);
  49919. onMounted(() => {
  49920. tabsRoot.sortPane(pane);
  49921. });
  49922. onUnmounted(() => {
  49923. tabsRoot.unregisterPane(pane.uid);
  49924. });
  49925. return (_ctx, _cache) => {
  49926. return unref(shouldBeRender) ? withDirectives((openBlock(), createElementBlock("div", {
  49927. key: 0,
  49928. id: `pane-${unref(paneName)}`,
  49929. class: normalizeClass(unref(ns).b()),
  49930. role: "tabpanel",
  49931. "aria-hidden": !unref(active),
  49932. "aria-labelledby": `tab-${unref(paneName)}`
  49933. }, [
  49934. renderSlot(_ctx.$slots, "default")
  49935. ], 10, ["id", "aria-hidden", "aria-labelledby"])), [
  49936. [vShow, unref(active)]
  49937. ]) : createCommentVNode("v-if", true);
  49938. };
  49939. }
  49940. });
  49941. var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["__file", "tab-pane.vue"]]);
  49942. const ElTabs = withInstall(Tabs, {
  49943. TabPane
  49944. });
  49945. const ElTabPane = withNoopInstall(TabPane);
  49946. const textProps = buildProps({
  49947. type: {
  49948. type: String,
  49949. values: ["primary", "success", "info", "warning", "danger", ""],
  49950. default: ""
  49951. },
  49952. size: {
  49953. type: String,
  49954. values: componentSizes,
  49955. default: ""
  49956. },
  49957. truncated: Boolean,
  49958. lineClamp: {
  49959. type: [String, Number]
  49960. },
  49961. tag: {
  49962. type: String,
  49963. default: "span"
  49964. }
  49965. });
  49966. const __default__$s = defineComponent({
  49967. name: "ElText"
  49968. });
  49969. const _sfc_main$x = /* @__PURE__ */ defineComponent({
  49970. ...__default__$s,
  49971. props: textProps,
  49972. setup(__props) {
  49973. const props = __props;
  49974. const textSize = useFormSize();
  49975. const ns = useNamespace("text");
  49976. const textKls = computed(() => [
  49977. ns.b(),
  49978. ns.m(props.type),
  49979. ns.m(textSize.value),
  49980. ns.is("truncated", props.truncated),
  49981. ns.is("line-clamp", !isUndefined(props.lineClamp))
  49982. ]);
  49983. return (_ctx, _cache) => {
  49984. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  49985. class: normalizeClass(unref(textKls)),
  49986. style: normalizeStyle({ "-webkit-line-clamp": _ctx.lineClamp })
  49987. }, {
  49988. default: withCtx(() => [
  49989. renderSlot(_ctx.$slots, "default")
  49990. ]),
  49991. _: 3
  49992. }, 8, ["class", "style"]);
  49993. };
  49994. }
  49995. });
  49996. var Text = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__file", "text.vue"]]);
  49997. const ElText = withInstall(Text);
  49998. const timeSelectProps = buildProps({
  49999. format: {
  50000. type: String,
  50001. default: "HH:mm"
  50002. },
  50003. modelValue: String,
  50004. disabled: Boolean,
  50005. editable: {
  50006. type: Boolean,
  50007. default: true
  50008. },
  50009. effect: {
  50010. type: definePropType(String),
  50011. default: "light"
  50012. },
  50013. clearable: {
  50014. type: Boolean,
  50015. default: true
  50016. },
  50017. size: useSizeProp,
  50018. placeholder: String,
  50019. start: {
  50020. type: String,
  50021. default: "09:00"
  50022. },
  50023. end: {
  50024. type: String,
  50025. default: "18:00"
  50026. },
  50027. step: {
  50028. type: String,
  50029. default: "00:30"
  50030. },
  50031. minTime: String,
  50032. maxTime: String,
  50033. name: String,
  50034. prefixIcon: {
  50035. type: definePropType([String, Object]),
  50036. default: () => clock_default
  50037. },
  50038. clearIcon: {
  50039. type: definePropType([String, Object]),
  50040. default: () => circle_close_default
  50041. },
  50042. ...useEmptyValuesProps
  50043. });
  50044. const parseTime = (time) => {
  50045. const values = (time || "").split(":");
  50046. if (values.length >= 2) {
  50047. let hours = Number.parseInt(values[0], 10);
  50048. const minutes = Number.parseInt(values[1], 10);
  50049. const timeUpper = time.toUpperCase();
  50050. if (timeUpper.includes("AM") && hours === 12) {
  50051. hours = 0;
  50052. } else if (timeUpper.includes("PM") && hours !== 12) {
  50053. hours += 12;
  50054. }
  50055. return {
  50056. hours,
  50057. minutes
  50058. };
  50059. }
  50060. return null;
  50061. };
  50062. const compareTime = (time1, time2) => {
  50063. const value1 = parseTime(time1);
  50064. if (!value1)
  50065. return -1;
  50066. const value2 = parseTime(time2);
  50067. if (!value2)
  50068. return -1;
  50069. const minutes1 = value1.minutes + value1.hours * 60;
  50070. const minutes2 = value2.minutes + value2.hours * 60;
  50071. if (minutes1 === minutes2) {
  50072. return 0;
  50073. }
  50074. return minutes1 > minutes2 ? 1 : -1;
  50075. };
  50076. const padTime = (time) => {
  50077. return `${time}`.padStart(2, "0");
  50078. };
  50079. const formatTime = (time) => {
  50080. return `${padTime(time.hours)}:${padTime(time.minutes)}`;
  50081. };
  50082. const nextTime = (time, step) => {
  50083. const timeValue = parseTime(time);
  50084. if (!timeValue)
  50085. return "";
  50086. const stepValue = parseTime(step);
  50087. if (!stepValue)
  50088. return "";
  50089. const next = {
  50090. hours: timeValue.hours,
  50091. minutes: timeValue.minutes
  50092. };
  50093. next.minutes += stepValue.minutes;
  50094. next.hours += stepValue.hours;
  50095. next.hours += Math.floor(next.minutes / 60);
  50096. next.minutes = next.minutes % 60;
  50097. return formatTime(next);
  50098. };
  50099. const __default__$r = defineComponent({
  50100. name: "ElTimeSelect"
  50101. });
  50102. const _sfc_main$w = /* @__PURE__ */ defineComponent({
  50103. ...__default__$r,
  50104. props: timeSelectProps,
  50105. emits: ["change", "blur", "focus", "clear", "update:modelValue"],
  50106. setup(__props, { expose }) {
  50107. const props = __props;
  50108. dayjs.extend(customParseFormat);
  50109. const { Option: ElOption } = ElSelect;
  50110. const nsInput = useNamespace("input");
  50111. const select = ref();
  50112. const _disabled = useFormDisabled();
  50113. const { lang } = useLocale();
  50114. const value = computed(() => props.modelValue);
  50115. const start = computed(() => {
  50116. const time = parseTime(props.start);
  50117. return time ? formatTime(time) : null;
  50118. });
  50119. const end = computed(() => {
  50120. const time = parseTime(props.end);
  50121. return time ? formatTime(time) : null;
  50122. });
  50123. const step = computed(() => {
  50124. const time = parseTime(props.step);
  50125. return time ? formatTime(time) : null;
  50126. });
  50127. const minTime = computed(() => {
  50128. const time = parseTime(props.minTime || "");
  50129. return time ? formatTime(time) : null;
  50130. });
  50131. const maxTime = computed(() => {
  50132. const time = parseTime(props.maxTime || "");
  50133. return time ? formatTime(time) : null;
  50134. });
  50135. const items = computed(() => {
  50136. const result = [];
  50137. if (props.start && props.end && props.step) {
  50138. let current = start.value;
  50139. let currentTime;
  50140. while (current && end.value && compareTime(current, end.value) <= 0) {
  50141. currentTime = dayjs(current, "HH:mm").locale(lang.value).format(props.format);
  50142. result.push({
  50143. value: currentTime,
  50144. disabled: compareTime(current, minTime.value || "-1:-1") <= 0 || compareTime(current, maxTime.value || "100:100") >= 0
  50145. });
  50146. current = nextTime(current, step.value);
  50147. }
  50148. }
  50149. return result;
  50150. });
  50151. const blur = () => {
  50152. var _a, _b;
  50153. (_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  50154. };
  50155. const focus = () => {
  50156. var _a, _b;
  50157. (_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  50158. };
  50159. expose({
  50160. blur,
  50161. focus
  50162. });
  50163. return (_ctx, _cache) => {
  50164. return openBlock(), createBlock(unref(ElSelect), {
  50165. ref_key: "select",
  50166. ref: select,
  50167. "model-value": unref(value),
  50168. disabled: unref(_disabled),
  50169. clearable: _ctx.clearable,
  50170. "clear-icon": _ctx.clearIcon,
  50171. size: _ctx.size,
  50172. effect: _ctx.effect,
  50173. placeholder: _ctx.placeholder,
  50174. "default-first-option": "",
  50175. filterable: _ctx.editable,
  50176. "empty-values": _ctx.emptyValues,
  50177. "value-on-clear": _ctx.valueOnClear,
  50178. "onUpdate:modelValue": (event) => _ctx.$emit("update:modelValue", event),
  50179. onChange: (event) => _ctx.$emit("change", event),
  50180. onBlur: (event) => _ctx.$emit("blur", event),
  50181. onFocus: (event) => _ctx.$emit("focus", event),
  50182. onClear: () => _ctx.$emit("clear")
  50183. }, {
  50184. prefix: withCtx(() => [
  50185. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  50186. key: 0,
  50187. class: normalizeClass(unref(nsInput).e("prefix-icon"))
  50188. }, {
  50189. default: withCtx(() => [
  50190. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  50191. ]),
  50192. _: 1
  50193. }, 8, ["class"])) : createCommentVNode("v-if", true)
  50194. ]),
  50195. default: withCtx(() => [
  50196. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item) => {
  50197. return openBlock(), createBlock(unref(ElOption), {
  50198. key: item.value,
  50199. label: item.value,
  50200. value: item.value,
  50201. disabled: item.disabled
  50202. }, null, 8, ["label", "value", "disabled"]);
  50203. }), 128))
  50204. ]),
  50205. _: 1
  50206. }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable", "empty-values", "value-on-clear", "onUpdate:modelValue", "onChange", "onBlur", "onFocus", "onClear"]);
  50207. };
  50208. }
  50209. });
  50210. var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__file", "time-select.vue"]]);
  50211. const ElTimeSelect = withInstall(TimeSelect);
  50212. const Timeline = defineComponent({
  50213. name: "ElTimeline",
  50214. setup(_, { slots }) {
  50215. const ns = useNamespace("timeline");
  50216. provide("timeline", slots);
  50217. return () => {
  50218. return h$1("ul", { class: [ns.b()] }, [renderSlot(slots, "default")]);
  50219. };
  50220. }
  50221. });
  50222. var Timeline$1 = Timeline;
  50223. const timelineItemProps = buildProps({
  50224. timestamp: {
  50225. type: String,
  50226. default: ""
  50227. },
  50228. hideTimestamp: Boolean,
  50229. center: Boolean,
  50230. placement: {
  50231. type: String,
  50232. values: ["top", "bottom"],
  50233. default: "bottom"
  50234. },
  50235. type: {
  50236. type: String,
  50237. values: ["primary", "success", "warning", "danger", "info"],
  50238. default: ""
  50239. },
  50240. color: {
  50241. type: String,
  50242. default: ""
  50243. },
  50244. size: {
  50245. type: String,
  50246. values: ["normal", "large"],
  50247. default: "normal"
  50248. },
  50249. icon: {
  50250. type: iconPropType
  50251. },
  50252. hollow: Boolean
  50253. });
  50254. const __default__$q = defineComponent({
  50255. name: "ElTimelineItem"
  50256. });
  50257. const _sfc_main$v = /* @__PURE__ */ defineComponent({
  50258. ...__default__$q,
  50259. props: timelineItemProps,
  50260. setup(__props) {
  50261. const props = __props;
  50262. const ns = useNamespace("timeline-item");
  50263. const defaultNodeKls = computed(() => [
  50264. ns.e("node"),
  50265. ns.em("node", props.size || ""),
  50266. ns.em("node", props.type || ""),
  50267. ns.is("hollow", props.hollow)
  50268. ]);
  50269. return (_ctx, _cache) => {
  50270. return openBlock(), createElementBlock("li", {
  50271. class: normalizeClass([unref(ns).b(), { [unref(ns).e("center")]: _ctx.center }])
  50272. }, [
  50273. createElementVNode("div", {
  50274. class: normalizeClass(unref(ns).e("tail"))
  50275. }, null, 2),
  50276. !_ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
  50277. key: 0,
  50278. class: normalizeClass(unref(defaultNodeKls)),
  50279. style: normalizeStyle({
  50280. backgroundColor: _ctx.color
  50281. })
  50282. }, [
  50283. _ctx.icon ? (openBlock(), createBlock(unref(ElIcon), {
  50284. key: 0,
  50285. class: normalizeClass(unref(ns).e("icon"))
  50286. }, {
  50287. default: withCtx(() => [
  50288. (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))
  50289. ]),
  50290. _: 1
  50291. }, 8, ["class"])) : createCommentVNode("v-if", true)
  50292. ], 6)) : createCommentVNode("v-if", true),
  50293. _ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
  50294. key: 1,
  50295. class: normalizeClass(unref(ns).e("dot"))
  50296. }, [
  50297. renderSlot(_ctx.$slots, "dot")
  50298. ], 2)) : createCommentVNode("v-if", true),
  50299. createElementVNode("div", {
  50300. class: normalizeClass(unref(ns).e("wrapper"))
  50301. }, [
  50302. !_ctx.hideTimestamp && _ctx.placement === "top" ? (openBlock(), createElementBlock("div", {
  50303. key: 0,
  50304. class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("top")])
  50305. }, toDisplayString(_ctx.timestamp), 3)) : createCommentVNode("v-if", true),
  50306. createElementVNode("div", {
  50307. class: normalizeClass(unref(ns).e("content"))
  50308. }, [
  50309. renderSlot(_ctx.$slots, "default")
  50310. ], 2),
  50311. !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (openBlock(), createElementBlock("div", {
  50312. key: 1,
  50313. class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("bottom")])
  50314. }, toDisplayString(_ctx.timestamp), 3)) : createCommentVNode("v-if", true)
  50315. ], 2)
  50316. ], 2);
  50317. };
  50318. }
  50319. });
  50320. var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__file", "timeline-item.vue"]]);
  50321. const ElTimeline = withInstall(Timeline$1, {
  50322. TimelineItem
  50323. });
  50324. const ElTimelineItem = withNoopInstall(TimelineItem);
  50325. const tooltipV2CommonProps = buildProps({
  50326. nowrap: Boolean
  50327. });
  50328. var TooltipV2Sides = /* @__PURE__ */ ((TooltipV2Sides2) => {
  50329. TooltipV2Sides2["top"] = "top";
  50330. TooltipV2Sides2["bottom"] = "bottom";
  50331. TooltipV2Sides2["left"] = "left";
  50332. TooltipV2Sides2["right"] = "right";
  50333. return TooltipV2Sides2;
  50334. })(TooltipV2Sides || {});
  50335. const tooltipV2Sides = Object.values(TooltipV2Sides);
  50336. const tooltipV2ArrowProps = buildProps({
  50337. width: {
  50338. type: Number,
  50339. default: 10
  50340. },
  50341. height: {
  50342. type: Number,
  50343. default: 10
  50344. },
  50345. style: {
  50346. type: definePropType(Object),
  50347. default: null
  50348. }
  50349. });
  50350. const tooltipV2ArrowSpecialProps = buildProps({
  50351. side: {
  50352. type: definePropType(String),
  50353. values: tooltipV2Sides,
  50354. required: true
  50355. }
  50356. });
  50357. const tooltipV2Strategies = ["absolute", "fixed"];
  50358. const tooltipV2Placements = [
  50359. "top-start",
  50360. "top-end",
  50361. "top",
  50362. "bottom-start",
  50363. "bottom-end",
  50364. "bottom",
  50365. "left-start",
  50366. "left-end",
  50367. "left",
  50368. "right-start",
  50369. "right-end",
  50370. "right"
  50371. ];
  50372. const tooltipV2ContentProps = buildProps({
  50373. arrowPadding: {
  50374. type: definePropType(Number),
  50375. default: 5
  50376. },
  50377. effect: {
  50378. type: definePropType(String),
  50379. default: "light"
  50380. },
  50381. contentClass: String,
  50382. placement: {
  50383. type: definePropType(String),
  50384. values: tooltipV2Placements,
  50385. default: "bottom"
  50386. },
  50387. reference: {
  50388. type: definePropType(Object),
  50389. default: null
  50390. },
  50391. offset: {
  50392. type: Number,
  50393. default: 8
  50394. },
  50395. strategy: {
  50396. type: definePropType(String),
  50397. values: tooltipV2Strategies,
  50398. default: "absolute"
  50399. },
  50400. showArrow: Boolean,
  50401. ...useAriaProps(["ariaLabel"])
  50402. });
  50403. const tooltipV2RootProps = buildProps({
  50404. delayDuration: {
  50405. type: Number,
  50406. default: 300
  50407. },
  50408. defaultOpen: Boolean,
  50409. open: {
  50410. type: Boolean,
  50411. default: void 0
  50412. },
  50413. onOpenChange: {
  50414. type: definePropType(Function)
  50415. },
  50416. "onUpdate:open": {
  50417. type: definePropType(Function)
  50418. }
  50419. });
  50420. const EventHandler = {
  50421. type: definePropType(Function)
  50422. };
  50423. const tooltipV2TriggerProps = buildProps({
  50424. onBlur: EventHandler,
  50425. onClick: EventHandler,
  50426. onFocus: EventHandler,
  50427. onMouseDown: EventHandler,
  50428. onMouseEnter: EventHandler,
  50429. onMouseLeave: EventHandler
  50430. });
  50431. const tooltipV2Props = buildProps({
  50432. ...tooltipV2RootProps,
  50433. ...tooltipV2ArrowProps,
  50434. ...tooltipV2TriggerProps,
  50435. ...tooltipV2ContentProps,
  50436. alwaysOn: Boolean,
  50437. fullTransition: Boolean,
  50438. transitionProps: {
  50439. type: definePropType(Object),
  50440. default: null
  50441. },
  50442. teleported: Boolean,
  50443. to: {
  50444. type: definePropType(String),
  50445. default: "body"
  50446. }
  50447. });
  50448. const tooltipV2RootKey = Symbol("tooltipV2");
  50449. const tooltipV2ContentKey = Symbol("tooltipV2Content");
  50450. const TOOLTIP_V2_OPEN = "tooltip_v2.open";
  50451. const __default__$p = defineComponent({
  50452. name: "ElTooltipV2Root"
  50453. });
  50454. const _sfc_main$u = /* @__PURE__ */ defineComponent({
  50455. ...__default__$p,
  50456. props: tooltipV2RootProps,
  50457. setup(__props, { expose }) {
  50458. const props = __props;
  50459. const _open = ref(props.defaultOpen);
  50460. const triggerRef = ref(null);
  50461. const open = computed({
  50462. get: () => isPropAbsent(props.open) ? _open.value : props.open,
  50463. set: (open2) => {
  50464. var _a;
  50465. _open.value = open2;
  50466. (_a = props["onUpdate:open"]) == null ? void 0 : _a.call(props, open2);
  50467. }
  50468. });
  50469. const isOpenDelayed = computed(() => isNumber(props.delayDuration) && props.delayDuration > 0);
  50470. const { start: onDelayedOpen, stop: clearTimer } = useTimeoutFn(() => {
  50471. open.value = true;
  50472. }, computed(() => props.delayDuration), {
  50473. immediate: false
  50474. });
  50475. const ns = useNamespace("tooltip-v2");
  50476. const contentId = useId();
  50477. const onNormalOpen = () => {
  50478. clearTimer();
  50479. open.value = true;
  50480. };
  50481. const onDelayOpen = () => {
  50482. unref(isOpenDelayed) ? onDelayedOpen() : onNormalOpen();
  50483. };
  50484. const onOpen = onNormalOpen;
  50485. const onClose = () => {
  50486. clearTimer();
  50487. open.value = false;
  50488. };
  50489. const onChange = (open2) => {
  50490. var _a;
  50491. if (open2) {
  50492. document.dispatchEvent(new CustomEvent(TOOLTIP_V2_OPEN));
  50493. onOpen();
  50494. }
  50495. (_a = props.onOpenChange) == null ? void 0 : _a.call(props, open2);
  50496. };
  50497. watch(open, onChange);
  50498. onMounted(() => {
  50499. document.addEventListener(TOOLTIP_V2_OPEN, onClose);
  50500. });
  50501. onBeforeUnmount(() => {
  50502. clearTimer();
  50503. document.removeEventListener(TOOLTIP_V2_OPEN, onClose);
  50504. });
  50505. provide(tooltipV2RootKey, {
  50506. contentId,
  50507. triggerRef,
  50508. ns,
  50509. onClose,
  50510. onDelayOpen,
  50511. onOpen
  50512. });
  50513. expose({
  50514. onOpen,
  50515. onClose
  50516. });
  50517. return (_ctx, _cache) => {
  50518. return renderSlot(_ctx.$slots, "default", { open: unref(open) });
  50519. };
  50520. }
  50521. });
  50522. var TooltipV2Root = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__file", "root.vue"]]);
  50523. const __default__$o = defineComponent({
  50524. name: "ElTooltipV2Arrow"
  50525. });
  50526. const _sfc_main$t = /* @__PURE__ */ defineComponent({
  50527. ...__default__$o,
  50528. props: {
  50529. ...tooltipV2ArrowProps,
  50530. ...tooltipV2ArrowSpecialProps
  50531. },
  50532. setup(__props) {
  50533. const props = __props;
  50534. const { ns } = inject(tooltipV2RootKey);
  50535. const { arrowRef } = inject(tooltipV2ContentKey);
  50536. const arrowStyle = computed(() => {
  50537. const { style, width, height } = props;
  50538. const namespace = ns.namespace.value;
  50539. return {
  50540. [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,
  50541. [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,
  50542. [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,
  50543. [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,
  50544. ...style || {}
  50545. };
  50546. });
  50547. return (_ctx, _cache) => {
  50548. return openBlock(), createElementBlock("span", {
  50549. ref_key: "arrowRef",
  50550. ref: arrowRef,
  50551. style: normalizeStyle(unref(arrowStyle)),
  50552. class: normalizeClass(unref(ns).e("arrow"))
  50553. }, null, 6);
  50554. };
  50555. }
  50556. });
  50557. var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__file", "arrow.vue"]]);
  50558. const visualHiddenProps = buildProps({
  50559. style: {
  50560. type: definePropType([String, Object, Array]),
  50561. default: () => ({})
  50562. }
  50563. });
  50564. const __default__$n = defineComponent({
  50565. name: "ElVisuallyHidden"
  50566. });
  50567. const _sfc_main$s = /* @__PURE__ */ defineComponent({
  50568. ...__default__$n,
  50569. props: visualHiddenProps,
  50570. setup(__props) {
  50571. const props = __props;
  50572. const computedStyle = computed(() => {
  50573. return [
  50574. props.style,
  50575. {
  50576. position: "absolute",
  50577. border: 0,
  50578. width: 1,
  50579. height: 1,
  50580. padding: 0,
  50581. margin: -1,
  50582. overflow: "hidden",
  50583. clip: "rect(0, 0, 0, 0)",
  50584. whiteSpace: "nowrap",
  50585. wordWrap: "normal"
  50586. }
  50587. ];
  50588. });
  50589. return (_ctx, _cache) => {
  50590. return openBlock(), createElementBlock("span", mergeProps(_ctx.$attrs, { style: unref(computedStyle) }), [
  50591. renderSlot(_ctx.$slots, "default")
  50592. ], 16);
  50593. };
  50594. }
  50595. });
  50596. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__file", "visual-hidden.vue"]]);
  50597. const __default__$m = defineComponent({
  50598. name: "ElTooltipV2Content"
  50599. });
  50600. const _sfc_main$r = /* @__PURE__ */ defineComponent({
  50601. ...__default__$m,
  50602. props: { ...tooltipV2ContentProps, ...tooltipV2CommonProps },
  50603. setup(__props) {
  50604. const props = __props;
  50605. const { triggerRef, contentId } = inject(tooltipV2RootKey);
  50606. const placement = ref(props.placement);
  50607. const strategy = ref(props.strategy);
  50608. const arrowRef = ref(null);
  50609. const { referenceRef, contentRef, middlewareData, x, y, update } = useFloating$1({
  50610. placement,
  50611. strategy,
  50612. middleware: computed(() => {
  50613. const middleware = [offset(props.offset)];
  50614. if (props.showArrow) {
  50615. middleware.push(arrowMiddleware({
  50616. arrowRef
  50617. }));
  50618. }
  50619. return middleware;
  50620. })
  50621. });
  50622. const zIndex = useZIndex().nextZIndex();
  50623. const ns = useNamespace("tooltip-v2");
  50624. const side = computed(() => {
  50625. return placement.value.split("-")[0];
  50626. });
  50627. const contentStyle = computed(() => {
  50628. return {
  50629. position: unref(strategy),
  50630. top: `${unref(y) || 0}px`,
  50631. left: `${unref(x) || 0}px`,
  50632. zIndex
  50633. };
  50634. });
  50635. const arrowStyle = computed(() => {
  50636. if (!props.showArrow)
  50637. return {};
  50638. const { arrow } = unref(middlewareData);
  50639. return {
  50640. [`--${ns.namespace.value}-tooltip-v2-arrow-x`]: `${arrow == null ? void 0 : arrow.x}px` || "",
  50641. [`--${ns.namespace.value}-tooltip-v2-arrow-y`]: `${arrow == null ? void 0 : arrow.y}px` || ""
  50642. };
  50643. });
  50644. const contentClass = computed(() => [
  50645. ns.e("content"),
  50646. ns.is("dark", props.effect === "dark"),
  50647. ns.is(unref(strategy)),
  50648. props.contentClass
  50649. ]);
  50650. watch(arrowRef, () => update());
  50651. watch(() => props.placement, (val) => placement.value = val);
  50652. onMounted(() => {
  50653. watch(() => props.reference || triggerRef.value, (el) => {
  50654. referenceRef.value = el || void 0;
  50655. }, {
  50656. immediate: true
  50657. });
  50658. });
  50659. provide(tooltipV2ContentKey, { arrowRef });
  50660. return (_ctx, _cache) => {
  50661. return openBlock(), createElementBlock("div", {
  50662. ref_key: "contentRef",
  50663. ref: contentRef,
  50664. style: normalizeStyle(unref(contentStyle)),
  50665. "data-tooltip-v2-root": ""
  50666. }, [
  50667. !_ctx.nowrap ? (openBlock(), createElementBlock("div", {
  50668. key: 0,
  50669. "data-side": unref(side),
  50670. class: normalizeClass(unref(contentClass))
  50671. }, [
  50672. renderSlot(_ctx.$slots, "default", {
  50673. contentStyle: unref(contentStyle),
  50674. contentClass: unref(contentClass)
  50675. }),
  50676. createVNode(unref(ElVisuallyHidden), {
  50677. id: unref(contentId),
  50678. role: "tooltip"
  50679. }, {
  50680. default: withCtx(() => [
  50681. _ctx.ariaLabel ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  50682. createTextVNode(toDisplayString(_ctx.ariaLabel), 1)
  50683. ], 64)) : renderSlot(_ctx.$slots, "default", { key: 1 })
  50684. ]),
  50685. _: 3
  50686. }, 8, ["id"]),
  50687. renderSlot(_ctx.$slots, "arrow", {
  50688. style: normalizeStyle(unref(arrowStyle)),
  50689. side: unref(side)
  50690. })
  50691. ], 10, ["data-side"])) : createCommentVNode("v-if", true)
  50692. ], 4);
  50693. };
  50694. }
  50695. });
  50696. var TooltipV2Content = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__file", "content.vue"]]);
  50697. const forwardRefProps = buildProps({
  50698. setRef: {
  50699. type: definePropType(Function),
  50700. required: true
  50701. },
  50702. onlyChild: Boolean
  50703. });
  50704. var ForwardRef = defineComponent({
  50705. props: forwardRefProps,
  50706. setup(props, {
  50707. slots
  50708. }) {
  50709. const fragmentRef = ref();
  50710. const setRef = composeRefs(fragmentRef, (el) => {
  50711. if (el) {
  50712. props.setRef(el.nextElementSibling);
  50713. } else {
  50714. props.setRef(null);
  50715. }
  50716. });
  50717. return () => {
  50718. var _a;
  50719. const [firstChild] = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || [];
  50720. const child = props.onlyChild ? ensureOnlyChild(firstChild.children) : firstChild.children;
  50721. return createVNode(Fragment, {
  50722. "ref": setRef
  50723. }, [child]);
  50724. };
  50725. }
  50726. });
  50727. const __default__$l = defineComponent({
  50728. name: "ElTooltipV2Trigger"
  50729. });
  50730. const _sfc_main$q = /* @__PURE__ */ defineComponent({
  50731. ...__default__$l,
  50732. props: {
  50733. ...tooltipV2CommonProps,
  50734. ...tooltipV2TriggerProps
  50735. },
  50736. setup(__props) {
  50737. const props = __props;
  50738. const { onClose, onOpen, onDelayOpen, triggerRef, contentId } = inject(tooltipV2RootKey);
  50739. let isMousedown = false;
  50740. const setTriggerRef = (el) => {
  50741. triggerRef.value = el;
  50742. };
  50743. const onMouseup = () => {
  50744. isMousedown = false;
  50745. };
  50746. const onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen);
  50747. const onMouseleave = composeEventHandlers(props.onMouseLeave, onClose);
  50748. const onMousedown = composeEventHandlers(props.onMouseDown, () => {
  50749. onClose();
  50750. isMousedown = true;
  50751. document.addEventListener("mouseup", onMouseup, { once: true });
  50752. });
  50753. const onFocus = composeEventHandlers(props.onFocus, () => {
  50754. if (!isMousedown)
  50755. onOpen();
  50756. });
  50757. const onBlur = composeEventHandlers(props.onBlur, onClose);
  50758. const onClick = composeEventHandlers(props.onClick, (e) => {
  50759. if (e.detail === 0)
  50760. onClose();
  50761. });
  50762. const events = {
  50763. blur: onBlur,
  50764. click: onClick,
  50765. focus: onFocus,
  50766. mousedown: onMousedown,
  50767. mouseenter: onMouseenter,
  50768. mouseleave: onMouseleave
  50769. };
  50770. const setEvents = (el, events2, type) => {
  50771. if (el) {
  50772. Object.entries(events2).forEach(([name, handler]) => {
  50773. el[type](name, handler);
  50774. });
  50775. }
  50776. };
  50777. watch(triggerRef, (triggerEl, previousTriggerEl) => {
  50778. setEvents(triggerEl, events, "addEventListener");
  50779. setEvents(previousTriggerEl, events, "removeEventListener");
  50780. if (triggerEl) {
  50781. triggerEl.setAttribute("aria-describedby", contentId.value);
  50782. }
  50783. });
  50784. onBeforeUnmount(() => {
  50785. setEvents(triggerRef.value, events, "removeEventListener");
  50786. document.removeEventListener("mouseup", onMouseup);
  50787. });
  50788. return (_ctx, _cache) => {
  50789. return _ctx.nowrap ? (openBlock(), createBlock(unref(ForwardRef), {
  50790. key: 0,
  50791. "set-ref": setTriggerRef,
  50792. "only-child": ""
  50793. }, {
  50794. default: withCtx(() => [
  50795. renderSlot(_ctx.$slots, "default")
  50796. ]),
  50797. _: 3
  50798. })) : (openBlock(), createElementBlock("button", mergeProps({
  50799. key: 1,
  50800. ref_key: "triggerRef",
  50801. ref: triggerRef
  50802. }, _ctx.$attrs), [
  50803. renderSlot(_ctx.$slots, "default")
  50804. ], 16));
  50805. };
  50806. }
  50807. });
  50808. var TooltipV2Trigger = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["__file", "trigger.vue"]]);
  50809. const __default__$k = defineComponent({
  50810. name: "ElTooltipV2"
  50811. });
  50812. const _sfc_main$p = /* @__PURE__ */ defineComponent({
  50813. ...__default__$k,
  50814. props: tooltipV2Props,
  50815. setup(__props) {
  50816. const props = __props;
  50817. const refedProps = toRefs(props);
  50818. const arrowProps = reactive(pick(refedProps, Object.keys(tooltipV2ArrowProps)));
  50819. const contentProps = reactive(pick(refedProps, Object.keys(tooltipV2ContentProps)));
  50820. const rootProps = reactive(pick(refedProps, Object.keys(tooltipV2RootProps)));
  50821. const triggerProps = reactive(pick(refedProps, Object.keys(tooltipV2TriggerProps)));
  50822. return (_ctx, _cache) => {
  50823. return openBlock(), createBlock(TooltipV2Root, normalizeProps(guardReactiveProps(rootProps)), {
  50824. default: withCtx(({ open }) => [
  50825. createVNode(TooltipV2Trigger, mergeProps(triggerProps, { nowrap: "" }), {
  50826. default: withCtx(() => [
  50827. renderSlot(_ctx.$slots, "trigger")
  50828. ]),
  50829. _: 3
  50830. }, 16),
  50831. createVNode(unref(ElTeleport$1), {
  50832. to: _ctx.to,
  50833. disabled: !_ctx.teleported
  50834. }, {
  50835. default: withCtx(() => [
  50836. _ctx.fullTransition ? (openBlock(), createBlock(Transition, normalizeProps(mergeProps({ key: 0 }, _ctx.transitionProps)), {
  50837. default: withCtx(() => [
  50838. _ctx.alwaysOn || open ? (openBlock(), createBlock(TooltipV2Content, normalizeProps(mergeProps({ key: 0 }, contentProps)), {
  50839. arrow: withCtx(({ style, side }) => [
  50840. _ctx.showArrow ? (openBlock(), createBlock(TooltipV2Arrow, mergeProps({ key: 0 }, arrowProps, {
  50841. style,
  50842. side
  50843. }), null, 16, ["style", "side"])) : createCommentVNode("v-if", true)
  50844. ]),
  50845. default: withCtx(() => [
  50846. renderSlot(_ctx.$slots, "default")
  50847. ]),
  50848. _: 3
  50849. }, 16)) : createCommentVNode("v-if", true)
  50850. ]),
  50851. _: 2
  50852. }, 1040)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  50853. _ctx.alwaysOn || open ? (openBlock(), createBlock(TooltipV2Content, normalizeProps(mergeProps({ key: 0 }, contentProps)), {
  50854. arrow: withCtx(({ style, side }) => [
  50855. _ctx.showArrow ? (openBlock(), createBlock(TooltipV2Arrow, mergeProps({ key: 0 }, arrowProps, {
  50856. style,
  50857. side
  50858. }), null, 16, ["style", "side"])) : createCommentVNode("v-if", true)
  50859. ]),
  50860. default: withCtx(() => [
  50861. renderSlot(_ctx.$slots, "default")
  50862. ]),
  50863. _: 3
  50864. }, 16)) : createCommentVNode("v-if", true)
  50865. ], 64))
  50866. ]),
  50867. _: 2
  50868. }, 1032, ["to", "disabled"])
  50869. ]),
  50870. _: 3
  50871. }, 16);
  50872. };
  50873. }
  50874. });
  50875. var TooltipV2 = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["__file", "tooltip.vue"]]);
  50876. const ElTooltipV2 = withInstall(TooltipV2);
  50877. const LEFT_CHECK_CHANGE_EVENT = "left-check-change";
  50878. const RIGHT_CHECK_CHANGE_EVENT = "right-check-change";
  50879. const transferProps = buildProps({
  50880. data: {
  50881. type: definePropType(Array),
  50882. default: () => []
  50883. },
  50884. titles: {
  50885. type: definePropType(Array),
  50886. default: () => []
  50887. },
  50888. buttonTexts: {
  50889. type: definePropType(Array),
  50890. default: () => []
  50891. },
  50892. filterPlaceholder: String,
  50893. filterMethod: {
  50894. type: definePropType(Function)
  50895. },
  50896. leftDefaultChecked: {
  50897. type: definePropType(Array),
  50898. default: () => []
  50899. },
  50900. rightDefaultChecked: {
  50901. type: definePropType(Array),
  50902. default: () => []
  50903. },
  50904. renderContent: {
  50905. type: definePropType(Function)
  50906. },
  50907. modelValue: {
  50908. type: definePropType(Array),
  50909. default: () => []
  50910. },
  50911. format: {
  50912. type: definePropType(Object),
  50913. default: () => ({})
  50914. },
  50915. filterable: Boolean,
  50916. props: {
  50917. type: definePropType(Object),
  50918. default: () => mutable({
  50919. label: "label",
  50920. key: "key",
  50921. disabled: "disabled"
  50922. })
  50923. },
  50924. targetOrder: {
  50925. type: String,
  50926. values: ["original", "push", "unshift"],
  50927. default: "original"
  50928. },
  50929. validateEvent: {
  50930. type: Boolean,
  50931. default: true
  50932. }
  50933. });
  50934. const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray$1) || isArray$1(value) && isNil(movedKeys);
  50935. const transferEmits = {
  50936. [CHANGE_EVENT]: (value, direction, movedKeys) => [value, movedKeys].every(isArray$1) && ["left", "right"].includes(direction),
  50937. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value),
  50938. [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,
  50939. [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn
  50940. };
  50941. const CHECKED_CHANGE_EVENT = "checked-change";
  50942. const transferPanelProps = buildProps({
  50943. data: transferProps.data,
  50944. optionRender: {
  50945. type: definePropType(Function)
  50946. },
  50947. placeholder: String,
  50948. title: String,
  50949. filterable: Boolean,
  50950. format: transferProps.format,
  50951. filterMethod: transferProps.filterMethod,
  50952. defaultChecked: transferProps.leftDefaultChecked,
  50953. props: transferProps.props
  50954. });
  50955. const transferPanelEmits = {
  50956. [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn
  50957. };
  50958. const usePropsAlias = (props) => {
  50959. const initProps = {
  50960. label: "label",
  50961. key: "key",
  50962. disabled: "disabled"
  50963. };
  50964. return computed(() => ({
  50965. ...initProps,
  50966. ...props.props
  50967. }));
  50968. };
  50969. const useCheck$1 = (props, panelState, emit) => {
  50970. const propsAlias = usePropsAlias(props);
  50971. const filteredData = computed(() => {
  50972. return props.data.filter((item) => {
  50973. if (isFunction$1(props.filterMethod)) {
  50974. return props.filterMethod(panelState.query, item);
  50975. } else {
  50976. const label = String(item[propsAlias.value.label] || item[propsAlias.value.key]);
  50977. return label.toLowerCase().includes(panelState.query.toLowerCase());
  50978. }
  50979. });
  50980. });
  50981. const checkableData = computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled]));
  50982. const checkedSummary = computed(() => {
  50983. const checkedLength = panelState.checked.length;
  50984. const dataLength = props.data.length;
  50985. const { noChecked, hasChecked } = props.format;
  50986. if (noChecked && hasChecked) {
  50987. return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString());
  50988. } else {
  50989. return `${checkedLength}/${dataLength}`;
  50990. }
  50991. });
  50992. const isIndeterminate = computed(() => {
  50993. const checkedLength = panelState.checked.length;
  50994. return checkedLength > 0 && checkedLength < checkableData.value.length;
  50995. });
  50996. const updateAllChecked = () => {
  50997. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  50998. panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item));
  50999. };
  51000. const handleAllCheckedChange = (value) => {
  51001. panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : [];
  51002. };
  51003. watch(() => panelState.checked, (val, oldVal) => {
  51004. updateAllChecked();
  51005. if (panelState.checkChangeByUser) {
  51006. const movedKeys = val.concat(oldVal).filter((v) => !val.includes(v) || !oldVal.includes(v));
  51007. emit(CHECKED_CHANGE_EVENT, val, movedKeys);
  51008. } else {
  51009. emit(CHECKED_CHANGE_EVENT, val);
  51010. panelState.checkChangeByUser = true;
  51011. }
  51012. });
  51013. watch(checkableData, () => {
  51014. updateAllChecked();
  51015. });
  51016. watch(() => props.data, () => {
  51017. const checked = [];
  51018. const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]);
  51019. panelState.checked.forEach((item) => {
  51020. if (filteredDataKeys.includes(item)) {
  51021. checked.push(item);
  51022. }
  51023. });
  51024. panelState.checkChangeByUser = false;
  51025. panelState.checked = checked;
  51026. });
  51027. watch(() => props.defaultChecked, (val, oldVal) => {
  51028. if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item)))
  51029. return;
  51030. const checked = [];
  51031. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  51032. val.forEach((item) => {
  51033. if (checkableDataKeys.includes(item)) {
  51034. checked.push(item);
  51035. }
  51036. });
  51037. panelState.checkChangeByUser = false;
  51038. panelState.checked = checked;
  51039. }, {
  51040. immediate: true
  51041. });
  51042. return {
  51043. filteredData,
  51044. checkableData,
  51045. checkedSummary,
  51046. isIndeterminate,
  51047. updateAllChecked,
  51048. handleAllCheckedChange
  51049. };
  51050. };
  51051. const useCheckedChange = (checkedState, emit) => {
  51052. const onSourceCheckedChange = (val, movedKeys) => {
  51053. checkedState.leftChecked = val;
  51054. if (!movedKeys)
  51055. return;
  51056. emit(LEFT_CHECK_CHANGE_EVENT, val, movedKeys);
  51057. };
  51058. const onTargetCheckedChange = (val, movedKeys) => {
  51059. checkedState.rightChecked = val;
  51060. if (!movedKeys)
  51061. return;
  51062. emit(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys);
  51063. };
  51064. return {
  51065. onSourceCheckedChange,
  51066. onTargetCheckedChange
  51067. };
  51068. };
  51069. const useComputedData = (props) => {
  51070. const propsAlias = usePropsAlias(props);
  51071. const dataObj = computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur) && o, {}));
  51072. const sourceData = computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key])));
  51073. const targetData = computed(() => {
  51074. if (props.targetOrder === "original") {
  51075. return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
  51076. } else {
  51077. return props.modelValue.reduce((arr, cur) => {
  51078. const val = dataObj.value[cur];
  51079. if (val) {
  51080. arr.push(val);
  51081. }
  51082. return arr;
  51083. }, []);
  51084. }
  51085. });
  51086. return {
  51087. sourceData,
  51088. targetData
  51089. };
  51090. };
  51091. const useMove = (props, checkedState, emit) => {
  51092. const propsAlias = usePropsAlias(props);
  51093. const _emit = (value, direction, movedKeys) => {
  51094. emit(UPDATE_MODEL_EVENT, value);
  51095. emit(CHANGE_EVENT, value, direction, movedKeys);
  51096. };
  51097. const addToLeft = () => {
  51098. const currentValue = props.modelValue.slice();
  51099. checkedState.rightChecked.forEach((item) => {
  51100. const index = currentValue.indexOf(item);
  51101. if (index > -1) {
  51102. currentValue.splice(index, 1);
  51103. }
  51104. });
  51105. _emit(currentValue, "left", checkedState.rightChecked);
  51106. };
  51107. const addToRight = () => {
  51108. let currentValue = props.modelValue.slice();
  51109. const itemsToBeMoved = props.data.filter((item) => {
  51110. const itemKey = item[propsAlias.value.key];
  51111. return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey);
  51112. }).map((item) => item[propsAlias.value.key]);
  51113. currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  51114. if (props.targetOrder === "original") {
  51115. currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]);
  51116. }
  51117. _emit(currentValue, "right", checkedState.leftChecked);
  51118. };
  51119. return {
  51120. addToLeft,
  51121. addToRight
  51122. };
  51123. };
  51124. const __default__$j = defineComponent({
  51125. name: "ElTransferPanel"
  51126. });
  51127. const _sfc_main$o = /* @__PURE__ */ defineComponent({
  51128. ...__default__$j,
  51129. props: transferPanelProps,
  51130. emits: transferPanelEmits,
  51131. setup(__props, { expose, emit }) {
  51132. const props = __props;
  51133. const slots = useSlots();
  51134. const OptionContent = ({ option }) => option;
  51135. const { t } = useLocale();
  51136. const ns = useNamespace("transfer");
  51137. const panelState = reactive({
  51138. checked: [],
  51139. allChecked: false,
  51140. query: "",
  51141. checkChangeByUser: true
  51142. });
  51143. const propsAlias = usePropsAlias(props);
  51144. const {
  51145. filteredData,
  51146. checkedSummary,
  51147. isIndeterminate,
  51148. handleAllCheckedChange
  51149. } = useCheck$1(props, panelState, emit);
  51150. const hasNoMatch = computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value));
  51151. const hasFooter = computed(() => !isEmpty(slots.default()[0].children));
  51152. const { checked, allChecked, query } = toRefs(panelState);
  51153. expose({
  51154. query
  51155. });
  51156. return (_ctx, _cache) => {
  51157. return openBlock(), createElementBlock("div", {
  51158. class: normalizeClass(unref(ns).b("panel"))
  51159. }, [
  51160. createElementVNode("p", {
  51161. class: normalizeClass(unref(ns).be("panel", "header"))
  51162. }, [
  51163. createVNode(unref(ElCheckbox), {
  51164. modelValue: unref(allChecked),
  51165. "onUpdate:modelValue": ($event) => isRef(allChecked) ? allChecked.value = $event : null,
  51166. indeterminate: unref(isIndeterminate),
  51167. "validate-event": false,
  51168. onChange: unref(handleAllCheckedChange)
  51169. }, {
  51170. default: withCtx(() => [
  51171. createTextVNode(toDisplayString(_ctx.title) + " ", 1),
  51172. createElementVNode("span", null, toDisplayString(unref(checkedSummary)), 1)
  51173. ]),
  51174. _: 1
  51175. }, 8, ["modelValue", "onUpdate:modelValue", "indeterminate", "onChange"])
  51176. ], 2),
  51177. createElementVNode("div", {
  51178. class: normalizeClass([unref(ns).be("panel", "body"), unref(ns).is("with-footer", unref(hasFooter))])
  51179. }, [
  51180. _ctx.filterable ? (openBlock(), createBlock(unref(ElInput), {
  51181. key: 0,
  51182. modelValue: unref(query),
  51183. "onUpdate:modelValue": ($event) => isRef(query) ? query.value = $event : null,
  51184. class: normalizeClass(unref(ns).be("panel", "filter")),
  51185. size: "default",
  51186. placeholder: _ctx.placeholder,
  51187. "prefix-icon": unref(search_default),
  51188. clearable: "",
  51189. "validate-event": false
  51190. }, null, 8, ["modelValue", "onUpdate:modelValue", "class", "placeholder", "prefix-icon"])) : createCommentVNode("v-if", true),
  51191. withDirectives(createVNode(unref(ElCheckboxGroup$1), {
  51192. modelValue: unref(checked),
  51193. "onUpdate:modelValue": ($event) => isRef(checked) ? checked.value = $event : null,
  51194. "validate-event": false,
  51195. class: normalizeClass([unref(ns).is("filterable", _ctx.filterable), unref(ns).be("panel", "list")])
  51196. }, {
  51197. default: withCtx(() => [
  51198. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(filteredData), (item) => {
  51199. return openBlock(), createBlock(unref(ElCheckbox), {
  51200. key: item[unref(propsAlias).key],
  51201. class: normalizeClass(unref(ns).be("panel", "item")),
  51202. value: item[unref(propsAlias).key],
  51203. disabled: item[unref(propsAlias).disabled],
  51204. "validate-event": false
  51205. }, {
  51206. default: withCtx(() => {
  51207. var _a;
  51208. return [
  51209. createVNode(OptionContent, {
  51210. option: (_a = _ctx.optionRender) == null ? void 0 : _a.call(_ctx, item)
  51211. }, null, 8, ["option"])
  51212. ];
  51213. }),
  51214. _: 2
  51215. }, 1032, ["class", "value", "disabled"]);
  51216. }), 128))
  51217. ]),
  51218. _: 1
  51219. }, 8, ["modelValue", "onUpdate:modelValue", "class"]), [
  51220. [vShow, !unref(hasNoMatch) && !unref(isEmpty)(_ctx.data)]
  51221. ]),
  51222. withDirectives(createElementVNode("div", {
  51223. class: normalizeClass(unref(ns).be("panel", "empty"))
  51224. }, [
  51225. renderSlot(_ctx.$slots, "empty", {}, () => [
  51226. createTextVNode(toDisplayString(unref(hasNoMatch) ? unref(t)("el.transfer.noMatch") : unref(t)("el.transfer.noData")), 1)
  51227. ])
  51228. ], 2), [
  51229. [vShow, unref(hasNoMatch) || unref(isEmpty)(_ctx.data)]
  51230. ])
  51231. ], 2),
  51232. unref(hasFooter) ? (openBlock(), createElementBlock("p", {
  51233. key: 0,
  51234. class: normalizeClass(unref(ns).be("panel", "footer"))
  51235. }, [
  51236. renderSlot(_ctx.$slots, "default")
  51237. ], 2)) : createCommentVNode("v-if", true)
  51238. ], 2);
  51239. };
  51240. }
  51241. });
  51242. var TransferPanel = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__file", "transfer-panel.vue"]]);
  51243. const __default__$i = defineComponent({
  51244. name: "ElTransfer"
  51245. });
  51246. const _sfc_main$n = /* @__PURE__ */ defineComponent({
  51247. ...__default__$i,
  51248. props: transferProps,
  51249. emits: transferEmits,
  51250. setup(__props, { expose, emit }) {
  51251. const props = __props;
  51252. const slots = useSlots();
  51253. const { t } = useLocale();
  51254. const ns = useNamespace("transfer");
  51255. const { formItem } = useFormItem();
  51256. const checkedState = reactive({
  51257. leftChecked: [],
  51258. rightChecked: []
  51259. });
  51260. const propsAlias = usePropsAlias(props);
  51261. const { sourceData, targetData } = useComputedData(props);
  51262. const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit);
  51263. const { addToLeft, addToRight } = useMove(props, checkedState, emit);
  51264. const leftPanel = ref();
  51265. const rightPanel = ref();
  51266. const clearQuery = (which) => {
  51267. switch (which) {
  51268. case "left":
  51269. leftPanel.value.query = "";
  51270. break;
  51271. case "right":
  51272. rightPanel.value.query = "";
  51273. break;
  51274. }
  51275. };
  51276. const hasButtonTexts = computed(() => props.buttonTexts.length === 2);
  51277. const leftPanelTitle = computed(() => props.titles[0] || t("el.transfer.titles.0"));
  51278. const rightPanelTitle = computed(() => props.titles[1] || t("el.transfer.titles.1"));
  51279. const panelFilterPlaceholder = computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder"));
  51280. watch(() => props.modelValue, () => {
  51281. var _a;
  51282. if (props.validateEvent) {
  51283. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  51284. }
  51285. });
  51286. const optionRender = computed(() => (option) => {
  51287. var _a;
  51288. if (props.renderContent)
  51289. return props.renderContent(h$1, option);
  51290. const defaultSlotVNodes = (((_a = slots.default) == null ? void 0 : _a.call(slots, { option })) || []).filter((node) => node.type !== Comment);
  51291. if (defaultSlotVNodes.length) {
  51292. return defaultSlotVNodes;
  51293. }
  51294. return h$1("span", option[propsAlias.value.label] || option[propsAlias.value.key]);
  51295. });
  51296. expose({
  51297. clearQuery,
  51298. leftPanel,
  51299. rightPanel
  51300. });
  51301. return (_ctx, _cache) => {
  51302. return openBlock(), createElementBlock("div", {
  51303. class: normalizeClass(unref(ns).b())
  51304. }, [
  51305. createVNode(TransferPanel, {
  51306. ref_key: "leftPanel",
  51307. ref: leftPanel,
  51308. data: unref(sourceData),
  51309. "option-render": unref(optionRender),
  51310. placeholder: unref(panelFilterPlaceholder),
  51311. title: unref(leftPanelTitle),
  51312. filterable: _ctx.filterable,
  51313. format: _ctx.format,
  51314. "filter-method": _ctx.filterMethod,
  51315. "default-checked": _ctx.leftDefaultChecked,
  51316. props: props.props,
  51317. onCheckedChange: unref(onSourceCheckedChange)
  51318. }, {
  51319. empty: withCtx(() => [
  51320. renderSlot(_ctx.$slots, "left-empty")
  51321. ]),
  51322. default: withCtx(() => [
  51323. renderSlot(_ctx.$slots, "left-footer")
  51324. ]),
  51325. _: 3
  51326. }, 8, ["data", "option-render", "placeholder", "title", "filterable", "format", "filter-method", "default-checked", "props", "onCheckedChange"]),
  51327. createElementVNode("div", {
  51328. class: normalizeClass(unref(ns).e("buttons"))
  51329. }, [
  51330. createVNode(unref(ElButton), {
  51331. type: "primary",
  51332. class: normalizeClass([unref(ns).e("button"), unref(ns).is("with-texts", unref(hasButtonTexts))]),
  51333. disabled: unref(isEmpty)(checkedState.rightChecked),
  51334. onClick: unref(addToLeft)
  51335. }, {
  51336. default: withCtx(() => [
  51337. createVNode(unref(ElIcon), null, {
  51338. default: withCtx(() => [
  51339. createVNode(unref(arrow_left_default))
  51340. ]),
  51341. _: 1
  51342. }),
  51343. !unref(isUndefined)(_ctx.buttonTexts[0]) ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(_ctx.buttonTexts[0]), 1)) : createCommentVNode("v-if", true)
  51344. ]),
  51345. _: 1
  51346. }, 8, ["class", "disabled", "onClick"]),
  51347. createVNode(unref(ElButton), {
  51348. type: "primary",
  51349. class: normalizeClass([unref(ns).e("button"), unref(ns).is("with-texts", unref(hasButtonTexts))]),
  51350. disabled: unref(isEmpty)(checkedState.leftChecked),
  51351. onClick: unref(addToRight)
  51352. }, {
  51353. default: withCtx(() => [
  51354. !unref(isUndefined)(_ctx.buttonTexts[1]) ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(_ctx.buttonTexts[1]), 1)) : createCommentVNode("v-if", true),
  51355. createVNode(unref(ElIcon), null, {
  51356. default: withCtx(() => [
  51357. createVNode(unref(arrow_right_default))
  51358. ]),
  51359. _: 1
  51360. })
  51361. ]),
  51362. _: 1
  51363. }, 8, ["class", "disabled", "onClick"])
  51364. ], 2),
  51365. createVNode(TransferPanel, {
  51366. ref_key: "rightPanel",
  51367. ref: rightPanel,
  51368. data: unref(targetData),
  51369. "option-render": unref(optionRender),
  51370. placeholder: unref(panelFilterPlaceholder),
  51371. filterable: _ctx.filterable,
  51372. format: _ctx.format,
  51373. "filter-method": _ctx.filterMethod,
  51374. title: unref(rightPanelTitle),
  51375. "default-checked": _ctx.rightDefaultChecked,
  51376. props: props.props,
  51377. onCheckedChange: unref(onTargetCheckedChange)
  51378. }, {
  51379. empty: withCtx(() => [
  51380. renderSlot(_ctx.$slots, "right-empty")
  51381. ]),
  51382. default: withCtx(() => [
  51383. renderSlot(_ctx.$slots, "right-footer")
  51384. ]),
  51385. _: 3
  51386. }, 8, ["data", "option-render", "placeholder", "filterable", "format", "filter-method", "title", "default-checked", "props", "onCheckedChange"])
  51387. ], 2);
  51388. };
  51389. }
  51390. });
  51391. var Transfer = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__file", "transfer.vue"]]);
  51392. const ElTransfer = withInstall(Transfer);
  51393. const NODE_KEY = "$treeNodeId";
  51394. const markNodeData = function(node, data) {
  51395. if (!data || data[NODE_KEY])
  51396. return;
  51397. Object.defineProperty(data, NODE_KEY, {
  51398. value: node.id,
  51399. enumerable: false,
  51400. configurable: false,
  51401. writable: false
  51402. });
  51403. };
  51404. const getNodeKey = function(key, data) {
  51405. if (!key)
  51406. return data[NODE_KEY];
  51407. return data[key];
  51408. };
  51409. const handleCurrentChange = (store, emit, setCurrent) => {
  51410. const preCurrentNode = store.value.currentNode;
  51411. setCurrent();
  51412. const currentNode = store.value.currentNode;
  51413. if (preCurrentNode === currentNode)
  51414. return;
  51415. emit("current-change", currentNode ? currentNode.data : null, currentNode);
  51416. };
  51417. const getChildState = (node) => {
  51418. let all = true;
  51419. let none = true;
  51420. let allWithoutDisable = true;
  51421. for (let i = 0, j = node.length; i < j; i++) {
  51422. const n = node[i];
  51423. if (n.checked !== true || n.indeterminate) {
  51424. all = false;
  51425. if (!n.disabled) {
  51426. allWithoutDisable = false;
  51427. }
  51428. }
  51429. if (n.checked !== false || n.indeterminate) {
  51430. none = false;
  51431. }
  51432. }
  51433. return { all, none, allWithoutDisable, half: !all && !none };
  51434. };
  51435. const reInitChecked = function(node) {
  51436. if (node.childNodes.length === 0 || node.loading)
  51437. return;
  51438. const { all, none, half } = getChildState(node.childNodes);
  51439. if (all) {
  51440. node.checked = true;
  51441. node.indeterminate = false;
  51442. } else if (half) {
  51443. node.checked = false;
  51444. node.indeterminate = true;
  51445. } else if (none) {
  51446. node.checked = false;
  51447. node.indeterminate = false;
  51448. }
  51449. const parent = node.parent;
  51450. if (!parent || parent.level === 0)
  51451. return;
  51452. if (!node.store.checkStrictly) {
  51453. reInitChecked(parent);
  51454. }
  51455. };
  51456. const getPropertyFromData = function(node, prop) {
  51457. const props = node.store.props;
  51458. const data = node.data || {};
  51459. const config = props[prop];
  51460. if (isFunction$1(config)) {
  51461. return config(data, node);
  51462. } else if (isString$1(config)) {
  51463. return data[config];
  51464. } else if (isUndefined(config)) {
  51465. const dataProp = data[prop];
  51466. return dataProp === void 0 ? "" : dataProp;
  51467. }
  51468. };
  51469. let nodeIdSeed = 0;
  51470. class Node {
  51471. constructor(options) {
  51472. this.id = nodeIdSeed++;
  51473. this.text = null;
  51474. this.checked = false;
  51475. this.indeterminate = false;
  51476. this.data = null;
  51477. this.expanded = false;
  51478. this.parent = null;
  51479. this.visible = true;
  51480. this.isCurrent = false;
  51481. this.canFocus = false;
  51482. for (const name in options) {
  51483. if (hasOwn(options, name)) {
  51484. this[name] = options[name];
  51485. }
  51486. }
  51487. this.level = 0;
  51488. this.loaded = false;
  51489. this.childNodes = [];
  51490. this.loading = false;
  51491. if (this.parent) {
  51492. this.level = this.parent.level + 1;
  51493. }
  51494. }
  51495. initialize() {
  51496. const store = this.store;
  51497. if (!store) {
  51498. throw new Error("[Node]store is required!");
  51499. }
  51500. store.registerNode(this);
  51501. const props = store.props;
  51502. if (props && typeof props.isLeaf !== "undefined") {
  51503. const isLeaf = getPropertyFromData(this, "isLeaf");
  51504. if (isBoolean(isLeaf)) {
  51505. this.isLeafByUser = isLeaf;
  51506. }
  51507. }
  51508. if (store.lazy !== true && this.data) {
  51509. this.setData(this.data);
  51510. if (store.defaultExpandAll) {
  51511. this.expanded = true;
  51512. this.canFocus = true;
  51513. }
  51514. } else if (this.level > 0 && store.lazy && store.defaultExpandAll && !this.isLeafByUser) {
  51515. this.expand();
  51516. }
  51517. if (!isArray$1(this.data)) {
  51518. markNodeData(this, this.data);
  51519. }
  51520. if (!this.data)
  51521. return;
  51522. const defaultExpandedKeys = store.defaultExpandedKeys;
  51523. const key = store.key;
  51524. if (key && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) {
  51525. this.expand(null, store.autoExpandParent);
  51526. }
  51527. if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
  51528. store.currentNode = this;
  51529. store.currentNode.isCurrent = true;
  51530. }
  51531. if (store.lazy) {
  51532. store._initDefaultCheckedNode(this);
  51533. }
  51534. this.updateLeafState();
  51535. if (this.parent && (this.level === 1 || this.parent.expanded === true))
  51536. this.canFocus = true;
  51537. }
  51538. setData(data) {
  51539. if (!isArray$1(data)) {
  51540. markNodeData(this, data);
  51541. }
  51542. this.data = data;
  51543. this.childNodes = [];
  51544. let children;
  51545. if (this.level === 0 && isArray$1(this.data)) {
  51546. children = this.data;
  51547. } else {
  51548. children = getPropertyFromData(this, "children") || [];
  51549. }
  51550. for (let i = 0, j = children.length; i < j; i++) {
  51551. this.insertChild({ data: children[i] });
  51552. }
  51553. }
  51554. get label() {
  51555. return getPropertyFromData(this, "label");
  51556. }
  51557. get key() {
  51558. const nodeKey = this.store.key;
  51559. if (this.data)
  51560. return this.data[nodeKey];
  51561. return null;
  51562. }
  51563. get disabled() {
  51564. return getPropertyFromData(this, "disabled");
  51565. }
  51566. get nextSibling() {
  51567. const parent = this.parent;
  51568. if (parent) {
  51569. const index = parent.childNodes.indexOf(this);
  51570. if (index > -1) {
  51571. return parent.childNodes[index + 1];
  51572. }
  51573. }
  51574. return null;
  51575. }
  51576. get previousSibling() {
  51577. const parent = this.parent;
  51578. if (parent) {
  51579. const index = parent.childNodes.indexOf(this);
  51580. if (index > -1) {
  51581. return index > 0 ? parent.childNodes[index - 1] : null;
  51582. }
  51583. }
  51584. return null;
  51585. }
  51586. contains(target, deep = true) {
  51587. return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
  51588. }
  51589. remove() {
  51590. const parent = this.parent;
  51591. if (parent) {
  51592. parent.removeChild(this);
  51593. }
  51594. }
  51595. insertChild(child, index, batch) {
  51596. if (!child)
  51597. throw new Error("InsertChild error: child is required.");
  51598. if (!(child instanceof Node)) {
  51599. if (!batch) {
  51600. const children = this.getChildren(true);
  51601. if (!children.includes(child.data)) {
  51602. if (isUndefined(index) || index < 0) {
  51603. children.push(child.data);
  51604. } else {
  51605. children.splice(index, 0, child.data);
  51606. }
  51607. }
  51608. }
  51609. Object.assign(child, {
  51610. parent: this,
  51611. store: this.store
  51612. });
  51613. child = reactive(new Node(child));
  51614. if (child instanceof Node) {
  51615. child.initialize();
  51616. }
  51617. }
  51618. child.level = this.level + 1;
  51619. if (isUndefined(index) || index < 0) {
  51620. this.childNodes.push(child);
  51621. } else {
  51622. this.childNodes.splice(index, 0, child);
  51623. }
  51624. this.updateLeafState();
  51625. }
  51626. insertBefore(child, ref) {
  51627. let index;
  51628. if (ref) {
  51629. index = this.childNodes.indexOf(ref);
  51630. }
  51631. this.insertChild(child, index);
  51632. }
  51633. insertAfter(child, ref) {
  51634. let index;
  51635. if (ref) {
  51636. index = this.childNodes.indexOf(ref);
  51637. if (index !== -1)
  51638. index += 1;
  51639. }
  51640. this.insertChild(child, index);
  51641. }
  51642. removeChild(child) {
  51643. const children = this.getChildren() || [];
  51644. const dataIndex = children.indexOf(child.data);
  51645. if (dataIndex > -1) {
  51646. children.splice(dataIndex, 1);
  51647. }
  51648. const index = this.childNodes.indexOf(child);
  51649. if (index > -1) {
  51650. this.store && this.store.deregisterNode(child);
  51651. child.parent = null;
  51652. this.childNodes.splice(index, 1);
  51653. }
  51654. this.updateLeafState();
  51655. }
  51656. removeChildByData(data) {
  51657. let targetNode = null;
  51658. for (let i = 0; i < this.childNodes.length; i++) {
  51659. if (this.childNodes[i].data === data) {
  51660. targetNode = this.childNodes[i];
  51661. break;
  51662. }
  51663. }
  51664. if (targetNode) {
  51665. this.removeChild(targetNode);
  51666. }
  51667. }
  51668. expand(callback, expandParent) {
  51669. const done = () => {
  51670. if (expandParent) {
  51671. let parent = this.parent;
  51672. while (parent.level > 0) {
  51673. parent.expanded = true;
  51674. parent = parent.parent;
  51675. }
  51676. }
  51677. this.expanded = true;
  51678. if (callback)
  51679. callback();
  51680. this.childNodes.forEach((item) => {
  51681. item.canFocus = true;
  51682. });
  51683. };
  51684. if (this.shouldLoadData()) {
  51685. this.loadData((data) => {
  51686. if (isArray$1(data)) {
  51687. if (this.checked) {
  51688. this.setChecked(true, true);
  51689. } else if (!this.store.checkStrictly) {
  51690. reInitChecked(this);
  51691. }
  51692. done();
  51693. }
  51694. });
  51695. } else {
  51696. done();
  51697. }
  51698. }
  51699. doCreateChildren(array, defaultProps = {}) {
  51700. array.forEach((item) => {
  51701. this.insertChild(Object.assign({ data: item }, defaultProps), void 0, true);
  51702. });
  51703. }
  51704. collapse() {
  51705. this.expanded = false;
  51706. this.childNodes.forEach((item) => {
  51707. item.canFocus = false;
  51708. });
  51709. }
  51710. shouldLoadData() {
  51711. return this.store.lazy === true && this.store.load && !this.loaded;
  51712. }
  51713. updateLeafState() {
  51714. if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
  51715. this.isLeaf = this.isLeafByUser;
  51716. return;
  51717. }
  51718. const childNodes = this.childNodes;
  51719. if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
  51720. this.isLeaf = !childNodes || childNodes.length === 0;
  51721. return;
  51722. }
  51723. this.isLeaf = false;
  51724. }
  51725. setChecked(value, deep, recursion, passValue) {
  51726. this.indeterminate = value === "half";
  51727. this.checked = value === true;
  51728. if (this.store.checkStrictly)
  51729. return;
  51730. if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
  51731. const { all, allWithoutDisable } = getChildState(this.childNodes);
  51732. if (!this.isLeaf && !all && allWithoutDisable) {
  51733. this.checked = false;
  51734. value = false;
  51735. }
  51736. const handleDescendants = () => {
  51737. if (deep) {
  51738. const childNodes = this.childNodes;
  51739. for (let i = 0, j = childNodes.length; i < j; i++) {
  51740. const child = childNodes[i];
  51741. passValue = passValue || value !== false;
  51742. const isCheck = child.disabled ? child.checked : passValue;
  51743. child.setChecked(isCheck, deep, true, passValue);
  51744. }
  51745. const { half, all: all2 } = getChildState(childNodes);
  51746. if (!all2) {
  51747. this.checked = all2;
  51748. this.indeterminate = half;
  51749. }
  51750. }
  51751. };
  51752. if (this.shouldLoadData()) {
  51753. this.loadData(() => {
  51754. handleDescendants();
  51755. reInitChecked(this);
  51756. }, {
  51757. checked: value !== false
  51758. });
  51759. return;
  51760. } else {
  51761. handleDescendants();
  51762. }
  51763. }
  51764. const parent = this.parent;
  51765. if (!parent || parent.level === 0)
  51766. return;
  51767. if (!recursion) {
  51768. reInitChecked(parent);
  51769. }
  51770. }
  51771. getChildren(forceInit = false) {
  51772. if (this.level === 0)
  51773. return this.data;
  51774. const data = this.data;
  51775. if (!data)
  51776. return null;
  51777. const props = this.store.props;
  51778. let children = "children";
  51779. if (props) {
  51780. children = props.children || "children";
  51781. }
  51782. if (data[children] === void 0) {
  51783. data[children] = null;
  51784. }
  51785. if (forceInit && !data[children]) {
  51786. data[children] = [];
  51787. }
  51788. return data[children];
  51789. }
  51790. updateChildren() {
  51791. const newData = this.getChildren() || [];
  51792. const oldData = this.childNodes.map((node) => node.data);
  51793. const newDataMap = {};
  51794. const newNodes = [];
  51795. newData.forEach((item, index) => {
  51796. const key = item[NODE_KEY];
  51797. const isNodeExists = !!key && oldData.findIndex((data) => data[NODE_KEY] === key) >= 0;
  51798. if (isNodeExists) {
  51799. newDataMap[key] = { index, data: item };
  51800. } else {
  51801. newNodes.push({ index, data: item });
  51802. }
  51803. });
  51804. if (!this.store.lazy) {
  51805. oldData.forEach((item) => {
  51806. if (!newDataMap[item[NODE_KEY]])
  51807. this.removeChildByData(item);
  51808. });
  51809. }
  51810. newNodes.forEach(({ index, data }) => {
  51811. this.insertChild({ data }, index);
  51812. });
  51813. this.updateLeafState();
  51814. }
  51815. loadData(callback, defaultProps = {}) {
  51816. if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
  51817. this.loading = true;
  51818. const resolve = (children) => {
  51819. this.childNodes = [];
  51820. this.doCreateChildren(children, defaultProps);
  51821. this.loaded = true;
  51822. this.loading = false;
  51823. this.updateLeafState();
  51824. if (callback) {
  51825. callback.call(this, children);
  51826. }
  51827. };
  51828. const reject = () => {
  51829. this.loading = false;
  51830. };
  51831. this.store.load(this, resolve, reject);
  51832. } else {
  51833. if (callback) {
  51834. callback.call(this);
  51835. }
  51836. }
  51837. }
  51838. eachNode(callback) {
  51839. const arr = [this];
  51840. while (arr.length) {
  51841. const node = arr.shift();
  51842. arr.unshift(...node.childNodes);
  51843. callback(node);
  51844. }
  51845. }
  51846. reInitChecked() {
  51847. if (this.store.checkStrictly)
  51848. return;
  51849. reInitChecked(this);
  51850. }
  51851. }
  51852. var Node$1 = Node;
  51853. class TreeStore {
  51854. constructor(options) {
  51855. this.currentNode = null;
  51856. this.currentNodeKey = null;
  51857. for (const option in options) {
  51858. if (hasOwn(options, option)) {
  51859. this[option] = options[option];
  51860. }
  51861. }
  51862. this.nodesMap = {};
  51863. }
  51864. initialize() {
  51865. this.root = new Node$1({
  51866. data: this.data,
  51867. store: this
  51868. });
  51869. this.root.initialize();
  51870. if (this.lazy && this.load) {
  51871. const loadFn = this.load;
  51872. loadFn(this.root, (data) => {
  51873. this.root.doCreateChildren(data);
  51874. this._initDefaultCheckedNodes();
  51875. });
  51876. } else {
  51877. this._initDefaultCheckedNodes();
  51878. }
  51879. }
  51880. filter(value) {
  51881. const filterNodeMethod = this.filterNodeMethod;
  51882. const lazy = this.lazy;
  51883. const traverse = function(node) {
  51884. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  51885. childNodes.forEach((child) => {
  51886. child.visible = filterNodeMethod.call(child, value, child.data, child);
  51887. traverse(child);
  51888. });
  51889. if (!node.visible && childNodes.length) {
  51890. let allHidden = true;
  51891. allHidden = !childNodes.some((child) => child.visible);
  51892. if (node.root) {
  51893. node.root.visible = allHidden === false;
  51894. } else {
  51895. node.visible = allHidden === false;
  51896. }
  51897. }
  51898. if (!value)
  51899. return;
  51900. if (node.visible && !node.isLeaf) {
  51901. if (!lazy || node.loaded) {
  51902. node.expand();
  51903. }
  51904. }
  51905. };
  51906. traverse(this);
  51907. }
  51908. setData(newVal) {
  51909. const instanceChanged = newVal !== this.root.data;
  51910. if (instanceChanged) {
  51911. this.nodesMap = {};
  51912. this.root.setData(newVal);
  51913. this._initDefaultCheckedNodes();
  51914. this.setCurrentNodeKey(this.currentNodeKey);
  51915. } else {
  51916. this.root.updateChildren();
  51917. }
  51918. }
  51919. getNode(data) {
  51920. if (data instanceof Node$1)
  51921. return data;
  51922. const key = isObject$1(data) ? getNodeKey(this.key, data) : data;
  51923. return this.nodesMap[key] || null;
  51924. }
  51925. insertBefore(data, refData) {
  51926. const refNode = this.getNode(refData);
  51927. refNode.parent.insertBefore({ data }, refNode);
  51928. }
  51929. insertAfter(data, refData) {
  51930. const refNode = this.getNode(refData);
  51931. refNode.parent.insertAfter({ data }, refNode);
  51932. }
  51933. remove(data) {
  51934. const node = this.getNode(data);
  51935. if (node && node.parent) {
  51936. if (node === this.currentNode) {
  51937. this.currentNode = null;
  51938. }
  51939. node.parent.removeChild(node);
  51940. }
  51941. }
  51942. append(data, parentData) {
  51943. const parentNode = !isPropAbsent(parentData) ? this.getNode(parentData) : this.root;
  51944. if (parentNode) {
  51945. parentNode.insertChild({ data });
  51946. }
  51947. }
  51948. _initDefaultCheckedNodes() {
  51949. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  51950. const nodesMap = this.nodesMap;
  51951. defaultCheckedKeys.forEach((checkedKey) => {
  51952. const node = nodesMap[checkedKey];
  51953. if (node) {
  51954. node.setChecked(true, !this.checkStrictly);
  51955. }
  51956. });
  51957. }
  51958. _initDefaultCheckedNode(node) {
  51959. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  51960. if (defaultCheckedKeys.includes(node.key)) {
  51961. node.setChecked(true, !this.checkStrictly);
  51962. }
  51963. }
  51964. setDefaultCheckedKey(newVal) {
  51965. if (newVal !== this.defaultCheckedKeys) {
  51966. this.defaultCheckedKeys = newVal;
  51967. this._initDefaultCheckedNodes();
  51968. }
  51969. }
  51970. registerNode(node) {
  51971. const key = this.key;
  51972. if (!node || !node.data)
  51973. return;
  51974. if (!key) {
  51975. this.nodesMap[node.id] = node;
  51976. } else {
  51977. const nodeKey = node.key;
  51978. if (nodeKey !== void 0)
  51979. this.nodesMap[node.key] = node;
  51980. }
  51981. }
  51982. deregisterNode(node) {
  51983. const key = this.key;
  51984. if (!key || !node || !node.data)
  51985. return;
  51986. node.childNodes.forEach((child) => {
  51987. this.deregisterNode(child);
  51988. });
  51989. delete this.nodesMap[node.key];
  51990. }
  51991. getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
  51992. const checkedNodes = [];
  51993. const traverse = function(node) {
  51994. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  51995. childNodes.forEach((child) => {
  51996. if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
  51997. checkedNodes.push(child.data);
  51998. }
  51999. traverse(child);
  52000. });
  52001. };
  52002. traverse(this);
  52003. return checkedNodes;
  52004. }
  52005. getCheckedKeys(leafOnly = false) {
  52006. return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
  52007. }
  52008. getHalfCheckedNodes() {
  52009. const nodes = [];
  52010. const traverse = function(node) {
  52011. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  52012. childNodes.forEach((child) => {
  52013. if (child.indeterminate) {
  52014. nodes.push(child.data);
  52015. }
  52016. traverse(child);
  52017. });
  52018. };
  52019. traverse(this);
  52020. return nodes;
  52021. }
  52022. getHalfCheckedKeys() {
  52023. return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
  52024. }
  52025. _getAllNodes() {
  52026. const allNodes = [];
  52027. const nodesMap = this.nodesMap;
  52028. for (const nodeKey in nodesMap) {
  52029. if (hasOwn(nodesMap, nodeKey)) {
  52030. allNodes.push(nodesMap[nodeKey]);
  52031. }
  52032. }
  52033. return allNodes;
  52034. }
  52035. updateChildren(key, data) {
  52036. const node = this.nodesMap[key];
  52037. if (!node)
  52038. return;
  52039. const childNodes = node.childNodes;
  52040. for (let i = childNodes.length - 1; i >= 0; i--) {
  52041. const child = childNodes[i];
  52042. this.remove(child.data);
  52043. }
  52044. for (let i = 0, j = data.length; i < j; i++) {
  52045. const child = data[i];
  52046. this.append(child, node.data);
  52047. }
  52048. }
  52049. _setCheckedKeys(key, leafOnly = false, checkedKeys) {
  52050. const allNodes = this._getAllNodes().sort((a, b) => a.level - b.level);
  52051. const cache = /* @__PURE__ */ Object.create(null);
  52052. const keys = Object.keys(checkedKeys);
  52053. allNodes.forEach((node) => node.setChecked(false, false));
  52054. const cacheCheckedChild = (node) => {
  52055. node.childNodes.forEach((child) => {
  52056. var _a;
  52057. cache[child.data[key]] = true;
  52058. if ((_a = child.childNodes) == null ? void 0 : _a.length) {
  52059. cacheCheckedChild(child);
  52060. }
  52061. });
  52062. };
  52063. for (let i = 0, j = allNodes.length; i < j; i++) {
  52064. const node = allNodes[i];
  52065. const nodeKey = node.data[key].toString();
  52066. const checked = keys.includes(nodeKey);
  52067. if (!checked) {
  52068. if (node.checked && !cache[nodeKey]) {
  52069. node.setChecked(false, false);
  52070. }
  52071. continue;
  52072. }
  52073. if (node.childNodes.length) {
  52074. cacheCheckedChild(node);
  52075. }
  52076. if (node.isLeaf || this.checkStrictly) {
  52077. node.setChecked(true, false);
  52078. continue;
  52079. }
  52080. node.setChecked(true, true);
  52081. if (leafOnly) {
  52082. node.setChecked(false, false);
  52083. const traverse = function(node2) {
  52084. const childNodes = node2.childNodes;
  52085. childNodes.forEach((child) => {
  52086. if (!child.isLeaf) {
  52087. child.setChecked(false, false);
  52088. }
  52089. traverse(child);
  52090. });
  52091. };
  52092. traverse(node);
  52093. }
  52094. }
  52095. }
  52096. setCheckedNodes(array, leafOnly = false) {
  52097. const key = this.key;
  52098. const checkedKeys = {};
  52099. array.forEach((item) => {
  52100. checkedKeys[(item || {})[key]] = true;
  52101. });
  52102. this._setCheckedKeys(key, leafOnly, checkedKeys);
  52103. }
  52104. setCheckedKeys(keys, leafOnly = false) {
  52105. this.defaultCheckedKeys = keys;
  52106. const key = this.key;
  52107. const checkedKeys = {};
  52108. keys.forEach((key2) => {
  52109. checkedKeys[key2] = true;
  52110. });
  52111. this._setCheckedKeys(key, leafOnly, checkedKeys);
  52112. }
  52113. setDefaultExpandedKeys(keys) {
  52114. keys = keys || [];
  52115. this.defaultExpandedKeys = keys;
  52116. keys.forEach((key) => {
  52117. const node = this.getNode(key);
  52118. if (node)
  52119. node.expand(null, this.autoExpandParent);
  52120. });
  52121. }
  52122. setChecked(data, checked, deep) {
  52123. const node = this.getNode(data);
  52124. if (node) {
  52125. node.setChecked(!!checked, deep);
  52126. }
  52127. }
  52128. getCurrentNode() {
  52129. return this.currentNode;
  52130. }
  52131. setCurrentNode(currentNode) {
  52132. const prevCurrentNode = this.currentNode;
  52133. if (prevCurrentNode) {
  52134. prevCurrentNode.isCurrent = false;
  52135. }
  52136. this.currentNode = currentNode;
  52137. this.currentNode.isCurrent = true;
  52138. }
  52139. setUserCurrentNode(node, shouldAutoExpandParent = true) {
  52140. const key = node[this.key];
  52141. const currNode = this.nodesMap[key];
  52142. this.setCurrentNode(currNode);
  52143. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  52144. this.currentNode.parent.expand(null, true);
  52145. }
  52146. }
  52147. setCurrentNodeKey(key, shouldAutoExpandParent = true) {
  52148. this.currentNodeKey = key;
  52149. if (key === null || key === void 0) {
  52150. this.currentNode && (this.currentNode.isCurrent = false);
  52151. this.currentNode = null;
  52152. return;
  52153. }
  52154. const node = this.getNode(key);
  52155. if (node) {
  52156. this.setCurrentNode(node);
  52157. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  52158. this.currentNode.parent.expand(null, true);
  52159. }
  52160. }
  52161. }
  52162. }
  52163. const _sfc_main$m = defineComponent({
  52164. name: "ElTreeNodeContent",
  52165. props: {
  52166. node: {
  52167. type: Object,
  52168. required: true
  52169. },
  52170. renderContent: Function
  52171. },
  52172. setup(props) {
  52173. const ns = useNamespace("tree");
  52174. const nodeInstance = inject("NodeInstance");
  52175. const tree = inject("RootTree");
  52176. return () => {
  52177. const node = props.node;
  52178. const { data, store } = node;
  52179. return props.renderContent ? props.renderContent(h$1, { _self: nodeInstance, node, data, store }) : renderSlot(tree.ctx.slots, "default", { node, data }, () => [
  52180. h$1("span", { class: ns.be("node", "label") }, [node.label])
  52181. ]);
  52182. };
  52183. }
  52184. });
  52185. var NodeContent = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "tree-node-content.vue"]]);
  52186. function useNodeExpandEventBroadcast(props) {
  52187. const parentNodeMap = inject("TreeNodeMap", null);
  52188. const currentNodeMap = {
  52189. treeNodeExpand: (node) => {
  52190. if (props.node !== node) {
  52191. props.node.collapse();
  52192. }
  52193. },
  52194. children: []
  52195. };
  52196. if (parentNodeMap) {
  52197. parentNodeMap.children.push(currentNodeMap);
  52198. }
  52199. provide("TreeNodeMap", currentNodeMap);
  52200. return {
  52201. broadcastExpanded: (node) => {
  52202. if (!props.accordion)
  52203. return;
  52204. for (const childNode of currentNodeMap.children) {
  52205. childNode.treeNodeExpand(node);
  52206. }
  52207. }
  52208. };
  52209. }
  52210. const dragEventsKey = Symbol("dragEvents");
  52211. function useDragNodeHandler({ props, ctx, el$, dropIndicator$, store }) {
  52212. const ns = useNamespace("tree");
  52213. const dragState = ref({
  52214. showDropIndicator: false,
  52215. draggingNode: null,
  52216. dropNode: null,
  52217. allowDrop: true,
  52218. dropType: null
  52219. });
  52220. const treeNodeDragStart = ({ event, treeNode }) => {
  52221. if (isFunction$1(props.allowDrag) && !props.allowDrag(treeNode.node)) {
  52222. event.preventDefault();
  52223. return false;
  52224. }
  52225. event.dataTransfer.effectAllowed = "move";
  52226. try {
  52227. event.dataTransfer.setData("text/plain", "");
  52228. } catch (e) {
  52229. }
  52230. dragState.value.draggingNode = treeNode;
  52231. ctx.emit("node-drag-start", treeNode.node, event);
  52232. };
  52233. const treeNodeDragOver = ({ event, treeNode }) => {
  52234. const dropNode = treeNode;
  52235. const oldDropNode = dragState.value.dropNode;
  52236. if (oldDropNode && oldDropNode.node.id !== dropNode.node.id) {
  52237. removeClass(oldDropNode.$el, ns.is("drop-inner"));
  52238. }
  52239. const draggingNode = dragState.value.draggingNode;
  52240. if (!draggingNode || !dropNode)
  52241. return;
  52242. let dropPrev = true;
  52243. let dropInner = true;
  52244. let dropNext = true;
  52245. let userAllowDropInner = true;
  52246. if (isFunction$1(props.allowDrop)) {
  52247. dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
  52248. userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
  52249. dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
  52250. }
  52251. event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
  52252. if ((dropPrev || dropInner || dropNext) && (oldDropNode == null ? void 0 : oldDropNode.node.id) !== dropNode.node.id) {
  52253. if (oldDropNode) {
  52254. ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
  52255. }
  52256. ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
  52257. }
  52258. if (dropPrev || dropInner || dropNext) {
  52259. dragState.value.dropNode = dropNode;
  52260. } else {
  52261. dragState.value.dropNode = null;
  52262. }
  52263. if (dropNode.node.nextSibling === draggingNode.node) {
  52264. dropNext = false;
  52265. }
  52266. if (dropNode.node.previousSibling === draggingNode.node) {
  52267. dropPrev = false;
  52268. }
  52269. if (dropNode.node.contains(draggingNode.node, false)) {
  52270. dropInner = false;
  52271. }
  52272. if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
  52273. dropPrev = false;
  52274. dropInner = false;
  52275. dropNext = false;
  52276. }
  52277. const targetPosition = dropNode.$el.querySelector(`.${ns.be("node", "content")}`).getBoundingClientRect();
  52278. const treePosition = el$.value.getBoundingClientRect();
  52279. let dropType;
  52280. const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
  52281. const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
  52282. let indicatorTop = -9999;
  52283. const distance = event.clientY - targetPosition.top;
  52284. if (distance < targetPosition.height * prevPercent) {
  52285. dropType = "before";
  52286. } else if (distance > targetPosition.height * nextPercent) {
  52287. dropType = "after";
  52288. } else if (dropInner) {
  52289. dropType = "inner";
  52290. } else {
  52291. dropType = "none";
  52292. }
  52293. const iconPosition = dropNode.$el.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
  52294. const dropIndicator = dropIndicator$.value;
  52295. if (dropType === "before") {
  52296. indicatorTop = iconPosition.top - treePosition.top;
  52297. } else if (dropType === "after") {
  52298. indicatorTop = iconPosition.bottom - treePosition.top;
  52299. }
  52300. dropIndicator.style.top = `${indicatorTop}px`;
  52301. dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
  52302. if (dropType === "inner") {
  52303. addClass(dropNode.$el, ns.is("drop-inner"));
  52304. } else {
  52305. removeClass(dropNode.$el, ns.is("drop-inner"));
  52306. }
  52307. dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
  52308. dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
  52309. dragState.value.dropType = dropType;
  52310. ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
  52311. };
  52312. const treeNodeDragEnd = (event) => {
  52313. const { draggingNode, dropType, dropNode } = dragState.value;
  52314. event.preventDefault();
  52315. if (event.dataTransfer) {
  52316. event.dataTransfer.dropEffect = "move";
  52317. }
  52318. if (draggingNode && dropNode) {
  52319. const draggingNodeCopy = { data: draggingNode.node.data };
  52320. if (dropType !== "none") {
  52321. draggingNode.node.remove();
  52322. }
  52323. if (dropType === "before") {
  52324. dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node);
  52325. } else if (dropType === "after") {
  52326. dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node);
  52327. } else if (dropType === "inner") {
  52328. dropNode.node.insertChild(draggingNodeCopy);
  52329. }
  52330. if (dropType !== "none") {
  52331. store.value.registerNode(draggingNodeCopy);
  52332. if (store.value.key) {
  52333. draggingNode.node.eachNode((node) => {
  52334. var _a;
  52335. (_a = store.value.nodesMap[node.data[store.value.key]]) == null ? void 0 : _a.setChecked(node.checked, !store.value.checkStrictly);
  52336. });
  52337. }
  52338. }
  52339. removeClass(dropNode.$el, ns.is("drop-inner"));
  52340. ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
  52341. if (dropType !== "none") {
  52342. ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
  52343. }
  52344. }
  52345. if (draggingNode && !dropNode) {
  52346. ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
  52347. }
  52348. dragState.value.showDropIndicator = false;
  52349. dragState.value.draggingNode = null;
  52350. dragState.value.dropNode = null;
  52351. dragState.value.allowDrop = true;
  52352. };
  52353. provide(dragEventsKey, {
  52354. treeNodeDragStart,
  52355. treeNodeDragOver,
  52356. treeNodeDragEnd
  52357. });
  52358. return {
  52359. dragState
  52360. };
  52361. }
  52362. const _sfc_main$l = defineComponent({
  52363. name: "ElTreeNode",
  52364. components: {
  52365. ElCollapseTransition,
  52366. ElCheckbox,
  52367. NodeContent,
  52368. ElIcon,
  52369. Loading: loading_default
  52370. },
  52371. props: {
  52372. node: {
  52373. type: Node$1,
  52374. default: () => ({})
  52375. },
  52376. props: {
  52377. type: Object,
  52378. default: () => ({})
  52379. },
  52380. accordion: Boolean,
  52381. renderContent: Function,
  52382. renderAfterExpand: Boolean,
  52383. showCheckbox: {
  52384. type: Boolean,
  52385. default: false
  52386. }
  52387. },
  52388. emits: ["node-expand"],
  52389. setup(props, ctx) {
  52390. const ns = useNamespace("tree");
  52391. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  52392. const tree = inject("RootTree");
  52393. const expanded = ref(false);
  52394. const childNodeRendered = ref(false);
  52395. const oldChecked = ref(null);
  52396. const oldIndeterminate = ref(null);
  52397. const node$ = ref(null);
  52398. const dragEvents = inject(dragEventsKey);
  52399. const instance = getCurrentInstance();
  52400. provide("NodeInstance", instance);
  52401. if (props.node.expanded) {
  52402. expanded.value = true;
  52403. childNodeRendered.value = true;
  52404. }
  52405. const childrenKey = tree.props.props["children"] || "children";
  52406. watch(() => {
  52407. const children = props.node.data[childrenKey];
  52408. return children && [...children];
  52409. }, () => {
  52410. props.node.updateChildren();
  52411. });
  52412. watch(() => props.node.indeterminate, (val) => {
  52413. handleSelectChange(props.node.checked, val);
  52414. });
  52415. watch(() => props.node.checked, (val) => {
  52416. handleSelectChange(val, props.node.indeterminate);
  52417. });
  52418. watch(() => props.node.childNodes.length, () => props.node.reInitChecked());
  52419. watch(() => props.node.expanded, (val) => {
  52420. nextTick(() => expanded.value = val);
  52421. if (val) {
  52422. childNodeRendered.value = true;
  52423. }
  52424. });
  52425. const getNodeKey$1 = (node) => {
  52426. return getNodeKey(tree.props.nodeKey, node.data);
  52427. };
  52428. const getNodeClass = (node) => {
  52429. const nodeClassFunc = props.props.class;
  52430. if (!nodeClassFunc) {
  52431. return {};
  52432. }
  52433. let className;
  52434. if (isFunction$1(nodeClassFunc)) {
  52435. const { data } = node;
  52436. className = nodeClassFunc(data, node);
  52437. } else {
  52438. className = nodeClassFunc;
  52439. }
  52440. if (isString$1(className)) {
  52441. return { [className]: true };
  52442. } else {
  52443. return className;
  52444. }
  52445. };
  52446. const handleSelectChange = (checked, indeterminate) => {
  52447. if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) {
  52448. tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
  52449. }
  52450. oldChecked.value = checked;
  52451. oldIndeterminate.value = indeterminate;
  52452. };
  52453. const handleClick = (e) => {
  52454. handleCurrentChange(tree.store, tree.ctx.emit, () => {
  52455. var _a;
  52456. const nodeKeyProp = (_a = tree == null ? void 0 : tree.props) == null ? void 0 : _a.nodeKey;
  52457. if (nodeKeyProp) {
  52458. const curNodeKey = getNodeKey$1(props.node);
  52459. tree.store.value.setCurrentNodeKey(curNodeKey);
  52460. } else {
  52461. tree.store.value.setCurrentNode(props.node);
  52462. }
  52463. });
  52464. tree.currentNode.value = props.node;
  52465. if (tree.props.expandOnClickNode) {
  52466. handleExpandIconClick();
  52467. }
  52468. if (tree.props.checkOnClickNode && !props.node.disabled) {
  52469. handleCheckChange(null, {
  52470. target: { checked: !props.node.checked }
  52471. });
  52472. }
  52473. tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
  52474. };
  52475. const handleContextMenu = (event) => {
  52476. if (tree.instance.vnode.props["onNodeContextmenu"]) {
  52477. event.stopPropagation();
  52478. event.preventDefault();
  52479. }
  52480. tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
  52481. };
  52482. const handleExpandIconClick = () => {
  52483. if (props.node.isLeaf)
  52484. return;
  52485. if (expanded.value) {
  52486. tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
  52487. props.node.collapse();
  52488. } else {
  52489. props.node.expand(() => {
  52490. ctx.emit("node-expand", props.node.data, props.node, instance);
  52491. });
  52492. }
  52493. };
  52494. const handleCheckChange = (value, ev) => {
  52495. props.node.setChecked(ev.target.checked, !tree.props.checkStrictly);
  52496. nextTick(() => {
  52497. const store = tree.store.value;
  52498. tree.ctx.emit("check", props.node.data, {
  52499. checkedNodes: store.getCheckedNodes(),
  52500. checkedKeys: store.getCheckedKeys(),
  52501. halfCheckedNodes: store.getHalfCheckedNodes(),
  52502. halfCheckedKeys: store.getHalfCheckedKeys()
  52503. });
  52504. });
  52505. };
  52506. const handleChildNodeExpand = (nodeData, node, instance2) => {
  52507. broadcastExpanded(node);
  52508. tree.ctx.emit("node-expand", nodeData, node, instance2);
  52509. };
  52510. const handleDragStart = (event) => {
  52511. if (!tree.props.draggable)
  52512. return;
  52513. dragEvents.treeNodeDragStart({ event, treeNode: props });
  52514. };
  52515. const handleDragOver = (event) => {
  52516. event.preventDefault();
  52517. if (!tree.props.draggable)
  52518. return;
  52519. dragEvents.treeNodeDragOver({
  52520. event,
  52521. treeNode: { $el: node$.value, node: props.node }
  52522. });
  52523. };
  52524. const handleDrop = (event) => {
  52525. event.preventDefault();
  52526. };
  52527. const handleDragEnd = (event) => {
  52528. if (!tree.props.draggable)
  52529. return;
  52530. dragEvents.treeNodeDragEnd(event);
  52531. };
  52532. return {
  52533. ns,
  52534. node$,
  52535. tree,
  52536. expanded,
  52537. childNodeRendered,
  52538. oldChecked,
  52539. oldIndeterminate,
  52540. getNodeKey: getNodeKey$1,
  52541. getNodeClass,
  52542. handleSelectChange,
  52543. handleClick,
  52544. handleContextMenu,
  52545. handleExpandIconClick,
  52546. handleCheckChange,
  52547. handleChildNodeExpand,
  52548. handleDragStart,
  52549. handleDragOver,
  52550. handleDrop,
  52551. handleDragEnd,
  52552. CaretRight: caret_right_default
  52553. };
  52554. }
  52555. });
  52556. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  52557. const _component_el_icon = resolveComponent("el-icon");
  52558. const _component_el_checkbox = resolveComponent("el-checkbox");
  52559. const _component_loading = resolveComponent("loading");
  52560. const _component_node_content = resolveComponent("node-content");
  52561. const _component_el_tree_node = resolveComponent("el-tree-node");
  52562. const _component_el_collapse_transition = resolveComponent("el-collapse-transition");
  52563. return withDirectives((openBlock(), createElementBlock("div", {
  52564. ref: "node$",
  52565. class: normalizeClass([
  52566. _ctx.ns.b("node"),
  52567. _ctx.ns.is("expanded", _ctx.expanded),
  52568. _ctx.ns.is("current", _ctx.node.isCurrent),
  52569. _ctx.ns.is("hidden", !_ctx.node.visible),
  52570. _ctx.ns.is("focusable", !_ctx.node.disabled),
  52571. _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
  52572. _ctx.getNodeClass(_ctx.node)
  52573. ]),
  52574. role: "treeitem",
  52575. tabindex: "-1",
  52576. "aria-expanded": _ctx.expanded,
  52577. "aria-disabled": _ctx.node.disabled,
  52578. "aria-checked": _ctx.node.checked,
  52579. draggable: _ctx.tree.props.draggable,
  52580. "data-key": _ctx.getNodeKey(_ctx.node),
  52581. onClick: withModifiers(_ctx.handleClick, ["stop"]),
  52582. onContextmenu: _ctx.handleContextMenu,
  52583. onDragstart: withModifiers(_ctx.handleDragStart, ["stop"]),
  52584. onDragover: withModifiers(_ctx.handleDragOver, ["stop"]),
  52585. onDragend: withModifiers(_ctx.handleDragEnd, ["stop"]),
  52586. onDrop: withModifiers(_ctx.handleDrop, ["stop"])
  52587. }, [
  52588. createElementVNode("div", {
  52589. class: normalizeClass(_ctx.ns.be("node", "content")),
  52590. style: normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
  52591. }, [
  52592. _ctx.tree.props.icon || _ctx.CaretRight ? (openBlock(), createBlock(_component_el_icon, {
  52593. key: 0,
  52594. class: normalizeClass([
  52595. _ctx.ns.be("node", "expand-icon"),
  52596. _ctx.ns.is("leaf", _ctx.node.isLeaf),
  52597. {
  52598. expanded: !_ctx.node.isLeaf && _ctx.expanded
  52599. }
  52600. ]),
  52601. onClick: withModifiers(_ctx.handleExpandIconClick, ["stop"])
  52602. }, {
  52603. default: withCtx(() => [
  52604. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))
  52605. ]),
  52606. _: 1
  52607. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  52608. _ctx.showCheckbox ? (openBlock(), createBlock(_component_el_checkbox, {
  52609. key: 1,
  52610. "model-value": _ctx.node.checked,
  52611. indeterminate: _ctx.node.indeterminate,
  52612. disabled: !!_ctx.node.disabled,
  52613. onClick: withModifiers(() => {
  52614. }, ["stop"]),
  52615. onChange: _ctx.handleCheckChange
  52616. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick", "onChange"])) : createCommentVNode("v-if", true),
  52617. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  52618. key: 2,
  52619. class: normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
  52620. }, {
  52621. default: withCtx(() => [
  52622. createVNode(_component_loading)
  52623. ]),
  52624. _: 1
  52625. }, 8, ["class"])) : createCommentVNode("v-if", true),
  52626. createVNode(_component_node_content, {
  52627. node: _ctx.node,
  52628. "render-content": _ctx.renderContent
  52629. }, null, 8, ["node", "render-content"])
  52630. ], 6),
  52631. createVNode(_component_el_collapse_transition, null, {
  52632. default: withCtx(() => [
  52633. !_ctx.renderAfterExpand || _ctx.childNodeRendered ? withDirectives((openBlock(), createElementBlock("div", {
  52634. key: 0,
  52635. class: normalizeClass(_ctx.ns.be("node", "children")),
  52636. role: "group",
  52637. "aria-expanded": _ctx.expanded
  52638. }, [
  52639. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.node.childNodes, (child) => {
  52640. return openBlock(), createBlock(_component_el_tree_node, {
  52641. key: _ctx.getNodeKey(child),
  52642. "render-content": _ctx.renderContent,
  52643. "render-after-expand": _ctx.renderAfterExpand,
  52644. "show-checkbox": _ctx.showCheckbox,
  52645. node: child,
  52646. accordion: _ctx.accordion,
  52647. props: _ctx.props,
  52648. onNodeExpand: _ctx.handleChildNodeExpand
  52649. }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]);
  52650. }), 128))
  52651. ], 10, ["aria-expanded"])), [
  52652. [vShow, _ctx.expanded]
  52653. ]) : createCommentVNode("v-if", true)
  52654. ]),
  52655. _: 1
  52656. })
  52657. ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key", "onClick", "onContextmenu", "onDragstart", "onDragover", "onDragend", "onDrop"])), [
  52658. [vShow, _ctx.node.visible]
  52659. ]);
  52660. }
  52661. var ElTreeNode$1 = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$2], ["__file", "tree-node.vue"]]);
  52662. function useKeydown({ el$ }, store) {
  52663. const ns = useNamespace("tree");
  52664. const treeItems = shallowRef([]);
  52665. const checkboxItems = shallowRef([]);
  52666. onMounted(() => {
  52667. initTabIndex();
  52668. });
  52669. onUpdated(() => {
  52670. treeItems.value = Array.from(el$.value.querySelectorAll("[role=treeitem]"));
  52671. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  52672. });
  52673. watch(checkboxItems, (val) => {
  52674. val.forEach((checkbox) => {
  52675. checkbox.setAttribute("tabindex", "-1");
  52676. });
  52677. });
  52678. const handleKeydown = (ev) => {
  52679. const currentItem = ev.target;
  52680. if (!currentItem.className.includes(ns.b("node")))
  52681. return;
  52682. const code = ev.code;
  52683. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  52684. const currentIndex = treeItems.value.indexOf(currentItem);
  52685. let nextIndex;
  52686. if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
  52687. ev.preventDefault();
  52688. if (code === EVENT_CODE.up) {
  52689. nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.value.length - 1;
  52690. const startIndex = nextIndex;
  52691. while (true) {
  52692. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  52693. break;
  52694. nextIndex--;
  52695. if (nextIndex === startIndex) {
  52696. nextIndex = -1;
  52697. break;
  52698. }
  52699. if (nextIndex < 0) {
  52700. nextIndex = treeItems.value.length - 1;
  52701. }
  52702. }
  52703. } else {
  52704. nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.value.length - 1 ? currentIndex + 1 : 0;
  52705. const startIndex = nextIndex;
  52706. while (true) {
  52707. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  52708. break;
  52709. nextIndex++;
  52710. if (nextIndex === startIndex) {
  52711. nextIndex = -1;
  52712. break;
  52713. }
  52714. if (nextIndex >= treeItems.value.length) {
  52715. nextIndex = 0;
  52716. }
  52717. }
  52718. }
  52719. nextIndex !== -1 && treeItems.value[nextIndex].focus();
  52720. }
  52721. if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
  52722. ev.preventDefault();
  52723. currentItem.click();
  52724. }
  52725. const hasInput = currentItem.querySelector('[type="checkbox"]');
  52726. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter, EVENT_CODE.space].includes(code) && hasInput) {
  52727. ev.preventDefault();
  52728. hasInput.click();
  52729. }
  52730. };
  52731. useEventListener(el$, "keydown", handleKeydown);
  52732. const initTabIndex = () => {
  52733. var _a;
  52734. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  52735. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  52736. const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
  52737. if (checkedItem.length) {
  52738. checkedItem[0].setAttribute("tabindex", "0");
  52739. return;
  52740. }
  52741. (_a = treeItems.value[0]) == null ? void 0 : _a.setAttribute("tabindex", "0");
  52742. };
  52743. }
  52744. const _sfc_main$k = defineComponent({
  52745. name: "ElTree",
  52746. components: { ElTreeNode: ElTreeNode$1 },
  52747. props: {
  52748. data: {
  52749. type: Array,
  52750. default: () => []
  52751. },
  52752. emptyText: {
  52753. type: String
  52754. },
  52755. renderAfterExpand: {
  52756. type: Boolean,
  52757. default: true
  52758. },
  52759. nodeKey: String,
  52760. checkStrictly: Boolean,
  52761. defaultExpandAll: Boolean,
  52762. expandOnClickNode: {
  52763. type: Boolean,
  52764. default: true
  52765. },
  52766. checkOnClickNode: Boolean,
  52767. checkDescendants: {
  52768. type: Boolean,
  52769. default: false
  52770. },
  52771. autoExpandParent: {
  52772. type: Boolean,
  52773. default: true
  52774. },
  52775. defaultCheckedKeys: Array,
  52776. defaultExpandedKeys: Array,
  52777. currentNodeKey: [String, Number],
  52778. renderContent: Function,
  52779. showCheckbox: {
  52780. type: Boolean,
  52781. default: false
  52782. },
  52783. draggable: {
  52784. type: Boolean,
  52785. default: false
  52786. },
  52787. allowDrag: Function,
  52788. allowDrop: Function,
  52789. props: {
  52790. type: Object,
  52791. default: () => ({
  52792. children: "children",
  52793. label: "label",
  52794. disabled: "disabled"
  52795. })
  52796. },
  52797. lazy: {
  52798. type: Boolean,
  52799. default: false
  52800. },
  52801. highlightCurrent: Boolean,
  52802. load: Function,
  52803. filterNodeMethod: Function,
  52804. accordion: Boolean,
  52805. indent: {
  52806. type: Number,
  52807. default: 18
  52808. },
  52809. icon: {
  52810. type: iconPropType
  52811. }
  52812. },
  52813. emits: [
  52814. "check-change",
  52815. "current-change",
  52816. "node-click",
  52817. "node-contextmenu",
  52818. "node-collapse",
  52819. "node-expand",
  52820. "check",
  52821. "node-drag-start",
  52822. "node-drag-end",
  52823. "node-drop",
  52824. "node-drag-leave",
  52825. "node-drag-enter",
  52826. "node-drag-over"
  52827. ],
  52828. setup(props, ctx) {
  52829. const { t } = useLocale();
  52830. const ns = useNamespace("tree");
  52831. const selectInfo = inject(selectKey, null);
  52832. const store = ref(new TreeStore({
  52833. key: props.nodeKey,
  52834. data: props.data,
  52835. lazy: props.lazy,
  52836. props: props.props,
  52837. load: props.load,
  52838. currentNodeKey: props.currentNodeKey,
  52839. checkStrictly: props.checkStrictly,
  52840. checkDescendants: props.checkDescendants,
  52841. defaultCheckedKeys: props.defaultCheckedKeys,
  52842. defaultExpandedKeys: props.defaultExpandedKeys,
  52843. autoExpandParent: props.autoExpandParent,
  52844. defaultExpandAll: props.defaultExpandAll,
  52845. filterNodeMethod: props.filterNodeMethod
  52846. }));
  52847. store.value.initialize();
  52848. const root = ref(store.value.root);
  52849. const currentNode = ref(null);
  52850. const el$ = ref(null);
  52851. const dropIndicator$ = ref(null);
  52852. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  52853. const { dragState } = useDragNodeHandler({
  52854. props,
  52855. ctx,
  52856. el$,
  52857. dropIndicator$,
  52858. store
  52859. });
  52860. useKeydown({ el$ }, store);
  52861. const isEmpty = computed(() => {
  52862. const { childNodes } = root.value;
  52863. const hasFilteredOptions = selectInfo ? selectInfo.hasFilteredOptions !== 0 : false;
  52864. return (!childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible)) && !hasFilteredOptions;
  52865. });
  52866. watch(() => props.currentNodeKey, (newVal) => {
  52867. store.value.setCurrentNodeKey(newVal);
  52868. });
  52869. watch(() => props.defaultCheckedKeys, (newVal) => {
  52870. store.value.setDefaultCheckedKey(newVal);
  52871. });
  52872. watch(() => props.defaultExpandedKeys, (newVal) => {
  52873. store.value.setDefaultExpandedKeys(newVal);
  52874. });
  52875. watch(() => props.data, (newVal) => {
  52876. store.value.setData(newVal);
  52877. }, { deep: true });
  52878. watch(() => props.checkStrictly, (newVal) => {
  52879. store.value.checkStrictly = newVal;
  52880. });
  52881. const filter = (value) => {
  52882. if (!props.filterNodeMethod)
  52883. throw new Error("[Tree] filterNodeMethod is required when filter");
  52884. store.value.filter(value);
  52885. };
  52886. const getNodeKey$1 = (node) => {
  52887. return getNodeKey(props.nodeKey, node.data);
  52888. };
  52889. const getNodePath = (data) => {
  52890. if (!props.nodeKey)
  52891. throw new Error("[Tree] nodeKey is required in getNodePath");
  52892. const node = store.value.getNode(data);
  52893. if (!node)
  52894. return [];
  52895. const path = [node.data];
  52896. let parent = node.parent;
  52897. while (parent && parent !== root.value) {
  52898. path.push(parent.data);
  52899. parent = parent.parent;
  52900. }
  52901. return path.reverse();
  52902. };
  52903. const getCheckedNodes = (leafOnly, includeHalfChecked) => {
  52904. return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
  52905. };
  52906. const getCheckedKeys = (leafOnly) => {
  52907. return store.value.getCheckedKeys(leafOnly);
  52908. };
  52909. const getCurrentNode = () => {
  52910. const currentNode2 = store.value.getCurrentNode();
  52911. return currentNode2 ? currentNode2.data : null;
  52912. };
  52913. const getCurrentKey = () => {
  52914. if (!props.nodeKey)
  52915. throw new Error("[Tree] nodeKey is required in getCurrentKey");
  52916. const currentNode2 = getCurrentNode();
  52917. return currentNode2 ? currentNode2[props.nodeKey] : null;
  52918. };
  52919. const setCheckedNodes = (nodes, leafOnly) => {
  52920. if (!props.nodeKey)
  52921. throw new Error("[Tree] nodeKey is required in setCheckedNodes");
  52922. store.value.setCheckedNodes(nodes, leafOnly);
  52923. };
  52924. const setCheckedKeys = (keys, leafOnly) => {
  52925. if (!props.nodeKey)
  52926. throw new Error("[Tree] nodeKey is required in setCheckedKeys");
  52927. store.value.setCheckedKeys(keys, leafOnly);
  52928. };
  52929. const setChecked = (data, checked, deep) => {
  52930. store.value.setChecked(data, checked, deep);
  52931. };
  52932. const getHalfCheckedNodes = () => {
  52933. return store.value.getHalfCheckedNodes();
  52934. };
  52935. const getHalfCheckedKeys = () => {
  52936. return store.value.getHalfCheckedKeys();
  52937. };
  52938. const setCurrentNode = (node, shouldAutoExpandParent = true) => {
  52939. if (!props.nodeKey)
  52940. throw new Error("[Tree] nodeKey is required in setCurrentNode");
  52941. handleCurrentChange(store, ctx.emit, () => {
  52942. broadcastExpanded(node);
  52943. store.value.setUserCurrentNode(node, shouldAutoExpandParent);
  52944. });
  52945. };
  52946. const setCurrentKey = (key, shouldAutoExpandParent = true) => {
  52947. if (!props.nodeKey)
  52948. throw new Error("[Tree] nodeKey is required in setCurrentKey");
  52949. handleCurrentChange(store, ctx.emit, () => {
  52950. broadcastExpanded();
  52951. store.value.setCurrentNodeKey(key, shouldAutoExpandParent);
  52952. });
  52953. };
  52954. const getNode = (data) => {
  52955. return store.value.getNode(data);
  52956. };
  52957. const remove = (data) => {
  52958. store.value.remove(data);
  52959. };
  52960. const append = (data, parentNode) => {
  52961. store.value.append(data, parentNode);
  52962. };
  52963. const insertBefore = (data, refNode) => {
  52964. store.value.insertBefore(data, refNode);
  52965. };
  52966. const insertAfter = (data, refNode) => {
  52967. store.value.insertAfter(data, refNode);
  52968. };
  52969. const handleNodeExpand = (nodeData, node, instance) => {
  52970. broadcastExpanded(node);
  52971. ctx.emit("node-expand", nodeData, node, instance);
  52972. };
  52973. const updateKeyChildren = (key, data) => {
  52974. if (!props.nodeKey)
  52975. throw new Error("[Tree] nodeKey is required in updateKeyChild");
  52976. store.value.updateChildren(key, data);
  52977. };
  52978. provide("RootTree", {
  52979. ctx,
  52980. props,
  52981. store,
  52982. root,
  52983. currentNode,
  52984. instance: getCurrentInstance()
  52985. });
  52986. provide(formItemContextKey, void 0);
  52987. return {
  52988. ns,
  52989. store,
  52990. root,
  52991. currentNode,
  52992. dragState,
  52993. el$,
  52994. dropIndicator$,
  52995. isEmpty,
  52996. filter,
  52997. getNodeKey: getNodeKey$1,
  52998. getNodePath,
  52999. getCheckedNodes,
  53000. getCheckedKeys,
  53001. getCurrentNode,
  53002. getCurrentKey,
  53003. setCheckedNodes,
  53004. setCheckedKeys,
  53005. setChecked,
  53006. getHalfCheckedNodes,
  53007. getHalfCheckedKeys,
  53008. setCurrentNode,
  53009. setCurrentKey,
  53010. t,
  53011. getNode,
  53012. remove,
  53013. append,
  53014. insertBefore,
  53015. insertAfter,
  53016. handleNodeExpand,
  53017. updateKeyChildren
  53018. };
  53019. }
  53020. });
  53021. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  53022. const _component_el_tree_node = resolveComponent("el-tree-node");
  53023. return openBlock(), createElementBlock("div", {
  53024. ref: "el$",
  53025. class: normalizeClass([
  53026. _ctx.ns.b(),
  53027. _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
  53028. _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
  53029. _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
  53030. { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
  53031. ]),
  53032. role: "tree"
  53033. }, [
  53034. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.root.childNodes, (child) => {
  53035. return openBlock(), createBlock(_component_el_tree_node, {
  53036. key: _ctx.getNodeKey(child),
  53037. node: child,
  53038. props: _ctx.props,
  53039. accordion: _ctx.accordion,
  53040. "render-after-expand": _ctx.renderAfterExpand,
  53041. "show-checkbox": _ctx.showCheckbox,
  53042. "render-content": _ctx.renderContent,
  53043. onNodeExpand: _ctx.handleNodeExpand
  53044. }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]);
  53045. }), 128)),
  53046. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  53047. key: 0,
  53048. class: normalizeClass(_ctx.ns.e("empty-block"))
  53049. }, [
  53050. renderSlot(_ctx.$slots, "empty", {}, () => {
  53051. var _a;
  53052. return [
  53053. createElementVNode("span", {
  53054. class: normalizeClass(_ctx.ns.e("empty-text"))
  53055. }, toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t("el.tree.emptyText")), 3)
  53056. ];
  53057. })
  53058. ], 2)) : createCommentVNode("v-if", true),
  53059. withDirectives(createElementVNode("div", {
  53060. ref: "dropIndicator$",
  53061. class: normalizeClass(_ctx.ns.e("drop-indicator"))
  53062. }, null, 2), [
  53063. [vShow, _ctx.dragState.showDropIndicator]
  53064. ])
  53065. ], 2);
  53066. }
  53067. var Tree = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["render", _sfc_render$1], ["__file", "tree.vue"]]);
  53068. const ElTree = withInstall(Tree);
  53069. const useSelect = (props, { attrs, emit }, {
  53070. select,
  53071. tree,
  53072. key
  53073. }) => {
  53074. const ns = useNamespace("tree-select");
  53075. watch(() => props.data, () => {
  53076. if (props.filterable) {
  53077. nextTick(() => {
  53078. var _a, _b;
  53079. (_b = tree.value) == null ? void 0 : _b.filter((_a = select.value) == null ? void 0 : _a.states.inputValue);
  53080. });
  53081. }
  53082. }, { flush: "post" });
  53083. const result = {
  53084. ...pick(toRefs(props), Object.keys(ElSelect.props)),
  53085. ...attrs,
  53086. "onUpdate:modelValue": (value) => emit(UPDATE_MODEL_EVENT, value),
  53087. valueKey: key,
  53088. popperClass: computed(() => {
  53089. const classes = [ns.e("popper")];
  53090. if (props.popperClass)
  53091. classes.push(props.popperClass);
  53092. return classes.join(" ");
  53093. }),
  53094. filterMethod: (keyword = "") => {
  53095. var _a;
  53096. if (props.filterMethod) {
  53097. props.filterMethod(keyword);
  53098. } else if (props.remoteMethod) {
  53099. props.remoteMethod(keyword);
  53100. } else {
  53101. (_a = tree.value) == null ? void 0 : _a.filter(keyword);
  53102. }
  53103. }
  53104. };
  53105. return result;
  53106. };
  53107. const component = defineComponent({
  53108. extends: ElOption,
  53109. setup(props, ctx) {
  53110. const result = ElOption.setup(props, ctx);
  53111. delete result.selectOptionClick;
  53112. const vm = getCurrentInstance().proxy;
  53113. nextTick(() => {
  53114. if (!result.select.states.cachedOptions.get(vm.value)) {
  53115. result.select.onOptionCreate(vm);
  53116. }
  53117. });
  53118. watch(() => ctx.attrs.visible, (val) => {
  53119. result.states.visible = val;
  53120. }, {
  53121. immediate: true
  53122. });
  53123. return result;
  53124. },
  53125. methods: {
  53126. selectOptionClick() {
  53127. this.$el.parentElement.click();
  53128. }
  53129. }
  53130. });
  53131. var TreeSelectOption = component;
  53132. function isValidValue(val) {
  53133. return val || val === 0;
  53134. }
  53135. function isValidArray(val) {
  53136. return isArray$1(val) && val.length;
  53137. }
  53138. function toValidArray(val) {
  53139. return isArray$1(val) ? val : isValidValue(val) ? [val] : [];
  53140. }
  53141. function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
  53142. for (let i = 0; i < treeData.length; i++) {
  53143. const data = treeData[i];
  53144. if (findCallback(data, i, treeData, parent)) {
  53145. return resultCallback ? resultCallback(data, i, treeData, parent) : data;
  53146. } else {
  53147. const children = getChildren(data);
  53148. if (isValidArray(children)) {
  53149. const find = treeFind(children, findCallback, getChildren, resultCallback, data);
  53150. if (find)
  53151. return find;
  53152. }
  53153. }
  53154. }
  53155. }
  53156. function treeEach(treeData, callback, getChildren, parent) {
  53157. for (let i = 0; i < treeData.length; i++) {
  53158. const data = treeData[i];
  53159. callback(data, i, treeData, parent);
  53160. const children = getChildren(data);
  53161. if (isValidArray(children)) {
  53162. treeEach(children, callback, getChildren, data);
  53163. }
  53164. }
  53165. }
  53166. const useTree$1 = (props, { attrs, slots, emit }, {
  53167. select,
  53168. tree,
  53169. key
  53170. }) => {
  53171. watch(() => props.modelValue, () => {
  53172. if (props.showCheckbox) {
  53173. nextTick(() => {
  53174. const treeInstance = tree.value;
  53175. if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) {
  53176. treeInstance.setCheckedKeys(toValidArray(props.modelValue));
  53177. }
  53178. });
  53179. }
  53180. }, {
  53181. immediate: true,
  53182. deep: true
  53183. });
  53184. const propsMap = computed(() => ({
  53185. value: key.value,
  53186. label: "label",
  53187. children: "children",
  53188. disabled: "disabled",
  53189. isLeaf: "isLeaf",
  53190. ...props.props
  53191. }));
  53192. const getNodeValByProp = (prop, data) => {
  53193. var _a;
  53194. const propVal = propsMap.value[prop];
  53195. if (isFunction$1(propVal)) {
  53196. return propVal(data, (_a = tree.value) == null ? void 0 : _a.getNode(getNodeValByProp("value", data)));
  53197. } else {
  53198. return data[propVal];
  53199. }
  53200. };
  53201. const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
  53202. return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent));
  53203. }).filter((item) => isValidValue(item));
  53204. const cacheOptions = computed(() => {
  53205. if (!props.renderAfterExpand && !props.lazy)
  53206. return [];
  53207. const options = [];
  53208. treeEach(props.data.concat(props.cacheData), (node) => {
  53209. const value = getNodeValByProp("value", node);
  53210. options.push({
  53211. value,
  53212. currentLabel: getNodeValByProp("label", node),
  53213. isDisabled: getNodeValByProp("disabled", node)
  53214. });
  53215. }, (data) => getNodeValByProp("children", data));
  53216. return options;
  53217. });
  53218. const getChildCheckedKeys = () => {
  53219. var _a;
  53220. return (_a = tree.value) == null ? void 0 : _a.getCheckedKeys().filter((checkedKey) => {
  53221. var _a2;
  53222. const node = (_a2 = tree.value) == null ? void 0 : _a2.getNode(checkedKey);
  53223. return !isNil(node) && isEmpty(node.childNodes);
  53224. });
  53225. };
  53226. return {
  53227. ...pick(toRefs(props), Object.keys(ElTree.props)),
  53228. ...attrs,
  53229. nodeKey: key,
  53230. expandOnClickNode: computed(() => {
  53231. return !props.checkStrictly && props.expandOnClickNode;
  53232. }),
  53233. defaultExpandedKeys: computed(() => {
  53234. return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
  53235. }),
  53236. renderContent: (h, { node, data, store }) => {
  53237. return h(TreeSelectOption, {
  53238. value: getNodeValByProp("value", data),
  53239. label: getNodeValByProp("label", data),
  53240. disabled: getNodeValByProp("disabled", data),
  53241. visible: node.visible
  53242. }, props.renderContent ? () => props.renderContent(h, { node, data, store }) : slots.default ? () => slots.default({ node, data, store }) : void 0);
  53243. },
  53244. filterNodeMethod: (value, data, node) => {
  53245. if (props.filterNodeMethod)
  53246. return props.filterNodeMethod(value, data, node);
  53247. if (!value)
  53248. return true;
  53249. const regexp = new RegExp(escapeStringRegexp(value), "i");
  53250. return regexp.test(getNodeValByProp("label", data) || "");
  53251. },
  53252. onNodeClick: (data, node, e) => {
  53253. var _a, _b, _c, _d;
  53254. (_a = attrs.onNodeClick) == null ? void 0 : _a.call(attrs, data, node, e);
  53255. if (props.showCheckbox && props.checkOnClickNode)
  53256. return;
  53257. if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
  53258. if (!getNodeValByProp("disabled", data)) {
  53259. const option = (_b = select.value) == null ? void 0 : _b.states.options.get(getNodeValByProp("value", data));
  53260. (_c = select.value) == null ? void 0 : _c.handleOptionSelect(option);
  53261. }
  53262. } else if (props.expandOnClickNode) {
  53263. e.proxy.handleExpandIconClick();
  53264. }
  53265. (_d = select.value) == null ? void 0 : _d.focus();
  53266. },
  53267. onCheck: (data, params) => {
  53268. var _a;
  53269. if (!props.showCheckbox)
  53270. return;
  53271. const dataValue = getNodeValByProp("value", data);
  53272. const dataMap = {};
  53273. treeEach([tree.value.store.root], (node) => dataMap[node.key] = node, (node) => node.childNodes);
  53274. const uncachedCheckedKeys = params.checkedKeys;
  53275. const cachedKeys = props.multiple ? toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item)) : [];
  53276. const checkedKeys = cachedKeys.concat(uncachedCheckedKeys);
  53277. if (props.checkStrictly) {
  53278. emit(UPDATE_MODEL_EVENT, props.multiple ? checkedKeys : checkedKeys.includes(dataValue) ? dataValue : void 0);
  53279. } else {
  53280. if (props.multiple) {
  53281. const childKeys = getChildCheckedKeys();
  53282. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
  53283. } else {
  53284. const firstLeaf = treeFind([data], (data2) => !isValidArray(getNodeValByProp("children", data2)) && !getNodeValByProp("disabled", data2), (data2) => getNodeValByProp("children", data2));
  53285. const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
  53286. const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data2) => getNodeValByProp("value", data2) === props.modelValue, (data2) => getNodeValByProp("children", data2));
  53287. emit(UPDATE_MODEL_EVENT, firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
  53288. }
  53289. }
  53290. nextTick(() => {
  53291. var _a2;
  53292. const checkedKeys2 = toValidArray(props.modelValue);
  53293. tree.value.setCheckedKeys(checkedKeys2);
  53294. (_a2 = attrs.onCheck) == null ? void 0 : _a2.call(attrs, data, {
  53295. checkedKeys: tree.value.getCheckedKeys(),
  53296. checkedNodes: tree.value.getCheckedNodes(),
  53297. halfCheckedKeys: tree.value.getHalfCheckedKeys(),
  53298. halfCheckedNodes: tree.value.getHalfCheckedNodes()
  53299. });
  53300. });
  53301. (_a = select.value) == null ? void 0 : _a.focus();
  53302. },
  53303. onNodeExpand: (data, node, e) => {
  53304. var _a;
  53305. (_a = attrs.onNodeExpand) == null ? void 0 : _a.call(attrs, data, node, e);
  53306. nextTick(() => {
  53307. if (!props.checkStrictly && props.lazy && props.multiple && node.checked) {
  53308. const dataMap = {};
  53309. const uncachedCheckedKeys = tree.value.getCheckedKeys();
  53310. treeEach([tree.value.store.root], (node2) => dataMap[node2.key] = node2, (node2) => node2.childNodes);
  53311. const cachedKeys = toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item));
  53312. const childKeys = getChildCheckedKeys();
  53313. emit(UPDATE_MODEL_EVENT, cachedKeys.concat(childKeys));
  53314. }
  53315. });
  53316. },
  53317. cacheOptions
  53318. };
  53319. };
  53320. var CacheOptions = defineComponent({
  53321. props: {
  53322. data: {
  53323. type: Array,
  53324. default: () => []
  53325. }
  53326. },
  53327. setup(props) {
  53328. const select = inject(selectKey);
  53329. watch(() => props.data, () => {
  53330. var _a;
  53331. props.data.forEach((item) => {
  53332. if (!select.states.cachedOptions.has(item.value)) {
  53333. select.states.cachedOptions.set(item.value, item);
  53334. }
  53335. });
  53336. const inputs = ((_a = select.selectRef) == null ? void 0 : _a.querySelectorAll("input")) || [];
  53337. if (isClient && !Array.from(inputs).includes(document.activeElement)) {
  53338. select.setSelected();
  53339. }
  53340. }, { flush: "post", immediate: true });
  53341. return () => void 0;
  53342. }
  53343. });
  53344. const _sfc_main$j = defineComponent({
  53345. name: "ElTreeSelect",
  53346. inheritAttrs: false,
  53347. props: {
  53348. ...ElSelect.props,
  53349. ...ElTree.props,
  53350. cacheData: {
  53351. type: Array,
  53352. default: () => []
  53353. }
  53354. },
  53355. setup(props, context) {
  53356. const { slots, expose } = context;
  53357. const select = ref();
  53358. const tree = ref();
  53359. const key = computed(() => props.nodeKey || props.valueKey || "value");
  53360. const selectProps = useSelect(props, context, { select, tree, key });
  53361. const { cacheOptions, ...treeProps } = useTree$1(props, context, {
  53362. select,
  53363. tree,
  53364. key
  53365. });
  53366. const methods = reactive({});
  53367. expose(methods);
  53368. onMounted(() => {
  53369. Object.assign(methods, {
  53370. ...pick(tree.value, [
  53371. "filter",
  53372. "updateKeyChildren",
  53373. "getCheckedNodes",
  53374. "setCheckedNodes",
  53375. "getCheckedKeys",
  53376. "setCheckedKeys",
  53377. "setChecked",
  53378. "getHalfCheckedNodes",
  53379. "getHalfCheckedKeys",
  53380. "getCurrentKey",
  53381. "getCurrentNode",
  53382. "setCurrentKey",
  53383. "setCurrentNode",
  53384. "getNode",
  53385. "remove",
  53386. "append",
  53387. "insertBefore",
  53388. "insertAfter"
  53389. ]),
  53390. ...pick(select.value, ["focus", "blur", "selectedLabel"])
  53391. });
  53392. });
  53393. return () => h$1(ElSelect, reactive({
  53394. ...selectProps,
  53395. ref: (ref2) => select.value = ref2
  53396. }), {
  53397. ...slots,
  53398. default: () => [
  53399. h$1(CacheOptions, { data: cacheOptions.value }),
  53400. h$1(ElTree, reactive({
  53401. ...treeProps,
  53402. ref: (ref2) => tree.value = ref2
  53403. }))
  53404. ]
  53405. });
  53406. }
  53407. });
  53408. var TreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__file", "tree-select.vue"]]);
  53409. const ElTreeSelect = withInstall(TreeSelect);
  53410. const ROOT_TREE_INJECTION_KEY = Symbol();
  53411. const EMPTY_NODE = {
  53412. key: -1,
  53413. level: -1,
  53414. data: {}
  53415. };
  53416. var TreeOptionsEnum = /* @__PURE__ */ ((TreeOptionsEnum2) => {
  53417. TreeOptionsEnum2["KEY"] = "id";
  53418. TreeOptionsEnum2["LABEL"] = "label";
  53419. TreeOptionsEnum2["CHILDREN"] = "children";
  53420. TreeOptionsEnum2["DISABLED"] = "disabled";
  53421. TreeOptionsEnum2["CLASS"] = "";
  53422. return TreeOptionsEnum2;
  53423. })(TreeOptionsEnum || {});
  53424. var SetOperationEnum = /* @__PURE__ */ ((SetOperationEnum2) => {
  53425. SetOperationEnum2["ADD"] = "add";
  53426. SetOperationEnum2["DELETE"] = "delete";
  53427. return SetOperationEnum2;
  53428. })(SetOperationEnum || {});
  53429. const itemSize = {
  53430. type: Number,
  53431. default: 26
  53432. };
  53433. const treeProps = buildProps({
  53434. data: {
  53435. type: definePropType(Array),
  53436. default: () => mutable([])
  53437. },
  53438. emptyText: {
  53439. type: String
  53440. },
  53441. height: {
  53442. type: Number,
  53443. default: 200
  53444. },
  53445. props: {
  53446. type: definePropType(Object),
  53447. default: () => mutable({
  53448. children: "children" /* CHILDREN */,
  53449. label: "label" /* LABEL */,
  53450. disabled: "disabled" /* DISABLED */,
  53451. value: "id" /* KEY */,
  53452. class: "" /* CLASS */
  53453. })
  53454. },
  53455. highlightCurrent: {
  53456. type: Boolean,
  53457. default: false
  53458. },
  53459. showCheckbox: {
  53460. type: Boolean,
  53461. default: false
  53462. },
  53463. defaultCheckedKeys: {
  53464. type: definePropType(Array),
  53465. default: () => mutable([])
  53466. },
  53467. checkStrictly: {
  53468. type: Boolean,
  53469. default: false
  53470. },
  53471. defaultExpandedKeys: {
  53472. type: definePropType(Array),
  53473. default: () => mutable([])
  53474. },
  53475. indent: {
  53476. type: Number,
  53477. default: 16
  53478. },
  53479. itemSize,
  53480. icon: {
  53481. type: iconPropType
  53482. },
  53483. expandOnClickNode: {
  53484. type: Boolean,
  53485. default: true
  53486. },
  53487. checkOnClickNode: {
  53488. type: Boolean,
  53489. default: false
  53490. },
  53491. currentNodeKey: {
  53492. type: definePropType([String, Number])
  53493. },
  53494. accordion: {
  53495. type: Boolean,
  53496. default: false
  53497. },
  53498. filterMethod: {
  53499. type: definePropType(Function)
  53500. },
  53501. perfMode: {
  53502. type: Boolean,
  53503. default: true
  53504. }
  53505. });
  53506. const treeNodeProps = buildProps({
  53507. node: {
  53508. type: definePropType(Object),
  53509. default: () => mutable(EMPTY_NODE)
  53510. },
  53511. expanded: {
  53512. type: Boolean,
  53513. default: false
  53514. },
  53515. checked: {
  53516. type: Boolean,
  53517. default: false
  53518. },
  53519. indeterminate: {
  53520. type: Boolean,
  53521. default: false
  53522. },
  53523. showCheckbox: {
  53524. type: Boolean,
  53525. default: false
  53526. },
  53527. disabled: {
  53528. type: Boolean,
  53529. default: false
  53530. },
  53531. current: {
  53532. type: Boolean,
  53533. default: false
  53534. },
  53535. hiddenExpandIcon: {
  53536. type: Boolean,
  53537. default: false
  53538. },
  53539. itemSize
  53540. });
  53541. const treeNodeContentProps = buildProps({
  53542. node: {
  53543. type: definePropType(Object),
  53544. required: true
  53545. }
  53546. });
  53547. const NODE_CLICK = "node-click";
  53548. const NODE_DROP = "node-drop";
  53549. const NODE_EXPAND = "node-expand";
  53550. const NODE_COLLAPSE = "node-collapse";
  53551. const CURRENT_CHANGE = "current-change";
  53552. const NODE_CHECK = "check";
  53553. const NODE_CHECK_CHANGE = "check-change";
  53554. const NODE_CONTEXTMENU = "node-contextmenu";
  53555. const treeEmits = {
  53556. [NODE_CLICK]: (data, node, e) => data && node && e,
  53557. [NODE_DROP]: (data, node, e) => data && node && e,
  53558. [NODE_EXPAND]: (data, node) => data && node,
  53559. [NODE_COLLAPSE]: (data, node) => data && node,
  53560. [CURRENT_CHANGE]: (data, node) => data && node,
  53561. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  53562. [NODE_CHECK_CHANGE]: (data, checked) => data && isBoolean(checked),
  53563. [NODE_CONTEXTMENU]: (evt, data, node) => evt && data && node
  53564. };
  53565. const treeNodeEmits = {
  53566. click: (node, e) => !!(node && e),
  53567. drop: (node, e) => !!(node && e),
  53568. toggle: (node) => !!node,
  53569. check: (node, checked) => node && isBoolean(checked)
  53570. };
  53571. function useCheck(props, tree) {
  53572. const checkedKeys = ref(/* @__PURE__ */ new Set());
  53573. const indeterminateKeys = ref(/* @__PURE__ */ new Set());
  53574. const { emit } = getCurrentInstance();
  53575. watch([() => tree.value, () => props.defaultCheckedKeys], () => {
  53576. return nextTick(() => {
  53577. _setCheckedKeys(props.defaultCheckedKeys);
  53578. });
  53579. }, {
  53580. immediate: true
  53581. });
  53582. const updateCheckedKeys = () => {
  53583. if (!tree.value || !props.showCheckbox || props.checkStrictly) {
  53584. return;
  53585. }
  53586. const { levelTreeNodeMap, maxLevel } = tree.value;
  53587. const checkedKeySet = checkedKeys.value;
  53588. const indeterminateKeySet = /* @__PURE__ */ new Set();
  53589. for (let level = maxLevel - 1; level >= 1; --level) {
  53590. const nodes = levelTreeNodeMap.get(level);
  53591. if (!nodes)
  53592. continue;
  53593. nodes.forEach((node) => {
  53594. const children = node.children;
  53595. if (children) {
  53596. let allChecked = true;
  53597. let hasChecked = false;
  53598. for (const childNode of children) {
  53599. const key = childNode.key;
  53600. if (checkedKeySet.has(key)) {
  53601. hasChecked = true;
  53602. } else if (indeterminateKeySet.has(key)) {
  53603. allChecked = false;
  53604. hasChecked = true;
  53605. break;
  53606. } else {
  53607. allChecked = false;
  53608. }
  53609. }
  53610. if (allChecked) {
  53611. checkedKeySet.add(node.key);
  53612. } else if (hasChecked) {
  53613. indeterminateKeySet.add(node.key);
  53614. checkedKeySet.delete(node.key);
  53615. } else {
  53616. checkedKeySet.delete(node.key);
  53617. indeterminateKeySet.delete(node.key);
  53618. }
  53619. }
  53620. });
  53621. }
  53622. indeterminateKeys.value = indeterminateKeySet;
  53623. };
  53624. const isChecked = (node) => checkedKeys.value.has(node.key);
  53625. const isIndeterminate = (node) => indeterminateKeys.value.has(node.key);
  53626. const toggleCheckbox = (node, isChecked2, nodeClick = true, immediateUpdate = true) => {
  53627. const checkedKeySet = checkedKeys.value;
  53628. const toggle = (node2, checked) => {
  53629. checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](node2.key);
  53630. const children = node2.children;
  53631. if (!props.checkStrictly && children) {
  53632. children.forEach((childNode) => {
  53633. if (!childNode.disabled) {
  53634. toggle(childNode, checked);
  53635. }
  53636. });
  53637. }
  53638. };
  53639. toggle(node, isChecked2);
  53640. if (immediateUpdate) {
  53641. updateCheckedKeys();
  53642. }
  53643. if (nodeClick) {
  53644. afterNodeCheck(node, isChecked2);
  53645. }
  53646. };
  53647. const afterNodeCheck = (node, checked) => {
  53648. const { checkedNodes, checkedKeys: checkedKeys2 } = getChecked();
  53649. const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked();
  53650. emit(NODE_CHECK, node.data, {
  53651. checkedKeys: checkedKeys2,
  53652. checkedNodes,
  53653. halfCheckedKeys,
  53654. halfCheckedNodes
  53655. });
  53656. emit(NODE_CHECK_CHANGE, node.data, checked);
  53657. };
  53658. function getCheckedKeys(leafOnly = false) {
  53659. return getChecked(leafOnly).checkedKeys;
  53660. }
  53661. function getCheckedNodes(leafOnly = false) {
  53662. return getChecked(leafOnly).checkedNodes;
  53663. }
  53664. function getHalfCheckedKeys() {
  53665. return getHalfChecked().halfCheckedKeys;
  53666. }
  53667. function getHalfCheckedNodes() {
  53668. return getHalfChecked().halfCheckedNodes;
  53669. }
  53670. function getChecked(leafOnly = false) {
  53671. const checkedNodes = [];
  53672. const keys = [];
  53673. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  53674. const { treeNodeMap } = tree.value;
  53675. checkedKeys.value.forEach((key) => {
  53676. const node = treeNodeMap.get(key);
  53677. if (node && (!leafOnly || leafOnly && node.isLeaf)) {
  53678. keys.push(key);
  53679. checkedNodes.push(node.data);
  53680. }
  53681. });
  53682. }
  53683. return {
  53684. checkedKeys: keys,
  53685. checkedNodes
  53686. };
  53687. }
  53688. function getHalfChecked() {
  53689. const halfCheckedNodes = [];
  53690. const halfCheckedKeys = [];
  53691. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  53692. const { treeNodeMap } = tree.value;
  53693. indeterminateKeys.value.forEach((key) => {
  53694. const node = treeNodeMap.get(key);
  53695. if (node) {
  53696. halfCheckedKeys.push(key);
  53697. halfCheckedNodes.push(node.data);
  53698. }
  53699. });
  53700. }
  53701. return {
  53702. halfCheckedNodes,
  53703. halfCheckedKeys
  53704. };
  53705. }
  53706. function setCheckedKeys(keys) {
  53707. checkedKeys.value.clear();
  53708. indeterminateKeys.value.clear();
  53709. nextTick(() => {
  53710. _setCheckedKeys(keys);
  53711. });
  53712. }
  53713. function setChecked(key, isChecked2) {
  53714. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  53715. const node = tree.value.treeNodeMap.get(key);
  53716. if (node) {
  53717. toggleCheckbox(node, isChecked2, false);
  53718. }
  53719. }
  53720. }
  53721. function _setCheckedKeys(keys) {
  53722. if (tree == null ? void 0 : tree.value) {
  53723. const { treeNodeMap } = tree.value;
  53724. if (props.showCheckbox && treeNodeMap && (keys == null ? void 0 : keys.length) > 0) {
  53725. for (const key of keys) {
  53726. const node = treeNodeMap.get(key);
  53727. if (node && !isChecked(node)) {
  53728. toggleCheckbox(node, true, false, false);
  53729. }
  53730. }
  53731. updateCheckedKeys();
  53732. }
  53733. }
  53734. }
  53735. return {
  53736. updateCheckedKeys,
  53737. toggleCheckbox,
  53738. isChecked,
  53739. isIndeterminate,
  53740. getCheckedKeys,
  53741. getCheckedNodes,
  53742. getHalfCheckedKeys,
  53743. getHalfCheckedNodes,
  53744. setChecked,
  53745. setCheckedKeys
  53746. };
  53747. }
  53748. function useFilter(props, tree) {
  53749. const hiddenNodeKeySet = ref(/* @__PURE__ */ new Set([]));
  53750. const hiddenExpandIconKeySet = ref(/* @__PURE__ */ new Set([]));
  53751. const filterable = computed(() => {
  53752. return isFunction$1(props.filterMethod);
  53753. });
  53754. function doFilter(query) {
  53755. var _a;
  53756. if (!filterable.value) {
  53757. return;
  53758. }
  53759. const expandKeySet = /* @__PURE__ */ new Set();
  53760. const hiddenExpandIconKeys = hiddenExpandIconKeySet.value;
  53761. const hiddenKeys = hiddenNodeKeySet.value;
  53762. const family = [];
  53763. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  53764. const filter = props.filterMethod;
  53765. hiddenKeys.clear();
  53766. function traverse(nodes2) {
  53767. nodes2.forEach((node) => {
  53768. family.push(node);
  53769. if (filter == null ? void 0 : filter(query, node.data, node)) {
  53770. family.forEach((member) => {
  53771. expandKeySet.add(member.key);
  53772. });
  53773. } else if (node.isLeaf) {
  53774. hiddenKeys.add(node.key);
  53775. }
  53776. const children = node.children;
  53777. if (children) {
  53778. traverse(children);
  53779. }
  53780. if (!node.isLeaf) {
  53781. if (!expandKeySet.has(node.key)) {
  53782. hiddenKeys.add(node.key);
  53783. } else if (children) {
  53784. let allHidden = true;
  53785. for (const childNode of children) {
  53786. if (!hiddenKeys.has(childNode.key)) {
  53787. allHidden = false;
  53788. break;
  53789. }
  53790. }
  53791. if (allHidden) {
  53792. hiddenExpandIconKeys.add(node.key);
  53793. } else {
  53794. hiddenExpandIconKeys.delete(node.key);
  53795. }
  53796. }
  53797. }
  53798. family.pop();
  53799. });
  53800. }
  53801. traverse(nodes);
  53802. return expandKeySet;
  53803. }
  53804. function isForceHiddenExpandIcon(node) {
  53805. return hiddenExpandIconKeySet.value.has(node.key);
  53806. }
  53807. return {
  53808. hiddenExpandIconKeySet,
  53809. hiddenNodeKeySet,
  53810. doFilter,
  53811. isForceHiddenExpandIcon
  53812. };
  53813. }
  53814. function useTree(props, emit) {
  53815. const expandedKeySet = ref(new Set(props.defaultExpandedKeys));
  53816. const currentKey = ref();
  53817. const tree = shallowRef();
  53818. const listRef = ref();
  53819. watch(() => props.currentNodeKey, (key) => {
  53820. currentKey.value = key;
  53821. }, {
  53822. immediate: true
  53823. });
  53824. watch(() => props.data, (data) => {
  53825. setData(data);
  53826. }, {
  53827. immediate: true
  53828. });
  53829. const {
  53830. isIndeterminate,
  53831. isChecked,
  53832. toggleCheckbox,
  53833. getCheckedKeys,
  53834. getCheckedNodes,
  53835. getHalfCheckedKeys,
  53836. getHalfCheckedNodes,
  53837. setChecked,
  53838. setCheckedKeys
  53839. } = useCheck(props, tree);
  53840. const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree);
  53841. const valueKey = computed(() => {
  53842. var _a;
  53843. return ((_a = props.props) == null ? void 0 : _a.value) || TreeOptionsEnum.KEY;
  53844. });
  53845. const childrenKey = computed(() => {
  53846. var _a;
  53847. return ((_a = props.props) == null ? void 0 : _a.children) || TreeOptionsEnum.CHILDREN;
  53848. });
  53849. const disabledKey = computed(() => {
  53850. var _a;
  53851. return ((_a = props.props) == null ? void 0 : _a.disabled) || TreeOptionsEnum.DISABLED;
  53852. });
  53853. const labelKey = computed(() => {
  53854. var _a;
  53855. return ((_a = props.props) == null ? void 0 : _a.label) || TreeOptionsEnum.LABEL;
  53856. });
  53857. const flattenTree = computed(() => {
  53858. var _a;
  53859. const expandedKeys = expandedKeySet.value;
  53860. const hiddenKeys = hiddenNodeKeySet.value;
  53861. const flattenNodes = [];
  53862. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  53863. const stack = [];
  53864. for (let i = nodes.length - 1; i >= 0; --i) {
  53865. stack.push(nodes[i]);
  53866. }
  53867. while (stack.length) {
  53868. const node = stack.pop();
  53869. if (hiddenKeys.has(node.key))
  53870. continue;
  53871. flattenNodes.push(node);
  53872. if (node.children && expandedKeys.has(node.key)) {
  53873. for (let i = node.children.length - 1; i >= 0; --i) {
  53874. stack.push(node.children[i]);
  53875. }
  53876. }
  53877. }
  53878. return flattenNodes;
  53879. });
  53880. const isNotEmpty = computed(() => {
  53881. return flattenTree.value.length > 0;
  53882. });
  53883. function createTree(data) {
  53884. const treeNodeMap = /* @__PURE__ */ new Map();
  53885. const levelTreeNodeMap = /* @__PURE__ */ new Map();
  53886. let maxLevel = 1;
  53887. function traverse(nodes, level = 1, parent = void 0) {
  53888. var _a;
  53889. const siblings = [];
  53890. for (const rawNode of nodes) {
  53891. const value = getKey(rawNode);
  53892. const node = {
  53893. level,
  53894. key: value,
  53895. data: rawNode
  53896. };
  53897. node.label = getLabel(rawNode);
  53898. node.parent = parent;
  53899. const children = getChildren(rawNode);
  53900. node.disabled = getDisabled(rawNode);
  53901. node.isLeaf = !children || children.length === 0;
  53902. if (children && children.length) {
  53903. node.children = traverse(children, level + 1, node);
  53904. }
  53905. siblings.push(node);
  53906. treeNodeMap.set(value, node);
  53907. if (!levelTreeNodeMap.has(level)) {
  53908. levelTreeNodeMap.set(level, []);
  53909. }
  53910. (_a = levelTreeNodeMap.get(level)) == null ? void 0 : _a.push(node);
  53911. }
  53912. if (level > maxLevel) {
  53913. maxLevel = level;
  53914. }
  53915. return siblings;
  53916. }
  53917. const treeNodes = traverse(data);
  53918. return {
  53919. treeNodeMap,
  53920. levelTreeNodeMap,
  53921. maxLevel,
  53922. treeNodes
  53923. };
  53924. }
  53925. function filter(query) {
  53926. const keys = doFilter(query);
  53927. if (keys) {
  53928. expandedKeySet.value = keys;
  53929. }
  53930. }
  53931. function getChildren(node) {
  53932. return node[childrenKey.value];
  53933. }
  53934. function getKey(node) {
  53935. if (!node) {
  53936. return "";
  53937. }
  53938. return node[valueKey.value];
  53939. }
  53940. function getDisabled(node) {
  53941. return node[disabledKey.value];
  53942. }
  53943. function getLabel(node) {
  53944. return node[labelKey.value];
  53945. }
  53946. function toggleExpand(node) {
  53947. const expandedKeys = expandedKeySet.value;
  53948. if (expandedKeys.has(node.key)) {
  53949. collapseNode(node);
  53950. } else {
  53951. expandNode(node);
  53952. }
  53953. }
  53954. function setExpandedKeys(keys) {
  53955. const expandedKeys = /* @__PURE__ */ new Set();
  53956. const nodeMap = tree.value.treeNodeMap;
  53957. keys.forEach((k) => {
  53958. let node = nodeMap.get(k);
  53959. while (node && !expandedKeys.has(node.key)) {
  53960. expandedKeys.add(node.key);
  53961. node = node.parent;
  53962. }
  53963. });
  53964. expandedKeySet.value = expandedKeys;
  53965. }
  53966. function handleNodeClick(node, e) {
  53967. emit(NODE_CLICK, node.data, node, e);
  53968. handleCurrentChange(node);
  53969. if (props.expandOnClickNode) {
  53970. toggleExpand(node);
  53971. }
  53972. if (props.showCheckbox && props.checkOnClickNode && !node.disabled) {
  53973. toggleCheckbox(node, !isChecked(node), true);
  53974. }
  53975. }
  53976. function handleNodeDrop(node, e) {
  53977. emit(NODE_DROP, node.data, node, e);
  53978. }
  53979. function handleCurrentChange(node) {
  53980. if (!isCurrent(node)) {
  53981. currentKey.value = node.key;
  53982. emit(CURRENT_CHANGE, node.data, node);
  53983. }
  53984. }
  53985. function handleNodeCheck(node, checked) {
  53986. toggleCheckbox(node, checked);
  53987. }
  53988. function expandNode(node) {
  53989. const keySet = expandedKeySet.value;
  53990. if (tree.value && props.accordion) {
  53991. const { treeNodeMap } = tree.value;
  53992. keySet.forEach((key) => {
  53993. const treeNode = treeNodeMap.get(key);
  53994. if (node && node.level === (treeNode == null ? void 0 : treeNode.level)) {
  53995. keySet.delete(key);
  53996. }
  53997. });
  53998. }
  53999. keySet.add(node.key);
  54000. emit(NODE_EXPAND, node.data, node);
  54001. }
  54002. function collapseNode(node) {
  54003. expandedKeySet.value.delete(node.key);
  54004. emit(NODE_COLLAPSE, node.data, node);
  54005. }
  54006. function isExpanded(node) {
  54007. return expandedKeySet.value.has(node.key);
  54008. }
  54009. function isDisabled(node) {
  54010. return !!node.disabled;
  54011. }
  54012. function isCurrent(node) {
  54013. const current = currentKey.value;
  54014. return current !== void 0 && current === node.key;
  54015. }
  54016. function getCurrentNode() {
  54017. var _a, _b;
  54018. if (!currentKey.value)
  54019. return void 0;
  54020. return (_b = (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(currentKey.value)) == null ? void 0 : _b.data;
  54021. }
  54022. function getCurrentKey() {
  54023. return currentKey.value;
  54024. }
  54025. function setCurrentKey(key) {
  54026. currentKey.value = key;
  54027. }
  54028. function setData(data) {
  54029. nextTick(() => tree.value = createTree(data));
  54030. }
  54031. function getNode(data) {
  54032. var _a;
  54033. const key = isObject$1(data) ? getKey(data) : data;
  54034. return (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(key);
  54035. }
  54036. function scrollToNode(key, strategy = "auto") {
  54037. const node = getNode(key);
  54038. if (node && listRef.value) {
  54039. listRef.value.scrollToItem(flattenTree.value.indexOf(node), strategy);
  54040. }
  54041. }
  54042. function scrollTo(offset) {
  54043. var _a;
  54044. (_a = listRef.value) == null ? void 0 : _a.scrollTo(offset);
  54045. }
  54046. return {
  54047. tree,
  54048. flattenTree,
  54049. isNotEmpty,
  54050. listRef,
  54051. getKey,
  54052. getChildren,
  54053. toggleExpand,
  54054. toggleCheckbox,
  54055. isExpanded,
  54056. isChecked,
  54057. isIndeterminate,
  54058. isDisabled,
  54059. isCurrent,
  54060. isForceHiddenExpandIcon,
  54061. handleNodeClick,
  54062. handleNodeDrop,
  54063. handleNodeCheck,
  54064. getCurrentNode,
  54065. getCurrentKey,
  54066. setCurrentKey,
  54067. getCheckedKeys,
  54068. getCheckedNodes,
  54069. getHalfCheckedKeys,
  54070. getHalfCheckedNodes,
  54071. setChecked,
  54072. setCheckedKeys,
  54073. filter,
  54074. setData,
  54075. getNode,
  54076. expandNode,
  54077. collapseNode,
  54078. setExpandedKeys,
  54079. scrollToNode,
  54080. scrollTo
  54081. };
  54082. }
  54083. var ElNodeContent = defineComponent({
  54084. name: "ElTreeNodeContent",
  54085. props: treeNodeContentProps,
  54086. setup(props) {
  54087. const tree = inject(ROOT_TREE_INJECTION_KEY);
  54088. const ns = useNamespace("tree");
  54089. return () => {
  54090. const node = props.node;
  54091. const { data } = node;
  54092. 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]);
  54093. };
  54094. }
  54095. });
  54096. const __default__$h = defineComponent({
  54097. name: "ElTreeNode"
  54098. });
  54099. const _sfc_main$i = /* @__PURE__ */ defineComponent({
  54100. ...__default__$h,
  54101. props: treeNodeProps,
  54102. emits: treeNodeEmits,
  54103. setup(__props, { emit }) {
  54104. const props = __props;
  54105. const tree = inject(ROOT_TREE_INJECTION_KEY);
  54106. const ns = useNamespace("tree");
  54107. const indent = computed(() => {
  54108. var _a;
  54109. return (_a = tree == null ? void 0 : tree.props.indent) != null ? _a : 16;
  54110. });
  54111. const icon = computed(() => {
  54112. var _a;
  54113. return (_a = tree == null ? void 0 : tree.props.icon) != null ? _a : caret_right_default;
  54114. });
  54115. const getNodeClass = (node) => {
  54116. const nodeClassFunc = tree == null ? void 0 : tree.props.props.class;
  54117. if (!nodeClassFunc)
  54118. return {};
  54119. let className;
  54120. if (isFunction$1(nodeClassFunc)) {
  54121. const { data } = node;
  54122. className = nodeClassFunc(data, node);
  54123. } else {
  54124. className = nodeClassFunc;
  54125. }
  54126. return isString$1(className) ? { [className]: true } : className;
  54127. };
  54128. const handleClick = (e) => {
  54129. emit("click", props.node, e);
  54130. };
  54131. const handleDrop = (e) => {
  54132. emit("drop", props.node, e);
  54133. };
  54134. const handleExpandIconClick = () => {
  54135. emit("toggle", props.node);
  54136. };
  54137. const handleCheckChange = (value) => {
  54138. emit("check", props.node, value);
  54139. };
  54140. const handleContextMenu = (event) => {
  54141. var _a, _b, _c, _d;
  54142. 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"]) {
  54143. event.stopPropagation();
  54144. event.preventDefault();
  54145. }
  54146. tree == null ? void 0 : tree.ctx.emit(NODE_CONTEXTMENU, event, (_d = props.node) == null ? void 0 : _d.data, props.node);
  54147. };
  54148. return (_ctx, _cache) => {
  54149. var _a, _b, _c;
  54150. return openBlock(), createElementBlock("div", {
  54151. ref: "node$",
  54152. class: normalizeClass([
  54153. unref(ns).b("node"),
  54154. unref(ns).is("expanded", _ctx.expanded),
  54155. unref(ns).is("current", _ctx.current),
  54156. unref(ns).is("focusable", !_ctx.disabled),
  54157. unref(ns).is("checked", !_ctx.disabled && _ctx.checked),
  54158. getNodeClass(_ctx.node)
  54159. ]),
  54160. role: "treeitem",
  54161. tabindex: "-1",
  54162. "aria-expanded": _ctx.expanded,
  54163. "aria-disabled": _ctx.disabled,
  54164. "aria-checked": _ctx.checked,
  54165. "data-key": (_a = _ctx.node) == null ? void 0 : _a.key,
  54166. onClick: withModifiers(handleClick, ["stop"]),
  54167. onContextmenu: handleContextMenu,
  54168. onDragover: withModifiers(() => {
  54169. }, ["prevent"]),
  54170. onDragenter: withModifiers(() => {
  54171. }, ["prevent"]),
  54172. onDrop: withModifiers(handleDrop, ["stop"])
  54173. }, [
  54174. createElementVNode("div", {
  54175. class: normalizeClass(unref(ns).be("node", "content")),
  54176. style: normalizeStyle({
  54177. paddingLeft: `${(_ctx.node.level - 1) * unref(indent)}px`,
  54178. height: _ctx.itemSize + "px"
  54179. })
  54180. }, [
  54181. unref(icon) ? (openBlock(), createBlock(unref(ElIcon), {
  54182. key: 0,
  54183. class: normalizeClass([
  54184. unref(ns).is("leaf", !!((_b = _ctx.node) == null ? void 0 : _b.isLeaf)),
  54185. unref(ns).is("hidden", _ctx.hiddenExpandIcon),
  54186. {
  54187. expanded: !((_c = _ctx.node) == null ? void 0 : _c.isLeaf) && _ctx.expanded
  54188. },
  54189. unref(ns).be("node", "expand-icon")
  54190. ]),
  54191. onClick: withModifiers(handleExpandIconClick, ["stop"])
  54192. }, {
  54193. default: withCtx(() => [
  54194. (openBlock(), createBlock(resolveDynamicComponent(unref(icon))))
  54195. ]),
  54196. _: 1
  54197. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  54198. _ctx.showCheckbox ? (openBlock(), createBlock(unref(ElCheckbox), {
  54199. key: 1,
  54200. "model-value": _ctx.checked,
  54201. indeterminate: _ctx.indeterminate,
  54202. disabled: _ctx.disabled,
  54203. onChange: handleCheckChange,
  54204. onClick: withModifiers(() => {
  54205. }, ["stop"])
  54206. }, null, 8, ["model-value", "indeterminate", "disabled", "onClick"])) : createCommentVNode("v-if", true),
  54207. createVNode(unref(ElNodeContent), { node: _ctx.node }, null, 8, ["node"])
  54208. ], 6)
  54209. ], 42, ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick", "onDragover", "onDragenter", "onDrop"]);
  54210. };
  54211. }
  54212. });
  54213. var ElTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__file", "tree-node.vue"]]);
  54214. const __default__$g = defineComponent({
  54215. name: "ElTreeV2"
  54216. });
  54217. const _sfc_main$h = /* @__PURE__ */ defineComponent({
  54218. ...__default__$g,
  54219. props: treeProps,
  54220. emits: treeEmits,
  54221. setup(__props, { expose, emit }) {
  54222. const props = __props;
  54223. const slots = useSlots();
  54224. const treeNodeSize = computed(() => props.itemSize);
  54225. provide(ROOT_TREE_INJECTION_KEY, {
  54226. ctx: {
  54227. emit,
  54228. slots
  54229. },
  54230. props,
  54231. instance: getCurrentInstance()
  54232. });
  54233. provide(formItemContextKey, void 0);
  54234. const { t } = useLocale();
  54235. const ns = useNamespace("tree");
  54236. const {
  54237. flattenTree,
  54238. isNotEmpty,
  54239. listRef,
  54240. toggleExpand,
  54241. isExpanded,
  54242. isIndeterminate,
  54243. isChecked,
  54244. isDisabled,
  54245. isCurrent,
  54246. isForceHiddenExpandIcon,
  54247. handleNodeClick,
  54248. handleNodeDrop,
  54249. handleNodeCheck,
  54250. toggleCheckbox,
  54251. getCurrentNode,
  54252. getCurrentKey,
  54253. setCurrentKey,
  54254. getCheckedKeys,
  54255. getCheckedNodes,
  54256. getHalfCheckedKeys,
  54257. getHalfCheckedNodes,
  54258. setChecked,
  54259. setCheckedKeys,
  54260. filter,
  54261. setData,
  54262. getNode,
  54263. expandNode,
  54264. collapseNode,
  54265. setExpandedKeys,
  54266. scrollToNode,
  54267. scrollTo
  54268. } = useTree(props, emit);
  54269. expose({
  54270. toggleCheckbox,
  54271. getCurrentNode,
  54272. getCurrentKey,
  54273. setCurrentKey,
  54274. getCheckedKeys,
  54275. getCheckedNodes,
  54276. getHalfCheckedKeys,
  54277. getHalfCheckedNodes,
  54278. setChecked,
  54279. setCheckedKeys,
  54280. filter,
  54281. setData,
  54282. getNode,
  54283. expandNode,
  54284. collapseNode,
  54285. setExpandedKeys,
  54286. scrollToNode,
  54287. scrollTo
  54288. });
  54289. return (_ctx, _cache) => {
  54290. return openBlock(), createElementBlock("div", {
  54291. class: normalizeClass([unref(ns).b(), { [unref(ns).m("highlight-current")]: _ctx.highlightCurrent }]),
  54292. role: "tree"
  54293. }, [
  54294. unref(isNotEmpty) ? (openBlock(), createBlock(unref(FixedSizeList$1), {
  54295. key: 0,
  54296. ref_key: "listRef",
  54297. ref: listRef,
  54298. "class-name": unref(ns).b("virtual-list"),
  54299. data: unref(flattenTree),
  54300. total: unref(flattenTree).length,
  54301. height: _ctx.height,
  54302. "item-size": unref(treeNodeSize),
  54303. "perf-mode": _ctx.perfMode
  54304. }, {
  54305. default: withCtx(({ data, index, style }) => [
  54306. (openBlock(), createBlock(ElTreeNode, {
  54307. key: data[index].key,
  54308. style: normalizeStyle(style),
  54309. node: data[index],
  54310. expanded: unref(isExpanded)(data[index]),
  54311. "show-checkbox": _ctx.showCheckbox,
  54312. checked: unref(isChecked)(data[index]),
  54313. indeterminate: unref(isIndeterminate)(data[index]),
  54314. "item-size": unref(treeNodeSize),
  54315. disabled: unref(isDisabled)(data[index]),
  54316. current: unref(isCurrent)(data[index]),
  54317. "hidden-expand-icon": unref(isForceHiddenExpandIcon)(data[index]),
  54318. onClick: unref(handleNodeClick),
  54319. onToggle: unref(toggleExpand),
  54320. onCheck: unref(handleNodeCheck),
  54321. onDrop: unref(handleNodeDrop)
  54322. }, null, 8, ["style", "node", "expanded", "show-checkbox", "checked", "indeterminate", "item-size", "disabled", "current", "hidden-expand-icon", "onClick", "onToggle", "onCheck", "onDrop"]))
  54323. ]),
  54324. _: 1
  54325. }, 8, ["class-name", "data", "total", "height", "item-size", "perf-mode"])) : (openBlock(), createElementBlock("div", {
  54326. key: 1,
  54327. class: normalizeClass(unref(ns).e("empty-block"))
  54328. }, [
  54329. renderSlot(_ctx.$slots, "empty", {}, () => {
  54330. var _a;
  54331. return [
  54332. createElementVNode("span", {
  54333. class: normalizeClass(unref(ns).e("empty-text"))
  54334. }, toDisplayString((_a = _ctx.emptyText) != null ? _a : unref(t)("el.tree.emptyText")), 3)
  54335. ];
  54336. })
  54337. ], 2))
  54338. ], 2);
  54339. };
  54340. }
  54341. });
  54342. var TreeV2 = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__file", "tree.vue"]]);
  54343. const ElTreeV2 = withInstall(TreeV2);
  54344. const uploadContextKey = Symbol("uploadContextKey");
  54345. const SCOPE$2 = "ElUpload";
  54346. class UploadAjaxError extends Error {
  54347. constructor(message, status, method, url) {
  54348. super(message);
  54349. this.name = "UploadAjaxError";
  54350. this.status = status;
  54351. this.method = method;
  54352. this.url = url;
  54353. }
  54354. }
  54355. function getError(action, option, xhr) {
  54356. let msg;
  54357. if (xhr.response) {
  54358. msg = `${xhr.response.error || xhr.response}`;
  54359. } else if (xhr.responseText) {
  54360. msg = `${xhr.responseText}`;
  54361. } else {
  54362. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  54363. }
  54364. return new UploadAjaxError(msg, xhr.status, option.method, action);
  54365. }
  54366. function getBody(xhr) {
  54367. const text = xhr.responseText || xhr.response;
  54368. if (!text) {
  54369. return text;
  54370. }
  54371. try {
  54372. return JSON.parse(text);
  54373. } catch (e) {
  54374. return text;
  54375. }
  54376. }
  54377. const ajaxUpload = (option) => {
  54378. if (typeof XMLHttpRequest === "undefined")
  54379. throwError(SCOPE$2, "XMLHttpRequest is undefined");
  54380. const xhr = new XMLHttpRequest();
  54381. const action = option.action;
  54382. if (xhr.upload) {
  54383. xhr.upload.addEventListener("progress", (evt) => {
  54384. const progressEvt = evt;
  54385. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  54386. option.onProgress(progressEvt);
  54387. });
  54388. }
  54389. const formData = new FormData();
  54390. if (option.data) {
  54391. for (const [key, value] of Object.entries(option.data)) {
  54392. if (isArray$1(value) && value.length)
  54393. formData.append(key, ...value);
  54394. else
  54395. formData.append(key, value);
  54396. }
  54397. }
  54398. formData.append(option.filename, option.file, option.file.name);
  54399. xhr.addEventListener("error", () => {
  54400. option.onError(getError(action, option, xhr));
  54401. });
  54402. xhr.addEventListener("load", () => {
  54403. if (xhr.status < 200 || xhr.status >= 300) {
  54404. return option.onError(getError(action, option, xhr));
  54405. }
  54406. option.onSuccess(getBody(xhr));
  54407. });
  54408. xhr.open(option.method, action, true);
  54409. if (option.withCredentials && "withCredentials" in xhr) {
  54410. xhr.withCredentials = true;
  54411. }
  54412. const headers = option.headers || {};
  54413. if (headers instanceof Headers) {
  54414. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  54415. } else {
  54416. for (const [key, value] of Object.entries(headers)) {
  54417. if (isNil(value))
  54418. continue;
  54419. xhr.setRequestHeader(key, String(value));
  54420. }
  54421. }
  54422. xhr.send(formData);
  54423. return xhr;
  54424. };
  54425. const uploadListTypes = ["text", "picture", "picture-card"];
  54426. let fileId = 1;
  54427. const genFileId = () => Date.now() + fileId++;
  54428. const uploadBaseProps = buildProps({
  54429. action: {
  54430. type: String,
  54431. default: "#"
  54432. },
  54433. headers: {
  54434. type: definePropType(Object)
  54435. },
  54436. method: {
  54437. type: String,
  54438. default: "post"
  54439. },
  54440. data: {
  54441. type: definePropType([Object, Function, Promise]),
  54442. default: () => mutable({})
  54443. },
  54444. multiple: Boolean,
  54445. name: {
  54446. type: String,
  54447. default: "file"
  54448. },
  54449. drag: Boolean,
  54450. withCredentials: Boolean,
  54451. showFileList: {
  54452. type: Boolean,
  54453. default: true
  54454. },
  54455. accept: {
  54456. type: String,
  54457. default: ""
  54458. },
  54459. fileList: {
  54460. type: definePropType(Array),
  54461. default: () => mutable([])
  54462. },
  54463. autoUpload: {
  54464. type: Boolean,
  54465. default: true
  54466. },
  54467. listType: {
  54468. type: String,
  54469. values: uploadListTypes,
  54470. default: "text"
  54471. },
  54472. httpRequest: {
  54473. type: definePropType(Function),
  54474. default: ajaxUpload
  54475. },
  54476. disabled: Boolean,
  54477. limit: Number
  54478. });
  54479. const uploadProps = buildProps({
  54480. ...uploadBaseProps,
  54481. beforeUpload: {
  54482. type: definePropType(Function),
  54483. default: NOOP
  54484. },
  54485. beforeRemove: {
  54486. type: definePropType(Function)
  54487. },
  54488. onRemove: {
  54489. type: definePropType(Function),
  54490. default: NOOP
  54491. },
  54492. onChange: {
  54493. type: definePropType(Function),
  54494. default: NOOP
  54495. },
  54496. onPreview: {
  54497. type: definePropType(Function),
  54498. default: NOOP
  54499. },
  54500. onSuccess: {
  54501. type: definePropType(Function),
  54502. default: NOOP
  54503. },
  54504. onProgress: {
  54505. type: definePropType(Function),
  54506. default: NOOP
  54507. },
  54508. onError: {
  54509. type: definePropType(Function),
  54510. default: NOOP
  54511. },
  54512. onExceed: {
  54513. type: definePropType(Function),
  54514. default: NOOP
  54515. },
  54516. crossorigin: {
  54517. type: definePropType(String)
  54518. }
  54519. });
  54520. const uploadListProps = buildProps({
  54521. files: {
  54522. type: definePropType(Array),
  54523. default: () => mutable([])
  54524. },
  54525. disabled: {
  54526. type: Boolean,
  54527. default: false
  54528. },
  54529. handlePreview: {
  54530. type: definePropType(Function),
  54531. default: NOOP
  54532. },
  54533. listType: {
  54534. type: String,
  54535. values: uploadListTypes,
  54536. default: "text"
  54537. },
  54538. crossorigin: {
  54539. type: definePropType(String)
  54540. }
  54541. });
  54542. const uploadListEmits = {
  54543. remove: (file) => !!file
  54544. };
  54545. const __default__$f = defineComponent({
  54546. name: "ElUploadList"
  54547. });
  54548. const _sfc_main$g = /* @__PURE__ */ defineComponent({
  54549. ...__default__$f,
  54550. props: uploadListProps,
  54551. emits: uploadListEmits,
  54552. setup(__props, { emit }) {
  54553. const props = __props;
  54554. const { t } = useLocale();
  54555. const nsUpload = useNamespace("upload");
  54556. const nsIcon = useNamespace("icon");
  54557. const nsList = useNamespace("list");
  54558. const disabled = useFormDisabled();
  54559. const focusing = ref(false);
  54560. const containerKls = computed(() => [
  54561. nsUpload.b("list"),
  54562. nsUpload.bm("list", props.listType),
  54563. nsUpload.is("disabled", props.disabled)
  54564. ]);
  54565. const handleRemove = (file) => {
  54566. emit("remove", file);
  54567. };
  54568. return (_ctx, _cache) => {
  54569. return openBlock(), createBlock(TransitionGroup, {
  54570. tag: "ul",
  54571. class: normalizeClass(unref(containerKls)),
  54572. name: unref(nsList).b()
  54573. }, {
  54574. default: withCtx(() => [
  54575. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file, index) => {
  54576. return openBlock(), createElementBlock("li", {
  54577. key: file.uid || file.name,
  54578. class: normalizeClass([
  54579. unref(nsUpload).be("list", "item"),
  54580. unref(nsUpload).is(file.status),
  54581. { focusing: focusing.value }
  54582. ]),
  54583. tabindex: "0",
  54584. onKeydown: withKeys(($event) => !unref(disabled) && handleRemove(file), ["delete"]),
  54585. onFocus: ($event) => focusing.value = true,
  54586. onBlur: ($event) => focusing.value = false,
  54587. onClick: ($event) => focusing.value = false
  54588. }, [
  54589. renderSlot(_ctx.$slots, "default", {
  54590. file,
  54591. index
  54592. }, () => [
  54593. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
  54594. key: 0,
  54595. class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
  54596. src: file.url,
  54597. crossorigin: _ctx.crossorigin,
  54598. alt: ""
  54599. }, null, 10, ["src", "crossorigin"])) : createCommentVNode("v-if", true),
  54600. file.status === "uploading" || _ctx.listType !== "picture-card" ? (openBlock(), createElementBlock("div", {
  54601. key: 1,
  54602. class: normalizeClass(unref(nsUpload).be("list", "item-info"))
  54603. }, [
  54604. createElementVNode("a", {
  54605. class: normalizeClass(unref(nsUpload).be("list", "item-name")),
  54606. onClick: withModifiers(($event) => _ctx.handlePreview(file), ["prevent"])
  54607. }, [
  54608. createVNode(unref(ElIcon), {
  54609. class: normalizeClass(unref(nsIcon).m("document"))
  54610. }, {
  54611. default: withCtx(() => [
  54612. createVNode(unref(document_default))
  54613. ]),
  54614. _: 1
  54615. }, 8, ["class"]),
  54616. createElementVNode("span", {
  54617. class: normalizeClass(unref(nsUpload).be("list", "item-file-name")),
  54618. title: file.name
  54619. }, toDisplayString(file.name), 11, ["title"])
  54620. ], 10, ["onClick"]),
  54621. file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
  54622. key: 0,
  54623. type: _ctx.listType === "picture-card" ? "circle" : "line",
  54624. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  54625. percentage: Number(file.percentage),
  54626. style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  54627. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
  54628. ], 2)) : createCommentVNode("v-if", true),
  54629. createElementVNode("label", {
  54630. class: normalizeClass(unref(nsUpload).be("list", "item-status-label"))
  54631. }, [
  54632. _ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
  54633. key: 0,
  54634. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
  54635. }, {
  54636. default: withCtx(() => [
  54637. createVNode(unref(circle_check_default))
  54638. ]),
  54639. _: 1
  54640. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), {
  54641. key: 1,
  54642. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
  54643. }, {
  54644. default: withCtx(() => [
  54645. createVNode(unref(check_default))
  54646. ]),
  54647. _: 1
  54648. }, 8, ["class"])) : createCommentVNode("v-if", true)
  54649. ], 2),
  54650. !unref(disabled) ? (openBlock(), createBlock(unref(ElIcon), {
  54651. key: 2,
  54652. class: normalizeClass(unref(nsIcon).m("close")),
  54653. onClick: ($event) => handleRemove(file)
  54654. }, {
  54655. default: withCtx(() => [
  54656. createVNode(unref(close_default))
  54657. ]),
  54658. _: 2
  54659. }, 1032, ["class", "onClick"])) : createCommentVNode("v-if", true),
  54660. createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
  54661. createCommentVNode(" This is a bug which needs to be fixed "),
  54662. createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  54663. !unref(disabled) ? (openBlock(), createElementBlock("i", {
  54664. key: 3,
  54665. class: normalizeClass(unref(nsIcon).m("close-tip"))
  54666. }, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
  54667. _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
  54668. key: 4,
  54669. class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
  54670. }, [
  54671. createElementVNode("span", {
  54672. class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
  54673. onClick: ($event) => _ctx.handlePreview(file)
  54674. }, [
  54675. createVNode(unref(ElIcon), {
  54676. class: normalizeClass(unref(nsIcon).m("zoom-in"))
  54677. }, {
  54678. default: withCtx(() => [
  54679. createVNode(unref(zoom_in_default))
  54680. ]),
  54681. _: 1
  54682. }, 8, ["class"])
  54683. ], 10, ["onClick"]),
  54684. !unref(disabled) ? (openBlock(), createElementBlock("span", {
  54685. key: 0,
  54686. class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
  54687. onClick: ($event) => handleRemove(file)
  54688. }, [
  54689. createVNode(unref(ElIcon), {
  54690. class: normalizeClass(unref(nsIcon).m("delete"))
  54691. }, {
  54692. default: withCtx(() => [
  54693. createVNode(unref(delete_default))
  54694. ]),
  54695. _: 1
  54696. }, 8, ["class"])
  54697. ], 10, ["onClick"])) : createCommentVNode("v-if", true)
  54698. ], 2)) : createCommentVNode("v-if", true)
  54699. ])
  54700. ], 42, ["onKeydown", "onFocus", "onBlur", "onClick"]);
  54701. }), 128)),
  54702. renderSlot(_ctx.$slots, "append")
  54703. ]),
  54704. _: 3
  54705. }, 8, ["class", "name"]);
  54706. };
  54707. }
  54708. });
  54709. var UploadList = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__file", "upload-list.vue"]]);
  54710. const uploadDraggerProps = buildProps({
  54711. disabled: {
  54712. type: Boolean,
  54713. default: false
  54714. }
  54715. });
  54716. const uploadDraggerEmits = {
  54717. file: (file) => isArray$1(file)
  54718. };
  54719. const COMPONENT_NAME = "ElUploadDrag";
  54720. const __default__$e = defineComponent({
  54721. name: COMPONENT_NAME
  54722. });
  54723. const _sfc_main$f = /* @__PURE__ */ defineComponent({
  54724. ...__default__$e,
  54725. props: uploadDraggerProps,
  54726. emits: uploadDraggerEmits,
  54727. setup(__props, { emit }) {
  54728. const uploaderContext = inject(uploadContextKey);
  54729. if (!uploaderContext) {
  54730. throwError(COMPONENT_NAME, "usage: <el-upload><el-upload-dragger /></el-upload>");
  54731. }
  54732. const ns = useNamespace("upload");
  54733. const dragover = ref(false);
  54734. const disabled = useFormDisabled();
  54735. const onDrop = (e) => {
  54736. if (disabled.value)
  54737. return;
  54738. dragover.value = false;
  54739. e.stopPropagation();
  54740. const files = Array.from(e.dataTransfer.files);
  54741. emit("file", files);
  54742. };
  54743. const onDragover = () => {
  54744. if (!disabled.value)
  54745. dragover.value = true;
  54746. };
  54747. return (_ctx, _cache) => {
  54748. return openBlock(), createElementBlock("div", {
  54749. class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
  54750. onDrop: withModifiers(onDrop, ["prevent"]),
  54751. onDragover: withModifiers(onDragover, ["prevent"]),
  54752. onDragleave: withModifiers(($event) => dragover.value = false, ["prevent"])
  54753. }, [
  54754. renderSlot(_ctx.$slots, "default")
  54755. ], 42, ["onDrop", "onDragover", "onDragleave"]);
  54756. };
  54757. }
  54758. });
  54759. var UploadDragger = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__file", "upload-dragger.vue"]]);
  54760. const uploadContentProps = buildProps({
  54761. ...uploadBaseProps,
  54762. beforeUpload: {
  54763. type: definePropType(Function),
  54764. default: NOOP
  54765. },
  54766. onRemove: {
  54767. type: definePropType(Function),
  54768. default: NOOP
  54769. },
  54770. onStart: {
  54771. type: definePropType(Function),
  54772. default: NOOP
  54773. },
  54774. onSuccess: {
  54775. type: definePropType(Function),
  54776. default: NOOP
  54777. },
  54778. onProgress: {
  54779. type: definePropType(Function),
  54780. default: NOOP
  54781. },
  54782. onError: {
  54783. type: definePropType(Function),
  54784. default: NOOP
  54785. },
  54786. onExceed: {
  54787. type: definePropType(Function),
  54788. default: NOOP
  54789. }
  54790. });
  54791. const __default__$d = defineComponent({
  54792. name: "ElUploadContent",
  54793. inheritAttrs: false
  54794. });
  54795. const _sfc_main$e = /* @__PURE__ */ defineComponent({
  54796. ...__default__$d,
  54797. props: uploadContentProps,
  54798. setup(__props, { expose }) {
  54799. const props = __props;
  54800. const ns = useNamespace("upload");
  54801. const disabled = useFormDisabled();
  54802. const requests = shallowRef({});
  54803. const inputRef = shallowRef();
  54804. const uploadFiles = (files) => {
  54805. if (files.length === 0)
  54806. return;
  54807. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  54808. if (limit && fileList.length + files.length > limit) {
  54809. onExceed(files, fileList);
  54810. return;
  54811. }
  54812. if (!multiple) {
  54813. files = files.slice(0, 1);
  54814. }
  54815. for (const file of files) {
  54816. const rawFile = file;
  54817. rawFile.uid = genFileId();
  54818. onStart(rawFile);
  54819. if (autoUpload)
  54820. upload(rawFile);
  54821. }
  54822. };
  54823. const upload = async (rawFile) => {
  54824. inputRef.value.value = "";
  54825. if (!props.beforeUpload) {
  54826. return doUpload(rawFile);
  54827. }
  54828. let hookResult;
  54829. let beforeData = {};
  54830. try {
  54831. const originData = props.data;
  54832. const beforeUploadPromise = props.beforeUpload(rawFile);
  54833. beforeData = isPlainObject$1(props.data) ? cloneDeep(props.data) : props.data;
  54834. hookResult = await beforeUploadPromise;
  54835. if (isPlainObject$1(props.data) && isEqual$1(originData, beforeData)) {
  54836. beforeData = cloneDeep(props.data);
  54837. }
  54838. } catch (e) {
  54839. hookResult = false;
  54840. }
  54841. if (hookResult === false) {
  54842. props.onRemove(rawFile);
  54843. return;
  54844. }
  54845. let file = rawFile;
  54846. if (hookResult instanceof Blob) {
  54847. if (hookResult instanceof File) {
  54848. file = hookResult;
  54849. } else {
  54850. file = new File([hookResult], rawFile.name, {
  54851. type: rawFile.type
  54852. });
  54853. }
  54854. }
  54855. doUpload(Object.assign(file, {
  54856. uid: rawFile.uid
  54857. }), beforeData);
  54858. };
  54859. const resolveData = async (data, rawFile) => {
  54860. if (isFunction$1(data)) {
  54861. return data(rawFile);
  54862. }
  54863. return data;
  54864. };
  54865. const doUpload = async (rawFile, beforeData) => {
  54866. const {
  54867. headers,
  54868. data,
  54869. method,
  54870. withCredentials,
  54871. name: filename,
  54872. action,
  54873. onProgress,
  54874. onSuccess,
  54875. onError,
  54876. httpRequest
  54877. } = props;
  54878. try {
  54879. beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile);
  54880. } catch (e) {
  54881. props.onRemove(rawFile);
  54882. return;
  54883. }
  54884. const { uid } = rawFile;
  54885. const options = {
  54886. headers: headers || {},
  54887. withCredentials,
  54888. file: rawFile,
  54889. data: beforeData,
  54890. method,
  54891. filename,
  54892. action,
  54893. onProgress: (evt) => {
  54894. onProgress(evt, rawFile);
  54895. },
  54896. onSuccess: (res) => {
  54897. onSuccess(res, rawFile);
  54898. delete requests.value[uid];
  54899. },
  54900. onError: (err) => {
  54901. onError(err, rawFile);
  54902. delete requests.value[uid];
  54903. }
  54904. };
  54905. const request = httpRequest(options);
  54906. requests.value[uid] = request;
  54907. if (request instanceof Promise) {
  54908. request.then(options.onSuccess, options.onError);
  54909. }
  54910. };
  54911. const handleChange = (e) => {
  54912. const files = e.target.files;
  54913. if (!files)
  54914. return;
  54915. uploadFiles(Array.from(files));
  54916. };
  54917. const handleClick = () => {
  54918. if (!disabled.value) {
  54919. inputRef.value.value = "";
  54920. inputRef.value.click();
  54921. }
  54922. };
  54923. const handleKeydown = () => {
  54924. handleClick();
  54925. };
  54926. const abort = (file) => {
  54927. const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
  54928. _reqs.forEach(([uid, req]) => {
  54929. if (req instanceof XMLHttpRequest)
  54930. req.abort();
  54931. delete requests.value[uid];
  54932. });
  54933. };
  54934. expose({
  54935. abort,
  54936. upload
  54937. });
  54938. return (_ctx, _cache) => {
  54939. return openBlock(), createElementBlock("div", {
  54940. class: normalizeClass([
  54941. unref(ns).b(),
  54942. unref(ns).m(_ctx.listType),
  54943. unref(ns).is("drag", _ctx.drag),
  54944. unref(ns).is("disabled", unref(disabled))
  54945. ]),
  54946. tabindex: unref(disabled) ? "-1" : "0",
  54947. onClick: handleClick,
  54948. onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  54949. }, [
  54950. _ctx.drag ? (openBlock(), createBlock(UploadDragger, {
  54951. key: 0,
  54952. disabled: unref(disabled),
  54953. onFile: uploadFiles
  54954. }, {
  54955. default: withCtx(() => [
  54956. renderSlot(_ctx.$slots, "default")
  54957. ]),
  54958. _: 3
  54959. }, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
  54960. createElementVNode("input", {
  54961. ref_key: "inputRef",
  54962. ref: inputRef,
  54963. class: normalizeClass(unref(ns).e("input")),
  54964. name: _ctx.name,
  54965. disabled: unref(disabled),
  54966. multiple: _ctx.multiple,
  54967. accept: _ctx.accept,
  54968. type: "file",
  54969. onChange: handleChange,
  54970. onClick: withModifiers(() => {
  54971. }, ["stop"])
  54972. }, null, 42, ["name", "disabled", "multiple", "accept", "onClick"])
  54973. ], 42, ["tabindex", "onKeydown"]);
  54974. };
  54975. }
  54976. });
  54977. var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "upload-content.vue"]]);
  54978. const SCOPE$1 = "ElUpload";
  54979. const revokeFileObjectURL = (file) => {
  54980. var _a;
  54981. if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) {
  54982. URL.revokeObjectURL(file.url);
  54983. }
  54984. };
  54985. const useHandlers = (props, uploadRef) => {
  54986. const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
  54987. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  54988. function abort(file) {
  54989. var _a;
  54990. (_a = uploadRef.value) == null ? void 0 : _a.abort(file);
  54991. }
  54992. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  54993. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  54994. }
  54995. function removeFile(file) {
  54996. uploadFiles.value = uploadFiles.value.filter((uploadFile) => uploadFile !== file);
  54997. }
  54998. const handleError = (err, rawFile) => {
  54999. const file = getFile(rawFile);
  55000. if (!file)
  55001. return;
  55002. console.error(err);
  55003. file.status = "fail";
  55004. removeFile(file);
  55005. props.onError(err, file, uploadFiles.value);
  55006. props.onChange(file, uploadFiles.value);
  55007. };
  55008. const handleProgress = (evt, rawFile) => {
  55009. const file = getFile(rawFile);
  55010. if (!file)
  55011. return;
  55012. props.onProgress(evt, file, uploadFiles.value);
  55013. file.status = "uploading";
  55014. file.percentage = Math.round(evt.percent);
  55015. };
  55016. const handleSuccess = (response, rawFile) => {
  55017. const file = getFile(rawFile);
  55018. if (!file)
  55019. return;
  55020. file.status = "success";
  55021. file.response = response;
  55022. props.onSuccess(response, file, uploadFiles.value);
  55023. props.onChange(file, uploadFiles.value);
  55024. };
  55025. const handleStart = (file) => {
  55026. if (isNil(file.uid))
  55027. file.uid = genFileId();
  55028. const uploadFile = {
  55029. name: file.name,
  55030. percentage: 0,
  55031. status: "ready",
  55032. size: file.size,
  55033. raw: file,
  55034. uid: file.uid
  55035. };
  55036. if (props.listType === "picture-card" || props.listType === "picture") {
  55037. try {
  55038. uploadFile.url = URL.createObjectURL(file);
  55039. } catch (err) {
  55040. debugWarn(SCOPE$1, err.message);
  55041. props.onError(err, uploadFile, uploadFiles.value);
  55042. }
  55043. }
  55044. uploadFiles.value = [...uploadFiles.value, uploadFile];
  55045. props.onChange(uploadFile, uploadFiles.value);
  55046. };
  55047. const handleRemove = async (file) => {
  55048. const uploadFile = file instanceof File ? getFile(file) : file;
  55049. if (!uploadFile)
  55050. throwError(SCOPE$1, "file to be removed not found");
  55051. const doRemove = (file2) => {
  55052. abort(file2);
  55053. removeFile(file2);
  55054. props.onRemove(file2, uploadFiles.value);
  55055. revokeFileObjectURL(file2);
  55056. };
  55057. if (props.beforeRemove) {
  55058. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  55059. if (before !== false)
  55060. doRemove(uploadFile);
  55061. } else {
  55062. doRemove(uploadFile);
  55063. }
  55064. };
  55065. function submit() {
  55066. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  55067. var _a;
  55068. return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw));
  55069. });
  55070. }
  55071. watch(() => props.listType, (val) => {
  55072. if (val !== "picture-card" && val !== "picture") {
  55073. return;
  55074. }
  55075. uploadFiles.value = uploadFiles.value.map((file) => {
  55076. const { raw, url } = file;
  55077. if (!url && raw) {
  55078. try {
  55079. file.url = URL.createObjectURL(raw);
  55080. } catch (err) {
  55081. props.onError(err, file, uploadFiles.value);
  55082. }
  55083. }
  55084. return file;
  55085. });
  55086. });
  55087. watch(uploadFiles, (files) => {
  55088. for (const file of files) {
  55089. file.uid || (file.uid = genFileId());
  55090. file.status || (file.status = "success");
  55091. }
  55092. }, { immediate: true, deep: true });
  55093. return {
  55094. uploadFiles,
  55095. abort,
  55096. clearFiles,
  55097. handleError,
  55098. handleProgress,
  55099. handleStart,
  55100. handleSuccess,
  55101. handleRemove,
  55102. submit,
  55103. revokeFileObjectURL
  55104. };
  55105. };
  55106. const __default__$c = defineComponent({
  55107. name: "ElUpload"
  55108. });
  55109. const _sfc_main$d = /* @__PURE__ */ defineComponent({
  55110. ...__default__$c,
  55111. props: uploadProps,
  55112. setup(__props, { expose }) {
  55113. const props = __props;
  55114. const disabled = useFormDisabled();
  55115. const uploadRef = shallowRef();
  55116. const {
  55117. abort,
  55118. submit,
  55119. clearFiles,
  55120. uploadFiles,
  55121. handleStart,
  55122. handleError,
  55123. handleRemove,
  55124. handleSuccess,
  55125. handleProgress,
  55126. revokeFileObjectURL
  55127. } = useHandlers(props, uploadRef);
  55128. const isPictureCard = computed(() => props.listType === "picture-card");
  55129. const uploadContentProps = computed(() => ({
  55130. ...props,
  55131. fileList: uploadFiles.value,
  55132. onStart: handleStart,
  55133. onProgress: handleProgress,
  55134. onSuccess: handleSuccess,
  55135. onError: handleError,
  55136. onRemove: handleRemove
  55137. }));
  55138. onBeforeUnmount(() => {
  55139. uploadFiles.value.forEach(revokeFileObjectURL);
  55140. });
  55141. provide(uploadContextKey, {
  55142. accept: toRef(props, "accept")
  55143. });
  55144. expose({
  55145. abort,
  55146. submit,
  55147. clearFiles,
  55148. handleStart,
  55149. handleRemove
  55150. });
  55151. return (_ctx, _cache) => {
  55152. return openBlock(), createElementBlock("div", null, [
  55153. unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  55154. key: 0,
  55155. disabled: unref(disabled),
  55156. "list-type": _ctx.listType,
  55157. files: unref(uploadFiles),
  55158. crossorigin: _ctx.crossorigin,
  55159. "handle-preview": _ctx.onPreview,
  55160. onRemove: unref(handleRemove)
  55161. }, createSlots({
  55162. append: withCtx(() => [
  55163. createVNode(UploadContent, mergeProps({
  55164. ref_key: "uploadRef",
  55165. ref: uploadRef
  55166. }, unref(uploadContentProps)), {
  55167. default: withCtx(() => [
  55168. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  55169. !_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  55170. ]),
  55171. _: 3
  55172. }, 16)
  55173. ]),
  55174. _: 2
  55175. }, [
  55176. _ctx.$slots.file ? {
  55177. name: "default",
  55178. fn: withCtx(({ file, index }) => [
  55179. renderSlot(_ctx.$slots, "file", {
  55180. file,
  55181. index
  55182. })
  55183. ])
  55184. } : void 0
  55185. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true),
  55186. !unref(isPictureCard) || unref(isPictureCard) && !_ctx.showFileList ? (openBlock(), createBlock(UploadContent, mergeProps({
  55187. key: 1,
  55188. ref_key: "uploadRef",
  55189. ref: uploadRef
  55190. }, unref(uploadContentProps)), {
  55191. default: withCtx(() => [
  55192. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
  55193. !_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
  55194. ]),
  55195. _: 3
  55196. }, 16)) : createCommentVNode("v-if", true),
  55197. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
  55198. renderSlot(_ctx.$slots, "tip"),
  55199. !unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
  55200. key: 3,
  55201. disabled: unref(disabled),
  55202. "list-type": _ctx.listType,
  55203. files: unref(uploadFiles),
  55204. crossorigin: _ctx.crossorigin,
  55205. "handle-preview": _ctx.onPreview,
  55206. onRemove: unref(handleRemove)
  55207. }, createSlots({
  55208. _: 2
  55209. }, [
  55210. _ctx.$slots.file ? {
  55211. name: "default",
  55212. fn: withCtx(({ file, index }) => [
  55213. renderSlot(_ctx.$slots, "file", {
  55214. file,
  55215. index
  55216. })
  55217. ])
  55218. } : void 0
  55219. ]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true)
  55220. ]);
  55221. };
  55222. }
  55223. });
  55224. var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__file", "upload.vue"]]);
  55225. const ElUpload = withInstall(Upload);
  55226. const watermarkProps = buildProps({
  55227. zIndex: {
  55228. type: Number,
  55229. default: 9
  55230. },
  55231. rotate: {
  55232. type: Number,
  55233. default: -22
  55234. },
  55235. width: Number,
  55236. height: Number,
  55237. image: String,
  55238. content: {
  55239. type: definePropType([String, Array]),
  55240. default: "Element Plus"
  55241. },
  55242. font: {
  55243. type: definePropType(Object)
  55244. },
  55245. gap: {
  55246. type: definePropType(Array),
  55247. default: () => [100, 100]
  55248. },
  55249. offset: {
  55250. type: definePropType(Array)
  55251. }
  55252. });
  55253. function toLowercaseSeparator(key) {
  55254. return key.replace(/([A-Z])/g, "-$1").toLowerCase();
  55255. }
  55256. function getStyleStr(style) {
  55257. return Object.keys(style).map((key) => `${toLowercaseSeparator(key)}: ${style[key]};`).join(" ");
  55258. }
  55259. function getPixelRatio() {
  55260. return window.devicePixelRatio || 1;
  55261. }
  55262. const reRendering = (mutation, watermarkElement) => {
  55263. let flag = false;
  55264. if (mutation.removedNodes.length && watermarkElement) {
  55265. flag = Array.from(mutation.removedNodes).includes(watermarkElement);
  55266. }
  55267. if (mutation.type === "attributes" && mutation.target === watermarkElement) {
  55268. flag = true;
  55269. }
  55270. return flag;
  55271. };
  55272. const FontGap = 3;
  55273. function prepareCanvas(width, height, ratio = 1) {
  55274. const canvas = document.createElement("canvas");
  55275. const ctx = canvas.getContext("2d");
  55276. const realWidth = width * ratio;
  55277. const realHeight = height * ratio;
  55278. canvas.setAttribute("width", `${realWidth}px`);
  55279. canvas.setAttribute("height", `${realHeight}px`);
  55280. ctx.save();
  55281. return [ctx, canvas, realWidth, realHeight];
  55282. }
  55283. function useClips() {
  55284. function getClips(content, rotate, ratio, width, height, font, gapX, gapY) {
  55285. const [ctx, canvas, contentWidth, contentHeight] = prepareCanvas(width, height, ratio);
  55286. if (content instanceof HTMLImageElement) {
  55287. ctx.drawImage(content, 0, 0, contentWidth, contentHeight);
  55288. } else {
  55289. const {
  55290. color,
  55291. fontSize,
  55292. fontStyle,
  55293. fontWeight,
  55294. fontFamily,
  55295. textAlign,
  55296. textBaseline
  55297. } = font;
  55298. const mergedFontSize = Number(fontSize) * ratio;
  55299. ctx.font = `${fontStyle} normal ${fontWeight} ${mergedFontSize}px/${height}px ${fontFamily}`;
  55300. ctx.fillStyle = color;
  55301. ctx.textAlign = textAlign;
  55302. ctx.textBaseline = textBaseline;
  55303. const contents = isArray$1(content) ? content : [content];
  55304. contents == null ? void 0 : contents.forEach((item, index) => {
  55305. ctx.fillText(item != null ? item : "", contentWidth / 2, index * (mergedFontSize + FontGap * ratio));
  55306. });
  55307. }
  55308. const angle = Math.PI / 180 * Number(rotate);
  55309. const maxSize = Math.max(width, height);
  55310. const [rCtx, rCanvas, realMaxSize] = prepareCanvas(maxSize, maxSize, ratio);
  55311. rCtx.translate(realMaxSize / 2, realMaxSize / 2);
  55312. rCtx.rotate(angle);
  55313. if (contentWidth > 0 && contentHeight > 0) {
  55314. rCtx.drawImage(canvas, -contentWidth / 2, -contentHeight / 2);
  55315. }
  55316. function getRotatePos(x, y) {
  55317. const targetX = x * Math.cos(angle) - y * Math.sin(angle);
  55318. const targetY = x * Math.sin(angle) + y * Math.cos(angle);
  55319. return [targetX, targetY];
  55320. }
  55321. let left = 0;
  55322. let right = 0;
  55323. let top = 0;
  55324. let bottom = 0;
  55325. const halfWidth = contentWidth / 2;
  55326. const halfHeight = contentHeight / 2;
  55327. const points = [
  55328. [0 - halfWidth, 0 - halfHeight],
  55329. [0 + halfWidth, 0 - halfHeight],
  55330. [0 + halfWidth, 0 + halfHeight],
  55331. [0 - halfWidth, 0 + halfHeight]
  55332. ];
  55333. points.forEach(([x, y]) => {
  55334. const [targetX, targetY] = getRotatePos(x, y);
  55335. left = Math.min(left, targetX);
  55336. right = Math.max(right, targetX);
  55337. top = Math.min(top, targetY);
  55338. bottom = Math.max(bottom, targetY);
  55339. });
  55340. const cutLeft = left + realMaxSize / 2;
  55341. const cutTop = top + realMaxSize / 2;
  55342. const cutWidth = right - left;
  55343. const cutHeight = bottom - top;
  55344. const realGapX = gapX * ratio;
  55345. const realGapY = gapY * ratio;
  55346. const filledWidth = (cutWidth + realGapX) * 2;
  55347. const filledHeight = cutHeight + realGapY;
  55348. const [fCtx, fCanvas] = prepareCanvas(filledWidth, filledHeight);
  55349. function drawImg(targetX = 0, targetY = 0) {
  55350. fCtx.drawImage(rCanvas, cutLeft, cutTop, cutWidth, cutHeight, targetX, targetY, cutWidth, cutHeight);
  55351. }
  55352. drawImg();
  55353. drawImg(cutWidth + realGapX, -cutHeight / 2 - realGapY / 2);
  55354. drawImg(cutWidth + realGapX, +cutHeight / 2 + realGapY / 2);
  55355. return [fCanvas.toDataURL(), filledWidth / ratio, filledHeight / ratio];
  55356. }
  55357. return getClips;
  55358. }
  55359. const __default__$b = defineComponent({
  55360. name: "ElWatermark"
  55361. });
  55362. const _sfc_main$c = /* @__PURE__ */ defineComponent({
  55363. ...__default__$b,
  55364. props: watermarkProps,
  55365. setup(__props) {
  55366. const props = __props;
  55367. const style = {
  55368. position: "relative"
  55369. };
  55370. const color = computed(() => {
  55371. var _a, _b;
  55372. return (_b = (_a = props.font) == null ? void 0 : _a.color) != null ? _b : "rgba(0,0,0,.15)";
  55373. });
  55374. const fontSize = computed(() => {
  55375. var _a, _b;
  55376. return (_b = (_a = props.font) == null ? void 0 : _a.fontSize) != null ? _b : 16;
  55377. });
  55378. const fontWeight = computed(() => {
  55379. var _a, _b;
  55380. return (_b = (_a = props.font) == null ? void 0 : _a.fontWeight) != null ? _b : "normal";
  55381. });
  55382. const fontStyle = computed(() => {
  55383. var _a, _b;
  55384. return (_b = (_a = props.font) == null ? void 0 : _a.fontStyle) != null ? _b : "normal";
  55385. });
  55386. const fontFamily = computed(() => {
  55387. var _a, _b;
  55388. return (_b = (_a = props.font) == null ? void 0 : _a.fontFamily) != null ? _b : "sans-serif";
  55389. });
  55390. const textAlign = computed(() => {
  55391. var _a, _b;
  55392. return (_b = (_a = props.font) == null ? void 0 : _a.textAlign) != null ? _b : "center";
  55393. });
  55394. const textBaseline = computed(() => {
  55395. var _a, _b;
  55396. return (_b = (_a = props.font) == null ? void 0 : _a.textBaseline) != null ? _b : "hanging";
  55397. });
  55398. const gapX = computed(() => props.gap[0]);
  55399. const gapY = computed(() => props.gap[1]);
  55400. const gapXCenter = computed(() => gapX.value / 2);
  55401. const gapYCenter = computed(() => gapY.value / 2);
  55402. const offsetLeft = computed(() => {
  55403. var _a, _b;
  55404. return (_b = (_a = props.offset) == null ? void 0 : _a[0]) != null ? _b : gapXCenter.value;
  55405. });
  55406. const offsetTop = computed(() => {
  55407. var _a, _b;
  55408. return (_b = (_a = props.offset) == null ? void 0 : _a[1]) != null ? _b : gapYCenter.value;
  55409. });
  55410. const getMarkStyle = () => {
  55411. const markStyle = {
  55412. zIndex: props.zIndex,
  55413. position: "absolute",
  55414. left: 0,
  55415. top: 0,
  55416. width: "100%",
  55417. height: "100%",
  55418. pointerEvents: "none",
  55419. backgroundRepeat: "repeat"
  55420. };
  55421. let positionLeft = offsetLeft.value - gapXCenter.value;
  55422. let positionTop = offsetTop.value - gapYCenter.value;
  55423. if (positionLeft > 0) {
  55424. markStyle.left = `${positionLeft}px`;
  55425. markStyle.width = `calc(100% - ${positionLeft}px)`;
  55426. positionLeft = 0;
  55427. }
  55428. if (positionTop > 0) {
  55429. markStyle.top = `${positionTop}px`;
  55430. markStyle.height = `calc(100% - ${positionTop}px)`;
  55431. positionTop = 0;
  55432. }
  55433. markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
  55434. return markStyle;
  55435. };
  55436. const containerRef = shallowRef(null);
  55437. const watermarkRef = shallowRef();
  55438. const stopObservation = ref(false);
  55439. const destroyWatermark = () => {
  55440. if (watermarkRef.value) {
  55441. watermarkRef.value.remove();
  55442. watermarkRef.value = void 0;
  55443. }
  55444. };
  55445. const appendWatermark = (base64Url, markWidth) => {
  55446. var _a;
  55447. if (containerRef.value && watermarkRef.value) {
  55448. stopObservation.value = true;
  55449. watermarkRef.value.setAttribute("style", getStyleStr({
  55450. ...getMarkStyle(),
  55451. backgroundImage: `url('${base64Url}')`,
  55452. backgroundSize: `${Math.floor(markWidth)}px`
  55453. }));
  55454. (_a = containerRef.value) == null ? void 0 : _a.append(watermarkRef.value);
  55455. setTimeout(() => {
  55456. stopObservation.value = false;
  55457. });
  55458. }
  55459. };
  55460. const getMarkSize = (ctx) => {
  55461. let defaultWidth = 120;
  55462. let defaultHeight = 64;
  55463. const image = props.image;
  55464. const content = props.content;
  55465. const width = props.width;
  55466. const height = props.height;
  55467. if (!image && ctx.measureText) {
  55468. ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
  55469. const contents = isArray$1(content) ? content : [content];
  55470. const sizes = contents.map((item) => {
  55471. const metrics = ctx.measureText(item);
  55472. return [
  55473. metrics.width,
  55474. metrics.fontBoundingBoxAscent !== void 0 ? metrics.fontBoundingBoxAscent + metrics.fontBoundingBoxDescent : metrics.actualBoundingBoxAscent + metrics.actualBoundingBoxDescent
  55475. ];
  55476. });
  55477. defaultWidth = Math.ceil(Math.max(...sizes.map((size) => size[0])));
  55478. defaultHeight = Math.ceil(Math.max(...sizes.map((size) => size[1]))) * contents.length + (contents.length - 1) * FontGap;
  55479. }
  55480. return [width != null ? width : defaultWidth, height != null ? height : defaultHeight];
  55481. };
  55482. const getClips = useClips();
  55483. const renderWatermark = () => {
  55484. const canvas = document.createElement("canvas");
  55485. const ctx = canvas.getContext("2d");
  55486. const image = props.image;
  55487. const content = props.content;
  55488. const rotate = props.rotate;
  55489. if (ctx) {
  55490. if (!watermarkRef.value) {
  55491. watermarkRef.value = document.createElement("div");
  55492. }
  55493. const ratio = getPixelRatio();
  55494. const [markWidth, markHeight] = getMarkSize(ctx);
  55495. const drawCanvas = (drawContent) => {
  55496. const [textClips, clipWidth] = getClips(drawContent || "", rotate, ratio, markWidth, markHeight, {
  55497. color: color.value,
  55498. fontSize: fontSize.value,
  55499. fontStyle: fontStyle.value,
  55500. fontWeight: fontWeight.value,
  55501. fontFamily: fontFamily.value,
  55502. textAlign: textAlign.value,
  55503. textBaseline: textBaseline.value
  55504. }, gapX.value, gapY.value);
  55505. appendWatermark(textClips, clipWidth);
  55506. };
  55507. if (image) {
  55508. const img = new Image();
  55509. img.onload = () => {
  55510. drawCanvas(img);
  55511. };
  55512. img.onerror = () => {
  55513. drawCanvas(content);
  55514. };
  55515. img.crossOrigin = "anonymous";
  55516. img.referrerPolicy = "no-referrer";
  55517. img.src = image;
  55518. } else {
  55519. drawCanvas(content);
  55520. }
  55521. }
  55522. };
  55523. onMounted(() => {
  55524. renderWatermark();
  55525. });
  55526. watch(() => props, () => {
  55527. renderWatermark();
  55528. }, {
  55529. deep: true,
  55530. flush: "post"
  55531. });
  55532. onBeforeUnmount(() => {
  55533. destroyWatermark();
  55534. });
  55535. const onMutate = (mutations) => {
  55536. if (stopObservation.value) {
  55537. return;
  55538. }
  55539. mutations.forEach((mutation) => {
  55540. if (reRendering(mutation, watermarkRef.value)) {
  55541. destroyWatermark();
  55542. renderWatermark();
  55543. }
  55544. });
  55545. };
  55546. useMutationObserver(containerRef, onMutate, {
  55547. attributes: true,
  55548. subtree: true,
  55549. childList: true
  55550. });
  55551. return (_ctx, _cache) => {
  55552. return openBlock(), createElementBlock("div", {
  55553. ref_key: "containerRef",
  55554. ref: containerRef,
  55555. style: normalizeStyle([style])
  55556. }, [
  55557. renderSlot(_ctx.$slots, "default")
  55558. ], 4);
  55559. };
  55560. }
  55561. });
  55562. var Watermark = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__file", "watermark.vue"]]);
  55563. const ElWatermark = withInstall(Watermark);
  55564. const maskProps = buildProps({
  55565. zIndex: {
  55566. type: Number,
  55567. default: 1001
  55568. },
  55569. visible: Boolean,
  55570. fill: {
  55571. type: String,
  55572. default: "rgba(0,0,0,0.5)"
  55573. },
  55574. pos: {
  55575. type: definePropType(Object)
  55576. },
  55577. targetAreaClickable: {
  55578. type: Boolean,
  55579. default: true
  55580. }
  55581. });
  55582. const useTarget = (target, open, gap, mergedMask, scrollIntoViewOptions) => {
  55583. const posInfo = ref(null);
  55584. const getTargetEl = () => {
  55585. let targetEl;
  55586. if (isString$1(target.value)) {
  55587. targetEl = document.querySelector(target.value);
  55588. } else if (isFunction$1(target.value)) {
  55589. targetEl = target.value();
  55590. } else {
  55591. targetEl = target.value;
  55592. }
  55593. return targetEl;
  55594. };
  55595. const updatePosInfo = () => {
  55596. const targetEl = getTargetEl();
  55597. if (!targetEl || !open.value) {
  55598. posInfo.value = null;
  55599. return;
  55600. }
  55601. if (!isInViewPort(targetEl)) {
  55602. targetEl.scrollIntoView(scrollIntoViewOptions.value);
  55603. }
  55604. const { left, top, width, height } = targetEl.getBoundingClientRect();
  55605. posInfo.value = {
  55606. left,
  55607. top,
  55608. width,
  55609. height,
  55610. radius: 0
  55611. };
  55612. };
  55613. onMounted(() => {
  55614. watch([open, target], () => {
  55615. updatePosInfo();
  55616. }, {
  55617. immediate: true
  55618. });
  55619. window.addEventListener("resize", updatePosInfo);
  55620. });
  55621. onBeforeUnmount(() => {
  55622. window.removeEventListener("resize", updatePosInfo);
  55623. });
  55624. const getGapOffset = (index) => {
  55625. var _a;
  55626. return (_a = isArray$1(gap.value.offset) ? gap.value.offset[index] : gap.value.offset) != null ? _a : 6;
  55627. };
  55628. const mergedPosInfo = computed(() => {
  55629. var _a;
  55630. if (!posInfo.value)
  55631. return posInfo.value;
  55632. const gapOffsetX = getGapOffset(0);
  55633. const gapOffsetY = getGapOffset(1);
  55634. const gapRadius = ((_a = gap.value) == null ? void 0 : _a.radius) || 2;
  55635. return {
  55636. left: posInfo.value.left - gapOffsetX,
  55637. top: posInfo.value.top - gapOffsetY,
  55638. width: posInfo.value.width + gapOffsetX * 2,
  55639. height: posInfo.value.height + gapOffsetY * 2,
  55640. radius: gapRadius
  55641. };
  55642. });
  55643. const triggerTarget = computed(() => {
  55644. const targetEl = getTargetEl();
  55645. if (!mergedMask.value || !targetEl || !window.DOMRect) {
  55646. return targetEl || void 0;
  55647. }
  55648. return {
  55649. getBoundingClientRect() {
  55650. var _a, _b, _c, _d;
  55651. return window.DOMRect.fromRect({
  55652. width: ((_a = mergedPosInfo.value) == null ? void 0 : _a.width) || 0,
  55653. height: ((_b = mergedPosInfo.value) == null ? void 0 : _b.height) || 0,
  55654. x: ((_c = mergedPosInfo.value) == null ? void 0 : _c.left) || 0,
  55655. y: ((_d = mergedPosInfo.value) == null ? void 0 : _d.top) || 0
  55656. });
  55657. }
  55658. };
  55659. });
  55660. return {
  55661. mergedPosInfo,
  55662. triggerTarget
  55663. };
  55664. };
  55665. const tourKey = Symbol("ElTour");
  55666. function isInViewPort(element) {
  55667. const viewWidth = window.innerWidth || document.documentElement.clientWidth;
  55668. const viewHeight = window.innerHeight || document.documentElement.clientHeight;
  55669. const { top, right, bottom, left } = element.getBoundingClientRect();
  55670. return top >= 0 && left >= 0 && right <= viewWidth && bottom <= viewHeight;
  55671. }
  55672. const useFloating = (referenceRef, contentRef, arrowRef, placement, strategy, offset$1, zIndex, showArrow) => {
  55673. const x = ref();
  55674. const y = ref();
  55675. const middlewareData = ref({});
  55676. const states = {
  55677. x,
  55678. y,
  55679. placement,
  55680. strategy,
  55681. middlewareData
  55682. };
  55683. const middleware = computed(() => {
  55684. const _middleware = [
  55685. offset(unref(offset$1)),
  55686. flip(),
  55687. shift(),
  55688. overflowMiddleware()
  55689. ];
  55690. if (unref(showArrow) && unref(arrowRef)) {
  55691. _middleware.push(arrow({
  55692. element: unref(arrowRef)
  55693. }));
  55694. }
  55695. return _middleware;
  55696. });
  55697. const update = async () => {
  55698. if (!isClient)
  55699. return;
  55700. const referenceEl = unref(referenceRef);
  55701. const contentEl = unref(contentRef);
  55702. if (!referenceEl || !contentEl)
  55703. return;
  55704. const data = await computePosition(referenceEl, contentEl, {
  55705. placement: unref(placement),
  55706. strategy: unref(strategy),
  55707. middleware: unref(middleware)
  55708. });
  55709. keysOf(states).forEach((key) => {
  55710. states[key].value = data[key];
  55711. });
  55712. };
  55713. const contentStyle = computed(() => {
  55714. if (!unref(referenceRef)) {
  55715. return {
  55716. position: "fixed",
  55717. top: "50%",
  55718. left: "50%",
  55719. transform: "translate3d(-50%, -50%, 0)",
  55720. maxWidth: "100vw",
  55721. zIndex: unref(zIndex)
  55722. };
  55723. }
  55724. const { overflow } = unref(middlewareData);
  55725. return {
  55726. position: unref(strategy),
  55727. zIndex: unref(zIndex),
  55728. top: unref(y) != null ? `${unref(y)}px` : "",
  55729. left: unref(x) != null ? `${unref(x)}px` : "",
  55730. maxWidth: (overflow == null ? void 0 : overflow.maxWidth) ? `${overflow == null ? void 0 : overflow.maxWidth}px` : ""
  55731. };
  55732. });
  55733. const arrowStyle = computed(() => {
  55734. if (!unref(showArrow))
  55735. return {};
  55736. const { arrow: arrow2 } = unref(middlewareData);
  55737. return {
  55738. left: (arrow2 == null ? void 0 : arrow2.x) != null ? `${arrow2 == null ? void 0 : arrow2.x}px` : "",
  55739. top: (arrow2 == null ? void 0 : arrow2.y) != null ? `${arrow2 == null ? void 0 : arrow2.y}px` : ""
  55740. };
  55741. });
  55742. let cleanup;
  55743. onMounted(() => {
  55744. const referenceEl = unref(referenceRef);
  55745. const contentEl = unref(contentRef);
  55746. if (referenceEl && contentEl) {
  55747. cleanup = autoUpdate(referenceEl, contentEl, update);
  55748. }
  55749. watchEffect(() => {
  55750. update();
  55751. });
  55752. });
  55753. onBeforeUnmount(() => {
  55754. cleanup && cleanup();
  55755. });
  55756. return {
  55757. update,
  55758. contentStyle,
  55759. arrowStyle
  55760. };
  55761. };
  55762. const overflowMiddleware = () => {
  55763. return {
  55764. name: "overflow",
  55765. async fn(state) {
  55766. const overflow = await detectOverflow(state);
  55767. let overWidth = 0;
  55768. if (overflow.left > 0)
  55769. overWidth = overflow.left;
  55770. if (overflow.right > 0)
  55771. overWidth = overflow.right;
  55772. const floatingWidth = state.rects.floating.width;
  55773. return {
  55774. data: {
  55775. maxWidth: floatingWidth - overWidth
  55776. }
  55777. };
  55778. }
  55779. };
  55780. };
  55781. const __default__$a = defineComponent({
  55782. name: "ElTourMask",
  55783. inheritAttrs: false
  55784. });
  55785. const _sfc_main$b = /* @__PURE__ */ defineComponent({
  55786. ...__default__$a,
  55787. props: maskProps,
  55788. setup(__props) {
  55789. const props = __props;
  55790. const { ns } = inject(tourKey);
  55791. const radius = computed(() => {
  55792. var _a, _b;
  55793. return (_b = (_a = props.pos) == null ? void 0 : _a.radius) != null ? _b : 2;
  55794. });
  55795. const roundInfo = computed(() => {
  55796. const v = radius.value;
  55797. const baseInfo = `a${v},${v} 0 0 1`;
  55798. return {
  55799. topRight: `${baseInfo} ${v},${v}`,
  55800. bottomRight: `${baseInfo} ${-v},${v}`,
  55801. bottomLeft: `${baseInfo} ${-v},${-v}`,
  55802. topLeft: `${baseInfo} ${v},${-v}`
  55803. };
  55804. });
  55805. const path = computed(() => {
  55806. const width = window.innerWidth;
  55807. const height = window.innerHeight;
  55808. const info = roundInfo.value;
  55809. const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`;
  55810. const _radius = radius.value;
  55811. 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;
  55812. });
  55813. const pathStyle = computed(() => {
  55814. return {
  55815. fill: props.fill,
  55816. pointerEvents: "auto",
  55817. cursor: "auto"
  55818. };
  55819. });
  55820. useLockscreen(toRef(props, "visible"), {
  55821. ns
  55822. });
  55823. return (_ctx, _cache) => {
  55824. return _ctx.visible ? (openBlock(), createElementBlock("div", mergeProps({
  55825. key: 0,
  55826. class: unref(ns).e("mask"),
  55827. style: {
  55828. position: "fixed",
  55829. left: 0,
  55830. right: 0,
  55831. top: 0,
  55832. bottom: 0,
  55833. zIndex: _ctx.zIndex,
  55834. pointerEvents: _ctx.pos && _ctx.targetAreaClickable ? "none" : "auto"
  55835. }
  55836. }, _ctx.$attrs), [
  55837. (openBlock(), createElementBlock("svg", { style: {
  55838. width: "100%",
  55839. height: "100%"
  55840. } }, [
  55841. createElementVNode("path", {
  55842. class: normalizeClass(unref(ns).e("hollow")),
  55843. style: normalizeStyle(unref(pathStyle)),
  55844. d: unref(path)
  55845. }, null, 14, ["d"])
  55846. ]))
  55847. ], 16)) : createCommentVNode("v-if", true);
  55848. };
  55849. }
  55850. });
  55851. var ElTourMask = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__file", "mask.vue"]]);
  55852. const tourStrategies = ["absolute", "fixed"];
  55853. const tourPlacements = [
  55854. "top-start",
  55855. "top-end",
  55856. "top",
  55857. "bottom-start",
  55858. "bottom-end",
  55859. "bottom",
  55860. "left-start",
  55861. "left-end",
  55862. "left",
  55863. "right-start",
  55864. "right-end",
  55865. "right"
  55866. ];
  55867. const tourContentProps = buildProps({
  55868. placement: {
  55869. type: definePropType(String),
  55870. values: tourPlacements,
  55871. default: "bottom"
  55872. },
  55873. reference: {
  55874. type: definePropType(Object),
  55875. default: null
  55876. },
  55877. strategy: {
  55878. type: definePropType(String),
  55879. values: tourStrategies,
  55880. default: "absolute"
  55881. },
  55882. offset: {
  55883. type: Number,
  55884. default: 10
  55885. },
  55886. showArrow: Boolean,
  55887. zIndex: {
  55888. type: Number,
  55889. default: 2001
  55890. }
  55891. });
  55892. const tourContentEmits = {
  55893. close: () => true
  55894. };
  55895. const __default__$9 = defineComponent({
  55896. name: "ElTourContent"
  55897. });
  55898. const _sfc_main$a = /* @__PURE__ */ defineComponent({
  55899. ...__default__$9,
  55900. props: tourContentProps,
  55901. emits: tourContentEmits,
  55902. setup(__props, { emit }) {
  55903. const props = __props;
  55904. const placement = ref(props.placement);
  55905. const strategy = ref(props.strategy);
  55906. const contentRef = ref(null);
  55907. const arrowRef = ref(null);
  55908. watch(() => props.placement, () => {
  55909. placement.value = props.placement;
  55910. });
  55911. const { contentStyle, arrowStyle } = useFloating(toRef(props, "reference"), contentRef, arrowRef, placement, strategy, toRef(props, "offset"), toRef(props, "zIndex"), toRef(props, "showArrow"));
  55912. const side = computed(() => {
  55913. return placement.value.split("-")[0];
  55914. });
  55915. const { ns } = inject(tourKey);
  55916. const onCloseRequested = () => {
  55917. emit("close");
  55918. };
  55919. const onFocusoutPrevented = (event) => {
  55920. if (event.detail.focusReason === "pointer") {
  55921. event.preventDefault();
  55922. }
  55923. };
  55924. return (_ctx, _cache) => {
  55925. return openBlock(), createElementBlock("div", {
  55926. ref_key: "contentRef",
  55927. ref: contentRef,
  55928. style: normalizeStyle(unref(contentStyle)),
  55929. class: normalizeClass(unref(ns).e("content")),
  55930. "data-side": unref(side),
  55931. tabindex: "-1"
  55932. }, [
  55933. createVNode(unref(ElFocusTrap), {
  55934. loop: "",
  55935. trapped: "",
  55936. "focus-start-el": "container",
  55937. "focus-trap-el": contentRef.value || void 0,
  55938. onReleaseRequested: onCloseRequested,
  55939. onFocusoutPrevented
  55940. }, {
  55941. default: withCtx(() => [
  55942. renderSlot(_ctx.$slots, "default")
  55943. ]),
  55944. _: 3
  55945. }, 8, ["focus-trap-el"]),
  55946. _ctx.showArrow ? (openBlock(), createElementBlock("span", {
  55947. key: 0,
  55948. ref_key: "arrowRef",
  55949. ref: arrowRef,
  55950. style: normalizeStyle(unref(arrowStyle)),
  55951. class: normalizeClass(unref(ns).e("arrow"))
  55952. }, null, 6)) : createCommentVNode("v-if", true)
  55953. ], 14, ["data-side"]);
  55954. };
  55955. }
  55956. });
  55957. var ElTourContent = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__file", "content.vue"]]);
  55958. var ElTourSteps = defineComponent({
  55959. name: "ElTourSteps",
  55960. props: {
  55961. current: {
  55962. type: Number,
  55963. default: 0
  55964. }
  55965. },
  55966. emits: ["update-total"],
  55967. setup(props, { slots, emit }) {
  55968. let cacheTotal = 0;
  55969. return () => {
  55970. var _a, _b;
  55971. const children = (_a = slots.default) == null ? void 0 : _a.call(slots);
  55972. const result = [];
  55973. let total = 0;
  55974. function filterSteps(children2) {
  55975. if (!isArray$1(children2))
  55976. return;
  55977. children2.forEach((item) => {
  55978. var _a2;
  55979. const name = (_a2 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a2.name;
  55980. if (name === "ElTourStep") {
  55981. result.push(item);
  55982. total += 1;
  55983. }
  55984. });
  55985. }
  55986. if (children.length) {
  55987. filterSteps(flattedChildren((_b = children[0]) == null ? void 0 : _b.children));
  55988. }
  55989. if (cacheTotal !== total) {
  55990. cacheTotal = total;
  55991. emit("update-total", total);
  55992. }
  55993. if (result.length) {
  55994. return result[props.current];
  55995. }
  55996. return null;
  55997. };
  55998. }
  55999. });
  56000. const tourProps = buildProps({
  56001. modelValue: Boolean,
  56002. current: {
  56003. type: Number,
  56004. default: 0
  56005. },
  56006. showArrow: {
  56007. type: Boolean,
  56008. default: true
  56009. },
  56010. showClose: {
  56011. type: Boolean,
  56012. default: true
  56013. },
  56014. closeIcon: {
  56015. type: iconPropType
  56016. },
  56017. placement: tourContentProps.placement,
  56018. contentStyle: {
  56019. type: definePropType([Object])
  56020. },
  56021. mask: {
  56022. type: definePropType([Boolean, Object]),
  56023. default: true
  56024. },
  56025. gap: {
  56026. type: definePropType(Object),
  56027. default: () => ({
  56028. offset: 6,
  56029. radius: 2
  56030. })
  56031. },
  56032. zIndex: {
  56033. type: Number
  56034. },
  56035. scrollIntoViewOptions: {
  56036. type: definePropType([Boolean, Object]),
  56037. default: () => ({
  56038. block: "center"
  56039. })
  56040. },
  56041. type: {
  56042. type: definePropType(String)
  56043. },
  56044. appendTo: {
  56045. type: definePropType([String, Object]),
  56046. default: "body"
  56047. },
  56048. closeOnPressEscape: {
  56049. type: Boolean,
  56050. default: true
  56051. },
  56052. targetAreaClickable: {
  56053. type: Boolean,
  56054. default: true
  56055. }
  56056. });
  56057. const tourEmits = {
  56058. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  56059. ["update:current"]: (current) => isNumber(current),
  56060. close: (current) => isNumber(current),
  56061. finish: () => true,
  56062. change: (current) => isNumber(current)
  56063. };
  56064. const __default__$8 = defineComponent({
  56065. name: "ElTour"
  56066. });
  56067. const _sfc_main$9 = /* @__PURE__ */ defineComponent({
  56068. ...__default__$8,
  56069. props: tourProps,
  56070. emits: tourEmits,
  56071. setup(__props, { emit }) {
  56072. const props = __props;
  56073. const ns = useNamespace("tour");
  56074. const total = ref(0);
  56075. const currentStep = ref();
  56076. const current = useVModel(props, "current", emit, {
  56077. passive: true
  56078. });
  56079. const currentTarget = computed(() => {
  56080. var _a;
  56081. return (_a = currentStep.value) == null ? void 0 : _a.target;
  56082. });
  56083. const kls = computed(() => [
  56084. ns.b(),
  56085. mergedType.value === "primary" ? ns.m("primary") : ""
  56086. ]);
  56087. const mergedPlacement = computed(() => {
  56088. var _a;
  56089. return ((_a = currentStep.value) == null ? void 0 : _a.placement) || props.placement;
  56090. });
  56091. const mergedContentStyle = computed(() => {
  56092. var _a, _b;
  56093. return (_b = (_a = currentStep.value) == null ? void 0 : _a.contentStyle) != null ? _b : props.contentStyle;
  56094. });
  56095. const mergedMask = computed(() => {
  56096. var _a, _b;
  56097. return (_b = (_a = currentStep.value) == null ? void 0 : _a.mask) != null ? _b : props.mask;
  56098. });
  56099. const mergedShowMask = computed(() => !!mergedMask.value && props.modelValue);
  56100. const mergedMaskStyle = computed(() => isBoolean(mergedMask.value) ? void 0 : mergedMask.value);
  56101. const mergedShowArrow = computed(() => {
  56102. var _a, _b;
  56103. return !!currentTarget.value && ((_b = (_a = currentStep.value) == null ? void 0 : _a.showArrow) != null ? _b : props.showArrow);
  56104. });
  56105. const mergedScrollIntoViewOptions = computed(() => {
  56106. var _a, _b;
  56107. return (_b = (_a = currentStep.value) == null ? void 0 : _a.scrollIntoViewOptions) != null ? _b : props.scrollIntoViewOptions;
  56108. });
  56109. const mergedType = computed(() => {
  56110. var _a, _b;
  56111. return (_b = (_a = currentStep.value) == null ? void 0 : _a.type) != null ? _b : props.type;
  56112. });
  56113. const { nextZIndex } = useZIndex();
  56114. const nowZIndex = nextZIndex();
  56115. const mergedZIndex = computed(() => {
  56116. var _a;
  56117. return (_a = props.zIndex) != null ? _a : nowZIndex;
  56118. });
  56119. const { mergedPosInfo: pos, triggerTarget } = useTarget(currentTarget, toRef(props, "modelValue"), toRef(props, "gap"), mergedMask, mergedScrollIntoViewOptions);
  56120. watch(() => props.modelValue, (val) => {
  56121. if (!val) {
  56122. current.value = 0;
  56123. }
  56124. });
  56125. const onEscClose = () => {
  56126. if (props.closeOnPressEscape) {
  56127. emit("update:modelValue", false);
  56128. emit("close", current.value);
  56129. }
  56130. };
  56131. const onUpdateTotal = (val) => {
  56132. total.value = val;
  56133. };
  56134. const slots = useSlots();
  56135. provide(tourKey, {
  56136. currentStep,
  56137. current,
  56138. total,
  56139. showClose: toRef(props, "showClose"),
  56140. closeIcon: toRef(props, "closeIcon"),
  56141. mergedType,
  56142. ns,
  56143. slots,
  56144. updateModelValue(modelValue) {
  56145. emit("update:modelValue", modelValue);
  56146. },
  56147. onClose() {
  56148. emit("close", current.value);
  56149. },
  56150. onFinish() {
  56151. emit("finish");
  56152. },
  56153. onChange() {
  56154. emit("change", current.value);
  56155. }
  56156. });
  56157. return (_ctx, _cache) => {
  56158. return openBlock(), createElementBlock(Fragment, null, [
  56159. createVNode(unref(ElTeleport$1), { to: _ctx.appendTo }, {
  56160. default: withCtx(() => {
  56161. var _a, _b;
  56162. return [
  56163. createElementVNode("div", mergeProps({ class: unref(kls) }, _ctx.$attrs), [
  56164. createVNode(ElTourMask, {
  56165. visible: unref(mergedShowMask),
  56166. fill: (_a = unref(mergedMaskStyle)) == null ? void 0 : _a.color,
  56167. style: normalizeStyle((_b = unref(mergedMaskStyle)) == null ? void 0 : _b.style),
  56168. pos: unref(pos),
  56169. "z-index": unref(mergedZIndex),
  56170. "target-area-clickable": _ctx.targetAreaClickable
  56171. }, null, 8, ["visible", "fill", "style", "pos", "z-index", "target-area-clickable"]),
  56172. _ctx.modelValue ? (openBlock(), createBlock(ElTourContent, {
  56173. key: unref(current),
  56174. reference: unref(triggerTarget),
  56175. placement: unref(mergedPlacement),
  56176. "show-arrow": unref(mergedShowArrow),
  56177. "z-index": unref(mergedZIndex),
  56178. style: normalizeStyle(unref(mergedContentStyle)),
  56179. onClose: onEscClose
  56180. }, {
  56181. default: withCtx(() => [
  56182. createVNode(unref(ElTourSteps), {
  56183. current: unref(current),
  56184. onUpdateTotal
  56185. }, {
  56186. default: withCtx(() => [
  56187. renderSlot(_ctx.$slots, "default")
  56188. ]),
  56189. _: 3
  56190. }, 8, ["current"])
  56191. ]),
  56192. _: 3
  56193. }, 8, ["reference", "placement", "show-arrow", "z-index", "style"])) : createCommentVNode("v-if", true)
  56194. ], 16)
  56195. ];
  56196. }),
  56197. _: 3
  56198. }, 8, ["to"]),
  56199. createCommentVNode(" just for IDE "),
  56200. createCommentVNode("v-if", true)
  56201. ], 64);
  56202. };
  56203. }
  56204. });
  56205. var Tour = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "tour.vue"]]);
  56206. const tourStepProps = buildProps({
  56207. target: {
  56208. type: definePropType([String, Object, Function])
  56209. },
  56210. title: String,
  56211. description: String,
  56212. showClose: {
  56213. type: Boolean,
  56214. default: void 0
  56215. },
  56216. closeIcon: {
  56217. type: iconPropType
  56218. },
  56219. showArrow: {
  56220. type: Boolean,
  56221. default: void 0
  56222. },
  56223. placement: tourContentProps.placement,
  56224. mask: {
  56225. type: definePropType([Boolean, Object]),
  56226. default: void 0
  56227. },
  56228. contentStyle: {
  56229. type: definePropType([Object])
  56230. },
  56231. prevButtonProps: {
  56232. type: definePropType(Object)
  56233. },
  56234. nextButtonProps: {
  56235. type: definePropType(Object)
  56236. },
  56237. scrollIntoViewOptions: {
  56238. type: definePropType([Boolean, Object]),
  56239. default: void 0
  56240. },
  56241. type: {
  56242. type: definePropType(String)
  56243. }
  56244. });
  56245. const tourStepEmits = {
  56246. close: () => true
  56247. };
  56248. const __default__$7 = defineComponent({
  56249. name: "ElTourStep"
  56250. });
  56251. const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  56252. ...__default__$7,
  56253. props: tourStepProps,
  56254. emits: tourStepEmits,
  56255. setup(__props, { emit }) {
  56256. const props = __props;
  56257. const { Close } = CloseComponents;
  56258. const { t } = useLocale();
  56259. const {
  56260. currentStep,
  56261. current,
  56262. total,
  56263. showClose,
  56264. closeIcon,
  56265. mergedType,
  56266. ns,
  56267. slots: tourSlots,
  56268. updateModelValue,
  56269. onClose: tourOnClose,
  56270. onFinish: tourOnFinish,
  56271. onChange
  56272. } = inject(tourKey);
  56273. watch(props, (val) => {
  56274. currentStep.value = val;
  56275. }, {
  56276. immediate: true
  56277. });
  56278. const mergedShowClose = computed(() => {
  56279. var _a;
  56280. return (_a = props.showClose) != null ? _a : showClose.value;
  56281. });
  56282. const mergedCloseIcon = computed(() => {
  56283. var _a, _b;
  56284. return (_b = (_a = props.closeIcon) != null ? _a : closeIcon.value) != null ? _b : Close;
  56285. });
  56286. const filterButtonProps = (btnProps) => {
  56287. if (!btnProps)
  56288. return;
  56289. return omit(btnProps, ["children", "onClick"]);
  56290. };
  56291. const onPrev = () => {
  56292. var _a, _b;
  56293. current.value -= 1;
  56294. if ((_a = props.prevButtonProps) == null ? void 0 : _a.onClick) {
  56295. (_b = props.prevButtonProps) == null ? void 0 : _b.onClick();
  56296. }
  56297. onChange();
  56298. };
  56299. const onNext = () => {
  56300. var _a;
  56301. if (current.value >= total.value - 1) {
  56302. onFinish();
  56303. } else {
  56304. current.value += 1;
  56305. }
  56306. if ((_a = props.nextButtonProps) == null ? void 0 : _a.onClick) {
  56307. props.nextButtonProps.onClick();
  56308. }
  56309. onChange();
  56310. };
  56311. const onFinish = () => {
  56312. onClose();
  56313. tourOnFinish();
  56314. };
  56315. const onClose = () => {
  56316. updateModelValue(false);
  56317. tourOnClose();
  56318. emit("close");
  56319. };
  56320. return (_ctx, _cache) => {
  56321. return openBlock(), createElementBlock(Fragment, null, [
  56322. unref(mergedShowClose) ? (openBlock(), createElementBlock("button", {
  56323. key: 0,
  56324. "aria-label": "Close",
  56325. class: normalizeClass(unref(ns).e("closebtn")),
  56326. type: "button",
  56327. onClick: onClose
  56328. }, [
  56329. createVNode(unref(ElIcon), {
  56330. class: normalizeClass(unref(ns).e("close"))
  56331. }, {
  56332. default: withCtx(() => [
  56333. (openBlock(), createBlock(resolveDynamicComponent(unref(mergedCloseIcon))))
  56334. ]),
  56335. _: 1
  56336. }, 8, ["class"])
  56337. ], 2)) : createCommentVNode("v-if", true),
  56338. createElementVNode("header", {
  56339. class: normalizeClass([unref(ns).e("header"), { "show-close": unref(showClose) }])
  56340. }, [
  56341. renderSlot(_ctx.$slots, "header", {}, () => [
  56342. createElementVNode("span", {
  56343. role: "heading",
  56344. class: normalizeClass(unref(ns).e("title"))
  56345. }, toDisplayString(_ctx.title), 3)
  56346. ])
  56347. ], 2),
  56348. createElementVNode("div", {
  56349. class: normalizeClass(unref(ns).e("body"))
  56350. }, [
  56351. renderSlot(_ctx.$slots, "default", {}, () => [
  56352. createElementVNode("span", null, toDisplayString(_ctx.description), 1)
  56353. ])
  56354. ], 2),
  56355. createElementVNode("footer", {
  56356. class: normalizeClass(unref(ns).e("footer"))
  56357. }, [
  56358. createElementVNode("div", {
  56359. class: normalizeClass(unref(ns).b("indicators"))
  56360. }, [
  56361. unref(tourSlots).indicators ? (openBlock(), createBlock(resolveDynamicComponent(unref(tourSlots).indicators), {
  56362. key: 0,
  56363. current: unref(current),
  56364. total: unref(total)
  56365. }, null, 8, ["current", "total"])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(total), (item, index) => {
  56366. return openBlock(), createElementBlock("span", {
  56367. key: item,
  56368. class: normalizeClass([unref(ns).b("indicator"), index === unref(current) ? "is-active" : ""])
  56369. }, null, 2);
  56370. }), 128))
  56371. ], 2),
  56372. createElementVNode("div", {
  56373. class: normalizeClass(unref(ns).b("buttons"))
  56374. }, [
  56375. unref(current) > 0 ? (openBlock(), createBlock(unref(ElButton), mergeProps({
  56376. key: 0,
  56377. size: "small",
  56378. type: unref(mergedType)
  56379. }, filterButtonProps(_ctx.prevButtonProps), { onClick: onPrev }), {
  56380. default: withCtx(() => {
  56381. var _a, _b;
  56382. return [
  56383. createTextVNode(toDisplayString((_b = (_a = _ctx.prevButtonProps) == null ? void 0 : _a.children) != null ? _b : unref(t)("el.tour.previous")), 1)
  56384. ];
  56385. }),
  56386. _: 1
  56387. }, 16, ["type"])) : createCommentVNode("v-if", true),
  56388. unref(current) <= unref(total) - 1 ? (openBlock(), createBlock(unref(ElButton), mergeProps({
  56389. key: 1,
  56390. size: "small",
  56391. type: unref(mergedType) === "primary" ? "default" : "primary"
  56392. }, filterButtonProps(_ctx.nextButtonProps), { onClick: onNext }), {
  56393. default: withCtx(() => {
  56394. var _a, _b;
  56395. return [
  56396. 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)
  56397. ];
  56398. }),
  56399. _: 1
  56400. }, 16, ["type"])) : createCommentVNode("v-if", true)
  56401. ], 2)
  56402. ], 2)
  56403. ], 64);
  56404. };
  56405. }
  56406. });
  56407. var TourStep = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "step.vue"]]);
  56408. const ElTour = withInstall(Tour, {
  56409. TourStep
  56410. });
  56411. const ElTourStep = withNoopInstall(TourStep);
  56412. const anchorProps = buildProps({
  56413. container: {
  56414. type: definePropType([
  56415. String,
  56416. Object
  56417. ])
  56418. },
  56419. offset: {
  56420. type: Number,
  56421. default: 0
  56422. },
  56423. bound: {
  56424. type: Number,
  56425. default: 15
  56426. },
  56427. duration: {
  56428. type: Number,
  56429. default: 300
  56430. },
  56431. marker: {
  56432. type: Boolean,
  56433. default: true
  56434. },
  56435. type: {
  56436. type: definePropType(String),
  56437. default: "default"
  56438. },
  56439. direction: {
  56440. type: definePropType(String),
  56441. default: "vertical"
  56442. }
  56443. });
  56444. const anchorEmits = {
  56445. change: (href) => isString$1(href),
  56446. click: (e, href) => e instanceof MouseEvent && (isString$1(href) || isUndefined(href))
  56447. };
  56448. const anchorKey = Symbol("anchor");
  56449. const __default__$6 = defineComponent({
  56450. name: "ElAnchor"
  56451. });
  56452. const _sfc_main$7 = /* @__PURE__ */ defineComponent({
  56453. ...__default__$6,
  56454. props: anchorProps,
  56455. emits: anchorEmits,
  56456. setup(__props, { expose, emit }) {
  56457. const props = __props;
  56458. const currentAnchor = ref("");
  56459. const anchorRef = ref(null);
  56460. const markerRef = ref(null);
  56461. const containerEl = ref();
  56462. const links = {};
  56463. let isScrolling = false;
  56464. let currentScrollTop = 0;
  56465. const ns = useNamespace("anchor");
  56466. const cls = computed(() => [
  56467. ns.b(),
  56468. props.type === "underline" ? ns.m("underline") : "",
  56469. ns.m(props.direction)
  56470. ]);
  56471. const addLink = (state) => {
  56472. links[state.href] = state.el;
  56473. };
  56474. const removeLink = (href) => {
  56475. delete links[href];
  56476. };
  56477. const setCurrentAnchor = (href) => {
  56478. const activeHref = currentAnchor.value;
  56479. if (activeHref !== href) {
  56480. currentAnchor.value = href;
  56481. emit("change", href);
  56482. }
  56483. };
  56484. let clearAnimate = null;
  56485. const scrollToAnchor = (href) => {
  56486. if (!containerEl.value)
  56487. return;
  56488. const target = getElement(href);
  56489. if (!target)
  56490. return;
  56491. if (clearAnimate)
  56492. clearAnimate();
  56493. isScrolling = true;
  56494. const scrollEle = getScrollElement(target, containerEl.value);
  56495. const distance = getOffsetTopDistance(target, scrollEle);
  56496. const max = scrollEle.scrollHeight - scrollEle.clientHeight;
  56497. const to = Math.min(distance - props.offset, max);
  56498. clearAnimate = animateScrollTo(containerEl.value, currentScrollTop, to, props.duration, () => {
  56499. setTimeout(() => {
  56500. isScrolling = false;
  56501. }, 20);
  56502. });
  56503. };
  56504. const scrollTo = (href) => {
  56505. if (href) {
  56506. setCurrentAnchor(href);
  56507. scrollToAnchor(href);
  56508. }
  56509. };
  56510. const handleClick = (e, href) => {
  56511. emit("click", e, href);
  56512. scrollTo(href);
  56513. };
  56514. const handleScroll = throttleByRaf(() => {
  56515. if (containerEl.value) {
  56516. currentScrollTop = getScrollTop(containerEl.value);
  56517. }
  56518. const currentHref = getCurrentHref();
  56519. if (isScrolling || isUndefined(currentHref))
  56520. return;
  56521. setCurrentAnchor(currentHref);
  56522. });
  56523. const getCurrentHref = () => {
  56524. if (!containerEl.value)
  56525. return;
  56526. const scrollTop = getScrollTop(containerEl.value);
  56527. const anchorTopList = [];
  56528. for (const href of Object.keys(links)) {
  56529. const target = getElement(href);
  56530. if (!target)
  56531. continue;
  56532. const scrollEle = getScrollElement(target, containerEl.value);
  56533. const distance = getOffsetTopDistance(target, scrollEle);
  56534. anchorTopList.push({
  56535. top: distance - props.offset - props.bound,
  56536. href
  56537. });
  56538. }
  56539. anchorTopList.sort((prev, next) => prev.top - next.top);
  56540. for (let i = 0; i < anchorTopList.length; i++) {
  56541. const item = anchorTopList[i];
  56542. const next = anchorTopList[i + 1];
  56543. if (i === 0 && scrollTop === 0) {
  56544. return "";
  56545. }
  56546. if (item.top <= scrollTop && (!next || next.top > scrollTop)) {
  56547. return item.href;
  56548. }
  56549. }
  56550. };
  56551. const getContainer = () => {
  56552. const el = getElement(props.container);
  56553. if (!el || isWindow$1(el)) {
  56554. containerEl.value = window;
  56555. } else {
  56556. containerEl.value = el;
  56557. }
  56558. };
  56559. useEventListener(containerEl, "scroll", handleScroll);
  56560. const markerStyle = computed(() => {
  56561. if (!anchorRef.value || !markerRef.value || !currentAnchor.value)
  56562. return {};
  56563. const currentLinkEl = links[currentAnchor.value];
  56564. if (!currentLinkEl)
  56565. return {};
  56566. const anchorRect = anchorRef.value.getBoundingClientRect();
  56567. const markerRect = markerRef.value.getBoundingClientRect();
  56568. const linkRect = currentLinkEl.getBoundingClientRect();
  56569. if (props.direction === "horizontal") {
  56570. const left = linkRect.left - anchorRect.left;
  56571. return {
  56572. left: `${left}px`,
  56573. width: `${linkRect.width}px`,
  56574. opacity: 1
  56575. };
  56576. } else {
  56577. const top = linkRect.top - anchorRect.top + (linkRect.height - markerRect.height) / 2;
  56578. return {
  56579. top: `${top}px`,
  56580. opacity: 1
  56581. };
  56582. }
  56583. });
  56584. onMounted(() => {
  56585. getContainer();
  56586. const hash = decodeURIComponent(window.location.hash);
  56587. const target = getElement(hash);
  56588. if (target) {
  56589. scrollTo(hash);
  56590. } else {
  56591. handleScroll();
  56592. }
  56593. });
  56594. watch(() => props.container, () => {
  56595. getContainer();
  56596. });
  56597. provide(anchorKey, {
  56598. ns,
  56599. direction: props.direction,
  56600. currentAnchor,
  56601. addLink,
  56602. removeLink,
  56603. handleClick
  56604. });
  56605. expose({
  56606. scrollTo
  56607. });
  56608. return (_ctx, _cache) => {
  56609. return openBlock(), createElementBlock("div", {
  56610. ref_key: "anchorRef",
  56611. ref: anchorRef,
  56612. class: normalizeClass(unref(cls))
  56613. }, [
  56614. _ctx.marker ? (openBlock(), createElementBlock("div", {
  56615. key: 0,
  56616. ref_key: "markerRef",
  56617. ref: markerRef,
  56618. class: normalizeClass(unref(ns).e("marker")),
  56619. style: normalizeStyle(unref(markerStyle))
  56620. }, null, 6)) : createCommentVNode("v-if", true),
  56621. createElementVNode("div", {
  56622. class: normalizeClass(unref(ns).e("list"))
  56623. }, [
  56624. renderSlot(_ctx.$slots, "default")
  56625. ], 2)
  56626. ], 2);
  56627. };
  56628. }
  56629. });
  56630. var Anchor = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "anchor.vue"]]);
  56631. const anchorLinkProps = buildProps({
  56632. title: String,
  56633. href: String
  56634. });
  56635. const __default__$5 = defineComponent({
  56636. name: "ElAnchorLink"
  56637. });
  56638. const _sfc_main$6 = /* @__PURE__ */ defineComponent({
  56639. ...__default__$5,
  56640. props: anchorLinkProps,
  56641. setup(__props) {
  56642. const props = __props;
  56643. const linkRef = ref(null);
  56644. const {
  56645. ns,
  56646. direction,
  56647. currentAnchor,
  56648. addLink,
  56649. removeLink,
  56650. handleClick: contextHandleClick
  56651. } = inject(anchorKey);
  56652. const cls = computed(() => [
  56653. ns.e("link"),
  56654. ns.is("active", currentAnchor.value === props.href)
  56655. ]);
  56656. const handleClick = (e) => {
  56657. contextHandleClick(e, props.href);
  56658. };
  56659. watch(() => props.href, (val, oldVal) => {
  56660. nextTick(() => {
  56661. if (oldVal)
  56662. removeLink(oldVal);
  56663. if (val) {
  56664. addLink({
  56665. href: val,
  56666. el: linkRef.value
  56667. });
  56668. }
  56669. });
  56670. });
  56671. onMounted(() => {
  56672. const { href } = props;
  56673. if (href) {
  56674. addLink({
  56675. href,
  56676. el: linkRef.value
  56677. });
  56678. }
  56679. });
  56680. onBeforeUnmount(() => {
  56681. const { href } = props;
  56682. if (href) {
  56683. removeLink(href);
  56684. }
  56685. });
  56686. return (_ctx, _cache) => {
  56687. return openBlock(), createElementBlock("div", {
  56688. class: normalizeClass(unref(ns).e("item"))
  56689. }, [
  56690. createElementVNode("a", {
  56691. ref_key: "linkRef",
  56692. ref: linkRef,
  56693. class: normalizeClass(unref(cls)),
  56694. href: _ctx.href,
  56695. onClick: handleClick
  56696. }, [
  56697. renderSlot(_ctx.$slots, "default", {}, () => [
  56698. createTextVNode(toDisplayString(_ctx.title), 1)
  56699. ])
  56700. ], 10, ["href"]),
  56701. _ctx.$slots["sub-link"] && unref(direction) === "vertical" ? (openBlock(), createElementBlock("div", {
  56702. key: 0,
  56703. class: normalizeClass(unref(ns).e("list"))
  56704. }, [
  56705. renderSlot(_ctx.$slots, "sub-link")
  56706. ], 2)) : createCommentVNode("v-if", true)
  56707. ], 2);
  56708. };
  56709. }
  56710. });
  56711. var AnchorLink = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "anchor-link.vue"]]);
  56712. const ElAnchor = withInstall(Anchor, {
  56713. AnchorLink
  56714. });
  56715. const ElAnchorLink = withNoopInstall(AnchorLink);
  56716. const segmentedProps = buildProps({
  56717. direction: {
  56718. type: definePropType(String),
  56719. default: "horizontal"
  56720. },
  56721. options: {
  56722. type: definePropType(Array),
  56723. default: () => []
  56724. },
  56725. modelValue: {
  56726. type: [String, Number, Boolean],
  56727. default: void 0
  56728. },
  56729. block: Boolean,
  56730. size: useSizeProp,
  56731. disabled: Boolean,
  56732. validateEvent: {
  56733. type: Boolean,
  56734. default: true
  56735. },
  56736. id: String,
  56737. name: String,
  56738. ...useAriaProps(["ariaLabel"])
  56739. });
  56740. const segmentedEmits = {
  56741. [UPDATE_MODEL_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val),
  56742. [CHANGE_EVENT]: (val) => isString$1(val) || isNumber(val) || isBoolean(val)
  56743. };
  56744. const __default__$4 = defineComponent({
  56745. name: "ElSegmented"
  56746. });
  56747. const _sfc_main$5 = /* @__PURE__ */ defineComponent({
  56748. ...__default__$4,
  56749. props: segmentedProps,
  56750. emits: segmentedEmits,
  56751. setup(__props, { emit }) {
  56752. const props = __props;
  56753. const ns = useNamespace("segmented");
  56754. const segmentedId = useId();
  56755. const segmentedSize = useFormSize();
  56756. const _disabled = useFormDisabled();
  56757. const { formItem } = useFormItem();
  56758. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  56759. formItemContext: formItem
  56760. });
  56761. const segmentedRef = ref(null);
  56762. const activeElement = useActiveElement();
  56763. const state = reactive({
  56764. isInit: false,
  56765. width: 0,
  56766. height: 0,
  56767. translateX: 0,
  56768. translateY: 0,
  56769. focusVisible: false
  56770. });
  56771. const handleChange = (item) => {
  56772. const value = getValue(item);
  56773. emit(UPDATE_MODEL_EVENT, value);
  56774. emit(CHANGE_EVENT, value);
  56775. };
  56776. const getValue = (item) => {
  56777. return isObject$1(item) ? item.value : item;
  56778. };
  56779. const getLabel = (item) => {
  56780. return isObject$1(item) ? item.label : item;
  56781. };
  56782. const getDisabled = (item) => {
  56783. return !!(_disabled.value || (isObject$1(item) ? item.disabled : false));
  56784. };
  56785. const getSelected = (item) => {
  56786. return props.modelValue === getValue(item);
  56787. };
  56788. const getOption = (value) => {
  56789. return props.options.find((item) => getValue(item) === value);
  56790. };
  56791. const getItemCls = (item) => {
  56792. return [
  56793. ns.e("item"),
  56794. ns.is("selected", getSelected(item)),
  56795. ns.is("disabled", getDisabled(item))
  56796. ];
  56797. };
  56798. const updateSelect = () => {
  56799. if (!segmentedRef.value)
  56800. return;
  56801. const selectedItem = segmentedRef.value.querySelector(".is-selected");
  56802. const selectedItemInput = segmentedRef.value.querySelector(".is-selected input");
  56803. if (!selectedItem || !selectedItemInput) {
  56804. state.width = 0;
  56805. state.height = 0;
  56806. state.translateX = 0;
  56807. state.translateY = 0;
  56808. state.focusVisible = false;
  56809. return;
  56810. }
  56811. const rect = selectedItem.getBoundingClientRect();
  56812. state.isInit = true;
  56813. if (props.direction === "vertical") {
  56814. state.height = rect.height;
  56815. state.translateY = selectedItem.offsetTop;
  56816. } else {
  56817. state.width = rect.width;
  56818. state.translateX = selectedItem.offsetLeft;
  56819. }
  56820. try {
  56821. state.focusVisible = selectedItemInput.matches(":focus-visible");
  56822. } catch (e) {
  56823. }
  56824. };
  56825. const segmentedCls = computed(() => [
  56826. ns.b(),
  56827. ns.m(segmentedSize.value),
  56828. ns.is("block", props.block)
  56829. ]);
  56830. const selectedStyle = computed(() => ({
  56831. width: props.direction === "vertical" ? "100%" : `${state.width}px`,
  56832. height: props.direction === "vertical" ? `${state.height}px` : "100%",
  56833. transform: props.direction === "vertical" ? `translateY(${state.translateY}px)` : `translateX(${state.translateX}px)`,
  56834. display: state.isInit ? "block" : "none"
  56835. }));
  56836. const selectedCls = computed(() => [
  56837. ns.e("item-selected"),
  56838. ns.is("disabled", getDisabled(getOption(props.modelValue))),
  56839. ns.is("focus-visible", state.focusVisible)
  56840. ]);
  56841. const name = computed(() => {
  56842. return props.name || segmentedId.value;
  56843. });
  56844. useResizeObserver(segmentedRef, updateSelect);
  56845. watch(activeElement, updateSelect);
  56846. watch(() => props.modelValue, () => {
  56847. var _a;
  56848. updateSelect();
  56849. if (props.validateEvent) {
  56850. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  56851. }
  56852. }, {
  56853. flush: "post"
  56854. });
  56855. return (_ctx, _cache) => {
  56856. return _ctx.options.length ? (openBlock(), createElementBlock("div", {
  56857. key: 0,
  56858. id: unref(inputId),
  56859. ref_key: "segmentedRef",
  56860. ref: segmentedRef,
  56861. class: normalizeClass(unref(segmentedCls)),
  56862. role: "radiogroup",
  56863. "aria-label": !unref(isLabeledByFormItem) ? _ctx.ariaLabel || "segmented" : void 0,
  56864. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
  56865. }, [
  56866. createElementVNode("div", {
  56867. class: normalizeClass([unref(ns).e("group"), unref(ns).m(props.direction)])
  56868. }, [
  56869. createElementVNode("div", {
  56870. style: normalizeStyle(unref(selectedStyle)),
  56871. class: normalizeClass(unref(selectedCls))
  56872. }, null, 6),
  56873. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index) => {
  56874. return openBlock(), createElementBlock("label", {
  56875. key: index,
  56876. class: normalizeClass(getItemCls(item))
  56877. }, [
  56878. createElementVNode("input", {
  56879. class: normalizeClass(unref(ns).e("item-input")),
  56880. type: "radio",
  56881. name: unref(name),
  56882. disabled: getDisabled(item),
  56883. checked: getSelected(item),
  56884. onChange: ($event) => handleChange(item)
  56885. }, null, 42, ["name", "disabled", "checked", "onChange"]),
  56886. createElementVNode("div", {
  56887. class: normalizeClass(unref(ns).e("item-label"))
  56888. }, [
  56889. renderSlot(_ctx.$slots, "default", { item }, () => [
  56890. createTextVNode(toDisplayString(getLabel(item)), 1)
  56891. ])
  56892. ], 2)
  56893. ], 2);
  56894. }), 128))
  56895. ], 2)
  56896. ], 10, ["id", "aria-label", "aria-labelledby"])) : createCommentVNode("v-if", true);
  56897. };
  56898. }
  56899. });
  56900. var Segmented = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "segmented.vue"]]);
  56901. const ElSegmented = withInstall(Segmented);
  56902. const filterOption = (pattern, option) => {
  56903. const lowerCase = pattern.toLowerCase();
  56904. const label = option.label || option.value;
  56905. return label.toLowerCase().includes(lowerCase);
  56906. };
  56907. const getMentionCtx = (inputEl, prefix, split) => {
  56908. const { selectionEnd } = inputEl;
  56909. if (selectionEnd === null)
  56910. return;
  56911. const inputValue = inputEl.value;
  56912. const prefixArray = castArray$1(prefix);
  56913. let splitIndex = -1;
  56914. let mentionCtx;
  56915. for (let i = selectionEnd - 1; i >= 0; --i) {
  56916. const char = inputValue[i];
  56917. if (char === split || char === "\n" || char === "\r") {
  56918. splitIndex = i;
  56919. continue;
  56920. }
  56921. if (prefixArray.includes(char)) {
  56922. const end = splitIndex === -1 ? selectionEnd : splitIndex;
  56923. const pattern = inputValue.slice(i + 1, end);
  56924. mentionCtx = {
  56925. pattern,
  56926. start: i + 1,
  56927. end,
  56928. prefix: char,
  56929. prefixIndex: i,
  56930. splitIndex,
  56931. selectionEnd
  56932. };
  56933. break;
  56934. }
  56935. }
  56936. return mentionCtx;
  56937. };
  56938. const getCursorPosition = (element, options = {
  56939. debug: false,
  56940. useSelectionEnd: false
  56941. }) => {
  56942. const selectionStart = element.selectionStart !== null ? element.selectionStart : 0;
  56943. const selectionEnd = element.selectionEnd !== null ? element.selectionEnd : 0;
  56944. const position = options.useSelectionEnd ? selectionEnd : selectionStart;
  56945. const properties = [
  56946. "direction",
  56947. "boxSizing",
  56948. "width",
  56949. "height",
  56950. "overflowX",
  56951. "overflowY",
  56952. "borderTopWidth",
  56953. "borderRightWidth",
  56954. "borderBottomWidth",
  56955. "borderLeftWidth",
  56956. "borderStyle",
  56957. "paddingTop",
  56958. "paddingRight",
  56959. "paddingBottom",
  56960. "paddingLeft",
  56961. "fontStyle",
  56962. "fontVariant",
  56963. "fontWeight",
  56964. "fontStretch",
  56965. "fontSize",
  56966. "fontSizeAdjust",
  56967. "lineHeight",
  56968. "fontFamily",
  56969. "textAlign",
  56970. "textTransform",
  56971. "textIndent",
  56972. "textDecoration",
  56973. "letterSpacing",
  56974. "wordSpacing",
  56975. "tabSize",
  56976. "MozTabSize"
  56977. ];
  56978. if (options.debug) {
  56979. const el = document.querySelector("#input-textarea-caret-position-mirror-div");
  56980. if (el == null ? void 0 : el.parentNode)
  56981. el.parentNode.removeChild(el);
  56982. }
  56983. const div = document.createElement("div");
  56984. div.id = "input-textarea-caret-position-mirror-div";
  56985. document.body.appendChild(div);
  56986. const style = div.style;
  56987. const computed = window.getComputedStyle(element);
  56988. const isInput = element.nodeName === "INPUT";
  56989. style.whiteSpace = isInput ? "nowrap" : "pre-wrap";
  56990. if (!isInput)
  56991. style.wordWrap = "break-word";
  56992. style.position = "absolute";
  56993. if (!options.debug)
  56994. style.visibility = "hidden";
  56995. properties.forEach((prop) => {
  56996. if (isInput && prop === "lineHeight") {
  56997. if (computed.boxSizing === "border-box") {
  56998. const height = Number.parseInt(computed.height);
  56999. const outerHeight = Number.parseInt(computed.paddingTop) + Number.parseInt(computed.paddingBottom) + Number.parseInt(computed.borderTopWidth) + Number.parseInt(computed.borderBottomWidth);
  57000. const targetHeight = outerHeight + Number.parseInt(computed.lineHeight);
  57001. if (height > targetHeight) {
  57002. style.lineHeight = `${height - outerHeight}px`;
  57003. } else if (height === targetHeight) {
  57004. style.lineHeight = computed.lineHeight;
  57005. } else {
  57006. style.lineHeight = "0";
  57007. }
  57008. } else {
  57009. style.lineHeight = computed.height;
  57010. }
  57011. } else {
  57012. style[prop] = computed[prop];
  57013. }
  57014. });
  57015. if (isFirefox()) {
  57016. if (element.scrollHeight > Number.parseInt(computed.height)) {
  57017. style.overflowY = "scroll";
  57018. }
  57019. } else {
  57020. style.overflow = "hidden";
  57021. }
  57022. div.textContent = element.value.slice(0, Math.max(0, position));
  57023. if (isInput && div.textContent) {
  57024. div.textContent = div.textContent.replace(/\s/g, "\xA0");
  57025. }
  57026. const span = document.createElement("span");
  57027. span.textContent = element.value.slice(Math.max(0, position)) || ".";
  57028. span.style.position = "relative";
  57029. span.style.left = `${-element.scrollLeft}px`;
  57030. span.style.top = `${-element.scrollTop}px`;
  57031. div.appendChild(span);
  57032. const relativePosition = {
  57033. top: span.offsetTop + Number.parseInt(computed.borderTopWidth),
  57034. left: span.offsetLeft + Number.parseInt(computed.borderLeftWidth),
  57035. height: Number.parseInt(computed.fontSize) * 1.5
  57036. };
  57037. if (options.debug) {
  57038. span.style.backgroundColor = "#aaa";
  57039. } else {
  57040. document.body.removeChild(div);
  57041. }
  57042. if (relativePosition.left >= element.clientWidth) {
  57043. relativePosition.left = element.clientWidth;
  57044. }
  57045. return relativePosition;
  57046. };
  57047. const mentionProps = buildProps({
  57048. ...inputProps,
  57049. options: {
  57050. type: definePropType(Array),
  57051. default: () => []
  57052. },
  57053. prefix: {
  57054. type: definePropType([String, Array]),
  57055. default: "@",
  57056. validator: (val) => {
  57057. if (isString$1(val))
  57058. return val.length === 1;
  57059. return val.every((v) => isString$1(v) && v.length === 1);
  57060. }
  57061. },
  57062. split: {
  57063. type: String,
  57064. default: " ",
  57065. validator: (val) => val.length === 1
  57066. },
  57067. filterOption: {
  57068. type: definePropType([Boolean, Function]),
  57069. default: () => filterOption,
  57070. validator: (val) => {
  57071. if (val === false)
  57072. return true;
  57073. return isFunction$1(val);
  57074. }
  57075. },
  57076. placement: {
  57077. type: definePropType(String),
  57078. default: "bottom"
  57079. },
  57080. showArrow: Boolean,
  57081. offset: {
  57082. type: Number,
  57083. default: 0
  57084. },
  57085. whole: Boolean,
  57086. checkIsWhole: {
  57087. type: definePropType(Function)
  57088. },
  57089. modelValue: String,
  57090. loading: Boolean,
  57091. popperClass: {
  57092. type: String,
  57093. default: ""
  57094. },
  57095. popperOptions: {
  57096. type: definePropType(Object),
  57097. default: () => ({})
  57098. }
  57099. });
  57100. const mentionEmits = {
  57101. [UPDATE_MODEL_EVENT]: (value) => isString$1(value),
  57102. search: (pattern, prefix) => isString$1(pattern) && isString$1(prefix),
  57103. select: (option, prefix) => isString$1(option.value) && isString$1(prefix),
  57104. focus: (evt) => evt instanceof FocusEvent,
  57105. blur: (evt) => evt instanceof FocusEvent
  57106. };
  57107. const mentionDropdownProps = buildProps({
  57108. options: {
  57109. type: definePropType(Array),
  57110. default: () => []
  57111. },
  57112. loading: Boolean,
  57113. disabled: Boolean,
  57114. contentId: String,
  57115. ariaLabel: String
  57116. });
  57117. const mentionDropdownEmits = {
  57118. select: (option) => isString$1(option.value)
  57119. };
  57120. const __default__$3 = defineComponent({
  57121. name: "ElMentionDropdown"
  57122. });
  57123. const _sfc_main$4 = /* @__PURE__ */ defineComponent({
  57124. ...__default__$3,
  57125. props: mentionDropdownProps,
  57126. emits: mentionDropdownEmits,
  57127. setup(__props, { expose, emit }) {
  57128. const props = __props;
  57129. const ns = useNamespace("mention");
  57130. const { t } = useLocale();
  57131. const hoveringIndex = ref(-1);
  57132. const scrollbarRef = ref();
  57133. const optionRefs = ref();
  57134. const dropdownRef = ref();
  57135. const optionkls = (item, index) => [
  57136. ns.be("dropdown", "item"),
  57137. ns.is("hovering", hoveringIndex.value === index),
  57138. ns.is("disabled", item.disabled || props.disabled)
  57139. ];
  57140. const handleSelect = (item) => {
  57141. if (item.disabled || props.disabled)
  57142. return;
  57143. emit("select", item);
  57144. };
  57145. const handleMouseEnter = (index) => {
  57146. hoveringIndex.value = index;
  57147. };
  57148. const filteredAllDisabled = computed(() => props.disabled || props.options.every((item) => item.disabled));
  57149. const hoverOption = computed(() => props.options[hoveringIndex.value]);
  57150. const selectHoverOption = () => {
  57151. if (!hoverOption.value)
  57152. return;
  57153. emit("select", hoverOption.value);
  57154. };
  57155. const navigateOptions = (direction) => {
  57156. const { options } = props;
  57157. if (options.length === 0 || filteredAllDisabled.value)
  57158. return;
  57159. if (direction === "next") {
  57160. hoveringIndex.value++;
  57161. if (hoveringIndex.value === options.length) {
  57162. hoveringIndex.value = 0;
  57163. }
  57164. } else if (direction === "prev") {
  57165. hoveringIndex.value--;
  57166. if (hoveringIndex.value < 0) {
  57167. hoveringIndex.value = options.length - 1;
  57168. }
  57169. }
  57170. const option = options[hoveringIndex.value];
  57171. if (option.disabled) {
  57172. navigateOptions(direction);
  57173. return;
  57174. }
  57175. nextTick(() => scrollToOption(option));
  57176. };
  57177. const scrollToOption = (option) => {
  57178. var _a, _b, _c, _d;
  57179. const { options } = props;
  57180. const index = options.findIndex((item) => item.value === option.value);
  57181. const target = (_a = optionRefs.value) == null ? void 0 : _a[index];
  57182. if (target) {
  57183. const menu = (_c = (_b = dropdownRef.value) == null ? void 0 : _b.querySelector) == null ? void 0 : _c.call(_b, `.${ns.be("dropdown", "wrap")}`);
  57184. if (menu) {
  57185. scrollIntoView(menu, target);
  57186. }
  57187. }
  57188. (_d = scrollbarRef.value) == null ? void 0 : _d.handleScroll();
  57189. };
  57190. const resetHoveringIndex = () => {
  57191. if (filteredAllDisabled.value || props.options.length === 0) {
  57192. hoveringIndex.value = -1;
  57193. } else {
  57194. hoveringIndex.value = 0;
  57195. }
  57196. };
  57197. watch(() => props.options, resetHoveringIndex, {
  57198. immediate: true
  57199. });
  57200. expose({
  57201. hoveringIndex,
  57202. navigateOptions,
  57203. selectHoverOption,
  57204. hoverOption
  57205. });
  57206. return (_ctx, _cache) => {
  57207. return openBlock(), createElementBlock("div", {
  57208. ref_key: "dropdownRef",
  57209. ref: dropdownRef,
  57210. class: normalizeClass(unref(ns).b("dropdown"))
  57211. }, [
  57212. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  57213. key: 0,
  57214. class: normalizeClass(unref(ns).be("dropdown", "header"))
  57215. }, [
  57216. renderSlot(_ctx.$slots, "header")
  57217. ], 2)) : createCommentVNode("v-if", true),
  57218. withDirectives(createVNode(unref(ElScrollbar), {
  57219. id: _ctx.contentId,
  57220. ref_key: "scrollbarRef",
  57221. ref: scrollbarRef,
  57222. tag: "ul",
  57223. "wrap-class": unref(ns).be("dropdown", "wrap"),
  57224. "view-class": unref(ns).be("dropdown", "list"),
  57225. role: "listbox",
  57226. "aria-label": _ctx.ariaLabel,
  57227. "aria-orientation": "vertical"
  57228. }, {
  57229. default: withCtx(() => [
  57230. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (item, index) => {
  57231. return openBlock(), createElementBlock("li", {
  57232. id: `${_ctx.contentId}-${index}`,
  57233. ref_for: true,
  57234. ref_key: "optionRefs",
  57235. ref: optionRefs,
  57236. key: index,
  57237. class: normalizeClass(optionkls(item, index)),
  57238. role: "option",
  57239. "aria-disabled": item.disabled || _ctx.disabled || void 0,
  57240. "aria-selected": hoveringIndex.value === index,
  57241. onMousemove: ($event) => handleMouseEnter(index),
  57242. onClick: withModifiers(($event) => handleSelect(item), ["stop"])
  57243. }, [
  57244. renderSlot(_ctx.$slots, "label", {
  57245. item,
  57246. index
  57247. }, () => {
  57248. var _a;
  57249. return [
  57250. createElementVNode("span", null, toDisplayString((_a = item.label) != null ? _a : item.value), 1)
  57251. ];
  57252. })
  57253. ], 42, ["id", "aria-disabled", "aria-selected", "onMousemove", "onClick"]);
  57254. }), 128))
  57255. ]),
  57256. _: 3
  57257. }, 8, ["id", "wrap-class", "view-class", "aria-label"]), [
  57258. [vShow, _ctx.options.length > 0 && !_ctx.loading]
  57259. ]),
  57260. _ctx.loading ? (openBlock(), createElementBlock("div", {
  57261. key: 1,
  57262. class: normalizeClass(unref(ns).be("dropdown", "loading"))
  57263. }, [
  57264. renderSlot(_ctx.$slots, "loading", {}, () => [
  57265. createTextVNode(toDisplayString(unref(t)("el.mention.loading")), 1)
  57266. ])
  57267. ], 2)) : createCommentVNode("v-if", true),
  57268. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  57269. key: 2,
  57270. class: normalizeClass(unref(ns).be("dropdown", "footer"))
  57271. }, [
  57272. renderSlot(_ctx.$slots, "footer")
  57273. ], 2)) : createCommentVNode("v-if", true)
  57274. ], 2);
  57275. };
  57276. }
  57277. });
  57278. var ElMentionDropdown = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "mention-dropdown.vue"]]);
  57279. const __default__$2 = defineComponent({
  57280. name: "ElMention",
  57281. inheritAttrs: false
  57282. });
  57283. const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  57284. ...__default__$2,
  57285. props: mentionProps,
  57286. emits: mentionEmits,
  57287. setup(__props, { expose, emit }) {
  57288. const props = __props;
  57289. const passInputProps = computed(() => pick(props, Object.keys(inputProps)));
  57290. const ns = useNamespace("mention");
  57291. const disabled = useFormDisabled();
  57292. const contentId = useId();
  57293. const elInputRef = ref();
  57294. const tooltipRef = ref();
  57295. const dropdownRef = ref();
  57296. const visible = ref(false);
  57297. const cursorStyle = ref();
  57298. const mentionCtx = ref();
  57299. const computedPlacement = computed(() => props.showArrow ? props.placement : `${props.placement}-start`);
  57300. const computedFallbackPlacements = computed(() => props.showArrow ? ["bottom", "top"] : ["bottom-start", "top-start"]);
  57301. const filteredOptions = computed(() => {
  57302. const { filterOption, options } = props;
  57303. if (!mentionCtx.value || !filterOption)
  57304. return options;
  57305. return options.filter((option) => filterOption(mentionCtx.value.pattern, option));
  57306. });
  57307. const dropdownVisible = computed(() => {
  57308. return visible.value && (!!filteredOptions.value.length || props.loading);
  57309. });
  57310. const hoveringId = computed(() => {
  57311. var _a;
  57312. return `${contentId.value}-${(_a = dropdownRef.value) == null ? void 0 : _a.hoveringIndex}`;
  57313. });
  57314. const handleInputChange = (value) => {
  57315. emit("update:modelValue", value);
  57316. syncAfterCursorMove();
  57317. };
  57318. const handleInputKeyDown = (event) => {
  57319. var _a, _b, _c, _d;
  57320. if (!("code" in event) || ((_a = elInputRef.value) == null ? void 0 : _a.isComposing))
  57321. return;
  57322. switch (event.code) {
  57323. case EVENT_CODE.left:
  57324. case EVENT_CODE.right:
  57325. syncAfterCursorMove();
  57326. break;
  57327. case EVENT_CODE.up:
  57328. case EVENT_CODE.down:
  57329. if (!visible.value)
  57330. return;
  57331. event.preventDefault();
  57332. (_b = dropdownRef.value) == null ? void 0 : _b.navigateOptions(event.code === EVENT_CODE.up ? "prev" : "next");
  57333. break;
  57334. case EVENT_CODE.enter:
  57335. case EVENT_CODE.numpadEnter:
  57336. if (!visible.value)
  57337. return;
  57338. event.preventDefault();
  57339. if ((_c = dropdownRef.value) == null ? void 0 : _c.hoverOption) {
  57340. (_d = dropdownRef.value) == null ? void 0 : _d.selectHoverOption();
  57341. } else {
  57342. visible.value = false;
  57343. }
  57344. break;
  57345. case EVENT_CODE.esc:
  57346. if (!visible.value)
  57347. return;
  57348. event.preventDefault();
  57349. visible.value = false;
  57350. break;
  57351. case EVENT_CODE.backspace:
  57352. if (props.whole && mentionCtx.value) {
  57353. const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
  57354. const inputEl = getInputEl();
  57355. if (!inputEl)
  57356. return;
  57357. const inputValue = inputEl.value;
  57358. const matchOption = props.options.find((item) => item.value === pattern);
  57359. const isWhole = isFunction$1(props.checkIsWhole) ? props.checkIsWhole(pattern, prefix) : matchOption;
  57360. if (isWhole && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {
  57361. event.preventDefault();
  57362. const newValue = inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1);
  57363. emit(UPDATE_MODEL_EVENT, newValue);
  57364. const newSelectionEnd = prefixIndex;
  57365. nextTick(() => {
  57366. inputEl.selectionStart = newSelectionEnd;
  57367. inputEl.selectionEnd = newSelectionEnd;
  57368. syncDropdownVisible();
  57369. });
  57370. }
  57371. }
  57372. }
  57373. };
  57374. const { wrapperRef } = useFocusController(elInputRef, {
  57375. beforeFocus() {
  57376. return disabled.value;
  57377. },
  57378. afterFocus() {
  57379. syncAfterCursorMove();
  57380. },
  57381. beforeBlur(event) {
  57382. var _a;
  57383. return (_a = tooltipRef.value) == null ? void 0 : _a.isFocusInsideContent(event);
  57384. },
  57385. afterBlur() {
  57386. visible.value = false;
  57387. }
  57388. });
  57389. const handleInputMouseDown = () => {
  57390. syncAfterCursorMove();
  57391. };
  57392. const handleSelect = (item) => {
  57393. if (!mentionCtx.value)
  57394. return;
  57395. const inputEl = getInputEl();
  57396. if (!inputEl)
  57397. return;
  57398. const inputValue = inputEl.value;
  57399. const { split } = props;
  57400. const newEndPart = inputValue.slice(mentionCtx.value.end);
  57401. const alreadySeparated = newEndPart.startsWith(split);
  57402. const newMiddlePart = `${item.value}${alreadySeparated ? "" : split}`;
  57403. const newValue = inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart;
  57404. emit(UPDATE_MODEL_EVENT, newValue);
  57405. emit("select", item, mentionCtx.value.prefix);
  57406. const newSelectionEnd = mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0);
  57407. nextTick(() => {
  57408. inputEl.selectionStart = newSelectionEnd;
  57409. inputEl.selectionEnd = newSelectionEnd;
  57410. inputEl.focus();
  57411. syncDropdownVisible();
  57412. });
  57413. };
  57414. const getInputEl = () => {
  57415. var _a, _b;
  57416. return props.type === "textarea" ? (_a = elInputRef.value) == null ? void 0 : _a.textarea : (_b = elInputRef.value) == null ? void 0 : _b.input;
  57417. };
  57418. const syncAfterCursorMove = () => {
  57419. setTimeout(() => {
  57420. syncCursor();
  57421. syncDropdownVisible();
  57422. nextTick(() => {
  57423. var _a;
  57424. return (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  57425. });
  57426. }, 0);
  57427. };
  57428. const syncCursor = () => {
  57429. const inputEl = getInputEl();
  57430. if (!inputEl)
  57431. return;
  57432. const caretPosition = getCursorPosition(inputEl);
  57433. const inputRect = inputEl.getBoundingClientRect();
  57434. const elInputRect = elInputRef.value.$el.getBoundingClientRect();
  57435. cursorStyle.value = {
  57436. position: "absolute",
  57437. width: 0,
  57438. height: `${caretPosition.height}px`,
  57439. left: `${caretPosition.left + inputRect.left - elInputRect.left}px`,
  57440. top: `${caretPosition.top + inputRect.top - elInputRect.top}px`
  57441. };
  57442. };
  57443. const syncDropdownVisible = () => {
  57444. const inputEl = getInputEl();
  57445. if (document.activeElement !== inputEl) {
  57446. visible.value = false;
  57447. return;
  57448. }
  57449. const { prefix, split } = props;
  57450. mentionCtx.value = getMentionCtx(inputEl, prefix, split);
  57451. if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {
  57452. visible.value = true;
  57453. emit("search", mentionCtx.value.pattern, mentionCtx.value.prefix);
  57454. return;
  57455. }
  57456. visible.value = false;
  57457. };
  57458. expose({
  57459. input: elInputRef,
  57460. tooltip: tooltipRef,
  57461. dropdownVisible
  57462. });
  57463. return (_ctx, _cache) => {
  57464. return openBlock(), createElementBlock("div", {
  57465. ref_key: "wrapperRef",
  57466. ref: wrapperRef,
  57467. class: normalizeClass(unref(ns).b())
  57468. }, [
  57469. createVNode(unref(ElInput), mergeProps(mergeProps(unref(passInputProps), _ctx.$attrs), {
  57470. ref_key: "elInputRef",
  57471. ref: elInputRef,
  57472. "model-value": _ctx.modelValue,
  57473. disabled: unref(disabled),
  57474. role: unref(dropdownVisible) ? "combobox" : void 0,
  57475. "aria-activedescendant": unref(dropdownVisible) ? unref(hoveringId) || "" : void 0,
  57476. "aria-controls": unref(dropdownVisible) ? unref(contentId) : void 0,
  57477. "aria-expanded": unref(dropdownVisible) || void 0,
  57478. "aria-label": _ctx.ariaLabel,
  57479. "aria-autocomplete": unref(dropdownVisible) ? "none" : void 0,
  57480. "aria-haspopup": unref(dropdownVisible) ? "listbox" : void 0,
  57481. onInput: handleInputChange,
  57482. onKeydown: handleInputKeyDown,
  57483. onMousedown: handleInputMouseDown
  57484. }), createSlots({
  57485. _: 2
  57486. }, [
  57487. renderList(_ctx.$slots, (_, name) => {
  57488. return {
  57489. name,
  57490. fn: withCtx((slotProps) => [
  57491. renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
  57492. ])
  57493. };
  57494. })
  57495. ]), 1040, ["model-value", "disabled", "role", "aria-activedescendant", "aria-controls", "aria-expanded", "aria-label", "aria-autocomplete", "aria-haspopup"]),
  57496. createVNode(unref(ElTooltip), {
  57497. ref_key: "tooltipRef",
  57498. ref: tooltipRef,
  57499. visible: unref(dropdownVisible),
  57500. "popper-class": [unref(ns).e("popper"), _ctx.popperClass],
  57501. "popper-options": _ctx.popperOptions,
  57502. placement: unref(computedPlacement),
  57503. "fallback-placements": unref(computedFallbackPlacements),
  57504. effect: "light",
  57505. pure: "",
  57506. offset: _ctx.offset,
  57507. "show-arrow": _ctx.showArrow
  57508. }, {
  57509. default: withCtx(() => [
  57510. createElementVNode("div", {
  57511. style: normalizeStyle(cursorStyle.value)
  57512. }, null, 4)
  57513. ]),
  57514. content: withCtx(() => {
  57515. var _a;
  57516. return [
  57517. createVNode(ElMentionDropdown, {
  57518. ref_key: "dropdownRef",
  57519. ref: dropdownRef,
  57520. options: unref(filteredOptions),
  57521. disabled: unref(disabled),
  57522. loading: _ctx.loading,
  57523. "content-id": unref(contentId),
  57524. "aria-label": _ctx.ariaLabel,
  57525. onSelect: handleSelect,
  57526. onClick: withModifiers((_a = elInputRef.value) == null ? void 0 : _a.focus, ["stop"])
  57527. }, createSlots({
  57528. _: 2
  57529. }, [
  57530. renderList(_ctx.$slots, (_, name) => {
  57531. return {
  57532. name,
  57533. fn: withCtx((slotProps) => [
  57534. renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))
  57535. ])
  57536. };
  57537. })
  57538. ]), 1032, ["options", "disabled", "loading", "content-id", "aria-label", "onClick"])
  57539. ];
  57540. }),
  57541. _: 3
  57542. }, 8, ["visible", "popper-class", "popper-options", "placement", "fallback-placements", "offset", "show-arrow"])
  57543. ], 2);
  57544. };
  57545. }
  57546. });
  57547. var Mention = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "mention.vue"]]);
  57548. const ElMention = withInstall(Mention);
  57549. var Components = [
  57550. ElAffix,
  57551. ElAlert,
  57552. ElAutocomplete,
  57553. ElAutoResizer,
  57554. ElAvatar,
  57555. ElBacktop,
  57556. ElBadge,
  57557. ElBreadcrumb,
  57558. ElBreadcrumbItem,
  57559. ElButton,
  57560. ElButtonGroup$1,
  57561. ElCalendar,
  57562. ElCard,
  57563. ElCarousel,
  57564. ElCarouselItem,
  57565. ElCascader,
  57566. ElCascaderPanel,
  57567. ElCheckTag,
  57568. ElCheckbox,
  57569. ElCheckboxButton,
  57570. ElCheckboxGroup$1,
  57571. ElCol,
  57572. ElCollapse,
  57573. ElCollapseItem,
  57574. ElCollapseTransition,
  57575. ElColorPicker,
  57576. ElConfigProvider,
  57577. ElContainer,
  57578. ElAside,
  57579. ElFooter,
  57580. ElHeader,
  57581. ElMain,
  57582. ElDatePicker,
  57583. ElDescriptions,
  57584. ElDescriptionsItem,
  57585. ElDialog,
  57586. ElDivider,
  57587. ElDrawer,
  57588. ElDropdown,
  57589. ElDropdownItem,
  57590. ElDropdownMenu,
  57591. ElEmpty,
  57592. ElForm,
  57593. ElFormItem,
  57594. ElIcon,
  57595. ElImage,
  57596. ElImageViewer,
  57597. ElInput,
  57598. ElInputNumber,
  57599. ElInputTag,
  57600. ElLink,
  57601. ElMenu,
  57602. ElMenuItem,
  57603. ElMenuItemGroup,
  57604. ElSubMenu,
  57605. ElPageHeader,
  57606. ElPagination,
  57607. ElPopconfirm,
  57608. ElPopover,
  57609. ElPopper,
  57610. ElProgress,
  57611. ElRadio,
  57612. ElRadioButton,
  57613. ElRadioGroup,
  57614. ElRate,
  57615. ElResult,
  57616. ElRow,
  57617. ElScrollbar,
  57618. ElSelect,
  57619. ElOption,
  57620. ElOptionGroup,
  57621. ElSelectV2,
  57622. ElSkeleton,
  57623. ElSkeletonItem,
  57624. ElSlider,
  57625. ElSpace,
  57626. ElStatistic,
  57627. ElCountdown,
  57628. ElSteps,
  57629. ElStep,
  57630. ElSwitch,
  57631. ElTable,
  57632. ElTableColumn,
  57633. ElTableV2,
  57634. ElTabs,
  57635. ElTabPane,
  57636. ElTag,
  57637. ElText,
  57638. ElTimePicker,
  57639. ElTimeSelect,
  57640. ElTimeline,
  57641. ElTimelineItem,
  57642. ElTooltip,
  57643. ElTooltipV2,
  57644. ElTransfer,
  57645. ElTree,
  57646. ElTreeSelect,
  57647. ElTreeV2,
  57648. ElUpload,
  57649. ElWatermark,
  57650. ElTour,
  57651. ElTourStep,
  57652. ElAnchor,
  57653. ElAnchorLink,
  57654. ElSegmented,
  57655. ElMention
  57656. ];
  57657. const SCOPE = "ElInfiniteScroll";
  57658. const CHECK_INTERVAL = 50;
  57659. const DEFAULT_DELAY = 200;
  57660. const DEFAULT_DISTANCE = 0;
  57661. const attributes = {
  57662. delay: {
  57663. type: Number,
  57664. default: DEFAULT_DELAY
  57665. },
  57666. distance: {
  57667. type: Number,
  57668. default: DEFAULT_DISTANCE
  57669. },
  57670. disabled: {
  57671. type: Boolean,
  57672. default: false
  57673. },
  57674. immediate: {
  57675. type: Boolean,
  57676. default: true
  57677. }
  57678. };
  57679. const getScrollOptions = (el, instance) => {
  57680. return Object.entries(attributes).reduce((acm, [name, option]) => {
  57681. var _a, _b;
  57682. const { type, default: defaultValue } = option;
  57683. const attrVal = el.getAttribute(`infinite-scroll-${name}`);
  57684. let value = (_b = (_a = instance[attrVal]) != null ? _a : attrVal) != null ? _b : defaultValue;
  57685. value = value === "false" ? false : value;
  57686. value = type(value);
  57687. acm[name] = Number.isNaN(value) ? defaultValue : value;
  57688. return acm;
  57689. }, {});
  57690. };
  57691. const destroyObserver = (el) => {
  57692. const { observer } = el[SCOPE];
  57693. if (observer) {
  57694. observer.disconnect();
  57695. delete el[SCOPE].observer;
  57696. }
  57697. };
  57698. const handleScroll = (el, cb) => {
  57699. const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE];
  57700. const { disabled, distance } = getScrollOptions(el, instance);
  57701. const { clientHeight, scrollHeight, scrollTop } = containerEl;
  57702. const delta = scrollTop - lastScrollTop;
  57703. el[SCOPE].lastScrollTop = scrollTop;
  57704. if (observer || disabled || delta < 0)
  57705. return;
  57706. let shouldTrigger = false;
  57707. if (container === el) {
  57708. shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance;
  57709. } else {
  57710. const { clientTop, scrollHeight: height } = el;
  57711. const offsetTop = getOffsetTopDistance(el, containerEl);
  57712. shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance;
  57713. }
  57714. if (shouldTrigger) {
  57715. cb.call(instance);
  57716. }
  57717. };
  57718. function checkFull(el, cb) {
  57719. const { containerEl, instance } = el[SCOPE];
  57720. const { disabled } = getScrollOptions(el, instance);
  57721. if (disabled || containerEl.clientHeight === 0)
  57722. return;
  57723. if (containerEl.scrollHeight <= containerEl.clientHeight) {
  57724. cb.call(instance);
  57725. } else {
  57726. destroyObserver(el);
  57727. }
  57728. }
  57729. const InfiniteScroll = {
  57730. async mounted(el, binding) {
  57731. const { instance, value: cb } = binding;
  57732. if (!isFunction$1(cb)) {
  57733. throwError(SCOPE, "'v-infinite-scroll' binding value must be a function");
  57734. }
  57735. await nextTick();
  57736. const { delay, immediate } = getScrollOptions(el, instance);
  57737. const container = getScrollContainer(el, true);
  57738. const containerEl = container === window ? document.documentElement : container;
  57739. const onScroll = throttle(handleScroll.bind(null, el, cb), delay);
  57740. if (!container)
  57741. return;
  57742. el[SCOPE] = {
  57743. instance,
  57744. container,
  57745. containerEl,
  57746. delay,
  57747. cb,
  57748. onScroll,
  57749. lastScrollTop: containerEl.scrollTop
  57750. };
  57751. if (immediate) {
  57752. const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), CHECK_INTERVAL));
  57753. el[SCOPE].observer = observer;
  57754. observer.observe(el, { childList: true, subtree: true });
  57755. checkFull(el, cb);
  57756. }
  57757. container.addEventListener("scroll", onScroll);
  57758. },
  57759. unmounted(el) {
  57760. if (!el[SCOPE])
  57761. return;
  57762. const { container, onScroll } = el[SCOPE];
  57763. container == null ? void 0 : container.removeEventListener("scroll", onScroll);
  57764. destroyObserver(el);
  57765. },
  57766. async updated(el) {
  57767. if (!el[SCOPE]) {
  57768. await nextTick();
  57769. } else {
  57770. const { containerEl, cb, observer } = el[SCOPE];
  57771. if (containerEl.clientHeight && observer) {
  57772. checkFull(el, cb);
  57773. }
  57774. }
  57775. }
  57776. };
  57777. var InfiniteScroll$1 = InfiniteScroll;
  57778. const _InfiniteScroll = InfiniteScroll$1;
  57779. _InfiniteScroll.install = (app) => {
  57780. app.directive("InfiniteScroll", _InfiniteScroll);
  57781. };
  57782. const ElInfiniteScroll = _InfiniteScroll;
  57783. function createLoadingComponent(options) {
  57784. let afterLeaveTimer;
  57785. const afterLeaveFlag = ref(false);
  57786. const data = reactive({
  57787. ...options,
  57788. originalPosition: "",
  57789. originalOverflow: "",
  57790. visible: false
  57791. });
  57792. function setText(text) {
  57793. data.text = text;
  57794. }
  57795. function destroySelf() {
  57796. const target = data.parent;
  57797. const ns = vm.ns;
  57798. if (!target.vLoadingAddClassList) {
  57799. let loadingNumber = target.getAttribute("loading-number");
  57800. loadingNumber = Number.parseInt(loadingNumber) - 1;
  57801. if (!loadingNumber) {
  57802. removeClass(target, ns.bm("parent", "relative"));
  57803. target.removeAttribute("loading-number");
  57804. } else {
  57805. target.setAttribute("loading-number", loadingNumber.toString());
  57806. }
  57807. removeClass(target, ns.bm("parent", "hidden"));
  57808. }
  57809. removeElLoadingChild();
  57810. loadingInstance.unmount();
  57811. }
  57812. function removeElLoadingChild() {
  57813. var _a, _b;
  57814. (_b = (_a = vm.$el) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(vm.$el);
  57815. }
  57816. function close() {
  57817. var _a;
  57818. if (options.beforeClose && !options.beforeClose())
  57819. return;
  57820. afterLeaveFlag.value = true;
  57821. clearTimeout(afterLeaveTimer);
  57822. afterLeaveTimer = setTimeout(handleAfterLeave, 400);
  57823. data.visible = false;
  57824. (_a = options.closed) == null ? void 0 : _a.call(options);
  57825. }
  57826. function handleAfterLeave() {
  57827. if (!afterLeaveFlag.value)
  57828. return;
  57829. const target = data.parent;
  57830. afterLeaveFlag.value = false;
  57831. target.vLoadingAddClassList = void 0;
  57832. destroySelf();
  57833. }
  57834. const elLoadingComponent = defineComponent({
  57835. name: "ElLoading",
  57836. setup(_, { expose }) {
  57837. const { ns, zIndex } = useGlobalComponentSettings("loading");
  57838. expose({
  57839. ns,
  57840. zIndex
  57841. });
  57842. return () => {
  57843. const svg = data.spinner || data.svg;
  57844. const spinner = h$1("svg", {
  57845. class: "circular",
  57846. viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
  57847. ...svg ? { innerHTML: svg } : {}
  57848. }, [
  57849. h$1("circle", {
  57850. class: "path",
  57851. cx: "25",
  57852. cy: "25",
  57853. r: "20",
  57854. fill: "none"
  57855. })
  57856. ]);
  57857. const spinnerText = data.text ? h$1("p", { class: ns.b("text") }, [data.text]) : void 0;
  57858. return h$1(Transition, {
  57859. name: ns.b("fade"),
  57860. onAfterLeave: handleAfterLeave
  57861. }, {
  57862. default: withCtx(() => [
  57863. withDirectives(createVNode("div", {
  57864. style: {
  57865. backgroundColor: data.background || ""
  57866. },
  57867. class: [
  57868. ns.b("mask"),
  57869. data.customClass,
  57870. data.fullscreen ? "is-fullscreen" : ""
  57871. ]
  57872. }, [
  57873. h$1("div", {
  57874. class: ns.b("spinner")
  57875. }, [spinner, spinnerText])
  57876. ]), [[vShow, data.visible]])
  57877. ])
  57878. });
  57879. };
  57880. }
  57881. });
  57882. const loadingInstance = createApp(elLoadingComponent);
  57883. const vm = loadingInstance.mount(document.createElement("div"));
  57884. return {
  57885. ...toRefs(data),
  57886. setText,
  57887. removeElLoadingChild,
  57888. close,
  57889. handleAfterLeave,
  57890. vm,
  57891. get $el() {
  57892. return vm.$el;
  57893. }
  57894. };
  57895. }
  57896. let fullscreenInstance = void 0;
  57897. const Loading = function(options = {}) {
  57898. if (!isClient)
  57899. return void 0;
  57900. const resolved = resolveOptions(options);
  57901. if (resolved.fullscreen && fullscreenInstance) {
  57902. return fullscreenInstance;
  57903. }
  57904. const instance = createLoadingComponent({
  57905. ...resolved,
  57906. closed: () => {
  57907. var _a;
  57908. (_a = resolved.closed) == null ? void 0 : _a.call(resolved);
  57909. if (resolved.fullscreen)
  57910. fullscreenInstance = void 0;
  57911. }
  57912. });
  57913. addStyle(resolved, resolved.parent, instance);
  57914. addClassList(resolved, resolved.parent, instance);
  57915. resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
  57916. let loadingNumber = resolved.parent.getAttribute("loading-number");
  57917. if (!loadingNumber) {
  57918. loadingNumber = "1";
  57919. } else {
  57920. loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
  57921. }
  57922. resolved.parent.setAttribute("loading-number", loadingNumber);
  57923. resolved.parent.appendChild(instance.$el);
  57924. nextTick(() => instance.visible.value = resolved.visible);
  57925. if (resolved.fullscreen) {
  57926. fullscreenInstance = instance;
  57927. }
  57928. return instance;
  57929. };
  57930. const resolveOptions = (options) => {
  57931. var _a, _b, _c, _d;
  57932. let target;
  57933. if (isString$1(options.target)) {
  57934. target = (_a = document.querySelector(options.target)) != null ? _a : document.body;
  57935. } else {
  57936. target = options.target || document.body;
  57937. }
  57938. return {
  57939. parent: target === document.body || options.body ? document.body : target,
  57940. background: options.background || "",
  57941. svg: options.svg || "",
  57942. svgViewBox: options.svgViewBox || "",
  57943. spinner: options.spinner || false,
  57944. text: options.text || "",
  57945. fullscreen: target === document.body && ((_b = options.fullscreen) != null ? _b : true),
  57946. lock: (_c = options.lock) != null ? _c : false,
  57947. customClass: options.customClass || "",
  57948. visible: (_d = options.visible) != null ? _d : true,
  57949. beforeClose: options.beforeClose,
  57950. closed: options.closed,
  57951. target
  57952. };
  57953. };
  57954. const addStyle = async (options, parent, instance) => {
  57955. const { nextZIndex } = instance.vm.zIndex || instance.vm._.exposed.zIndex;
  57956. const maskStyle = {};
  57957. if (options.fullscreen) {
  57958. instance.originalPosition.value = getStyle(document.body, "position");
  57959. instance.originalOverflow.value = getStyle(document.body, "overflow");
  57960. maskStyle.zIndex = nextZIndex();
  57961. } else if (options.parent === document.body) {
  57962. instance.originalPosition.value = getStyle(document.body, "position");
  57963. await nextTick();
  57964. for (const property of ["top", "left"]) {
  57965. const scroll = property === "top" ? "scrollTop" : "scrollLeft";
  57966. maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`;
  57967. }
  57968. for (const property of ["height", "width"]) {
  57969. maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`;
  57970. }
  57971. } else {
  57972. instance.originalPosition.value = getStyle(parent, "position");
  57973. }
  57974. for (const [key, value] of Object.entries(maskStyle)) {
  57975. instance.$el.style[key] = value;
  57976. }
  57977. };
  57978. const addClassList = (options, parent, instance) => {
  57979. const ns = instance.vm.ns || instance.vm._.exposed.ns;
  57980. if (!["absolute", "fixed", "sticky"].includes(instance.originalPosition.value)) {
  57981. addClass(parent, ns.bm("parent", "relative"));
  57982. } else {
  57983. removeClass(parent, ns.bm("parent", "relative"));
  57984. }
  57985. if (options.fullscreen && options.lock) {
  57986. addClass(parent, ns.bm("parent", "hidden"));
  57987. } else {
  57988. removeClass(parent, ns.bm("parent", "hidden"));
  57989. }
  57990. };
  57991. const INSTANCE_KEY = Symbol("ElLoading");
  57992. const createInstance = (el, binding) => {
  57993. var _a, _b, _c, _d;
  57994. const vm = binding.instance;
  57995. const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0;
  57996. const resolveExpression = (key) => {
  57997. const data = isString$1(key) && (vm == null ? void 0 : vm[key]) || key;
  57998. if (data)
  57999. return ref(data);
  58000. else
  58001. return data;
  58002. };
  58003. const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(`element-loading-${hyphenate(name)}`));
  58004. const fullscreen = (_a = getBindingProp("fullscreen")) != null ? _a : binding.modifiers.fullscreen;
  58005. const options = {
  58006. text: getProp("text"),
  58007. svg: getProp("svg"),
  58008. svgViewBox: getProp("svgViewBox"),
  58009. spinner: getProp("spinner"),
  58010. background: getProp("background"),
  58011. customClass: getProp("customClass"),
  58012. fullscreen,
  58013. target: (_b = getBindingProp("target")) != null ? _b : fullscreen ? void 0 : el,
  58014. body: (_c = getBindingProp("body")) != null ? _c : binding.modifiers.body,
  58015. lock: (_d = getBindingProp("lock")) != null ? _d : binding.modifiers.lock
  58016. };
  58017. el[INSTANCE_KEY] = {
  58018. options,
  58019. instance: Loading(options)
  58020. };
  58021. };
  58022. const updateOptions = (newOptions, originalOptions) => {
  58023. for (const key of Object.keys(originalOptions)) {
  58024. if (isRef(originalOptions[key]))
  58025. originalOptions[key].value = newOptions[key];
  58026. }
  58027. };
  58028. const vLoading = {
  58029. mounted(el, binding) {
  58030. if (binding.value) {
  58031. createInstance(el, binding);
  58032. }
  58033. },
  58034. updated(el, binding) {
  58035. const instance = el[INSTANCE_KEY];
  58036. if (binding.oldValue !== binding.value) {
  58037. if (binding.value && !binding.oldValue) {
  58038. createInstance(el, binding);
  58039. } else if (binding.value && binding.oldValue) {
  58040. if (isObject$1(binding.value))
  58041. updateOptions(binding.value, instance.options);
  58042. } else {
  58043. instance == null ? void 0 : instance.instance.close();
  58044. }
  58045. }
  58046. },
  58047. unmounted(el) {
  58048. var _a;
  58049. (_a = el[INSTANCE_KEY]) == null ? void 0 : _a.instance.close();
  58050. el[INSTANCE_KEY] = null;
  58051. }
  58052. };
  58053. const ElLoading = {
  58054. install(app) {
  58055. app.directive("loading", vLoading);
  58056. app.config.globalProperties.$loading = Loading;
  58057. },
  58058. directive: vLoading,
  58059. service: Loading
  58060. };
  58061. const messageTypes = ["success", "info", "warning", "error"];
  58062. const messageDefaults = mutable({
  58063. customClass: "",
  58064. center: false,
  58065. dangerouslyUseHTMLString: false,
  58066. duration: 3e3,
  58067. icon: void 0,
  58068. id: "",
  58069. message: "",
  58070. onClose: void 0,
  58071. showClose: false,
  58072. type: "info",
  58073. plain: false,
  58074. offset: 16,
  58075. zIndex: 0,
  58076. grouping: false,
  58077. repeatNum: 1,
  58078. appendTo: isClient ? document.body : void 0
  58079. });
  58080. const messageProps = buildProps({
  58081. customClass: {
  58082. type: String,
  58083. default: messageDefaults.customClass
  58084. },
  58085. center: {
  58086. type: Boolean,
  58087. default: messageDefaults.center
  58088. },
  58089. dangerouslyUseHTMLString: {
  58090. type: Boolean,
  58091. default: messageDefaults.dangerouslyUseHTMLString
  58092. },
  58093. duration: {
  58094. type: Number,
  58095. default: messageDefaults.duration
  58096. },
  58097. icon: {
  58098. type: iconPropType,
  58099. default: messageDefaults.icon
  58100. },
  58101. id: {
  58102. type: String,
  58103. default: messageDefaults.id
  58104. },
  58105. message: {
  58106. type: definePropType([
  58107. String,
  58108. Object,
  58109. Function
  58110. ]),
  58111. default: messageDefaults.message
  58112. },
  58113. onClose: {
  58114. type: definePropType(Function),
  58115. default: messageDefaults.onClose
  58116. },
  58117. showClose: {
  58118. type: Boolean,
  58119. default: messageDefaults.showClose
  58120. },
  58121. type: {
  58122. type: String,
  58123. values: messageTypes,
  58124. default: messageDefaults.type
  58125. },
  58126. plain: {
  58127. type: Boolean,
  58128. default: messageDefaults.plain
  58129. },
  58130. offset: {
  58131. type: Number,
  58132. default: messageDefaults.offset
  58133. },
  58134. zIndex: {
  58135. type: Number,
  58136. default: messageDefaults.zIndex
  58137. },
  58138. grouping: {
  58139. type: Boolean,
  58140. default: messageDefaults.grouping
  58141. },
  58142. repeatNum: {
  58143. type: Number,
  58144. default: messageDefaults.repeatNum
  58145. }
  58146. });
  58147. const messageEmits = {
  58148. destroy: () => true
  58149. };
  58150. const instances = shallowReactive([]);
  58151. const getInstance = (id) => {
  58152. const idx = instances.findIndex((instance) => instance.id === id);
  58153. const current = instances[idx];
  58154. let prev;
  58155. if (idx > 0) {
  58156. prev = instances[idx - 1];
  58157. }
  58158. return { current, prev };
  58159. };
  58160. const getLastOffset = (id) => {
  58161. const { prev } = getInstance(id);
  58162. if (!prev)
  58163. return 0;
  58164. return prev.vm.exposed.bottom.value;
  58165. };
  58166. const getOffsetOrSpace = (id, offset) => {
  58167. const idx = instances.findIndex((instance) => instance.id === id);
  58168. return idx > 0 ? 16 : offset;
  58169. };
  58170. const __default__$1 = defineComponent({
  58171. name: "ElMessage"
  58172. });
  58173. const _sfc_main$2 = /* @__PURE__ */ defineComponent({
  58174. ...__default__$1,
  58175. props: messageProps,
  58176. emits: messageEmits,
  58177. setup(__props, { expose }) {
  58178. const props = __props;
  58179. const { Close } = TypeComponents;
  58180. const { ns, zIndex } = useGlobalComponentSettings("message");
  58181. const { currentZIndex, nextZIndex } = zIndex;
  58182. const messageRef = ref();
  58183. const visible = ref(false);
  58184. const height = ref(0);
  58185. let stopTimer = void 0;
  58186. const badgeType = computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  58187. const typeClass = computed(() => {
  58188. const type = props.type;
  58189. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  58190. });
  58191. const iconComponent = computed(() => props.icon || TypeComponentsMap[props.type] || "");
  58192. const lastOffset = computed(() => getLastOffset(props.id));
  58193. const offset = computed(() => getOffsetOrSpace(props.id, props.offset) + lastOffset.value);
  58194. const bottom = computed(() => height.value + offset.value);
  58195. const customStyle = computed(() => ({
  58196. top: `${offset.value}px`,
  58197. zIndex: currentZIndex.value
  58198. }));
  58199. function startTimer() {
  58200. if (props.duration === 0)
  58201. return;
  58202. ({ stop: stopTimer } = useTimeoutFn(() => {
  58203. close();
  58204. }, props.duration));
  58205. }
  58206. function clearTimer() {
  58207. stopTimer == null ? void 0 : stopTimer();
  58208. }
  58209. function close() {
  58210. visible.value = false;
  58211. }
  58212. function keydown({ code }) {
  58213. if (code === EVENT_CODE.esc) {
  58214. close();
  58215. }
  58216. }
  58217. onMounted(() => {
  58218. startTimer();
  58219. nextZIndex();
  58220. visible.value = true;
  58221. });
  58222. watch(() => props.repeatNum, () => {
  58223. clearTimer();
  58224. startTimer();
  58225. });
  58226. useEventListener(document, "keydown", keydown);
  58227. useResizeObserver(messageRef, () => {
  58228. height.value = messageRef.value.getBoundingClientRect().height;
  58229. });
  58230. expose({
  58231. visible,
  58232. bottom,
  58233. close
  58234. });
  58235. return (_ctx, _cache) => {
  58236. return openBlock(), createBlock(Transition, {
  58237. name: unref(ns).b("fade"),
  58238. onBeforeLeave: _ctx.onClose,
  58239. onAfterLeave: ($event) => _ctx.$emit("destroy"),
  58240. persisted: ""
  58241. }, {
  58242. default: withCtx(() => [
  58243. withDirectives(createElementVNode("div", {
  58244. id: _ctx.id,
  58245. ref_key: "messageRef",
  58246. ref: messageRef,
  58247. class: normalizeClass([
  58248. unref(ns).b(),
  58249. { [unref(ns).m(_ctx.type)]: _ctx.type },
  58250. unref(ns).is("center", _ctx.center),
  58251. unref(ns).is("closable", _ctx.showClose),
  58252. unref(ns).is("plain", _ctx.plain),
  58253. _ctx.customClass
  58254. ]),
  58255. style: normalizeStyle(unref(customStyle)),
  58256. role: "alert",
  58257. onMouseenter: clearTimer,
  58258. onMouseleave: startTimer
  58259. }, [
  58260. _ctx.repeatNum > 1 ? (openBlock(), createBlock(unref(ElBadge), {
  58261. key: 0,
  58262. value: _ctx.repeatNum,
  58263. type: unref(badgeType),
  58264. class: normalizeClass(unref(ns).e("badge"))
  58265. }, null, 8, ["value", "type", "class"])) : createCommentVNode("v-if", true),
  58266. unref(iconComponent) ? (openBlock(), createBlock(unref(ElIcon), {
  58267. key: 1,
  58268. class: normalizeClass([unref(ns).e("icon"), unref(typeClass)])
  58269. }, {
  58270. default: withCtx(() => [
  58271. (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent))))
  58272. ]),
  58273. _: 1
  58274. }, 8, ["class"])) : createCommentVNode("v-if", true),
  58275. renderSlot(_ctx.$slots, "default", {}, () => [
  58276. !_ctx.dangerouslyUseHTMLString ? (openBlock(), createElementBlock("p", {
  58277. key: 0,
  58278. class: normalizeClass(unref(ns).e("content"))
  58279. }, toDisplayString(_ctx.message), 3)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  58280. createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  58281. createElementVNode("p", {
  58282. class: normalizeClass(unref(ns).e("content")),
  58283. innerHTML: _ctx.message
  58284. }, null, 10, ["innerHTML"])
  58285. ], 2112))
  58286. ]),
  58287. _ctx.showClose ? (openBlock(), createBlock(unref(ElIcon), {
  58288. key: 2,
  58289. class: normalizeClass(unref(ns).e("closeBtn")),
  58290. onClick: withModifiers(close, ["stop"])
  58291. }, {
  58292. default: withCtx(() => [
  58293. createVNode(unref(Close))
  58294. ]),
  58295. _: 1
  58296. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  58297. ], 46, ["id"]), [
  58298. [vShow, visible.value]
  58299. ])
  58300. ]),
  58301. _: 3
  58302. }, 8, ["name", "onBeforeLeave", "onAfterLeave"]);
  58303. };
  58304. }
  58305. });
  58306. var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "message.vue"]]);
  58307. let seed$1 = 1;
  58308. const normalizeOptions = (params) => {
  58309. const options = !params || isString$1(params) || isVNode(params) || isFunction$1(params) ? { message: params } : params;
  58310. const normalized = {
  58311. ...messageDefaults,
  58312. ...options
  58313. };
  58314. if (!normalized.appendTo) {
  58315. normalized.appendTo = document.body;
  58316. } else if (isString$1(normalized.appendTo)) {
  58317. let appendTo = document.querySelector(normalized.appendTo);
  58318. if (!isElement$1(appendTo)) {
  58319. appendTo = document.body;
  58320. }
  58321. normalized.appendTo = appendTo;
  58322. }
  58323. if (isBoolean(messageConfig.grouping) && !normalized.grouping) {
  58324. normalized.grouping = messageConfig.grouping;
  58325. }
  58326. if (isNumber(messageConfig.duration) && normalized.duration === 3e3) {
  58327. normalized.duration = messageConfig.duration;
  58328. }
  58329. if (isNumber(messageConfig.offset) && normalized.offset === 16) {
  58330. normalized.offset = messageConfig.offset;
  58331. }
  58332. if (isBoolean(messageConfig.showClose) && !normalized.showClose) {
  58333. normalized.showClose = messageConfig.showClose;
  58334. }
  58335. return normalized;
  58336. };
  58337. const closeMessage = (instance) => {
  58338. const idx = instances.indexOf(instance);
  58339. if (idx === -1)
  58340. return;
  58341. instances.splice(idx, 1);
  58342. const { handler } = instance;
  58343. handler.close();
  58344. };
  58345. const createMessage = ({ appendTo, ...options }, context) => {
  58346. const id = `message_${seed$1++}`;
  58347. const userOnClose = options.onClose;
  58348. const container = document.createElement("div");
  58349. const props = {
  58350. ...options,
  58351. id,
  58352. onClose: () => {
  58353. userOnClose == null ? void 0 : userOnClose();
  58354. closeMessage(instance);
  58355. },
  58356. onDestroy: () => {
  58357. render(null, container);
  58358. }
  58359. };
  58360. const vnode = createVNode(MessageConstructor, props, isFunction$1(props.message) || isVNode(props.message) ? {
  58361. default: isFunction$1(props.message) ? props.message : () => props.message
  58362. } : null);
  58363. vnode.appContext = context || message._context;
  58364. render(vnode, container);
  58365. appendTo.appendChild(container.firstElementChild);
  58366. const vm = vnode.component;
  58367. const handler = {
  58368. close: () => {
  58369. vm.exposed.visible.value = false;
  58370. }
  58371. };
  58372. const instance = {
  58373. id,
  58374. vnode,
  58375. vm,
  58376. handler,
  58377. props: vnode.component.props
  58378. };
  58379. return instance;
  58380. };
  58381. const message = (options = {}, context) => {
  58382. if (!isClient)
  58383. return { close: () => void 0 };
  58384. const normalized = normalizeOptions(options);
  58385. if (normalized.grouping && instances.length) {
  58386. const instance2 = instances.find(({ vnode: vm }) => {
  58387. var _a;
  58388. return ((_a = vm.props) == null ? void 0 : _a.message) === normalized.message;
  58389. });
  58390. if (instance2) {
  58391. instance2.props.repeatNum += 1;
  58392. instance2.props.type = normalized.type;
  58393. return instance2.handler;
  58394. }
  58395. }
  58396. if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
  58397. return { close: () => void 0 };
  58398. }
  58399. const instance = createMessage(normalized, context);
  58400. instances.push(instance);
  58401. return instance.handler;
  58402. };
  58403. messageTypes.forEach((type) => {
  58404. message[type] = (options = {}, appContext) => {
  58405. const normalized = normalizeOptions(options);
  58406. return message({ ...normalized, type }, appContext);
  58407. };
  58408. });
  58409. function closeAll$1(type) {
  58410. for (const instance of instances) {
  58411. if (!type || type === instance.props.type) {
  58412. instance.handler.close();
  58413. }
  58414. }
  58415. }
  58416. message.closeAll = closeAll$1;
  58417. message._context = null;
  58418. var Message = message;
  58419. const ElMessage = withInstallFunction(Message, "$message");
  58420. const _sfc_main$1 = defineComponent({
  58421. name: "ElMessageBox",
  58422. directives: {
  58423. TrapFocus
  58424. },
  58425. components: {
  58426. ElButton,
  58427. ElFocusTrap,
  58428. ElInput,
  58429. ElOverlay,
  58430. ElIcon,
  58431. ...TypeComponents
  58432. },
  58433. inheritAttrs: false,
  58434. props: {
  58435. buttonSize: {
  58436. type: String,
  58437. validator: isValidComponentSize
  58438. },
  58439. modal: {
  58440. type: Boolean,
  58441. default: true
  58442. },
  58443. lockScroll: {
  58444. type: Boolean,
  58445. default: true
  58446. },
  58447. showClose: {
  58448. type: Boolean,
  58449. default: true
  58450. },
  58451. closeOnClickModal: {
  58452. type: Boolean,
  58453. default: true
  58454. },
  58455. closeOnPressEscape: {
  58456. type: Boolean,
  58457. default: true
  58458. },
  58459. closeOnHashChange: {
  58460. type: Boolean,
  58461. default: true
  58462. },
  58463. center: Boolean,
  58464. draggable: Boolean,
  58465. overflow: Boolean,
  58466. roundButton: {
  58467. default: false,
  58468. type: Boolean
  58469. },
  58470. container: {
  58471. type: String,
  58472. default: "body"
  58473. },
  58474. boxType: {
  58475. type: String,
  58476. default: ""
  58477. }
  58478. },
  58479. emits: ["vanish", "action"],
  58480. setup(props, { emit }) {
  58481. const {
  58482. locale,
  58483. zIndex,
  58484. ns,
  58485. size: btnSize
  58486. } = useGlobalComponentSettings("message-box", computed(() => props.buttonSize));
  58487. const { t } = locale;
  58488. const { nextZIndex } = zIndex;
  58489. const visible = ref(false);
  58490. const state = reactive({
  58491. autofocus: true,
  58492. beforeClose: null,
  58493. callback: null,
  58494. cancelButtonText: "",
  58495. cancelButtonClass: "",
  58496. confirmButtonText: "",
  58497. confirmButtonClass: "",
  58498. customClass: "",
  58499. customStyle: {},
  58500. dangerouslyUseHTMLString: false,
  58501. distinguishCancelAndClose: false,
  58502. icon: "",
  58503. inputPattern: null,
  58504. inputPlaceholder: "",
  58505. inputType: "text",
  58506. inputValue: null,
  58507. inputValidator: null,
  58508. inputErrorMessage: "",
  58509. message: null,
  58510. modalFade: true,
  58511. modalClass: "",
  58512. showCancelButton: false,
  58513. showConfirmButton: true,
  58514. type: "",
  58515. title: void 0,
  58516. showInput: false,
  58517. action: "",
  58518. confirmButtonLoading: false,
  58519. cancelButtonLoading: false,
  58520. confirmButtonLoadingIcon: markRaw(loading_default),
  58521. cancelButtonLoadingIcon: markRaw(loading_default),
  58522. confirmButtonDisabled: false,
  58523. editorErrorMessage: "",
  58524. validateError: false,
  58525. zIndex: nextZIndex()
  58526. });
  58527. const typeClass = computed(() => {
  58528. const type = state.type;
  58529. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  58530. });
  58531. const contentId = useId();
  58532. const inputId = useId();
  58533. const iconComponent = computed(() => state.icon || TypeComponentsMap[state.type] || "");
  58534. const hasMessage = computed(() => !!state.message);
  58535. const rootRef = ref();
  58536. const headerRef = ref();
  58537. const focusStartRef = ref();
  58538. const inputRef = ref();
  58539. const confirmRef = ref();
  58540. const confirmButtonClasses = computed(() => state.confirmButtonClass);
  58541. watch(() => state.inputValue, async (val) => {
  58542. await nextTick();
  58543. if (props.boxType === "prompt" && val !== null) {
  58544. validate();
  58545. }
  58546. }, { immediate: true });
  58547. watch(() => visible.value, (val) => {
  58548. var _a, _b;
  58549. if (val) {
  58550. if (props.boxType !== "prompt") {
  58551. if (state.autofocus) {
  58552. focusStartRef.value = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) != null ? _b : rootRef.value;
  58553. } else {
  58554. focusStartRef.value = rootRef.value;
  58555. }
  58556. }
  58557. state.zIndex = nextZIndex();
  58558. }
  58559. if (props.boxType !== "prompt")
  58560. return;
  58561. if (val) {
  58562. nextTick().then(() => {
  58563. var _a2;
  58564. if (inputRef.value && inputRef.value.$el) {
  58565. if (state.autofocus) {
  58566. focusStartRef.value = (_a2 = getInputElement()) != null ? _a2 : rootRef.value;
  58567. } else {
  58568. focusStartRef.value = rootRef.value;
  58569. }
  58570. }
  58571. });
  58572. } else {
  58573. state.editorErrorMessage = "";
  58574. state.validateError = false;
  58575. }
  58576. });
  58577. const draggable = computed(() => props.draggable);
  58578. const overflow = computed(() => props.overflow);
  58579. useDraggable(rootRef, headerRef, draggable, overflow);
  58580. onMounted(async () => {
  58581. await nextTick();
  58582. if (props.closeOnHashChange) {
  58583. window.addEventListener("hashchange", doClose);
  58584. }
  58585. });
  58586. onBeforeUnmount(() => {
  58587. if (props.closeOnHashChange) {
  58588. window.removeEventListener("hashchange", doClose);
  58589. }
  58590. });
  58591. function doClose() {
  58592. if (!visible.value)
  58593. return;
  58594. visible.value = false;
  58595. nextTick(() => {
  58596. if (state.action)
  58597. emit("action", state.action);
  58598. });
  58599. }
  58600. const handleWrapperClick = () => {
  58601. if (props.closeOnClickModal) {
  58602. handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
  58603. }
  58604. };
  58605. const overlayEvent = useSameTarget(handleWrapperClick);
  58606. const handleInputEnter = (e) => {
  58607. if (state.inputType !== "textarea") {
  58608. e.preventDefault();
  58609. return handleAction("confirm");
  58610. }
  58611. };
  58612. const handleAction = (action) => {
  58613. var _a;
  58614. if (props.boxType === "prompt" && action === "confirm" && !validate()) {
  58615. return;
  58616. }
  58617. state.action = action;
  58618. if (state.beforeClose) {
  58619. (_a = state.beforeClose) == null ? void 0 : _a.call(state, action, state, doClose);
  58620. } else {
  58621. doClose();
  58622. }
  58623. };
  58624. const validate = () => {
  58625. if (props.boxType === "prompt") {
  58626. const inputPattern = state.inputPattern;
  58627. if (inputPattern && !inputPattern.test(state.inputValue || "")) {
  58628. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  58629. state.validateError = true;
  58630. return false;
  58631. }
  58632. const inputValidator = state.inputValidator;
  58633. if (isFunction$1(inputValidator)) {
  58634. const validateResult = inputValidator(state.inputValue);
  58635. if (validateResult === false) {
  58636. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  58637. state.validateError = true;
  58638. return false;
  58639. }
  58640. if (isString$1(validateResult)) {
  58641. state.editorErrorMessage = validateResult;
  58642. state.validateError = true;
  58643. return false;
  58644. }
  58645. }
  58646. }
  58647. state.editorErrorMessage = "";
  58648. state.validateError = false;
  58649. return true;
  58650. };
  58651. const getInputElement = () => {
  58652. const inputRefs = inputRef.value.$refs;
  58653. return inputRefs.input || inputRefs.textarea;
  58654. };
  58655. const handleClose = () => {
  58656. handleAction("close");
  58657. };
  58658. const onCloseRequested = () => {
  58659. if (props.closeOnPressEscape) {
  58660. handleClose();
  58661. }
  58662. };
  58663. if (props.lockScroll) {
  58664. useLockscreen(visible);
  58665. }
  58666. return {
  58667. ...toRefs(state),
  58668. ns,
  58669. overlayEvent,
  58670. visible,
  58671. hasMessage,
  58672. typeClass,
  58673. contentId,
  58674. inputId,
  58675. btnSize,
  58676. iconComponent,
  58677. confirmButtonClasses,
  58678. rootRef,
  58679. focusStartRef,
  58680. headerRef,
  58681. inputRef,
  58682. confirmRef,
  58683. doClose,
  58684. handleClose,
  58685. onCloseRequested,
  58686. handleWrapperClick,
  58687. handleInputEnter,
  58688. handleAction,
  58689. t
  58690. };
  58691. }
  58692. });
  58693. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  58694. const _component_el_icon = resolveComponent("el-icon");
  58695. const _component_close = resolveComponent("close");
  58696. const _component_el_input = resolveComponent("el-input");
  58697. const _component_el_button = resolveComponent("el-button");
  58698. const _component_el_focus_trap = resolveComponent("el-focus-trap");
  58699. const _component_el_overlay = resolveComponent("el-overlay");
  58700. return openBlock(), createBlock(Transition, {
  58701. name: "fade-in-linear",
  58702. onAfterLeave: ($event) => _ctx.$emit("vanish"),
  58703. persisted: ""
  58704. }, {
  58705. default: withCtx(() => [
  58706. withDirectives(createVNode(_component_el_overlay, {
  58707. "z-index": _ctx.zIndex,
  58708. "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
  58709. mask: _ctx.modal
  58710. }, {
  58711. default: withCtx(() => [
  58712. createElementVNode("div", {
  58713. role: "dialog",
  58714. "aria-label": _ctx.title,
  58715. "aria-modal": "true",
  58716. "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
  58717. class: normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
  58718. onClick: _ctx.overlayEvent.onClick,
  58719. onMousedown: _ctx.overlayEvent.onMousedown,
  58720. onMouseup: _ctx.overlayEvent.onMouseup
  58721. }, [
  58722. createVNode(_component_el_focus_trap, {
  58723. loop: "",
  58724. trapped: _ctx.visible,
  58725. "focus-trap-el": _ctx.rootRef,
  58726. "focus-start-el": _ctx.focusStartRef,
  58727. onReleaseRequested: _ctx.onCloseRequested
  58728. }, {
  58729. default: withCtx(() => [
  58730. createElementVNode("div", {
  58731. ref: "rootRef",
  58732. class: normalizeClass([
  58733. _ctx.ns.b(),
  58734. _ctx.customClass,
  58735. _ctx.ns.is("draggable", _ctx.draggable),
  58736. { [_ctx.ns.m("center")]: _ctx.center }
  58737. ]),
  58738. style: normalizeStyle(_ctx.customStyle),
  58739. tabindex: "-1",
  58740. onClick: withModifiers(() => {
  58741. }, ["stop"])
  58742. }, [
  58743. _ctx.title !== null && _ctx.title !== void 0 ? (openBlock(), createElementBlock("div", {
  58744. key: 0,
  58745. ref: "headerRef",
  58746. class: normalizeClass([_ctx.ns.e("header"), { "show-close": _ctx.showClose }])
  58747. }, [
  58748. createElementVNode("div", {
  58749. class: normalizeClass(_ctx.ns.e("title"))
  58750. }, [
  58751. _ctx.iconComponent && _ctx.center ? (openBlock(), createBlock(_component_el_icon, {
  58752. key: 0,
  58753. class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  58754. }, {
  58755. default: withCtx(() => [
  58756. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  58757. ]),
  58758. _: 1
  58759. }, 8, ["class"])) : createCommentVNode("v-if", true),
  58760. createElementVNode("span", null, toDisplayString(_ctx.title), 1)
  58761. ], 2),
  58762. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  58763. key: 0,
  58764. type: "button",
  58765. class: normalizeClass(_ctx.ns.e("headerbtn")),
  58766. "aria-label": _ctx.t("el.messagebox.close"),
  58767. onClick: ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"),
  58768. onKeydown: withKeys(withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"])
  58769. }, [
  58770. createVNode(_component_el_icon, {
  58771. class: normalizeClass(_ctx.ns.e("close"))
  58772. }, {
  58773. default: withCtx(() => [
  58774. createVNode(_component_close)
  58775. ]),
  58776. _: 1
  58777. }, 8, ["class"])
  58778. ], 42, ["aria-label", "onClick", "onKeydown"])) : createCommentVNode("v-if", true)
  58779. ], 2)) : createCommentVNode("v-if", true),
  58780. createElementVNode("div", {
  58781. id: _ctx.contentId,
  58782. class: normalizeClass(_ctx.ns.e("content"))
  58783. }, [
  58784. createElementVNode("div", {
  58785. class: normalizeClass(_ctx.ns.e("container"))
  58786. }, [
  58787. _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (openBlock(), createBlock(_component_el_icon, {
  58788. key: 0,
  58789. class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  58790. }, {
  58791. default: withCtx(() => [
  58792. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  58793. ]),
  58794. _: 1
  58795. }, 8, ["class"])) : createCommentVNode("v-if", true),
  58796. _ctx.hasMessage ? (openBlock(), createElementBlock("div", {
  58797. key: 1,
  58798. class: normalizeClass(_ctx.ns.e("message"))
  58799. }, [
  58800. renderSlot(_ctx.$slots, "default", {}, () => [
  58801. !_ctx.dangerouslyUseHTMLString ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  58802. key: 0,
  58803. for: _ctx.showInput ? _ctx.inputId : void 0
  58804. }, {
  58805. default: withCtx(() => [
  58806. createTextVNode(toDisplayString(!_ctx.dangerouslyUseHTMLString ? _ctx.message : ""), 1)
  58807. ]),
  58808. _: 1
  58809. }, 8, ["for"])) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  58810. key: 1,
  58811. for: _ctx.showInput ? _ctx.inputId : void 0,
  58812. innerHTML: _ctx.message
  58813. }, null, 8, ["for", "innerHTML"]))
  58814. ])
  58815. ], 2)) : createCommentVNode("v-if", true)
  58816. ], 2),
  58817. withDirectives(createElementVNode("div", {
  58818. class: normalizeClass(_ctx.ns.e("input"))
  58819. }, [
  58820. createVNode(_component_el_input, {
  58821. id: _ctx.inputId,
  58822. ref: "inputRef",
  58823. modelValue: _ctx.inputValue,
  58824. "onUpdate:modelValue": ($event) => _ctx.inputValue = $event,
  58825. type: _ctx.inputType,
  58826. placeholder: _ctx.inputPlaceholder,
  58827. "aria-invalid": _ctx.validateError,
  58828. class: normalizeClass({ invalid: _ctx.validateError }),
  58829. onKeydown: withKeys(_ctx.handleInputEnter, ["enter"])
  58830. }, null, 8, ["id", "modelValue", "onUpdate:modelValue", "type", "placeholder", "aria-invalid", "class", "onKeydown"]),
  58831. createElementVNode("div", {
  58832. class: normalizeClass(_ctx.ns.e("errormsg")),
  58833. style: normalizeStyle({
  58834. visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden"
  58835. })
  58836. }, toDisplayString(_ctx.editorErrorMessage), 7)
  58837. ], 2), [
  58838. [vShow, _ctx.showInput]
  58839. ])
  58840. ], 10, ["id"]),
  58841. createElementVNode("div", {
  58842. class: normalizeClass(_ctx.ns.e("btns"))
  58843. }, [
  58844. _ctx.showCancelButton ? (openBlock(), createBlock(_component_el_button, {
  58845. key: 0,
  58846. loading: _ctx.cancelButtonLoading,
  58847. "loading-icon": _ctx.cancelButtonLoadingIcon,
  58848. class: normalizeClass([_ctx.cancelButtonClass]),
  58849. round: _ctx.roundButton,
  58850. size: _ctx.btnSize,
  58851. onClick: ($event) => _ctx.handleAction("cancel"),
  58852. onKeydown: withKeys(withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"])
  58853. }, {
  58854. default: withCtx(() => [
  58855. createTextVNode(toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)
  58856. ]),
  58857. _: 1
  58858. }, 8, ["loading", "loading-icon", "class", "round", "size", "onClick", "onKeydown"])) : createCommentVNode("v-if", true),
  58859. withDirectives(createVNode(_component_el_button, {
  58860. ref: "confirmRef",
  58861. type: "primary",
  58862. loading: _ctx.confirmButtonLoading,
  58863. "loading-icon": _ctx.confirmButtonLoadingIcon,
  58864. class: normalizeClass([_ctx.confirmButtonClasses]),
  58865. round: _ctx.roundButton,
  58866. disabled: _ctx.confirmButtonDisabled,
  58867. size: _ctx.btnSize,
  58868. onClick: ($event) => _ctx.handleAction("confirm"),
  58869. onKeydown: withKeys(withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"])
  58870. }, {
  58871. default: withCtx(() => [
  58872. createTextVNode(toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)
  58873. ]),
  58874. _: 1
  58875. }, 8, ["loading", "loading-icon", "class", "round", "disabled", "size", "onClick", "onKeydown"]), [
  58876. [vShow, _ctx.showConfirmButton]
  58877. ])
  58878. ], 2)
  58879. ], 14, ["onClick"])
  58880. ]),
  58881. _: 3
  58882. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  58883. ], 42, ["aria-label", "aria-describedby", "onClick", "onMousedown", "onMouseup"])
  58884. ]),
  58885. _: 3
  58886. }, 8, ["z-index", "overlay-class", "mask"]), [
  58887. [vShow, _ctx.visible]
  58888. ])
  58889. ]),
  58890. _: 3
  58891. }, 8, ["onAfterLeave"]);
  58892. }
  58893. var MessageBoxConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "index.vue"]]);
  58894. const messageInstance = /* @__PURE__ */ new Map();
  58895. const getAppendToElement = (props) => {
  58896. let appendTo = document.body;
  58897. if (props.appendTo) {
  58898. if (isString$1(props.appendTo)) {
  58899. appendTo = document.querySelector(props.appendTo);
  58900. }
  58901. if (isElement$1(props.appendTo)) {
  58902. appendTo = props.appendTo;
  58903. }
  58904. if (!isElement$1(appendTo)) {
  58905. appendTo = document.body;
  58906. }
  58907. }
  58908. return appendTo;
  58909. };
  58910. const initInstance = (props, container, appContext = null) => {
  58911. const vnode = createVNode(MessageBoxConstructor, props, isFunction$1(props.message) || isVNode(props.message) ? {
  58912. default: isFunction$1(props.message) ? props.message : () => props.message
  58913. } : null);
  58914. vnode.appContext = appContext;
  58915. render(vnode, container);
  58916. getAppendToElement(props).appendChild(container.firstElementChild);
  58917. return vnode.component;
  58918. };
  58919. const genContainer = () => {
  58920. return document.createElement("div");
  58921. };
  58922. const showMessage = (options, appContext) => {
  58923. const container = genContainer();
  58924. options.onVanish = () => {
  58925. render(null, container);
  58926. messageInstance.delete(vm);
  58927. };
  58928. options.onAction = (action) => {
  58929. const currentMsg = messageInstance.get(vm);
  58930. let resolve;
  58931. if (options.showInput) {
  58932. resolve = { value: vm.inputValue, action };
  58933. } else {
  58934. resolve = action;
  58935. }
  58936. if (options.callback) {
  58937. options.callback(resolve, instance.proxy);
  58938. } else {
  58939. if (action === "cancel" || action === "close") {
  58940. if (options.distinguishCancelAndClose && action !== "cancel") {
  58941. currentMsg.reject("close");
  58942. } else {
  58943. currentMsg.reject("cancel");
  58944. }
  58945. } else {
  58946. currentMsg.resolve(resolve);
  58947. }
  58948. }
  58949. };
  58950. const instance = initInstance(options, container, appContext);
  58951. const vm = instance.proxy;
  58952. for (const prop in options) {
  58953. if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) {
  58954. vm[prop] = options[prop];
  58955. }
  58956. }
  58957. vm.visible = true;
  58958. return vm;
  58959. };
  58960. function MessageBox(options, appContext = null) {
  58961. if (!isClient)
  58962. return Promise.reject();
  58963. let callback;
  58964. if (isString$1(options) || isVNode(options)) {
  58965. options = {
  58966. message: options
  58967. };
  58968. } else {
  58969. callback = options.callback;
  58970. }
  58971. return new Promise((resolve, reject) => {
  58972. const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
  58973. messageInstance.set(vm, {
  58974. options,
  58975. callback,
  58976. resolve,
  58977. reject
  58978. });
  58979. });
  58980. }
  58981. const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
  58982. const MESSAGE_BOX_DEFAULT_OPTS = {
  58983. alert: { closeOnPressEscape: false, closeOnClickModal: false },
  58984. confirm: { showCancelButton: true },
  58985. prompt: { showCancelButton: true, showInput: true }
  58986. };
  58987. MESSAGE_BOX_VARIANTS.forEach((boxType) => {
  58988. MessageBox[boxType] = messageBoxFactory(boxType);
  58989. });
  58990. function messageBoxFactory(boxType) {
  58991. return (message, title, options, appContext) => {
  58992. let titleOrOpts = "";
  58993. if (isObject$1(title)) {
  58994. options = title;
  58995. titleOrOpts = "";
  58996. } else if (isUndefined(title)) {
  58997. titleOrOpts = "";
  58998. } else {
  58999. titleOrOpts = title;
  59000. }
  59001. return MessageBox(Object.assign({
  59002. title: titleOrOpts,
  59003. message,
  59004. type: "",
  59005. ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
  59006. }, options, {
  59007. boxType
  59008. }), appContext);
  59009. };
  59010. }
  59011. MessageBox.close = () => {
  59012. messageInstance.forEach((_, vm) => {
  59013. vm.doClose();
  59014. });
  59015. messageInstance.clear();
  59016. };
  59017. MessageBox._context = null;
  59018. const _MessageBox = MessageBox;
  59019. _MessageBox.install = (app) => {
  59020. _MessageBox._context = app._context;
  59021. app.config.globalProperties.$msgbox = _MessageBox;
  59022. app.config.globalProperties.$messageBox = _MessageBox;
  59023. app.config.globalProperties.$alert = _MessageBox.alert;
  59024. app.config.globalProperties.$confirm = _MessageBox.confirm;
  59025. app.config.globalProperties.$prompt = _MessageBox.prompt;
  59026. };
  59027. const ElMessageBox = _MessageBox;
  59028. const notificationTypes = [
  59029. "success",
  59030. "info",
  59031. "warning",
  59032. "error"
  59033. ];
  59034. const notificationProps = buildProps({
  59035. customClass: {
  59036. type: String,
  59037. default: ""
  59038. },
  59039. dangerouslyUseHTMLString: Boolean,
  59040. duration: {
  59041. type: Number,
  59042. default: 4500
  59043. },
  59044. icon: {
  59045. type: iconPropType
  59046. },
  59047. id: {
  59048. type: String,
  59049. default: ""
  59050. },
  59051. message: {
  59052. type: definePropType([
  59053. String,
  59054. Object,
  59055. Function
  59056. ]),
  59057. default: ""
  59058. },
  59059. offset: {
  59060. type: Number,
  59061. default: 0
  59062. },
  59063. onClick: {
  59064. type: definePropType(Function),
  59065. default: () => void 0
  59066. },
  59067. onClose: {
  59068. type: definePropType(Function),
  59069. required: true
  59070. },
  59071. position: {
  59072. type: String,
  59073. values: ["top-right", "top-left", "bottom-right", "bottom-left"],
  59074. default: "top-right"
  59075. },
  59076. showClose: {
  59077. type: Boolean,
  59078. default: true
  59079. },
  59080. title: {
  59081. type: String,
  59082. default: ""
  59083. },
  59084. type: {
  59085. type: String,
  59086. values: [...notificationTypes, ""],
  59087. default: ""
  59088. },
  59089. zIndex: Number
  59090. });
  59091. const notificationEmits = {
  59092. destroy: () => true
  59093. };
  59094. const __default__ = defineComponent({
  59095. name: "ElNotification"
  59096. });
  59097. const _sfc_main = /* @__PURE__ */ defineComponent({
  59098. ...__default__,
  59099. props: notificationProps,
  59100. emits: notificationEmits,
  59101. setup(__props, { expose }) {
  59102. const props = __props;
  59103. const { ns, zIndex } = useGlobalComponentSettings("notification");
  59104. const { nextZIndex, currentZIndex } = zIndex;
  59105. const { Close } = CloseComponents;
  59106. const visible = ref(false);
  59107. let timer = void 0;
  59108. const typeClass = computed(() => {
  59109. const type = props.type;
  59110. return type && TypeComponentsMap[props.type] ? ns.m(type) : "";
  59111. });
  59112. const iconComponent = computed(() => {
  59113. if (!props.type)
  59114. return props.icon;
  59115. return TypeComponentsMap[props.type] || props.icon;
  59116. });
  59117. const horizontalClass = computed(() => props.position.endsWith("right") ? "right" : "left");
  59118. const verticalProperty = computed(() => props.position.startsWith("top") ? "top" : "bottom");
  59119. const positionStyle = computed(() => {
  59120. var _a;
  59121. return {
  59122. [verticalProperty.value]: `${props.offset}px`,
  59123. zIndex: (_a = props.zIndex) != null ? _a : currentZIndex.value
  59124. };
  59125. });
  59126. function startTimer() {
  59127. if (props.duration > 0) {
  59128. ({ stop: timer } = useTimeoutFn(() => {
  59129. if (visible.value)
  59130. close();
  59131. }, props.duration));
  59132. }
  59133. }
  59134. function clearTimer() {
  59135. timer == null ? void 0 : timer();
  59136. }
  59137. function close() {
  59138. visible.value = false;
  59139. }
  59140. function onKeydown({ code }) {
  59141. if (code === EVENT_CODE.delete || code === EVENT_CODE.backspace) {
  59142. clearTimer();
  59143. } else if (code === EVENT_CODE.esc) {
  59144. if (visible.value) {
  59145. close();
  59146. }
  59147. } else {
  59148. startTimer();
  59149. }
  59150. }
  59151. onMounted(() => {
  59152. startTimer();
  59153. nextZIndex();
  59154. visible.value = true;
  59155. });
  59156. useEventListener(document, "keydown", onKeydown);
  59157. expose({
  59158. visible,
  59159. close
  59160. });
  59161. return (_ctx, _cache) => {
  59162. return openBlock(), createBlock(Transition, {
  59163. name: unref(ns).b("fade"),
  59164. onBeforeLeave: _ctx.onClose,
  59165. onAfterLeave: ($event) => _ctx.$emit("destroy"),
  59166. persisted: ""
  59167. }, {
  59168. default: withCtx(() => [
  59169. withDirectives(createElementVNode("div", {
  59170. id: _ctx.id,
  59171. class: normalizeClass([unref(ns).b(), _ctx.customClass, unref(horizontalClass)]),
  59172. style: normalizeStyle(unref(positionStyle)),
  59173. role: "alert",
  59174. onMouseenter: clearTimer,
  59175. onMouseleave: startTimer,
  59176. onClick: _ctx.onClick
  59177. }, [
  59178. unref(iconComponent) ? (openBlock(), createBlock(unref(ElIcon), {
  59179. key: 0,
  59180. class: normalizeClass([unref(ns).e("icon"), unref(typeClass)])
  59181. }, {
  59182. default: withCtx(() => [
  59183. (openBlock(), createBlock(resolveDynamicComponent(unref(iconComponent))))
  59184. ]),
  59185. _: 1
  59186. }, 8, ["class"])) : createCommentVNode("v-if", true),
  59187. createElementVNode("div", {
  59188. class: normalizeClass(unref(ns).e("group"))
  59189. }, [
  59190. createElementVNode("h2", {
  59191. class: normalizeClass(unref(ns).e("title")),
  59192. textContent: toDisplayString(_ctx.title)
  59193. }, null, 10, ["textContent"]),
  59194. withDirectives(createElementVNode("div", {
  59195. class: normalizeClass(unref(ns).e("content")),
  59196. style: normalizeStyle(!!_ctx.title ? void 0 : { margin: 0 })
  59197. }, [
  59198. renderSlot(_ctx.$slots, "default", {}, () => [
  59199. !_ctx.dangerouslyUseHTMLString ? (openBlock(), createElementBlock("p", { key: 0 }, toDisplayString(_ctx.message), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  59200. createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  59201. createElementVNode("p", { innerHTML: _ctx.message }, null, 8, ["innerHTML"])
  59202. ], 2112))
  59203. ])
  59204. ], 6), [
  59205. [vShow, _ctx.message]
  59206. ]),
  59207. _ctx.showClose ? (openBlock(), createBlock(unref(ElIcon), {
  59208. key: 0,
  59209. class: normalizeClass(unref(ns).e("closeBtn")),
  59210. onClick: withModifiers(close, ["stop"])
  59211. }, {
  59212. default: withCtx(() => [
  59213. createVNode(unref(Close))
  59214. ]),
  59215. _: 1
  59216. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  59217. ], 2)
  59218. ], 46, ["id", "onClick"]), [
  59219. [vShow, visible.value]
  59220. ])
  59221. ]),
  59222. _: 3
  59223. }, 8, ["name", "onBeforeLeave", "onAfterLeave"]);
  59224. };
  59225. }
  59226. });
  59227. var NotificationConstructor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "notification.vue"]]);
  59228. const notifications = {
  59229. "top-left": [],
  59230. "top-right": [],
  59231. "bottom-left": [],
  59232. "bottom-right": []
  59233. };
  59234. const GAP_SIZE = 16;
  59235. let seed = 1;
  59236. const notify = function(options = {}, context) {
  59237. if (!isClient)
  59238. return { close: () => void 0 };
  59239. if (isString$1(options) || isVNode(options)) {
  59240. options = { message: options };
  59241. }
  59242. const position = options.position || "top-right";
  59243. let verticalOffset = options.offset || 0;
  59244. notifications[position].forEach(({ vm: vm2 }) => {
  59245. var _a;
  59246. verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE;
  59247. });
  59248. verticalOffset += GAP_SIZE;
  59249. const id = `notification_${seed++}`;
  59250. const userOnClose = options.onClose;
  59251. const props = {
  59252. ...options,
  59253. offset: verticalOffset,
  59254. id,
  59255. onClose: () => {
  59256. close(id, position, userOnClose);
  59257. }
  59258. };
  59259. let appendTo = document.body;
  59260. if (isElement$1(options.appendTo)) {
  59261. appendTo = options.appendTo;
  59262. } else if (isString$1(options.appendTo)) {
  59263. appendTo = document.querySelector(options.appendTo);
  59264. }
  59265. if (!isElement$1(appendTo)) {
  59266. appendTo = document.body;
  59267. }
  59268. const container = document.createElement("div");
  59269. const vm = createVNode(NotificationConstructor, props, isFunction$1(props.message) ? props.message : isVNode(props.message) ? () => props.message : null);
  59270. vm.appContext = isUndefined(context) ? notify._context : context;
  59271. vm.props.onDestroy = () => {
  59272. render(null, container);
  59273. };
  59274. render(vm, container);
  59275. notifications[position].push({ vm });
  59276. appendTo.appendChild(container.firstElementChild);
  59277. return {
  59278. close: () => {
  59279. vm.component.exposed.visible.value = false;
  59280. }
  59281. };
  59282. };
  59283. notificationTypes.forEach((type) => {
  59284. notify[type] = (options = {}, appContext) => {
  59285. if (isString$1(options) || isVNode(options)) {
  59286. options = {
  59287. message: options
  59288. };
  59289. }
  59290. return notify({ ...options, type }, appContext);
  59291. };
  59292. });
  59293. function close(id, position, userOnClose) {
  59294. const orientedNotifications = notifications[position];
  59295. const idx = orientedNotifications.findIndex(({ vm: vm2 }) => {
  59296. var _a;
  59297. return ((_a = vm2.component) == null ? void 0 : _a.props.id) === id;
  59298. });
  59299. if (idx === -1)
  59300. return;
  59301. const { vm } = orientedNotifications[idx];
  59302. if (!vm)
  59303. return;
  59304. userOnClose == null ? void 0 : userOnClose(vm);
  59305. const removedHeight = vm.el.offsetHeight;
  59306. const verticalPos = position.split("-")[0];
  59307. orientedNotifications.splice(idx, 1);
  59308. const len = orientedNotifications.length;
  59309. if (len < 1)
  59310. return;
  59311. for (let i = idx; i < len; i++) {
  59312. const { el, component } = orientedNotifications[i].vm;
  59313. const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
  59314. component.props.offset = pos;
  59315. }
  59316. }
  59317. function closeAll() {
  59318. for (const orientedNotifications of Object.values(notifications)) {
  59319. orientedNotifications.forEach(({ vm }) => {
  59320. vm.component.exposed.visible.value = false;
  59321. });
  59322. }
  59323. }
  59324. notify.closeAll = closeAll;
  59325. notify._context = null;
  59326. var Notify = notify;
  59327. const ElNotification = withInstallFunction(Notify, "$notify");
  59328. var Plugins = [
  59329. ElInfiniteScroll,
  59330. ElLoading,
  59331. ElMessage,
  59332. ElMessageBox,
  59333. ElNotification,
  59334. ElPopoverDirective
  59335. ];
  59336. var installer = makeInstaller([...Components, ...Plugins]);
  59337. const install = installer.install;
  59338. const version = installer.version;
  59339. 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, 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, 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, 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, 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 };