index.js 2.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383
  1. /*! Element Plus v2.2.21 */
  2. (function (global, factory) {
  3. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue')) :
  4. typeof define === 'function' && define.amd ? define(['exports', 'vue'], factory) :
  5. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ElementPlus = {}, global.Vue));
  6. })(this, (function (exports, vue) { 'use strict';
  7. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  8. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  9. var root = freeGlobal || freeSelf || Function("return this")();
  10. var Symbol$1 = root.Symbol;
  11. var objectProto$s = Object.prototype;
  12. var hasOwnProperty$p = objectProto$s.hasOwnProperty;
  13. var nativeObjectToString$3 = objectProto$s.toString;
  14. var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
  15. function getRawTag(value) {
  16. var isOwn = hasOwnProperty$p.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  17. try {
  18. value[symToStringTag$1] = void 0;
  19. var unmasked = true;
  20. } catch (e) {
  21. }
  22. var result = nativeObjectToString$3.call(value);
  23. if (unmasked) {
  24. if (isOwn) {
  25. value[symToStringTag$1] = tag;
  26. } else {
  27. delete value[symToStringTag$1];
  28. }
  29. }
  30. return result;
  31. }
  32. var objectProto$r = Object.prototype;
  33. var nativeObjectToString$2 = objectProto$r.toString;
  34. function objectToString$1(value) {
  35. return nativeObjectToString$2.call(value);
  36. }
  37. var nullTag = "[object Null]";
  38. var undefinedTag = "[object Undefined]";
  39. var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
  40. function baseGetTag(value) {
  41. if (value == null) {
  42. return value === void 0 ? undefinedTag : nullTag;
  43. }
  44. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString$1(value);
  45. }
  46. function isObjectLike(value) {
  47. return value != null && typeof value == "object";
  48. }
  49. var symbolTag$3 = "[object Symbol]";
  50. function isSymbol(value) {
  51. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  52. }
  53. var NAN$2 = 0 / 0;
  54. function baseToNumber(value) {
  55. if (typeof value == "number") {
  56. return value;
  57. }
  58. if (isSymbol(value)) {
  59. return NAN$2;
  60. }
  61. return +value;
  62. }
  63. function arrayMap(array, iteratee) {
  64. var index = -1, length = array == null ? 0 : array.length, result = Array(length);
  65. while (++index < length) {
  66. result[index] = iteratee(array[index], index, array);
  67. }
  68. return result;
  69. }
  70. var isArray$1 = Array.isArray;
  71. var INFINITY$5 = 1 / 0;
  72. var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0;
  73. var symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  74. function baseToString(value) {
  75. if (typeof value == "string") {
  76. return value;
  77. }
  78. if (isArray$1(value)) {
  79. return arrayMap(value, baseToString) + "";
  80. }
  81. if (isSymbol(value)) {
  82. return symbolToString ? symbolToString.call(value) : "";
  83. }
  84. var result = value + "";
  85. return result == "0" && 1 / value == -INFINITY$5 ? "-0" : result;
  86. }
  87. function createMathOperation(operator, defaultValue) {
  88. return function(value, other) {
  89. var result;
  90. if (value === void 0 && other === void 0) {
  91. return defaultValue;
  92. }
  93. if (value !== void 0) {
  94. result = value;
  95. }
  96. if (other !== void 0) {
  97. if (result === void 0) {
  98. return other;
  99. }
  100. if (typeof value == "string" || typeof other == "string") {
  101. value = baseToString(value);
  102. other = baseToString(other);
  103. } else {
  104. value = baseToNumber(value);
  105. other = baseToNumber(other);
  106. }
  107. result = operator(value, other);
  108. }
  109. return result;
  110. };
  111. }
  112. var add = createMathOperation(function(augend, addend) {
  113. return augend + addend;
  114. }, 0);
  115. var reWhitespace = /\s/;
  116. function trimmedEndIndex(string) {
  117. var index = string.length;
  118. while (index-- && reWhitespace.test(string.charAt(index))) {
  119. }
  120. return index;
  121. }
  122. var reTrimStart$2 = /^\s+/;
  123. function baseTrim(string) {
  124. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart$2, "") : string;
  125. }
  126. function isObject$2(value) {
  127. var type = typeof value;
  128. return value != null && (type == "object" || type == "function");
  129. }
  130. var NAN$1 = 0 / 0;
  131. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  132. var reIsBinary = /^0b[01]+$/i;
  133. var reIsOctal = /^0o[0-7]+$/i;
  134. var freeParseInt = parseInt;
  135. function toNumber(value) {
  136. if (typeof value == "number") {
  137. return value;
  138. }
  139. if (isSymbol(value)) {
  140. return NAN$1;
  141. }
  142. if (isObject$2(value)) {
  143. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  144. value = isObject$2(other) ? other + "" : other;
  145. }
  146. if (typeof value != "string") {
  147. return value === 0 ? value : +value;
  148. }
  149. value = baseTrim(value);
  150. var isBinary = reIsBinary.test(value);
  151. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN$1 : +value;
  152. }
  153. var INFINITY$4 = 1 / 0;
  154. var MAX_INTEGER = 17976931348623157e292;
  155. function toFinite(value) {
  156. if (!value) {
  157. return value === 0 ? value : 0;
  158. }
  159. value = toNumber(value);
  160. if (value === INFINITY$4 || value === -INFINITY$4) {
  161. var sign = value < 0 ? -1 : 1;
  162. return sign * MAX_INTEGER;
  163. }
  164. return value === value ? value : 0;
  165. }
  166. function toInteger(value) {
  167. var result = toFinite(value), remainder = result % 1;
  168. return result === result ? remainder ? result - remainder : result : 0;
  169. }
  170. var FUNC_ERROR_TEXT$b = "Expected a function";
  171. function after(n, func) {
  172. if (typeof func != "function") {
  173. throw new TypeError(FUNC_ERROR_TEXT$b);
  174. }
  175. n = toInteger(n);
  176. return function() {
  177. if (--n < 1) {
  178. return func.apply(this, arguments);
  179. }
  180. };
  181. }
  182. function identity$1(value) {
  183. return value;
  184. }
  185. var asyncTag = "[object AsyncFunction]";
  186. var funcTag$2 = "[object Function]";
  187. var genTag$1 = "[object GeneratorFunction]";
  188. var proxyTag = "[object Proxy]";
  189. function isFunction$1(value) {
  190. if (!isObject$2(value)) {
  191. return false;
  192. }
  193. var tag = baseGetTag(value);
  194. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  195. }
  196. var coreJsData = root["__core-js_shared__"];
  197. var maskSrcKey = function() {
  198. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
  199. return uid ? "Symbol(src)_1." + uid : "";
  200. }();
  201. function isMasked(func) {
  202. return !!maskSrcKey && maskSrcKey in func;
  203. }
  204. var funcProto$2 = Function.prototype;
  205. var funcToString$2 = funcProto$2.toString;
  206. function toSource(func) {
  207. if (func != null) {
  208. try {
  209. return funcToString$2.call(func);
  210. } catch (e) {
  211. }
  212. try {
  213. return func + "";
  214. } catch (e) {
  215. }
  216. }
  217. return "";
  218. }
  219. var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
  220. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  221. var funcProto$1 = Function.prototype;
  222. var objectProto$q = Object.prototype;
  223. var funcToString$1 = funcProto$1.toString;
  224. var hasOwnProperty$o = objectProto$q.hasOwnProperty;
  225. var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$o).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  226. function baseIsNative(value) {
  227. if (!isObject$2(value) || isMasked(value)) {
  228. return false;
  229. }
  230. var pattern = isFunction$1(value) ? reIsNative : reIsHostCtor;
  231. return pattern.test(toSource(value));
  232. }
  233. function getValue$1(object, key) {
  234. return object == null ? void 0 : object[key];
  235. }
  236. function getNative(object, key) {
  237. var value = getValue$1(object, key);
  238. return baseIsNative(value) ? value : void 0;
  239. }
  240. var WeakMap = getNative(root, "WeakMap");
  241. var metaMap = WeakMap && new WeakMap();
  242. var baseSetData = !metaMap ? identity$1 : function(func, data) {
  243. metaMap.set(func, data);
  244. return func;
  245. };
  246. var objectCreate = Object.create;
  247. var baseCreate = function() {
  248. function object() {
  249. }
  250. return function(proto) {
  251. if (!isObject$2(proto)) {
  252. return {};
  253. }
  254. if (objectCreate) {
  255. return objectCreate(proto);
  256. }
  257. object.prototype = proto;
  258. var result = new object();
  259. object.prototype = void 0;
  260. return result;
  261. };
  262. }();
  263. function createCtor(Ctor) {
  264. return function() {
  265. var args = arguments;
  266. switch (args.length) {
  267. case 0:
  268. return new Ctor();
  269. case 1:
  270. return new Ctor(args[0]);
  271. case 2:
  272. return new Ctor(args[0], args[1]);
  273. case 3:
  274. return new Ctor(args[0], args[1], args[2]);
  275. case 4:
  276. return new Ctor(args[0], args[1], args[2], args[3]);
  277. case 5:
  278. return new Ctor(args[0], args[1], args[2], args[3], args[4]);
  279. case 6:
  280. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5]);
  281. case 7:
  282. return new Ctor(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
  283. }
  284. var thisBinding = baseCreate(Ctor.prototype), result = Ctor.apply(thisBinding, args);
  285. return isObject$2(result) ? result : thisBinding;
  286. };
  287. }
  288. var WRAP_BIND_FLAG$8 = 1;
  289. function createBind(func, bitmask, thisArg) {
  290. var isBind = bitmask & WRAP_BIND_FLAG$8, Ctor = createCtor(func);
  291. function wrapper() {
  292. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  293. return fn.apply(isBind ? thisArg : this, arguments);
  294. }
  295. return wrapper;
  296. }
  297. function apply(func, thisArg, args) {
  298. switch (args.length) {
  299. case 0:
  300. return func.call(thisArg);
  301. case 1:
  302. return func.call(thisArg, args[0]);
  303. case 2:
  304. return func.call(thisArg, args[0], args[1]);
  305. case 3:
  306. return func.call(thisArg, args[0], args[1], args[2]);
  307. }
  308. return func.apply(thisArg, args);
  309. }
  310. var nativeMax$g = Math.max;
  311. function composeArgs(args, partials, holders, isCurried) {
  312. 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;
  313. while (++leftIndex < leftLength) {
  314. result[leftIndex] = partials[leftIndex];
  315. }
  316. while (++argsIndex < holdersLength) {
  317. if (isUncurried || argsIndex < argsLength) {
  318. result[holders[argsIndex]] = args[argsIndex];
  319. }
  320. }
  321. while (rangeLength--) {
  322. result[leftIndex++] = args[argsIndex++];
  323. }
  324. return result;
  325. }
  326. var nativeMax$f = Math.max;
  327. function composeArgsRight(args, partials, holders, isCurried) {
  328. 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;
  329. while (++argsIndex < rangeLength) {
  330. result[argsIndex] = args[argsIndex];
  331. }
  332. var offset = argsIndex;
  333. while (++rightIndex < rightLength) {
  334. result[offset + rightIndex] = partials[rightIndex];
  335. }
  336. while (++holdersIndex < holdersLength) {
  337. if (isUncurried || argsIndex < argsLength) {
  338. result[offset + holders[holdersIndex]] = args[argsIndex++];
  339. }
  340. }
  341. return result;
  342. }
  343. function countHolders(array, placeholder) {
  344. var length = array.length, result = 0;
  345. while (length--) {
  346. if (array[length] === placeholder) {
  347. ++result;
  348. }
  349. }
  350. return result;
  351. }
  352. function baseLodash() {
  353. }
  354. var MAX_ARRAY_LENGTH$6 = 4294967295;
  355. function LazyWrapper(value) {
  356. this.__wrapped__ = value;
  357. this.__actions__ = [];
  358. this.__dir__ = 1;
  359. this.__filtered__ = false;
  360. this.__iteratees__ = [];
  361. this.__takeCount__ = MAX_ARRAY_LENGTH$6;
  362. this.__views__ = [];
  363. }
  364. LazyWrapper.prototype = baseCreate(baseLodash.prototype);
  365. LazyWrapper.prototype.constructor = LazyWrapper;
  366. function noop$1() {
  367. }
  368. var getData = !metaMap ? noop$1 : function(func) {
  369. return metaMap.get(func);
  370. };
  371. var realNames = {};
  372. var objectProto$p = Object.prototype;
  373. var hasOwnProperty$n = objectProto$p.hasOwnProperty;
  374. function getFuncName(func) {
  375. var result = func.name + "", array = realNames[result], length = hasOwnProperty$n.call(realNames, result) ? array.length : 0;
  376. while (length--) {
  377. var data = array[length], otherFunc = data.func;
  378. if (otherFunc == null || otherFunc == func) {
  379. return data.name;
  380. }
  381. }
  382. return result;
  383. }
  384. function LodashWrapper(value, chainAll) {
  385. this.__wrapped__ = value;
  386. this.__actions__ = [];
  387. this.__chain__ = !!chainAll;
  388. this.__index__ = 0;
  389. this.__values__ = void 0;
  390. }
  391. LodashWrapper.prototype = baseCreate(baseLodash.prototype);
  392. LodashWrapper.prototype.constructor = LodashWrapper;
  393. function copyArray(source, array) {
  394. var index = -1, length = source.length;
  395. array || (array = Array(length));
  396. while (++index < length) {
  397. array[index] = source[index];
  398. }
  399. return array;
  400. }
  401. function wrapperClone(wrapper) {
  402. if (wrapper instanceof LazyWrapper) {
  403. return wrapper.clone();
  404. }
  405. var result = new LodashWrapper(wrapper.__wrapped__, wrapper.__chain__);
  406. result.__actions__ = copyArray(wrapper.__actions__);
  407. result.__index__ = wrapper.__index__;
  408. result.__values__ = wrapper.__values__;
  409. return result;
  410. }
  411. var objectProto$o = Object.prototype;
  412. var hasOwnProperty$m = objectProto$o.hasOwnProperty;
  413. function lodash(value) {
  414. if (isObjectLike(value) && !isArray$1(value) && !(value instanceof LazyWrapper)) {
  415. if (value instanceof LodashWrapper) {
  416. return value;
  417. }
  418. if (hasOwnProperty$m.call(value, "__wrapped__")) {
  419. return wrapperClone(value);
  420. }
  421. }
  422. return new LodashWrapper(value);
  423. }
  424. lodash.prototype = baseLodash.prototype;
  425. lodash.prototype.constructor = lodash;
  426. function isLaziable(func) {
  427. var funcName = getFuncName(func), other = lodash[funcName];
  428. if (typeof other != "function" || !(funcName in LazyWrapper.prototype)) {
  429. return false;
  430. }
  431. if (func === other) {
  432. return true;
  433. }
  434. var data = getData(other);
  435. return !!data && func === data[0];
  436. }
  437. var HOT_COUNT = 800;
  438. var HOT_SPAN = 16;
  439. var nativeNow = Date.now;
  440. function shortOut(func) {
  441. var count = 0, lastCalled = 0;
  442. return function() {
  443. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  444. lastCalled = stamp;
  445. if (remaining > 0) {
  446. if (++count >= HOT_COUNT) {
  447. return arguments[0];
  448. }
  449. } else {
  450. count = 0;
  451. }
  452. return func.apply(void 0, arguments);
  453. };
  454. }
  455. var setData = shortOut(baseSetData);
  456. var reWrapDetails = /\{\n\/\* \[wrapped with (.+)\] \*/;
  457. var reSplitDetails = /,? & /;
  458. function getWrapDetails(source) {
  459. var match = source.match(reWrapDetails);
  460. return match ? match[1].split(reSplitDetails) : [];
  461. }
  462. var reWrapComment = /\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/;
  463. function insertWrapDetails(source, details) {
  464. var length = details.length;
  465. if (!length) {
  466. return source;
  467. }
  468. var lastIndex = length - 1;
  469. details[lastIndex] = (length > 1 ? "& " : "") + details[lastIndex];
  470. details = details.join(length > 2 ? ", " : " ");
  471. return source.replace(reWrapComment, "{\n/* [wrapped with " + details + "] */\n");
  472. }
  473. function constant(value) {
  474. return function() {
  475. return value;
  476. };
  477. }
  478. var defineProperty = function() {
  479. try {
  480. var func = getNative(Object, "defineProperty");
  481. func({}, "", {});
  482. return func;
  483. } catch (e) {
  484. }
  485. }();
  486. var baseSetToString = !defineProperty ? identity$1 : function(func, string) {
  487. return defineProperty(func, "toString", {
  488. "configurable": true,
  489. "enumerable": false,
  490. "value": constant(string),
  491. "writable": true
  492. });
  493. };
  494. var setToString = shortOut(baseSetToString);
  495. function arrayEach(array, iteratee) {
  496. var index = -1, length = array == null ? 0 : array.length;
  497. while (++index < length) {
  498. if (iteratee(array[index], index, array) === false) {
  499. break;
  500. }
  501. }
  502. return array;
  503. }
  504. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  505. var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
  506. while (fromRight ? index-- : ++index < length) {
  507. if (predicate(array[index], index, array)) {
  508. return index;
  509. }
  510. }
  511. return -1;
  512. }
  513. function baseIsNaN(value) {
  514. return value !== value;
  515. }
  516. function strictIndexOf(array, value, fromIndex) {
  517. var index = fromIndex - 1, length = array.length;
  518. while (++index < length) {
  519. if (array[index] === value) {
  520. return index;
  521. }
  522. }
  523. return -1;
  524. }
  525. function baseIndexOf(array, value, fromIndex) {
  526. return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
  527. }
  528. function arrayIncludes(array, value) {
  529. var length = array == null ? 0 : array.length;
  530. return !!length && baseIndexOf(array, value, 0) > -1;
  531. }
  532. var WRAP_BIND_FLAG$7 = 1;
  533. var WRAP_BIND_KEY_FLAG$6 = 2;
  534. var WRAP_CURRY_FLAG$6 = 8;
  535. var WRAP_CURRY_RIGHT_FLAG$3 = 16;
  536. var WRAP_PARTIAL_FLAG$6 = 32;
  537. var WRAP_PARTIAL_RIGHT_FLAG$3 = 64;
  538. var WRAP_ARY_FLAG$4 = 128;
  539. var WRAP_REARG_FLAG$3 = 256;
  540. var WRAP_FLIP_FLAG$2 = 512;
  541. var wrapFlags = [
  542. ["ary", WRAP_ARY_FLAG$4],
  543. ["bind", WRAP_BIND_FLAG$7],
  544. ["bindKey", WRAP_BIND_KEY_FLAG$6],
  545. ["curry", WRAP_CURRY_FLAG$6],
  546. ["curryRight", WRAP_CURRY_RIGHT_FLAG$3],
  547. ["flip", WRAP_FLIP_FLAG$2],
  548. ["partial", WRAP_PARTIAL_FLAG$6],
  549. ["partialRight", WRAP_PARTIAL_RIGHT_FLAG$3],
  550. ["rearg", WRAP_REARG_FLAG$3]
  551. ];
  552. function updateWrapDetails(details, bitmask) {
  553. arrayEach(wrapFlags, function(pair) {
  554. var value = "_." + pair[0];
  555. if (bitmask & pair[1] && !arrayIncludes(details, value)) {
  556. details.push(value);
  557. }
  558. });
  559. return details.sort();
  560. }
  561. function setWrapToString(wrapper, reference, bitmask) {
  562. var source = reference + "";
  563. return setToString(wrapper, insertWrapDetails(source, updateWrapDetails(getWrapDetails(source), bitmask)));
  564. }
  565. var WRAP_BIND_FLAG$6 = 1;
  566. var WRAP_BIND_KEY_FLAG$5 = 2;
  567. var WRAP_CURRY_BOUND_FLAG$1 = 4;
  568. var WRAP_CURRY_FLAG$5 = 8;
  569. var WRAP_PARTIAL_FLAG$5 = 32;
  570. var WRAP_PARTIAL_RIGHT_FLAG$2 = 64;
  571. function createRecurry(func, bitmask, wrapFunc, placeholder, thisArg, partials, holders, argPos, ary, arity) {
  572. 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;
  573. bitmask |= isCurry ? WRAP_PARTIAL_FLAG$5 : WRAP_PARTIAL_RIGHT_FLAG$2;
  574. bitmask &= ~(isCurry ? WRAP_PARTIAL_RIGHT_FLAG$2 : WRAP_PARTIAL_FLAG$5);
  575. if (!(bitmask & WRAP_CURRY_BOUND_FLAG$1)) {
  576. bitmask &= ~(WRAP_BIND_FLAG$6 | WRAP_BIND_KEY_FLAG$5);
  577. }
  578. var newData = [
  579. func,
  580. bitmask,
  581. thisArg,
  582. newPartials,
  583. newHolders,
  584. newPartialsRight,
  585. newHoldersRight,
  586. argPos,
  587. ary,
  588. arity
  589. ];
  590. var result = wrapFunc.apply(void 0, newData);
  591. if (isLaziable(func)) {
  592. setData(result, newData);
  593. }
  594. result.placeholder = placeholder;
  595. return setWrapToString(result, func, bitmask);
  596. }
  597. function getHolder(func) {
  598. var object = func;
  599. return object.placeholder;
  600. }
  601. var MAX_SAFE_INTEGER$5 = 9007199254740991;
  602. var reIsUint = /^(?:0|[1-9]\d*)$/;
  603. function isIndex(value, length) {
  604. var type = typeof value;
  605. length = length == null ? MAX_SAFE_INTEGER$5 : length;
  606. return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  607. }
  608. var nativeMin$e = Math.min;
  609. function reorder(array, indexes) {
  610. var arrLength = array.length, length = nativeMin$e(indexes.length, arrLength), oldArray = copyArray(array);
  611. while (length--) {
  612. var index = indexes[length];
  613. array[length] = isIndex(index, arrLength) ? oldArray[index] : void 0;
  614. }
  615. return array;
  616. }
  617. var PLACEHOLDER$1 = "__lodash_placeholder__";
  618. function replaceHolders(array, placeholder) {
  619. var index = -1, length = array.length, resIndex = 0, result = [];
  620. while (++index < length) {
  621. var value = array[index];
  622. if (value === placeholder || value === PLACEHOLDER$1) {
  623. array[index] = PLACEHOLDER$1;
  624. result[resIndex++] = index;
  625. }
  626. }
  627. return result;
  628. }
  629. var WRAP_BIND_FLAG$5 = 1;
  630. var WRAP_BIND_KEY_FLAG$4 = 2;
  631. var WRAP_CURRY_FLAG$4 = 8;
  632. var WRAP_CURRY_RIGHT_FLAG$2 = 16;
  633. var WRAP_ARY_FLAG$3 = 128;
  634. var WRAP_FLIP_FLAG$1 = 512;
  635. function createHybrid(func, bitmask, thisArg, partials, holders, partialsRight, holdersRight, argPos, ary, arity) {
  636. 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);
  637. function wrapper() {
  638. var length = arguments.length, args = Array(length), index = length;
  639. while (index--) {
  640. args[index] = arguments[index];
  641. }
  642. if (isCurried) {
  643. var placeholder = getHolder(wrapper), holdersCount = countHolders(args, placeholder);
  644. }
  645. if (partials) {
  646. args = composeArgs(args, partials, holders, isCurried);
  647. }
  648. if (partialsRight) {
  649. args = composeArgsRight(args, partialsRight, holdersRight, isCurried);
  650. }
  651. length -= holdersCount;
  652. if (isCurried && length < arity) {
  653. var newHolders = replaceHolders(args, placeholder);
  654. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, thisArg, args, newHolders, argPos, ary, arity - length);
  655. }
  656. var thisBinding = isBind ? thisArg : this, fn = isBindKey ? thisBinding[func] : func;
  657. length = args.length;
  658. if (argPos) {
  659. args = reorder(args, argPos);
  660. } else if (isFlip && length > 1) {
  661. args.reverse();
  662. }
  663. if (isAry && ary < length) {
  664. args.length = ary;
  665. }
  666. if (this && this !== root && this instanceof wrapper) {
  667. fn = Ctor || createCtor(fn);
  668. }
  669. return fn.apply(thisBinding, args);
  670. }
  671. return wrapper;
  672. }
  673. function createCurry(func, bitmask, arity) {
  674. var Ctor = createCtor(func);
  675. function wrapper() {
  676. var length = arguments.length, args = Array(length), index = length, placeholder = getHolder(wrapper);
  677. while (index--) {
  678. args[index] = arguments[index];
  679. }
  680. var holders = length < 3 && args[0] !== placeholder && args[length - 1] !== placeholder ? [] : replaceHolders(args, placeholder);
  681. length -= holders.length;
  682. if (length < arity) {
  683. return createRecurry(func, bitmask, createHybrid, wrapper.placeholder, void 0, args, holders, void 0, void 0, arity - length);
  684. }
  685. var fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  686. return apply(fn, this, args);
  687. }
  688. return wrapper;
  689. }
  690. var WRAP_BIND_FLAG$4 = 1;
  691. function createPartial(func, bitmask, thisArg, partials) {
  692. var isBind = bitmask & WRAP_BIND_FLAG$4, Ctor = createCtor(func);
  693. function wrapper() {
  694. var argsIndex = -1, argsLength = arguments.length, leftIndex = -1, leftLength = partials.length, args = Array(leftLength + argsLength), fn = this && this !== root && this instanceof wrapper ? Ctor : func;
  695. while (++leftIndex < leftLength) {
  696. args[leftIndex] = partials[leftIndex];
  697. }
  698. while (argsLength--) {
  699. args[leftIndex++] = arguments[++argsIndex];
  700. }
  701. return apply(fn, isBind ? thisArg : this, args);
  702. }
  703. return wrapper;
  704. }
  705. var PLACEHOLDER = "__lodash_placeholder__";
  706. var WRAP_BIND_FLAG$3 = 1;
  707. var WRAP_BIND_KEY_FLAG$3 = 2;
  708. var WRAP_CURRY_BOUND_FLAG = 4;
  709. var WRAP_CURRY_FLAG$3 = 8;
  710. var WRAP_ARY_FLAG$2 = 128;
  711. var WRAP_REARG_FLAG$2 = 256;
  712. var nativeMin$d = Math.min;
  713. function mergeData(data, source) {
  714. 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);
  715. 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;
  716. if (!(isCommon || isCombo)) {
  717. return data;
  718. }
  719. if (srcBitmask & WRAP_BIND_FLAG$3) {
  720. data[2] = source[2];
  721. newBitmask |= bitmask & WRAP_BIND_FLAG$3 ? 0 : WRAP_CURRY_BOUND_FLAG;
  722. }
  723. var value = source[3];
  724. if (value) {
  725. var partials = data[3];
  726. data[3] = partials ? composeArgs(partials, value, source[4]) : value;
  727. data[4] = partials ? replaceHolders(data[3], PLACEHOLDER) : source[4];
  728. }
  729. value = source[5];
  730. if (value) {
  731. partials = data[5];
  732. data[5] = partials ? composeArgsRight(partials, value, source[6]) : value;
  733. data[6] = partials ? replaceHolders(data[5], PLACEHOLDER) : source[6];
  734. }
  735. value = source[7];
  736. if (value) {
  737. data[7] = value;
  738. }
  739. if (srcBitmask & WRAP_ARY_FLAG$2) {
  740. data[8] = data[8] == null ? source[8] : nativeMin$d(data[8], source[8]);
  741. }
  742. if (data[9] == null) {
  743. data[9] = source[9];
  744. }
  745. data[0] = source[0];
  746. data[1] = newBitmask;
  747. return data;
  748. }
  749. var FUNC_ERROR_TEXT$a = "Expected a function";
  750. var WRAP_BIND_FLAG$2 = 1;
  751. var WRAP_BIND_KEY_FLAG$2 = 2;
  752. var WRAP_CURRY_FLAG$2 = 8;
  753. var WRAP_CURRY_RIGHT_FLAG$1 = 16;
  754. var WRAP_PARTIAL_FLAG$4 = 32;
  755. var WRAP_PARTIAL_RIGHT_FLAG$1 = 64;
  756. var nativeMax$e = Math.max;
  757. function createWrap(func, bitmask, thisArg, partials, holders, argPos, ary, arity) {
  758. var isBindKey = bitmask & WRAP_BIND_KEY_FLAG$2;
  759. if (!isBindKey && typeof func != "function") {
  760. throw new TypeError(FUNC_ERROR_TEXT$a);
  761. }
  762. var length = partials ? partials.length : 0;
  763. if (!length) {
  764. bitmask &= ~(WRAP_PARTIAL_FLAG$4 | WRAP_PARTIAL_RIGHT_FLAG$1);
  765. partials = holders = void 0;
  766. }
  767. ary = ary === void 0 ? ary : nativeMax$e(toInteger(ary), 0);
  768. arity = arity === void 0 ? arity : toInteger(arity);
  769. length -= holders ? holders.length : 0;
  770. if (bitmask & WRAP_PARTIAL_RIGHT_FLAG$1) {
  771. var partialsRight = partials, holdersRight = holders;
  772. partials = holders = void 0;
  773. }
  774. var data = isBindKey ? void 0 : getData(func);
  775. var newData = [
  776. func,
  777. bitmask,
  778. thisArg,
  779. partials,
  780. holders,
  781. partialsRight,
  782. holdersRight,
  783. argPos,
  784. ary,
  785. arity
  786. ];
  787. if (data) {
  788. mergeData(newData, data);
  789. }
  790. func = newData[0];
  791. bitmask = newData[1];
  792. thisArg = newData[2];
  793. partials = newData[3];
  794. holders = newData[4];
  795. arity = newData[9] = newData[9] === void 0 ? isBindKey ? 0 : func.length : nativeMax$e(newData[9] - length, 0);
  796. if (!arity && bitmask & (WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1)) {
  797. bitmask &= ~(WRAP_CURRY_FLAG$2 | WRAP_CURRY_RIGHT_FLAG$1);
  798. }
  799. if (!bitmask || bitmask == WRAP_BIND_FLAG$2) {
  800. var result = createBind(func, bitmask, thisArg);
  801. } else if (bitmask == WRAP_CURRY_FLAG$2 || bitmask == WRAP_CURRY_RIGHT_FLAG$1) {
  802. result = createCurry(func, bitmask, arity);
  803. } else if ((bitmask == WRAP_PARTIAL_FLAG$4 || bitmask == (WRAP_BIND_FLAG$2 | WRAP_PARTIAL_FLAG$4)) && !holders.length) {
  804. result = createPartial(func, bitmask, thisArg, partials);
  805. } else {
  806. result = createHybrid.apply(void 0, newData);
  807. }
  808. var setter = data ? baseSetData : setData;
  809. return setWrapToString(setter(result, newData), func, bitmask);
  810. }
  811. var WRAP_ARY_FLAG$1 = 128;
  812. function ary(func, n, guard) {
  813. n = guard ? void 0 : n;
  814. n = func && n == null ? func.length : n;
  815. return createWrap(func, WRAP_ARY_FLAG$1, void 0, void 0, void 0, void 0, n);
  816. }
  817. function baseAssignValue(object, key, value) {
  818. if (key == "__proto__" && defineProperty) {
  819. defineProperty(object, key, {
  820. "configurable": true,
  821. "enumerable": true,
  822. "value": value,
  823. "writable": true
  824. });
  825. } else {
  826. object[key] = value;
  827. }
  828. }
  829. function eq(value, other) {
  830. return value === other || value !== value && other !== other;
  831. }
  832. var objectProto$n = Object.prototype;
  833. var hasOwnProperty$l = objectProto$n.hasOwnProperty;
  834. function assignValue(object, key, value) {
  835. var objValue = object[key];
  836. if (!(hasOwnProperty$l.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
  837. baseAssignValue(object, key, value);
  838. }
  839. }
  840. function copyObject(source, props, object, customizer) {
  841. var isNew = !object;
  842. object || (object = {});
  843. var index = -1, length = props.length;
  844. while (++index < length) {
  845. var key = props[index];
  846. var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
  847. if (newValue === void 0) {
  848. newValue = source[key];
  849. }
  850. if (isNew) {
  851. baseAssignValue(object, key, newValue);
  852. } else {
  853. assignValue(object, key, newValue);
  854. }
  855. }
  856. return object;
  857. }
  858. var nativeMax$d = Math.max;
  859. function overRest(func, start, transform) {
  860. start = nativeMax$d(start === void 0 ? func.length - 1 : start, 0);
  861. return function() {
  862. var args = arguments, index = -1, length = nativeMax$d(args.length - start, 0), array = Array(length);
  863. while (++index < length) {
  864. array[index] = args[start + index];
  865. }
  866. index = -1;
  867. var otherArgs = Array(start + 1);
  868. while (++index < start) {
  869. otherArgs[index] = args[index];
  870. }
  871. otherArgs[start] = transform(array);
  872. return apply(func, this, otherArgs);
  873. };
  874. }
  875. function baseRest(func, start) {
  876. return setToString(overRest(func, start, identity$1), func + "");
  877. }
  878. var MAX_SAFE_INTEGER$4 = 9007199254740991;
  879. function isLength(value) {
  880. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$4;
  881. }
  882. function isArrayLike(value) {
  883. return value != null && isLength(value.length) && !isFunction$1(value);
  884. }
  885. function isIterateeCall(value, index, object) {
  886. if (!isObject$2(object)) {
  887. return false;
  888. }
  889. var type = typeof index;
  890. if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) {
  891. return eq(object[index], value);
  892. }
  893. return false;
  894. }
  895. function createAssigner(assigner) {
  896. return baseRest(function(object, sources) {
  897. var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
  898. customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
  899. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  900. customizer = length < 3 ? void 0 : customizer;
  901. length = 1;
  902. }
  903. object = Object(object);
  904. while (++index < length) {
  905. var source = sources[index];
  906. if (source) {
  907. assigner(object, source, index, customizer);
  908. }
  909. }
  910. return object;
  911. });
  912. }
  913. var objectProto$m = Object.prototype;
  914. function isPrototype(value) {
  915. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$m;
  916. return value === proto;
  917. }
  918. function baseTimes(n, iteratee) {
  919. var index = -1, result = Array(n);
  920. while (++index < n) {
  921. result[index] = iteratee(index);
  922. }
  923. return result;
  924. }
  925. var argsTag$3 = "[object Arguments]";
  926. function baseIsArguments(value) {
  927. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  928. }
  929. var objectProto$l = Object.prototype;
  930. var hasOwnProperty$k = objectProto$l.hasOwnProperty;
  931. var propertyIsEnumerable$1 = objectProto$l.propertyIsEnumerable;
  932. var isArguments = baseIsArguments(function() {
  933. return arguments;
  934. }()) ? baseIsArguments : function(value) {
  935. return isObjectLike(value) && hasOwnProperty$k.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  936. };
  937. function stubFalse() {
  938. return false;
  939. }
  940. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  941. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  942. var moduleExports$2 = freeModule$2 && freeModule$2.exports === freeExports$2;
  943. var Buffer$1 = moduleExports$2 ? root.Buffer : void 0;
  944. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  945. var isBuffer = nativeIsBuffer || stubFalse;
  946. var argsTag$2 = "[object Arguments]";
  947. var arrayTag$2 = "[object Array]";
  948. var boolTag$4 = "[object Boolean]";
  949. var dateTag$4 = "[object Date]";
  950. var errorTag$3 = "[object Error]";
  951. var funcTag$1 = "[object Function]";
  952. var mapTag$9 = "[object Map]";
  953. var numberTag$4 = "[object Number]";
  954. var objectTag$4 = "[object Object]";
  955. var regexpTag$4 = "[object RegExp]";
  956. var setTag$9 = "[object Set]";
  957. var stringTag$4 = "[object String]";
  958. var weakMapTag$3 = "[object WeakMap]";
  959. var arrayBufferTag$4 = "[object ArrayBuffer]";
  960. var dataViewTag$4 = "[object DataView]";
  961. var float32Tag$2 = "[object Float32Array]";
  962. var float64Tag$2 = "[object Float64Array]";
  963. var int8Tag$2 = "[object Int8Array]";
  964. var int16Tag$2 = "[object Int16Array]";
  965. var int32Tag$2 = "[object Int32Array]";
  966. var uint8Tag$2 = "[object Uint8Array]";
  967. var uint8ClampedTag$2 = "[object Uint8ClampedArray]";
  968. var uint16Tag$2 = "[object Uint16Array]";
  969. var uint32Tag$2 = "[object Uint32Array]";
  970. var typedArrayTags = {};
  971. 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;
  972. 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;
  973. function baseIsTypedArray(value) {
  974. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  975. }
  976. function baseUnary(func) {
  977. return function(value) {
  978. return func(value);
  979. };
  980. }
  981. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  982. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  983. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  984. var freeProcess = moduleExports$1 && freeGlobal.process;
  985. var nodeUtil = function() {
  986. try {
  987. var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  988. if (types) {
  989. return types;
  990. }
  991. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  992. } catch (e) {
  993. }
  994. }();
  995. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  996. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  997. var objectProto$k = Object.prototype;
  998. var hasOwnProperty$j = objectProto$k.hasOwnProperty;
  999. function arrayLikeKeys(value, inherited) {
  1000. var isArr = isArray$1(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;
  1001. for (var key in value) {
  1002. if ((inherited || hasOwnProperty$j.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
  1003. result.push(key);
  1004. }
  1005. }
  1006. return result;
  1007. }
  1008. function overArg(func, transform) {
  1009. return function(arg) {
  1010. return func(transform(arg));
  1011. };
  1012. }
  1013. var nativeKeys = overArg(Object.keys, Object);
  1014. var objectProto$j = Object.prototype;
  1015. var hasOwnProperty$i = objectProto$j.hasOwnProperty;
  1016. function baseKeys(object) {
  1017. if (!isPrototype(object)) {
  1018. return nativeKeys(object);
  1019. }
  1020. var result = [];
  1021. for (var key in Object(object)) {
  1022. if (hasOwnProperty$i.call(object, key) && key != "constructor") {
  1023. result.push(key);
  1024. }
  1025. }
  1026. return result;
  1027. }
  1028. function keys(object) {
  1029. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  1030. }
  1031. var objectProto$i = Object.prototype;
  1032. var hasOwnProperty$h = objectProto$i.hasOwnProperty;
  1033. var assign = createAssigner(function(object, source) {
  1034. if (isPrototype(source) || isArrayLike(source)) {
  1035. copyObject(source, keys(source), object);
  1036. return;
  1037. }
  1038. for (var key in source) {
  1039. if (hasOwnProperty$h.call(source, key)) {
  1040. assignValue(object, key, source[key]);
  1041. }
  1042. }
  1043. });
  1044. function nativeKeysIn(object) {
  1045. var result = [];
  1046. if (object != null) {
  1047. for (var key in Object(object)) {
  1048. result.push(key);
  1049. }
  1050. }
  1051. return result;
  1052. }
  1053. var objectProto$h = Object.prototype;
  1054. var hasOwnProperty$g = objectProto$h.hasOwnProperty;
  1055. function baseKeysIn(object) {
  1056. if (!isObject$2(object)) {
  1057. return nativeKeysIn(object);
  1058. }
  1059. var isProto = isPrototype(object), result = [];
  1060. for (var key in object) {
  1061. if (!(key == "constructor" && (isProto || !hasOwnProperty$g.call(object, key)))) {
  1062. result.push(key);
  1063. }
  1064. }
  1065. return result;
  1066. }
  1067. function keysIn(object) {
  1068. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  1069. }
  1070. var assignIn = createAssigner(function(object, source) {
  1071. copyObject(source, keysIn(source), object);
  1072. });
  1073. var assignInWith = createAssigner(function(object, source, srcIndex, customizer) {
  1074. copyObject(source, keysIn(source), object, customizer);
  1075. });
  1076. var assignWith = createAssigner(function(object, source, srcIndex, customizer) {
  1077. copyObject(source, keys(source), object, customizer);
  1078. });
  1079. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
  1080. var reIsPlainProp = /^\w*$/;
  1081. function isKey(value, object) {
  1082. if (isArray$1(value)) {
  1083. return false;
  1084. }
  1085. var type = typeof value;
  1086. if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) {
  1087. return true;
  1088. }
  1089. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  1090. }
  1091. var nativeCreate = getNative(Object, "create");
  1092. function hashClear() {
  1093. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  1094. this.size = 0;
  1095. }
  1096. function hashDelete(key) {
  1097. var result = this.has(key) && delete this.__data__[key];
  1098. this.size -= result ? 1 : 0;
  1099. return result;
  1100. }
  1101. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  1102. var objectProto$g = Object.prototype;
  1103. var hasOwnProperty$f = objectProto$g.hasOwnProperty;
  1104. function hashGet(key) {
  1105. var data = this.__data__;
  1106. if (nativeCreate) {
  1107. var result = data[key];
  1108. return result === HASH_UNDEFINED$2 ? void 0 : result;
  1109. }
  1110. return hasOwnProperty$f.call(data, key) ? data[key] : void 0;
  1111. }
  1112. var objectProto$f = Object.prototype;
  1113. var hasOwnProperty$e = objectProto$f.hasOwnProperty;
  1114. function hashHas(key) {
  1115. var data = this.__data__;
  1116. return nativeCreate ? data[key] !== void 0 : hasOwnProperty$e.call(data, key);
  1117. }
  1118. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  1119. function hashSet(key, value) {
  1120. var data = this.__data__;
  1121. this.size += this.has(key) ? 0 : 1;
  1122. data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
  1123. return this;
  1124. }
  1125. function Hash(entries) {
  1126. var index = -1, length = entries == null ? 0 : entries.length;
  1127. this.clear();
  1128. while (++index < length) {
  1129. var entry = entries[index];
  1130. this.set(entry[0], entry[1]);
  1131. }
  1132. }
  1133. Hash.prototype.clear = hashClear;
  1134. Hash.prototype["delete"] = hashDelete;
  1135. Hash.prototype.get = hashGet;
  1136. Hash.prototype.has = hashHas;
  1137. Hash.prototype.set = hashSet;
  1138. function listCacheClear() {
  1139. this.__data__ = [];
  1140. this.size = 0;
  1141. }
  1142. function assocIndexOf(array, key) {
  1143. var length = array.length;
  1144. while (length--) {
  1145. if (eq(array[length][0], key)) {
  1146. return length;
  1147. }
  1148. }
  1149. return -1;
  1150. }
  1151. var arrayProto$5 = Array.prototype;
  1152. var splice$2 = arrayProto$5.splice;
  1153. function listCacheDelete(key) {
  1154. var data = this.__data__, index = assocIndexOf(data, key);
  1155. if (index < 0) {
  1156. return false;
  1157. }
  1158. var lastIndex = data.length - 1;
  1159. if (index == lastIndex) {
  1160. data.pop();
  1161. } else {
  1162. splice$2.call(data, index, 1);
  1163. }
  1164. --this.size;
  1165. return true;
  1166. }
  1167. function listCacheGet(key) {
  1168. var data = this.__data__, index = assocIndexOf(data, key);
  1169. return index < 0 ? void 0 : data[index][1];
  1170. }
  1171. function listCacheHas(key) {
  1172. return assocIndexOf(this.__data__, key) > -1;
  1173. }
  1174. function listCacheSet(key, value) {
  1175. var data = this.__data__, index = assocIndexOf(data, key);
  1176. if (index < 0) {
  1177. ++this.size;
  1178. data.push([key, value]);
  1179. } else {
  1180. data[index][1] = value;
  1181. }
  1182. return this;
  1183. }
  1184. function ListCache(entries) {
  1185. var index = -1, length = entries == null ? 0 : entries.length;
  1186. this.clear();
  1187. while (++index < length) {
  1188. var entry = entries[index];
  1189. this.set(entry[0], entry[1]);
  1190. }
  1191. }
  1192. ListCache.prototype.clear = listCacheClear;
  1193. ListCache.prototype["delete"] = listCacheDelete;
  1194. ListCache.prototype.get = listCacheGet;
  1195. ListCache.prototype.has = listCacheHas;
  1196. ListCache.prototype.set = listCacheSet;
  1197. var Map$1 = getNative(root, "Map");
  1198. function mapCacheClear() {
  1199. this.size = 0;
  1200. this.__data__ = {
  1201. "hash": new Hash(),
  1202. "map": new (Map$1 || ListCache)(),
  1203. "string": new Hash()
  1204. };
  1205. }
  1206. function isKeyable(value) {
  1207. var type = typeof value;
  1208. return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
  1209. }
  1210. function getMapData(map, key) {
  1211. var data = map.__data__;
  1212. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  1213. }
  1214. function mapCacheDelete(key) {
  1215. var result = getMapData(this, key)["delete"](key);
  1216. this.size -= result ? 1 : 0;
  1217. return result;
  1218. }
  1219. function mapCacheGet(key) {
  1220. return getMapData(this, key).get(key);
  1221. }
  1222. function mapCacheHas(key) {
  1223. return getMapData(this, key).has(key);
  1224. }
  1225. function mapCacheSet(key, value) {
  1226. var data = getMapData(this, key), size = data.size;
  1227. data.set(key, value);
  1228. this.size += data.size == size ? 0 : 1;
  1229. return this;
  1230. }
  1231. function MapCache(entries) {
  1232. var index = -1, length = entries == null ? 0 : entries.length;
  1233. this.clear();
  1234. while (++index < length) {
  1235. var entry = entries[index];
  1236. this.set(entry[0], entry[1]);
  1237. }
  1238. }
  1239. MapCache.prototype.clear = mapCacheClear;
  1240. MapCache.prototype["delete"] = mapCacheDelete;
  1241. MapCache.prototype.get = mapCacheGet;
  1242. MapCache.prototype.has = mapCacheHas;
  1243. MapCache.prototype.set = mapCacheSet;
  1244. var FUNC_ERROR_TEXT$9 = "Expected a function";
  1245. function memoize(func, resolver) {
  1246. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  1247. throw new TypeError(FUNC_ERROR_TEXT$9);
  1248. }
  1249. var memoized = function() {
  1250. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  1251. if (cache.has(key)) {
  1252. return cache.get(key);
  1253. }
  1254. var result = func.apply(this, args);
  1255. memoized.cache = cache.set(key, result) || cache;
  1256. return result;
  1257. };
  1258. memoized.cache = new (memoize.Cache || MapCache)();
  1259. return memoized;
  1260. }
  1261. memoize.Cache = MapCache;
  1262. var MAX_MEMOIZE_SIZE = 500;
  1263. function memoizeCapped(func) {
  1264. var result = memoize(func, function(key) {
  1265. if (cache.size === MAX_MEMOIZE_SIZE) {
  1266. cache.clear();
  1267. }
  1268. return key;
  1269. });
  1270. var cache = result.cache;
  1271. return result;
  1272. }
  1273. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1274. var reEscapeChar = /\\(\\)?/g;
  1275. var stringToPath = memoizeCapped(function(string) {
  1276. var result = [];
  1277. if (string.charCodeAt(0) === 46) {
  1278. result.push("");
  1279. }
  1280. string.replace(rePropName, function(match, number, quote, subString) {
  1281. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  1282. });
  1283. return result;
  1284. });
  1285. function toString(value) {
  1286. return value == null ? "" : baseToString(value);
  1287. }
  1288. function castPath(value, object) {
  1289. if (isArray$1(value)) {
  1290. return value;
  1291. }
  1292. return isKey(value, object) ? [value] : stringToPath(toString(value));
  1293. }
  1294. var INFINITY$3 = 1 / 0;
  1295. function toKey(value) {
  1296. if (typeof value == "string" || isSymbol(value)) {
  1297. return value;
  1298. }
  1299. var result = value + "";
  1300. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  1301. }
  1302. function baseGet(object, path) {
  1303. path = castPath(path, object);
  1304. var index = 0, length = path.length;
  1305. while (object != null && index < length) {
  1306. object = object[toKey(path[index++])];
  1307. }
  1308. return index && index == length ? object : void 0;
  1309. }
  1310. function get(object, path, defaultValue) {
  1311. var result = object == null ? void 0 : baseGet(object, path);
  1312. return result === void 0 ? defaultValue : result;
  1313. }
  1314. function baseAt(object, paths) {
  1315. var index = -1, length = paths.length, result = Array(length), skip = object == null;
  1316. while (++index < length) {
  1317. result[index] = skip ? void 0 : get(object, paths[index]);
  1318. }
  1319. return result;
  1320. }
  1321. function arrayPush(array, values) {
  1322. var index = -1, length = values.length, offset = array.length;
  1323. while (++index < length) {
  1324. array[offset + index] = values[index];
  1325. }
  1326. return array;
  1327. }
  1328. var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
  1329. function isFlattenable(value) {
  1330. return isArray$1(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  1331. }
  1332. function baseFlatten(array, depth, predicate, isStrict, result) {
  1333. var index = -1, length = array.length;
  1334. predicate || (predicate = isFlattenable);
  1335. result || (result = []);
  1336. while (++index < length) {
  1337. var value = array[index];
  1338. if (depth > 0 && predicate(value)) {
  1339. if (depth > 1) {
  1340. baseFlatten(value, depth - 1, predicate, isStrict, result);
  1341. } else {
  1342. arrayPush(result, value);
  1343. }
  1344. } else if (!isStrict) {
  1345. result[result.length] = value;
  1346. }
  1347. }
  1348. return result;
  1349. }
  1350. function flatten(array) {
  1351. var length = array == null ? 0 : array.length;
  1352. return length ? baseFlatten(array, 1) : [];
  1353. }
  1354. function flatRest(func) {
  1355. return setToString(overRest(func, void 0, flatten), func + "");
  1356. }
  1357. var at$1 = flatRest(baseAt);
  1358. var getPrototype = overArg(Object.getPrototypeOf, Object);
  1359. var objectTag$3 = "[object Object]";
  1360. var funcProto = Function.prototype;
  1361. var objectProto$e = Object.prototype;
  1362. var funcToString = funcProto.toString;
  1363. var hasOwnProperty$d = objectProto$e.hasOwnProperty;
  1364. var objectCtorString = funcToString.call(Object);
  1365. function isPlainObject(value) {
  1366. if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) {
  1367. return false;
  1368. }
  1369. var proto = getPrototype(value);
  1370. if (proto === null) {
  1371. return true;
  1372. }
  1373. var Ctor = hasOwnProperty$d.call(proto, "constructor") && proto.constructor;
  1374. return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
  1375. }
  1376. var domExcTag = "[object DOMException]";
  1377. var errorTag$2 = "[object Error]";
  1378. function isError(value) {
  1379. if (!isObjectLike(value)) {
  1380. return false;
  1381. }
  1382. var tag = baseGetTag(value);
  1383. return tag == errorTag$2 || tag == domExcTag || typeof value.message == "string" && typeof value.name == "string" && !isPlainObject(value);
  1384. }
  1385. var attempt = baseRest(function(func, args) {
  1386. try {
  1387. return apply(func, void 0, args);
  1388. } catch (e) {
  1389. return isError(e) ? e : new Error(e);
  1390. }
  1391. });
  1392. var FUNC_ERROR_TEXT$8 = "Expected a function";
  1393. function before(n, func) {
  1394. var result;
  1395. if (typeof func != "function") {
  1396. throw new TypeError(FUNC_ERROR_TEXT$8);
  1397. }
  1398. n = toInteger(n);
  1399. return function() {
  1400. if (--n > 0) {
  1401. result = func.apply(this, arguments);
  1402. }
  1403. if (n <= 1) {
  1404. func = void 0;
  1405. }
  1406. return result;
  1407. };
  1408. }
  1409. var WRAP_BIND_FLAG$1 = 1;
  1410. var WRAP_PARTIAL_FLAG$3 = 32;
  1411. var bind = baseRest(function(func, thisArg, partials) {
  1412. var bitmask = WRAP_BIND_FLAG$1;
  1413. if (partials.length) {
  1414. var holders = replaceHolders(partials, getHolder(bind));
  1415. bitmask |= WRAP_PARTIAL_FLAG$3;
  1416. }
  1417. return createWrap(func, bitmask, thisArg, partials, holders);
  1418. });
  1419. bind.placeholder = {};
  1420. var bindAll = flatRest(function(object, methodNames) {
  1421. arrayEach(methodNames, function(key) {
  1422. key = toKey(key);
  1423. baseAssignValue(object, key, bind(object[key], object));
  1424. });
  1425. return object;
  1426. });
  1427. var WRAP_BIND_FLAG = 1;
  1428. var WRAP_BIND_KEY_FLAG$1 = 2;
  1429. var WRAP_PARTIAL_FLAG$2 = 32;
  1430. var bindKey = baseRest(function(object, key, partials) {
  1431. var bitmask = WRAP_BIND_FLAG | WRAP_BIND_KEY_FLAG$1;
  1432. if (partials.length) {
  1433. var holders = replaceHolders(partials, getHolder(bindKey));
  1434. bitmask |= WRAP_PARTIAL_FLAG$2;
  1435. }
  1436. return createWrap(key, bitmask, object, partials, holders);
  1437. });
  1438. bindKey.placeholder = {};
  1439. function baseSlice(array, start, end) {
  1440. var index = -1, length = array.length;
  1441. if (start < 0) {
  1442. start = -start > length ? 0 : length + start;
  1443. }
  1444. end = end > length ? length : end;
  1445. if (end < 0) {
  1446. end += length;
  1447. }
  1448. length = start > end ? 0 : end - start >>> 0;
  1449. start >>>= 0;
  1450. var result = Array(length);
  1451. while (++index < length) {
  1452. result[index] = array[index + start];
  1453. }
  1454. return result;
  1455. }
  1456. function castSlice(array, start, end) {
  1457. var length = array.length;
  1458. end = end === void 0 ? length : end;
  1459. return !start && end >= length ? array : baseSlice(array, start, end);
  1460. }
  1461. var rsAstralRange$3 = "\\ud800-\\udfff";
  1462. var rsComboMarksRange$4 = "\\u0300-\\u036f";
  1463. var reComboHalfMarksRange$4 = "\\ufe20-\\ufe2f";
  1464. var rsComboSymbolsRange$4 = "\\u20d0-\\u20ff";
  1465. var rsComboRange$4 = rsComboMarksRange$4 + reComboHalfMarksRange$4 + rsComboSymbolsRange$4;
  1466. var rsVarRange$3 = "\\ufe0e\\ufe0f";
  1467. var rsZWJ$3 = "\\u200d";
  1468. var reHasUnicode = RegExp("[" + rsZWJ$3 + rsAstralRange$3 + rsComboRange$4 + rsVarRange$3 + "]");
  1469. function hasUnicode(string) {
  1470. return reHasUnicode.test(string);
  1471. }
  1472. function asciiToArray(string) {
  1473. return string.split("");
  1474. }
  1475. var rsAstralRange$2 = "\\ud800-\\udfff";
  1476. var rsComboMarksRange$3 = "\\u0300-\\u036f";
  1477. var reComboHalfMarksRange$3 = "\\ufe20-\\ufe2f";
  1478. var rsComboSymbolsRange$3 = "\\u20d0-\\u20ff";
  1479. var rsComboRange$3 = rsComboMarksRange$3 + reComboHalfMarksRange$3 + rsComboSymbolsRange$3;
  1480. var rsVarRange$2 = "\\ufe0e\\ufe0f";
  1481. var rsAstral$1 = "[" + rsAstralRange$2 + "]";
  1482. var rsCombo$3 = "[" + rsComboRange$3 + "]";
  1483. var rsFitz$2 = "\\ud83c[\\udffb-\\udfff]";
  1484. var rsModifier$2 = "(?:" + rsCombo$3 + "|" + rsFitz$2 + ")";
  1485. var rsNonAstral$2 = "[^" + rsAstralRange$2 + "]";
  1486. var rsRegional$2 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  1487. var rsSurrPair$2 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  1488. var rsZWJ$2 = "\\u200d";
  1489. var reOptMod$2 = rsModifier$2 + "?";
  1490. var rsOptVar$2 = "[" + rsVarRange$2 + "]?";
  1491. var rsOptJoin$2 = "(?:" + rsZWJ$2 + "(?:" + [rsNonAstral$2, rsRegional$2, rsSurrPair$2].join("|") + ")" + rsOptVar$2 + reOptMod$2 + ")*";
  1492. var rsSeq$2 = rsOptVar$2 + reOptMod$2 + rsOptJoin$2;
  1493. var rsSymbol$1 = "(?:" + [rsNonAstral$2 + rsCombo$3 + "?", rsCombo$3, rsRegional$2, rsSurrPair$2, rsAstral$1].join("|") + ")";
  1494. var reUnicode$1 = RegExp(rsFitz$2 + "(?=" + rsFitz$2 + ")|" + rsSymbol$1 + rsSeq$2, "g");
  1495. function unicodeToArray(string) {
  1496. return string.match(reUnicode$1) || [];
  1497. }
  1498. function stringToArray(string) {
  1499. return hasUnicode(string) ? unicodeToArray(string) : asciiToArray(string);
  1500. }
  1501. function createCaseFirst(methodName) {
  1502. return function(string) {
  1503. string = toString(string);
  1504. var strSymbols = hasUnicode(string) ? stringToArray(string) : void 0;
  1505. var chr = strSymbols ? strSymbols[0] : string.charAt(0);
  1506. var trailing = strSymbols ? castSlice(strSymbols, 1).join("") : string.slice(1);
  1507. return chr[methodName]() + trailing;
  1508. };
  1509. }
  1510. var upperFirst = createCaseFirst("toUpperCase");
  1511. function capitalize$2(string) {
  1512. return upperFirst(toString(string).toLowerCase());
  1513. }
  1514. function arrayReduce(array, iteratee, accumulator, initAccum) {
  1515. var index = -1, length = array == null ? 0 : array.length;
  1516. if (initAccum && length) {
  1517. accumulator = array[++index];
  1518. }
  1519. while (++index < length) {
  1520. accumulator = iteratee(accumulator, array[index], index, array);
  1521. }
  1522. return accumulator;
  1523. }
  1524. function basePropertyOf(object) {
  1525. return function(key) {
  1526. return object == null ? void 0 : object[key];
  1527. };
  1528. }
  1529. var deburredLetters = {
  1530. "\xC0": "A",
  1531. "\xC1": "A",
  1532. "\xC2": "A",
  1533. "\xC3": "A",
  1534. "\xC4": "A",
  1535. "\xC5": "A",
  1536. "\xE0": "a",
  1537. "\xE1": "a",
  1538. "\xE2": "a",
  1539. "\xE3": "a",
  1540. "\xE4": "a",
  1541. "\xE5": "a",
  1542. "\xC7": "C",
  1543. "\xE7": "c",
  1544. "\xD0": "D",
  1545. "\xF0": "d",
  1546. "\xC8": "E",
  1547. "\xC9": "E",
  1548. "\xCA": "E",
  1549. "\xCB": "E",
  1550. "\xE8": "e",
  1551. "\xE9": "e",
  1552. "\xEA": "e",
  1553. "\xEB": "e",
  1554. "\xCC": "I",
  1555. "\xCD": "I",
  1556. "\xCE": "I",
  1557. "\xCF": "I",
  1558. "\xEC": "i",
  1559. "\xED": "i",
  1560. "\xEE": "i",
  1561. "\xEF": "i",
  1562. "\xD1": "N",
  1563. "\xF1": "n",
  1564. "\xD2": "O",
  1565. "\xD3": "O",
  1566. "\xD4": "O",
  1567. "\xD5": "O",
  1568. "\xD6": "O",
  1569. "\xD8": "O",
  1570. "\xF2": "o",
  1571. "\xF3": "o",
  1572. "\xF4": "o",
  1573. "\xF5": "o",
  1574. "\xF6": "o",
  1575. "\xF8": "o",
  1576. "\xD9": "U",
  1577. "\xDA": "U",
  1578. "\xDB": "U",
  1579. "\xDC": "U",
  1580. "\xF9": "u",
  1581. "\xFA": "u",
  1582. "\xFB": "u",
  1583. "\xFC": "u",
  1584. "\xDD": "Y",
  1585. "\xFD": "y",
  1586. "\xFF": "y",
  1587. "\xC6": "Ae",
  1588. "\xE6": "ae",
  1589. "\xDE": "Th",
  1590. "\xFE": "th",
  1591. "\xDF": "ss",
  1592. "\u0100": "A",
  1593. "\u0102": "A",
  1594. "\u0104": "A",
  1595. "\u0101": "a",
  1596. "\u0103": "a",
  1597. "\u0105": "a",
  1598. "\u0106": "C",
  1599. "\u0108": "C",
  1600. "\u010A": "C",
  1601. "\u010C": "C",
  1602. "\u0107": "c",
  1603. "\u0109": "c",
  1604. "\u010B": "c",
  1605. "\u010D": "c",
  1606. "\u010E": "D",
  1607. "\u0110": "D",
  1608. "\u010F": "d",
  1609. "\u0111": "d",
  1610. "\u0112": "E",
  1611. "\u0114": "E",
  1612. "\u0116": "E",
  1613. "\u0118": "E",
  1614. "\u011A": "E",
  1615. "\u0113": "e",
  1616. "\u0115": "e",
  1617. "\u0117": "e",
  1618. "\u0119": "e",
  1619. "\u011B": "e",
  1620. "\u011C": "G",
  1621. "\u011E": "G",
  1622. "\u0120": "G",
  1623. "\u0122": "G",
  1624. "\u011D": "g",
  1625. "\u011F": "g",
  1626. "\u0121": "g",
  1627. "\u0123": "g",
  1628. "\u0124": "H",
  1629. "\u0126": "H",
  1630. "\u0125": "h",
  1631. "\u0127": "h",
  1632. "\u0128": "I",
  1633. "\u012A": "I",
  1634. "\u012C": "I",
  1635. "\u012E": "I",
  1636. "\u0130": "I",
  1637. "\u0129": "i",
  1638. "\u012B": "i",
  1639. "\u012D": "i",
  1640. "\u012F": "i",
  1641. "\u0131": "i",
  1642. "\u0134": "J",
  1643. "\u0135": "j",
  1644. "\u0136": "K",
  1645. "\u0137": "k",
  1646. "\u0138": "k",
  1647. "\u0139": "L",
  1648. "\u013B": "L",
  1649. "\u013D": "L",
  1650. "\u013F": "L",
  1651. "\u0141": "L",
  1652. "\u013A": "l",
  1653. "\u013C": "l",
  1654. "\u013E": "l",
  1655. "\u0140": "l",
  1656. "\u0142": "l",
  1657. "\u0143": "N",
  1658. "\u0145": "N",
  1659. "\u0147": "N",
  1660. "\u014A": "N",
  1661. "\u0144": "n",
  1662. "\u0146": "n",
  1663. "\u0148": "n",
  1664. "\u014B": "n",
  1665. "\u014C": "O",
  1666. "\u014E": "O",
  1667. "\u0150": "O",
  1668. "\u014D": "o",
  1669. "\u014F": "o",
  1670. "\u0151": "o",
  1671. "\u0154": "R",
  1672. "\u0156": "R",
  1673. "\u0158": "R",
  1674. "\u0155": "r",
  1675. "\u0157": "r",
  1676. "\u0159": "r",
  1677. "\u015A": "S",
  1678. "\u015C": "S",
  1679. "\u015E": "S",
  1680. "\u0160": "S",
  1681. "\u015B": "s",
  1682. "\u015D": "s",
  1683. "\u015F": "s",
  1684. "\u0161": "s",
  1685. "\u0162": "T",
  1686. "\u0164": "T",
  1687. "\u0166": "T",
  1688. "\u0163": "t",
  1689. "\u0165": "t",
  1690. "\u0167": "t",
  1691. "\u0168": "U",
  1692. "\u016A": "U",
  1693. "\u016C": "U",
  1694. "\u016E": "U",
  1695. "\u0170": "U",
  1696. "\u0172": "U",
  1697. "\u0169": "u",
  1698. "\u016B": "u",
  1699. "\u016D": "u",
  1700. "\u016F": "u",
  1701. "\u0171": "u",
  1702. "\u0173": "u",
  1703. "\u0174": "W",
  1704. "\u0175": "w",
  1705. "\u0176": "Y",
  1706. "\u0177": "y",
  1707. "\u0178": "Y",
  1708. "\u0179": "Z",
  1709. "\u017B": "Z",
  1710. "\u017D": "Z",
  1711. "\u017A": "z",
  1712. "\u017C": "z",
  1713. "\u017E": "z",
  1714. "\u0132": "IJ",
  1715. "\u0133": "ij",
  1716. "\u0152": "Oe",
  1717. "\u0153": "oe",
  1718. "\u0149": "'n",
  1719. "\u017F": "s"
  1720. };
  1721. var deburrLetter = basePropertyOf(deburredLetters);
  1722. var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
  1723. var rsComboMarksRange$2 = "\\u0300-\\u036f";
  1724. var reComboHalfMarksRange$2 = "\\ufe20-\\ufe2f";
  1725. var rsComboSymbolsRange$2 = "\\u20d0-\\u20ff";
  1726. var rsComboRange$2 = rsComboMarksRange$2 + reComboHalfMarksRange$2 + rsComboSymbolsRange$2;
  1727. var rsCombo$2 = "[" + rsComboRange$2 + "]";
  1728. var reComboMark = RegExp(rsCombo$2, "g");
  1729. function deburr(string) {
  1730. string = toString(string);
  1731. return string && string.replace(reLatin, deburrLetter).replace(reComboMark, "");
  1732. }
  1733. var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;
  1734. function asciiWords(string) {
  1735. return string.match(reAsciiWord) || [];
  1736. }
  1737. 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 ]/;
  1738. function hasUnicodeWord(string) {
  1739. return reHasUnicodeWord.test(string);
  1740. }
  1741. var rsAstralRange$1 = "\\ud800-\\udfff";
  1742. var rsComboMarksRange$1 = "\\u0300-\\u036f";
  1743. var reComboHalfMarksRange$1 = "\\ufe20-\\ufe2f";
  1744. var rsComboSymbolsRange$1 = "\\u20d0-\\u20ff";
  1745. var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
  1746. var rsDingbatRange = "\\u2700-\\u27bf";
  1747. var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
  1748. var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
  1749. var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
  1750. var rsPunctuationRange = "\\u2000-\\u206f";
  1751. 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";
  1752. var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
  1753. var rsVarRange$1 = "\\ufe0e\\ufe0f";
  1754. var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
  1755. var rsApos$1 = "['\u2019]";
  1756. var rsBreak = "[" + rsBreakRange + "]";
  1757. var rsCombo$1 = "[" + rsComboRange$1 + "]";
  1758. var rsDigits = "\\d+";
  1759. var rsDingbat = "[" + rsDingbatRange + "]";
  1760. var rsLower = "[" + rsLowerRange + "]";
  1761. var rsMisc = "[^" + rsAstralRange$1 + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
  1762. var rsFitz$1 = "\\ud83c[\\udffb-\\udfff]";
  1763. var rsModifier$1 = "(?:" + rsCombo$1 + "|" + rsFitz$1 + ")";
  1764. var rsNonAstral$1 = "[^" + rsAstralRange$1 + "]";
  1765. var rsRegional$1 = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  1766. var rsSurrPair$1 = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  1767. var rsUpper = "[" + rsUpperRange + "]";
  1768. var rsZWJ$1 = "\\u200d";
  1769. var rsMiscLower = "(?:" + rsLower + "|" + rsMisc + ")";
  1770. var rsMiscUpper = "(?:" + rsUpper + "|" + rsMisc + ")";
  1771. var rsOptContrLower = "(?:" + rsApos$1 + "(?:d|ll|m|re|s|t|ve))?";
  1772. var rsOptContrUpper = "(?:" + rsApos$1 + "(?:D|LL|M|RE|S|T|VE))?";
  1773. var reOptMod$1 = rsModifier$1 + "?";
  1774. var rsOptVar$1 = "[" + rsVarRange$1 + "]?";
  1775. var rsOptJoin$1 = "(?:" + rsZWJ$1 + "(?:" + [rsNonAstral$1, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsOptVar$1 + reOptMod$1 + ")*";
  1776. var rsOrdLower = "\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])";
  1777. var rsOrdUpper = "\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])";
  1778. var rsSeq$1 = rsOptVar$1 + reOptMod$1 + rsOptJoin$1;
  1779. var rsEmoji = "(?:" + [rsDingbat, rsRegional$1, rsSurrPair$1].join("|") + ")" + rsSeq$1;
  1780. var reUnicodeWord = RegExp([
  1781. rsUpper + "?" + rsLower + "+" + rsOptContrLower + "(?=" + [rsBreak, rsUpper, "$"].join("|") + ")",
  1782. rsMiscUpper + "+" + rsOptContrUpper + "(?=" + [rsBreak, rsUpper + rsMiscLower, "$"].join("|") + ")",
  1783. rsUpper + "?" + rsMiscLower + "+" + rsOptContrLower,
  1784. rsUpper + "+" + rsOptContrUpper,
  1785. rsOrdUpper,
  1786. rsOrdLower,
  1787. rsDigits,
  1788. rsEmoji
  1789. ].join("|"), "g");
  1790. function unicodeWords(string) {
  1791. return string.match(reUnicodeWord) || [];
  1792. }
  1793. function words(string, pattern, guard) {
  1794. string = toString(string);
  1795. pattern = guard ? void 0 : pattern;
  1796. if (pattern === void 0) {
  1797. return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string);
  1798. }
  1799. return string.match(pattern) || [];
  1800. }
  1801. var rsApos = "['\u2019]";
  1802. var reApos = RegExp(rsApos, "g");
  1803. function createCompounder(callback) {
  1804. return function(string) {
  1805. return arrayReduce(words(deburr(string).replace(reApos, "")), callback, "");
  1806. };
  1807. }
  1808. var camelCase = createCompounder(function(result, word, index) {
  1809. word = word.toLowerCase();
  1810. return result + (index ? capitalize$2(word) : word);
  1811. });
  1812. function castArray$1() {
  1813. if (!arguments.length) {
  1814. return [];
  1815. }
  1816. var value = arguments[0];
  1817. return isArray$1(value) ? value : [value];
  1818. }
  1819. var nativeIsFinite$1 = root.isFinite;
  1820. var nativeMin$c = Math.min;
  1821. function createRound(methodName) {
  1822. var func = Math[methodName];
  1823. return function(number, precision) {
  1824. number = toNumber(number);
  1825. precision = precision == null ? 0 : nativeMin$c(toInteger(precision), 292);
  1826. if (precision && nativeIsFinite$1(number)) {
  1827. var pair = (toString(number) + "e").split("e"), value = func(pair[0] + "e" + (+pair[1] + precision));
  1828. pair = (toString(value) + "e").split("e");
  1829. return +(pair[0] + "e" + (+pair[1] - precision));
  1830. }
  1831. return func(number);
  1832. };
  1833. }
  1834. var ceil = createRound("ceil");
  1835. function chain(value) {
  1836. var result = lodash(value);
  1837. result.__chain__ = true;
  1838. return result;
  1839. }
  1840. var nativeCeil$3 = Math.ceil;
  1841. var nativeMax$c = Math.max;
  1842. function chunk(array, size, guard) {
  1843. if (guard ? isIterateeCall(array, size, guard) : size === void 0) {
  1844. size = 1;
  1845. } else {
  1846. size = nativeMax$c(toInteger(size), 0);
  1847. }
  1848. var length = array == null ? 0 : array.length;
  1849. if (!length || size < 1) {
  1850. return [];
  1851. }
  1852. var index = 0, resIndex = 0, result = Array(nativeCeil$3(length / size));
  1853. while (index < length) {
  1854. result[resIndex++] = baseSlice(array, index, index += size);
  1855. }
  1856. return result;
  1857. }
  1858. function baseClamp(number, lower, upper) {
  1859. if (number === number) {
  1860. if (upper !== void 0) {
  1861. number = number <= upper ? number : upper;
  1862. }
  1863. if (lower !== void 0) {
  1864. number = number >= lower ? number : lower;
  1865. }
  1866. }
  1867. return number;
  1868. }
  1869. function clamp(number, lower, upper) {
  1870. if (upper === void 0) {
  1871. upper = lower;
  1872. lower = void 0;
  1873. }
  1874. if (upper !== void 0) {
  1875. upper = toNumber(upper);
  1876. upper = upper === upper ? upper : 0;
  1877. }
  1878. if (lower !== void 0) {
  1879. lower = toNumber(lower);
  1880. lower = lower === lower ? lower : 0;
  1881. }
  1882. return baseClamp(toNumber(number), lower, upper);
  1883. }
  1884. function stackClear() {
  1885. this.__data__ = new ListCache();
  1886. this.size = 0;
  1887. }
  1888. function stackDelete(key) {
  1889. var data = this.__data__, result = data["delete"](key);
  1890. this.size = data.size;
  1891. return result;
  1892. }
  1893. function stackGet(key) {
  1894. return this.__data__.get(key);
  1895. }
  1896. function stackHas(key) {
  1897. return this.__data__.has(key);
  1898. }
  1899. var LARGE_ARRAY_SIZE$2 = 200;
  1900. function stackSet(key, value) {
  1901. var data = this.__data__;
  1902. if (data instanceof ListCache) {
  1903. var pairs = data.__data__;
  1904. if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE$2 - 1) {
  1905. pairs.push([key, value]);
  1906. this.size = ++data.size;
  1907. return this;
  1908. }
  1909. data = this.__data__ = new MapCache(pairs);
  1910. }
  1911. data.set(key, value);
  1912. this.size = data.size;
  1913. return this;
  1914. }
  1915. function Stack(entries) {
  1916. var data = this.__data__ = new ListCache(entries);
  1917. this.size = data.size;
  1918. }
  1919. Stack.prototype.clear = stackClear;
  1920. Stack.prototype["delete"] = stackDelete;
  1921. Stack.prototype.get = stackGet;
  1922. Stack.prototype.has = stackHas;
  1923. Stack.prototype.set = stackSet;
  1924. function baseAssign(object, source) {
  1925. return object && copyObject(source, keys(source), object);
  1926. }
  1927. function baseAssignIn(object, source) {
  1928. return object && copyObject(source, keysIn(source), object);
  1929. }
  1930. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  1931. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  1932. var moduleExports = freeModule && freeModule.exports === freeExports;
  1933. var Buffer = moduleExports ? root.Buffer : void 0;
  1934. var allocUnsafe = Buffer ? Buffer.allocUnsafe : void 0;
  1935. function cloneBuffer(buffer, isDeep) {
  1936. if (isDeep) {
  1937. return buffer.slice();
  1938. }
  1939. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  1940. buffer.copy(result);
  1941. return result;
  1942. }
  1943. function arrayFilter(array, predicate) {
  1944. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  1945. while (++index < length) {
  1946. var value = array[index];
  1947. if (predicate(value, index, array)) {
  1948. result[resIndex++] = value;
  1949. }
  1950. }
  1951. return result;
  1952. }
  1953. function stubArray() {
  1954. return [];
  1955. }
  1956. var objectProto$d = Object.prototype;
  1957. var propertyIsEnumerable = objectProto$d.propertyIsEnumerable;
  1958. var nativeGetSymbols$1 = Object.getOwnPropertySymbols;
  1959. var getSymbols = !nativeGetSymbols$1 ? stubArray : function(object) {
  1960. if (object == null) {
  1961. return [];
  1962. }
  1963. object = Object(object);
  1964. return arrayFilter(nativeGetSymbols$1(object), function(symbol) {
  1965. return propertyIsEnumerable.call(object, symbol);
  1966. });
  1967. };
  1968. function copySymbols(source, object) {
  1969. return copyObject(source, getSymbols(source), object);
  1970. }
  1971. var nativeGetSymbols = Object.getOwnPropertySymbols;
  1972. var getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {
  1973. var result = [];
  1974. while (object) {
  1975. arrayPush(result, getSymbols(object));
  1976. object = getPrototype(object);
  1977. }
  1978. return result;
  1979. };
  1980. function copySymbolsIn(source, object) {
  1981. return copyObject(source, getSymbolsIn(source), object);
  1982. }
  1983. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  1984. var result = keysFunc(object);
  1985. return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
  1986. }
  1987. function getAllKeys(object) {
  1988. return baseGetAllKeys(object, keys, getSymbols);
  1989. }
  1990. function getAllKeysIn(object) {
  1991. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  1992. }
  1993. var DataView = getNative(root, "DataView");
  1994. var Promise$1 = getNative(root, "Promise");
  1995. var Set$1 = getNative(root, "Set");
  1996. var mapTag$8 = "[object Map]";
  1997. var objectTag$2 = "[object Object]";
  1998. var promiseTag = "[object Promise]";
  1999. var setTag$8 = "[object Set]";
  2000. var weakMapTag$2 = "[object WeakMap]";
  2001. var dataViewTag$3 = "[object DataView]";
  2002. var dataViewCtorString = toSource(DataView);
  2003. var mapCtorString = toSource(Map$1);
  2004. var promiseCtorString = toSource(Promise$1);
  2005. var setCtorString = toSource(Set$1);
  2006. var weakMapCtorString = toSource(WeakMap);
  2007. var getTag = baseGetTag;
  2008. 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) {
  2009. getTag = function(value) {
  2010. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  2011. if (ctorString) {
  2012. switch (ctorString) {
  2013. case dataViewCtorString:
  2014. return dataViewTag$3;
  2015. case mapCtorString:
  2016. return mapTag$8;
  2017. case promiseCtorString:
  2018. return promiseTag;
  2019. case setCtorString:
  2020. return setTag$8;
  2021. case weakMapCtorString:
  2022. return weakMapTag$2;
  2023. }
  2024. }
  2025. return result;
  2026. };
  2027. }
  2028. var getTag$1 = getTag;
  2029. var objectProto$c = Object.prototype;
  2030. var hasOwnProperty$c = objectProto$c.hasOwnProperty;
  2031. function initCloneArray(array) {
  2032. var length = array.length, result = new array.constructor(length);
  2033. if (length && typeof array[0] == "string" && hasOwnProperty$c.call(array, "index")) {
  2034. result.index = array.index;
  2035. result.input = array.input;
  2036. }
  2037. return result;
  2038. }
  2039. var Uint8Array = root.Uint8Array;
  2040. function cloneArrayBuffer(arrayBuffer) {
  2041. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  2042. new Uint8Array(result).set(new Uint8Array(arrayBuffer));
  2043. return result;
  2044. }
  2045. function cloneDataView(dataView, isDeep) {
  2046. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  2047. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  2048. }
  2049. var reFlags$1 = /\w*$/;
  2050. function cloneRegExp(regexp) {
  2051. var result = new regexp.constructor(regexp.source, reFlags$1.exec(regexp));
  2052. result.lastIndex = regexp.lastIndex;
  2053. return result;
  2054. }
  2055. var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0;
  2056. var symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  2057. function cloneSymbol(symbol) {
  2058. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  2059. }
  2060. function cloneTypedArray(typedArray, isDeep) {
  2061. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  2062. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  2063. }
  2064. var boolTag$3 = "[object Boolean]";
  2065. var dateTag$3 = "[object Date]";
  2066. var mapTag$7 = "[object Map]";
  2067. var numberTag$3 = "[object Number]";
  2068. var regexpTag$3 = "[object RegExp]";
  2069. var setTag$7 = "[object Set]";
  2070. var stringTag$3 = "[object String]";
  2071. var symbolTag$2 = "[object Symbol]";
  2072. var arrayBufferTag$3 = "[object ArrayBuffer]";
  2073. var dataViewTag$2 = "[object DataView]";
  2074. var float32Tag$1 = "[object Float32Array]";
  2075. var float64Tag$1 = "[object Float64Array]";
  2076. var int8Tag$1 = "[object Int8Array]";
  2077. var int16Tag$1 = "[object Int16Array]";
  2078. var int32Tag$1 = "[object Int32Array]";
  2079. var uint8Tag$1 = "[object Uint8Array]";
  2080. var uint8ClampedTag$1 = "[object Uint8ClampedArray]";
  2081. var uint16Tag$1 = "[object Uint16Array]";
  2082. var uint32Tag$1 = "[object Uint32Array]";
  2083. function initCloneByTag(object, tag, isDeep) {
  2084. var Ctor = object.constructor;
  2085. switch (tag) {
  2086. case arrayBufferTag$3:
  2087. return cloneArrayBuffer(object);
  2088. case boolTag$3:
  2089. case dateTag$3:
  2090. return new Ctor(+object);
  2091. case dataViewTag$2:
  2092. return cloneDataView(object, isDeep);
  2093. case float32Tag$1:
  2094. case float64Tag$1:
  2095. case int8Tag$1:
  2096. case int16Tag$1:
  2097. case int32Tag$1:
  2098. case uint8Tag$1:
  2099. case uint8ClampedTag$1:
  2100. case uint16Tag$1:
  2101. case uint32Tag$1:
  2102. return cloneTypedArray(object, isDeep);
  2103. case mapTag$7:
  2104. return new Ctor();
  2105. case numberTag$3:
  2106. case stringTag$3:
  2107. return new Ctor(object);
  2108. case regexpTag$3:
  2109. return cloneRegExp(object);
  2110. case setTag$7:
  2111. return new Ctor();
  2112. case symbolTag$2:
  2113. return cloneSymbol(object);
  2114. }
  2115. }
  2116. function initCloneObject(object) {
  2117. return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
  2118. }
  2119. var mapTag$6 = "[object Map]";
  2120. function baseIsMap(value) {
  2121. return isObjectLike(value) && getTag$1(value) == mapTag$6;
  2122. }
  2123. var nodeIsMap = nodeUtil && nodeUtil.isMap;
  2124. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  2125. var setTag$6 = "[object Set]";
  2126. function baseIsSet(value) {
  2127. return isObjectLike(value) && getTag$1(value) == setTag$6;
  2128. }
  2129. var nodeIsSet = nodeUtil && nodeUtil.isSet;
  2130. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  2131. var CLONE_DEEP_FLAG$7 = 1;
  2132. var CLONE_FLAT_FLAG$1 = 2;
  2133. var CLONE_SYMBOLS_FLAG$5 = 4;
  2134. var argsTag$1 = "[object Arguments]";
  2135. var arrayTag$1 = "[object Array]";
  2136. var boolTag$2 = "[object Boolean]";
  2137. var dateTag$2 = "[object Date]";
  2138. var errorTag$1 = "[object Error]";
  2139. var funcTag = "[object Function]";
  2140. var genTag = "[object GeneratorFunction]";
  2141. var mapTag$5 = "[object Map]";
  2142. var numberTag$2 = "[object Number]";
  2143. var objectTag$1 = "[object Object]";
  2144. var regexpTag$2 = "[object RegExp]";
  2145. var setTag$5 = "[object Set]";
  2146. var stringTag$2 = "[object String]";
  2147. var symbolTag$1 = "[object Symbol]";
  2148. var weakMapTag$1 = "[object WeakMap]";
  2149. var arrayBufferTag$2 = "[object ArrayBuffer]";
  2150. var dataViewTag$1 = "[object DataView]";
  2151. var float32Tag = "[object Float32Array]";
  2152. var float64Tag = "[object Float64Array]";
  2153. var int8Tag = "[object Int8Array]";
  2154. var int16Tag = "[object Int16Array]";
  2155. var int32Tag = "[object Int32Array]";
  2156. var uint8Tag = "[object Uint8Array]";
  2157. var uint8ClampedTag = "[object Uint8ClampedArray]";
  2158. var uint16Tag = "[object Uint16Array]";
  2159. var uint32Tag = "[object Uint32Array]";
  2160. var cloneableTags = {};
  2161. 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;
  2162. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag$1] = false;
  2163. function baseClone(value, bitmask, customizer, key, object, stack) {
  2164. var result, isDeep = bitmask & CLONE_DEEP_FLAG$7, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$5;
  2165. if (customizer) {
  2166. result = object ? customizer(value, key, object, stack) : customizer(value);
  2167. }
  2168. if (result !== void 0) {
  2169. return result;
  2170. }
  2171. if (!isObject$2(value)) {
  2172. return value;
  2173. }
  2174. var isArr = isArray$1(value);
  2175. if (isArr) {
  2176. result = initCloneArray(value);
  2177. if (!isDeep) {
  2178. return copyArray(value, result);
  2179. }
  2180. } else {
  2181. var tag = getTag$1(value), isFunc = tag == funcTag || tag == genTag;
  2182. if (isBuffer(value)) {
  2183. return cloneBuffer(value, isDeep);
  2184. }
  2185. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
  2186. result = isFlat || isFunc ? {} : initCloneObject(value);
  2187. if (!isDeep) {
  2188. return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  2189. }
  2190. } else {
  2191. if (!cloneableTags[tag]) {
  2192. return object ? value : {};
  2193. }
  2194. result = initCloneByTag(value, tag, isDeep);
  2195. }
  2196. }
  2197. stack || (stack = new Stack());
  2198. var stacked = stack.get(value);
  2199. if (stacked) {
  2200. return stacked;
  2201. }
  2202. stack.set(value, result);
  2203. if (isSet(value)) {
  2204. value.forEach(function(subValue) {
  2205. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  2206. });
  2207. } else if (isMap(value)) {
  2208. value.forEach(function(subValue, key2) {
  2209. result.set(key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  2210. });
  2211. }
  2212. var keysFunc = isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys;
  2213. var props = isArr ? void 0 : keysFunc(value);
  2214. arrayEach(props || value, function(subValue, key2) {
  2215. if (props) {
  2216. key2 = subValue;
  2217. subValue = value[key2];
  2218. }
  2219. assignValue(result, key2, baseClone(subValue, bitmask, customizer, key2, value, stack));
  2220. });
  2221. return result;
  2222. }
  2223. var CLONE_SYMBOLS_FLAG$4 = 4;
  2224. function clone(value) {
  2225. return baseClone(value, CLONE_SYMBOLS_FLAG$4);
  2226. }
  2227. var CLONE_DEEP_FLAG$6 = 1;
  2228. var CLONE_SYMBOLS_FLAG$3 = 4;
  2229. function cloneDeep(value) {
  2230. return baseClone(value, CLONE_DEEP_FLAG$6 | CLONE_SYMBOLS_FLAG$3);
  2231. }
  2232. var CLONE_DEEP_FLAG$5 = 1;
  2233. var CLONE_SYMBOLS_FLAG$2 = 4;
  2234. function cloneDeepWith(value, customizer) {
  2235. customizer = typeof customizer == "function" ? customizer : void 0;
  2236. return baseClone(value, CLONE_DEEP_FLAG$5 | CLONE_SYMBOLS_FLAG$2, customizer);
  2237. }
  2238. var CLONE_SYMBOLS_FLAG$1 = 4;
  2239. function cloneWith(value, customizer) {
  2240. customizer = typeof customizer == "function" ? customizer : void 0;
  2241. return baseClone(value, CLONE_SYMBOLS_FLAG$1, customizer);
  2242. }
  2243. function wrapperCommit() {
  2244. return new LodashWrapper(this.value(), this.__chain__);
  2245. }
  2246. function compact(array) {
  2247. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  2248. while (++index < length) {
  2249. var value = array[index];
  2250. if (value) {
  2251. result[resIndex++] = value;
  2252. }
  2253. }
  2254. return result;
  2255. }
  2256. function concat() {
  2257. var length = arguments.length;
  2258. if (!length) {
  2259. return [];
  2260. }
  2261. var args = Array(length - 1), array = arguments[0], index = length;
  2262. while (index--) {
  2263. args[index - 1] = arguments[index];
  2264. }
  2265. return arrayPush(isArray$1(array) ? copyArray(array) : [array], baseFlatten(args, 1));
  2266. }
  2267. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  2268. function setCacheAdd(value) {
  2269. this.__data__.set(value, HASH_UNDEFINED);
  2270. return this;
  2271. }
  2272. function setCacheHas(value) {
  2273. return this.__data__.has(value);
  2274. }
  2275. function SetCache(values) {
  2276. var index = -1, length = values == null ? 0 : values.length;
  2277. this.__data__ = new MapCache();
  2278. while (++index < length) {
  2279. this.add(values[index]);
  2280. }
  2281. }
  2282. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  2283. SetCache.prototype.has = setCacheHas;
  2284. function arraySome(array, predicate) {
  2285. var index = -1, length = array == null ? 0 : array.length;
  2286. while (++index < length) {
  2287. if (predicate(array[index], index, array)) {
  2288. return true;
  2289. }
  2290. }
  2291. return false;
  2292. }
  2293. function cacheHas(cache, key) {
  2294. return cache.has(key);
  2295. }
  2296. var COMPARE_PARTIAL_FLAG$5 = 1;
  2297. var COMPARE_UNORDERED_FLAG$3 = 2;
  2298. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  2299. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length;
  2300. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  2301. return false;
  2302. }
  2303. var arrStacked = stack.get(array);
  2304. var othStacked = stack.get(other);
  2305. if (arrStacked && othStacked) {
  2306. return arrStacked == other && othStacked == array;
  2307. }
  2308. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  2309. stack.set(array, other);
  2310. stack.set(other, array);
  2311. while (++index < arrLength) {
  2312. var arrValue = array[index], othValue = other[index];
  2313. if (customizer) {
  2314. var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
  2315. }
  2316. if (compared !== void 0) {
  2317. if (compared) {
  2318. continue;
  2319. }
  2320. result = false;
  2321. break;
  2322. }
  2323. if (seen) {
  2324. if (!arraySome(other, function(othValue2, othIndex) {
  2325. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  2326. return seen.push(othIndex);
  2327. }
  2328. })) {
  2329. result = false;
  2330. break;
  2331. }
  2332. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  2333. result = false;
  2334. break;
  2335. }
  2336. }
  2337. stack["delete"](array);
  2338. stack["delete"](other);
  2339. return result;
  2340. }
  2341. function mapToArray(map) {
  2342. var index = -1, result = Array(map.size);
  2343. map.forEach(function(value, key) {
  2344. result[++index] = [key, value];
  2345. });
  2346. return result;
  2347. }
  2348. function setToArray(set) {
  2349. var index = -1, result = Array(set.size);
  2350. set.forEach(function(value) {
  2351. result[++index] = value;
  2352. });
  2353. return result;
  2354. }
  2355. var COMPARE_PARTIAL_FLAG$4 = 1;
  2356. var COMPARE_UNORDERED_FLAG$2 = 2;
  2357. var boolTag$1 = "[object Boolean]";
  2358. var dateTag$1 = "[object Date]";
  2359. var errorTag = "[object Error]";
  2360. var mapTag$4 = "[object Map]";
  2361. var numberTag$1 = "[object Number]";
  2362. var regexpTag$1 = "[object RegExp]";
  2363. var setTag$4 = "[object Set]";
  2364. var stringTag$1 = "[object String]";
  2365. var symbolTag = "[object Symbol]";
  2366. var arrayBufferTag$1 = "[object ArrayBuffer]";
  2367. var dataViewTag = "[object DataView]";
  2368. var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0;
  2369. var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  2370. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  2371. switch (tag) {
  2372. case dataViewTag:
  2373. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
  2374. return false;
  2375. }
  2376. object = object.buffer;
  2377. other = other.buffer;
  2378. case arrayBufferTag$1:
  2379. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  2380. return false;
  2381. }
  2382. return true;
  2383. case boolTag$1:
  2384. case dateTag$1:
  2385. case numberTag$1:
  2386. return eq(+object, +other);
  2387. case errorTag:
  2388. return object.name == other.name && object.message == other.message;
  2389. case regexpTag$1:
  2390. case stringTag$1:
  2391. return object == other + "";
  2392. case mapTag$4:
  2393. var convert = mapToArray;
  2394. case setTag$4:
  2395. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
  2396. convert || (convert = setToArray);
  2397. if (object.size != other.size && !isPartial) {
  2398. return false;
  2399. }
  2400. var stacked = stack.get(object);
  2401. if (stacked) {
  2402. return stacked == other;
  2403. }
  2404. bitmask |= COMPARE_UNORDERED_FLAG$2;
  2405. stack.set(object, other);
  2406. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  2407. stack["delete"](object);
  2408. return result;
  2409. case symbolTag:
  2410. if (symbolValueOf) {
  2411. return symbolValueOf.call(object) == symbolValueOf.call(other);
  2412. }
  2413. }
  2414. return false;
  2415. }
  2416. var COMPARE_PARTIAL_FLAG$3 = 1;
  2417. var objectProto$b = Object.prototype;
  2418. var hasOwnProperty$b = objectProto$b.hasOwnProperty;
  2419. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  2420. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  2421. if (objLength != othLength && !isPartial) {
  2422. return false;
  2423. }
  2424. var index = objLength;
  2425. while (index--) {
  2426. var key = objProps[index];
  2427. if (!(isPartial ? key in other : hasOwnProperty$b.call(other, key))) {
  2428. return false;
  2429. }
  2430. }
  2431. var objStacked = stack.get(object);
  2432. var othStacked = stack.get(other);
  2433. if (objStacked && othStacked) {
  2434. return objStacked == other && othStacked == object;
  2435. }
  2436. var result = true;
  2437. stack.set(object, other);
  2438. stack.set(other, object);
  2439. var skipCtor = isPartial;
  2440. while (++index < objLength) {
  2441. key = objProps[index];
  2442. var objValue = object[key], othValue = other[key];
  2443. if (customizer) {
  2444. var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  2445. }
  2446. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  2447. result = false;
  2448. break;
  2449. }
  2450. skipCtor || (skipCtor = key == "constructor");
  2451. }
  2452. if (result && !skipCtor) {
  2453. var objCtor = object.constructor, othCtor = other.constructor;
  2454. if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  2455. result = false;
  2456. }
  2457. }
  2458. stack["delete"](object);
  2459. stack["delete"](other);
  2460. return result;
  2461. }
  2462. var COMPARE_PARTIAL_FLAG$2 = 1;
  2463. var argsTag = "[object Arguments]";
  2464. var arrayTag = "[object Array]";
  2465. var objectTag = "[object Object]";
  2466. var objectProto$a = Object.prototype;
  2467. var hasOwnProperty$a = objectProto$a.hasOwnProperty;
  2468. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  2469. var objIsArr = isArray$1(object), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
  2470. objTag = objTag == argsTag ? objectTag : objTag;
  2471. othTag = othTag == argsTag ? objectTag : othTag;
  2472. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  2473. if (isSameTag && isBuffer(object)) {
  2474. if (!isBuffer(other)) {
  2475. return false;
  2476. }
  2477. objIsArr = true;
  2478. objIsObj = false;
  2479. }
  2480. if (isSameTag && !objIsObj) {
  2481. stack || (stack = new Stack());
  2482. return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  2483. }
  2484. if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
  2485. var objIsWrapped = objIsObj && hasOwnProperty$a.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$a.call(other, "__wrapped__");
  2486. if (objIsWrapped || othIsWrapped) {
  2487. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  2488. stack || (stack = new Stack());
  2489. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  2490. }
  2491. }
  2492. if (!isSameTag) {
  2493. return false;
  2494. }
  2495. stack || (stack = new Stack());
  2496. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  2497. }
  2498. function baseIsEqual(value, other, bitmask, customizer, stack) {
  2499. if (value === other) {
  2500. return true;
  2501. }
  2502. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  2503. return value !== value && other !== other;
  2504. }
  2505. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  2506. }
  2507. var COMPARE_PARTIAL_FLAG$1 = 1;
  2508. var COMPARE_UNORDERED_FLAG$1 = 2;
  2509. function baseIsMatch(object, source, matchData, customizer) {
  2510. var index = matchData.length, length = index, noCustomizer = !customizer;
  2511. if (object == null) {
  2512. return !length;
  2513. }
  2514. object = Object(object);
  2515. while (index--) {
  2516. var data = matchData[index];
  2517. if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) {
  2518. return false;
  2519. }
  2520. }
  2521. while (++index < length) {
  2522. data = matchData[index];
  2523. var key = data[0], objValue = object[key], srcValue = data[1];
  2524. if (noCustomizer && data[2]) {
  2525. if (objValue === void 0 && !(key in object)) {
  2526. return false;
  2527. }
  2528. } else {
  2529. var stack = new Stack();
  2530. if (customizer) {
  2531. var result = customizer(objValue, srcValue, key, object, source, stack);
  2532. }
  2533. if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) {
  2534. return false;
  2535. }
  2536. }
  2537. }
  2538. return true;
  2539. }
  2540. function isStrictComparable(value) {
  2541. return value === value && !isObject$2(value);
  2542. }
  2543. function getMatchData(object) {
  2544. var result = keys(object), length = result.length;
  2545. while (length--) {
  2546. var key = result[length], value = object[key];
  2547. result[length] = [key, value, isStrictComparable(value)];
  2548. }
  2549. return result;
  2550. }
  2551. function matchesStrictComparable(key, srcValue) {
  2552. return function(object) {
  2553. if (object == null) {
  2554. return false;
  2555. }
  2556. return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
  2557. };
  2558. }
  2559. function baseMatches(source) {
  2560. var matchData = getMatchData(source);
  2561. if (matchData.length == 1 && matchData[0][2]) {
  2562. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  2563. }
  2564. return function(object) {
  2565. return object === source || baseIsMatch(object, source, matchData);
  2566. };
  2567. }
  2568. function baseHasIn(object, key) {
  2569. return object != null && key in Object(object);
  2570. }
  2571. function hasPath(object, path, hasFunc) {
  2572. path = castPath(path, object);
  2573. var index = -1, length = path.length, result = false;
  2574. while (++index < length) {
  2575. var key = toKey(path[index]);
  2576. if (!(result = object != null && hasFunc(object, key))) {
  2577. break;
  2578. }
  2579. object = object[key];
  2580. }
  2581. if (result || ++index != length) {
  2582. return result;
  2583. }
  2584. length = object == null ? 0 : object.length;
  2585. return !!length && isLength(length) && isIndex(key, length) && (isArray$1(object) || isArguments(object));
  2586. }
  2587. function hasIn(object, path) {
  2588. return object != null && hasPath(object, path, baseHasIn);
  2589. }
  2590. var COMPARE_PARTIAL_FLAG = 1;
  2591. var COMPARE_UNORDERED_FLAG = 2;
  2592. function baseMatchesProperty(path, srcValue) {
  2593. if (isKey(path) && isStrictComparable(srcValue)) {
  2594. return matchesStrictComparable(toKey(path), srcValue);
  2595. }
  2596. return function(object) {
  2597. var objValue = get(object, path);
  2598. return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  2599. };
  2600. }
  2601. function baseProperty(key) {
  2602. return function(object) {
  2603. return object == null ? void 0 : object[key];
  2604. };
  2605. }
  2606. function basePropertyDeep(path) {
  2607. return function(object) {
  2608. return baseGet(object, path);
  2609. };
  2610. }
  2611. function property(path) {
  2612. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  2613. }
  2614. function baseIteratee(value) {
  2615. if (typeof value == "function") {
  2616. return value;
  2617. }
  2618. if (value == null) {
  2619. return identity$1;
  2620. }
  2621. if (typeof value == "object") {
  2622. return isArray$1(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
  2623. }
  2624. return property(value);
  2625. }
  2626. var FUNC_ERROR_TEXT$7 = "Expected a function";
  2627. function cond(pairs) {
  2628. var length = pairs == null ? 0 : pairs.length, toIteratee = baseIteratee;
  2629. pairs = !length ? [] : arrayMap(pairs, function(pair) {
  2630. if (typeof pair[1] != "function") {
  2631. throw new TypeError(FUNC_ERROR_TEXT$7);
  2632. }
  2633. return [toIteratee(pair[0]), pair[1]];
  2634. });
  2635. return baseRest(function(args) {
  2636. var index = -1;
  2637. while (++index < length) {
  2638. var pair = pairs[index];
  2639. if (apply(pair[0], this, args)) {
  2640. return apply(pair[1], this, args);
  2641. }
  2642. }
  2643. });
  2644. }
  2645. function baseConformsTo(object, source, props) {
  2646. var length = props.length;
  2647. if (object == null) {
  2648. return !length;
  2649. }
  2650. object = Object(object);
  2651. while (length--) {
  2652. var key = props[length], predicate = source[key], value = object[key];
  2653. if (value === void 0 && !(key in object) || !predicate(value)) {
  2654. return false;
  2655. }
  2656. }
  2657. return true;
  2658. }
  2659. function baseConforms(source) {
  2660. var props = keys(source);
  2661. return function(object) {
  2662. return baseConformsTo(object, source, props);
  2663. };
  2664. }
  2665. var CLONE_DEEP_FLAG$4 = 1;
  2666. function conforms(source) {
  2667. return baseConforms(baseClone(source, CLONE_DEEP_FLAG$4));
  2668. }
  2669. function conformsTo(object, source) {
  2670. return source == null || baseConformsTo(object, source, keys(source));
  2671. }
  2672. function arrayAggregator(array, setter, iteratee, accumulator) {
  2673. var index = -1, length = array == null ? 0 : array.length;
  2674. while (++index < length) {
  2675. var value = array[index];
  2676. setter(accumulator, value, iteratee(value), array);
  2677. }
  2678. return accumulator;
  2679. }
  2680. function createBaseFor(fromRight) {
  2681. return function(object, iteratee, keysFunc) {
  2682. var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
  2683. while (length--) {
  2684. var key = props[fromRight ? length : ++index];
  2685. if (iteratee(iterable[key], key, iterable) === false) {
  2686. break;
  2687. }
  2688. }
  2689. return object;
  2690. };
  2691. }
  2692. var baseFor = createBaseFor();
  2693. function baseForOwn(object, iteratee) {
  2694. return object && baseFor(object, iteratee, keys);
  2695. }
  2696. function createBaseEach(eachFunc, fromRight) {
  2697. return function(collection, iteratee) {
  2698. if (collection == null) {
  2699. return collection;
  2700. }
  2701. if (!isArrayLike(collection)) {
  2702. return eachFunc(collection, iteratee);
  2703. }
  2704. var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
  2705. while (fromRight ? index-- : ++index < length) {
  2706. if (iteratee(iterable[index], index, iterable) === false) {
  2707. break;
  2708. }
  2709. }
  2710. return collection;
  2711. };
  2712. }
  2713. var baseEach = createBaseEach(baseForOwn);
  2714. function baseAggregator(collection, setter, iteratee, accumulator) {
  2715. baseEach(collection, function(value, key, collection2) {
  2716. setter(accumulator, value, iteratee(value), collection2);
  2717. });
  2718. return accumulator;
  2719. }
  2720. function createAggregator(setter, initializer) {
  2721. return function(collection, iteratee) {
  2722. var func = isArray$1(collection) ? arrayAggregator : baseAggregator, accumulator = initializer ? initializer() : {};
  2723. return func(collection, setter, baseIteratee(iteratee), accumulator);
  2724. };
  2725. }
  2726. var objectProto$9 = Object.prototype;
  2727. var hasOwnProperty$9 = objectProto$9.hasOwnProperty;
  2728. var countBy = createAggregator(function(result, value, key) {
  2729. if (hasOwnProperty$9.call(result, key)) {
  2730. ++result[key];
  2731. } else {
  2732. baseAssignValue(result, key, 1);
  2733. }
  2734. });
  2735. function create(prototype, properties) {
  2736. var result = baseCreate(prototype);
  2737. return properties == null ? result : baseAssign(result, properties);
  2738. }
  2739. var WRAP_CURRY_FLAG$1 = 8;
  2740. function curry(func, arity, guard) {
  2741. arity = guard ? void 0 : arity;
  2742. var result = createWrap(func, WRAP_CURRY_FLAG$1, void 0, void 0, void 0, void 0, void 0, arity);
  2743. result.placeholder = curry.placeholder;
  2744. return result;
  2745. }
  2746. curry.placeholder = {};
  2747. var WRAP_CURRY_RIGHT_FLAG = 16;
  2748. function curryRight(func, arity, guard) {
  2749. arity = guard ? void 0 : arity;
  2750. var result = createWrap(func, WRAP_CURRY_RIGHT_FLAG, void 0, void 0, void 0, void 0, void 0, arity);
  2751. result.placeholder = curryRight.placeholder;
  2752. return result;
  2753. }
  2754. curryRight.placeholder = {};
  2755. var now = function() {
  2756. return root.Date.now();
  2757. };
  2758. var FUNC_ERROR_TEXT$6 = "Expected a function";
  2759. var nativeMax$b = Math.max;
  2760. var nativeMin$b = Math.min;
  2761. function debounce(func, wait, options) {
  2762. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  2763. if (typeof func != "function") {
  2764. throw new TypeError(FUNC_ERROR_TEXT$6);
  2765. }
  2766. wait = toNumber(wait) || 0;
  2767. if (isObject$2(options)) {
  2768. leading = !!options.leading;
  2769. maxing = "maxWait" in options;
  2770. maxWait = maxing ? nativeMax$b(toNumber(options.maxWait) || 0, wait) : maxWait;
  2771. trailing = "trailing" in options ? !!options.trailing : trailing;
  2772. }
  2773. function invokeFunc(time) {
  2774. var args = lastArgs, thisArg = lastThis;
  2775. lastArgs = lastThis = void 0;
  2776. lastInvokeTime = time;
  2777. result = func.apply(thisArg, args);
  2778. return result;
  2779. }
  2780. function leadingEdge(time) {
  2781. lastInvokeTime = time;
  2782. timerId = setTimeout(timerExpired, wait);
  2783. return leading ? invokeFunc(time) : result;
  2784. }
  2785. function remainingWait(time) {
  2786. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  2787. return maxing ? nativeMin$b(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  2788. }
  2789. function shouldInvoke(time) {
  2790. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  2791. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  2792. }
  2793. function timerExpired() {
  2794. var time = now();
  2795. if (shouldInvoke(time)) {
  2796. return trailingEdge(time);
  2797. }
  2798. timerId = setTimeout(timerExpired, remainingWait(time));
  2799. }
  2800. function trailingEdge(time) {
  2801. timerId = void 0;
  2802. if (trailing && lastArgs) {
  2803. return invokeFunc(time);
  2804. }
  2805. lastArgs = lastThis = void 0;
  2806. return result;
  2807. }
  2808. function cancel() {
  2809. if (timerId !== void 0) {
  2810. clearTimeout(timerId);
  2811. }
  2812. lastInvokeTime = 0;
  2813. lastArgs = lastCallTime = lastThis = timerId = void 0;
  2814. }
  2815. function flush() {
  2816. return timerId === void 0 ? result : trailingEdge(now());
  2817. }
  2818. function debounced() {
  2819. var time = now(), isInvoking = shouldInvoke(time);
  2820. lastArgs = arguments;
  2821. lastThis = this;
  2822. lastCallTime = time;
  2823. if (isInvoking) {
  2824. if (timerId === void 0) {
  2825. return leadingEdge(lastCallTime);
  2826. }
  2827. if (maxing) {
  2828. clearTimeout(timerId);
  2829. timerId = setTimeout(timerExpired, wait);
  2830. return invokeFunc(lastCallTime);
  2831. }
  2832. }
  2833. if (timerId === void 0) {
  2834. timerId = setTimeout(timerExpired, wait);
  2835. }
  2836. return result;
  2837. }
  2838. debounced.cancel = cancel;
  2839. debounced.flush = flush;
  2840. return debounced;
  2841. }
  2842. function defaultTo(value, defaultValue) {
  2843. return value == null || value !== value ? defaultValue : value;
  2844. }
  2845. var objectProto$8 = Object.prototype;
  2846. var hasOwnProperty$8 = objectProto$8.hasOwnProperty;
  2847. var defaults = baseRest(function(object, sources) {
  2848. object = Object(object);
  2849. var index = -1;
  2850. var length = sources.length;
  2851. var guard = length > 2 ? sources[2] : void 0;
  2852. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  2853. length = 1;
  2854. }
  2855. while (++index < length) {
  2856. var source = sources[index];
  2857. var props = keysIn(source);
  2858. var propsIndex = -1;
  2859. var propsLength = props.length;
  2860. while (++propsIndex < propsLength) {
  2861. var key = props[propsIndex];
  2862. var value = object[key];
  2863. if (value === void 0 || eq(value, objectProto$8[key]) && !hasOwnProperty$8.call(object, key)) {
  2864. object[key] = source[key];
  2865. }
  2866. }
  2867. }
  2868. return object;
  2869. });
  2870. function assignMergeValue(object, key, value) {
  2871. if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) {
  2872. baseAssignValue(object, key, value);
  2873. }
  2874. }
  2875. function isArrayLikeObject(value) {
  2876. return isObjectLike(value) && isArrayLike(value);
  2877. }
  2878. function safeGet(object, key) {
  2879. if (key === "constructor" && typeof object[key] === "function") {
  2880. return;
  2881. }
  2882. if (key == "__proto__") {
  2883. return;
  2884. }
  2885. return object[key];
  2886. }
  2887. function toPlainObject(value) {
  2888. return copyObject(value, keysIn(value));
  2889. }
  2890. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  2891. var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
  2892. if (stacked) {
  2893. assignMergeValue(object, key, stacked);
  2894. return;
  2895. }
  2896. var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
  2897. var isCommon = newValue === void 0;
  2898. if (isCommon) {
  2899. var isArr = isArray$1(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  2900. newValue = srcValue;
  2901. if (isArr || isBuff || isTyped) {
  2902. if (isArray$1(objValue)) {
  2903. newValue = objValue;
  2904. } else if (isArrayLikeObject(objValue)) {
  2905. newValue = copyArray(objValue);
  2906. } else if (isBuff) {
  2907. isCommon = false;
  2908. newValue = cloneBuffer(srcValue, true);
  2909. } else if (isTyped) {
  2910. isCommon = false;
  2911. newValue = cloneTypedArray(srcValue, true);
  2912. } else {
  2913. newValue = [];
  2914. }
  2915. } else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  2916. newValue = objValue;
  2917. if (isArguments(objValue)) {
  2918. newValue = toPlainObject(objValue);
  2919. } else if (!isObject$2(objValue) || isFunction$1(objValue)) {
  2920. newValue = initCloneObject(srcValue);
  2921. }
  2922. } else {
  2923. isCommon = false;
  2924. }
  2925. }
  2926. if (isCommon) {
  2927. stack.set(srcValue, newValue);
  2928. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  2929. stack["delete"](srcValue);
  2930. }
  2931. assignMergeValue(object, key, newValue);
  2932. }
  2933. function baseMerge(object, source, srcIndex, customizer, stack) {
  2934. if (object === source) {
  2935. return;
  2936. }
  2937. baseFor(source, function(srcValue, key) {
  2938. stack || (stack = new Stack());
  2939. if (isObject$2(srcValue)) {
  2940. baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  2941. } else {
  2942. var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
  2943. if (newValue === void 0) {
  2944. newValue = srcValue;
  2945. }
  2946. assignMergeValue(object, key, newValue);
  2947. }
  2948. }, keysIn);
  2949. }
  2950. function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
  2951. if (isObject$2(objValue) && isObject$2(srcValue)) {
  2952. stack.set(srcValue, objValue);
  2953. baseMerge(objValue, srcValue, void 0, customDefaultsMerge, stack);
  2954. stack["delete"](srcValue);
  2955. }
  2956. return objValue;
  2957. }
  2958. var mergeWith = createAssigner(function(object, source, srcIndex, customizer) {
  2959. baseMerge(object, source, srcIndex, customizer);
  2960. });
  2961. var defaultsDeep = baseRest(function(args) {
  2962. args.push(void 0, customDefaultsMerge);
  2963. return apply(mergeWith, void 0, args);
  2964. });
  2965. var FUNC_ERROR_TEXT$5 = "Expected a function";
  2966. function baseDelay(func, wait, args) {
  2967. if (typeof func != "function") {
  2968. throw new TypeError(FUNC_ERROR_TEXT$5);
  2969. }
  2970. return setTimeout(function() {
  2971. func.apply(void 0, args);
  2972. }, wait);
  2973. }
  2974. var defer = baseRest(function(func, args) {
  2975. return baseDelay(func, 1, args);
  2976. });
  2977. var delay = baseRest(function(func, wait, args) {
  2978. return baseDelay(func, toNumber(wait) || 0, args);
  2979. });
  2980. function arrayIncludesWith(array, value, comparator) {
  2981. var index = -1, length = array == null ? 0 : array.length;
  2982. while (++index < length) {
  2983. if (comparator(value, array[index])) {
  2984. return true;
  2985. }
  2986. }
  2987. return false;
  2988. }
  2989. var LARGE_ARRAY_SIZE$1 = 200;
  2990. function baseDifference(array, values, iteratee, comparator) {
  2991. var index = -1, includes = arrayIncludes, isCommon = true, length = array.length, result = [], valuesLength = values.length;
  2992. if (!length) {
  2993. return result;
  2994. }
  2995. if (iteratee) {
  2996. values = arrayMap(values, baseUnary(iteratee));
  2997. }
  2998. if (comparator) {
  2999. includes = arrayIncludesWith;
  3000. isCommon = false;
  3001. } else if (values.length >= LARGE_ARRAY_SIZE$1) {
  3002. includes = cacheHas;
  3003. isCommon = false;
  3004. values = new SetCache(values);
  3005. }
  3006. outer:
  3007. while (++index < length) {
  3008. var value = array[index], computed = iteratee == null ? value : iteratee(value);
  3009. value = comparator || value !== 0 ? value : 0;
  3010. if (isCommon && computed === computed) {
  3011. var valuesIndex = valuesLength;
  3012. while (valuesIndex--) {
  3013. if (values[valuesIndex] === computed) {
  3014. continue outer;
  3015. }
  3016. }
  3017. result.push(value);
  3018. } else if (!includes(values, computed, comparator)) {
  3019. result.push(value);
  3020. }
  3021. }
  3022. return result;
  3023. }
  3024. var difference = baseRest(function(array, values) {
  3025. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true)) : [];
  3026. });
  3027. function last(array) {
  3028. var length = array == null ? 0 : array.length;
  3029. return length ? array[length - 1] : void 0;
  3030. }
  3031. var differenceBy = baseRest(function(array, values) {
  3032. var iteratee = last(values);
  3033. if (isArrayLikeObject(iteratee)) {
  3034. iteratee = void 0;
  3035. }
  3036. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), baseIteratee(iteratee)) : [];
  3037. });
  3038. var differenceWith = baseRest(function(array, values) {
  3039. var comparator = last(values);
  3040. if (isArrayLikeObject(comparator)) {
  3041. comparator = void 0;
  3042. }
  3043. return isArrayLikeObject(array) ? baseDifference(array, baseFlatten(values, 1, isArrayLikeObject, true), void 0, comparator) : [];
  3044. });
  3045. var divide = createMathOperation(function(dividend, divisor) {
  3046. return dividend / divisor;
  3047. }, 1);
  3048. function drop(array, n, guard) {
  3049. var length = array == null ? 0 : array.length;
  3050. if (!length) {
  3051. return [];
  3052. }
  3053. n = guard || n === void 0 ? 1 : toInteger(n);
  3054. return baseSlice(array, n < 0 ? 0 : n, length);
  3055. }
  3056. function dropRight(array, n, guard) {
  3057. var length = array == null ? 0 : array.length;
  3058. if (!length) {
  3059. return [];
  3060. }
  3061. n = guard || n === void 0 ? 1 : toInteger(n);
  3062. n = length - n;
  3063. return baseSlice(array, 0, n < 0 ? 0 : n);
  3064. }
  3065. function baseWhile(array, predicate, isDrop, fromRight) {
  3066. var length = array.length, index = fromRight ? length : -1;
  3067. while ((fromRight ? index-- : ++index < length) && predicate(array[index], index, array)) {
  3068. }
  3069. return isDrop ? baseSlice(array, fromRight ? 0 : index, fromRight ? index + 1 : length) : baseSlice(array, fromRight ? index + 1 : 0, fromRight ? length : index);
  3070. }
  3071. function dropRightWhile(array, predicate) {
  3072. return array && array.length ? baseWhile(array, baseIteratee(predicate), true, true) : [];
  3073. }
  3074. function dropWhile(array, predicate) {
  3075. return array && array.length ? baseWhile(array, baseIteratee(predicate), true) : [];
  3076. }
  3077. function castFunction(value) {
  3078. return typeof value == "function" ? value : identity$1;
  3079. }
  3080. function forEach(collection, iteratee) {
  3081. var func = isArray$1(collection) ? arrayEach : baseEach;
  3082. return func(collection, castFunction(iteratee));
  3083. }
  3084. function arrayEachRight(array, iteratee) {
  3085. var length = array == null ? 0 : array.length;
  3086. while (length--) {
  3087. if (iteratee(array[length], length, array) === false) {
  3088. break;
  3089. }
  3090. }
  3091. return array;
  3092. }
  3093. var baseForRight = createBaseFor(true);
  3094. function baseForOwnRight(object, iteratee) {
  3095. return object && baseForRight(object, iteratee, keys);
  3096. }
  3097. var baseEachRight = createBaseEach(baseForOwnRight, true);
  3098. function forEachRight(collection, iteratee) {
  3099. var func = isArray$1(collection) ? arrayEachRight : baseEachRight;
  3100. return func(collection, castFunction(iteratee));
  3101. }
  3102. function endsWith(string, target, position) {
  3103. string = toString(string);
  3104. target = baseToString(target);
  3105. var length = string.length;
  3106. position = position === void 0 ? length : baseClamp(toInteger(position), 0, length);
  3107. var end = position;
  3108. position -= target.length;
  3109. return position >= 0 && string.slice(position, end) == target;
  3110. }
  3111. function baseToPairs(object, props) {
  3112. return arrayMap(props, function(key) {
  3113. return [key, object[key]];
  3114. });
  3115. }
  3116. function setToPairs(set) {
  3117. var index = -1, result = Array(set.size);
  3118. set.forEach(function(value) {
  3119. result[++index] = [value, value];
  3120. });
  3121. return result;
  3122. }
  3123. var mapTag$3 = "[object Map]";
  3124. var setTag$3 = "[object Set]";
  3125. function createToPairs(keysFunc) {
  3126. return function(object) {
  3127. var tag = getTag$1(object);
  3128. if (tag == mapTag$3) {
  3129. return mapToArray(object);
  3130. }
  3131. if (tag == setTag$3) {
  3132. return setToPairs(object);
  3133. }
  3134. return baseToPairs(object, keysFunc(object));
  3135. };
  3136. }
  3137. var toPairs = createToPairs(keys);
  3138. var toPairsIn = createToPairs(keysIn);
  3139. var htmlEscapes = {
  3140. "&": "&amp;",
  3141. "<": "&lt;",
  3142. ">": "&gt;",
  3143. '"': "&quot;",
  3144. "'": "&#39;"
  3145. };
  3146. var escapeHtmlChar = basePropertyOf(htmlEscapes);
  3147. var reUnescapedHtml = /[&<>"']/g;
  3148. var reHasUnescapedHtml = RegExp(reUnescapedHtml.source);
  3149. function escape(string) {
  3150. string = toString(string);
  3151. return string && reHasUnescapedHtml.test(string) ? string.replace(reUnescapedHtml, escapeHtmlChar) : string;
  3152. }
  3153. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  3154. var reHasRegExpChar = RegExp(reRegExpChar.source);
  3155. function escapeRegExp(string) {
  3156. string = toString(string);
  3157. return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, "\\$&") : string;
  3158. }
  3159. function arrayEvery(array, predicate) {
  3160. var index = -1, length = array == null ? 0 : array.length;
  3161. while (++index < length) {
  3162. if (!predicate(array[index], index, array)) {
  3163. return false;
  3164. }
  3165. }
  3166. return true;
  3167. }
  3168. function baseEvery(collection, predicate) {
  3169. var result = true;
  3170. baseEach(collection, function(value, index, collection2) {
  3171. result = !!predicate(value, index, collection2);
  3172. return result;
  3173. });
  3174. return result;
  3175. }
  3176. function every(collection, predicate, guard) {
  3177. var func = isArray$1(collection) ? arrayEvery : baseEvery;
  3178. if (guard && isIterateeCall(collection, predicate, guard)) {
  3179. predicate = void 0;
  3180. }
  3181. return func(collection, baseIteratee(predicate));
  3182. }
  3183. var MAX_ARRAY_LENGTH$5 = 4294967295;
  3184. function toLength(value) {
  3185. return value ? baseClamp(toInteger(value), 0, MAX_ARRAY_LENGTH$5) : 0;
  3186. }
  3187. function baseFill(array, value, start, end) {
  3188. var length = array.length;
  3189. start = toInteger(start);
  3190. if (start < 0) {
  3191. start = -start > length ? 0 : length + start;
  3192. }
  3193. end = end === void 0 || end > length ? length : toInteger(end);
  3194. if (end < 0) {
  3195. end += length;
  3196. }
  3197. end = start > end ? 0 : toLength(end);
  3198. while (start < end) {
  3199. array[start++] = value;
  3200. }
  3201. return array;
  3202. }
  3203. function fill(array, value, start, end) {
  3204. var length = array == null ? 0 : array.length;
  3205. if (!length) {
  3206. return [];
  3207. }
  3208. if (start && typeof start != "number" && isIterateeCall(array, value, start)) {
  3209. start = 0;
  3210. end = length;
  3211. }
  3212. return baseFill(array, value, start, end);
  3213. }
  3214. function baseFilter(collection, predicate) {
  3215. var result = [];
  3216. baseEach(collection, function(value, index, collection2) {
  3217. if (predicate(value, index, collection2)) {
  3218. result.push(value);
  3219. }
  3220. });
  3221. return result;
  3222. }
  3223. function filter(collection, predicate) {
  3224. var func = isArray$1(collection) ? arrayFilter : baseFilter;
  3225. return func(collection, baseIteratee(predicate));
  3226. }
  3227. function createFind(findIndexFunc) {
  3228. return function(collection, predicate, fromIndex) {
  3229. var iterable = Object(collection);
  3230. if (!isArrayLike(collection)) {
  3231. var iteratee = baseIteratee(predicate);
  3232. collection = keys(collection);
  3233. predicate = function(key) {
  3234. return iteratee(iterable[key], key, iterable);
  3235. };
  3236. }
  3237. var index = findIndexFunc(collection, predicate, fromIndex);
  3238. return index > -1 ? iterable[iteratee ? collection[index] : index] : void 0;
  3239. };
  3240. }
  3241. var nativeMax$a = Math.max;
  3242. function findIndex(array, predicate, fromIndex) {
  3243. var length = array == null ? 0 : array.length;
  3244. if (!length) {
  3245. return -1;
  3246. }
  3247. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  3248. if (index < 0) {
  3249. index = nativeMax$a(length + index, 0);
  3250. }
  3251. return baseFindIndex(array, baseIteratee(predicate), index);
  3252. }
  3253. var find = createFind(findIndex);
  3254. function baseFindKey(collection, predicate, eachFunc) {
  3255. var result;
  3256. eachFunc(collection, function(value, key, collection2) {
  3257. if (predicate(value, key, collection2)) {
  3258. result = key;
  3259. return false;
  3260. }
  3261. });
  3262. return result;
  3263. }
  3264. function findKey(object, predicate) {
  3265. return baseFindKey(object, baseIteratee(predicate), baseForOwn);
  3266. }
  3267. var nativeMax$9 = Math.max;
  3268. var nativeMin$a = Math.min;
  3269. function findLastIndex(array, predicate, fromIndex) {
  3270. var length = array == null ? 0 : array.length;
  3271. if (!length) {
  3272. return -1;
  3273. }
  3274. var index = length - 1;
  3275. if (fromIndex !== void 0) {
  3276. index = toInteger(fromIndex);
  3277. index = fromIndex < 0 ? nativeMax$9(length + index, 0) : nativeMin$a(index, length - 1);
  3278. }
  3279. return baseFindIndex(array, baseIteratee(predicate), index, true);
  3280. }
  3281. var findLast = createFind(findLastIndex);
  3282. function findLastKey(object, predicate) {
  3283. return baseFindKey(object, baseIteratee(predicate), baseForOwnRight);
  3284. }
  3285. function head(array) {
  3286. return array && array.length ? array[0] : void 0;
  3287. }
  3288. function baseMap(collection, iteratee) {
  3289. var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  3290. baseEach(collection, function(value, key, collection2) {
  3291. result[++index] = iteratee(value, key, collection2);
  3292. });
  3293. return result;
  3294. }
  3295. function map(collection, iteratee) {
  3296. var func = isArray$1(collection) ? arrayMap : baseMap;
  3297. return func(collection, baseIteratee(iteratee));
  3298. }
  3299. function flatMap(collection, iteratee) {
  3300. return baseFlatten(map(collection, iteratee), 1);
  3301. }
  3302. var INFINITY$2 = 1 / 0;
  3303. function flatMapDeep(collection, iteratee) {
  3304. return baseFlatten(map(collection, iteratee), INFINITY$2);
  3305. }
  3306. function flatMapDepth(collection, iteratee, depth) {
  3307. depth = depth === void 0 ? 1 : toInteger(depth);
  3308. return baseFlatten(map(collection, iteratee), depth);
  3309. }
  3310. var INFINITY$1 = 1 / 0;
  3311. function flattenDeep(array) {
  3312. var length = array == null ? 0 : array.length;
  3313. return length ? baseFlatten(array, INFINITY$1) : [];
  3314. }
  3315. function flattenDepth(array, depth) {
  3316. var length = array == null ? 0 : array.length;
  3317. if (!length) {
  3318. return [];
  3319. }
  3320. depth = depth === void 0 ? 1 : toInteger(depth);
  3321. return baseFlatten(array, depth);
  3322. }
  3323. var WRAP_FLIP_FLAG = 512;
  3324. function flip(func) {
  3325. return createWrap(func, WRAP_FLIP_FLAG);
  3326. }
  3327. var floor$1 = createRound("floor");
  3328. var FUNC_ERROR_TEXT$4 = "Expected a function";
  3329. var WRAP_CURRY_FLAG = 8;
  3330. var WRAP_PARTIAL_FLAG$1 = 32;
  3331. var WRAP_ARY_FLAG = 128;
  3332. var WRAP_REARG_FLAG$1 = 256;
  3333. function createFlow(fromRight) {
  3334. return flatRest(function(funcs) {
  3335. var length = funcs.length, index = length, prereq = LodashWrapper.prototype.thru;
  3336. if (fromRight) {
  3337. funcs.reverse();
  3338. }
  3339. while (index--) {
  3340. var func = funcs[index];
  3341. if (typeof func != "function") {
  3342. throw new TypeError(FUNC_ERROR_TEXT$4);
  3343. }
  3344. if (prereq && !wrapper && getFuncName(func) == "wrapper") {
  3345. var wrapper = new LodashWrapper([], true);
  3346. }
  3347. }
  3348. index = wrapper ? index : length;
  3349. while (++index < length) {
  3350. func = funcs[index];
  3351. var funcName = getFuncName(func), data = funcName == "wrapper" ? getData(func) : void 0;
  3352. 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) {
  3353. wrapper = wrapper[getFuncName(data[0])].apply(wrapper, data[3]);
  3354. } else {
  3355. wrapper = func.length == 1 && isLaziable(func) ? wrapper[funcName]() : wrapper.thru(func);
  3356. }
  3357. }
  3358. return function() {
  3359. var args = arguments, value = args[0];
  3360. if (wrapper && args.length == 1 && isArray$1(value)) {
  3361. return wrapper.plant(value).value();
  3362. }
  3363. var index2 = 0, result = length ? funcs[index2].apply(this, args) : value;
  3364. while (++index2 < length) {
  3365. result = funcs[index2].call(this, result);
  3366. }
  3367. return result;
  3368. };
  3369. });
  3370. }
  3371. var flow = createFlow();
  3372. var flowRight = createFlow(true);
  3373. function forIn(object, iteratee) {
  3374. return object == null ? object : baseFor(object, castFunction(iteratee), keysIn);
  3375. }
  3376. function forInRight(object, iteratee) {
  3377. return object == null ? object : baseForRight(object, castFunction(iteratee), keysIn);
  3378. }
  3379. function forOwn(object, iteratee) {
  3380. return object && baseForOwn(object, castFunction(iteratee));
  3381. }
  3382. function forOwnRight(object, iteratee) {
  3383. return object && baseForOwnRight(object, castFunction(iteratee));
  3384. }
  3385. function fromPairs(pairs) {
  3386. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  3387. while (++index < length) {
  3388. var pair = pairs[index];
  3389. result[pair[0]] = pair[1];
  3390. }
  3391. return result;
  3392. }
  3393. function baseFunctions(object, props) {
  3394. return arrayFilter(props, function(key) {
  3395. return isFunction$1(object[key]);
  3396. });
  3397. }
  3398. function functions(object) {
  3399. return object == null ? [] : baseFunctions(object, keys(object));
  3400. }
  3401. function functionsIn(object) {
  3402. return object == null ? [] : baseFunctions(object, keysIn(object));
  3403. }
  3404. var objectProto$7 = Object.prototype;
  3405. var hasOwnProperty$7 = objectProto$7.hasOwnProperty;
  3406. var groupBy = createAggregator(function(result, value, key) {
  3407. if (hasOwnProperty$7.call(result, key)) {
  3408. result[key].push(value);
  3409. } else {
  3410. baseAssignValue(result, key, [value]);
  3411. }
  3412. });
  3413. function baseGt(value, other) {
  3414. return value > other;
  3415. }
  3416. function createRelationalOperation(operator) {
  3417. return function(value, other) {
  3418. if (!(typeof value == "string" && typeof other == "string")) {
  3419. value = toNumber(value);
  3420. other = toNumber(other);
  3421. }
  3422. return operator(value, other);
  3423. };
  3424. }
  3425. var gt$1 = createRelationalOperation(baseGt);
  3426. var gte = createRelationalOperation(function(value, other) {
  3427. return value >= other;
  3428. });
  3429. var objectProto$6 = Object.prototype;
  3430. var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
  3431. function baseHas(object, key) {
  3432. return object != null && hasOwnProperty$6.call(object, key);
  3433. }
  3434. function has(object, path) {
  3435. return object != null && hasPath(object, path, baseHas);
  3436. }
  3437. var nativeMax$8 = Math.max;
  3438. var nativeMin$9 = Math.min;
  3439. function baseInRange(number, start, end) {
  3440. return number >= nativeMin$9(start, end) && number < nativeMax$8(start, end);
  3441. }
  3442. function inRange(number, start, end) {
  3443. start = toFinite(start);
  3444. if (end === void 0) {
  3445. end = start;
  3446. start = 0;
  3447. } else {
  3448. end = toFinite(end);
  3449. }
  3450. number = toNumber(number);
  3451. return baseInRange(number, start, end);
  3452. }
  3453. var stringTag = "[object String]";
  3454. function isString$2(value) {
  3455. return typeof value == "string" || !isArray$1(value) && isObjectLike(value) && baseGetTag(value) == stringTag;
  3456. }
  3457. function baseValues(object, props) {
  3458. return arrayMap(props, function(key) {
  3459. return object[key];
  3460. });
  3461. }
  3462. function values(object) {
  3463. return object == null ? [] : baseValues(object, keys(object));
  3464. }
  3465. var nativeMax$7 = Math.max;
  3466. function includes(collection, value, fromIndex, guard) {
  3467. collection = isArrayLike(collection) ? collection : values(collection);
  3468. fromIndex = fromIndex && !guard ? toInteger(fromIndex) : 0;
  3469. var length = collection.length;
  3470. if (fromIndex < 0) {
  3471. fromIndex = nativeMax$7(length + fromIndex, 0);
  3472. }
  3473. return isString$2(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
  3474. }
  3475. var nativeMax$6 = Math.max;
  3476. function indexOf(array, value, fromIndex) {
  3477. var length = array == null ? 0 : array.length;
  3478. if (!length) {
  3479. return -1;
  3480. }
  3481. var index = fromIndex == null ? 0 : toInteger(fromIndex);
  3482. if (index < 0) {
  3483. index = nativeMax$6(length + index, 0);
  3484. }
  3485. return baseIndexOf(array, value, index);
  3486. }
  3487. function initial(array) {
  3488. var length = array == null ? 0 : array.length;
  3489. return length ? baseSlice(array, 0, -1) : [];
  3490. }
  3491. var nativeMin$8 = Math.min;
  3492. function baseIntersection(arrays, iteratee, comparator) {
  3493. var includes = comparator ? arrayIncludesWith : arrayIncludes, length = arrays[0].length, othLength = arrays.length, othIndex = othLength, caches = Array(othLength), maxLength = Infinity, result = [];
  3494. while (othIndex--) {
  3495. var array = arrays[othIndex];
  3496. if (othIndex && iteratee) {
  3497. array = arrayMap(array, baseUnary(iteratee));
  3498. }
  3499. maxLength = nativeMin$8(array.length, maxLength);
  3500. caches[othIndex] = !comparator && (iteratee || length >= 120 && array.length >= 120) ? new SetCache(othIndex && array) : void 0;
  3501. }
  3502. array = arrays[0];
  3503. var index = -1, seen = caches[0];
  3504. outer:
  3505. while (++index < length && result.length < maxLength) {
  3506. var value = array[index], computed = iteratee ? iteratee(value) : value;
  3507. value = comparator || value !== 0 ? value : 0;
  3508. if (!(seen ? cacheHas(seen, computed) : includes(result, computed, comparator))) {
  3509. othIndex = othLength;
  3510. while (--othIndex) {
  3511. var cache = caches[othIndex];
  3512. if (!(cache ? cacheHas(cache, computed) : includes(arrays[othIndex], computed, comparator))) {
  3513. continue outer;
  3514. }
  3515. }
  3516. if (seen) {
  3517. seen.push(computed);
  3518. }
  3519. result.push(value);
  3520. }
  3521. }
  3522. return result;
  3523. }
  3524. function castArrayLikeObject(value) {
  3525. return isArrayLikeObject(value) ? value : [];
  3526. }
  3527. var intersection = baseRest(function(arrays) {
  3528. var mapped = arrayMap(arrays, castArrayLikeObject);
  3529. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
  3530. });
  3531. var intersectionBy = baseRest(function(arrays) {
  3532. var iteratee = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  3533. if (iteratee === last(mapped)) {
  3534. iteratee = void 0;
  3535. } else {
  3536. mapped.pop();
  3537. }
  3538. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, baseIteratee(iteratee)) : [];
  3539. });
  3540. var intersectionWith = baseRest(function(arrays) {
  3541. var comparator = last(arrays), mapped = arrayMap(arrays, castArrayLikeObject);
  3542. comparator = typeof comparator == "function" ? comparator : void 0;
  3543. if (comparator) {
  3544. mapped.pop();
  3545. }
  3546. return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped, void 0, comparator) : [];
  3547. });
  3548. function baseInverter(object, setter, iteratee, accumulator) {
  3549. baseForOwn(object, function(value, key, object2) {
  3550. setter(accumulator, iteratee(value), key, object2);
  3551. });
  3552. return accumulator;
  3553. }
  3554. function createInverter(setter, toIteratee) {
  3555. return function(object, iteratee) {
  3556. return baseInverter(object, setter, toIteratee(iteratee), {});
  3557. };
  3558. }
  3559. var objectProto$5 = Object.prototype;
  3560. var nativeObjectToString$1 = objectProto$5.toString;
  3561. var invert = createInverter(function(result, value, key) {
  3562. if (value != null && typeof value.toString != "function") {
  3563. value = nativeObjectToString$1.call(value);
  3564. }
  3565. result[value] = key;
  3566. }, constant(identity$1));
  3567. var objectProto$4 = Object.prototype;
  3568. var hasOwnProperty$5 = objectProto$4.hasOwnProperty;
  3569. var nativeObjectToString = objectProto$4.toString;
  3570. var invertBy = createInverter(function(result, value, key) {
  3571. if (value != null && typeof value.toString != "function") {
  3572. value = nativeObjectToString.call(value);
  3573. }
  3574. if (hasOwnProperty$5.call(result, value)) {
  3575. result[value].push(key);
  3576. } else {
  3577. result[value] = [key];
  3578. }
  3579. }, baseIteratee);
  3580. function parent(object, path) {
  3581. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  3582. }
  3583. function baseInvoke(object, path, args) {
  3584. path = castPath(path, object);
  3585. object = parent(object, path);
  3586. var func = object == null ? object : object[toKey(last(path))];
  3587. return func == null ? void 0 : apply(func, object, args);
  3588. }
  3589. var invoke = baseRest(baseInvoke);
  3590. var invokeMap = baseRest(function(collection, path, args) {
  3591. var index = -1, isFunc = typeof path == "function", result = isArrayLike(collection) ? Array(collection.length) : [];
  3592. baseEach(collection, function(value) {
  3593. result[++index] = isFunc ? apply(path, value, args) : baseInvoke(value, path, args);
  3594. });
  3595. return result;
  3596. });
  3597. var arrayBufferTag = "[object ArrayBuffer]";
  3598. function baseIsArrayBuffer(value) {
  3599. return isObjectLike(value) && baseGetTag(value) == arrayBufferTag;
  3600. }
  3601. var nodeIsArrayBuffer = nodeUtil && nodeUtil.isArrayBuffer;
  3602. var isArrayBuffer = nodeIsArrayBuffer ? baseUnary(nodeIsArrayBuffer) : baseIsArrayBuffer;
  3603. var boolTag = "[object Boolean]";
  3604. function isBoolean$1(value) {
  3605. return value === true || value === false || isObjectLike(value) && baseGetTag(value) == boolTag;
  3606. }
  3607. var dateTag = "[object Date]";
  3608. function baseIsDate(value) {
  3609. return isObjectLike(value) && baseGetTag(value) == dateTag;
  3610. }
  3611. var nodeIsDate = nodeUtil && nodeUtil.isDate;
  3612. var isDate$1 = nodeIsDate ? baseUnary(nodeIsDate) : baseIsDate;
  3613. function isElement$2(value) {
  3614. return isObjectLike(value) && value.nodeType === 1 && !isPlainObject(value);
  3615. }
  3616. var mapTag$2 = "[object Map]";
  3617. var setTag$2 = "[object Set]";
  3618. var objectProto$3 = Object.prototype;
  3619. var hasOwnProperty$4 = objectProto$3.hasOwnProperty;
  3620. function isEmpty$1(value) {
  3621. if (value == null) {
  3622. return true;
  3623. }
  3624. if (isArrayLike(value) && (isArray$1(value) || typeof value == "string" || typeof value.splice == "function" || isBuffer(value) || isTypedArray(value) || isArguments(value))) {
  3625. return !value.length;
  3626. }
  3627. var tag = getTag$1(value);
  3628. if (tag == mapTag$2 || tag == setTag$2) {
  3629. return !value.size;
  3630. }
  3631. if (isPrototype(value)) {
  3632. return !baseKeys(value).length;
  3633. }
  3634. for (var key in value) {
  3635. if (hasOwnProperty$4.call(value, key)) {
  3636. return false;
  3637. }
  3638. }
  3639. return true;
  3640. }
  3641. function isEqual$1(value, other) {
  3642. return baseIsEqual(value, other);
  3643. }
  3644. function isEqualWith(value, other, customizer) {
  3645. customizer = typeof customizer == "function" ? customizer : void 0;
  3646. var result = customizer ? customizer(value, other) : void 0;
  3647. return result === void 0 ? baseIsEqual(value, other, void 0, customizer) : !!result;
  3648. }
  3649. var nativeIsFinite = root.isFinite;
  3650. function isFinite(value) {
  3651. return typeof value == "number" && nativeIsFinite(value);
  3652. }
  3653. function isInteger(value) {
  3654. return typeof value == "number" && value == toInteger(value);
  3655. }
  3656. function isMatch(object, source) {
  3657. return object === source || baseIsMatch(object, source, getMatchData(source));
  3658. }
  3659. function isMatchWith(object, source, customizer) {
  3660. customizer = typeof customizer == "function" ? customizer : void 0;
  3661. return baseIsMatch(object, source, getMatchData(source), customizer);
  3662. }
  3663. var numberTag = "[object Number]";
  3664. function isNumber$1(value) {
  3665. return typeof value == "number" || isObjectLike(value) && baseGetTag(value) == numberTag;
  3666. }
  3667. function isNaN$1(value) {
  3668. return isNumber$1(value) && value != +value;
  3669. }
  3670. var isMaskable = coreJsData ? isFunction$1 : stubFalse;
  3671. var CORE_ERROR_TEXT = "Unsupported core-js use. Try https://npms.io/search?q=ponyfill.";
  3672. function isNative(value) {
  3673. if (isMaskable(value)) {
  3674. throw new Error(CORE_ERROR_TEXT);
  3675. }
  3676. return baseIsNative(value);
  3677. }
  3678. function isNil(value) {
  3679. return value == null;
  3680. }
  3681. function isNull(value) {
  3682. return value === null;
  3683. }
  3684. var regexpTag = "[object RegExp]";
  3685. function baseIsRegExp(value) {
  3686. return isObjectLike(value) && baseGetTag(value) == regexpTag;
  3687. }
  3688. var nodeIsRegExp = nodeUtil && nodeUtil.isRegExp;
  3689. var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
  3690. var MAX_SAFE_INTEGER$3 = 9007199254740991;
  3691. function isSafeInteger(value) {
  3692. return isInteger(value) && value >= -MAX_SAFE_INTEGER$3 && value <= MAX_SAFE_INTEGER$3;
  3693. }
  3694. function isUndefined$1(value) {
  3695. return value === void 0;
  3696. }
  3697. var weakMapTag = "[object WeakMap]";
  3698. function isWeakMap(value) {
  3699. return isObjectLike(value) && getTag$1(value) == weakMapTag;
  3700. }
  3701. var weakSetTag = "[object WeakSet]";
  3702. function isWeakSet(value) {
  3703. return isObjectLike(value) && baseGetTag(value) == weakSetTag;
  3704. }
  3705. var CLONE_DEEP_FLAG$3 = 1;
  3706. function iteratee(func) {
  3707. return baseIteratee(typeof func == "function" ? func : baseClone(func, CLONE_DEEP_FLAG$3));
  3708. }
  3709. var arrayProto$4 = Array.prototype;
  3710. var nativeJoin = arrayProto$4.join;
  3711. function join(array, separator) {
  3712. return array == null ? "" : nativeJoin.call(array, separator);
  3713. }
  3714. var kebabCase = createCompounder(function(result, word, index) {
  3715. return result + (index ? "-" : "") + word.toLowerCase();
  3716. });
  3717. var keyBy = createAggregator(function(result, value, key) {
  3718. baseAssignValue(result, key, value);
  3719. });
  3720. function strictLastIndexOf(array, value, fromIndex) {
  3721. var index = fromIndex + 1;
  3722. while (index--) {
  3723. if (array[index] === value) {
  3724. return index;
  3725. }
  3726. }
  3727. return index;
  3728. }
  3729. var nativeMax$5 = Math.max;
  3730. var nativeMin$7 = Math.min;
  3731. function lastIndexOf(array, value, fromIndex) {
  3732. var length = array == null ? 0 : array.length;
  3733. if (!length) {
  3734. return -1;
  3735. }
  3736. var index = length;
  3737. if (fromIndex !== void 0) {
  3738. index = toInteger(fromIndex);
  3739. index = index < 0 ? nativeMax$5(length + index, 0) : nativeMin$7(index, length - 1);
  3740. }
  3741. return value === value ? strictLastIndexOf(array, value, index) : baseFindIndex(array, baseIsNaN, index, true);
  3742. }
  3743. var lowerCase = createCompounder(function(result, word, index) {
  3744. return result + (index ? " " : "") + word.toLowerCase();
  3745. });
  3746. var lowerFirst = createCaseFirst("toLowerCase");
  3747. function baseLt(value, other) {
  3748. return value < other;
  3749. }
  3750. var lt$1 = createRelationalOperation(baseLt);
  3751. var lte = createRelationalOperation(function(value, other) {
  3752. return value <= other;
  3753. });
  3754. function mapKeys(object, iteratee) {
  3755. var result = {};
  3756. iteratee = baseIteratee(iteratee);
  3757. baseForOwn(object, function(value, key, object2) {
  3758. baseAssignValue(result, iteratee(value, key, object2), value);
  3759. });
  3760. return result;
  3761. }
  3762. function mapValues(object, iteratee) {
  3763. var result = {};
  3764. iteratee = baseIteratee(iteratee);
  3765. baseForOwn(object, function(value, key, object2) {
  3766. baseAssignValue(result, key, iteratee(value, key, object2));
  3767. });
  3768. return result;
  3769. }
  3770. var CLONE_DEEP_FLAG$2 = 1;
  3771. function matches(source) {
  3772. return baseMatches(baseClone(source, CLONE_DEEP_FLAG$2));
  3773. }
  3774. var CLONE_DEEP_FLAG$1 = 1;
  3775. function matchesProperty(path, srcValue) {
  3776. return baseMatchesProperty(path, baseClone(srcValue, CLONE_DEEP_FLAG$1));
  3777. }
  3778. function baseExtremum(array, iteratee, comparator) {
  3779. var index = -1, length = array.length;
  3780. while (++index < length) {
  3781. var value = array[index], current = iteratee(value);
  3782. if (current != null && (computed === void 0 ? current === current && !isSymbol(current) : comparator(current, computed))) {
  3783. var computed = current, result = value;
  3784. }
  3785. }
  3786. return result;
  3787. }
  3788. function max$3(array) {
  3789. return array && array.length ? baseExtremum(array, identity$1, baseGt) : void 0;
  3790. }
  3791. function maxBy(array, iteratee) {
  3792. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseGt) : void 0;
  3793. }
  3794. function baseSum(array, iteratee) {
  3795. var result, index = -1, length = array.length;
  3796. while (++index < length) {
  3797. var current = iteratee(array[index]);
  3798. if (current !== void 0) {
  3799. result = result === void 0 ? current : result + current;
  3800. }
  3801. }
  3802. return result;
  3803. }
  3804. var NAN = 0 / 0;
  3805. function baseMean(array, iteratee) {
  3806. var length = array == null ? 0 : array.length;
  3807. return length ? baseSum(array, iteratee) / length : NAN;
  3808. }
  3809. function mean(array) {
  3810. return baseMean(array, identity$1);
  3811. }
  3812. function meanBy(array, iteratee) {
  3813. return baseMean(array, baseIteratee(iteratee));
  3814. }
  3815. var merge = createAssigner(function(object, source, srcIndex) {
  3816. baseMerge(object, source, srcIndex);
  3817. });
  3818. var method = baseRest(function(path, args) {
  3819. return function(object) {
  3820. return baseInvoke(object, path, args);
  3821. };
  3822. });
  3823. var methodOf = baseRest(function(object, args) {
  3824. return function(path) {
  3825. return baseInvoke(object, path, args);
  3826. };
  3827. });
  3828. function min$3(array) {
  3829. return array && array.length ? baseExtremum(array, identity$1, baseLt) : void 0;
  3830. }
  3831. function minBy(array, iteratee) {
  3832. return array && array.length ? baseExtremum(array, baseIteratee(iteratee), baseLt) : void 0;
  3833. }
  3834. function mixin$1(object, source, options) {
  3835. var props = keys(source), methodNames = baseFunctions(source, props);
  3836. var chain = !(isObject$2(options) && "chain" in options) || !!options.chain, isFunc = isFunction$1(object);
  3837. arrayEach(methodNames, function(methodName) {
  3838. var func = source[methodName];
  3839. object[methodName] = func;
  3840. if (isFunc) {
  3841. object.prototype[methodName] = function() {
  3842. var chainAll = this.__chain__;
  3843. if (chain || chainAll) {
  3844. var result = object(this.__wrapped__), actions = result.__actions__ = copyArray(this.__actions__);
  3845. actions.push({ "func": func, "args": arguments, "thisArg": object });
  3846. result.__chain__ = chainAll;
  3847. return result;
  3848. }
  3849. return func.apply(object, arrayPush([this.value()], arguments));
  3850. };
  3851. }
  3852. });
  3853. return object;
  3854. }
  3855. var multiply = createMathOperation(function(multiplier, multiplicand) {
  3856. return multiplier * multiplicand;
  3857. }, 1);
  3858. var FUNC_ERROR_TEXT$3 = "Expected a function";
  3859. function negate(predicate) {
  3860. if (typeof predicate != "function") {
  3861. throw new TypeError(FUNC_ERROR_TEXT$3);
  3862. }
  3863. return function() {
  3864. var args = arguments;
  3865. switch (args.length) {
  3866. case 0:
  3867. return !predicate.call(this);
  3868. case 1:
  3869. return !predicate.call(this, args[0]);
  3870. case 2:
  3871. return !predicate.call(this, args[0], args[1]);
  3872. case 3:
  3873. return !predicate.call(this, args[0], args[1], args[2]);
  3874. }
  3875. return !predicate.apply(this, args);
  3876. };
  3877. }
  3878. function iteratorToArray(iterator) {
  3879. var data, result = [];
  3880. while (!(data = iterator.next()).done) {
  3881. result.push(data.value);
  3882. }
  3883. return result;
  3884. }
  3885. var mapTag$1 = "[object Map]";
  3886. var setTag$1 = "[object Set]";
  3887. var symIterator$1 = Symbol$1 ? Symbol$1.iterator : void 0;
  3888. function toArray(value) {
  3889. if (!value) {
  3890. return [];
  3891. }
  3892. if (isArrayLike(value)) {
  3893. return isString$2(value) ? stringToArray(value) : copyArray(value);
  3894. }
  3895. if (symIterator$1 && value[symIterator$1]) {
  3896. return iteratorToArray(value[symIterator$1]());
  3897. }
  3898. var tag = getTag$1(value), func = tag == mapTag$1 ? mapToArray : tag == setTag$1 ? setToArray : values;
  3899. return func(value);
  3900. }
  3901. function wrapperNext() {
  3902. if (this.__values__ === void 0) {
  3903. this.__values__ = toArray(this.value());
  3904. }
  3905. var done = this.__index__ >= this.__values__.length, value = done ? void 0 : this.__values__[this.__index__++];
  3906. return { "done": done, "value": value };
  3907. }
  3908. function baseNth(array, n) {
  3909. var length = array.length;
  3910. if (!length) {
  3911. return;
  3912. }
  3913. n += n < 0 ? length : 0;
  3914. return isIndex(n, length) ? array[n] : void 0;
  3915. }
  3916. function nth(array, n) {
  3917. return array && array.length ? baseNth(array, toInteger(n)) : void 0;
  3918. }
  3919. function nthArg(n) {
  3920. n = toInteger(n);
  3921. return baseRest(function(args) {
  3922. return baseNth(args, n);
  3923. });
  3924. }
  3925. function baseUnset(object, path) {
  3926. path = castPath(path, object);
  3927. object = parent(object, path);
  3928. return object == null || delete object[toKey(last(path))];
  3929. }
  3930. function customOmitClone(value) {
  3931. return isPlainObject(value) ? void 0 : value;
  3932. }
  3933. var CLONE_DEEP_FLAG = 1;
  3934. var CLONE_FLAT_FLAG = 2;
  3935. var CLONE_SYMBOLS_FLAG = 4;
  3936. var omit = flatRest(function(object, paths) {
  3937. var result = {};
  3938. if (object == null) {
  3939. return result;
  3940. }
  3941. var isDeep = false;
  3942. paths = arrayMap(paths, function(path) {
  3943. path = castPath(path, object);
  3944. isDeep || (isDeep = path.length > 1);
  3945. return path;
  3946. });
  3947. copyObject(object, getAllKeysIn(object), result);
  3948. if (isDeep) {
  3949. result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  3950. }
  3951. var length = paths.length;
  3952. while (length--) {
  3953. baseUnset(result, paths[length]);
  3954. }
  3955. return result;
  3956. });
  3957. function baseSet(object, path, value, customizer) {
  3958. if (!isObject$2(object)) {
  3959. return object;
  3960. }
  3961. path = castPath(path, object);
  3962. var index = -1, length = path.length, lastIndex = length - 1, nested = object;
  3963. while (nested != null && ++index < length) {
  3964. var key = toKey(path[index]), newValue = value;
  3965. if (key === "__proto__" || key === "constructor" || key === "prototype") {
  3966. return object;
  3967. }
  3968. if (index != lastIndex) {
  3969. var objValue = nested[key];
  3970. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  3971. if (newValue === void 0) {
  3972. newValue = isObject$2(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  3973. }
  3974. }
  3975. assignValue(nested, key, newValue);
  3976. nested = nested[key];
  3977. }
  3978. return object;
  3979. }
  3980. function basePickBy(object, paths, predicate) {
  3981. var index = -1, length = paths.length, result = {};
  3982. while (++index < length) {
  3983. var path = paths[index], value = baseGet(object, path);
  3984. if (predicate(value, path)) {
  3985. baseSet(result, castPath(path, object), value);
  3986. }
  3987. }
  3988. return result;
  3989. }
  3990. function pickBy(object, predicate) {
  3991. if (object == null) {
  3992. return {};
  3993. }
  3994. var props = arrayMap(getAllKeysIn(object), function(prop) {
  3995. return [prop];
  3996. });
  3997. predicate = baseIteratee(predicate);
  3998. return basePickBy(object, props, function(value, path) {
  3999. return predicate(value, path[0]);
  4000. });
  4001. }
  4002. function omitBy(object, predicate) {
  4003. return pickBy(object, negate(baseIteratee(predicate)));
  4004. }
  4005. function once(func) {
  4006. return before(2, func);
  4007. }
  4008. function baseSortBy(array, comparer) {
  4009. var length = array.length;
  4010. array.sort(comparer);
  4011. while (length--) {
  4012. array[length] = array[length].value;
  4013. }
  4014. return array;
  4015. }
  4016. function compareAscending(value, other) {
  4017. if (value !== other) {
  4018. var valIsDefined = value !== void 0, valIsNull = value === null, valIsReflexive = value === value, valIsSymbol = isSymbol(value);
  4019. var othIsDefined = other !== void 0, othIsNull = other === null, othIsReflexive = other === other, othIsSymbol = isSymbol(other);
  4020. if (!othIsNull && !othIsSymbol && !valIsSymbol && value > other || valIsSymbol && othIsDefined && othIsReflexive && !othIsNull && !othIsSymbol || valIsNull && othIsDefined && othIsReflexive || !valIsDefined && othIsReflexive || !valIsReflexive) {
  4021. return 1;
  4022. }
  4023. if (!valIsNull && !valIsSymbol && !othIsSymbol && value < other || othIsSymbol && valIsDefined && valIsReflexive && !valIsNull && !valIsSymbol || othIsNull && valIsDefined && valIsReflexive || !othIsDefined && valIsReflexive || !othIsReflexive) {
  4024. return -1;
  4025. }
  4026. }
  4027. return 0;
  4028. }
  4029. function compareMultiple(object, other, orders) {
  4030. var index = -1, objCriteria = object.criteria, othCriteria = other.criteria, length = objCriteria.length, ordersLength = orders.length;
  4031. while (++index < length) {
  4032. var result = compareAscending(objCriteria[index], othCriteria[index]);
  4033. if (result) {
  4034. if (index >= ordersLength) {
  4035. return result;
  4036. }
  4037. var order = orders[index];
  4038. return result * (order == "desc" ? -1 : 1);
  4039. }
  4040. }
  4041. return object.index - other.index;
  4042. }
  4043. function baseOrderBy(collection, iteratees, orders) {
  4044. if (iteratees.length) {
  4045. iteratees = arrayMap(iteratees, function(iteratee) {
  4046. if (isArray$1(iteratee)) {
  4047. return function(value) {
  4048. return baseGet(value, iteratee.length === 1 ? iteratee[0] : iteratee);
  4049. };
  4050. }
  4051. return iteratee;
  4052. });
  4053. } else {
  4054. iteratees = [identity$1];
  4055. }
  4056. var index = -1;
  4057. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  4058. var result = baseMap(collection, function(value, key, collection2) {
  4059. var criteria = arrayMap(iteratees, function(iteratee) {
  4060. return iteratee(value);
  4061. });
  4062. return { "criteria": criteria, "index": ++index, "value": value };
  4063. });
  4064. return baseSortBy(result, function(object, other) {
  4065. return compareMultiple(object, other, orders);
  4066. });
  4067. }
  4068. function orderBy$1(collection, iteratees, orders, guard) {
  4069. if (collection == null) {
  4070. return [];
  4071. }
  4072. if (!isArray$1(iteratees)) {
  4073. iteratees = iteratees == null ? [] : [iteratees];
  4074. }
  4075. orders = guard ? void 0 : orders;
  4076. if (!isArray$1(orders)) {
  4077. orders = orders == null ? [] : [orders];
  4078. }
  4079. return baseOrderBy(collection, iteratees, orders);
  4080. }
  4081. function createOver(arrayFunc) {
  4082. return flatRest(function(iteratees) {
  4083. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  4084. return baseRest(function(args) {
  4085. var thisArg = this;
  4086. return arrayFunc(iteratees, function(iteratee) {
  4087. return apply(iteratee, thisArg, args);
  4088. });
  4089. });
  4090. });
  4091. }
  4092. var over = createOver(arrayMap);
  4093. var castRest = baseRest;
  4094. var nativeMin$6 = Math.min;
  4095. var overArgs = castRest(function(func, transforms) {
  4096. transforms = transforms.length == 1 && isArray$1(transforms[0]) ? arrayMap(transforms[0], baseUnary(baseIteratee)) : arrayMap(baseFlatten(transforms, 1), baseUnary(baseIteratee));
  4097. var funcsLength = transforms.length;
  4098. return baseRest(function(args) {
  4099. var index = -1, length = nativeMin$6(args.length, funcsLength);
  4100. while (++index < length) {
  4101. args[index] = transforms[index].call(this, args[index]);
  4102. }
  4103. return apply(func, this, args);
  4104. });
  4105. });
  4106. var overEvery = createOver(arrayEvery);
  4107. var overSome = createOver(arraySome);
  4108. var MAX_SAFE_INTEGER$2 = 9007199254740991;
  4109. var nativeFloor$3 = Math.floor;
  4110. function baseRepeat(string, n) {
  4111. var result = "";
  4112. if (!string || n < 1 || n > MAX_SAFE_INTEGER$2) {
  4113. return result;
  4114. }
  4115. do {
  4116. if (n % 2) {
  4117. result += string;
  4118. }
  4119. n = nativeFloor$3(n / 2);
  4120. if (n) {
  4121. string += string;
  4122. }
  4123. } while (n);
  4124. return result;
  4125. }
  4126. var asciiSize = baseProperty("length");
  4127. var rsAstralRange = "\\ud800-\\udfff";
  4128. var rsComboMarksRange = "\\u0300-\\u036f";
  4129. var reComboHalfMarksRange = "\\ufe20-\\ufe2f";
  4130. var rsComboSymbolsRange = "\\u20d0-\\u20ff";
  4131. var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
  4132. var rsVarRange = "\\ufe0e\\ufe0f";
  4133. var rsAstral = "[" + rsAstralRange + "]";
  4134. var rsCombo = "[" + rsComboRange + "]";
  4135. var rsFitz = "\\ud83c[\\udffb-\\udfff]";
  4136. var rsModifier = "(?:" + rsCombo + "|" + rsFitz + ")";
  4137. var rsNonAstral = "[^" + rsAstralRange + "]";
  4138. var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
  4139. var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
  4140. var rsZWJ = "\\u200d";
  4141. var reOptMod = rsModifier + "?";
  4142. var rsOptVar = "[" + rsVarRange + "]?";
  4143. var rsOptJoin = "(?:" + rsZWJ + "(?:" + [rsNonAstral, rsRegional, rsSurrPair].join("|") + ")" + rsOptVar + reOptMod + ")*";
  4144. var rsSeq = rsOptVar + reOptMod + rsOptJoin;
  4145. var rsSymbol = "(?:" + [rsNonAstral + rsCombo + "?", rsCombo, rsRegional, rsSurrPair, rsAstral].join("|") + ")";
  4146. var reUnicode = RegExp(rsFitz + "(?=" + rsFitz + ")|" + rsSymbol + rsSeq, "g");
  4147. function unicodeSize(string) {
  4148. var result = reUnicode.lastIndex = 0;
  4149. while (reUnicode.test(string)) {
  4150. ++result;
  4151. }
  4152. return result;
  4153. }
  4154. function stringSize(string) {
  4155. return hasUnicode(string) ? unicodeSize(string) : asciiSize(string);
  4156. }
  4157. var nativeCeil$2 = Math.ceil;
  4158. function createPadding(length, chars) {
  4159. chars = chars === void 0 ? " " : baseToString(chars);
  4160. var charsLength = chars.length;
  4161. if (charsLength < 2) {
  4162. return charsLength ? baseRepeat(chars, length) : chars;
  4163. }
  4164. var result = baseRepeat(chars, nativeCeil$2(length / stringSize(chars)));
  4165. return hasUnicode(chars) ? castSlice(stringToArray(result), 0, length).join("") : result.slice(0, length);
  4166. }
  4167. var nativeCeil$1 = Math.ceil;
  4168. var nativeFloor$2 = Math.floor;
  4169. function pad(string, length, chars) {
  4170. string = toString(string);
  4171. length = toInteger(length);
  4172. var strLength = length ? stringSize(string) : 0;
  4173. if (!length || strLength >= length) {
  4174. return string;
  4175. }
  4176. var mid = (length - strLength) / 2;
  4177. return createPadding(nativeFloor$2(mid), chars) + string + createPadding(nativeCeil$1(mid), chars);
  4178. }
  4179. function padEnd(string, length, chars) {
  4180. string = toString(string);
  4181. length = toInteger(length);
  4182. var strLength = length ? stringSize(string) : 0;
  4183. return length && strLength < length ? string + createPadding(length - strLength, chars) : string;
  4184. }
  4185. function padStart(string, length, chars) {
  4186. string = toString(string);
  4187. length = toInteger(length);
  4188. var strLength = length ? stringSize(string) : 0;
  4189. return length && strLength < length ? createPadding(length - strLength, chars) + string : string;
  4190. }
  4191. var reTrimStart$1 = /^\s+/;
  4192. var nativeParseInt = root.parseInt;
  4193. function parseInt$1(string, radix, guard) {
  4194. if (guard || radix == null) {
  4195. radix = 0;
  4196. } else if (radix) {
  4197. radix = +radix;
  4198. }
  4199. return nativeParseInt(toString(string).replace(reTrimStart$1, ""), radix || 0);
  4200. }
  4201. var WRAP_PARTIAL_FLAG = 32;
  4202. var partial = baseRest(function(func, partials) {
  4203. var holders = replaceHolders(partials, getHolder(partial));
  4204. return createWrap(func, WRAP_PARTIAL_FLAG, void 0, partials, holders);
  4205. });
  4206. partial.placeholder = {};
  4207. var WRAP_PARTIAL_RIGHT_FLAG = 64;
  4208. var partialRight = baseRest(function(func, partials) {
  4209. var holders = replaceHolders(partials, getHolder(partialRight));
  4210. return createWrap(func, WRAP_PARTIAL_RIGHT_FLAG, void 0, partials, holders);
  4211. });
  4212. partialRight.placeholder = {};
  4213. var partition = createAggregator(function(result, value, key) {
  4214. result[key ? 0 : 1].push(value);
  4215. }, function() {
  4216. return [[], []];
  4217. });
  4218. function basePick(object, paths) {
  4219. return basePickBy(object, paths, function(value, path) {
  4220. return hasIn(object, path);
  4221. });
  4222. }
  4223. var pick = flatRest(function(object, paths) {
  4224. return object == null ? {} : basePick(object, paths);
  4225. });
  4226. function wrapperPlant(value) {
  4227. var result, parent = this;
  4228. while (parent instanceof baseLodash) {
  4229. var clone = wrapperClone(parent);
  4230. clone.__index__ = 0;
  4231. clone.__values__ = void 0;
  4232. if (result) {
  4233. previous.__wrapped__ = clone;
  4234. } else {
  4235. result = clone;
  4236. }
  4237. var previous = clone;
  4238. parent = parent.__wrapped__;
  4239. }
  4240. previous.__wrapped__ = value;
  4241. return result;
  4242. }
  4243. function propertyOf(object) {
  4244. return function(path) {
  4245. return object == null ? void 0 : baseGet(object, path);
  4246. };
  4247. }
  4248. function baseIndexOfWith(array, value, fromIndex, comparator) {
  4249. var index = fromIndex - 1, length = array.length;
  4250. while (++index < length) {
  4251. if (comparator(array[index], value)) {
  4252. return index;
  4253. }
  4254. }
  4255. return -1;
  4256. }
  4257. var arrayProto$3 = Array.prototype;
  4258. var splice$1 = arrayProto$3.splice;
  4259. function basePullAll(array, values, iteratee, comparator) {
  4260. var indexOf = comparator ? baseIndexOfWith : baseIndexOf, index = -1, length = values.length, seen = array;
  4261. if (array === values) {
  4262. values = copyArray(values);
  4263. }
  4264. if (iteratee) {
  4265. seen = arrayMap(array, baseUnary(iteratee));
  4266. }
  4267. while (++index < length) {
  4268. var fromIndex = 0, value = values[index], computed = iteratee ? iteratee(value) : value;
  4269. while ((fromIndex = indexOf(seen, computed, fromIndex, comparator)) > -1) {
  4270. if (seen !== array) {
  4271. splice$1.call(seen, fromIndex, 1);
  4272. }
  4273. splice$1.call(array, fromIndex, 1);
  4274. }
  4275. }
  4276. return array;
  4277. }
  4278. function pullAll(array, values) {
  4279. return array && array.length && values && values.length ? basePullAll(array, values) : array;
  4280. }
  4281. var pull = baseRest(pullAll);
  4282. function pullAllBy(array, values, iteratee) {
  4283. return array && array.length && values && values.length ? basePullAll(array, values, baseIteratee(iteratee)) : array;
  4284. }
  4285. function pullAllWith(array, values, comparator) {
  4286. return array && array.length && values && values.length ? basePullAll(array, values, void 0, comparator) : array;
  4287. }
  4288. var arrayProto$2 = Array.prototype;
  4289. var splice = arrayProto$2.splice;
  4290. function basePullAt(array, indexes) {
  4291. var length = array ? indexes.length : 0, lastIndex = length - 1;
  4292. while (length--) {
  4293. var index = indexes[length];
  4294. if (length == lastIndex || index !== previous) {
  4295. var previous = index;
  4296. if (isIndex(index)) {
  4297. splice.call(array, index, 1);
  4298. } else {
  4299. baseUnset(array, index);
  4300. }
  4301. }
  4302. }
  4303. return array;
  4304. }
  4305. var pullAt = flatRest(function(array, indexes) {
  4306. var length = array == null ? 0 : array.length, result = baseAt(array, indexes);
  4307. basePullAt(array, arrayMap(indexes, function(index) {
  4308. return isIndex(index, length) ? +index : index;
  4309. }).sort(compareAscending));
  4310. return result;
  4311. });
  4312. var nativeFloor$1 = Math.floor;
  4313. var nativeRandom$1 = Math.random;
  4314. function baseRandom(lower, upper) {
  4315. return lower + nativeFloor$1(nativeRandom$1() * (upper - lower + 1));
  4316. }
  4317. var freeParseFloat = parseFloat;
  4318. var nativeMin$5 = Math.min;
  4319. var nativeRandom = Math.random;
  4320. function random(lower, upper, floating) {
  4321. if (floating && typeof floating != "boolean" && isIterateeCall(lower, upper, floating)) {
  4322. upper = floating = void 0;
  4323. }
  4324. if (floating === void 0) {
  4325. if (typeof upper == "boolean") {
  4326. floating = upper;
  4327. upper = void 0;
  4328. } else if (typeof lower == "boolean") {
  4329. floating = lower;
  4330. lower = void 0;
  4331. }
  4332. }
  4333. if (lower === void 0 && upper === void 0) {
  4334. lower = 0;
  4335. upper = 1;
  4336. } else {
  4337. lower = toFinite(lower);
  4338. if (upper === void 0) {
  4339. upper = lower;
  4340. lower = 0;
  4341. } else {
  4342. upper = toFinite(upper);
  4343. }
  4344. }
  4345. if (lower > upper) {
  4346. var temp = lower;
  4347. lower = upper;
  4348. upper = temp;
  4349. }
  4350. if (floating || lower % 1 || upper % 1) {
  4351. var rand = nativeRandom();
  4352. return nativeMin$5(lower + rand * (upper - lower + freeParseFloat("1e-" + ((rand + "").length - 1))), upper);
  4353. }
  4354. return baseRandom(lower, upper);
  4355. }
  4356. var nativeCeil = Math.ceil;
  4357. var nativeMax$4 = Math.max;
  4358. function baseRange(start, end, step, fromRight) {
  4359. var index = -1, length = nativeMax$4(nativeCeil((end - start) / (step || 1)), 0), result = Array(length);
  4360. while (length--) {
  4361. result[fromRight ? length : ++index] = start;
  4362. start += step;
  4363. }
  4364. return result;
  4365. }
  4366. function createRange(fromRight) {
  4367. return function(start, end, step) {
  4368. if (step && typeof step != "number" && isIterateeCall(start, end, step)) {
  4369. end = step = void 0;
  4370. }
  4371. start = toFinite(start);
  4372. if (end === void 0) {
  4373. end = start;
  4374. start = 0;
  4375. } else {
  4376. end = toFinite(end);
  4377. }
  4378. step = step === void 0 ? start < end ? 1 : -1 : toFinite(step);
  4379. return baseRange(start, end, step, fromRight);
  4380. };
  4381. }
  4382. var range$1 = createRange();
  4383. var rangeRight = createRange(true);
  4384. var WRAP_REARG_FLAG = 256;
  4385. var rearg = flatRest(function(func, indexes) {
  4386. return createWrap(func, WRAP_REARG_FLAG, void 0, void 0, void 0, indexes);
  4387. });
  4388. function baseReduce(collection, iteratee, accumulator, initAccum, eachFunc) {
  4389. eachFunc(collection, function(value, index, collection2) {
  4390. accumulator = initAccum ? (initAccum = false, value) : iteratee(accumulator, value, index, collection2);
  4391. });
  4392. return accumulator;
  4393. }
  4394. function reduce(collection, iteratee, accumulator) {
  4395. var func = isArray$1(collection) ? arrayReduce : baseReduce, initAccum = arguments.length < 3;
  4396. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEach);
  4397. }
  4398. function arrayReduceRight(array, iteratee, accumulator, initAccum) {
  4399. var length = array == null ? 0 : array.length;
  4400. if (initAccum && length) {
  4401. accumulator = array[--length];
  4402. }
  4403. while (length--) {
  4404. accumulator = iteratee(accumulator, array[length], length, array);
  4405. }
  4406. return accumulator;
  4407. }
  4408. function reduceRight(collection, iteratee, accumulator) {
  4409. var func = isArray$1(collection) ? arrayReduceRight : baseReduce, initAccum = arguments.length < 3;
  4410. return func(collection, baseIteratee(iteratee), accumulator, initAccum, baseEachRight);
  4411. }
  4412. function reject(collection, predicate) {
  4413. var func = isArray$1(collection) ? arrayFilter : baseFilter;
  4414. return func(collection, negate(baseIteratee(predicate)));
  4415. }
  4416. function remove(array, predicate) {
  4417. var result = [];
  4418. if (!(array && array.length)) {
  4419. return result;
  4420. }
  4421. var index = -1, indexes = [], length = array.length;
  4422. predicate = baseIteratee(predicate);
  4423. while (++index < length) {
  4424. var value = array[index];
  4425. if (predicate(value, index, array)) {
  4426. result.push(value);
  4427. indexes.push(index);
  4428. }
  4429. }
  4430. basePullAt(array, indexes);
  4431. return result;
  4432. }
  4433. function repeat(string, n, guard) {
  4434. if (guard ? isIterateeCall(string, n, guard) : n === void 0) {
  4435. n = 1;
  4436. } else {
  4437. n = toInteger(n);
  4438. }
  4439. return baseRepeat(toString(string), n);
  4440. }
  4441. function replace() {
  4442. var args = arguments, string = toString(args[0]);
  4443. return args.length < 3 ? string : string.replace(args[1], args[2]);
  4444. }
  4445. var FUNC_ERROR_TEXT$2 = "Expected a function";
  4446. function rest(func, start) {
  4447. if (typeof func != "function") {
  4448. throw new TypeError(FUNC_ERROR_TEXT$2);
  4449. }
  4450. start = start === void 0 ? start : toInteger(start);
  4451. return baseRest(func, start);
  4452. }
  4453. function result(object, path, defaultValue) {
  4454. path = castPath(path, object);
  4455. var index = -1, length = path.length;
  4456. if (!length) {
  4457. length = 1;
  4458. object = void 0;
  4459. }
  4460. while (++index < length) {
  4461. var value = object == null ? void 0 : object[toKey(path[index])];
  4462. if (value === void 0) {
  4463. index = length;
  4464. value = defaultValue;
  4465. }
  4466. object = isFunction$1(value) ? value.call(object) : value;
  4467. }
  4468. return object;
  4469. }
  4470. var arrayProto$1 = Array.prototype;
  4471. var nativeReverse = arrayProto$1.reverse;
  4472. function reverse(array) {
  4473. return array == null ? array : nativeReverse.call(array);
  4474. }
  4475. var round$1 = createRound("round");
  4476. function arraySample(array) {
  4477. var length = array.length;
  4478. return length ? array[baseRandom(0, length - 1)] : void 0;
  4479. }
  4480. function baseSample(collection) {
  4481. return arraySample(values(collection));
  4482. }
  4483. function sample(collection) {
  4484. var func = isArray$1(collection) ? arraySample : baseSample;
  4485. return func(collection);
  4486. }
  4487. function shuffleSelf(array, size) {
  4488. var index = -1, length = array.length, lastIndex = length - 1;
  4489. size = size === void 0 ? length : size;
  4490. while (++index < size) {
  4491. var rand = baseRandom(index, lastIndex), value = array[rand];
  4492. array[rand] = array[index];
  4493. array[index] = value;
  4494. }
  4495. array.length = size;
  4496. return array;
  4497. }
  4498. function arraySampleSize(array, n) {
  4499. return shuffleSelf(copyArray(array), baseClamp(n, 0, array.length));
  4500. }
  4501. function baseSampleSize(collection, n) {
  4502. var array = values(collection);
  4503. return shuffleSelf(array, baseClamp(n, 0, array.length));
  4504. }
  4505. function sampleSize(collection, n, guard) {
  4506. if (guard ? isIterateeCall(collection, n, guard) : n === void 0) {
  4507. n = 1;
  4508. } else {
  4509. n = toInteger(n);
  4510. }
  4511. var func = isArray$1(collection) ? arraySampleSize : baseSampleSize;
  4512. return func(collection, n);
  4513. }
  4514. function set(object, path, value) {
  4515. return object == null ? object : baseSet(object, path, value);
  4516. }
  4517. function setWith(object, path, value, customizer) {
  4518. customizer = typeof customizer == "function" ? customizer : void 0;
  4519. return object == null ? object : baseSet(object, path, value, customizer);
  4520. }
  4521. function arrayShuffle(array) {
  4522. return shuffleSelf(copyArray(array));
  4523. }
  4524. function baseShuffle(collection) {
  4525. return shuffleSelf(values(collection));
  4526. }
  4527. function shuffle(collection) {
  4528. var func = isArray$1(collection) ? arrayShuffle : baseShuffle;
  4529. return func(collection);
  4530. }
  4531. var mapTag = "[object Map]";
  4532. var setTag = "[object Set]";
  4533. function size(collection) {
  4534. if (collection == null) {
  4535. return 0;
  4536. }
  4537. if (isArrayLike(collection)) {
  4538. return isString$2(collection) ? stringSize(collection) : collection.length;
  4539. }
  4540. var tag = getTag$1(collection);
  4541. if (tag == mapTag || tag == setTag) {
  4542. return collection.size;
  4543. }
  4544. return baseKeys(collection).length;
  4545. }
  4546. function slice(array, start, end) {
  4547. var length = array == null ? 0 : array.length;
  4548. if (!length) {
  4549. return [];
  4550. }
  4551. if (end && typeof end != "number" && isIterateeCall(array, start, end)) {
  4552. start = 0;
  4553. end = length;
  4554. } else {
  4555. start = start == null ? 0 : toInteger(start);
  4556. end = end === void 0 ? length : toInteger(end);
  4557. }
  4558. return baseSlice(array, start, end);
  4559. }
  4560. var snakeCase = createCompounder(function(result, word, index) {
  4561. return result + (index ? "_" : "") + word.toLowerCase();
  4562. });
  4563. function baseSome(collection, predicate) {
  4564. var result;
  4565. baseEach(collection, function(value, index, collection2) {
  4566. result = predicate(value, index, collection2);
  4567. return !result;
  4568. });
  4569. return !!result;
  4570. }
  4571. function some(collection, predicate, guard) {
  4572. var func = isArray$1(collection) ? arraySome : baseSome;
  4573. if (guard && isIterateeCall(collection, predicate, guard)) {
  4574. predicate = void 0;
  4575. }
  4576. return func(collection, baseIteratee(predicate));
  4577. }
  4578. var sortBy = baseRest(function(collection, iteratees) {
  4579. if (collection == null) {
  4580. return [];
  4581. }
  4582. var length = iteratees.length;
  4583. if (length > 1 && isIterateeCall(collection, iteratees[0], iteratees[1])) {
  4584. iteratees = [];
  4585. } else if (length > 2 && isIterateeCall(iteratees[0], iteratees[1], iteratees[2])) {
  4586. iteratees = [iteratees[0]];
  4587. }
  4588. return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
  4589. });
  4590. var MAX_ARRAY_LENGTH$4 = 4294967295;
  4591. var MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH$4 - 1;
  4592. var nativeFloor = Math.floor;
  4593. var nativeMin$4 = Math.min;
  4594. function baseSortedIndexBy(array, value, iteratee, retHighest) {
  4595. var low = 0, high = array == null ? 0 : array.length;
  4596. if (high === 0) {
  4597. return 0;
  4598. }
  4599. value = iteratee(value);
  4600. var valIsNaN = value !== value, valIsNull = value === null, valIsSymbol = isSymbol(value), valIsUndefined = value === void 0;
  4601. while (low < high) {
  4602. var mid = nativeFloor((low + high) / 2), computed = iteratee(array[mid]), othIsDefined = computed !== void 0, othIsNull = computed === null, othIsReflexive = computed === computed, othIsSymbol = isSymbol(computed);
  4603. if (valIsNaN) {
  4604. var setLow = retHighest || othIsReflexive;
  4605. } else if (valIsUndefined) {
  4606. setLow = othIsReflexive && (retHighest || othIsDefined);
  4607. } else if (valIsNull) {
  4608. setLow = othIsReflexive && othIsDefined && (retHighest || !othIsNull);
  4609. } else if (valIsSymbol) {
  4610. setLow = othIsReflexive && othIsDefined && !othIsNull && (retHighest || !othIsSymbol);
  4611. } else if (othIsNull || othIsSymbol) {
  4612. setLow = false;
  4613. } else {
  4614. setLow = retHighest ? computed <= value : computed < value;
  4615. }
  4616. if (setLow) {
  4617. low = mid + 1;
  4618. } else {
  4619. high = mid;
  4620. }
  4621. }
  4622. return nativeMin$4(high, MAX_ARRAY_INDEX);
  4623. }
  4624. var MAX_ARRAY_LENGTH$3 = 4294967295;
  4625. var HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH$3 >>> 1;
  4626. function baseSortedIndex(array, value, retHighest) {
  4627. var low = 0, high = array == null ? low : array.length;
  4628. if (typeof value == "number" && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
  4629. while (low < high) {
  4630. var mid = low + high >>> 1, computed = array[mid];
  4631. if (computed !== null && !isSymbol(computed) && (retHighest ? computed <= value : computed < value)) {
  4632. low = mid + 1;
  4633. } else {
  4634. high = mid;
  4635. }
  4636. }
  4637. return high;
  4638. }
  4639. return baseSortedIndexBy(array, value, identity$1, retHighest);
  4640. }
  4641. function sortedIndex(array, value) {
  4642. return baseSortedIndex(array, value);
  4643. }
  4644. function sortedIndexBy(array, value, iteratee) {
  4645. return baseSortedIndexBy(array, value, baseIteratee(iteratee));
  4646. }
  4647. function sortedIndexOf(array, value) {
  4648. var length = array == null ? 0 : array.length;
  4649. if (length) {
  4650. var index = baseSortedIndex(array, value);
  4651. if (index < length && eq(array[index], value)) {
  4652. return index;
  4653. }
  4654. }
  4655. return -1;
  4656. }
  4657. function sortedLastIndex(array, value) {
  4658. return baseSortedIndex(array, value, true);
  4659. }
  4660. function sortedLastIndexBy(array, value, iteratee) {
  4661. return baseSortedIndexBy(array, value, baseIteratee(iteratee), true);
  4662. }
  4663. function sortedLastIndexOf(array, value) {
  4664. var length = array == null ? 0 : array.length;
  4665. if (length) {
  4666. var index = baseSortedIndex(array, value, true) - 1;
  4667. if (eq(array[index], value)) {
  4668. return index;
  4669. }
  4670. }
  4671. return -1;
  4672. }
  4673. function baseSortedUniq(array, iteratee) {
  4674. var index = -1, length = array.length, resIndex = 0, result = [];
  4675. while (++index < length) {
  4676. var value = array[index], computed = iteratee ? iteratee(value) : value;
  4677. if (!index || !eq(computed, seen)) {
  4678. var seen = computed;
  4679. result[resIndex++] = value === 0 ? 0 : value;
  4680. }
  4681. }
  4682. return result;
  4683. }
  4684. function sortedUniq(array) {
  4685. return array && array.length ? baseSortedUniq(array) : [];
  4686. }
  4687. function sortedUniqBy(array, iteratee) {
  4688. return array && array.length ? baseSortedUniq(array, baseIteratee(iteratee)) : [];
  4689. }
  4690. var MAX_ARRAY_LENGTH$2 = 4294967295;
  4691. function split(string, separator, limit) {
  4692. if (limit && typeof limit != "number" && isIterateeCall(string, separator, limit)) {
  4693. separator = limit = void 0;
  4694. }
  4695. limit = limit === void 0 ? MAX_ARRAY_LENGTH$2 : limit >>> 0;
  4696. if (!limit) {
  4697. return [];
  4698. }
  4699. string = toString(string);
  4700. if (string && (typeof separator == "string" || separator != null && !isRegExp(separator))) {
  4701. separator = baseToString(separator);
  4702. if (!separator && hasUnicode(string)) {
  4703. return castSlice(stringToArray(string), 0, limit);
  4704. }
  4705. }
  4706. return string.split(separator, limit);
  4707. }
  4708. var FUNC_ERROR_TEXT$1 = "Expected a function";
  4709. var nativeMax$3 = Math.max;
  4710. function spread(func, start) {
  4711. if (typeof func != "function") {
  4712. throw new TypeError(FUNC_ERROR_TEXT$1);
  4713. }
  4714. start = start == null ? 0 : nativeMax$3(toInteger(start), 0);
  4715. return baseRest(function(args) {
  4716. var array = args[start], otherArgs = castSlice(args, 0, start);
  4717. if (array) {
  4718. arrayPush(otherArgs, array);
  4719. }
  4720. return apply(func, this, otherArgs);
  4721. });
  4722. }
  4723. var startCase = createCompounder(function(result, word, index) {
  4724. return result + (index ? " " : "") + upperFirst(word);
  4725. });
  4726. function startsWith(string, target, position) {
  4727. string = toString(string);
  4728. position = position == null ? 0 : baseClamp(toInteger(position), 0, string.length);
  4729. target = baseToString(target);
  4730. return string.slice(position, position + target.length) == target;
  4731. }
  4732. function stubObject() {
  4733. return {};
  4734. }
  4735. function stubString() {
  4736. return "";
  4737. }
  4738. function stubTrue() {
  4739. return true;
  4740. }
  4741. var subtract = createMathOperation(function(minuend, subtrahend) {
  4742. return minuend - subtrahend;
  4743. }, 0);
  4744. function sum$1(array) {
  4745. return array && array.length ? baseSum(array, identity$1) : 0;
  4746. }
  4747. function sumBy(array, iteratee) {
  4748. return array && array.length ? baseSum(array, baseIteratee(iteratee)) : 0;
  4749. }
  4750. function tail(array) {
  4751. var length = array == null ? 0 : array.length;
  4752. return length ? baseSlice(array, 1, length) : [];
  4753. }
  4754. function take(array, n, guard) {
  4755. if (!(array && array.length)) {
  4756. return [];
  4757. }
  4758. n = guard || n === void 0 ? 1 : toInteger(n);
  4759. return baseSlice(array, 0, n < 0 ? 0 : n);
  4760. }
  4761. function takeRight(array, n, guard) {
  4762. var length = array == null ? 0 : array.length;
  4763. if (!length) {
  4764. return [];
  4765. }
  4766. n = guard || n === void 0 ? 1 : toInteger(n);
  4767. n = length - n;
  4768. return baseSlice(array, n < 0 ? 0 : n, length);
  4769. }
  4770. function takeRightWhile(array, predicate) {
  4771. return array && array.length ? baseWhile(array, baseIteratee(predicate), false, true) : [];
  4772. }
  4773. function takeWhile(array, predicate) {
  4774. return array && array.length ? baseWhile(array, baseIteratee(predicate)) : [];
  4775. }
  4776. function tap(value, interceptor) {
  4777. interceptor(value);
  4778. return value;
  4779. }
  4780. var objectProto$2 = Object.prototype;
  4781. var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
  4782. function customDefaultsAssignIn(objValue, srcValue, key, object) {
  4783. if (objValue === void 0 || eq(objValue, objectProto$2[key]) && !hasOwnProperty$3.call(object, key)) {
  4784. return srcValue;
  4785. }
  4786. return objValue;
  4787. }
  4788. var stringEscapes = {
  4789. "\\": "\\",
  4790. "'": "'",
  4791. "\n": "n",
  4792. "\r": "r",
  4793. "\u2028": "u2028",
  4794. "\u2029": "u2029"
  4795. };
  4796. function escapeStringChar(chr) {
  4797. return "\\" + stringEscapes[chr];
  4798. }
  4799. var reInterpolate = /<%=([\s\S]+?)%>/g;
  4800. var reEscape = /<%-([\s\S]+?)%>/g;
  4801. var reEvaluate = /<%([\s\S]+?)%>/g;
  4802. var templateSettings = {
  4803. "escape": reEscape,
  4804. "evaluate": reEvaluate,
  4805. "interpolate": reInterpolate,
  4806. "variable": "",
  4807. "imports": {
  4808. "_": { "escape": escape }
  4809. }
  4810. };
  4811. var INVALID_TEMPL_VAR_ERROR_TEXT = "Invalid `variable` option passed into `_.template`";
  4812. var reEmptyStringLeading = /\b__p \+= '';/g;
  4813. var reEmptyStringMiddle = /\b(__p \+=) '' \+/g;
  4814. var reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g;
  4815. var reForbiddenIdentifierChars = /[()=,{}\[\]\/\s]/;
  4816. var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g;
  4817. var reNoMatch = /($^)/;
  4818. var reUnescapedString = /['\n\r\u2028\u2029\\]/g;
  4819. var objectProto$1 = Object.prototype;
  4820. var hasOwnProperty$2 = objectProto$1.hasOwnProperty;
  4821. function template(string, options, guard) {
  4822. var settings = templateSettings.imports._.templateSettings || templateSettings;
  4823. if (guard && isIterateeCall(string, options, guard)) {
  4824. options = void 0;
  4825. }
  4826. string = toString(string);
  4827. options = assignInWith({}, options, settings, customDefaultsAssignIn);
  4828. var imports = assignInWith({}, options.imports, settings.imports, customDefaultsAssignIn), importsKeys = keys(imports), importsValues = baseValues(imports, importsKeys);
  4829. var isEscaping, isEvaluating, index = 0, interpolate = options.interpolate || reNoMatch, source = "__p += '";
  4830. var reDelimiters = RegExp((options.escape || reNoMatch).source + "|" + interpolate.source + "|" + (interpolate === reInterpolate ? reEsTemplate : reNoMatch).source + "|" + (options.evaluate || reNoMatch).source + "|$", "g");
  4831. var sourceURL = hasOwnProperty$2.call(options, "sourceURL") ? "//# sourceURL=" + (options.sourceURL + "").replace(/\s/g, " ") + "\n" : "";
  4832. string.replace(reDelimiters, function(match, escapeValue, interpolateValue, esTemplateValue, evaluateValue, offset) {
  4833. interpolateValue || (interpolateValue = esTemplateValue);
  4834. source += string.slice(index, offset).replace(reUnescapedString, escapeStringChar);
  4835. if (escapeValue) {
  4836. isEscaping = true;
  4837. source += "' +\n__e(" + escapeValue + ") +\n'";
  4838. }
  4839. if (evaluateValue) {
  4840. isEvaluating = true;
  4841. source += "';\n" + evaluateValue + ";\n__p += '";
  4842. }
  4843. if (interpolateValue) {
  4844. source += "' +\n((__t = (" + interpolateValue + ")) == null ? '' : __t) +\n'";
  4845. }
  4846. index = offset + match.length;
  4847. return match;
  4848. });
  4849. source += "';\n";
  4850. var variable = hasOwnProperty$2.call(options, "variable") && options.variable;
  4851. if (!variable) {
  4852. source = "with (obj) {\n" + source + "\n}\n";
  4853. } else if (reForbiddenIdentifierChars.test(variable)) {
  4854. throw new Error(INVALID_TEMPL_VAR_ERROR_TEXT);
  4855. }
  4856. source = (isEvaluating ? source.replace(reEmptyStringLeading, "") : source).replace(reEmptyStringMiddle, "$1").replace(reEmptyStringTrailing, "$1;");
  4857. 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}";
  4858. var result = attempt(function() {
  4859. return Function(importsKeys, sourceURL + "return " + source).apply(void 0, importsValues);
  4860. });
  4861. result.source = source;
  4862. if (isError(result)) {
  4863. throw result;
  4864. }
  4865. return result;
  4866. }
  4867. var FUNC_ERROR_TEXT = "Expected a function";
  4868. function throttle(func, wait, options) {
  4869. var leading = true, trailing = true;
  4870. if (typeof func != "function") {
  4871. throw new TypeError(FUNC_ERROR_TEXT);
  4872. }
  4873. if (isObject$2(options)) {
  4874. leading = "leading" in options ? !!options.leading : leading;
  4875. trailing = "trailing" in options ? !!options.trailing : trailing;
  4876. }
  4877. return debounce(func, wait, {
  4878. "leading": leading,
  4879. "maxWait": wait,
  4880. "trailing": trailing
  4881. });
  4882. }
  4883. function thru(value, interceptor) {
  4884. return interceptor(value);
  4885. }
  4886. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  4887. var MAX_ARRAY_LENGTH$1 = 4294967295;
  4888. var nativeMin$3 = Math.min;
  4889. function times(n, iteratee) {
  4890. n = toInteger(n);
  4891. if (n < 1 || n > MAX_SAFE_INTEGER$1) {
  4892. return [];
  4893. }
  4894. var index = MAX_ARRAY_LENGTH$1, length = nativeMin$3(n, MAX_ARRAY_LENGTH$1);
  4895. iteratee = castFunction(iteratee);
  4896. n -= MAX_ARRAY_LENGTH$1;
  4897. var result = baseTimes(length, iteratee);
  4898. while (++index < n) {
  4899. iteratee(index);
  4900. }
  4901. return result;
  4902. }
  4903. function wrapperToIterator() {
  4904. return this;
  4905. }
  4906. function baseWrapperValue(value, actions) {
  4907. var result = value;
  4908. if (result instanceof LazyWrapper) {
  4909. result = result.value();
  4910. }
  4911. return arrayReduce(actions, function(result2, action) {
  4912. return action.func.apply(action.thisArg, arrayPush([result2], action.args));
  4913. }, result);
  4914. }
  4915. function wrapperValue() {
  4916. return baseWrapperValue(this.__wrapped__, this.__actions__);
  4917. }
  4918. function toLower(value) {
  4919. return toString(value).toLowerCase();
  4920. }
  4921. function toPath(value) {
  4922. if (isArray$1(value)) {
  4923. return arrayMap(value, toKey);
  4924. }
  4925. return isSymbol(value) ? [value] : copyArray(stringToPath(toString(value)));
  4926. }
  4927. var MAX_SAFE_INTEGER = 9007199254740991;
  4928. function toSafeInteger(value) {
  4929. return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
  4930. }
  4931. function toUpper(value) {
  4932. return toString(value).toUpperCase();
  4933. }
  4934. function transform(object, iteratee, accumulator) {
  4935. var isArr = isArray$1(object), isArrLike = isArr || isBuffer(object) || isTypedArray(object);
  4936. iteratee = baseIteratee(iteratee);
  4937. if (accumulator == null) {
  4938. var Ctor = object && object.constructor;
  4939. if (isArrLike) {
  4940. accumulator = isArr ? new Ctor() : [];
  4941. } else if (isObject$2(object)) {
  4942. accumulator = isFunction$1(Ctor) ? baseCreate(getPrototype(object)) : {};
  4943. } else {
  4944. accumulator = {};
  4945. }
  4946. }
  4947. (isArrLike ? arrayEach : baseForOwn)(object, function(value, index, object2) {
  4948. return iteratee(accumulator, value, index, object2);
  4949. });
  4950. return accumulator;
  4951. }
  4952. function charsEndIndex(strSymbols, chrSymbols) {
  4953. var index = strSymbols.length;
  4954. while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  4955. }
  4956. return index;
  4957. }
  4958. function charsStartIndex(strSymbols, chrSymbols) {
  4959. var index = -1, length = strSymbols.length;
  4960. while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {
  4961. }
  4962. return index;
  4963. }
  4964. function trim(string, chars, guard) {
  4965. string = toString(string);
  4966. if (string && (guard || chars === void 0)) {
  4967. return baseTrim(string);
  4968. }
  4969. if (!string || !(chars = baseToString(chars))) {
  4970. return string;
  4971. }
  4972. var strSymbols = stringToArray(string), chrSymbols = stringToArray(chars), start = charsStartIndex(strSymbols, chrSymbols), end = charsEndIndex(strSymbols, chrSymbols) + 1;
  4973. return castSlice(strSymbols, start, end).join("");
  4974. }
  4975. function trimEnd(string, chars, guard) {
  4976. string = toString(string);
  4977. if (string && (guard || chars === void 0)) {
  4978. return string.slice(0, trimmedEndIndex(string) + 1);
  4979. }
  4980. if (!string || !(chars = baseToString(chars))) {
  4981. return string;
  4982. }
  4983. var strSymbols = stringToArray(string), end = charsEndIndex(strSymbols, stringToArray(chars)) + 1;
  4984. return castSlice(strSymbols, 0, end).join("");
  4985. }
  4986. var reTrimStart = /^\s+/;
  4987. function trimStart(string, chars, guard) {
  4988. string = toString(string);
  4989. if (string && (guard || chars === void 0)) {
  4990. return string.replace(reTrimStart, "");
  4991. }
  4992. if (!string || !(chars = baseToString(chars))) {
  4993. return string;
  4994. }
  4995. var strSymbols = stringToArray(string), start = charsStartIndex(strSymbols, stringToArray(chars));
  4996. return castSlice(strSymbols, start).join("");
  4997. }
  4998. var DEFAULT_TRUNC_LENGTH = 30;
  4999. var DEFAULT_TRUNC_OMISSION = "...";
  5000. var reFlags = /\w*$/;
  5001. function truncate(string, options) {
  5002. var length = DEFAULT_TRUNC_LENGTH, omission = DEFAULT_TRUNC_OMISSION;
  5003. if (isObject$2(options)) {
  5004. var separator = "separator" in options ? options.separator : separator;
  5005. length = "length" in options ? toInteger(options.length) : length;
  5006. omission = "omission" in options ? baseToString(options.omission) : omission;
  5007. }
  5008. string = toString(string);
  5009. var strLength = string.length;
  5010. if (hasUnicode(string)) {
  5011. var strSymbols = stringToArray(string);
  5012. strLength = strSymbols.length;
  5013. }
  5014. if (length >= strLength) {
  5015. return string;
  5016. }
  5017. var end = length - stringSize(omission);
  5018. if (end < 1) {
  5019. return omission;
  5020. }
  5021. var result = strSymbols ? castSlice(strSymbols, 0, end).join("") : string.slice(0, end);
  5022. if (separator === void 0) {
  5023. return result + omission;
  5024. }
  5025. if (strSymbols) {
  5026. end += result.length - end;
  5027. }
  5028. if (isRegExp(separator)) {
  5029. if (string.slice(end).search(separator)) {
  5030. var match, substring = result;
  5031. if (!separator.global) {
  5032. separator = RegExp(separator.source, toString(reFlags.exec(separator)) + "g");
  5033. }
  5034. separator.lastIndex = 0;
  5035. while (match = separator.exec(substring)) {
  5036. var newEnd = match.index;
  5037. }
  5038. result = result.slice(0, newEnd === void 0 ? end : newEnd);
  5039. }
  5040. } else if (string.indexOf(baseToString(separator), end) != end) {
  5041. var index = result.lastIndexOf(separator);
  5042. if (index > -1) {
  5043. result = result.slice(0, index);
  5044. }
  5045. }
  5046. return result + omission;
  5047. }
  5048. function unary(func) {
  5049. return ary(func, 1);
  5050. }
  5051. var htmlUnescapes = {
  5052. "&amp;": "&",
  5053. "&lt;": "<",
  5054. "&gt;": ">",
  5055. "&quot;": '"',
  5056. "&#39;": "'"
  5057. };
  5058. var unescapeHtmlChar = basePropertyOf(htmlUnescapes);
  5059. var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g;
  5060. var reHasEscapedHtml = RegExp(reEscapedHtml.source);
  5061. function unescape(string) {
  5062. string = toString(string);
  5063. return string && reHasEscapedHtml.test(string) ? string.replace(reEscapedHtml, unescapeHtmlChar) : string;
  5064. }
  5065. var INFINITY = 1 / 0;
  5066. var createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == INFINITY) ? noop$1 : function(values) {
  5067. return new Set$1(values);
  5068. };
  5069. var LARGE_ARRAY_SIZE = 200;
  5070. function baseUniq(array, iteratee, comparator) {
  5071. var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
  5072. if (comparator) {
  5073. isCommon = false;
  5074. includes = arrayIncludesWith;
  5075. } else if (length >= LARGE_ARRAY_SIZE) {
  5076. var set = iteratee ? null : createSet(array);
  5077. if (set) {
  5078. return setToArray(set);
  5079. }
  5080. isCommon = false;
  5081. includes = cacheHas;
  5082. seen = new SetCache();
  5083. } else {
  5084. seen = iteratee ? [] : result;
  5085. }
  5086. outer:
  5087. while (++index < length) {
  5088. var value = array[index], computed = iteratee ? iteratee(value) : value;
  5089. value = comparator || value !== 0 ? value : 0;
  5090. if (isCommon && computed === computed) {
  5091. var seenIndex = seen.length;
  5092. while (seenIndex--) {
  5093. if (seen[seenIndex] === computed) {
  5094. continue outer;
  5095. }
  5096. }
  5097. if (iteratee) {
  5098. seen.push(computed);
  5099. }
  5100. result.push(value);
  5101. } else if (!includes(seen, computed, comparator)) {
  5102. if (seen !== result) {
  5103. seen.push(computed);
  5104. }
  5105. result.push(value);
  5106. }
  5107. }
  5108. return result;
  5109. }
  5110. var union = baseRest(function(arrays) {
  5111. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  5112. });
  5113. var unionBy = baseRest(function(arrays) {
  5114. var iteratee = last(arrays);
  5115. if (isArrayLikeObject(iteratee)) {
  5116. iteratee = void 0;
  5117. }
  5118. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), baseIteratee(iteratee));
  5119. });
  5120. var unionWith = baseRest(function(arrays) {
  5121. var comparator = last(arrays);
  5122. comparator = typeof comparator == "function" ? comparator : void 0;
  5123. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true), void 0, comparator);
  5124. });
  5125. function uniq(array) {
  5126. return array && array.length ? baseUniq(array) : [];
  5127. }
  5128. function uniqBy(array, iteratee) {
  5129. return array && array.length ? baseUniq(array, baseIteratee(iteratee)) : [];
  5130. }
  5131. function uniqWith(array, comparator) {
  5132. comparator = typeof comparator == "function" ? comparator : void 0;
  5133. return array && array.length ? baseUniq(array, void 0, comparator) : [];
  5134. }
  5135. var idCounter = 0;
  5136. function uniqueId(prefix) {
  5137. var id = ++idCounter;
  5138. return toString(prefix) + id;
  5139. }
  5140. function unset(object, path) {
  5141. return object == null ? true : baseUnset(object, path);
  5142. }
  5143. var nativeMax$2 = Math.max;
  5144. function unzip(array) {
  5145. if (!(array && array.length)) {
  5146. return [];
  5147. }
  5148. var length = 0;
  5149. array = arrayFilter(array, function(group) {
  5150. if (isArrayLikeObject(group)) {
  5151. length = nativeMax$2(group.length, length);
  5152. return true;
  5153. }
  5154. });
  5155. return baseTimes(length, function(index) {
  5156. return arrayMap(array, baseProperty(index));
  5157. });
  5158. }
  5159. function unzipWith(array, iteratee) {
  5160. if (!(array && array.length)) {
  5161. return [];
  5162. }
  5163. var result = unzip(array);
  5164. if (iteratee == null) {
  5165. return result;
  5166. }
  5167. return arrayMap(result, function(group) {
  5168. return apply(iteratee, void 0, group);
  5169. });
  5170. }
  5171. function baseUpdate(object, path, updater, customizer) {
  5172. return baseSet(object, path, updater(baseGet(object, path)), customizer);
  5173. }
  5174. function update(object, path, updater) {
  5175. return object == null ? object : baseUpdate(object, path, castFunction(updater));
  5176. }
  5177. function updateWith(object, path, updater, customizer) {
  5178. customizer = typeof customizer == "function" ? customizer : void 0;
  5179. return object == null ? object : baseUpdate(object, path, castFunction(updater), customizer);
  5180. }
  5181. var upperCase = createCompounder(function(result, word, index) {
  5182. return result + (index ? " " : "") + word.toUpperCase();
  5183. });
  5184. function valuesIn(object) {
  5185. return object == null ? [] : baseValues(object, keysIn(object));
  5186. }
  5187. var without = baseRest(function(array, values) {
  5188. return isArrayLikeObject(array) ? baseDifference(array, values) : [];
  5189. });
  5190. function wrap(value, wrapper) {
  5191. return partial(castFunction(wrapper), value);
  5192. }
  5193. var wrapperAt = flatRest(function(paths) {
  5194. var length = paths.length, start = length ? paths[0] : 0, value = this.__wrapped__, interceptor = function(object) {
  5195. return baseAt(object, paths);
  5196. };
  5197. if (length > 1 || this.__actions__.length || !(value instanceof LazyWrapper) || !isIndex(start)) {
  5198. return this.thru(interceptor);
  5199. }
  5200. value = value.slice(start, +start + (length ? 1 : 0));
  5201. value.__actions__.push({
  5202. "func": thru,
  5203. "args": [interceptor],
  5204. "thisArg": void 0
  5205. });
  5206. return new LodashWrapper(value, this.__chain__).thru(function(array) {
  5207. if (length && !array.length) {
  5208. array.push(void 0);
  5209. }
  5210. return array;
  5211. });
  5212. });
  5213. function wrapperChain() {
  5214. return chain(this);
  5215. }
  5216. function wrapperReverse() {
  5217. var value = this.__wrapped__;
  5218. if (value instanceof LazyWrapper) {
  5219. var wrapped = value;
  5220. if (this.__actions__.length) {
  5221. wrapped = new LazyWrapper(this);
  5222. }
  5223. wrapped = wrapped.reverse();
  5224. wrapped.__actions__.push({
  5225. "func": thru,
  5226. "args": [reverse],
  5227. "thisArg": void 0
  5228. });
  5229. return new LodashWrapper(wrapped, this.__chain__);
  5230. }
  5231. return this.thru(reverse);
  5232. }
  5233. function baseXor(arrays, iteratee, comparator) {
  5234. var length = arrays.length;
  5235. if (length < 2) {
  5236. return length ? baseUniq(arrays[0]) : [];
  5237. }
  5238. var index = -1, result = Array(length);
  5239. while (++index < length) {
  5240. var array = arrays[index], othIndex = -1;
  5241. while (++othIndex < length) {
  5242. if (othIndex != index) {
  5243. result[index] = baseDifference(result[index] || array, arrays[othIndex], iteratee, comparator);
  5244. }
  5245. }
  5246. }
  5247. return baseUniq(baseFlatten(result, 1), iteratee, comparator);
  5248. }
  5249. var xor = baseRest(function(arrays) {
  5250. return baseXor(arrayFilter(arrays, isArrayLikeObject));
  5251. });
  5252. var xorBy = baseRest(function(arrays) {
  5253. var iteratee = last(arrays);
  5254. if (isArrayLikeObject(iteratee)) {
  5255. iteratee = void 0;
  5256. }
  5257. return baseXor(arrayFilter(arrays, isArrayLikeObject), baseIteratee(iteratee));
  5258. });
  5259. var xorWith = baseRest(function(arrays) {
  5260. var comparator = last(arrays);
  5261. comparator = typeof comparator == "function" ? comparator : void 0;
  5262. return baseXor(arrayFilter(arrays, isArrayLikeObject), void 0, comparator);
  5263. });
  5264. var zip = baseRest(unzip);
  5265. function baseZipObject(props, values, assignFunc) {
  5266. var index = -1, length = props.length, valsLength = values.length, result = {};
  5267. while (++index < length) {
  5268. var value = index < valsLength ? values[index] : void 0;
  5269. assignFunc(result, props[index], value);
  5270. }
  5271. return result;
  5272. }
  5273. function zipObject(props, values) {
  5274. return baseZipObject(props || [], values || [], assignValue);
  5275. }
  5276. function zipObjectDeep(props, values) {
  5277. return baseZipObject(props || [], values || [], baseSet);
  5278. }
  5279. var zipWith = baseRest(function(arrays) {
  5280. var length = arrays.length, iteratee = length > 1 ? arrays[length - 1] : void 0;
  5281. iteratee = typeof iteratee == "function" ? (arrays.pop(), iteratee) : void 0;
  5282. return unzipWith(arrays, iteratee);
  5283. });
  5284. var array = {
  5285. chunk,
  5286. compact,
  5287. concat,
  5288. difference,
  5289. differenceBy,
  5290. differenceWith,
  5291. drop,
  5292. dropRight,
  5293. dropRightWhile,
  5294. dropWhile,
  5295. fill,
  5296. findIndex,
  5297. findLastIndex,
  5298. first: head,
  5299. flatten,
  5300. flattenDeep,
  5301. flattenDepth,
  5302. fromPairs,
  5303. head,
  5304. indexOf,
  5305. initial,
  5306. intersection,
  5307. intersectionBy,
  5308. intersectionWith,
  5309. join,
  5310. last,
  5311. lastIndexOf,
  5312. nth,
  5313. pull,
  5314. pullAll,
  5315. pullAllBy,
  5316. pullAllWith,
  5317. pullAt,
  5318. remove,
  5319. reverse,
  5320. slice,
  5321. sortedIndex,
  5322. sortedIndexBy,
  5323. sortedIndexOf,
  5324. sortedLastIndex,
  5325. sortedLastIndexBy,
  5326. sortedLastIndexOf,
  5327. sortedUniq,
  5328. sortedUniqBy,
  5329. tail,
  5330. take,
  5331. takeRight,
  5332. takeRightWhile,
  5333. takeWhile,
  5334. union,
  5335. unionBy,
  5336. unionWith,
  5337. uniq,
  5338. uniqBy,
  5339. uniqWith,
  5340. unzip,
  5341. unzipWith,
  5342. without,
  5343. xor,
  5344. xorBy,
  5345. xorWith,
  5346. zip,
  5347. zipObject,
  5348. zipObjectDeep,
  5349. zipWith
  5350. };
  5351. var collection = {
  5352. countBy,
  5353. each: forEach,
  5354. eachRight: forEachRight,
  5355. every,
  5356. filter,
  5357. find,
  5358. findLast,
  5359. flatMap,
  5360. flatMapDeep,
  5361. flatMapDepth,
  5362. forEach,
  5363. forEachRight,
  5364. groupBy,
  5365. includes,
  5366. invokeMap,
  5367. keyBy,
  5368. map,
  5369. orderBy: orderBy$1,
  5370. partition,
  5371. reduce,
  5372. reduceRight,
  5373. reject,
  5374. sample,
  5375. sampleSize,
  5376. shuffle,
  5377. size,
  5378. some,
  5379. sortBy
  5380. };
  5381. var date$1 = {
  5382. now
  5383. };
  5384. var func = {
  5385. after,
  5386. ary,
  5387. before,
  5388. bind,
  5389. bindKey,
  5390. curry,
  5391. curryRight,
  5392. debounce,
  5393. defer,
  5394. delay,
  5395. flip,
  5396. memoize,
  5397. negate,
  5398. once,
  5399. overArgs,
  5400. partial,
  5401. partialRight,
  5402. rearg,
  5403. rest,
  5404. spread,
  5405. throttle,
  5406. unary,
  5407. wrap
  5408. };
  5409. var lang = {
  5410. castArray: castArray$1,
  5411. clone,
  5412. cloneDeep,
  5413. cloneDeepWith,
  5414. cloneWith,
  5415. conformsTo,
  5416. eq,
  5417. gt: gt$1,
  5418. gte,
  5419. isArguments,
  5420. isArray: isArray$1,
  5421. isArrayBuffer,
  5422. isArrayLike,
  5423. isArrayLikeObject,
  5424. isBoolean: isBoolean$1,
  5425. isBuffer,
  5426. isDate: isDate$1,
  5427. isElement: isElement$2,
  5428. isEmpty: isEmpty$1,
  5429. isEqual: isEqual$1,
  5430. isEqualWith,
  5431. isError,
  5432. isFinite,
  5433. isFunction: isFunction$1,
  5434. isInteger,
  5435. isLength,
  5436. isMap,
  5437. isMatch,
  5438. isMatchWith,
  5439. isNaN: isNaN$1,
  5440. isNative,
  5441. isNil,
  5442. isNull,
  5443. isNumber: isNumber$1,
  5444. isObject: isObject$2,
  5445. isObjectLike,
  5446. isPlainObject,
  5447. isRegExp,
  5448. isSafeInteger,
  5449. isSet,
  5450. isString: isString$2,
  5451. isSymbol,
  5452. isTypedArray,
  5453. isUndefined: isUndefined$1,
  5454. isWeakMap,
  5455. isWeakSet,
  5456. lt: lt$1,
  5457. lte,
  5458. toArray,
  5459. toFinite,
  5460. toInteger,
  5461. toLength,
  5462. toNumber,
  5463. toPlainObject,
  5464. toSafeInteger,
  5465. toString
  5466. };
  5467. var math = {
  5468. add,
  5469. ceil,
  5470. divide,
  5471. floor: floor$1,
  5472. max: max$3,
  5473. maxBy,
  5474. mean,
  5475. meanBy,
  5476. min: min$3,
  5477. minBy,
  5478. multiply,
  5479. round: round$1,
  5480. subtract,
  5481. sum: sum$1,
  5482. sumBy
  5483. };
  5484. var number = {
  5485. clamp,
  5486. inRange,
  5487. random
  5488. };
  5489. var object = {
  5490. assign,
  5491. assignIn,
  5492. assignInWith,
  5493. assignWith,
  5494. at: at$1,
  5495. create,
  5496. defaults,
  5497. defaultsDeep,
  5498. entries: toPairs,
  5499. entriesIn: toPairsIn,
  5500. extend: assignIn,
  5501. extendWith: assignInWith,
  5502. findKey,
  5503. findLastKey,
  5504. forIn,
  5505. forInRight,
  5506. forOwn,
  5507. forOwnRight,
  5508. functions,
  5509. functionsIn,
  5510. get,
  5511. has,
  5512. hasIn,
  5513. invert,
  5514. invertBy,
  5515. invoke,
  5516. keys,
  5517. keysIn,
  5518. mapKeys,
  5519. mapValues,
  5520. merge,
  5521. mergeWith,
  5522. omit,
  5523. omitBy,
  5524. pick,
  5525. pickBy,
  5526. result,
  5527. set,
  5528. setWith,
  5529. toPairs,
  5530. toPairsIn,
  5531. transform,
  5532. unset,
  5533. update,
  5534. updateWith,
  5535. values,
  5536. valuesIn
  5537. };
  5538. var seq = {
  5539. at: wrapperAt,
  5540. chain,
  5541. commit: wrapperCommit,
  5542. lodash,
  5543. next: wrapperNext,
  5544. plant: wrapperPlant,
  5545. reverse: wrapperReverse,
  5546. tap,
  5547. thru,
  5548. toIterator: wrapperToIterator,
  5549. toJSON: wrapperValue,
  5550. value: wrapperValue,
  5551. valueOf: wrapperValue,
  5552. wrapperChain
  5553. };
  5554. var string$1 = {
  5555. camelCase,
  5556. capitalize: capitalize$2,
  5557. deburr,
  5558. endsWith,
  5559. escape,
  5560. escapeRegExp,
  5561. kebabCase,
  5562. lowerCase,
  5563. lowerFirst,
  5564. pad,
  5565. padEnd,
  5566. padStart,
  5567. parseInt: parseInt$1,
  5568. repeat,
  5569. replace,
  5570. snakeCase,
  5571. split,
  5572. startCase,
  5573. startsWith,
  5574. template,
  5575. templateSettings,
  5576. toLower,
  5577. toUpper,
  5578. trim,
  5579. trimEnd,
  5580. trimStart,
  5581. truncate,
  5582. unescape,
  5583. upperCase,
  5584. upperFirst,
  5585. words
  5586. };
  5587. var util = {
  5588. attempt,
  5589. bindAll,
  5590. cond,
  5591. conforms,
  5592. constant,
  5593. defaultTo,
  5594. flow,
  5595. flowRight,
  5596. identity: identity$1,
  5597. iteratee,
  5598. matches,
  5599. matchesProperty,
  5600. method,
  5601. methodOf,
  5602. mixin: mixin$1,
  5603. noop: noop$1,
  5604. nthArg,
  5605. over,
  5606. overEvery,
  5607. overSome,
  5608. property,
  5609. propertyOf,
  5610. range: range$1,
  5611. rangeRight,
  5612. stubArray,
  5613. stubFalse,
  5614. stubObject,
  5615. stubString,
  5616. stubTrue,
  5617. times,
  5618. toPath,
  5619. uniqueId
  5620. };
  5621. function lazyClone() {
  5622. var result = new LazyWrapper(this.__wrapped__);
  5623. result.__actions__ = copyArray(this.__actions__);
  5624. result.__dir__ = this.__dir__;
  5625. result.__filtered__ = this.__filtered__;
  5626. result.__iteratees__ = copyArray(this.__iteratees__);
  5627. result.__takeCount__ = this.__takeCount__;
  5628. result.__views__ = copyArray(this.__views__);
  5629. return result;
  5630. }
  5631. function lazyReverse() {
  5632. if (this.__filtered__) {
  5633. var result = new LazyWrapper(this);
  5634. result.__dir__ = -1;
  5635. result.__filtered__ = true;
  5636. } else {
  5637. result = this.clone();
  5638. result.__dir__ *= -1;
  5639. }
  5640. return result;
  5641. }
  5642. var nativeMax$1 = Math.max;
  5643. var nativeMin$2 = Math.min;
  5644. function getView(start, end, transforms) {
  5645. var index = -1, length = transforms.length;
  5646. while (++index < length) {
  5647. var data = transforms[index], size = data.size;
  5648. switch (data.type) {
  5649. case "drop":
  5650. start += size;
  5651. break;
  5652. case "dropRight":
  5653. end -= size;
  5654. break;
  5655. case "take":
  5656. end = nativeMin$2(end, start + size);
  5657. break;
  5658. case "takeRight":
  5659. start = nativeMax$1(start, end - size);
  5660. break;
  5661. }
  5662. }
  5663. return { "start": start, "end": end };
  5664. }
  5665. var LAZY_FILTER_FLAG$1 = 1;
  5666. var LAZY_MAP_FLAG = 2;
  5667. var nativeMin$1 = Math.min;
  5668. function lazyValue() {
  5669. var array = this.__wrapped__.value(), dir = this.__dir__, isArr = isArray$1(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__);
  5670. if (!isArr || !isRight && arrLength == length && takeCount == length) {
  5671. return baseWrapperValue(array, this.__actions__);
  5672. }
  5673. var result = [];
  5674. outer:
  5675. while (length-- && resIndex < takeCount) {
  5676. index += dir;
  5677. var iterIndex = -1, value = array[index];
  5678. while (++iterIndex < iterLength) {
  5679. var data = iteratees[iterIndex], iteratee = data.iteratee, type = data.type, computed = iteratee(value);
  5680. if (type == LAZY_MAP_FLAG) {
  5681. value = computed;
  5682. } else if (!computed) {
  5683. if (type == LAZY_FILTER_FLAG$1) {
  5684. continue outer;
  5685. } else {
  5686. break outer;
  5687. }
  5688. }
  5689. }
  5690. result[resIndex++] = value;
  5691. }
  5692. return result;
  5693. }
  5694. var VERSION = "4.17.21";
  5695. var WRAP_BIND_KEY_FLAG = 2;
  5696. var LAZY_FILTER_FLAG = 1;
  5697. var LAZY_WHILE_FLAG = 3;
  5698. var MAX_ARRAY_LENGTH = 4294967295;
  5699. var arrayProto = Array.prototype;
  5700. var objectProto = Object.prototype;
  5701. var hasOwnProperty$1 = objectProto.hasOwnProperty;
  5702. var symIterator = Symbol$1 ? Symbol$1.iterator : void 0;
  5703. var nativeMax = Math.max;
  5704. var nativeMin = Math.min;
  5705. var mixin = function(func2) {
  5706. return function(object2, source, options) {
  5707. if (options == null) {
  5708. var isObj = isObject$2(source), props = isObj && keys(source), methodNames = props && props.length && baseFunctions(source, props);
  5709. if (!(methodNames ? methodNames.length : isObj)) {
  5710. options = source;
  5711. source = object2;
  5712. object2 = this;
  5713. }
  5714. }
  5715. return func2(object2, source, options);
  5716. };
  5717. }(mixin$1);
  5718. lodash.after = func.after;
  5719. lodash.ary = func.ary;
  5720. lodash.assign = object.assign;
  5721. lodash.assignIn = object.assignIn;
  5722. lodash.assignInWith = object.assignInWith;
  5723. lodash.assignWith = object.assignWith;
  5724. lodash.at = object.at;
  5725. lodash.before = func.before;
  5726. lodash.bind = func.bind;
  5727. lodash.bindAll = util.bindAll;
  5728. lodash.bindKey = func.bindKey;
  5729. lodash.castArray = lang.castArray;
  5730. lodash.chain = seq.chain;
  5731. lodash.chunk = array.chunk;
  5732. lodash.compact = array.compact;
  5733. lodash.concat = array.concat;
  5734. lodash.cond = util.cond;
  5735. lodash.conforms = util.conforms;
  5736. lodash.constant = util.constant;
  5737. lodash.countBy = collection.countBy;
  5738. lodash.create = object.create;
  5739. lodash.curry = func.curry;
  5740. lodash.curryRight = func.curryRight;
  5741. lodash.debounce = func.debounce;
  5742. lodash.defaults = object.defaults;
  5743. lodash.defaultsDeep = object.defaultsDeep;
  5744. lodash.defer = func.defer;
  5745. lodash.delay = func.delay;
  5746. lodash.difference = array.difference;
  5747. lodash.differenceBy = array.differenceBy;
  5748. lodash.differenceWith = array.differenceWith;
  5749. lodash.drop = array.drop;
  5750. lodash.dropRight = array.dropRight;
  5751. lodash.dropRightWhile = array.dropRightWhile;
  5752. lodash.dropWhile = array.dropWhile;
  5753. lodash.fill = array.fill;
  5754. lodash.filter = collection.filter;
  5755. lodash.flatMap = collection.flatMap;
  5756. lodash.flatMapDeep = collection.flatMapDeep;
  5757. lodash.flatMapDepth = collection.flatMapDepth;
  5758. lodash.flatten = array.flatten;
  5759. lodash.flattenDeep = array.flattenDeep;
  5760. lodash.flattenDepth = array.flattenDepth;
  5761. lodash.flip = func.flip;
  5762. lodash.flow = util.flow;
  5763. lodash.flowRight = util.flowRight;
  5764. lodash.fromPairs = array.fromPairs;
  5765. lodash.functions = object.functions;
  5766. lodash.functionsIn = object.functionsIn;
  5767. lodash.groupBy = collection.groupBy;
  5768. lodash.initial = array.initial;
  5769. lodash.intersection = array.intersection;
  5770. lodash.intersectionBy = array.intersectionBy;
  5771. lodash.intersectionWith = array.intersectionWith;
  5772. lodash.invert = object.invert;
  5773. lodash.invertBy = object.invertBy;
  5774. lodash.invokeMap = collection.invokeMap;
  5775. lodash.iteratee = util.iteratee;
  5776. lodash.keyBy = collection.keyBy;
  5777. lodash.keys = keys;
  5778. lodash.keysIn = object.keysIn;
  5779. lodash.map = collection.map;
  5780. lodash.mapKeys = object.mapKeys;
  5781. lodash.mapValues = object.mapValues;
  5782. lodash.matches = util.matches;
  5783. lodash.matchesProperty = util.matchesProperty;
  5784. lodash.memoize = func.memoize;
  5785. lodash.merge = object.merge;
  5786. lodash.mergeWith = object.mergeWith;
  5787. lodash.method = util.method;
  5788. lodash.methodOf = util.methodOf;
  5789. lodash.mixin = mixin;
  5790. lodash.negate = negate;
  5791. lodash.nthArg = util.nthArg;
  5792. lodash.omit = object.omit;
  5793. lodash.omitBy = object.omitBy;
  5794. lodash.once = func.once;
  5795. lodash.orderBy = collection.orderBy;
  5796. lodash.over = util.over;
  5797. lodash.overArgs = func.overArgs;
  5798. lodash.overEvery = util.overEvery;
  5799. lodash.overSome = util.overSome;
  5800. lodash.partial = func.partial;
  5801. lodash.partialRight = func.partialRight;
  5802. lodash.partition = collection.partition;
  5803. lodash.pick = object.pick;
  5804. lodash.pickBy = object.pickBy;
  5805. lodash.property = util.property;
  5806. lodash.propertyOf = util.propertyOf;
  5807. lodash.pull = array.pull;
  5808. lodash.pullAll = array.pullAll;
  5809. lodash.pullAllBy = array.pullAllBy;
  5810. lodash.pullAllWith = array.pullAllWith;
  5811. lodash.pullAt = array.pullAt;
  5812. lodash.range = util.range;
  5813. lodash.rangeRight = util.rangeRight;
  5814. lodash.rearg = func.rearg;
  5815. lodash.reject = collection.reject;
  5816. lodash.remove = array.remove;
  5817. lodash.rest = func.rest;
  5818. lodash.reverse = array.reverse;
  5819. lodash.sampleSize = collection.sampleSize;
  5820. lodash.set = object.set;
  5821. lodash.setWith = object.setWith;
  5822. lodash.shuffle = collection.shuffle;
  5823. lodash.slice = array.slice;
  5824. lodash.sortBy = collection.sortBy;
  5825. lodash.sortedUniq = array.sortedUniq;
  5826. lodash.sortedUniqBy = array.sortedUniqBy;
  5827. lodash.split = string$1.split;
  5828. lodash.spread = func.spread;
  5829. lodash.tail = array.tail;
  5830. lodash.take = array.take;
  5831. lodash.takeRight = array.takeRight;
  5832. lodash.takeRightWhile = array.takeRightWhile;
  5833. lodash.takeWhile = array.takeWhile;
  5834. lodash.tap = seq.tap;
  5835. lodash.throttle = func.throttle;
  5836. lodash.thru = thru;
  5837. lodash.toArray = lang.toArray;
  5838. lodash.toPairs = object.toPairs;
  5839. lodash.toPairsIn = object.toPairsIn;
  5840. lodash.toPath = util.toPath;
  5841. lodash.toPlainObject = lang.toPlainObject;
  5842. lodash.transform = object.transform;
  5843. lodash.unary = func.unary;
  5844. lodash.union = array.union;
  5845. lodash.unionBy = array.unionBy;
  5846. lodash.unionWith = array.unionWith;
  5847. lodash.uniq = array.uniq;
  5848. lodash.uniqBy = array.uniqBy;
  5849. lodash.uniqWith = array.uniqWith;
  5850. lodash.unset = object.unset;
  5851. lodash.unzip = array.unzip;
  5852. lodash.unzipWith = array.unzipWith;
  5853. lodash.update = object.update;
  5854. lodash.updateWith = object.updateWith;
  5855. lodash.values = object.values;
  5856. lodash.valuesIn = object.valuesIn;
  5857. lodash.without = array.without;
  5858. lodash.words = string$1.words;
  5859. lodash.wrap = func.wrap;
  5860. lodash.xor = array.xor;
  5861. lodash.xorBy = array.xorBy;
  5862. lodash.xorWith = array.xorWith;
  5863. lodash.zip = array.zip;
  5864. lodash.zipObject = array.zipObject;
  5865. lodash.zipObjectDeep = array.zipObjectDeep;
  5866. lodash.zipWith = array.zipWith;
  5867. lodash.entries = object.toPairs;
  5868. lodash.entriesIn = object.toPairsIn;
  5869. lodash.extend = object.assignIn;
  5870. lodash.extendWith = object.assignInWith;
  5871. mixin(lodash, lodash);
  5872. lodash.add = math.add;
  5873. lodash.attempt = util.attempt;
  5874. lodash.camelCase = string$1.camelCase;
  5875. lodash.capitalize = string$1.capitalize;
  5876. lodash.ceil = math.ceil;
  5877. lodash.clamp = number.clamp;
  5878. lodash.clone = lang.clone;
  5879. lodash.cloneDeep = lang.cloneDeep;
  5880. lodash.cloneDeepWith = lang.cloneDeepWith;
  5881. lodash.cloneWith = lang.cloneWith;
  5882. lodash.conformsTo = lang.conformsTo;
  5883. lodash.deburr = string$1.deburr;
  5884. lodash.defaultTo = util.defaultTo;
  5885. lodash.divide = math.divide;
  5886. lodash.endsWith = string$1.endsWith;
  5887. lodash.eq = lang.eq;
  5888. lodash.escape = string$1.escape;
  5889. lodash.escapeRegExp = string$1.escapeRegExp;
  5890. lodash.every = collection.every;
  5891. lodash.find = collection.find;
  5892. lodash.findIndex = array.findIndex;
  5893. lodash.findKey = object.findKey;
  5894. lodash.findLast = collection.findLast;
  5895. lodash.findLastIndex = array.findLastIndex;
  5896. lodash.findLastKey = object.findLastKey;
  5897. lodash.floor = math.floor;
  5898. lodash.forEach = collection.forEach;
  5899. lodash.forEachRight = collection.forEachRight;
  5900. lodash.forIn = object.forIn;
  5901. lodash.forInRight = object.forInRight;
  5902. lodash.forOwn = object.forOwn;
  5903. lodash.forOwnRight = object.forOwnRight;
  5904. lodash.get = object.get;
  5905. lodash.gt = lang.gt;
  5906. lodash.gte = lang.gte;
  5907. lodash.has = object.has;
  5908. lodash.hasIn = object.hasIn;
  5909. lodash.head = array.head;
  5910. lodash.identity = identity$1;
  5911. lodash.includes = collection.includes;
  5912. lodash.indexOf = array.indexOf;
  5913. lodash.inRange = number.inRange;
  5914. lodash.invoke = object.invoke;
  5915. lodash.isArguments = lang.isArguments;
  5916. lodash.isArray = isArray$1;
  5917. lodash.isArrayBuffer = lang.isArrayBuffer;
  5918. lodash.isArrayLike = lang.isArrayLike;
  5919. lodash.isArrayLikeObject = lang.isArrayLikeObject;
  5920. lodash.isBoolean = lang.isBoolean;
  5921. lodash.isBuffer = lang.isBuffer;
  5922. lodash.isDate = lang.isDate;
  5923. lodash.isElement = lang.isElement;
  5924. lodash.isEmpty = lang.isEmpty;
  5925. lodash.isEqual = lang.isEqual;
  5926. lodash.isEqualWith = lang.isEqualWith;
  5927. lodash.isError = lang.isError;
  5928. lodash.isFinite = lang.isFinite;
  5929. lodash.isFunction = lang.isFunction;
  5930. lodash.isInteger = lang.isInteger;
  5931. lodash.isLength = lang.isLength;
  5932. lodash.isMap = lang.isMap;
  5933. lodash.isMatch = lang.isMatch;
  5934. lodash.isMatchWith = lang.isMatchWith;
  5935. lodash.isNaN = lang.isNaN;
  5936. lodash.isNative = lang.isNative;
  5937. lodash.isNil = lang.isNil;
  5938. lodash.isNull = lang.isNull;
  5939. lodash.isNumber = lang.isNumber;
  5940. lodash.isObject = isObject$2;
  5941. lodash.isObjectLike = lang.isObjectLike;
  5942. lodash.isPlainObject = lang.isPlainObject;
  5943. lodash.isRegExp = lang.isRegExp;
  5944. lodash.isSafeInteger = lang.isSafeInteger;
  5945. lodash.isSet = lang.isSet;
  5946. lodash.isString = lang.isString;
  5947. lodash.isSymbol = lang.isSymbol;
  5948. lodash.isTypedArray = lang.isTypedArray;
  5949. lodash.isUndefined = lang.isUndefined;
  5950. lodash.isWeakMap = lang.isWeakMap;
  5951. lodash.isWeakSet = lang.isWeakSet;
  5952. lodash.join = array.join;
  5953. lodash.kebabCase = string$1.kebabCase;
  5954. lodash.last = last;
  5955. lodash.lastIndexOf = array.lastIndexOf;
  5956. lodash.lowerCase = string$1.lowerCase;
  5957. lodash.lowerFirst = string$1.lowerFirst;
  5958. lodash.lt = lang.lt;
  5959. lodash.lte = lang.lte;
  5960. lodash.max = math.max;
  5961. lodash.maxBy = math.maxBy;
  5962. lodash.mean = math.mean;
  5963. lodash.meanBy = math.meanBy;
  5964. lodash.min = math.min;
  5965. lodash.minBy = math.minBy;
  5966. lodash.stubArray = util.stubArray;
  5967. lodash.stubFalse = util.stubFalse;
  5968. lodash.stubObject = util.stubObject;
  5969. lodash.stubString = util.stubString;
  5970. lodash.stubTrue = util.stubTrue;
  5971. lodash.multiply = math.multiply;
  5972. lodash.nth = array.nth;
  5973. lodash.noop = util.noop;
  5974. lodash.now = date$1.now;
  5975. lodash.pad = string$1.pad;
  5976. lodash.padEnd = string$1.padEnd;
  5977. lodash.padStart = string$1.padStart;
  5978. lodash.parseInt = string$1.parseInt;
  5979. lodash.random = number.random;
  5980. lodash.reduce = collection.reduce;
  5981. lodash.reduceRight = collection.reduceRight;
  5982. lodash.repeat = string$1.repeat;
  5983. lodash.replace = string$1.replace;
  5984. lodash.result = object.result;
  5985. lodash.round = math.round;
  5986. lodash.sample = collection.sample;
  5987. lodash.size = collection.size;
  5988. lodash.snakeCase = string$1.snakeCase;
  5989. lodash.some = collection.some;
  5990. lodash.sortedIndex = array.sortedIndex;
  5991. lodash.sortedIndexBy = array.sortedIndexBy;
  5992. lodash.sortedIndexOf = array.sortedIndexOf;
  5993. lodash.sortedLastIndex = array.sortedLastIndex;
  5994. lodash.sortedLastIndexBy = array.sortedLastIndexBy;
  5995. lodash.sortedLastIndexOf = array.sortedLastIndexOf;
  5996. lodash.startCase = string$1.startCase;
  5997. lodash.startsWith = string$1.startsWith;
  5998. lodash.subtract = math.subtract;
  5999. lodash.sum = math.sum;
  6000. lodash.sumBy = math.sumBy;
  6001. lodash.template = string$1.template;
  6002. lodash.times = util.times;
  6003. lodash.toFinite = lang.toFinite;
  6004. lodash.toInteger = toInteger;
  6005. lodash.toLength = lang.toLength;
  6006. lodash.toLower = string$1.toLower;
  6007. lodash.toNumber = lang.toNumber;
  6008. lodash.toSafeInteger = lang.toSafeInteger;
  6009. lodash.toString = lang.toString;
  6010. lodash.toUpper = string$1.toUpper;
  6011. lodash.trim = string$1.trim;
  6012. lodash.trimEnd = string$1.trimEnd;
  6013. lodash.trimStart = string$1.trimStart;
  6014. lodash.truncate = string$1.truncate;
  6015. lodash.unescape = string$1.unescape;
  6016. lodash.uniqueId = util.uniqueId;
  6017. lodash.upperCase = string$1.upperCase;
  6018. lodash.upperFirst = string$1.upperFirst;
  6019. lodash.each = collection.forEach;
  6020. lodash.eachRight = collection.forEachRight;
  6021. lodash.first = array.head;
  6022. mixin(lodash, function() {
  6023. var source = {};
  6024. baseForOwn(lodash, function(func2, methodName) {
  6025. if (!hasOwnProperty$1.call(lodash.prototype, methodName)) {
  6026. source[methodName] = func2;
  6027. }
  6028. });
  6029. return source;
  6030. }(), { "chain": false });
  6031. lodash.VERSION = VERSION;
  6032. (lodash.templateSettings = string$1.templateSettings).imports._ = lodash;
  6033. arrayEach(["bind", "bindKey", "curry", "curryRight", "partial", "partialRight"], function(methodName) {
  6034. lodash[methodName].placeholder = lodash;
  6035. });
  6036. arrayEach(["drop", "take"], function(methodName, index) {
  6037. LazyWrapper.prototype[methodName] = function(n) {
  6038. n = n === void 0 ? 1 : nativeMax(toInteger(n), 0);
  6039. var result = this.__filtered__ && !index ? new LazyWrapper(this) : this.clone();
  6040. if (result.__filtered__) {
  6041. result.__takeCount__ = nativeMin(n, result.__takeCount__);
  6042. } else {
  6043. result.__views__.push({
  6044. "size": nativeMin(n, MAX_ARRAY_LENGTH),
  6045. "type": methodName + (result.__dir__ < 0 ? "Right" : "")
  6046. });
  6047. }
  6048. return result;
  6049. };
  6050. LazyWrapper.prototype[methodName + "Right"] = function(n) {
  6051. return this.reverse()[methodName](n).reverse();
  6052. };
  6053. });
  6054. arrayEach(["filter", "map", "takeWhile"], function(methodName, index) {
  6055. var type = index + 1, isFilter = type == LAZY_FILTER_FLAG || type == LAZY_WHILE_FLAG;
  6056. LazyWrapper.prototype[methodName] = function(iteratee) {
  6057. var result = this.clone();
  6058. result.__iteratees__.push({
  6059. "iteratee": baseIteratee(iteratee),
  6060. "type": type
  6061. });
  6062. result.__filtered__ = result.__filtered__ || isFilter;
  6063. return result;
  6064. };
  6065. });
  6066. arrayEach(["head", "last"], function(methodName, index) {
  6067. var takeName = "take" + (index ? "Right" : "");
  6068. LazyWrapper.prototype[methodName] = function() {
  6069. return this[takeName](1).value()[0];
  6070. };
  6071. });
  6072. arrayEach(["initial", "tail"], function(methodName, index) {
  6073. var dropName = "drop" + (index ? "" : "Right");
  6074. LazyWrapper.prototype[methodName] = function() {
  6075. return this.__filtered__ ? new LazyWrapper(this) : this[dropName](1);
  6076. };
  6077. });
  6078. LazyWrapper.prototype.compact = function() {
  6079. return this.filter(identity$1);
  6080. };
  6081. LazyWrapper.prototype.find = function(predicate) {
  6082. return this.filter(predicate).head();
  6083. };
  6084. LazyWrapper.prototype.findLast = function(predicate) {
  6085. return this.reverse().find(predicate);
  6086. };
  6087. LazyWrapper.prototype.invokeMap = baseRest(function(path, args) {
  6088. if (typeof path == "function") {
  6089. return new LazyWrapper(this);
  6090. }
  6091. return this.map(function(value) {
  6092. return baseInvoke(value, path, args);
  6093. });
  6094. });
  6095. LazyWrapper.prototype.reject = function(predicate) {
  6096. return this.filter(negate(baseIteratee(predicate)));
  6097. };
  6098. LazyWrapper.prototype.slice = function(start, end) {
  6099. start = toInteger(start);
  6100. var result = this;
  6101. if (result.__filtered__ && (start > 0 || end < 0)) {
  6102. return new LazyWrapper(result);
  6103. }
  6104. if (start < 0) {
  6105. result = result.takeRight(-start);
  6106. } else if (start) {
  6107. result = result.drop(start);
  6108. }
  6109. if (end !== void 0) {
  6110. end = toInteger(end);
  6111. result = end < 0 ? result.dropRight(-end) : result.take(end - start);
  6112. }
  6113. return result;
  6114. };
  6115. LazyWrapper.prototype.takeRightWhile = function(predicate) {
  6116. return this.reverse().takeWhile(predicate).reverse();
  6117. };
  6118. LazyWrapper.prototype.toArray = function() {
  6119. return this.take(MAX_ARRAY_LENGTH);
  6120. };
  6121. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  6122. 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);
  6123. if (!lodashFunc) {
  6124. return;
  6125. }
  6126. lodash.prototype[methodName] = function() {
  6127. var value = this.__wrapped__, args = isTaker ? [1] : arguments, isLazy = value instanceof LazyWrapper, iteratee = args[0], useLazy = isLazy || isArray$1(value);
  6128. var interceptor = function(value2) {
  6129. var result2 = lodashFunc.apply(lodash, arrayPush([value2], args));
  6130. return isTaker && chainAll ? result2[0] : result2;
  6131. };
  6132. if (useLazy && checkIteratee && typeof iteratee == "function" && iteratee.length != 1) {
  6133. isLazy = useLazy = false;
  6134. }
  6135. var chainAll = this.__chain__, isHybrid = !!this.__actions__.length, isUnwrapped = retUnwrapped && !chainAll, onlyLazy = isLazy && !isHybrid;
  6136. if (!retUnwrapped && useLazy) {
  6137. value = onlyLazy ? value : new LazyWrapper(this);
  6138. var result = func2.apply(value, args);
  6139. result.__actions__.push({ "func": thru, "args": [interceptor], "thisArg": void 0 });
  6140. return new LodashWrapper(result, chainAll);
  6141. }
  6142. if (isUnwrapped && onlyLazy) {
  6143. return func2.apply(this, args);
  6144. }
  6145. result = this.thru(interceptor);
  6146. return isUnwrapped ? isTaker ? result.value()[0] : result.value() : result;
  6147. };
  6148. });
  6149. arrayEach(["pop", "push", "shift", "sort", "splice", "unshift"], function(methodName) {
  6150. var func2 = arrayProto[methodName], chainName = /^(?:push|sort|unshift)$/.test(methodName) ? "tap" : "thru", retUnwrapped = /^(?:pop|shift)$/.test(methodName);
  6151. lodash.prototype[methodName] = function() {
  6152. var args = arguments;
  6153. if (retUnwrapped && !this.__chain__) {
  6154. var value = this.value();
  6155. return func2.apply(isArray$1(value) ? value : [], args);
  6156. }
  6157. return this[chainName](function(value2) {
  6158. return func2.apply(isArray$1(value2) ? value2 : [], args);
  6159. });
  6160. };
  6161. });
  6162. baseForOwn(LazyWrapper.prototype, function(func2, methodName) {
  6163. var lodashFunc = lodash[methodName];
  6164. if (lodashFunc) {
  6165. var key = lodashFunc.name + "";
  6166. if (!hasOwnProperty$1.call(realNames, key)) {
  6167. realNames[key] = [];
  6168. }
  6169. realNames[key].push({ "name": methodName, "func": lodashFunc });
  6170. }
  6171. });
  6172. realNames[createHybrid(void 0, WRAP_BIND_KEY_FLAG).name] = [{
  6173. "name": "wrapper",
  6174. "func": void 0
  6175. }];
  6176. LazyWrapper.prototype.clone = lazyClone;
  6177. LazyWrapper.prototype.reverse = lazyReverse;
  6178. LazyWrapper.prototype.value = lazyValue;
  6179. lodash.prototype.at = seq.at;
  6180. lodash.prototype.chain = seq.wrapperChain;
  6181. lodash.prototype.commit = seq.commit;
  6182. lodash.prototype.next = seq.next;
  6183. lodash.prototype.plant = seq.plant;
  6184. lodash.prototype.reverse = seq.reverse;
  6185. lodash.prototype.toJSON = lodash.prototype.valueOf = lodash.prototype.value = seq.value;
  6186. lodash.prototype.first = lodash.prototype.head;
  6187. if (symIterator) {
  6188. lodash.prototype[symIterator] = seq.toIterator;
  6189. }
  6190. /**
  6191. * @license
  6192. * Lodash (Custom Build) <https://lodash.com/>
  6193. * Build: `lodash modularize exports="es" -o ./`
  6194. * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
  6195. * Released under MIT license <https://lodash.com/license>
  6196. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  6197. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  6198. */
  6199. 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])`;
  6200. const isVisible = (element) => {
  6201. const computed = getComputedStyle(element);
  6202. return computed.position === "fixed" ? false : element.offsetParent !== null;
  6203. };
  6204. const obtainAllFocusableElements$1 = (element) => {
  6205. return Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((item) => isFocusable(item) && isVisible(item));
  6206. };
  6207. const isFocusable = (element) => {
  6208. if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) {
  6209. return true;
  6210. }
  6211. if (element.disabled) {
  6212. return false;
  6213. }
  6214. switch (element.nodeName) {
  6215. case "A": {
  6216. return !!element.href && element.rel !== "ignore";
  6217. }
  6218. case "INPUT": {
  6219. return !(element.type === "hidden" || element.type === "file");
  6220. }
  6221. case "BUTTON":
  6222. case "SELECT":
  6223. case "TEXTAREA": {
  6224. return true;
  6225. }
  6226. default: {
  6227. return false;
  6228. }
  6229. }
  6230. };
  6231. const triggerEvent = function(elm, name, ...opts) {
  6232. let eventName;
  6233. if (name.includes("mouse") || name.includes("click")) {
  6234. eventName = "MouseEvents";
  6235. } else if (name.includes("key")) {
  6236. eventName = "KeyboardEvent";
  6237. } else {
  6238. eventName = "HTMLEvents";
  6239. }
  6240. const evt = document.createEvent(eventName);
  6241. evt.initEvent(name, ...opts);
  6242. elm.dispatchEvent(evt);
  6243. return elm;
  6244. };
  6245. const isLeaf = (el) => !el.getAttribute("aria-owns");
  6246. const getSibling = (el, distance, elClass) => {
  6247. const { parentNode } = el;
  6248. if (!parentNode)
  6249. return null;
  6250. const siblings = parentNode.querySelectorAll(elClass);
  6251. const index = Array.prototype.indexOf.call(siblings, el);
  6252. return siblings[index + distance] || null;
  6253. };
  6254. const focusNode = (el) => {
  6255. if (!el)
  6256. return;
  6257. el.focus();
  6258. !isLeaf(el) && el.click();
  6259. };
  6260. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  6261. const handleEvent = (event) => {
  6262. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event);
  6263. if (checkForDefaultPrevented === false || !shouldPrevent) {
  6264. return oursHandler == null ? void 0 : oursHandler(event);
  6265. }
  6266. };
  6267. return handleEvent;
  6268. };
  6269. const whenMouse = (handler) => {
  6270. return (e) => e.pointerType === "mouse" ? handler(e) : void 0;
  6271. };
  6272. var __defProp$9 = Object.defineProperty;
  6273. var __defProps$6 = Object.defineProperties;
  6274. var __getOwnPropDescs$6 = Object.getOwnPropertyDescriptors;
  6275. var __getOwnPropSymbols$b = Object.getOwnPropertySymbols;
  6276. var __hasOwnProp$b = Object.prototype.hasOwnProperty;
  6277. var __propIsEnum$b = Object.prototype.propertyIsEnumerable;
  6278. var __defNormalProp$9 = (obj, key, value) => key in obj ? __defProp$9(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  6279. var __spreadValues$9 = (a, b) => {
  6280. for (var prop in b || (b = {}))
  6281. if (__hasOwnProp$b.call(b, prop))
  6282. __defNormalProp$9(a, prop, b[prop]);
  6283. if (__getOwnPropSymbols$b)
  6284. for (var prop of __getOwnPropSymbols$b(b)) {
  6285. if (__propIsEnum$b.call(b, prop))
  6286. __defNormalProp$9(a, prop, b[prop]);
  6287. }
  6288. return a;
  6289. };
  6290. var __spreadProps$6 = (a, b) => __defProps$6(a, __getOwnPropDescs$6(b));
  6291. function computedEager(fn, options) {
  6292. var _a;
  6293. const result = vue.shallowRef();
  6294. vue.watchEffect(() => {
  6295. result.value = fn();
  6296. }, __spreadProps$6(__spreadValues$9({}, options), {
  6297. flush: (_a = options == null ? void 0 : options.flush) != null ? _a : "sync"
  6298. }));
  6299. return vue.readonly(result);
  6300. }
  6301. var _a;
  6302. const isClient = typeof window !== "undefined";
  6303. const isDef = (val) => typeof val !== "undefined";
  6304. const isBoolean = (val) => typeof val === "boolean";
  6305. const isNumber = (val) => typeof val === "number";
  6306. const isString$1 = (val) => typeof val === "string";
  6307. const noop = () => {
  6308. };
  6309. isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  6310. function resolveUnref(r) {
  6311. return typeof r === "function" ? r() : vue.unref(r);
  6312. }
  6313. function createFilterWrapper(filter, fn) {
  6314. function wrapper(...args) {
  6315. filter(() => fn.apply(this, args), { fn, thisArg: this, args });
  6316. }
  6317. return wrapper;
  6318. }
  6319. function debounceFilter(ms, options = {}) {
  6320. let timer;
  6321. let maxTimer;
  6322. const filter = (invoke) => {
  6323. const duration = resolveUnref(ms);
  6324. const maxDuration = resolveUnref(options.maxWait);
  6325. if (timer)
  6326. clearTimeout(timer);
  6327. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  6328. if (maxTimer) {
  6329. clearTimeout(maxTimer);
  6330. maxTimer = null;
  6331. }
  6332. return invoke();
  6333. }
  6334. if (maxDuration && !maxTimer) {
  6335. maxTimer = setTimeout(() => {
  6336. if (timer)
  6337. clearTimeout(timer);
  6338. maxTimer = null;
  6339. invoke();
  6340. }, maxDuration);
  6341. }
  6342. timer = setTimeout(() => {
  6343. if (maxTimer)
  6344. clearTimeout(maxTimer);
  6345. maxTimer = null;
  6346. invoke();
  6347. }, duration);
  6348. };
  6349. return filter;
  6350. }
  6351. function throttleFilter(ms, trailing = true, leading = true) {
  6352. let lastExec = 0;
  6353. let timer;
  6354. let isLeading = true;
  6355. const clear = () => {
  6356. if (timer) {
  6357. clearTimeout(timer);
  6358. timer = void 0;
  6359. }
  6360. };
  6361. const filter = (invoke) => {
  6362. const duration = resolveUnref(ms);
  6363. const elapsed = Date.now() - lastExec;
  6364. clear();
  6365. if (duration <= 0) {
  6366. lastExec = Date.now();
  6367. return invoke();
  6368. }
  6369. if (elapsed > duration && (leading || !isLeading)) {
  6370. lastExec = Date.now();
  6371. invoke();
  6372. } else if (trailing) {
  6373. timer = setTimeout(() => {
  6374. lastExec = Date.now();
  6375. isLeading = true;
  6376. clear();
  6377. invoke();
  6378. }, duration);
  6379. }
  6380. if (!leading && !timer)
  6381. timer = setTimeout(() => isLeading = true, duration);
  6382. isLeading = false;
  6383. };
  6384. return filter;
  6385. }
  6386. function identity(arg) {
  6387. return arg;
  6388. }
  6389. function tryOnScopeDispose(fn) {
  6390. if (vue.getCurrentScope()) {
  6391. vue.onScopeDispose(fn);
  6392. return true;
  6393. }
  6394. return false;
  6395. }
  6396. function useDebounceFn(fn, ms = 200, options = {}) {
  6397. return createFilterWrapper(debounceFilter(ms, options), fn);
  6398. }
  6399. function refDebounced(value, ms = 200, options = {}) {
  6400. if (ms <= 0)
  6401. return value;
  6402. const debounced = vue.ref(value.value);
  6403. const updater = useDebounceFn(() => {
  6404. debounced.value = value.value;
  6405. }, ms, options);
  6406. vue.watch(value, () => updater());
  6407. return debounced;
  6408. }
  6409. function useThrottleFn(fn, ms = 200, trailing = false, leading = true) {
  6410. return createFilterWrapper(throttleFilter(ms, trailing, leading), fn);
  6411. }
  6412. function tryOnMounted(fn, sync = true) {
  6413. if (vue.getCurrentInstance())
  6414. vue.onMounted(fn);
  6415. else if (sync)
  6416. fn();
  6417. else
  6418. vue.nextTick(fn);
  6419. }
  6420. function useTimeoutFn(cb, interval, options = {}) {
  6421. const {
  6422. immediate = true
  6423. } = options;
  6424. const isPending = vue.ref(false);
  6425. let timer = null;
  6426. function clear() {
  6427. if (timer) {
  6428. clearTimeout(timer);
  6429. timer = null;
  6430. }
  6431. }
  6432. function stop() {
  6433. isPending.value = false;
  6434. clear();
  6435. }
  6436. function start(...args) {
  6437. clear();
  6438. isPending.value = true;
  6439. timer = setTimeout(() => {
  6440. isPending.value = false;
  6441. timer = null;
  6442. cb(...args);
  6443. }, resolveUnref(interval));
  6444. }
  6445. if (immediate) {
  6446. isPending.value = true;
  6447. if (isClient)
  6448. start();
  6449. }
  6450. tryOnScopeDispose(stop);
  6451. return {
  6452. isPending,
  6453. start,
  6454. stop
  6455. };
  6456. }
  6457. function unrefElement(elRef) {
  6458. var _a;
  6459. const plain = resolveUnref(elRef);
  6460. return (_a = plain == null ? void 0 : plain.$el) != null ? _a : plain;
  6461. }
  6462. const defaultWindow = isClient ? window : void 0;
  6463. const defaultDocument = isClient ? window.document : void 0;
  6464. function useEventListener(...args) {
  6465. let target;
  6466. let event;
  6467. let listener;
  6468. let options;
  6469. if (isString$1(args[0])) {
  6470. [event, listener, options] = args;
  6471. target = defaultWindow;
  6472. } else {
  6473. [target, event, listener, options] = args;
  6474. }
  6475. if (!target)
  6476. return noop;
  6477. let cleanup = noop;
  6478. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  6479. cleanup();
  6480. if (!el)
  6481. return;
  6482. el.addEventListener(event, listener, options);
  6483. cleanup = () => {
  6484. el.removeEventListener(event, listener, options);
  6485. cleanup = noop;
  6486. };
  6487. }, { immediate: true, flush: "post" });
  6488. const stop = () => {
  6489. stopWatch();
  6490. cleanup();
  6491. };
  6492. tryOnScopeDispose(stop);
  6493. return stop;
  6494. }
  6495. function onClickOutside(target, handler, options = {}) {
  6496. const { window = defaultWindow, ignore, capture = true, detectIframe = false } = options;
  6497. if (!window)
  6498. return;
  6499. const shouldListen = vue.ref(true);
  6500. let fallback;
  6501. const listener = (event) => {
  6502. window.clearTimeout(fallback);
  6503. const el = unrefElement(target);
  6504. const composedPath = event.composedPath();
  6505. if (!el || el === event.target || composedPath.includes(el) || !shouldListen.value)
  6506. return;
  6507. if (ignore && ignore.length > 0) {
  6508. if (ignore.some((target2) => {
  6509. const el2 = unrefElement(target2);
  6510. return el2 && (event.target === el2 || composedPath.includes(el2));
  6511. }))
  6512. return;
  6513. }
  6514. handler(event);
  6515. };
  6516. const cleanup = [
  6517. useEventListener(window, "click", listener, { passive: true, capture }),
  6518. useEventListener(window, "pointerdown", (e) => {
  6519. const el = unrefElement(target);
  6520. shouldListen.value = !!el && !e.composedPath().includes(el);
  6521. }, { passive: true }),
  6522. useEventListener(window, "pointerup", (e) => {
  6523. if (e.button === 0) {
  6524. const path = e.composedPath();
  6525. e.composedPath = () => path;
  6526. fallback = window.setTimeout(() => listener(e), 50);
  6527. }
  6528. }, { passive: true }),
  6529. detectIframe && useEventListener(window, "blur", (event) => {
  6530. var _a;
  6531. const el = unrefElement(target);
  6532. if (((_a = document.activeElement) == null ? void 0 : _a.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(document.activeElement)))
  6533. handler(event);
  6534. })
  6535. ].filter(Boolean);
  6536. const stop = () => cleanup.forEach((fn) => fn());
  6537. return stop;
  6538. }
  6539. function useSupported(callback, sync = false) {
  6540. const isSupported = vue.ref();
  6541. const update = () => isSupported.value = Boolean(callback());
  6542. update();
  6543. tryOnMounted(update, sync);
  6544. return isSupported;
  6545. }
  6546. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  6547. const globalKey = "__vueuse_ssr_handlers__";
  6548. _global[globalKey] = _global[globalKey] || {};
  6549. _global[globalKey];
  6550. function useCssVar(prop, target, { window = defaultWindow, initialValue = "" } = {}) {
  6551. const variable = vue.ref(initialValue);
  6552. const elRef = vue.computed(() => {
  6553. var _a;
  6554. return unrefElement(target) || ((_a = window == null ? void 0 : window.document) == null ? void 0 : _a.documentElement);
  6555. });
  6556. vue.watch([elRef, () => resolveUnref(prop)], ([el, prop2]) => {
  6557. var _a;
  6558. if (el && window) {
  6559. const value = (_a = window.getComputedStyle(el).getPropertyValue(prop2)) == null ? void 0 : _a.trim();
  6560. variable.value = value || initialValue;
  6561. }
  6562. }, { immediate: true });
  6563. vue.watch(variable, (val) => {
  6564. var _a;
  6565. if ((_a = elRef.value) == null ? void 0 : _a.style)
  6566. elRef.value.style.setProperty(resolveUnref(prop), val);
  6567. });
  6568. return variable;
  6569. }
  6570. function useDocumentVisibility({ document = defaultDocument } = {}) {
  6571. if (!document)
  6572. return vue.ref("visible");
  6573. const visibility = vue.ref(document.visibilityState);
  6574. useEventListener(document, "visibilitychange", () => {
  6575. visibility.value = document.visibilityState;
  6576. });
  6577. return visibility;
  6578. }
  6579. var __getOwnPropSymbols$f = Object.getOwnPropertySymbols;
  6580. var __hasOwnProp$f = Object.prototype.hasOwnProperty;
  6581. var __propIsEnum$f = Object.prototype.propertyIsEnumerable;
  6582. var __objRest$2 = (source, exclude) => {
  6583. var target = {};
  6584. for (var prop in source)
  6585. if (__hasOwnProp$f.call(source, prop) && exclude.indexOf(prop) < 0)
  6586. target[prop] = source[prop];
  6587. if (source != null && __getOwnPropSymbols$f)
  6588. for (var prop of __getOwnPropSymbols$f(source)) {
  6589. if (exclude.indexOf(prop) < 0 && __propIsEnum$f.call(source, prop))
  6590. target[prop] = source[prop];
  6591. }
  6592. return target;
  6593. };
  6594. function useResizeObserver(target, callback, options = {}) {
  6595. const _a = options, { window = defaultWindow } = _a, observerOptions = __objRest$2(_a, ["window"]);
  6596. let observer;
  6597. const isSupported = useSupported(() => window && "ResizeObserver" in window);
  6598. const cleanup = () => {
  6599. if (observer) {
  6600. observer.disconnect();
  6601. observer = void 0;
  6602. }
  6603. };
  6604. const stopWatch = vue.watch(() => unrefElement(target), (el) => {
  6605. cleanup();
  6606. if (isSupported.value && window && el) {
  6607. observer = new ResizeObserver(callback);
  6608. observer.observe(el, observerOptions);
  6609. }
  6610. }, { immediate: true, flush: "post" });
  6611. const stop = () => {
  6612. cleanup();
  6613. stopWatch();
  6614. };
  6615. tryOnScopeDispose(stop);
  6616. return {
  6617. isSupported,
  6618. stop
  6619. };
  6620. }
  6621. function useElementBounding(target, options = {}) {
  6622. const {
  6623. reset = true,
  6624. windowResize = true,
  6625. windowScroll = true,
  6626. immediate = true
  6627. } = options;
  6628. const height = vue.ref(0);
  6629. const bottom = vue.ref(0);
  6630. const left = vue.ref(0);
  6631. const right = vue.ref(0);
  6632. const top = vue.ref(0);
  6633. const width = vue.ref(0);
  6634. const x = vue.ref(0);
  6635. const y = vue.ref(0);
  6636. function update() {
  6637. const el = unrefElement(target);
  6638. if (!el) {
  6639. if (reset) {
  6640. height.value = 0;
  6641. bottom.value = 0;
  6642. left.value = 0;
  6643. right.value = 0;
  6644. top.value = 0;
  6645. width.value = 0;
  6646. x.value = 0;
  6647. y.value = 0;
  6648. }
  6649. return;
  6650. }
  6651. const rect = el.getBoundingClientRect();
  6652. height.value = rect.height;
  6653. bottom.value = rect.bottom;
  6654. left.value = rect.left;
  6655. right.value = rect.right;
  6656. top.value = rect.top;
  6657. width.value = rect.width;
  6658. x.value = rect.x;
  6659. y.value = rect.y;
  6660. }
  6661. useResizeObserver(target, update);
  6662. vue.watch(() => unrefElement(target), (ele) => !ele && update());
  6663. if (windowScroll)
  6664. useEventListener("scroll", update, { passive: true });
  6665. if (windowResize)
  6666. useEventListener("resize", update, { passive: true });
  6667. tryOnMounted(() => {
  6668. if (immediate)
  6669. update();
  6670. });
  6671. return {
  6672. height,
  6673. bottom,
  6674. left,
  6675. right,
  6676. top,
  6677. width,
  6678. x,
  6679. y,
  6680. update
  6681. };
  6682. }
  6683. var SwipeDirection;
  6684. (function(SwipeDirection2) {
  6685. SwipeDirection2["UP"] = "UP";
  6686. SwipeDirection2["RIGHT"] = "RIGHT";
  6687. SwipeDirection2["DOWN"] = "DOWN";
  6688. SwipeDirection2["LEFT"] = "LEFT";
  6689. SwipeDirection2["NONE"] = "NONE";
  6690. })(SwipeDirection || (SwipeDirection = {}));
  6691. var __defProp = Object.defineProperty;
  6692. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  6693. var __hasOwnProp = Object.prototype.hasOwnProperty;
  6694. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  6695. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  6696. var __spreadValues = (a, b) => {
  6697. for (var prop in b || (b = {}))
  6698. if (__hasOwnProp.call(b, prop))
  6699. __defNormalProp(a, prop, b[prop]);
  6700. if (__getOwnPropSymbols)
  6701. for (var prop of __getOwnPropSymbols(b)) {
  6702. if (__propIsEnum.call(b, prop))
  6703. __defNormalProp(a, prop, b[prop]);
  6704. }
  6705. return a;
  6706. };
  6707. const _TransitionPresets = {
  6708. easeInSine: [0.12, 0, 0.39, 0],
  6709. easeOutSine: [0.61, 1, 0.88, 1],
  6710. easeInOutSine: [0.37, 0, 0.63, 1],
  6711. easeInQuad: [0.11, 0, 0.5, 0],
  6712. easeOutQuad: [0.5, 1, 0.89, 1],
  6713. easeInOutQuad: [0.45, 0, 0.55, 1],
  6714. easeInCubic: [0.32, 0, 0.67, 0],
  6715. easeOutCubic: [0.33, 1, 0.68, 1],
  6716. easeInOutCubic: [0.65, 0, 0.35, 1],
  6717. easeInQuart: [0.5, 0, 0.75, 0],
  6718. easeOutQuart: [0.25, 1, 0.5, 1],
  6719. easeInOutQuart: [0.76, 0, 0.24, 1],
  6720. easeInQuint: [0.64, 0, 0.78, 0],
  6721. easeOutQuint: [0.22, 1, 0.36, 1],
  6722. easeInOutQuint: [0.83, 0, 0.17, 1],
  6723. easeInExpo: [0.7, 0, 0.84, 0],
  6724. easeOutExpo: [0.16, 1, 0.3, 1],
  6725. easeInOutExpo: [0.87, 0, 0.13, 1],
  6726. easeInCirc: [0.55, 0, 1, 0.45],
  6727. easeOutCirc: [0, 0.55, 0.45, 1],
  6728. easeInOutCirc: [0.85, 0, 0.15, 1],
  6729. easeInBack: [0.36, 0, 0.66, -0.56],
  6730. easeOutBack: [0.34, 1.56, 0.64, 1],
  6731. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  6732. };
  6733. __spreadValues({
  6734. linear: identity
  6735. }, _TransitionPresets);
  6736. function useVModel(props, key, emit, options = {}) {
  6737. var _a, _b, _c;
  6738. const {
  6739. passive = false,
  6740. eventName,
  6741. deep = false,
  6742. defaultValue
  6743. } = options;
  6744. const vm = vue.getCurrentInstance();
  6745. 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));
  6746. let event = eventName;
  6747. if (!key) {
  6748. {
  6749. key = "modelValue";
  6750. }
  6751. }
  6752. event = eventName || event || `update:${key.toString()}`;
  6753. const getValue = () => isDef(props[key]) ? props[key] : defaultValue;
  6754. if (passive) {
  6755. const proxy = vue.ref(getValue());
  6756. vue.watch(() => props[key], (v) => proxy.value = v);
  6757. vue.watch(proxy, (v) => {
  6758. if (v !== props[key] || deep)
  6759. _emit(event, v);
  6760. }, {
  6761. deep
  6762. });
  6763. return proxy;
  6764. } else {
  6765. return vue.computed({
  6766. get() {
  6767. return getValue();
  6768. },
  6769. set(value) {
  6770. _emit(event, value);
  6771. }
  6772. });
  6773. }
  6774. }
  6775. function useWindowFocus({ window = defaultWindow } = {}) {
  6776. if (!window)
  6777. return vue.ref(false);
  6778. const focused = vue.ref(window.document.hasFocus());
  6779. useEventListener(window, "blur", () => {
  6780. focused.value = false;
  6781. });
  6782. useEventListener(window, "focus", () => {
  6783. focused.value = true;
  6784. });
  6785. return focused;
  6786. }
  6787. function useWindowSize(options = {}) {
  6788. const {
  6789. window = defaultWindow,
  6790. initialWidth = Infinity,
  6791. initialHeight = Infinity,
  6792. listenOrientation = true
  6793. } = options;
  6794. const width = vue.ref(initialWidth);
  6795. const height = vue.ref(initialHeight);
  6796. const update = () => {
  6797. if (window) {
  6798. width.value = window.innerWidth;
  6799. height.value = window.innerHeight;
  6800. }
  6801. };
  6802. update();
  6803. tryOnMounted(update);
  6804. useEventListener("resize", update, { passive: true });
  6805. if (listenOrientation)
  6806. useEventListener("orientationchange", update, { passive: true });
  6807. return { width, height };
  6808. }
  6809. const isInContainer = (el, container) => {
  6810. if (!isClient || !el || !container)
  6811. return false;
  6812. const elRect = el.getBoundingClientRect();
  6813. let containerRect;
  6814. if (container instanceof Element) {
  6815. containerRect = container.getBoundingClientRect();
  6816. } else {
  6817. containerRect = {
  6818. top: 0,
  6819. right: window.innerWidth,
  6820. bottom: window.innerHeight,
  6821. left: 0
  6822. };
  6823. }
  6824. return elRect.top < containerRect.bottom && elRect.bottom > containerRect.top && elRect.right > containerRect.left && elRect.left < containerRect.right;
  6825. };
  6826. const getOffsetTop = (el) => {
  6827. let offset = 0;
  6828. let parent = el;
  6829. while (parent) {
  6830. offset += parent.offsetTop;
  6831. parent = parent.offsetParent;
  6832. }
  6833. return offset;
  6834. };
  6835. const getOffsetTopDistance = (el, containerEl) => {
  6836. return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl));
  6837. };
  6838. const getClientXY = (event) => {
  6839. let clientX;
  6840. let clientY;
  6841. if (event.type === "touchend") {
  6842. clientY = event.changedTouches[0].clientY;
  6843. clientX = event.changedTouches[0].clientX;
  6844. } else if (event.type.startsWith("touch")) {
  6845. clientY = event.touches[0].clientY;
  6846. clientX = event.touches[0].clientX;
  6847. } else {
  6848. clientY = event.clientY;
  6849. clientX = event.clientX;
  6850. }
  6851. return {
  6852. clientX,
  6853. clientY
  6854. };
  6855. };
  6856. const NOOP = () => {
  6857. };
  6858. const hasOwnProperty = Object.prototype.hasOwnProperty;
  6859. const hasOwn = (val, key) => hasOwnProperty.call(val, key);
  6860. const isArray = Array.isArray;
  6861. const isDate = (val) => toTypeString(val) === "[object Date]";
  6862. const isFunction = (val) => typeof val === "function";
  6863. const isString = (val) => typeof val === "string";
  6864. const isObject$1 = (val) => val !== null && typeof val === "object";
  6865. const isPromise = (val) => {
  6866. return isObject$1(val) && isFunction(val.then) && isFunction(val.catch);
  6867. };
  6868. const objectToString = Object.prototype.toString;
  6869. const toTypeString = (value) => objectToString.call(value);
  6870. const toRawType = (value) => {
  6871. return toTypeString(value).slice(8, -1);
  6872. };
  6873. const cacheStringFunction = (fn) => {
  6874. const cache = /* @__PURE__ */ Object.create(null);
  6875. return (str) => {
  6876. const hit = cache[str];
  6877. return hit || (cache[str] = fn(str));
  6878. };
  6879. };
  6880. const camelizeRE = /-(\w)/g;
  6881. const camelize = cacheStringFunction((str) => {
  6882. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  6883. });
  6884. const hyphenateRE = /\B([A-Z])/g;
  6885. const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
  6886. const capitalize$1 = cacheStringFunction((str) => str.charAt(0).toUpperCase() + str.slice(1));
  6887. const isUndefined = (val) => val === void 0;
  6888. const isEmpty = (val) => !val && val !== 0 || isArray(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  6889. const isElement$1 = (e) => {
  6890. if (typeof Element === "undefined")
  6891. return false;
  6892. return e instanceof Element;
  6893. };
  6894. const isPropAbsent = (prop) => {
  6895. return isNil(prop);
  6896. };
  6897. const isStringNumber = (val) => {
  6898. if (!isString(val)) {
  6899. return false;
  6900. }
  6901. return !Number.isNaN(Number(val));
  6902. };
  6903. const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  6904. const capitalize = (str) => capitalize$1(str);
  6905. const keysOf = (arr) => Object.keys(arr);
  6906. const entriesOf = (arr) => Object.entries(arr);
  6907. const getProp = (obj, path, defaultValue) => {
  6908. return {
  6909. get value() {
  6910. return get(obj, path, defaultValue);
  6911. },
  6912. set value(val) {
  6913. set(obj, path, val);
  6914. }
  6915. };
  6916. };
  6917. class ElementPlusError extends Error {
  6918. constructor(m) {
  6919. super(m);
  6920. this.name = "ElementPlusError";
  6921. }
  6922. }
  6923. function throwError(scope, m) {
  6924. throw new ElementPlusError(`[${scope}] ${m}`);
  6925. }
  6926. function debugWarn(scope, message) {
  6927. }
  6928. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  6929. const hasClass = (el, cls) => {
  6930. if (!el || !cls)
  6931. return false;
  6932. if (cls.includes(" "))
  6933. throw new Error("className should not contain space.");
  6934. return el.classList.contains(cls);
  6935. };
  6936. const addClass = (el, cls) => {
  6937. if (!el || !cls.trim())
  6938. return;
  6939. el.classList.add(...classNameToArray(cls));
  6940. };
  6941. const removeClass = (el, cls) => {
  6942. if (!el || !cls.trim())
  6943. return;
  6944. el.classList.remove(...classNameToArray(cls));
  6945. };
  6946. const getStyle = (element, styleName) => {
  6947. var _a;
  6948. if (!isClient || !element || !styleName)
  6949. return "";
  6950. let key = camelize(styleName);
  6951. if (key === "float")
  6952. key = "cssFloat";
  6953. try {
  6954. const style = element.style[key];
  6955. if (style)
  6956. return style;
  6957. const computed = (_a = document.defaultView) == null ? void 0 : _a.getComputedStyle(element, "");
  6958. return computed ? computed[key] : "";
  6959. } catch (e) {
  6960. return element.style[key];
  6961. }
  6962. };
  6963. function addUnit(value, defaultUnit = "px") {
  6964. if (!value)
  6965. return "";
  6966. if (isNumber(value) || isStringNumber(value)) {
  6967. return `${value}${defaultUnit}`;
  6968. } else if (isString(value)) {
  6969. return value;
  6970. }
  6971. }
  6972. const isScroll = (el, isVertical) => {
  6973. if (!isClient)
  6974. return false;
  6975. const key = {
  6976. undefined: "overflow",
  6977. true: "overflow-y",
  6978. false: "overflow-x"
  6979. }[String(isVertical)];
  6980. const overflow = getStyle(el, key);
  6981. return ["scroll", "auto", "overlay"].some((s) => overflow.includes(s));
  6982. };
  6983. const getScrollContainer = (el, isVertical) => {
  6984. if (!isClient)
  6985. return;
  6986. let parent = el;
  6987. while (parent) {
  6988. if ([window, document, document.documentElement].includes(parent))
  6989. return window;
  6990. if (isScroll(parent, isVertical))
  6991. return parent;
  6992. parent = parent.parentNode;
  6993. }
  6994. return parent;
  6995. };
  6996. let scrollBarWidth;
  6997. const getScrollBarWidth = (namespace) => {
  6998. var _a;
  6999. if (!isClient)
  7000. return 0;
  7001. if (scrollBarWidth !== void 0)
  7002. return scrollBarWidth;
  7003. const outer = document.createElement("div");
  7004. outer.className = `${namespace}-scrollbar__wrap`;
  7005. outer.style.visibility = "hidden";
  7006. outer.style.width = "100px";
  7007. outer.style.position = "absolute";
  7008. outer.style.top = "-9999px";
  7009. document.body.appendChild(outer);
  7010. const widthNoScroll = outer.offsetWidth;
  7011. outer.style.overflow = "scroll";
  7012. const inner = document.createElement("div");
  7013. inner.style.width = "100%";
  7014. outer.appendChild(inner);
  7015. const widthWithScroll = inner.offsetWidth;
  7016. (_a = outer.parentNode) == null ? void 0 : _a.removeChild(outer);
  7017. scrollBarWidth = widthNoScroll - widthWithScroll;
  7018. return scrollBarWidth;
  7019. };
  7020. function scrollIntoView(container, selected) {
  7021. if (!isClient)
  7022. return;
  7023. if (!selected) {
  7024. container.scrollTop = 0;
  7025. return;
  7026. }
  7027. const offsetParents = [];
  7028. let pointer = selected.offsetParent;
  7029. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  7030. offsetParents.push(pointer);
  7031. pointer = pointer.offsetParent;
  7032. }
  7033. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  7034. const bottom = top + selected.offsetHeight;
  7035. const viewRectTop = container.scrollTop;
  7036. const viewRectBottom = viewRectTop + container.clientHeight;
  7037. if (top < viewRectTop) {
  7038. container.scrollTop = top;
  7039. } else if (bottom > viewRectBottom) {
  7040. container.scrollTop = bottom - container.clientHeight;
  7041. }
  7042. }
  7043. let target = !isClient ? void 0 : document.body;
  7044. function createGlobalNode(id) {
  7045. const el = document.createElement("div");
  7046. if (id !== void 0) {
  7047. el.setAttribute("id", id);
  7048. }
  7049. target.appendChild(el);
  7050. return el;
  7051. }
  7052. function removeGlobalNode(el) {
  7053. el.remove();
  7054. }
  7055. var export_helper_default = (sfc, props) => {
  7056. let target = sfc.__vccOpts || sfc;
  7057. for (let [key, val] of props)
  7058. target[key] = val;
  7059. return target;
  7060. };
  7061. var _sfc_main6 = {
  7062. name: "ArrowDown"
  7063. };
  7064. var _hoisted_16$1 = {
  7065. viewBox: "0 0 1024 1024",
  7066. xmlns: "http://www.w3.org/2000/svg"
  7067. };
  7068. var _hoisted_26 = /* @__PURE__ */ vue.createElementVNode("path", {
  7069. fill: "currentColor",
  7070. 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"
  7071. }, null, -1);
  7072. var _hoisted_36 = [
  7073. _hoisted_26
  7074. ];
  7075. function _sfc_render6(_ctx, _cache, $props, $setup, $data, $options) {
  7076. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_16$1, _hoisted_36);
  7077. }
  7078. var arrow_down_default = /* @__PURE__ */ export_helper_default(_sfc_main6, [["render", _sfc_render6], ["__file", "arrow-down.vue"]]);
  7079. var _sfc_main8 = {
  7080. name: "ArrowLeft"
  7081. };
  7082. var _hoisted_18$1 = {
  7083. viewBox: "0 0 1024 1024",
  7084. xmlns: "http://www.w3.org/2000/svg"
  7085. };
  7086. var _hoisted_28 = /* @__PURE__ */ vue.createElementVNode("path", {
  7087. fill: "currentColor",
  7088. 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"
  7089. }, null, -1);
  7090. var _hoisted_38 = [
  7091. _hoisted_28
  7092. ];
  7093. function _sfc_render8(_ctx, _cache, $props, $setup, $data, $options) {
  7094. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_18$1, _hoisted_38);
  7095. }
  7096. var arrow_left_default = /* @__PURE__ */ export_helper_default(_sfc_main8, [["render", _sfc_render8], ["__file", "arrow-left.vue"]]);
  7097. var _sfc_main10 = {
  7098. name: "ArrowRight"
  7099. };
  7100. var _hoisted_110 = {
  7101. viewBox: "0 0 1024 1024",
  7102. xmlns: "http://www.w3.org/2000/svg"
  7103. };
  7104. var _hoisted_210 = /* @__PURE__ */ vue.createElementVNode("path", {
  7105. fill: "currentColor",
  7106. 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"
  7107. }, null, -1);
  7108. var _hoisted_310 = [
  7109. _hoisted_210
  7110. ];
  7111. function _sfc_render10(_ctx, _cache, $props, $setup, $data, $options) {
  7112. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_110, _hoisted_310);
  7113. }
  7114. var arrow_right_default = /* @__PURE__ */ export_helper_default(_sfc_main10, [["render", _sfc_render10], ["__file", "arrow-right.vue"]]);
  7115. var _sfc_main12 = {
  7116. name: "ArrowUp"
  7117. };
  7118. var _hoisted_112 = {
  7119. viewBox: "0 0 1024 1024",
  7120. xmlns: "http://www.w3.org/2000/svg"
  7121. };
  7122. var _hoisted_212 = /* @__PURE__ */ vue.createElementVNode("path", {
  7123. fill: "currentColor",
  7124. 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 0z"
  7125. }, null, -1);
  7126. var _hoisted_312 = [
  7127. _hoisted_212
  7128. ];
  7129. function _sfc_render12(_ctx, _cache, $props, $setup, $data, $options) {
  7130. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_112, _hoisted_312);
  7131. }
  7132. var arrow_up_default = /* @__PURE__ */ export_helper_default(_sfc_main12, [["render", _sfc_render12], ["__file", "arrow-up.vue"]]);
  7133. var _sfc_main14 = {
  7134. name: "Back"
  7135. };
  7136. var _hoisted_114 = {
  7137. viewBox: "0 0 1024 1024",
  7138. xmlns: "http://www.w3.org/2000/svg"
  7139. };
  7140. var _hoisted_214 = /* @__PURE__ */ vue.createElementVNode("path", {
  7141. fill: "currentColor",
  7142. d: "M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64z"
  7143. }, null, -1);
  7144. var _hoisted_314 = /* @__PURE__ */ vue.createElementVNode("path", {
  7145. fill: "currentColor",
  7146. 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.312L237.248 512z"
  7147. }, null, -1);
  7148. var _hoisted_44 = [
  7149. _hoisted_214,
  7150. _hoisted_314
  7151. ];
  7152. function _sfc_render14(_ctx, _cache, $props, $setup, $data, $options) {
  7153. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_114, _hoisted_44);
  7154. }
  7155. var back_default = /* @__PURE__ */ export_helper_default(_sfc_main14, [["render", _sfc_render14], ["__file", "back.vue"]]);
  7156. var _sfc_main29 = {
  7157. name: "Calendar"
  7158. };
  7159. var _hoisted_129 = {
  7160. viewBox: "0 0 1024 1024",
  7161. xmlns: "http://www.w3.org/2000/svg"
  7162. };
  7163. var _hoisted_229 = /* @__PURE__ */ vue.createElementVNode("path", {
  7164. fill: "currentColor",
  7165. d: "M128 384v512h768V192H768v32a32 32 0 1 1-64 0v-32H320v32a32 32 0 0 1-64 0v-32H128v128h768v64H128zm192-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 0v32zm-32 384h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm192-192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64zm0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64z"
  7166. }, null, -1);
  7167. var _hoisted_328 = [
  7168. _hoisted_229
  7169. ];
  7170. function _sfc_render29(_ctx, _cache, $props, $setup, $data, $options) {
  7171. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_129, _hoisted_328);
  7172. }
  7173. var calendar_default = /* @__PURE__ */ export_helper_default(_sfc_main29, [["render", _sfc_render29], ["__file", "calendar.vue"]]);
  7174. var _sfc_main34 = {
  7175. name: "CaretRight"
  7176. };
  7177. var _hoisted_134 = {
  7178. viewBox: "0 0 1024 1024",
  7179. xmlns: "http://www.w3.org/2000/svg"
  7180. };
  7181. var _hoisted_234 = /* @__PURE__ */ vue.createElementVNode("path", {
  7182. fill: "currentColor",
  7183. d: "M384 192v640l384-320.064z"
  7184. }, null, -1);
  7185. var _hoisted_333 = [
  7186. _hoisted_234
  7187. ];
  7188. function _sfc_render34(_ctx, _cache, $props, $setup, $data, $options) {
  7189. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_134, _hoisted_333);
  7190. }
  7191. var caret_right_default = /* @__PURE__ */ export_helper_default(_sfc_main34, [["render", _sfc_render34], ["__file", "caret-right.vue"]]);
  7192. var _sfc_main35 = {
  7193. name: "CaretTop"
  7194. };
  7195. var _hoisted_135 = {
  7196. viewBox: "0 0 1024 1024",
  7197. xmlns: "http://www.w3.org/2000/svg"
  7198. };
  7199. var _hoisted_235 = /* @__PURE__ */ vue.createElementVNode("path", {
  7200. fill: "currentColor",
  7201. d: "M512 320 192 704h639.936z"
  7202. }, null, -1);
  7203. var _hoisted_334 = [
  7204. _hoisted_235
  7205. ];
  7206. function _sfc_render35(_ctx, _cache, $props, $setup, $data, $options) {
  7207. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_135, _hoisted_334);
  7208. }
  7209. var caret_top_default = /* @__PURE__ */ export_helper_default(_sfc_main35, [["render", _sfc_render35], ["__file", "caret-top.vue"]]);
  7210. var _sfc_main43 = {
  7211. name: "Check"
  7212. };
  7213. var _hoisted_143 = {
  7214. viewBox: "0 0 1024 1024",
  7215. xmlns: "http://www.w3.org/2000/svg"
  7216. };
  7217. var _hoisted_243 = /* @__PURE__ */ vue.createElementVNode("path", {
  7218. fill: "currentColor",
  7219. 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"
  7220. }, null, -1);
  7221. var _hoisted_342 = [
  7222. _hoisted_243
  7223. ];
  7224. function _sfc_render43(_ctx, _cache, $props, $setup, $data, $options) {
  7225. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_143, _hoisted_342);
  7226. }
  7227. var check_default = /* @__PURE__ */ export_helper_default(_sfc_main43, [["render", _sfc_render43], ["__file", "check.vue"]]);
  7228. var _sfc_main47 = {
  7229. name: "CircleCheckFilled"
  7230. };
  7231. var _hoisted_147 = {
  7232. viewBox: "0 0 1024 1024",
  7233. xmlns: "http://www.w3.org/2000/svg"
  7234. };
  7235. var _hoisted_247 = /* @__PURE__ */ vue.createElementVNode("path", {
  7236. fill: "currentColor",
  7237. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-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.336L456.192 600.384z"
  7238. }, null, -1);
  7239. var _hoisted_346 = [
  7240. _hoisted_247
  7241. ];
  7242. function _sfc_render47(_ctx, _cache, $props, $setup, $data, $options) {
  7243. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_147, _hoisted_346);
  7244. }
  7245. var circle_check_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main47, [["render", _sfc_render47], ["__file", "circle-check-filled.vue"]]);
  7246. var _sfc_main48 = {
  7247. name: "CircleCheck"
  7248. };
  7249. var _hoisted_148 = {
  7250. viewBox: "0 0 1024 1024",
  7251. xmlns: "http://www.w3.org/2000/svg"
  7252. };
  7253. var _hoisted_248 = /* @__PURE__ */ vue.createElementVNode("path", {
  7254. fill: "currentColor",
  7255. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  7256. }, null, -1);
  7257. var _hoisted_347 = /* @__PURE__ */ vue.createElementVNode("path", {
  7258. fill: "currentColor",
  7259. 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"
  7260. }, null, -1);
  7261. var _hoisted_414 = [
  7262. _hoisted_248,
  7263. _hoisted_347
  7264. ];
  7265. function _sfc_render48(_ctx, _cache, $props, $setup, $data, $options) {
  7266. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_148, _hoisted_414);
  7267. }
  7268. var circle_check_default = /* @__PURE__ */ export_helper_default(_sfc_main48, [["render", _sfc_render48], ["__file", "circle-check.vue"]]);
  7269. var _sfc_main49 = {
  7270. name: "CircleCloseFilled"
  7271. };
  7272. var _hoisted_149 = {
  7273. viewBox: "0 0 1024 1024",
  7274. xmlns: "http://www.w3.org/2000/svg"
  7275. };
  7276. var _hoisted_249 = /* @__PURE__ */ vue.createElementVNode("path", {
  7277. fill: "currentColor",
  7278. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 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.336L512 457.664z"
  7279. }, null, -1);
  7280. var _hoisted_348 = [
  7281. _hoisted_249
  7282. ];
  7283. function _sfc_render49(_ctx, _cache, $props, $setup, $data, $options) {
  7284. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_149, _hoisted_348);
  7285. }
  7286. var circle_close_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main49, [["render", _sfc_render49], ["__file", "circle-close-filled.vue"]]);
  7287. var _sfc_main50 = {
  7288. name: "CircleClose"
  7289. };
  7290. var _hoisted_150 = {
  7291. viewBox: "0 0 1024 1024",
  7292. xmlns: "http://www.w3.org/2000/svg"
  7293. };
  7294. var _hoisted_250 = /* @__PURE__ */ vue.createElementVNode("path", {
  7295. fill: "currentColor",
  7296. 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.248L466.752 512z"
  7297. }, null, -1);
  7298. var _hoisted_349 = /* @__PURE__ */ vue.createElementVNode("path", {
  7299. fill: "currentColor",
  7300. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  7301. }, null, -1);
  7302. var _hoisted_415 = [
  7303. _hoisted_250,
  7304. _hoisted_349
  7305. ];
  7306. function _sfc_render50(_ctx, _cache, $props, $setup, $data, $options) {
  7307. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_150, _hoisted_415);
  7308. }
  7309. var circle_close_default = /* @__PURE__ */ export_helper_default(_sfc_main50, [["render", _sfc_render50], ["__file", "circle-close.vue"]]);
  7310. var _sfc_main53 = {
  7311. name: "Clock"
  7312. };
  7313. var _hoisted_153 = {
  7314. viewBox: "0 0 1024 1024",
  7315. xmlns: "http://www.w3.org/2000/svg"
  7316. };
  7317. var _hoisted_253 = /* @__PURE__ */ vue.createElementVNode("path", {
  7318. fill: "currentColor",
  7319. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  7320. }, null, -1);
  7321. var _hoisted_352 = /* @__PURE__ */ vue.createElementVNode("path", {
  7322. fill: "currentColor",
  7323. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32z"
  7324. }, null, -1);
  7325. var _hoisted_417 = /* @__PURE__ */ vue.createElementVNode("path", {
  7326. fill: "currentColor",
  7327. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32z"
  7328. }, null, -1);
  7329. var _hoisted_55 = [
  7330. _hoisted_253,
  7331. _hoisted_352,
  7332. _hoisted_417
  7333. ];
  7334. function _sfc_render53(_ctx, _cache, $props, $setup, $data, $options) {
  7335. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_153, _hoisted_55);
  7336. }
  7337. var clock_default = /* @__PURE__ */ export_helper_default(_sfc_main53, [["render", _sfc_render53], ["__file", "clock.vue"]]);
  7338. var _sfc_main55 = {
  7339. name: "Close"
  7340. };
  7341. var _hoisted_155 = {
  7342. viewBox: "0 0 1024 1024",
  7343. xmlns: "http://www.w3.org/2000/svg"
  7344. };
  7345. var _hoisted_255 = /* @__PURE__ */ vue.createElementVNode("path", {
  7346. fill: "currentColor",
  7347. 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"
  7348. }, null, -1);
  7349. var _hoisted_354 = [
  7350. _hoisted_255
  7351. ];
  7352. function _sfc_render55(_ctx, _cache, $props, $setup, $data, $options) {
  7353. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_155, _hoisted_354);
  7354. }
  7355. var close_default = /* @__PURE__ */ export_helper_default(_sfc_main55, [["render", _sfc_render55], ["__file", "close.vue"]]);
  7356. var _sfc_main71 = {
  7357. name: "DArrowLeft"
  7358. };
  7359. var _hoisted_171 = {
  7360. viewBox: "0 0 1024 1024",
  7361. xmlns: "http://www.w3.org/2000/svg"
  7362. };
  7363. var _hoisted_271 = /* @__PURE__ */ vue.createElementVNode("path", {
  7364. fill: "currentColor",
  7365. 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"
  7366. }, null, -1);
  7367. var _hoisted_370 = [
  7368. _hoisted_271
  7369. ];
  7370. function _sfc_render71(_ctx, _cache, $props, $setup, $data, $options) {
  7371. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_171, _hoisted_370);
  7372. }
  7373. var d_arrow_left_default = /* @__PURE__ */ export_helper_default(_sfc_main71, [["render", _sfc_render71], ["__file", "d-arrow-left.vue"]]);
  7374. var _sfc_main72 = {
  7375. name: "DArrowRight"
  7376. };
  7377. var _hoisted_172 = {
  7378. viewBox: "0 0 1024 1024",
  7379. xmlns: "http://www.w3.org/2000/svg"
  7380. };
  7381. var _hoisted_272 = /* @__PURE__ */ vue.createElementVNode("path", {
  7382. fill: "currentColor",
  7383. 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.688zm-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"
  7384. }, null, -1);
  7385. var _hoisted_371 = [
  7386. _hoisted_272
  7387. ];
  7388. function _sfc_render72(_ctx, _cache, $props, $setup, $data, $options) {
  7389. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_172, _hoisted_371);
  7390. }
  7391. var d_arrow_right_default = /* @__PURE__ */ export_helper_default(_sfc_main72, [["render", _sfc_render72], ["__file", "d-arrow-right.vue"]]);
  7392. var _sfc_main79 = {
  7393. name: "Delete"
  7394. };
  7395. var _hoisted_179 = {
  7396. viewBox: "0 0 1024 1024",
  7397. xmlns: "http://www.w3.org/2000/svg"
  7398. };
  7399. var _hoisted_279 = /* @__PURE__ */ vue.createElementVNode("path", {
  7400. fill: "currentColor",
  7401. 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-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"
  7402. }, null, -1);
  7403. var _hoisted_378 = [
  7404. _hoisted_279
  7405. ];
  7406. function _sfc_render79(_ctx, _cache, $props, $setup, $data, $options) {
  7407. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_179, _hoisted_378);
  7408. }
  7409. var delete_default = /* @__PURE__ */ export_helper_default(_sfc_main79, [["render", _sfc_render79], ["__file", "delete.vue"]]);
  7410. var _sfc_main89 = {
  7411. name: "Document"
  7412. };
  7413. var _hoisted_189 = {
  7414. viewBox: "0 0 1024 1024",
  7415. xmlns: "http://www.w3.org/2000/svg"
  7416. };
  7417. var _hoisted_289 = /* @__PURE__ */ vue.createElementVNode("path", {
  7418. fill: "currentColor",
  7419. d: "M832 384H576V128H192v768h640V384zm-26.496-64L640 154.496V320h165.504zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32zm160 448h384v64H320v-64zm0-192h160v64H320v-64zm0 384h384v64H320v-64z"
  7420. }, null, -1);
  7421. var _hoisted_388 = [
  7422. _hoisted_289
  7423. ];
  7424. function _sfc_render89(_ctx, _cache, $props, $setup, $data, $options) {
  7425. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_189, _hoisted_388);
  7426. }
  7427. var document_default = /* @__PURE__ */ export_helper_default(_sfc_main89, [["render", _sfc_render89], ["__file", "document.vue"]]);
  7428. var _sfc_main117 = {
  7429. name: "FullScreen"
  7430. };
  7431. var _hoisted_1117 = {
  7432. viewBox: "0 0 1024 1024",
  7433. xmlns: "http://www.w3.org/2000/svg"
  7434. };
  7435. var _hoisted_2117 = /* @__PURE__ */ vue.createElementVNode("path", {
  7436. fill: "currentColor",
  7437. d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64v.064zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64l-192 .192zM864 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-64v-.064z"
  7438. }, null, -1);
  7439. var _hoisted_3116 = [
  7440. _hoisted_2117
  7441. ];
  7442. function _sfc_render117(_ctx, _cache, $props, $setup, $data, $options) {
  7443. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1117, _hoisted_3116);
  7444. }
  7445. var full_screen_default = /* @__PURE__ */ export_helper_default(_sfc_main117, [["render", _sfc_render117], ["__file", "full-screen.vue"]]);
  7446. var _sfc_main130 = {
  7447. name: "Hide"
  7448. };
  7449. var _hoisted_1130 = {
  7450. viewBox: "0 0 1024 1024",
  7451. xmlns: "http://www.w3.org/2000/svg"
  7452. };
  7453. var _hoisted_2130 = /* @__PURE__ */ vue.createElementVNode("path", {
  7454. 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.2L371.2 588.8ZM889.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",
  7455. fill: "currentColor"
  7456. }, null, -1);
  7457. var _hoisted_3129 = /* @__PURE__ */ vue.createElementVNode("path", {
  7458. 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",
  7459. fill: "currentColor"
  7460. }, null, -1);
  7461. var _hoisted_436 = [
  7462. _hoisted_2130,
  7463. _hoisted_3129
  7464. ];
  7465. function _sfc_render130(_ctx, _cache, $props, $setup, $data, $options) {
  7466. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1130, _hoisted_436);
  7467. }
  7468. var hide_default = /* @__PURE__ */ export_helper_default(_sfc_main130, [["render", _sfc_render130], ["__file", "hide.vue"]]);
  7469. var _sfc_main140 = {
  7470. name: "InfoFilled"
  7471. };
  7472. var _hoisted_1140 = {
  7473. viewBox: "0 0 1024 1024",
  7474. xmlns: "http://www.w3.org/2000/svg"
  7475. };
  7476. var _hoisted_2140 = /* @__PURE__ */ vue.createElementVNode("path", {
  7477. fill: "currentColor",
  7478. d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64zm67.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.344zM590.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"
  7479. }, null, -1);
  7480. var _hoisted_3139 = [
  7481. _hoisted_2140
  7482. ];
  7483. function _sfc_render140(_ctx, _cache, $props, $setup, $data, $options) {
  7484. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1140, _hoisted_3139);
  7485. }
  7486. var info_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main140, [["render", _sfc_render140], ["__file", "info-filled.vue"]]);
  7487. var _sfc_main147 = {
  7488. name: "Loading"
  7489. };
  7490. var _hoisted_1147 = {
  7491. viewBox: "0 0 1024 1024",
  7492. xmlns: "http://www.w3.org/2000/svg"
  7493. };
  7494. var _hoisted_2147 = /* @__PURE__ */ vue.createElementVNode("path", {
  7495. fill: "currentColor",
  7496. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.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 0zm-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"
  7497. }, null, -1);
  7498. var _hoisted_3146 = [
  7499. _hoisted_2147
  7500. ];
  7501. function _sfc_render147(_ctx, _cache, $props, $setup, $data, $options) {
  7502. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1147, _hoisted_3146);
  7503. }
  7504. var loading_default = /* @__PURE__ */ export_helper_default(_sfc_main147, [["render", _sfc_render147], ["__file", "loading.vue"]]);
  7505. var _sfc_main165 = {
  7506. name: "Minus"
  7507. };
  7508. var _hoisted_1165 = {
  7509. viewBox: "0 0 1024 1024",
  7510. xmlns: "http://www.w3.org/2000/svg"
  7511. };
  7512. var _hoisted_2165 = /* @__PURE__ */ vue.createElementVNode("path", {
  7513. fill: "currentColor",
  7514. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"
  7515. }, null, -1);
  7516. var _hoisted_3164 = [
  7517. _hoisted_2165
  7518. ];
  7519. function _sfc_render165(_ctx, _cache, $props, $setup, $data, $options) {
  7520. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1165, _hoisted_3164);
  7521. }
  7522. var minus_default = /* @__PURE__ */ export_helper_default(_sfc_main165, [["render", _sfc_render165], ["__file", "minus.vue"]]);
  7523. var _sfc_main170 = {
  7524. name: "MoreFilled"
  7525. };
  7526. var _hoisted_1170 = {
  7527. viewBox: "0 0 1024 1024",
  7528. xmlns: "http://www.w3.org/2000/svg"
  7529. };
  7530. var _hoisted_2170 = /* @__PURE__ */ vue.createElementVNode("path", {
  7531. fill: "currentColor",
  7532. d: "M176 416a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224z"
  7533. }, null, -1);
  7534. var _hoisted_3169 = [
  7535. _hoisted_2170
  7536. ];
  7537. function _sfc_render170(_ctx, _cache, $props, $setup, $data, $options) {
  7538. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1170, _hoisted_3169);
  7539. }
  7540. var more_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main170, [["render", _sfc_render170], ["__file", "more-filled.vue"]]);
  7541. var _sfc_main171 = {
  7542. name: "More"
  7543. };
  7544. var _hoisted_1171 = {
  7545. viewBox: "0 0 1024 1024",
  7546. xmlns: "http://www.w3.org/2000/svg"
  7547. };
  7548. var _hoisted_2171 = /* @__PURE__ */ vue.createElementVNode("path", {
  7549. fill: "currentColor",
  7550. 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-96zm336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96zm336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224zm0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96z"
  7551. }, null, -1);
  7552. var _hoisted_3170 = [
  7553. _hoisted_2171
  7554. ];
  7555. function _sfc_render171(_ctx, _cache, $props, $setup, $data, $options) {
  7556. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1171, _hoisted_3170);
  7557. }
  7558. var more_default = /* @__PURE__ */ export_helper_default(_sfc_main171, [["render", _sfc_render171], ["__file", "more.vue"]]);
  7559. var _sfc_main191 = {
  7560. name: "PictureFilled"
  7561. };
  7562. var _hoisted_1191 = {
  7563. viewBox: "0 0 1024 1024",
  7564. xmlns: "http://www.w3.org/2000/svg"
  7565. };
  7566. var _hoisted_2191 = /* @__PURE__ */ vue.createElementVNode("path", {
  7567. fill: "currentColor",
  7568. 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 32H96zm315.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.112zM256 384a96 96 0 1 0 192.064-.064A96 96 0 0 0 256 384z"
  7569. }, null, -1);
  7570. var _hoisted_3190 = [
  7571. _hoisted_2191
  7572. ];
  7573. function _sfc_render191(_ctx, _cache, $props, $setup, $data, $options) {
  7574. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1191, _hoisted_3190);
  7575. }
  7576. var picture_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main191, [["render", _sfc_render191], ["__file", "picture-filled.vue"]]);
  7577. var _sfc_main197 = {
  7578. name: "Plus"
  7579. };
  7580. var _hoisted_1197 = {
  7581. viewBox: "0 0 1024 1024",
  7582. xmlns: "http://www.w3.org/2000/svg"
  7583. };
  7584. var _hoisted_2197 = /* @__PURE__ */ vue.createElementVNode("path", {
  7585. fill: "currentColor",
  7586. 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-64h352z"
  7587. }, null, -1);
  7588. var _hoisted_3196 = [
  7589. _hoisted_2197
  7590. ];
  7591. function _sfc_render197(_ctx, _cache, $props, $setup, $data, $options) {
  7592. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1197, _hoisted_3196);
  7593. }
  7594. var plus_default = /* @__PURE__ */ export_helper_default(_sfc_main197, [["render", _sfc_render197], ["__file", "plus.vue"]]);
  7595. var _sfc_main206 = {
  7596. name: "QuestionFilled"
  7597. };
  7598. var _hoisted_1206 = {
  7599. viewBox: "0 0 1024 1024",
  7600. xmlns: "http://www.w3.org/2000/svg"
  7601. };
  7602. var _hoisted_2206 = /* @__PURE__ */ vue.createElementVNode("path", {
  7603. fill: "currentColor",
  7604. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm23.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"
  7605. }, null, -1);
  7606. var _hoisted_3205 = [
  7607. _hoisted_2206
  7608. ];
  7609. function _sfc_render206(_ctx, _cache, $props, $setup, $data, $options) {
  7610. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1206, _hoisted_3205);
  7611. }
  7612. var question_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main206, [["render", _sfc_render206], ["__file", "question-filled.vue"]]);
  7613. var _sfc_main210 = {
  7614. name: "RefreshLeft"
  7615. };
  7616. var _hoisted_1210 = {
  7617. viewBox: "0 0 1024 1024",
  7618. xmlns: "http://www.w3.org/2000/svg"
  7619. };
  7620. var _hoisted_2210 = /* @__PURE__ */ vue.createElementVNode("path", {
  7621. fill: "currentColor",
  7622. 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"
  7623. }, null, -1);
  7624. var _hoisted_3209 = [
  7625. _hoisted_2210
  7626. ];
  7627. function _sfc_render210(_ctx, _cache, $props, $setup, $data, $options) {
  7628. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1210, _hoisted_3209);
  7629. }
  7630. var refresh_left_default = /* @__PURE__ */ export_helper_default(_sfc_main210, [["render", _sfc_render210], ["__file", "refresh-left.vue"]]);
  7631. var _sfc_main211 = {
  7632. name: "RefreshRight"
  7633. };
  7634. var _hoisted_1211 = {
  7635. viewBox: "0 0 1024 1024",
  7636. xmlns: "http://www.w3.org/2000/svg"
  7637. };
  7638. var _hoisted_2211 = /* @__PURE__ */ vue.createElementVNode("path", {
  7639. fill: "currentColor",
  7640. 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"
  7641. }, null, -1);
  7642. var _hoisted_3210 = [
  7643. _hoisted_2211
  7644. ];
  7645. function _sfc_render211(_ctx, _cache, $props, $setup, $data, $options) {
  7646. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1211, _hoisted_3210);
  7647. }
  7648. var refresh_right_default = /* @__PURE__ */ export_helper_default(_sfc_main211, [["render", _sfc_render211], ["__file", "refresh-right.vue"]]);
  7649. var _sfc_main217 = {
  7650. name: "ScaleToOriginal"
  7651. };
  7652. var _hoisted_1217 = {
  7653. viewBox: "0 0 1024 1024",
  7654. xmlns: "http://www.w3.org/2000/svg"
  7655. };
  7656. var _hoisted_2217 = /* @__PURE__ */ vue.createElementVNode("path", {
  7657. fill: "currentColor",
  7658. 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.118zM512 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.412zM512 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 512z"
  7659. }, null, -1);
  7660. var _hoisted_3216 = [
  7661. _hoisted_2217
  7662. ];
  7663. function _sfc_render217(_ctx, _cache, $props, $setup, $data, $options) {
  7664. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1217, _hoisted_3216);
  7665. }
  7666. var scale_to_original_default = /* @__PURE__ */ export_helper_default(_sfc_main217, [["render", _sfc_render217], ["__file", "scale-to-original.vue"]]);
  7667. var _sfc_main220 = {
  7668. name: "Search"
  7669. };
  7670. var _hoisted_1220 = {
  7671. viewBox: "0 0 1024 1024",
  7672. xmlns: "http://www.w3.org/2000/svg"
  7673. };
  7674. var _hoisted_2220 = /* @__PURE__ */ vue.createElementVNode("path", {
  7675. fill: "currentColor",
  7676. 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 704z"
  7677. }, null, -1);
  7678. var _hoisted_3219 = [
  7679. _hoisted_2220
  7680. ];
  7681. function _sfc_render220(_ctx, _cache, $props, $setup, $data, $options) {
  7682. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1220, _hoisted_3219);
  7683. }
  7684. var search_default = /* @__PURE__ */ export_helper_default(_sfc_main220, [["render", _sfc_render220], ["__file", "search.vue"]]);
  7685. var _sfc_main236 = {
  7686. name: "SortDown"
  7687. };
  7688. var _hoisted_1236 = {
  7689. viewBox: "0 0 1024 1024",
  7690. xmlns: "http://www.w3.org/2000/svg"
  7691. };
  7692. var _hoisted_2236 = /* @__PURE__ */ vue.createElementVNode("path", {
  7693. fill: "currentColor",
  7694. 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 0z"
  7695. }, null, -1);
  7696. var _hoisted_3235 = [
  7697. _hoisted_2236
  7698. ];
  7699. function _sfc_render236(_ctx, _cache, $props, $setup, $data, $options) {
  7700. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1236, _hoisted_3235);
  7701. }
  7702. var sort_down_default = /* @__PURE__ */ export_helper_default(_sfc_main236, [["render", _sfc_render236], ["__file", "sort-down.vue"]]);
  7703. var _sfc_main237 = {
  7704. name: "SortUp"
  7705. };
  7706. var _hoisted_1237 = {
  7707. viewBox: "0 0 1024 1024",
  7708. xmlns: "http://www.w3.org/2000/svg"
  7709. };
  7710. var _hoisted_2237 = /* @__PURE__ */ vue.createElementVNode("path", {
  7711. fill: "currentColor",
  7712. 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.248z"
  7713. }, null, -1);
  7714. var _hoisted_3236 = [
  7715. _hoisted_2237
  7716. ];
  7717. function _sfc_render237(_ctx, _cache, $props, $setup, $data, $options) {
  7718. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1237, _hoisted_3236);
  7719. }
  7720. var sort_up_default = /* @__PURE__ */ export_helper_default(_sfc_main237, [["render", _sfc_render237], ["__file", "sort-up.vue"]]);
  7721. var _sfc_main240 = {
  7722. name: "StarFilled"
  7723. };
  7724. var _hoisted_1240 = {
  7725. viewBox: "0 0 1024 1024",
  7726. xmlns: "http://www.w3.org/2000/svg"
  7727. };
  7728. var _hoisted_2240 = /* @__PURE__ */ vue.createElementVNode("path", {
  7729. fill: "currentColor",
  7730. 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"
  7731. }, null, -1);
  7732. var _hoisted_3239 = [
  7733. _hoisted_2240
  7734. ];
  7735. function _sfc_render240(_ctx, _cache, $props, $setup, $data, $options) {
  7736. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1240, _hoisted_3239);
  7737. }
  7738. var star_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main240, [["render", _sfc_render240], ["__file", "star-filled.vue"]]);
  7739. var _sfc_main241 = {
  7740. name: "Star"
  7741. };
  7742. var _hoisted_1241 = {
  7743. viewBox: "0 0 1024 1024",
  7744. xmlns: "http://www.w3.org/2000/svg"
  7745. };
  7746. var _hoisted_2241 = /* @__PURE__ */ vue.createElementVNode("path", {
  7747. fill: "currentColor",
  7748. 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.72L512 747.84zM313.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"
  7749. }, null, -1);
  7750. var _hoisted_3240 = [
  7751. _hoisted_2241
  7752. ];
  7753. function _sfc_render241(_ctx, _cache, $props, $setup, $data, $options) {
  7754. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1241, _hoisted_3240);
  7755. }
  7756. var star_default = /* @__PURE__ */ export_helper_default(_sfc_main241, [["render", _sfc_render241], ["__file", "star.vue"]]);
  7757. var _sfc_main243 = {
  7758. name: "SuccessFilled"
  7759. };
  7760. var _hoisted_1243 = {
  7761. viewBox: "0 0 1024 1024",
  7762. xmlns: "http://www.w3.org/2000/svg"
  7763. };
  7764. var _hoisted_2243 = /* @__PURE__ */ vue.createElementVNode("path", {
  7765. fill: "currentColor",
  7766. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-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.336L456.192 600.384z"
  7767. }, null, -1);
  7768. var _hoisted_3242 = [
  7769. _hoisted_2243
  7770. ];
  7771. function _sfc_render243(_ctx, _cache, $props, $setup, $data, $options) {
  7772. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1243, _hoisted_3242);
  7773. }
  7774. var success_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main243, [["render", _sfc_render243], ["__file", "success-filled.vue"]]);
  7775. var _sfc_main274 = {
  7776. name: "View"
  7777. };
  7778. var _hoisted_1274 = {
  7779. viewBox: "0 0 1024 1024",
  7780. xmlns: "http://www.w3.org/2000/svg"
  7781. };
  7782. var _hoisted_2274 = /* @__PURE__ */ vue.createElementVNode("path", {
  7783. fill: "currentColor",
  7784. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 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-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"
  7785. }, null, -1);
  7786. var _hoisted_3273 = [
  7787. _hoisted_2274
  7788. ];
  7789. function _sfc_render274(_ctx, _cache, $props, $setup, $data, $options) {
  7790. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1274, _hoisted_3273);
  7791. }
  7792. var view_default = /* @__PURE__ */ export_helper_default(_sfc_main274, [["render", _sfc_render274], ["__file", "view.vue"]]);
  7793. var _sfc_main277 = {
  7794. name: "WarningFilled"
  7795. };
  7796. var _hoisted_1277 = {
  7797. viewBox: "0 0 1024 1024",
  7798. xmlns: "http://www.w3.org/2000/svg"
  7799. };
  7800. var _hoisted_2277 = /* @__PURE__ */ vue.createElementVNode("path", {
  7801. fill: "currentColor",
  7802. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm0 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 256zm0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4z"
  7803. }, null, -1);
  7804. var _hoisted_3276 = [
  7805. _hoisted_2277
  7806. ];
  7807. function _sfc_render277(_ctx, _cache, $props, $setup, $data, $options) {
  7808. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1277, _hoisted_3276);
  7809. }
  7810. var warning_filled_default = /* @__PURE__ */ export_helper_default(_sfc_main277, [["render", _sfc_render277], ["__file", "warning-filled.vue"]]);
  7811. var _sfc_main282 = {
  7812. name: "ZoomIn"
  7813. };
  7814. var _hoisted_1282 = {
  7815. viewBox: "0 0 1024 1024",
  7816. xmlns: "http://www.w3.org/2000/svg"
  7817. };
  7818. var _hoisted_2282 = /* @__PURE__ */ vue.createElementVNode("path", {
  7819. fill: "currentColor",
  7820. 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 704zm-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-64h96z"
  7821. }, null, -1);
  7822. var _hoisted_3281 = [
  7823. _hoisted_2282
  7824. ];
  7825. function _sfc_render282(_ctx, _cache, $props, $setup, $data, $options) {
  7826. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1282, _hoisted_3281);
  7827. }
  7828. var zoom_in_default = /* @__PURE__ */ export_helper_default(_sfc_main282, [["render", _sfc_render282], ["__file", "zoom-in.vue"]]);
  7829. var _sfc_main283 = {
  7830. name: "ZoomOut"
  7831. };
  7832. var _hoisted_1283 = {
  7833. viewBox: "0 0 1024 1024",
  7834. xmlns: "http://www.w3.org/2000/svg"
  7835. };
  7836. var _hoisted_2283 = /* @__PURE__ */ vue.createElementVNode("path", {
  7837. fill: "currentColor",
  7838. 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 704zM352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64z"
  7839. }, null, -1);
  7840. var _hoisted_3282 = [
  7841. _hoisted_2283
  7842. ];
  7843. function _sfc_render283(_ctx, _cache, $props, $setup, $data, $options) {
  7844. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1283, _hoisted_3282);
  7845. }
  7846. var zoom_out_default = /* @__PURE__ */ export_helper_default(_sfc_main283, [["render", _sfc_render283], ["__file", "zoom-out.vue"]]);
  7847. /*! Element Plus Icons Vue v2.0.6 */
  7848. const epPropKey = "__epPropKey";
  7849. const definePropType = (val) => val;
  7850. const isEpProp = (val) => isObject$1(val) && !!val[epPropKey];
  7851. const buildProp = (prop, key) => {
  7852. if (!isObject$1(prop) || isEpProp(prop))
  7853. return prop;
  7854. const { values, required, default: defaultValue, type, validator } = prop;
  7855. const _validator = values || validator ? (val) => {
  7856. let valid = false;
  7857. let allowedValues = [];
  7858. if (values) {
  7859. allowedValues = Array.from(values);
  7860. if (hasOwn(prop, "default")) {
  7861. allowedValues.push(defaultValue);
  7862. }
  7863. valid || (valid = allowedValues.includes(val));
  7864. }
  7865. if (validator)
  7866. valid || (valid = validator(val));
  7867. if (!valid && allowedValues.length > 0) {
  7868. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  7869. vue.warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  7870. }
  7871. return valid;
  7872. } : void 0;
  7873. const epProp = {
  7874. type,
  7875. required: !!required,
  7876. validator: _validator,
  7877. [epPropKey]: true
  7878. };
  7879. if (hasOwn(prop, "default"))
  7880. epProp.default = defaultValue;
  7881. return epProp;
  7882. };
  7883. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  7884. key,
  7885. buildProp(option, key)
  7886. ]));
  7887. const iconPropType = definePropType([
  7888. String,
  7889. Object,
  7890. Function
  7891. ]);
  7892. const CloseComponents = {
  7893. Close: close_default
  7894. };
  7895. const TypeComponents = {
  7896. Close: close_default,
  7897. SuccessFilled: success_filled_default,
  7898. InfoFilled: info_filled_default,
  7899. WarningFilled: warning_filled_default,
  7900. CircleCloseFilled: circle_close_filled_default
  7901. };
  7902. const TypeComponentsMap = {
  7903. success: success_filled_default,
  7904. warning: warning_filled_default,
  7905. error: circle_close_filled_default,
  7906. info: info_filled_default
  7907. };
  7908. const ValidateComponentsMap = {
  7909. validating: loading_default,
  7910. success: circle_check_default,
  7911. error: circle_close_default
  7912. };
  7913. const withInstall = (main, extra) => {
  7914. main.install = (app) => {
  7915. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  7916. app.component(comp.name, comp);
  7917. }
  7918. };
  7919. if (extra) {
  7920. for (const [key, comp] of Object.entries(extra)) {
  7921. main[key] = comp;
  7922. }
  7923. }
  7924. return main;
  7925. };
  7926. const withInstallFunction = (fn, name) => {
  7927. fn.install = (app) => {
  7928. fn._context = app._context;
  7929. app.config.globalProperties[name] = fn;
  7930. };
  7931. return fn;
  7932. };
  7933. const withInstallDirective = (directive, name) => {
  7934. directive.install = (app) => {
  7935. app.directive(name, directive);
  7936. };
  7937. return directive;
  7938. };
  7939. const withNoopInstall = (component) => {
  7940. component.install = NOOP;
  7941. return component;
  7942. };
  7943. const composeRefs = (...refs) => {
  7944. return (el) => {
  7945. refs.forEach((ref) => {
  7946. if (isFunction(ref)) {
  7947. ref(el);
  7948. } else {
  7949. ref.value = el;
  7950. }
  7951. });
  7952. };
  7953. };
  7954. const EVENT_CODE = {
  7955. tab: "Tab",
  7956. enter: "Enter",
  7957. space: "Space",
  7958. left: "ArrowLeft",
  7959. up: "ArrowUp",
  7960. right: "ArrowRight",
  7961. down: "ArrowDown",
  7962. esc: "Escape",
  7963. delete: "Delete",
  7964. backspace: "Backspace",
  7965. numpadEnter: "NumpadEnter",
  7966. pageUp: "PageUp",
  7967. pageDown: "PageDown",
  7968. home: "Home",
  7969. end: "End"
  7970. };
  7971. const datePickTypes = [
  7972. "year",
  7973. "month",
  7974. "date",
  7975. "dates",
  7976. "week",
  7977. "datetime",
  7978. "datetimerange",
  7979. "daterange",
  7980. "monthrange"
  7981. ];
  7982. const WEEK_DAYS = [
  7983. "sun",
  7984. "mon",
  7985. "tue",
  7986. "wed",
  7987. "thu",
  7988. "fri",
  7989. "sat"
  7990. ];
  7991. const UPDATE_MODEL_EVENT = "update:modelValue";
  7992. const CHANGE_EVENT = "change";
  7993. const INPUT_EVENT = "input";
  7994. const INSTALLED_KEY = Symbol("INSTALLED_KEY");
  7995. const componentSizes = ["", "default", "small", "large"];
  7996. const componentSizeMap = {
  7997. large: 40,
  7998. default: 32,
  7999. small: 24
  8000. };
  8001. const getComponentSize = (size) => {
  8002. return componentSizeMap[size || "default"];
  8003. };
  8004. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  8005. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  8006. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  8007. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  8008. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  8009. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  8010. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  8011. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  8012. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  8013. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  8014. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  8015. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  8016. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  8017. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  8018. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  8019. return PatchFlags2;
  8020. })(PatchFlags || {});
  8021. function isFragment(node) {
  8022. return vue.isVNode(node) && node.type === vue.Fragment;
  8023. }
  8024. function isComment(node) {
  8025. return vue.isVNode(node) && node.type === vue.Comment;
  8026. }
  8027. function isValidElementNode(node) {
  8028. return vue.isVNode(node) && !isFragment(node) && !isComment(node);
  8029. }
  8030. const getNormalizedProps = (node) => {
  8031. if (!vue.isVNode(node)) {
  8032. return {};
  8033. }
  8034. const raw = node.props || {};
  8035. const type = (vue.isVNode(node.type) ? node.type.props : void 0) || {};
  8036. const props = {};
  8037. Object.keys(type).forEach((key) => {
  8038. if (hasOwn(type[key], "default")) {
  8039. props[key] = type[key].default;
  8040. }
  8041. });
  8042. Object.keys(raw).forEach((key) => {
  8043. props[camelize(key)] = raw[key];
  8044. });
  8045. return props;
  8046. };
  8047. const ensureOnlyChild = (children) => {
  8048. if (!isArray(children) || children.length > 1) {
  8049. throw new Error("expect to receive a single Vue element child");
  8050. }
  8051. return children[0];
  8052. };
  8053. const flattedChildren = (children) => {
  8054. const vNodes = isArray(children) ? children : [children];
  8055. const result = [];
  8056. vNodes.forEach((child) => {
  8057. var _a;
  8058. if (isArray(child)) {
  8059. result.push(...flattedChildren(child));
  8060. } else if (vue.isVNode(child) && isArray(child.children)) {
  8061. result.push(...flattedChildren(child.children));
  8062. } else {
  8063. result.push(child);
  8064. if (vue.isVNode(child) && ((_a = child.component) == null ? void 0 : _a.subTree)) {
  8065. result.push(...flattedChildren(child.component.subTree));
  8066. }
  8067. }
  8068. });
  8069. return result;
  8070. };
  8071. const cubic = (value) => {
  8072. return value ** 3;
  8073. };
  8074. const easeInOutCubic = (value) => value < 0.5 ? cubic(value * 2) / 2 : 1 - cubic((1 - value) * 2) / 2;
  8075. const unique = (arr) => [...new Set(arr)];
  8076. const castArray = (arr) => {
  8077. if (!arr && arr !== 0)
  8078. return [];
  8079. return Array.isArray(arr) ? arr : [arr];
  8080. };
  8081. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  8082. const isKorean = (text) => /([(\uAC00-\uD7AF)|(\u3130-\u318F)])+/gi.test(text);
  8083. const rAF = (fn) => isClient ? window.requestAnimationFrame(fn) : setTimeout(fn, 16);
  8084. const cAF = (handle) => isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle);
  8085. const generateId = () => Math.floor(Math.random() * 1e4);
  8086. const mutable = (val) => val;
  8087. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  8088. const LISTENER_PREFIX = /^on[A-Z]/;
  8089. const useAttrs = (params = {}) => {
  8090. const { excludeListeners = false, excludeKeys } = params;
  8091. const allExcludeKeys = vue.computed(() => {
  8092. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  8093. });
  8094. const instance = vue.getCurrentInstance();
  8095. if (!instance) {
  8096. return vue.computed(() => ({}));
  8097. }
  8098. return vue.computed(() => {
  8099. var _a;
  8100. return fromPairs(Object.entries((_a = instance.proxy) == null ? void 0 : _a.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  8101. });
  8102. };
  8103. const breadcrumbKey = Symbol("breadcrumbKey");
  8104. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  8105. const carouselContextKey = Symbol("carouselContextKey");
  8106. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  8107. const collapseContextKey = Symbol("collapseContextKey");
  8108. const configProviderContextKey = Symbol();
  8109. const dialogInjectionKey = Symbol("dialogInjectionKey");
  8110. const formContextKey = Symbol("formContextKey");
  8111. const formItemContextKey = Symbol("formItemContextKey");
  8112. const elPaginationKey = Symbol("elPaginationKey");
  8113. const radioGroupKey = Symbol("radioGroupKey");
  8114. const rowContextKey = Symbol("rowContextKey");
  8115. const scrollbarContextKey = Symbol("scrollbarContextKey");
  8116. const sliderContextKey = Symbol("sliderContextKey");
  8117. const tabsRootContextKey = Symbol("tabsRootContextKey");
  8118. const uploadContextKey = Symbol("uploadContextKey");
  8119. const POPPER_INJECTION_KEY = Symbol("popper");
  8120. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  8121. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  8122. const tooltipV2RootKey = Symbol("tooltipV2");
  8123. const tooltipV2ContentKey = Symbol("tooltipV2Content");
  8124. const TOOLTIP_V2_OPEN = "tooltip_v2.open";
  8125. const ROOT_PICKER_INJECTION_KEY = Symbol();
  8126. const useProp = (name) => {
  8127. const vm = vue.getCurrentInstance();
  8128. return vue.computed(() => {
  8129. var _a, _b;
  8130. return (_b = ((_a = vm.proxy) == null ? void 0 : _a.$props)[name]) != null ? _b : void 0;
  8131. });
  8132. };
  8133. const globalConfig = vue.ref();
  8134. function useGlobalConfig(key, defaultValue = void 0) {
  8135. const config = vue.getCurrentInstance() ? vue.inject(configProviderContextKey, globalConfig) : globalConfig;
  8136. if (key) {
  8137. return vue.computed(() => {
  8138. var _a, _b;
  8139. return (_b = (_a = config.value) == null ? void 0 : _a[key]) != null ? _b : defaultValue;
  8140. });
  8141. } else {
  8142. return config;
  8143. }
  8144. }
  8145. const provideGlobalConfig = (config, app, global = false) => {
  8146. var _a;
  8147. const inSetup = !!vue.getCurrentInstance();
  8148. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  8149. const provideFn = (_a = app == null ? void 0 : app.provide) != null ? _a : inSetup ? vue.provide : void 0;
  8150. if (!provideFn) {
  8151. return;
  8152. }
  8153. const context = vue.computed(() => {
  8154. const cfg = vue.unref(config);
  8155. if (!(oldConfig == null ? void 0 : oldConfig.value))
  8156. return cfg;
  8157. return mergeConfig(oldConfig.value, cfg);
  8158. });
  8159. provideFn(configProviderContextKey, context);
  8160. if (global || !globalConfig.value) {
  8161. globalConfig.value = context.value;
  8162. }
  8163. return context;
  8164. };
  8165. const mergeConfig = (a, b) => {
  8166. var _a;
  8167. const keys = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
  8168. const obj = {};
  8169. for (const key of keys) {
  8170. obj[key] = (_a = b[key]) != null ? _a : a[key];
  8171. }
  8172. return obj;
  8173. };
  8174. const useSizeProp = buildProp({
  8175. type: String,
  8176. values: componentSizes,
  8177. required: false
  8178. });
  8179. const useSize = (fallback, ignore = {}) => {
  8180. const emptyRef = vue.ref(void 0);
  8181. const size = ignore.prop ? emptyRef : useProp("size");
  8182. const globalConfig = ignore.global ? emptyRef : useGlobalConfig("size");
  8183. const form = ignore.form ? { size: void 0 } : vue.inject(formContextKey, void 0);
  8184. const formItem = ignore.formItem ? { size: void 0 } : vue.inject(formItemContextKey, void 0);
  8185. return vue.computed(() => size.value || vue.unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig.value || "");
  8186. };
  8187. const useDisabled = (fallback) => {
  8188. const disabled = useProp("disabled");
  8189. const form = vue.inject(formContextKey, void 0);
  8190. return vue.computed(() => disabled.value || vue.unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  8191. };
  8192. const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
  8193. vue.watch(() => vue.unref(condition), (val) => {
  8194. }, {
  8195. immediate: true
  8196. });
  8197. };
  8198. const useDraggable = (targetRef, dragRef, draggable) => {
  8199. let transform = {
  8200. offsetX: 0,
  8201. offsetY: 0
  8202. };
  8203. const onMousedown = (e) => {
  8204. const downX = e.clientX;
  8205. const downY = e.clientY;
  8206. const { offsetX, offsetY } = transform;
  8207. const targetRect = targetRef.value.getBoundingClientRect();
  8208. const targetLeft = targetRect.left;
  8209. const targetTop = targetRect.top;
  8210. const targetWidth = targetRect.width;
  8211. const targetHeight = targetRect.height;
  8212. const clientWidth = document.documentElement.clientWidth;
  8213. const clientHeight = document.documentElement.clientHeight;
  8214. const minLeft = -targetLeft + offsetX;
  8215. const minTop = -targetTop + offsetY;
  8216. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  8217. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  8218. const onMousemove = (e2) => {
  8219. const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
  8220. const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
  8221. transform = {
  8222. offsetX: moveX,
  8223. offsetY: moveY
  8224. };
  8225. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  8226. };
  8227. const onMouseup = () => {
  8228. document.removeEventListener("mousemove", onMousemove);
  8229. document.removeEventListener("mouseup", onMouseup);
  8230. };
  8231. document.addEventListener("mousemove", onMousemove);
  8232. document.addEventListener("mouseup", onMouseup);
  8233. };
  8234. const onDraggable = () => {
  8235. if (dragRef.value && targetRef.value) {
  8236. dragRef.value.addEventListener("mousedown", onMousedown);
  8237. }
  8238. };
  8239. const offDraggable = () => {
  8240. if (dragRef.value && targetRef.value) {
  8241. dragRef.value.removeEventListener("mousedown", onMousedown);
  8242. }
  8243. };
  8244. vue.onMounted(() => {
  8245. vue.watchEffect(() => {
  8246. if (draggable.value) {
  8247. onDraggable();
  8248. } else {
  8249. offDraggable();
  8250. }
  8251. });
  8252. });
  8253. vue.onBeforeUnmount(() => {
  8254. offDraggable();
  8255. });
  8256. };
  8257. const useFocus = (el) => {
  8258. return {
  8259. focus: () => {
  8260. var _a, _b;
  8261. (_b = (_a = el.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  8262. }
  8263. };
  8264. };
  8265. const defaultNamespace = "el";
  8266. const statePrefix = "is-";
  8267. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  8268. let cls = `${namespace}-${block}`;
  8269. if (blockSuffix) {
  8270. cls += `-${blockSuffix}`;
  8271. }
  8272. if (element) {
  8273. cls += `__${element}`;
  8274. }
  8275. if (modifier) {
  8276. cls += `--${modifier}`;
  8277. }
  8278. return cls;
  8279. };
  8280. const useNamespace = (block) => {
  8281. const namespace = useGlobalConfig("namespace", defaultNamespace);
  8282. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  8283. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  8284. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  8285. const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  8286. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  8287. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  8288. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  8289. const is = (name, ...args) => {
  8290. const state = args.length >= 1 ? args[0] : true;
  8291. return name && state ? `${statePrefix}${name}` : "";
  8292. };
  8293. const cssVar = (object) => {
  8294. const styles = {};
  8295. for (const key in object) {
  8296. if (object[key]) {
  8297. styles[`--${namespace.value}-${key}`] = object[key];
  8298. }
  8299. }
  8300. return styles;
  8301. };
  8302. const cssVarBlock = (object) => {
  8303. const styles = {};
  8304. for (const key in object) {
  8305. if (object[key]) {
  8306. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  8307. }
  8308. }
  8309. return styles;
  8310. };
  8311. const cssVarName = (name) => `--${namespace.value}-${name}`;
  8312. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  8313. return {
  8314. namespace,
  8315. b,
  8316. e,
  8317. m,
  8318. be,
  8319. em,
  8320. bm,
  8321. bem,
  8322. is,
  8323. cssVar,
  8324. cssVarName,
  8325. cssVarBlock,
  8326. cssVarBlockName
  8327. };
  8328. };
  8329. const defaultIdInjection = {
  8330. prefix: Math.floor(Math.random() * 1e4),
  8331. current: 0
  8332. };
  8333. const ID_INJECTION_KEY = Symbol("elIdInjection");
  8334. const useId = (deterministicId) => {
  8335. const idInjection = vue.inject(ID_INJECTION_KEY, defaultIdInjection);
  8336. const namespace = useGlobalConfig("namespace", defaultNamespace);
  8337. const idRef = vue.computed(() => vue.unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  8338. return idRef;
  8339. };
  8340. const useFormItem = () => {
  8341. const form = vue.inject(formContextKey, void 0);
  8342. const formItem = vue.inject(formItemContextKey, void 0);
  8343. return {
  8344. form,
  8345. formItem
  8346. };
  8347. };
  8348. const useFormItemInputId = (props, {
  8349. formItemContext,
  8350. disableIdGeneration,
  8351. disableIdManagement
  8352. }) => {
  8353. if (!disableIdGeneration) {
  8354. disableIdGeneration = vue.ref(false);
  8355. }
  8356. if (!disableIdManagement) {
  8357. disableIdManagement = vue.ref(false);
  8358. }
  8359. const inputId = vue.ref();
  8360. let idUnwatch = void 0;
  8361. const isLabeledByFormItem = vue.computed(() => {
  8362. var _a;
  8363. return !!(!props.label && formItemContext && formItemContext.inputIds && ((_a = formItemContext.inputIds) == null ? void 0 : _a.length) <= 1);
  8364. });
  8365. vue.onMounted(() => {
  8366. idUnwatch = vue.watch([vue.toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  8367. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  8368. if (newId !== inputId.value) {
  8369. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  8370. inputId.value && formItemContext.removeInputId(inputId.value);
  8371. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  8372. formItemContext.addInputId(newId);
  8373. }
  8374. }
  8375. inputId.value = newId;
  8376. }
  8377. }, { immediate: true });
  8378. });
  8379. vue.onUnmounted(() => {
  8380. idUnwatch && idUnwatch();
  8381. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  8382. inputId.value && formItemContext.removeInputId(inputId.value);
  8383. }
  8384. });
  8385. return {
  8386. isLabeledByFormItem,
  8387. inputId
  8388. };
  8389. };
  8390. var English = {
  8391. name: "en",
  8392. el: {
  8393. colorpicker: {
  8394. confirm: "OK",
  8395. clear: "Clear",
  8396. defaultLabel: "color picker",
  8397. description: "current color is {color}. press enter to select a new color."
  8398. },
  8399. datepicker: {
  8400. now: "Now",
  8401. today: "Today",
  8402. cancel: "Cancel",
  8403. clear: "Clear",
  8404. confirm: "OK",
  8405. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  8406. monthTablePrompt: "Use the arrow keys and enter to select the month",
  8407. yearTablePrompt: "Use the arrow keys and enter to select the year",
  8408. selectedDate: "Selected date",
  8409. selectDate: "Select date",
  8410. selectTime: "Select time",
  8411. startDate: "Start Date",
  8412. startTime: "Start Time",
  8413. endDate: "End Date",
  8414. endTime: "End Time",
  8415. prevYear: "Previous Year",
  8416. nextYear: "Next Year",
  8417. prevMonth: "Previous Month",
  8418. nextMonth: "Next Month",
  8419. year: "",
  8420. month1: "January",
  8421. month2: "February",
  8422. month3: "March",
  8423. month4: "April",
  8424. month5: "May",
  8425. month6: "June",
  8426. month7: "July",
  8427. month8: "August",
  8428. month9: "September",
  8429. month10: "October",
  8430. month11: "November",
  8431. month12: "December",
  8432. week: "week",
  8433. weeks: {
  8434. sun: "Sun",
  8435. mon: "Mon",
  8436. tue: "Tue",
  8437. wed: "Wed",
  8438. thu: "Thu",
  8439. fri: "Fri",
  8440. sat: "Sat"
  8441. },
  8442. weeksFull: {
  8443. sun: "Sunday",
  8444. mon: "Monday",
  8445. tue: "Tuesday",
  8446. wed: "Wednesday",
  8447. thu: "Thursday",
  8448. fri: "Friday",
  8449. sat: "Saturday"
  8450. },
  8451. months: {
  8452. jan: "Jan",
  8453. feb: "Feb",
  8454. mar: "Mar",
  8455. apr: "Apr",
  8456. may: "May",
  8457. jun: "Jun",
  8458. jul: "Jul",
  8459. aug: "Aug",
  8460. sep: "Sep",
  8461. oct: "Oct",
  8462. nov: "Nov",
  8463. dec: "Dec"
  8464. }
  8465. },
  8466. inputNumber: {
  8467. decrease: "decrease number",
  8468. increase: "increase number"
  8469. },
  8470. select: {
  8471. loading: "Loading",
  8472. noMatch: "No matching data",
  8473. noData: "No data",
  8474. placeholder: "Select"
  8475. },
  8476. dropdown: {
  8477. toggleDropdown: "Toggle Dropdown"
  8478. },
  8479. cascader: {
  8480. noMatch: "No matching data",
  8481. loading: "Loading",
  8482. placeholder: "Select",
  8483. noData: "No data"
  8484. },
  8485. pagination: {
  8486. goto: "Go to",
  8487. pagesize: "/page",
  8488. total: "Total {total}",
  8489. pageClassifier: "",
  8490. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  8491. },
  8492. dialog: {
  8493. close: "Close this dialog"
  8494. },
  8495. drawer: {
  8496. close: "Close this dialog"
  8497. },
  8498. messagebox: {
  8499. title: "Message",
  8500. confirm: "OK",
  8501. cancel: "Cancel",
  8502. error: "Illegal input",
  8503. close: "Close this dialog"
  8504. },
  8505. upload: {
  8506. deleteTip: "press delete to remove",
  8507. delete: "Delete",
  8508. preview: "Preview",
  8509. continue: "Continue"
  8510. },
  8511. slider: {
  8512. defaultLabel: "slider between {min} and {max}",
  8513. defaultRangeStartLabel: "pick start value",
  8514. defaultRangeEndLabel: "pick end value"
  8515. },
  8516. table: {
  8517. emptyText: "No Data",
  8518. confirmFilter: "Confirm",
  8519. resetFilter: "Reset",
  8520. clearFilter: "All",
  8521. sumText: "Sum"
  8522. },
  8523. tree: {
  8524. emptyText: "No Data"
  8525. },
  8526. transfer: {
  8527. noMatch: "No matching data",
  8528. noData: "No data",
  8529. titles: ["List 1", "List 2"],
  8530. filterPlaceholder: "Enter keyword",
  8531. noCheckedFormat: "{total} items",
  8532. hasCheckedFormat: "{checked}/{total} checked"
  8533. },
  8534. image: {
  8535. error: "FAILED"
  8536. },
  8537. pageHeader: {
  8538. title: "Back"
  8539. },
  8540. popconfirm: {
  8541. confirmButtonText: "Yes",
  8542. cancelButtonText: "No"
  8543. }
  8544. }
  8545. };
  8546. const buildTranslator = (locale) => (path, option) => translate(path, option, vue.unref(locale));
  8547. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
  8548. var _a;
  8549. return `${(_a = option == null ? void 0 : option[key]) != null ? _a : `{${key}}`}`;
  8550. });
  8551. const buildLocaleContext = (locale) => {
  8552. const lang = vue.computed(() => vue.unref(locale).name);
  8553. const localeRef = vue.isRef(locale) ? locale : vue.ref(locale);
  8554. return {
  8555. lang,
  8556. locale: localeRef,
  8557. t: buildTranslator(locale)
  8558. };
  8559. };
  8560. const useLocale = () => {
  8561. const locale = useGlobalConfig("locale");
  8562. return buildLocaleContext(vue.computed(() => locale.value || English));
  8563. };
  8564. let activeEffectScope;
  8565. function recordEffectScope(effect2, scope = activeEffectScope) {
  8566. if (scope && scope.active) {
  8567. scope.effects.push(effect2);
  8568. }
  8569. }
  8570. const createDep = (effects) => {
  8571. const dep = new Set(effects);
  8572. dep.w = 0;
  8573. dep.n = 0;
  8574. return dep;
  8575. };
  8576. const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
  8577. const newTracked = (dep) => (dep.n & trackOpBit) > 0;
  8578. const initDepMarkers = ({ deps }) => {
  8579. if (deps.length) {
  8580. for (let i = 0; i < deps.length; i++) {
  8581. deps[i].w |= trackOpBit;
  8582. }
  8583. }
  8584. };
  8585. const finalizeDepMarkers = (effect2) => {
  8586. const { deps } = effect2;
  8587. if (deps.length) {
  8588. let ptr = 0;
  8589. for (let i = 0; i < deps.length; i++) {
  8590. const dep = deps[i];
  8591. if (wasTracked(dep) && !newTracked(dep)) {
  8592. dep.delete(effect2);
  8593. } else {
  8594. deps[ptr++] = dep;
  8595. }
  8596. dep.w &= ~trackOpBit;
  8597. dep.n &= ~trackOpBit;
  8598. }
  8599. deps.length = ptr;
  8600. }
  8601. };
  8602. let effectTrackDepth = 0;
  8603. let trackOpBit = 1;
  8604. const maxMarkerBits = 30;
  8605. let activeEffect;
  8606. class ReactiveEffect {
  8607. constructor(fn, scheduler2 = null, scope) {
  8608. this.fn = fn;
  8609. this.scheduler = scheduler2;
  8610. this.active = true;
  8611. this.deps = [];
  8612. this.parent = void 0;
  8613. recordEffectScope(this, scope);
  8614. }
  8615. run() {
  8616. if (!this.active) {
  8617. return this.fn();
  8618. }
  8619. let parent = activeEffect;
  8620. let lastShouldTrack = shouldTrack;
  8621. while (parent) {
  8622. if (parent === this) {
  8623. return;
  8624. }
  8625. parent = parent.parent;
  8626. }
  8627. try {
  8628. this.parent = activeEffect;
  8629. activeEffect = this;
  8630. shouldTrack = true;
  8631. trackOpBit = 1 << ++effectTrackDepth;
  8632. if (effectTrackDepth <= maxMarkerBits) {
  8633. initDepMarkers(this);
  8634. } else {
  8635. cleanupEffect(this);
  8636. }
  8637. return this.fn();
  8638. } finally {
  8639. if (effectTrackDepth <= maxMarkerBits) {
  8640. finalizeDepMarkers(this);
  8641. }
  8642. trackOpBit = 1 << --effectTrackDepth;
  8643. activeEffect = this.parent;
  8644. shouldTrack = lastShouldTrack;
  8645. this.parent = void 0;
  8646. if (this.deferStop) {
  8647. this.stop();
  8648. }
  8649. }
  8650. }
  8651. stop() {
  8652. if (activeEffect === this) {
  8653. this.deferStop = true;
  8654. } else if (this.active) {
  8655. cleanupEffect(this);
  8656. if (this.onStop) {
  8657. this.onStop();
  8658. }
  8659. this.active = false;
  8660. }
  8661. }
  8662. }
  8663. function cleanupEffect(effect2) {
  8664. const { deps } = effect2;
  8665. if (deps.length) {
  8666. for (let i = 0; i < deps.length; i++) {
  8667. deps[i].delete(effect2);
  8668. }
  8669. deps.length = 0;
  8670. }
  8671. }
  8672. let shouldTrack = true;
  8673. function trackEffects(dep, debuggerEventExtraInfo) {
  8674. let shouldTrack2 = false;
  8675. if (effectTrackDepth <= maxMarkerBits) {
  8676. if (!newTracked(dep)) {
  8677. dep.n |= trackOpBit;
  8678. shouldTrack2 = !wasTracked(dep);
  8679. }
  8680. } else {
  8681. shouldTrack2 = !dep.has(activeEffect);
  8682. }
  8683. if (shouldTrack2) {
  8684. dep.add(activeEffect);
  8685. activeEffect.deps.push(dep);
  8686. }
  8687. }
  8688. function triggerEffects(dep, debuggerEventExtraInfo) {
  8689. const effects = isArray(dep) ? dep : [...dep];
  8690. for (const effect2 of effects) {
  8691. if (effect2.computed) {
  8692. triggerEffect(effect2);
  8693. }
  8694. }
  8695. for (const effect2 of effects) {
  8696. if (!effect2.computed) {
  8697. triggerEffect(effect2);
  8698. }
  8699. }
  8700. }
  8701. function triggerEffect(effect2, debuggerEventExtraInfo) {
  8702. if (effect2 !== activeEffect || effect2.allowRecurse) {
  8703. if (effect2.scheduler) {
  8704. effect2.scheduler();
  8705. } else {
  8706. effect2.run();
  8707. }
  8708. }
  8709. }
  8710. function toRaw(observed) {
  8711. const raw = observed && observed["__v_raw"];
  8712. return raw ? toRaw(raw) : observed;
  8713. }
  8714. function trackRefValue(ref2) {
  8715. if (shouldTrack && activeEffect) {
  8716. ref2 = toRaw(ref2);
  8717. {
  8718. trackEffects(ref2.dep || (ref2.dep = createDep()));
  8719. }
  8720. }
  8721. }
  8722. function triggerRefValue(ref2, newVal) {
  8723. ref2 = toRaw(ref2);
  8724. if (ref2.dep) {
  8725. {
  8726. triggerEffects(ref2.dep);
  8727. }
  8728. }
  8729. }
  8730. class ComputedRefImpl {
  8731. constructor(getter, _setter, isReadonly2, isSSR) {
  8732. this._setter = _setter;
  8733. this.dep = void 0;
  8734. this.__v_isRef = true;
  8735. this._dirty = true;
  8736. this.effect = new ReactiveEffect(getter, () => {
  8737. if (!this._dirty) {
  8738. this._dirty = true;
  8739. triggerRefValue(this);
  8740. }
  8741. });
  8742. this.effect.computed = this;
  8743. this.effect.active = this._cacheable = !isSSR;
  8744. this["__v_isReadonly"] = isReadonly2;
  8745. }
  8746. get value() {
  8747. const self = toRaw(this);
  8748. trackRefValue(self);
  8749. if (self._dirty || !self._cacheable) {
  8750. self._dirty = false;
  8751. self._value = self.effect.run();
  8752. }
  8753. return self._value;
  8754. }
  8755. set value(newValue) {
  8756. this._setter(newValue);
  8757. }
  8758. }
  8759. function computed(getterOrOptions, debugOptions, isSSR = false) {
  8760. let getter;
  8761. let setter;
  8762. const onlyGetter = isFunction(getterOrOptions);
  8763. if (onlyGetter) {
  8764. getter = getterOrOptions;
  8765. setter = NOOP;
  8766. } else {
  8767. getter = getterOrOptions.get;
  8768. setter = getterOrOptions.set;
  8769. }
  8770. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  8771. return cRef;
  8772. }
  8773. const useLockscreen = (trigger) => {
  8774. if (!vue.isRef(trigger)) {
  8775. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  8776. }
  8777. const ns = useNamespace("popup");
  8778. const hiddenCls = computed(() => ns.bm("parent", "hidden"));
  8779. if (!isClient || hasClass(document.body, hiddenCls.value)) {
  8780. return;
  8781. }
  8782. let scrollBarWidth = 0;
  8783. let withoutHiddenClass = false;
  8784. let bodyWidth = "0";
  8785. const cleanup = () => {
  8786. setTimeout(() => {
  8787. removeClass(document.body, hiddenCls.value);
  8788. if (withoutHiddenClass) {
  8789. document.body.style.width = bodyWidth;
  8790. }
  8791. }, 200);
  8792. };
  8793. vue.watch(trigger, (val) => {
  8794. if (!val) {
  8795. cleanup();
  8796. return;
  8797. }
  8798. withoutHiddenClass = !hasClass(document.body, hiddenCls.value);
  8799. if (withoutHiddenClass) {
  8800. bodyWidth = document.body.style.width;
  8801. }
  8802. scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  8803. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  8804. const bodyOverflowY = getStyle(document.body, "overflowY");
  8805. if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  8806. document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
  8807. }
  8808. addClass(document.body, hiddenCls.value);
  8809. });
  8810. vue.onScopeDispose(() => cleanup());
  8811. };
  8812. const modalStack = [];
  8813. const closeModal = (e) => {
  8814. if (modalStack.length === 0)
  8815. return;
  8816. if (e.code === EVENT_CODE.esc) {
  8817. e.stopPropagation();
  8818. const topModal = modalStack[modalStack.length - 1];
  8819. topModal.handleClose();
  8820. }
  8821. };
  8822. const useModal = (instance, visibleRef) => {
  8823. vue.watch(visibleRef, (val) => {
  8824. if (val) {
  8825. modalStack.push(instance);
  8826. } else {
  8827. modalStack.splice(modalStack.indexOf(instance), 1);
  8828. }
  8829. });
  8830. };
  8831. if (isClient)
  8832. useEventListener(document, "keydown", closeModal);
  8833. const _prop = buildProp({
  8834. type: definePropType(Boolean),
  8835. default: null
  8836. });
  8837. const _event = buildProp({
  8838. type: definePropType(Function)
  8839. });
  8840. const createModelToggleComposable = (name) => {
  8841. const updateEventKey = `update:${name}`;
  8842. const updateEventKeyRaw = `onUpdate:${name}`;
  8843. const useModelToggleEmits2 = [updateEventKey];
  8844. const useModelToggleProps2 = {
  8845. [name]: _prop,
  8846. [updateEventKeyRaw]: _event
  8847. };
  8848. const useModelToggle2 = ({
  8849. indicator,
  8850. toggleReason,
  8851. shouldHideWhenRouteChanges,
  8852. shouldProceed,
  8853. onShow,
  8854. onHide
  8855. }) => {
  8856. const instance = vue.getCurrentInstance();
  8857. const { emit } = instance;
  8858. const props = instance.props;
  8859. const hasUpdateHandler = vue.computed(() => isFunction(props[updateEventKeyRaw]));
  8860. const isModelBindingAbsent = vue.computed(() => props[name] === null);
  8861. const doShow = (event) => {
  8862. if (indicator.value === true) {
  8863. return;
  8864. }
  8865. indicator.value = true;
  8866. if (toggleReason) {
  8867. toggleReason.value = event;
  8868. }
  8869. if (isFunction(onShow)) {
  8870. onShow(event);
  8871. }
  8872. };
  8873. const doHide = (event) => {
  8874. if (indicator.value === false) {
  8875. return;
  8876. }
  8877. indicator.value = false;
  8878. if (toggleReason) {
  8879. toggleReason.value = event;
  8880. }
  8881. if (isFunction(onHide)) {
  8882. onHide(event);
  8883. }
  8884. };
  8885. const show = (event) => {
  8886. if (props.disabled === true || isFunction(shouldProceed) && !shouldProceed())
  8887. return;
  8888. const shouldEmit = hasUpdateHandler.value && isClient;
  8889. if (shouldEmit) {
  8890. emit(updateEventKey, true);
  8891. }
  8892. if (isModelBindingAbsent.value || !shouldEmit) {
  8893. doShow(event);
  8894. }
  8895. };
  8896. const hide = (event) => {
  8897. if (props.disabled === true || !isClient)
  8898. return;
  8899. const shouldEmit = hasUpdateHandler.value && isClient;
  8900. if (shouldEmit) {
  8901. emit(updateEventKey, false);
  8902. }
  8903. if (isModelBindingAbsent.value || !shouldEmit) {
  8904. doHide(event);
  8905. }
  8906. };
  8907. const onChange = (val) => {
  8908. if (!isBoolean(val))
  8909. return;
  8910. if (props.disabled && val) {
  8911. if (hasUpdateHandler.value) {
  8912. emit(updateEventKey, false);
  8913. }
  8914. } else if (indicator.value !== val) {
  8915. if (val) {
  8916. doShow();
  8917. } else {
  8918. doHide();
  8919. }
  8920. }
  8921. };
  8922. const toggle = () => {
  8923. if (indicator.value) {
  8924. hide();
  8925. } else {
  8926. show();
  8927. }
  8928. };
  8929. vue.watch(() => props[name], onChange);
  8930. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  8931. vue.watch(() => ({
  8932. ...instance.proxy.$route
  8933. }), () => {
  8934. if (shouldHideWhenRouteChanges.value && indicator.value) {
  8935. hide();
  8936. }
  8937. });
  8938. }
  8939. vue.onMounted(() => {
  8940. onChange(props[name]);
  8941. });
  8942. return {
  8943. hide,
  8944. show,
  8945. toggle,
  8946. hasUpdateHandler
  8947. };
  8948. };
  8949. return {
  8950. useModelToggle: useModelToggle2,
  8951. useModelToggleProps: useModelToggleProps2,
  8952. useModelToggleEmits: useModelToggleEmits2
  8953. };
  8954. };
  8955. const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue");
  8956. const usePreventGlobal = (indicator, evt, cb) => {
  8957. const prevent = (e) => {
  8958. if (cb(e))
  8959. e.stopImmediatePropagation();
  8960. };
  8961. let stop = void 0;
  8962. vue.watch(() => indicator.value, (val) => {
  8963. if (val) {
  8964. stop = useEventListener(document, evt, prevent, true);
  8965. } else {
  8966. stop == null ? void 0 : stop();
  8967. }
  8968. }, { immediate: true });
  8969. };
  8970. const useRestoreActive = (toggle, initialFocus) => {
  8971. let previousActive;
  8972. vue.watch(() => toggle.value, (val) => {
  8973. var _a, _b;
  8974. if (val) {
  8975. previousActive = document.activeElement;
  8976. if (vue.isRef(initialFocus)) {
  8977. (_b = (_a = initialFocus.value).focus) == null ? void 0 : _b.call(_a);
  8978. }
  8979. } else {
  8980. {
  8981. previousActive.focus();
  8982. }
  8983. }
  8984. });
  8985. };
  8986. const useSameTarget = (handleClick) => {
  8987. if (!handleClick) {
  8988. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  8989. }
  8990. let mousedownTarget = false;
  8991. let mouseupTarget = false;
  8992. const onClick = (e) => {
  8993. if (mousedownTarget && mouseupTarget) {
  8994. handleClick(e);
  8995. }
  8996. mousedownTarget = mouseupTarget = false;
  8997. };
  8998. const onMousedown = (e) => {
  8999. mousedownTarget = e.target === e.currentTarget;
  9000. };
  9001. const onMouseup = (e) => {
  9002. mouseupTarget = e.target === e.currentTarget;
  9003. };
  9004. return { onClick, onMousedown, onMouseup };
  9005. };
  9006. const useTeleport = (contentRenderer, appendToBody) => {
  9007. const isTeleportVisible = vue.ref(false);
  9008. if (!isClient) {
  9009. return {
  9010. isTeleportVisible,
  9011. showTeleport: NOOP,
  9012. hideTeleport: NOOP,
  9013. renderTeleport: NOOP
  9014. };
  9015. }
  9016. let $el = null;
  9017. const showTeleport = () => {
  9018. isTeleportVisible.value = true;
  9019. if ($el !== null)
  9020. return;
  9021. $el = createGlobalNode();
  9022. };
  9023. const hideTeleport = () => {
  9024. isTeleportVisible.value = false;
  9025. if ($el !== null) {
  9026. removeGlobalNode($el);
  9027. $el = null;
  9028. }
  9029. };
  9030. const renderTeleport = () => {
  9031. return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [vue.h(vue.Teleport, { to: $el }, contentRenderer())] : void 0;
  9032. };
  9033. vue.onUnmounted(hideTeleport);
  9034. return {
  9035. isTeleportVisible,
  9036. showTeleport,
  9037. hideTeleport,
  9038. renderTeleport
  9039. };
  9040. };
  9041. const useThrottleRender = (loading, throttle = 0) => {
  9042. if (throttle === 0)
  9043. return loading;
  9044. const throttled = vue.ref(false);
  9045. let timeoutHandle = 0;
  9046. const dispatchThrottling = () => {
  9047. if (timeoutHandle) {
  9048. clearTimeout(timeoutHandle);
  9049. }
  9050. timeoutHandle = window.setTimeout(() => {
  9051. throttled.value = loading.value;
  9052. }, throttle);
  9053. };
  9054. vue.onMounted(dispatchThrottling);
  9055. vue.watch(() => loading.value, (val) => {
  9056. if (val) {
  9057. dispatchThrottling();
  9058. } else {
  9059. throttled.value = val;
  9060. }
  9061. });
  9062. return throttled;
  9063. };
  9064. function useTimeout() {
  9065. let timeoutHandle;
  9066. const registerTimeout = (fn, delay) => {
  9067. cancelTimeout();
  9068. timeoutHandle = window.setTimeout(fn, delay);
  9069. };
  9070. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  9071. tryOnScopeDispose(() => cancelTimeout());
  9072. return {
  9073. registerTimeout,
  9074. cancelTimeout
  9075. };
  9076. }
  9077. const AFTER_APPEAR = "after-appear";
  9078. const AFTER_ENTER = "after-enter";
  9079. const AFTER_LEAVE = "after-leave";
  9080. const APPEAR = "appear";
  9081. const APPEAR_CANCELLED = "appear-cancelled";
  9082. const BEFORE_ENTER = "before-enter";
  9083. const BEFORE_LEAVE = "before-leave";
  9084. const ENTER = "enter";
  9085. const ENTER_CANCELLED = "enter-cancelled";
  9086. const LEAVE = "leave";
  9087. const LEAVE_CANCELLED = "leave-cancelled";
  9088. const useTransitionFallthroughEmits = [
  9089. AFTER_APPEAR,
  9090. AFTER_ENTER,
  9091. AFTER_LEAVE,
  9092. APPEAR,
  9093. APPEAR_CANCELLED,
  9094. BEFORE_ENTER,
  9095. BEFORE_LEAVE,
  9096. ENTER,
  9097. ENTER_CANCELLED,
  9098. LEAVE,
  9099. LEAVE_CANCELLED
  9100. ];
  9101. const useTransitionFallthrough = () => {
  9102. const { emit } = vue.getCurrentInstance();
  9103. return {
  9104. onAfterAppear: () => {
  9105. emit(AFTER_APPEAR);
  9106. },
  9107. onAfterEnter: () => {
  9108. emit(AFTER_ENTER);
  9109. },
  9110. onAfterLeave: () => {
  9111. emit(AFTER_LEAVE);
  9112. },
  9113. onAppearCancelled: () => {
  9114. emit(APPEAR_CANCELLED);
  9115. },
  9116. onBeforeEnter: () => {
  9117. emit(BEFORE_ENTER);
  9118. },
  9119. onBeforeLeave: () => {
  9120. emit(BEFORE_LEAVE);
  9121. },
  9122. onEnter: () => {
  9123. emit(ENTER);
  9124. },
  9125. onEnterCancelled: () => {
  9126. emit(ENTER_CANCELLED);
  9127. },
  9128. onLeave: () => {
  9129. emit(LEAVE);
  9130. },
  9131. onLeaveCancelled: () => {
  9132. emit(LEAVE_CANCELLED);
  9133. }
  9134. };
  9135. };
  9136. let registeredEscapeHandlers = [];
  9137. const cachedHandler = (e) => {
  9138. const event = e;
  9139. if (event.key === EVENT_CODE.esc) {
  9140. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  9141. }
  9142. };
  9143. const useEscapeKeydown = (handler) => {
  9144. vue.onMounted(() => {
  9145. if (registeredEscapeHandlers.length === 0) {
  9146. document.addEventListener("keydown", cachedHandler);
  9147. }
  9148. if (isClient)
  9149. registeredEscapeHandlers.push(handler);
  9150. });
  9151. vue.onBeforeUnmount(() => {
  9152. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  9153. if (registeredEscapeHandlers.length === 0) {
  9154. if (isClient)
  9155. document.removeEventListener("keydown", cachedHandler);
  9156. }
  9157. });
  9158. };
  9159. let cachedContainer;
  9160. const namespace = useGlobalConfig("namespace", defaultNamespace);
  9161. const POPPER_CONTAINER_ID = `${namespace.value}-popper-container-${generateId()}`;
  9162. const POPPER_CONTAINER_SELECTOR = `#${POPPER_CONTAINER_ID}`;
  9163. const createContainer = () => {
  9164. const container = document.createElement("div");
  9165. container.id = POPPER_CONTAINER_ID;
  9166. document.body.appendChild(container);
  9167. return container;
  9168. };
  9169. const usePopperContainer = () => {
  9170. vue.onBeforeMount(() => {
  9171. if (!isClient)
  9172. return;
  9173. if (!cachedContainer || !document.body.querySelector(POPPER_CONTAINER_SELECTOR)) {
  9174. cachedContainer = createContainer();
  9175. }
  9176. });
  9177. };
  9178. const useDelayedRender = ({
  9179. indicator,
  9180. intermediateIndicator,
  9181. shouldSetIntermediate = () => true,
  9182. beforeShow,
  9183. afterShow,
  9184. afterHide,
  9185. beforeHide
  9186. }) => {
  9187. vue.watch(() => vue.unref(indicator), (val) => {
  9188. if (val) {
  9189. beforeShow == null ? void 0 : beforeShow();
  9190. vue.nextTick(() => {
  9191. if (!vue.unref(indicator))
  9192. return;
  9193. if (shouldSetIntermediate("show")) {
  9194. intermediateIndicator.value = true;
  9195. }
  9196. });
  9197. } else {
  9198. beforeHide == null ? void 0 : beforeHide();
  9199. vue.nextTick(() => {
  9200. if (vue.unref(indicator))
  9201. return;
  9202. if (shouldSetIntermediate("hide")) {
  9203. intermediateIndicator.value = false;
  9204. }
  9205. });
  9206. }
  9207. });
  9208. vue.watch(() => intermediateIndicator.value, (val) => {
  9209. if (val) {
  9210. afterShow == null ? void 0 : afterShow();
  9211. } else {
  9212. afterHide == null ? void 0 : afterHide();
  9213. }
  9214. });
  9215. };
  9216. const useDelayedToggleProps = buildProps({
  9217. showAfter: {
  9218. type: Number,
  9219. default: 0
  9220. },
  9221. hideAfter: {
  9222. type: Number,
  9223. default: 200
  9224. }
  9225. });
  9226. const useDelayedToggle = ({
  9227. showAfter,
  9228. hideAfter,
  9229. open,
  9230. close
  9231. }) => {
  9232. const { registerTimeout } = useTimeout();
  9233. const onOpen = (event) => {
  9234. registerTimeout(() => {
  9235. open(event);
  9236. }, vue.unref(showAfter));
  9237. };
  9238. const onClose = (event) => {
  9239. registerTimeout(() => {
  9240. close(event);
  9241. }, vue.unref(hideAfter));
  9242. };
  9243. return {
  9244. onOpen,
  9245. onClose
  9246. };
  9247. };
  9248. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  9249. const useForwardRef = (forwardRef) => {
  9250. const setForwardRef = (el) => {
  9251. forwardRef.value = el;
  9252. };
  9253. vue.provide(FORWARD_REF_INJECTION_KEY, {
  9254. setForwardRef
  9255. });
  9256. };
  9257. const useForwardRefDirective = (setForwardRef) => {
  9258. return {
  9259. mounted(el) {
  9260. setForwardRef(el);
  9261. },
  9262. updated(el) {
  9263. setForwardRef(el);
  9264. },
  9265. unmounted() {
  9266. setForwardRef(null);
  9267. }
  9268. };
  9269. };
  9270. const zIndex = vue.ref(0);
  9271. const useZIndex = () => {
  9272. const initialZIndex = useGlobalConfig("zIndex", 2e3);
  9273. const currentZIndex = vue.computed(() => initialZIndex.value + zIndex.value);
  9274. const nextZIndex = () => {
  9275. zIndex.value++;
  9276. return currentZIndex.value;
  9277. };
  9278. return {
  9279. initialZIndex,
  9280. currentZIndex,
  9281. nextZIndex
  9282. };
  9283. };
  9284. function getSide(placement) {
  9285. return placement.split('-')[0];
  9286. }
  9287. function getAlignment(placement) {
  9288. return placement.split('-')[1];
  9289. }
  9290. function getMainAxisFromPlacement(placement) {
  9291. return ['top', 'bottom'].includes(getSide(placement)) ? 'x' : 'y';
  9292. }
  9293. function getLengthFromAxis(axis) {
  9294. return axis === 'y' ? 'height' : 'width';
  9295. }
  9296. function computeCoordsFromPlacement(_ref, placement, rtl) {
  9297. let {
  9298. reference,
  9299. floating
  9300. } = _ref;
  9301. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  9302. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  9303. const mainAxis = getMainAxisFromPlacement(placement);
  9304. const length = getLengthFromAxis(mainAxis);
  9305. const commonAlign = reference[length] / 2 - floating[length] / 2;
  9306. const side = getSide(placement);
  9307. const isVertical = mainAxis === 'x';
  9308. let coords;
  9309. switch (side) {
  9310. case 'top':
  9311. coords = {
  9312. x: commonX,
  9313. y: reference.y - floating.height
  9314. };
  9315. break;
  9316. case 'bottom':
  9317. coords = {
  9318. x: commonX,
  9319. y: reference.y + reference.height
  9320. };
  9321. break;
  9322. case 'right':
  9323. coords = {
  9324. x: reference.x + reference.width,
  9325. y: commonY
  9326. };
  9327. break;
  9328. case 'left':
  9329. coords = {
  9330. x: reference.x - floating.width,
  9331. y: commonY
  9332. };
  9333. break;
  9334. default:
  9335. coords = {
  9336. x: reference.x,
  9337. y: reference.y
  9338. };
  9339. }
  9340. switch (getAlignment(placement)) {
  9341. case 'start':
  9342. coords[mainAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  9343. break;
  9344. case 'end':
  9345. coords[mainAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  9346. break;
  9347. }
  9348. return coords;
  9349. }
  9350. /**
  9351. * Computes the `x` and `y` coordinates that will place the floating element
  9352. * next to a reference element when it is given a certain positioning strategy.
  9353. *
  9354. * This export does not have any `platform` interface logic. You will need to
  9355. * write one for the platform you are using Floating UI with.
  9356. */
  9357. const computePosition$1 = async (reference, floating, config) => {
  9358. const {
  9359. placement = 'bottom',
  9360. strategy = 'absolute',
  9361. middleware = [],
  9362. platform
  9363. } = config;
  9364. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  9365. if (process.env.NODE_ENV !== "production") {
  9366. if (platform == null) {
  9367. console.error(['Floating UI: `platform` property was not passed to config. If you', 'want to use Floating UI on the web, install @floating-ui/dom', 'instead of the /core package. Otherwise, you can create your own', '`platform`: https://floating-ui.com/docs/platform'].join(' '));
  9368. }
  9369. if (middleware.filter(_ref => {
  9370. let {
  9371. name
  9372. } = _ref;
  9373. return name === 'autoPlacement' || name === 'flip';
  9374. }).length > 1) {
  9375. throw new Error(['Floating UI: duplicate `flip` and/or `autoPlacement`', 'middleware detected. This will lead to an infinite loop. Ensure only', 'one of either has been passed to the `middleware` array.'].join(' '));
  9376. }
  9377. }
  9378. let rects = await platform.getElementRects({
  9379. reference,
  9380. floating,
  9381. strategy
  9382. });
  9383. let {
  9384. x,
  9385. y
  9386. } = computeCoordsFromPlacement(rects, placement, rtl);
  9387. let statefulPlacement = placement;
  9388. let middlewareData = {};
  9389. let resetCount = 0;
  9390. for (let i = 0; i < middleware.length; i++) {
  9391. const {
  9392. name,
  9393. fn
  9394. } = middleware[i];
  9395. const {
  9396. x: nextX,
  9397. y: nextY,
  9398. data,
  9399. reset
  9400. } = await fn({
  9401. x,
  9402. y,
  9403. initialPlacement: placement,
  9404. placement: statefulPlacement,
  9405. strategy,
  9406. middlewareData,
  9407. rects,
  9408. platform,
  9409. elements: {
  9410. reference,
  9411. floating
  9412. }
  9413. });
  9414. x = nextX != null ? nextX : x;
  9415. y = nextY != null ? nextY : y;
  9416. middlewareData = { ...middlewareData,
  9417. [name]: { ...middlewareData[name],
  9418. ...data
  9419. }
  9420. };
  9421. if (process.env.NODE_ENV !== "production") {
  9422. if (resetCount > 50) {
  9423. console.warn(['Floating UI: The middleware lifecycle appears to be running in an', 'infinite loop. This is usually caused by a `reset` continually', 'being returned without a break condition.'].join(' '));
  9424. }
  9425. }
  9426. if (reset && resetCount <= 50) {
  9427. resetCount++;
  9428. if (typeof reset === 'object') {
  9429. if (reset.placement) {
  9430. statefulPlacement = reset.placement;
  9431. }
  9432. if (reset.rects) {
  9433. rects = reset.rects === true ? await platform.getElementRects({
  9434. reference,
  9435. floating,
  9436. strategy
  9437. }) : reset.rects;
  9438. }
  9439. ({
  9440. x,
  9441. y
  9442. } = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  9443. }
  9444. i = -1;
  9445. continue;
  9446. }
  9447. }
  9448. return {
  9449. x,
  9450. y,
  9451. placement: statefulPlacement,
  9452. strategy,
  9453. middlewareData
  9454. };
  9455. };
  9456. function expandPaddingObject(padding) {
  9457. return {
  9458. top: 0,
  9459. right: 0,
  9460. bottom: 0,
  9461. left: 0,
  9462. ...padding
  9463. };
  9464. }
  9465. function getSideObjectFromPadding(padding) {
  9466. return typeof padding !== 'number' ? expandPaddingObject(padding) : {
  9467. top: padding,
  9468. right: padding,
  9469. bottom: padding,
  9470. left: padding
  9471. };
  9472. }
  9473. function rectToClientRect(rect) {
  9474. return { ...rect,
  9475. top: rect.y,
  9476. left: rect.x,
  9477. right: rect.x + rect.width,
  9478. bottom: rect.y + rect.height
  9479. };
  9480. }
  9481. const min$2 = Math.min;
  9482. const max$2 = Math.max;
  9483. function within(min$1, value, max$1) {
  9484. return max$2(min$1, min$2(value, max$1));
  9485. }
  9486. /**
  9487. * Positions an inner element of the floating element such that it is centered
  9488. * to the reference element.
  9489. * @see https://floating-ui.com/docs/arrow
  9490. */
  9491. const arrow = options => ({
  9492. name: 'arrow',
  9493. options,
  9494. async fn(middlewareArguments) {
  9495. // Since `element` is required, we don't Partial<> the type
  9496. const {
  9497. element,
  9498. padding = 0
  9499. } = options != null ? options : {};
  9500. const {
  9501. x,
  9502. y,
  9503. placement,
  9504. rects,
  9505. platform
  9506. } = middlewareArguments;
  9507. if (element == null) {
  9508. if (process.env.NODE_ENV !== "production") {
  9509. console.warn('Floating UI: No `element` was passed to the `arrow` middleware.');
  9510. }
  9511. return {};
  9512. }
  9513. const paddingObject = getSideObjectFromPadding(padding);
  9514. const coords = {
  9515. x,
  9516. y
  9517. };
  9518. const axis = getMainAxisFromPlacement(placement);
  9519. const alignment = getAlignment(placement);
  9520. const length = getLengthFromAxis(axis);
  9521. const arrowDimensions = await platform.getDimensions(element);
  9522. const minProp = axis === 'y' ? 'top' : 'left';
  9523. const maxProp = axis === 'y' ? 'bottom' : 'right';
  9524. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  9525. const startDiff = coords[axis] - rects.reference[axis];
  9526. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  9527. let clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  9528. if (clientSize === 0) {
  9529. clientSize = rects.floating[length];
  9530. }
  9531. const centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the floating element if the center
  9532. // point is outside the floating element's bounds
  9533. const min = paddingObject[minProp];
  9534. const max = clientSize - arrowDimensions[length] - paddingObject[maxProp];
  9535. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  9536. const offset = within(min, center, max); // Make sure that arrow points at the reference
  9537. const alignmentPadding = alignment === 'start' ? paddingObject[minProp] : paddingObject[maxProp];
  9538. const shouldAddOffset = alignmentPadding > 0 && center !== offset && rects.reference[length] <= rects.floating[length];
  9539. const alignmentOffset = shouldAddOffset ? center < min ? min - center : max - center : 0;
  9540. return {
  9541. [axis]: coords[axis] - alignmentOffset,
  9542. data: {
  9543. [axis]: offset,
  9544. centerOffset: center - offset
  9545. }
  9546. };
  9547. }
  9548. });
  9549. async function convertValueToCoords(middlewareArguments, value) {
  9550. const {
  9551. placement,
  9552. platform,
  9553. elements
  9554. } = middlewareArguments;
  9555. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  9556. const side = getSide(placement);
  9557. const alignment = getAlignment(placement);
  9558. const isVertical = getMainAxisFromPlacement(placement) === 'x';
  9559. const mainAxisMulti = ['left', 'top'].includes(side) ? -1 : 1;
  9560. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  9561. const rawValue = typeof value === 'function' ? value(middlewareArguments) : value; // eslint-disable-next-line prefer-const
  9562. let {
  9563. mainAxis,
  9564. crossAxis,
  9565. alignmentAxis
  9566. } = typeof rawValue === 'number' ? {
  9567. mainAxis: rawValue,
  9568. crossAxis: 0,
  9569. alignmentAxis: null
  9570. } : {
  9571. mainAxis: 0,
  9572. crossAxis: 0,
  9573. alignmentAxis: null,
  9574. ...rawValue
  9575. };
  9576. if (alignment && typeof alignmentAxis === 'number') {
  9577. crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
  9578. }
  9579. return isVertical ? {
  9580. x: crossAxis * crossAxisMulti,
  9581. y: mainAxis * mainAxisMulti
  9582. } : {
  9583. x: mainAxis * mainAxisMulti,
  9584. y: crossAxis * crossAxisMulti
  9585. };
  9586. }
  9587. /**
  9588. * Displaces the floating element from its reference element.
  9589. * @see https://floating-ui.com/docs/offset
  9590. */
  9591. const offset = function (value) {
  9592. if (value === void 0) {
  9593. value = 0;
  9594. }
  9595. return {
  9596. name: 'offset',
  9597. options: value,
  9598. async fn(middlewareArguments) {
  9599. const {
  9600. x,
  9601. y
  9602. } = middlewareArguments;
  9603. const diffCoords = await convertValueToCoords(middlewareArguments, value);
  9604. return {
  9605. x: x + diffCoords.x,
  9606. y: y + diffCoords.y,
  9607. data: diffCoords
  9608. };
  9609. }
  9610. };
  9611. };
  9612. function isWindow(value) {
  9613. return value && value.document && value.location && value.alert && value.setInterval;
  9614. }
  9615. function getWindow(node) {
  9616. if (node == null) {
  9617. return window;
  9618. }
  9619. if (!isWindow(node)) {
  9620. const ownerDocument = node.ownerDocument;
  9621. return ownerDocument ? ownerDocument.defaultView || window : window;
  9622. }
  9623. return node;
  9624. }
  9625. function getComputedStyle$1(element) {
  9626. return getWindow(element).getComputedStyle(element);
  9627. }
  9628. function getNodeName(node) {
  9629. return isWindow(node) ? '' : node ? (node.nodeName || '').toLowerCase() : '';
  9630. }
  9631. function getUAString() {
  9632. const uaData = navigator.userAgentData;
  9633. if (uaData != null && uaData.brands) {
  9634. return uaData.brands.map(item => item.brand + "/" + item.version).join(' ');
  9635. }
  9636. return navigator.userAgent;
  9637. }
  9638. function isHTMLElement(value) {
  9639. return value instanceof getWindow(value).HTMLElement;
  9640. }
  9641. function isElement(value) {
  9642. return value instanceof getWindow(value).Element;
  9643. }
  9644. function isNode(value) {
  9645. return value instanceof getWindow(value).Node;
  9646. }
  9647. function isShadowRoot(node) {
  9648. // Browsers without `ShadowRoot` support
  9649. if (typeof ShadowRoot === 'undefined') {
  9650. return false;
  9651. }
  9652. const OwnElement = getWindow(node).ShadowRoot;
  9653. return node instanceof OwnElement || node instanceof ShadowRoot;
  9654. }
  9655. function isOverflowElement(element) {
  9656. // Firefox wants us to check `-x` and `-y` variations as well
  9657. const {
  9658. overflow,
  9659. overflowX,
  9660. overflowY
  9661. } = getComputedStyle$1(element);
  9662. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  9663. }
  9664. function isTableElement(element) {
  9665. return ['table', 'td', 'th'].includes(getNodeName(element));
  9666. }
  9667. function isContainingBlock(element) {
  9668. // TODO: Try and use feature detection here instead
  9669. const isFirefox = /firefox/i.test(getUAString());
  9670. const css = getComputedStyle$1(element); // This is non-exhaustive but covers the most common CSS properties that
  9671. // create a containing block.
  9672. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  9673. return css.transform !== 'none' || css.perspective !== 'none' || // @ts-ignore (TS 4.1 compat)
  9674. css.contain === 'paint' || ['transform', 'perspective'].includes(css.willChange) || isFirefox && css.willChange === 'filter' || isFirefox && (css.filter ? css.filter !== 'none' : false);
  9675. }
  9676. function isLayoutViewport() {
  9677. // Not Safari
  9678. return !/^((?!chrome|android).)*safari/i.test(getUAString()); // Feature detection for this fails in various ways
  9679. // • Always-visible scrollbar or not
  9680. // • Width of <html>, etc.
  9681. // const vV = win.visualViewport;
  9682. // return vV ? Math.abs(win.innerWidth / vV.scale - vV.width) < 0.5 : true;
  9683. }
  9684. const min$1 = Math.min;
  9685. const max$1 = Math.max;
  9686. const round = Math.round;
  9687. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  9688. var _win$visualViewport$o, _win$visualViewport, _win$visualViewport$o2, _win$visualViewport2;
  9689. if (includeScale === void 0) {
  9690. includeScale = false;
  9691. }
  9692. if (isFixedStrategy === void 0) {
  9693. isFixedStrategy = false;
  9694. }
  9695. const clientRect = element.getBoundingClientRect();
  9696. let scaleX = 1;
  9697. let scaleY = 1;
  9698. if (includeScale && isHTMLElement(element)) {
  9699. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  9700. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  9701. }
  9702. const win = isElement(element) ? getWindow(element) : window;
  9703. const addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  9704. 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;
  9705. 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;
  9706. const width = clientRect.width / scaleX;
  9707. const height = clientRect.height / scaleY;
  9708. return {
  9709. width,
  9710. height,
  9711. top: y,
  9712. right: x + width,
  9713. bottom: y + height,
  9714. left: x,
  9715. x,
  9716. y
  9717. };
  9718. }
  9719. function getDocumentElement(node) {
  9720. return ((isNode(node) ? node.ownerDocument : node.document) || window.document).documentElement;
  9721. }
  9722. function getNodeScroll(element) {
  9723. if (isElement(element)) {
  9724. return {
  9725. scrollLeft: element.scrollLeft,
  9726. scrollTop: element.scrollTop
  9727. };
  9728. }
  9729. return {
  9730. scrollLeft: element.pageXOffset,
  9731. scrollTop: element.pageYOffset
  9732. };
  9733. }
  9734. function getWindowScrollBarX(element) {
  9735. // If <html> has a CSS width greater than the viewport, then this will be
  9736. // incorrect for RTL.
  9737. return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft;
  9738. }
  9739. function isScaled(element) {
  9740. const rect = getBoundingClientRect(element);
  9741. return round(rect.width) !== element.offsetWidth || round(rect.height) !== element.offsetHeight;
  9742. }
  9743. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  9744. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9745. const documentElement = getDocumentElement(offsetParent);
  9746. const rect = getBoundingClientRect(element, // @ts-ignore - checked above (TS 4.1 compat)
  9747. isOffsetParentAnElement && isScaled(offsetParent), strategy === 'fixed');
  9748. let scroll = {
  9749. scrollLeft: 0,
  9750. scrollTop: 0
  9751. };
  9752. const offsets = {
  9753. x: 0,
  9754. y: 0
  9755. };
  9756. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  9757. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  9758. scroll = getNodeScroll(offsetParent);
  9759. }
  9760. if (isHTMLElement(offsetParent)) {
  9761. const offsetRect = getBoundingClientRect(offsetParent, true);
  9762. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9763. offsets.y = offsetRect.y + offsetParent.clientTop;
  9764. } else if (documentElement) {
  9765. offsets.x = getWindowScrollBarX(documentElement);
  9766. }
  9767. }
  9768. return {
  9769. x: rect.left + scroll.scrollLeft - offsets.x,
  9770. y: rect.top + scroll.scrollTop - offsets.y,
  9771. width: rect.width,
  9772. height: rect.height
  9773. };
  9774. }
  9775. function getParentNode(node) {
  9776. if (getNodeName(node) === 'html') {
  9777. return node;
  9778. }
  9779. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  9780. // @ts-ignore
  9781. node.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  9782. node.parentNode || ( // DOM Element detected
  9783. isShadowRoot(node) ? node.host : null) || // ShadowRoot detected
  9784. getDocumentElement(node) // fallback
  9785. );
  9786. }
  9787. function getTrueOffsetParent(element) {
  9788. if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
  9789. return null;
  9790. }
  9791. return composedOffsetParent(element);
  9792. }
  9793. /**
  9794. * Polyfills the old offsetParent behavior from before the spec was changed:
  9795. * https://github.com/w3c/csswg-drafts/issues/159
  9796. */
  9797. function composedOffsetParent(element) {
  9798. let {
  9799. offsetParent
  9800. } = element;
  9801. let ancestor = element;
  9802. let foundInsideSlot = false;
  9803. while (ancestor && ancestor !== offsetParent) {
  9804. const {
  9805. assignedSlot
  9806. } = ancestor;
  9807. if (assignedSlot) {
  9808. let newOffsetParent = assignedSlot.offsetParent;
  9809. if (getComputedStyle$1(assignedSlot).display === 'contents') {
  9810. const hadStyleAttribute = assignedSlot.hasAttribute('style');
  9811. const oldDisplay = assignedSlot.style.display;
  9812. assignedSlot.style.display = getComputedStyle$1(ancestor).display;
  9813. newOffsetParent = assignedSlot.offsetParent;
  9814. assignedSlot.style.display = oldDisplay;
  9815. if (!hadStyleAttribute) {
  9816. assignedSlot.removeAttribute('style');
  9817. }
  9818. }
  9819. ancestor = assignedSlot;
  9820. if (offsetParent !== newOffsetParent) {
  9821. offsetParent = newOffsetParent;
  9822. foundInsideSlot = true;
  9823. }
  9824. } else if (isShadowRoot(ancestor) && ancestor.host && foundInsideSlot) {
  9825. break;
  9826. }
  9827. ancestor = isShadowRoot(ancestor) && ancestor.host || ancestor.parentNode;
  9828. }
  9829. return offsetParent;
  9830. }
  9831. function getContainingBlock(element) {
  9832. let currentNode = getParentNode(element);
  9833. if (isShadowRoot(currentNode)) {
  9834. currentNode = currentNode.host;
  9835. }
  9836. while (isHTMLElement(currentNode) && !['html', 'body'].includes(getNodeName(currentNode))) {
  9837. if (isContainingBlock(currentNode)) {
  9838. return currentNode;
  9839. } else {
  9840. const parent = currentNode.parentNode;
  9841. currentNode = isShadowRoot(parent) ? parent.host : parent;
  9842. }
  9843. }
  9844. return null;
  9845. } // Gets the closest ancestor positioned element. Handles some edge cases,
  9846. // such as table ancestors and cross browser bugs.
  9847. function getOffsetParent(element) {
  9848. const window = getWindow(element);
  9849. let offsetParent = getTrueOffsetParent(element);
  9850. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  9851. offsetParent = getTrueOffsetParent(offsetParent);
  9852. }
  9853. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static' && !isContainingBlock(offsetParent))) {
  9854. return window;
  9855. }
  9856. return offsetParent || getContainingBlock(element) || window;
  9857. }
  9858. function getDimensions(element) {
  9859. if (isHTMLElement(element)) {
  9860. return {
  9861. width: element.offsetWidth,
  9862. height: element.offsetHeight
  9863. };
  9864. }
  9865. const rect = getBoundingClientRect(element);
  9866. return {
  9867. width: rect.width,
  9868. height: rect.height
  9869. };
  9870. }
  9871. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  9872. let {
  9873. rect,
  9874. offsetParent,
  9875. strategy
  9876. } = _ref;
  9877. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  9878. const documentElement = getDocumentElement(offsetParent);
  9879. if (offsetParent === documentElement) {
  9880. return rect;
  9881. }
  9882. let scroll = {
  9883. scrollLeft: 0,
  9884. scrollTop: 0
  9885. };
  9886. const offsets = {
  9887. x: 0,
  9888. y: 0
  9889. };
  9890. if (isOffsetParentAnElement || !isOffsetParentAnElement && strategy !== 'fixed') {
  9891. if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
  9892. scroll = getNodeScroll(offsetParent);
  9893. }
  9894. if (isHTMLElement(offsetParent)) {
  9895. const offsetRect = getBoundingClientRect(offsetParent, true);
  9896. offsets.x = offsetRect.x + offsetParent.clientLeft;
  9897. offsets.y = offsetRect.y + offsetParent.clientTop;
  9898. } // This doesn't appear to be need to be negated.
  9899. // else if (documentElement) {
  9900. // offsets.x = getWindowScrollBarX(documentElement);
  9901. // }
  9902. }
  9903. return { ...rect,
  9904. x: rect.x - scroll.scrollLeft + offsets.x,
  9905. y: rect.y - scroll.scrollTop + offsets.y
  9906. };
  9907. }
  9908. function getViewportRect(element, strategy) {
  9909. const win = getWindow(element);
  9910. const html = getDocumentElement(element);
  9911. const visualViewport = win.visualViewport;
  9912. let width = html.clientWidth;
  9913. let height = html.clientHeight;
  9914. let x = 0;
  9915. let y = 0;
  9916. if (visualViewport) {
  9917. width = visualViewport.width;
  9918. height = visualViewport.height;
  9919. const layoutViewport = isLayoutViewport();
  9920. if (layoutViewport || !layoutViewport && strategy === 'fixed') {
  9921. x = visualViewport.offsetLeft;
  9922. y = visualViewport.offsetTop;
  9923. }
  9924. }
  9925. return {
  9926. width,
  9927. height,
  9928. x,
  9929. y
  9930. };
  9931. }
  9932. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  9933. function getDocumentRect(element) {
  9934. var _element$ownerDocumen;
  9935. const html = getDocumentElement(element);
  9936. const scroll = getNodeScroll(element);
  9937. const body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  9938. const width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  9939. const height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  9940. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  9941. const y = -scroll.scrollTop;
  9942. if (getComputedStyle$1(body || html).direction === 'rtl') {
  9943. x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width;
  9944. }
  9945. return {
  9946. width,
  9947. height,
  9948. x,
  9949. y
  9950. };
  9951. }
  9952. function getNearestOverflowAncestor(node) {
  9953. const parentNode = getParentNode(node);
  9954. if (['html', 'body', '#document'].includes(getNodeName(parentNode))) {
  9955. // @ts-ignore assume body is always available
  9956. return node.ownerDocument.body;
  9957. }
  9958. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
  9959. return parentNode;
  9960. }
  9961. return getNearestOverflowAncestor(parentNode);
  9962. }
  9963. function getOverflowAncestors(node, list) {
  9964. var _node$ownerDocument;
  9965. if (list === void 0) {
  9966. list = [];
  9967. }
  9968. const scrollableAncestor = getNearestOverflowAncestor(node);
  9969. const isBody = scrollableAncestor === ((_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.body);
  9970. const win = getWindow(scrollableAncestor);
  9971. const target = isBody ? [win].concat(win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : []) : scrollableAncestor;
  9972. const updatedList = list.concat(target);
  9973. return isBody ? updatedList : // @ts-ignore: isBody tells us target will be an HTMLElement here
  9974. updatedList.concat(getOverflowAncestors(target));
  9975. }
  9976. function contains(parent, child) {
  9977. const rootNode = child.getRootNode == null ? void 0 : child.getRootNode(); // First, attempt with faster native method
  9978. if (parent.contains(child)) {
  9979. return true;
  9980. } // then fallback to custom implementation with Shadow DOM support
  9981. else if (rootNode && isShadowRoot(rootNode)) {
  9982. let next = child;
  9983. do {
  9984. // use `===` replace node.isSameNode()
  9985. if (next && parent === next) {
  9986. return true;
  9987. } // @ts-ignore: need a better way to handle this...
  9988. next = next.parentNode || next.host;
  9989. } while (next);
  9990. }
  9991. return false;
  9992. }
  9993. function getInnerBoundingClientRect(element, strategy) {
  9994. const clientRect = getBoundingClientRect(element, false, strategy === 'fixed');
  9995. const top = clientRect.top + element.clientTop;
  9996. const left = clientRect.left + element.clientLeft;
  9997. return {
  9998. top,
  9999. left,
  10000. x: left,
  10001. y: top,
  10002. right: left + element.clientWidth,
  10003. bottom: top + element.clientHeight,
  10004. width: element.clientWidth,
  10005. height: element.clientHeight
  10006. };
  10007. }
  10008. function getClientRectFromClippingAncestor(element, clippingParent, strategy) {
  10009. if (clippingParent === 'viewport') {
  10010. return rectToClientRect(getViewportRect(element, strategy));
  10011. }
  10012. if (isElement(clippingParent)) {
  10013. return getInnerBoundingClientRect(clippingParent, strategy);
  10014. }
  10015. return rectToClientRect(getDocumentRect(getDocumentElement(element)));
  10016. } // A "clipping ancestor" is an overflowable container with the characteristic of
  10017. // clipping (or hiding) overflowing elements with a position different from
  10018. // `initial`
  10019. function getClippingAncestors(element) {
  10020. const clippingAncestors = getOverflowAncestors(element);
  10021. const canEscapeClipping = ['absolute', 'fixed'].includes(getComputedStyle$1(element).position);
  10022. const clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  10023. if (!isElement(clipperElement)) {
  10024. return [];
  10025. } // @ts-ignore isElement check ensures we return Array<Element>
  10026. return clippingAncestors.filter(clippingAncestors => isElement(clippingAncestors) && contains(clippingAncestors, clipperElement) && getNodeName(clippingAncestors) !== 'body');
  10027. } // Gets the maximum area that the element is visible in due to any number of
  10028. // clipping ancestors
  10029. function getClippingRect(_ref) {
  10030. let {
  10031. element,
  10032. boundary,
  10033. rootBoundary,
  10034. strategy
  10035. } = _ref;
  10036. const mainClippingAncestors = boundary === 'clippingAncestors' ? getClippingAncestors(element) : [].concat(boundary);
  10037. const clippingAncestors = [...mainClippingAncestors, rootBoundary];
  10038. const firstClippingAncestor = clippingAncestors[0];
  10039. const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
  10040. const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
  10041. accRect.top = max$1(rect.top, accRect.top);
  10042. accRect.right = min$1(rect.right, accRect.right);
  10043. accRect.bottom = min$1(rect.bottom, accRect.bottom);
  10044. accRect.left = max$1(rect.left, accRect.left);
  10045. return accRect;
  10046. }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
  10047. return {
  10048. width: clippingRect.right - clippingRect.left,
  10049. height: clippingRect.bottom - clippingRect.top,
  10050. x: clippingRect.left,
  10051. y: clippingRect.top
  10052. };
  10053. }
  10054. const platform = {
  10055. getClippingRect,
  10056. convertOffsetParentRelativeRectToViewportRelativeRect,
  10057. isElement,
  10058. getDimensions,
  10059. getOffsetParent,
  10060. getDocumentElement,
  10061. getElementRects: _ref => {
  10062. let {
  10063. reference,
  10064. floating,
  10065. strategy
  10066. } = _ref;
  10067. return {
  10068. reference: getRectRelativeToOffsetParent(reference, getOffsetParent(floating), strategy),
  10069. floating: { ...getDimensions(floating),
  10070. x: 0,
  10071. y: 0
  10072. }
  10073. };
  10074. },
  10075. getClientRects: element => Array.from(element.getClientRects()),
  10076. isRTL: element => getComputedStyle$1(element).direction === 'rtl'
  10077. };
  10078. /**
  10079. * Computes the `x` and `y` coordinates that will place the floating element
  10080. * next to a reference element when it is given a certain CSS positioning
  10081. * strategy.
  10082. */
  10083. const computePosition = (reference, floating, options) => computePosition$1(reference, floating, {
  10084. platform,
  10085. ...options
  10086. });
  10087. const useFloatingProps = buildProps({});
  10088. const unrefReference = (elRef) => {
  10089. if (!isClient)
  10090. return;
  10091. if (!elRef)
  10092. return elRef;
  10093. const unrefEl = unrefElement(elRef);
  10094. if (unrefEl)
  10095. return unrefEl;
  10096. return vue.isRef(elRef) ? unrefEl : elRef;
  10097. };
  10098. const getPositionDataWithUnit = (record, key) => {
  10099. const value = record == null ? void 0 : record[key];
  10100. return isNil(value) ? "" : `${value}px`;
  10101. };
  10102. const useFloating = ({
  10103. middleware,
  10104. placement,
  10105. strategy
  10106. }) => {
  10107. const referenceRef = vue.ref();
  10108. const contentRef = vue.ref();
  10109. const x = vue.ref();
  10110. const y = vue.ref();
  10111. const middlewareData = vue.ref({});
  10112. const states = {
  10113. x,
  10114. y,
  10115. placement,
  10116. strategy,
  10117. middlewareData
  10118. };
  10119. const update = async () => {
  10120. if (!isClient)
  10121. return;
  10122. const referenceEl = unrefReference(referenceRef);
  10123. const contentEl = unrefElement(contentRef);
  10124. if (!referenceEl || !contentEl)
  10125. return;
  10126. const data = await computePosition(referenceEl, contentEl, {
  10127. placement: vue.unref(placement),
  10128. strategy: vue.unref(strategy),
  10129. middleware: vue.unref(middleware)
  10130. });
  10131. keysOf(states).forEach((key) => {
  10132. states[key].value = data[key];
  10133. });
  10134. };
  10135. vue.onMounted(() => {
  10136. vue.watchEffect(() => {
  10137. update();
  10138. });
  10139. });
  10140. return {
  10141. ...states,
  10142. update,
  10143. referenceRef,
  10144. contentRef
  10145. };
  10146. };
  10147. const arrowMiddleware = ({
  10148. arrowRef,
  10149. padding
  10150. }) => {
  10151. return {
  10152. name: "arrow",
  10153. options: {
  10154. element: arrowRef,
  10155. padding
  10156. },
  10157. fn(args) {
  10158. const arrowEl = vue.unref(arrowRef);
  10159. if (!arrowEl)
  10160. return {};
  10161. return arrow({
  10162. element: arrowEl,
  10163. padding
  10164. }).fn(args);
  10165. }
  10166. };
  10167. };
  10168. function useCursor(input) {
  10169. const selectionRef = vue.ref();
  10170. function recordCursor() {
  10171. if (input.value == void 0)
  10172. return;
  10173. const { selectionStart, selectionEnd, value } = input.value;
  10174. if (selectionStart == null || selectionEnd == null)
  10175. return;
  10176. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  10177. const afterTxt = value.slice(Math.max(0, selectionEnd));
  10178. selectionRef.value = {
  10179. selectionStart,
  10180. selectionEnd,
  10181. value,
  10182. beforeTxt,
  10183. afterTxt
  10184. };
  10185. }
  10186. function setCursor() {
  10187. if (input.value == void 0 || selectionRef.value == void 0)
  10188. return;
  10189. const { value } = input.value;
  10190. const { beforeTxt, afterTxt, selectionStart } = selectionRef.value;
  10191. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  10192. return;
  10193. let startPos = value.length;
  10194. if (value.endsWith(afterTxt)) {
  10195. startPos = value.length - afterTxt.length;
  10196. } else if (value.startsWith(beforeTxt)) {
  10197. startPos = beforeTxt.length;
  10198. } else {
  10199. const beforeLastChar = beforeTxt[selectionStart - 1];
  10200. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  10201. if (newIndex !== -1) {
  10202. startPos = newIndex + 1;
  10203. }
  10204. }
  10205. input.value.setSelectionRange(startPos, startPos);
  10206. }
  10207. return [recordCursor, setCursor];
  10208. }
  10209. const getOrderedChildren = (vm, childComponentName, children) => {
  10210. const nodes = flattedChildren(vm.subTree).filter((n) => {
  10211. var _a;
  10212. return vue.isVNode(n) && ((_a = n.type) == null ? void 0 : _a.name) === childComponentName && !!n.component;
  10213. });
  10214. const uids = nodes.map((n) => n.component.uid);
  10215. return uids.map((uid) => children[uid]).filter((p) => !!p);
  10216. };
  10217. const useOrderedChildren = (vm, childComponentName) => {
  10218. const children = {};
  10219. const orderedChildren = vue.shallowRef([]);
  10220. const addChild = (child) => {
  10221. children[child.uid] = child;
  10222. orderedChildren.value = getOrderedChildren(vm, childComponentName, children);
  10223. };
  10224. const removeChild = (uid) => {
  10225. delete children[uid];
  10226. orderedChildren.value = orderedChildren.value.filter((children2) => children2.uid !== uid);
  10227. };
  10228. return {
  10229. children: orderedChildren,
  10230. addChild,
  10231. removeChild
  10232. };
  10233. };
  10234. const version$1 = "2.2.21";
  10235. const makeInstaller = (components = []) => {
  10236. const install = (app, options) => {
  10237. if (app[INSTALLED_KEY])
  10238. return;
  10239. app[INSTALLED_KEY] = true;
  10240. components.forEach((c) => app.use(c));
  10241. if (options)
  10242. provideGlobalConfig(options, app, true);
  10243. };
  10244. return {
  10245. version: version$1,
  10246. install
  10247. };
  10248. };
  10249. const affixProps = buildProps({
  10250. zIndex: {
  10251. type: definePropType([Number, String]),
  10252. default: 100
  10253. },
  10254. target: {
  10255. type: String,
  10256. default: ""
  10257. },
  10258. offset: {
  10259. type: Number,
  10260. default: 0
  10261. },
  10262. position: {
  10263. type: String,
  10264. values: ["top", "bottom"],
  10265. default: "top"
  10266. }
  10267. });
  10268. const affixEmits = {
  10269. scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed),
  10270. [CHANGE_EVENT]: (fixed) => isBoolean(fixed)
  10271. };
  10272. var _export_sfc = (sfc, props) => {
  10273. const target = sfc.__vccOpts || sfc;
  10274. for (const [key, val] of props) {
  10275. target[key] = val;
  10276. }
  10277. return target;
  10278. };
  10279. const COMPONENT_NAME$l = "ElAffix";
  10280. const __default__$1w = vue.defineComponent({
  10281. name: COMPONENT_NAME$l
  10282. });
  10283. const _sfc_main$2f = /* @__PURE__ */ vue.defineComponent({
  10284. ...__default__$1w,
  10285. props: affixProps,
  10286. emits: affixEmits,
  10287. setup(__props, { expose, emit }) {
  10288. const props = __props;
  10289. const ns = useNamespace("affix");
  10290. const target = vue.shallowRef();
  10291. const root = vue.shallowRef();
  10292. const scrollContainer = vue.shallowRef();
  10293. const { height: windowHeight } = useWindowSize();
  10294. const {
  10295. height: rootHeight,
  10296. width: rootWidth,
  10297. top: rootTop,
  10298. bottom: rootBottom,
  10299. update: updateRoot
  10300. } = useElementBounding(root, { windowScroll: false });
  10301. const targetRect = useElementBounding(target);
  10302. const fixed = vue.ref(false);
  10303. const scrollTop = vue.ref(0);
  10304. const transform = vue.ref(0);
  10305. const rootStyle = vue.computed(() => {
  10306. return {
  10307. height: fixed.value ? `${rootHeight.value}px` : "",
  10308. width: fixed.value ? `${rootWidth.value}px` : ""
  10309. };
  10310. });
  10311. const affixStyle = vue.computed(() => {
  10312. if (!fixed.value)
  10313. return {};
  10314. const offset = props.offset ? addUnit(props.offset) : 0;
  10315. return {
  10316. height: `${rootHeight.value}px`,
  10317. width: `${rootWidth.value}px`,
  10318. top: props.position === "top" ? offset : "",
  10319. bottom: props.position === "bottom" ? offset : "",
  10320. transform: transform.value ? `translateY(${transform.value}px)` : "",
  10321. zIndex: props.zIndex
  10322. };
  10323. });
  10324. const update = () => {
  10325. if (!scrollContainer.value)
  10326. return;
  10327. scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
  10328. if (props.position === "top") {
  10329. if (props.target) {
  10330. const difference = targetRect.bottom.value - props.offset - rootHeight.value;
  10331. fixed.value = props.offset > rootTop.value && targetRect.bottom.value > 0;
  10332. transform.value = difference < 0 ? difference : 0;
  10333. } else {
  10334. fixed.value = props.offset > rootTop.value;
  10335. }
  10336. } else if (props.target) {
  10337. const difference = windowHeight.value - targetRect.top.value - props.offset - rootHeight.value;
  10338. fixed.value = windowHeight.value - props.offset < rootBottom.value && windowHeight.value > targetRect.top.value;
  10339. transform.value = difference < 0 ? -difference : 0;
  10340. } else {
  10341. fixed.value = windowHeight.value - props.offset < rootBottom.value;
  10342. }
  10343. };
  10344. const handleScroll = () => {
  10345. updateRoot();
  10346. emit("scroll", {
  10347. scrollTop: scrollTop.value,
  10348. fixed: fixed.value
  10349. });
  10350. };
  10351. vue.watch(fixed, (val) => emit("change", val));
  10352. vue.onMounted(() => {
  10353. var _a;
  10354. if (props.target) {
  10355. target.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  10356. if (!target.value)
  10357. throwError(COMPONENT_NAME$l, `Target is not existed: ${props.target}`);
  10358. } else {
  10359. target.value = document.documentElement;
  10360. }
  10361. scrollContainer.value = getScrollContainer(root.value, true);
  10362. updateRoot();
  10363. });
  10364. useEventListener(scrollContainer, "scroll", handleScroll);
  10365. vue.watchEffect(update);
  10366. expose({
  10367. update,
  10368. updateRoot
  10369. });
  10370. return (_ctx, _cache) => {
  10371. return vue.openBlock(), vue.createElementBlock("div", {
  10372. ref_key: "root",
  10373. ref: root,
  10374. class: vue.normalizeClass(vue.unref(ns).b()),
  10375. style: vue.normalizeStyle(vue.unref(rootStyle))
  10376. }, [
  10377. vue.createElementVNode("div", {
  10378. class: vue.normalizeClass({ [vue.unref(ns).m("fixed")]: fixed.value }),
  10379. style: vue.normalizeStyle(vue.unref(affixStyle))
  10380. }, [
  10381. vue.renderSlot(_ctx.$slots, "default")
  10382. ], 6)
  10383. ], 6);
  10384. };
  10385. }
  10386. });
  10387. var Affix = /* @__PURE__ */ _export_sfc(_sfc_main$2f, [["__file", "affix.vue"]]);
  10388. const ElAffix = withInstall(Affix);
  10389. const iconProps = buildProps({
  10390. size: {
  10391. type: definePropType([Number, String])
  10392. },
  10393. color: {
  10394. type: String
  10395. }
  10396. });
  10397. const __default__$1v = vue.defineComponent({
  10398. name: "ElIcon",
  10399. inheritAttrs: false
  10400. });
  10401. const _sfc_main$2e = /* @__PURE__ */ vue.defineComponent({
  10402. ...__default__$1v,
  10403. props: iconProps,
  10404. setup(__props) {
  10405. const props = __props;
  10406. const ns = useNamespace("icon");
  10407. const style = vue.computed(() => {
  10408. const { size, color } = props;
  10409. if (!size && !color)
  10410. return {};
  10411. return {
  10412. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  10413. "--color": color
  10414. };
  10415. });
  10416. return (_ctx, _cache) => {
  10417. return vue.openBlock(), vue.createElementBlock("i", vue.mergeProps({
  10418. class: vue.unref(ns).b(),
  10419. style: vue.unref(style)
  10420. }, _ctx.$attrs), [
  10421. vue.renderSlot(_ctx.$slots, "default")
  10422. ], 16);
  10423. };
  10424. }
  10425. });
  10426. var Icon = /* @__PURE__ */ _export_sfc(_sfc_main$2e, [["__file", "icon.vue"]]);
  10427. const ElIcon = withInstall(Icon);
  10428. const alertEffects = ["light", "dark"];
  10429. const alertProps = buildProps({
  10430. title: {
  10431. type: String,
  10432. default: ""
  10433. },
  10434. description: {
  10435. type: String,
  10436. default: ""
  10437. },
  10438. type: {
  10439. type: String,
  10440. values: keysOf(TypeComponentsMap),
  10441. default: "info"
  10442. },
  10443. closable: {
  10444. type: Boolean,
  10445. default: true
  10446. },
  10447. closeText: {
  10448. type: String,
  10449. default: ""
  10450. },
  10451. showIcon: Boolean,
  10452. center: Boolean,
  10453. effect: {
  10454. type: String,
  10455. values: alertEffects,
  10456. default: "light"
  10457. }
  10458. });
  10459. const alertEmits = {
  10460. close: (evt) => evt instanceof MouseEvent
  10461. };
  10462. const __default__$1u = vue.defineComponent({
  10463. name: "ElAlert"
  10464. });
  10465. const _sfc_main$2d = /* @__PURE__ */ vue.defineComponent({
  10466. ...__default__$1u,
  10467. props: alertProps,
  10468. emits: alertEmits,
  10469. setup(__props, { emit }) {
  10470. const props = __props;
  10471. const { Close } = TypeComponents;
  10472. const slots = vue.useSlots();
  10473. const ns = useNamespace("alert");
  10474. const visible = vue.ref(true);
  10475. const iconComponent = vue.computed(() => TypeComponentsMap[props.type]);
  10476. const iconClass = vue.computed(() => [
  10477. ns.e("icon"),
  10478. { [ns.is("big")]: !!props.description || !!slots.default }
  10479. ]);
  10480. const isBoldTitle = vue.computed(() => {
  10481. return { [ns.is("bold")]: props.description || slots.default };
  10482. });
  10483. const close = (evt) => {
  10484. visible.value = false;
  10485. emit("close", evt);
  10486. };
  10487. return (_ctx, _cache) => {
  10488. return vue.openBlock(), vue.createBlock(vue.Transition, {
  10489. name: vue.unref(ns).b("fade"),
  10490. persisted: ""
  10491. }, {
  10492. default: vue.withCtx(() => [
  10493. vue.withDirectives(vue.createElementVNode("div", {
  10494. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.type), vue.unref(ns).is("center", _ctx.center), vue.unref(ns).is(_ctx.effect)]),
  10495. role: "alert"
  10496. }, [
  10497. _ctx.showIcon && vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10498. key: 0,
  10499. class: vue.normalizeClass(vue.unref(iconClass))
  10500. }, {
  10501. default: vue.withCtx(() => [
  10502. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  10503. ]),
  10504. _: 1
  10505. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  10506. vue.createElementVNode("div", {
  10507. class: vue.normalizeClass(vue.unref(ns).e("content"))
  10508. }, [
  10509. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  10510. key: 0,
  10511. class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(isBoldTitle)])
  10512. }, [
  10513. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  10514. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  10515. ])
  10516. ], 2)) : vue.createCommentVNode("v-if", true),
  10517. _ctx.$slots.default || _ctx.description ? (vue.openBlock(), vue.createElementBlock("p", {
  10518. key: 1,
  10519. class: vue.normalizeClass(vue.unref(ns).e("description"))
  10520. }, [
  10521. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  10522. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  10523. ])
  10524. ], 2)) : vue.createCommentVNode("v-if", true),
  10525. _ctx.closable ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  10526. _ctx.closeText ? (vue.openBlock(), vue.createElementBlock("div", {
  10527. key: 0,
  10528. class: vue.normalizeClass([vue.unref(ns).e("close-btn"), vue.unref(ns).is("customed")]),
  10529. onClick: close
  10530. }, vue.toDisplayString(_ctx.closeText), 3)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10531. key: 1,
  10532. class: vue.normalizeClass(vue.unref(ns).e("close-btn")),
  10533. onClick: close
  10534. }, {
  10535. default: vue.withCtx(() => [
  10536. vue.createVNode(vue.unref(Close))
  10537. ]),
  10538. _: 1
  10539. }, 8, ["class"]))
  10540. ], 64)) : vue.createCommentVNode("v-if", true)
  10541. ], 2)
  10542. ], 2), [
  10543. [vue.vShow, visible.value]
  10544. ])
  10545. ]),
  10546. _: 3
  10547. }, 8, ["name"]);
  10548. };
  10549. }
  10550. });
  10551. var Alert = /* @__PURE__ */ _export_sfc(_sfc_main$2d, [["__file", "alert.vue"]]);
  10552. const ElAlert = withInstall(Alert);
  10553. let hiddenTextarea = void 0;
  10554. const HIDDEN_STYLE = `
  10555. height:0 !important;
  10556. visibility:hidden !important;
  10557. overflow:hidden !important;
  10558. position:absolute !important;
  10559. z-index:-1000 !important;
  10560. top:0 !important;
  10561. right:0 !important;
  10562. `;
  10563. const CONTEXT_STYLE = [
  10564. "letter-spacing",
  10565. "line-height",
  10566. "padding-top",
  10567. "padding-bottom",
  10568. "font-family",
  10569. "font-weight",
  10570. "font-size",
  10571. "text-rendering",
  10572. "text-transform",
  10573. "width",
  10574. "text-indent",
  10575. "padding-left",
  10576. "padding-right",
  10577. "border-width",
  10578. "box-sizing"
  10579. ];
  10580. function calculateNodeStyling(targetElement) {
  10581. const style = window.getComputedStyle(targetElement);
  10582. const boxSizing = style.getPropertyValue("box-sizing");
  10583. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  10584. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  10585. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  10586. return { contextStyle, paddingSize, borderSize, boxSizing };
  10587. }
  10588. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  10589. var _a;
  10590. if (!hiddenTextarea) {
  10591. hiddenTextarea = document.createElement("textarea");
  10592. document.body.appendChild(hiddenTextarea);
  10593. }
  10594. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  10595. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  10596. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  10597. let height = hiddenTextarea.scrollHeight;
  10598. const result = {};
  10599. if (boxSizing === "border-box") {
  10600. height = height + borderSize;
  10601. } else if (boxSizing === "content-box") {
  10602. height = height - paddingSize;
  10603. }
  10604. hiddenTextarea.value = "";
  10605. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  10606. if (isNumber(minRows)) {
  10607. let minHeight = singleRowHeight * minRows;
  10608. if (boxSizing === "border-box") {
  10609. minHeight = minHeight + paddingSize + borderSize;
  10610. }
  10611. height = Math.max(minHeight, height);
  10612. result.minHeight = `${minHeight}px`;
  10613. }
  10614. if (isNumber(maxRows)) {
  10615. let maxHeight = singleRowHeight * maxRows;
  10616. if (boxSizing === "border-box") {
  10617. maxHeight = maxHeight + paddingSize + borderSize;
  10618. }
  10619. height = Math.min(maxHeight, height);
  10620. }
  10621. result.height = `${height}px`;
  10622. (_a = hiddenTextarea.parentNode) == null ? void 0 : _a.removeChild(hiddenTextarea);
  10623. hiddenTextarea = void 0;
  10624. return result;
  10625. }
  10626. const inputProps = buildProps({
  10627. id: {
  10628. type: String,
  10629. default: void 0
  10630. },
  10631. size: useSizeProp,
  10632. disabled: Boolean,
  10633. modelValue: {
  10634. type: definePropType([
  10635. String,
  10636. Number,
  10637. Object
  10638. ]),
  10639. default: ""
  10640. },
  10641. type: {
  10642. type: String,
  10643. default: "text"
  10644. },
  10645. resize: {
  10646. type: String,
  10647. values: ["none", "both", "horizontal", "vertical"]
  10648. },
  10649. autosize: {
  10650. type: definePropType([Boolean, Object]),
  10651. default: false
  10652. },
  10653. autocomplete: {
  10654. type: String,
  10655. default: "off"
  10656. },
  10657. formatter: {
  10658. type: Function
  10659. },
  10660. parser: {
  10661. type: Function
  10662. },
  10663. placeholder: {
  10664. type: String
  10665. },
  10666. form: {
  10667. type: String
  10668. },
  10669. readonly: {
  10670. type: Boolean,
  10671. default: false
  10672. },
  10673. clearable: {
  10674. type: Boolean,
  10675. default: false
  10676. },
  10677. showPassword: {
  10678. type: Boolean,
  10679. default: false
  10680. },
  10681. showWordLimit: {
  10682. type: Boolean,
  10683. default: false
  10684. },
  10685. suffixIcon: {
  10686. type: iconPropType
  10687. },
  10688. prefixIcon: {
  10689. type: iconPropType
  10690. },
  10691. containerRole: {
  10692. type: String,
  10693. default: void 0
  10694. },
  10695. label: {
  10696. type: String,
  10697. default: void 0
  10698. },
  10699. tabindex: {
  10700. type: [String, Number],
  10701. default: 0
  10702. },
  10703. validateEvent: {
  10704. type: Boolean,
  10705. default: true
  10706. },
  10707. inputStyle: {
  10708. type: definePropType([Object, Array, String]),
  10709. default: () => mutable({})
  10710. }
  10711. });
  10712. const inputEmits = {
  10713. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  10714. input: (value) => isString(value),
  10715. change: (value) => isString(value),
  10716. focus: (evt) => evt instanceof FocusEvent,
  10717. blur: (evt) => evt instanceof FocusEvent,
  10718. clear: () => true,
  10719. mouseleave: (evt) => evt instanceof MouseEvent,
  10720. mouseenter: (evt) => evt instanceof MouseEvent,
  10721. keydown: (evt) => evt instanceof Event,
  10722. compositionstart: (evt) => evt instanceof CompositionEvent,
  10723. compositionupdate: (evt) => evt instanceof CompositionEvent,
  10724. compositionend: (evt) => evt instanceof CompositionEvent
  10725. };
  10726. const _hoisted_1$13 = ["role"];
  10727. const _hoisted_2$G = ["id", "type", "disabled", "formatter", "parser", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form"];
  10728. const _hoisted_3$k = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form"];
  10729. const __default__$1t = vue.defineComponent({
  10730. name: "ElInput",
  10731. inheritAttrs: false
  10732. });
  10733. const _sfc_main$2c = /* @__PURE__ */ vue.defineComponent({
  10734. ...__default__$1t,
  10735. props: inputProps,
  10736. emits: inputEmits,
  10737. setup(__props, { expose, emit }) {
  10738. const props = __props;
  10739. const rawAttrs = vue.useAttrs();
  10740. const slots = vue.useSlots();
  10741. const containerAttrs = vue.computed(() => {
  10742. const comboBoxAttrs = {};
  10743. if (props.containerRole === "combobox") {
  10744. comboBoxAttrs["aria-haspopup"] = rawAttrs["aria-haspopup"];
  10745. comboBoxAttrs["aria-owns"] = rawAttrs["aria-owns"];
  10746. comboBoxAttrs["aria-expanded"] = rawAttrs["aria-expanded"];
  10747. }
  10748. return comboBoxAttrs;
  10749. });
  10750. const attrs = useAttrs({
  10751. excludeKeys: vue.computed(() => {
  10752. return Object.keys(containerAttrs.value);
  10753. })
  10754. });
  10755. const { form, formItem } = useFormItem();
  10756. const { inputId } = useFormItemInputId(props, {
  10757. formItemContext: formItem
  10758. });
  10759. const inputSize = useSize();
  10760. const inputDisabled = useDisabled();
  10761. const nsInput = useNamespace("input");
  10762. const nsTextarea = useNamespace("textarea");
  10763. const input = vue.shallowRef();
  10764. const textarea = vue.shallowRef();
  10765. const focused = vue.ref(false);
  10766. const hovering = vue.ref(false);
  10767. const isComposing = vue.ref(false);
  10768. const passwordVisible = vue.ref(false);
  10769. const countStyle = vue.ref();
  10770. const textareaCalcStyle = vue.shallowRef(props.inputStyle);
  10771. const _ref = vue.computed(() => input.value || textarea.value);
  10772. const needStatusIcon = vue.computed(() => {
  10773. var _a;
  10774. return (_a = form == null ? void 0 : form.statusIcon) != null ? _a : false;
  10775. });
  10776. const validateState = vue.computed(() => (formItem == null ? void 0 : formItem.validateState) || "");
  10777. const validateIcon = vue.computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  10778. const passwordIcon = vue.computed(() => passwordVisible.value ? view_default : hide_default);
  10779. const containerStyle = vue.computed(() => [
  10780. rawAttrs.style,
  10781. props.inputStyle
  10782. ]);
  10783. const textareaStyle = vue.computed(() => [
  10784. props.inputStyle,
  10785. textareaCalcStyle.value,
  10786. { resize: props.resize }
  10787. ]);
  10788. const nativeInputValue = vue.computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  10789. const showClear = vue.computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
  10790. const showPwdVisible = vue.computed(() => props.showPassword && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (!!nativeInputValue.value || focused.value));
  10791. const isWordLimitVisible = vue.computed(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  10792. const textLength = vue.computed(() => Array.from(nativeInputValue.value).length);
  10793. const inputExceed = vue.computed(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
  10794. const suffixVisible = vue.computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  10795. const [recordCursor, setCursor] = useCursor(input);
  10796. useResizeObserver(textarea, (entries) => {
  10797. if (!isWordLimitVisible.value || props.resize !== "both")
  10798. return;
  10799. const entry = entries[0];
  10800. const { width } = entry.contentRect;
  10801. countStyle.value = {
  10802. right: `calc(100% - ${width + 15 + 6}px)`
  10803. };
  10804. });
  10805. const resizeTextarea = () => {
  10806. const { type, autosize } = props;
  10807. if (!isClient || type !== "textarea")
  10808. return;
  10809. if (autosize) {
  10810. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  10811. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  10812. textareaCalcStyle.value = {
  10813. ...calcTextareaHeight(textarea.value, minRows, maxRows)
  10814. };
  10815. } else {
  10816. textareaCalcStyle.value = {
  10817. minHeight: calcTextareaHeight(textarea.value).minHeight
  10818. };
  10819. }
  10820. };
  10821. const setNativeInputValue = () => {
  10822. const input2 = _ref.value;
  10823. if (!input2 || input2.value === nativeInputValue.value)
  10824. return;
  10825. input2.value = nativeInputValue.value;
  10826. };
  10827. const handleInput = async (event) => {
  10828. recordCursor();
  10829. let { value } = event.target;
  10830. if (props.formatter) {
  10831. value = props.parser ? props.parser(value) : value;
  10832. value = props.formatter(value);
  10833. }
  10834. if (isComposing.value)
  10835. return;
  10836. if (value === nativeInputValue.value) {
  10837. setNativeInputValue();
  10838. return;
  10839. }
  10840. emit(UPDATE_MODEL_EVENT, value);
  10841. emit("input", value);
  10842. await vue.nextTick();
  10843. setNativeInputValue();
  10844. setCursor();
  10845. };
  10846. const handleChange = (event) => {
  10847. emit("change", event.target.value);
  10848. };
  10849. const handleCompositionStart = (event) => {
  10850. emit("compositionstart", event);
  10851. isComposing.value = true;
  10852. };
  10853. const handleCompositionUpdate = (event) => {
  10854. var _a;
  10855. emit("compositionupdate", event);
  10856. const text = (_a = event.target) == null ? void 0 : _a.value;
  10857. const lastCharacter = text[text.length - 1] || "";
  10858. isComposing.value = !isKorean(lastCharacter);
  10859. };
  10860. const handleCompositionEnd = (event) => {
  10861. emit("compositionend", event);
  10862. if (isComposing.value) {
  10863. isComposing.value = false;
  10864. handleInput(event);
  10865. }
  10866. };
  10867. const handlePasswordVisible = () => {
  10868. passwordVisible.value = !passwordVisible.value;
  10869. focus();
  10870. };
  10871. const focus = async () => {
  10872. var _a;
  10873. await vue.nextTick();
  10874. (_a = _ref.value) == null ? void 0 : _a.focus();
  10875. };
  10876. const blur = () => {
  10877. var _a;
  10878. return (_a = _ref.value) == null ? void 0 : _a.blur();
  10879. };
  10880. const handleFocus = (event) => {
  10881. focused.value = true;
  10882. emit("focus", event);
  10883. };
  10884. const handleBlur = (event) => {
  10885. var _a;
  10886. focused.value = false;
  10887. emit("blur", event);
  10888. if (props.validateEvent) {
  10889. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn());
  10890. }
  10891. };
  10892. const handleMouseLeave = (evt) => {
  10893. hovering.value = false;
  10894. emit("mouseleave", evt);
  10895. };
  10896. const handleMouseEnter = (evt) => {
  10897. hovering.value = true;
  10898. emit("mouseenter", evt);
  10899. };
  10900. const handleKeydown = (evt) => {
  10901. emit("keydown", evt);
  10902. };
  10903. const select = () => {
  10904. var _a;
  10905. (_a = _ref.value) == null ? void 0 : _a.select();
  10906. };
  10907. const clear = () => {
  10908. emit(UPDATE_MODEL_EVENT, "");
  10909. emit("change", "");
  10910. emit("clear");
  10911. emit("input", "");
  10912. };
  10913. vue.watch(() => props.modelValue, () => {
  10914. var _a;
  10915. vue.nextTick(() => resizeTextarea());
  10916. if (props.validateEvent) {
  10917. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  10918. }
  10919. });
  10920. vue.watch(nativeInputValue, () => setNativeInputValue());
  10921. vue.watch(() => props.type, async () => {
  10922. await vue.nextTick();
  10923. setNativeInputValue();
  10924. resizeTextarea();
  10925. });
  10926. vue.onMounted(() => {
  10927. if (!props.formatter && props.parser) ;
  10928. setNativeInputValue();
  10929. vue.nextTick(resizeTextarea);
  10930. });
  10931. expose({
  10932. input,
  10933. textarea,
  10934. ref: _ref,
  10935. textareaStyle,
  10936. autosize: vue.toRef(props, "autosize"),
  10937. focus,
  10938. blur,
  10939. select,
  10940. clear,
  10941. resizeTextarea
  10942. });
  10943. return (_ctx, _cache) => {
  10944. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", vue.mergeProps(vue.unref(containerAttrs), {
  10945. class: [
  10946. _ctx.type === "textarea" ? vue.unref(nsTextarea).b() : vue.unref(nsInput).b(),
  10947. vue.unref(nsInput).m(vue.unref(inputSize)),
  10948. vue.unref(nsInput).is("disabled", vue.unref(inputDisabled)),
  10949. vue.unref(nsInput).is("exceed", vue.unref(inputExceed)),
  10950. {
  10951. [vue.unref(nsInput).b("group")]: _ctx.$slots.prepend || _ctx.$slots.append,
  10952. [vue.unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  10953. [vue.unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend,
  10954. [vue.unref(nsInput).m("prefix")]: _ctx.$slots.prefix || _ctx.prefixIcon,
  10955. [vue.unref(nsInput).m("suffix")]: _ctx.$slots.suffix || _ctx.suffixIcon || _ctx.clearable || _ctx.showPassword,
  10956. [vue.unref(nsInput).bm("suffix", "password-clear")]: vue.unref(showClear) && vue.unref(showPwdVisible)
  10957. },
  10958. _ctx.$attrs.class
  10959. ],
  10960. style: vue.unref(containerStyle),
  10961. role: _ctx.containerRole,
  10962. onMouseenter: handleMouseEnter,
  10963. onMouseleave: handleMouseLeave
  10964. }), [
  10965. vue.createCommentVNode(" input "),
  10966. _ctx.type !== "textarea" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  10967. vue.createCommentVNode(" prepend slot "),
  10968. _ctx.$slots.prepend ? (vue.openBlock(), vue.createElementBlock("div", {
  10969. key: 0,
  10970. class: vue.normalizeClass(vue.unref(nsInput).be("group", "prepend"))
  10971. }, [
  10972. vue.renderSlot(_ctx.$slots, "prepend")
  10973. ], 2)) : vue.createCommentVNode("v-if", true),
  10974. vue.createElementVNode("div", {
  10975. class: vue.normalizeClass([vue.unref(nsInput).e("wrapper"), vue.unref(nsInput).is("focus", focused.value)])
  10976. }, [
  10977. vue.createCommentVNode(" prefix slot "),
  10978. _ctx.$slots.prefix || _ctx.prefixIcon ? (vue.openBlock(), vue.createElementBlock("span", {
  10979. key: 0,
  10980. class: vue.normalizeClass(vue.unref(nsInput).e("prefix"))
  10981. }, [
  10982. vue.createElementVNode("span", {
  10983. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-inner"))
  10984. }, [
  10985. vue.renderSlot(_ctx.$slots, "prefix"),
  10986. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  10987. key: 0,
  10988. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  10989. }, {
  10990. default: vue.withCtx(() => [
  10991. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  10992. ]),
  10993. _: 1
  10994. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  10995. ], 2)
  10996. ], 2)) : vue.createCommentVNode("v-if", true),
  10997. vue.createElementVNode("input", vue.mergeProps({
  10998. id: vue.unref(inputId),
  10999. ref_key: "input",
  11000. ref: input,
  11001. class: vue.unref(nsInput).e("inner")
  11002. }, vue.unref(attrs), {
  11003. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  11004. disabled: vue.unref(inputDisabled),
  11005. formatter: _ctx.formatter,
  11006. parser: _ctx.parser,
  11007. readonly: _ctx.readonly,
  11008. autocomplete: _ctx.autocomplete,
  11009. tabindex: _ctx.tabindex,
  11010. "aria-label": _ctx.label,
  11011. placeholder: _ctx.placeholder,
  11012. style: _ctx.inputStyle,
  11013. form: props.form,
  11014. onCompositionstart: handleCompositionStart,
  11015. onCompositionupdate: handleCompositionUpdate,
  11016. onCompositionend: handleCompositionEnd,
  11017. onInput: handleInput,
  11018. onFocus: handleFocus,
  11019. onBlur: handleBlur,
  11020. onChange: handleChange,
  11021. onKeydown: handleKeydown
  11022. }), null, 16, _hoisted_2$G),
  11023. vue.createCommentVNode(" suffix slot "),
  11024. vue.unref(suffixVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  11025. key: 1,
  11026. class: vue.normalizeClass(vue.unref(nsInput).e("suffix"))
  11027. }, [
  11028. vue.createElementVNode("span", {
  11029. class: vue.normalizeClass(vue.unref(nsInput).e("suffix-inner"))
  11030. }, [
  11031. !vue.unref(showClear) || !vue.unref(showPwdVisible) || !vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  11032. vue.renderSlot(_ctx.$slots, "suffix"),
  11033. _ctx.suffixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  11034. key: 0,
  11035. class: vue.normalizeClass(vue.unref(nsInput).e("icon"))
  11036. }, {
  11037. default: vue.withCtx(() => [
  11038. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.suffixIcon)))
  11039. ]),
  11040. _: 1
  11041. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  11042. ], 64)) : vue.createCommentVNode("v-if", true),
  11043. vue.unref(showClear) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  11044. key: 1,
  11045. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("clear")]),
  11046. onMousedown: vue.withModifiers(vue.unref(NOOP), ["prevent"]),
  11047. onClick: clear
  11048. }, {
  11049. default: vue.withCtx(() => [
  11050. vue.createVNode(vue.unref(circle_close_default))
  11051. ]),
  11052. _: 1
  11053. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true),
  11054. vue.unref(showPwdVisible) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  11055. key: 2,
  11056. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsInput).e("password")]),
  11057. onClick: handlePasswordVisible
  11058. }, {
  11059. default: vue.withCtx(() => [
  11060. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(passwordIcon))))
  11061. ]),
  11062. _: 1
  11063. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  11064. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  11065. key: 3,
  11066. class: vue.normalizeClass(vue.unref(nsInput).e("count"))
  11067. }, [
  11068. vue.createElementVNode("span", {
  11069. class: vue.normalizeClass(vue.unref(nsInput).e("count-inner"))
  11070. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(vue.unref(attrs).maxlength), 3)
  11071. ], 2)) : vue.createCommentVNode("v-if", true),
  11072. vue.unref(validateState) && vue.unref(validateIcon) && vue.unref(needStatusIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  11073. key: 4,
  11074. class: vue.normalizeClass([
  11075. vue.unref(nsInput).e("icon"),
  11076. vue.unref(nsInput).e("validateIcon"),
  11077. vue.unref(nsInput).is("loading", vue.unref(validateState) === "validating")
  11078. ])
  11079. }, {
  11080. default: vue.withCtx(() => [
  11081. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(validateIcon))))
  11082. ]),
  11083. _: 1
  11084. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  11085. ], 2)
  11086. ], 2)) : vue.createCommentVNode("v-if", true)
  11087. ], 2),
  11088. vue.createCommentVNode(" append slot "),
  11089. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  11090. key: 1,
  11091. class: vue.normalizeClass(vue.unref(nsInput).be("group", "append"))
  11092. }, [
  11093. vue.renderSlot(_ctx.$slots, "append")
  11094. ], 2)) : vue.createCommentVNode("v-if", true)
  11095. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  11096. vue.createCommentVNode(" textarea "),
  11097. vue.createElementVNode("textarea", vue.mergeProps({
  11098. id: vue.unref(inputId),
  11099. ref_key: "textarea",
  11100. ref: textarea,
  11101. class: vue.unref(nsTextarea).e("inner")
  11102. }, vue.unref(attrs), {
  11103. tabindex: _ctx.tabindex,
  11104. disabled: vue.unref(inputDisabled),
  11105. readonly: _ctx.readonly,
  11106. autocomplete: _ctx.autocomplete,
  11107. style: vue.unref(textareaStyle),
  11108. "aria-label": _ctx.label,
  11109. placeholder: _ctx.placeholder,
  11110. form: props.form,
  11111. onCompositionstart: handleCompositionStart,
  11112. onCompositionupdate: handleCompositionUpdate,
  11113. onCompositionend: handleCompositionEnd,
  11114. onInput: handleInput,
  11115. onFocus: handleFocus,
  11116. onBlur: handleBlur,
  11117. onChange: handleChange,
  11118. onKeydown: handleKeydown
  11119. }), null, 16, _hoisted_3$k),
  11120. vue.unref(isWordLimitVisible) ? (vue.openBlock(), vue.createElementBlock("span", {
  11121. key: 0,
  11122. style: vue.normalizeStyle(countStyle.value),
  11123. class: vue.normalizeClass(vue.unref(nsInput).e("count"))
  11124. }, vue.toDisplayString(vue.unref(textLength)) + " / " + vue.toDisplayString(vue.unref(attrs).maxlength), 7)) : vue.createCommentVNode("v-if", true)
  11125. ], 64))
  11126. ], 16, _hoisted_1$13)), [
  11127. [vue.vShow, _ctx.type !== "hidden"]
  11128. ]);
  11129. };
  11130. }
  11131. });
  11132. var Input = /* @__PURE__ */ _export_sfc(_sfc_main$2c, [["__file", "input.vue"]]);
  11133. const ElInput = withInstall(Input);
  11134. const GAP = 4;
  11135. const BAR_MAP = {
  11136. vertical: {
  11137. offset: "offsetHeight",
  11138. scroll: "scrollTop",
  11139. scrollSize: "scrollHeight",
  11140. size: "height",
  11141. key: "vertical",
  11142. axis: "Y",
  11143. client: "clientY",
  11144. direction: "top"
  11145. },
  11146. horizontal: {
  11147. offset: "offsetWidth",
  11148. scroll: "scrollLeft",
  11149. scrollSize: "scrollWidth",
  11150. size: "width",
  11151. key: "horizontal",
  11152. axis: "X",
  11153. client: "clientX",
  11154. direction: "left"
  11155. }
  11156. };
  11157. const renderThumbStyle$1 = ({
  11158. move,
  11159. size,
  11160. bar
  11161. }) => ({
  11162. [bar.size]: size,
  11163. transform: `translate${bar.axis}(${move}%)`
  11164. });
  11165. const thumbProps = buildProps({
  11166. vertical: Boolean,
  11167. size: String,
  11168. move: Number,
  11169. ratio: {
  11170. type: Number,
  11171. required: true
  11172. },
  11173. always: Boolean
  11174. });
  11175. const COMPONENT_NAME$k = "Thumb";
  11176. const _sfc_main$2b = /* @__PURE__ */ vue.defineComponent({
  11177. __name: "thumb",
  11178. props: thumbProps,
  11179. setup(__props) {
  11180. const props = __props;
  11181. const scrollbar = vue.inject(scrollbarContextKey);
  11182. const ns = useNamespace("scrollbar");
  11183. if (!scrollbar)
  11184. throwError(COMPONENT_NAME$k, "can not inject scrollbar context");
  11185. const instance = vue.ref();
  11186. const thumb = vue.ref();
  11187. const thumbState = vue.ref({});
  11188. const visible = vue.ref(false);
  11189. let cursorDown = false;
  11190. let cursorLeave = false;
  11191. let originalOnSelectStart = isClient ? document.onselectstart : null;
  11192. const bar = vue.computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  11193. const thumbStyle = vue.computed(() => renderThumbStyle$1({
  11194. size: props.size,
  11195. move: props.move,
  11196. bar: bar.value
  11197. }));
  11198. const offsetRatio = vue.computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  11199. const clickThumbHandler = (e) => {
  11200. var _a;
  11201. e.stopPropagation();
  11202. if (e.ctrlKey || [1, 2].includes(e.button))
  11203. return;
  11204. (_a = window.getSelection()) == null ? void 0 : _a.removeAllRanges();
  11205. startDrag(e);
  11206. const el = e.currentTarget;
  11207. if (!el)
  11208. return;
  11209. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  11210. };
  11211. const clickTrackHandler = (e) => {
  11212. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  11213. return;
  11214. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  11215. const thumbHalf = thumb.value[bar.value.offset] / 2;
  11216. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  11217. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  11218. };
  11219. const startDrag = (e) => {
  11220. e.stopImmediatePropagation();
  11221. cursorDown = true;
  11222. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  11223. document.addEventListener("mouseup", mouseUpDocumentHandler);
  11224. originalOnSelectStart = document.onselectstart;
  11225. document.onselectstart = () => false;
  11226. };
  11227. const mouseMoveDocumentHandler = (e) => {
  11228. if (!instance.value || !thumb.value)
  11229. return;
  11230. if (cursorDown === false)
  11231. return;
  11232. const prevPage = thumbState.value[bar.value.axis];
  11233. if (!prevPage)
  11234. return;
  11235. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  11236. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  11237. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  11238. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  11239. };
  11240. const mouseUpDocumentHandler = () => {
  11241. cursorDown = false;
  11242. thumbState.value[bar.value.axis] = 0;
  11243. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  11244. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  11245. restoreOnselectstart();
  11246. if (cursorLeave)
  11247. visible.value = false;
  11248. };
  11249. const mouseMoveScrollbarHandler = () => {
  11250. cursorLeave = false;
  11251. visible.value = !!props.size;
  11252. };
  11253. const mouseLeaveScrollbarHandler = () => {
  11254. cursorLeave = true;
  11255. visible.value = cursorDown;
  11256. };
  11257. vue.onBeforeUnmount(() => {
  11258. restoreOnselectstart();
  11259. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  11260. });
  11261. const restoreOnselectstart = () => {
  11262. if (document.onselectstart !== originalOnSelectStart)
  11263. document.onselectstart = originalOnSelectStart;
  11264. };
  11265. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  11266. useEventListener(vue.toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  11267. return (_ctx, _cache) => {
  11268. return vue.openBlock(), vue.createBlock(vue.Transition, {
  11269. name: vue.unref(ns).b("fade"),
  11270. persisted: ""
  11271. }, {
  11272. default: vue.withCtx(() => [
  11273. vue.withDirectives(vue.createElementVNode("div", {
  11274. ref_key: "instance",
  11275. ref: instance,
  11276. class: vue.normalizeClass([vue.unref(ns).e("bar"), vue.unref(ns).is(vue.unref(bar).key)]),
  11277. onMousedown: clickTrackHandler
  11278. }, [
  11279. vue.createElementVNode("div", {
  11280. ref_key: "thumb",
  11281. ref: thumb,
  11282. class: vue.normalizeClass(vue.unref(ns).e("thumb")),
  11283. style: vue.normalizeStyle(vue.unref(thumbStyle)),
  11284. onMousedown: clickThumbHandler
  11285. }, null, 38)
  11286. ], 34), [
  11287. [vue.vShow, _ctx.always || visible.value]
  11288. ])
  11289. ]),
  11290. _: 1
  11291. }, 8, ["name"]);
  11292. };
  11293. }
  11294. });
  11295. var Thumb = /* @__PURE__ */ _export_sfc(_sfc_main$2b, [["__file", "thumb.vue"]]);
  11296. const barProps = buildProps({
  11297. always: {
  11298. type: Boolean,
  11299. default: true
  11300. },
  11301. width: String,
  11302. height: String,
  11303. ratioX: {
  11304. type: Number,
  11305. default: 1
  11306. },
  11307. ratioY: {
  11308. type: Number,
  11309. default: 1
  11310. }
  11311. });
  11312. const _sfc_main$2a = /* @__PURE__ */ vue.defineComponent({
  11313. __name: "bar",
  11314. props: barProps,
  11315. setup(__props, { expose }) {
  11316. const props = __props;
  11317. const moveX = vue.ref(0);
  11318. const moveY = vue.ref(0);
  11319. const handleScroll = (wrap) => {
  11320. if (wrap) {
  11321. const offsetHeight = wrap.offsetHeight - GAP;
  11322. const offsetWidth = wrap.offsetWidth - GAP;
  11323. moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
  11324. moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
  11325. }
  11326. };
  11327. expose({
  11328. handleScroll
  11329. });
  11330. return (_ctx, _cache) => {
  11331. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  11332. vue.createVNode(Thumb, {
  11333. move: moveX.value,
  11334. ratio: _ctx.ratioX,
  11335. size: _ctx.width,
  11336. always: _ctx.always
  11337. }, null, 8, ["move", "ratio", "size", "always"]),
  11338. vue.createVNode(Thumb, {
  11339. move: moveY.value,
  11340. ratio: _ctx.ratioY,
  11341. size: _ctx.height,
  11342. vertical: "",
  11343. always: _ctx.always
  11344. }, null, 8, ["move", "ratio", "size", "always"])
  11345. ], 64);
  11346. };
  11347. }
  11348. });
  11349. var Bar = /* @__PURE__ */ _export_sfc(_sfc_main$2a, [["__file", "bar.vue"]]);
  11350. const scrollbarProps = buildProps({
  11351. height: {
  11352. type: [String, Number],
  11353. default: ""
  11354. },
  11355. maxHeight: {
  11356. type: [String, Number],
  11357. default: ""
  11358. },
  11359. native: Boolean,
  11360. wrapStyle: {
  11361. type: definePropType([String, Object, Array]),
  11362. default: ""
  11363. },
  11364. wrapClass: {
  11365. type: [String, Array],
  11366. default: ""
  11367. },
  11368. viewClass: {
  11369. type: [String, Array],
  11370. default: ""
  11371. },
  11372. viewStyle: {
  11373. type: [String, Array, Object],
  11374. default: ""
  11375. },
  11376. noresize: Boolean,
  11377. tag: {
  11378. type: String,
  11379. default: "div"
  11380. },
  11381. always: Boolean,
  11382. minSize: {
  11383. type: Number,
  11384. default: 20
  11385. }
  11386. });
  11387. const scrollbarEmits = {
  11388. scroll: ({
  11389. scrollTop,
  11390. scrollLeft
  11391. }) => [scrollTop, scrollLeft].every(isNumber)
  11392. };
  11393. const __default__$1s = vue.defineComponent({
  11394. name: "ElScrollbar"
  11395. });
  11396. const _sfc_main$29 = /* @__PURE__ */ vue.defineComponent({
  11397. ...__default__$1s,
  11398. props: scrollbarProps,
  11399. emits: scrollbarEmits,
  11400. setup(__props, { expose, emit }) {
  11401. const props = __props;
  11402. const ns = useNamespace("scrollbar");
  11403. let stopResizeObserver = void 0;
  11404. let stopResizeListener = void 0;
  11405. const scrollbar$ = vue.ref();
  11406. const wrap$ = vue.ref();
  11407. const resize$ = vue.ref();
  11408. const sizeWidth = vue.ref("0");
  11409. const sizeHeight = vue.ref("0");
  11410. const barRef = vue.ref();
  11411. const ratioY = vue.ref(1);
  11412. const ratioX = vue.ref(1);
  11413. const style = vue.computed(() => {
  11414. const style2 = {};
  11415. if (props.height)
  11416. style2.height = addUnit(props.height);
  11417. if (props.maxHeight)
  11418. style2.maxHeight = addUnit(props.maxHeight);
  11419. return [props.wrapStyle, style2];
  11420. });
  11421. const handleScroll = () => {
  11422. var _a;
  11423. if (wrap$.value) {
  11424. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrap$.value);
  11425. emit("scroll", {
  11426. scrollTop: wrap$.value.scrollTop,
  11427. scrollLeft: wrap$.value.scrollLeft
  11428. });
  11429. }
  11430. };
  11431. function scrollTo(arg1, arg2) {
  11432. if (isObject$1(arg1)) {
  11433. wrap$.value.scrollTo(arg1);
  11434. } else if (isNumber(arg1) && isNumber(arg2)) {
  11435. wrap$.value.scrollTo(arg1, arg2);
  11436. }
  11437. }
  11438. const setScrollTop = (value) => {
  11439. if (!isNumber(value)) {
  11440. return;
  11441. }
  11442. wrap$.value.scrollTop = value;
  11443. };
  11444. const setScrollLeft = (value) => {
  11445. if (!isNumber(value)) {
  11446. return;
  11447. }
  11448. wrap$.value.scrollLeft = value;
  11449. };
  11450. const update = () => {
  11451. if (!wrap$.value)
  11452. return;
  11453. const offsetHeight = wrap$.value.offsetHeight - GAP;
  11454. const offsetWidth = wrap$.value.offsetWidth - GAP;
  11455. const originalHeight = offsetHeight ** 2 / wrap$.value.scrollHeight;
  11456. const originalWidth = offsetWidth ** 2 / wrap$.value.scrollWidth;
  11457. const height = Math.max(originalHeight, props.minSize);
  11458. const width = Math.max(originalWidth, props.minSize);
  11459. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  11460. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  11461. sizeHeight.value = height + GAP < offsetHeight ? `${height}px` : "";
  11462. sizeWidth.value = width + GAP < offsetWidth ? `${width}px` : "";
  11463. };
  11464. vue.watch(() => props.noresize, (noresize) => {
  11465. if (noresize) {
  11466. stopResizeObserver == null ? void 0 : stopResizeObserver();
  11467. stopResizeListener == null ? void 0 : stopResizeListener();
  11468. } else {
  11469. ({ stop: stopResizeObserver } = useResizeObserver(resize$, update));
  11470. stopResizeListener = useEventListener("resize", update);
  11471. }
  11472. }, { immediate: true });
  11473. vue.watch(() => [props.maxHeight, props.height], () => {
  11474. if (!props.native)
  11475. vue.nextTick(() => {
  11476. var _a;
  11477. update();
  11478. if (wrap$.value) {
  11479. (_a = barRef.value) == null ? void 0 : _a.handleScroll(wrap$.value);
  11480. }
  11481. });
  11482. });
  11483. vue.provide(scrollbarContextKey, vue.reactive({
  11484. scrollbarElement: scrollbar$,
  11485. wrapElement: wrap$
  11486. }));
  11487. vue.onMounted(() => {
  11488. if (!props.native)
  11489. vue.nextTick(() => {
  11490. update();
  11491. });
  11492. });
  11493. vue.onUpdated(() => update());
  11494. expose({
  11495. wrap$,
  11496. update,
  11497. scrollTo,
  11498. setScrollTop,
  11499. setScrollLeft,
  11500. handleScroll
  11501. });
  11502. return (_ctx, _cache) => {
  11503. return vue.openBlock(), vue.createElementBlock("div", {
  11504. ref_key: "scrollbar$",
  11505. ref: scrollbar$,
  11506. class: vue.normalizeClass(vue.unref(ns).b())
  11507. }, [
  11508. vue.createElementVNode("div", {
  11509. ref_key: "wrap$",
  11510. ref: wrap$,
  11511. class: vue.normalizeClass([
  11512. _ctx.wrapClass,
  11513. vue.unref(ns).e("wrap"),
  11514. { [vue.unref(ns).em("wrap", "hidden-default")]: !_ctx.native }
  11515. ]),
  11516. style: vue.normalizeStyle(vue.unref(style)),
  11517. onScroll: handleScroll
  11518. }, [
  11519. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  11520. ref_key: "resize$",
  11521. ref: resize$,
  11522. class: vue.normalizeClass([vue.unref(ns).e("view"), _ctx.viewClass]),
  11523. style: vue.normalizeStyle(_ctx.viewStyle)
  11524. }, {
  11525. default: vue.withCtx(() => [
  11526. vue.renderSlot(_ctx.$slots, "default")
  11527. ]),
  11528. _: 3
  11529. }, 8, ["class", "style"]))
  11530. ], 38),
  11531. !_ctx.native ? (vue.openBlock(), vue.createBlock(Bar, {
  11532. key: 0,
  11533. ref_key: "barRef",
  11534. ref: barRef,
  11535. height: sizeHeight.value,
  11536. width: sizeWidth.value,
  11537. always: _ctx.always,
  11538. "ratio-x": ratioX.value,
  11539. "ratio-y": ratioY.value
  11540. }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : vue.createCommentVNode("v-if", true)
  11541. ], 2);
  11542. };
  11543. }
  11544. });
  11545. var Scrollbar$1 = /* @__PURE__ */ _export_sfc(_sfc_main$29, [["__file", "scrollbar.vue"]]);
  11546. const ElScrollbar = withInstall(Scrollbar$1);
  11547. const Effect = {
  11548. LIGHT: "light",
  11549. DARK: "dark"
  11550. };
  11551. const roleTypes = [
  11552. "dialog",
  11553. "grid",
  11554. "group",
  11555. "listbox",
  11556. "menu",
  11557. "navigation",
  11558. "tooltip",
  11559. "tree"
  11560. ];
  11561. const popperProps = buildProps({
  11562. role: {
  11563. type: String,
  11564. values: roleTypes,
  11565. default: "tooltip"
  11566. }
  11567. });
  11568. const usePopperProps = popperProps;
  11569. const __default__$1r = vue.defineComponent({
  11570. name: "ElPopperRoot",
  11571. inheritAttrs: false
  11572. });
  11573. const _sfc_main$28 = /* @__PURE__ */ vue.defineComponent({
  11574. ...__default__$1r,
  11575. props: popperProps,
  11576. setup(__props, { expose }) {
  11577. const props = __props;
  11578. const triggerRef = vue.ref();
  11579. const popperInstanceRef = vue.ref();
  11580. const contentRef = vue.ref();
  11581. const referenceRef = vue.ref();
  11582. const role = vue.computed(() => props.role);
  11583. const popperProvides = {
  11584. triggerRef,
  11585. popperInstanceRef,
  11586. contentRef,
  11587. referenceRef,
  11588. role
  11589. };
  11590. expose(popperProvides);
  11591. vue.provide(POPPER_INJECTION_KEY, popperProvides);
  11592. return (_ctx, _cache) => {
  11593. return vue.renderSlot(_ctx.$slots, "default");
  11594. };
  11595. }
  11596. });
  11597. var Popper = /* @__PURE__ */ _export_sfc(_sfc_main$28, [["__file", "popper.vue"]]);
  11598. const popperArrowProps = buildProps({
  11599. arrowOffset: {
  11600. type: Number,
  11601. default: 5
  11602. }
  11603. });
  11604. const usePopperArrowProps = popperArrowProps;
  11605. const __default__$1q = vue.defineComponent({
  11606. name: "ElPopperArrow",
  11607. inheritAttrs: false
  11608. });
  11609. const _sfc_main$27 = /* @__PURE__ */ vue.defineComponent({
  11610. ...__default__$1q,
  11611. props: popperArrowProps,
  11612. setup(__props, { expose }) {
  11613. const props = __props;
  11614. const ns = useNamespace("popper");
  11615. const { arrowOffset, arrowRef } = vue.inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  11616. vue.watch(() => props.arrowOffset, (val) => {
  11617. arrowOffset.value = val;
  11618. });
  11619. vue.onBeforeUnmount(() => {
  11620. arrowRef.value = void 0;
  11621. });
  11622. expose({
  11623. arrowRef
  11624. });
  11625. return (_ctx, _cache) => {
  11626. return vue.openBlock(), vue.createElementBlock("span", {
  11627. ref_key: "arrowRef",
  11628. ref: arrowRef,
  11629. class: vue.normalizeClass(vue.unref(ns).e("arrow")),
  11630. "data-popper-arrow": ""
  11631. }, null, 2);
  11632. };
  11633. }
  11634. });
  11635. var ElPopperArrow = /* @__PURE__ */ _export_sfc(_sfc_main$27, [["__file", "arrow.vue"]]);
  11636. const NAME = "ElOnlyChild";
  11637. const OnlyChild = vue.defineComponent({
  11638. name: NAME,
  11639. setup(_, {
  11640. slots,
  11641. attrs
  11642. }) {
  11643. var _a;
  11644. const forwardRefInjection = vue.inject(FORWARD_REF_INJECTION_KEY);
  11645. const forwardRefDirective = useForwardRefDirective((_a = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a : NOOP);
  11646. return () => {
  11647. var _a2;
  11648. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots, attrs);
  11649. if (!defaultSlot)
  11650. return null;
  11651. if (defaultSlot.length > 1) {
  11652. return null;
  11653. }
  11654. const firstLegitNode = findFirstLegitChild(defaultSlot);
  11655. if (!firstLegitNode) {
  11656. return null;
  11657. }
  11658. return vue.withDirectives(vue.cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  11659. };
  11660. }
  11661. });
  11662. function findFirstLegitChild(node) {
  11663. if (!node)
  11664. return null;
  11665. const children = node;
  11666. for (const child of children) {
  11667. if (isObject$1(child)) {
  11668. switch (child.type) {
  11669. case vue.Comment:
  11670. continue;
  11671. case vue.Text:
  11672. case "svg":
  11673. return wrapTextContent(child);
  11674. case vue.Fragment:
  11675. return findFirstLegitChild(child.children);
  11676. default:
  11677. return child;
  11678. }
  11679. }
  11680. return wrapTextContent(child);
  11681. }
  11682. return null;
  11683. }
  11684. function wrapTextContent(s) {
  11685. const ns = useNamespace("only-child");
  11686. return vue.createVNode("span", {
  11687. "class": ns.e("content")
  11688. }, [s]);
  11689. }
  11690. const popperTriggerProps = buildProps({
  11691. virtualRef: {
  11692. type: definePropType(Object)
  11693. },
  11694. virtualTriggering: Boolean,
  11695. onMouseenter: {
  11696. type: definePropType(Function)
  11697. },
  11698. onMouseleave: {
  11699. type: definePropType(Function)
  11700. },
  11701. onClick: {
  11702. type: definePropType(Function)
  11703. },
  11704. onKeydown: {
  11705. type: definePropType(Function)
  11706. },
  11707. onFocus: {
  11708. type: definePropType(Function)
  11709. },
  11710. onBlur: {
  11711. type: definePropType(Function)
  11712. },
  11713. onContextmenu: {
  11714. type: definePropType(Function)
  11715. },
  11716. id: String,
  11717. open: Boolean
  11718. });
  11719. const usePopperTriggerProps = popperTriggerProps;
  11720. const __default__$1p = vue.defineComponent({
  11721. name: "ElPopperTrigger",
  11722. inheritAttrs: false
  11723. });
  11724. const _sfc_main$26 = /* @__PURE__ */ vue.defineComponent({
  11725. ...__default__$1p,
  11726. props: popperTriggerProps,
  11727. setup(__props, { expose }) {
  11728. const props = __props;
  11729. const { role, triggerRef } = vue.inject(POPPER_INJECTION_KEY, void 0);
  11730. useForwardRef(triggerRef);
  11731. const ariaControls = vue.computed(() => {
  11732. return ariaHaspopup.value ? props.id : void 0;
  11733. });
  11734. const ariaDescribedby = vue.computed(() => {
  11735. if (role && role.value === "tooltip") {
  11736. return props.open && props.id ? props.id : void 0;
  11737. }
  11738. return void 0;
  11739. });
  11740. const ariaHaspopup = vue.computed(() => {
  11741. if (role && role.value !== "tooltip") {
  11742. return role.value;
  11743. }
  11744. return void 0;
  11745. });
  11746. const ariaExpanded = vue.computed(() => {
  11747. return ariaHaspopup.value ? `${props.open}` : void 0;
  11748. });
  11749. let virtualTriggerAriaStopWatch = void 0;
  11750. vue.onMounted(() => {
  11751. vue.watch(() => props.virtualRef, (virtualEl) => {
  11752. if (virtualEl) {
  11753. triggerRef.value = unrefElement(virtualEl);
  11754. }
  11755. }, {
  11756. immediate: true
  11757. });
  11758. vue.watch(triggerRef, (el, prevEl) => {
  11759. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  11760. virtualTriggerAriaStopWatch = void 0;
  11761. if (isElement$1(el)) {
  11762. [
  11763. "onMouseenter",
  11764. "onMouseleave",
  11765. "onClick",
  11766. "onKeydown",
  11767. "onFocus",
  11768. "onBlur",
  11769. "onContextmenu"
  11770. ].forEach((eventName) => {
  11771. var _a;
  11772. const handler = props[eventName];
  11773. if (handler) {
  11774. el.addEventListener(eventName.slice(2).toLowerCase(), handler);
  11775. (_a = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a.call(prevEl, eventName.slice(2).toLowerCase(), handler);
  11776. }
  11777. });
  11778. virtualTriggerAriaStopWatch = vue.watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  11779. [
  11780. "aria-controls",
  11781. "aria-describedby",
  11782. "aria-haspopup",
  11783. "aria-expanded"
  11784. ].forEach((key, idx) => {
  11785. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  11786. });
  11787. }, { immediate: true });
  11788. }
  11789. if (isElement$1(prevEl)) {
  11790. [
  11791. "aria-controls",
  11792. "aria-describedby",
  11793. "aria-haspopup",
  11794. "aria-expanded"
  11795. ].forEach((key) => prevEl.removeAttribute(key));
  11796. }
  11797. }, {
  11798. immediate: true
  11799. });
  11800. });
  11801. vue.onBeforeUnmount(() => {
  11802. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  11803. virtualTriggerAriaStopWatch = void 0;
  11804. });
  11805. expose({
  11806. triggerRef
  11807. });
  11808. return (_ctx, _cache) => {
  11809. return !_ctx.virtualTriggering ? (vue.openBlock(), vue.createBlock(vue.unref(OnlyChild), vue.mergeProps({ key: 0 }, _ctx.$attrs, {
  11810. "aria-controls": vue.unref(ariaControls),
  11811. "aria-describedby": vue.unref(ariaDescribedby),
  11812. "aria-expanded": vue.unref(ariaExpanded),
  11813. "aria-haspopup": vue.unref(ariaHaspopup)
  11814. }), {
  11815. default: vue.withCtx(() => [
  11816. vue.renderSlot(_ctx.$slots, "default")
  11817. ]),
  11818. _: 3
  11819. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : vue.createCommentVNode("v-if", true);
  11820. };
  11821. }
  11822. });
  11823. var ElPopperTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$26, [["__file", "trigger.vue"]]);
  11824. 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});
  11825. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  11826. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  11827. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  11828. const FOCUS_AFTER_TRAPPED_OPTS = {
  11829. cancelable: true,
  11830. bubbles: false
  11831. };
  11832. const FOCUSOUT_PREVENTED_OPTS = {
  11833. cancelable: true,
  11834. bubbles: false
  11835. };
  11836. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  11837. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  11838. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  11839. const focusReason = vue.ref();
  11840. const lastUserFocusTimestamp = vue.ref(0);
  11841. const lastAutomatedFocusTimestamp = vue.ref(0);
  11842. let focusReasonUserCount = 0;
  11843. const obtainAllFocusableElements = (element) => {
  11844. const nodes = [];
  11845. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  11846. acceptNode: (node) => {
  11847. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  11848. if (node.disabled || node.hidden || isHiddenInput)
  11849. return NodeFilter.FILTER_SKIP;
  11850. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  11851. }
  11852. });
  11853. while (walker.nextNode())
  11854. nodes.push(walker.currentNode);
  11855. return nodes;
  11856. };
  11857. const getVisibleElement = (elements, container) => {
  11858. for (const element of elements) {
  11859. if (!isHidden(element, container))
  11860. return element;
  11861. }
  11862. };
  11863. const isHidden = (element, container) => {
  11864. if (getComputedStyle(element).visibility === "hidden")
  11865. return true;
  11866. while (element) {
  11867. if (container && element === container)
  11868. return false;
  11869. if (getComputedStyle(element).display === "none")
  11870. return true;
  11871. element = element.parentElement;
  11872. }
  11873. return false;
  11874. };
  11875. const getEdges = (container) => {
  11876. const focusable = obtainAllFocusableElements(container);
  11877. const first = getVisibleElement(focusable, container);
  11878. const last = getVisibleElement(focusable.reverse(), container);
  11879. return [first, last];
  11880. };
  11881. const isSelectable = (element) => {
  11882. return element instanceof HTMLInputElement && "select" in element;
  11883. };
  11884. const tryFocus = (element, shouldSelect) => {
  11885. if (element && element.focus) {
  11886. const prevFocusedElement = document.activeElement;
  11887. element.focus({ preventScroll: true });
  11888. lastAutomatedFocusTimestamp.value = window.performance.now();
  11889. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  11890. if (element.tagName === "INPUT") {
  11891. element.setSelectionRange(element.value.length, element.value.length);
  11892. return;
  11893. }
  11894. element.select();
  11895. }
  11896. }
  11897. };
  11898. function removeFromStack(list, item) {
  11899. const copy = [...list];
  11900. const idx = list.indexOf(item);
  11901. if (idx !== -1) {
  11902. copy.splice(idx, 1);
  11903. }
  11904. return copy;
  11905. }
  11906. const createFocusableStack = () => {
  11907. let stack = [];
  11908. const push = (layer) => {
  11909. const currentLayer = stack[0];
  11910. if (currentLayer && layer !== currentLayer) {
  11911. currentLayer.pause();
  11912. }
  11913. stack = removeFromStack(stack, layer);
  11914. stack.unshift(layer);
  11915. };
  11916. const remove = (layer) => {
  11917. var _a, _b;
  11918. stack = removeFromStack(stack, layer);
  11919. (_b = (_a = stack[0]) == null ? void 0 : _a.resume) == null ? void 0 : _b.call(_a);
  11920. };
  11921. return {
  11922. push,
  11923. remove
  11924. };
  11925. };
  11926. const focusFirstDescendant = (elements, shouldSelect = false) => {
  11927. const prevFocusedElement = document.activeElement;
  11928. for (const element of elements) {
  11929. tryFocus(element, shouldSelect);
  11930. if (document.activeElement !== prevFocusedElement)
  11931. return;
  11932. }
  11933. };
  11934. const focusableStack = createFocusableStack();
  11935. const isFocusCausedByUserEvent = () => {
  11936. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  11937. };
  11938. const notifyFocusReasonPointer = () => {
  11939. focusReason.value = "pointer";
  11940. lastUserFocusTimestamp.value = window.performance.now();
  11941. };
  11942. const notifyFocusReasonKeydown = () => {
  11943. focusReason.value = "keyboard";
  11944. lastUserFocusTimestamp.value = window.performance.now();
  11945. };
  11946. const useFocusReason = () => {
  11947. vue.onMounted(() => {
  11948. if (focusReasonUserCount === 0) {
  11949. document.addEventListener("mousedown", notifyFocusReasonPointer);
  11950. document.addEventListener("touchstart", notifyFocusReasonPointer);
  11951. document.addEventListener("keydown", notifyFocusReasonKeydown);
  11952. }
  11953. focusReasonUserCount++;
  11954. });
  11955. vue.onBeforeUnmount(() => {
  11956. focusReasonUserCount--;
  11957. if (focusReasonUserCount <= 0) {
  11958. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  11959. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  11960. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  11961. }
  11962. });
  11963. return {
  11964. focusReason,
  11965. lastUserFocusTimestamp,
  11966. lastAutomatedFocusTimestamp
  11967. };
  11968. };
  11969. const createFocusOutPreventedEvent = (detail) => {
  11970. return new CustomEvent(FOCUSOUT_PREVENTED, {
  11971. ...FOCUSOUT_PREVENTED_OPTS,
  11972. detail
  11973. });
  11974. };
  11975. const _sfc_main$25 = vue.defineComponent({
  11976. name: "ElFocusTrap",
  11977. inheritAttrs: false,
  11978. props: {
  11979. loop: Boolean,
  11980. trapped: Boolean,
  11981. focusTrapEl: Object,
  11982. focusStartEl: {
  11983. type: [Object, String],
  11984. default: "first"
  11985. }
  11986. },
  11987. emits: [
  11988. ON_TRAP_FOCUS_EVT,
  11989. ON_RELEASE_FOCUS_EVT,
  11990. "focusin",
  11991. "focusout",
  11992. "focusout-prevented",
  11993. "release-requested"
  11994. ],
  11995. setup(props, { emit }) {
  11996. const forwardRef = vue.ref();
  11997. let lastFocusBeforeTrapped;
  11998. let lastFocusAfterTrapped;
  11999. const { focusReason } = useFocusReason();
  12000. useEscapeKeydown((event) => {
  12001. if (props.trapped && !focusLayer.paused) {
  12002. emit("release-requested", event);
  12003. }
  12004. });
  12005. const focusLayer = {
  12006. paused: false,
  12007. pause() {
  12008. this.paused = true;
  12009. },
  12010. resume() {
  12011. this.paused = false;
  12012. }
  12013. };
  12014. const onKeydown = (e) => {
  12015. if (!props.loop && !props.trapped)
  12016. return;
  12017. if (focusLayer.paused)
  12018. return;
  12019. const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  12020. const { loop } = props;
  12021. const isTabbing = key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  12022. const currentFocusingEl = document.activeElement;
  12023. if (isTabbing && currentFocusingEl) {
  12024. const container = currentTarget;
  12025. const [first, last] = getEdges(container);
  12026. const isTabbable = first && last;
  12027. if (!isTabbable) {
  12028. if (currentFocusingEl === container) {
  12029. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  12030. focusReason: focusReason.value
  12031. });
  12032. emit("focusout-prevented", focusoutPreventedEvent);
  12033. if (!focusoutPreventedEvent.defaultPrevented) {
  12034. e.preventDefault();
  12035. }
  12036. }
  12037. } else {
  12038. if (!shiftKey && currentFocusingEl === last) {
  12039. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  12040. focusReason: focusReason.value
  12041. });
  12042. emit("focusout-prevented", focusoutPreventedEvent);
  12043. if (!focusoutPreventedEvent.defaultPrevented) {
  12044. e.preventDefault();
  12045. if (loop)
  12046. tryFocus(first, true);
  12047. }
  12048. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  12049. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  12050. focusReason: focusReason.value
  12051. });
  12052. emit("focusout-prevented", focusoutPreventedEvent);
  12053. if (!focusoutPreventedEvent.defaultPrevented) {
  12054. e.preventDefault();
  12055. if (loop)
  12056. tryFocus(last, true);
  12057. }
  12058. }
  12059. }
  12060. }
  12061. };
  12062. vue.provide(FOCUS_TRAP_INJECTION_KEY, {
  12063. focusTrapRef: forwardRef,
  12064. onKeydown
  12065. });
  12066. vue.watch(() => props.focusTrapEl, (focusTrapEl) => {
  12067. if (focusTrapEl) {
  12068. forwardRef.value = focusTrapEl;
  12069. }
  12070. }, { immediate: true });
  12071. vue.watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  12072. if (forwardRef2) {
  12073. forwardRef2.addEventListener("keydown", onKeydown);
  12074. forwardRef2.addEventListener("focusin", onFocusIn);
  12075. forwardRef2.addEventListener("focusout", onFocusOut);
  12076. }
  12077. if (oldForwardRef) {
  12078. oldForwardRef.removeEventListener("keydown", onKeydown);
  12079. oldForwardRef.removeEventListener("focusin", onFocusIn);
  12080. oldForwardRef.removeEventListener("focusout", onFocusOut);
  12081. }
  12082. });
  12083. const trapOnFocus = (e) => {
  12084. emit(ON_TRAP_FOCUS_EVT, e);
  12085. };
  12086. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  12087. const onFocusIn = (e) => {
  12088. const trapContainer = vue.unref(forwardRef);
  12089. if (!trapContainer)
  12090. return;
  12091. const target = e.target;
  12092. const relatedTarget = e.relatedTarget;
  12093. const isFocusedInTrap = target && trapContainer.contains(target);
  12094. if (!props.trapped) {
  12095. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  12096. if (!isPrevFocusedInTrap) {
  12097. lastFocusBeforeTrapped = relatedTarget;
  12098. }
  12099. }
  12100. if (isFocusedInTrap)
  12101. emit("focusin", e);
  12102. if (focusLayer.paused)
  12103. return;
  12104. if (props.trapped) {
  12105. if (isFocusedInTrap) {
  12106. lastFocusAfterTrapped = target;
  12107. } else {
  12108. tryFocus(lastFocusAfterTrapped, true);
  12109. }
  12110. }
  12111. };
  12112. const onFocusOut = (e) => {
  12113. const trapContainer = vue.unref(forwardRef);
  12114. if (focusLayer.paused || !trapContainer)
  12115. return;
  12116. if (props.trapped) {
  12117. const relatedTarget = e.relatedTarget;
  12118. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  12119. setTimeout(() => {
  12120. if (!focusLayer.paused && props.trapped) {
  12121. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  12122. focusReason: focusReason.value
  12123. });
  12124. emit("focusout-prevented", focusoutPreventedEvent);
  12125. if (!focusoutPreventedEvent.defaultPrevented) {
  12126. tryFocus(lastFocusAfterTrapped, true);
  12127. }
  12128. }
  12129. }, 0);
  12130. }
  12131. } else {
  12132. const target = e.target;
  12133. const isFocusedInTrap = target && trapContainer.contains(target);
  12134. if (!isFocusedInTrap)
  12135. emit("focusout", e);
  12136. }
  12137. };
  12138. async function startTrap() {
  12139. await vue.nextTick();
  12140. const trapContainer = vue.unref(forwardRef);
  12141. if (trapContainer) {
  12142. focusableStack.push(focusLayer);
  12143. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  12144. lastFocusBeforeTrapped = prevFocusedElement;
  12145. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  12146. if (!isPrevFocusContained) {
  12147. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  12148. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  12149. trapContainer.dispatchEvent(focusEvent);
  12150. if (!focusEvent.defaultPrevented) {
  12151. vue.nextTick(() => {
  12152. let focusStartEl = props.focusStartEl;
  12153. if (!isString(focusStartEl)) {
  12154. tryFocus(focusStartEl);
  12155. if (document.activeElement !== focusStartEl) {
  12156. focusStartEl = "first";
  12157. }
  12158. }
  12159. if (focusStartEl === "first") {
  12160. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  12161. }
  12162. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  12163. tryFocus(trapContainer);
  12164. }
  12165. });
  12166. }
  12167. }
  12168. }
  12169. }
  12170. function stopTrap() {
  12171. const trapContainer = vue.unref(forwardRef);
  12172. if (trapContainer) {
  12173. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  12174. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  12175. ...FOCUS_AFTER_TRAPPED_OPTS,
  12176. detail: {
  12177. focusReason: focusReason.value
  12178. }
  12179. });
  12180. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  12181. trapContainer.dispatchEvent(releasedEvent);
  12182. if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent())) {
  12183. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body, true);
  12184. }
  12185. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, trapOnFocus);
  12186. focusableStack.remove(focusLayer);
  12187. }
  12188. }
  12189. vue.onMounted(() => {
  12190. if (props.trapped) {
  12191. startTrap();
  12192. }
  12193. vue.watch(() => props.trapped, (trapped) => {
  12194. if (trapped) {
  12195. startTrap();
  12196. } else {
  12197. stopTrap();
  12198. }
  12199. });
  12200. });
  12201. vue.onBeforeUnmount(() => {
  12202. if (props.trapped) {
  12203. stopTrap();
  12204. }
  12205. });
  12206. return {
  12207. onKeydown
  12208. };
  12209. }
  12210. });
  12211. function _sfc_render$y(_ctx, _cache, $props, $setup, $data, $options) {
  12212. return vue.renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  12213. }
  12214. var ElFocusTrap = /* @__PURE__ */ _export_sfc(_sfc_main$25, [["render", _sfc_render$y], ["__file", "focus-trap.vue"]]);
  12215. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  12216. const popperCoreConfigProps = buildProps({
  12217. boundariesPadding: {
  12218. type: Number,
  12219. default: 0
  12220. },
  12221. fallbackPlacements: {
  12222. type: definePropType(Array),
  12223. default: void 0
  12224. },
  12225. gpuAcceleration: {
  12226. type: Boolean,
  12227. default: true
  12228. },
  12229. offset: {
  12230. type: Number,
  12231. default: 12
  12232. },
  12233. placement: {
  12234. type: String,
  12235. values: Ee,
  12236. default: "bottom"
  12237. },
  12238. popperOptions: {
  12239. type: definePropType(Object),
  12240. default: () => ({})
  12241. },
  12242. strategy: {
  12243. type: String,
  12244. values: POSITIONING_STRATEGIES,
  12245. default: "absolute"
  12246. }
  12247. });
  12248. const popperContentProps = buildProps({
  12249. ...popperCoreConfigProps,
  12250. id: String,
  12251. style: {
  12252. type: definePropType([String, Array, Object])
  12253. },
  12254. className: {
  12255. type: definePropType([String, Array, Object])
  12256. },
  12257. effect: {
  12258. type: String,
  12259. default: "dark"
  12260. },
  12261. visible: Boolean,
  12262. enterable: {
  12263. type: Boolean,
  12264. default: true
  12265. },
  12266. pure: Boolean,
  12267. focusOnShow: {
  12268. type: Boolean,
  12269. default: false
  12270. },
  12271. trapping: {
  12272. type: Boolean,
  12273. default: false
  12274. },
  12275. popperClass: {
  12276. type: definePropType([String, Array, Object])
  12277. },
  12278. popperStyle: {
  12279. type: definePropType([String, Array, Object])
  12280. },
  12281. referenceEl: {
  12282. type: definePropType(Object)
  12283. },
  12284. triggerTargetEl: {
  12285. type: definePropType(Object)
  12286. },
  12287. stopPopperMouseEvent: {
  12288. type: Boolean,
  12289. default: true
  12290. },
  12291. ariaLabel: {
  12292. type: String,
  12293. default: void 0
  12294. },
  12295. virtualTriggering: Boolean,
  12296. zIndex: Number
  12297. });
  12298. const popperContentEmits = {
  12299. mouseenter: (evt) => evt instanceof MouseEvent,
  12300. mouseleave: (evt) => evt instanceof MouseEvent,
  12301. focus: () => true,
  12302. blur: () => true,
  12303. close: () => true
  12304. };
  12305. const usePopperCoreConfigProps = popperCoreConfigProps;
  12306. const usePopperContentProps = popperContentProps;
  12307. const usePopperContentEmits = popperContentEmits;
  12308. const buildPopperOptions = (props, arrowProps) => {
  12309. const { placement, strategy, popperOptions } = props;
  12310. const options = {
  12311. placement,
  12312. strategy,
  12313. ...popperOptions,
  12314. modifiers: genModifiers(props)
  12315. };
  12316. attachArrow(options, arrowProps);
  12317. deriveExtraModifiers(options, popperOptions == null ? void 0 : popperOptions.modifiers);
  12318. return options;
  12319. };
  12320. const unwrapMeasurableEl = ($el) => {
  12321. if (!isClient)
  12322. return;
  12323. return unrefElement($el);
  12324. };
  12325. function genModifiers(options) {
  12326. const { offset, gpuAcceleration, fallbackPlacements } = options;
  12327. return [
  12328. {
  12329. name: "offset",
  12330. options: {
  12331. offset: [0, offset != null ? offset : 12]
  12332. }
  12333. },
  12334. {
  12335. name: "preventOverflow",
  12336. options: {
  12337. padding: {
  12338. top: 2,
  12339. bottom: 2,
  12340. left: 5,
  12341. right: 5
  12342. }
  12343. }
  12344. },
  12345. {
  12346. name: "flip",
  12347. options: {
  12348. padding: 5,
  12349. fallbackPlacements
  12350. }
  12351. },
  12352. {
  12353. name: "computeStyles",
  12354. options: {
  12355. gpuAcceleration
  12356. }
  12357. }
  12358. ];
  12359. }
  12360. function attachArrow(options, { arrowEl, arrowOffset }) {
  12361. options.modifiers.push({
  12362. name: "arrow",
  12363. options: {
  12364. element: arrowEl,
  12365. padding: arrowOffset != null ? arrowOffset : 5
  12366. }
  12367. });
  12368. }
  12369. function deriveExtraModifiers(options, modifiers) {
  12370. if (modifiers) {
  12371. options.modifiers = [...options.modifiers, ...modifiers != null ? modifiers : []];
  12372. }
  12373. }
  12374. const __default__$1o = vue.defineComponent({
  12375. name: "ElPopperContent"
  12376. });
  12377. const _sfc_main$24 = /* @__PURE__ */ vue.defineComponent({
  12378. ...__default__$1o,
  12379. props: popperContentProps,
  12380. emits: popperContentEmits,
  12381. setup(__props, { expose, emit }) {
  12382. const props = __props;
  12383. const { popperInstanceRef, contentRef, triggerRef, role } = vue.inject(POPPER_INJECTION_KEY, void 0);
  12384. const formItemContext = vue.inject(formItemContextKey, void 0);
  12385. const { nextZIndex } = useZIndex();
  12386. const ns = useNamespace("popper");
  12387. const popperContentRef = vue.ref();
  12388. const focusStartRef = vue.ref("first");
  12389. const arrowRef = vue.ref();
  12390. const arrowOffset = vue.ref();
  12391. vue.provide(POPPER_CONTENT_INJECTION_KEY, {
  12392. arrowRef,
  12393. arrowOffset
  12394. });
  12395. if (formItemContext && (formItemContext.addInputId || formItemContext.removeInputId)) {
  12396. vue.provide(formItemContextKey, {
  12397. ...formItemContext,
  12398. addInputId: NOOP,
  12399. removeInputId: NOOP
  12400. });
  12401. }
  12402. const contentZIndex = vue.ref(props.zIndex || nextZIndex());
  12403. const trapped = vue.ref(false);
  12404. let triggerTargetAriaStopWatch = void 0;
  12405. const computedReference = vue.computed(() => unwrapMeasurableEl(props.referenceEl) || vue.unref(triggerRef));
  12406. const contentStyle = vue.computed(() => [{ zIndex: vue.unref(contentZIndex) }, props.popperStyle]);
  12407. const contentClass = vue.computed(() => [
  12408. ns.b(),
  12409. ns.is("pure", props.pure),
  12410. ns.is(props.effect),
  12411. props.popperClass
  12412. ]);
  12413. const ariaModal = vue.computed(() => {
  12414. return role && role.value === "dialog" ? "false" : void 0;
  12415. });
  12416. const createPopperInstance = ({
  12417. referenceEl,
  12418. popperContentEl,
  12419. arrowEl
  12420. }) => {
  12421. const options = buildPopperOptions(props, {
  12422. arrowEl,
  12423. arrowOffset: vue.unref(arrowOffset)
  12424. });
  12425. return yn(referenceEl, popperContentEl, options);
  12426. };
  12427. const updatePopper = (shouldUpdateZIndex = true) => {
  12428. var _a;
  12429. (_a = vue.unref(popperInstanceRef)) == null ? void 0 : _a.update();
  12430. shouldUpdateZIndex && (contentZIndex.value = props.zIndex || nextZIndex());
  12431. };
  12432. const togglePopperAlive = () => {
  12433. var _a, _b;
  12434. const monitorable = { name: "eventListeners", enabled: props.visible };
  12435. (_b = (_a = vue.unref(popperInstanceRef)) == null ? void 0 : _a.setOptions) == null ? void 0 : _b.call(_a, (options) => ({
  12436. ...options,
  12437. modifiers: [...options.modifiers || [], monitorable]
  12438. }));
  12439. updatePopper(false);
  12440. if (props.visible && props.focusOnShow) {
  12441. trapped.value = true;
  12442. } else if (props.visible === false) {
  12443. trapped.value = false;
  12444. }
  12445. };
  12446. const onFocusAfterTrapped = () => {
  12447. emit("focus");
  12448. };
  12449. const onFocusAfterReleased = (event) => {
  12450. var _a;
  12451. if (((_a = event.detail) == null ? void 0 : _a.focusReason) !== "pointer") {
  12452. focusStartRef.value = "first";
  12453. emit("blur");
  12454. }
  12455. };
  12456. const onFocusInTrap = (event) => {
  12457. if (props.visible && !trapped.value) {
  12458. if (event.target) {
  12459. focusStartRef.value = event.target;
  12460. }
  12461. trapped.value = true;
  12462. }
  12463. };
  12464. const onFocusoutPrevented = (event) => {
  12465. if (!props.trapping) {
  12466. if (event.detail.focusReason === "pointer") {
  12467. event.preventDefault();
  12468. }
  12469. trapped.value = false;
  12470. }
  12471. };
  12472. const onReleaseRequested = () => {
  12473. trapped.value = false;
  12474. emit("close");
  12475. };
  12476. vue.onMounted(() => {
  12477. let updateHandle;
  12478. vue.watch(computedReference, (referenceEl) => {
  12479. var _a;
  12480. updateHandle == null ? void 0 : updateHandle();
  12481. const popperInstance = vue.unref(popperInstanceRef);
  12482. (_a = popperInstance == null ? void 0 : popperInstance.destroy) == null ? void 0 : _a.call(popperInstance);
  12483. if (referenceEl) {
  12484. const popperContentEl = vue.unref(popperContentRef);
  12485. contentRef.value = popperContentEl;
  12486. popperInstanceRef.value = createPopperInstance({
  12487. referenceEl,
  12488. popperContentEl,
  12489. arrowEl: vue.unref(arrowRef)
  12490. });
  12491. updateHandle = vue.watch(() => referenceEl.getBoundingClientRect(), () => updatePopper(), {
  12492. immediate: true
  12493. });
  12494. } else {
  12495. popperInstanceRef.value = void 0;
  12496. }
  12497. }, {
  12498. immediate: true
  12499. });
  12500. vue.watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  12501. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  12502. triggerTargetAriaStopWatch = void 0;
  12503. const el = vue.unref(triggerTargetEl || popperContentRef.value);
  12504. const prevEl = vue.unref(prevTriggerTargetEl || popperContentRef.value);
  12505. if (isElement$1(el)) {
  12506. triggerTargetAriaStopWatch = vue.watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  12507. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  12508. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  12509. });
  12510. }, { immediate: true });
  12511. }
  12512. if (prevEl !== el && isElement$1(prevEl)) {
  12513. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  12514. prevEl.removeAttribute(key);
  12515. });
  12516. }
  12517. }, { immediate: true });
  12518. vue.watch(() => props.visible, togglePopperAlive, { immediate: true });
  12519. vue.watch(() => buildPopperOptions(props, {
  12520. arrowEl: vue.unref(arrowRef),
  12521. arrowOffset: vue.unref(arrowOffset)
  12522. }), (option) => {
  12523. var _a;
  12524. return (_a = popperInstanceRef.value) == null ? void 0 : _a.setOptions(option);
  12525. });
  12526. });
  12527. vue.onBeforeUnmount(() => {
  12528. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  12529. triggerTargetAriaStopWatch = void 0;
  12530. });
  12531. expose({
  12532. popperContentRef,
  12533. popperInstanceRef,
  12534. updatePopper,
  12535. contentStyle
  12536. });
  12537. return (_ctx, _cache) => {
  12538. return vue.openBlock(), vue.createElementBlock("div", {
  12539. ref_key: "popperContentRef",
  12540. ref: popperContentRef,
  12541. style: vue.normalizeStyle(vue.unref(contentStyle)),
  12542. class: vue.normalizeClass(vue.unref(contentClass)),
  12543. tabindex: "-1",
  12544. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  12545. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  12546. }, [
  12547. vue.createVNode(vue.unref(ElFocusTrap), {
  12548. trapped: trapped.value,
  12549. "trap-on-focus-in": true,
  12550. "focus-trap-el": popperContentRef.value,
  12551. "focus-start-el": focusStartRef.value,
  12552. onFocusAfterTrapped,
  12553. onFocusAfterReleased,
  12554. onFocusin: onFocusInTrap,
  12555. onFocusoutPrevented,
  12556. onReleaseRequested
  12557. }, {
  12558. default: vue.withCtx(() => [
  12559. vue.renderSlot(_ctx.$slots, "default")
  12560. ]),
  12561. _: 3
  12562. }, 8, ["trapped", "focus-trap-el", "focus-start-el"])
  12563. ], 38);
  12564. };
  12565. }
  12566. });
  12567. var ElPopperContent = /* @__PURE__ */ _export_sfc(_sfc_main$24, [["__file", "content.vue"]]);
  12568. const ElPopper = withInstall(Popper);
  12569. const ns = useNamespace("tooltip");
  12570. const useTooltipContentProps = buildProps({
  12571. ...useDelayedToggleProps,
  12572. ...popperContentProps,
  12573. appendTo: {
  12574. type: definePropType([String, Object]),
  12575. default: POPPER_CONTAINER_SELECTOR
  12576. },
  12577. content: {
  12578. type: String,
  12579. default: ""
  12580. },
  12581. rawContent: {
  12582. type: Boolean,
  12583. default: false
  12584. },
  12585. persistent: Boolean,
  12586. ariaLabel: String,
  12587. visible: {
  12588. type: definePropType(Boolean),
  12589. default: null
  12590. },
  12591. transition: {
  12592. type: String,
  12593. default: `${ns.namespace.value}-fade-in-linear`
  12594. },
  12595. teleported: {
  12596. type: Boolean,
  12597. default: true
  12598. },
  12599. disabled: {
  12600. type: Boolean
  12601. }
  12602. });
  12603. const useTooltipTriggerProps = buildProps({
  12604. ...popperTriggerProps,
  12605. disabled: Boolean,
  12606. trigger: {
  12607. type: definePropType([String, Array]),
  12608. default: "hover"
  12609. },
  12610. triggerKeys: {
  12611. type: definePropType(Array),
  12612. default: () => [EVENT_CODE.enter, EVENT_CODE.space]
  12613. }
  12614. });
  12615. const {
  12616. useModelToggleProps: useTooltipModelToggleProps,
  12617. useModelToggleEmits: useTooltipModelToggleEmits,
  12618. useModelToggle: useTooltipModelToggle
  12619. } = createModelToggleComposable("visible");
  12620. const useTooltipProps = buildProps({
  12621. ...popperProps,
  12622. ...useTooltipModelToggleProps,
  12623. ...useTooltipContentProps,
  12624. ...useTooltipTriggerProps,
  12625. ...popperArrowProps,
  12626. showArrow: {
  12627. type: Boolean,
  12628. default: true
  12629. }
  12630. });
  12631. const tooltipEmits = [
  12632. ...useTooltipModelToggleEmits,
  12633. "before-show",
  12634. "before-hide",
  12635. "show",
  12636. "hide",
  12637. "open",
  12638. "close"
  12639. ];
  12640. const isTriggerType = (trigger, type) => {
  12641. if (isArray(trigger)) {
  12642. return trigger.includes(type);
  12643. }
  12644. return trigger === type;
  12645. };
  12646. const whenTrigger = (trigger, type, handler) => {
  12647. return (e) => {
  12648. isTriggerType(vue.unref(trigger), type) && handler(e);
  12649. };
  12650. };
  12651. const __default__$1n = vue.defineComponent({
  12652. name: "ElTooltipTrigger"
  12653. });
  12654. const _sfc_main$23 = /* @__PURE__ */ vue.defineComponent({
  12655. ...__default__$1n,
  12656. props: useTooltipTriggerProps,
  12657. setup(__props, { expose }) {
  12658. const props = __props;
  12659. const ns = useNamespace("tooltip");
  12660. const { controlled, id, open, onOpen, onClose, onToggle } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  12661. const triggerRef = vue.ref(null);
  12662. const stopWhenControlledOrDisabled = () => {
  12663. if (vue.unref(controlled) || props.disabled) {
  12664. return true;
  12665. }
  12666. };
  12667. const trigger = vue.toRef(props, "trigger");
  12668. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onOpen));
  12669. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  12670. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  12671. if (e.button === 0) {
  12672. onToggle(e);
  12673. }
  12674. }));
  12675. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  12676. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  12677. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  12678. e.preventDefault();
  12679. onToggle(e);
  12680. }));
  12681. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  12682. const { code } = e;
  12683. if (props.triggerKeys.includes(code)) {
  12684. e.preventDefault();
  12685. onToggle(e);
  12686. }
  12687. });
  12688. expose({
  12689. triggerRef
  12690. });
  12691. return (_ctx, _cache) => {
  12692. return vue.openBlock(), vue.createBlock(vue.unref(ElPopperTrigger), {
  12693. id: vue.unref(id),
  12694. "virtual-ref": _ctx.virtualRef,
  12695. open: vue.unref(open),
  12696. "virtual-triggering": _ctx.virtualTriggering,
  12697. class: vue.normalizeClass(vue.unref(ns).e("trigger")),
  12698. onBlur: vue.unref(onBlur),
  12699. onClick: vue.unref(onClick),
  12700. onContextmenu: vue.unref(onContextMenu),
  12701. onFocus: vue.unref(onFocus),
  12702. onMouseenter: vue.unref(onMouseenter),
  12703. onMouseleave: vue.unref(onMouseleave),
  12704. onKeydown: vue.unref(onKeydown)
  12705. }, {
  12706. default: vue.withCtx(() => [
  12707. vue.renderSlot(_ctx.$slots, "default")
  12708. ]),
  12709. _: 3
  12710. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  12711. };
  12712. }
  12713. });
  12714. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc(_sfc_main$23, [["__file", "trigger.vue"]]);
  12715. const __default__$1m = vue.defineComponent({
  12716. name: "ElTooltipContent",
  12717. inheritAttrs: false
  12718. });
  12719. const _sfc_main$22 = /* @__PURE__ */ vue.defineComponent({
  12720. ...__default__$1m,
  12721. props: useTooltipContentProps,
  12722. setup(__props, { expose }) {
  12723. const props = __props;
  12724. const contentRef = vue.ref(null);
  12725. const destroyed = vue.ref(false);
  12726. const {
  12727. controlled,
  12728. id,
  12729. open,
  12730. trigger,
  12731. onClose,
  12732. onOpen,
  12733. onShow,
  12734. onHide,
  12735. onBeforeShow,
  12736. onBeforeHide
  12737. } = vue.inject(TOOLTIP_INJECTION_KEY, void 0);
  12738. const persistentRef = vue.computed(() => {
  12739. return props.persistent;
  12740. });
  12741. vue.onBeforeUnmount(() => {
  12742. destroyed.value = true;
  12743. });
  12744. const shouldRender = vue.computed(() => {
  12745. return vue.unref(persistentRef) ? true : vue.unref(open);
  12746. });
  12747. const shouldShow = vue.computed(() => {
  12748. return props.disabled ? false : vue.unref(open);
  12749. });
  12750. const contentStyle = vue.computed(() => {
  12751. var _a;
  12752. return (_a = props.style) != null ? _a : {};
  12753. });
  12754. const ariaHidden = vue.computed(() => !vue.unref(open));
  12755. const onTransitionLeave = () => {
  12756. onHide();
  12757. };
  12758. const stopWhenControlled = () => {
  12759. if (vue.unref(controlled))
  12760. return true;
  12761. };
  12762. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  12763. if (props.enterable && vue.unref(trigger) === "hover") {
  12764. onOpen();
  12765. }
  12766. });
  12767. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  12768. if (vue.unref(trigger) === "hover") {
  12769. onClose();
  12770. }
  12771. });
  12772. const onBeforeEnter = () => {
  12773. var _a, _b;
  12774. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  12775. onBeforeShow == null ? void 0 : onBeforeShow();
  12776. };
  12777. const onBeforeLeave = () => {
  12778. onBeforeHide == null ? void 0 : onBeforeHide();
  12779. };
  12780. const onAfterShow = () => {
  12781. onShow();
  12782. stopHandle = onClickOutside(vue.computed(() => {
  12783. var _a;
  12784. return (_a = contentRef.value) == null ? void 0 : _a.popperContentRef;
  12785. }), () => {
  12786. if (vue.unref(controlled))
  12787. return;
  12788. const $trigger = vue.unref(trigger);
  12789. if ($trigger !== "hover") {
  12790. onClose();
  12791. }
  12792. });
  12793. };
  12794. const onBlur = () => {
  12795. if (!props.virtualTriggering) {
  12796. onClose();
  12797. }
  12798. };
  12799. let stopHandle;
  12800. vue.watch(() => vue.unref(open), (val) => {
  12801. if (!val) {
  12802. stopHandle == null ? void 0 : stopHandle();
  12803. }
  12804. }, {
  12805. flush: "post"
  12806. });
  12807. vue.watch(() => props.content, () => {
  12808. var _a, _b;
  12809. (_b = (_a = contentRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  12810. });
  12811. expose({
  12812. contentRef
  12813. });
  12814. return (_ctx, _cache) => {
  12815. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  12816. disabled: !_ctx.teleported,
  12817. to: _ctx.appendTo
  12818. }, [
  12819. vue.createVNode(vue.Transition, {
  12820. name: _ctx.transition,
  12821. onAfterLeave: onTransitionLeave,
  12822. onBeforeEnter,
  12823. onAfterEnter: onAfterShow,
  12824. onBeforeLeave
  12825. }, {
  12826. default: vue.withCtx(() => [
  12827. vue.unref(shouldRender) ? vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElPopperContent), vue.mergeProps({
  12828. key: 0,
  12829. id: vue.unref(id),
  12830. ref_key: "contentRef",
  12831. ref: contentRef
  12832. }, _ctx.$attrs, {
  12833. "aria-label": _ctx.ariaLabel,
  12834. "aria-hidden": vue.unref(ariaHidden),
  12835. "boundaries-padding": _ctx.boundariesPadding,
  12836. "fallback-placements": _ctx.fallbackPlacements,
  12837. "gpu-acceleration": _ctx.gpuAcceleration,
  12838. offset: _ctx.offset,
  12839. placement: _ctx.placement,
  12840. "popper-options": _ctx.popperOptions,
  12841. strategy: _ctx.strategy,
  12842. effect: _ctx.effect,
  12843. enterable: _ctx.enterable,
  12844. pure: _ctx.pure,
  12845. "popper-class": _ctx.popperClass,
  12846. "popper-style": [_ctx.popperStyle, vue.unref(contentStyle)],
  12847. "reference-el": _ctx.referenceEl,
  12848. "trigger-target-el": _ctx.triggerTargetEl,
  12849. visible: vue.unref(shouldShow),
  12850. "z-index": _ctx.zIndex,
  12851. onMouseenter: vue.unref(onContentEnter),
  12852. onMouseleave: vue.unref(onContentLeave),
  12853. onBlur,
  12854. onClose: vue.unref(onClose)
  12855. }), {
  12856. default: vue.withCtx(() => [
  12857. vue.createCommentVNode(" Workaround bug #6378 "),
  12858. !destroyed.value ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
  12859. ]),
  12860. _: 3
  12861. }, 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"])), [
  12862. [vue.vShow, vue.unref(shouldShow)]
  12863. ]) : vue.createCommentVNode("v-if", true)
  12864. ]),
  12865. _: 3
  12866. }, 8, ["name"])
  12867. ], 8, ["disabled", "to"]);
  12868. };
  12869. }
  12870. });
  12871. var ElTooltipContent = /* @__PURE__ */ _export_sfc(_sfc_main$22, [["__file", "content.vue"]]);
  12872. const _hoisted_1$12 = ["innerHTML"];
  12873. const _hoisted_2$F = { key: 1 };
  12874. const __default__$1l = vue.defineComponent({
  12875. name: "ElTooltip"
  12876. });
  12877. const _sfc_main$21 = /* @__PURE__ */ vue.defineComponent({
  12878. ...__default__$1l,
  12879. props: useTooltipProps,
  12880. emits: tooltipEmits,
  12881. setup(__props, { expose, emit }) {
  12882. const props = __props;
  12883. usePopperContainer();
  12884. const id = useId();
  12885. const popperRef = vue.ref();
  12886. const contentRef = vue.ref();
  12887. const updatePopper = () => {
  12888. var _a;
  12889. const popperComponent = vue.unref(popperRef);
  12890. if (popperComponent) {
  12891. (_a = popperComponent.popperInstanceRef) == null ? void 0 : _a.update();
  12892. }
  12893. };
  12894. const open = vue.ref(false);
  12895. const toggleReason = vue.ref();
  12896. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  12897. indicator: open,
  12898. toggleReason
  12899. });
  12900. const { onOpen, onClose } = useDelayedToggle({
  12901. showAfter: vue.toRef(props, "showAfter"),
  12902. hideAfter: vue.toRef(props, "hideAfter"),
  12903. open: show,
  12904. close: hide
  12905. });
  12906. const controlled = vue.computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  12907. vue.provide(TOOLTIP_INJECTION_KEY, {
  12908. controlled,
  12909. id,
  12910. open: vue.readonly(open),
  12911. trigger: vue.toRef(props, "trigger"),
  12912. onOpen: (event) => {
  12913. onOpen(event);
  12914. },
  12915. onClose: (event) => {
  12916. onClose(event);
  12917. },
  12918. onToggle: (event) => {
  12919. if (vue.unref(open)) {
  12920. onClose(event);
  12921. } else {
  12922. onOpen(event);
  12923. }
  12924. },
  12925. onShow: () => {
  12926. emit("show", toggleReason.value);
  12927. },
  12928. onHide: () => {
  12929. emit("hide", toggleReason.value);
  12930. },
  12931. onBeforeShow: () => {
  12932. emit("before-show", toggleReason.value);
  12933. },
  12934. onBeforeHide: () => {
  12935. emit("before-hide", toggleReason.value);
  12936. },
  12937. updatePopper
  12938. });
  12939. vue.watch(() => props.disabled, (disabled) => {
  12940. if (disabled && open.value) {
  12941. open.value = false;
  12942. }
  12943. });
  12944. const isFocusInsideContent = () => {
  12945. var _a, _b;
  12946. const popperContent = (_b = (_a = contentRef.value) == null ? void 0 : _a.contentRef) == null ? void 0 : _b.popperContentRef;
  12947. return popperContent && popperContent.contains(document.activeElement);
  12948. };
  12949. vue.onDeactivated(() => open.value && hide());
  12950. expose({
  12951. popperRef,
  12952. contentRef,
  12953. isFocusInsideContent,
  12954. updatePopper,
  12955. onOpen,
  12956. onClose,
  12957. hide
  12958. });
  12959. return (_ctx, _cache) => {
  12960. return vue.openBlock(), vue.createBlock(vue.unref(ElPopper), {
  12961. ref_key: "popperRef",
  12962. ref: popperRef,
  12963. role: _ctx.role
  12964. }, {
  12965. default: vue.withCtx(() => [
  12966. vue.createVNode(ElTooltipTrigger, {
  12967. disabled: _ctx.disabled,
  12968. trigger: _ctx.trigger,
  12969. "trigger-keys": _ctx.triggerKeys,
  12970. "virtual-ref": _ctx.virtualRef,
  12971. "virtual-triggering": _ctx.virtualTriggering
  12972. }, {
  12973. default: vue.withCtx(() => [
  12974. _ctx.$slots.default ? vue.renderSlot(_ctx.$slots, "default", { key: 0 }) : vue.createCommentVNode("v-if", true)
  12975. ]),
  12976. _: 3
  12977. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
  12978. vue.createVNode(ElTooltipContent, {
  12979. ref_key: "contentRef",
  12980. ref: contentRef,
  12981. "aria-label": _ctx.ariaLabel,
  12982. "boundaries-padding": _ctx.boundariesPadding,
  12983. content: _ctx.content,
  12984. disabled: _ctx.disabled,
  12985. effect: _ctx.effect,
  12986. enterable: _ctx.enterable,
  12987. "fallback-placements": _ctx.fallbackPlacements,
  12988. "hide-after": _ctx.hideAfter,
  12989. "gpu-acceleration": _ctx.gpuAcceleration,
  12990. offset: _ctx.offset,
  12991. persistent: _ctx.persistent,
  12992. "popper-class": _ctx.popperClass,
  12993. "popper-style": _ctx.popperStyle,
  12994. placement: _ctx.placement,
  12995. "popper-options": _ctx.popperOptions,
  12996. pure: _ctx.pure,
  12997. "raw-content": _ctx.rawContent,
  12998. "reference-el": _ctx.referenceEl,
  12999. "trigger-target-el": _ctx.triggerTargetEl,
  13000. "show-after": _ctx.showAfter,
  13001. strategy: _ctx.strategy,
  13002. teleported: _ctx.teleported,
  13003. transition: _ctx.transition,
  13004. "virtual-triggering": _ctx.virtualTriggering,
  13005. "z-index": _ctx.zIndex,
  13006. "append-to": _ctx.appendTo
  13007. }, {
  13008. default: vue.withCtx(() => [
  13009. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  13010. _ctx.rawContent ? (vue.openBlock(), vue.createElementBlock("span", {
  13011. key: 0,
  13012. innerHTML: _ctx.content
  13013. }, null, 8, _hoisted_1$12)) : (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$F, vue.toDisplayString(_ctx.content), 1))
  13014. ]),
  13015. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(vue.unref(ElPopperArrow), {
  13016. key: 0,
  13017. "arrow-offset": _ctx.arrowOffset
  13018. }, null, 8, ["arrow-offset"])) : vue.createCommentVNode("v-if", true)
  13019. ]),
  13020. _: 3
  13021. }, 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"])
  13022. ]),
  13023. _: 3
  13024. }, 8, ["role"]);
  13025. };
  13026. }
  13027. });
  13028. var Tooltip = /* @__PURE__ */ _export_sfc(_sfc_main$21, [["__file", "tooltip.vue"]]);
  13029. const ElTooltip = withInstall(Tooltip);
  13030. const autocompleteProps = buildProps({
  13031. valueKey: {
  13032. type: String,
  13033. default: "value"
  13034. },
  13035. modelValue: {
  13036. type: [String, Number],
  13037. default: ""
  13038. },
  13039. debounce: {
  13040. type: Number,
  13041. default: 300
  13042. },
  13043. placement: {
  13044. type: definePropType(String),
  13045. values: [
  13046. "top",
  13047. "top-start",
  13048. "top-end",
  13049. "bottom",
  13050. "bottom-start",
  13051. "bottom-end"
  13052. ],
  13053. default: "bottom-start"
  13054. },
  13055. fetchSuggestions: {
  13056. type: definePropType([Function, Array]),
  13057. default: NOOP
  13058. },
  13059. popperClass: {
  13060. type: String,
  13061. default: ""
  13062. },
  13063. triggerOnFocus: {
  13064. type: Boolean,
  13065. default: true
  13066. },
  13067. selectWhenUnmatched: {
  13068. type: Boolean,
  13069. default: false
  13070. },
  13071. hideLoading: {
  13072. type: Boolean,
  13073. default: false
  13074. },
  13075. label: {
  13076. type: String
  13077. },
  13078. teleported: useTooltipContentProps.teleported,
  13079. highlightFirstItem: {
  13080. type: Boolean,
  13081. default: false
  13082. },
  13083. fitInputWidth: {
  13084. type: Boolean,
  13085. default: false
  13086. }
  13087. });
  13088. const autocompleteEmits = {
  13089. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  13090. [INPUT_EVENT]: (value) => isString(value),
  13091. [CHANGE_EVENT]: (value) => isString(value),
  13092. focus: (evt) => evt instanceof FocusEvent,
  13093. blur: (evt) => evt instanceof FocusEvent,
  13094. clear: () => true,
  13095. select: (item) => isObject$1(item)
  13096. };
  13097. const _hoisted_1$11 = ["aria-expanded", "aria-owns"];
  13098. const _hoisted_2$E = { key: 0 };
  13099. const _hoisted_3$j = ["id", "aria-selected", "onClick"];
  13100. const COMPONENT_NAME$j = "ElAutocomplete";
  13101. const __default__$1k = vue.defineComponent({
  13102. name: COMPONENT_NAME$j,
  13103. inheritAttrs: false
  13104. });
  13105. const _sfc_main$20 = /* @__PURE__ */ vue.defineComponent({
  13106. ...__default__$1k,
  13107. props: autocompleteProps,
  13108. emits: autocompleteEmits,
  13109. setup(__props, { expose, emit }) {
  13110. const props = __props;
  13111. const attrs = useAttrs();
  13112. const rawAttrs = vue.useAttrs();
  13113. const disabled = useDisabled();
  13114. const ns = useNamespace("autocomplete");
  13115. const inputRef = vue.ref();
  13116. const regionRef = vue.ref();
  13117. const popperRef = vue.ref();
  13118. const listboxRef = vue.ref();
  13119. let readonly = false;
  13120. let ignoreFocusEvent = false;
  13121. const suggestions = vue.ref([]);
  13122. const highlightedIndex = vue.ref(-1);
  13123. const dropdownWidth = vue.ref("");
  13124. const activated = vue.ref(false);
  13125. const suggestionDisabled = vue.ref(false);
  13126. const loading = vue.ref(false);
  13127. const listboxId = vue.computed(() => ns.b(String(generateId())));
  13128. const styles = vue.computed(() => rawAttrs.style);
  13129. const suggestionVisible = vue.computed(() => {
  13130. const isValidData = suggestions.value.length > 0;
  13131. return (isValidData || loading.value) && activated.value;
  13132. });
  13133. const suggestionLoading = vue.computed(() => !props.hideLoading && loading.value);
  13134. const refInput = vue.computed(() => {
  13135. if (inputRef.value) {
  13136. return Array.from(inputRef.value.$el.querySelectorAll("input"));
  13137. }
  13138. return [];
  13139. });
  13140. const onSuggestionShow = async () => {
  13141. await vue.nextTick();
  13142. if (suggestionVisible.value) {
  13143. dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
  13144. }
  13145. };
  13146. const onShow = () => {
  13147. ignoreFocusEvent = true;
  13148. };
  13149. const onHide = () => {
  13150. ignoreFocusEvent = false;
  13151. highlightedIndex.value = -1;
  13152. };
  13153. const getData = async (queryString) => {
  13154. if (suggestionDisabled.value)
  13155. return;
  13156. const cb = (suggestionList) => {
  13157. loading.value = false;
  13158. if (suggestionDisabled.value)
  13159. return;
  13160. if (isArray(suggestionList)) {
  13161. suggestions.value = suggestionList;
  13162. highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
  13163. } else {
  13164. throwError(COMPONENT_NAME$j, "autocomplete suggestions must be an array");
  13165. }
  13166. };
  13167. loading.value = true;
  13168. if (isArray(props.fetchSuggestions)) {
  13169. cb(props.fetchSuggestions);
  13170. } else {
  13171. const result = await props.fetchSuggestions(queryString, cb);
  13172. if (isArray(result))
  13173. cb(result);
  13174. }
  13175. };
  13176. const debouncedGetData = debounce(getData, props.debounce);
  13177. const handleInput = (value) => {
  13178. const valuePresented = !!value;
  13179. emit(INPUT_EVENT, value);
  13180. emit(UPDATE_MODEL_EVENT, value);
  13181. suggestionDisabled.value = false;
  13182. activated.value || (activated.value = valuePresented);
  13183. if (!props.triggerOnFocus && !value) {
  13184. suggestionDisabled.value = true;
  13185. suggestions.value = [];
  13186. return;
  13187. }
  13188. debouncedGetData(value);
  13189. };
  13190. const handleMouseDown = (event) => {
  13191. var _a;
  13192. if (disabled.value)
  13193. return;
  13194. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  13195. activated.value = true;
  13196. }
  13197. };
  13198. const handleChange = (value) => {
  13199. emit(CHANGE_EVENT, value);
  13200. };
  13201. const handleFocus = (evt) => {
  13202. if (ignoreFocusEvent)
  13203. return;
  13204. activated.value = true;
  13205. emit("focus", evt);
  13206. if (props.triggerOnFocus && !readonly) {
  13207. debouncedGetData(String(props.modelValue));
  13208. }
  13209. };
  13210. const handleBlur = (evt) => {
  13211. if (ignoreFocusEvent)
  13212. return;
  13213. emit("blur", evt);
  13214. };
  13215. const handleClear = () => {
  13216. activated.value = false;
  13217. emit(UPDATE_MODEL_EVENT, "");
  13218. emit("clear");
  13219. };
  13220. const handleKeyEnter = async () => {
  13221. if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) {
  13222. handleSelect(suggestions.value[highlightedIndex.value]);
  13223. } else if (props.selectWhenUnmatched) {
  13224. emit("select", { value: props.modelValue });
  13225. suggestions.value = [];
  13226. highlightedIndex.value = -1;
  13227. }
  13228. };
  13229. const handleKeyEscape = (evt) => {
  13230. if (suggestionVisible.value) {
  13231. evt.preventDefault();
  13232. evt.stopPropagation();
  13233. close();
  13234. }
  13235. };
  13236. const close = () => {
  13237. activated.value = false;
  13238. };
  13239. const focus = () => {
  13240. var _a;
  13241. (_a = inputRef.value) == null ? void 0 : _a.focus();
  13242. };
  13243. const blur = () => {
  13244. var _a;
  13245. (_a = inputRef.value) == null ? void 0 : _a.blur();
  13246. };
  13247. const handleSelect = async (item) => {
  13248. emit(INPUT_EVENT, item[props.valueKey]);
  13249. emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
  13250. emit("select", item);
  13251. suggestions.value = [];
  13252. highlightedIndex.value = -1;
  13253. };
  13254. const highlight = (index) => {
  13255. if (!suggestionVisible.value || loading.value)
  13256. return;
  13257. if (index < 0) {
  13258. highlightedIndex.value = -1;
  13259. return;
  13260. }
  13261. if (index >= suggestions.value.length) {
  13262. index = suggestions.value.length - 1;
  13263. }
  13264. const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
  13265. const suggestionList = suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`);
  13266. const highlightItem = suggestionList[index];
  13267. const scrollTop = suggestion.scrollTop;
  13268. const { offsetTop, scrollHeight } = highlightItem;
  13269. if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) {
  13270. suggestion.scrollTop += scrollHeight;
  13271. }
  13272. if (offsetTop < scrollTop) {
  13273. suggestion.scrollTop -= scrollHeight;
  13274. }
  13275. highlightedIndex.value = index;
  13276. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  13277. };
  13278. onClickOutside(listboxRef, () => {
  13279. suggestionVisible.value && close();
  13280. });
  13281. vue.onMounted(() => {
  13282. inputRef.value.ref.setAttribute("role", "textbox");
  13283. inputRef.value.ref.setAttribute("aria-autocomplete", "list");
  13284. inputRef.value.ref.setAttribute("aria-controls", "id");
  13285. inputRef.value.ref.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  13286. readonly = inputRef.value.ref.hasAttribute("readonly");
  13287. });
  13288. expose({
  13289. highlightedIndex,
  13290. activated,
  13291. loading,
  13292. inputRef,
  13293. popperRef,
  13294. suggestions,
  13295. handleSelect,
  13296. handleKeyEnter,
  13297. focus,
  13298. blur,
  13299. close,
  13300. highlight
  13301. });
  13302. return (_ctx, _cache) => {
  13303. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  13304. ref_key: "popperRef",
  13305. ref: popperRef,
  13306. visible: vue.unref(suggestionVisible),
  13307. placement: _ctx.placement,
  13308. "fallback-placements": ["bottom-start", "top-start"],
  13309. "popper-class": [vue.unref(ns).e("popper"), _ctx.popperClass],
  13310. teleported: _ctx.teleported,
  13311. "gpu-acceleration": false,
  13312. pure: "",
  13313. "manual-mode": "",
  13314. effect: "light",
  13315. trigger: "click",
  13316. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  13317. persistent: "",
  13318. onBeforeShow: onSuggestionShow,
  13319. onShow,
  13320. onHide
  13321. }, {
  13322. content: vue.withCtx(() => [
  13323. vue.createElementVNode("div", {
  13324. ref_key: "regionRef",
  13325. ref: regionRef,
  13326. class: vue.normalizeClass([vue.unref(ns).b("suggestion"), vue.unref(ns).is("loading", vue.unref(suggestionLoading))]),
  13327. style: vue.normalizeStyle({
  13328. [_ctx.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
  13329. outline: "none"
  13330. }),
  13331. role: "region"
  13332. }, [
  13333. vue.createVNode(vue.unref(ElScrollbar), {
  13334. id: vue.unref(listboxId),
  13335. tag: "ul",
  13336. "wrap-class": vue.unref(ns).be("suggestion", "wrap"),
  13337. "view-class": vue.unref(ns).be("suggestion", "list"),
  13338. role: "listbox"
  13339. }, {
  13340. default: vue.withCtx(() => [
  13341. vue.unref(suggestionLoading) ? (vue.openBlock(), vue.createElementBlock("li", _hoisted_2$E, [
  13342. vue.createVNode(vue.unref(ElIcon), {
  13343. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  13344. }, {
  13345. default: vue.withCtx(() => [
  13346. vue.createVNode(vue.unref(loading_default))
  13347. ]),
  13348. _: 1
  13349. }, 8, ["class"])
  13350. ])) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(suggestions.value, (item, index) => {
  13351. return vue.openBlock(), vue.createElementBlock("li", {
  13352. id: `${vue.unref(listboxId)}-item-${index}`,
  13353. key: index,
  13354. class: vue.normalizeClass({ highlighted: highlightedIndex.value === index }),
  13355. role: "option",
  13356. "aria-selected": highlightedIndex.value === index,
  13357. onClick: ($event) => handleSelect(item)
  13358. }, [
  13359. vue.renderSlot(_ctx.$slots, "default", { item }, () => [
  13360. vue.createTextVNode(vue.toDisplayString(item[_ctx.valueKey]), 1)
  13361. ])
  13362. ], 10, _hoisted_3$j);
  13363. }), 128))
  13364. ]),
  13365. _: 3
  13366. }, 8, ["id", "wrap-class", "view-class"])
  13367. ], 6)
  13368. ]),
  13369. default: vue.withCtx(() => [
  13370. vue.createElementVNode("div", {
  13371. ref_key: "listboxRef",
  13372. ref: listboxRef,
  13373. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.$attrs.class]),
  13374. style: vue.normalizeStyle(vue.unref(styles)),
  13375. role: "combobox",
  13376. "aria-haspopup": "listbox",
  13377. "aria-expanded": vue.unref(suggestionVisible),
  13378. "aria-owns": vue.unref(listboxId)
  13379. }, [
  13380. vue.createVNode(vue.unref(ElInput), vue.mergeProps({
  13381. ref_key: "inputRef",
  13382. ref: inputRef
  13383. }, vue.unref(attrs), {
  13384. "model-value": _ctx.modelValue,
  13385. onInput: handleInput,
  13386. onChange: handleChange,
  13387. onFocus: handleFocus,
  13388. onBlur: handleBlur,
  13389. onClear: handleClear,
  13390. onKeydown: [
  13391. _cache[0] || (_cache[0] = vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value - 1), ["prevent"]), ["up"])),
  13392. _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers(($event) => highlight(highlightedIndex.value + 1), ["prevent"]), ["down"])),
  13393. vue.withKeys(handleKeyEnter, ["enter"]),
  13394. vue.withKeys(close, ["tab"]),
  13395. vue.withKeys(handleKeyEscape, ["esc"])
  13396. ],
  13397. onMousedown: handleMouseDown
  13398. }), vue.createSlots({ _: 2 }, [
  13399. _ctx.$slots.prepend ? {
  13400. name: "prepend",
  13401. fn: vue.withCtx(() => [
  13402. vue.renderSlot(_ctx.$slots, "prepend")
  13403. ])
  13404. } : void 0,
  13405. _ctx.$slots.append ? {
  13406. name: "append",
  13407. fn: vue.withCtx(() => [
  13408. vue.renderSlot(_ctx.$slots, "append")
  13409. ])
  13410. } : void 0,
  13411. _ctx.$slots.prefix ? {
  13412. name: "prefix",
  13413. fn: vue.withCtx(() => [
  13414. vue.renderSlot(_ctx.$slots, "prefix")
  13415. ])
  13416. } : void 0,
  13417. _ctx.$slots.suffix ? {
  13418. name: "suffix",
  13419. fn: vue.withCtx(() => [
  13420. vue.renderSlot(_ctx.$slots, "suffix")
  13421. ])
  13422. } : void 0
  13423. ]), 1040, ["model-value", "onKeydown"])
  13424. ], 14, _hoisted_1$11)
  13425. ]),
  13426. _: 3
  13427. }, 8, ["visible", "placement", "popper-class", "teleported", "transition"]);
  13428. };
  13429. }
  13430. });
  13431. var Autocomplete = /* @__PURE__ */ _export_sfc(_sfc_main$20, [["__file", "autocomplete.vue"]]);
  13432. const ElAutocomplete = withInstall(Autocomplete);
  13433. const avatarProps = buildProps({
  13434. size: {
  13435. type: [Number, String],
  13436. values: componentSizes,
  13437. default: "",
  13438. validator: (val) => isNumber(val)
  13439. },
  13440. shape: {
  13441. type: String,
  13442. values: ["circle", "square"],
  13443. default: "circle"
  13444. },
  13445. icon: {
  13446. type: iconPropType
  13447. },
  13448. src: {
  13449. type: String,
  13450. default: ""
  13451. },
  13452. alt: String,
  13453. srcSet: String,
  13454. fit: {
  13455. type: definePropType(String),
  13456. default: "cover"
  13457. }
  13458. });
  13459. const avatarEmits = {
  13460. error: (evt) => evt instanceof Event
  13461. };
  13462. const _hoisted_1$10 = ["src", "alt", "srcset"];
  13463. const __default__$1j = vue.defineComponent({
  13464. name: "ElAvatar"
  13465. });
  13466. const _sfc_main$1$ = /* @__PURE__ */ vue.defineComponent({
  13467. ...__default__$1j,
  13468. props: avatarProps,
  13469. emits: avatarEmits,
  13470. setup(__props, { emit }) {
  13471. const props = __props;
  13472. const ns = useNamespace("avatar");
  13473. const hasLoadError = vue.ref(false);
  13474. const avatarClass = vue.computed(() => {
  13475. const { size, icon, shape } = props;
  13476. const classList = [ns.b()];
  13477. if (isString(size))
  13478. classList.push(ns.m(size));
  13479. if (icon)
  13480. classList.push(ns.m("icon"));
  13481. if (shape)
  13482. classList.push(ns.m(shape));
  13483. return classList;
  13484. });
  13485. const sizeStyle = vue.computed(() => {
  13486. const { size } = props;
  13487. return isNumber(size) ? ns.cssVarBlock({
  13488. size: addUnit(size) || ""
  13489. }) : void 0;
  13490. });
  13491. const fitStyle = vue.computed(() => ({
  13492. objectFit: props.fit
  13493. }));
  13494. vue.watch(() => props.src, () => hasLoadError.value = false);
  13495. function handleError(e) {
  13496. hasLoadError.value = true;
  13497. emit("error", e);
  13498. }
  13499. return (_ctx, _cache) => {
  13500. return vue.openBlock(), vue.createElementBlock("span", {
  13501. class: vue.normalizeClass(vue.unref(avatarClass)),
  13502. style: vue.normalizeStyle(vue.unref(sizeStyle))
  13503. }, [
  13504. (_ctx.src || _ctx.srcSet) && !hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("img", {
  13505. key: 0,
  13506. src: _ctx.src,
  13507. alt: _ctx.alt,
  13508. srcset: _ctx.srcSet,
  13509. style: vue.normalizeStyle(vue.unref(fitStyle)),
  13510. onError: handleError
  13511. }, null, 44, _hoisted_1$10)) : _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  13512. default: vue.withCtx(() => [
  13513. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  13514. ]),
  13515. _: 1
  13516. })) : vue.renderSlot(_ctx.$slots, "default", { key: 2 })
  13517. ], 6);
  13518. };
  13519. }
  13520. });
  13521. var Avatar = /* @__PURE__ */ _export_sfc(_sfc_main$1$, [["__file", "avatar.vue"]]);
  13522. const ElAvatar = withInstall(Avatar);
  13523. const backtopProps = {
  13524. visibilityHeight: {
  13525. type: Number,
  13526. default: 200
  13527. },
  13528. target: {
  13529. type: String,
  13530. default: ""
  13531. },
  13532. right: {
  13533. type: Number,
  13534. default: 40
  13535. },
  13536. bottom: {
  13537. type: Number,
  13538. default: 40
  13539. }
  13540. };
  13541. const backtopEmits = {
  13542. click: (evt) => evt instanceof MouseEvent
  13543. };
  13544. const useBackTop = (props, emit, componentName) => {
  13545. const el = vue.shallowRef();
  13546. const container = vue.shallowRef();
  13547. const visible = vue.ref(false);
  13548. const scrollToTop = () => {
  13549. if (!el.value)
  13550. return;
  13551. const beginTime = Date.now();
  13552. const beginValue = el.value.scrollTop;
  13553. const frameFunc = () => {
  13554. if (!el.value)
  13555. return;
  13556. const progress = (Date.now() - beginTime) / 500;
  13557. if (progress < 1) {
  13558. el.value.scrollTop = beginValue * (1 - easeInOutCubic(progress));
  13559. requestAnimationFrame(frameFunc);
  13560. } else {
  13561. el.value.scrollTop = 0;
  13562. }
  13563. };
  13564. requestAnimationFrame(frameFunc);
  13565. };
  13566. const handleScroll = () => {
  13567. if (el.value)
  13568. visible.value = el.value.scrollTop >= props.visibilityHeight;
  13569. };
  13570. const handleClick = (event) => {
  13571. scrollToTop();
  13572. emit("click", event);
  13573. };
  13574. const handleScrollThrottled = useThrottleFn(handleScroll, 300, true);
  13575. useEventListener(container, "scroll", handleScrollThrottled);
  13576. vue.onMounted(() => {
  13577. var _a;
  13578. container.value = document;
  13579. el.value = document.documentElement;
  13580. if (props.target) {
  13581. el.value = (_a = document.querySelector(props.target)) != null ? _a : void 0;
  13582. if (!el.value) {
  13583. throwError(componentName, `target does not exist: ${props.target}`);
  13584. }
  13585. container.value = el.value;
  13586. }
  13587. });
  13588. return {
  13589. visible,
  13590. handleClick
  13591. };
  13592. };
  13593. const COMPONENT_NAME$i = "ElBacktop";
  13594. const __default__$1i = vue.defineComponent({
  13595. name: COMPONENT_NAME$i
  13596. });
  13597. const _sfc_main$1_ = /* @__PURE__ */ vue.defineComponent({
  13598. ...__default__$1i,
  13599. props: backtopProps,
  13600. emits: backtopEmits,
  13601. setup(__props, { emit }) {
  13602. const props = __props;
  13603. const ns = useNamespace("backtop");
  13604. const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$i);
  13605. const backTopStyle = vue.computed(() => ({
  13606. right: `${props.right}px`,
  13607. bottom: `${props.bottom}px`
  13608. }));
  13609. return (_ctx, _cache) => {
  13610. return vue.openBlock(), vue.createBlock(vue.Transition, {
  13611. name: `${vue.unref(ns).namespace.value}-fade-in`
  13612. }, {
  13613. default: vue.withCtx(() => [
  13614. vue.unref(visible) ? (vue.openBlock(), vue.createElementBlock("div", {
  13615. key: 0,
  13616. style: vue.normalizeStyle(vue.unref(backTopStyle)),
  13617. class: vue.normalizeClass(vue.unref(ns).b()),
  13618. onClick: _cache[0] || (_cache[0] = vue.withModifiers((...args) => vue.unref(handleClick) && vue.unref(handleClick)(...args), ["stop"]))
  13619. }, [
  13620. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  13621. vue.createVNode(vue.unref(ElIcon), {
  13622. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  13623. }, {
  13624. default: vue.withCtx(() => [
  13625. vue.createVNode(vue.unref(caret_top_default))
  13626. ]),
  13627. _: 1
  13628. }, 8, ["class"])
  13629. ])
  13630. ], 6)) : vue.createCommentVNode("v-if", true)
  13631. ]),
  13632. _: 3
  13633. }, 8, ["name"]);
  13634. };
  13635. }
  13636. });
  13637. var Backtop = /* @__PURE__ */ _export_sfc(_sfc_main$1_, [["__file", "backtop.vue"]]);
  13638. const ElBacktop = withInstall(Backtop);
  13639. const badgeProps = buildProps({
  13640. value: {
  13641. type: [String, Number],
  13642. default: ""
  13643. },
  13644. max: {
  13645. type: Number,
  13646. default: 99
  13647. },
  13648. isDot: Boolean,
  13649. hidden: Boolean,
  13650. type: {
  13651. type: String,
  13652. values: ["primary", "success", "warning", "info", "danger"],
  13653. default: "danger"
  13654. }
  13655. });
  13656. const _hoisted_1$$ = ["textContent"];
  13657. const __default__$1h = vue.defineComponent({
  13658. name: "ElBadge"
  13659. });
  13660. const _sfc_main$1Z = /* @__PURE__ */ vue.defineComponent({
  13661. ...__default__$1h,
  13662. props: badgeProps,
  13663. setup(__props, { expose }) {
  13664. const props = __props;
  13665. const ns = useNamespace("badge");
  13666. const content = vue.computed(() => {
  13667. if (props.isDot)
  13668. return "";
  13669. if (isNumber(props.value) && isNumber(props.max)) {
  13670. return props.max < props.value ? `${props.max}+` : `${props.value}`;
  13671. }
  13672. return `${props.value}`;
  13673. });
  13674. expose({
  13675. content
  13676. });
  13677. return (_ctx, _cache) => {
  13678. return vue.openBlock(), vue.createElementBlock("div", {
  13679. class: vue.normalizeClass(vue.unref(ns).b())
  13680. }, [
  13681. vue.renderSlot(_ctx.$slots, "default"),
  13682. vue.createVNode(vue.Transition, {
  13683. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  13684. persisted: ""
  13685. }, {
  13686. default: vue.withCtx(() => [
  13687. vue.withDirectives(vue.createElementVNode("sup", {
  13688. class: vue.normalizeClass([
  13689. vue.unref(ns).e("content"),
  13690. vue.unref(ns).em("content", _ctx.type),
  13691. vue.unref(ns).is("fixed", !!_ctx.$slots.default),
  13692. vue.unref(ns).is("dot", _ctx.isDot)
  13693. ]),
  13694. textContent: vue.toDisplayString(vue.unref(content))
  13695. }, null, 10, _hoisted_1$$), [
  13696. [vue.vShow, !_ctx.hidden && (vue.unref(content) || _ctx.isDot)]
  13697. ])
  13698. ]),
  13699. _: 1
  13700. }, 8, ["name"])
  13701. ], 2);
  13702. };
  13703. }
  13704. });
  13705. var Badge = /* @__PURE__ */ _export_sfc(_sfc_main$1Z, [["__file", "badge.vue"]]);
  13706. const ElBadge = withInstall(Badge);
  13707. const breadcrumbProps = buildProps({
  13708. separator: {
  13709. type: String,
  13710. default: "/"
  13711. },
  13712. separatorIcon: {
  13713. type: iconPropType
  13714. }
  13715. });
  13716. const __default__$1g = vue.defineComponent({
  13717. name: "ElBreadcrumb"
  13718. });
  13719. const _sfc_main$1Y = /* @__PURE__ */ vue.defineComponent({
  13720. ...__default__$1g,
  13721. props: breadcrumbProps,
  13722. setup(__props) {
  13723. const props = __props;
  13724. const ns = useNamespace("breadcrumb");
  13725. const breadcrumb = vue.ref();
  13726. vue.provide(breadcrumbKey, props);
  13727. vue.onMounted(() => {
  13728. const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
  13729. if (items.length) {
  13730. items[items.length - 1].setAttribute("aria-current", "page");
  13731. }
  13732. });
  13733. return (_ctx, _cache) => {
  13734. return vue.openBlock(), vue.createElementBlock("div", {
  13735. ref_key: "breadcrumb",
  13736. ref: breadcrumb,
  13737. class: vue.normalizeClass(vue.unref(ns).b()),
  13738. "aria-label": "Breadcrumb",
  13739. role: "navigation"
  13740. }, [
  13741. vue.renderSlot(_ctx.$slots, "default")
  13742. ], 2);
  13743. };
  13744. }
  13745. });
  13746. var Breadcrumb = /* @__PURE__ */ _export_sfc(_sfc_main$1Y, [["__file", "breadcrumb.vue"]]);
  13747. const breadcrumbItemProps = buildProps({
  13748. to: {
  13749. type: definePropType([String, Object]),
  13750. default: ""
  13751. },
  13752. replace: {
  13753. type: Boolean,
  13754. default: false
  13755. }
  13756. });
  13757. const __default__$1f = vue.defineComponent({
  13758. name: "ElBreadcrumbItem"
  13759. });
  13760. const _sfc_main$1X = /* @__PURE__ */ vue.defineComponent({
  13761. ...__default__$1f,
  13762. props: breadcrumbItemProps,
  13763. setup(__props) {
  13764. const props = __props;
  13765. const instance = vue.getCurrentInstance();
  13766. const breadcrumbContext = vue.inject(breadcrumbKey, void 0);
  13767. const ns = useNamespace("breadcrumb");
  13768. const { separator, separatorIcon } = vue.toRefs(breadcrumbContext);
  13769. const router = instance.appContext.config.globalProperties.$router;
  13770. const link = vue.ref();
  13771. const onClick = () => {
  13772. if (!props.to || !router)
  13773. return;
  13774. props.replace ? router.replace(props.to) : router.push(props.to);
  13775. };
  13776. return (_ctx, _cache) => {
  13777. return vue.openBlock(), vue.createElementBlock("span", {
  13778. class: vue.normalizeClass(vue.unref(ns).e("item"))
  13779. }, [
  13780. vue.createElementVNode("span", {
  13781. ref_key: "link",
  13782. ref: link,
  13783. class: vue.normalizeClass([vue.unref(ns).e("inner"), vue.unref(ns).is("link", !!_ctx.to)]),
  13784. role: "link",
  13785. onClick
  13786. }, [
  13787. vue.renderSlot(_ctx.$slots, "default")
  13788. ], 2),
  13789. vue.unref(separatorIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  13790. key: 0,
  13791. class: vue.normalizeClass(vue.unref(ns).e("separator"))
  13792. }, {
  13793. default: vue.withCtx(() => [
  13794. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(separatorIcon))))
  13795. ]),
  13796. _: 1
  13797. }, 8, ["class"])) : (vue.openBlock(), vue.createElementBlock("span", {
  13798. key: 1,
  13799. class: vue.normalizeClass(vue.unref(ns).e("separator")),
  13800. role: "presentation"
  13801. }, vue.toDisplayString(vue.unref(separator)), 3))
  13802. ], 2);
  13803. };
  13804. }
  13805. });
  13806. var BreadcrumbItem = /* @__PURE__ */ _export_sfc(_sfc_main$1X, [["__file", "breadcrumb-item.vue"]]);
  13807. const ElBreadcrumb = withInstall(Breadcrumb, {
  13808. BreadcrumbItem
  13809. });
  13810. const ElBreadcrumbItem = withNoopInstall(BreadcrumbItem);
  13811. const useButton = (props, emit) => {
  13812. useDeprecated({
  13813. from: "type.text",
  13814. replacement: "link",
  13815. version: "3.0.0",
  13816. scope: "props",
  13817. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  13818. }, vue.computed(() => props.type === "text"));
  13819. const buttonGroupContext = vue.inject(buttonGroupContextKey, void 0);
  13820. const globalConfig = useGlobalConfig("button");
  13821. const { form } = useFormItem();
  13822. const _size = useSize(vue.computed(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  13823. const _disabled = useDisabled();
  13824. const _ref = vue.ref();
  13825. const slots = vue.useSlots();
  13826. const _type = vue.computed(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  13827. const autoInsertSpace = vue.computed(() => {
  13828. var _a, _b, _c;
  13829. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a = globalConfig.value) == null ? void 0 : _a.autoInsertSpace) != null ? _c : false;
  13830. });
  13831. const shouldAddSpace = vue.computed(() => {
  13832. var _a;
  13833. const defaultSlot = (_a = slots.default) == null ? void 0 : _a.call(slots);
  13834. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  13835. const slot = defaultSlot[0];
  13836. if ((slot == null ? void 0 : slot.type) === vue.Text) {
  13837. const text = slot.children;
  13838. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  13839. }
  13840. }
  13841. return false;
  13842. });
  13843. const handleClick = (evt) => {
  13844. if (props.nativeType === "reset") {
  13845. form == null ? void 0 : form.resetFields();
  13846. }
  13847. emit("click", evt);
  13848. };
  13849. return {
  13850. _disabled,
  13851. _size,
  13852. _type,
  13853. _ref,
  13854. shouldAddSpace,
  13855. handleClick
  13856. };
  13857. };
  13858. const buttonTypes = [
  13859. "default",
  13860. "primary",
  13861. "success",
  13862. "warning",
  13863. "info",
  13864. "danger",
  13865. "text",
  13866. ""
  13867. ];
  13868. const buttonNativeTypes = ["button", "submit", "reset"];
  13869. const buttonProps = buildProps({
  13870. size: useSizeProp,
  13871. disabled: Boolean,
  13872. type: {
  13873. type: String,
  13874. values: buttonTypes,
  13875. default: ""
  13876. },
  13877. icon: {
  13878. type: iconPropType
  13879. },
  13880. nativeType: {
  13881. type: String,
  13882. values: buttonNativeTypes,
  13883. default: "button"
  13884. },
  13885. loading: Boolean,
  13886. loadingIcon: {
  13887. type: iconPropType,
  13888. default: () => loading_default
  13889. },
  13890. plain: Boolean,
  13891. text: Boolean,
  13892. link: Boolean,
  13893. bg: Boolean,
  13894. autofocus: Boolean,
  13895. round: Boolean,
  13896. circle: Boolean,
  13897. color: String,
  13898. dark: Boolean,
  13899. autoInsertSpace: {
  13900. type: Boolean,
  13901. default: void 0
  13902. }
  13903. });
  13904. const buttonEmits = {
  13905. click: (evt) => evt instanceof MouseEvent
  13906. };
  13907. function bound01$1(n, max) {
  13908. if (isOnePointZero$1(n)) {
  13909. n = "100%";
  13910. }
  13911. var isPercent = isPercentage$1(n);
  13912. n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
  13913. if (isPercent) {
  13914. n = parseInt(String(n * max), 10) / 100;
  13915. }
  13916. if (Math.abs(n - max) < 1e-6) {
  13917. return 1;
  13918. }
  13919. if (max === 360) {
  13920. n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
  13921. } else {
  13922. n = n % max / parseFloat(String(max));
  13923. }
  13924. return n;
  13925. }
  13926. function clamp01(val) {
  13927. return Math.min(1, Math.max(0, val));
  13928. }
  13929. function isOnePointZero$1(n) {
  13930. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  13931. }
  13932. function isPercentage$1(n) {
  13933. return typeof n === "string" && n.indexOf("%") !== -1;
  13934. }
  13935. function boundAlpha(a) {
  13936. a = parseFloat(a);
  13937. if (isNaN(a) || a < 0 || a > 1) {
  13938. a = 1;
  13939. }
  13940. return a;
  13941. }
  13942. function convertToPercentage(n) {
  13943. if (n <= 1) {
  13944. return "".concat(Number(n) * 100, "%");
  13945. }
  13946. return n;
  13947. }
  13948. function pad2(c) {
  13949. return c.length === 1 ? "0" + c : String(c);
  13950. }
  13951. function rgbToRgb(r, g, b) {
  13952. return {
  13953. r: bound01$1(r, 255) * 255,
  13954. g: bound01$1(g, 255) * 255,
  13955. b: bound01$1(b, 255) * 255
  13956. };
  13957. }
  13958. function rgbToHsl(r, g, b) {
  13959. r = bound01$1(r, 255);
  13960. g = bound01$1(g, 255);
  13961. b = bound01$1(b, 255);
  13962. var max = Math.max(r, g, b);
  13963. var min = Math.min(r, g, b);
  13964. var h = 0;
  13965. var s = 0;
  13966. var l = (max + min) / 2;
  13967. if (max === min) {
  13968. s = 0;
  13969. h = 0;
  13970. } else {
  13971. var d = max - min;
  13972. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  13973. switch (max) {
  13974. case r:
  13975. h = (g - b) / d + (g < b ? 6 : 0);
  13976. break;
  13977. case g:
  13978. h = (b - r) / d + 2;
  13979. break;
  13980. case b:
  13981. h = (r - g) / d + 4;
  13982. break;
  13983. }
  13984. h /= 6;
  13985. }
  13986. return { h, s, l };
  13987. }
  13988. function hue2rgb(p, q, t) {
  13989. if (t < 0) {
  13990. t += 1;
  13991. }
  13992. if (t > 1) {
  13993. t -= 1;
  13994. }
  13995. if (t < 1 / 6) {
  13996. return p + (q - p) * (6 * t);
  13997. }
  13998. if (t < 1 / 2) {
  13999. return q;
  14000. }
  14001. if (t < 2 / 3) {
  14002. return p + (q - p) * (2 / 3 - t) * 6;
  14003. }
  14004. return p;
  14005. }
  14006. function hslToRgb(h, s, l) {
  14007. var r;
  14008. var g;
  14009. var b;
  14010. h = bound01$1(h, 360);
  14011. s = bound01$1(s, 100);
  14012. l = bound01$1(l, 100);
  14013. if (s === 0) {
  14014. g = l;
  14015. b = l;
  14016. r = l;
  14017. } else {
  14018. var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
  14019. var p = 2 * l - q;
  14020. r = hue2rgb(p, q, h + 1 / 3);
  14021. g = hue2rgb(p, q, h);
  14022. b = hue2rgb(p, q, h - 1 / 3);
  14023. }
  14024. return { r: r * 255, g: g * 255, b: b * 255 };
  14025. }
  14026. function rgbToHsv(r, g, b) {
  14027. r = bound01$1(r, 255);
  14028. g = bound01$1(g, 255);
  14029. b = bound01$1(b, 255);
  14030. var max = Math.max(r, g, b);
  14031. var min = Math.min(r, g, b);
  14032. var h = 0;
  14033. var v = max;
  14034. var d = max - min;
  14035. var s = max === 0 ? 0 : d / max;
  14036. if (max === min) {
  14037. h = 0;
  14038. } else {
  14039. switch (max) {
  14040. case r:
  14041. h = (g - b) / d + (g < b ? 6 : 0);
  14042. break;
  14043. case g:
  14044. h = (b - r) / d + 2;
  14045. break;
  14046. case b:
  14047. h = (r - g) / d + 4;
  14048. break;
  14049. }
  14050. h /= 6;
  14051. }
  14052. return { h, s, v };
  14053. }
  14054. function hsvToRgb(h, s, v) {
  14055. h = bound01$1(h, 360) * 6;
  14056. s = bound01$1(s, 100);
  14057. v = bound01$1(v, 100);
  14058. var i = Math.floor(h);
  14059. var f = h - i;
  14060. var p = v * (1 - s);
  14061. var q = v * (1 - f * s);
  14062. var t = v * (1 - (1 - f) * s);
  14063. var mod = i % 6;
  14064. var r = [v, q, p, p, t, v][mod];
  14065. var g = [t, v, v, q, p, p][mod];
  14066. var b = [p, p, t, v, v, q][mod];
  14067. return { r: r * 255, g: g * 255, b: b * 255 };
  14068. }
  14069. function rgbToHex(r, g, b, allow3Char) {
  14070. var hex = [
  14071. pad2(Math.round(r).toString(16)),
  14072. pad2(Math.round(g).toString(16)),
  14073. pad2(Math.round(b).toString(16))
  14074. ];
  14075. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  14076. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  14077. }
  14078. return hex.join("");
  14079. }
  14080. function rgbaToHex(r, g, b, a, allow4Char) {
  14081. var hex = [
  14082. pad2(Math.round(r).toString(16)),
  14083. pad2(Math.round(g).toString(16)),
  14084. pad2(Math.round(b).toString(16)),
  14085. pad2(convertDecimalToHex(a))
  14086. ];
  14087. 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))) {
  14088. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  14089. }
  14090. return hex.join("");
  14091. }
  14092. function convertDecimalToHex(d) {
  14093. return Math.round(parseFloat(d) * 255).toString(16);
  14094. }
  14095. function convertHexToDecimal(h) {
  14096. return parseIntFromHex(h) / 255;
  14097. }
  14098. function parseIntFromHex(val) {
  14099. return parseInt(val, 16);
  14100. }
  14101. function numberInputToObject(color) {
  14102. return {
  14103. r: color >> 16,
  14104. g: (color & 65280) >> 8,
  14105. b: color & 255
  14106. };
  14107. }
  14108. var names = {
  14109. aliceblue: "#f0f8ff",
  14110. antiquewhite: "#faebd7",
  14111. aqua: "#00ffff",
  14112. aquamarine: "#7fffd4",
  14113. azure: "#f0ffff",
  14114. beige: "#f5f5dc",
  14115. bisque: "#ffe4c4",
  14116. black: "#000000",
  14117. blanchedalmond: "#ffebcd",
  14118. blue: "#0000ff",
  14119. blueviolet: "#8a2be2",
  14120. brown: "#a52a2a",
  14121. burlywood: "#deb887",
  14122. cadetblue: "#5f9ea0",
  14123. chartreuse: "#7fff00",
  14124. chocolate: "#d2691e",
  14125. coral: "#ff7f50",
  14126. cornflowerblue: "#6495ed",
  14127. cornsilk: "#fff8dc",
  14128. crimson: "#dc143c",
  14129. cyan: "#00ffff",
  14130. darkblue: "#00008b",
  14131. darkcyan: "#008b8b",
  14132. darkgoldenrod: "#b8860b",
  14133. darkgray: "#a9a9a9",
  14134. darkgreen: "#006400",
  14135. darkgrey: "#a9a9a9",
  14136. darkkhaki: "#bdb76b",
  14137. darkmagenta: "#8b008b",
  14138. darkolivegreen: "#556b2f",
  14139. darkorange: "#ff8c00",
  14140. darkorchid: "#9932cc",
  14141. darkred: "#8b0000",
  14142. darksalmon: "#e9967a",
  14143. darkseagreen: "#8fbc8f",
  14144. darkslateblue: "#483d8b",
  14145. darkslategray: "#2f4f4f",
  14146. darkslategrey: "#2f4f4f",
  14147. darkturquoise: "#00ced1",
  14148. darkviolet: "#9400d3",
  14149. deeppink: "#ff1493",
  14150. deepskyblue: "#00bfff",
  14151. dimgray: "#696969",
  14152. dimgrey: "#696969",
  14153. dodgerblue: "#1e90ff",
  14154. firebrick: "#b22222",
  14155. floralwhite: "#fffaf0",
  14156. forestgreen: "#228b22",
  14157. fuchsia: "#ff00ff",
  14158. gainsboro: "#dcdcdc",
  14159. ghostwhite: "#f8f8ff",
  14160. goldenrod: "#daa520",
  14161. gold: "#ffd700",
  14162. gray: "#808080",
  14163. green: "#008000",
  14164. greenyellow: "#adff2f",
  14165. grey: "#808080",
  14166. honeydew: "#f0fff0",
  14167. hotpink: "#ff69b4",
  14168. indianred: "#cd5c5c",
  14169. indigo: "#4b0082",
  14170. ivory: "#fffff0",
  14171. khaki: "#f0e68c",
  14172. lavenderblush: "#fff0f5",
  14173. lavender: "#e6e6fa",
  14174. lawngreen: "#7cfc00",
  14175. lemonchiffon: "#fffacd",
  14176. lightblue: "#add8e6",
  14177. lightcoral: "#f08080",
  14178. lightcyan: "#e0ffff",
  14179. lightgoldenrodyellow: "#fafad2",
  14180. lightgray: "#d3d3d3",
  14181. lightgreen: "#90ee90",
  14182. lightgrey: "#d3d3d3",
  14183. lightpink: "#ffb6c1",
  14184. lightsalmon: "#ffa07a",
  14185. lightseagreen: "#20b2aa",
  14186. lightskyblue: "#87cefa",
  14187. lightslategray: "#778899",
  14188. lightslategrey: "#778899",
  14189. lightsteelblue: "#b0c4de",
  14190. lightyellow: "#ffffe0",
  14191. lime: "#00ff00",
  14192. limegreen: "#32cd32",
  14193. linen: "#faf0e6",
  14194. magenta: "#ff00ff",
  14195. maroon: "#800000",
  14196. mediumaquamarine: "#66cdaa",
  14197. mediumblue: "#0000cd",
  14198. mediumorchid: "#ba55d3",
  14199. mediumpurple: "#9370db",
  14200. mediumseagreen: "#3cb371",
  14201. mediumslateblue: "#7b68ee",
  14202. mediumspringgreen: "#00fa9a",
  14203. mediumturquoise: "#48d1cc",
  14204. mediumvioletred: "#c71585",
  14205. midnightblue: "#191970",
  14206. mintcream: "#f5fffa",
  14207. mistyrose: "#ffe4e1",
  14208. moccasin: "#ffe4b5",
  14209. navajowhite: "#ffdead",
  14210. navy: "#000080",
  14211. oldlace: "#fdf5e6",
  14212. olive: "#808000",
  14213. olivedrab: "#6b8e23",
  14214. orange: "#ffa500",
  14215. orangered: "#ff4500",
  14216. orchid: "#da70d6",
  14217. palegoldenrod: "#eee8aa",
  14218. palegreen: "#98fb98",
  14219. paleturquoise: "#afeeee",
  14220. palevioletred: "#db7093",
  14221. papayawhip: "#ffefd5",
  14222. peachpuff: "#ffdab9",
  14223. peru: "#cd853f",
  14224. pink: "#ffc0cb",
  14225. plum: "#dda0dd",
  14226. powderblue: "#b0e0e6",
  14227. purple: "#800080",
  14228. rebeccapurple: "#663399",
  14229. red: "#ff0000",
  14230. rosybrown: "#bc8f8f",
  14231. royalblue: "#4169e1",
  14232. saddlebrown: "#8b4513",
  14233. salmon: "#fa8072",
  14234. sandybrown: "#f4a460",
  14235. seagreen: "#2e8b57",
  14236. seashell: "#fff5ee",
  14237. sienna: "#a0522d",
  14238. silver: "#c0c0c0",
  14239. skyblue: "#87ceeb",
  14240. slateblue: "#6a5acd",
  14241. slategray: "#708090",
  14242. slategrey: "#708090",
  14243. snow: "#fffafa",
  14244. springgreen: "#00ff7f",
  14245. steelblue: "#4682b4",
  14246. tan: "#d2b48c",
  14247. teal: "#008080",
  14248. thistle: "#d8bfd8",
  14249. tomato: "#ff6347",
  14250. turquoise: "#40e0d0",
  14251. violet: "#ee82ee",
  14252. wheat: "#f5deb3",
  14253. white: "#ffffff",
  14254. whitesmoke: "#f5f5f5",
  14255. yellow: "#ffff00",
  14256. yellowgreen: "#9acd32"
  14257. };
  14258. function inputToRGB(color) {
  14259. var rgb = { r: 0, g: 0, b: 0 };
  14260. var a = 1;
  14261. var s = null;
  14262. var v = null;
  14263. var l = null;
  14264. var ok = false;
  14265. var format = false;
  14266. if (typeof color === "string") {
  14267. color = stringInputToObject(color);
  14268. }
  14269. if (typeof color === "object") {
  14270. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  14271. rgb = rgbToRgb(color.r, color.g, color.b);
  14272. ok = true;
  14273. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  14274. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  14275. s = convertToPercentage(color.s);
  14276. v = convertToPercentage(color.v);
  14277. rgb = hsvToRgb(color.h, s, v);
  14278. ok = true;
  14279. format = "hsv";
  14280. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  14281. s = convertToPercentage(color.s);
  14282. l = convertToPercentage(color.l);
  14283. rgb = hslToRgb(color.h, s, l);
  14284. ok = true;
  14285. format = "hsl";
  14286. }
  14287. if (Object.prototype.hasOwnProperty.call(color, "a")) {
  14288. a = color.a;
  14289. }
  14290. }
  14291. a = boundAlpha(a);
  14292. return {
  14293. ok,
  14294. format: color.format || format,
  14295. r: Math.min(255, Math.max(rgb.r, 0)),
  14296. g: Math.min(255, Math.max(rgb.g, 0)),
  14297. b: Math.min(255, Math.max(rgb.b, 0)),
  14298. a
  14299. };
  14300. }
  14301. var CSS_INTEGER = "[-\\+]?\\d+%?";
  14302. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  14303. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  14304. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  14305. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  14306. var matchers = {
  14307. CSS_UNIT: new RegExp(CSS_UNIT),
  14308. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  14309. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  14310. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  14311. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  14312. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  14313. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  14314. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  14315. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  14316. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  14317. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  14318. };
  14319. function stringInputToObject(color) {
  14320. color = color.trim().toLowerCase();
  14321. if (color.length === 0) {
  14322. return false;
  14323. }
  14324. var named = false;
  14325. if (names[color]) {
  14326. color = names[color];
  14327. named = true;
  14328. } else if (color === "transparent") {
  14329. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  14330. }
  14331. var match = matchers.rgb.exec(color);
  14332. if (match) {
  14333. return { r: match[1], g: match[2], b: match[3] };
  14334. }
  14335. match = matchers.rgba.exec(color);
  14336. if (match) {
  14337. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  14338. }
  14339. match = matchers.hsl.exec(color);
  14340. if (match) {
  14341. return { h: match[1], s: match[2], l: match[3] };
  14342. }
  14343. match = matchers.hsla.exec(color);
  14344. if (match) {
  14345. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  14346. }
  14347. match = matchers.hsv.exec(color);
  14348. if (match) {
  14349. return { h: match[1], s: match[2], v: match[3] };
  14350. }
  14351. match = matchers.hsva.exec(color);
  14352. if (match) {
  14353. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  14354. }
  14355. match = matchers.hex8.exec(color);
  14356. if (match) {
  14357. return {
  14358. r: parseIntFromHex(match[1]),
  14359. g: parseIntFromHex(match[2]),
  14360. b: parseIntFromHex(match[3]),
  14361. a: convertHexToDecimal(match[4]),
  14362. format: named ? "name" : "hex8"
  14363. };
  14364. }
  14365. match = matchers.hex6.exec(color);
  14366. if (match) {
  14367. return {
  14368. r: parseIntFromHex(match[1]),
  14369. g: parseIntFromHex(match[2]),
  14370. b: parseIntFromHex(match[3]),
  14371. format: named ? "name" : "hex"
  14372. };
  14373. }
  14374. match = matchers.hex4.exec(color);
  14375. if (match) {
  14376. return {
  14377. r: parseIntFromHex(match[1] + match[1]),
  14378. g: parseIntFromHex(match[2] + match[2]),
  14379. b: parseIntFromHex(match[3] + match[3]),
  14380. a: convertHexToDecimal(match[4] + match[4]),
  14381. format: named ? "name" : "hex8"
  14382. };
  14383. }
  14384. match = matchers.hex3.exec(color);
  14385. if (match) {
  14386. return {
  14387. r: parseIntFromHex(match[1] + match[1]),
  14388. g: parseIntFromHex(match[2] + match[2]),
  14389. b: parseIntFromHex(match[3] + match[3]),
  14390. format: named ? "name" : "hex"
  14391. };
  14392. }
  14393. return false;
  14394. }
  14395. function isValidCSSUnit(color) {
  14396. return Boolean(matchers.CSS_UNIT.exec(String(color)));
  14397. }
  14398. var TinyColor = function() {
  14399. function TinyColor2(color, opts) {
  14400. if (color === void 0) {
  14401. color = "";
  14402. }
  14403. if (opts === void 0) {
  14404. opts = {};
  14405. }
  14406. var _a;
  14407. if (color instanceof TinyColor2) {
  14408. return color;
  14409. }
  14410. if (typeof color === "number") {
  14411. color = numberInputToObject(color);
  14412. }
  14413. this.originalInput = color;
  14414. var rgb = inputToRGB(color);
  14415. this.originalInput = color;
  14416. this.r = rgb.r;
  14417. this.g = rgb.g;
  14418. this.b = rgb.b;
  14419. this.a = rgb.a;
  14420. this.roundA = Math.round(100 * this.a) / 100;
  14421. this.format = (_a = opts.format) !== null && _a !== void 0 ? _a : rgb.format;
  14422. this.gradientType = opts.gradientType;
  14423. if (this.r < 1) {
  14424. this.r = Math.round(this.r);
  14425. }
  14426. if (this.g < 1) {
  14427. this.g = Math.round(this.g);
  14428. }
  14429. if (this.b < 1) {
  14430. this.b = Math.round(this.b);
  14431. }
  14432. this.isValid = rgb.ok;
  14433. }
  14434. TinyColor2.prototype.isDark = function() {
  14435. return this.getBrightness() < 128;
  14436. };
  14437. TinyColor2.prototype.isLight = function() {
  14438. return !this.isDark();
  14439. };
  14440. TinyColor2.prototype.getBrightness = function() {
  14441. var rgb = this.toRgb();
  14442. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  14443. };
  14444. TinyColor2.prototype.getLuminance = function() {
  14445. var rgb = this.toRgb();
  14446. var R;
  14447. var G;
  14448. var B;
  14449. var RsRGB = rgb.r / 255;
  14450. var GsRGB = rgb.g / 255;
  14451. var BsRGB = rgb.b / 255;
  14452. if (RsRGB <= 0.03928) {
  14453. R = RsRGB / 12.92;
  14454. } else {
  14455. R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  14456. }
  14457. if (GsRGB <= 0.03928) {
  14458. G = GsRGB / 12.92;
  14459. } else {
  14460. G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  14461. }
  14462. if (BsRGB <= 0.03928) {
  14463. B = BsRGB / 12.92;
  14464. } else {
  14465. B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  14466. }
  14467. return 0.2126 * R + 0.7152 * G + 0.0722 * B;
  14468. };
  14469. TinyColor2.prototype.getAlpha = function() {
  14470. return this.a;
  14471. };
  14472. TinyColor2.prototype.setAlpha = function(alpha) {
  14473. this.a = boundAlpha(alpha);
  14474. this.roundA = Math.round(100 * this.a) / 100;
  14475. return this;
  14476. };
  14477. TinyColor2.prototype.toHsv = function() {
  14478. var hsv = rgbToHsv(this.r, this.g, this.b);
  14479. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  14480. };
  14481. TinyColor2.prototype.toHsvString = function() {
  14482. var hsv = rgbToHsv(this.r, this.g, this.b);
  14483. var h = Math.round(hsv.h * 360);
  14484. var s = Math.round(hsv.s * 100);
  14485. var v = Math.round(hsv.v * 100);
  14486. return this.a === 1 ? "hsv(".concat(h, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
  14487. };
  14488. TinyColor2.prototype.toHsl = function() {
  14489. var hsl = rgbToHsl(this.r, this.g, this.b);
  14490. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  14491. };
  14492. TinyColor2.prototype.toHslString = function() {
  14493. var hsl = rgbToHsl(this.r, this.g, this.b);
  14494. var h = Math.round(hsl.h * 360);
  14495. var s = Math.round(hsl.s * 100);
  14496. var l = Math.round(hsl.l * 100);
  14497. return this.a === 1 ? "hsl(".concat(h, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
  14498. };
  14499. TinyColor2.prototype.toHex = function(allow3Char) {
  14500. if (allow3Char === void 0) {
  14501. allow3Char = false;
  14502. }
  14503. return rgbToHex(this.r, this.g, this.b, allow3Char);
  14504. };
  14505. TinyColor2.prototype.toHexString = function(allow3Char) {
  14506. if (allow3Char === void 0) {
  14507. allow3Char = false;
  14508. }
  14509. return "#" + this.toHex(allow3Char);
  14510. };
  14511. TinyColor2.prototype.toHex8 = function(allow4Char) {
  14512. if (allow4Char === void 0) {
  14513. allow4Char = false;
  14514. }
  14515. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  14516. };
  14517. TinyColor2.prototype.toHex8String = function(allow4Char) {
  14518. if (allow4Char === void 0) {
  14519. allow4Char = false;
  14520. }
  14521. return "#" + this.toHex8(allow4Char);
  14522. };
  14523. TinyColor2.prototype.toRgb = function() {
  14524. return {
  14525. r: Math.round(this.r),
  14526. g: Math.round(this.g),
  14527. b: Math.round(this.b),
  14528. a: this.a
  14529. };
  14530. };
  14531. TinyColor2.prototype.toRgbString = function() {
  14532. var r = Math.round(this.r);
  14533. var g = Math.round(this.g);
  14534. var b = Math.round(this.b);
  14535. return this.a === 1 ? "rgb(".concat(r, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
  14536. };
  14537. TinyColor2.prototype.toPercentageRgb = function() {
  14538. var fmt = function(x) {
  14539. return "".concat(Math.round(bound01$1(x, 255) * 100), "%");
  14540. };
  14541. return {
  14542. r: fmt(this.r),
  14543. g: fmt(this.g),
  14544. b: fmt(this.b),
  14545. a: this.a
  14546. };
  14547. };
  14548. TinyColor2.prototype.toPercentageRgbString = function() {
  14549. var rnd = function(x) {
  14550. return Math.round(bound01$1(x, 255) * 100);
  14551. };
  14552. 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, ")");
  14553. };
  14554. TinyColor2.prototype.toName = function() {
  14555. if (this.a === 0) {
  14556. return "transparent";
  14557. }
  14558. if (this.a < 1) {
  14559. return false;
  14560. }
  14561. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  14562. for (var _i = 0, _a = Object.entries(names); _i < _a.length; _i++) {
  14563. var _b = _a[_i], key = _b[0], value = _b[1];
  14564. if (hex === value) {
  14565. return key;
  14566. }
  14567. }
  14568. return false;
  14569. };
  14570. TinyColor2.prototype.toString = function(format) {
  14571. var formatSet = Boolean(format);
  14572. format = format !== null && format !== void 0 ? format : this.format;
  14573. var formattedString = false;
  14574. var hasAlpha = this.a < 1 && this.a >= 0;
  14575. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  14576. if (needsAlphaFormat) {
  14577. if (format === "name" && this.a === 0) {
  14578. return this.toName();
  14579. }
  14580. return this.toRgbString();
  14581. }
  14582. if (format === "rgb") {
  14583. formattedString = this.toRgbString();
  14584. }
  14585. if (format === "prgb") {
  14586. formattedString = this.toPercentageRgbString();
  14587. }
  14588. if (format === "hex" || format === "hex6") {
  14589. formattedString = this.toHexString();
  14590. }
  14591. if (format === "hex3") {
  14592. formattedString = this.toHexString(true);
  14593. }
  14594. if (format === "hex4") {
  14595. formattedString = this.toHex8String(true);
  14596. }
  14597. if (format === "hex8") {
  14598. formattedString = this.toHex8String();
  14599. }
  14600. if (format === "name") {
  14601. formattedString = this.toName();
  14602. }
  14603. if (format === "hsl") {
  14604. formattedString = this.toHslString();
  14605. }
  14606. if (format === "hsv") {
  14607. formattedString = this.toHsvString();
  14608. }
  14609. return formattedString || this.toHexString();
  14610. };
  14611. TinyColor2.prototype.toNumber = function() {
  14612. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  14613. };
  14614. TinyColor2.prototype.clone = function() {
  14615. return new TinyColor2(this.toString());
  14616. };
  14617. TinyColor2.prototype.lighten = function(amount) {
  14618. if (amount === void 0) {
  14619. amount = 10;
  14620. }
  14621. var hsl = this.toHsl();
  14622. hsl.l += amount / 100;
  14623. hsl.l = clamp01(hsl.l);
  14624. return new TinyColor2(hsl);
  14625. };
  14626. TinyColor2.prototype.brighten = function(amount) {
  14627. if (amount === void 0) {
  14628. amount = 10;
  14629. }
  14630. var rgb = this.toRgb();
  14631. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  14632. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  14633. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  14634. return new TinyColor2(rgb);
  14635. };
  14636. TinyColor2.prototype.darken = function(amount) {
  14637. if (amount === void 0) {
  14638. amount = 10;
  14639. }
  14640. var hsl = this.toHsl();
  14641. hsl.l -= amount / 100;
  14642. hsl.l = clamp01(hsl.l);
  14643. return new TinyColor2(hsl);
  14644. };
  14645. TinyColor2.prototype.tint = function(amount) {
  14646. if (amount === void 0) {
  14647. amount = 10;
  14648. }
  14649. return this.mix("white", amount);
  14650. };
  14651. TinyColor2.prototype.shade = function(amount) {
  14652. if (amount === void 0) {
  14653. amount = 10;
  14654. }
  14655. return this.mix("black", amount);
  14656. };
  14657. TinyColor2.prototype.desaturate = function(amount) {
  14658. if (amount === void 0) {
  14659. amount = 10;
  14660. }
  14661. var hsl = this.toHsl();
  14662. hsl.s -= amount / 100;
  14663. hsl.s = clamp01(hsl.s);
  14664. return new TinyColor2(hsl);
  14665. };
  14666. TinyColor2.prototype.saturate = function(amount) {
  14667. if (amount === void 0) {
  14668. amount = 10;
  14669. }
  14670. var hsl = this.toHsl();
  14671. hsl.s += amount / 100;
  14672. hsl.s = clamp01(hsl.s);
  14673. return new TinyColor2(hsl);
  14674. };
  14675. TinyColor2.prototype.greyscale = function() {
  14676. return this.desaturate(100);
  14677. };
  14678. TinyColor2.prototype.spin = function(amount) {
  14679. var hsl = this.toHsl();
  14680. var hue = (hsl.h + amount) % 360;
  14681. hsl.h = hue < 0 ? 360 + hue : hue;
  14682. return new TinyColor2(hsl);
  14683. };
  14684. TinyColor2.prototype.mix = function(color, amount) {
  14685. if (amount === void 0) {
  14686. amount = 50;
  14687. }
  14688. var rgb1 = this.toRgb();
  14689. var rgb2 = new TinyColor2(color).toRgb();
  14690. var p = amount / 100;
  14691. var rgba = {
  14692. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  14693. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  14694. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  14695. a: (rgb2.a - rgb1.a) * p + rgb1.a
  14696. };
  14697. return new TinyColor2(rgba);
  14698. };
  14699. TinyColor2.prototype.analogous = function(results, slices) {
  14700. if (results === void 0) {
  14701. results = 6;
  14702. }
  14703. if (slices === void 0) {
  14704. slices = 30;
  14705. }
  14706. var hsl = this.toHsl();
  14707. var part = 360 / slices;
  14708. var ret = [this];
  14709. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  14710. hsl.h = (hsl.h + part) % 360;
  14711. ret.push(new TinyColor2(hsl));
  14712. }
  14713. return ret;
  14714. };
  14715. TinyColor2.prototype.complement = function() {
  14716. var hsl = this.toHsl();
  14717. hsl.h = (hsl.h + 180) % 360;
  14718. return new TinyColor2(hsl);
  14719. };
  14720. TinyColor2.prototype.monochromatic = function(results) {
  14721. if (results === void 0) {
  14722. results = 6;
  14723. }
  14724. var hsv = this.toHsv();
  14725. var h = hsv.h;
  14726. var s = hsv.s;
  14727. var v = hsv.v;
  14728. var res = [];
  14729. var modification = 1 / results;
  14730. while (results--) {
  14731. res.push(new TinyColor2({ h, s, v }));
  14732. v = (v + modification) % 1;
  14733. }
  14734. return res;
  14735. };
  14736. TinyColor2.prototype.splitcomplement = function() {
  14737. var hsl = this.toHsl();
  14738. var h = hsl.h;
  14739. return [
  14740. this,
  14741. new TinyColor2({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }),
  14742. new TinyColor2({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })
  14743. ];
  14744. };
  14745. TinyColor2.prototype.onBackground = function(background) {
  14746. var fg = this.toRgb();
  14747. var bg = new TinyColor2(background).toRgb();
  14748. return new TinyColor2({
  14749. r: bg.r + (fg.r - bg.r) * fg.a,
  14750. g: bg.g + (fg.g - bg.g) * fg.a,
  14751. b: bg.b + (fg.b - bg.b) * fg.a
  14752. });
  14753. };
  14754. TinyColor2.prototype.triad = function() {
  14755. return this.polyad(3);
  14756. };
  14757. TinyColor2.prototype.tetrad = function() {
  14758. return this.polyad(4);
  14759. };
  14760. TinyColor2.prototype.polyad = function(n) {
  14761. var hsl = this.toHsl();
  14762. var h = hsl.h;
  14763. var result = [this];
  14764. var increment = 360 / n;
  14765. for (var i = 1; i < n; i++) {
  14766. result.push(new TinyColor2({ h: (h + i * increment) % 360, s: hsl.s, l: hsl.l }));
  14767. }
  14768. return result;
  14769. };
  14770. TinyColor2.prototype.equals = function(color) {
  14771. return this.toRgbString() === new TinyColor2(color).toRgbString();
  14772. };
  14773. return TinyColor2;
  14774. }();
  14775. function darken(color, amount = 20) {
  14776. return color.mix("#141414", amount).toString();
  14777. }
  14778. function useButtonCustomStyle(props) {
  14779. const _disabled = useDisabled();
  14780. const ns = useNamespace("button");
  14781. return vue.computed(() => {
  14782. let styles = {};
  14783. const buttonColor = props.color;
  14784. if (buttonColor) {
  14785. const color = new TinyColor(buttonColor);
  14786. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  14787. if (props.plain) {
  14788. styles = ns.cssVarBlock({
  14789. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  14790. "text-color": buttonColor,
  14791. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  14792. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  14793. "hover-bg-color": buttonColor,
  14794. "hover-border-color": buttonColor,
  14795. "active-bg-color": activeBgColor,
  14796. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  14797. "active-border-color": activeBgColor
  14798. });
  14799. if (_disabled.value) {
  14800. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  14801. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  14802. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  14803. }
  14804. } else {
  14805. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  14806. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  14807. styles = ns.cssVarBlock({
  14808. "bg-color": buttonColor,
  14809. "text-color": textColor,
  14810. "border-color": buttonColor,
  14811. "hover-bg-color": hoverBgColor,
  14812. "hover-text-color": textColor,
  14813. "hover-border-color": hoverBgColor,
  14814. "active-bg-color": activeBgColor,
  14815. "active-border-color": activeBgColor
  14816. });
  14817. if (_disabled.value) {
  14818. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  14819. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  14820. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  14821. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  14822. }
  14823. }
  14824. }
  14825. return styles;
  14826. });
  14827. }
  14828. const _hoisted_1$_ = ["aria-disabled", "disabled", "autofocus", "type"];
  14829. const __default__$1e = vue.defineComponent({
  14830. name: "ElButton"
  14831. });
  14832. const _sfc_main$1W = /* @__PURE__ */ vue.defineComponent({
  14833. ...__default__$1e,
  14834. props: buttonProps,
  14835. emits: buttonEmits,
  14836. setup(__props, { expose, emit }) {
  14837. const props = __props;
  14838. const buttonStyle = useButtonCustomStyle(props);
  14839. const ns = useNamespace("button");
  14840. const { _ref, _size, _type, _disabled, shouldAddSpace, handleClick } = useButton(props, emit);
  14841. expose({
  14842. ref: _ref,
  14843. size: _size,
  14844. type: _type,
  14845. disabled: _disabled,
  14846. shouldAddSpace
  14847. });
  14848. return (_ctx, _cache) => {
  14849. return vue.openBlock(), vue.createElementBlock("button", {
  14850. ref_key: "_ref",
  14851. ref: _ref,
  14852. class: vue.normalizeClass([
  14853. vue.unref(ns).b(),
  14854. vue.unref(ns).m(vue.unref(_type)),
  14855. vue.unref(ns).m(vue.unref(_size)),
  14856. vue.unref(ns).is("disabled", vue.unref(_disabled)),
  14857. vue.unref(ns).is("loading", _ctx.loading),
  14858. vue.unref(ns).is("plain", _ctx.plain),
  14859. vue.unref(ns).is("round", _ctx.round),
  14860. vue.unref(ns).is("circle", _ctx.circle),
  14861. vue.unref(ns).is("text", _ctx.text),
  14862. vue.unref(ns).is("link", _ctx.link),
  14863. vue.unref(ns).is("has-bg", _ctx.bg)
  14864. ]),
  14865. "aria-disabled": vue.unref(_disabled) || _ctx.loading,
  14866. disabled: vue.unref(_disabled) || _ctx.loading,
  14867. autofocus: _ctx.autofocus,
  14868. type: _ctx.nativeType,
  14869. style: vue.normalizeStyle(vue.unref(buttonStyle)),
  14870. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleClick) && vue.unref(handleClick)(...args))
  14871. }, [
  14872. _ctx.loading ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  14873. _ctx.$slots.loading ? vue.renderSlot(_ctx.$slots, "loading", { key: 0 }) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  14874. key: 1,
  14875. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  14876. }, {
  14877. default: vue.withCtx(() => [
  14878. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.loadingIcon)))
  14879. ]),
  14880. _: 1
  14881. }, 8, ["class"]))
  14882. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  14883. default: vue.withCtx(() => [
  14884. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon), { key: 0 })) : vue.renderSlot(_ctx.$slots, "icon", { key: 1 })
  14885. ]),
  14886. _: 3
  14887. })) : vue.createCommentVNode("v-if", true),
  14888. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  14889. key: 2,
  14890. class: vue.normalizeClass({ [vue.unref(ns).em("text", "expand")]: vue.unref(shouldAddSpace) })
  14891. }, [
  14892. vue.renderSlot(_ctx.$slots, "default")
  14893. ], 2)) : vue.createCommentVNode("v-if", true)
  14894. ], 14, _hoisted_1$_);
  14895. };
  14896. }
  14897. });
  14898. var Button = /* @__PURE__ */ _export_sfc(_sfc_main$1W, [["__file", "button.vue"]]);
  14899. const buttonGroupProps = {
  14900. size: buttonProps.size,
  14901. type: buttonProps.type
  14902. };
  14903. const __default__$1d = vue.defineComponent({
  14904. name: "ElButtonGroup"
  14905. });
  14906. const _sfc_main$1V = /* @__PURE__ */ vue.defineComponent({
  14907. ...__default__$1d,
  14908. props: buttonGroupProps,
  14909. setup(__props) {
  14910. const props = __props;
  14911. vue.provide(buttonGroupContextKey, vue.reactive({
  14912. size: vue.toRef(props, "size"),
  14913. type: vue.toRef(props, "type")
  14914. }));
  14915. const ns = useNamespace("button");
  14916. return (_ctx, _cache) => {
  14917. return vue.openBlock(), vue.createElementBlock("div", {
  14918. class: vue.normalizeClass(`${vue.unref(ns).b("group")}`)
  14919. }, [
  14920. vue.renderSlot(_ctx.$slots, "default")
  14921. ], 2);
  14922. };
  14923. }
  14924. });
  14925. var ButtonGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1V, [["__file", "button-group.vue"]]);
  14926. const ElButton = withInstall(Button, {
  14927. ButtonGroup
  14928. });
  14929. const ElButtonGroup$1 = withNoopInstall(ButtonGroup);
  14930. var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
  14931. var dayjs_min = {exports: {}};
  14932. (function(module, exports) {
  14933. !function(t, e) {
  14934. module.exports = e() ;
  14935. }(commonjsGlobal, function() {
  14936. var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", f = "month", h = "quarter", c = "year", d = "date", $ = "Invalid Date", l = /^(\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("_") }, m = function(t2, e2, n2) {
  14937. var r2 = String(t2);
  14938. return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
  14939. }, g = { s: m, z: function(t2) {
  14940. var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
  14941. return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
  14942. }, m: function t2(e2, n2) {
  14943. if (e2.date() < n2.date())
  14944. return -t2(n2, e2);
  14945. var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, f), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), f);
  14946. return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
  14947. }, a: function(t2) {
  14948. return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
  14949. }, p: function(t2) {
  14950. return { M: f, y: c, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: h }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
  14951. }, u: function(t2) {
  14952. return t2 === void 0;
  14953. } }, v = "en", D = {};
  14954. D[v] = M;
  14955. var p = function(t2) {
  14956. return t2 instanceof _;
  14957. }, S = function t2(e2, n2, r2) {
  14958. var i2;
  14959. if (!e2)
  14960. return v;
  14961. if (typeof e2 == "string") {
  14962. var s2 = e2.toLowerCase();
  14963. D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
  14964. var u2 = e2.split("-");
  14965. if (!i2 && u2.length > 1)
  14966. return t2(u2[0]);
  14967. } else {
  14968. var a2 = e2.name;
  14969. D[a2] = e2, i2 = a2;
  14970. }
  14971. return !r2 && i2 && (v = i2), i2 || !r2 && v;
  14972. }, w = function(t2, e2) {
  14973. if (p(t2))
  14974. return t2.clone();
  14975. var n2 = typeof e2 == "object" ? e2 : {};
  14976. return n2.date = t2, n2.args = arguments, new _(n2);
  14977. }, O = g;
  14978. O.l = S, O.i = p, O.w = function(t2, e2) {
  14979. return w(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
  14980. };
  14981. var _ = function() {
  14982. function M2(t2) {
  14983. this.$L = S(t2.locale, null, true), this.parse(t2);
  14984. }
  14985. var m2 = M2.prototype;
  14986. return m2.parse = function(t2) {
  14987. this.$d = function(t3) {
  14988. var e2 = t3.date, n2 = t3.utc;
  14989. if (e2 === null)
  14990. return new Date(NaN);
  14991. if (O.u(e2))
  14992. return new Date();
  14993. if (e2 instanceof Date)
  14994. return new Date(e2);
  14995. if (typeof e2 == "string" && !/Z$/i.test(e2)) {
  14996. var r2 = e2.match(l);
  14997. if (r2) {
  14998. var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
  14999. 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);
  15000. }
  15001. }
  15002. return new Date(e2);
  15003. }(t2), this.$x = t2.x || {}, this.init();
  15004. }, m2.init = function() {
  15005. var t2 = this.$d;
  15006. 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();
  15007. }, m2.$utils = function() {
  15008. return O;
  15009. }, m2.isValid = function() {
  15010. return !(this.$d.toString() === $);
  15011. }, m2.isSame = function(t2, e2) {
  15012. var n2 = w(t2);
  15013. return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
  15014. }, m2.isAfter = function(t2, e2) {
  15015. return w(t2) < this.startOf(e2);
  15016. }, m2.isBefore = function(t2, e2) {
  15017. return this.endOf(e2) < w(t2);
  15018. }, m2.$g = function(t2, e2, n2) {
  15019. return O.u(t2) ? this[e2] : this.set(n2, t2);
  15020. }, m2.unix = function() {
  15021. return Math.floor(this.valueOf() / 1e3);
  15022. }, m2.valueOf = function() {
  15023. return this.$d.getTime();
  15024. }, m2.startOf = function(t2, e2) {
  15025. var n2 = this, r2 = !!O.u(e2) || e2, h2 = O.p(t2), $2 = function(t3, e3) {
  15026. var i2 = O.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
  15027. return r2 ? i2 : i2.endOf(a);
  15028. }, l2 = function(t3, e3) {
  15029. return O.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
  15030. }, y2 = this.$W, M3 = this.$M, m3 = this.$D, g2 = "set" + (this.$u ? "UTC" : "");
  15031. switch (h2) {
  15032. case c:
  15033. return r2 ? $2(1, 0) : $2(31, 11);
  15034. case f:
  15035. return r2 ? $2(1, M3) : $2(0, M3 + 1);
  15036. case o:
  15037. var v2 = this.$locale().weekStart || 0, D2 = (y2 < v2 ? y2 + 7 : y2) - v2;
  15038. return $2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
  15039. case a:
  15040. case d:
  15041. return l2(g2 + "Hours", 0);
  15042. case u:
  15043. return l2(g2 + "Minutes", 1);
  15044. case s:
  15045. return l2(g2 + "Seconds", 2);
  15046. case i:
  15047. return l2(g2 + "Milliseconds", 3);
  15048. default:
  15049. return this.clone();
  15050. }
  15051. }, m2.endOf = function(t2) {
  15052. return this.startOf(t2, false);
  15053. }, m2.$set = function(t2, e2) {
  15054. var n2, o2 = O.p(t2), h2 = "set" + (this.$u ? "UTC" : ""), $2 = (n2 = {}, n2[a] = h2 + "Date", n2[d] = h2 + "Date", n2[f] = h2 + "Month", n2[c] = h2 + "FullYear", n2[u] = h2 + "Hours", n2[s] = h2 + "Minutes", n2[i] = h2 + "Seconds", n2[r] = h2 + "Milliseconds", n2)[o2], l2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
  15055. if (o2 === f || o2 === c) {
  15056. var y2 = this.clone().set(d, 1);
  15057. y2.$d[$2](l2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
  15058. } else
  15059. $2 && this.$d[$2](l2);
  15060. return this.init(), this;
  15061. }, m2.set = function(t2, e2) {
  15062. return this.clone().$set(t2, e2);
  15063. }, m2.get = function(t2) {
  15064. return this[O.p(t2)]();
  15065. }, m2.add = function(r2, h2) {
  15066. var d2, $2 = this;
  15067. r2 = Number(r2);
  15068. var l2 = O.p(h2), y2 = function(t2) {
  15069. var e2 = w($2);
  15070. return O.w(e2.date(e2.date() + Math.round(t2 * r2)), $2);
  15071. };
  15072. if (l2 === f)
  15073. return this.set(f, this.$M + r2);
  15074. if (l2 === c)
  15075. return this.set(c, this.$y + r2);
  15076. if (l2 === a)
  15077. return y2(1);
  15078. if (l2 === o)
  15079. return y2(7);
  15080. var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[l2] || 1, m3 = this.$d.getTime() + r2 * M3;
  15081. return O.w(m3, this);
  15082. }, m2.subtract = function(t2, e2) {
  15083. return this.add(-1 * t2, e2);
  15084. }, m2.format = function(t2) {
  15085. var e2 = this, n2 = this.$locale();
  15086. if (!this.isValid())
  15087. return n2.invalidDate || $;
  15088. var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = O.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, f2 = n2.months, h2 = function(t3, n3, i3, s3) {
  15089. return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
  15090. }, c2 = function(t3) {
  15091. return O.s(s2 % 12 || 12, t3, "0");
  15092. }, d2 = n2.meridiem || function(t3, e3, n3) {
  15093. var r3 = t3 < 12 ? "AM" : "PM";
  15094. return n3 ? r3.toLowerCase() : r3;
  15095. }, l2 = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a2 + 1, MM: O.s(a2 + 1, 2, "0"), MMM: h2(n2.monthsShort, a2, f2, 3), MMMM: h2(f2, a2), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: h2(n2.weekdaysMin, this.$W, o2, 2), ddd: h2(n2.weekdaysShort, this.$W, o2, 3), dddd: o2[this.$W], H: String(s2), HH: O.s(s2, 2, "0"), h: c2(1), hh: c2(2), a: d2(s2, u2, true), A: d2(s2, u2, false), m: String(u2), mm: O.s(u2, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: i2 };
  15096. return r2.replace(y, function(t3, e3) {
  15097. return e3 || l2[t3] || i2.replace(":", "");
  15098. });
  15099. }, m2.utcOffset = function() {
  15100. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  15101. }, m2.diff = function(r2, d2, $2) {
  15102. var l2, y2 = O.p(d2), M3 = w(r2), m3 = (M3.utcOffset() - this.utcOffset()) * e, g2 = this - M3, v2 = O.m(this, M3);
  15103. return v2 = (l2 = {}, l2[c] = v2 / 12, l2[f] = v2, l2[h] = v2 / 3, l2[o] = (g2 - m3) / 6048e5, l2[a] = (g2 - m3) / 864e5, l2[u] = g2 / n, l2[s] = g2 / e, l2[i] = g2 / t, l2)[y2] || g2, $2 ? v2 : O.a(v2);
  15104. }, m2.daysInMonth = function() {
  15105. return this.endOf(f).$D;
  15106. }, m2.$locale = function() {
  15107. return D[this.$L];
  15108. }, m2.locale = function(t2, e2) {
  15109. if (!t2)
  15110. return this.$L;
  15111. var n2 = this.clone(), r2 = S(t2, e2, true);
  15112. return r2 && (n2.$L = r2), n2;
  15113. }, m2.clone = function() {
  15114. return O.w(this.$d, this);
  15115. }, m2.toDate = function() {
  15116. return new Date(this.valueOf());
  15117. }, m2.toJSON = function() {
  15118. return this.isValid() ? this.toISOString() : null;
  15119. }, m2.toISOString = function() {
  15120. return this.$d.toISOString();
  15121. }, m2.toString = function() {
  15122. return this.$d.toUTCString();
  15123. }, M2;
  15124. }(), T = _.prototype;
  15125. return w.prototype = T, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function(t2) {
  15126. T[t2[1]] = function(e2) {
  15127. return this.$g(e2, t2[0], t2[1]);
  15128. };
  15129. }), w.extend = function(t2, e2) {
  15130. return t2.$i || (t2(e2, _, w), t2.$i = true), w;
  15131. }, w.locale = S, w.isDayjs = p, w.unix = function(t2) {
  15132. return w(1e3 * t2);
  15133. }, w.en = D[v], w.Ls = D, w.p = {}, w;
  15134. });
  15135. })(dayjs_min);
  15136. var dayjs = dayjs_min.exports;
  15137. var customParseFormat$1 = {exports: {}};
  15138. (function(module, exports) {
  15139. !function(e, t) {
  15140. module.exports = t() ;
  15141. }(commonjsGlobal, function() {
  15142. 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|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d\d/, r = /\d\d?/, i = /\d*[^-_:/,()\s\d]+/, o = {}, s = function(e2) {
  15143. return (e2 = +e2) + (e2 > 68 ? 1900 : 2e3);
  15144. };
  15145. var a = function(e2) {
  15146. return function(t2) {
  15147. this[e2] = +t2;
  15148. };
  15149. }, f = [/[+-]\d\d:?(\d\d)?|Z/, function(e2) {
  15150. (this.zone || (this.zone = {})).offset = function(e3) {
  15151. if (!e3)
  15152. return 0;
  15153. if (e3 === "Z")
  15154. return 0;
  15155. var t2 = e3.match(/([+-]|\d\d)/g), n2 = 60 * t2[1] + (+t2[2] || 0);
  15156. return n2 === 0 ? 0 : t2[0] === "+" ? -n2 : n2;
  15157. }(e2);
  15158. }], h = function(e2) {
  15159. var t2 = o[e2];
  15160. return t2 && (t2.indexOf ? t2 : t2.s.concat(t2.f));
  15161. }, u = function(e2, t2) {
  15162. var n2, r2 = o.meridiem;
  15163. if (r2) {
  15164. for (var i2 = 1; i2 <= 24; i2 += 1)
  15165. if (e2.indexOf(r2(i2, 0, t2)) > -1) {
  15166. n2 = i2 > 12;
  15167. break;
  15168. }
  15169. } else
  15170. n2 = e2 === (t2 ? "pm" : "PM");
  15171. return n2;
  15172. }, d = { A: [i, function(e2) {
  15173. this.afternoon = u(e2, false);
  15174. }], a: [i, function(e2) {
  15175. this.afternoon = u(e2, true);
  15176. }], S: [/\d/, function(e2) {
  15177. this.milliseconds = 100 * +e2;
  15178. }], SS: [n, function(e2) {
  15179. this.milliseconds = 10 * +e2;
  15180. }], SSS: [/\d{3}/, function(e2) {
  15181. this.milliseconds = +e2;
  15182. }], s: [r, a("seconds")], ss: [r, a("seconds")], m: [r, a("minutes")], mm: [r, a("minutes")], H: [r, a("hours")], h: [r, a("hours")], HH: [r, a("hours")], hh: [r, a("hours")], D: [r, a("day")], DD: [n, a("day")], Do: [i, function(e2) {
  15183. var t2 = o.ordinal, n2 = e2.match(/\d+/);
  15184. if (this.day = n2[0], t2)
  15185. for (var r2 = 1; r2 <= 31; r2 += 1)
  15186. t2(r2).replace(/\[|\]/g, "") === e2 && (this.day = r2);
  15187. }], M: [r, a("month")], MM: [n, a("month")], MMM: [i, function(e2) {
  15188. var t2 = h("months"), n2 = (h("monthsShort") || t2.map(function(e3) {
  15189. return e3.slice(0, 3);
  15190. })).indexOf(e2) + 1;
  15191. if (n2 < 1)
  15192. throw new Error();
  15193. this.month = n2 % 12 || n2;
  15194. }], MMMM: [i, function(e2) {
  15195. var t2 = h("months").indexOf(e2) + 1;
  15196. if (t2 < 1)
  15197. throw new Error();
  15198. this.month = t2 % 12 || t2;
  15199. }], Y: [/[+-]?\d+/, a("year")], YY: [n, function(e2) {
  15200. this.year = s(e2);
  15201. }], YYYY: [/\d{4}/, a("year")], Z: f, ZZ: f };
  15202. function c(n2) {
  15203. var r2, i2;
  15204. r2 = n2, i2 = o && o.formats;
  15205. for (var s2 = (n2 = r2.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, function(t2, n3, r3) {
  15206. var o2 = r3 && r3.toUpperCase();
  15207. return n3 || i2[r3] || e[r3] || i2[o2].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(e2, t3, n4) {
  15208. return t3 || n4.slice(1);
  15209. });
  15210. })).match(t), a2 = s2.length, f2 = 0; f2 < a2; f2 += 1) {
  15211. var h2 = s2[f2], u2 = d[h2], c2 = u2 && u2[0], l = u2 && u2[1];
  15212. s2[f2] = l ? { regex: c2, parser: l } : h2.replace(/^\[|\]$/g, "");
  15213. }
  15214. return function(e2) {
  15215. for (var t2 = {}, n3 = 0, r3 = 0; n3 < a2; n3 += 1) {
  15216. var i3 = s2[n3];
  15217. if (typeof i3 == "string")
  15218. r3 += i3.length;
  15219. else {
  15220. var o2 = i3.regex, f3 = i3.parser, h3 = e2.slice(r3), u3 = o2.exec(h3)[0];
  15221. f3.call(t2, u3), e2 = e2.replace(u3, "");
  15222. }
  15223. }
  15224. return function(e3) {
  15225. var t3 = e3.afternoon;
  15226. if (t3 !== void 0) {
  15227. var n4 = e3.hours;
  15228. t3 ? n4 < 12 && (e3.hours += 12) : n4 === 12 && (e3.hours = 0), delete e3.afternoon;
  15229. }
  15230. }(t2), t2;
  15231. };
  15232. }
  15233. return function(e2, t2, n2) {
  15234. n2.p.customParseFormat = true, e2 && e2.parseTwoDigitYear && (s = e2.parseTwoDigitYear);
  15235. var r2 = t2.prototype, i2 = r2.parse;
  15236. r2.parse = function(e3) {
  15237. var t3 = e3.date, r3 = e3.utc, s2 = e3.args;
  15238. this.$u = r3;
  15239. var a2 = s2[1];
  15240. if (typeof a2 == "string") {
  15241. var f2 = s2[2] === true, h2 = s2[3] === true, u2 = f2 || h2, d2 = s2[2];
  15242. h2 && (d2 = s2[2]), o = this.$locale(), !f2 && d2 && (o = n2.Ls[d2]), this.$d = function(e4, t4, n3) {
  15243. try {
  15244. if (["x", "X"].indexOf(t4) > -1)
  15245. return new Date((t4 === "X" ? 1e3 : 1) * e4);
  15246. var r4 = c(t4)(e4), i3 = r4.year, o2 = r4.month, s3 = r4.day, a3 = r4.hours, f3 = r4.minutes, h3 = r4.seconds, u3 = r4.milliseconds, d3 = r4.zone, l2 = new Date(), m2 = s3 || (i3 || o2 ? 1 : l2.getDate()), M2 = i3 || l2.getFullYear(), Y = 0;
  15247. i3 && !o2 || (Y = o2 > 0 ? o2 - 1 : l2.getMonth());
  15248. var p = a3 || 0, v = f3 || 0, D = h3 || 0, g = u3 || 0;
  15249. return d3 ? new Date(Date.UTC(M2, Y, m2, p, v, D, g + 60 * d3.offset * 1e3)) : n3 ? new Date(Date.UTC(M2, Y, m2, p, v, D, g)) : new Date(M2, Y, m2, p, v, D, g);
  15250. } catch (e5) {
  15251. return new Date("");
  15252. }
  15253. }(t3, a2, r3), this.init(), d2 && d2 !== true && (this.$L = this.locale(d2).$L), u2 && t3 != this.format(a2) && (this.$d = new Date("")), o = {};
  15254. } else if (a2 instanceof Array)
  15255. for (var l = a2.length, m = 1; m <= l; m += 1) {
  15256. s2[1] = a2[m - 1];
  15257. var M = n2.apply(this, s2);
  15258. if (M.isValid()) {
  15259. this.$d = M.$d, this.$L = M.$L, this.init();
  15260. break;
  15261. }
  15262. m === l && (this.$d = new Date(""));
  15263. }
  15264. else
  15265. i2.call(this, e3);
  15266. };
  15267. };
  15268. });
  15269. })(customParseFormat$1);
  15270. var customParseFormat = customParseFormat$1.exports;
  15271. const timeUnits = ["hours", "minutes", "seconds"];
  15272. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  15273. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  15274. const DEFAULT_FORMATS_DATEPICKER = {
  15275. date: DEFAULT_FORMATS_DATE,
  15276. dates: DEFAULT_FORMATS_DATE,
  15277. week: "gggg[w]ww",
  15278. year: "YYYY",
  15279. month: "YYYY-MM",
  15280. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  15281. monthrange: "YYYY-MM",
  15282. daterange: DEFAULT_FORMATS_DATE,
  15283. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  15284. };
  15285. const buildTimeList = (value, bound) => {
  15286. return [
  15287. value > 0 ? value - 1 : void 0,
  15288. value,
  15289. value < bound ? value + 1 : void 0
  15290. ];
  15291. };
  15292. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  15293. const extractDateFormat = (format) => {
  15294. return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  15295. };
  15296. const extractTimeFormat = (format) => {
  15297. return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  15298. };
  15299. const dateEquals = function(a, b) {
  15300. const aIsDate = isDate(a);
  15301. const bIsDate = isDate(b);
  15302. if (aIsDate && bIsDate) {
  15303. return a.getTime() === b.getTime();
  15304. }
  15305. if (!aIsDate && !bIsDate) {
  15306. return a === b;
  15307. }
  15308. return false;
  15309. };
  15310. const valueEquals = function(a, b) {
  15311. const aIsArray = isArray(a);
  15312. const bIsArray = isArray(b);
  15313. if (aIsArray && bIsArray) {
  15314. if (a.length !== b.length) {
  15315. return false;
  15316. }
  15317. return a.every((item, index) => dateEquals(item, b[index]));
  15318. }
  15319. if (!aIsArray && !bIsArray) {
  15320. return dateEquals(a, b);
  15321. }
  15322. return false;
  15323. };
  15324. const parseDate = function(date, format, lang) {
  15325. const day = isEmpty(format) || format === "x" ? dayjs(date).locale(lang) : dayjs(date, format).locale(lang);
  15326. return day.isValid() ? day : void 0;
  15327. };
  15328. const formatter = function(date, format, lang) {
  15329. if (isEmpty(format))
  15330. return date;
  15331. if (format === "x")
  15332. return +date;
  15333. return dayjs(date).locale(lang).format(format);
  15334. };
  15335. const makeList = (total, method) => {
  15336. var _a;
  15337. const arr = [];
  15338. const disabledArr = method == null ? void 0 : method();
  15339. for (let i = 0; i < total; i++) {
  15340. arr.push((_a = disabledArr == null ? void 0 : disabledArr.includes(i)) != null ? _a : false);
  15341. }
  15342. return arr;
  15343. };
  15344. const disabledTimeListsProps = buildProps({
  15345. disabledHours: {
  15346. type: definePropType(Function)
  15347. },
  15348. disabledMinutes: {
  15349. type: definePropType(Function)
  15350. },
  15351. disabledSeconds: {
  15352. type: definePropType(Function)
  15353. }
  15354. });
  15355. const timePanelSharedProps = buildProps({
  15356. visible: Boolean,
  15357. actualVisible: {
  15358. type: Boolean,
  15359. default: void 0
  15360. },
  15361. format: {
  15362. type: String,
  15363. default: ""
  15364. }
  15365. });
  15366. const timePickerDefaultProps = buildProps({
  15367. id: {
  15368. type: definePropType([Array, String])
  15369. },
  15370. name: {
  15371. type: definePropType([Array, String]),
  15372. default: ""
  15373. },
  15374. popperClass: {
  15375. type: String,
  15376. default: ""
  15377. },
  15378. format: String,
  15379. valueFormat: String,
  15380. type: {
  15381. type: String,
  15382. default: ""
  15383. },
  15384. clearable: {
  15385. type: Boolean,
  15386. default: true
  15387. },
  15388. clearIcon: {
  15389. type: definePropType([String, Object]),
  15390. default: circle_close_default
  15391. },
  15392. editable: {
  15393. type: Boolean,
  15394. default: true
  15395. },
  15396. prefixIcon: {
  15397. type: definePropType([String, Object]),
  15398. default: ""
  15399. },
  15400. size: useSizeProp,
  15401. readonly: {
  15402. type: Boolean,
  15403. default: false
  15404. },
  15405. disabled: {
  15406. type: Boolean,
  15407. default: false
  15408. },
  15409. placeholder: {
  15410. type: String,
  15411. default: ""
  15412. },
  15413. popperOptions: {
  15414. type: definePropType(Object),
  15415. default: () => ({})
  15416. },
  15417. modelValue: {
  15418. type: definePropType([Date, Array, String, Number]),
  15419. default: ""
  15420. },
  15421. rangeSeparator: {
  15422. type: String,
  15423. default: "-"
  15424. },
  15425. startPlaceholder: String,
  15426. endPlaceholder: String,
  15427. defaultValue: {
  15428. type: definePropType([Date, Array])
  15429. },
  15430. defaultTime: {
  15431. type: definePropType([Date, Array])
  15432. },
  15433. isRange: {
  15434. type: Boolean,
  15435. default: false
  15436. },
  15437. ...disabledTimeListsProps,
  15438. disabledDate: {
  15439. type: Function
  15440. },
  15441. cellClassName: {
  15442. type: Function
  15443. },
  15444. shortcuts: {
  15445. type: Array,
  15446. default: () => []
  15447. },
  15448. arrowControl: {
  15449. type: Boolean,
  15450. default: false
  15451. },
  15452. label: {
  15453. type: String,
  15454. default: void 0
  15455. },
  15456. tabindex: {
  15457. type: definePropType([String, Number]),
  15458. default: 0
  15459. },
  15460. validateEvent: {
  15461. type: Boolean,
  15462. default: true
  15463. },
  15464. unlinkPanels: Boolean
  15465. });
  15466. const _hoisted_1$Z = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  15467. const _hoisted_2$D = ["id", "name", "placeholder", "value", "disabled", "readonly"];
  15468. const __default__$1c = vue.defineComponent({
  15469. name: "Picker"
  15470. });
  15471. const _sfc_main$1U = /* @__PURE__ */ vue.defineComponent({
  15472. ...__default__$1c,
  15473. props: timePickerDefaultProps,
  15474. emits: [
  15475. "update:modelValue",
  15476. "change",
  15477. "focus",
  15478. "blur",
  15479. "calendar-change",
  15480. "panel-change",
  15481. "visible-change",
  15482. "keydown"
  15483. ],
  15484. setup(__props, { expose, emit }) {
  15485. const props = __props;
  15486. const { lang } = useLocale();
  15487. const nsDate = useNamespace("date");
  15488. const nsInput = useNamespace("input");
  15489. const nsRange = useNamespace("range");
  15490. const { form, formItem } = useFormItem();
  15491. const elPopperOptions = vue.inject("ElPopperOptions", {});
  15492. const refPopper = vue.ref();
  15493. const inputRef = vue.ref();
  15494. const pickerVisible = vue.ref(false);
  15495. const pickerActualVisible = vue.ref(false);
  15496. const valueOnOpen = vue.ref(null);
  15497. let hasJustTabExitedInput = false;
  15498. let ignoreFocusEvent = false;
  15499. vue.watch(pickerVisible, (val) => {
  15500. if (!val) {
  15501. userInput.value = null;
  15502. vue.nextTick(() => {
  15503. emitChange(props.modelValue);
  15504. });
  15505. } else {
  15506. vue.nextTick(() => {
  15507. if (val) {
  15508. valueOnOpen.value = props.modelValue;
  15509. }
  15510. });
  15511. }
  15512. });
  15513. const emitChange = (val, isClear) => {
  15514. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  15515. emit("change", val);
  15516. props.validateEvent && (formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn()));
  15517. }
  15518. };
  15519. const emitInput = (input) => {
  15520. if (!valueEquals(props.modelValue, input)) {
  15521. let formatted;
  15522. if (isArray(input)) {
  15523. formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
  15524. } else if (input) {
  15525. formatted = formatter(input, props.valueFormat, lang.value);
  15526. }
  15527. emit("update:modelValue", input ? formatted : input, lang.value);
  15528. }
  15529. };
  15530. const emitKeydown = (e) => {
  15531. emit("keydown", e);
  15532. };
  15533. const refInput = vue.computed(() => {
  15534. if (inputRef.value) {
  15535. const _r = isRangeInput.value ? inputRef.value : inputRef.value.$el;
  15536. return Array.from(_r.querySelectorAll("input"));
  15537. }
  15538. return [];
  15539. });
  15540. const setSelectionRange = (start, end, pos) => {
  15541. const _inputs = refInput.value;
  15542. if (!_inputs.length)
  15543. return;
  15544. if (!pos || pos === "min") {
  15545. _inputs[0].setSelectionRange(start, end);
  15546. _inputs[0].focus();
  15547. } else if (pos === "max") {
  15548. _inputs[1].setSelectionRange(start, end);
  15549. _inputs[1].focus();
  15550. }
  15551. };
  15552. const focusOnInputBox = () => {
  15553. focus(true, true);
  15554. vue.nextTick(() => {
  15555. ignoreFocusEvent = false;
  15556. });
  15557. };
  15558. const onPick = (date = "", visible = false) => {
  15559. if (!visible) {
  15560. ignoreFocusEvent = true;
  15561. }
  15562. pickerVisible.value = visible;
  15563. let result;
  15564. if (isArray(date)) {
  15565. result = date.map((_) => _.toDate());
  15566. } else {
  15567. result = date ? date.toDate() : date;
  15568. }
  15569. userInput.value = null;
  15570. emitInput(result);
  15571. };
  15572. const onBeforeShow = () => {
  15573. pickerActualVisible.value = true;
  15574. };
  15575. const onShow = () => {
  15576. emit("visible-change", true);
  15577. };
  15578. const onKeydownPopperContent = (event) => {
  15579. if ((event == null ? void 0 : event.key) === EVENT_CODE.esc) {
  15580. focus(true, true);
  15581. }
  15582. };
  15583. const onHide = () => {
  15584. pickerActualVisible.value = false;
  15585. pickerVisible.value = false;
  15586. ignoreFocusEvent = false;
  15587. emit("visible-change", false);
  15588. };
  15589. const handleOpen = () => {
  15590. pickerVisible.value = true;
  15591. };
  15592. const handleClose = () => {
  15593. pickerVisible.value = false;
  15594. };
  15595. const focus = (focusStartInput = true, isIgnoreFocusEvent = false) => {
  15596. ignoreFocusEvent = isIgnoreFocusEvent;
  15597. const [leftInput, rightInput] = vue.unref(refInput);
  15598. let input = leftInput;
  15599. if (!focusStartInput && isRangeInput.value) {
  15600. input = rightInput;
  15601. }
  15602. if (input) {
  15603. input.focus();
  15604. }
  15605. };
  15606. const handleFocusInput = (e) => {
  15607. if (props.readonly || pickerDisabled.value || pickerVisible.value || ignoreFocusEvent) {
  15608. return;
  15609. }
  15610. pickerVisible.value = true;
  15611. emit("focus", e);
  15612. };
  15613. let currentHandleBlurDeferCallback = void 0;
  15614. const handleBlurInput = (e) => {
  15615. const handleBlurDefer = async () => {
  15616. setTimeout(() => {
  15617. var _a;
  15618. if (currentHandleBlurDeferCallback === handleBlurDefer) {
  15619. if (!(((_a = refPopper.value) == null ? void 0 : _a.isFocusInsideContent()) && !hasJustTabExitedInput) && refInput.value.filter((input) => {
  15620. return input.contains(document.activeElement);
  15621. }).length === 0) {
  15622. handleChange();
  15623. pickerVisible.value = false;
  15624. emit("blur", e);
  15625. props.validateEvent && (formItem == null ? void 0 : formItem.validate("blur").catch((err) => debugWarn()));
  15626. }
  15627. hasJustTabExitedInput = false;
  15628. }
  15629. }, 0);
  15630. };
  15631. currentHandleBlurDeferCallback = handleBlurDefer;
  15632. handleBlurDefer();
  15633. };
  15634. const pickerDisabled = vue.computed(() => {
  15635. return props.disabled || (form == null ? void 0 : form.disabled);
  15636. });
  15637. const parsedValue = vue.computed(() => {
  15638. let dayOrDays;
  15639. if (valueIsEmpty.value) {
  15640. if (pickerOptions.value.getDefaultValue) {
  15641. dayOrDays = pickerOptions.value.getDefaultValue();
  15642. }
  15643. } else {
  15644. if (isArray(props.modelValue)) {
  15645. dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
  15646. } else {
  15647. dayOrDays = parseDate(props.modelValue, props.valueFormat, lang.value);
  15648. }
  15649. }
  15650. if (pickerOptions.value.getRangeAvailableTime) {
  15651. const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
  15652. if (!isEqual$1(availableResult, dayOrDays)) {
  15653. dayOrDays = availableResult;
  15654. emitInput(isArray(dayOrDays) ? dayOrDays.map((_) => _.toDate()) : dayOrDays.toDate());
  15655. }
  15656. }
  15657. if (isArray(dayOrDays) && dayOrDays.some((day) => !day)) {
  15658. dayOrDays = [];
  15659. }
  15660. return dayOrDays;
  15661. });
  15662. const displayValue = vue.computed(() => {
  15663. if (!pickerOptions.value.panelReady)
  15664. return "";
  15665. const formattedValue = formatDayjsToString(parsedValue.value);
  15666. if (isArray(userInput.value)) {
  15667. return [
  15668. userInput.value[0] || formattedValue && formattedValue[0] || "",
  15669. userInput.value[1] || formattedValue && formattedValue[1] || ""
  15670. ];
  15671. } else if (userInput.value !== null) {
  15672. return userInput.value;
  15673. }
  15674. if (!isTimePicker.value && valueIsEmpty.value)
  15675. return "";
  15676. if (!pickerVisible.value && valueIsEmpty.value)
  15677. return "";
  15678. if (formattedValue) {
  15679. return isDatesPicker.value ? formattedValue.join(", ") : formattedValue;
  15680. }
  15681. return "";
  15682. });
  15683. const isTimeLikePicker = vue.computed(() => props.type.includes("time"));
  15684. const isTimePicker = vue.computed(() => props.type.startsWith("time"));
  15685. const isDatesPicker = vue.computed(() => props.type === "dates");
  15686. const triggerIcon = vue.computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default));
  15687. const showClose = vue.ref(false);
  15688. const onClearIconClick = (event) => {
  15689. if (props.readonly || pickerDisabled.value)
  15690. return;
  15691. if (showClose.value) {
  15692. event.stopPropagation();
  15693. focusOnInputBox();
  15694. emitInput(null);
  15695. emitChange(null, true);
  15696. showClose.value = false;
  15697. pickerVisible.value = false;
  15698. pickerOptions.value.handleClear && pickerOptions.value.handleClear();
  15699. }
  15700. };
  15701. const valueIsEmpty = vue.computed(() => {
  15702. const { modelValue } = props;
  15703. return !modelValue || isArray(modelValue) && !modelValue.filter(Boolean).length;
  15704. });
  15705. const onMouseDownInput = async (event) => {
  15706. var _a;
  15707. if (props.readonly || pickerDisabled.value)
  15708. return;
  15709. if (((_a = event.target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  15710. pickerVisible.value = true;
  15711. }
  15712. };
  15713. const onMouseEnter = () => {
  15714. if (props.readonly || pickerDisabled.value)
  15715. return;
  15716. if (!valueIsEmpty.value && props.clearable) {
  15717. showClose.value = true;
  15718. }
  15719. };
  15720. const onMouseLeave = () => {
  15721. showClose.value = false;
  15722. };
  15723. const onTouchStartInput = (event) => {
  15724. var _a;
  15725. if (props.readonly || pickerDisabled.value)
  15726. return;
  15727. if (((_a = event.touches[0].target) == null ? void 0 : _a.tagName) !== "INPUT" || refInput.value.includes(document.activeElement)) {
  15728. pickerVisible.value = true;
  15729. }
  15730. };
  15731. const isRangeInput = vue.computed(() => {
  15732. return props.type.includes("range");
  15733. });
  15734. const pickerSize = useSize();
  15735. const popperEl = vue.computed(() => {
  15736. var _a, _b;
  15737. return (_b = (_a = vue.unref(refPopper)) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  15738. });
  15739. const actualInputRef = vue.computed(() => {
  15740. var _a;
  15741. if (vue.unref(isRangeInput)) {
  15742. return vue.unref(inputRef);
  15743. }
  15744. return (_a = vue.unref(inputRef)) == null ? void 0 : _a.$el;
  15745. });
  15746. onClickOutside(actualInputRef, (e) => {
  15747. const unrefedPopperEl = vue.unref(popperEl);
  15748. const inputEl = vue.unref(actualInputRef);
  15749. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || e.composedPath().includes(inputEl))
  15750. return;
  15751. pickerVisible.value = false;
  15752. });
  15753. const userInput = vue.ref(null);
  15754. const handleChange = () => {
  15755. if (userInput.value) {
  15756. const value = parseUserInputToDayjs(displayValue.value);
  15757. if (value) {
  15758. if (isValidValue(value)) {
  15759. emitInput(isArray(value) ? value.map((_) => _.toDate()) : value.toDate());
  15760. userInput.value = null;
  15761. }
  15762. }
  15763. }
  15764. if (userInput.value === "") {
  15765. emitInput(null);
  15766. emitChange(null);
  15767. userInput.value = null;
  15768. }
  15769. };
  15770. const parseUserInputToDayjs = (value) => {
  15771. if (!value)
  15772. return null;
  15773. return pickerOptions.value.parseUserInput(value);
  15774. };
  15775. const formatDayjsToString = (value) => {
  15776. if (!value)
  15777. return null;
  15778. return pickerOptions.value.formatToString(value);
  15779. };
  15780. const isValidValue = (value) => {
  15781. return pickerOptions.value.isValidValue(value);
  15782. };
  15783. const handleKeydownInput = async (event) => {
  15784. if (props.readonly || pickerDisabled.value)
  15785. return;
  15786. const { code } = event;
  15787. emitKeydown(event);
  15788. if (code === EVENT_CODE.esc) {
  15789. if (pickerVisible.value === true) {
  15790. pickerVisible.value = false;
  15791. event.preventDefault();
  15792. event.stopPropagation();
  15793. }
  15794. return;
  15795. }
  15796. if (code === EVENT_CODE.down) {
  15797. if (pickerOptions.value.handleFocusPicker) {
  15798. event.preventDefault();
  15799. event.stopPropagation();
  15800. }
  15801. if (pickerVisible.value === false) {
  15802. pickerVisible.value = true;
  15803. await vue.nextTick();
  15804. }
  15805. if (pickerOptions.value.handleFocusPicker) {
  15806. pickerOptions.value.handleFocusPicker();
  15807. return;
  15808. }
  15809. }
  15810. if (code === EVENT_CODE.tab) {
  15811. hasJustTabExitedInput = true;
  15812. return;
  15813. }
  15814. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  15815. if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  15816. handleChange();
  15817. pickerVisible.value = false;
  15818. }
  15819. event.stopPropagation();
  15820. return;
  15821. }
  15822. if (userInput.value) {
  15823. event.stopPropagation();
  15824. return;
  15825. }
  15826. if (pickerOptions.value.handleKeydownInput) {
  15827. pickerOptions.value.handleKeydownInput(event);
  15828. }
  15829. };
  15830. const onUserInput = (e) => {
  15831. userInput.value = e;
  15832. if (!pickerVisible.value) {
  15833. pickerVisible.value = true;
  15834. }
  15835. };
  15836. const handleStartInput = (event) => {
  15837. const target = event.target;
  15838. if (userInput.value) {
  15839. userInput.value = [target.value, userInput.value[1]];
  15840. } else {
  15841. userInput.value = [target.value, null];
  15842. }
  15843. };
  15844. const handleEndInput = (event) => {
  15845. const target = event.target;
  15846. if (userInput.value) {
  15847. userInput.value = [userInput.value[0], target.value];
  15848. } else {
  15849. userInput.value = [null, target.value];
  15850. }
  15851. };
  15852. const handleStartChange = () => {
  15853. var _a;
  15854. const values = userInput.value;
  15855. const value = parseUserInputToDayjs(values && values[0]);
  15856. const parsedVal = vue.unref(parsedValue);
  15857. if (value && value.isValid()) {
  15858. userInput.value = [
  15859. formatDayjsToString(value),
  15860. ((_a = displayValue.value) == null ? void 0 : _a[1]) || null
  15861. ];
  15862. const newValue = [value, parsedVal && (parsedVal[1] || null)];
  15863. if (isValidValue(newValue)) {
  15864. emitInput(newValue);
  15865. userInput.value = null;
  15866. }
  15867. }
  15868. };
  15869. const handleEndChange = () => {
  15870. var _a;
  15871. const values = vue.unref(userInput);
  15872. const value = parseUserInputToDayjs(values && values[1]);
  15873. const parsedVal = vue.unref(parsedValue);
  15874. if (value && value.isValid()) {
  15875. userInput.value = [
  15876. ((_a = vue.unref(displayValue)) == null ? void 0 : _a[0]) || null,
  15877. formatDayjsToString(value)
  15878. ];
  15879. const newValue = [parsedVal && parsedVal[0], value];
  15880. if (isValidValue(newValue)) {
  15881. emitInput(newValue);
  15882. userInput.value = null;
  15883. }
  15884. }
  15885. };
  15886. const pickerOptions = vue.ref({});
  15887. const onSetPickerOption = (e) => {
  15888. pickerOptions.value[e[0]] = e[1];
  15889. pickerOptions.value.panelReady = true;
  15890. };
  15891. const onCalendarChange = (e) => {
  15892. emit("calendar-change", e);
  15893. };
  15894. const onPanelChange = (value, mode, view) => {
  15895. emit("panel-change", value, mode, view);
  15896. };
  15897. vue.provide("EP_PICKER_BASE", {
  15898. props
  15899. });
  15900. expose({
  15901. focus,
  15902. handleFocusInput,
  15903. handleBlurInput,
  15904. handleOpen,
  15905. handleClose,
  15906. onPick
  15907. });
  15908. return (_ctx, _cache) => {
  15909. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  15910. ref_key: "refPopper",
  15911. ref: refPopper,
  15912. visible: pickerVisible.value,
  15913. effect: "light",
  15914. pure: "",
  15915. trigger: "click"
  15916. }, _ctx.$attrs, {
  15917. role: "dialog",
  15918. teleported: "",
  15919. transition: `${vue.unref(nsDate).namespace.value}-zoom-in-top`,
  15920. "popper-class": [`${vue.unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
  15921. "popper-options": vue.unref(elPopperOptions),
  15922. "fallback-placements": ["bottom", "top", "right", "left"],
  15923. "gpu-acceleration": false,
  15924. "stop-popper-mouse-event": false,
  15925. "hide-after": 0,
  15926. persistent: "",
  15927. onBeforeShow,
  15928. onShow,
  15929. onHide
  15930. }), {
  15931. default: vue.withCtx(() => [
  15932. !vue.unref(isRangeInput) ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  15933. key: 0,
  15934. id: _ctx.id,
  15935. ref_key: "inputRef",
  15936. ref: inputRef,
  15937. "container-role": "combobox",
  15938. "model-value": vue.unref(displayValue),
  15939. name: _ctx.name,
  15940. size: vue.unref(pickerSize),
  15941. disabled: vue.unref(pickerDisabled),
  15942. placeholder: _ctx.placeholder,
  15943. class: vue.normalizeClass([vue.unref(nsDate).b("editor"), vue.unref(nsDate).bm("editor", _ctx.type), _ctx.$attrs.class]),
  15944. style: vue.normalizeStyle(_ctx.$attrs.style),
  15945. readonly: !_ctx.editable || _ctx.readonly || vue.unref(isDatesPicker) || _ctx.type === "week",
  15946. label: _ctx.label,
  15947. tabindex: _ctx.tabindex,
  15948. "validate-event": false,
  15949. onInput: onUserInput,
  15950. onFocus: handleFocusInput,
  15951. onBlur: handleBlurInput,
  15952. onKeydown: handleKeydownInput,
  15953. onChange: handleChange,
  15954. onMousedown: onMouseDownInput,
  15955. onMouseenter: onMouseEnter,
  15956. onMouseleave: onMouseLeave,
  15957. onTouchstart: onTouchStartInput,
  15958. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  15959. }, ["stop"]))
  15960. }, {
  15961. prefix: vue.withCtx(() => [
  15962. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  15963. key: 0,
  15964. class: vue.normalizeClass(vue.unref(nsInput).e("icon")),
  15965. onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]),
  15966. onTouchstart: onTouchStartInput
  15967. }, {
  15968. default: vue.withCtx(() => [
  15969. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  15970. ]),
  15971. _: 1
  15972. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true)
  15973. ]),
  15974. suffix: vue.withCtx(() => [
  15975. showClose.value && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  15976. key: 0,
  15977. class: vue.normalizeClass(`${vue.unref(nsInput).e("icon")} clear-icon`),
  15978. onClick: vue.withModifiers(onClearIconClick, ["stop"])
  15979. }, {
  15980. default: vue.withCtx(() => [
  15981. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  15982. ]),
  15983. _: 1
  15984. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  15985. ]),
  15986. _: 1
  15987. }, 8, ["id", "model-value", "name", "size", "disabled", "placeholder", "class", "style", "readonly", "label", "tabindex", "onKeydown"])) : (vue.openBlock(), vue.createElementBlock("div", {
  15988. key: 1,
  15989. ref_key: "inputRef",
  15990. ref: inputRef,
  15991. class: vue.normalizeClass([
  15992. vue.unref(nsDate).b("editor"),
  15993. vue.unref(nsDate).bm("editor", _ctx.type),
  15994. vue.unref(nsInput).e("wrapper"),
  15995. vue.unref(nsDate).is("disabled", vue.unref(pickerDisabled)),
  15996. vue.unref(nsDate).is("active", pickerVisible.value),
  15997. vue.unref(nsRange).b("editor"),
  15998. vue.unref(pickerSize) ? vue.unref(nsRange).bm("editor", vue.unref(pickerSize)) : "",
  15999. _ctx.$attrs.class
  16000. ]),
  16001. style: vue.normalizeStyle(_ctx.$attrs.style),
  16002. onClick: handleFocusInput,
  16003. onMouseenter: onMouseEnter,
  16004. onMouseleave: onMouseLeave,
  16005. onTouchstart: onTouchStartInput,
  16006. onKeydown: handleKeydownInput
  16007. }, [
  16008. vue.unref(triggerIcon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  16009. key: 0,
  16010. class: vue.normalizeClass([vue.unref(nsInput).e("icon"), vue.unref(nsRange).e("icon")]),
  16011. onMousedown: vue.withModifiers(onMouseDownInput, ["prevent"]),
  16012. onTouchstart: onTouchStartInput
  16013. }, {
  16014. default: vue.withCtx(() => [
  16015. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(triggerIcon))))
  16016. ]),
  16017. _: 1
  16018. }, 8, ["class", "onMousedown"])) : vue.createCommentVNode("v-if", true),
  16019. vue.createElementVNode("input", {
  16020. id: _ctx.id && _ctx.id[0],
  16021. autocomplete: "off",
  16022. name: _ctx.name && _ctx.name[0],
  16023. placeholder: _ctx.startPlaceholder,
  16024. value: vue.unref(displayValue) && vue.unref(displayValue)[0],
  16025. disabled: vue.unref(pickerDisabled),
  16026. readonly: !_ctx.editable || _ctx.readonly,
  16027. class: vue.normalizeClass(vue.unref(nsRange).b("input")),
  16028. onMousedown: onMouseDownInput,
  16029. onInput: handleStartInput,
  16030. onChange: handleStartChange,
  16031. onFocus: handleFocusInput,
  16032. onBlur: handleBlurInput
  16033. }, null, 42, _hoisted_1$Z),
  16034. vue.renderSlot(_ctx.$slots, "range-separator", {}, () => [
  16035. vue.createElementVNode("span", {
  16036. class: vue.normalizeClass(vue.unref(nsRange).b("separator"))
  16037. }, vue.toDisplayString(_ctx.rangeSeparator), 3)
  16038. ]),
  16039. vue.createElementVNode("input", {
  16040. id: _ctx.id && _ctx.id[1],
  16041. autocomplete: "off",
  16042. name: _ctx.name && _ctx.name[1],
  16043. placeholder: _ctx.endPlaceholder,
  16044. value: vue.unref(displayValue) && vue.unref(displayValue)[1],
  16045. disabled: vue.unref(pickerDisabled),
  16046. readonly: !_ctx.editable || _ctx.readonly,
  16047. class: vue.normalizeClass(vue.unref(nsRange).b("input")),
  16048. onMousedown: onMouseDownInput,
  16049. onFocus: handleFocusInput,
  16050. onBlur: handleBlurInput,
  16051. onInput: handleEndInput,
  16052. onChange: handleEndChange
  16053. }, null, 42, _hoisted_2$D),
  16054. _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  16055. key: 1,
  16056. class: vue.normalizeClass([
  16057. vue.unref(nsInput).e("icon"),
  16058. vue.unref(nsRange).e("close-icon"),
  16059. {
  16060. [vue.unref(nsRange).e("close-icon--hidden")]: !showClose.value
  16061. }
  16062. ]),
  16063. onClick: onClearIconClick
  16064. }, {
  16065. default: vue.withCtx(() => [
  16066. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  16067. ]),
  16068. _: 1
  16069. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  16070. ], 38))
  16071. ]),
  16072. content: vue.withCtx(() => [
  16073. vue.renderSlot(_ctx.$slots, "default", {
  16074. visible: pickerVisible.value,
  16075. actualVisible: pickerActualVisible.value,
  16076. parsedValue: vue.unref(parsedValue),
  16077. format: _ctx.format,
  16078. unlinkPanels: _ctx.unlinkPanels,
  16079. type: _ctx.type,
  16080. defaultValue: _ctx.defaultValue,
  16081. onPick,
  16082. onSelectRange: setSelectionRange,
  16083. onSetPickerOption,
  16084. onCalendarChange,
  16085. onPanelChange,
  16086. onKeydown: onKeydownPopperContent,
  16087. onMousedown: _cache[1] || (_cache[1] = vue.withModifiers(() => {
  16088. }, ["stop"]))
  16089. })
  16090. ]),
  16091. _: 3
  16092. }, 16, ["visible", "transition", "popper-class", "popper-options"]);
  16093. };
  16094. }
  16095. });
  16096. var CommonPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1U, [["__file", "picker.vue"]]);
  16097. const panelTimePickerProps = buildProps({
  16098. ...timePanelSharedProps,
  16099. datetimeRole: String,
  16100. parsedValue: {
  16101. type: definePropType(Object)
  16102. }
  16103. });
  16104. const useTimePanel = ({
  16105. getAvailableHours,
  16106. getAvailableMinutes,
  16107. getAvailableSeconds
  16108. }) => {
  16109. const getAvailableTime = (date, role, first, compareDate) => {
  16110. const availableTimeGetters = {
  16111. hour: getAvailableHours,
  16112. minute: getAvailableMinutes,
  16113. second: getAvailableSeconds
  16114. };
  16115. let result = date;
  16116. ["hour", "minute", "second"].forEach((type) => {
  16117. if (availableTimeGetters[type]) {
  16118. let availableTimeSlots;
  16119. const method = availableTimeGetters[type];
  16120. switch (type) {
  16121. case "minute": {
  16122. availableTimeSlots = method(result.hour(), role, compareDate);
  16123. break;
  16124. }
  16125. case "second": {
  16126. availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
  16127. break;
  16128. }
  16129. default: {
  16130. availableTimeSlots = method(role, compareDate);
  16131. break;
  16132. }
  16133. }
  16134. if ((availableTimeSlots == null ? void 0 : availableTimeSlots.length) && !availableTimeSlots.includes(result[type]())) {
  16135. const pos = first ? 0 : availableTimeSlots.length - 1;
  16136. result = result[type](availableTimeSlots[pos]);
  16137. }
  16138. }
  16139. });
  16140. return result;
  16141. };
  16142. const timePickerOptions = {};
  16143. const onSetOption = ([key, val]) => {
  16144. timePickerOptions[key] = val;
  16145. };
  16146. return {
  16147. timePickerOptions,
  16148. getAvailableTime,
  16149. onSetOption
  16150. };
  16151. };
  16152. const makeAvailableArr = (disabledList) => {
  16153. const trueOrNumber = (isDisabled, index) => isDisabled || index;
  16154. const getNumber = (predicate) => predicate !== true;
  16155. return disabledList.map(trueOrNumber).filter(getNumber);
  16156. };
  16157. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  16158. const getHoursList = (role, compare) => {
  16159. return makeList(24, disabledHours && (() => disabledHours == null ? void 0 : disabledHours(role, compare)));
  16160. };
  16161. const getMinutesList = (hour, role, compare) => {
  16162. return makeList(60, disabledMinutes && (() => disabledMinutes == null ? void 0 : disabledMinutes(hour, role, compare)));
  16163. };
  16164. const getSecondsList = (hour, minute, role, compare) => {
  16165. return makeList(60, disabledSeconds && (() => disabledSeconds == null ? void 0 : disabledSeconds(hour, minute, role, compare)));
  16166. };
  16167. return {
  16168. getHoursList,
  16169. getMinutesList,
  16170. getSecondsList
  16171. };
  16172. };
  16173. const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
  16174. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  16175. const getAvailableHours = (role, compare) => {
  16176. return makeAvailableArr(getHoursList(role, compare));
  16177. };
  16178. const getAvailableMinutes = (hour, role, compare) => {
  16179. return makeAvailableArr(getMinutesList(hour, role, compare));
  16180. };
  16181. const getAvailableSeconds = (hour, minute, role, compare) => {
  16182. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  16183. };
  16184. return {
  16185. getAvailableHours,
  16186. getAvailableMinutes,
  16187. getAvailableSeconds
  16188. };
  16189. };
  16190. const useOldValue = (props) => {
  16191. const oldValue = vue.ref(props.parsedValue);
  16192. vue.watch(() => props.visible, (val) => {
  16193. if (!val) {
  16194. oldValue.value = props.parsedValue;
  16195. }
  16196. });
  16197. return oldValue;
  16198. };
  16199. const nodeList = /* @__PURE__ */ new Map();
  16200. let startClick;
  16201. if (isClient) {
  16202. document.addEventListener("mousedown", (e) => startClick = e);
  16203. document.addEventListener("mouseup", (e) => {
  16204. for (const handlers of nodeList.values()) {
  16205. for (const { documentHandler } of handlers) {
  16206. documentHandler(e, startClick);
  16207. }
  16208. }
  16209. });
  16210. }
  16211. function createDocumentHandler(el, binding) {
  16212. let excludes = [];
  16213. if (Array.isArray(binding.arg)) {
  16214. excludes = binding.arg;
  16215. } else if (isElement$1(binding.arg)) {
  16216. excludes.push(binding.arg);
  16217. }
  16218. return function(mouseup, mousedown) {
  16219. const popperRef = binding.instance.popperRef;
  16220. const mouseUpTarget = mouseup.target;
  16221. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  16222. const isBound = !binding || !binding.instance;
  16223. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  16224. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  16225. const isSelf = el === mouseUpTarget;
  16226. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  16227. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  16228. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  16229. return;
  16230. }
  16231. binding.value(mouseup, mousedown);
  16232. };
  16233. }
  16234. const ClickOutside = {
  16235. beforeMount(el, binding) {
  16236. if (!nodeList.has(el)) {
  16237. nodeList.set(el, []);
  16238. }
  16239. nodeList.get(el).push({
  16240. documentHandler: createDocumentHandler(el, binding),
  16241. bindingFn: binding.value
  16242. });
  16243. },
  16244. updated(el, binding) {
  16245. if (!nodeList.has(el)) {
  16246. nodeList.set(el, []);
  16247. }
  16248. const handlers = nodeList.get(el);
  16249. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  16250. const newHandler = {
  16251. documentHandler: createDocumentHandler(el, binding),
  16252. bindingFn: binding.value
  16253. };
  16254. if (oldHandlerIndex >= 0) {
  16255. handlers.splice(oldHandlerIndex, 1, newHandler);
  16256. } else {
  16257. handlers.push(newHandler);
  16258. }
  16259. },
  16260. unmounted(el) {
  16261. nodeList.delete(el);
  16262. }
  16263. };
  16264. const REPEAT_INTERVAL = 100;
  16265. const REPEAT_DELAY = 600;
  16266. const vRepeatClick = {
  16267. beforeMount(el, binding) {
  16268. const value = binding.value;
  16269. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction(value) ? {} : value;
  16270. let intervalId;
  16271. let delayId;
  16272. const handler = () => isFunction(value) ? value() : value.handler();
  16273. const clear = () => {
  16274. if (delayId) {
  16275. clearTimeout(delayId);
  16276. delayId = void 0;
  16277. }
  16278. if (intervalId) {
  16279. clearInterval(intervalId);
  16280. intervalId = void 0;
  16281. }
  16282. };
  16283. el.addEventListener("mousedown", (evt) => {
  16284. if (evt.button !== 0)
  16285. return;
  16286. clear();
  16287. handler();
  16288. document.addEventListener("mouseup", () => clear(), {
  16289. once: true
  16290. });
  16291. delayId = setTimeout(() => {
  16292. intervalId = setInterval(() => {
  16293. handler();
  16294. }, interval);
  16295. }, delay);
  16296. });
  16297. }
  16298. };
  16299. const FOCUSABLE_CHILDREN = "_trap-focus-children";
  16300. const FOCUS_STACK = [];
  16301. const FOCUS_HANDLER = (e) => {
  16302. if (FOCUS_STACK.length === 0)
  16303. return;
  16304. const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN];
  16305. if (focusableElement.length > 0 && e.code === EVENT_CODE.tab) {
  16306. if (focusableElement.length === 1) {
  16307. e.preventDefault();
  16308. if (document.activeElement !== focusableElement[0]) {
  16309. focusableElement[0].focus();
  16310. }
  16311. return;
  16312. }
  16313. const goingBackward = e.shiftKey;
  16314. const isFirst = e.target === focusableElement[0];
  16315. const isLast = e.target === focusableElement[focusableElement.length - 1];
  16316. if (isFirst && goingBackward) {
  16317. e.preventDefault();
  16318. focusableElement[focusableElement.length - 1].focus();
  16319. }
  16320. if (isLast && !goingBackward) {
  16321. e.preventDefault();
  16322. focusableElement[0].focus();
  16323. }
  16324. }
  16325. };
  16326. const TrapFocus = {
  16327. beforeMount(el) {
  16328. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  16329. FOCUS_STACK.push(el);
  16330. if (FOCUS_STACK.length <= 1) {
  16331. document.addEventListener("keydown", FOCUS_HANDLER);
  16332. }
  16333. },
  16334. updated(el) {
  16335. vue.nextTick(() => {
  16336. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  16337. });
  16338. },
  16339. unmounted() {
  16340. FOCUS_STACK.shift();
  16341. if (FOCUS_STACK.length === 0) {
  16342. document.removeEventListener("keydown", FOCUS_HANDLER);
  16343. }
  16344. }
  16345. };
  16346. 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;/**
  16347. * Checks if an event is supported in the current execution environment.
  16348. *
  16349. * NOTE: This will not work correctly for non-generic events such as `change`,
  16350. * `reset`, `load`, `error`, and `select`.
  16351. *
  16352. * Borrows from Modernizr.
  16353. *
  16354. * @param {string} eventNameSuffix Event name, e.g. "click".
  16355. * @param {?boolean} capture Check if the capture phase is supported.
  16356. * @return {boolean} True if the event is supported.
  16357. * @internal
  16358. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  16359. */
  16360. const mousewheel = function(element, callback) {
  16361. if (element && element.addEventListener) {
  16362. const fn = function(event) {
  16363. const normalized = Y(event);
  16364. callback && Reflect.apply(callback, this, [event, normalized]);
  16365. };
  16366. element.addEventListener("wheel", fn, { passive: true });
  16367. }
  16368. };
  16369. const Mousewheel = {
  16370. beforeMount(el, binding) {
  16371. mousewheel(el, binding.value);
  16372. }
  16373. };
  16374. const basicTimeSpinnerProps = buildProps({
  16375. role: {
  16376. type: String,
  16377. required: true
  16378. },
  16379. spinnerDate: {
  16380. type: definePropType(Object),
  16381. required: true
  16382. },
  16383. showSeconds: {
  16384. type: Boolean,
  16385. default: true
  16386. },
  16387. arrowControl: Boolean,
  16388. amPmMode: {
  16389. type: definePropType(String),
  16390. default: ""
  16391. },
  16392. ...disabledTimeListsProps
  16393. });
  16394. const _hoisted_1$Y = ["onClick"];
  16395. const _hoisted_2$C = ["onMouseenter"];
  16396. const _sfc_main$1T = /* @__PURE__ */ vue.defineComponent({
  16397. __name: "basic-time-spinner",
  16398. props: basicTimeSpinnerProps,
  16399. emits: ["change", "select-range", "set-option"],
  16400. setup(__props, { emit }) {
  16401. const props = __props;
  16402. const ns = useNamespace("time");
  16403. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  16404. let isScrolling = false;
  16405. const currentScrollbar = vue.ref();
  16406. const listHoursRef = vue.ref();
  16407. const listMinutesRef = vue.ref();
  16408. const listSecondsRef = vue.ref();
  16409. const listRefsMap = {
  16410. hours: listHoursRef,
  16411. minutes: listMinutesRef,
  16412. seconds: listSecondsRef
  16413. };
  16414. const spinnerItems = vue.computed(() => {
  16415. return props.showSeconds ? timeUnits : timeUnits.slice(0, 2);
  16416. });
  16417. const timePartials = vue.computed(() => {
  16418. const { spinnerDate } = props;
  16419. const hours = spinnerDate.hour();
  16420. const minutes = spinnerDate.minute();
  16421. const seconds = spinnerDate.second();
  16422. return { hours, minutes, seconds };
  16423. });
  16424. const timeList = vue.computed(() => {
  16425. const { hours, minutes } = vue.unref(timePartials);
  16426. return {
  16427. hours: getHoursList(props.role),
  16428. minutes: getMinutesList(hours, props.role),
  16429. seconds: getSecondsList(hours, minutes, props.role)
  16430. };
  16431. });
  16432. const arrowControlTimeList = vue.computed(() => {
  16433. const { hours, minutes, seconds } = vue.unref(timePartials);
  16434. return {
  16435. hours: buildTimeList(hours, 23),
  16436. minutes: buildTimeList(minutes, 59),
  16437. seconds: buildTimeList(seconds, 59)
  16438. };
  16439. });
  16440. const debouncedResetScroll = debounce((type) => {
  16441. isScrolling = false;
  16442. adjustCurrentSpinner(type);
  16443. }, 200);
  16444. const getAmPmFlag = (hour) => {
  16445. const shouldShowAmPm = !!props.amPmMode;
  16446. if (!shouldShowAmPm)
  16447. return "";
  16448. const isCapital = props.amPmMode === "A";
  16449. let content = hour < 12 ? " am" : " pm";
  16450. if (isCapital)
  16451. content = content.toUpperCase();
  16452. return content;
  16453. };
  16454. const emitSelectRange = (type) => {
  16455. let range;
  16456. switch (type) {
  16457. case "hours":
  16458. range = [0, 2];
  16459. break;
  16460. case "minutes":
  16461. range = [3, 5];
  16462. break;
  16463. case "seconds":
  16464. range = [6, 8];
  16465. break;
  16466. }
  16467. const [left, right] = range;
  16468. emit("select-range", left, right);
  16469. currentScrollbar.value = type;
  16470. };
  16471. const adjustCurrentSpinner = (type) => {
  16472. adjustSpinner(type, vue.unref(timePartials)[type]);
  16473. };
  16474. const adjustSpinners = () => {
  16475. adjustCurrentSpinner("hours");
  16476. adjustCurrentSpinner("minutes");
  16477. adjustCurrentSpinner("seconds");
  16478. };
  16479. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  16480. const adjustSpinner = (type, value) => {
  16481. if (props.arrowControl)
  16482. return;
  16483. const scrollbar = vue.unref(listRefsMap[type]);
  16484. if (scrollbar && scrollbar.$el) {
  16485. getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
  16486. }
  16487. };
  16488. const typeItemHeight = (type) => {
  16489. const scrollbar = vue.unref(listRefsMap[type]);
  16490. return (scrollbar == null ? void 0 : scrollbar.$el.querySelector("li").offsetHeight) || 0;
  16491. };
  16492. const onIncrement = () => {
  16493. scrollDown(1);
  16494. };
  16495. const onDecrement = () => {
  16496. scrollDown(-1);
  16497. };
  16498. const scrollDown = (step) => {
  16499. if (!currentScrollbar.value) {
  16500. emitSelectRange("hours");
  16501. }
  16502. const label = currentScrollbar.value;
  16503. const now = vue.unref(timePartials)[label];
  16504. const total = currentScrollbar.value === "hours" ? 24 : 60;
  16505. const next = findNextUnDisabled(label, now, step, total);
  16506. modifyDateField(label, next);
  16507. adjustSpinner(label, next);
  16508. vue.nextTick(() => emitSelectRange(label));
  16509. };
  16510. const findNextUnDisabled = (type, now, step, total) => {
  16511. let next = (now + step + total) % total;
  16512. const list = vue.unref(timeList)[type];
  16513. while (list[next] && next !== now) {
  16514. next = (next + step + total) % total;
  16515. }
  16516. return next;
  16517. };
  16518. const modifyDateField = (type, value) => {
  16519. const list = vue.unref(timeList)[type];
  16520. const isDisabled = list[value];
  16521. if (isDisabled)
  16522. return;
  16523. const { hours, minutes, seconds } = vue.unref(timePartials);
  16524. let changeTo;
  16525. switch (type) {
  16526. case "hours":
  16527. changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
  16528. break;
  16529. case "minutes":
  16530. changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
  16531. break;
  16532. case "seconds":
  16533. changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
  16534. break;
  16535. }
  16536. emit("change", changeTo);
  16537. };
  16538. const handleClick = (type, { value, disabled }) => {
  16539. if (!disabled) {
  16540. modifyDateField(type, value);
  16541. emitSelectRange(type);
  16542. adjustSpinner(type, value);
  16543. }
  16544. };
  16545. const handleScroll = (type) => {
  16546. isScrolling = true;
  16547. debouncedResetScroll(type);
  16548. const value = Math.min(Math.round((getScrollbarElement(vue.unref(listRefsMap[type]).$el).scrollTop - (scrollBarHeight(type) * 0.5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59);
  16549. modifyDateField(type, value);
  16550. };
  16551. const scrollBarHeight = (type) => {
  16552. return vue.unref(listRefsMap[type]).$el.offsetHeight;
  16553. };
  16554. const bindScrollEvent = () => {
  16555. const bindFunction = (type) => {
  16556. const scrollbar = vue.unref(listRefsMap[type]);
  16557. if (scrollbar && scrollbar.$el) {
  16558. getScrollbarElement(scrollbar.$el).onscroll = () => {
  16559. handleScroll(type);
  16560. };
  16561. }
  16562. };
  16563. bindFunction("hours");
  16564. bindFunction("minutes");
  16565. bindFunction("seconds");
  16566. };
  16567. vue.onMounted(() => {
  16568. vue.nextTick(() => {
  16569. !props.arrowControl && bindScrollEvent();
  16570. adjustSpinners();
  16571. if (props.role === "start")
  16572. emitSelectRange("hours");
  16573. });
  16574. });
  16575. const setRef = (scrollbar, type) => {
  16576. listRefsMap[type].value = scrollbar;
  16577. };
  16578. emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  16579. emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  16580. vue.watch(() => props.spinnerDate, () => {
  16581. if (isScrolling)
  16582. return;
  16583. adjustSpinners();
  16584. });
  16585. return (_ctx, _cache) => {
  16586. return vue.openBlock(), vue.createElementBlock("div", {
  16587. class: vue.normalizeClass([vue.unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }])
  16588. }, [
  16589. !_ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  16590. return vue.openBlock(), vue.createBlock(vue.unref(ElScrollbar), {
  16591. key: item,
  16592. ref_for: true,
  16593. ref: (scrollbar) => setRef(scrollbar, item),
  16594. class: vue.normalizeClass(vue.unref(ns).be("spinner", "wrapper")),
  16595. "wrap-style": "max-height: inherit;",
  16596. "view-class": vue.unref(ns).be("spinner", "list"),
  16597. noresize: "",
  16598. tag: "ul",
  16599. onMouseenter: ($event) => emitSelectRange(item),
  16600. onMousemove: ($event) => adjustCurrentSpinner(item)
  16601. }, {
  16602. default: vue.withCtx(() => [
  16603. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(timeList)[item], (disabled, key) => {
  16604. return vue.openBlock(), vue.createElementBlock("li", {
  16605. key,
  16606. class: vue.normalizeClass([
  16607. vue.unref(ns).be("spinner", "item"),
  16608. vue.unref(ns).is("active", key === vue.unref(timePartials)[item]),
  16609. vue.unref(ns).is("disabled", disabled)
  16610. ]),
  16611. onClick: ($event) => handleClick(item, { value: key, disabled })
  16612. }, [
  16613. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  16614. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + vue.toDisplayString(getAmPmFlag(key)), 1)
  16615. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  16616. vue.createTextVNode(vue.toDisplayString(("0" + key).slice(-2)), 1)
  16617. ], 64))
  16618. ], 10, _hoisted_1$Y);
  16619. }), 128))
  16620. ]),
  16621. _: 2
  16622. }, 1032, ["class", "view-class", "onMouseenter", "onMousemove"]);
  16623. }), 128)) : vue.createCommentVNode("v-if", true),
  16624. _ctx.arrowControl ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(vue.unref(spinnerItems), (item) => {
  16625. return vue.openBlock(), vue.createElementBlock("div", {
  16626. key: item,
  16627. class: vue.normalizeClass([vue.unref(ns).be("spinner", "wrapper"), vue.unref(ns).is("arrow")]),
  16628. onMouseenter: ($event) => emitSelectRange(item)
  16629. }, [
  16630. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  16631. class: vue.normalizeClass(["arrow-up", vue.unref(ns).be("spinner", "arrow")])
  16632. }, {
  16633. default: vue.withCtx(() => [
  16634. vue.createVNode(vue.unref(arrow_up_default))
  16635. ]),
  16636. _: 1
  16637. }, 8, ["class"])), [
  16638. [vue.unref(vRepeatClick), onDecrement]
  16639. ]),
  16640. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  16641. class: vue.normalizeClass(["arrow-down", vue.unref(ns).be("spinner", "arrow")])
  16642. }, {
  16643. default: vue.withCtx(() => [
  16644. vue.createVNode(vue.unref(arrow_down_default))
  16645. ]),
  16646. _: 1
  16647. }, 8, ["class"])), [
  16648. [vue.unref(vRepeatClick), onIncrement]
  16649. ]),
  16650. vue.createElementVNode("ul", {
  16651. class: vue.normalizeClass(vue.unref(ns).be("spinner", "list"))
  16652. }, [
  16653. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(arrowControlTimeList)[item], (time, key) => {
  16654. return vue.openBlock(), vue.createElementBlock("li", {
  16655. key,
  16656. class: vue.normalizeClass([
  16657. vue.unref(ns).be("spinner", "item"),
  16658. vue.unref(ns).is("active", time === vue.unref(timePartials)[item]),
  16659. vue.unref(ns).is("disabled", vue.unref(timeList)[item][time])
  16660. ])
  16661. }, [
  16662. typeof time === "number" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  16663. item === "hours" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  16664. vue.createTextVNode(vue.toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + vue.toDisplayString(getAmPmFlag(time)), 1)
  16665. ], 64)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  16666. vue.createTextVNode(vue.toDisplayString(("0" + time).slice(-2)), 1)
  16667. ], 64))
  16668. ], 64)) : vue.createCommentVNode("v-if", true)
  16669. ], 2);
  16670. }), 128))
  16671. ], 2)
  16672. ], 42, _hoisted_2$C);
  16673. }), 128)) : vue.createCommentVNode("v-if", true)
  16674. ], 2);
  16675. };
  16676. }
  16677. });
  16678. var TimeSpinner = /* @__PURE__ */ _export_sfc(_sfc_main$1T, [["__file", "basic-time-spinner.vue"]]);
  16679. const _sfc_main$1S = /* @__PURE__ */ vue.defineComponent({
  16680. __name: "panel-time-pick",
  16681. props: panelTimePickerProps,
  16682. emits: ["pick", "select-range", "set-picker-option"],
  16683. setup(__props, { emit }) {
  16684. const props = __props;
  16685. const pickerBase = vue.inject("EP_PICKER_BASE");
  16686. const {
  16687. arrowControl,
  16688. disabledHours,
  16689. disabledMinutes,
  16690. disabledSeconds,
  16691. defaultValue
  16692. } = pickerBase.props;
  16693. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
  16694. const ns = useNamespace("time");
  16695. const { t, lang } = useLocale();
  16696. const selectionRange = vue.ref([0, 2]);
  16697. const oldValue = useOldValue(props);
  16698. const transitionName = vue.computed(() => {
  16699. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  16700. });
  16701. const showSeconds = vue.computed(() => {
  16702. return props.format.includes("ss");
  16703. });
  16704. const amPmMode = vue.computed(() => {
  16705. if (props.format.includes("A"))
  16706. return "A";
  16707. if (props.format.includes("a"))
  16708. return "a";
  16709. return "";
  16710. });
  16711. const isValidValue = (_date) => {
  16712. const parsedDate = dayjs(_date).locale(lang.value);
  16713. const result = getRangeAvailableTime(parsedDate);
  16714. return parsedDate.isSame(result);
  16715. };
  16716. const handleCancel = () => {
  16717. emit("pick", oldValue.value, false);
  16718. };
  16719. const handleConfirm = (visible = false, first = false) => {
  16720. if (first)
  16721. return;
  16722. emit("pick", props.parsedValue, visible);
  16723. };
  16724. const handleChange = (_date) => {
  16725. if (!props.visible) {
  16726. return;
  16727. }
  16728. const result = getRangeAvailableTime(_date).millisecond(0);
  16729. emit("pick", result, true);
  16730. };
  16731. const setSelectionRange = (start, end) => {
  16732. emit("select-range", start, end);
  16733. selectionRange.value = [start, end];
  16734. };
  16735. const changeSelectionRange = (step) => {
  16736. const list = [0, 3].concat(showSeconds.value ? [6] : []);
  16737. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  16738. const index = list.indexOf(selectionRange.value[0]);
  16739. const next = (index + step + list.length) % list.length;
  16740. timePickerOptions["start_emitSelectRange"](mapping[next]);
  16741. };
  16742. const handleKeydown = (event) => {
  16743. const code = event.code;
  16744. const { left, right, up, down } = EVENT_CODE;
  16745. if ([left, right].includes(code)) {
  16746. const step = code === left ? -1 : 1;
  16747. changeSelectionRange(step);
  16748. event.preventDefault();
  16749. return;
  16750. }
  16751. if ([up, down].includes(code)) {
  16752. const step = code === up ? -1 : 1;
  16753. timePickerOptions["start_scrollDown"](step);
  16754. event.preventDefault();
  16755. return;
  16756. }
  16757. };
  16758. const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
  16759. getAvailableHours,
  16760. getAvailableMinutes,
  16761. getAvailableSeconds
  16762. });
  16763. const getRangeAvailableTime = (date) => {
  16764. return getAvailableTime(date, props.datetimeRole || "", true);
  16765. };
  16766. const parseUserInput = (value) => {
  16767. if (!value)
  16768. return null;
  16769. return dayjs(value, props.format).locale(lang.value);
  16770. };
  16771. const formatToString = (value) => {
  16772. if (!value)
  16773. return null;
  16774. return value.format(props.format);
  16775. };
  16776. const getDefaultValue = () => {
  16777. return dayjs(defaultValue).locale(lang.value);
  16778. };
  16779. emit("set-picker-option", ["isValidValue", isValidValue]);
  16780. emit("set-picker-option", ["formatToString", formatToString]);
  16781. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  16782. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  16783. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  16784. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  16785. return (_ctx, _cache) => {
  16786. return vue.openBlock(), vue.createBlock(vue.Transition, { name: vue.unref(transitionName) }, {
  16787. default: vue.withCtx(() => [
  16788. _ctx.actualVisible || _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", {
  16789. key: 0,
  16790. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  16791. }, [
  16792. vue.createElementVNode("div", {
  16793. class: vue.normalizeClass([vue.unref(ns).be("panel", "content"), { "has-seconds": vue.unref(showSeconds) }])
  16794. }, [
  16795. vue.createVNode(TimeSpinner, {
  16796. ref: "spinner",
  16797. role: _ctx.datetimeRole || "start",
  16798. "arrow-control": vue.unref(arrowControl),
  16799. "show-seconds": vue.unref(showSeconds),
  16800. "am-pm-mode": vue.unref(amPmMode),
  16801. "spinner-date": _ctx.parsedValue,
  16802. "disabled-hours": vue.unref(disabledHours),
  16803. "disabled-minutes": vue.unref(disabledMinutes),
  16804. "disabled-seconds": vue.unref(disabledSeconds),
  16805. onChange: handleChange,
  16806. onSetOption: vue.unref(onSetOption),
  16807. onSelectRange: setSelectionRange
  16808. }, null, 8, ["role", "arrow-control", "show-seconds", "am-pm-mode", "spinner-date", "disabled-hours", "disabled-minutes", "disabled-seconds", "onSetOption"])
  16809. ], 2),
  16810. vue.createElementVNode("div", {
  16811. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  16812. }, [
  16813. vue.createElementVNode("button", {
  16814. type: "button",
  16815. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "cancel"]),
  16816. onClick: handleCancel
  16817. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 3),
  16818. vue.createElementVNode("button", {
  16819. type: "button",
  16820. class: vue.normalizeClass([vue.unref(ns).be("panel", "btn"), "confirm"]),
  16821. onClick: _cache[0] || (_cache[0] = ($event) => handleConfirm())
  16822. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 3)
  16823. ], 2)
  16824. ], 2)) : vue.createCommentVNode("v-if", true)
  16825. ]),
  16826. _: 1
  16827. }, 8, ["name"]);
  16828. };
  16829. }
  16830. });
  16831. var TimePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1S, [["__file", "panel-time-pick.vue"]]);
  16832. const panelTimeRangeProps = buildProps({
  16833. ...timePanelSharedProps,
  16834. parsedValue: {
  16835. type: definePropType(Array)
  16836. }
  16837. });
  16838. const _hoisted_1$X = ["disabled"];
  16839. const _sfc_main$1R = /* @__PURE__ */ vue.defineComponent({
  16840. __name: "panel-time-range",
  16841. props: panelTimeRangeProps,
  16842. emits: ["pick", "select-range", "set-picker-option"],
  16843. setup(__props, { emit }) {
  16844. const props = __props;
  16845. const makeSelectRange = (start, end) => {
  16846. const result = [];
  16847. for (let i = start; i <= end; i++) {
  16848. result.push(i);
  16849. }
  16850. return result;
  16851. };
  16852. const { t, lang } = useLocale();
  16853. const nsTime = useNamespace("time");
  16854. const nsPicker = useNamespace("picker");
  16855. const pickerBase = vue.inject("EP_PICKER_BASE");
  16856. const {
  16857. arrowControl,
  16858. disabledHours,
  16859. disabledMinutes,
  16860. disabledSeconds,
  16861. defaultValue
  16862. } = pickerBase.props;
  16863. const startTime = vue.computed(() => props.parsedValue[0]);
  16864. const endTime = vue.computed(() => props.parsedValue[1]);
  16865. const oldValue = useOldValue(props);
  16866. const handleCancel = () => {
  16867. emit("pick", oldValue.value, false);
  16868. };
  16869. const showSeconds = vue.computed(() => {
  16870. return props.format.includes("ss");
  16871. });
  16872. const amPmMode = vue.computed(() => {
  16873. if (props.format.includes("A"))
  16874. return "A";
  16875. if (props.format.includes("a"))
  16876. return "a";
  16877. return "";
  16878. });
  16879. const handleConfirm = (visible = false) => {
  16880. emit("pick", [startTime.value, endTime.value], visible);
  16881. };
  16882. const handleMinChange = (date) => {
  16883. handleChange(date.millisecond(0), endTime.value);
  16884. };
  16885. const handleMaxChange = (date) => {
  16886. handleChange(startTime.value, date.millisecond(0));
  16887. };
  16888. const isValidValue = (_date) => {
  16889. const parsedDate = _date.map((_) => dayjs(_).locale(lang.value));
  16890. const result = getRangeAvailableTime(parsedDate);
  16891. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  16892. };
  16893. const handleChange = (start, end) => {
  16894. emit("pick", [start, end], true);
  16895. };
  16896. const btnConfirmDisabled = vue.computed(() => {
  16897. return startTime.value > endTime.value;
  16898. });
  16899. const selectionRange = vue.ref([0, 2]);
  16900. const setMinSelectionRange = (start, end) => {
  16901. emit("select-range", start, end, "min");
  16902. selectionRange.value = [start, end];
  16903. };
  16904. const offset = vue.computed(() => showSeconds.value ? 11 : 8);
  16905. const setMaxSelectionRange = (start, end) => {
  16906. emit("select-range", start, end, "max");
  16907. const _offset = vue.unref(offset);
  16908. selectionRange.value = [start + _offset, end + _offset];
  16909. };
  16910. const changeSelectionRange = (step) => {
  16911. const list = showSeconds.value ? [0, 3, 6, 11, 14, 17] : [0, 3, 8, 11];
  16912. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  16913. const index = list.indexOf(selectionRange.value[0]);
  16914. const next = (index + step + list.length) % list.length;
  16915. const half = list.length / 2;
  16916. if (next < half) {
  16917. timePickerOptions["start_emitSelectRange"](mapping[next]);
  16918. } else {
  16919. timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  16920. }
  16921. };
  16922. const handleKeydown = (event) => {
  16923. const code = event.code;
  16924. const { left, right, up, down } = EVENT_CODE;
  16925. if ([left, right].includes(code)) {
  16926. const step = code === left ? -1 : 1;
  16927. changeSelectionRange(step);
  16928. event.preventDefault();
  16929. return;
  16930. }
  16931. if ([up, down].includes(code)) {
  16932. const step = code === up ? -1 : 1;
  16933. const role = selectionRange.value[0] < offset.value ? "start" : "end";
  16934. timePickerOptions[`${role}_scrollDown`](step);
  16935. event.preventDefault();
  16936. return;
  16937. }
  16938. };
  16939. const disabledHours_ = (role, compare) => {
  16940. const defaultDisable = disabledHours ? disabledHours(role) : [];
  16941. const isStart = role === "start";
  16942. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  16943. const compareHour = compareDate.hour();
  16944. const nextDisable = isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1);
  16945. return union(defaultDisable, nextDisable);
  16946. };
  16947. const disabledMinutes_ = (hour, role, compare) => {
  16948. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  16949. const isStart = role === "start";
  16950. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  16951. const compareHour = compareDate.hour();
  16952. if (hour !== compareHour) {
  16953. return defaultDisable;
  16954. }
  16955. const compareMinute = compareDate.minute();
  16956. const nextDisable = isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1);
  16957. return union(defaultDisable, nextDisable);
  16958. };
  16959. const disabledSeconds_ = (hour, minute, role, compare) => {
  16960. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  16961. const isStart = role === "start";
  16962. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  16963. const compareHour = compareDate.hour();
  16964. const compareMinute = compareDate.minute();
  16965. if (hour !== compareHour || minute !== compareMinute) {
  16966. return defaultDisable;
  16967. }
  16968. const compareSecond = compareDate.second();
  16969. const nextDisable = isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1);
  16970. return union(defaultDisable, nextDisable);
  16971. };
  16972. const getRangeAvailableTime = ([start, end]) => {
  16973. return [
  16974. getAvailableTime(start, "start", true, end),
  16975. getAvailableTime(end, "end", false, start)
  16976. ];
  16977. };
  16978. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
  16979. const {
  16980. timePickerOptions,
  16981. getAvailableTime,
  16982. onSetOption
  16983. } = useTimePanel({
  16984. getAvailableHours,
  16985. getAvailableMinutes,
  16986. getAvailableSeconds
  16987. });
  16988. const parseUserInput = (days) => {
  16989. if (!days)
  16990. return null;
  16991. if (isArray(days)) {
  16992. return days.map((d) => dayjs(d, props.format).locale(lang.value));
  16993. }
  16994. return dayjs(days, props.format).locale(lang.value);
  16995. };
  16996. const formatToString = (days) => {
  16997. if (!days)
  16998. return null;
  16999. if (isArray(days)) {
  17000. return days.map((d) => d.format(props.format));
  17001. }
  17002. return days.format(props.format);
  17003. };
  17004. const getDefaultValue = () => {
  17005. if (isArray(defaultValue)) {
  17006. return defaultValue.map((d) => dayjs(d).locale(lang.value));
  17007. }
  17008. const defaultDay = dayjs(defaultValue).locale(lang.value);
  17009. return [defaultDay, defaultDay.add(60, "m")];
  17010. };
  17011. emit("set-picker-option", ["formatToString", formatToString]);
  17012. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  17013. emit("set-picker-option", ["isValidValue", isValidValue]);
  17014. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  17015. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  17016. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  17017. return (_ctx, _cache) => {
  17018. return _ctx.actualVisible ? (vue.openBlock(), vue.createElementBlock("div", {
  17019. key: 0,
  17020. class: vue.normalizeClass([vue.unref(nsTime).b("range-picker"), vue.unref(nsPicker).b("panel")])
  17021. }, [
  17022. vue.createElementVNode("div", {
  17023. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "content"))
  17024. }, [
  17025. vue.createElementVNode("div", {
  17026. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  17027. }, [
  17028. vue.createElementVNode("div", {
  17029. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  17030. }, vue.toDisplayString(vue.unref(t)("el.datepicker.startTime")), 3),
  17031. vue.createElementVNode("div", {
  17032. class: vue.normalizeClass([
  17033. vue.unref(nsTime).be("range-picker", "body"),
  17034. vue.unref(nsTime).be("panel", "content"),
  17035. vue.unref(nsTime).is("arrow", vue.unref(arrowControl)),
  17036. { "has-seconds": vue.unref(showSeconds) }
  17037. ])
  17038. }, [
  17039. vue.createVNode(TimeSpinner, {
  17040. ref: "minSpinner",
  17041. role: "start",
  17042. "show-seconds": vue.unref(showSeconds),
  17043. "am-pm-mode": vue.unref(amPmMode),
  17044. "arrow-control": vue.unref(arrowControl),
  17045. "spinner-date": vue.unref(startTime),
  17046. "disabled-hours": disabledHours_,
  17047. "disabled-minutes": disabledMinutes_,
  17048. "disabled-seconds": disabledSeconds_,
  17049. onChange: handleMinChange,
  17050. onSetOption: vue.unref(onSetOption),
  17051. onSelectRange: setMinSelectionRange
  17052. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  17053. ], 2)
  17054. ], 2),
  17055. vue.createElementVNode("div", {
  17056. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "cell"))
  17057. }, [
  17058. vue.createElementVNode("div", {
  17059. class: vue.normalizeClass(vue.unref(nsTime).be("range-picker", "header"))
  17060. }, vue.toDisplayString(vue.unref(t)("el.datepicker.endTime")), 3),
  17061. vue.createElementVNode("div", {
  17062. class: vue.normalizeClass([
  17063. vue.unref(nsTime).be("range-picker", "body"),
  17064. vue.unref(nsTime).be("panel", "content"),
  17065. vue.unref(nsTime).is("arrow", vue.unref(arrowControl)),
  17066. { "has-seconds": vue.unref(showSeconds) }
  17067. ])
  17068. }, [
  17069. vue.createVNode(TimeSpinner, {
  17070. ref: "maxSpinner",
  17071. role: "end",
  17072. "show-seconds": vue.unref(showSeconds),
  17073. "am-pm-mode": vue.unref(amPmMode),
  17074. "arrow-control": vue.unref(arrowControl),
  17075. "spinner-date": vue.unref(endTime),
  17076. "disabled-hours": disabledHours_,
  17077. "disabled-minutes": disabledMinutes_,
  17078. "disabled-seconds": disabledSeconds_,
  17079. onChange: handleMaxChange,
  17080. onSetOption: vue.unref(onSetOption),
  17081. onSelectRange: setMaxSelectionRange
  17082. }, null, 8, ["show-seconds", "am-pm-mode", "arrow-control", "spinner-date", "onSetOption"])
  17083. ], 2)
  17084. ], 2)
  17085. ], 2),
  17086. vue.createElementVNode("div", {
  17087. class: vue.normalizeClass(vue.unref(nsTime).be("panel", "footer"))
  17088. }, [
  17089. vue.createElementVNode("button", {
  17090. type: "button",
  17091. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "cancel"]),
  17092. onClick: _cache[0] || (_cache[0] = ($event) => handleCancel())
  17093. }, vue.toDisplayString(vue.unref(t)("el.datepicker.cancel")), 3),
  17094. vue.createElementVNode("button", {
  17095. type: "button",
  17096. class: vue.normalizeClass([vue.unref(nsTime).be("panel", "btn"), "confirm"]),
  17097. disabled: vue.unref(btnConfirmDisabled),
  17098. onClick: _cache[1] || (_cache[1] = ($event) => handleConfirm())
  17099. }, vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 11, _hoisted_1$X)
  17100. ], 2)
  17101. ], 2)) : vue.createCommentVNode("v-if", true);
  17102. };
  17103. }
  17104. });
  17105. var TimeRangePanel = /* @__PURE__ */ _export_sfc(_sfc_main$1R, [["__file", "panel-time-range.vue"]]);
  17106. dayjs.extend(customParseFormat);
  17107. var TimePicker = vue.defineComponent({
  17108. name: "ElTimePicker",
  17109. install: null,
  17110. props: {
  17111. ...timePickerDefaultProps,
  17112. isRange: {
  17113. type: Boolean,
  17114. default: false
  17115. }
  17116. },
  17117. emits: ["update:modelValue"],
  17118. setup(props, ctx) {
  17119. const commonPicker = vue.ref();
  17120. const [type, Panel] = props.isRange ? ["timerange", TimeRangePanel] : ["time", TimePickPanel];
  17121. const modelUpdater = (value) => ctx.emit("update:modelValue", value);
  17122. vue.provide("ElPopperOptions", props.popperOptions);
  17123. ctx.expose({
  17124. focus: (e) => {
  17125. var _a;
  17126. (_a = commonPicker.value) == null ? void 0 : _a.handleFocusInput(e);
  17127. },
  17128. blur: (e) => {
  17129. var _a;
  17130. (_a = commonPicker.value) == null ? void 0 : _a.handleBlurInput(e);
  17131. },
  17132. handleOpen: () => {
  17133. var _a;
  17134. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  17135. },
  17136. handleClose: () => {
  17137. var _a;
  17138. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  17139. }
  17140. });
  17141. return () => {
  17142. var _a;
  17143. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_TIME;
  17144. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  17145. "ref": commonPicker,
  17146. "type": type,
  17147. "format": format,
  17148. "onUpdate:modelValue": modelUpdater
  17149. }), {
  17150. default: (props2) => vue.createVNode(Panel, props2, null)
  17151. });
  17152. };
  17153. }
  17154. });
  17155. const _TimePicker = TimePicker;
  17156. _TimePicker.install = (app) => {
  17157. app.component(_TimePicker.name, _TimePicker);
  17158. };
  17159. const ElTimePicker = _TimePicker;
  17160. const getPrevMonthLastDays = (date, count) => {
  17161. const lastDay = date.subtract(1, "month").endOf("month").date();
  17162. return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
  17163. };
  17164. const getMonthDays = (date) => {
  17165. const days = date.daysInMonth();
  17166. return rangeArr(days).map((_, index) => index + 1);
  17167. };
  17168. const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
  17169. const start = index * 7;
  17170. return days.slice(start, start + 7);
  17171. });
  17172. const dateTableProps = buildProps({
  17173. selectedDay: {
  17174. type: definePropType(Object)
  17175. },
  17176. range: {
  17177. type: definePropType(Array)
  17178. },
  17179. date: {
  17180. type: definePropType(Object),
  17181. required: true
  17182. },
  17183. hideHeader: {
  17184. type: Boolean
  17185. }
  17186. });
  17187. const dateTableEmits = {
  17188. pick: (value) => isObject$1(value)
  17189. };
  17190. var localeData$1 = {exports: {}};
  17191. (function(module, exports) {
  17192. !function(n, e) {
  17193. module.exports = e() ;
  17194. }(commonjsGlobal, function() {
  17195. return function(n, e, t) {
  17196. var r = e.prototype, o = function(n2) {
  17197. return n2 && (n2.indexOf ? n2 : n2.s);
  17198. }, u = function(n2, e2, t2, r2, u2) {
  17199. var i2 = n2.name ? n2 : n2.$locale(), a2 = o(i2[e2]), s2 = o(i2[t2]), f = a2 || s2.map(function(n3) {
  17200. return n3.slice(0, r2);
  17201. });
  17202. if (!u2)
  17203. return f;
  17204. var d = i2.weekStart;
  17205. return f.map(function(n3, e3) {
  17206. return f[(e3 + (d || 0)) % 7];
  17207. });
  17208. }, i = function() {
  17209. return t.Ls[t.locale()];
  17210. }, a = function(n2, e2) {
  17211. return n2.formats[e2] || function(n3) {
  17212. return n3.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, function(n4, e3, t2) {
  17213. return e3 || t2.slice(1);
  17214. });
  17215. }(n2.formats[e2.toUpperCase()]);
  17216. }, s = function() {
  17217. var n2 = this;
  17218. return { months: function(e2) {
  17219. return e2 ? e2.format("MMMM") : u(n2, "months");
  17220. }, monthsShort: function(e2) {
  17221. return e2 ? e2.format("MMM") : u(n2, "monthsShort", "months", 3);
  17222. }, firstDayOfWeek: function() {
  17223. return n2.$locale().weekStart || 0;
  17224. }, weekdays: function(e2) {
  17225. return e2 ? e2.format("dddd") : u(n2, "weekdays");
  17226. }, weekdaysMin: function(e2) {
  17227. return e2 ? e2.format("dd") : u(n2, "weekdaysMin", "weekdays", 2);
  17228. }, weekdaysShort: function(e2) {
  17229. return e2 ? e2.format("ddd") : u(n2, "weekdaysShort", "weekdays", 3);
  17230. }, longDateFormat: function(e2) {
  17231. return a(n2.$locale(), e2);
  17232. }, meridiem: this.$locale().meridiem, ordinal: this.$locale().ordinal };
  17233. };
  17234. r.localeData = function() {
  17235. return s.bind(this)();
  17236. }, t.localeData = function() {
  17237. var n2 = i();
  17238. return { firstDayOfWeek: function() {
  17239. return n2.weekStart || 0;
  17240. }, weekdays: function() {
  17241. return t.weekdays();
  17242. }, weekdaysShort: function() {
  17243. return t.weekdaysShort();
  17244. }, weekdaysMin: function() {
  17245. return t.weekdaysMin();
  17246. }, months: function() {
  17247. return t.months();
  17248. }, monthsShort: function() {
  17249. return t.monthsShort();
  17250. }, longDateFormat: function(e2) {
  17251. return a(n2, e2);
  17252. }, meridiem: n2.meridiem, ordinal: n2.ordinal };
  17253. }, t.months = function() {
  17254. return u(i(), "months");
  17255. }, t.monthsShort = function() {
  17256. return u(i(), "monthsShort", "months", 3);
  17257. }, t.weekdays = function(n2) {
  17258. return u(i(), "weekdays", null, null, n2);
  17259. }, t.weekdaysShort = function(n2) {
  17260. return u(i(), "weekdaysShort", "weekdays", 3, n2);
  17261. }, t.weekdaysMin = function(n2) {
  17262. return u(i(), "weekdaysMin", "weekdays", 2, n2);
  17263. };
  17264. };
  17265. });
  17266. })(localeData$1);
  17267. var localeData = localeData$1.exports;
  17268. const useDateTable = (props, emit) => {
  17269. dayjs.extend(localeData);
  17270. const firstDayOfWeek = dayjs.localeData().firstDayOfWeek();
  17271. const { t, lang } = useLocale();
  17272. const now = dayjs().locale(lang.value);
  17273. const isInRange = vue.computed(() => !!props.range && !!props.range.length);
  17274. const rows = vue.computed(() => {
  17275. let days = [];
  17276. if (isInRange.value) {
  17277. const [start, end] = props.range;
  17278. const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
  17279. text: start.date() + index,
  17280. type: "current"
  17281. }));
  17282. let remaining = currentMonthRange.length % 7;
  17283. remaining = remaining === 0 ? 0 : 7 - remaining;
  17284. const nextMonthRange = rangeArr(remaining).map((_, index) => ({
  17285. text: index + 1,
  17286. type: "next"
  17287. }));
  17288. days = currentMonthRange.concat(nextMonthRange);
  17289. } else {
  17290. const firstDay = props.date.startOf("month").day();
  17291. const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
  17292. text: day,
  17293. type: "prev"
  17294. }));
  17295. const currentMonthDays = getMonthDays(props.date).map((day) => ({
  17296. text: day,
  17297. type: "current"
  17298. }));
  17299. days = [...prevMonthDays, ...currentMonthDays];
  17300. const remaining = 7 - (days.length % 7 || 7);
  17301. const nextMonthDays = rangeArr(remaining).map((_, index) => ({
  17302. text: index + 1,
  17303. type: "next"
  17304. }));
  17305. days = days.concat(nextMonthDays);
  17306. }
  17307. return toNestedArr(days);
  17308. });
  17309. const weekDays = vue.computed(() => {
  17310. const start = firstDayOfWeek;
  17311. if (start === 0) {
  17312. return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
  17313. } else {
  17314. return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
  17315. }
  17316. });
  17317. const getFormattedDate = (day, type) => {
  17318. switch (type) {
  17319. case "prev":
  17320. return props.date.startOf("month").subtract(1, "month").date(day);
  17321. case "next":
  17322. return props.date.startOf("month").add(1, "month").date(day);
  17323. case "current":
  17324. return props.date.date(day);
  17325. }
  17326. };
  17327. const handlePickDay = ({ text, type }) => {
  17328. const date = getFormattedDate(text, type);
  17329. emit("pick", date);
  17330. };
  17331. const getSlotData = ({ text, type }) => {
  17332. const day = getFormattedDate(text, type);
  17333. return {
  17334. isSelected: day.isSame(props.selectedDay),
  17335. type: `${type}-month`,
  17336. day: day.format("YYYY-MM-DD"),
  17337. date: day.toDate()
  17338. };
  17339. };
  17340. return {
  17341. now,
  17342. isInRange,
  17343. rows,
  17344. weekDays,
  17345. getFormattedDate,
  17346. handlePickDay,
  17347. getSlotData
  17348. };
  17349. };
  17350. const _hoisted_1$W = { key: 0 };
  17351. const _hoisted_2$B = ["onClick"];
  17352. const __default__$1b = vue.defineComponent({
  17353. name: "DateTable"
  17354. });
  17355. const _sfc_main$1Q = /* @__PURE__ */ vue.defineComponent({
  17356. ...__default__$1b,
  17357. props: dateTableProps,
  17358. emits: dateTableEmits,
  17359. setup(__props, { expose, emit }) {
  17360. const props = __props;
  17361. const {
  17362. isInRange,
  17363. now,
  17364. rows,
  17365. weekDays,
  17366. getFormattedDate,
  17367. handlePickDay,
  17368. getSlotData
  17369. } = useDateTable(props, emit);
  17370. const nsTable = useNamespace("calendar-table");
  17371. const nsDay = useNamespace("calendar-day");
  17372. const getCellClass = ({ text, type }) => {
  17373. const classes = [type];
  17374. if (type === "current") {
  17375. const date = getFormattedDate(text, type);
  17376. if (date.isSame(props.selectedDay, "day")) {
  17377. classes.push(nsDay.is("selected"));
  17378. }
  17379. if (date.isSame(now, "day")) {
  17380. classes.push(nsDay.is("today"));
  17381. }
  17382. }
  17383. return classes;
  17384. };
  17385. expose({
  17386. getFormattedDate
  17387. });
  17388. return (_ctx, _cache) => {
  17389. return vue.openBlock(), vue.createElementBlock("table", {
  17390. class: vue.normalizeClass([vue.unref(nsTable).b(), vue.unref(nsTable).is("range", vue.unref(isInRange))]),
  17391. cellspacing: "0",
  17392. cellpadding: "0"
  17393. }, [
  17394. !_ctx.hideHeader ? (vue.openBlock(), vue.createElementBlock("thead", _hoisted_1$W, [
  17395. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(weekDays), (day) => {
  17396. return vue.openBlock(), vue.createElementBlock("th", { key: day }, vue.toDisplayString(day), 1);
  17397. }), 128))
  17398. ])) : vue.createCommentVNode("v-if", true),
  17399. vue.createElementVNode("tbody", null, [
  17400. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, index) => {
  17401. return vue.openBlock(), vue.createElementBlock("tr", {
  17402. key: index,
  17403. class: vue.normalizeClass({
  17404. [vue.unref(nsTable).e("row")]: true,
  17405. [vue.unref(nsTable).em("row", "hide-border")]: index === 0 && _ctx.hideHeader
  17406. })
  17407. }, [
  17408. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key) => {
  17409. return vue.openBlock(), vue.createElementBlock("td", {
  17410. key,
  17411. class: vue.normalizeClass(getCellClass(cell)),
  17412. onClick: ($event) => vue.unref(handlePickDay)(cell)
  17413. }, [
  17414. vue.createElementVNode("div", {
  17415. class: vue.normalizeClass(vue.unref(nsDay).b())
  17416. }, [
  17417. vue.renderSlot(_ctx.$slots, "date-cell", {
  17418. data: vue.unref(getSlotData)(cell)
  17419. }, () => [
  17420. vue.createElementVNode("span", null, vue.toDisplayString(cell.text), 1)
  17421. ])
  17422. ], 2)
  17423. ], 10, _hoisted_2$B);
  17424. }), 128))
  17425. ], 2);
  17426. }), 128))
  17427. ])
  17428. ], 2);
  17429. };
  17430. }
  17431. });
  17432. var DateTable$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1Q, [["__file", "date-table.vue"]]);
  17433. const adjacentMonth = (start, end) => {
  17434. const firstMonthLastDay = start.endOf("month");
  17435. const lastMonthFirstDay = end.startOf("month");
  17436. const isSameWeek = firstMonthLastDay.isSame(lastMonthFirstDay, "week");
  17437. const lastMonthStartDay = isSameWeek ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  17438. return [
  17439. [start, firstMonthLastDay],
  17440. [lastMonthStartDay.startOf("week"), end]
  17441. ];
  17442. };
  17443. const threeConsecutiveMonth = (start, end) => {
  17444. const firstMonthLastDay = start.endOf("month");
  17445. const secondMonthFirstDay = start.add(1, "month").startOf("month");
  17446. const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
  17447. const secondMonthLastDay = secondMonthStartDay.endOf("month");
  17448. const lastMonthFirstDay = end.startOf("month");
  17449. const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  17450. return [
  17451. [start, firstMonthLastDay],
  17452. [secondMonthStartDay.startOf("week"), secondMonthLastDay],
  17453. [lastMonthStartDay.startOf("week"), end]
  17454. ];
  17455. };
  17456. const useCalendar = (props, emit, componentName) => {
  17457. const slots = vue.useSlots();
  17458. const { lang } = useLocale();
  17459. const selectedDay = vue.ref();
  17460. const now = dayjs().locale(lang.value);
  17461. const realSelectedDay = vue.computed({
  17462. get() {
  17463. if (!props.modelValue)
  17464. return selectedDay.value;
  17465. return date.value;
  17466. },
  17467. set(val) {
  17468. if (!val)
  17469. return;
  17470. selectedDay.value = val;
  17471. const result = val.toDate();
  17472. emit(INPUT_EVENT, result);
  17473. emit(UPDATE_MODEL_EVENT, result);
  17474. }
  17475. });
  17476. const validatedRange = vue.computed(() => {
  17477. if (!props.range)
  17478. return [];
  17479. const rangeArrDayjs = props.range.map((_) => dayjs(_).locale(lang.value));
  17480. const [startDayjs, endDayjs] = rangeArrDayjs;
  17481. if (startDayjs.isAfter(endDayjs)) {
  17482. return [];
  17483. }
  17484. if (startDayjs.isSame(endDayjs, "month")) {
  17485. return calculateValidatedDateRange(startDayjs, endDayjs);
  17486. } else {
  17487. if (startDayjs.add(1, "month").month() !== endDayjs.month()) {
  17488. return [];
  17489. }
  17490. return calculateValidatedDateRange(startDayjs, endDayjs);
  17491. }
  17492. });
  17493. const date = vue.computed(() => {
  17494. if (!props.modelValue) {
  17495. return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
  17496. } else {
  17497. return dayjs(props.modelValue).locale(lang.value);
  17498. }
  17499. });
  17500. const prevMonthDayjs = vue.computed(() => date.value.subtract(1, "month").date(1));
  17501. const nextMonthDayjs = vue.computed(() => date.value.add(1, "month").date(1));
  17502. const prevYearDayjs = vue.computed(() => date.value.subtract(1, "year").date(1));
  17503. const nextYearDayjs = vue.computed(() => date.value.add(1, "year").date(1));
  17504. const calculateValidatedDateRange = (startDayjs, endDayjs) => {
  17505. const firstDay = startDayjs.startOf("week");
  17506. const lastDay = endDayjs.endOf("week");
  17507. const firstMonth = firstDay.get("month");
  17508. const lastMonth = lastDay.get("month");
  17509. if (firstMonth === lastMonth) {
  17510. return [[firstDay, lastDay]];
  17511. } else if ((firstMonth + 1) % 12 === lastMonth) {
  17512. return adjacentMonth(firstDay, lastDay);
  17513. } else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) {
  17514. return threeConsecutiveMonth(firstDay, lastDay);
  17515. } else {
  17516. return [];
  17517. }
  17518. };
  17519. const pickDay = (day) => {
  17520. realSelectedDay.value = day;
  17521. };
  17522. const selectDate = (type) => {
  17523. const dateMap = {
  17524. "prev-month": prevMonthDayjs.value,
  17525. "next-month": nextMonthDayjs.value,
  17526. "prev-year": prevYearDayjs.value,
  17527. "next-year": nextYearDayjs.value,
  17528. today: now
  17529. };
  17530. const day = dateMap[type];
  17531. if (!day.isSame(date.value, "day")) {
  17532. pickDay(day);
  17533. }
  17534. };
  17535. useDeprecated({
  17536. from: '"dateCell"',
  17537. replacement: '"date-cell"',
  17538. scope: "ElCalendar",
  17539. version: "2.3.0",
  17540. ref: "https://element-plus.org/en-US/component/calendar.html#slots",
  17541. type: "Slot"
  17542. }, vue.computed(() => !!slots.dateCell));
  17543. return {
  17544. calculateValidatedDateRange,
  17545. date,
  17546. realSelectedDay,
  17547. pickDay,
  17548. selectDate,
  17549. validatedRange
  17550. };
  17551. };
  17552. const isValidRange$1 = (range) => isArray(range) && range.length === 2 && range.every((item) => isDate(item));
  17553. const calendarProps = buildProps({
  17554. modelValue: {
  17555. type: Date
  17556. },
  17557. range: {
  17558. type: definePropType(Array),
  17559. validator: isValidRange$1
  17560. }
  17561. });
  17562. const calendarEmits = {
  17563. [UPDATE_MODEL_EVENT]: (value) => isDate(value),
  17564. [INPUT_EVENT]: (value) => isDate(value)
  17565. };
  17566. const COMPONENT_NAME$h = "ElCalendar";
  17567. const __default__$1a = vue.defineComponent({
  17568. name: COMPONENT_NAME$h
  17569. });
  17570. const _sfc_main$1P = /* @__PURE__ */ vue.defineComponent({
  17571. ...__default__$1a,
  17572. props: calendarProps,
  17573. emits: calendarEmits,
  17574. setup(__props, { expose, emit }) {
  17575. const props = __props;
  17576. const ns = useNamespace("calendar");
  17577. const {
  17578. calculateValidatedDateRange,
  17579. date,
  17580. pickDay,
  17581. realSelectedDay,
  17582. selectDate,
  17583. validatedRange
  17584. } = useCalendar(props, emit);
  17585. const { t } = useLocale();
  17586. const i18nDate = vue.computed(() => {
  17587. const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
  17588. return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
  17589. });
  17590. expose({
  17591. selectedDay: realSelectedDay,
  17592. pickDay,
  17593. selectDate,
  17594. calculateValidatedDateRange
  17595. });
  17596. return (_ctx, _cache) => {
  17597. return vue.openBlock(), vue.createElementBlock("div", {
  17598. class: vue.normalizeClass(vue.unref(ns).b())
  17599. }, [
  17600. vue.createElementVNode("div", {
  17601. class: vue.normalizeClass(vue.unref(ns).e("header"))
  17602. }, [
  17603. vue.renderSlot(_ctx.$slots, "header", { date: vue.unref(i18nDate) }, () => [
  17604. vue.createElementVNode("div", {
  17605. class: vue.normalizeClass(vue.unref(ns).e("title"))
  17606. }, vue.toDisplayString(vue.unref(i18nDate)), 3),
  17607. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  17608. key: 0,
  17609. class: vue.normalizeClass(vue.unref(ns).e("button-group"))
  17610. }, [
  17611. vue.createVNode(vue.unref(ElButtonGroup$1), null, {
  17612. default: vue.withCtx(() => [
  17613. vue.createVNode(vue.unref(ElButton), {
  17614. size: "small",
  17615. onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(selectDate)("prev-month"))
  17616. }, {
  17617. default: vue.withCtx(() => [
  17618. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.prevMonth")), 1)
  17619. ]),
  17620. _: 1
  17621. }),
  17622. vue.createVNode(vue.unref(ElButton), {
  17623. size: "small",
  17624. onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(selectDate)("today"))
  17625. }, {
  17626. default: vue.withCtx(() => [
  17627. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.today")), 1)
  17628. ]),
  17629. _: 1
  17630. }),
  17631. vue.createVNode(vue.unref(ElButton), {
  17632. size: "small",
  17633. onClick: _cache[2] || (_cache[2] = ($event) => vue.unref(selectDate)("next-month"))
  17634. }, {
  17635. default: vue.withCtx(() => [
  17636. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.nextMonth")), 1)
  17637. ]),
  17638. _: 1
  17639. })
  17640. ]),
  17641. _: 1
  17642. })
  17643. ], 2)) : vue.createCommentVNode("v-if", true)
  17644. ])
  17645. ], 2),
  17646. vue.unref(validatedRange).length === 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  17647. key: 0,
  17648. class: vue.normalizeClass(vue.unref(ns).e("body"))
  17649. }, [
  17650. vue.createVNode(DateTable$1, {
  17651. date: vue.unref(date),
  17652. "selected-day": vue.unref(realSelectedDay),
  17653. onPick: vue.unref(pickDay)
  17654. }, vue.createSlots({ _: 2 }, [
  17655. _ctx.$slots["date-cell"] || _ctx.$slots.dateCell ? {
  17656. name: "date-cell",
  17657. fn: vue.withCtx((data) => [
  17658. _ctx.$slots["date-cell"] ? vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.mergeProps({ key: 0 }, data))) : vue.renderSlot(_ctx.$slots, "dateCell", vue.normalizeProps(vue.mergeProps({ key: 1 }, data)))
  17659. ])
  17660. } : void 0
  17661. ]), 1032, ["date", "selected-day", "onPick"])
  17662. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  17663. key: 1,
  17664. class: vue.normalizeClass(vue.unref(ns).e("body"))
  17665. }, [
  17666. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(validatedRange), (range_, index) => {
  17667. return vue.openBlock(), vue.createBlock(DateTable$1, {
  17668. key: index,
  17669. date: range_[0],
  17670. "selected-day": vue.unref(realSelectedDay),
  17671. range: range_,
  17672. "hide-header": index !== 0,
  17673. onPick: vue.unref(pickDay)
  17674. }, vue.createSlots({ _: 2 }, [
  17675. _ctx.$slots["date-cell"] || _ctx.$slots.dateCell ? {
  17676. name: "date-cell",
  17677. fn: vue.withCtx((data) => [
  17678. _ctx.$slots["date-cell"] ? vue.renderSlot(_ctx.$slots, "date-cell", vue.normalizeProps(vue.mergeProps({ key: 0 }, data))) : vue.renderSlot(_ctx.$slots, "dateCell", vue.normalizeProps(vue.mergeProps({ key: 1 }, data)))
  17679. ])
  17680. } : void 0
  17681. ]), 1032, ["date", "selected-day", "range", "hide-header", "onPick"]);
  17682. }), 128))
  17683. ], 2))
  17684. ], 2);
  17685. };
  17686. }
  17687. });
  17688. var Calendar = /* @__PURE__ */ _export_sfc(_sfc_main$1P, [["__file", "calendar.vue"]]);
  17689. const ElCalendar = withInstall(Calendar);
  17690. const cardProps = buildProps({
  17691. header: {
  17692. type: String,
  17693. default: ""
  17694. },
  17695. bodyStyle: {
  17696. type: definePropType([String, Object, Array]),
  17697. default: ""
  17698. },
  17699. shadow: {
  17700. type: String,
  17701. values: ["always", "hover", "never"],
  17702. default: "always"
  17703. }
  17704. });
  17705. const __default__$19 = vue.defineComponent({
  17706. name: "ElCard"
  17707. });
  17708. const _sfc_main$1O = /* @__PURE__ */ vue.defineComponent({
  17709. ...__default__$19,
  17710. props: cardProps,
  17711. setup(__props) {
  17712. const ns = useNamespace("card");
  17713. return (_ctx, _cache) => {
  17714. return vue.openBlock(), vue.createElementBlock("div", {
  17715. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is(`${_ctx.shadow}-shadow`)])
  17716. }, [
  17717. _ctx.$slots.header || _ctx.header ? (vue.openBlock(), vue.createElementBlock("div", {
  17718. key: 0,
  17719. class: vue.normalizeClass(vue.unref(ns).e("header"))
  17720. }, [
  17721. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  17722. vue.createTextVNode(vue.toDisplayString(_ctx.header), 1)
  17723. ])
  17724. ], 2)) : vue.createCommentVNode("v-if", true),
  17725. vue.createElementVNode("div", {
  17726. class: vue.normalizeClass(vue.unref(ns).e("body")),
  17727. style: vue.normalizeStyle(_ctx.bodyStyle)
  17728. }, [
  17729. vue.renderSlot(_ctx.$slots, "default")
  17730. ], 6)
  17731. ], 2);
  17732. };
  17733. }
  17734. });
  17735. var Card = /* @__PURE__ */ _export_sfc(_sfc_main$1O, [["__file", "card.vue"]]);
  17736. const ElCard = withInstall(Card);
  17737. const carouselProps = buildProps({
  17738. initialIndex: {
  17739. type: Number,
  17740. default: 0
  17741. },
  17742. height: {
  17743. type: String,
  17744. default: ""
  17745. },
  17746. trigger: {
  17747. type: String,
  17748. values: ["hover", "click"],
  17749. default: "hover"
  17750. },
  17751. autoplay: {
  17752. type: Boolean,
  17753. default: true
  17754. },
  17755. interval: {
  17756. type: Number,
  17757. default: 3e3
  17758. },
  17759. indicatorPosition: {
  17760. type: String,
  17761. values: ["", "none", "outside"],
  17762. default: ""
  17763. },
  17764. indicator: {
  17765. type: Boolean,
  17766. default: true
  17767. },
  17768. arrow: {
  17769. type: String,
  17770. values: ["always", "hover", "never"],
  17771. default: "hover"
  17772. },
  17773. type: {
  17774. type: String,
  17775. values: ["", "card"],
  17776. default: ""
  17777. },
  17778. loop: {
  17779. type: Boolean,
  17780. default: true
  17781. },
  17782. direction: {
  17783. type: String,
  17784. values: ["horizontal", "vertical"],
  17785. default: "horizontal"
  17786. },
  17787. pauseOnHover: {
  17788. type: Boolean,
  17789. default: true
  17790. }
  17791. });
  17792. const carouselEmits = {
  17793. change: (current, prev) => [current, prev].every(isNumber)
  17794. };
  17795. const THROTTLE_TIME = 300;
  17796. const useCarousel = (props, emit, componentName) => {
  17797. const {
  17798. children: items,
  17799. addChild: addItem,
  17800. removeChild: removeItem
  17801. } = useOrderedChildren(vue.getCurrentInstance(), "ElCarouselItem");
  17802. const activeIndex = vue.ref(-1);
  17803. const timer = vue.ref(null);
  17804. const hover = vue.ref(false);
  17805. const root = vue.ref();
  17806. const arrowDisplay = vue.computed(() => props.arrow !== "never" && !vue.unref(isVertical));
  17807. const hasLabel = vue.computed(() => {
  17808. return items.value.some((item) => item.props.label.toString().length > 0);
  17809. });
  17810. const isCardType = vue.computed(() => props.type === "card");
  17811. const isVertical = vue.computed(() => props.direction === "vertical");
  17812. const throttledArrowClick = throttle((index) => {
  17813. setActiveItem(index);
  17814. }, THROTTLE_TIME, { trailing: true });
  17815. const throttledIndicatorHover = throttle((index) => {
  17816. handleIndicatorHover(index);
  17817. }, THROTTLE_TIME);
  17818. function pauseTimer() {
  17819. if (timer.value) {
  17820. clearInterval(timer.value);
  17821. timer.value = null;
  17822. }
  17823. }
  17824. function startTimer() {
  17825. if (props.interval <= 0 || !props.autoplay || timer.value)
  17826. return;
  17827. timer.value = setInterval(() => playSlides(), props.interval);
  17828. }
  17829. const playSlides = () => {
  17830. if (activeIndex.value < items.value.length - 1) {
  17831. activeIndex.value = activeIndex.value + 1;
  17832. } else if (props.loop) {
  17833. activeIndex.value = 0;
  17834. }
  17835. };
  17836. function setActiveItem(index) {
  17837. if (isString(index)) {
  17838. const filteredItems = items.value.filter((item) => item.props.name === index);
  17839. if (filteredItems.length > 0) {
  17840. index = items.value.indexOf(filteredItems[0]);
  17841. }
  17842. }
  17843. index = Number(index);
  17844. if (Number.isNaN(index) || index !== Math.floor(index)) {
  17845. return;
  17846. }
  17847. const itemCount = items.value.length;
  17848. const oldIndex = activeIndex.value;
  17849. if (index < 0) {
  17850. activeIndex.value = props.loop ? itemCount - 1 : 0;
  17851. } else if (index >= itemCount) {
  17852. activeIndex.value = props.loop ? 0 : itemCount - 1;
  17853. } else {
  17854. activeIndex.value = index;
  17855. }
  17856. if (oldIndex === activeIndex.value) {
  17857. resetItemPosition(oldIndex);
  17858. }
  17859. resetTimer();
  17860. }
  17861. function resetItemPosition(oldIndex) {
  17862. items.value.forEach((item, index) => {
  17863. item.translateItem(index, activeIndex.value, oldIndex);
  17864. });
  17865. }
  17866. function itemInStage(item, index) {
  17867. var _a, _b, _c, _d;
  17868. const _items = vue.unref(items);
  17869. const itemCount = _items.length;
  17870. if (itemCount === 0 || !item.states.inStage)
  17871. return false;
  17872. const nextItemIndex = index + 1;
  17873. const prevItemIndex = index - 1;
  17874. const lastItemIndex = itemCount - 1;
  17875. const isLastItemActive = _items[lastItemIndex].states.active;
  17876. const isFirstItemActive = _items[0].states.active;
  17877. const isNextItemActive = (_b = (_a = _items[nextItemIndex]) == null ? void 0 : _a.states) == null ? void 0 : _b.active;
  17878. const isPrevItemActive = (_d = (_c = _items[prevItemIndex]) == null ? void 0 : _c.states) == null ? void 0 : _d.active;
  17879. if (index === lastItemIndex && isFirstItemActive || isNextItemActive) {
  17880. return "left";
  17881. } else if (index === 0 && isLastItemActive || isPrevItemActive) {
  17882. return "right";
  17883. }
  17884. return false;
  17885. }
  17886. function handleMouseEnter() {
  17887. hover.value = true;
  17888. if (props.pauseOnHover) {
  17889. pauseTimer();
  17890. }
  17891. }
  17892. function handleMouseLeave() {
  17893. hover.value = false;
  17894. startTimer();
  17895. }
  17896. function handleButtonEnter(arrow) {
  17897. if (vue.unref(isVertical))
  17898. return;
  17899. items.value.forEach((item, index) => {
  17900. if (arrow === itemInStage(item, index)) {
  17901. item.states.hover = true;
  17902. }
  17903. });
  17904. }
  17905. function handleButtonLeave() {
  17906. if (vue.unref(isVertical))
  17907. return;
  17908. items.value.forEach((item) => {
  17909. item.states.hover = false;
  17910. });
  17911. }
  17912. function handleIndicatorClick(index) {
  17913. activeIndex.value = index;
  17914. }
  17915. function handleIndicatorHover(index) {
  17916. if (props.trigger === "hover" && index !== activeIndex.value) {
  17917. activeIndex.value = index;
  17918. }
  17919. }
  17920. function prev() {
  17921. setActiveItem(activeIndex.value - 1);
  17922. }
  17923. function next() {
  17924. setActiveItem(activeIndex.value + 1);
  17925. }
  17926. function resetTimer() {
  17927. pauseTimer();
  17928. startTimer();
  17929. }
  17930. vue.watch(() => activeIndex.value, (current, prev2) => {
  17931. resetItemPosition(prev2);
  17932. if (prev2 > -1) {
  17933. emit("change", current, prev2);
  17934. }
  17935. });
  17936. vue.watch(() => props.autoplay, (autoplay) => {
  17937. autoplay ? startTimer() : pauseTimer();
  17938. });
  17939. vue.watch(() => props.loop, () => {
  17940. setActiveItem(activeIndex.value);
  17941. });
  17942. vue.watch(() => props.interval, () => {
  17943. resetTimer();
  17944. });
  17945. vue.watch(() => items.value, () => {
  17946. if (items.value.length > 0)
  17947. setActiveItem(props.initialIndex);
  17948. });
  17949. const resizeObserver = vue.shallowRef();
  17950. vue.onMounted(() => {
  17951. resizeObserver.value = useResizeObserver(root.value, () => {
  17952. resetItemPosition();
  17953. });
  17954. startTimer();
  17955. });
  17956. vue.onBeforeUnmount(() => {
  17957. pauseTimer();
  17958. if (root.value && resizeObserver.value)
  17959. resizeObserver.value.stop();
  17960. });
  17961. vue.provide(carouselContextKey, {
  17962. root,
  17963. isCardType,
  17964. isVertical,
  17965. items,
  17966. loop: props.loop,
  17967. addItem,
  17968. removeItem,
  17969. setActiveItem
  17970. });
  17971. return {
  17972. root,
  17973. activeIndex,
  17974. arrowDisplay,
  17975. hasLabel,
  17976. hover,
  17977. isCardType,
  17978. items,
  17979. handleButtonEnter,
  17980. handleButtonLeave,
  17981. handleIndicatorClick,
  17982. handleMouseEnter,
  17983. handleMouseLeave,
  17984. setActiveItem,
  17985. prev,
  17986. next,
  17987. throttledArrowClick,
  17988. throttledIndicatorHover
  17989. };
  17990. };
  17991. const _hoisted_1$V = ["onMouseenter", "onClick"];
  17992. const _hoisted_2$A = { key: 0 };
  17993. const COMPONENT_NAME$g = "ElCarousel";
  17994. const __default__$18 = vue.defineComponent({
  17995. name: COMPONENT_NAME$g
  17996. });
  17997. const _sfc_main$1N = /* @__PURE__ */ vue.defineComponent({
  17998. ...__default__$18,
  17999. props: carouselProps,
  18000. emits: carouselEmits,
  18001. setup(__props, { expose, emit }) {
  18002. const props = __props;
  18003. const {
  18004. root,
  18005. activeIndex,
  18006. arrowDisplay,
  18007. hasLabel,
  18008. hover,
  18009. isCardType,
  18010. items,
  18011. handleButtonEnter,
  18012. handleButtonLeave,
  18013. handleIndicatorClick,
  18014. handleMouseEnter,
  18015. handleMouseLeave,
  18016. setActiveItem,
  18017. prev,
  18018. next,
  18019. throttledArrowClick,
  18020. throttledIndicatorHover
  18021. } = useCarousel(props, emit);
  18022. const ns = useNamespace("carousel");
  18023. const carouselClasses = vue.computed(() => {
  18024. const classes = [ns.b(), ns.m(props.direction)];
  18025. if (vue.unref(isCardType)) {
  18026. classes.push(ns.m("card"));
  18027. }
  18028. return classes;
  18029. });
  18030. const indicatorsClasses = vue.computed(() => {
  18031. const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
  18032. if (vue.unref(hasLabel)) {
  18033. classes.push(ns.em("indicators", "labels"));
  18034. }
  18035. if (props.indicatorPosition === "outside" || vue.unref(isCardType)) {
  18036. classes.push(ns.em("indicators", "outside"));
  18037. }
  18038. return classes;
  18039. });
  18040. expose({
  18041. setActiveItem,
  18042. prev,
  18043. next
  18044. });
  18045. return (_ctx, _cache) => {
  18046. return vue.openBlock(), vue.createElementBlock("div", {
  18047. ref_key: "root",
  18048. ref: root,
  18049. class: vue.normalizeClass(vue.unref(carouselClasses)),
  18050. onMouseenter: _cache[6] || (_cache[6] = vue.withModifiers((...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args), ["stop"])),
  18051. onMouseleave: _cache[7] || (_cache[7] = vue.withModifiers((...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args), ["stop"]))
  18052. }, [
  18053. vue.createElementVNode("div", {
  18054. class: vue.normalizeClass(vue.unref(ns).e("container")),
  18055. style: vue.normalizeStyle({ height: _ctx.height })
  18056. }, [
  18057. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  18058. key: 0,
  18059. name: "carousel-arrow-left",
  18060. persisted: ""
  18061. }, {
  18062. default: vue.withCtx(() => [
  18063. vue.withDirectives(vue.createElementVNode("button", {
  18064. type: "button",
  18065. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "left")]),
  18066. onMouseenter: _cache[0] || (_cache[0] = ($event) => vue.unref(handleButtonEnter)("left")),
  18067. onMouseleave: _cache[1] || (_cache[1] = (...args) => vue.unref(handleButtonLeave) && vue.unref(handleButtonLeave)(...args)),
  18068. onClick: _cache[2] || (_cache[2] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) - 1), ["stop"]))
  18069. }, [
  18070. vue.createVNode(vue.unref(ElIcon), null, {
  18071. default: vue.withCtx(() => [
  18072. vue.createVNode(vue.unref(arrow_left_default))
  18073. ]),
  18074. _: 1
  18075. })
  18076. ], 34), [
  18077. [
  18078. vue.vShow,
  18079. (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) > 0)
  18080. ]
  18081. ])
  18082. ]),
  18083. _: 1
  18084. })) : vue.createCommentVNode("v-if", true),
  18085. vue.unref(arrowDisplay) ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  18086. key: 1,
  18087. name: "carousel-arrow-right",
  18088. persisted: ""
  18089. }, {
  18090. default: vue.withCtx(() => [
  18091. vue.withDirectives(vue.createElementVNode("button", {
  18092. type: "button",
  18093. class: vue.normalizeClass([vue.unref(ns).e("arrow"), vue.unref(ns).em("arrow", "right")]),
  18094. onMouseenter: _cache[3] || (_cache[3] = ($event) => vue.unref(handleButtonEnter)("right")),
  18095. onMouseleave: _cache[4] || (_cache[4] = (...args) => vue.unref(handleButtonLeave) && vue.unref(handleButtonLeave)(...args)),
  18096. onClick: _cache[5] || (_cache[5] = vue.withModifiers(($event) => vue.unref(throttledArrowClick)(vue.unref(activeIndex) + 1), ["stop"]))
  18097. }, [
  18098. vue.createVNode(vue.unref(ElIcon), null, {
  18099. default: vue.withCtx(() => [
  18100. vue.createVNode(vue.unref(arrow_right_default))
  18101. ]),
  18102. _: 1
  18103. })
  18104. ], 34), [
  18105. [
  18106. vue.vShow,
  18107. (_ctx.arrow === "always" || vue.unref(hover)) && (props.loop || vue.unref(activeIndex) < vue.unref(items).length - 1)
  18108. ]
  18109. ])
  18110. ]),
  18111. _: 1
  18112. })) : vue.createCommentVNode("v-if", true),
  18113. vue.renderSlot(_ctx.$slots, "default")
  18114. ], 6),
  18115. _ctx.indicatorPosition !== "none" ? (vue.openBlock(), vue.createElementBlock("ul", {
  18116. key: 0,
  18117. class: vue.normalizeClass(vue.unref(indicatorsClasses))
  18118. }, [
  18119. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item, index) => {
  18120. return vue.openBlock(), vue.createElementBlock("li", {
  18121. key: index,
  18122. class: vue.normalizeClass([
  18123. vue.unref(ns).e("indicator"),
  18124. vue.unref(ns).em("indicator", _ctx.direction),
  18125. vue.unref(ns).is("active", index === vue.unref(activeIndex))
  18126. ]),
  18127. onMouseenter: ($event) => vue.unref(throttledIndicatorHover)(index),
  18128. onClick: vue.withModifiers(($event) => vue.unref(handleIndicatorClick)(index), ["stop"])
  18129. }, [
  18130. vue.createElementVNode("button", {
  18131. class: vue.normalizeClass(vue.unref(ns).e("button"))
  18132. }, [
  18133. vue.unref(hasLabel) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$A, vue.toDisplayString(item.props.label), 1)) : vue.createCommentVNode("v-if", true)
  18134. ], 2)
  18135. ], 42, _hoisted_1$V);
  18136. }), 128))
  18137. ], 2)) : vue.createCommentVNode("v-if", true)
  18138. ], 34);
  18139. };
  18140. }
  18141. });
  18142. var Carousel = /* @__PURE__ */ _export_sfc(_sfc_main$1N, [["__file", "carousel.vue"]]);
  18143. const carouselItemProps = buildProps({
  18144. name: { type: String, default: "" },
  18145. label: {
  18146. type: [String, Number],
  18147. default: ""
  18148. }
  18149. });
  18150. const useCarouselItem = (props, componentName) => {
  18151. const carouselContext = vue.inject(carouselContextKey);
  18152. const instance = vue.getCurrentInstance();
  18153. const CARD_SCALE = 0.83;
  18154. const hover = vue.ref(false);
  18155. const translate = vue.ref(0);
  18156. const scale = vue.ref(1);
  18157. const active = vue.ref(false);
  18158. const ready = vue.ref(false);
  18159. const inStage = vue.ref(false);
  18160. const animating = vue.ref(false);
  18161. const { isCardType, isVertical } = carouselContext;
  18162. function processIndex(index, activeIndex, length) {
  18163. const lastItemIndex = length - 1;
  18164. const prevItemIndex = activeIndex - 1;
  18165. const nextItemIndex = activeIndex + 1;
  18166. const halfItemIndex = length / 2;
  18167. if (activeIndex === 0 && index === lastItemIndex) {
  18168. return -1;
  18169. } else if (activeIndex === lastItemIndex && index === 0) {
  18170. return length;
  18171. } else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) {
  18172. return length + 1;
  18173. } else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) {
  18174. return -2;
  18175. }
  18176. return index;
  18177. }
  18178. function calcCardTranslate(index, activeIndex) {
  18179. var _a;
  18180. const parentWidth = ((_a = carouselContext.root.value) == null ? void 0 : _a.offsetWidth) || 0;
  18181. if (inStage.value) {
  18182. return parentWidth * ((2 - CARD_SCALE) * (index - activeIndex) + 1) / 4;
  18183. } else if (index < activeIndex) {
  18184. return -(1 + CARD_SCALE) * parentWidth / 4;
  18185. } else {
  18186. return (3 + CARD_SCALE) * parentWidth / 4;
  18187. }
  18188. }
  18189. function calcTranslate(index, activeIndex, isVertical2) {
  18190. const rootEl = carouselContext.root.value;
  18191. if (!rootEl)
  18192. return 0;
  18193. const distance = (isVertical2 ? rootEl.offsetHeight : rootEl.offsetWidth) || 0;
  18194. return distance * (index - activeIndex);
  18195. }
  18196. const translateItem = (index, activeIndex, oldIndex) => {
  18197. var _a;
  18198. const _isCardType = vue.unref(isCardType);
  18199. const carouselItemLength = (_a = carouselContext.items.value.length) != null ? _a : Number.NaN;
  18200. const isActive = index === activeIndex;
  18201. if (!_isCardType && !isUndefined(oldIndex)) {
  18202. animating.value = isActive || index === oldIndex;
  18203. }
  18204. if (!isActive && carouselItemLength > 2 && carouselContext.loop) {
  18205. index = processIndex(index, activeIndex, carouselItemLength);
  18206. }
  18207. const _isVertical = vue.unref(isVertical);
  18208. active.value = isActive;
  18209. if (_isCardType) {
  18210. inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
  18211. translate.value = calcCardTranslate(index, activeIndex);
  18212. scale.value = vue.unref(active) ? 1 : CARD_SCALE;
  18213. } else {
  18214. translate.value = calcTranslate(index, activeIndex, _isVertical);
  18215. }
  18216. ready.value = true;
  18217. };
  18218. function handleItemClick() {
  18219. if (carouselContext && vue.unref(isCardType)) {
  18220. const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
  18221. carouselContext.setActiveItem(index);
  18222. }
  18223. }
  18224. vue.onMounted(() => {
  18225. carouselContext.addItem({
  18226. props,
  18227. states: vue.reactive({
  18228. hover,
  18229. translate,
  18230. scale,
  18231. active,
  18232. ready,
  18233. inStage,
  18234. animating
  18235. }),
  18236. uid: instance.uid,
  18237. translateItem
  18238. });
  18239. });
  18240. vue.onUnmounted(() => {
  18241. carouselContext.removeItem(instance.uid);
  18242. });
  18243. return {
  18244. active,
  18245. animating,
  18246. hover,
  18247. inStage,
  18248. isVertical,
  18249. translate,
  18250. isCardType,
  18251. scale,
  18252. ready,
  18253. handleItemClick
  18254. };
  18255. };
  18256. const __default__$17 = vue.defineComponent({
  18257. name: "ElCarouselItem"
  18258. });
  18259. const _sfc_main$1M = /* @__PURE__ */ vue.defineComponent({
  18260. ...__default__$17,
  18261. props: carouselItemProps,
  18262. setup(__props) {
  18263. const props = __props;
  18264. const ns = useNamespace("carousel");
  18265. const {
  18266. active,
  18267. animating,
  18268. hover,
  18269. inStage,
  18270. isVertical,
  18271. translate,
  18272. isCardType,
  18273. scale,
  18274. ready,
  18275. handleItemClick
  18276. } = useCarouselItem(props);
  18277. const itemStyle = vue.computed(() => {
  18278. const translateType = `translate${vue.unref(isVertical) ? "Y" : "X"}`;
  18279. const _translate = `${translateType}(${vue.unref(translate)}px)`;
  18280. const _scale = `scale(${vue.unref(scale)})`;
  18281. const transform = [_translate, _scale].join(" ");
  18282. return {
  18283. transform
  18284. };
  18285. });
  18286. return (_ctx, _cache) => {
  18287. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  18288. class: vue.normalizeClass([
  18289. vue.unref(ns).e("item"),
  18290. vue.unref(ns).is("active", vue.unref(active)),
  18291. vue.unref(ns).is("in-stage", vue.unref(inStage)),
  18292. vue.unref(ns).is("hover", vue.unref(hover)),
  18293. vue.unref(ns).is("animating", vue.unref(animating)),
  18294. { [vue.unref(ns).em("item", "card")]: vue.unref(isCardType) }
  18295. ]),
  18296. style: vue.normalizeStyle(vue.unref(itemStyle)),
  18297. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleItemClick) && vue.unref(handleItemClick)(...args))
  18298. }, [
  18299. vue.unref(isCardType) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  18300. key: 0,
  18301. class: vue.normalizeClass(vue.unref(ns).e("mask"))
  18302. }, null, 2)), [
  18303. [vue.vShow, !vue.unref(active)]
  18304. ]) : vue.createCommentVNode("v-if", true),
  18305. vue.renderSlot(_ctx.$slots, "default")
  18306. ], 6)), [
  18307. [vue.vShow, vue.unref(ready)]
  18308. ]);
  18309. };
  18310. }
  18311. });
  18312. var CarouselItem = /* @__PURE__ */ _export_sfc(_sfc_main$1M, [["__file", "carousel-item.vue"]]);
  18313. const ElCarousel = withInstall(Carousel, {
  18314. CarouselItem
  18315. });
  18316. const ElCarouselItem = withNoopInstall(CarouselItem);
  18317. const checkboxProps = {
  18318. modelValue: {
  18319. type: [Number, String, Boolean],
  18320. default: void 0
  18321. },
  18322. label: {
  18323. type: [String, Boolean, Number, Object]
  18324. },
  18325. indeterminate: Boolean,
  18326. disabled: Boolean,
  18327. checked: Boolean,
  18328. name: {
  18329. type: String,
  18330. default: void 0
  18331. },
  18332. trueLabel: {
  18333. type: [String, Number],
  18334. default: void 0
  18335. },
  18336. falseLabel: {
  18337. type: [String, Number],
  18338. default: void 0
  18339. },
  18340. id: {
  18341. type: String,
  18342. default: void 0
  18343. },
  18344. controls: {
  18345. type: String,
  18346. default: void 0
  18347. },
  18348. border: Boolean,
  18349. size: useSizeProp,
  18350. tabindex: [String, Number],
  18351. validateEvent: {
  18352. type: Boolean,
  18353. default: true
  18354. }
  18355. };
  18356. const checkboxEmits = {
  18357. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  18358. change: (val) => isString(val) || isNumber(val) || isBoolean(val)
  18359. };
  18360. const useCheckboxDisabled = ({
  18361. model,
  18362. isChecked
  18363. }) => {
  18364. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  18365. const isLimitDisabled = vue.computed(() => {
  18366. var _a, _b;
  18367. const max = (_a = checkboxGroup == null ? void 0 : checkboxGroup.max) == null ? void 0 : _a.value;
  18368. const min = (_b = checkboxGroup == null ? void 0 : checkboxGroup.min) == null ? void 0 : _b.value;
  18369. return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
  18370. });
  18371. const isDisabled = useDisabled(vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.disabled.value) || isLimitDisabled.value));
  18372. return {
  18373. isDisabled,
  18374. isLimitDisabled
  18375. };
  18376. };
  18377. const useCheckboxEvent = (props, {
  18378. model,
  18379. isLimitExceeded,
  18380. hasOwnLabel,
  18381. isDisabled,
  18382. isLabeledByFormItem
  18383. }) => {
  18384. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  18385. const { formItem } = useFormItem();
  18386. const { emit } = vue.getCurrentInstance();
  18387. function getLabeledValue(value) {
  18388. var _a, _b;
  18389. return value === props.trueLabel || value === true ? (_a = props.trueLabel) != null ? _a : true : (_b = props.falseLabel) != null ? _b : false;
  18390. }
  18391. function emitChangeEvent(checked, e) {
  18392. emit("change", getLabeledValue(checked), e);
  18393. }
  18394. function handleChange(e) {
  18395. if (isLimitExceeded.value)
  18396. return;
  18397. const target = e.target;
  18398. emit("change", getLabeledValue(target.checked), e);
  18399. }
  18400. async function onClickRoot(e) {
  18401. if (isLimitExceeded.value)
  18402. return;
  18403. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  18404. const eventTargets = e.composedPath();
  18405. const hasLabel = eventTargets.some((item) => item.tagName === "LABEL");
  18406. if (!hasLabel) {
  18407. model.value = getLabeledValue([false, props.falseLabel].includes(model.value));
  18408. await vue.nextTick();
  18409. emitChangeEvent(model.value, e);
  18410. }
  18411. }
  18412. }
  18413. const validateEvent = vue.computed(() => (checkboxGroup == null ? void 0 : checkboxGroup.validateEvent) || props.validateEvent);
  18414. vue.watch(() => props.modelValue, () => {
  18415. if (validateEvent.value) {
  18416. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  18417. }
  18418. });
  18419. return {
  18420. handleChange,
  18421. onClickRoot
  18422. };
  18423. };
  18424. const useCheckboxModel = (props) => {
  18425. const selfModel = vue.ref(false);
  18426. const { emit } = vue.getCurrentInstance();
  18427. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  18428. const isGroup = vue.computed(() => isUndefined(checkboxGroup) === false);
  18429. const isLimitExceeded = vue.ref(false);
  18430. const model = vue.computed({
  18431. get() {
  18432. var _a, _b;
  18433. return isGroup.value ? (_a = checkboxGroup == null ? void 0 : checkboxGroup.modelValue) == null ? void 0 : _a.value : (_b = props.modelValue) != null ? _b : selfModel.value;
  18434. },
  18435. set(val) {
  18436. var _a, _b;
  18437. if (isGroup.value && isArray(val)) {
  18438. 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);
  18439. isLimitExceeded.value === false && ((_b = checkboxGroup == null ? void 0 : checkboxGroup.changeEvent) == null ? void 0 : _b.call(checkboxGroup, val));
  18440. } else {
  18441. emit(UPDATE_MODEL_EVENT, val);
  18442. selfModel.value = val;
  18443. }
  18444. }
  18445. });
  18446. return {
  18447. model,
  18448. isGroup,
  18449. isLimitExceeded
  18450. };
  18451. };
  18452. const useCheckboxStatus = (props, slots, { model }) => {
  18453. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  18454. const isFocused = vue.ref(false);
  18455. const isChecked = vue.computed(() => {
  18456. const value = model.value;
  18457. if (isBoolean(value)) {
  18458. return value;
  18459. } else if (isArray(value)) {
  18460. if (isObject$1(props.label)) {
  18461. return value.map(vue.toRaw).some((o) => isEqual$1(o, props.label));
  18462. } else {
  18463. return value.map(vue.toRaw).includes(props.label);
  18464. }
  18465. } else if (value !== null && value !== void 0) {
  18466. return value === props.trueLabel;
  18467. } else {
  18468. return !!value;
  18469. }
  18470. });
  18471. const checkboxButtonSize = useSize(vue.computed(() => {
  18472. var _a;
  18473. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  18474. }), {
  18475. prop: true
  18476. });
  18477. const checkboxSize = useSize(vue.computed(() => {
  18478. var _a;
  18479. return (_a = checkboxGroup == null ? void 0 : checkboxGroup.size) == null ? void 0 : _a.value;
  18480. }));
  18481. const hasOwnLabel = vue.computed(() => {
  18482. return !!(slots.default || props.label);
  18483. });
  18484. return {
  18485. checkboxButtonSize,
  18486. isChecked,
  18487. isFocused,
  18488. checkboxSize,
  18489. hasOwnLabel
  18490. };
  18491. };
  18492. const setStoreValue = (props, { model }) => {
  18493. function addToStore() {
  18494. if (isArray(model.value) && !model.value.includes(props.label)) {
  18495. model.value.push(props.label);
  18496. } else {
  18497. model.value = props.trueLabel || true;
  18498. }
  18499. }
  18500. props.checked && addToStore();
  18501. };
  18502. const useCheckbox = (props, slots) => {
  18503. const { formItem: elFormItem } = useFormItem();
  18504. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  18505. const {
  18506. isFocused,
  18507. isChecked,
  18508. checkboxButtonSize,
  18509. checkboxSize,
  18510. hasOwnLabel
  18511. } = useCheckboxStatus(props, slots, { model });
  18512. const { isDisabled } = useCheckboxDisabled({ model, isChecked });
  18513. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  18514. formItemContext: elFormItem,
  18515. disableIdGeneration: hasOwnLabel,
  18516. disableIdManagement: isGroup
  18517. });
  18518. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  18519. model,
  18520. isLimitExceeded,
  18521. hasOwnLabel,
  18522. isDisabled,
  18523. isLabeledByFormItem
  18524. });
  18525. setStoreValue(props, { model });
  18526. return {
  18527. inputId,
  18528. isLabeledByFormItem,
  18529. isChecked,
  18530. isDisabled,
  18531. isFocused,
  18532. checkboxButtonSize,
  18533. checkboxSize,
  18534. hasOwnLabel,
  18535. model,
  18536. handleChange,
  18537. onClickRoot
  18538. };
  18539. };
  18540. const _hoisted_1$U = ["tabindex", "role", "aria-checked"];
  18541. const _hoisted_2$z = ["id", "aria-hidden", "name", "tabindex", "disabled", "true-value", "false-value"];
  18542. const _hoisted_3$i = ["id", "aria-hidden", "disabled", "value", "name", "tabindex"];
  18543. const __default__$16 = vue.defineComponent({
  18544. name: "ElCheckbox"
  18545. });
  18546. const _sfc_main$1L = /* @__PURE__ */ vue.defineComponent({
  18547. ...__default__$16,
  18548. props: checkboxProps,
  18549. emits: checkboxEmits,
  18550. setup(__props) {
  18551. const props = __props;
  18552. const slots = vue.useSlots();
  18553. const {
  18554. inputId,
  18555. isLabeledByFormItem,
  18556. isChecked,
  18557. isDisabled,
  18558. isFocused,
  18559. checkboxSize,
  18560. hasOwnLabel,
  18561. model,
  18562. handleChange,
  18563. onClickRoot
  18564. } = useCheckbox(props, slots);
  18565. const ns = useNamespace("checkbox");
  18566. return (_ctx, _cache) => {
  18567. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(!vue.unref(hasOwnLabel) && vue.unref(isLabeledByFormItem) ? "span" : "label"), {
  18568. class: vue.normalizeClass([
  18569. vue.unref(ns).b(),
  18570. vue.unref(ns).m(vue.unref(checkboxSize)),
  18571. vue.unref(ns).is("disabled", vue.unref(isDisabled)),
  18572. vue.unref(ns).is("bordered", _ctx.border),
  18573. vue.unref(ns).is("checked", vue.unref(isChecked))
  18574. ]),
  18575. "aria-controls": _ctx.indeterminate ? _ctx.controls : null,
  18576. onClick: vue.unref(onClickRoot)
  18577. }, {
  18578. default: vue.withCtx(() => [
  18579. vue.createElementVNode("span", {
  18580. class: vue.normalizeClass([
  18581. vue.unref(ns).e("input"),
  18582. vue.unref(ns).is("disabled", vue.unref(isDisabled)),
  18583. vue.unref(ns).is("checked", vue.unref(isChecked)),
  18584. vue.unref(ns).is("indeterminate", _ctx.indeterminate),
  18585. vue.unref(ns).is("focus", vue.unref(isFocused))
  18586. ]),
  18587. tabindex: _ctx.indeterminate ? 0 : void 0,
  18588. role: _ctx.indeterminate ? "checkbox" : void 0,
  18589. "aria-checked": _ctx.indeterminate ? "mixed" : void 0
  18590. }, [
  18591. _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  18592. key: 0,
  18593. id: vue.unref(inputId),
  18594. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(model) ? model.value = $event : null),
  18595. class: vue.normalizeClass(vue.unref(ns).e("original")),
  18596. type: "checkbox",
  18597. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  18598. name: _ctx.name,
  18599. tabindex: _ctx.tabindex,
  18600. disabled: vue.unref(isDisabled),
  18601. "true-value": _ctx.trueLabel,
  18602. "false-value": _ctx.falseLabel,
  18603. onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  18604. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  18605. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false)
  18606. }, null, 42, _hoisted_2$z)), [
  18607. [vue.vModelCheckbox, vue.unref(model)]
  18608. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  18609. key: 1,
  18610. id: vue.unref(inputId),
  18611. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.isRef(model) ? model.value = $event : null),
  18612. class: vue.normalizeClass(vue.unref(ns).e("original")),
  18613. type: "checkbox",
  18614. "aria-hidden": _ctx.indeterminate ? "true" : "false",
  18615. disabled: vue.unref(isDisabled),
  18616. value: _ctx.label,
  18617. name: _ctx.name,
  18618. tabindex: _ctx.tabindex,
  18619. onChange: _cache[5] || (_cache[5] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  18620. onFocus: _cache[6] || (_cache[6] = ($event) => isFocused.value = true),
  18621. onBlur: _cache[7] || (_cache[7] = ($event) => isFocused.value = false)
  18622. }, null, 42, _hoisted_3$i)), [
  18623. [vue.vModelCheckbox, vue.unref(model)]
  18624. ]),
  18625. vue.createElementVNode("span", {
  18626. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  18627. }, null, 2)
  18628. ], 10, _hoisted_1$U),
  18629. vue.unref(hasOwnLabel) ? (vue.openBlock(), vue.createElementBlock("span", {
  18630. key: 0,
  18631. class: vue.normalizeClass(vue.unref(ns).e("label"))
  18632. }, [
  18633. vue.renderSlot(_ctx.$slots, "default"),
  18634. !_ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  18635. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  18636. ], 64)) : vue.createCommentVNode("v-if", true)
  18637. ], 2)) : vue.createCommentVNode("v-if", true)
  18638. ]),
  18639. _: 3
  18640. }, 8, ["class", "aria-controls", "onClick"]);
  18641. };
  18642. }
  18643. });
  18644. var Checkbox = /* @__PURE__ */ _export_sfc(_sfc_main$1L, [["__file", "checkbox.vue"]]);
  18645. const _hoisted_1$T = ["name", "tabindex", "disabled", "true-value", "false-value"];
  18646. const _hoisted_2$y = ["name", "tabindex", "disabled", "value"];
  18647. const __default__$15 = vue.defineComponent({
  18648. name: "ElCheckboxButton"
  18649. });
  18650. const _sfc_main$1K = /* @__PURE__ */ vue.defineComponent({
  18651. ...__default__$15,
  18652. props: checkboxProps,
  18653. emits: checkboxEmits,
  18654. setup(__props) {
  18655. const props = __props;
  18656. const slots = vue.useSlots();
  18657. const {
  18658. isFocused,
  18659. isChecked,
  18660. isDisabled,
  18661. checkboxButtonSize,
  18662. model,
  18663. handleChange
  18664. } = useCheckbox(props, slots);
  18665. const checkboxGroup = vue.inject(checkboxGroupContextKey, void 0);
  18666. const ns = useNamespace("checkbox");
  18667. const activeStyle = vue.computed(() => {
  18668. var _a, _b, _c, _d;
  18669. const fillValue = (_b = (_a = checkboxGroup == null ? void 0 : checkboxGroup.fill) == null ? void 0 : _a.value) != null ? _b : "";
  18670. return {
  18671. backgroundColor: fillValue,
  18672. borderColor: fillValue,
  18673. color: (_d = (_c = checkboxGroup == null ? void 0 : checkboxGroup.textColor) == null ? void 0 : _c.value) != null ? _d : "",
  18674. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  18675. };
  18676. });
  18677. return (_ctx, _cache) => {
  18678. return vue.openBlock(), vue.createElementBlock("label", {
  18679. class: vue.normalizeClass([
  18680. vue.unref(ns).b("button"),
  18681. vue.unref(ns).bm("button", vue.unref(checkboxButtonSize)),
  18682. vue.unref(ns).is("disabled", vue.unref(isDisabled)),
  18683. vue.unref(ns).is("checked", vue.unref(isChecked)),
  18684. vue.unref(ns).is("focus", vue.unref(isFocused))
  18685. ])
  18686. }, [
  18687. _ctx.trueLabel || _ctx.falseLabel ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  18688. key: 0,
  18689. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(model) ? model.value = $event : null),
  18690. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  18691. type: "checkbox",
  18692. name: _ctx.name,
  18693. tabindex: _ctx.tabindex,
  18694. disabled: vue.unref(isDisabled),
  18695. "true-value": _ctx.trueLabel,
  18696. "false-value": _ctx.falseLabel,
  18697. onChange: _cache[1] || (_cache[1] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  18698. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  18699. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false)
  18700. }, null, 42, _hoisted_1$T)), [
  18701. [vue.vModelCheckbox, vue.unref(model)]
  18702. ]) : vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  18703. key: 1,
  18704. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.isRef(model) ? model.value = $event : null),
  18705. class: vue.normalizeClass(vue.unref(ns).be("button", "original")),
  18706. type: "checkbox",
  18707. name: _ctx.name,
  18708. tabindex: _ctx.tabindex,
  18709. disabled: vue.unref(isDisabled),
  18710. value: _ctx.label,
  18711. onChange: _cache[5] || (_cache[5] = (...args) => vue.unref(handleChange) && vue.unref(handleChange)(...args)),
  18712. onFocus: _cache[6] || (_cache[6] = ($event) => isFocused.value = true),
  18713. onBlur: _cache[7] || (_cache[7] = ($event) => isFocused.value = false)
  18714. }, null, 42, _hoisted_2$y)), [
  18715. [vue.vModelCheckbox, vue.unref(model)]
  18716. ]),
  18717. _ctx.$slots.default || _ctx.label ? (vue.openBlock(), vue.createElementBlock("span", {
  18718. key: 2,
  18719. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  18720. style: vue.normalizeStyle(vue.unref(isChecked) ? vue.unref(activeStyle) : void 0)
  18721. }, [
  18722. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  18723. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  18724. ])
  18725. ], 6)) : vue.createCommentVNode("v-if", true)
  18726. ], 2);
  18727. };
  18728. }
  18729. });
  18730. var CheckboxButton = /* @__PURE__ */ _export_sfc(_sfc_main$1K, [["__file", "checkbox-button.vue"]]);
  18731. const checkboxGroupProps = buildProps({
  18732. modelValue: {
  18733. type: definePropType(Array),
  18734. default: () => []
  18735. },
  18736. disabled: Boolean,
  18737. min: Number,
  18738. max: Number,
  18739. size: useSizeProp,
  18740. label: String,
  18741. fill: String,
  18742. textColor: String,
  18743. tag: {
  18744. type: String,
  18745. default: "div"
  18746. },
  18747. validateEvent: {
  18748. type: Boolean,
  18749. default: true
  18750. }
  18751. });
  18752. const checkboxGroupEmits = {
  18753. [UPDATE_MODEL_EVENT]: (val) => isArray(val),
  18754. change: (val) => isArray(val)
  18755. };
  18756. const __default__$14 = vue.defineComponent({
  18757. name: "ElCheckboxGroup"
  18758. });
  18759. const _sfc_main$1J = /* @__PURE__ */ vue.defineComponent({
  18760. ...__default__$14,
  18761. props: checkboxGroupProps,
  18762. emits: checkboxGroupEmits,
  18763. setup(__props, { emit }) {
  18764. const props = __props;
  18765. const ns = useNamespace("checkbox");
  18766. const { formItem } = useFormItem();
  18767. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  18768. formItemContext: formItem
  18769. });
  18770. const changeEvent = async (value) => {
  18771. emit(UPDATE_MODEL_EVENT, value);
  18772. await vue.nextTick();
  18773. emit("change", value);
  18774. };
  18775. const modelValue = vue.computed({
  18776. get() {
  18777. return props.modelValue;
  18778. },
  18779. set(val) {
  18780. changeEvent(val);
  18781. }
  18782. });
  18783. vue.provide(checkboxGroupContextKey, {
  18784. ...pick(vue.toRefs(props), [
  18785. "size",
  18786. "min",
  18787. "max",
  18788. "disabled",
  18789. "validateEvent",
  18790. "fill",
  18791. "textColor"
  18792. ]),
  18793. modelValue,
  18794. changeEvent
  18795. });
  18796. vue.watch(() => props.modelValue, () => {
  18797. if (props.validateEvent) {
  18798. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  18799. }
  18800. });
  18801. return (_ctx, _cache) => {
  18802. var _a;
  18803. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  18804. id: vue.unref(groupId),
  18805. class: vue.normalizeClass(vue.unref(ns).b("group")),
  18806. role: "group",
  18807. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || "checkbox-group" : void 0,
  18808. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItem)) == null ? void 0 : _a.labelId : void 0
  18809. }, {
  18810. default: vue.withCtx(() => [
  18811. vue.renderSlot(_ctx.$slots, "default")
  18812. ]),
  18813. _: 3
  18814. }, 8, ["id", "class", "aria-label", "aria-labelledby"]);
  18815. };
  18816. }
  18817. });
  18818. var CheckboxGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1J, [["__file", "checkbox-group.vue"]]);
  18819. const ElCheckbox = withInstall(Checkbox, {
  18820. CheckboxButton,
  18821. CheckboxGroup
  18822. });
  18823. const ElCheckboxButton = withNoopInstall(CheckboxButton);
  18824. const ElCheckboxGroup$1 = withNoopInstall(CheckboxGroup);
  18825. const radioPropsBase = buildProps({
  18826. size: useSizeProp,
  18827. disabled: Boolean,
  18828. label: {
  18829. type: [String, Number, Boolean],
  18830. default: ""
  18831. }
  18832. });
  18833. const radioProps = buildProps({
  18834. ...radioPropsBase,
  18835. modelValue: {
  18836. type: [String, Number, Boolean],
  18837. default: ""
  18838. },
  18839. name: {
  18840. type: String,
  18841. default: ""
  18842. },
  18843. border: Boolean
  18844. });
  18845. const radioEmits = {
  18846. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  18847. [CHANGE_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val)
  18848. };
  18849. const useRadio = (props, emit) => {
  18850. const radioRef = vue.ref();
  18851. const radioGroup = vue.inject(radioGroupKey, void 0);
  18852. const isGroup = vue.computed(() => !!radioGroup);
  18853. const modelValue = vue.computed({
  18854. get() {
  18855. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  18856. },
  18857. set(val) {
  18858. if (isGroup.value) {
  18859. radioGroup.changeEvent(val);
  18860. } else {
  18861. emit && emit(UPDATE_MODEL_EVENT, val);
  18862. }
  18863. radioRef.value.checked = props.modelValue === props.label;
  18864. }
  18865. });
  18866. const size = useSize(vue.computed(() => radioGroup == null ? void 0 : radioGroup.size));
  18867. const disabled = useDisabled(vue.computed(() => radioGroup == null ? void 0 : radioGroup.disabled));
  18868. const focus = vue.ref(false);
  18869. const tabIndex = vue.computed(() => {
  18870. return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
  18871. });
  18872. return {
  18873. radioRef,
  18874. isGroup,
  18875. radioGroup,
  18876. focus,
  18877. size,
  18878. disabled,
  18879. tabIndex,
  18880. modelValue
  18881. };
  18882. };
  18883. const _hoisted_1$S = ["value", "name", "disabled"];
  18884. const __default__$13 = vue.defineComponent({
  18885. name: "ElRadio"
  18886. });
  18887. const _sfc_main$1I = /* @__PURE__ */ vue.defineComponent({
  18888. ...__default__$13,
  18889. props: radioProps,
  18890. emits: radioEmits,
  18891. setup(__props, { emit }) {
  18892. const props = __props;
  18893. const ns = useNamespace("radio");
  18894. const { radioRef, radioGroup, focus, size, disabled, modelValue } = useRadio(props, emit);
  18895. function handleChange() {
  18896. vue.nextTick(() => emit("change", modelValue.value));
  18897. }
  18898. return (_ctx, _cache) => {
  18899. var _a;
  18900. return vue.openBlock(), vue.createElementBlock("label", {
  18901. class: vue.normalizeClass([
  18902. vue.unref(ns).b(),
  18903. vue.unref(ns).is("disabled", vue.unref(disabled)),
  18904. vue.unref(ns).is("focus", vue.unref(focus)),
  18905. vue.unref(ns).is("bordered", _ctx.border),
  18906. vue.unref(ns).is("checked", vue.unref(modelValue) === _ctx.label),
  18907. vue.unref(ns).m(vue.unref(size))
  18908. ])
  18909. }, [
  18910. vue.createElementVNode("span", {
  18911. class: vue.normalizeClass([
  18912. vue.unref(ns).e("input"),
  18913. vue.unref(ns).is("disabled", vue.unref(disabled)),
  18914. vue.unref(ns).is("checked", vue.unref(modelValue) === _ctx.label)
  18915. ])
  18916. }, [
  18917. vue.withDirectives(vue.createElementVNode("input", {
  18918. ref_key: "radioRef",
  18919. ref: radioRef,
  18920. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null),
  18921. class: vue.normalizeClass(vue.unref(ns).e("original")),
  18922. value: _ctx.label,
  18923. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  18924. disabled: vue.unref(disabled),
  18925. type: "radio",
  18926. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  18927. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
  18928. onChange: handleChange
  18929. }, null, 42, _hoisted_1$S), [
  18930. [vue.vModelRadio, vue.unref(modelValue)]
  18931. ]),
  18932. vue.createElementVNode("span", {
  18933. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  18934. }, null, 2)
  18935. ], 2),
  18936. vue.createElementVNode("span", {
  18937. class: vue.normalizeClass(vue.unref(ns).e("label")),
  18938. onKeydown: _cache[3] || (_cache[3] = vue.withModifiers(() => {
  18939. }, ["stop"]))
  18940. }, [
  18941. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  18942. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  18943. ])
  18944. ], 34)
  18945. ], 2);
  18946. };
  18947. }
  18948. });
  18949. var Radio = /* @__PURE__ */ _export_sfc(_sfc_main$1I, [["__file", "radio.vue"]]);
  18950. const radioButtonProps = buildProps({
  18951. ...radioPropsBase,
  18952. name: {
  18953. type: String,
  18954. default: ""
  18955. }
  18956. });
  18957. const _hoisted_1$R = ["value", "name", "disabled"];
  18958. const __default__$12 = vue.defineComponent({
  18959. name: "ElRadioButton"
  18960. });
  18961. const _sfc_main$1H = /* @__PURE__ */ vue.defineComponent({
  18962. ...__default__$12,
  18963. props: radioButtonProps,
  18964. setup(__props) {
  18965. const props = __props;
  18966. const ns = useNamespace("radio");
  18967. const { radioRef, focus, size, disabled, modelValue, radioGroup } = useRadio(props);
  18968. const activeStyle = vue.computed(() => {
  18969. return {
  18970. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  18971. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  18972. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  18973. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  18974. };
  18975. });
  18976. return (_ctx, _cache) => {
  18977. var _a;
  18978. return vue.openBlock(), vue.createElementBlock("label", {
  18979. class: vue.normalizeClass([
  18980. vue.unref(ns).b("button"),
  18981. vue.unref(ns).is("active", vue.unref(modelValue) === _ctx.label),
  18982. vue.unref(ns).is("disabled", vue.unref(disabled)),
  18983. vue.unref(ns).is("focus", vue.unref(focus)),
  18984. vue.unref(ns).bm("button", vue.unref(size))
  18985. ])
  18986. }, [
  18987. vue.withDirectives(vue.createElementVNode("input", {
  18988. ref_key: "radioRef",
  18989. ref: radioRef,
  18990. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null),
  18991. class: vue.normalizeClass(vue.unref(ns).be("button", "original-radio")),
  18992. value: _ctx.label,
  18993. type: "radio",
  18994. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  18995. disabled: vue.unref(disabled),
  18996. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  18997. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false)
  18998. }, null, 42, _hoisted_1$R), [
  18999. [vue.vModelRadio, vue.unref(modelValue)]
  19000. ]),
  19001. vue.createElementVNode("span", {
  19002. class: vue.normalizeClass(vue.unref(ns).be("button", "inner")),
  19003. style: vue.normalizeStyle(vue.unref(modelValue) === _ctx.label ? vue.unref(activeStyle) : {}),
  19004. onKeydown: _cache[3] || (_cache[3] = vue.withModifiers(() => {
  19005. }, ["stop"]))
  19006. }, [
  19007. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  19008. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  19009. ])
  19010. ], 38)
  19011. ], 2);
  19012. };
  19013. }
  19014. });
  19015. var RadioButton = /* @__PURE__ */ _export_sfc(_sfc_main$1H, [["__file", "radio-button.vue"]]);
  19016. const radioGroupProps = buildProps({
  19017. id: {
  19018. type: String,
  19019. default: void 0
  19020. },
  19021. size: useSizeProp,
  19022. disabled: Boolean,
  19023. modelValue: {
  19024. type: [String, Number, Boolean],
  19025. default: ""
  19026. },
  19027. fill: {
  19028. type: String,
  19029. default: ""
  19030. },
  19031. label: {
  19032. type: String,
  19033. default: void 0
  19034. },
  19035. textColor: {
  19036. type: String,
  19037. default: ""
  19038. },
  19039. name: {
  19040. type: String,
  19041. default: void 0
  19042. },
  19043. validateEvent: {
  19044. type: Boolean,
  19045. default: true
  19046. }
  19047. });
  19048. const radioGroupEmits = radioEmits;
  19049. const _hoisted_1$Q = ["id", "aria-label", "aria-labelledby"];
  19050. const __default__$11 = vue.defineComponent({
  19051. name: "ElRadioGroup"
  19052. });
  19053. const _sfc_main$1G = /* @__PURE__ */ vue.defineComponent({
  19054. ...__default__$11,
  19055. props: radioGroupProps,
  19056. emits: radioGroupEmits,
  19057. setup(__props, { emit }) {
  19058. const props = __props;
  19059. const ns = useNamespace("radio");
  19060. const radioId = useId();
  19061. const radioGroupRef = vue.ref();
  19062. const { formItem } = useFormItem();
  19063. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  19064. formItemContext: formItem
  19065. });
  19066. const changeEvent = (value) => {
  19067. emit(UPDATE_MODEL_EVENT, value);
  19068. vue.nextTick(() => emit("change", value));
  19069. };
  19070. vue.onMounted(() => {
  19071. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  19072. const firstLabel = radios[0];
  19073. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  19074. firstLabel.tabIndex = 0;
  19075. }
  19076. });
  19077. const name = vue.computed(() => {
  19078. return props.name || radioId.value;
  19079. });
  19080. vue.provide(radioGroupKey, vue.reactive({
  19081. ...vue.toRefs(props),
  19082. changeEvent,
  19083. name
  19084. }));
  19085. vue.watch(() => props.modelValue, () => {
  19086. if (props.validateEvent) {
  19087. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  19088. }
  19089. });
  19090. return (_ctx, _cache) => {
  19091. return vue.openBlock(), vue.createElementBlock("div", {
  19092. id: vue.unref(groupId),
  19093. ref_key: "radioGroupRef",
  19094. ref: radioGroupRef,
  19095. class: vue.normalizeClass(vue.unref(ns).b("group")),
  19096. role: "radiogroup",
  19097. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || "radio-group" : void 0,
  19098. "aria-labelledby": vue.unref(isLabeledByFormItem) ? vue.unref(formItem).labelId : void 0
  19099. }, [
  19100. vue.renderSlot(_ctx.$slots, "default")
  19101. ], 10, _hoisted_1$Q);
  19102. };
  19103. }
  19104. });
  19105. var RadioGroup = /* @__PURE__ */ _export_sfc(_sfc_main$1G, [["__file", "radio-group.vue"]]);
  19106. const ElRadio = withInstall(Radio, {
  19107. RadioButton,
  19108. RadioGroup
  19109. });
  19110. const ElRadioGroup = withNoopInstall(RadioGroup);
  19111. const ElRadioButton = withNoopInstall(RadioButton);
  19112. var NodeContent$1 = vue.defineComponent({
  19113. name: "NodeContent",
  19114. setup() {
  19115. const ns = useNamespace("cascader-node");
  19116. return {
  19117. ns
  19118. };
  19119. },
  19120. render() {
  19121. const { ns } = this;
  19122. const { node, panel } = this.$parent;
  19123. const { data, label } = node;
  19124. const { renderLabelFn } = panel;
  19125. return vue.h("span", { class: ns.e("label") }, renderLabelFn ? renderLabelFn({ node, data }) : label);
  19126. }
  19127. });
  19128. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  19129. const _sfc_main$1F = vue.defineComponent({
  19130. name: "ElCascaderNode",
  19131. components: {
  19132. ElCheckbox,
  19133. ElRadio,
  19134. NodeContent: NodeContent$1,
  19135. ElIcon,
  19136. Check: check_default,
  19137. Loading: loading_default,
  19138. ArrowRight: arrow_right_default
  19139. },
  19140. props: {
  19141. node: {
  19142. type: Object,
  19143. required: true
  19144. },
  19145. menuId: String
  19146. },
  19147. emits: ["expand"],
  19148. setup(props, { emit }) {
  19149. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  19150. const ns = useNamespace("cascader-node");
  19151. const isHoverMenu = vue.computed(() => panel.isHoverMenu);
  19152. const multiple = vue.computed(() => panel.config.multiple);
  19153. const checkStrictly = vue.computed(() => panel.config.checkStrictly);
  19154. const checkedNodeId = vue.computed(() => {
  19155. var _a;
  19156. return (_a = panel.checkedNodes[0]) == null ? void 0 : _a.uid;
  19157. });
  19158. const isDisabled = vue.computed(() => props.node.isDisabled);
  19159. const isLeaf = vue.computed(() => props.node.isLeaf);
  19160. const expandable = vue.computed(() => checkStrictly.value && !isLeaf.value || !isDisabled.value);
  19161. const inExpandingPath = vue.computed(() => isInPath(panel.expandingNode));
  19162. const inCheckedPath = vue.computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  19163. const isInPath = (node) => {
  19164. var _a;
  19165. const { level, uid } = props.node;
  19166. return ((_a = node == null ? void 0 : node.pathNodes[level - 1]) == null ? void 0 : _a.uid) === uid;
  19167. };
  19168. const doExpand = () => {
  19169. if (inExpandingPath.value)
  19170. return;
  19171. panel.expandNode(props.node);
  19172. };
  19173. const doCheck = (checked) => {
  19174. const { node } = props;
  19175. if (checked === node.checked)
  19176. return;
  19177. panel.handleCheckChange(node, checked);
  19178. };
  19179. const doLoad = () => {
  19180. panel.lazyLoad(props.node, () => {
  19181. if (!isLeaf.value)
  19182. doExpand();
  19183. });
  19184. };
  19185. const handleHoverExpand = (e) => {
  19186. if (!isHoverMenu.value)
  19187. return;
  19188. handleExpand();
  19189. !isLeaf.value && emit("expand", e);
  19190. };
  19191. const handleExpand = () => {
  19192. const { node } = props;
  19193. if (!expandable.value || node.loading)
  19194. return;
  19195. node.loaded ? doExpand() : doLoad();
  19196. };
  19197. const handleClick = () => {
  19198. if (isHoverMenu.value && !isLeaf.value)
  19199. return;
  19200. if (isLeaf.value && !isDisabled.value && !checkStrictly.value && !multiple.value) {
  19201. handleCheck(true);
  19202. } else {
  19203. handleExpand();
  19204. }
  19205. };
  19206. const handleSelectCheck = (checked) => {
  19207. if (checkStrictly.value) {
  19208. doCheck(checked);
  19209. if (props.node.loaded) {
  19210. doExpand();
  19211. }
  19212. } else {
  19213. handleCheck(checked);
  19214. }
  19215. };
  19216. const handleCheck = (checked) => {
  19217. if (!props.node.loaded) {
  19218. doLoad();
  19219. } else {
  19220. doCheck(checked);
  19221. !checkStrictly.value && doExpand();
  19222. }
  19223. };
  19224. return {
  19225. panel,
  19226. isHoverMenu,
  19227. multiple,
  19228. checkStrictly,
  19229. checkedNodeId,
  19230. isDisabled,
  19231. isLeaf,
  19232. expandable,
  19233. inExpandingPath,
  19234. inCheckedPath,
  19235. ns,
  19236. handleHoverExpand,
  19237. handleExpand,
  19238. handleClick,
  19239. handleCheck,
  19240. handleSelectCheck
  19241. };
  19242. }
  19243. });
  19244. const _hoisted_1$P = ["id", "aria-haspopup", "aria-owns", "aria-expanded", "tabindex"];
  19245. const _hoisted_2$x = /* @__PURE__ */ vue.createElementVNode("span", null, null, -1);
  19246. function _sfc_render$x(_ctx, _cache, $props, $setup, $data, $options) {
  19247. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  19248. const _component_el_radio = vue.resolveComponent("el-radio");
  19249. const _component_check = vue.resolveComponent("check");
  19250. const _component_el_icon = vue.resolveComponent("el-icon");
  19251. const _component_node_content = vue.resolveComponent("node-content");
  19252. const _component_loading = vue.resolveComponent("loading");
  19253. const _component_arrow_right = vue.resolveComponent("arrow-right");
  19254. return vue.openBlock(), vue.createElementBlock("li", {
  19255. id: `${_ctx.menuId}-${_ctx.node.uid}`,
  19256. role: "menuitem",
  19257. "aria-haspopup": !_ctx.isLeaf,
  19258. "aria-owns": _ctx.isLeaf ? null : _ctx.menuId,
  19259. "aria-expanded": _ctx.inExpandingPath,
  19260. tabindex: _ctx.expandable ? -1 : void 0,
  19261. class: vue.normalizeClass([
  19262. _ctx.ns.b(),
  19263. _ctx.ns.is("selectable", _ctx.checkStrictly),
  19264. _ctx.ns.is("active", _ctx.node.checked),
  19265. _ctx.ns.is("disabled", !_ctx.expandable),
  19266. _ctx.inExpandingPath && "in-active-path",
  19267. _ctx.inCheckedPath && "in-checked-path"
  19268. ]),
  19269. onMouseenter: _cache[2] || (_cache[2] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  19270. onFocus: _cache[3] || (_cache[3] = (...args) => _ctx.handleHoverExpand && _ctx.handleHoverExpand(...args)),
  19271. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  19272. }, [
  19273. vue.createCommentVNode(" prefix "),
  19274. _ctx.multiple ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  19275. key: 0,
  19276. "model-value": _ctx.node.checked,
  19277. indeterminate: _ctx.node.indeterminate,
  19278. disabled: _ctx.isDisabled,
  19279. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  19280. }, ["stop"])),
  19281. "onUpdate:modelValue": _ctx.handleSelectCheck
  19282. }, null, 8, ["model-value", "indeterminate", "disabled", "onUpdate:modelValue"])) : _ctx.checkStrictly ? (vue.openBlock(), vue.createBlock(_component_el_radio, {
  19283. key: 1,
  19284. "model-value": _ctx.checkedNodeId,
  19285. label: _ctx.node.uid,
  19286. disabled: _ctx.isDisabled,
  19287. "onUpdate:modelValue": _ctx.handleSelectCheck,
  19288. onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
  19289. }, ["stop"]))
  19290. }, {
  19291. default: vue.withCtx(() => [
  19292. vue.createCommentVNode("\n Add an empty element to avoid render label,\n do not use empty fragment here for https://github.com/vuejs/vue-next/pull/2485\n "),
  19293. _hoisted_2$x
  19294. ]),
  19295. _: 1
  19296. }, 8, ["model-value", "label", "disabled", "onUpdate:modelValue"])) : _ctx.isLeaf && _ctx.node.checked ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  19297. key: 2,
  19298. class: vue.normalizeClass(_ctx.ns.e("prefix"))
  19299. }, {
  19300. default: vue.withCtx(() => [
  19301. vue.createVNode(_component_check)
  19302. ]),
  19303. _: 1
  19304. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  19305. vue.createCommentVNode(" content "),
  19306. vue.createVNode(_component_node_content),
  19307. vue.createCommentVNode(" postfix "),
  19308. !_ctx.isLeaf ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
  19309. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  19310. key: 0,
  19311. class: vue.normalizeClass([_ctx.ns.is("loading"), _ctx.ns.e("postfix")])
  19312. }, {
  19313. default: vue.withCtx(() => [
  19314. vue.createVNode(_component_loading)
  19315. ]),
  19316. _: 1
  19317. }, 8, ["class"])) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
  19318. key: 1,
  19319. class: vue.normalizeClass(["arrow-right", _ctx.ns.e("postfix")])
  19320. }, {
  19321. default: vue.withCtx(() => [
  19322. vue.createVNode(_component_arrow_right)
  19323. ]),
  19324. _: 1
  19325. }, 8, ["class"]))
  19326. ], 64)) : vue.createCommentVNode("v-if", true)
  19327. ], 42, _hoisted_1$P);
  19328. }
  19329. var ElCascaderNode = /* @__PURE__ */ _export_sfc(_sfc_main$1F, [["render", _sfc_render$x], ["__file", "node.vue"]]);
  19330. const _sfc_main$1E = vue.defineComponent({
  19331. name: "ElCascaderMenu",
  19332. components: {
  19333. Loading: loading_default,
  19334. ElIcon,
  19335. ElScrollbar,
  19336. ElCascaderNode
  19337. },
  19338. props: {
  19339. nodes: {
  19340. type: Array,
  19341. required: true
  19342. },
  19343. index: {
  19344. type: Number,
  19345. required: true
  19346. }
  19347. },
  19348. setup(props) {
  19349. const instance = vue.getCurrentInstance();
  19350. const ns = useNamespace("cascader-menu");
  19351. const { t } = useLocale();
  19352. const id = generateId();
  19353. let activeNode = null;
  19354. let hoverTimer = null;
  19355. const panel = vue.inject(CASCADER_PANEL_INJECTION_KEY);
  19356. const hoverZone = vue.ref(null);
  19357. const isEmpty = vue.computed(() => !props.nodes.length);
  19358. const isLoading = vue.computed(() => !panel.initialLoaded);
  19359. const menuId = vue.computed(() => `cascader-menu-${id}-${props.index}`);
  19360. const handleExpand = (e) => {
  19361. activeNode = e.target;
  19362. };
  19363. const handleMouseMove = (e) => {
  19364. if (!panel.isHoverMenu || !activeNode || !hoverZone.value)
  19365. return;
  19366. if (activeNode.contains(e.target)) {
  19367. clearHoverTimer();
  19368. const el = instance.vnode.el;
  19369. const { left } = el.getBoundingClientRect();
  19370. const { offsetWidth, offsetHeight } = el;
  19371. const startX = e.clientX - left;
  19372. const top = activeNode.offsetTop;
  19373. const bottom = top + activeNode.offsetHeight;
  19374. hoverZone.value.innerHTML = `
  19375. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} 0 V${top} Z" />
  19376. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight} V${bottom} Z" />
  19377. `;
  19378. } else if (!hoverTimer) {
  19379. hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  19380. }
  19381. };
  19382. const clearHoverTimer = () => {
  19383. if (!hoverTimer)
  19384. return;
  19385. clearTimeout(hoverTimer);
  19386. hoverTimer = null;
  19387. };
  19388. const clearHoverZone = () => {
  19389. if (!hoverZone.value)
  19390. return;
  19391. hoverZone.value.innerHTML = "";
  19392. clearHoverTimer();
  19393. };
  19394. return {
  19395. ns,
  19396. panel,
  19397. hoverZone,
  19398. isEmpty,
  19399. isLoading,
  19400. menuId,
  19401. t,
  19402. handleExpand,
  19403. handleMouseMove,
  19404. clearHoverZone
  19405. };
  19406. }
  19407. });
  19408. function _sfc_render$w(_ctx, _cache, $props, $setup, $data, $options) {
  19409. const _component_el_cascader_node = vue.resolveComponent("el-cascader-node");
  19410. const _component_loading = vue.resolveComponent("loading");
  19411. const _component_el_icon = vue.resolveComponent("el-icon");
  19412. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  19413. return vue.openBlock(), vue.createBlock(_component_el_scrollbar, {
  19414. key: _ctx.menuId,
  19415. tag: "ul",
  19416. role: "menu",
  19417. class: vue.normalizeClass(_ctx.ns.b()),
  19418. "wrap-class": _ctx.ns.e("wrap"),
  19419. "view-class": [_ctx.ns.e("list"), _ctx.ns.is("empty", _ctx.isEmpty)],
  19420. onMousemove: _ctx.handleMouseMove,
  19421. onMouseleave: _ctx.clearHoverZone
  19422. }, {
  19423. default: vue.withCtx(() => {
  19424. var _a;
  19425. return [
  19426. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.nodes, (node) => {
  19427. return vue.openBlock(), vue.createBlock(_component_el_cascader_node, {
  19428. key: node.uid,
  19429. node,
  19430. "menu-id": _ctx.menuId,
  19431. onExpand: _ctx.handleExpand
  19432. }, null, 8, ["node", "menu-id", "onExpand"]);
  19433. }), 128)),
  19434. _ctx.isLoading ? (vue.openBlock(), vue.createElementBlock("div", {
  19435. key: 0,
  19436. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  19437. }, [
  19438. vue.createVNode(_component_el_icon, {
  19439. size: "14",
  19440. class: vue.normalizeClass(_ctx.ns.is("loading"))
  19441. }, {
  19442. default: vue.withCtx(() => [
  19443. vue.createVNode(_component_loading)
  19444. ]),
  19445. _: 1
  19446. }, 8, ["class"]),
  19447. vue.createTextVNode(" " + vue.toDisplayString(_ctx.t("el.cascader.loading")), 1)
  19448. ], 2)) : _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  19449. key: 1,
  19450. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  19451. }, vue.toDisplayString(_ctx.t("el.cascader.noData")), 3)) : ((_a = _ctx.panel) == null ? void 0 : _a.isHoverMenu) ? (vue.openBlock(), vue.createElementBlock("svg", {
  19452. key: 2,
  19453. ref: "hoverZone",
  19454. class: vue.normalizeClass(_ctx.ns.e("hover-zone"))
  19455. }, null, 2)) : vue.createCommentVNode("v-if", true)
  19456. ];
  19457. }),
  19458. _: 1
  19459. }, 8, ["class", "wrap-class", "view-class", "onMousemove", "onMouseleave"]);
  19460. }
  19461. var ElCascaderMenu = /* @__PURE__ */ _export_sfc(_sfc_main$1E, [["render", _sfc_render$w], ["__file", "menu.vue"]]);
  19462. let uid = 0;
  19463. const calculatePathNodes = (node) => {
  19464. const nodes = [node];
  19465. let { parent } = node;
  19466. while (parent) {
  19467. nodes.unshift(parent);
  19468. parent = parent.parent;
  19469. }
  19470. return nodes;
  19471. };
  19472. class Node$2 {
  19473. constructor(data, config, parent, root = false) {
  19474. this.data = data;
  19475. this.config = config;
  19476. this.parent = parent;
  19477. this.root = root;
  19478. this.uid = uid++;
  19479. this.checked = false;
  19480. this.indeterminate = false;
  19481. this.loading = false;
  19482. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  19483. const childrenData = data[childrenKey];
  19484. const pathNodes = calculatePathNodes(this);
  19485. this.level = root ? 0 : parent ? parent.level + 1 : 1;
  19486. this.value = data[valueKey];
  19487. this.label = data[labelKey];
  19488. this.pathNodes = pathNodes;
  19489. this.pathValues = pathNodes.map((node) => node.value);
  19490. this.pathLabels = pathNodes.map((node) => node.label);
  19491. this.childrenData = childrenData;
  19492. this.children = (childrenData || []).map((child) => new Node$2(child, config, this));
  19493. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  19494. }
  19495. get isDisabled() {
  19496. const { data, parent, config } = this;
  19497. const { disabled, checkStrictly } = config;
  19498. const isDisabled = isFunction(disabled) ? disabled(data, this) : !!data[disabled];
  19499. return isDisabled || !checkStrictly && (parent == null ? void 0 : parent.isDisabled);
  19500. }
  19501. get isLeaf() {
  19502. const { data, config, childrenData, loaded } = this;
  19503. const { lazy, leaf } = config;
  19504. const isLeaf = isFunction(leaf) ? leaf(data, this) : data[leaf];
  19505. return isUndefined(isLeaf) ? lazy && !loaded ? false : !(Array.isArray(childrenData) && childrenData.length) : !!isLeaf;
  19506. }
  19507. get valueByOption() {
  19508. return this.config.emitPath ? this.pathValues : this.value;
  19509. }
  19510. appendChild(childData) {
  19511. const { childrenData, children } = this;
  19512. const node = new Node$2(childData, this.config, this);
  19513. if (Array.isArray(childrenData)) {
  19514. childrenData.push(childData);
  19515. } else {
  19516. this.childrenData = [childData];
  19517. }
  19518. children.push(node);
  19519. return node;
  19520. }
  19521. calcText(allLevels, separator) {
  19522. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  19523. this.text = text;
  19524. return text;
  19525. }
  19526. broadcast(event, ...args) {
  19527. const handlerName = `onParent${capitalize(event)}`;
  19528. this.children.forEach((child) => {
  19529. if (child) {
  19530. child.broadcast(event, ...args);
  19531. child[handlerName] && child[handlerName](...args);
  19532. }
  19533. });
  19534. }
  19535. emit(event, ...args) {
  19536. const { parent } = this;
  19537. const handlerName = `onChild${capitalize(event)}`;
  19538. if (parent) {
  19539. parent[handlerName] && parent[handlerName](...args);
  19540. parent.emit(event, ...args);
  19541. }
  19542. }
  19543. onParentCheck(checked) {
  19544. if (!this.isDisabled) {
  19545. this.setCheckState(checked);
  19546. }
  19547. }
  19548. onChildCheck() {
  19549. const { children } = this;
  19550. const validChildren = children.filter((child) => !child.isDisabled);
  19551. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  19552. this.setCheckState(checked);
  19553. }
  19554. setCheckState(checked) {
  19555. const totalNum = this.children.length;
  19556. const checkedNum = this.children.reduce((c, p) => {
  19557. const num = p.checked ? 1 : p.indeterminate ? 0.5 : 0;
  19558. return c + num;
  19559. }, 0);
  19560. this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked;
  19561. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  19562. }
  19563. doCheck(checked) {
  19564. if (this.checked === checked)
  19565. return;
  19566. const { checkStrictly, multiple } = this.config;
  19567. if (checkStrictly || !multiple) {
  19568. this.checked = checked;
  19569. } else {
  19570. this.broadcast("check", checked);
  19571. this.setCheckState(checked);
  19572. this.emit("check");
  19573. }
  19574. }
  19575. }
  19576. var Node$3 = Node$2;
  19577. const flatNodes = (nodes, leafOnly) => {
  19578. return nodes.reduce((res, node) => {
  19579. if (node.isLeaf) {
  19580. res.push(node);
  19581. } else {
  19582. !leafOnly && res.push(node);
  19583. res = res.concat(flatNodes(node.children, leafOnly));
  19584. }
  19585. return res;
  19586. }, []);
  19587. };
  19588. class Store {
  19589. constructor(data, config) {
  19590. this.config = config;
  19591. const nodes = (data || []).map((nodeData) => new Node$3(nodeData, this.config));
  19592. this.nodes = nodes;
  19593. this.allNodes = flatNodes(nodes, false);
  19594. this.leafNodes = flatNodes(nodes, true);
  19595. }
  19596. getNodes() {
  19597. return this.nodes;
  19598. }
  19599. getFlattedNodes(leafOnly) {
  19600. return leafOnly ? this.leafNodes : this.allNodes;
  19601. }
  19602. appendNode(nodeData, parentNode) {
  19603. const node = parentNode ? parentNode.appendChild(nodeData) : new Node$3(nodeData, this.config);
  19604. if (!parentNode)
  19605. this.nodes.push(node);
  19606. this.allNodes.push(node);
  19607. node.isLeaf && this.leafNodes.push(node);
  19608. }
  19609. appendNodes(nodeDataList, parentNode) {
  19610. nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  19611. }
  19612. getNodeByValue(value, leafOnly = false) {
  19613. if (!value && value !== 0)
  19614. return null;
  19615. const node = this.getFlattedNodes(leafOnly).find((node2) => isEqual$1(node2.value, value) || isEqual$1(node2.pathValues, value));
  19616. return node || null;
  19617. }
  19618. getSameNode(node) {
  19619. if (!node)
  19620. return null;
  19621. const node_ = this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level);
  19622. return node_ || null;
  19623. }
  19624. }
  19625. const CommonProps = {
  19626. modelValue: [Number, String, Array],
  19627. options: {
  19628. type: Array,
  19629. default: () => []
  19630. },
  19631. props: {
  19632. type: Object,
  19633. default: () => ({})
  19634. }
  19635. };
  19636. const DefaultProps = {
  19637. expandTrigger: "click",
  19638. multiple: false,
  19639. checkStrictly: false,
  19640. emitPath: true,
  19641. lazy: false,
  19642. lazyLoad: NOOP,
  19643. value: "value",
  19644. label: "label",
  19645. children: "children",
  19646. leaf: "leaf",
  19647. disabled: "disabled",
  19648. hoverThreshold: 500
  19649. };
  19650. const useCascaderConfig = (props) => {
  19651. return vue.computed(() => ({
  19652. ...DefaultProps,
  19653. ...props.props
  19654. }));
  19655. };
  19656. const getMenuIndex = (el) => {
  19657. if (!el)
  19658. return 0;
  19659. const pieces = el.id.split("-");
  19660. return Number(pieces[pieces.length - 2]);
  19661. };
  19662. const checkNode = (el) => {
  19663. if (!el)
  19664. return;
  19665. const input = el.querySelector("input");
  19666. if (input) {
  19667. input.click();
  19668. } else if (isLeaf(el)) {
  19669. el.click();
  19670. }
  19671. };
  19672. const sortByOriginalOrder = (oldNodes, newNodes) => {
  19673. const newNodesCopy = newNodes.slice(0);
  19674. const newIds = newNodesCopy.map((node) => node.uid);
  19675. const res = oldNodes.reduce((acc, item) => {
  19676. const index = newIds.indexOf(item.uid);
  19677. if (index > -1) {
  19678. acc.push(item);
  19679. newNodesCopy.splice(index, 1);
  19680. newIds.splice(index, 1);
  19681. }
  19682. return acc;
  19683. }, []);
  19684. res.push(...newNodesCopy);
  19685. return res;
  19686. };
  19687. const _sfc_main$1D = vue.defineComponent({
  19688. name: "ElCascaderPanel",
  19689. components: {
  19690. ElCascaderMenu
  19691. },
  19692. props: {
  19693. ...CommonProps,
  19694. border: {
  19695. type: Boolean,
  19696. default: true
  19697. },
  19698. renderLabel: Function
  19699. },
  19700. emits: [UPDATE_MODEL_EVENT, CHANGE_EVENT, "close", "expand-change"],
  19701. setup(props, { emit, slots }) {
  19702. let manualChecked = false;
  19703. const ns = useNamespace("cascader");
  19704. const config = useCascaderConfig(props);
  19705. let store = null;
  19706. const initialLoaded = vue.ref(true);
  19707. const menuList = vue.ref([]);
  19708. const checkedValue = vue.ref(null);
  19709. const menus = vue.ref([]);
  19710. const expandingNode = vue.ref(null);
  19711. const checkedNodes = vue.ref([]);
  19712. const isHoverMenu = vue.computed(() => config.value.expandTrigger === "hover");
  19713. const renderLabelFn = vue.computed(() => props.renderLabel || slots.default);
  19714. const initStore = () => {
  19715. const { options } = props;
  19716. const cfg = config.value;
  19717. manualChecked = false;
  19718. store = new Store(options, cfg);
  19719. menus.value = [store.getNodes()];
  19720. if (cfg.lazy && isEmpty(props.options)) {
  19721. initialLoaded.value = false;
  19722. lazyLoad(void 0, (list) => {
  19723. if (list) {
  19724. store = new Store(list, cfg);
  19725. menus.value = [store.getNodes()];
  19726. }
  19727. initialLoaded.value = true;
  19728. syncCheckedValue(false, true);
  19729. });
  19730. } else {
  19731. syncCheckedValue(false, true);
  19732. }
  19733. };
  19734. const lazyLoad = (node, cb) => {
  19735. const cfg = config.value;
  19736. node = node || new Node$3({}, cfg, void 0, true);
  19737. node.loading = true;
  19738. const resolve = (dataList) => {
  19739. const _node = node;
  19740. const parent = _node.root ? null : _node;
  19741. dataList && (store == null ? void 0 : store.appendNodes(dataList, parent));
  19742. _node.loading = false;
  19743. _node.loaded = true;
  19744. _node.childrenData = _node.childrenData || [];
  19745. cb && cb(dataList);
  19746. };
  19747. cfg.lazyLoad(node, resolve);
  19748. };
  19749. const expandNode = (node, silent) => {
  19750. var _a;
  19751. const { level } = node;
  19752. const newMenus = menus.value.slice(0, level);
  19753. let newExpandingNode;
  19754. if (node.isLeaf) {
  19755. newExpandingNode = node.pathNodes[level - 2];
  19756. } else {
  19757. newExpandingNode = node;
  19758. newMenus.push(node.children);
  19759. }
  19760. if (((_a = expandingNode.value) == null ? void 0 : _a.uid) !== (newExpandingNode == null ? void 0 : newExpandingNode.uid)) {
  19761. expandingNode.value = node;
  19762. menus.value = newMenus;
  19763. !silent && emit("expand-change", (node == null ? void 0 : node.pathValues) || []);
  19764. }
  19765. };
  19766. const handleCheckChange = (node, checked, emitClose = true) => {
  19767. const { checkStrictly, multiple } = config.value;
  19768. const oldNode = checkedNodes.value[0];
  19769. manualChecked = true;
  19770. !multiple && (oldNode == null ? void 0 : oldNode.doCheck(false));
  19771. node.doCheck(checked);
  19772. calculateCheckedValue();
  19773. emitClose && !multiple && !checkStrictly && emit("close");
  19774. !emitClose && !multiple && !checkStrictly && expandParentNode(node);
  19775. };
  19776. const expandParentNode = (node) => {
  19777. if (!node)
  19778. return;
  19779. node = node.parent;
  19780. expandParentNode(node);
  19781. node && expandNode(node);
  19782. };
  19783. const getFlattedNodes = (leafOnly) => {
  19784. return store == null ? void 0 : store.getFlattedNodes(leafOnly);
  19785. };
  19786. const getCheckedNodes = (leafOnly) => {
  19787. var _a;
  19788. return (_a = getFlattedNodes(leafOnly)) == null ? void 0 : _a.filter((node) => node.checked !== false);
  19789. };
  19790. const clearCheckedNodes = () => {
  19791. checkedNodes.value.forEach((node) => node.doCheck(false));
  19792. calculateCheckedValue();
  19793. };
  19794. const calculateCheckedValue = () => {
  19795. var _a;
  19796. const { checkStrictly, multiple } = config.value;
  19797. const oldNodes = checkedNodes.value;
  19798. const newNodes = getCheckedNodes(!checkStrictly);
  19799. const nodes = sortByOriginalOrder(oldNodes, newNodes);
  19800. const values = nodes.map((node) => node.valueByOption);
  19801. checkedNodes.value = nodes;
  19802. checkedValue.value = multiple ? values : (_a = values[0]) != null ? _a : null;
  19803. };
  19804. const syncCheckedValue = (loaded = false, forced = false) => {
  19805. const { modelValue } = props;
  19806. const { lazy, multiple, checkStrictly } = config.value;
  19807. const leafOnly = !checkStrictly;
  19808. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value))
  19809. return;
  19810. if (lazy && !loaded) {
  19811. const values = unique(flattenDeep(castArray(modelValue)));
  19812. const nodes = values.map((val) => store == null ? void 0 : store.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  19813. if (nodes.length) {
  19814. nodes.forEach((node) => {
  19815. lazyLoad(node, () => syncCheckedValue(false, forced));
  19816. });
  19817. } else {
  19818. syncCheckedValue(true, forced);
  19819. }
  19820. } else {
  19821. const values = multiple ? castArray(modelValue) : [modelValue];
  19822. const nodes = unique(values.map((val) => store == null ? void 0 : store.getNodeByValue(val, leafOnly)));
  19823. syncMenuState(nodes, forced);
  19824. checkedValue.value = cloneDeep(modelValue);
  19825. }
  19826. };
  19827. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  19828. const { checkStrictly } = config.value;
  19829. const oldNodes = checkedNodes.value;
  19830. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  19831. const oldExpandingNode = store == null ? void 0 : store.getSameNode(expandingNode.value);
  19832. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  19833. if (newExpandingNode) {
  19834. newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  19835. } else {
  19836. expandingNode.value = null;
  19837. }
  19838. oldNodes.forEach((node) => node.doCheck(false));
  19839. newNodes.forEach((node) => node.doCheck(true));
  19840. checkedNodes.value = newNodes;
  19841. vue.nextTick(scrollToExpandingNode);
  19842. };
  19843. const scrollToExpandingNode = () => {
  19844. if (!isClient)
  19845. return;
  19846. menuList.value.forEach((menu) => {
  19847. const menuElement = menu == null ? void 0 : menu.$el;
  19848. if (menuElement) {
  19849. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  19850. const activeNode = menuElement.querySelector(`.${ns.b("node")}.${ns.is("active")}`) || menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  19851. scrollIntoView(container, activeNode);
  19852. }
  19853. });
  19854. };
  19855. const handleKeyDown = (e) => {
  19856. const target = e.target;
  19857. const { code } = e;
  19858. switch (code) {
  19859. case EVENT_CODE.up:
  19860. case EVENT_CODE.down: {
  19861. e.preventDefault();
  19862. const distance = code === EVENT_CODE.up ? -1 : 1;
  19863. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  19864. break;
  19865. }
  19866. case EVENT_CODE.left: {
  19867. e.preventDefault();
  19868. const preMenu = menuList.value[getMenuIndex(target) - 1];
  19869. const expandedNode = preMenu == null ? void 0 : preMenu.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  19870. focusNode(expandedNode);
  19871. break;
  19872. }
  19873. case EVENT_CODE.right: {
  19874. e.preventDefault();
  19875. const nextMenu = menuList.value[getMenuIndex(target) + 1];
  19876. const firstNode = nextMenu == null ? void 0 : nextMenu.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  19877. focusNode(firstNode);
  19878. break;
  19879. }
  19880. case EVENT_CODE.enter:
  19881. checkNode(target);
  19882. break;
  19883. }
  19884. };
  19885. vue.provide(CASCADER_PANEL_INJECTION_KEY, vue.reactive({
  19886. config,
  19887. expandingNode,
  19888. checkedNodes,
  19889. isHoverMenu,
  19890. initialLoaded,
  19891. renderLabelFn,
  19892. lazyLoad,
  19893. expandNode,
  19894. handleCheckChange
  19895. }));
  19896. vue.watch([config, () => props.options], initStore, {
  19897. deep: true,
  19898. immediate: true
  19899. });
  19900. vue.watch(() => props.modelValue, () => {
  19901. manualChecked = false;
  19902. syncCheckedValue();
  19903. }, {
  19904. deep: true
  19905. });
  19906. vue.watch(() => checkedValue.value, (val) => {
  19907. if (!isEqual$1(val, props.modelValue)) {
  19908. emit(UPDATE_MODEL_EVENT, val);
  19909. emit(CHANGE_EVENT, val);
  19910. }
  19911. });
  19912. vue.onBeforeUpdate(() => menuList.value = []);
  19913. vue.onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  19914. return {
  19915. ns,
  19916. menuList,
  19917. menus,
  19918. checkedNodes,
  19919. handleKeyDown,
  19920. handleCheckChange,
  19921. getFlattedNodes,
  19922. getCheckedNodes,
  19923. clearCheckedNodes,
  19924. calculateCheckedValue,
  19925. scrollToExpandingNode
  19926. };
  19927. }
  19928. });
  19929. function _sfc_render$v(_ctx, _cache, $props, $setup, $data, $options) {
  19930. const _component_el_cascader_menu = vue.resolveComponent("el-cascader-menu");
  19931. return vue.openBlock(), vue.createElementBlock("div", {
  19932. class: vue.normalizeClass([_ctx.ns.b("panel"), _ctx.ns.is("bordered", _ctx.border)]),
  19933. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args))
  19934. }, [
  19935. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menus, (menu, index) => {
  19936. return vue.openBlock(), vue.createBlock(_component_el_cascader_menu, {
  19937. key: index,
  19938. ref_for: true,
  19939. ref: (item) => _ctx.menuList[index] = item,
  19940. index,
  19941. nodes: [...menu]
  19942. }, null, 8, ["index", "nodes"]);
  19943. }), 128))
  19944. ], 34);
  19945. }
  19946. var CascaderPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1D, [["render", _sfc_render$v], ["__file", "index.vue"]]);
  19947. CascaderPanel.install = (app) => {
  19948. app.component(CascaderPanel.name, CascaderPanel);
  19949. };
  19950. const _CascaderPanel = CascaderPanel;
  19951. const ElCascaderPanel = _CascaderPanel;
  19952. const tagProps = buildProps({
  19953. closable: Boolean,
  19954. type: {
  19955. type: String,
  19956. values: ["success", "info", "warning", "danger", ""],
  19957. default: ""
  19958. },
  19959. hit: Boolean,
  19960. disableTransitions: Boolean,
  19961. color: {
  19962. type: String,
  19963. default: ""
  19964. },
  19965. size: {
  19966. type: String,
  19967. values: componentSizes,
  19968. default: ""
  19969. },
  19970. effect: {
  19971. type: String,
  19972. values: ["dark", "light", "plain"],
  19973. default: "light"
  19974. },
  19975. round: Boolean
  19976. });
  19977. const tagEmits = {
  19978. close: (evt) => evt instanceof MouseEvent,
  19979. click: (evt) => evt instanceof MouseEvent
  19980. };
  19981. const __default__$10 = vue.defineComponent({
  19982. name: "ElTag"
  19983. });
  19984. const _sfc_main$1C = /* @__PURE__ */ vue.defineComponent({
  19985. ...__default__$10,
  19986. props: tagProps,
  19987. emits: tagEmits,
  19988. setup(__props, { emit }) {
  19989. const props = __props;
  19990. const tagSize = useSize();
  19991. const ns = useNamespace("tag");
  19992. const classes = vue.computed(() => {
  19993. const { type, hit, effect, closable, round } = props;
  19994. return [
  19995. ns.b(),
  19996. ns.is("closable", closable),
  19997. ns.m(type),
  19998. ns.m(tagSize.value),
  19999. ns.m(effect),
  20000. ns.is("hit", hit),
  20001. ns.is("round", round)
  20002. ];
  20003. });
  20004. const handleClose = (event) => {
  20005. emit("close", event);
  20006. };
  20007. const handleClick = (event) => {
  20008. emit("click", event);
  20009. };
  20010. return (_ctx, _cache) => {
  20011. return _ctx.disableTransitions ? (vue.openBlock(), vue.createElementBlock("span", {
  20012. key: 0,
  20013. class: vue.normalizeClass(vue.unref(classes)),
  20014. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  20015. onClick: handleClick
  20016. }, [
  20017. vue.createElementVNode("span", {
  20018. class: vue.normalizeClass(vue.unref(ns).e("content"))
  20019. }, [
  20020. vue.renderSlot(_ctx.$slots, "default")
  20021. ], 2),
  20022. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  20023. key: 0,
  20024. class: vue.normalizeClass(vue.unref(ns).e("close")),
  20025. onClick: vue.withModifiers(handleClose, ["stop"])
  20026. }, {
  20027. default: vue.withCtx(() => [
  20028. vue.createVNode(vue.unref(close_default))
  20029. ]),
  20030. _: 1
  20031. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  20032. ], 6)) : (vue.openBlock(), vue.createBlock(vue.Transition, {
  20033. key: 1,
  20034. name: `${vue.unref(ns).namespace.value}-zoom-in-center`,
  20035. appear: ""
  20036. }, {
  20037. default: vue.withCtx(() => [
  20038. vue.createElementVNode("span", {
  20039. class: vue.normalizeClass(vue.unref(classes)),
  20040. style: vue.normalizeStyle({ backgroundColor: _ctx.color }),
  20041. onClick: handleClick
  20042. }, [
  20043. vue.createElementVNode("span", {
  20044. class: vue.normalizeClass(vue.unref(ns).e("content"))
  20045. }, [
  20046. vue.renderSlot(_ctx.$slots, "default")
  20047. ], 2),
  20048. _ctx.closable ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  20049. key: 0,
  20050. class: vue.normalizeClass(vue.unref(ns).e("close")),
  20051. onClick: vue.withModifiers(handleClose, ["stop"])
  20052. }, {
  20053. default: vue.withCtx(() => [
  20054. vue.createVNode(vue.unref(close_default))
  20055. ]),
  20056. _: 1
  20057. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  20058. ], 6)
  20059. ]),
  20060. _: 3
  20061. }, 8, ["name"]));
  20062. };
  20063. }
  20064. });
  20065. var Tag = /* @__PURE__ */ _export_sfc(_sfc_main$1C, [["__file", "tag.vue"]]);
  20066. const ElTag = withInstall(Tag);
  20067. const popperOptions = {
  20068. modifiers: [
  20069. {
  20070. name: "arrowPosition",
  20071. enabled: true,
  20072. phase: "main",
  20073. fn: ({ state }) => {
  20074. const { modifiersData, placement } = state;
  20075. if (["right", "left", "bottom", "top"].includes(placement))
  20076. return;
  20077. modifiersData.arrow.x = 35;
  20078. },
  20079. requires: ["arrow"]
  20080. }
  20081. ]
  20082. };
  20083. const COMPONENT_NAME$f = "ElCascader";
  20084. const _sfc_main$1B = vue.defineComponent({
  20085. name: COMPONENT_NAME$f,
  20086. components: {
  20087. ElCascaderPanel: _CascaderPanel,
  20088. ElInput,
  20089. ElTooltip,
  20090. ElScrollbar,
  20091. ElTag,
  20092. ElIcon,
  20093. CircleClose: circle_close_default,
  20094. Check: check_default,
  20095. ArrowDown: arrow_down_default
  20096. },
  20097. directives: {
  20098. Clickoutside: ClickOutside
  20099. },
  20100. props: {
  20101. ...CommonProps,
  20102. size: {
  20103. type: String,
  20104. validator: isValidComponentSize
  20105. },
  20106. placeholder: {
  20107. type: String
  20108. },
  20109. disabled: Boolean,
  20110. clearable: Boolean,
  20111. filterable: Boolean,
  20112. filterMethod: {
  20113. type: Function,
  20114. default: (node, keyword) => node.text.includes(keyword)
  20115. },
  20116. separator: {
  20117. type: String,
  20118. default: " / "
  20119. },
  20120. showAllLevels: {
  20121. type: Boolean,
  20122. default: true
  20123. },
  20124. collapseTags: Boolean,
  20125. collapseTagsTooltip: {
  20126. type: Boolean,
  20127. default: false
  20128. },
  20129. debounce: {
  20130. type: Number,
  20131. default: 300
  20132. },
  20133. beforeFilter: {
  20134. type: Function,
  20135. default: () => true
  20136. },
  20137. popperClass: {
  20138. type: String,
  20139. default: ""
  20140. },
  20141. teleported: useTooltipContentProps.teleported,
  20142. tagType: { ...tagProps.type, default: "info" },
  20143. validateEvent: {
  20144. type: Boolean,
  20145. default: true
  20146. }
  20147. },
  20148. emits: [
  20149. UPDATE_MODEL_EVENT,
  20150. CHANGE_EVENT,
  20151. "focus",
  20152. "blur",
  20153. "visible-change",
  20154. "expand-change",
  20155. "remove-tag"
  20156. ],
  20157. setup(props, { emit }) {
  20158. let inputInitialHeight = 0;
  20159. let pressDeleteCount = 0;
  20160. const nsCascader = useNamespace("cascader");
  20161. const nsInput = useNamespace("input");
  20162. const { t } = useLocale();
  20163. const { form, formItem } = useFormItem();
  20164. const tooltipRef = vue.ref(null);
  20165. const input = vue.ref(null);
  20166. const tagWrapper = vue.ref(null);
  20167. const panel = vue.ref(null);
  20168. const suggestionPanel = vue.ref(null);
  20169. const popperVisible = vue.ref(false);
  20170. const inputHover = vue.ref(false);
  20171. const filtering = vue.ref(false);
  20172. const inputValue = vue.ref("");
  20173. const searchInputValue = vue.ref("");
  20174. const presentTags = vue.ref([]);
  20175. const allPresentTags = vue.ref([]);
  20176. const suggestions = vue.ref([]);
  20177. const isOnComposition = vue.ref(false);
  20178. const isDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  20179. const inputPlaceholder = vue.computed(() => props.placeholder || t("el.cascader.placeholder"));
  20180. const currentPlaceholder = vue.computed(() => searchInputValue.value || presentTags.value.length > 0 ? "" : inputPlaceholder.value);
  20181. const realSize = useSize();
  20182. const tagSize = vue.computed(() => ["small"].includes(realSize.value) ? "small" : "default");
  20183. const multiple = vue.computed(() => !!props.props.multiple);
  20184. const readonly = vue.computed(() => !props.filterable || multiple.value);
  20185. const searchKeyword = vue.computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  20186. const checkedNodes = vue.computed(() => {
  20187. var _a;
  20188. return ((_a = panel.value) == null ? void 0 : _a.checkedNodes) || [];
  20189. });
  20190. const clearBtnVisible = vue.computed(() => {
  20191. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value)
  20192. return false;
  20193. return !!checkedNodes.value.length;
  20194. });
  20195. const presentText = vue.computed(() => {
  20196. const { showAllLevels, separator } = props;
  20197. const nodes = checkedNodes.value;
  20198. return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
  20199. });
  20200. const checkedValue = vue.computed({
  20201. get() {
  20202. return cloneDeep(props.modelValue);
  20203. },
  20204. set(val) {
  20205. emit(UPDATE_MODEL_EVENT, val);
  20206. emit(CHANGE_EVENT, val);
  20207. if (props.validateEvent) {
  20208. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  20209. }
  20210. }
  20211. });
  20212. const popperPaneRef = vue.computed(() => {
  20213. var _a, _b;
  20214. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  20215. });
  20216. const togglePopperVisible = (visible) => {
  20217. var _a, _b, _c;
  20218. if (isDisabled.value)
  20219. return;
  20220. visible = visible != null ? visible : !popperVisible.value;
  20221. if (visible !== popperVisible.value) {
  20222. popperVisible.value = visible;
  20223. (_b = (_a = input.value) == null ? void 0 : _a.input) == null ? void 0 : _b.setAttribute("aria-expanded", `${visible}`);
  20224. if (visible) {
  20225. updatePopperPosition();
  20226. vue.nextTick((_c = panel.value) == null ? void 0 : _c.scrollToExpandingNode);
  20227. } else if (props.filterable) {
  20228. syncPresentTextValue();
  20229. }
  20230. emit("visible-change", visible);
  20231. }
  20232. };
  20233. const updatePopperPosition = () => {
  20234. vue.nextTick(() => {
  20235. var _a;
  20236. (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper();
  20237. });
  20238. };
  20239. const hideSuggestionPanel = () => {
  20240. filtering.value = false;
  20241. };
  20242. const genTag = (node) => {
  20243. const { showAllLevels, separator } = props;
  20244. return {
  20245. node,
  20246. key: node.uid,
  20247. text: node.calcText(showAllLevels, separator),
  20248. hitState: false,
  20249. closable: !isDisabled.value && !node.isDisabled,
  20250. isCollapseTag: false
  20251. };
  20252. };
  20253. const deleteTag = (tag) => {
  20254. var _a;
  20255. const node = tag.node;
  20256. node.doCheck(false);
  20257. (_a = panel.value) == null ? void 0 : _a.calculateCheckedValue();
  20258. emit("remove-tag", node.valueByOption);
  20259. };
  20260. const calculatePresentTags = () => {
  20261. if (!multiple.value)
  20262. return;
  20263. const nodes = checkedNodes.value;
  20264. const tags = [];
  20265. const allTags = [];
  20266. nodes.forEach((node) => allTags.push(genTag(node)));
  20267. allPresentTags.value = allTags;
  20268. if (nodes.length) {
  20269. const [first, ...rest] = nodes;
  20270. const restCount = rest.length;
  20271. tags.push(genTag(first));
  20272. if (restCount) {
  20273. if (props.collapseTags) {
  20274. tags.push({
  20275. key: -1,
  20276. text: `+ ${restCount}`,
  20277. closable: false,
  20278. isCollapseTag: true
  20279. });
  20280. } else {
  20281. rest.forEach((node) => tags.push(genTag(node)));
  20282. }
  20283. }
  20284. }
  20285. presentTags.value = tags;
  20286. };
  20287. const calculateSuggestions = () => {
  20288. var _a, _b;
  20289. const { filterMethod, showAllLevels, separator } = props;
  20290. const res = (_b = (_a = panel.value) == null ? void 0 : _a.getFlattedNodes(!props.props.checkStrictly)) == null ? void 0 : _b.filter((node) => {
  20291. if (node.isDisabled)
  20292. return false;
  20293. node.calcText(showAllLevels, separator);
  20294. return filterMethod(node, searchKeyword.value);
  20295. });
  20296. if (multiple.value) {
  20297. presentTags.value.forEach((tag) => {
  20298. tag.hitState = false;
  20299. });
  20300. allPresentTags.value.forEach((tag) => {
  20301. tag.hitState = false;
  20302. });
  20303. }
  20304. filtering.value = true;
  20305. suggestions.value = res;
  20306. updatePopperPosition();
  20307. };
  20308. const focusFirstNode = () => {
  20309. var _a;
  20310. let firstNode;
  20311. if (filtering.value && suggestionPanel.value) {
  20312. firstNode = suggestionPanel.value.$el.querySelector(`.${nsCascader.e("suggestion-item")}`);
  20313. } else {
  20314. firstNode = (_a = panel.value) == null ? void 0 : _a.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  20315. }
  20316. if (firstNode) {
  20317. firstNode.focus();
  20318. !filtering.value && firstNode.click();
  20319. }
  20320. };
  20321. const updateStyle = () => {
  20322. var _a, _b;
  20323. const inputInner = (_a = input.value) == null ? void 0 : _a.input;
  20324. const tagWrapperEl = tagWrapper.value;
  20325. const suggestionPanelEl = (_b = suggestionPanel.value) == null ? void 0 : _b.$el;
  20326. if (!isClient || !inputInner)
  20327. return;
  20328. if (suggestionPanelEl) {
  20329. const suggestionList = suggestionPanelEl.querySelector(`.${nsCascader.e("suggestion-list")}`);
  20330. suggestionList.style.minWidth = `${inputInner.offsetWidth}px`;
  20331. }
  20332. if (tagWrapperEl) {
  20333. const { offsetHeight } = tagWrapperEl;
  20334. const height = presentTags.value.length > 0 ? `${Math.max(offsetHeight + 6, inputInitialHeight)}px` : `${inputInitialHeight}px`;
  20335. inputInner.style.height = height;
  20336. updatePopperPosition();
  20337. }
  20338. };
  20339. const getCheckedNodes = (leafOnly) => {
  20340. var _a;
  20341. return (_a = panel.value) == null ? void 0 : _a.getCheckedNodes(leafOnly);
  20342. };
  20343. const handleExpandChange = (value) => {
  20344. updatePopperPosition();
  20345. emit("expand-change", value);
  20346. };
  20347. const handleComposition = (event) => {
  20348. var _a;
  20349. const text = (_a = event.target) == null ? void 0 : _a.value;
  20350. if (event.type === "compositionend") {
  20351. isOnComposition.value = false;
  20352. vue.nextTick(() => handleInput(text));
  20353. } else {
  20354. const lastCharacter = text[text.length - 1] || "";
  20355. isOnComposition.value = !isKorean(lastCharacter);
  20356. }
  20357. };
  20358. const handleKeyDown = (e) => {
  20359. if (isOnComposition.value)
  20360. return;
  20361. switch (e.code) {
  20362. case EVENT_CODE.enter:
  20363. togglePopperVisible();
  20364. break;
  20365. case EVENT_CODE.down:
  20366. togglePopperVisible(true);
  20367. vue.nextTick(focusFirstNode);
  20368. e.preventDefault();
  20369. break;
  20370. case EVENT_CODE.esc:
  20371. if (popperVisible.value === true) {
  20372. e.preventDefault();
  20373. e.stopPropagation();
  20374. togglePopperVisible(false);
  20375. }
  20376. break;
  20377. case EVENT_CODE.tab:
  20378. togglePopperVisible(false);
  20379. break;
  20380. }
  20381. };
  20382. const handleClear = () => {
  20383. var _a;
  20384. (_a = panel.value) == null ? void 0 : _a.clearCheckedNodes();
  20385. if (!popperVisible.value && props.filterable) {
  20386. syncPresentTextValue();
  20387. }
  20388. togglePopperVisible(false);
  20389. };
  20390. const syncPresentTextValue = () => {
  20391. const { value } = presentText;
  20392. inputValue.value = value;
  20393. searchInputValue.value = value;
  20394. };
  20395. const handleSuggestionClick = (node) => {
  20396. var _a, _b;
  20397. const { checked } = node;
  20398. if (multiple.value) {
  20399. (_a = panel.value) == null ? void 0 : _a.handleCheckChange(node, !checked, false);
  20400. } else {
  20401. !checked && ((_b = panel.value) == null ? void 0 : _b.handleCheckChange(node, true, false));
  20402. togglePopperVisible(false);
  20403. }
  20404. };
  20405. const handleSuggestionKeyDown = (e) => {
  20406. const target = e.target;
  20407. const { code } = e;
  20408. switch (code) {
  20409. case EVENT_CODE.up:
  20410. case EVENT_CODE.down: {
  20411. const distance = code === EVENT_CODE.up ? -1 : 1;
  20412. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  20413. break;
  20414. }
  20415. case EVENT_CODE.enter:
  20416. target.click();
  20417. break;
  20418. }
  20419. };
  20420. const handleDelete = () => {
  20421. const tags = presentTags.value;
  20422. const lastTag = tags[tags.length - 1];
  20423. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  20424. if (!lastTag || !pressDeleteCount || props.collapseTags && tags.length > 1)
  20425. return;
  20426. if (lastTag.hitState) {
  20427. deleteTag(lastTag);
  20428. } else {
  20429. lastTag.hitState = true;
  20430. }
  20431. };
  20432. const handleFilter = debounce(() => {
  20433. const { value } = searchKeyword;
  20434. if (!value)
  20435. return;
  20436. const passed = props.beforeFilter(value);
  20437. if (isPromise(passed)) {
  20438. passed.then(calculateSuggestions).catch(() => {
  20439. });
  20440. } else if (passed !== false) {
  20441. calculateSuggestions();
  20442. } else {
  20443. hideSuggestionPanel();
  20444. }
  20445. }, props.debounce);
  20446. const handleInput = (val, e) => {
  20447. !popperVisible.value && togglePopperVisible(true);
  20448. if (e == null ? void 0 : e.isComposing)
  20449. return;
  20450. val ? handleFilter() : hideSuggestionPanel();
  20451. };
  20452. vue.watch(filtering, updatePopperPosition);
  20453. vue.watch([checkedNodes, isDisabled], calculatePresentTags);
  20454. vue.watch(presentTags, () => {
  20455. vue.nextTick(() => updateStyle());
  20456. });
  20457. vue.watch(presentText, syncPresentTextValue, { immediate: true });
  20458. vue.onMounted(() => {
  20459. const inputInner = input.value.input;
  20460. const inputInnerHeight = Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
  20461. inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
  20462. useResizeObserver(inputInner, updateStyle);
  20463. });
  20464. return {
  20465. popperOptions,
  20466. tooltipRef,
  20467. popperPaneRef,
  20468. input,
  20469. tagWrapper,
  20470. panel,
  20471. suggestionPanel,
  20472. popperVisible,
  20473. inputHover,
  20474. inputPlaceholder,
  20475. currentPlaceholder,
  20476. filtering,
  20477. presentText,
  20478. checkedValue,
  20479. inputValue,
  20480. searchInputValue,
  20481. presentTags,
  20482. allPresentTags,
  20483. suggestions,
  20484. isDisabled,
  20485. isOnComposition,
  20486. realSize,
  20487. tagSize,
  20488. multiple,
  20489. readonly,
  20490. clearBtnVisible,
  20491. nsCascader,
  20492. nsInput,
  20493. t,
  20494. togglePopperVisible,
  20495. hideSuggestionPanel,
  20496. deleteTag,
  20497. focusFirstNode,
  20498. getCheckedNodes,
  20499. handleExpandChange,
  20500. handleKeyDown,
  20501. handleComposition,
  20502. handleClear,
  20503. handleSuggestionClick,
  20504. handleSuggestionKeyDown,
  20505. handleDelete,
  20506. handleInput
  20507. };
  20508. }
  20509. });
  20510. const _hoisted_1$O = { key: 0 };
  20511. const _hoisted_2$w = ["placeholder"];
  20512. const _hoisted_3$h = ["onClick"];
  20513. function _sfc_render$u(_ctx, _cache, $props, $setup, $data, $options) {
  20514. const _component_circle_close = vue.resolveComponent("circle-close");
  20515. const _component_el_icon = vue.resolveComponent("el-icon");
  20516. const _component_arrow_down = vue.resolveComponent("arrow-down");
  20517. const _component_el_input = vue.resolveComponent("el-input");
  20518. const _component_el_tag = vue.resolveComponent("el-tag");
  20519. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  20520. const _component_el_cascader_panel = vue.resolveComponent("el-cascader-panel");
  20521. const _component_check = vue.resolveComponent("check");
  20522. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  20523. const _directive_clickoutside = vue.resolveDirective("clickoutside");
  20524. return vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  20525. ref: "tooltipRef",
  20526. visible: _ctx.popperVisible,
  20527. teleported: _ctx.teleported,
  20528. "popper-class": [_ctx.nsCascader.e("dropdown"), _ctx.popperClass],
  20529. "popper-options": _ctx.popperOptions,
  20530. "fallback-placements": [
  20531. "bottom-start",
  20532. "bottom",
  20533. "top-start",
  20534. "top",
  20535. "right",
  20536. "left"
  20537. ],
  20538. "stop-popper-mouse-event": false,
  20539. "gpu-acceleration": false,
  20540. placement: "bottom-start",
  20541. transition: `${_ctx.nsCascader.namespace.value}-zoom-in-top`,
  20542. effect: "light",
  20543. pure: "",
  20544. persistent: "",
  20545. onHide: _ctx.hideSuggestionPanel
  20546. }, {
  20547. default: vue.withCtx(() => [
  20548. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  20549. class: vue.normalizeClass([
  20550. _ctx.nsCascader.b(),
  20551. _ctx.nsCascader.m(_ctx.realSize),
  20552. _ctx.nsCascader.is("disabled", _ctx.isDisabled),
  20553. _ctx.$attrs.class
  20554. ]),
  20555. style: vue.normalizeStyle(_ctx.$attrs.style),
  20556. onClick: _cache[11] || (_cache[11] = () => _ctx.togglePopperVisible(_ctx.readonly ? void 0 : true)),
  20557. onKeydown: _cache[12] || (_cache[12] = (...args) => _ctx.handleKeyDown && _ctx.handleKeyDown(...args)),
  20558. onMouseenter: _cache[13] || (_cache[13] = ($event) => _ctx.inputHover = true),
  20559. onMouseleave: _cache[14] || (_cache[14] = ($event) => _ctx.inputHover = false)
  20560. }, [
  20561. vue.createVNode(_component_el_input, {
  20562. ref: "input",
  20563. modelValue: _ctx.inputValue,
  20564. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.inputValue = $event),
  20565. placeholder: _ctx.currentPlaceholder,
  20566. readonly: _ctx.readonly,
  20567. disabled: _ctx.isDisabled,
  20568. "validate-event": false,
  20569. size: _ctx.realSize,
  20570. class: vue.normalizeClass(_ctx.nsCascader.is("focus", _ctx.popperVisible)),
  20571. onCompositionstart: _ctx.handleComposition,
  20572. onCompositionupdate: _ctx.handleComposition,
  20573. onCompositionend: _ctx.handleComposition,
  20574. onFocus: _cache[2] || (_cache[2] = (e) => _ctx.$emit("focus", e)),
  20575. onBlur: _cache[3] || (_cache[3] = (e) => _ctx.$emit("blur", e)),
  20576. onInput: _ctx.handleInput
  20577. }, {
  20578. suffix: vue.withCtx(() => [
  20579. _ctx.clearBtnVisible ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  20580. key: "clear",
  20581. class: vue.normalizeClass([_ctx.nsInput.e("icon"), "icon-circle-close"]),
  20582. onClick: vue.withModifiers(_ctx.handleClear, ["stop"])
  20583. }, {
  20584. default: vue.withCtx(() => [
  20585. vue.createVNode(_component_circle_close)
  20586. ]),
  20587. _: 1
  20588. }, 8, ["class", "onClick"])) : (vue.openBlock(), vue.createBlock(_component_el_icon, {
  20589. key: "arrow-down",
  20590. class: vue.normalizeClass([
  20591. _ctx.nsInput.e("icon"),
  20592. "icon-arrow-down",
  20593. _ctx.nsCascader.is("reverse", _ctx.popperVisible)
  20594. ]),
  20595. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => _ctx.togglePopperVisible(), ["stop"]))
  20596. }, {
  20597. default: vue.withCtx(() => [
  20598. vue.createVNode(_component_arrow_down)
  20599. ]),
  20600. _: 1
  20601. }, 8, ["class"]))
  20602. ]),
  20603. _: 1
  20604. }, 8, ["modelValue", "placeholder", "readonly", "disabled", "size", "class", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onInput"]),
  20605. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", {
  20606. key: 0,
  20607. ref: "tagWrapper",
  20608. class: vue.normalizeClass(_ctx.nsCascader.e("tags"))
  20609. }, [
  20610. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.presentTags, (tag) => {
  20611. return vue.openBlock(), vue.createBlock(_component_el_tag, {
  20612. key: tag.key,
  20613. type: _ctx.tagType,
  20614. size: _ctx.tagSize,
  20615. hit: tag.hitState,
  20616. closable: tag.closable,
  20617. "disable-transitions": "",
  20618. onClose: ($event) => _ctx.deleteTag(tag)
  20619. }, {
  20620. default: vue.withCtx(() => [
  20621. tag.isCollapseTag === false ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$O, vue.toDisplayString(tag.text), 1)) : (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  20622. key: 1,
  20623. teleported: false,
  20624. disabled: _ctx.popperVisible || !_ctx.collapseTagsTooltip,
  20625. "fallback-placements": ["bottom", "top", "right", "left"],
  20626. placement: "bottom",
  20627. effect: "light"
  20628. }, {
  20629. default: vue.withCtx(() => [
  20630. vue.createElementVNode("span", null, vue.toDisplayString(tag.text), 1)
  20631. ]),
  20632. content: vue.withCtx(() => [
  20633. vue.createElementVNode("div", {
  20634. class: vue.normalizeClass(_ctx.nsCascader.e("collapse-tags"))
  20635. }, [
  20636. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.allPresentTags.slice(1), (tag2, idx) => {
  20637. return vue.openBlock(), vue.createElementBlock("div", {
  20638. key: idx,
  20639. class: vue.normalizeClass(_ctx.nsCascader.e("collapse-tag"))
  20640. }, [
  20641. (vue.openBlock(), vue.createBlock(_component_el_tag, {
  20642. key: tag2.key,
  20643. class: "in-tooltip",
  20644. type: _ctx.tagType,
  20645. size: _ctx.tagSize,
  20646. hit: tag2.hitState,
  20647. closable: tag2.closable,
  20648. "disable-transitions": "",
  20649. onClose: ($event) => _ctx.deleteTag(tag2)
  20650. }, {
  20651. default: vue.withCtx(() => [
  20652. vue.createElementVNode("span", null, vue.toDisplayString(tag2.text), 1)
  20653. ]),
  20654. _: 2
  20655. }, 1032, ["type", "size", "hit", "closable", "onClose"]))
  20656. ], 2);
  20657. }), 128))
  20658. ], 2)
  20659. ]),
  20660. _: 2
  20661. }, 1032, ["disabled"]))
  20662. ]),
  20663. _: 2
  20664. }, 1032, ["type", "size", "hit", "closable", "onClose"]);
  20665. }), 128)),
  20666. _ctx.filterable && !_ctx.isDisabled ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  20667. key: 0,
  20668. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => _ctx.searchInputValue = $event),
  20669. type: "text",
  20670. class: vue.normalizeClass(_ctx.nsCascader.e("search-input")),
  20671. placeholder: _ctx.presentText ? "" : _ctx.inputPlaceholder,
  20672. onInput: _cache[5] || (_cache[5] = (e) => _ctx.handleInput(_ctx.searchInputValue, e)),
  20673. onClick: _cache[6] || (_cache[6] = vue.withModifiers(($event) => _ctx.togglePopperVisible(true), ["stop"])),
  20674. onKeydown: _cache[7] || (_cache[7] = vue.withKeys((...args) => _ctx.handleDelete && _ctx.handleDelete(...args), ["delete"])),
  20675. onCompositionstart: _cache[8] || (_cache[8] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  20676. onCompositionupdate: _cache[9] || (_cache[9] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  20677. onCompositionend: _cache[10] || (_cache[10] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args))
  20678. }, null, 42, _hoisted_2$w)), [
  20679. [vue.vModelText, _ctx.searchInputValue]
  20680. ]) : vue.createCommentVNode("v-if", true)
  20681. ], 2)) : vue.createCommentVNode("v-if", true)
  20682. ], 38)), [
  20683. [_directive_clickoutside, () => _ctx.togglePopperVisible(false), _ctx.popperPaneRef]
  20684. ])
  20685. ]),
  20686. content: vue.withCtx(() => [
  20687. vue.withDirectives(vue.createVNode(_component_el_cascader_panel, {
  20688. ref: "panel",
  20689. modelValue: _ctx.checkedValue,
  20690. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.checkedValue = $event),
  20691. options: _ctx.options,
  20692. props: _ctx.props,
  20693. border: false,
  20694. "render-label": _ctx.$slots.default,
  20695. onExpandChange: _ctx.handleExpandChange,
  20696. onClose: _cache[16] || (_cache[16] = ($event) => _ctx.$nextTick(() => _ctx.togglePopperVisible(false)))
  20697. }, null, 8, ["modelValue", "options", "props", "render-label", "onExpandChange"]), [
  20698. [vue.vShow, !_ctx.filtering]
  20699. ]),
  20700. _ctx.filterable ? vue.withDirectives((vue.openBlock(), vue.createBlock(_component_el_scrollbar, {
  20701. key: 0,
  20702. ref: "suggestionPanel",
  20703. tag: "ul",
  20704. class: vue.normalizeClass(_ctx.nsCascader.e("suggestion-panel")),
  20705. "view-class": _ctx.nsCascader.e("suggestion-list"),
  20706. onKeydown: _ctx.handleSuggestionKeyDown
  20707. }, {
  20708. default: vue.withCtx(() => [
  20709. _ctx.suggestions.length ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 0 }, vue.renderList(_ctx.suggestions, (item) => {
  20710. return vue.openBlock(), vue.createElementBlock("li", {
  20711. key: item.uid,
  20712. class: vue.normalizeClass([
  20713. _ctx.nsCascader.e("suggestion-item"),
  20714. _ctx.nsCascader.is("checked", item.checked)
  20715. ]),
  20716. tabindex: -1,
  20717. onClick: ($event) => _ctx.handleSuggestionClick(item)
  20718. }, [
  20719. vue.createElementVNode("span", null, vue.toDisplayString(item.text), 1),
  20720. item.checked ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
  20721. default: vue.withCtx(() => [
  20722. vue.createVNode(_component_check)
  20723. ]),
  20724. _: 1
  20725. })) : vue.createCommentVNode("v-if", true)
  20726. ], 10, _hoisted_3$h);
  20727. }), 128)) : vue.renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
  20728. vue.createElementVNode("li", {
  20729. class: vue.normalizeClass(_ctx.nsCascader.e("empty-text"))
  20730. }, vue.toDisplayString(_ctx.t("el.cascader.noMatch")), 3)
  20731. ])
  20732. ]),
  20733. _: 3
  20734. }, 8, ["class", "view-class", "onKeydown"])), [
  20735. [vue.vShow, _ctx.filtering]
  20736. ]) : vue.createCommentVNode("v-if", true)
  20737. ]),
  20738. _: 3
  20739. }, 8, ["visible", "teleported", "popper-class", "popper-options", "transition", "onHide"]);
  20740. }
  20741. var Cascader = /* @__PURE__ */ _export_sfc(_sfc_main$1B, [["render", _sfc_render$u], ["__file", "index.vue"]]);
  20742. Cascader.install = (app) => {
  20743. app.component(Cascader.name, Cascader);
  20744. };
  20745. const _Cascader = Cascader;
  20746. const ElCascader = _Cascader;
  20747. const checkTagProps = buildProps({
  20748. checked: {
  20749. type: Boolean,
  20750. default: false
  20751. }
  20752. });
  20753. const checkTagEmits = {
  20754. "update:checked": (value) => isBoolean(value),
  20755. [CHANGE_EVENT]: (value) => isBoolean(value)
  20756. };
  20757. const __default__$$ = vue.defineComponent({
  20758. name: "ElCheckTag"
  20759. });
  20760. const _sfc_main$1A = /* @__PURE__ */ vue.defineComponent({
  20761. ...__default__$$,
  20762. props: checkTagProps,
  20763. emits: checkTagEmits,
  20764. setup(__props, { emit }) {
  20765. const props = __props;
  20766. const ns = useNamespace("check-tag");
  20767. const handleChange = () => {
  20768. const checked = !props.checked;
  20769. emit(CHANGE_EVENT, checked);
  20770. emit("update:checked", checked);
  20771. };
  20772. return (_ctx, _cache) => {
  20773. return vue.openBlock(), vue.createElementBlock("span", {
  20774. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is("checked", _ctx.checked)]),
  20775. onClick: handleChange
  20776. }, [
  20777. vue.renderSlot(_ctx.$slots, "default")
  20778. ], 2);
  20779. };
  20780. }
  20781. });
  20782. var CheckTag = /* @__PURE__ */ _export_sfc(_sfc_main$1A, [["__file", "check-tag.vue"]]);
  20783. const ElCheckTag = withInstall(CheckTag);
  20784. const colProps = buildProps({
  20785. tag: {
  20786. type: String,
  20787. default: "div"
  20788. },
  20789. span: {
  20790. type: Number,
  20791. default: 24
  20792. },
  20793. offset: {
  20794. type: Number,
  20795. default: 0
  20796. },
  20797. pull: {
  20798. type: Number,
  20799. default: 0
  20800. },
  20801. push: {
  20802. type: Number,
  20803. default: 0
  20804. },
  20805. xs: {
  20806. type: definePropType([Number, Object]),
  20807. default: () => mutable({})
  20808. },
  20809. sm: {
  20810. type: definePropType([Number, Object]),
  20811. default: () => mutable({})
  20812. },
  20813. md: {
  20814. type: definePropType([Number, Object]),
  20815. default: () => mutable({})
  20816. },
  20817. lg: {
  20818. type: definePropType([Number, Object]),
  20819. default: () => mutable({})
  20820. },
  20821. xl: {
  20822. type: definePropType([Number, Object]),
  20823. default: () => mutable({})
  20824. }
  20825. });
  20826. const __default__$_ = vue.defineComponent({
  20827. name: "ElCol"
  20828. });
  20829. const _sfc_main$1z = /* @__PURE__ */ vue.defineComponent({
  20830. ...__default__$_,
  20831. props: colProps,
  20832. setup(__props) {
  20833. const props = __props;
  20834. const { gutter } = vue.inject(rowContextKey, { gutter: vue.computed(() => 0) });
  20835. const ns = useNamespace("col");
  20836. const style = vue.computed(() => {
  20837. const styles = {};
  20838. if (gutter.value) {
  20839. styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
  20840. }
  20841. return styles;
  20842. });
  20843. const classes = vue.computed(() => {
  20844. const classes2 = [];
  20845. const pos = ["span", "offset", "pull", "push"];
  20846. pos.forEach((prop) => {
  20847. const size = props[prop];
  20848. if (isNumber(size)) {
  20849. if (prop === "span")
  20850. classes2.push(ns.b(`${props[prop]}`));
  20851. else if (size > 0)
  20852. classes2.push(ns.b(`${prop}-${props[prop]}`));
  20853. }
  20854. });
  20855. const sizes = ["xs", "sm", "md", "lg", "xl"];
  20856. sizes.forEach((size) => {
  20857. if (isNumber(props[size])) {
  20858. classes2.push(ns.b(`${size}-${props[size]}`));
  20859. } else if (isObject$1(props[size])) {
  20860. Object.entries(props[size]).forEach(([prop, sizeProp]) => {
  20861. classes2.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
  20862. });
  20863. }
  20864. });
  20865. if (gutter.value) {
  20866. classes2.push(ns.is("guttered"));
  20867. }
  20868. return classes2;
  20869. });
  20870. return (_ctx, _cache) => {
  20871. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  20872. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(classes)]),
  20873. style: vue.normalizeStyle(vue.unref(style))
  20874. }, {
  20875. default: vue.withCtx(() => [
  20876. vue.renderSlot(_ctx.$slots, "default")
  20877. ]),
  20878. _: 3
  20879. }, 8, ["class", "style"]);
  20880. };
  20881. }
  20882. });
  20883. var Col = /* @__PURE__ */ _export_sfc(_sfc_main$1z, [["__file", "col.vue"]]);
  20884. const ElCol = withInstall(Col);
  20885. const emitChangeFn = (value) => typeof isNumber(value);
  20886. const collapseProps = buildProps({
  20887. accordion: Boolean,
  20888. modelValue: {
  20889. type: definePropType([Array, String, Number]),
  20890. default: () => mutable([])
  20891. }
  20892. });
  20893. const collapseEmits = {
  20894. [UPDATE_MODEL_EVENT]: emitChangeFn,
  20895. [CHANGE_EVENT]: emitChangeFn
  20896. };
  20897. const useCollapse = (props, emit) => {
  20898. const activeNames = vue.ref(castArray$1(props.modelValue));
  20899. const setActiveNames = (_activeNames) => {
  20900. activeNames.value = _activeNames;
  20901. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  20902. emit(UPDATE_MODEL_EVENT, value);
  20903. emit(CHANGE_EVENT, value);
  20904. };
  20905. const handleItemClick = (name) => {
  20906. if (props.accordion) {
  20907. setActiveNames([activeNames.value[0] === name ? "" : name]);
  20908. } else {
  20909. const _activeNames = [...activeNames.value];
  20910. const index = _activeNames.indexOf(name);
  20911. if (index > -1) {
  20912. _activeNames.splice(index, 1);
  20913. } else {
  20914. _activeNames.push(name);
  20915. }
  20916. setActiveNames(_activeNames);
  20917. }
  20918. };
  20919. vue.watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true });
  20920. vue.provide(collapseContextKey, {
  20921. activeNames,
  20922. handleItemClick
  20923. });
  20924. return {
  20925. activeNames,
  20926. setActiveNames
  20927. };
  20928. };
  20929. const useCollapseDOM = () => {
  20930. const ns = useNamespace("collapse");
  20931. const rootKls = vue.computed(() => ns.b());
  20932. return {
  20933. rootKls
  20934. };
  20935. };
  20936. const __default__$Z = vue.defineComponent({
  20937. name: "ElCollapse"
  20938. });
  20939. const _sfc_main$1y = /* @__PURE__ */ vue.defineComponent({
  20940. ...__default__$Z,
  20941. props: collapseProps,
  20942. emits: collapseEmits,
  20943. setup(__props, { expose, emit }) {
  20944. const props = __props;
  20945. const { activeNames, setActiveNames } = useCollapse(props, emit);
  20946. const { rootKls } = useCollapseDOM();
  20947. expose({
  20948. activeNames,
  20949. setActiveNames
  20950. });
  20951. return (_ctx, _cache) => {
  20952. return vue.openBlock(), vue.createElementBlock("div", {
  20953. class: vue.normalizeClass(vue.unref(rootKls)),
  20954. role: "tablist",
  20955. "aria-multiselectable": "true"
  20956. }, [
  20957. vue.renderSlot(_ctx.$slots, "default")
  20958. ], 2);
  20959. };
  20960. }
  20961. });
  20962. var Collapse = /* @__PURE__ */ _export_sfc(_sfc_main$1y, [["__file", "collapse.vue"]]);
  20963. const __default__$Y = vue.defineComponent({
  20964. name: "ElCollapseTransition"
  20965. });
  20966. const _sfc_main$1x = /* @__PURE__ */ vue.defineComponent({
  20967. ...__default__$Y,
  20968. setup(__props) {
  20969. const ns = useNamespace("collapse-transition");
  20970. const on = {
  20971. beforeEnter(el) {
  20972. if (!el.dataset)
  20973. el.dataset = {};
  20974. el.dataset.oldPaddingTop = el.style.paddingTop;
  20975. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  20976. el.style.maxHeight = 0;
  20977. el.style.paddingTop = 0;
  20978. el.style.paddingBottom = 0;
  20979. },
  20980. enter(el) {
  20981. el.dataset.oldOverflow = el.style.overflow;
  20982. if (el.scrollHeight !== 0) {
  20983. el.style.maxHeight = `${el.scrollHeight}px`;
  20984. el.style.paddingTop = el.dataset.oldPaddingTop;
  20985. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  20986. } else {
  20987. el.style.maxHeight = 0;
  20988. el.style.paddingTop = el.dataset.oldPaddingTop;
  20989. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  20990. }
  20991. el.style.overflow = "hidden";
  20992. },
  20993. afterEnter(el) {
  20994. el.style.maxHeight = "";
  20995. el.style.overflow = el.dataset.oldOverflow;
  20996. },
  20997. beforeLeave(el) {
  20998. if (!el.dataset)
  20999. el.dataset = {};
  21000. el.dataset.oldPaddingTop = el.style.paddingTop;
  21001. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  21002. el.dataset.oldOverflow = el.style.overflow;
  21003. el.style.maxHeight = `${el.scrollHeight}px`;
  21004. el.style.overflow = "hidden";
  21005. },
  21006. leave(el) {
  21007. if (el.scrollHeight !== 0) {
  21008. el.style.maxHeight = 0;
  21009. el.style.paddingTop = 0;
  21010. el.style.paddingBottom = 0;
  21011. }
  21012. },
  21013. afterLeave(el) {
  21014. el.style.maxHeight = "";
  21015. el.style.overflow = el.dataset.oldOverflow;
  21016. el.style.paddingTop = el.dataset.oldPaddingTop;
  21017. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  21018. }
  21019. };
  21020. return (_ctx, _cache) => {
  21021. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({
  21022. name: vue.unref(ns).b()
  21023. }, vue.toHandlers(on)), {
  21024. default: vue.withCtx(() => [
  21025. vue.renderSlot(_ctx.$slots, "default")
  21026. ]),
  21027. _: 3
  21028. }, 16, ["name"]);
  21029. };
  21030. }
  21031. });
  21032. var CollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$1x, [["__file", "collapse-transition.vue"]]);
  21033. CollapseTransition.install = (app) => {
  21034. app.component(CollapseTransition.name, CollapseTransition);
  21035. };
  21036. const _CollapseTransition = CollapseTransition;
  21037. const ElCollapseTransition = _CollapseTransition;
  21038. const collapseItemProps = buildProps({
  21039. title: {
  21040. type: String,
  21041. default: ""
  21042. },
  21043. name: {
  21044. type: definePropType([String, Number]),
  21045. default: () => generateId()
  21046. },
  21047. disabled: Boolean
  21048. });
  21049. const useCollapseItem = (props) => {
  21050. const collapse = vue.inject(collapseContextKey);
  21051. const focusing = vue.ref(false);
  21052. const isClick = vue.ref(false);
  21053. const id = vue.ref(generateId());
  21054. const isActive = vue.computed(() => collapse == null ? void 0 : collapse.activeNames.value.includes(props.name));
  21055. const handleFocus = () => {
  21056. setTimeout(() => {
  21057. if (!isClick.value) {
  21058. focusing.value = true;
  21059. } else {
  21060. isClick.value = false;
  21061. }
  21062. }, 50);
  21063. };
  21064. const handleHeaderClick = () => {
  21065. if (props.disabled)
  21066. return;
  21067. collapse == null ? void 0 : collapse.handleItemClick(props.name);
  21068. focusing.value = false;
  21069. isClick.value = true;
  21070. };
  21071. const handleEnterClick = () => {
  21072. collapse == null ? void 0 : collapse.handleItemClick(props.name);
  21073. };
  21074. return {
  21075. focusing,
  21076. id,
  21077. isActive,
  21078. handleFocus,
  21079. handleHeaderClick,
  21080. handleEnterClick
  21081. };
  21082. };
  21083. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  21084. const ns = useNamespace("collapse");
  21085. const rootKls = vue.computed(() => [
  21086. ns.b("item"),
  21087. ns.is("active", vue.unref(isActive)),
  21088. ns.is("disabled", props.disabled)
  21089. ]);
  21090. const headKls = vue.computed(() => [
  21091. ns.be("item", "header"),
  21092. ns.is("active", vue.unref(isActive)),
  21093. { focusing: vue.unref(focusing) && !props.disabled }
  21094. ]);
  21095. const arrowKls = vue.computed(() => [
  21096. ns.be("item", "arrow"),
  21097. ns.is("active", vue.unref(isActive))
  21098. ]);
  21099. const itemWrapperKls = vue.computed(() => ns.be("item", "wrap"));
  21100. const itemContentKls = vue.computed(() => ns.be("item", "content"));
  21101. const scopedContentId = vue.computed(() => ns.b(`content-${vue.unref(id)}`));
  21102. const scopedHeadId = vue.computed(() => ns.b(`head-${vue.unref(id)}`));
  21103. return {
  21104. arrowKls,
  21105. headKls,
  21106. rootKls,
  21107. itemWrapperKls,
  21108. itemContentKls,
  21109. scopedContentId,
  21110. scopedHeadId
  21111. };
  21112. };
  21113. const _hoisted_1$N = ["aria-expanded", "aria-controls", "aria-describedby"];
  21114. const _hoisted_2$v = ["id", "tabindex"];
  21115. const _hoisted_3$g = ["id", "aria-hidden", "aria-labelledby"];
  21116. const __default__$X = vue.defineComponent({
  21117. name: "ElCollapseItem"
  21118. });
  21119. const _sfc_main$1w = /* @__PURE__ */ vue.defineComponent({
  21120. ...__default__$X,
  21121. props: collapseItemProps,
  21122. setup(__props, { expose }) {
  21123. const props = __props;
  21124. const {
  21125. focusing,
  21126. id,
  21127. isActive,
  21128. handleFocus,
  21129. handleHeaderClick,
  21130. handleEnterClick
  21131. } = useCollapseItem(props);
  21132. const {
  21133. arrowKls,
  21134. headKls,
  21135. rootKls,
  21136. itemWrapperKls,
  21137. itemContentKls,
  21138. scopedContentId,
  21139. scopedHeadId
  21140. } = useCollapseItemDOM(props, { focusing, isActive, id });
  21141. expose({
  21142. isActive
  21143. });
  21144. return (_ctx, _cache) => {
  21145. return vue.openBlock(), vue.createElementBlock("div", {
  21146. class: vue.normalizeClass(vue.unref(rootKls))
  21147. }, [
  21148. vue.createElementVNode("div", {
  21149. role: "tab",
  21150. "aria-expanded": vue.unref(isActive),
  21151. "aria-controls": vue.unref(scopedContentId),
  21152. "aria-describedby": vue.unref(scopedContentId)
  21153. }, [
  21154. vue.createElementVNode("div", {
  21155. id: vue.unref(scopedHeadId),
  21156. class: vue.normalizeClass(vue.unref(headKls)),
  21157. role: "button",
  21158. tabindex: _ctx.disabled ? -1 : 0,
  21159. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(handleHeaderClick) && vue.unref(handleHeaderClick)(...args)),
  21160. onKeypress: _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers((...args) => vue.unref(handleEnterClick) && vue.unref(handleEnterClick)(...args), ["stop", "prevent"]), ["space", "enter"])),
  21161. onFocus: _cache[2] || (_cache[2] = (...args) => vue.unref(handleFocus) && vue.unref(handleFocus)(...args)),
  21162. onBlur: _cache[3] || (_cache[3] = ($event) => focusing.value = false)
  21163. }, [
  21164. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  21165. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  21166. ]),
  21167. vue.createVNode(vue.unref(ElIcon), {
  21168. class: vue.normalizeClass(vue.unref(arrowKls))
  21169. }, {
  21170. default: vue.withCtx(() => [
  21171. vue.createVNode(vue.unref(arrow_right_default))
  21172. ]),
  21173. _: 1
  21174. }, 8, ["class"])
  21175. ], 42, _hoisted_2$v)
  21176. ], 8, _hoisted_1$N),
  21177. vue.createVNode(vue.unref(_CollapseTransition), null, {
  21178. default: vue.withCtx(() => [
  21179. vue.withDirectives(vue.createElementVNode("div", {
  21180. id: vue.unref(scopedContentId),
  21181. class: vue.normalizeClass(vue.unref(itemWrapperKls)),
  21182. role: "tabpanel",
  21183. "aria-hidden": !vue.unref(isActive),
  21184. "aria-labelledby": vue.unref(scopedHeadId)
  21185. }, [
  21186. vue.createElementVNode("div", {
  21187. class: vue.normalizeClass(vue.unref(itemContentKls))
  21188. }, [
  21189. vue.renderSlot(_ctx.$slots, "default")
  21190. ], 2)
  21191. ], 10, _hoisted_3$g), [
  21192. [vue.vShow, vue.unref(isActive)]
  21193. ])
  21194. ]),
  21195. _: 3
  21196. })
  21197. ], 2);
  21198. };
  21199. }
  21200. });
  21201. var CollapseItem = /* @__PURE__ */ _export_sfc(_sfc_main$1w, [["__file", "collapse-item.vue"]]);
  21202. const ElCollapse = withInstall(Collapse, {
  21203. CollapseItem
  21204. });
  21205. const ElCollapseItem = withNoopInstall(CollapseItem);
  21206. let isDragging = false;
  21207. function draggable(element, options) {
  21208. if (!isClient)
  21209. return;
  21210. const moveFn = function(event) {
  21211. var _a;
  21212. (_a = options.drag) == null ? void 0 : _a.call(options, event);
  21213. };
  21214. const upFn = function(event) {
  21215. var _a;
  21216. document.removeEventListener("mousemove", moveFn);
  21217. document.removeEventListener("mouseup", upFn);
  21218. document.removeEventListener("touchmove", moveFn);
  21219. document.removeEventListener("touchend", upFn);
  21220. document.onselectstart = null;
  21221. document.ondragstart = null;
  21222. isDragging = false;
  21223. (_a = options.end) == null ? void 0 : _a.call(options, event);
  21224. };
  21225. const downFn = function(event) {
  21226. var _a;
  21227. if (isDragging)
  21228. return;
  21229. event.preventDefault();
  21230. document.onselectstart = () => false;
  21231. document.ondragstart = () => false;
  21232. document.addEventListener("mousemove", moveFn);
  21233. document.addEventListener("mouseup", upFn);
  21234. document.addEventListener("touchmove", moveFn);
  21235. document.addEventListener("touchend", upFn);
  21236. isDragging = true;
  21237. (_a = options.start) == null ? void 0 : _a.call(options, event);
  21238. };
  21239. element.addEventListener("mousedown", downFn);
  21240. element.addEventListener("touchstart", downFn);
  21241. }
  21242. const _sfc_main$1v = vue.defineComponent({
  21243. name: "ElColorAlphaSlider",
  21244. props: {
  21245. color: {
  21246. type: Object,
  21247. required: true
  21248. },
  21249. vertical: {
  21250. type: Boolean,
  21251. default: false
  21252. }
  21253. },
  21254. setup(props) {
  21255. const ns = useNamespace("color-alpha-slider");
  21256. const instance = vue.getCurrentInstance();
  21257. const thumb = vue.shallowRef();
  21258. const bar = vue.shallowRef();
  21259. const thumbLeft = vue.ref(0);
  21260. const thumbTop = vue.ref(0);
  21261. const background = vue.ref();
  21262. vue.watch(() => props.color.get("alpha"), () => {
  21263. update();
  21264. });
  21265. vue.watch(() => props.color.value, () => {
  21266. update();
  21267. });
  21268. function getThumbLeft() {
  21269. if (!thumb.value)
  21270. return 0;
  21271. if (props.vertical)
  21272. return 0;
  21273. const el = instance.vnode.el;
  21274. const alpha = props.color.get("alpha");
  21275. if (!el)
  21276. return 0;
  21277. return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
  21278. }
  21279. function getThumbTop() {
  21280. if (!thumb.value)
  21281. return 0;
  21282. const el = instance.vnode.el;
  21283. if (!props.vertical)
  21284. return 0;
  21285. const alpha = props.color.get("alpha");
  21286. if (!el)
  21287. return 0;
  21288. return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
  21289. }
  21290. function getBackground() {
  21291. if (props.color && props.color.value) {
  21292. const { r, g, b } = props.color.toRgb();
  21293. return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
  21294. }
  21295. return "";
  21296. }
  21297. function handleClick(event) {
  21298. const target = event.target;
  21299. if (target !== thumb.value) {
  21300. handleDrag(event);
  21301. }
  21302. }
  21303. function handleDrag(event) {
  21304. if (!bar.value || !thumb.value)
  21305. return;
  21306. const el = instance.vnode.el;
  21307. const rect = el.getBoundingClientRect();
  21308. const { clientX, clientY } = getClientXY(event);
  21309. if (!props.vertical) {
  21310. let left = clientX - rect.left;
  21311. left = Math.max(thumb.value.offsetWidth / 2, left);
  21312. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  21313. props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
  21314. } else {
  21315. let top = clientY - rect.top;
  21316. top = Math.max(thumb.value.offsetHeight / 2, top);
  21317. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  21318. props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
  21319. }
  21320. }
  21321. function update() {
  21322. thumbLeft.value = getThumbLeft();
  21323. thumbTop.value = getThumbTop();
  21324. background.value = getBackground();
  21325. }
  21326. vue.onMounted(() => {
  21327. if (!bar.value || !thumb.value)
  21328. return;
  21329. const dragConfig = {
  21330. drag: (event) => {
  21331. handleDrag(event);
  21332. },
  21333. end: (event) => {
  21334. handleDrag(event);
  21335. }
  21336. };
  21337. draggable(bar.value, dragConfig);
  21338. draggable(thumb.value, dragConfig);
  21339. update();
  21340. });
  21341. return {
  21342. thumb,
  21343. bar,
  21344. thumbLeft,
  21345. thumbTop,
  21346. background,
  21347. handleClick,
  21348. update,
  21349. ns
  21350. };
  21351. }
  21352. });
  21353. function _sfc_render$t(_ctx, _cache, $props, $setup, $data, $options) {
  21354. return vue.openBlock(), vue.createElementBlock("div", {
  21355. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  21356. }, [
  21357. vue.createElementVNode("div", {
  21358. ref: "bar",
  21359. class: vue.normalizeClass(_ctx.ns.e("bar")),
  21360. style: vue.normalizeStyle({
  21361. background: _ctx.background
  21362. }),
  21363. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  21364. }, null, 6),
  21365. vue.createElementVNode("div", {
  21366. ref: "thumb",
  21367. class: vue.normalizeClass(_ctx.ns.e("thumb")),
  21368. style: vue.normalizeStyle({
  21369. left: _ctx.thumbLeft + "px",
  21370. top: _ctx.thumbTop + "px"
  21371. })
  21372. }, null, 6)
  21373. ], 2);
  21374. }
  21375. var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1v, [["render", _sfc_render$t], ["__file", "alpha-slider.vue"]]);
  21376. const _sfc_main$1u = vue.defineComponent({
  21377. name: "ElColorHueSlider",
  21378. props: {
  21379. color: {
  21380. type: Object,
  21381. required: true
  21382. },
  21383. vertical: Boolean
  21384. },
  21385. setup(props) {
  21386. const ns = useNamespace("color-hue-slider");
  21387. const instance = vue.getCurrentInstance();
  21388. const thumb = vue.ref();
  21389. const bar = vue.ref();
  21390. const thumbLeft = vue.ref(0);
  21391. const thumbTop = vue.ref(0);
  21392. const hueValue = vue.computed(() => {
  21393. return props.color.get("hue");
  21394. });
  21395. vue.watch(() => hueValue.value, () => {
  21396. update();
  21397. });
  21398. function handleClick(event) {
  21399. const target = event.target;
  21400. if (target !== thumb.value) {
  21401. handleDrag(event);
  21402. }
  21403. }
  21404. function handleDrag(event) {
  21405. if (!bar.value || !thumb.value)
  21406. return;
  21407. const el = instance.vnode.el;
  21408. const rect = el.getBoundingClientRect();
  21409. const { clientX, clientY } = getClientXY(event);
  21410. let hue;
  21411. if (!props.vertical) {
  21412. let left = clientX - rect.left;
  21413. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  21414. left = Math.max(thumb.value.offsetWidth / 2, left);
  21415. hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
  21416. } else {
  21417. let top = clientY - rect.top;
  21418. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  21419. top = Math.max(thumb.value.offsetHeight / 2, top);
  21420. hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
  21421. }
  21422. props.color.set("hue", hue);
  21423. }
  21424. function getThumbLeft() {
  21425. if (!thumb.value)
  21426. return 0;
  21427. const el = instance.vnode.el;
  21428. if (props.vertical)
  21429. return 0;
  21430. const hue = props.color.get("hue");
  21431. if (!el)
  21432. return 0;
  21433. return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
  21434. }
  21435. function getThumbTop() {
  21436. if (!thumb.value)
  21437. return 0;
  21438. const el = instance.vnode.el;
  21439. if (!props.vertical)
  21440. return 0;
  21441. const hue = props.color.get("hue");
  21442. if (!el)
  21443. return 0;
  21444. return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
  21445. }
  21446. function update() {
  21447. thumbLeft.value = getThumbLeft();
  21448. thumbTop.value = getThumbTop();
  21449. }
  21450. vue.onMounted(() => {
  21451. if (!bar.value || !thumb.value)
  21452. return;
  21453. const dragConfig = {
  21454. drag: (event) => {
  21455. handleDrag(event);
  21456. },
  21457. end: (event) => {
  21458. handleDrag(event);
  21459. }
  21460. };
  21461. draggable(bar.value, dragConfig);
  21462. draggable(thumb.value, dragConfig);
  21463. update();
  21464. });
  21465. return {
  21466. bar,
  21467. thumb,
  21468. thumbLeft,
  21469. thumbTop,
  21470. hueValue,
  21471. handleClick,
  21472. update,
  21473. ns
  21474. };
  21475. }
  21476. });
  21477. function _sfc_render$s(_ctx, _cache, $props, $setup, $data, $options) {
  21478. return vue.openBlock(), vue.createElementBlock("div", {
  21479. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  21480. }, [
  21481. vue.createElementVNode("div", {
  21482. ref: "bar",
  21483. class: vue.normalizeClass(_ctx.ns.e("bar")),
  21484. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  21485. }, null, 2),
  21486. vue.createElementVNode("div", {
  21487. ref: "thumb",
  21488. class: vue.normalizeClass(_ctx.ns.e("thumb")),
  21489. style: vue.normalizeStyle({
  21490. left: _ctx.thumbLeft + "px",
  21491. top: _ctx.thumbTop + "px"
  21492. })
  21493. }, null, 6)
  21494. ], 2);
  21495. }
  21496. var HueSlider = /* @__PURE__ */ _export_sfc(_sfc_main$1u, [["render", _sfc_render$s], ["__file", "hue-slider.vue"]]);
  21497. const colorPickerProps = buildProps({
  21498. modelValue: String,
  21499. id: String,
  21500. showAlpha: Boolean,
  21501. colorFormat: String,
  21502. disabled: Boolean,
  21503. size: useSizeProp,
  21504. popperClass: {
  21505. type: String,
  21506. default: ""
  21507. },
  21508. label: {
  21509. type: String,
  21510. default: void 0
  21511. },
  21512. tabindex: {
  21513. type: [String, Number],
  21514. default: 0
  21515. },
  21516. predefine: {
  21517. type: definePropType(Array)
  21518. },
  21519. validateEvent: {
  21520. type: Boolean,
  21521. default: true
  21522. }
  21523. });
  21524. const colorPickerEmits = {
  21525. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNil(val),
  21526. [CHANGE_EVENT]: (val) => isString(val) || isNil(val),
  21527. activeChange: (val) => isString(val) || isNil(val)
  21528. };
  21529. const colorPickerContextKey = Symbol("colorPickerContextKey");
  21530. const hsv2hsl = function(hue, sat, val) {
  21531. return [
  21532. hue,
  21533. sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
  21534. hue / 2
  21535. ];
  21536. };
  21537. const isOnePointZero = function(n) {
  21538. return typeof n === "string" && n.includes(".") && Number.parseFloat(n) === 1;
  21539. };
  21540. const isPercentage = function(n) {
  21541. return typeof n === "string" && n.includes("%");
  21542. };
  21543. const bound01 = function(value, max) {
  21544. if (isOnePointZero(value))
  21545. value = "100%";
  21546. const processPercent = isPercentage(value);
  21547. value = Math.min(max, Math.max(0, Number.parseFloat(`${value}`)));
  21548. if (processPercent) {
  21549. value = Number.parseInt(`${value * max}`, 10) / 100;
  21550. }
  21551. if (Math.abs(value - max) < 1e-6) {
  21552. return 1;
  21553. }
  21554. return value % max / Number.parseFloat(max);
  21555. };
  21556. const INT_HEX_MAP = {
  21557. 10: "A",
  21558. 11: "B",
  21559. 12: "C",
  21560. 13: "D",
  21561. 14: "E",
  21562. 15: "F"
  21563. };
  21564. const hexOne = (value) => {
  21565. value = Math.min(Math.round(value), 255);
  21566. const high = Math.floor(value / 16);
  21567. const low = value % 16;
  21568. return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
  21569. };
  21570. const toHex = function({ r, g, b }) {
  21571. if (Number.isNaN(+r) || Number.isNaN(+g) || Number.isNaN(+b))
  21572. return "";
  21573. return `#${hexOne(r)}${hexOne(g)}${hexOne(b)}`;
  21574. };
  21575. const HEX_INT_MAP = {
  21576. A: 10,
  21577. B: 11,
  21578. C: 12,
  21579. D: 13,
  21580. E: 14,
  21581. F: 15
  21582. };
  21583. const parseHexChannel = function(hex) {
  21584. if (hex.length === 2) {
  21585. return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
  21586. }
  21587. return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
  21588. };
  21589. const hsl2hsv = function(hue, sat, light) {
  21590. sat = sat / 100;
  21591. light = light / 100;
  21592. let smin = sat;
  21593. const lmin = Math.max(light, 0.01);
  21594. light *= 2;
  21595. sat *= light <= 1 ? light : 2 - light;
  21596. smin *= lmin <= 1 ? lmin : 2 - lmin;
  21597. const v = (light + sat) / 2;
  21598. const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
  21599. return {
  21600. h: hue,
  21601. s: sv * 100,
  21602. v: v * 100
  21603. };
  21604. };
  21605. const rgb2hsv = (r, g, b) => {
  21606. r = bound01(r, 255);
  21607. g = bound01(g, 255);
  21608. b = bound01(b, 255);
  21609. const max = Math.max(r, g, b);
  21610. const min = Math.min(r, g, b);
  21611. let h;
  21612. const v = max;
  21613. const d = max - min;
  21614. const s = max === 0 ? 0 : d / max;
  21615. if (max === min) {
  21616. h = 0;
  21617. } else {
  21618. switch (max) {
  21619. case r: {
  21620. h = (g - b) / d + (g < b ? 6 : 0);
  21621. break;
  21622. }
  21623. case g: {
  21624. h = (b - r) / d + 2;
  21625. break;
  21626. }
  21627. case b: {
  21628. h = (r - g) / d + 4;
  21629. break;
  21630. }
  21631. }
  21632. h /= 6;
  21633. }
  21634. return { h: h * 360, s: s * 100, v: v * 100 };
  21635. };
  21636. const hsv2rgb = function(h, s, v) {
  21637. h = bound01(h, 360) * 6;
  21638. s = bound01(s, 100);
  21639. v = bound01(v, 100);
  21640. const i = Math.floor(h);
  21641. const f = h - i;
  21642. const p = v * (1 - s);
  21643. const q = v * (1 - f * s);
  21644. const t = v * (1 - (1 - f) * s);
  21645. const mod = i % 6;
  21646. const r = [v, q, p, p, t, v][mod];
  21647. const g = [t, v, v, q, p, p][mod];
  21648. const b = [p, p, t, v, v, q][mod];
  21649. return {
  21650. r: Math.round(r * 255),
  21651. g: Math.round(g * 255),
  21652. b: Math.round(b * 255)
  21653. };
  21654. };
  21655. class Color {
  21656. constructor(options = {}) {
  21657. this._hue = 0;
  21658. this._saturation = 100;
  21659. this._value = 100;
  21660. this._alpha = 100;
  21661. this.enableAlpha = false;
  21662. this.format = "hex";
  21663. this.value = "";
  21664. for (const option in options) {
  21665. if (hasOwn(options, option)) {
  21666. this[option] = options[option];
  21667. }
  21668. }
  21669. if (options.value) {
  21670. this.fromString(options.value);
  21671. } else {
  21672. this.doOnChange();
  21673. }
  21674. }
  21675. set(prop, value) {
  21676. if (arguments.length === 1 && typeof prop === "object") {
  21677. for (const p in prop) {
  21678. if (hasOwn(prop, p)) {
  21679. this.set(p, prop[p]);
  21680. }
  21681. }
  21682. return;
  21683. }
  21684. this[`_${prop}`] = value;
  21685. this.doOnChange();
  21686. }
  21687. get(prop) {
  21688. if (prop === "alpha") {
  21689. return Math.floor(this[`_${prop}`]);
  21690. }
  21691. return this[`_${prop}`];
  21692. }
  21693. toRgb() {
  21694. return hsv2rgb(this._hue, this._saturation, this._value);
  21695. }
  21696. fromString(value) {
  21697. if (!value) {
  21698. this._hue = 0;
  21699. this._saturation = 100;
  21700. this._value = 100;
  21701. this.doOnChange();
  21702. return;
  21703. }
  21704. const fromHSV = (h, s, v) => {
  21705. this._hue = Math.max(0, Math.min(360, h));
  21706. this._saturation = Math.max(0, Math.min(100, s));
  21707. this._value = Math.max(0, Math.min(100, v));
  21708. this.doOnChange();
  21709. };
  21710. if (value.includes("hsl")) {
  21711. 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));
  21712. if (parts.length === 4) {
  21713. this._alpha = Number.parseFloat(parts[3]) * 100;
  21714. } else if (parts.length === 3) {
  21715. this._alpha = 100;
  21716. }
  21717. if (parts.length >= 3) {
  21718. const { h, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
  21719. fromHSV(h, s, v);
  21720. }
  21721. } else if (value.includes("hsv")) {
  21722. 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));
  21723. if (parts.length === 4) {
  21724. this._alpha = Number.parseFloat(parts[3]) * 100;
  21725. } else if (parts.length === 3) {
  21726. this._alpha = 100;
  21727. }
  21728. if (parts.length >= 3) {
  21729. fromHSV(parts[0], parts[1], parts[2]);
  21730. }
  21731. } else if (value.includes("rgb")) {
  21732. 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));
  21733. if (parts.length === 4) {
  21734. this._alpha = Number.parseFloat(parts[3]) * 100;
  21735. } else if (parts.length === 3) {
  21736. this._alpha = 100;
  21737. }
  21738. if (parts.length >= 3) {
  21739. const { h, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
  21740. fromHSV(h, s, v);
  21741. }
  21742. } else if (value.includes("#")) {
  21743. const hex = value.replace("#", "").trim();
  21744. if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
  21745. return;
  21746. let r, g, b;
  21747. if (hex.length === 3) {
  21748. r = parseHexChannel(hex[0] + hex[0]);
  21749. g = parseHexChannel(hex[1] + hex[1]);
  21750. b = parseHexChannel(hex[2] + hex[2]);
  21751. } else if (hex.length === 6 || hex.length === 8) {
  21752. r = parseHexChannel(hex.slice(0, 2));
  21753. g = parseHexChannel(hex.slice(2, 4));
  21754. b = parseHexChannel(hex.slice(4, 6));
  21755. }
  21756. if (hex.length === 8) {
  21757. this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
  21758. } else if (hex.length === 3 || hex.length === 6) {
  21759. this._alpha = 100;
  21760. }
  21761. const { h, s, v } = rgb2hsv(r, g, b);
  21762. fromHSV(h, s, v);
  21763. }
  21764. }
  21765. compare(color) {
  21766. 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;
  21767. }
  21768. doOnChange() {
  21769. const { _hue, _saturation, _value, _alpha, format } = this;
  21770. if (this.enableAlpha) {
  21771. switch (format) {
  21772. case "hsl": {
  21773. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  21774. this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
  21775. break;
  21776. }
  21777. case "hsv": {
  21778. this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
  21779. break;
  21780. }
  21781. case "hex": {
  21782. this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
  21783. break;
  21784. }
  21785. default: {
  21786. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  21787. this.value = `rgba(${r}, ${g}, ${b}, ${this.get("alpha") / 100})`;
  21788. }
  21789. }
  21790. } else {
  21791. switch (format) {
  21792. case "hsl": {
  21793. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  21794. this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
  21795. break;
  21796. }
  21797. case "hsv": {
  21798. this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
  21799. break;
  21800. }
  21801. case "rgb": {
  21802. const { r, g, b } = hsv2rgb(_hue, _saturation, _value);
  21803. this.value = `rgb(${r}, ${g}, ${b})`;
  21804. break;
  21805. }
  21806. default: {
  21807. this.value = toHex(hsv2rgb(_hue, _saturation, _value));
  21808. }
  21809. }
  21810. }
  21811. }
  21812. }
  21813. const _sfc_main$1t = vue.defineComponent({
  21814. props: {
  21815. colors: {
  21816. type: Array,
  21817. required: true
  21818. },
  21819. color: {
  21820. type: Object,
  21821. required: true
  21822. }
  21823. },
  21824. setup(props) {
  21825. const ns = useNamespace("color-predefine");
  21826. const { currentColor } = vue.inject(colorPickerContextKey);
  21827. const rgbaColors = vue.ref(parseColors(props.colors, props.color));
  21828. vue.watch(() => currentColor.value, (val) => {
  21829. const color = new Color();
  21830. color.fromString(val);
  21831. rgbaColors.value.forEach((item) => {
  21832. item.selected = color.compare(item);
  21833. });
  21834. });
  21835. vue.watchEffect(() => {
  21836. rgbaColors.value = parseColors(props.colors, props.color);
  21837. });
  21838. function handleSelect(index) {
  21839. props.color.fromString(props.colors[index]);
  21840. }
  21841. function parseColors(colors, color) {
  21842. return colors.map((value) => {
  21843. const c = new Color();
  21844. c.enableAlpha = true;
  21845. c.format = "rgba";
  21846. c.fromString(value);
  21847. c.selected = c.value === color.value;
  21848. return c;
  21849. });
  21850. }
  21851. return {
  21852. rgbaColors,
  21853. handleSelect,
  21854. ns
  21855. };
  21856. }
  21857. });
  21858. const _hoisted_1$M = ["onClick"];
  21859. function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
  21860. return vue.openBlock(), vue.createElementBlock("div", {
  21861. class: vue.normalizeClass(_ctx.ns.b())
  21862. }, [
  21863. vue.createElementVNode("div", {
  21864. class: vue.normalizeClass(_ctx.ns.e("colors"))
  21865. }, [
  21866. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rgbaColors, (item, index) => {
  21867. return vue.openBlock(), vue.createElementBlock("div", {
  21868. key: _ctx.colors[index],
  21869. class: vue.normalizeClass([
  21870. _ctx.ns.e("color-selector"),
  21871. _ctx.ns.is("alpha", item._alpha < 100),
  21872. { selected: item.selected }
  21873. ]),
  21874. onClick: ($event) => _ctx.handleSelect(index)
  21875. }, [
  21876. vue.createElementVNode("div", {
  21877. style: vue.normalizeStyle({ backgroundColor: item.value })
  21878. }, null, 4)
  21879. ], 10, _hoisted_1$M);
  21880. }), 128))
  21881. ], 2)
  21882. ], 2);
  21883. }
  21884. var Predefine = /* @__PURE__ */ _export_sfc(_sfc_main$1t, [["render", _sfc_render$r], ["__file", "predefine.vue"]]);
  21885. const _sfc_main$1s = vue.defineComponent({
  21886. name: "ElSlPanel",
  21887. props: {
  21888. color: {
  21889. type: Object,
  21890. required: true
  21891. }
  21892. },
  21893. setup(props) {
  21894. const ns = useNamespace("color-svpanel");
  21895. const instance = vue.getCurrentInstance();
  21896. const cursorTop = vue.ref(0);
  21897. const cursorLeft = vue.ref(0);
  21898. const background = vue.ref("hsl(0, 100%, 50%)");
  21899. const colorValue = vue.computed(() => {
  21900. const hue = props.color.get("hue");
  21901. const value = props.color.get("value");
  21902. return { hue, value };
  21903. });
  21904. function update() {
  21905. const saturation = props.color.get("saturation");
  21906. const value = props.color.get("value");
  21907. const el = instance.vnode.el;
  21908. const { clientWidth: width, clientHeight: height } = el;
  21909. cursorLeft.value = saturation * width / 100;
  21910. cursorTop.value = (100 - value) * height / 100;
  21911. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  21912. }
  21913. function handleDrag(event) {
  21914. const el = instance.vnode.el;
  21915. const rect = el.getBoundingClientRect();
  21916. const { clientX, clientY } = getClientXY(event);
  21917. let left = clientX - rect.left;
  21918. let top = clientY - rect.top;
  21919. left = Math.max(0, left);
  21920. left = Math.min(left, rect.width);
  21921. top = Math.max(0, top);
  21922. top = Math.min(top, rect.height);
  21923. cursorLeft.value = left;
  21924. cursorTop.value = top;
  21925. props.color.set({
  21926. saturation: left / rect.width * 100,
  21927. value: 100 - top / rect.height * 100
  21928. });
  21929. }
  21930. vue.watch(() => colorValue.value, () => {
  21931. update();
  21932. });
  21933. vue.onMounted(() => {
  21934. draggable(instance.vnode.el, {
  21935. drag: (event) => {
  21936. handleDrag(event);
  21937. },
  21938. end: (event) => {
  21939. handleDrag(event);
  21940. }
  21941. });
  21942. update();
  21943. });
  21944. return {
  21945. cursorTop,
  21946. cursorLeft,
  21947. background,
  21948. colorValue,
  21949. handleDrag,
  21950. update,
  21951. ns
  21952. };
  21953. }
  21954. });
  21955. const _hoisted_1$L = /* @__PURE__ */ vue.createElementVNode("div", null, null, -1);
  21956. const _hoisted_2$u = [
  21957. _hoisted_1$L
  21958. ];
  21959. function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
  21960. return vue.openBlock(), vue.createElementBlock("div", {
  21961. class: vue.normalizeClass(_ctx.ns.b()),
  21962. style: vue.normalizeStyle({
  21963. backgroundColor: _ctx.background
  21964. })
  21965. }, [
  21966. vue.createElementVNode("div", {
  21967. class: vue.normalizeClass(_ctx.ns.e("white"))
  21968. }, null, 2),
  21969. vue.createElementVNode("div", {
  21970. class: vue.normalizeClass(_ctx.ns.e("black"))
  21971. }, null, 2),
  21972. vue.createElementVNode("div", {
  21973. class: vue.normalizeClass(_ctx.ns.e("cursor")),
  21974. style: vue.normalizeStyle({
  21975. top: _ctx.cursorTop + "px",
  21976. left: _ctx.cursorLeft + "px"
  21977. })
  21978. }, _hoisted_2$u, 6)
  21979. ], 6);
  21980. }
  21981. var SvPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1s, [["render", _sfc_render$q], ["__file", "sv-panel.vue"]]);
  21982. const _hoisted_1$K = ["id", "aria-label", "aria-labelledby", "aria-description", "tabindex", "onKeydown"];
  21983. const __default__$W = vue.defineComponent({
  21984. name: "ElColorPicker"
  21985. });
  21986. const _sfc_main$1r = /* @__PURE__ */ vue.defineComponent({
  21987. ...__default__$W,
  21988. props: colorPickerProps,
  21989. emits: colorPickerEmits,
  21990. setup(__props, { expose, emit }) {
  21991. const props = __props;
  21992. const { t } = useLocale();
  21993. const ns = useNamespace("color");
  21994. const { formItem } = useFormItem();
  21995. const colorSize = useSize();
  21996. const colorDisabled = useDisabled();
  21997. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  21998. formItemContext: formItem
  21999. });
  22000. const hue = vue.ref();
  22001. const sv = vue.ref();
  22002. const alpha = vue.ref();
  22003. const popper = vue.ref();
  22004. let shouldActiveChange = true;
  22005. const color = vue.reactive(new Color({
  22006. enableAlpha: props.showAlpha,
  22007. format: props.colorFormat || "",
  22008. value: props.modelValue
  22009. }));
  22010. const showPicker = vue.ref(false);
  22011. const showPanelColor = vue.ref(false);
  22012. const customInput = vue.ref("");
  22013. const displayedColor = vue.computed(() => {
  22014. if (!props.modelValue && !showPanelColor.value) {
  22015. return "transparent";
  22016. }
  22017. return displayedRgb(color, props.showAlpha);
  22018. });
  22019. const currentColor = vue.computed(() => {
  22020. return !props.modelValue && !showPanelColor.value ? "" : color.value;
  22021. });
  22022. const buttonAriaLabel = vue.computed(() => {
  22023. return !isLabeledByFormItem.value ? props.label || t("el.colorpicker.defaultLabel") : void 0;
  22024. });
  22025. const buttonAriaLabelledby = vue.computed(() => {
  22026. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  22027. });
  22028. function displayedRgb(color2, showAlpha) {
  22029. if (!(color2 instanceof Color)) {
  22030. throw new TypeError("color should be instance of _color Class");
  22031. }
  22032. const { r, g, b } = color2.toRgb();
  22033. return showAlpha ? `rgba(${r}, ${g}, ${b}, ${color2.get("alpha") / 100})` : `rgb(${r}, ${g}, ${b})`;
  22034. }
  22035. function setShowPicker(value) {
  22036. showPicker.value = value;
  22037. }
  22038. const debounceSetShowPicker = debounce(setShowPicker, 100);
  22039. function hide() {
  22040. debounceSetShowPicker(false);
  22041. resetColor();
  22042. }
  22043. function resetColor() {
  22044. vue.nextTick(() => {
  22045. if (props.modelValue) {
  22046. color.fromString(props.modelValue);
  22047. } else {
  22048. color.value = "";
  22049. vue.nextTick(() => {
  22050. showPanelColor.value = false;
  22051. });
  22052. }
  22053. });
  22054. }
  22055. function handleTrigger() {
  22056. if (colorDisabled.value)
  22057. return;
  22058. debounceSetShowPicker(!showPicker.value);
  22059. }
  22060. function handleConfirm() {
  22061. color.fromString(customInput.value);
  22062. }
  22063. function confirmValue() {
  22064. const value = color.value;
  22065. emit(UPDATE_MODEL_EVENT, value);
  22066. emit("change", value);
  22067. if (props.validateEvent) {
  22068. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  22069. }
  22070. debounceSetShowPicker(false);
  22071. vue.nextTick(() => {
  22072. const newColor = new Color({
  22073. enableAlpha: props.showAlpha,
  22074. format: props.colorFormat || "",
  22075. value: props.modelValue
  22076. });
  22077. if (!color.compare(newColor)) {
  22078. resetColor();
  22079. }
  22080. });
  22081. }
  22082. function clear() {
  22083. debounceSetShowPicker(false);
  22084. emit(UPDATE_MODEL_EVENT, null);
  22085. emit("change", null);
  22086. if (props.modelValue !== null && props.validateEvent) {
  22087. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  22088. }
  22089. resetColor();
  22090. }
  22091. vue.onMounted(() => {
  22092. if (props.modelValue) {
  22093. customInput.value = currentColor.value;
  22094. }
  22095. });
  22096. vue.watch(() => props.modelValue, (newVal) => {
  22097. if (!newVal) {
  22098. showPanelColor.value = false;
  22099. } else if (newVal && newVal !== color.value) {
  22100. shouldActiveChange = false;
  22101. color.fromString(newVal);
  22102. }
  22103. });
  22104. vue.watch(() => currentColor.value, (val) => {
  22105. customInput.value = val;
  22106. shouldActiveChange && emit("activeChange", val);
  22107. shouldActiveChange = true;
  22108. });
  22109. vue.watch(() => color.value, () => {
  22110. if (!props.modelValue && !showPanelColor.value) {
  22111. showPanelColor.value = true;
  22112. }
  22113. });
  22114. vue.watch(() => showPicker.value, () => {
  22115. vue.nextTick(() => {
  22116. var _a, _b, _c;
  22117. (_a = hue.value) == null ? void 0 : _a.update();
  22118. (_b = sv.value) == null ? void 0 : _b.update();
  22119. (_c = alpha.value) == null ? void 0 : _c.update();
  22120. });
  22121. });
  22122. vue.provide(colorPickerContextKey, {
  22123. currentColor
  22124. });
  22125. expose({
  22126. color
  22127. });
  22128. return (_ctx, _cache) => {
  22129. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), {
  22130. ref_key: "popper",
  22131. ref: popper,
  22132. visible: showPicker.value,
  22133. "show-arrow": false,
  22134. "fallback-placements": ["bottom", "top", "right", "left"],
  22135. offset: 0,
  22136. "gpu-acceleration": false,
  22137. "popper-class": [vue.unref(ns).be("picker", "panel"), vue.unref(ns).b("dropdown"), _ctx.popperClass],
  22138. "stop-popper-mouse-event": false,
  22139. effect: "light",
  22140. trigger: "click",
  22141. transition: `${vue.unref(ns).namespace.value}-zoom-in-top`,
  22142. persistent: ""
  22143. }, {
  22144. content: vue.withCtx(() => [
  22145. vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", null, [
  22146. vue.createElementVNode("div", {
  22147. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "main-wrapper"))
  22148. }, [
  22149. vue.createVNode(HueSlider, {
  22150. ref_key: "hue",
  22151. ref: hue,
  22152. class: "hue-slider",
  22153. color: vue.unref(color),
  22154. vertical: ""
  22155. }, null, 8, ["color"]),
  22156. vue.createVNode(SvPanel, {
  22157. ref: "svPanel",
  22158. color: vue.unref(color)
  22159. }, null, 8, ["color"])
  22160. ], 2),
  22161. _ctx.showAlpha ? (vue.openBlock(), vue.createBlock(AlphaSlider, {
  22162. key: 0,
  22163. ref_key: "alpha",
  22164. ref: alpha,
  22165. color: vue.unref(color)
  22166. }, null, 8, ["color"])) : vue.createCommentVNode("v-if", true),
  22167. _ctx.predefine ? (vue.openBlock(), vue.createBlock(Predefine, {
  22168. key: 1,
  22169. ref: "predefine",
  22170. color: vue.unref(color),
  22171. colors: _ctx.predefine
  22172. }, null, 8, ["color", "colors"])) : vue.createCommentVNode("v-if", true),
  22173. vue.createElementVNode("div", {
  22174. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btns"))
  22175. }, [
  22176. vue.createElementVNode("span", {
  22177. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "value"))
  22178. }, [
  22179. vue.createVNode(vue.unref(ElInput), {
  22180. modelValue: customInput.value,
  22181. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => customInput.value = $event),
  22182. "validate-event": false,
  22183. size: "small",
  22184. onKeyup: vue.withKeys(handleConfirm, ["enter"]),
  22185. onBlur: handleConfirm
  22186. }, null, 8, ["modelValue", "onKeyup"])
  22187. ], 2),
  22188. vue.createVNode(vue.unref(ElButton), {
  22189. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "link-btn")),
  22190. text: "",
  22191. size: "small",
  22192. onClick: clear
  22193. }, {
  22194. default: vue.withCtx(() => [
  22195. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.clear")), 1)
  22196. ]),
  22197. _: 1
  22198. }, 8, ["class"]),
  22199. vue.createVNode(vue.unref(ElButton), {
  22200. plain: "",
  22201. size: "small",
  22202. class: vue.normalizeClass(vue.unref(ns).be("dropdown", "btn")),
  22203. onClick: confirmValue
  22204. }, {
  22205. default: vue.withCtx(() => [
  22206. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.colorpicker.confirm")), 1)
  22207. ]),
  22208. _: 1
  22209. }, 8, ["class"])
  22210. ], 2)
  22211. ])), [
  22212. [vue.unref(ClickOutside), hide]
  22213. ])
  22214. ]),
  22215. default: vue.withCtx(() => [
  22216. vue.createElementVNode("div", {
  22217. id: vue.unref(buttonId),
  22218. class: vue.normalizeClass([
  22219. vue.unref(ns).b("picker"),
  22220. vue.unref(ns).is("disabled", vue.unref(colorDisabled)),
  22221. vue.unref(ns).bm("picker", vue.unref(colorSize))
  22222. ]),
  22223. role: "button",
  22224. "aria-label": vue.unref(buttonAriaLabel),
  22225. "aria-labelledby": vue.unref(buttonAriaLabelledby),
  22226. "aria-description": vue.unref(t)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  22227. tabindex: _ctx.tabindex,
  22228. onKeydown: vue.withKeys(handleTrigger, ["enter"])
  22229. }, [
  22230. vue.unref(colorDisabled) ? (vue.openBlock(), vue.createElementBlock("div", {
  22231. key: 0,
  22232. class: vue.normalizeClass(vue.unref(ns).be("picker", "mask"))
  22233. }, null, 2)) : vue.createCommentVNode("v-if", true),
  22234. vue.createElementVNode("div", {
  22235. class: vue.normalizeClass(vue.unref(ns).be("picker", "trigger")),
  22236. onClick: handleTrigger
  22237. }, [
  22238. vue.createElementVNode("span", {
  22239. class: vue.normalizeClass([vue.unref(ns).be("picker", "color"), vue.unref(ns).is("alpha", _ctx.showAlpha)])
  22240. }, [
  22241. vue.createElementVNode("span", {
  22242. class: vue.normalizeClass(vue.unref(ns).be("picker", "color-inner")),
  22243. style: vue.normalizeStyle({
  22244. backgroundColor: vue.unref(displayedColor)
  22245. })
  22246. }, [
  22247. vue.withDirectives(vue.createVNode(vue.unref(ElIcon), {
  22248. class: vue.normalizeClass([vue.unref(ns).be("picker", "icon"), vue.unref(ns).is("icon-arrow-down")])
  22249. }, {
  22250. default: vue.withCtx(() => [
  22251. vue.createVNode(vue.unref(arrow_down_default))
  22252. ]),
  22253. _: 1
  22254. }, 8, ["class"]), [
  22255. [vue.vShow, _ctx.modelValue || showPanelColor.value]
  22256. ]),
  22257. !_ctx.modelValue && !showPanelColor.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  22258. key: 0,
  22259. class: vue.normalizeClass([vue.unref(ns).be("picker", "empty"), vue.unref(ns).is("icon-close")])
  22260. }, {
  22261. default: vue.withCtx(() => [
  22262. vue.createVNode(vue.unref(close_default))
  22263. ]),
  22264. _: 1
  22265. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  22266. ], 6)
  22267. ], 2)
  22268. ], 2)
  22269. ], 42, _hoisted_1$K)
  22270. ]),
  22271. _: 1
  22272. }, 8, ["visible", "popper-class", "transition"]);
  22273. };
  22274. }
  22275. });
  22276. var ColorPicker = /* @__PURE__ */ _export_sfc(_sfc_main$1r, [["__file", "color-picker.vue"]]);
  22277. const ElColorPicker = withInstall(ColorPicker);
  22278. const messageConfig = {};
  22279. const configProviderProps = buildProps({
  22280. a11y: {
  22281. type: Boolean,
  22282. default: true
  22283. },
  22284. locale: {
  22285. type: definePropType(Object)
  22286. },
  22287. size: useSizeProp,
  22288. button: {
  22289. type: definePropType(Object)
  22290. },
  22291. experimentalFeatures: {
  22292. type: definePropType(Object)
  22293. },
  22294. keyboardNavigation: {
  22295. type: Boolean,
  22296. default: true
  22297. },
  22298. message: {
  22299. type: definePropType(Object)
  22300. },
  22301. zIndex: Number,
  22302. namespace: {
  22303. type: String,
  22304. default: "el"
  22305. }
  22306. });
  22307. const ConfigProvider = vue.defineComponent({
  22308. name: "ElConfigProvider",
  22309. props: configProviderProps,
  22310. setup(props, { slots }) {
  22311. vue.watch(() => props.message, (val) => {
  22312. Object.assign(messageConfig, val != null ? val : {});
  22313. }, { immediate: true, deep: true });
  22314. const config = provideGlobalConfig(props);
  22315. return () => vue.renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  22316. }
  22317. });
  22318. const ElConfigProvider = withInstall(ConfigProvider);
  22319. const __default__$V = vue.defineComponent({
  22320. name: "ElContainer"
  22321. });
  22322. const _sfc_main$1q = /* @__PURE__ */ vue.defineComponent({
  22323. ...__default__$V,
  22324. props: {
  22325. direction: {
  22326. type: String
  22327. }
  22328. },
  22329. setup(__props) {
  22330. const props = __props;
  22331. const slots = vue.useSlots();
  22332. const ns = useNamespace("container");
  22333. const isVertical = vue.computed(() => {
  22334. if (props.direction === "vertical") {
  22335. return true;
  22336. } else if (props.direction === "horizontal") {
  22337. return false;
  22338. }
  22339. if (slots && slots.default) {
  22340. const vNodes = slots.default();
  22341. return vNodes.some((vNode) => {
  22342. const tag = vNode.type.name;
  22343. return tag === "ElHeader" || tag === "ElFooter";
  22344. });
  22345. } else {
  22346. return false;
  22347. }
  22348. });
  22349. return (_ctx, _cache) => {
  22350. return vue.openBlock(), vue.createElementBlock("section", {
  22351. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).is("vertical", vue.unref(isVertical))])
  22352. }, [
  22353. vue.renderSlot(_ctx.$slots, "default")
  22354. ], 2);
  22355. };
  22356. }
  22357. });
  22358. var Container = /* @__PURE__ */ _export_sfc(_sfc_main$1q, [["__file", "container.vue"]]);
  22359. const __default__$U = vue.defineComponent({
  22360. name: "ElAside"
  22361. });
  22362. const _sfc_main$1p = /* @__PURE__ */ vue.defineComponent({
  22363. ...__default__$U,
  22364. props: {
  22365. width: {
  22366. type: String,
  22367. default: null
  22368. }
  22369. },
  22370. setup(__props) {
  22371. const props = __props;
  22372. const ns = useNamespace("aside");
  22373. const style = vue.computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
  22374. return (_ctx, _cache) => {
  22375. return vue.openBlock(), vue.createElementBlock("aside", {
  22376. class: vue.normalizeClass(vue.unref(ns).b()),
  22377. style: vue.normalizeStyle(vue.unref(style))
  22378. }, [
  22379. vue.renderSlot(_ctx.$slots, "default")
  22380. ], 6);
  22381. };
  22382. }
  22383. });
  22384. var Aside = /* @__PURE__ */ _export_sfc(_sfc_main$1p, [["__file", "aside.vue"]]);
  22385. const __default__$T = vue.defineComponent({
  22386. name: "ElFooter"
  22387. });
  22388. const _sfc_main$1o = /* @__PURE__ */ vue.defineComponent({
  22389. ...__default__$T,
  22390. props: {
  22391. height: {
  22392. type: String,
  22393. default: null
  22394. }
  22395. },
  22396. setup(__props) {
  22397. const props = __props;
  22398. const ns = useNamespace("footer");
  22399. const style = vue.computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
  22400. return (_ctx, _cache) => {
  22401. return vue.openBlock(), vue.createElementBlock("footer", {
  22402. class: vue.normalizeClass(vue.unref(ns).b()),
  22403. style: vue.normalizeStyle(vue.unref(style))
  22404. }, [
  22405. vue.renderSlot(_ctx.$slots, "default")
  22406. ], 6);
  22407. };
  22408. }
  22409. });
  22410. var Footer$2 = /* @__PURE__ */ _export_sfc(_sfc_main$1o, [["__file", "footer.vue"]]);
  22411. const __default__$S = vue.defineComponent({
  22412. name: "ElHeader"
  22413. });
  22414. const _sfc_main$1n = /* @__PURE__ */ vue.defineComponent({
  22415. ...__default__$S,
  22416. props: {
  22417. height: {
  22418. type: String,
  22419. default: null
  22420. }
  22421. },
  22422. setup(__props) {
  22423. const props = __props;
  22424. const ns = useNamespace("header");
  22425. const style = vue.computed(() => {
  22426. return props.height ? ns.cssVarBlock({
  22427. height: props.height
  22428. }) : {};
  22429. });
  22430. return (_ctx, _cache) => {
  22431. return vue.openBlock(), vue.createElementBlock("header", {
  22432. class: vue.normalizeClass(vue.unref(ns).b()),
  22433. style: vue.normalizeStyle(vue.unref(style))
  22434. }, [
  22435. vue.renderSlot(_ctx.$slots, "default")
  22436. ], 6);
  22437. };
  22438. }
  22439. });
  22440. var Header$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1n, [["__file", "header.vue"]]);
  22441. const __default__$R = vue.defineComponent({
  22442. name: "ElMain"
  22443. });
  22444. const _sfc_main$1m = /* @__PURE__ */ vue.defineComponent({
  22445. ...__default__$R,
  22446. setup(__props) {
  22447. const ns = useNamespace("main");
  22448. return (_ctx, _cache) => {
  22449. return vue.openBlock(), vue.createElementBlock("main", {
  22450. class: vue.normalizeClass(vue.unref(ns).b())
  22451. }, [
  22452. vue.renderSlot(_ctx.$slots, "default")
  22453. ], 2);
  22454. };
  22455. }
  22456. });
  22457. var Main = /* @__PURE__ */ _export_sfc(_sfc_main$1m, [["__file", "main.vue"]]);
  22458. const ElContainer = withInstall(Container, {
  22459. Aside,
  22460. Footer: Footer$2,
  22461. Header: Header$1,
  22462. Main
  22463. });
  22464. const ElAside = withNoopInstall(Aside);
  22465. const ElFooter = withNoopInstall(Footer$2);
  22466. const ElHeader = withNoopInstall(Header$1);
  22467. const ElMain = withNoopInstall(Main);
  22468. var advancedFormat$1 = {exports: {}};
  22469. (function(module, exports) {
  22470. !function(e, t) {
  22471. module.exports = t() ;
  22472. }(commonjsGlobal, function() {
  22473. return function(e, t, r) {
  22474. var n = t.prototype, s = n.format;
  22475. r.en.ordinal = function(e2) {
  22476. var t2 = ["th", "st", "nd", "rd"], r2 = e2 % 100;
  22477. return "[" + e2 + (t2[(r2 - 20) % 10] || t2[r2] || t2[0]) + "]";
  22478. }, n.format = function(e2) {
  22479. var t2 = this, r2 = this.$locale();
  22480. if (!this.isValid())
  22481. return s.bind(this)(e2);
  22482. var n2 = 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) {
  22483. switch (e3) {
  22484. case "Q":
  22485. return Math.ceil((t2.$M + 1) / 3);
  22486. case "Do":
  22487. return r2.ordinal(t2.$D);
  22488. case "gggg":
  22489. return t2.weekYear();
  22490. case "GGGG":
  22491. return t2.isoWeekYear();
  22492. case "wo":
  22493. return r2.ordinal(t2.week(), "W");
  22494. case "w":
  22495. case "ww":
  22496. return n2.s(t2.week(), e3 === "w" ? 1 : 2, "0");
  22497. case "W":
  22498. case "WW":
  22499. return n2.s(t2.isoWeek(), e3 === "W" ? 1 : 2, "0");
  22500. case "k":
  22501. case "kk":
  22502. return n2.s(String(t2.$H === 0 ? 24 : t2.$H), e3 === "k" ? 1 : 2, "0");
  22503. case "X":
  22504. return Math.floor(t2.$d.getTime() / 1e3);
  22505. case "x":
  22506. return t2.$d.getTime();
  22507. case "z":
  22508. return "[" + t2.offsetName() + "]";
  22509. case "zzz":
  22510. return "[" + t2.offsetName("long") + "]";
  22511. default:
  22512. return e3;
  22513. }
  22514. });
  22515. return s.bind(this)(a);
  22516. };
  22517. };
  22518. });
  22519. })(advancedFormat$1);
  22520. var advancedFormat = advancedFormat$1.exports;
  22521. var weekOfYear$1 = {exports: {}};
  22522. (function(module, exports) {
  22523. !function(e, t) {
  22524. module.exports = t() ;
  22525. }(commonjsGlobal, function() {
  22526. var e = "week", t = "year";
  22527. return function(i, n, r) {
  22528. var f = n.prototype;
  22529. f.week = function(i2) {
  22530. if (i2 === void 0 && (i2 = null), i2 !== null)
  22531. return this.add(7 * (i2 - this.week()), "day");
  22532. var n2 = this.$locale().yearStart || 1;
  22533. if (this.month() === 11 && this.date() > 25) {
  22534. var f2 = r(this).startOf(t).add(1, t).date(n2), s = r(this).endOf(e);
  22535. if (f2.isBefore(s))
  22536. return 1;
  22537. }
  22538. var a = r(this).startOf(t).date(n2).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, true);
  22539. return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
  22540. }, f.weeks = function(e2) {
  22541. return e2 === void 0 && (e2 = null), this.week(e2);
  22542. };
  22543. };
  22544. });
  22545. })(weekOfYear$1);
  22546. var weekOfYear = weekOfYear$1.exports;
  22547. var weekYear$1 = {exports: {}};
  22548. (function(module, exports) {
  22549. !function(e, t) {
  22550. module.exports = t() ;
  22551. }(commonjsGlobal, function() {
  22552. return function(e, t) {
  22553. t.prototype.weekYear = function() {
  22554. var e2 = this.month(), t2 = this.week(), n = this.year();
  22555. return t2 === 1 && e2 === 11 ? n + 1 : e2 === 0 && t2 >= 52 ? n - 1 : n;
  22556. };
  22557. };
  22558. });
  22559. })(weekYear$1);
  22560. var weekYear = weekYear$1.exports;
  22561. var dayOfYear$1 = {exports: {}};
  22562. (function(module, exports) {
  22563. !function(e, t) {
  22564. module.exports = t() ;
  22565. }(commonjsGlobal, function() {
  22566. return function(e, t, n) {
  22567. t.prototype.dayOfYear = function(e2) {
  22568. var t2 = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  22569. return e2 == null ? t2 : this.add(e2 - t2, "day");
  22570. };
  22571. };
  22572. });
  22573. })(dayOfYear$1);
  22574. var dayOfYear = dayOfYear$1.exports;
  22575. var isSameOrAfter$1 = {exports: {}};
  22576. (function(module, exports) {
  22577. !function(e, t) {
  22578. module.exports = t() ;
  22579. }(commonjsGlobal, function() {
  22580. return function(e, t) {
  22581. t.prototype.isSameOrAfter = function(e2, t2) {
  22582. return this.isSame(e2, t2) || this.isAfter(e2, t2);
  22583. };
  22584. };
  22585. });
  22586. })(isSameOrAfter$1);
  22587. var isSameOrAfter = isSameOrAfter$1.exports;
  22588. var isSameOrBefore$1 = {exports: {}};
  22589. (function(module, exports) {
  22590. !function(e, i) {
  22591. module.exports = i() ;
  22592. }(commonjsGlobal, function() {
  22593. return function(e, i) {
  22594. i.prototype.isSameOrBefore = function(e2, i2) {
  22595. return this.isSame(e2, i2) || this.isBefore(e2, i2);
  22596. };
  22597. };
  22598. });
  22599. })(isSameOrBefore$1);
  22600. var isSameOrBefore = isSameOrBefore$1.exports;
  22601. const datePickerProps = buildProps({
  22602. type: {
  22603. type: definePropType(String),
  22604. default: "date"
  22605. }
  22606. });
  22607. const selectionModes = ["date", "dates", "year", "month", "week", "range"];
  22608. const datePickerSharedProps = buildProps({
  22609. disabledDate: {
  22610. type: definePropType(Function)
  22611. },
  22612. date: {
  22613. type: definePropType(Object),
  22614. required: true
  22615. },
  22616. minDate: {
  22617. type: definePropType(Object)
  22618. },
  22619. maxDate: {
  22620. type: definePropType(Object)
  22621. },
  22622. parsedValue: {
  22623. type: definePropType([Object, Array])
  22624. },
  22625. rangeState: {
  22626. type: definePropType(Object),
  22627. default: () => ({
  22628. endDate: null,
  22629. selecting: false
  22630. })
  22631. }
  22632. });
  22633. const panelSharedProps = buildProps({
  22634. type: {
  22635. type: definePropType(String),
  22636. required: true,
  22637. values: datePickTypes
  22638. }
  22639. });
  22640. const panelRangeSharedProps = buildProps({
  22641. unlinkPanels: Boolean,
  22642. parsedValue: {
  22643. type: definePropType(Array)
  22644. }
  22645. });
  22646. const selectionModeWithDefault = (mode) => {
  22647. return {
  22648. type: String,
  22649. values: selectionModes,
  22650. default: mode
  22651. };
  22652. };
  22653. const panelDatePickProps = buildProps({
  22654. ...panelSharedProps,
  22655. parsedValue: {
  22656. type: definePropType([Object, Array])
  22657. },
  22658. visible: {
  22659. type: Boolean
  22660. },
  22661. format: {
  22662. type: String,
  22663. default: ""
  22664. }
  22665. });
  22666. const basicDateTableProps = buildProps({
  22667. ...datePickerSharedProps,
  22668. cellClassName: {
  22669. type: definePropType(Function)
  22670. },
  22671. showWeekNumber: Boolean,
  22672. selectionMode: selectionModeWithDefault("date")
  22673. });
  22674. const isValidRange = (range) => {
  22675. if (!isArray(range))
  22676. return false;
  22677. const [left, right] = range;
  22678. return dayjs.isDayjs(left) && dayjs.isDayjs(right) && left.isSameOrBefore(right);
  22679. };
  22680. const getDefaultValue = (defaultValue, { lang, unit, unlinkPanels }) => {
  22681. let start;
  22682. if (isArray(defaultValue)) {
  22683. let [left, right] = defaultValue.map((d) => dayjs(d).locale(lang));
  22684. if (!unlinkPanels) {
  22685. right = left.add(1, unit);
  22686. }
  22687. return [left, right];
  22688. } else if (defaultValue) {
  22689. start = dayjs(defaultValue);
  22690. } else {
  22691. start = dayjs();
  22692. }
  22693. start = start.locale(lang);
  22694. return [start, start.add(1, unit)];
  22695. };
  22696. const buildPickerTable = (dimension, rows, {
  22697. columnIndexOffset,
  22698. startDate,
  22699. nextEndDate,
  22700. now,
  22701. unit,
  22702. relativeDateGetter,
  22703. setCellMetadata,
  22704. setRowMetadata
  22705. }) => {
  22706. for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
  22707. const row = rows[rowIndex];
  22708. for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
  22709. let cell = row[columnIndex + columnIndexOffset];
  22710. if (!cell) {
  22711. cell = {
  22712. row: rowIndex,
  22713. column: columnIndex,
  22714. type: "normal",
  22715. inRange: false,
  22716. start: false,
  22717. end: false
  22718. };
  22719. }
  22720. const index = rowIndex * dimension.column + columnIndex;
  22721. const nextStartDate = relativeDateGetter(index);
  22722. cell.dayjs = nextStartDate;
  22723. cell.date = nextStartDate.toDate();
  22724. cell.timestamp = nextStartDate.valueOf();
  22725. cell.type = "normal";
  22726. cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit));
  22727. if (startDate == null ? void 0 : startDate.isSameOrAfter(nextEndDate)) {
  22728. cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  22729. cell.end = startDate && nextStartDate.isSame(startDate, unit);
  22730. } else {
  22731. cell.start = !!startDate && nextStartDate.isSame(startDate, unit);
  22732. cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  22733. }
  22734. const isToday = nextStartDate.isSame(now, unit);
  22735. if (isToday) {
  22736. cell.type = "today";
  22737. }
  22738. setCellMetadata == null ? void 0 : setCellMetadata(cell, { rowIndex, columnIndex });
  22739. row[columnIndex + columnIndexOffset] = cell;
  22740. }
  22741. setRowMetadata == null ? void 0 : setRowMetadata(row);
  22742. }
  22743. };
  22744. const basicCellProps = buildProps({
  22745. cell: {
  22746. type: definePropType(Object)
  22747. }
  22748. });
  22749. var ElDatePickerCell = vue.defineComponent({
  22750. name: "ElDatePickerCell",
  22751. props: basicCellProps,
  22752. setup(props) {
  22753. const ns = useNamespace("date-table-cell");
  22754. const {
  22755. slots
  22756. } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  22757. return () => {
  22758. const {
  22759. cell
  22760. } = props;
  22761. if (slots.default) {
  22762. const list = slots.default(cell).filter((item) => {
  22763. return item.patchFlag !== -2 && item.type.toString() !== "Symbol(Comment)";
  22764. });
  22765. if (list.length) {
  22766. return list;
  22767. }
  22768. }
  22769. return vue.createVNode("div", {
  22770. "class": ns.b()
  22771. }, [vue.createVNode("span", {
  22772. "class": ns.e("text")
  22773. }, [cell == null ? void 0 : cell.text])]);
  22774. };
  22775. }
  22776. });
  22777. const _hoisted_1$J = ["aria-label"];
  22778. const _hoisted_2$t = {
  22779. key: 0,
  22780. scope: "col"
  22781. };
  22782. const _hoisted_3$f = ["aria-label"];
  22783. const _hoisted_4$b = ["aria-current", "aria-selected", "tabindex"];
  22784. const _sfc_main$1l = /* @__PURE__ */ vue.defineComponent({
  22785. __name: "basic-date-table",
  22786. props: basicDateTableProps,
  22787. emits: ["changerange", "pick", "select"],
  22788. setup(__props, { expose, emit }) {
  22789. const props = __props;
  22790. const ns = useNamespace("date-table");
  22791. const { t, lang } = useLocale();
  22792. const tbodyRef = vue.ref();
  22793. const currentCellRef = vue.ref();
  22794. const lastRow = vue.ref();
  22795. const lastColumn = vue.ref();
  22796. const tableRows = vue.ref([[], [], [], [], [], []]);
  22797. let focusWithClick = false;
  22798. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  22799. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
  22800. const offsetDay = vue.computed(() => {
  22801. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  22802. });
  22803. const startDate = vue.computed(() => {
  22804. const startDayOfMonth = props.date.startOf("month");
  22805. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  22806. });
  22807. const WEEKS = vue.computed(() => {
  22808. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  22809. });
  22810. const hasCurrent = vue.computed(() => {
  22811. return flatten(rows.value).some((row) => {
  22812. return row.isCurrent;
  22813. });
  22814. });
  22815. const days = vue.computed(() => {
  22816. const startOfMonth = props.date.startOf("month");
  22817. const startOfMonthDay = startOfMonth.day() || 7;
  22818. const dateCountOfMonth = startOfMonth.daysInMonth();
  22819. const dateCountOfLastMonth = startOfMonth.subtract(1, "month").daysInMonth();
  22820. return {
  22821. startOfMonthDay,
  22822. dateCountOfMonth,
  22823. dateCountOfLastMonth
  22824. };
  22825. });
  22826. const selectedDate = vue.computed(() => {
  22827. return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  22828. });
  22829. const setDateText = (cell, {
  22830. count,
  22831. rowIndex,
  22832. columnIndex
  22833. }) => {
  22834. const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = vue.unref(days);
  22835. const offset = vue.unref(offsetDay);
  22836. if (rowIndex >= 0 && rowIndex <= 1) {
  22837. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  22838. if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
  22839. cell.text = count;
  22840. return true;
  22841. } else {
  22842. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
  22843. cell.type = "prev-month";
  22844. }
  22845. } else {
  22846. if (count <= dateCountOfMonth) {
  22847. cell.text = count;
  22848. } else {
  22849. cell.text = count - dateCountOfMonth;
  22850. cell.type = "next-month";
  22851. }
  22852. return true;
  22853. }
  22854. return false;
  22855. };
  22856. const setCellMetadata = (cell, {
  22857. columnIndex,
  22858. rowIndex
  22859. }, count) => {
  22860. const { disabledDate, cellClassName } = props;
  22861. const _selectedDate = vue.unref(selectedDate);
  22862. const shouldIncrement = setDateText(cell, { count, rowIndex, columnIndex });
  22863. const cellDate = cell.dayjs.toDate();
  22864. cell.selected = _selectedDate.find((d) => d.valueOf() === cell.dayjs.valueOf());
  22865. cell.isSelected = !!cell.selected;
  22866. cell.isCurrent = isCurrent(cell);
  22867. cell.disabled = disabledDate == null ? void 0 : disabledDate(cellDate);
  22868. cell.customClass = cellClassName == null ? void 0 : cellClassName(cellDate);
  22869. return shouldIncrement;
  22870. };
  22871. const setRowMetadata = (row) => {
  22872. if (props.selectionMode === "week") {
  22873. const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
  22874. const isActive = isWeekActive(row[start + 1]);
  22875. row[start].inRange = isActive;
  22876. row[start].start = isActive;
  22877. row[end].inRange = isActive;
  22878. row[end].end = isActive;
  22879. }
  22880. };
  22881. const rows = vue.computed(() => {
  22882. const { minDate, maxDate, rangeState, showWeekNumber } = props;
  22883. const offset = offsetDay.value;
  22884. const rows_ = tableRows.value;
  22885. const dateUnit = "day";
  22886. let count = 1;
  22887. if (showWeekNumber) {
  22888. for (let rowIndex = 0; rowIndex < 6; rowIndex++) {
  22889. if (!rows_[rowIndex][0]) {
  22890. rows_[rowIndex][0] = {
  22891. type: "week",
  22892. text: startDate.value.add(rowIndex * 7 + 1, dateUnit).week()
  22893. };
  22894. }
  22895. }
  22896. }
  22897. buildPickerTable({ row: 6, column: 7 }, rows_, {
  22898. startDate: minDate,
  22899. columnIndexOffset: showWeekNumber ? 1 : 0,
  22900. nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
  22901. now: dayjs().locale(vue.unref(lang)).startOf(dateUnit),
  22902. unit: dateUnit,
  22903. relativeDateGetter: (idx) => startDate.value.add(idx - offset, dateUnit),
  22904. setCellMetadata: (...args) => {
  22905. if (setCellMetadata(...args, count)) {
  22906. count += 1;
  22907. }
  22908. },
  22909. setRowMetadata
  22910. });
  22911. return rows_;
  22912. });
  22913. vue.watch(() => props.date, async () => {
  22914. var _a, _b;
  22915. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  22916. await vue.nextTick();
  22917. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  22918. }
  22919. });
  22920. const focus = async () => {
  22921. var _a;
  22922. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  22923. };
  22924. const isNormalDay = (type = "") => {
  22925. return ["normal", "today"].includes(type);
  22926. };
  22927. const isCurrent = (cell) => {
  22928. return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
  22929. };
  22930. const cellMatchesDate = (cell, date) => {
  22931. if (!date)
  22932. return false;
  22933. return dayjs(date).locale(lang.value).isSame(props.date.date(Number(cell.text)), "day");
  22934. };
  22935. const getCellClasses = (cell) => {
  22936. const classes = [];
  22937. if (isNormalDay(cell.type) && !cell.disabled) {
  22938. classes.push("available");
  22939. if (cell.type === "today") {
  22940. classes.push("today");
  22941. }
  22942. } else {
  22943. classes.push(cell.type);
  22944. }
  22945. if (isCurrent(cell)) {
  22946. classes.push("current");
  22947. }
  22948. if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
  22949. classes.push("in-range");
  22950. if (cell.start) {
  22951. classes.push("start-date");
  22952. }
  22953. if (cell.end) {
  22954. classes.push("end-date");
  22955. }
  22956. }
  22957. if (cell.disabled) {
  22958. classes.push("disabled");
  22959. }
  22960. if (cell.selected) {
  22961. classes.push("selected");
  22962. }
  22963. if (cell.customClass) {
  22964. classes.push(cell.customClass);
  22965. }
  22966. return classes.join(" ");
  22967. };
  22968. const getDateOfCell = (row, column) => {
  22969. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0)) - offsetDay.value;
  22970. return startDate.value.add(offsetFromStart, "day");
  22971. };
  22972. const handleMouseMove = (event) => {
  22973. var _a;
  22974. if (!props.rangeState.selecting)
  22975. return;
  22976. let target = event.target;
  22977. if (target.tagName === "SPAN") {
  22978. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  22979. }
  22980. if (target.tagName === "DIV") {
  22981. target = target.parentNode;
  22982. }
  22983. if (target.tagName !== "TD")
  22984. return;
  22985. const row = target.parentNode.rowIndex - 1;
  22986. const column = target.cellIndex;
  22987. if (rows.value[row][column].disabled)
  22988. return;
  22989. if (row !== lastRow.value || column !== lastColumn.value) {
  22990. lastRow.value = row;
  22991. lastColumn.value = column;
  22992. emit("changerange", {
  22993. selecting: true,
  22994. endDate: getDateOfCell(row, column)
  22995. });
  22996. }
  22997. };
  22998. const isSelectedCell = (cell) => {
  22999. return !hasCurrent.value && (cell == null ? void 0 : cell.text) === 1 && cell.type === "normal" || cell.isCurrent;
  23000. };
  23001. const handleFocus = (event) => {
  23002. if (focusWithClick || hasCurrent.value || props.selectionMode !== "date")
  23003. return;
  23004. handlePickDate(event, true);
  23005. };
  23006. const handleMouseDown = (event) => {
  23007. const target = event.target.closest("td");
  23008. if (!target)
  23009. return;
  23010. focusWithClick = true;
  23011. };
  23012. const handleMouseUp = (event) => {
  23013. const target = event.target.closest("td");
  23014. if (!target)
  23015. return;
  23016. focusWithClick = false;
  23017. };
  23018. const handlePickDate = (event, isKeyboardMovement = false) => {
  23019. const target = event.target.closest("td");
  23020. if (!target)
  23021. return;
  23022. const row = target.parentNode.rowIndex - 1;
  23023. const column = target.cellIndex;
  23024. const cell = rows.value[row][column];
  23025. if (cell.disabled || cell.type === "week")
  23026. return;
  23027. const newDate = getDateOfCell(row, column);
  23028. if (props.selectionMode === "range") {
  23029. if (!props.rangeState.selecting || !props.minDate) {
  23030. emit("pick", { minDate: newDate, maxDate: null });
  23031. emit("select", true);
  23032. } else {
  23033. if (newDate >= props.minDate) {
  23034. emit("pick", { minDate: props.minDate, maxDate: newDate });
  23035. } else {
  23036. emit("pick", { minDate: newDate, maxDate: props.minDate });
  23037. }
  23038. emit("select", false);
  23039. }
  23040. } else if (props.selectionMode === "date") {
  23041. emit("pick", newDate, isKeyboardMovement);
  23042. } else if (props.selectionMode === "week") {
  23043. const weekNumber = newDate.week();
  23044. const value = `${newDate.year()}w${weekNumber}`;
  23045. emit("pick", {
  23046. year: newDate.year(),
  23047. week: weekNumber,
  23048. value,
  23049. date: newDate.startOf("week")
  23050. });
  23051. } else if (props.selectionMode === "dates") {
  23052. const newValue = cell.selected ? castArray(props.parsedValue).filter((d) => (d == null ? void 0 : d.valueOf()) !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]);
  23053. emit("pick", newValue);
  23054. }
  23055. };
  23056. const isWeekActive = (cell) => {
  23057. if (props.selectionMode !== "week")
  23058. return false;
  23059. let newDate = props.date.startOf("day");
  23060. if (cell.type === "prev-month") {
  23061. newDate = newDate.subtract(1, "month");
  23062. }
  23063. if (cell.type === "next-month") {
  23064. newDate = newDate.add(1, "month");
  23065. }
  23066. newDate = newDate.date(Number.parseInt(cell.text, 10));
  23067. if (props.parsedValue && !Array.isArray(props.parsedValue)) {
  23068. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  23069. const weekDate = props.parsedValue.subtract(dayOffset, "day");
  23070. return weekDate.isSame(newDate, "day");
  23071. }
  23072. return false;
  23073. };
  23074. expose({
  23075. focus
  23076. });
  23077. return (_ctx, _cache) => {
  23078. return vue.openBlock(), vue.createElementBlock("table", {
  23079. role: "grid",
  23080. "aria-label": vue.unref(t)("el.datepicker.dateTablePrompt"),
  23081. cellspacing: "0",
  23082. cellpadding: "0",
  23083. class: vue.normalizeClass([vue.unref(ns).b(), { "is-week-mode": _ctx.selectionMode === "week" }]),
  23084. onClick: handlePickDate,
  23085. onMousemove: handleMouseMove,
  23086. onMousedown: handleMouseDown,
  23087. onMouseup: handleMouseUp
  23088. }, [
  23089. vue.createElementVNode("tbody", {
  23090. ref_key: "tbodyRef",
  23091. ref: tbodyRef
  23092. }, [
  23093. vue.createElementVNode("tr", null, [
  23094. _ctx.showWeekNumber ? (vue.openBlock(), vue.createElementBlock("th", _hoisted_2$t, vue.toDisplayString(vue.unref(t)("el.datepicker.week")), 1)) : vue.createCommentVNode("v-if", true),
  23095. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(WEEKS), (week, key) => {
  23096. return vue.openBlock(), vue.createElementBlock("th", {
  23097. key,
  23098. scope: "col",
  23099. "aria-label": vue.unref(t)("el.datepicker.weeksFull." + week)
  23100. }, vue.toDisplayString(vue.unref(t)("el.datepicker.weeks." + week)), 9, _hoisted_3$f);
  23101. }), 128))
  23102. ]),
  23103. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, rowKey) => {
  23104. return vue.openBlock(), vue.createElementBlock("tr", {
  23105. key: rowKey,
  23106. class: vue.normalizeClass([vue.unref(ns).e("row"), { current: isWeekActive(row[1]) }])
  23107. }, [
  23108. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, columnKey) => {
  23109. return vue.openBlock(), vue.createElementBlock("td", {
  23110. key: `${rowKey}.${columnKey}`,
  23111. ref_for: true,
  23112. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  23113. class: vue.normalizeClass(getCellClasses(cell)),
  23114. "aria-current": cell.isCurrent ? "date" : void 0,
  23115. "aria-selected": cell.isCurrent,
  23116. tabindex: isSelectedCell(cell) ? 0 : -1,
  23117. onFocus: handleFocus
  23118. }, [
  23119. vue.createVNode(vue.unref(ElDatePickerCell), { cell }, null, 8, ["cell"])
  23120. ], 42, _hoisted_4$b);
  23121. }), 128))
  23122. ], 2);
  23123. }), 128))
  23124. ], 512)
  23125. ], 42, _hoisted_1$J);
  23126. };
  23127. }
  23128. });
  23129. var DateTable = /* @__PURE__ */ _export_sfc(_sfc_main$1l, [["__file", "basic-date-table.vue"]]);
  23130. const basicMonthTableProps = buildProps({
  23131. ...datePickerSharedProps,
  23132. selectionMode: selectionModeWithDefault("month")
  23133. });
  23134. const _hoisted_1$I = ["aria-label"];
  23135. const _hoisted_2$s = ["aria-selected", "aria-label", "tabindex", "onKeydown"];
  23136. const _hoisted_3$e = { class: "cell" };
  23137. const _sfc_main$1k = /* @__PURE__ */ vue.defineComponent({
  23138. __name: "basic-month-table",
  23139. props: basicMonthTableProps,
  23140. emits: ["changerange", "pick", "select"],
  23141. setup(__props, { expose, emit }) {
  23142. const props = __props;
  23143. const datesInMonth = (year, month, lang2) => {
  23144. const firstDay = dayjs().locale(lang2).startOf("month").month(month).year(year);
  23145. const numOfDays = firstDay.daysInMonth();
  23146. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  23147. };
  23148. const ns = useNamespace("month-table");
  23149. const { t, lang } = useLocale();
  23150. const tbodyRef = vue.ref();
  23151. const currentCellRef = vue.ref();
  23152. const months = vue.ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
  23153. const tableRows = vue.ref([
  23154. [],
  23155. [],
  23156. []
  23157. ]);
  23158. const lastRow = vue.ref();
  23159. const lastColumn = vue.ref();
  23160. const rows = vue.computed(() => {
  23161. var _a, _b;
  23162. const rows2 = tableRows.value;
  23163. const now = dayjs().locale(lang.value).startOf("month");
  23164. for (let i = 0; i < 3; i++) {
  23165. const row = rows2[i];
  23166. for (let j = 0; j < 4; j++) {
  23167. const cell = row[j] || (row[j] = {
  23168. row: i,
  23169. column: j,
  23170. type: "normal",
  23171. inRange: false,
  23172. start: false,
  23173. end: false,
  23174. text: -1,
  23175. disabled: false
  23176. });
  23177. cell.type = "normal";
  23178. const index = i * 4 + j;
  23179. const calTime = props.date.startOf("year").month(index);
  23180. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  23181. 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"));
  23182. if ((_a = props.minDate) == null ? void 0 : _a.isSameOrAfter(calEndDate)) {
  23183. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  23184. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  23185. } else {
  23186. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
  23187. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  23188. }
  23189. const isToday = now.isSame(calTime);
  23190. if (isToday) {
  23191. cell.type = "today";
  23192. }
  23193. cell.text = index;
  23194. cell.disabled = ((_b = props.disabledDate) == null ? void 0 : _b.call(props, calTime.toDate())) || false;
  23195. }
  23196. }
  23197. return rows2;
  23198. });
  23199. const focus = () => {
  23200. var _a;
  23201. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  23202. };
  23203. const getCellStyle = (cell) => {
  23204. const style = {};
  23205. const year = props.date.year();
  23206. const today = new Date();
  23207. const month = cell.text;
  23208. style.disabled = props.disabledDate ? datesInMonth(year, month, lang.value).every(props.disabledDate) : false;
  23209. style.current = castArray(props.parsedValue).findIndex((date) => dayjs.isDayjs(date) && date.year() === year && date.month() === month) >= 0;
  23210. style.today = today.getFullYear() === year && today.getMonth() === month;
  23211. if (cell.inRange) {
  23212. style["in-range"] = true;
  23213. if (cell.start) {
  23214. style["start-date"] = true;
  23215. }
  23216. if (cell.end) {
  23217. style["end-date"] = true;
  23218. }
  23219. }
  23220. return style;
  23221. };
  23222. const isSelectedCell = (cell) => {
  23223. const year = props.date.year();
  23224. const month = cell.text;
  23225. return castArray(props.date).findIndex((date) => date.year() === year && date.month() === month) >= 0;
  23226. };
  23227. const handleMouseMove = (event) => {
  23228. var _a;
  23229. if (!props.rangeState.selecting)
  23230. return;
  23231. let target = event.target;
  23232. if (target.tagName === "A") {
  23233. target = (_a = target.parentNode) == null ? void 0 : _a.parentNode;
  23234. }
  23235. if (target.tagName === "DIV") {
  23236. target = target.parentNode;
  23237. }
  23238. if (target.tagName !== "TD")
  23239. return;
  23240. const row = target.parentNode.rowIndex;
  23241. const column = target.cellIndex;
  23242. if (rows.value[row][column].disabled)
  23243. return;
  23244. if (row !== lastRow.value || column !== lastColumn.value) {
  23245. lastRow.value = row;
  23246. lastColumn.value = column;
  23247. emit("changerange", {
  23248. selecting: true,
  23249. endDate: props.date.startOf("year").month(row * 4 + column)
  23250. });
  23251. }
  23252. };
  23253. const handleMonthTableClick = (event) => {
  23254. var _a;
  23255. const target = (_a = event.target) == null ? void 0 : _a.closest("td");
  23256. if ((target == null ? void 0 : target.tagName) !== "TD")
  23257. return;
  23258. if (hasClass(target, "disabled"))
  23259. return;
  23260. const column = target.cellIndex;
  23261. const row = target.parentNode.rowIndex;
  23262. const month = row * 4 + column;
  23263. const newDate = props.date.startOf("year").month(month);
  23264. if (props.selectionMode === "range") {
  23265. if (!props.rangeState.selecting) {
  23266. emit("pick", { minDate: newDate, maxDate: null });
  23267. emit("select", true);
  23268. } else {
  23269. if (props.minDate && newDate >= props.minDate) {
  23270. emit("pick", { minDate: props.minDate, maxDate: newDate });
  23271. } else {
  23272. emit("pick", { minDate: newDate, maxDate: props.minDate });
  23273. }
  23274. emit("select", false);
  23275. }
  23276. } else {
  23277. emit("pick", month);
  23278. }
  23279. };
  23280. vue.watch(() => props.date, async () => {
  23281. var _a, _b;
  23282. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  23283. await vue.nextTick();
  23284. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  23285. }
  23286. });
  23287. expose({
  23288. focus
  23289. });
  23290. return (_ctx, _cache) => {
  23291. return vue.openBlock(), vue.createElementBlock("table", {
  23292. role: "grid",
  23293. "aria-label": vue.unref(t)("el.datepicker.monthTablePrompt"),
  23294. class: vue.normalizeClass(vue.unref(ns).b()),
  23295. onClick: handleMonthTableClick,
  23296. onMousemove: handleMouseMove
  23297. }, [
  23298. vue.createElementVNode("tbody", {
  23299. ref_key: "tbodyRef",
  23300. ref: tbodyRef
  23301. }, [
  23302. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(rows), (row, key) => {
  23303. return vue.openBlock(), vue.createElementBlock("tr", { key }, [
  23304. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(row, (cell, key_) => {
  23305. return vue.openBlock(), vue.createElementBlock("td", {
  23306. key: key_,
  23307. ref_for: true,
  23308. ref: (el) => isSelectedCell(cell) && (currentCellRef.value = el),
  23309. class: vue.normalizeClass(getCellStyle(cell)),
  23310. "aria-selected": `${isSelectedCell(cell)}`,
  23311. "aria-label": vue.unref(t)(`el.datepicker.month${+cell.text + 1}`),
  23312. tabindex: isSelectedCell(cell) ? 0 : -1,
  23313. onKeydown: [
  23314. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]),
  23315. vue.withKeys(vue.withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])
  23316. ]
  23317. }, [
  23318. vue.createElementVNode("div", null, [
  23319. vue.createElementVNode("span", _hoisted_3$e, vue.toDisplayString(vue.unref(t)("el.datepicker.months." + months.value[cell.text])), 1)
  23320. ])
  23321. ], 42, _hoisted_2$s);
  23322. }), 128))
  23323. ]);
  23324. }), 128))
  23325. ], 512)
  23326. ], 42, _hoisted_1$I);
  23327. };
  23328. }
  23329. });
  23330. var MonthTable = /* @__PURE__ */ _export_sfc(_sfc_main$1k, [["__file", "basic-month-table.vue"]]);
  23331. const { date, disabledDate, parsedValue } = datePickerSharedProps;
  23332. const basicYearTableProps = buildProps({
  23333. date,
  23334. disabledDate,
  23335. parsedValue
  23336. });
  23337. const _hoisted_1$H = ["aria-label"];
  23338. const _hoisted_2$r = ["aria-selected", "tabindex", "onKeydown"];
  23339. const _hoisted_3$d = { class: "cell" };
  23340. const _hoisted_4$a = { key: 1 };
  23341. const _sfc_main$1j = /* @__PURE__ */ vue.defineComponent({
  23342. __name: "basic-year-table",
  23343. props: basicYearTableProps,
  23344. emits: ["pick"],
  23345. setup(__props, { expose, emit }) {
  23346. const props = __props;
  23347. const datesInYear = (year, lang2) => {
  23348. const firstDay = dayjs(String(year)).locale(lang2).startOf("year");
  23349. const lastDay = firstDay.endOf("year");
  23350. const numOfDays = lastDay.dayOfYear();
  23351. return rangeArr(numOfDays).map((n) => firstDay.add(n, "day").toDate());
  23352. };
  23353. const ns = useNamespace("year-table");
  23354. const { t, lang } = useLocale();
  23355. const tbodyRef = vue.ref();
  23356. const currentCellRef = vue.ref();
  23357. const startYear = vue.computed(() => {
  23358. return Math.floor(props.date.year() / 10) * 10;
  23359. });
  23360. const focus = () => {
  23361. var _a;
  23362. (_a = currentCellRef.value) == null ? void 0 : _a.focus();
  23363. };
  23364. const getCellKls = (year) => {
  23365. const kls = {};
  23366. const today = dayjs().locale(lang.value);
  23367. kls.disabled = props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false;
  23368. kls.current = castArray(props.parsedValue).findIndex((d) => d.year() === year) >= 0;
  23369. kls.today = today.year() === year;
  23370. return kls;
  23371. };
  23372. const isSelectedCell = (year) => {
  23373. return year === startYear.value && props.date.year() < startYear.value && props.date.year() > startYear.value + 9 || castArray(props.date).findIndex((date) => date.year() === year) >= 0;
  23374. };
  23375. const handleYearTableClick = (event) => {
  23376. const clickTarget = event.target;
  23377. const target = clickTarget.closest("td");
  23378. if (target && target.textContent) {
  23379. if (hasClass(target, "disabled"))
  23380. return;
  23381. const year = target.textContent || target.innerText;
  23382. emit("pick", Number(year));
  23383. }
  23384. };
  23385. vue.watch(() => props.date, async () => {
  23386. var _a, _b;
  23387. if ((_a = tbodyRef.value) == null ? void 0 : _a.contains(document.activeElement)) {
  23388. await vue.nextTick();
  23389. (_b = currentCellRef.value) == null ? void 0 : _b.focus();
  23390. }
  23391. });
  23392. expose({
  23393. focus
  23394. });
  23395. return (_ctx, _cache) => {
  23396. return vue.openBlock(), vue.createElementBlock("table", {
  23397. role: "grid",
  23398. "aria-label": vue.unref(t)("el.datepicker.yearTablePrompt"),
  23399. class: vue.normalizeClass(vue.unref(ns).b()),
  23400. onClick: handleYearTableClick
  23401. }, [
  23402. vue.createElementVNode("tbody", {
  23403. ref_key: "tbodyRef",
  23404. ref: tbodyRef
  23405. }, [
  23406. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(3, (_, i) => {
  23407. return vue.createElementVNode("tr", { key: i }, [
  23408. (vue.openBlock(), vue.createElementBlock(vue.Fragment, null, vue.renderList(4, (__, j) => {
  23409. return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
  23410. key: i + "_" + j
  23411. }, [
  23412. i * 4 + j < 10 ? (vue.openBlock(), vue.createElementBlock("td", {
  23413. key: 0,
  23414. ref_for: true,
  23415. ref: (el) => isSelectedCell(vue.unref(startYear) + i * 4 + j) && (currentCellRef.value = el),
  23416. class: vue.normalizeClass(["available", getCellKls(vue.unref(startYear) + i * 4 + j)]),
  23417. "aria-selected": `${isSelectedCell(vue.unref(startYear) + i * 4 + j)}`,
  23418. tabindex: isSelectedCell(vue.unref(startYear) + i * 4 + j) ? 0 : -1,
  23419. onKeydown: [
  23420. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]),
  23421. vue.withKeys(vue.withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])
  23422. ]
  23423. }, [
  23424. vue.createElementVNode("span", _hoisted_3$d, vue.toDisplayString(vue.unref(startYear) + i * 4 + j), 1)
  23425. ], 42, _hoisted_2$r)) : (vue.openBlock(), vue.createElementBlock("td", _hoisted_4$a))
  23426. ], 64);
  23427. }), 64))
  23428. ]);
  23429. }), 64))
  23430. ], 512)
  23431. ], 10, _hoisted_1$H);
  23432. };
  23433. }
  23434. });
  23435. var YearTable = /* @__PURE__ */ _export_sfc(_sfc_main$1j, [["__file", "basic-year-table.vue"]]);
  23436. const _hoisted_1$G = ["onClick"];
  23437. const _hoisted_2$q = ["aria-label"];
  23438. const _hoisted_3$c = ["aria-label"];
  23439. const _hoisted_4$9 = ["aria-label"];
  23440. const _hoisted_5$7 = ["aria-label"];
  23441. const _sfc_main$1i = /* @__PURE__ */ vue.defineComponent({
  23442. __name: "panel-date-pick",
  23443. props: panelDatePickProps,
  23444. emits: ["pick", "set-picker-option", "panel-change"],
  23445. setup(__props, { emit: contextEmit }) {
  23446. const props = __props;
  23447. const timeWithinRange = (_, __, ___) => true;
  23448. const ppNs = useNamespace("picker-panel");
  23449. const dpNs = useNamespace("date-picker");
  23450. const attrs = vue.useAttrs();
  23451. const slots = vue.useSlots();
  23452. const { t, lang } = useLocale();
  23453. const pickerBase = vue.inject("EP_PICKER_BASE");
  23454. const popper = vue.inject(TOOLTIP_INJECTION_KEY);
  23455. const { shortcuts, disabledDate, cellClassName, defaultTime, arrowControl } = pickerBase.props;
  23456. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  23457. const currentViewRef = vue.ref();
  23458. const innerDate = vue.ref(dayjs().locale(lang.value));
  23459. const defaultTimeD = vue.computed(() => {
  23460. return dayjs(defaultTime).locale(lang.value);
  23461. });
  23462. const month = vue.computed(() => {
  23463. return innerDate.value.month();
  23464. });
  23465. const year = vue.computed(() => {
  23466. return innerDate.value.year();
  23467. });
  23468. const selectableRange = vue.ref([]);
  23469. const userInputDate = vue.ref(null);
  23470. const userInputTime = vue.ref(null);
  23471. const checkDateWithinRange = (date) => {
  23472. return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
  23473. };
  23474. const formatEmit = (emitDayjs) => {
  23475. if (defaultTime && !visibleTime.value) {
  23476. return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  23477. }
  23478. if (showTime.value)
  23479. return emitDayjs.millisecond(0);
  23480. return emitDayjs.startOf("day");
  23481. };
  23482. const emit = (value, ...args) => {
  23483. if (!value) {
  23484. contextEmit("pick", value, ...args);
  23485. } else if (isArray(value)) {
  23486. const dates = value.map(formatEmit);
  23487. contextEmit("pick", dates, ...args);
  23488. } else {
  23489. contextEmit("pick", formatEmit(value), ...args);
  23490. }
  23491. userInputDate.value = null;
  23492. userInputTime.value = null;
  23493. };
  23494. const handleDatePick = (value, keepOpen) => {
  23495. if (selectionMode.value === "date") {
  23496. value = value;
  23497. let newDate = props.parsedValue ? props.parsedValue.year(value.year()).month(value.month()).date(value.date()) : value;
  23498. if (!checkDateWithinRange(newDate)) {
  23499. newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  23500. }
  23501. innerDate.value = newDate;
  23502. emit(newDate, showTime.value || keepOpen);
  23503. } else if (selectionMode.value === "week") {
  23504. emit(value.date);
  23505. } else if (selectionMode.value === "dates") {
  23506. emit(value, true);
  23507. }
  23508. };
  23509. const moveByMonth = (forward) => {
  23510. const action = forward ? "add" : "subtract";
  23511. innerDate.value = innerDate.value[action](1, "month");
  23512. handlePanelChange("month");
  23513. };
  23514. const moveByYear = (forward) => {
  23515. const currentDate = innerDate.value;
  23516. const action = forward ? "add" : "subtract";
  23517. innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
  23518. handlePanelChange("year");
  23519. };
  23520. const currentView = vue.ref("date");
  23521. const yearLabel = vue.computed(() => {
  23522. const yearTranslation = t("el.datepicker.year");
  23523. if (currentView.value === "year") {
  23524. const startYear = Math.floor(year.value / 10) * 10;
  23525. if (yearTranslation) {
  23526. return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  23527. }
  23528. return `${startYear} - ${startYear + 9}`;
  23529. }
  23530. return `${year.value} ${yearTranslation}`;
  23531. });
  23532. const handleShortcutClick = (shortcut) => {
  23533. const shortcutValue = isFunction(shortcut.value) ? shortcut.value() : shortcut.value;
  23534. if (shortcutValue) {
  23535. emit(dayjs(shortcutValue).locale(lang.value));
  23536. return;
  23537. }
  23538. if (shortcut.onClick) {
  23539. shortcut.onClick({
  23540. attrs,
  23541. slots,
  23542. emit: contextEmit
  23543. });
  23544. }
  23545. };
  23546. const selectionMode = vue.computed(() => {
  23547. const { type } = props;
  23548. if (["week", "month", "year", "dates"].includes(type))
  23549. return type;
  23550. return "date";
  23551. });
  23552. const keyboardMode = vue.computed(() => {
  23553. return selectionMode.value === "date" ? currentView.value : selectionMode.value;
  23554. });
  23555. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  23556. const handleMonthPick = async (month2) => {
  23557. innerDate.value = innerDate.value.startOf("month").month(month2);
  23558. if (selectionMode.value === "month") {
  23559. emit(innerDate.value, false);
  23560. } else {
  23561. currentView.value = "date";
  23562. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  23563. emit(innerDate.value, true);
  23564. await vue.nextTick();
  23565. handleFocusPicker();
  23566. }
  23567. }
  23568. handlePanelChange("month");
  23569. };
  23570. const handleYearPick = async (year2) => {
  23571. if (selectionMode.value === "year") {
  23572. innerDate.value = innerDate.value.startOf("year").year(year2);
  23573. emit(innerDate.value, false);
  23574. } else {
  23575. innerDate.value = innerDate.value.year(year2);
  23576. currentView.value = "month";
  23577. if (["month", "year", "date", "week"].includes(selectionMode.value)) {
  23578. emit(innerDate.value, true);
  23579. await vue.nextTick();
  23580. handleFocusPicker();
  23581. }
  23582. }
  23583. handlePanelChange("year");
  23584. };
  23585. const showPicker = async (view) => {
  23586. currentView.value = view;
  23587. await vue.nextTick();
  23588. handleFocusPicker();
  23589. };
  23590. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  23591. const footerVisible = vue.computed(() => {
  23592. return showTime.value || selectionMode.value === "dates";
  23593. });
  23594. const onConfirm = () => {
  23595. if (selectionMode.value === "dates") {
  23596. emit(props.parsedValue);
  23597. } else {
  23598. let result = props.parsedValue;
  23599. if (!result) {
  23600. const defaultTimeD2 = dayjs(defaultTime).locale(lang.value);
  23601. const defaultValueD = getDefaultValue();
  23602. result = defaultTimeD2.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  23603. }
  23604. innerDate.value = result;
  23605. emit(result);
  23606. }
  23607. };
  23608. const changeToNow = () => {
  23609. const now = dayjs().locale(lang.value);
  23610. const nowDate = now.toDate();
  23611. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  23612. innerDate.value = dayjs().locale(lang.value);
  23613. emit(innerDate.value);
  23614. }
  23615. };
  23616. const timeFormat = vue.computed(() => {
  23617. return extractTimeFormat(props.format);
  23618. });
  23619. const dateFormat = vue.computed(() => {
  23620. return extractDateFormat(props.format);
  23621. });
  23622. const visibleTime = vue.computed(() => {
  23623. if (userInputTime.value)
  23624. return userInputTime.value;
  23625. if (!props.parsedValue && !defaultValue.value)
  23626. return;
  23627. return (props.parsedValue || innerDate.value).format(timeFormat.value);
  23628. });
  23629. const visibleDate = vue.computed(() => {
  23630. if (userInputDate.value)
  23631. return userInputDate.value;
  23632. if (!props.parsedValue && !defaultValue.value)
  23633. return;
  23634. return (props.parsedValue || innerDate.value).format(dateFormat.value);
  23635. });
  23636. const timePickerVisible = vue.ref(false);
  23637. const onTimePickerInputFocus = () => {
  23638. timePickerVisible.value = true;
  23639. };
  23640. const handleTimePickClose = () => {
  23641. timePickerVisible.value = false;
  23642. };
  23643. const getUnits = (date) => {
  23644. return {
  23645. hour: date.hour(),
  23646. minute: date.minute(),
  23647. second: date.second(),
  23648. year: date.year(),
  23649. month: date.month(),
  23650. date: date.date()
  23651. };
  23652. };
  23653. const handleTimePick = (value, visible, first) => {
  23654. const { hour, minute, second } = getUnits(value);
  23655. const newDate = props.parsedValue ? props.parsedValue.hour(hour).minute(minute).second(second) : value;
  23656. innerDate.value = newDate;
  23657. emit(innerDate.value, true);
  23658. if (!first) {
  23659. timePickerVisible.value = visible;
  23660. }
  23661. };
  23662. const handleVisibleTimeChange = (value) => {
  23663. const newDate = dayjs(value, timeFormat.value).locale(lang.value);
  23664. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  23665. const { year: year2, month: month2, date } = getUnits(innerDate.value);
  23666. innerDate.value = newDate.year(year2).month(month2).date(date);
  23667. userInputTime.value = null;
  23668. timePickerVisible.value = false;
  23669. emit(innerDate.value, true);
  23670. }
  23671. };
  23672. const handleVisibleDateChange = (value) => {
  23673. const newDate = dayjs(value, dateFormat.value).locale(lang.value);
  23674. if (newDate.isValid()) {
  23675. if (disabledDate && disabledDate(newDate.toDate())) {
  23676. return;
  23677. }
  23678. const { hour, minute, second } = getUnits(innerDate.value);
  23679. innerDate.value = newDate.hour(hour).minute(minute).second(second);
  23680. userInputDate.value = null;
  23681. emit(innerDate.value, true);
  23682. }
  23683. };
  23684. const isValidValue = (date) => {
  23685. return dayjs.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
  23686. };
  23687. const formatToString = (value) => {
  23688. if (selectionMode.value === "dates") {
  23689. return value.map((_) => _.format(props.format));
  23690. }
  23691. return value.format(props.format);
  23692. };
  23693. const parseUserInput = (value) => {
  23694. return dayjs(value, props.format).locale(lang.value);
  23695. };
  23696. const getDefaultValue = () => {
  23697. const parseDate = dayjs(defaultValue.value).locale(lang.value);
  23698. if (!defaultValue.value) {
  23699. const defaultTimeDValue = defaultTimeD.value;
  23700. return dayjs().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  23701. }
  23702. return parseDate;
  23703. };
  23704. const handleFocusPicker = async () => {
  23705. var _a;
  23706. if (["week", "month", "year", "date"].includes(selectionMode.value)) {
  23707. (_a = currentViewRef.value) == null ? void 0 : _a.focus();
  23708. if (selectionMode.value === "week") {
  23709. handleKeyControl(EVENT_CODE.down);
  23710. }
  23711. }
  23712. };
  23713. const handleKeydownTable = (event) => {
  23714. const { code } = event;
  23715. const validCode = [
  23716. EVENT_CODE.up,
  23717. EVENT_CODE.down,
  23718. EVENT_CODE.left,
  23719. EVENT_CODE.right,
  23720. EVENT_CODE.home,
  23721. EVENT_CODE.end,
  23722. EVENT_CODE.pageUp,
  23723. EVENT_CODE.pageDown
  23724. ];
  23725. if (validCode.includes(code)) {
  23726. handleKeyControl(code);
  23727. event.stopPropagation();
  23728. event.preventDefault();
  23729. }
  23730. if ([EVENT_CODE.enter, EVENT_CODE.space].includes(code) && userInputDate.value === null && userInputTime.value === null) {
  23731. event.preventDefault();
  23732. emit(innerDate.value, false);
  23733. }
  23734. };
  23735. const handleKeyControl = (code) => {
  23736. var _a;
  23737. const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
  23738. const mapping = {
  23739. year: {
  23740. [up]: -4,
  23741. [down]: 4,
  23742. [left]: -1,
  23743. [right]: 1,
  23744. offset: (date, step) => date.setFullYear(date.getFullYear() + step)
  23745. },
  23746. month: {
  23747. [up]: -4,
  23748. [down]: 4,
  23749. [left]: -1,
  23750. [right]: 1,
  23751. offset: (date, step) => date.setMonth(date.getMonth() + step)
  23752. },
  23753. week: {
  23754. [up]: -1,
  23755. [down]: 1,
  23756. [left]: -1,
  23757. [right]: 1,
  23758. offset: (date, step) => date.setDate(date.getDate() + step * 7)
  23759. },
  23760. date: {
  23761. [up]: -7,
  23762. [down]: 7,
  23763. [left]: -1,
  23764. [right]: 1,
  23765. [home]: (date) => -date.getDay(),
  23766. [end]: (date) => -date.getDay() + 6,
  23767. [pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
  23768. [pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
  23769. offset: (date, step) => date.setDate(date.getDate() + step)
  23770. }
  23771. };
  23772. const newDate = innerDate.value.toDate();
  23773. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  23774. const map = mapping[keyboardMode.value];
  23775. if (!map)
  23776. return;
  23777. map.offset(newDate, isFunction(map[code]) ? map[code](newDate) : (_a = map[code]) != null ? _a : 0);
  23778. if (disabledDate && disabledDate(newDate)) {
  23779. break;
  23780. }
  23781. const result = dayjs(newDate).locale(lang.value);
  23782. innerDate.value = result;
  23783. contextEmit("pick", result, true);
  23784. break;
  23785. }
  23786. };
  23787. const handlePanelChange = (mode) => {
  23788. contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  23789. };
  23790. vue.watch(() => selectionMode.value, (val) => {
  23791. if (["month", "year"].includes(val)) {
  23792. currentView.value = val;
  23793. return;
  23794. }
  23795. currentView.value = "date";
  23796. }, { immediate: true });
  23797. vue.watch(() => currentView.value, () => {
  23798. popper == null ? void 0 : popper.updatePopper();
  23799. });
  23800. vue.watch(() => defaultValue.value, (val) => {
  23801. if (val) {
  23802. innerDate.value = getDefaultValue();
  23803. }
  23804. }, { immediate: true });
  23805. vue.watch(() => props.parsedValue, (val) => {
  23806. if (val) {
  23807. if (selectionMode.value === "dates")
  23808. return;
  23809. if (Array.isArray(val))
  23810. return;
  23811. innerDate.value = val;
  23812. } else {
  23813. innerDate.value = getDefaultValue();
  23814. }
  23815. }, { immediate: true });
  23816. contextEmit("set-picker-option", ["isValidValue", isValidValue]);
  23817. contextEmit("set-picker-option", ["formatToString", formatToString]);
  23818. contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
  23819. contextEmit("set-picker-option", ["handleFocusPicker", handleFocusPicker]);
  23820. return (_ctx, _cache) => {
  23821. return vue.openBlock(), vue.createElementBlock("div", {
  23822. class: vue.normalizeClass([
  23823. vue.unref(ppNs).b(),
  23824. vue.unref(dpNs).b(),
  23825. {
  23826. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  23827. "has-time": vue.unref(showTime)
  23828. }
  23829. ])
  23830. }, [
  23831. vue.createElementVNode("div", {
  23832. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  23833. }, [
  23834. vue.renderSlot(_ctx.$slots, "sidebar", {
  23835. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  23836. }),
  23837. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  23838. key: 0,
  23839. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  23840. }, [
  23841. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  23842. return vue.openBlock(), vue.createElementBlock("button", {
  23843. key,
  23844. type: "button",
  23845. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  23846. onClick: ($event) => handleShortcutClick(shortcut)
  23847. }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$G);
  23848. }), 128))
  23849. ], 2)) : vue.createCommentVNode("v-if", true),
  23850. vue.createElementVNode("div", {
  23851. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  23852. }, [
  23853. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  23854. key: 0,
  23855. class: vue.normalizeClass(vue.unref(dpNs).e("time-header"))
  23856. }, [
  23857. vue.createElementVNode("span", {
  23858. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  23859. }, [
  23860. vue.createVNode(vue.unref(ElInput), {
  23861. placeholder: vue.unref(t)("el.datepicker.selectDate"),
  23862. "model-value": vue.unref(visibleDate),
  23863. size: "small",
  23864. "validate-event": false,
  23865. onInput: _cache[0] || (_cache[0] = (val) => userInputDate.value = val),
  23866. onChange: handleVisibleDateChange
  23867. }, null, 8, ["placeholder", "model-value"])
  23868. ], 2),
  23869. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  23870. class: vue.normalizeClass(vue.unref(dpNs).e("editor-wrap"))
  23871. }, [
  23872. vue.createVNode(vue.unref(ElInput), {
  23873. placeholder: vue.unref(t)("el.datepicker.selectTime"),
  23874. "model-value": vue.unref(visibleTime),
  23875. size: "small",
  23876. "validate-event": false,
  23877. onFocus: onTimePickerInputFocus,
  23878. onInput: _cache[1] || (_cache[1] = (val) => userInputTime.value = val),
  23879. onChange: handleVisibleTimeChange
  23880. }, null, 8, ["placeholder", "model-value"]),
  23881. vue.createVNode(vue.unref(TimePickPanel), {
  23882. visible: timePickerVisible.value,
  23883. format: vue.unref(timeFormat),
  23884. "time-arrow-control": vue.unref(arrowControl),
  23885. "parsed-value": innerDate.value,
  23886. onPick: handleTimePick
  23887. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"])
  23888. ], 2)), [
  23889. [vue.unref(ClickOutside), handleTimePickClose]
  23890. ])
  23891. ], 2)) : vue.createCommentVNode("v-if", true),
  23892. vue.withDirectives(vue.createElementVNode("div", {
  23893. class: vue.normalizeClass([
  23894. vue.unref(dpNs).e("header"),
  23895. (currentView.value === "year" || currentView.value === "month") && vue.unref(dpNs).e("header--bordered")
  23896. ])
  23897. }, [
  23898. vue.createElementVNode("span", {
  23899. class: vue.normalizeClass(vue.unref(dpNs).e("prev-btn"))
  23900. }, [
  23901. vue.createElementVNode("button", {
  23902. type: "button",
  23903. "aria-label": vue.unref(t)(`el.datepicker.prevYear`),
  23904. class: vue.normalizeClass(["d-arrow-left", vue.unref(ppNs).e("icon-btn")]),
  23905. onClick: _cache[2] || (_cache[2] = ($event) => moveByYear(false))
  23906. }, [
  23907. vue.createVNode(vue.unref(ElIcon), null, {
  23908. default: vue.withCtx(() => [
  23909. vue.createVNode(vue.unref(d_arrow_left_default))
  23910. ]),
  23911. _: 1
  23912. })
  23913. ], 10, _hoisted_2$q),
  23914. vue.withDirectives(vue.createElementVNode("button", {
  23915. type: "button",
  23916. "aria-label": vue.unref(t)(`el.datepicker.prevMonth`),
  23917. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  23918. onClick: _cache[3] || (_cache[3] = ($event) => moveByMonth(false))
  23919. }, [
  23920. vue.createVNode(vue.unref(ElIcon), null, {
  23921. default: vue.withCtx(() => [
  23922. vue.createVNode(vue.unref(arrow_left_default))
  23923. ]),
  23924. _: 1
  23925. })
  23926. ], 10, _hoisted_3$c), [
  23927. [vue.vShow, currentView.value === "date"]
  23928. ])
  23929. ], 2),
  23930. vue.createElementVNode("span", {
  23931. role: "button",
  23932. class: vue.normalizeClass(vue.unref(dpNs).e("header-label")),
  23933. "aria-live": "polite",
  23934. tabindex: "0",
  23935. onKeydown: _cache[4] || (_cache[4] = vue.withKeys(($event) => showPicker("year"), ["enter"])),
  23936. onClick: _cache[5] || (_cache[5] = ($event) => showPicker("year"))
  23937. }, vue.toDisplayString(vue.unref(yearLabel)), 35),
  23938. vue.withDirectives(vue.createElementVNode("span", {
  23939. role: "button",
  23940. "aria-live": "polite",
  23941. tabindex: "0",
  23942. class: vue.normalizeClass([
  23943. vue.unref(dpNs).e("header-label"),
  23944. { active: currentView.value === "month" }
  23945. ]),
  23946. onKeydown: _cache[6] || (_cache[6] = vue.withKeys(($event) => showPicker("month"), ["enter"])),
  23947. onClick: _cache[7] || (_cache[7] = ($event) => showPicker("month"))
  23948. }, vue.toDisplayString(vue.unref(t)(`el.datepicker.month${vue.unref(month) + 1}`)), 35), [
  23949. [vue.vShow, currentView.value === "date"]
  23950. ]),
  23951. vue.createElementVNode("span", {
  23952. class: vue.normalizeClass(vue.unref(dpNs).e("next-btn"))
  23953. }, [
  23954. vue.withDirectives(vue.createElementVNode("button", {
  23955. type: "button",
  23956. "aria-label": vue.unref(t)(`el.datepicker.nextMonth`),
  23957. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  23958. onClick: _cache[8] || (_cache[8] = ($event) => moveByMonth(true))
  23959. }, [
  23960. vue.createVNode(vue.unref(ElIcon), null, {
  23961. default: vue.withCtx(() => [
  23962. vue.createVNode(vue.unref(arrow_right_default))
  23963. ]),
  23964. _: 1
  23965. })
  23966. ], 10, _hoisted_4$9), [
  23967. [vue.vShow, currentView.value === "date"]
  23968. ]),
  23969. vue.createElementVNode("button", {
  23970. type: "button",
  23971. "aria-label": vue.unref(t)(`el.datepicker.nextYear`),
  23972. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  23973. onClick: _cache[9] || (_cache[9] = ($event) => moveByYear(true))
  23974. }, [
  23975. vue.createVNode(vue.unref(ElIcon), null, {
  23976. default: vue.withCtx(() => [
  23977. vue.createVNode(vue.unref(d_arrow_right_default))
  23978. ]),
  23979. _: 1
  23980. })
  23981. ], 10, _hoisted_5$7)
  23982. ], 2)
  23983. ], 2), [
  23984. [vue.vShow, currentView.value !== "time"]
  23985. ]),
  23986. vue.createElementVNode("div", {
  23987. class: vue.normalizeClass(vue.unref(ppNs).e("content")),
  23988. onKeydown: handleKeydownTable
  23989. }, [
  23990. currentView.value === "date" ? (vue.openBlock(), vue.createBlock(DateTable, {
  23991. key: 0,
  23992. ref_key: "currentViewRef",
  23993. ref: currentViewRef,
  23994. "selection-mode": vue.unref(selectionMode),
  23995. date: innerDate.value,
  23996. "parsed-value": _ctx.parsedValue,
  23997. "disabled-date": vue.unref(disabledDate),
  23998. "cell-class-name": vue.unref(cellClassName),
  23999. onPick: handleDatePick
  24000. }, null, 8, ["selection-mode", "date", "parsed-value", "disabled-date", "cell-class-name"])) : vue.createCommentVNode("v-if", true),
  24001. currentView.value === "year" ? (vue.openBlock(), vue.createBlock(YearTable, {
  24002. key: 1,
  24003. ref_key: "currentViewRef",
  24004. ref: currentViewRef,
  24005. date: innerDate.value,
  24006. "disabled-date": vue.unref(disabledDate),
  24007. "parsed-value": _ctx.parsedValue,
  24008. onPick: handleYearPick
  24009. }, null, 8, ["date", "disabled-date", "parsed-value"])) : vue.createCommentVNode("v-if", true),
  24010. currentView.value === "month" ? (vue.openBlock(), vue.createBlock(MonthTable, {
  24011. key: 2,
  24012. ref_key: "currentViewRef",
  24013. ref: currentViewRef,
  24014. date: innerDate.value,
  24015. "parsed-value": _ctx.parsedValue,
  24016. "disabled-date": vue.unref(disabledDate),
  24017. onPick: handleMonthPick
  24018. }, null, 8, ["date", "parsed-value", "disabled-date"])) : vue.createCommentVNode("v-if", true)
  24019. ], 34)
  24020. ], 2)
  24021. ], 2),
  24022. vue.withDirectives(vue.createElementVNode("div", {
  24023. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  24024. }, [
  24025. vue.withDirectives(vue.createVNode(vue.unref(ElButton), {
  24026. text: "",
  24027. size: "small",
  24028. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  24029. onClick: changeToNow
  24030. }, {
  24031. default: vue.withCtx(() => [
  24032. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.now")), 1)
  24033. ]),
  24034. _: 1
  24035. }, 8, ["class"]), [
  24036. [vue.vShow, vue.unref(selectionMode) !== "dates"]
  24037. ]),
  24038. vue.createVNode(vue.unref(ElButton), {
  24039. plain: "",
  24040. size: "small",
  24041. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  24042. onClick: onConfirm
  24043. }, {
  24044. default: vue.withCtx(() => [
  24045. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  24046. ]),
  24047. _: 1
  24048. }, 8, ["class"])
  24049. ], 2), [
  24050. [vue.vShow, vue.unref(footerVisible) && currentView.value === "date"]
  24051. ])
  24052. ], 2);
  24053. };
  24054. }
  24055. });
  24056. var DatePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1i, [["__file", "panel-date-pick.vue"]]);
  24057. const panelDateRangeProps = buildProps({
  24058. ...panelSharedProps,
  24059. ...panelRangeSharedProps
  24060. });
  24061. const useShortcut = (lang) => {
  24062. const { emit } = vue.getCurrentInstance();
  24063. const attrs = vue.useAttrs();
  24064. const slots = vue.useSlots();
  24065. const handleShortcutClick = (shortcut) => {
  24066. const shortcutValues = isFunction(shortcut.value) ? shortcut.value() : shortcut.value;
  24067. if (shortcutValues) {
  24068. emit("pick", [
  24069. dayjs(shortcutValues[0]).locale(lang.value),
  24070. dayjs(shortcutValues[1]).locale(lang.value)
  24071. ]);
  24072. return;
  24073. }
  24074. if (shortcut.onClick) {
  24075. shortcut.onClick({
  24076. attrs,
  24077. slots,
  24078. emit
  24079. });
  24080. }
  24081. };
  24082. return handleShortcutClick;
  24083. };
  24084. const useRangePicker = (props, {
  24085. defaultValue,
  24086. leftDate,
  24087. rightDate,
  24088. unit,
  24089. onParsedValueChanged
  24090. }) => {
  24091. const { emit } = vue.getCurrentInstance();
  24092. const { pickerNs } = vue.inject(ROOT_PICKER_INJECTION_KEY);
  24093. const drpNs = useNamespace("date-range-picker");
  24094. const { t, lang } = useLocale();
  24095. const handleShortcutClick = useShortcut(lang);
  24096. const minDate = vue.ref();
  24097. const maxDate = vue.ref();
  24098. const rangeState = vue.ref({
  24099. endDate: null,
  24100. selecting: false
  24101. });
  24102. const handleChangeRange = (val) => {
  24103. rangeState.value = val;
  24104. };
  24105. const handleRangeConfirm = (visible = false) => {
  24106. const _minDate = vue.unref(minDate);
  24107. const _maxDate = vue.unref(maxDate);
  24108. if (isValidRange([_minDate, _maxDate])) {
  24109. emit("pick", [_minDate, _maxDate], visible);
  24110. }
  24111. };
  24112. const onSelect = (selecting) => {
  24113. rangeState.value.selecting = selecting;
  24114. if (!selecting) {
  24115. rangeState.value.endDate = null;
  24116. }
  24117. };
  24118. const restoreDefault = () => {
  24119. const [start, end] = getDefaultValue(vue.unref(defaultValue), {
  24120. lang: vue.unref(lang),
  24121. unit,
  24122. unlinkPanels: props.unlinkPanels
  24123. });
  24124. minDate.value = void 0;
  24125. maxDate.value = void 0;
  24126. leftDate.value = start;
  24127. rightDate.value = end;
  24128. };
  24129. vue.watch(defaultValue, (val) => {
  24130. if (val) {
  24131. restoreDefault();
  24132. }
  24133. }, { immediate: true });
  24134. vue.watch(() => props.parsedValue, (parsedValue) => {
  24135. if (isArray(parsedValue) && parsedValue.length === 2) {
  24136. const [start, end] = parsedValue;
  24137. minDate.value = start;
  24138. leftDate.value = start;
  24139. maxDate.value = end;
  24140. onParsedValueChanged(vue.unref(minDate), vue.unref(maxDate));
  24141. } else {
  24142. restoreDefault();
  24143. }
  24144. }, { immediate: true });
  24145. return {
  24146. minDate,
  24147. maxDate,
  24148. rangeState,
  24149. lang,
  24150. ppNs: pickerNs,
  24151. drpNs,
  24152. handleChangeRange,
  24153. handleRangeConfirm,
  24154. handleShortcutClick,
  24155. onSelect,
  24156. t
  24157. };
  24158. };
  24159. const _hoisted_1$F = ["onClick"];
  24160. const _hoisted_2$p = ["disabled"];
  24161. const _hoisted_3$b = ["disabled"];
  24162. const _hoisted_4$8 = ["disabled"];
  24163. const _hoisted_5$6 = ["disabled"];
  24164. const unit$1 = "month";
  24165. const _sfc_main$1h = /* @__PURE__ */ vue.defineComponent({
  24166. __name: "panel-date-range",
  24167. props: panelDateRangeProps,
  24168. emits: [
  24169. "pick",
  24170. "set-picker-option",
  24171. "calendar-change",
  24172. "panel-change"
  24173. ],
  24174. setup(__props, { emit }) {
  24175. const props = __props;
  24176. const pickerBase = vue.inject("EP_PICKER_BASE");
  24177. const {
  24178. disabledDate,
  24179. cellClassName,
  24180. format,
  24181. defaultTime,
  24182. arrowControl,
  24183. clearable
  24184. } = pickerBase.props;
  24185. const shortcuts = vue.toRef(pickerBase.props, "shortcuts");
  24186. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  24187. const { lang } = useLocale();
  24188. const leftDate = vue.ref(dayjs().locale(lang.value));
  24189. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit$1));
  24190. const {
  24191. minDate,
  24192. maxDate,
  24193. rangeState,
  24194. ppNs,
  24195. drpNs,
  24196. handleChangeRange,
  24197. handleRangeConfirm,
  24198. handleShortcutClick,
  24199. onSelect,
  24200. t
  24201. } = useRangePicker(props, {
  24202. defaultValue,
  24203. leftDate,
  24204. rightDate,
  24205. unit: unit$1,
  24206. onParsedValueChanged
  24207. });
  24208. const dateUserInput = vue.ref({
  24209. min: null,
  24210. max: null
  24211. });
  24212. const timeUserInput = vue.ref({
  24213. min: null,
  24214. max: null
  24215. });
  24216. const leftLabel = vue.computed(() => {
  24217. return `${leftDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${leftDate.value.month() + 1}`)}`;
  24218. });
  24219. const rightLabel = vue.computed(() => {
  24220. return `${rightDate.value.year()} ${t("el.datepicker.year")} ${t(`el.datepicker.month${rightDate.value.month() + 1}`)}`;
  24221. });
  24222. const leftYear = vue.computed(() => {
  24223. return leftDate.value.year();
  24224. });
  24225. const leftMonth = vue.computed(() => {
  24226. return leftDate.value.month();
  24227. });
  24228. const rightYear = vue.computed(() => {
  24229. return rightDate.value.year();
  24230. });
  24231. const rightMonth = vue.computed(() => {
  24232. return rightDate.value.month();
  24233. });
  24234. const hasShortcuts = vue.computed(() => !!shortcuts.value.length);
  24235. const minVisibleDate = vue.computed(() => {
  24236. if (dateUserInput.value.min !== null)
  24237. return dateUserInput.value.min;
  24238. if (minDate.value)
  24239. return minDate.value.format(dateFormat.value);
  24240. return "";
  24241. });
  24242. const maxVisibleDate = vue.computed(() => {
  24243. if (dateUserInput.value.max !== null)
  24244. return dateUserInput.value.max;
  24245. if (maxDate.value || minDate.value)
  24246. return (maxDate.value || minDate.value).format(dateFormat.value);
  24247. return "";
  24248. });
  24249. const minVisibleTime = vue.computed(() => {
  24250. if (timeUserInput.value.min !== null)
  24251. return timeUserInput.value.min;
  24252. if (minDate.value)
  24253. return minDate.value.format(timeFormat.value);
  24254. return "";
  24255. });
  24256. const maxVisibleTime = vue.computed(() => {
  24257. if (timeUserInput.value.max !== null)
  24258. return timeUserInput.value.max;
  24259. if (maxDate.value || minDate.value)
  24260. return (maxDate.value || minDate.value).format(timeFormat.value);
  24261. return "";
  24262. });
  24263. const timeFormat = vue.computed(() => {
  24264. return extractTimeFormat(format);
  24265. });
  24266. const dateFormat = vue.computed(() => {
  24267. return extractDateFormat(format);
  24268. });
  24269. const leftPrevYear = () => {
  24270. leftDate.value = leftDate.value.subtract(1, "year");
  24271. if (!props.unlinkPanels) {
  24272. rightDate.value = leftDate.value.add(1, "month");
  24273. }
  24274. handlePanelChange("year");
  24275. };
  24276. const leftPrevMonth = () => {
  24277. leftDate.value = leftDate.value.subtract(1, "month");
  24278. if (!props.unlinkPanels) {
  24279. rightDate.value = leftDate.value.add(1, "month");
  24280. }
  24281. handlePanelChange("month");
  24282. };
  24283. const rightNextYear = () => {
  24284. if (!props.unlinkPanels) {
  24285. leftDate.value = leftDate.value.add(1, "year");
  24286. rightDate.value = leftDate.value.add(1, "month");
  24287. } else {
  24288. rightDate.value = rightDate.value.add(1, "year");
  24289. }
  24290. handlePanelChange("year");
  24291. };
  24292. const rightNextMonth = () => {
  24293. if (!props.unlinkPanels) {
  24294. leftDate.value = leftDate.value.add(1, "month");
  24295. rightDate.value = leftDate.value.add(1, "month");
  24296. } else {
  24297. rightDate.value = rightDate.value.add(1, "month");
  24298. }
  24299. handlePanelChange("month");
  24300. };
  24301. const leftNextYear = () => {
  24302. leftDate.value = leftDate.value.add(1, "year");
  24303. handlePanelChange("year");
  24304. };
  24305. const leftNextMonth = () => {
  24306. leftDate.value = leftDate.value.add(1, "month");
  24307. handlePanelChange("month");
  24308. };
  24309. const rightPrevYear = () => {
  24310. rightDate.value = rightDate.value.subtract(1, "year");
  24311. handlePanelChange("year");
  24312. };
  24313. const rightPrevMonth = () => {
  24314. rightDate.value = rightDate.value.subtract(1, "month");
  24315. handlePanelChange("month");
  24316. };
  24317. const handlePanelChange = (mode) => {
  24318. emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  24319. };
  24320. const enableMonthArrow = vue.computed(() => {
  24321. const nextMonth = (leftMonth.value + 1) % 12;
  24322. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  24323. return props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  24324. });
  24325. const enableYearArrow = vue.computed(() => {
  24326. return props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  24327. });
  24328. const btnDisabled = vue.computed(() => {
  24329. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]));
  24330. });
  24331. const showTime = vue.computed(() => props.type === "datetime" || props.type === "datetimerange");
  24332. const formatEmit = (emitDayjs, index) => {
  24333. if (!emitDayjs)
  24334. return;
  24335. if (defaultTime) {
  24336. const defaultTimeD = dayjs(defaultTime[index] || defaultTime).locale(lang.value);
  24337. return defaultTimeD.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  24338. }
  24339. return emitDayjs;
  24340. };
  24341. const handleRangePick = (val, close = true) => {
  24342. const min_ = val.minDate;
  24343. const max_ = val.maxDate;
  24344. const minDate_ = formatEmit(min_, 0);
  24345. const maxDate_ = formatEmit(max_, 1);
  24346. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  24347. return;
  24348. }
  24349. emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  24350. maxDate.value = maxDate_;
  24351. minDate.value = minDate_;
  24352. if (!close || showTime.value)
  24353. return;
  24354. handleRangeConfirm();
  24355. };
  24356. const minTimePickerVisible = vue.ref(false);
  24357. const maxTimePickerVisible = vue.ref(false);
  24358. const handleMinTimeClose = () => {
  24359. minTimePickerVisible.value = false;
  24360. };
  24361. const handleMaxTimeClose = () => {
  24362. maxTimePickerVisible.value = false;
  24363. };
  24364. const handleDateInput = (value, type) => {
  24365. dateUserInput.value[type] = value;
  24366. const parsedValueD = dayjs(value, dateFormat.value).locale(lang.value);
  24367. if (parsedValueD.isValid()) {
  24368. if (disabledDate && disabledDate(parsedValueD.toDate())) {
  24369. return;
  24370. }
  24371. if (type === "min") {
  24372. leftDate.value = parsedValueD;
  24373. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  24374. if (!props.unlinkPanels) {
  24375. rightDate.value = parsedValueD.add(1, "month");
  24376. maxDate.value = minDate.value.add(1, "month");
  24377. }
  24378. } else {
  24379. rightDate.value = parsedValueD;
  24380. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  24381. if (!props.unlinkPanels) {
  24382. leftDate.value = parsedValueD.subtract(1, "month");
  24383. minDate.value = maxDate.value.subtract(1, "month");
  24384. }
  24385. }
  24386. }
  24387. };
  24388. const handleDateChange = (_, type) => {
  24389. dateUserInput.value[type] = null;
  24390. };
  24391. const handleTimeInput = (value, type) => {
  24392. timeUserInput.value[type] = value;
  24393. const parsedValueD = dayjs(value, timeFormat.value).locale(lang.value);
  24394. if (parsedValueD.isValid()) {
  24395. if (type === "min") {
  24396. minTimePickerVisible.value = true;
  24397. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  24398. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  24399. maxDate.value = minDate.value;
  24400. }
  24401. } else {
  24402. maxTimePickerVisible.value = true;
  24403. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  24404. rightDate.value = maxDate.value;
  24405. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  24406. minDate.value = maxDate.value;
  24407. }
  24408. }
  24409. }
  24410. };
  24411. const handleTimeChange = (value, type) => {
  24412. timeUserInput.value[type] = null;
  24413. if (type === "min") {
  24414. leftDate.value = minDate.value;
  24415. minTimePickerVisible.value = false;
  24416. } else {
  24417. rightDate.value = maxDate.value;
  24418. maxTimePickerVisible.value = false;
  24419. }
  24420. };
  24421. const handleMinTimePick = (value, visible, first) => {
  24422. if (timeUserInput.value.min)
  24423. return;
  24424. if (value) {
  24425. leftDate.value = value;
  24426. minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  24427. }
  24428. if (!first) {
  24429. minTimePickerVisible.value = visible;
  24430. }
  24431. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  24432. maxDate.value = minDate.value;
  24433. rightDate.value = value;
  24434. }
  24435. };
  24436. const handleMaxTimePick = (value, visible, first) => {
  24437. if (timeUserInput.value.max)
  24438. return;
  24439. if (value) {
  24440. rightDate.value = value;
  24441. maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  24442. }
  24443. if (!first) {
  24444. maxTimePickerVisible.value = visible;
  24445. }
  24446. if (maxDate.value && maxDate.value.isBefore(minDate.value)) {
  24447. minDate.value = maxDate.value;
  24448. }
  24449. };
  24450. const handleClear = () => {
  24451. leftDate.value = getDefaultValue(vue.unref(defaultValue), {
  24452. lang: vue.unref(lang),
  24453. unit: "month",
  24454. unlinkPanels: props.unlinkPanels
  24455. })[0];
  24456. rightDate.value = leftDate.value.add(1, "month");
  24457. emit("pick", null);
  24458. };
  24459. const formatToString = (value) => {
  24460. return isArray(value) ? value.map((_) => _.format(format)) : value.format(format);
  24461. };
  24462. const parseUserInput = (value) => {
  24463. return isArray(value) ? value.map((_) => dayjs(_, format).locale(lang.value)) : dayjs(value, format).locale(lang.value);
  24464. };
  24465. function onParsedValueChanged(minDate2, maxDate2) {
  24466. if (props.unlinkPanels && maxDate2) {
  24467. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  24468. const minDateMonth = (minDate2 == null ? void 0 : minDate2.month()) || 0;
  24469. const maxDateYear = maxDate2.year();
  24470. const maxDateMonth = maxDate2.month();
  24471. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate2.add(1, unit$1) : maxDate2;
  24472. } else {
  24473. rightDate.value = leftDate.value.add(1, unit$1);
  24474. if (maxDate2) {
  24475. rightDate.value = rightDate.value.hour(maxDate2.hour()).minute(maxDate2.minute()).second(maxDate2.second());
  24476. }
  24477. }
  24478. }
  24479. emit("set-picker-option", ["isValidValue", isValidRange]);
  24480. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  24481. emit("set-picker-option", ["formatToString", formatToString]);
  24482. emit("set-picker-option", ["handleClear", handleClear]);
  24483. return (_ctx, _cache) => {
  24484. return vue.openBlock(), vue.createElementBlock("div", {
  24485. class: vue.normalizeClass([
  24486. vue.unref(ppNs).b(),
  24487. vue.unref(drpNs).b(),
  24488. {
  24489. "has-sidebar": _ctx.$slots.sidebar || vue.unref(hasShortcuts),
  24490. "has-time": vue.unref(showTime)
  24491. }
  24492. ])
  24493. }, [
  24494. vue.createElementVNode("div", {
  24495. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  24496. }, [
  24497. vue.renderSlot(_ctx.$slots, "sidebar", {
  24498. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  24499. }),
  24500. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  24501. key: 0,
  24502. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  24503. }, [
  24504. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  24505. return vue.openBlock(), vue.createElementBlock("button", {
  24506. key,
  24507. type: "button",
  24508. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  24509. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  24510. }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$F);
  24511. }), 128))
  24512. ], 2)) : vue.createCommentVNode("v-if", true),
  24513. vue.createElementVNode("div", {
  24514. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  24515. }, [
  24516. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  24517. key: 0,
  24518. class: vue.normalizeClass(vue.unref(drpNs).e("time-header"))
  24519. }, [
  24520. vue.createElementVNode("span", {
  24521. class: vue.normalizeClass(vue.unref(drpNs).e("editors-wrap"))
  24522. }, [
  24523. vue.createElementVNode("span", {
  24524. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  24525. }, [
  24526. vue.createVNode(vue.unref(ElInput), {
  24527. size: "small",
  24528. disabled: vue.unref(rangeState).selecting,
  24529. placeholder: vue.unref(t)("el.datepicker.startDate"),
  24530. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  24531. "model-value": vue.unref(minVisibleDate),
  24532. "validate-event": false,
  24533. onInput: _cache[0] || (_cache[0] = (val) => handleDateInput(val, "min")),
  24534. onChange: _cache[1] || (_cache[1] = (val) => handleDateChange(val, "min"))
  24535. }, null, 8, ["disabled", "placeholder", "class", "model-value"])
  24536. ], 2),
  24537. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  24538. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  24539. }, [
  24540. vue.createVNode(vue.unref(ElInput), {
  24541. size: "small",
  24542. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  24543. disabled: vue.unref(rangeState).selecting,
  24544. placeholder: vue.unref(t)("el.datepicker.startTime"),
  24545. "model-value": vue.unref(minVisibleTime),
  24546. "validate-event": false,
  24547. onFocus: _cache[2] || (_cache[2] = ($event) => minTimePickerVisible.value = true),
  24548. onInput: _cache[3] || (_cache[3] = (val) => handleTimeInput(val, "min")),
  24549. onChange: _cache[4] || (_cache[4] = (val) => handleTimeChange(val, "min"))
  24550. }, null, 8, ["class", "disabled", "placeholder", "model-value"]),
  24551. vue.createVNode(vue.unref(TimePickPanel), {
  24552. visible: minTimePickerVisible.value,
  24553. format: vue.unref(timeFormat),
  24554. "datetime-role": "start",
  24555. "time-arrow-control": vue.unref(arrowControl),
  24556. "parsed-value": leftDate.value,
  24557. onPick: handleMinTimePick
  24558. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"])
  24559. ], 2)), [
  24560. [vue.unref(ClickOutside), handleMinTimeClose]
  24561. ])
  24562. ], 2),
  24563. vue.createElementVNode("span", null, [
  24564. vue.createVNode(vue.unref(ElIcon), null, {
  24565. default: vue.withCtx(() => [
  24566. vue.createVNode(vue.unref(arrow_right_default))
  24567. ]),
  24568. _: 1
  24569. })
  24570. ]),
  24571. vue.createElementVNode("span", {
  24572. class: vue.normalizeClass([vue.unref(drpNs).e("editors-wrap"), "is-right"])
  24573. }, [
  24574. vue.createElementVNode("span", {
  24575. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  24576. }, [
  24577. vue.createVNode(vue.unref(ElInput), {
  24578. size: "small",
  24579. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  24580. disabled: vue.unref(rangeState).selecting,
  24581. placeholder: vue.unref(t)("el.datepicker.endDate"),
  24582. "model-value": vue.unref(maxVisibleDate),
  24583. readonly: !vue.unref(minDate),
  24584. "validate-event": false,
  24585. onInput: _cache[5] || (_cache[5] = (val) => handleDateInput(val, "max")),
  24586. onChange: _cache[6] || (_cache[6] = (val) => handleDateChange(val, "max"))
  24587. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly"])
  24588. ], 2),
  24589. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  24590. class: vue.normalizeClass(vue.unref(drpNs).e("time-picker-wrap"))
  24591. }, [
  24592. vue.createVNode(vue.unref(ElInput), {
  24593. size: "small",
  24594. class: vue.normalizeClass(vue.unref(drpNs).e("editor")),
  24595. disabled: vue.unref(rangeState).selecting,
  24596. placeholder: vue.unref(t)("el.datepicker.endTime"),
  24597. "model-value": vue.unref(maxVisibleTime),
  24598. readonly: !vue.unref(minDate),
  24599. "validate-event": false,
  24600. onFocus: _cache[7] || (_cache[7] = ($event) => vue.unref(minDate) && (maxTimePickerVisible.value = true)),
  24601. onInput: _cache[8] || (_cache[8] = (val) => handleTimeInput(val, "max")),
  24602. onChange: _cache[9] || (_cache[9] = (val) => handleTimeChange(val, "max"))
  24603. }, null, 8, ["class", "disabled", "placeholder", "model-value", "readonly"]),
  24604. vue.createVNode(vue.unref(TimePickPanel), {
  24605. "datetime-role": "end",
  24606. visible: maxTimePickerVisible.value,
  24607. format: vue.unref(timeFormat),
  24608. "time-arrow-control": vue.unref(arrowControl),
  24609. "parsed-value": rightDate.value,
  24610. onPick: handleMaxTimePick
  24611. }, null, 8, ["visible", "format", "time-arrow-control", "parsed-value"])
  24612. ], 2)), [
  24613. [vue.unref(ClickOutside), handleMaxTimeClose]
  24614. ])
  24615. ], 2)
  24616. ], 2)) : vue.createCommentVNode("v-if", true),
  24617. vue.createElementVNode("div", {
  24618. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  24619. }, [
  24620. vue.createElementVNode("div", {
  24621. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  24622. }, [
  24623. vue.createElementVNode("button", {
  24624. type: "button",
  24625. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  24626. onClick: leftPrevYear
  24627. }, [
  24628. vue.createVNode(vue.unref(ElIcon), null, {
  24629. default: vue.withCtx(() => [
  24630. vue.createVNode(vue.unref(d_arrow_left_default))
  24631. ]),
  24632. _: 1
  24633. })
  24634. ], 2),
  24635. vue.createElementVNode("button", {
  24636. type: "button",
  24637. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-left"]),
  24638. onClick: leftPrevMonth
  24639. }, [
  24640. vue.createVNode(vue.unref(ElIcon), null, {
  24641. default: vue.withCtx(() => [
  24642. vue.createVNode(vue.unref(arrow_left_default))
  24643. ]),
  24644. _: 1
  24645. })
  24646. ], 2),
  24647. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  24648. key: 0,
  24649. type: "button",
  24650. disabled: !vue.unref(enableYearArrow),
  24651. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-right"]),
  24652. onClick: leftNextYear
  24653. }, [
  24654. vue.createVNode(vue.unref(ElIcon), null, {
  24655. default: vue.withCtx(() => [
  24656. vue.createVNode(vue.unref(d_arrow_right_default))
  24657. ]),
  24658. _: 1
  24659. })
  24660. ], 10, _hoisted_2$p)) : vue.createCommentVNode("v-if", true),
  24661. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  24662. key: 1,
  24663. type: "button",
  24664. disabled: !vue.unref(enableMonthArrow),
  24665. class: vue.normalizeClass([[
  24666. vue.unref(ppNs).e("icon-btn"),
  24667. { "is-disabled": !vue.unref(enableMonthArrow) }
  24668. ], "arrow-right"]),
  24669. onClick: leftNextMonth
  24670. }, [
  24671. vue.createVNode(vue.unref(ElIcon), null, {
  24672. default: vue.withCtx(() => [
  24673. vue.createVNode(vue.unref(arrow_right_default))
  24674. ]),
  24675. _: 1
  24676. })
  24677. ], 10, _hoisted_3$b)) : vue.createCommentVNode("v-if", true),
  24678. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  24679. ], 2),
  24680. vue.createVNode(DateTable, {
  24681. "selection-mode": "range",
  24682. date: leftDate.value,
  24683. "min-date": vue.unref(minDate),
  24684. "max-date": vue.unref(maxDate),
  24685. "range-state": vue.unref(rangeState),
  24686. "disabled-date": vue.unref(disabledDate),
  24687. "cell-class-name": vue.unref(cellClassName),
  24688. onChangerange: vue.unref(handleChangeRange),
  24689. onPick: handleRangePick,
  24690. onSelect: vue.unref(onSelect)
  24691. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  24692. ], 2),
  24693. vue.createElementVNode("div", {
  24694. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  24695. }, [
  24696. vue.createElementVNode("div", {
  24697. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  24698. }, [
  24699. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  24700. key: 0,
  24701. type: "button",
  24702. disabled: !vue.unref(enableYearArrow),
  24703. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]),
  24704. onClick: rightPrevYear
  24705. }, [
  24706. vue.createVNode(vue.unref(ElIcon), null, {
  24707. default: vue.withCtx(() => [
  24708. vue.createVNode(vue.unref(d_arrow_left_default))
  24709. ]),
  24710. _: 1
  24711. })
  24712. ], 10, _hoisted_4$8)) : vue.createCommentVNode("v-if", true),
  24713. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  24714. key: 1,
  24715. type: "button",
  24716. disabled: !vue.unref(enableMonthArrow),
  24717. class: vue.normalizeClass([[
  24718. vue.unref(ppNs).e("icon-btn"),
  24719. { "is-disabled": !vue.unref(enableMonthArrow) }
  24720. ], "arrow-left"]),
  24721. onClick: rightPrevMonth
  24722. }, [
  24723. vue.createVNode(vue.unref(ElIcon), null, {
  24724. default: vue.withCtx(() => [
  24725. vue.createVNode(vue.unref(arrow_left_default))
  24726. ]),
  24727. _: 1
  24728. })
  24729. ], 10, _hoisted_5$6)) : vue.createCommentVNode("v-if", true),
  24730. vue.createElementVNode("button", {
  24731. type: "button",
  24732. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  24733. onClick: rightNextYear
  24734. }, [
  24735. vue.createVNode(vue.unref(ElIcon), null, {
  24736. default: vue.withCtx(() => [
  24737. vue.createVNode(vue.unref(d_arrow_right_default))
  24738. ]),
  24739. _: 1
  24740. })
  24741. ], 2),
  24742. vue.createElementVNode("button", {
  24743. type: "button",
  24744. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "arrow-right"]),
  24745. onClick: rightNextMonth
  24746. }, [
  24747. vue.createVNode(vue.unref(ElIcon), null, {
  24748. default: vue.withCtx(() => [
  24749. vue.createVNode(vue.unref(arrow_right_default))
  24750. ]),
  24751. _: 1
  24752. })
  24753. ], 2),
  24754. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  24755. ], 2),
  24756. vue.createVNode(DateTable, {
  24757. "selection-mode": "range",
  24758. date: rightDate.value,
  24759. "min-date": vue.unref(minDate),
  24760. "max-date": vue.unref(maxDate),
  24761. "range-state": vue.unref(rangeState),
  24762. "disabled-date": vue.unref(disabledDate),
  24763. "cell-class-name": vue.unref(cellClassName),
  24764. onChangerange: vue.unref(handleChangeRange),
  24765. onPick: handleRangePick,
  24766. onSelect: vue.unref(onSelect)
  24767. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "cell-class-name", "onChangerange", "onSelect"])
  24768. ], 2)
  24769. ], 2)
  24770. ], 2),
  24771. vue.unref(showTime) ? (vue.openBlock(), vue.createElementBlock("div", {
  24772. key: 0,
  24773. class: vue.normalizeClass(vue.unref(ppNs).e("footer"))
  24774. }, [
  24775. vue.unref(clearable) ? (vue.openBlock(), vue.createBlock(vue.unref(ElButton), {
  24776. key: 0,
  24777. text: "",
  24778. size: "small",
  24779. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  24780. onClick: handleClear
  24781. }, {
  24782. default: vue.withCtx(() => [
  24783. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.clear")), 1)
  24784. ]),
  24785. _: 1
  24786. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  24787. vue.createVNode(vue.unref(ElButton), {
  24788. plain: "",
  24789. size: "small",
  24790. class: vue.normalizeClass(vue.unref(ppNs).e("link-btn")),
  24791. disabled: vue.unref(btnDisabled),
  24792. onClick: _cache[10] || (_cache[10] = ($event) => vue.unref(handleRangeConfirm)(false))
  24793. }, {
  24794. default: vue.withCtx(() => [
  24795. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.datepicker.confirm")), 1)
  24796. ]),
  24797. _: 1
  24798. }, 8, ["class", "disabled"])
  24799. ], 2)) : vue.createCommentVNode("v-if", true)
  24800. ], 2);
  24801. };
  24802. }
  24803. });
  24804. var DateRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1h, [["__file", "panel-date-range.vue"]]);
  24805. const panelMonthRangeProps = buildProps({
  24806. ...panelRangeSharedProps
  24807. });
  24808. const panelMonthRangeEmits = ["pick", "set-picker-option"];
  24809. const useMonthRangeHeader = ({
  24810. unlinkPanels,
  24811. leftDate,
  24812. rightDate
  24813. }) => {
  24814. const { t } = useLocale();
  24815. const leftPrevYear = () => {
  24816. leftDate.value = leftDate.value.subtract(1, "year");
  24817. if (!unlinkPanels.value) {
  24818. rightDate.value = rightDate.value.subtract(1, "year");
  24819. }
  24820. };
  24821. const rightNextYear = () => {
  24822. if (!unlinkPanels.value) {
  24823. leftDate.value = leftDate.value.add(1, "year");
  24824. }
  24825. rightDate.value = rightDate.value.add(1, "year");
  24826. };
  24827. const leftNextYear = () => {
  24828. leftDate.value = leftDate.value.add(1, "year");
  24829. };
  24830. const rightPrevYear = () => {
  24831. rightDate.value = rightDate.value.subtract(1, "year");
  24832. };
  24833. const leftLabel = vue.computed(() => {
  24834. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  24835. });
  24836. const rightLabel = vue.computed(() => {
  24837. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  24838. });
  24839. const leftYear = vue.computed(() => {
  24840. return leftDate.value.year();
  24841. });
  24842. const rightYear = vue.computed(() => {
  24843. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  24844. });
  24845. return {
  24846. leftPrevYear,
  24847. rightNextYear,
  24848. leftNextYear,
  24849. rightPrevYear,
  24850. leftLabel,
  24851. rightLabel,
  24852. leftYear,
  24853. rightYear
  24854. };
  24855. };
  24856. const _hoisted_1$E = ["onClick"];
  24857. const _hoisted_2$o = ["disabled"];
  24858. const _hoisted_3$a = ["disabled"];
  24859. const unit = "year";
  24860. const __default__$Q = vue.defineComponent({
  24861. name: "DatePickerMonthRange"
  24862. });
  24863. const _sfc_main$1g = /* @__PURE__ */ vue.defineComponent({
  24864. ...__default__$Q,
  24865. props: panelMonthRangeProps,
  24866. emits: panelMonthRangeEmits,
  24867. setup(__props, { emit }) {
  24868. const props = __props;
  24869. const { lang } = useLocale();
  24870. const pickerBase = vue.inject("EP_PICKER_BASE");
  24871. const { shortcuts, disabledDate, format } = pickerBase.props;
  24872. const defaultValue = vue.toRef(pickerBase.props, "defaultValue");
  24873. const leftDate = vue.ref(dayjs().locale(lang.value));
  24874. const rightDate = vue.ref(dayjs().locale(lang.value).add(1, unit));
  24875. const {
  24876. minDate,
  24877. maxDate,
  24878. rangeState,
  24879. ppNs,
  24880. drpNs,
  24881. handleChangeRange,
  24882. handleRangeConfirm,
  24883. handleShortcutClick,
  24884. onSelect
  24885. } = useRangePicker(props, {
  24886. defaultValue,
  24887. leftDate,
  24888. rightDate,
  24889. unit,
  24890. onParsedValueChanged
  24891. });
  24892. const hasShortcuts = vue.computed(() => !!shortcuts.length);
  24893. const {
  24894. leftPrevYear,
  24895. rightNextYear,
  24896. leftNextYear,
  24897. rightPrevYear,
  24898. leftLabel,
  24899. rightLabel,
  24900. leftYear,
  24901. rightYear
  24902. } = useMonthRangeHeader({
  24903. unlinkPanels: vue.toRef(props, "unlinkPanels"),
  24904. leftDate,
  24905. rightDate
  24906. });
  24907. const enableYearArrow = vue.computed(() => {
  24908. return props.unlinkPanels && rightYear.value > leftYear.value + 1;
  24909. });
  24910. const handleRangePick = (val, close = true) => {
  24911. const minDate_ = val.minDate;
  24912. const maxDate_ = val.maxDate;
  24913. if (maxDate.value === maxDate_ && minDate.value === minDate_) {
  24914. return;
  24915. }
  24916. maxDate.value = maxDate_;
  24917. minDate.value = minDate_;
  24918. if (!close)
  24919. return;
  24920. handleRangeConfirm();
  24921. };
  24922. const formatToString = (days) => {
  24923. return days.map((day) => day.format(format));
  24924. };
  24925. function onParsedValueChanged(minDate2, maxDate2) {
  24926. if (props.unlinkPanels && maxDate2) {
  24927. const minDateYear = (minDate2 == null ? void 0 : minDate2.year()) || 0;
  24928. const maxDateYear = maxDate2.year();
  24929. rightDate.value = minDateYear === maxDateYear ? maxDate2.add(1, unit) : maxDate2;
  24930. } else {
  24931. rightDate.value = leftDate.value.add(1, unit);
  24932. }
  24933. }
  24934. emit("set-picker-option", ["formatToString", formatToString]);
  24935. return (_ctx, _cache) => {
  24936. return vue.openBlock(), vue.createElementBlock("div", {
  24937. class: vue.normalizeClass([
  24938. vue.unref(ppNs).b(),
  24939. vue.unref(drpNs).b(),
  24940. {
  24941. "has-sidebar": Boolean(_ctx.$slots.sidebar) || vue.unref(hasShortcuts)
  24942. }
  24943. ])
  24944. }, [
  24945. vue.createElementVNode("div", {
  24946. class: vue.normalizeClass(vue.unref(ppNs).e("body-wrapper"))
  24947. }, [
  24948. vue.renderSlot(_ctx.$slots, "sidebar", {
  24949. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  24950. }),
  24951. vue.unref(hasShortcuts) ? (vue.openBlock(), vue.createElementBlock("div", {
  24952. key: 0,
  24953. class: vue.normalizeClass(vue.unref(ppNs).e("sidebar"))
  24954. }, [
  24955. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(shortcuts), (shortcut, key) => {
  24956. return vue.openBlock(), vue.createElementBlock("button", {
  24957. key,
  24958. type: "button",
  24959. class: vue.normalizeClass(vue.unref(ppNs).e("shortcut")),
  24960. onClick: ($event) => vue.unref(handleShortcutClick)(shortcut)
  24961. }, vue.toDisplayString(shortcut.text), 11, _hoisted_1$E);
  24962. }), 128))
  24963. ], 2)) : vue.createCommentVNode("v-if", true),
  24964. vue.createElementVNode("div", {
  24965. class: vue.normalizeClass(vue.unref(ppNs).e("body"))
  24966. }, [
  24967. vue.createElementVNode("div", {
  24968. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-left"])
  24969. }, [
  24970. vue.createElementVNode("div", {
  24971. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  24972. }, [
  24973. vue.createElementVNode("button", {
  24974. type: "button",
  24975. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  24976. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(leftPrevYear) && vue.unref(leftPrevYear)(...args))
  24977. }, [
  24978. vue.createVNode(vue.unref(ElIcon), null, {
  24979. default: vue.withCtx(() => [
  24980. vue.createVNode(vue.unref(d_arrow_left_default))
  24981. ]),
  24982. _: 1
  24983. })
  24984. ], 2),
  24985. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  24986. key: 0,
  24987. type: "button",
  24988. disabled: !vue.unref(enableYearArrow),
  24989. class: vue.normalizeClass([[
  24990. vue.unref(ppNs).e("icon-btn"),
  24991. { [vue.unref(ppNs).is("disabled")]: !vue.unref(enableYearArrow) }
  24992. ], "d-arrow-right"]),
  24993. onClick: _cache[1] || (_cache[1] = (...args) => vue.unref(leftNextYear) && vue.unref(leftNextYear)(...args))
  24994. }, [
  24995. vue.createVNode(vue.unref(ElIcon), null, {
  24996. default: vue.withCtx(() => [
  24997. vue.createVNode(vue.unref(d_arrow_right_default))
  24998. ]),
  24999. _: 1
  25000. })
  25001. ], 10, _hoisted_2$o)) : vue.createCommentVNode("v-if", true),
  25002. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(leftLabel)), 1)
  25003. ], 2),
  25004. vue.createVNode(MonthTable, {
  25005. "selection-mode": "range",
  25006. date: leftDate.value,
  25007. "min-date": vue.unref(minDate),
  25008. "max-date": vue.unref(maxDate),
  25009. "range-state": vue.unref(rangeState),
  25010. "disabled-date": vue.unref(disabledDate),
  25011. onChangerange: vue.unref(handleChangeRange),
  25012. onPick: handleRangePick,
  25013. onSelect: vue.unref(onSelect)
  25014. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  25015. ], 2),
  25016. vue.createElementVNode("div", {
  25017. class: vue.normalizeClass([[vue.unref(ppNs).e("content"), vue.unref(drpNs).e("content")], "is-right"])
  25018. }, [
  25019. vue.createElementVNode("div", {
  25020. class: vue.normalizeClass(vue.unref(drpNs).e("header"))
  25021. }, [
  25022. _ctx.unlinkPanels ? (vue.openBlock(), vue.createElementBlock("button", {
  25023. key: 0,
  25024. type: "button",
  25025. disabled: !vue.unref(enableYearArrow),
  25026. class: vue.normalizeClass([[vue.unref(ppNs).e("icon-btn"), { "is-disabled": !vue.unref(enableYearArrow) }], "d-arrow-left"]),
  25027. onClick: _cache[2] || (_cache[2] = (...args) => vue.unref(rightPrevYear) && vue.unref(rightPrevYear)(...args))
  25028. }, [
  25029. vue.createVNode(vue.unref(ElIcon), null, {
  25030. default: vue.withCtx(() => [
  25031. vue.createVNode(vue.unref(d_arrow_left_default))
  25032. ]),
  25033. _: 1
  25034. })
  25035. ], 10, _hoisted_3$a)) : vue.createCommentVNode("v-if", true),
  25036. vue.createElementVNode("button", {
  25037. type: "button",
  25038. class: vue.normalizeClass([vue.unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  25039. onClick: _cache[3] || (_cache[3] = (...args) => vue.unref(rightNextYear) && vue.unref(rightNextYear)(...args))
  25040. }, [
  25041. vue.createVNode(vue.unref(ElIcon), null, {
  25042. default: vue.withCtx(() => [
  25043. vue.createVNode(vue.unref(d_arrow_right_default))
  25044. ]),
  25045. _: 1
  25046. })
  25047. ], 2),
  25048. vue.createElementVNode("div", null, vue.toDisplayString(vue.unref(rightLabel)), 1)
  25049. ], 2),
  25050. vue.createVNode(MonthTable, {
  25051. "selection-mode": "range",
  25052. date: rightDate.value,
  25053. "min-date": vue.unref(minDate),
  25054. "max-date": vue.unref(maxDate),
  25055. "range-state": vue.unref(rangeState),
  25056. "disabled-date": vue.unref(disabledDate),
  25057. onChangerange: vue.unref(handleChangeRange),
  25058. onPick: handleRangePick,
  25059. onSelect: vue.unref(onSelect)
  25060. }, null, 8, ["date", "min-date", "max-date", "range-state", "disabled-date", "onChangerange", "onSelect"])
  25061. ], 2)
  25062. ], 2)
  25063. ], 2)
  25064. ], 2);
  25065. };
  25066. }
  25067. });
  25068. var MonthRangePickPanel = /* @__PURE__ */ _export_sfc(_sfc_main$1g, [["__file", "panel-month-range.vue"]]);
  25069. const getPanel = function(type) {
  25070. switch (type) {
  25071. case "daterange":
  25072. case "datetimerange": {
  25073. return DateRangePickPanel;
  25074. }
  25075. case "monthrange": {
  25076. return MonthRangePickPanel;
  25077. }
  25078. default: {
  25079. return DatePickPanel;
  25080. }
  25081. }
  25082. };
  25083. dayjs.extend(localeData);
  25084. dayjs.extend(advancedFormat);
  25085. dayjs.extend(customParseFormat);
  25086. dayjs.extend(weekOfYear);
  25087. dayjs.extend(weekYear);
  25088. dayjs.extend(dayOfYear);
  25089. dayjs.extend(isSameOrAfter);
  25090. dayjs.extend(isSameOrBefore);
  25091. var DatePicker = vue.defineComponent({
  25092. name: "ElDatePicker",
  25093. install: null,
  25094. props: {
  25095. ...timePickerDefaultProps,
  25096. ...datePickerProps
  25097. },
  25098. emits: ["update:modelValue"],
  25099. setup(props, {
  25100. expose,
  25101. emit,
  25102. slots
  25103. }) {
  25104. const ns = useNamespace("picker-panel");
  25105. vue.provide("ElPopperOptions", vue.reactive(vue.toRef(props, "popperOptions")));
  25106. vue.provide(ROOT_PICKER_INJECTION_KEY, {
  25107. slots,
  25108. pickerNs: ns
  25109. });
  25110. const commonPicker = vue.ref();
  25111. const refProps = {
  25112. focus: (focusStartInput = true) => {
  25113. var _a;
  25114. (_a = commonPicker.value) == null ? void 0 : _a.focus(focusStartInput);
  25115. },
  25116. handleOpen: () => {
  25117. var _a;
  25118. (_a = commonPicker.value) == null ? void 0 : _a.handleOpen();
  25119. },
  25120. handleClose: () => {
  25121. var _a;
  25122. (_a = commonPicker.value) == null ? void 0 : _a.handleClose();
  25123. }
  25124. };
  25125. expose(refProps);
  25126. const onModelValueUpdated = (val) => {
  25127. emit("update:modelValue", val);
  25128. };
  25129. return () => {
  25130. var _a;
  25131. const format = (_a = props.format) != null ? _a : DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE;
  25132. const Component = getPanel(props.type);
  25133. return vue.createVNode(CommonPicker, vue.mergeProps(props, {
  25134. "format": format,
  25135. "type": props.type,
  25136. "ref": commonPicker,
  25137. "onUpdate:modelValue": onModelValueUpdated
  25138. }), {
  25139. default: (scopedProps) => vue.createVNode(Component, scopedProps, null),
  25140. "range-separator": slots["range-separator"]
  25141. });
  25142. };
  25143. }
  25144. });
  25145. const _DatePicker = DatePicker;
  25146. _DatePicker.install = (app) => {
  25147. app.component(_DatePicker.name, _DatePicker);
  25148. };
  25149. const ElDatePicker = _DatePicker;
  25150. const descriptionsKey = "elDescriptions";
  25151. var ElDescriptionsCell = vue.defineComponent({
  25152. name: "ElDescriptionsCell",
  25153. props: {
  25154. cell: {
  25155. type: Object
  25156. },
  25157. tag: {
  25158. type: String
  25159. },
  25160. type: {
  25161. type: String
  25162. }
  25163. },
  25164. setup() {
  25165. const descriptions = vue.inject(descriptionsKey, {});
  25166. return {
  25167. descriptions
  25168. };
  25169. },
  25170. render() {
  25171. var _a, _b, _c, _d, _e, _f;
  25172. const item = getNormalizedProps(this.cell);
  25173. const { border, direction } = this.descriptions;
  25174. const isVertical = direction === "vertical";
  25175. const label = ((_c = (_b = (_a = this.cell) == null ? void 0 : _a.children) == null ? void 0 : _b.label) == null ? void 0 : _c.call(_b)) || item.label;
  25176. const content = (_f = (_e = (_d = this.cell) == null ? void 0 : _d.children) == null ? void 0 : _e.default) == null ? void 0 : _f.call(_e);
  25177. const span = item.span;
  25178. const align = item.align ? `is-${item.align}` : "";
  25179. const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align;
  25180. const className = item.className;
  25181. const labelClassName = item.labelClassName;
  25182. const style = {
  25183. width: addUnit(item.width),
  25184. minWidth: addUnit(item.minWidth)
  25185. };
  25186. const ns = useNamespace("descriptions");
  25187. switch (this.type) {
  25188. case "label":
  25189. return vue.h(this.tag, {
  25190. style,
  25191. class: [
  25192. ns.e("cell"),
  25193. ns.e("label"),
  25194. ns.is("bordered-label", border),
  25195. ns.is("vertical-label", isVertical),
  25196. labelAlign,
  25197. labelClassName
  25198. ],
  25199. colSpan: isVertical ? span : 1
  25200. }, label);
  25201. case "content":
  25202. return vue.h(this.tag, {
  25203. style,
  25204. class: [
  25205. ns.e("cell"),
  25206. ns.e("content"),
  25207. ns.is("bordered-content", border),
  25208. ns.is("vertical-content", isVertical),
  25209. align,
  25210. className
  25211. ],
  25212. colSpan: isVertical ? span : span * 2 - 1
  25213. }, content);
  25214. default:
  25215. return vue.h("td", {
  25216. style,
  25217. class: [ns.e("cell"), align],
  25218. colSpan: span
  25219. }, [
  25220. vue.h("span", {
  25221. class: [ns.e("label"), labelClassName]
  25222. }, label),
  25223. vue.h("span", {
  25224. class: [ns.e("content"), className]
  25225. }, content)
  25226. ]);
  25227. }
  25228. }
  25229. });
  25230. const descriptionsRowProps = buildProps({
  25231. row: {
  25232. type: Array,
  25233. default: () => []
  25234. }
  25235. });
  25236. const _hoisted_1$D = { key: 1 };
  25237. const __default__$P = vue.defineComponent({
  25238. name: "ElDescriptionsRow"
  25239. });
  25240. const _sfc_main$1f = /* @__PURE__ */ vue.defineComponent({
  25241. ...__default__$P,
  25242. props: descriptionsRowProps,
  25243. setup(__props) {
  25244. const descriptions = vue.inject(descriptionsKey, {});
  25245. return (_ctx, _cache) => {
  25246. return vue.unref(descriptions).direction === "vertical" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  25247. vue.createElementVNode("tr", null, [
  25248. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, index) => {
  25249. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  25250. key: `tr1-${index}`,
  25251. cell,
  25252. tag: "th",
  25253. type: "label"
  25254. }, null, 8, ["cell"]);
  25255. }), 128))
  25256. ]),
  25257. vue.createElementVNode("tr", null, [
  25258. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, index) => {
  25259. return vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  25260. key: `tr2-${index}`,
  25261. cell,
  25262. tag: "td",
  25263. type: "content"
  25264. }, null, 8, ["cell"]);
  25265. }), 128))
  25266. ])
  25267. ], 64)) : (vue.openBlock(), vue.createElementBlock("tr", _hoisted_1$D, [
  25268. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.row, (cell, index) => {
  25269. return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
  25270. key: `tr3-${index}`
  25271. }, [
  25272. vue.unref(descriptions).border ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  25273. vue.createVNode(vue.unref(ElDescriptionsCell), {
  25274. cell,
  25275. tag: "td",
  25276. type: "label"
  25277. }, null, 8, ["cell"]),
  25278. vue.createVNode(vue.unref(ElDescriptionsCell), {
  25279. cell,
  25280. tag: "td",
  25281. type: "content"
  25282. }, null, 8, ["cell"])
  25283. ], 64)) : (vue.openBlock(), vue.createBlock(vue.unref(ElDescriptionsCell), {
  25284. key: 1,
  25285. cell,
  25286. tag: "td",
  25287. type: "both"
  25288. }, null, 8, ["cell"]))
  25289. ], 64);
  25290. }), 128))
  25291. ]));
  25292. };
  25293. }
  25294. });
  25295. var ElDescriptionsRow = /* @__PURE__ */ _export_sfc(_sfc_main$1f, [["__file", "descriptions-row.vue"]]);
  25296. const descriptionProps = buildProps({
  25297. border: {
  25298. type: Boolean,
  25299. default: false
  25300. },
  25301. column: {
  25302. type: Number,
  25303. default: 3
  25304. },
  25305. direction: {
  25306. type: String,
  25307. values: ["horizontal", "vertical"],
  25308. default: "horizontal"
  25309. },
  25310. size: useSizeProp,
  25311. title: {
  25312. type: String,
  25313. default: ""
  25314. },
  25315. extra: {
  25316. type: String,
  25317. default: ""
  25318. }
  25319. });
  25320. const __default__$O = vue.defineComponent({
  25321. name: "ElDescriptions"
  25322. });
  25323. const _sfc_main$1e = /* @__PURE__ */ vue.defineComponent({
  25324. ...__default__$O,
  25325. props: descriptionProps,
  25326. setup(__props) {
  25327. const props = __props;
  25328. const ns = useNamespace("descriptions");
  25329. const descriptionsSize = useSize();
  25330. const slots = vue.useSlots();
  25331. vue.provide(descriptionsKey, props);
  25332. const descriptionKls = vue.computed(() => [ns.b(), ns.m(descriptionsSize.value)]);
  25333. const filledNode = (node, span, count, isLast = false) => {
  25334. if (!node.props) {
  25335. node.props = {};
  25336. }
  25337. if (span > count) {
  25338. node.props.span = count;
  25339. }
  25340. if (isLast) {
  25341. node.props.span = span;
  25342. }
  25343. return node;
  25344. };
  25345. const getRows = () => {
  25346. var _a;
  25347. const children = flattedChildren((_a = slots.default) == null ? void 0 : _a.call(slots)).filter((node) => {
  25348. var _a2;
  25349. return ((_a2 = node == null ? void 0 : node.type) == null ? void 0 : _a2.name) === "ElDescriptionsItem";
  25350. });
  25351. const rows = [];
  25352. let temp = [];
  25353. let count = props.column;
  25354. let totalSpan = 0;
  25355. children.forEach((node, index) => {
  25356. var _a2;
  25357. const span = ((_a2 = node.props) == null ? void 0 : _a2.span) || 1;
  25358. if (index < children.length - 1) {
  25359. totalSpan += span > count ? count : span;
  25360. }
  25361. if (index === children.length - 1) {
  25362. const lastSpan = props.column - totalSpan % props.column;
  25363. temp.push(filledNode(node, lastSpan, count, true));
  25364. rows.push(temp);
  25365. return;
  25366. }
  25367. if (span < count) {
  25368. count -= span;
  25369. temp.push(node);
  25370. } else {
  25371. temp.push(filledNode(node, span, count));
  25372. rows.push(temp);
  25373. count = props.column;
  25374. temp = [];
  25375. }
  25376. });
  25377. return rows;
  25378. };
  25379. return (_ctx, _cache) => {
  25380. return vue.openBlock(), vue.createElementBlock("div", {
  25381. class: vue.normalizeClass(vue.unref(descriptionKls))
  25382. }, [
  25383. _ctx.title || _ctx.extra || _ctx.$slots.title || _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  25384. key: 0,
  25385. class: vue.normalizeClass(vue.unref(ns).e("header"))
  25386. }, [
  25387. vue.createElementVNode("div", {
  25388. class: vue.normalizeClass(vue.unref(ns).e("title"))
  25389. }, [
  25390. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  25391. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  25392. ])
  25393. ], 2),
  25394. vue.createElementVNode("div", {
  25395. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  25396. }, [
  25397. vue.renderSlot(_ctx.$slots, "extra", {}, () => [
  25398. vue.createTextVNode(vue.toDisplayString(_ctx.extra), 1)
  25399. ])
  25400. ], 2)
  25401. ], 2)) : vue.createCommentVNode("v-if", true),
  25402. vue.createElementVNode("div", {
  25403. class: vue.normalizeClass(vue.unref(ns).e("body"))
  25404. }, [
  25405. vue.createElementVNode("table", {
  25406. class: vue.normalizeClass([vue.unref(ns).e("table"), vue.unref(ns).is("bordered", _ctx.border)])
  25407. }, [
  25408. vue.createElementVNode("tbody", null, [
  25409. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(getRows(), (row, index) => {
  25410. return vue.openBlock(), vue.createBlock(ElDescriptionsRow, {
  25411. key: index,
  25412. row
  25413. }, null, 8, ["row"]);
  25414. }), 128))
  25415. ])
  25416. ], 2)
  25417. ], 2)
  25418. ], 2);
  25419. };
  25420. }
  25421. });
  25422. var Descriptions = /* @__PURE__ */ _export_sfc(_sfc_main$1e, [["__file", "description.vue"]]);
  25423. var DescriptionsItem = vue.defineComponent({
  25424. name: "ElDescriptionsItem",
  25425. props: {
  25426. label: {
  25427. type: String,
  25428. default: ""
  25429. },
  25430. span: {
  25431. type: Number,
  25432. default: 1
  25433. },
  25434. width: {
  25435. type: [String, Number],
  25436. default: ""
  25437. },
  25438. minWidth: {
  25439. type: [String, Number],
  25440. default: ""
  25441. },
  25442. align: {
  25443. type: String,
  25444. default: "left"
  25445. },
  25446. labelAlign: {
  25447. type: String,
  25448. default: ""
  25449. },
  25450. className: {
  25451. type: String,
  25452. default: ""
  25453. },
  25454. labelClassName: {
  25455. type: String,
  25456. default: ""
  25457. }
  25458. }
  25459. });
  25460. const ElDescriptions = withInstall(Descriptions, {
  25461. DescriptionsItem
  25462. });
  25463. const ElDescriptionsItem = withNoopInstall(DescriptionsItem);
  25464. const overlayProps = buildProps({
  25465. mask: {
  25466. type: Boolean,
  25467. default: true
  25468. },
  25469. customMaskEvent: {
  25470. type: Boolean,
  25471. default: false
  25472. },
  25473. overlayClass: {
  25474. type: definePropType([
  25475. String,
  25476. Array,
  25477. Object
  25478. ])
  25479. },
  25480. zIndex: {
  25481. type: definePropType([String, Number])
  25482. }
  25483. });
  25484. const overlayEmits = {
  25485. click: (evt) => evt instanceof MouseEvent
  25486. };
  25487. var Overlay$1 = vue.defineComponent({
  25488. name: "ElOverlay",
  25489. props: overlayProps,
  25490. emits: overlayEmits,
  25491. setup(props, { slots, emit }) {
  25492. const ns = useNamespace("overlay");
  25493. const onMaskClick = (e) => {
  25494. emit("click", e);
  25495. };
  25496. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  25497. return () => {
  25498. return props.mask ? vue.createVNode("div", {
  25499. class: [ns.b(), props.overlayClass],
  25500. style: {
  25501. zIndex: props.zIndex
  25502. },
  25503. onClick,
  25504. onMousedown,
  25505. onMouseup
  25506. }, [vue.renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : vue.h("div", {
  25507. class: props.overlayClass,
  25508. style: {
  25509. zIndex: props.zIndex,
  25510. position: "fixed",
  25511. top: "0px",
  25512. right: "0px",
  25513. bottom: "0px",
  25514. left: "0px"
  25515. }
  25516. }, [vue.renderSlot(slots, "default")]);
  25517. };
  25518. }
  25519. });
  25520. const ElOverlay = Overlay$1;
  25521. const dialogContentProps = buildProps({
  25522. center: {
  25523. type: Boolean,
  25524. default: false
  25525. },
  25526. alignCenter: {
  25527. type: Boolean,
  25528. default: false
  25529. },
  25530. closeIcon: {
  25531. type: iconPropType
  25532. },
  25533. customClass: {
  25534. type: String,
  25535. default: ""
  25536. },
  25537. draggable: {
  25538. type: Boolean,
  25539. default: false
  25540. },
  25541. fullscreen: {
  25542. type: Boolean,
  25543. default: false
  25544. },
  25545. showClose: {
  25546. type: Boolean,
  25547. default: true
  25548. },
  25549. title: {
  25550. type: String,
  25551. default: ""
  25552. }
  25553. });
  25554. const dialogContentEmits = {
  25555. close: () => true
  25556. };
  25557. const _hoisted_1$C = ["aria-label"];
  25558. const _hoisted_2$n = ["id"];
  25559. const __default__$N = vue.defineComponent({ name: "ElDialogContent" });
  25560. const _sfc_main$1d = /* @__PURE__ */ vue.defineComponent({
  25561. ...__default__$N,
  25562. props: dialogContentProps,
  25563. emits: dialogContentEmits,
  25564. setup(__props) {
  25565. const props = __props;
  25566. const { t } = useLocale();
  25567. const { Close } = CloseComponents;
  25568. const { dialogRef, headerRef, bodyId, ns, style } = vue.inject(dialogInjectionKey);
  25569. const { focusTrapRef } = vue.inject(FOCUS_TRAP_INJECTION_KEY);
  25570. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  25571. const draggable = vue.computed(() => props.draggable);
  25572. useDraggable(dialogRef, headerRef, draggable);
  25573. return (_ctx, _cache) => {
  25574. return vue.openBlock(), vue.createElementBlock("div", {
  25575. ref: vue.unref(composedDialogRef),
  25576. class: vue.normalizeClass([
  25577. vue.unref(ns).b(),
  25578. vue.unref(ns).is("fullscreen", _ctx.fullscreen),
  25579. vue.unref(ns).is("draggable", vue.unref(draggable)),
  25580. vue.unref(ns).is("align-center", _ctx.alignCenter),
  25581. { [vue.unref(ns).m("center")]: _ctx.center },
  25582. _ctx.customClass
  25583. ]),
  25584. style: vue.normalizeStyle(vue.unref(style)),
  25585. tabindex: "-1"
  25586. }, [
  25587. vue.createElementVNode("header", {
  25588. ref_key: "headerRef",
  25589. ref: headerRef,
  25590. class: vue.normalizeClass(vue.unref(ns).e("header"))
  25591. }, [
  25592. vue.renderSlot(_ctx.$slots, "header", {}, () => [
  25593. vue.createElementVNode("span", {
  25594. role: "heading",
  25595. class: vue.normalizeClass(vue.unref(ns).e("title"))
  25596. }, vue.toDisplayString(_ctx.title), 3)
  25597. ]),
  25598. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  25599. key: 0,
  25600. "aria-label": vue.unref(t)("el.dialog.close"),
  25601. class: vue.normalizeClass(vue.unref(ns).e("headerbtn")),
  25602. type: "button",
  25603. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  25604. }, [
  25605. vue.createVNode(vue.unref(ElIcon), {
  25606. class: vue.normalizeClass(vue.unref(ns).e("close"))
  25607. }, {
  25608. default: vue.withCtx(() => [
  25609. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.closeIcon || vue.unref(Close))))
  25610. ]),
  25611. _: 1
  25612. }, 8, ["class"])
  25613. ], 10, _hoisted_1$C)) : vue.createCommentVNode("v-if", true)
  25614. ], 2),
  25615. vue.createElementVNode("div", {
  25616. id: vue.unref(bodyId),
  25617. class: vue.normalizeClass(vue.unref(ns).e("body"))
  25618. }, [
  25619. vue.renderSlot(_ctx.$slots, "default")
  25620. ], 10, _hoisted_2$n),
  25621. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("footer", {
  25622. key: 0,
  25623. class: vue.normalizeClass(vue.unref(ns).e("footer"))
  25624. }, [
  25625. vue.renderSlot(_ctx.$slots, "footer")
  25626. ], 2)) : vue.createCommentVNode("v-if", true)
  25627. ], 6);
  25628. };
  25629. }
  25630. });
  25631. var ElDialogContent = /* @__PURE__ */ _export_sfc(_sfc_main$1d, [["__file", "dialog-content.vue"]]);
  25632. const dialogProps = buildProps({
  25633. ...dialogContentProps,
  25634. appendToBody: {
  25635. type: Boolean,
  25636. default: false
  25637. },
  25638. beforeClose: {
  25639. type: definePropType(Function)
  25640. },
  25641. destroyOnClose: {
  25642. type: Boolean,
  25643. default: false
  25644. },
  25645. closeOnClickModal: {
  25646. type: Boolean,
  25647. default: true
  25648. },
  25649. closeOnPressEscape: {
  25650. type: Boolean,
  25651. default: true
  25652. },
  25653. lockScroll: {
  25654. type: Boolean,
  25655. default: true
  25656. },
  25657. modal: {
  25658. type: Boolean,
  25659. default: true
  25660. },
  25661. openDelay: {
  25662. type: Number,
  25663. default: 0
  25664. },
  25665. closeDelay: {
  25666. type: Number,
  25667. default: 0
  25668. },
  25669. top: {
  25670. type: String
  25671. },
  25672. modelValue: {
  25673. type: Boolean,
  25674. default: false
  25675. },
  25676. modalClass: String,
  25677. width: {
  25678. type: [String, Number]
  25679. },
  25680. zIndex: {
  25681. type: Number
  25682. },
  25683. trapFocus: {
  25684. type: Boolean,
  25685. default: false
  25686. }
  25687. });
  25688. const dialogEmits = {
  25689. open: () => true,
  25690. opened: () => true,
  25691. close: () => true,
  25692. closed: () => true,
  25693. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  25694. openAutoFocus: () => true,
  25695. closeAutoFocus: () => true
  25696. };
  25697. const useDialog = (props, targetRef) => {
  25698. const instance = vue.getCurrentInstance();
  25699. const emit = instance.emit;
  25700. const { nextZIndex } = useZIndex();
  25701. let lastPosition = "";
  25702. const titleId = useId();
  25703. const bodyId = useId();
  25704. const visible = vue.ref(false);
  25705. const closed = vue.ref(false);
  25706. const rendered = vue.ref(false);
  25707. const zIndex = vue.ref(props.zIndex || nextZIndex());
  25708. let openTimer = void 0;
  25709. let closeTimer = void 0;
  25710. const namespace = useGlobalConfig("namespace", defaultNamespace);
  25711. const style = vue.computed(() => {
  25712. const style2 = {};
  25713. const varPrefix = `--${namespace.value}-dialog`;
  25714. if (!props.fullscreen) {
  25715. if (props.top) {
  25716. style2[`${varPrefix}-margin-top`] = props.top;
  25717. }
  25718. if (props.width) {
  25719. style2[`${varPrefix}-width`] = addUnit(props.width);
  25720. }
  25721. }
  25722. return style2;
  25723. });
  25724. const overlayDialogStyle = vue.computed(() => {
  25725. if (props.alignCenter) {
  25726. return { display: "flex" };
  25727. }
  25728. return {};
  25729. });
  25730. function afterEnter() {
  25731. emit("opened");
  25732. }
  25733. function afterLeave() {
  25734. emit("closed");
  25735. emit(UPDATE_MODEL_EVENT, false);
  25736. if (props.destroyOnClose) {
  25737. rendered.value = false;
  25738. }
  25739. }
  25740. function beforeLeave() {
  25741. emit("close");
  25742. }
  25743. function open() {
  25744. closeTimer == null ? void 0 : closeTimer();
  25745. openTimer == null ? void 0 : openTimer();
  25746. if (props.openDelay && props.openDelay > 0) {
  25747. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  25748. } else {
  25749. doOpen();
  25750. }
  25751. }
  25752. function close() {
  25753. openTimer == null ? void 0 : openTimer();
  25754. closeTimer == null ? void 0 : closeTimer();
  25755. if (props.closeDelay && props.closeDelay > 0) {
  25756. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  25757. } else {
  25758. doClose();
  25759. }
  25760. }
  25761. function handleClose() {
  25762. function hide(shouldCancel) {
  25763. if (shouldCancel)
  25764. return;
  25765. closed.value = true;
  25766. visible.value = false;
  25767. }
  25768. if (props.beforeClose) {
  25769. props.beforeClose(hide);
  25770. } else {
  25771. close();
  25772. }
  25773. }
  25774. function onModalClick() {
  25775. if (props.closeOnClickModal) {
  25776. handleClose();
  25777. }
  25778. }
  25779. function doOpen() {
  25780. if (!isClient)
  25781. return;
  25782. visible.value = true;
  25783. }
  25784. function doClose() {
  25785. visible.value = false;
  25786. }
  25787. function onOpenAutoFocus() {
  25788. emit("openAutoFocus");
  25789. }
  25790. function onCloseAutoFocus() {
  25791. emit("closeAutoFocus");
  25792. }
  25793. function onFocusoutPrevented(event) {
  25794. var _a;
  25795. if (((_a = event.detail) == null ? void 0 : _a.focusReason) === "pointer") {
  25796. event.preventDefault();
  25797. }
  25798. }
  25799. if (props.lockScroll) {
  25800. useLockscreen(visible);
  25801. }
  25802. function onCloseRequested() {
  25803. if (props.closeOnPressEscape) {
  25804. handleClose();
  25805. }
  25806. }
  25807. vue.watch(() => props.modelValue, (val) => {
  25808. if (val) {
  25809. closed.value = false;
  25810. open();
  25811. rendered.value = true;
  25812. zIndex.value = props.zIndex ? zIndex.value++ : nextZIndex();
  25813. vue.nextTick(() => {
  25814. emit("open");
  25815. if (targetRef.value) {
  25816. targetRef.value.scrollTop = 0;
  25817. }
  25818. });
  25819. } else {
  25820. if (visible.value) {
  25821. close();
  25822. }
  25823. }
  25824. });
  25825. vue.watch(() => props.fullscreen, (val) => {
  25826. if (!targetRef.value)
  25827. return;
  25828. if (val) {
  25829. lastPosition = targetRef.value.style.transform;
  25830. targetRef.value.style.transform = "";
  25831. } else {
  25832. targetRef.value.style.transform = lastPosition;
  25833. }
  25834. });
  25835. vue.onMounted(() => {
  25836. if (props.modelValue) {
  25837. visible.value = true;
  25838. rendered.value = true;
  25839. open();
  25840. }
  25841. });
  25842. return {
  25843. afterEnter,
  25844. afterLeave,
  25845. beforeLeave,
  25846. handleClose,
  25847. onModalClick,
  25848. close,
  25849. doClose,
  25850. onOpenAutoFocus,
  25851. onCloseAutoFocus,
  25852. onCloseRequested,
  25853. onFocusoutPrevented,
  25854. titleId,
  25855. bodyId,
  25856. closed,
  25857. style,
  25858. overlayDialogStyle,
  25859. rendered,
  25860. visible,
  25861. zIndex
  25862. };
  25863. };
  25864. const _hoisted_1$B = ["aria-label", "aria-labelledby", "aria-describedby"];
  25865. const __default__$M = vue.defineComponent({
  25866. name: "ElDialog",
  25867. inheritAttrs: false
  25868. });
  25869. const _sfc_main$1c = /* @__PURE__ */ vue.defineComponent({
  25870. ...__default__$M,
  25871. props: dialogProps,
  25872. emits: dialogEmits,
  25873. setup(__props, { expose }) {
  25874. const props = __props;
  25875. const slots = vue.useSlots();
  25876. useDeprecated({
  25877. scope: "el-dialog",
  25878. from: "the title slot",
  25879. replacement: "the header slot",
  25880. version: "3.0.0",
  25881. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  25882. }, vue.computed(() => !!slots.title));
  25883. useDeprecated({
  25884. scope: "el-dialog",
  25885. from: "custom-class",
  25886. replacement: "class",
  25887. version: "2.3.0",
  25888. ref: "https://element-plus.org/en-US/component/dialog.html#attributes",
  25889. type: "Attribute"
  25890. }, vue.computed(() => !!props.customClass));
  25891. const ns = useNamespace("dialog");
  25892. const dialogRef = vue.ref();
  25893. const headerRef = vue.ref();
  25894. const dialogContentRef = vue.ref();
  25895. const {
  25896. visible,
  25897. titleId,
  25898. bodyId,
  25899. style,
  25900. overlayDialogStyle,
  25901. rendered,
  25902. zIndex,
  25903. afterEnter,
  25904. afterLeave,
  25905. beforeLeave,
  25906. handleClose,
  25907. onModalClick,
  25908. onOpenAutoFocus,
  25909. onCloseAutoFocus,
  25910. onCloseRequested,
  25911. onFocusoutPrevented
  25912. } = useDialog(props, dialogRef);
  25913. vue.provide(dialogInjectionKey, {
  25914. dialogRef,
  25915. headerRef,
  25916. bodyId,
  25917. ns,
  25918. rendered,
  25919. style
  25920. });
  25921. const overlayEvent = useSameTarget(onModalClick);
  25922. const draggable = vue.computed(() => props.draggable && !props.fullscreen);
  25923. expose({
  25924. visible,
  25925. dialogContentRef
  25926. });
  25927. return (_ctx, _cache) => {
  25928. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  25929. to: "body",
  25930. disabled: !_ctx.appendToBody
  25931. }, [
  25932. vue.createVNode(vue.Transition, {
  25933. name: "dialog-fade",
  25934. onAfterEnter: vue.unref(afterEnter),
  25935. onAfterLeave: vue.unref(afterLeave),
  25936. onBeforeLeave: vue.unref(beforeLeave),
  25937. persisted: ""
  25938. }, {
  25939. default: vue.withCtx(() => [
  25940. vue.withDirectives(vue.createVNode(vue.unref(ElOverlay), {
  25941. "custom-mask-event": "",
  25942. mask: _ctx.modal,
  25943. "overlay-class": _ctx.modalClass,
  25944. "z-index": vue.unref(zIndex)
  25945. }, {
  25946. default: vue.withCtx(() => [
  25947. vue.createElementVNode("div", {
  25948. role: "dialog",
  25949. "aria-modal": "true",
  25950. "aria-label": _ctx.title || void 0,
  25951. "aria-labelledby": !_ctx.title ? vue.unref(titleId) : void 0,
  25952. "aria-describedby": vue.unref(bodyId),
  25953. class: vue.normalizeClass(`${vue.unref(ns).namespace.value}-overlay-dialog`),
  25954. style: vue.normalizeStyle(vue.unref(overlayDialogStyle)),
  25955. onClick: _cache[0] || (_cache[0] = (...args) => vue.unref(overlayEvent).onClick && vue.unref(overlayEvent).onClick(...args)),
  25956. onMousedown: _cache[1] || (_cache[1] = (...args) => vue.unref(overlayEvent).onMousedown && vue.unref(overlayEvent).onMousedown(...args)),
  25957. onMouseup: _cache[2] || (_cache[2] = (...args) => vue.unref(overlayEvent).onMouseup && vue.unref(overlayEvent).onMouseup(...args))
  25958. }, [
  25959. vue.createVNode(vue.unref(ElFocusTrap), {
  25960. loop: "",
  25961. trapped: vue.unref(visible),
  25962. "focus-start-el": "container",
  25963. onFocusAfterTrapped: vue.unref(onOpenAutoFocus),
  25964. onFocusAfterReleased: vue.unref(onCloseAutoFocus),
  25965. onFocusoutPrevented: vue.unref(onFocusoutPrevented),
  25966. onReleaseRequested: vue.unref(onCloseRequested)
  25967. }, {
  25968. default: vue.withCtx(() => [
  25969. vue.unref(rendered) ? (vue.openBlock(), vue.createBlock(ElDialogContent, vue.mergeProps({
  25970. key: 0,
  25971. ref_key: "dialogContentRef",
  25972. ref: dialogContentRef
  25973. }, _ctx.$attrs, {
  25974. "custom-class": _ctx.customClass,
  25975. center: _ctx.center,
  25976. "align-center": _ctx.alignCenter,
  25977. "close-icon": _ctx.closeIcon,
  25978. draggable: vue.unref(draggable),
  25979. fullscreen: _ctx.fullscreen,
  25980. "show-close": _ctx.showClose,
  25981. title: _ctx.title,
  25982. onClose: vue.unref(handleClose)
  25983. }), vue.createSlots({
  25984. header: vue.withCtx(() => [
  25985. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  25986. key: 0,
  25987. close: vue.unref(handleClose),
  25988. titleId: vue.unref(titleId),
  25989. titleClass: vue.unref(ns).e("title")
  25990. }) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  25991. ]),
  25992. default: vue.withCtx(() => [
  25993. vue.renderSlot(_ctx.$slots, "default")
  25994. ]),
  25995. _: 2
  25996. }, [
  25997. _ctx.$slots.footer ? {
  25998. name: "footer",
  25999. fn: vue.withCtx(() => [
  26000. vue.renderSlot(_ctx.$slots, "footer")
  26001. ])
  26002. } : void 0
  26003. ]), 1040, ["custom-class", "center", "align-center", "close-icon", "draggable", "fullscreen", "show-close", "title", "onClose"])) : vue.createCommentVNode("v-if", true)
  26004. ]),
  26005. _: 3
  26006. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  26007. ], 46, _hoisted_1$B)
  26008. ]),
  26009. _: 3
  26010. }, 8, ["mask", "overlay-class", "z-index"]), [
  26011. [vue.vShow, vue.unref(visible)]
  26012. ])
  26013. ]),
  26014. _: 3
  26015. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  26016. ], 8, ["disabled"]);
  26017. };
  26018. }
  26019. });
  26020. var Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["__file", "dialog.vue"]]);
  26021. const ElDialog = withInstall(Dialog);
  26022. const dividerProps = buildProps({
  26023. direction: {
  26024. type: String,
  26025. values: ["horizontal", "vertical"],
  26026. default: "horizontal"
  26027. },
  26028. contentPosition: {
  26029. type: String,
  26030. values: ["left", "center", "right"],
  26031. default: "center"
  26032. },
  26033. borderStyle: {
  26034. type: definePropType(String),
  26035. default: "solid"
  26036. }
  26037. });
  26038. const __default__$L = vue.defineComponent({
  26039. name: "ElDivider"
  26040. });
  26041. const _sfc_main$1b = /* @__PURE__ */ vue.defineComponent({
  26042. ...__default__$L,
  26043. props: dividerProps,
  26044. setup(__props) {
  26045. const props = __props;
  26046. const ns = useNamespace("divider");
  26047. const dividerStyle = vue.computed(() => {
  26048. return ns.cssVar({
  26049. "border-style": props.borderStyle
  26050. });
  26051. });
  26052. return (_ctx, _cache) => {
  26053. return vue.openBlock(), vue.createElementBlock("div", {
  26054. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.direction)]),
  26055. style: vue.normalizeStyle(vue.unref(dividerStyle)),
  26056. role: "separator"
  26057. }, [
  26058. _ctx.$slots.default && _ctx.direction !== "vertical" ? (vue.openBlock(), vue.createElementBlock("div", {
  26059. key: 0,
  26060. class: vue.normalizeClass([vue.unref(ns).e("text"), vue.unref(ns).is(_ctx.contentPosition)])
  26061. }, [
  26062. vue.renderSlot(_ctx.$slots, "default")
  26063. ], 2)) : vue.createCommentVNode("v-if", true)
  26064. ], 6);
  26065. };
  26066. }
  26067. });
  26068. var Divider = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["__file", "divider.vue"]]);
  26069. const ElDivider = withInstall(Divider);
  26070. const drawerProps = buildProps({
  26071. ...dialogProps,
  26072. direction: {
  26073. type: String,
  26074. default: "rtl",
  26075. values: ["ltr", "rtl", "ttb", "btt"]
  26076. },
  26077. size: {
  26078. type: [String, Number],
  26079. default: "30%"
  26080. },
  26081. withHeader: {
  26082. type: Boolean,
  26083. default: true
  26084. },
  26085. modalFade: {
  26086. type: Boolean,
  26087. default: true
  26088. }
  26089. });
  26090. const drawerEmits = dialogEmits;
  26091. const _sfc_main$1a = vue.defineComponent({
  26092. name: "ElDrawer",
  26093. components: {
  26094. ElOverlay,
  26095. ElFocusTrap,
  26096. ElIcon,
  26097. Close: close_default
  26098. },
  26099. props: drawerProps,
  26100. emits: drawerEmits,
  26101. setup(props, { slots }) {
  26102. useDeprecated({
  26103. scope: "el-drawer",
  26104. from: "the title slot",
  26105. replacement: "the header slot",
  26106. version: "3.0.0",
  26107. ref: "https://element-plus.org/en-US/component/drawer.html#slots"
  26108. }, vue.computed(() => !!slots.title));
  26109. const drawerRef = vue.ref();
  26110. const focusStartRef = vue.ref();
  26111. const ns = useNamespace("drawer");
  26112. const { t } = useLocale();
  26113. const isHorizontal = vue.computed(() => props.direction === "rtl" || props.direction === "ltr");
  26114. const drawerSize = vue.computed(() => addUnit(props.size));
  26115. return {
  26116. ...useDialog(props, drawerRef),
  26117. drawerRef,
  26118. focusStartRef,
  26119. isHorizontal,
  26120. drawerSize,
  26121. ns,
  26122. t
  26123. };
  26124. }
  26125. });
  26126. const _hoisted_1$A = ["aria-label", "aria-labelledby", "aria-describedby"];
  26127. const _hoisted_2$m = ["id"];
  26128. const _hoisted_3$9 = ["aria-label"];
  26129. const _hoisted_4$7 = ["id"];
  26130. function _sfc_render$p(_ctx, _cache, $props, $setup, $data, $options) {
  26131. const _component_close = vue.resolveComponent("close");
  26132. const _component_el_icon = vue.resolveComponent("el-icon");
  26133. const _component_el_focus_trap = vue.resolveComponent("el-focus-trap");
  26134. const _component_el_overlay = vue.resolveComponent("el-overlay");
  26135. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  26136. to: "body",
  26137. disabled: !_ctx.appendToBody
  26138. }, [
  26139. vue.createVNode(vue.Transition, {
  26140. name: _ctx.ns.b("fade"),
  26141. onAfterEnter: _ctx.afterEnter,
  26142. onAfterLeave: _ctx.afterLeave,
  26143. onBeforeLeave: _ctx.beforeLeave,
  26144. persisted: ""
  26145. }, {
  26146. default: vue.withCtx(() => [
  26147. vue.withDirectives(vue.createVNode(_component_el_overlay, {
  26148. mask: _ctx.modal,
  26149. "overlay-class": _ctx.modalClass,
  26150. "z-index": _ctx.zIndex,
  26151. onClick: _ctx.onModalClick
  26152. }, {
  26153. default: vue.withCtx(() => [
  26154. vue.createVNode(_component_el_focus_trap, {
  26155. loop: "",
  26156. trapped: _ctx.visible,
  26157. "focus-trap-el": _ctx.drawerRef,
  26158. "focus-start-el": _ctx.focusStartRef,
  26159. onReleaseRequested: _ctx.onCloseRequested
  26160. }, {
  26161. default: vue.withCtx(() => [
  26162. vue.createElementVNode("div", {
  26163. ref: "drawerRef",
  26164. "aria-modal": "true",
  26165. "aria-label": _ctx.title || void 0,
  26166. "aria-labelledby": !_ctx.title ? _ctx.titleId : void 0,
  26167. "aria-describedby": _ctx.bodyId,
  26168. class: vue.normalizeClass([_ctx.ns.b(), _ctx.direction, _ctx.visible && "open", _ctx.customClass]),
  26169. style: vue.normalizeStyle(_ctx.isHorizontal ? "width: " + _ctx.drawerSize : "height: " + _ctx.drawerSize),
  26170. role: "dialog",
  26171. onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
  26172. }, ["stop"]))
  26173. }, [
  26174. vue.createElementVNode("span", {
  26175. ref: "focusStartRef",
  26176. class: vue.normalizeClass(_ctx.ns.e("sr-focus")),
  26177. tabindex: "-1"
  26178. }, null, 2),
  26179. _ctx.withHeader ? (vue.openBlock(), vue.createElementBlock("header", {
  26180. key: 0,
  26181. class: vue.normalizeClass(_ctx.ns.e("header"))
  26182. }, [
  26183. !_ctx.$slots.title ? vue.renderSlot(_ctx.$slots, "header", {
  26184. key: 0,
  26185. close: _ctx.handleClose,
  26186. titleId: _ctx.titleId,
  26187. titleClass: _ctx.ns.e("title")
  26188. }, () => [
  26189. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("span", {
  26190. key: 0,
  26191. id: _ctx.titleId,
  26192. role: "heading",
  26193. class: vue.normalizeClass(_ctx.ns.e("title"))
  26194. }, vue.toDisplayString(_ctx.title), 11, _hoisted_2$m)) : vue.createCommentVNode("v-if", true)
  26195. ]) : vue.renderSlot(_ctx.$slots, "title", { key: 1 }, () => [
  26196. vue.createCommentVNode(" DEPRECATED SLOT ")
  26197. ]),
  26198. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  26199. key: 2,
  26200. "aria-label": _ctx.t("el.drawer.close"),
  26201. class: vue.normalizeClass(_ctx.ns.e("close-btn")),
  26202. type: "button",
  26203. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClose && _ctx.handleClose(...args))
  26204. }, [
  26205. vue.createVNode(_component_el_icon, {
  26206. class: vue.normalizeClass(_ctx.ns.e("close"))
  26207. }, {
  26208. default: vue.withCtx(() => [
  26209. vue.createVNode(_component_close)
  26210. ]),
  26211. _: 1
  26212. }, 8, ["class"])
  26213. ], 10, _hoisted_3$9)) : vue.createCommentVNode("v-if", true)
  26214. ], 2)) : vue.createCommentVNode("v-if", true),
  26215. _ctx.rendered ? (vue.openBlock(), vue.createElementBlock("div", {
  26216. key: 1,
  26217. id: _ctx.bodyId,
  26218. class: vue.normalizeClass(_ctx.ns.e("body"))
  26219. }, [
  26220. vue.renderSlot(_ctx.$slots, "default")
  26221. ], 10, _hoisted_4$7)) : vue.createCommentVNode("v-if", true),
  26222. _ctx.$slots.footer ? (vue.openBlock(), vue.createElementBlock("div", {
  26223. key: 2,
  26224. class: vue.normalizeClass(_ctx.ns.e("footer"))
  26225. }, [
  26226. vue.renderSlot(_ctx.$slots, "footer")
  26227. ], 2)) : vue.createCommentVNode("v-if", true)
  26228. ], 14, _hoisted_1$A)
  26229. ]),
  26230. _: 3
  26231. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  26232. ]),
  26233. _: 3
  26234. }, 8, ["mask", "overlay-class", "z-index", "onClick"]), [
  26235. [vue.vShow, _ctx.visible]
  26236. ])
  26237. ]),
  26238. _: 3
  26239. }, 8, ["name", "onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  26240. ], 8, ["disabled"]);
  26241. }
  26242. var Drawer = /* @__PURE__ */ _export_sfc(_sfc_main$1a, [["render", _sfc_render$p], ["__file", "drawer.vue"]]);
  26243. const ElDrawer = withInstall(Drawer);
  26244. const _sfc_main$19 = /* @__PURE__ */ vue.defineComponent({
  26245. inheritAttrs: false
  26246. });
  26247. function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
  26248. return vue.renderSlot(_ctx.$slots, "default");
  26249. }
  26250. var Collection = /* @__PURE__ */ _export_sfc(_sfc_main$19, [["render", _sfc_render$o], ["__file", "collection.vue"]]);
  26251. const _sfc_main$18 = /* @__PURE__ */ vue.defineComponent({
  26252. name: "ElCollectionItem",
  26253. inheritAttrs: false
  26254. });
  26255. function _sfc_render$n(_ctx, _cache, $props, $setup, $data, $options) {
  26256. return vue.renderSlot(_ctx.$slots, "default");
  26257. }
  26258. var CollectionItem = /* @__PURE__ */ _export_sfc(_sfc_main$18, [["render", _sfc_render$n], ["__file", "collection-item.vue"]]);
  26259. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  26260. const createCollectionWithScope = (name) => {
  26261. const COLLECTION_NAME = `El${name}Collection`;
  26262. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  26263. const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
  26264. const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
  26265. const ElCollection = {
  26266. ...Collection,
  26267. name: COLLECTION_NAME,
  26268. setup() {
  26269. const collectionRef = vue.ref(null);
  26270. const itemMap = /* @__PURE__ */ new Map();
  26271. const getItems = () => {
  26272. const collectionEl = vue.unref(collectionRef);
  26273. if (!collectionEl)
  26274. return [];
  26275. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  26276. const items = [...itemMap.values()];
  26277. return items.sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
  26278. };
  26279. vue.provide(COLLECTION_INJECTION_KEY, {
  26280. itemMap,
  26281. getItems,
  26282. collectionRef
  26283. });
  26284. }
  26285. };
  26286. const ElCollectionItem = {
  26287. ...CollectionItem,
  26288. name: COLLECTION_ITEM_NAME,
  26289. setup(_, { attrs }) {
  26290. const collectionItemRef = vue.ref(null);
  26291. const collectionInjection = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  26292. vue.provide(COLLECTION_ITEM_INJECTION_KEY, {
  26293. collectionItemRef
  26294. });
  26295. vue.onMounted(() => {
  26296. const collectionItemEl = vue.unref(collectionItemRef);
  26297. if (collectionItemEl) {
  26298. collectionInjection.itemMap.set(collectionItemEl, {
  26299. ref: collectionItemEl,
  26300. ...attrs
  26301. });
  26302. }
  26303. });
  26304. vue.onBeforeUnmount(() => {
  26305. const collectionItemEl = vue.unref(collectionItemRef);
  26306. collectionInjection.itemMap.delete(collectionItemEl);
  26307. });
  26308. }
  26309. };
  26310. return {
  26311. COLLECTION_INJECTION_KEY,
  26312. COLLECTION_ITEM_INJECTION_KEY,
  26313. ElCollection,
  26314. ElCollectionItem
  26315. };
  26316. };
  26317. const rovingFocusGroupProps = buildProps({
  26318. style: { type: definePropType([String, Array, Object]) },
  26319. currentTabId: {
  26320. type: definePropType(String)
  26321. },
  26322. defaultCurrentTabId: String,
  26323. loop: Boolean,
  26324. dir: {
  26325. type: String,
  26326. values: ["ltr", "rtl"],
  26327. default: "ltr"
  26328. },
  26329. orientation: {
  26330. type: definePropType(String)
  26331. },
  26332. onBlur: Function,
  26333. onFocus: Function,
  26334. onMousedown: Function
  26335. });
  26336. const {
  26337. ElCollection: ElCollection$1,
  26338. ElCollectionItem: ElCollectionItem$1,
  26339. COLLECTION_INJECTION_KEY: COLLECTION_INJECTION_KEY$1,
  26340. COLLECTION_ITEM_INJECTION_KEY: COLLECTION_ITEM_INJECTION_KEY$1
  26341. } = createCollectionWithScope("RovingFocusGroup");
  26342. const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
  26343. const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
  26344. const MAP_KEY_TO_FOCUS_INTENT = {
  26345. ArrowLeft: "prev",
  26346. ArrowUp: "prev",
  26347. ArrowRight: "next",
  26348. ArrowDown: "next",
  26349. PageUp: "first",
  26350. Home: "first",
  26351. PageDown: "last",
  26352. End: "last"
  26353. };
  26354. const getDirectionAwareKey = (key, dir) => {
  26355. if (dir !== "rtl")
  26356. return key;
  26357. switch (key) {
  26358. case EVENT_CODE.right:
  26359. return EVENT_CODE.left;
  26360. case EVENT_CODE.left:
  26361. return EVENT_CODE.right;
  26362. default:
  26363. return key;
  26364. }
  26365. };
  26366. const getFocusIntent = (event, orientation, dir) => {
  26367. const key = getDirectionAwareKey(event.key, dir);
  26368. if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key))
  26369. return void 0;
  26370. if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key))
  26371. return void 0;
  26372. return MAP_KEY_TO_FOCUS_INTENT[key];
  26373. };
  26374. const reorderArray = (array, atIdx) => {
  26375. return array.map((_, idx) => array[(idx + atIdx) % array.length]);
  26376. };
  26377. const focusFirst = (elements) => {
  26378. const { activeElement: prevActive } = document;
  26379. for (const element of elements) {
  26380. if (element === prevActive)
  26381. return;
  26382. element.focus();
  26383. if (prevActive !== document.activeElement)
  26384. return;
  26385. }
  26386. };
  26387. const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
  26388. const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
  26389. const EVT_OPTS = { bubbles: false, cancelable: true };
  26390. const _sfc_main$17 = vue.defineComponent({
  26391. name: "ElRovingFocusGroupImpl",
  26392. inheritAttrs: false,
  26393. props: rovingFocusGroupProps,
  26394. emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
  26395. setup(props, { emit }) {
  26396. var _a;
  26397. const currentTabbedId = vue.ref((_a = props.currentTabId || props.defaultCurrentTabId) != null ? _a : null);
  26398. const isBackingOut = vue.ref(false);
  26399. const isClickFocus = vue.ref(false);
  26400. const rovingFocusGroupRef = vue.ref(null);
  26401. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  26402. const rovingFocusGroupRootStyle = vue.computed(() => {
  26403. return [
  26404. {
  26405. outline: "none"
  26406. },
  26407. props.style
  26408. ];
  26409. });
  26410. const onItemFocus = (tabbedId) => {
  26411. emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
  26412. };
  26413. const onItemShiftTab = () => {
  26414. isBackingOut.value = true;
  26415. };
  26416. const onMousedown = composeEventHandlers((e) => {
  26417. var _a2;
  26418. (_a2 = props.onMousedown) == null ? void 0 : _a2.call(props, e);
  26419. }, () => {
  26420. isClickFocus.value = true;
  26421. });
  26422. const onFocus = composeEventHandlers((e) => {
  26423. var _a2;
  26424. (_a2 = props.onFocus) == null ? void 0 : _a2.call(props, e);
  26425. }, (e) => {
  26426. const isKeyboardFocus = !vue.unref(isClickFocus);
  26427. const { target, currentTarget } = e;
  26428. if (target === currentTarget && isKeyboardFocus && !vue.unref(isBackingOut)) {
  26429. const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
  26430. currentTarget == null ? void 0 : currentTarget.dispatchEvent(entryFocusEvt);
  26431. if (!entryFocusEvt.defaultPrevented) {
  26432. const items = getItems().filter((item) => item.focusable);
  26433. const activeItem = items.find((item) => item.active);
  26434. const currentItem = items.find((item) => item.id === vue.unref(currentTabbedId));
  26435. const candidates = [activeItem, currentItem, ...items].filter(Boolean);
  26436. const candidateNodes = candidates.map((item) => item.ref);
  26437. focusFirst(candidateNodes);
  26438. }
  26439. }
  26440. isClickFocus.value = false;
  26441. });
  26442. const onBlur = composeEventHandlers((e) => {
  26443. var _a2;
  26444. (_a2 = props.onBlur) == null ? void 0 : _a2.call(props, e);
  26445. }, () => {
  26446. isBackingOut.value = false;
  26447. });
  26448. const handleEntryFocus = (...args) => {
  26449. emit("entryFocus", ...args);
  26450. };
  26451. vue.provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
  26452. currentTabbedId: vue.readonly(currentTabbedId),
  26453. loop: vue.toRef(props, "loop"),
  26454. tabIndex: vue.computed(() => {
  26455. return vue.unref(isBackingOut) ? -1 : 0;
  26456. }),
  26457. rovingFocusGroupRef,
  26458. rovingFocusGroupRootStyle,
  26459. orientation: vue.toRef(props, "orientation"),
  26460. dir: vue.toRef(props, "dir"),
  26461. onItemFocus,
  26462. onItemShiftTab,
  26463. onBlur,
  26464. onFocus,
  26465. onMousedown
  26466. });
  26467. vue.watch(() => props.currentTabId, (val) => {
  26468. currentTabbedId.value = val != null ? val : null;
  26469. });
  26470. useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
  26471. }
  26472. });
  26473. function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
  26474. return vue.renderSlot(_ctx.$slots, "default");
  26475. }
  26476. var ElRovingFocusGroupImpl = /* @__PURE__ */ _export_sfc(_sfc_main$17, [["render", _sfc_render$m], ["__file", "roving-focus-group-impl.vue"]]);
  26477. const _sfc_main$16 = vue.defineComponent({
  26478. name: "ElRovingFocusGroup",
  26479. components: {
  26480. ElFocusGroupCollection: ElCollection$1,
  26481. ElRovingFocusGroupImpl
  26482. }
  26483. });
  26484. function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
  26485. const _component_el_roving_focus_group_impl = vue.resolveComponent("el-roving-focus-group-impl");
  26486. const _component_el_focus_group_collection = vue.resolveComponent("el-focus-group-collection");
  26487. return vue.openBlock(), vue.createBlock(_component_el_focus_group_collection, null, {
  26488. default: vue.withCtx(() => [
  26489. vue.createVNode(_component_el_roving_focus_group_impl, vue.normalizeProps(vue.guardReactiveProps(_ctx.$attrs)), {
  26490. default: vue.withCtx(() => [
  26491. vue.renderSlot(_ctx.$slots, "default")
  26492. ]),
  26493. _: 3
  26494. }, 16)
  26495. ]),
  26496. _: 3
  26497. });
  26498. }
  26499. var ElRovingFocusGroup = /* @__PURE__ */ _export_sfc(_sfc_main$16, [["render", _sfc_render$l], ["__file", "roving-focus-group.vue"]]);
  26500. const _sfc_main$15 = vue.defineComponent({
  26501. components: {
  26502. ElRovingFocusCollectionItem: ElCollectionItem$1
  26503. },
  26504. props: {
  26505. focusable: {
  26506. type: Boolean,
  26507. default: true
  26508. },
  26509. active: {
  26510. type: Boolean,
  26511. default: false
  26512. }
  26513. },
  26514. emits: ["mousedown", "focus", "keydown"],
  26515. setup(props, { emit }) {
  26516. const { currentTabbedId, loop, onItemFocus, onItemShiftTab } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  26517. const { getItems } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  26518. const id = useId();
  26519. const rovingFocusGroupItemRef = vue.ref(null);
  26520. const handleMousedown = composeEventHandlers((e) => {
  26521. emit("mousedown", e);
  26522. }, (e) => {
  26523. if (!props.focusable) {
  26524. e.preventDefault();
  26525. } else {
  26526. onItemFocus(vue.unref(id));
  26527. }
  26528. });
  26529. const handleFocus = composeEventHandlers((e) => {
  26530. emit("focus", e);
  26531. }, () => {
  26532. onItemFocus(vue.unref(id));
  26533. });
  26534. const handleKeydown = composeEventHandlers((e) => {
  26535. emit("keydown", e);
  26536. }, (e) => {
  26537. const { key, shiftKey, target, currentTarget } = e;
  26538. if (key === EVENT_CODE.tab && shiftKey) {
  26539. onItemShiftTab();
  26540. return;
  26541. }
  26542. if (target !== currentTarget)
  26543. return;
  26544. const focusIntent = getFocusIntent(e);
  26545. if (focusIntent) {
  26546. e.preventDefault();
  26547. const items = getItems().filter((item) => item.focusable);
  26548. let elements = items.map((item) => item.ref);
  26549. switch (focusIntent) {
  26550. case "last": {
  26551. elements.reverse();
  26552. break;
  26553. }
  26554. case "prev":
  26555. case "next": {
  26556. if (focusIntent === "prev") {
  26557. elements.reverse();
  26558. }
  26559. const currentIdx = elements.indexOf(currentTarget);
  26560. elements = loop.value ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
  26561. break;
  26562. }
  26563. }
  26564. vue.nextTick(() => {
  26565. focusFirst(elements);
  26566. });
  26567. }
  26568. });
  26569. const isCurrentTab = vue.computed(() => currentTabbedId.value === vue.unref(id));
  26570. vue.provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
  26571. rovingFocusGroupItemRef,
  26572. tabIndex: vue.computed(() => vue.unref(isCurrentTab) ? 0 : -1),
  26573. handleMousedown,
  26574. handleFocus,
  26575. handleKeydown
  26576. });
  26577. return {
  26578. id,
  26579. handleKeydown,
  26580. handleFocus,
  26581. handleMousedown
  26582. };
  26583. }
  26584. });
  26585. function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
  26586. const _component_el_roving_focus_collection_item = vue.resolveComponent("el-roving-focus-collection-item");
  26587. return vue.openBlock(), vue.createBlock(_component_el_roving_focus_collection_item, {
  26588. id: _ctx.id,
  26589. focusable: _ctx.focusable,
  26590. active: _ctx.active
  26591. }, {
  26592. default: vue.withCtx(() => [
  26593. vue.renderSlot(_ctx.$slots, "default")
  26594. ]),
  26595. _: 3
  26596. }, 8, ["id", "focusable", "active"]);
  26597. }
  26598. var ElRovingFocusItem = /* @__PURE__ */ _export_sfc(_sfc_main$15, [["render", _sfc_render$k], ["__file", "roving-focus-item.vue"]]);
  26599. const dropdownProps = buildProps({
  26600. trigger: useTooltipTriggerProps.trigger,
  26601. effect: {
  26602. ...useTooltipContentProps.effect,
  26603. default: "light"
  26604. },
  26605. type: {
  26606. type: definePropType(String)
  26607. },
  26608. placement: {
  26609. type: definePropType(String),
  26610. default: "bottom"
  26611. },
  26612. popperOptions: {
  26613. type: definePropType(Object),
  26614. default: () => ({})
  26615. },
  26616. id: String,
  26617. size: {
  26618. type: String,
  26619. default: ""
  26620. },
  26621. splitButton: Boolean,
  26622. hideOnClick: {
  26623. type: Boolean,
  26624. default: true
  26625. },
  26626. loop: {
  26627. type: Boolean,
  26628. default: true
  26629. },
  26630. showTimeout: {
  26631. type: Number,
  26632. default: 150
  26633. },
  26634. hideTimeout: {
  26635. type: Number,
  26636. default: 150
  26637. },
  26638. tabindex: {
  26639. type: definePropType([Number, String]),
  26640. default: 0
  26641. },
  26642. maxHeight: {
  26643. type: definePropType([Number, String]),
  26644. default: ""
  26645. },
  26646. popperClass: {
  26647. type: String,
  26648. default: ""
  26649. },
  26650. disabled: {
  26651. type: Boolean,
  26652. default: false
  26653. },
  26654. role: {
  26655. type: String,
  26656. default: "menu"
  26657. },
  26658. buttonProps: {
  26659. type: definePropType(Object)
  26660. },
  26661. teleported: useTooltipContentProps.teleported
  26662. });
  26663. const dropdownItemProps = buildProps({
  26664. command: {
  26665. type: [Object, String, Number],
  26666. default: () => ({})
  26667. },
  26668. disabled: Boolean,
  26669. divided: Boolean,
  26670. textValue: String,
  26671. icon: {
  26672. type: iconPropType
  26673. }
  26674. });
  26675. const dropdownMenuProps = buildProps({
  26676. onKeydown: { type: definePropType(Function) }
  26677. });
  26678. const FIRST_KEYS = [
  26679. EVENT_CODE.down,
  26680. EVENT_CODE.pageDown,
  26681. EVENT_CODE.home
  26682. ];
  26683. const LAST_KEYS = [EVENT_CODE.up, EVENT_CODE.pageUp, EVENT_CODE.end];
  26684. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  26685. const {
  26686. ElCollection,
  26687. ElCollectionItem,
  26688. COLLECTION_INJECTION_KEY,
  26689. COLLECTION_ITEM_INJECTION_KEY
  26690. } = createCollectionWithScope("Dropdown");
  26691. const DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
  26692. const { ButtonGroup: ElButtonGroup } = ElButton;
  26693. const _sfc_main$14 = vue.defineComponent({
  26694. name: "ElDropdown",
  26695. components: {
  26696. ElButton,
  26697. ElButtonGroup,
  26698. ElScrollbar,
  26699. ElDropdownCollection: ElCollection,
  26700. ElTooltip,
  26701. ElRovingFocusGroup,
  26702. ElOnlyChild: OnlyChild,
  26703. ElIcon,
  26704. ArrowDown: arrow_down_default
  26705. },
  26706. props: dropdownProps,
  26707. emits: ["visible-change", "click", "command"],
  26708. setup(props, { emit }) {
  26709. const _instance = vue.getCurrentInstance();
  26710. const ns = useNamespace("dropdown");
  26711. const { t } = useLocale();
  26712. const triggeringElementRef = vue.ref();
  26713. const referenceElementRef = vue.ref();
  26714. const popperRef = vue.ref(null);
  26715. const contentRef = vue.ref(null);
  26716. const scrollbar = vue.ref(null);
  26717. const currentTabId = vue.ref(null);
  26718. const isUsingKeyboard = vue.ref(false);
  26719. const triggerKeys = [EVENT_CODE.enter, EVENT_CODE.space, EVENT_CODE.down];
  26720. const wrapStyle = vue.computed(() => ({
  26721. maxHeight: addUnit(props.maxHeight)
  26722. }));
  26723. const dropdownTriggerKls = vue.computed(() => [ns.m(dropdownSize.value)]);
  26724. const defaultTriggerId = useId().value;
  26725. const triggerId = vue.computed(() => {
  26726. return props.id || defaultTriggerId;
  26727. });
  26728. function handleClick() {
  26729. handleClose();
  26730. }
  26731. function handleClose() {
  26732. var _a;
  26733. (_a = popperRef.value) == null ? void 0 : _a.onClose();
  26734. }
  26735. function handleOpen() {
  26736. var _a;
  26737. (_a = popperRef.value) == null ? void 0 : _a.onOpen();
  26738. }
  26739. const dropdownSize = useSize();
  26740. function commandHandler(...args) {
  26741. emit("command", ...args);
  26742. }
  26743. function onItemEnter() {
  26744. }
  26745. function onItemLeave() {
  26746. const contentEl = vue.unref(contentRef);
  26747. contentEl == null ? void 0 : contentEl.focus();
  26748. currentTabId.value = null;
  26749. }
  26750. function handleCurrentTabIdChange(id) {
  26751. currentTabId.value = id;
  26752. }
  26753. function handleEntryFocus(e) {
  26754. if (!isUsingKeyboard.value) {
  26755. e.preventDefault();
  26756. e.stopImmediatePropagation();
  26757. }
  26758. }
  26759. function handleBeforeShowTooltip() {
  26760. emit("visible-change", true);
  26761. }
  26762. function handleShowTooltip(event) {
  26763. if ((event == null ? void 0 : event.type) === "keydown") {
  26764. contentRef.value.focus();
  26765. }
  26766. }
  26767. function handleBeforeHideTooltip() {
  26768. emit("visible-change", false);
  26769. }
  26770. vue.provide(DROPDOWN_INJECTION_KEY, {
  26771. contentRef,
  26772. role: vue.computed(() => props.role),
  26773. triggerId,
  26774. isUsingKeyboard,
  26775. onItemEnter,
  26776. onItemLeave
  26777. });
  26778. vue.provide("elDropdown", {
  26779. instance: _instance,
  26780. dropdownSize,
  26781. handleClick,
  26782. commandHandler,
  26783. trigger: vue.toRef(props, "trigger"),
  26784. hideOnClick: vue.toRef(props, "hideOnClick")
  26785. });
  26786. const onFocusAfterTrapped = (e) => {
  26787. var _a, _b;
  26788. e.preventDefault();
  26789. (_b = (_a = contentRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a, {
  26790. preventScroll: true
  26791. });
  26792. };
  26793. const handlerMainButtonClick = (event) => {
  26794. emit("click", event);
  26795. };
  26796. return {
  26797. t,
  26798. ns,
  26799. scrollbar,
  26800. wrapStyle,
  26801. dropdownTriggerKls,
  26802. dropdownSize,
  26803. triggerId,
  26804. triggerKeys,
  26805. currentTabId,
  26806. handleCurrentTabIdChange,
  26807. handlerMainButtonClick,
  26808. handleEntryFocus,
  26809. handleClose,
  26810. handleOpen,
  26811. handleBeforeShowTooltip,
  26812. handleShowTooltip,
  26813. handleBeforeHideTooltip,
  26814. onFocusAfterTrapped,
  26815. popperRef,
  26816. contentRef,
  26817. triggeringElementRef,
  26818. referenceElementRef
  26819. };
  26820. }
  26821. });
  26822. function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
  26823. var _a;
  26824. const _component_el_dropdown_collection = vue.resolveComponent("el-dropdown-collection");
  26825. const _component_el_roving_focus_group = vue.resolveComponent("el-roving-focus-group");
  26826. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  26827. const _component_el_only_child = vue.resolveComponent("el-only-child");
  26828. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  26829. const _component_el_button = vue.resolveComponent("el-button");
  26830. const _component_arrow_down = vue.resolveComponent("arrow-down");
  26831. const _component_el_icon = vue.resolveComponent("el-icon");
  26832. const _component_el_button_group = vue.resolveComponent("el-button-group");
  26833. return vue.openBlock(), vue.createElementBlock("div", {
  26834. class: vue.normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)])
  26835. }, [
  26836. vue.createVNode(_component_el_tooltip, {
  26837. ref: "popperRef",
  26838. role: _ctx.role,
  26839. effect: _ctx.effect,
  26840. "fallback-placements": ["bottom", "top"],
  26841. "popper-options": _ctx.popperOptions,
  26842. "gpu-acceleration": false,
  26843. "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
  26844. "manual-mode": true,
  26845. placement: _ctx.placement,
  26846. "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
  26847. "reference-element": (_a = _ctx.referenceElementRef) == null ? void 0 : _a.$el,
  26848. trigger: _ctx.trigger,
  26849. "trigger-keys": _ctx.triggerKeys,
  26850. "trigger-target-el": _ctx.contentRef,
  26851. "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
  26852. "stop-popper-mouse-event": false,
  26853. "virtual-ref": _ctx.triggeringElementRef,
  26854. "virtual-triggering": _ctx.splitButton,
  26855. disabled: _ctx.disabled,
  26856. transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
  26857. teleported: _ctx.teleported,
  26858. pure: "",
  26859. persistent: "",
  26860. onBeforeShow: _ctx.handleBeforeShowTooltip,
  26861. onShow: _ctx.handleShowTooltip,
  26862. onBeforeHide: _ctx.handleBeforeHideTooltip
  26863. }, vue.createSlots({
  26864. content: vue.withCtx(() => [
  26865. vue.createVNode(_component_el_scrollbar, {
  26866. ref: "scrollbar",
  26867. "wrap-style": _ctx.wrapStyle,
  26868. tag: "div",
  26869. "view-class": _ctx.ns.e("list")
  26870. }, {
  26871. default: vue.withCtx(() => [
  26872. vue.createVNode(_component_el_roving_focus_group, {
  26873. loop: _ctx.loop,
  26874. "current-tab-id": _ctx.currentTabId,
  26875. orientation: "horizontal",
  26876. onCurrentTabIdChange: _ctx.handleCurrentTabIdChange,
  26877. onEntryFocus: _ctx.handleEntryFocus
  26878. }, {
  26879. default: vue.withCtx(() => [
  26880. vue.createVNode(_component_el_dropdown_collection, null, {
  26881. default: vue.withCtx(() => [
  26882. vue.renderSlot(_ctx.$slots, "dropdown")
  26883. ]),
  26884. _: 3
  26885. })
  26886. ]),
  26887. _: 3
  26888. }, 8, ["loop", "current-tab-id", "onCurrentTabIdChange", "onEntryFocus"])
  26889. ]),
  26890. _: 3
  26891. }, 8, ["wrap-style", "view-class"])
  26892. ]),
  26893. _: 2
  26894. }, [
  26895. !_ctx.splitButton ? {
  26896. name: "default",
  26897. fn: vue.withCtx(() => [
  26898. vue.createVNode(_component_el_only_child, {
  26899. id: _ctx.triggerId,
  26900. role: "button",
  26901. tabindex: _ctx.tabindex
  26902. }, {
  26903. default: vue.withCtx(() => [
  26904. vue.renderSlot(_ctx.$slots, "default")
  26905. ]),
  26906. _: 3
  26907. }, 8, ["id", "tabindex"])
  26908. ])
  26909. } : void 0
  26910. ]), 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"]),
  26911. _ctx.splitButton ? (vue.openBlock(), vue.createBlock(_component_el_button_group, { key: 0 }, {
  26912. default: vue.withCtx(() => [
  26913. vue.createVNode(_component_el_button, vue.mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
  26914. size: _ctx.dropdownSize,
  26915. type: _ctx.type,
  26916. disabled: _ctx.disabled,
  26917. tabindex: _ctx.tabindex,
  26918. onClick: _ctx.handlerMainButtonClick
  26919. }), {
  26920. default: vue.withCtx(() => [
  26921. vue.renderSlot(_ctx.$slots, "default")
  26922. ]),
  26923. _: 3
  26924. }, 16, ["size", "type", "disabled", "tabindex", "onClick"]),
  26925. vue.createVNode(_component_el_button, vue.mergeProps({
  26926. id: _ctx.triggerId,
  26927. ref: "triggeringElementRef"
  26928. }, _ctx.buttonProps, {
  26929. role: "button",
  26930. size: _ctx.dropdownSize,
  26931. type: _ctx.type,
  26932. class: _ctx.ns.e("caret-button"),
  26933. disabled: _ctx.disabled,
  26934. tabindex: _ctx.tabindex,
  26935. "aria-label": _ctx.t("el.dropdown.toggleDropdown")
  26936. }), {
  26937. default: vue.withCtx(() => [
  26938. vue.createVNode(_component_el_icon, {
  26939. class: vue.normalizeClass(_ctx.ns.e("icon"))
  26940. }, {
  26941. default: vue.withCtx(() => [
  26942. vue.createVNode(_component_arrow_down)
  26943. ]),
  26944. _: 1
  26945. }, 8, ["class"])
  26946. ]),
  26947. _: 1
  26948. }, 16, ["id", "size", "type", "class", "disabled", "tabindex", "aria-label"])
  26949. ]),
  26950. _: 3
  26951. })) : vue.createCommentVNode("v-if", true)
  26952. ], 2);
  26953. }
  26954. var Dropdown = /* @__PURE__ */ _export_sfc(_sfc_main$14, [["render", _sfc_render$j], ["__file", "dropdown.vue"]]);
  26955. const _sfc_main$13 = vue.defineComponent({
  26956. name: "DropdownItemImpl",
  26957. components: {
  26958. ElIcon
  26959. },
  26960. props: dropdownItemProps,
  26961. emits: ["pointermove", "pointerleave", "click", "clickimpl"],
  26962. setup(_, { emit }) {
  26963. const ns = useNamespace("dropdown");
  26964. const { role: menuRole } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  26965. const { collectionItemRef: dropdownCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
  26966. const { collectionItemRef: rovingFocusCollectionItemRef } = vue.inject(COLLECTION_ITEM_INJECTION_KEY$1, void 0);
  26967. const {
  26968. rovingFocusGroupItemRef,
  26969. tabIndex,
  26970. handleFocus,
  26971. handleKeydown: handleItemKeydown,
  26972. handleMousedown
  26973. } = vue.inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
  26974. const itemRef = composeRefs(dropdownCollectionItemRef, rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
  26975. const role = vue.computed(() => {
  26976. if (menuRole.value === "menu") {
  26977. return "menuitem";
  26978. } else if (menuRole.value === "navigation") {
  26979. return "link";
  26980. }
  26981. return "button";
  26982. });
  26983. const handleKeydown = composeEventHandlers((e) => {
  26984. const { code } = e;
  26985. if (code === EVENT_CODE.enter || code === EVENT_CODE.space) {
  26986. e.preventDefault();
  26987. e.stopImmediatePropagation();
  26988. emit("clickimpl", e);
  26989. return true;
  26990. }
  26991. }, handleItemKeydown);
  26992. return {
  26993. ns,
  26994. itemRef,
  26995. dataset: {
  26996. [COLLECTION_ITEM_SIGN]: ""
  26997. },
  26998. role,
  26999. tabIndex,
  27000. handleFocus,
  27001. handleKeydown,
  27002. handleMousedown
  27003. };
  27004. }
  27005. });
  27006. const _hoisted_1$z = ["aria-disabled", "tabindex", "role"];
  27007. function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
  27008. const _component_el_icon = vue.resolveComponent("el-icon");
  27009. return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [
  27010. _ctx.divided ? (vue.openBlock(), vue.createElementBlock("li", vue.mergeProps({
  27011. key: 0,
  27012. role: "separator",
  27013. class: _ctx.ns.bem("menu", "item", "divided")
  27014. }, _ctx.$attrs), null, 16)) : vue.createCommentVNode("v-if", true),
  27015. vue.createElementVNode("li", vue.mergeProps({ ref: _ctx.itemRef }, { ..._ctx.dataset, ..._ctx.$attrs }, {
  27016. "aria-disabled": _ctx.disabled,
  27017. class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
  27018. tabindex: _ctx.tabIndex,
  27019. role: _ctx.role,
  27020. onClick: _cache[0] || (_cache[0] = (e) => _ctx.$emit("clickimpl", e)),
  27021. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  27022. onKeydown: _cache[2] || (_cache[2] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args)),
  27023. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.handleMousedown && _ctx.handleMousedown(...args)),
  27024. onPointermove: _cache[4] || (_cache[4] = (e) => _ctx.$emit("pointermove", e)),
  27025. onPointerleave: _cache[5] || (_cache[5] = (e) => _ctx.$emit("pointerleave", e))
  27026. }), [
  27027. _ctx.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
  27028. default: vue.withCtx(() => [
  27029. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  27030. ]),
  27031. _: 1
  27032. })) : vue.createCommentVNode("v-if", true),
  27033. vue.renderSlot(_ctx.$slots, "default")
  27034. ], 16, _hoisted_1$z)
  27035. ], 64);
  27036. }
  27037. var ElDropdownItemImpl = /* @__PURE__ */ _export_sfc(_sfc_main$13, [["render", _sfc_render$i], ["__file", "dropdown-item-impl.vue"]]);
  27038. const useDropdown = () => {
  27039. const elDropdown = vue.inject("elDropdown", {});
  27040. const _elDropdownSize = vue.computed(() => elDropdown == null ? void 0 : elDropdown.dropdownSize);
  27041. return {
  27042. elDropdown,
  27043. _elDropdownSize
  27044. };
  27045. };
  27046. const _sfc_main$12 = vue.defineComponent({
  27047. name: "ElDropdownItem",
  27048. components: {
  27049. ElDropdownCollectionItem: ElCollectionItem,
  27050. ElRovingFocusItem,
  27051. ElDropdownItemImpl
  27052. },
  27053. inheritAttrs: false,
  27054. props: dropdownItemProps,
  27055. emits: ["pointermove", "pointerleave", "click"],
  27056. setup(props, { emit, attrs }) {
  27057. const { elDropdown } = useDropdown();
  27058. const _instance = vue.getCurrentInstance();
  27059. const itemRef = vue.ref(null);
  27060. const textContent = vue.computed(() => {
  27061. var _a, _b;
  27062. return (_b = (_a = vue.unref(itemRef)) == null ? void 0 : _a.textContent) != null ? _b : "";
  27063. });
  27064. const { onItemEnter, onItemLeave } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  27065. const handlePointerMove = composeEventHandlers((e) => {
  27066. emit("pointermove", e);
  27067. return e.defaultPrevented;
  27068. }, whenMouse((e) => {
  27069. var _a;
  27070. if (props.disabled) {
  27071. onItemLeave(e);
  27072. } else {
  27073. onItemEnter(e);
  27074. if (!e.defaultPrevented) {
  27075. (_a = e.currentTarget) == null ? void 0 : _a.focus();
  27076. }
  27077. }
  27078. }));
  27079. const handlePointerLeave = composeEventHandlers((e) => {
  27080. emit("pointerleave", e);
  27081. return e.defaultPrevented;
  27082. }, whenMouse((e) => {
  27083. onItemLeave(e);
  27084. }));
  27085. const handleClick = composeEventHandlers((e) => {
  27086. if (props.disabled) {
  27087. return;
  27088. }
  27089. emit("click", e);
  27090. return e.type !== "keydown" && e.defaultPrevented;
  27091. }, (e) => {
  27092. var _a, _b, _c;
  27093. if (props.disabled) {
  27094. e.stopImmediatePropagation();
  27095. return;
  27096. }
  27097. if ((_a = elDropdown == null ? void 0 : elDropdown.hideOnClick) == null ? void 0 : _a.value) {
  27098. (_b = elDropdown.handleClick) == null ? void 0 : _b.call(elDropdown);
  27099. }
  27100. (_c = elDropdown.commandHandler) == null ? void 0 : _c.call(elDropdown, props.command, _instance, e);
  27101. });
  27102. const propsAndAttrs = vue.computed(() => {
  27103. return { ...props, ...attrs };
  27104. });
  27105. return {
  27106. handleClick,
  27107. handlePointerMove,
  27108. handlePointerLeave,
  27109. textContent,
  27110. propsAndAttrs
  27111. };
  27112. }
  27113. });
  27114. function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
  27115. var _a;
  27116. const _component_el_dropdown_item_impl = vue.resolveComponent("el-dropdown-item-impl");
  27117. const _component_el_roving_focus_item = vue.resolveComponent("el-roving-focus-item");
  27118. const _component_el_dropdown_collection_item = vue.resolveComponent("el-dropdown-collection-item");
  27119. return vue.openBlock(), vue.createBlock(_component_el_dropdown_collection_item, {
  27120. disabled: _ctx.disabled,
  27121. "text-value": (_a = _ctx.textValue) != null ? _a : _ctx.textContent
  27122. }, {
  27123. default: vue.withCtx(() => [
  27124. vue.createVNode(_component_el_roving_focus_item, {
  27125. focusable: !_ctx.disabled
  27126. }, {
  27127. default: vue.withCtx(() => [
  27128. vue.createVNode(_component_el_dropdown_item_impl, vue.mergeProps(_ctx.propsAndAttrs, {
  27129. onPointerleave: _ctx.handlePointerLeave,
  27130. onPointermove: _ctx.handlePointerMove,
  27131. onClickimpl: _ctx.handleClick
  27132. }), {
  27133. default: vue.withCtx(() => [
  27134. vue.renderSlot(_ctx.$slots, "default")
  27135. ]),
  27136. _: 3
  27137. }, 16, ["onPointerleave", "onPointermove", "onClickimpl"])
  27138. ]),
  27139. _: 3
  27140. }, 8, ["focusable"])
  27141. ]),
  27142. _: 3
  27143. }, 8, ["disabled", "text-value"]);
  27144. }
  27145. var DropdownItem = /* @__PURE__ */ _export_sfc(_sfc_main$12, [["render", _sfc_render$h], ["__file", "dropdown-item.vue"]]);
  27146. const _sfc_main$11 = vue.defineComponent({
  27147. name: "ElDropdownMenu",
  27148. props: dropdownMenuProps,
  27149. setup(props) {
  27150. const ns = useNamespace("dropdown");
  27151. const { _elDropdownSize } = useDropdown();
  27152. const size = _elDropdownSize.value;
  27153. const { focusTrapRef, onKeydown } = vue.inject(FOCUS_TRAP_INJECTION_KEY, void 0);
  27154. const { contentRef, role, triggerId } = vue.inject(DROPDOWN_INJECTION_KEY, void 0);
  27155. const { collectionRef: dropdownCollectionRef, getItems } = vue.inject(COLLECTION_INJECTION_KEY, void 0);
  27156. const {
  27157. rovingFocusGroupRef,
  27158. rovingFocusGroupRootStyle,
  27159. tabIndex,
  27160. onBlur,
  27161. onFocus,
  27162. onMousedown
  27163. } = vue.inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  27164. const { collectionRef: rovingFocusGroupCollectionRef } = vue.inject(COLLECTION_INJECTION_KEY$1, void 0);
  27165. const dropdownKls = vue.computed(() => {
  27166. return [ns.b("menu"), ns.bm("menu", size == null ? void 0 : size.value)];
  27167. });
  27168. const dropdownListWrapperRef = composeRefs(contentRef, dropdownCollectionRef, focusTrapRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
  27169. const composedKeydown = composeEventHandlers((e) => {
  27170. var _a;
  27171. (_a = props.onKeydown) == null ? void 0 : _a.call(props, e);
  27172. }, (e) => {
  27173. const { currentTarget, code, target } = e;
  27174. currentTarget.contains(target);
  27175. if (EVENT_CODE.tab === code) {
  27176. e.stopImmediatePropagation();
  27177. }
  27178. e.preventDefault();
  27179. if (target !== vue.unref(contentRef))
  27180. return;
  27181. if (!FIRST_LAST_KEYS.includes(code))
  27182. return;
  27183. const items = getItems().filter((item) => !item.disabled);
  27184. const targets = items.map((item) => item.ref);
  27185. if (LAST_KEYS.includes(code)) {
  27186. targets.reverse();
  27187. }
  27188. focusFirst(targets);
  27189. });
  27190. const handleKeydown = (e) => {
  27191. composedKeydown(e);
  27192. onKeydown(e);
  27193. };
  27194. return {
  27195. size,
  27196. rovingFocusGroupRootStyle,
  27197. tabIndex,
  27198. dropdownKls,
  27199. role,
  27200. triggerId,
  27201. dropdownListWrapperRef,
  27202. handleKeydown,
  27203. onBlur,
  27204. onFocus,
  27205. onMousedown
  27206. };
  27207. }
  27208. });
  27209. const _hoisted_1$y = ["role", "aria-labelledby"];
  27210. function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
  27211. return vue.openBlock(), vue.createElementBlock("ul", {
  27212. ref: _ctx.dropdownListWrapperRef,
  27213. class: vue.normalizeClass(_ctx.dropdownKls),
  27214. style: vue.normalizeStyle(_ctx.rovingFocusGroupRootStyle),
  27215. tabindex: -1,
  27216. role: _ctx.role,
  27217. "aria-labelledby": _ctx.triggerId,
  27218. onBlur: _cache[0] || (_cache[0] = (...args) => _ctx.onBlur && _ctx.onBlur(...args)),
  27219. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
  27220. onKeydown: _cache[2] || (_cache[2] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args)),
  27221. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.onMousedown && _ctx.onMousedown(...args))
  27222. }, [
  27223. vue.renderSlot(_ctx.$slots, "default")
  27224. ], 46, _hoisted_1$y);
  27225. }
  27226. var DropdownMenu = /* @__PURE__ */ _export_sfc(_sfc_main$11, [["render", _sfc_render$g], ["__file", "dropdown-menu.vue"]]);
  27227. const ElDropdown = withInstall(Dropdown, {
  27228. DropdownItem,
  27229. DropdownMenu
  27230. });
  27231. const ElDropdownItem = withNoopInstall(DropdownItem);
  27232. const ElDropdownMenu = withNoopInstall(DropdownMenu);
  27233. let id = 0;
  27234. const _sfc_main$10 = vue.defineComponent({
  27235. name: "ImgEmpty",
  27236. setup() {
  27237. const ns = useNamespace("empty");
  27238. return {
  27239. ns,
  27240. id: ++id
  27241. };
  27242. }
  27243. });
  27244. const _hoisted_1$x = {
  27245. viewBox: "0 0 79 86",
  27246. version: "1.1",
  27247. xmlns: "http://www.w3.org/2000/svg",
  27248. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  27249. };
  27250. const _hoisted_2$l = ["id"];
  27251. const _hoisted_3$8 = ["stop-color"];
  27252. const _hoisted_4$6 = ["stop-color"];
  27253. const _hoisted_5$5 = ["id"];
  27254. const _hoisted_6$1 = ["stop-color"];
  27255. const _hoisted_7 = ["stop-color"];
  27256. const _hoisted_8 = ["id"];
  27257. const _hoisted_9 = {
  27258. id: "Illustrations",
  27259. stroke: "none",
  27260. "stroke-width": "1",
  27261. fill: "none",
  27262. "fill-rule": "evenodd"
  27263. };
  27264. const _hoisted_10 = {
  27265. id: "B-type",
  27266. transform: "translate(-1268.000000, -535.000000)"
  27267. };
  27268. const _hoisted_11 = {
  27269. id: "Group-2",
  27270. transform: "translate(1268.000000, 535.000000)"
  27271. };
  27272. const _hoisted_12 = ["fill"];
  27273. const _hoisted_13 = ["fill"];
  27274. const _hoisted_14 = {
  27275. id: "Group-Copy",
  27276. transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)"
  27277. };
  27278. const _hoisted_15 = ["fill"];
  27279. const _hoisted_16 = ["fill"];
  27280. const _hoisted_17 = ["fill"];
  27281. const _hoisted_18 = ["fill"];
  27282. const _hoisted_19 = ["fill"];
  27283. const _hoisted_20 = {
  27284. id: "Rectangle-Copy-17",
  27285. transform: "translate(53.000000, 45.000000)"
  27286. };
  27287. const _hoisted_21 = ["fill", "xlink:href"];
  27288. const _hoisted_22 = ["fill", "mask"];
  27289. const _hoisted_23 = ["fill"];
  27290. function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
  27291. return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$x, [
  27292. vue.createElementVNode("defs", null, [
  27293. vue.createElementVNode("linearGradient", {
  27294. id: `linearGradient-1-${_ctx.id}`,
  27295. x1: "38.8503086%",
  27296. y1: "0%",
  27297. x2: "61.1496914%",
  27298. y2: "100%"
  27299. }, [
  27300. vue.createElementVNode("stop", {
  27301. "stop-color": `var(${_ctx.ns.cssVarBlockName("fill-color-1")})`,
  27302. offset: "0%"
  27303. }, null, 8, _hoisted_3$8),
  27304. vue.createElementVNode("stop", {
  27305. "stop-color": `var(${_ctx.ns.cssVarBlockName("fill-color-4")})`,
  27306. offset: "100%"
  27307. }, null, 8, _hoisted_4$6)
  27308. ], 8, _hoisted_2$l),
  27309. vue.createElementVNode("linearGradient", {
  27310. id: `linearGradient-2-${_ctx.id}`,
  27311. x1: "0%",
  27312. y1: "9.5%",
  27313. x2: "100%",
  27314. y2: "90.5%"
  27315. }, [
  27316. vue.createElementVNode("stop", {
  27317. "stop-color": `var(${_ctx.ns.cssVarBlockName("fill-color-1")})`,
  27318. offset: "0%"
  27319. }, null, 8, _hoisted_6$1),
  27320. vue.createElementVNode("stop", {
  27321. "stop-color": `var(${_ctx.ns.cssVarBlockName("fill-color-6")})`,
  27322. offset: "100%"
  27323. }, null, 8, _hoisted_7)
  27324. ], 8, _hoisted_5$5),
  27325. vue.createElementVNode("rect", {
  27326. id: `path-3-${_ctx.id}`,
  27327. x: "0",
  27328. y: "0",
  27329. width: "17",
  27330. height: "36"
  27331. }, null, 8, _hoisted_8)
  27332. ]),
  27333. vue.createElementVNode("g", _hoisted_9, [
  27334. vue.createElementVNode("g", _hoisted_10, [
  27335. vue.createElementVNode("g", _hoisted_11, [
  27336. vue.createElementVNode("path", {
  27337. id: "Oval-Copy-2",
  27338. 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",
  27339. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-3")})`
  27340. }, null, 8, _hoisted_12),
  27341. vue.createElementVNode("polygon", {
  27342. id: "Rectangle-Copy-14",
  27343. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-7")})`,
  27344. transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",
  27345. points: "13 58 53 58 42 45 2 45"
  27346. }, null, 8, _hoisted_13),
  27347. vue.createElementVNode("g", _hoisted_14, [
  27348. vue.createElementVNode("polygon", {
  27349. id: "Rectangle-Copy-10",
  27350. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-7")})`,
  27351. transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",
  27352. points: "2.84078316e-14 3 18 3 23 7 5 7"
  27353. }, null, 8, _hoisted_15),
  27354. vue.createElementVNode("polygon", {
  27355. id: "Rectangle-Copy-11",
  27356. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-5")})`,
  27357. points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"
  27358. }, null, 8, _hoisted_16),
  27359. vue.createElementVNode("rect", {
  27360. id: "Rectangle-Copy-12",
  27361. fill: `url(#linearGradient-1-${_ctx.id})`,
  27362. transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",
  27363. x: "38",
  27364. y: "7",
  27365. width: "17",
  27366. height: "36"
  27367. }, null, 8, _hoisted_17),
  27368. vue.createElementVNode("polygon", {
  27369. id: "Rectangle-Copy-13",
  27370. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-2")})`,
  27371. transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",
  27372. points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"
  27373. }, null, 8, _hoisted_18)
  27374. ]),
  27375. vue.createElementVNode("rect", {
  27376. id: "Rectangle-Copy-15",
  27377. fill: `url(#linearGradient-2-${_ctx.id})`,
  27378. x: "13",
  27379. y: "45",
  27380. width: "40",
  27381. height: "36"
  27382. }, null, 8, _hoisted_19),
  27383. vue.createElementVNode("g", _hoisted_20, [
  27384. vue.createElementVNode("use", {
  27385. id: "Mask",
  27386. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-8")})`,
  27387. transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",
  27388. "xlink:href": `#path-3-${_ctx.id}`
  27389. }, null, 8, _hoisted_21),
  27390. vue.createElementVNode("polygon", {
  27391. id: "Rectangle-Copy",
  27392. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-9")})`,
  27393. mask: `url(#mask-4-${_ctx.id})`,
  27394. transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",
  27395. points: "7 0 24 0 20 18 7 16.5"
  27396. }, null, 8, _hoisted_22)
  27397. ]),
  27398. vue.createElementVNode("polygon", {
  27399. id: "Rectangle-Copy-18",
  27400. fill: `var(${_ctx.ns.cssVarBlockName("fill-color-2")})`,
  27401. transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",
  27402. points: "62 45 79 45 70 58 53 58"
  27403. }, null, 8, _hoisted_23)
  27404. ])
  27405. ])
  27406. ])
  27407. ]);
  27408. }
  27409. var ImgEmpty = /* @__PURE__ */ _export_sfc(_sfc_main$10, [["render", _sfc_render$f], ["__file", "img-empty.vue"]]);
  27410. const emptyProps = {
  27411. image: {
  27412. type: String,
  27413. default: ""
  27414. },
  27415. imageSize: Number,
  27416. description: {
  27417. type: String,
  27418. default: ""
  27419. }
  27420. };
  27421. const _hoisted_1$w = ["src"];
  27422. const _hoisted_2$k = { key: 1 };
  27423. const __default__$K = vue.defineComponent({
  27424. name: "ElEmpty"
  27425. });
  27426. const _sfc_main$$ = /* @__PURE__ */ vue.defineComponent({
  27427. ...__default__$K,
  27428. props: emptyProps,
  27429. setup(__props) {
  27430. const props = __props;
  27431. const { t } = useLocale();
  27432. const ns = useNamespace("empty");
  27433. const emptyDescription = vue.computed(() => props.description || t("el.table.emptyText"));
  27434. const imageStyle = vue.computed(() => ({
  27435. width: props.imageSize ? `${props.imageSize}px` : ""
  27436. }));
  27437. return (_ctx, _cache) => {
  27438. return vue.openBlock(), vue.createElementBlock("div", {
  27439. class: vue.normalizeClass(vue.unref(ns).b())
  27440. }, [
  27441. vue.createElementVNode("div", {
  27442. class: vue.normalizeClass(vue.unref(ns).e("image")),
  27443. style: vue.normalizeStyle(vue.unref(imageStyle))
  27444. }, [
  27445. _ctx.image ? (vue.openBlock(), vue.createElementBlock("img", {
  27446. key: 0,
  27447. src: _ctx.image,
  27448. ondragstart: "return false"
  27449. }, null, 8, _hoisted_1$w)) : vue.renderSlot(_ctx.$slots, "image", { key: 1 }, () => [
  27450. vue.createVNode(ImgEmpty)
  27451. ])
  27452. ], 6),
  27453. vue.createElementVNode("div", {
  27454. class: vue.normalizeClass(vue.unref(ns).e("description"))
  27455. }, [
  27456. _ctx.$slots.description ? vue.renderSlot(_ctx.$slots, "description", { key: 0 }) : (vue.openBlock(), vue.createElementBlock("p", _hoisted_2$k, vue.toDisplayString(vue.unref(emptyDescription)), 1))
  27457. ], 2),
  27458. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  27459. key: 0,
  27460. class: vue.normalizeClass(vue.unref(ns).e("bottom"))
  27461. }, [
  27462. vue.renderSlot(_ctx.$slots, "default")
  27463. ], 2)) : vue.createCommentVNode("v-if", true)
  27464. ], 2);
  27465. };
  27466. }
  27467. });
  27468. var Empty = /* @__PURE__ */ _export_sfc(_sfc_main$$, [["__file", "empty.vue"]]);
  27469. const ElEmpty = withInstall(Empty);
  27470. const formProps = buildProps({
  27471. model: Object,
  27472. rules: {
  27473. type: definePropType(Object)
  27474. },
  27475. labelPosition: {
  27476. type: String,
  27477. values: ["left", "right", "top"],
  27478. default: "right"
  27479. },
  27480. requireAsteriskPosition: {
  27481. type: String,
  27482. values: ["left", "right"],
  27483. default: "left"
  27484. },
  27485. labelWidth: {
  27486. type: [String, Number],
  27487. default: ""
  27488. },
  27489. labelSuffix: {
  27490. type: String,
  27491. default: ""
  27492. },
  27493. inline: Boolean,
  27494. inlineMessage: Boolean,
  27495. statusIcon: Boolean,
  27496. showMessage: {
  27497. type: Boolean,
  27498. default: true
  27499. },
  27500. size: {
  27501. type: String,
  27502. values: componentSizes
  27503. },
  27504. disabled: Boolean,
  27505. validateOnRuleChange: {
  27506. type: Boolean,
  27507. default: true
  27508. },
  27509. hideRequiredAsterisk: {
  27510. type: Boolean,
  27511. default: false
  27512. },
  27513. scrollToError: Boolean
  27514. });
  27515. const formEmits = {
  27516. validate: (prop, isValid, message) => (isArray(prop) || isString(prop)) && isBoolean(isValid) && isString(message)
  27517. };
  27518. function useFormLabelWidth() {
  27519. const potentialLabelWidthArr = vue.ref([]);
  27520. const autoLabelWidth = vue.computed(() => {
  27521. if (!potentialLabelWidthArr.value.length)
  27522. return "0";
  27523. const max = Math.max(...potentialLabelWidthArr.value);
  27524. return max ? `${max}px` : "";
  27525. });
  27526. function getLabelWidthIndex(width) {
  27527. const index = potentialLabelWidthArr.value.indexOf(width);
  27528. if (index === -1 && autoLabelWidth.value === "0") ;
  27529. return index;
  27530. }
  27531. function registerLabelWidth(val, oldVal) {
  27532. if (val && oldVal) {
  27533. const index = getLabelWidthIndex(oldVal);
  27534. potentialLabelWidthArr.value.splice(index, 1, val);
  27535. } else if (val) {
  27536. potentialLabelWidthArr.value.push(val);
  27537. }
  27538. }
  27539. function deregisterLabelWidth(val) {
  27540. const index = getLabelWidthIndex(val);
  27541. if (index > -1) {
  27542. potentialLabelWidthArr.value.splice(index, 1);
  27543. }
  27544. }
  27545. return {
  27546. autoLabelWidth,
  27547. registerLabelWidth,
  27548. deregisterLabelWidth
  27549. };
  27550. }
  27551. const filterFields = (fields, props) => {
  27552. const normalized = castArray$1(props);
  27553. return normalized.length > 0 ? fields.filter((field) => field.prop && normalized.includes(field.prop)) : fields;
  27554. };
  27555. const COMPONENT_NAME$e = "ElForm";
  27556. const __default__$J = vue.defineComponent({
  27557. name: COMPONENT_NAME$e
  27558. });
  27559. const _sfc_main$_ = /* @__PURE__ */ vue.defineComponent({
  27560. ...__default__$J,
  27561. props: formProps,
  27562. emits: formEmits,
  27563. setup(__props, { expose, emit }) {
  27564. const props = __props;
  27565. const fields = [];
  27566. const formSize = useSize();
  27567. const ns = useNamespace("form");
  27568. const formClasses = vue.computed(() => {
  27569. const { labelPosition, inline } = props;
  27570. return [
  27571. ns.b(),
  27572. ns.m(formSize.value || "default"),
  27573. {
  27574. [ns.m(`label-${labelPosition}`)]: labelPosition,
  27575. [ns.m("inline")]: inline
  27576. }
  27577. ];
  27578. });
  27579. const addField = (field) => {
  27580. fields.push(field);
  27581. };
  27582. const removeField = (field) => {
  27583. if (field.prop) {
  27584. fields.splice(fields.indexOf(field), 1);
  27585. }
  27586. };
  27587. const resetFields = (properties = []) => {
  27588. if (!props.model) {
  27589. return;
  27590. }
  27591. filterFields(fields, properties).forEach((field) => field.resetField());
  27592. };
  27593. const clearValidate = (props2 = []) => {
  27594. filterFields(fields, props2).forEach((field) => field.clearValidate());
  27595. };
  27596. const isValidatable = vue.computed(() => {
  27597. const hasModel = !!props.model;
  27598. return hasModel;
  27599. });
  27600. const obtainValidateFields = (props2) => {
  27601. if (fields.length === 0)
  27602. return [];
  27603. const filteredFields = filterFields(fields, props2);
  27604. if (!filteredFields.length) {
  27605. return [];
  27606. }
  27607. return filteredFields;
  27608. };
  27609. const validate = async (callback) => validateField(void 0, callback);
  27610. const doValidateField = async (props2 = []) => {
  27611. if (!isValidatable.value)
  27612. return false;
  27613. const fields2 = obtainValidateFields(props2);
  27614. if (fields2.length === 0)
  27615. return true;
  27616. let validationErrors = {};
  27617. for (const field of fields2) {
  27618. try {
  27619. await field.validate("");
  27620. } catch (fields3) {
  27621. validationErrors = {
  27622. ...validationErrors,
  27623. ...fields3
  27624. };
  27625. }
  27626. }
  27627. if (Object.keys(validationErrors).length === 0)
  27628. return true;
  27629. return Promise.reject(validationErrors);
  27630. };
  27631. const validateField = async (modelProps = [], callback) => {
  27632. const shouldThrow = !isFunction(callback);
  27633. try {
  27634. const result = await doValidateField(modelProps);
  27635. if (result === true) {
  27636. callback == null ? void 0 : callback(result);
  27637. }
  27638. return result;
  27639. } catch (e) {
  27640. if (e instanceof Error)
  27641. throw e;
  27642. const invalidFields = e;
  27643. if (props.scrollToError) {
  27644. scrollToField(Object.keys(invalidFields)[0]);
  27645. }
  27646. callback == null ? void 0 : callback(false, invalidFields);
  27647. return shouldThrow && Promise.reject(invalidFields);
  27648. }
  27649. };
  27650. const scrollToField = (prop) => {
  27651. var _a;
  27652. const field = filterFields(fields, prop)[0];
  27653. if (field) {
  27654. (_a = field.$el) == null ? void 0 : _a.scrollIntoView();
  27655. }
  27656. };
  27657. vue.watch(() => props.rules, () => {
  27658. if (props.validateOnRuleChange) {
  27659. validate().catch((err) => debugWarn());
  27660. }
  27661. }, { deep: true });
  27662. vue.provide(formContextKey, vue.reactive({
  27663. ...vue.toRefs(props),
  27664. emit,
  27665. resetFields,
  27666. clearValidate,
  27667. validateField,
  27668. addField,
  27669. removeField,
  27670. ...useFormLabelWidth()
  27671. }));
  27672. expose({
  27673. validate,
  27674. validateField,
  27675. resetFields,
  27676. clearValidate,
  27677. scrollToField
  27678. });
  27679. return (_ctx, _cache) => {
  27680. return vue.openBlock(), vue.createElementBlock("form", {
  27681. class: vue.normalizeClass(vue.unref(formClasses))
  27682. }, [
  27683. vue.renderSlot(_ctx.$slots, "default")
  27684. ], 2);
  27685. };
  27686. }
  27687. });
  27688. var Form = /* @__PURE__ */ _export_sfc(_sfc_main$_, [["__file", "form.vue"]]);
  27689. function _extends() {
  27690. _extends = Object.assign ? Object.assign.bind() : function(target) {
  27691. for (var i = 1; i < arguments.length; i++) {
  27692. var source = arguments[i];
  27693. for (var key in source) {
  27694. if (Object.prototype.hasOwnProperty.call(source, key)) {
  27695. target[key] = source[key];
  27696. }
  27697. }
  27698. }
  27699. return target;
  27700. };
  27701. return _extends.apply(this, arguments);
  27702. }
  27703. function _inheritsLoose(subClass, superClass) {
  27704. subClass.prototype = Object.create(superClass.prototype);
  27705. subClass.prototype.constructor = subClass;
  27706. _setPrototypeOf(subClass, superClass);
  27707. }
  27708. function _getPrototypeOf(o) {
  27709. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
  27710. return o2.__proto__ || Object.getPrototypeOf(o2);
  27711. };
  27712. return _getPrototypeOf(o);
  27713. }
  27714. function _setPrototypeOf(o, p) {
  27715. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
  27716. o2.__proto__ = p2;
  27717. return o2;
  27718. };
  27719. return _setPrototypeOf(o, p);
  27720. }
  27721. function _isNativeReflectConstruct() {
  27722. if (typeof Reflect === "undefined" || !Reflect.construct)
  27723. return false;
  27724. if (Reflect.construct.sham)
  27725. return false;
  27726. if (typeof Proxy === "function")
  27727. return true;
  27728. try {
  27729. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  27730. }));
  27731. return true;
  27732. } catch (e) {
  27733. return false;
  27734. }
  27735. }
  27736. function _construct(Parent, args, Class) {
  27737. if (_isNativeReflectConstruct()) {
  27738. _construct = Reflect.construct.bind();
  27739. } else {
  27740. _construct = function _construct2(Parent2, args2, Class2) {
  27741. var a = [null];
  27742. a.push.apply(a, args2);
  27743. var Constructor = Function.bind.apply(Parent2, a);
  27744. var instance = new Constructor();
  27745. if (Class2)
  27746. _setPrototypeOf(instance, Class2.prototype);
  27747. return instance;
  27748. };
  27749. }
  27750. return _construct.apply(null, arguments);
  27751. }
  27752. function _isNativeFunction(fn) {
  27753. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  27754. }
  27755. function _wrapNativeSuper(Class) {
  27756. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  27757. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  27758. if (Class2 === null || !_isNativeFunction(Class2))
  27759. return Class2;
  27760. if (typeof Class2 !== "function") {
  27761. throw new TypeError("Super expression must either be null or a function");
  27762. }
  27763. if (typeof _cache !== "undefined") {
  27764. if (_cache.has(Class2))
  27765. return _cache.get(Class2);
  27766. _cache.set(Class2, Wrapper);
  27767. }
  27768. function Wrapper() {
  27769. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  27770. }
  27771. Wrapper.prototype = Object.create(Class2.prototype, {
  27772. constructor: {
  27773. value: Wrapper,
  27774. enumerable: false,
  27775. writable: true,
  27776. configurable: true
  27777. }
  27778. });
  27779. return _setPrototypeOf(Wrapper, Class2);
  27780. };
  27781. return _wrapNativeSuper(Class);
  27782. }
  27783. var formatRegExp = /%[sdj%]/g;
  27784. var warning = function warning2() {
  27785. };
  27786. if (typeof process !== "undefined" && process.env && false) {
  27787. warning = function warning3(type4, errors) {
  27788. if (typeof console !== "undefined" && console.warn && typeof ASYNC_VALIDATOR_NO_WARNING === "undefined") {
  27789. if (errors.every(function(e) {
  27790. return typeof e === "string";
  27791. })) {
  27792. console.warn(type4, errors);
  27793. }
  27794. }
  27795. };
  27796. }
  27797. function convertFieldsError(errors) {
  27798. if (!errors || !errors.length)
  27799. return null;
  27800. var fields = {};
  27801. errors.forEach(function(error) {
  27802. var field = error.field;
  27803. fields[field] = fields[field] || [];
  27804. fields[field].push(error);
  27805. });
  27806. return fields;
  27807. }
  27808. function format(template) {
  27809. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  27810. args[_key - 1] = arguments[_key];
  27811. }
  27812. var i = 0;
  27813. var len = args.length;
  27814. if (typeof template === "function") {
  27815. return template.apply(null, args);
  27816. }
  27817. if (typeof template === "string") {
  27818. var str = template.replace(formatRegExp, function(x) {
  27819. if (x === "%%") {
  27820. return "%";
  27821. }
  27822. if (i >= len) {
  27823. return x;
  27824. }
  27825. switch (x) {
  27826. case "%s":
  27827. return String(args[i++]);
  27828. case "%d":
  27829. return Number(args[i++]);
  27830. case "%j":
  27831. try {
  27832. return JSON.stringify(args[i++]);
  27833. } catch (_) {
  27834. return "[Circular]";
  27835. }
  27836. break;
  27837. default:
  27838. return x;
  27839. }
  27840. });
  27841. return str;
  27842. }
  27843. return template;
  27844. }
  27845. function isNativeStringType(type4) {
  27846. return type4 === "string" || type4 === "url" || type4 === "hex" || type4 === "email" || type4 === "date" || type4 === "pattern";
  27847. }
  27848. function isEmptyValue(value, type4) {
  27849. if (value === void 0 || value === null) {
  27850. return true;
  27851. }
  27852. if (type4 === "array" && Array.isArray(value) && !value.length) {
  27853. return true;
  27854. }
  27855. if (isNativeStringType(type4) && typeof value === "string" && !value) {
  27856. return true;
  27857. }
  27858. return false;
  27859. }
  27860. function asyncParallelArray(arr, func, callback) {
  27861. var results = [];
  27862. var total = 0;
  27863. var arrLength = arr.length;
  27864. function count(errors) {
  27865. results.push.apply(results, errors || []);
  27866. total++;
  27867. if (total === arrLength) {
  27868. callback(results);
  27869. }
  27870. }
  27871. arr.forEach(function(a) {
  27872. func(a, count);
  27873. });
  27874. }
  27875. function asyncSerialArray(arr, func, callback) {
  27876. var index = 0;
  27877. var arrLength = arr.length;
  27878. function next(errors) {
  27879. if (errors && errors.length) {
  27880. callback(errors);
  27881. return;
  27882. }
  27883. var original = index;
  27884. index = index + 1;
  27885. if (original < arrLength) {
  27886. func(arr[original], next);
  27887. } else {
  27888. callback([]);
  27889. }
  27890. }
  27891. next([]);
  27892. }
  27893. function flattenObjArr(objArr) {
  27894. var ret = [];
  27895. Object.keys(objArr).forEach(function(k) {
  27896. ret.push.apply(ret, objArr[k] || []);
  27897. });
  27898. return ret;
  27899. }
  27900. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  27901. _inheritsLoose(AsyncValidationError2, _Error);
  27902. function AsyncValidationError2(errors, fields) {
  27903. var _this;
  27904. _this = _Error.call(this, "Async Validation Error") || this;
  27905. _this.errors = errors;
  27906. _this.fields = fields;
  27907. return _this;
  27908. }
  27909. return AsyncValidationError2;
  27910. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  27911. function asyncMap(objArr, option, func, callback, source) {
  27912. if (option.first) {
  27913. var _pending = new Promise(function(resolve, reject) {
  27914. var next = function next2(errors) {
  27915. callback(errors);
  27916. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  27917. };
  27918. var flattenArr = flattenObjArr(objArr);
  27919. asyncSerialArray(flattenArr, func, next);
  27920. });
  27921. _pending["catch"](function(e) {
  27922. return e;
  27923. });
  27924. return _pending;
  27925. }
  27926. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  27927. var objArrKeys = Object.keys(objArr);
  27928. var objArrLength = objArrKeys.length;
  27929. var total = 0;
  27930. var results = [];
  27931. var pending = new Promise(function(resolve, reject) {
  27932. var next = function next2(errors) {
  27933. results.push.apply(results, errors);
  27934. total++;
  27935. if (total === objArrLength) {
  27936. callback(results);
  27937. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  27938. }
  27939. };
  27940. if (!objArrKeys.length) {
  27941. callback(results);
  27942. resolve(source);
  27943. }
  27944. objArrKeys.forEach(function(key) {
  27945. var arr = objArr[key];
  27946. if (firstFields.indexOf(key) !== -1) {
  27947. asyncSerialArray(arr, func, next);
  27948. } else {
  27949. asyncParallelArray(arr, func, next);
  27950. }
  27951. });
  27952. });
  27953. pending["catch"](function(e) {
  27954. return e;
  27955. });
  27956. return pending;
  27957. }
  27958. function isErrorObj(obj) {
  27959. return !!(obj && obj.message !== void 0);
  27960. }
  27961. function getValue(value, path) {
  27962. var v = value;
  27963. for (var i = 0; i < path.length; i++) {
  27964. if (v == void 0) {
  27965. return v;
  27966. }
  27967. v = v[path[i]];
  27968. }
  27969. return v;
  27970. }
  27971. function complementError(rule, source) {
  27972. return function(oe) {
  27973. var fieldValue;
  27974. if (rule.fullFields) {
  27975. fieldValue = getValue(source, rule.fullFields);
  27976. } else {
  27977. fieldValue = source[oe.field || rule.fullField];
  27978. }
  27979. if (isErrorObj(oe)) {
  27980. oe.field = oe.field || rule.fullField;
  27981. oe.fieldValue = fieldValue;
  27982. return oe;
  27983. }
  27984. return {
  27985. message: typeof oe === "function" ? oe() : oe,
  27986. fieldValue,
  27987. field: oe.field || rule.fullField
  27988. };
  27989. };
  27990. }
  27991. function deepMerge(target, source) {
  27992. if (source) {
  27993. for (var s in source) {
  27994. if (source.hasOwnProperty(s)) {
  27995. var value = source[s];
  27996. if (typeof value === "object" && typeof target[s] === "object") {
  27997. target[s] = _extends({}, target[s], value);
  27998. } else {
  27999. target[s] = value;
  28000. }
  28001. }
  28002. }
  28003. }
  28004. return target;
  28005. }
  28006. var required$1 = function required(rule, value, source, errors, options, type4) {
  28007. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type4 || rule.type))) {
  28008. errors.push(format(options.messages.required, rule.fullField));
  28009. }
  28010. };
  28011. var whitespace = function whitespace2(rule, value, source, errors, options) {
  28012. if (/^\s+$/.test(value) || value === "") {
  28013. errors.push(format(options.messages.whitespace, rule.fullField));
  28014. }
  28015. };
  28016. var urlReg;
  28017. var getUrlRegex = function() {
  28018. if (urlReg) {
  28019. return urlReg;
  28020. }
  28021. var word = "[a-fA-F\\d:]";
  28022. var b = function b2(options) {
  28023. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  28024. };
  28025. 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}";
  28026. var v6seg = "[a-fA-F\\d]{1,4}";
  28027. 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();
  28028. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  28029. var v4exact = new RegExp("^" + v4 + "$");
  28030. var v6exact = new RegExp("^" + v6 + "$");
  28031. var ip = function ip2(options) {
  28032. return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g");
  28033. };
  28034. ip.v4 = function(options) {
  28035. return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g");
  28036. };
  28037. ip.v6 = function(options) {
  28038. return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g");
  28039. };
  28040. var protocol = "(?:(?:[a-z]+:)?//)";
  28041. var auth = "(?:\\S+(?::\\S*)?@)?";
  28042. var ipv4 = ip.v4().source;
  28043. var ipv6 = ip.v6().source;
  28044. var host = "(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)";
  28045. var domain = "(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*";
  28046. var tld = "(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))";
  28047. var port = "(?::\\d{2,5})?";
  28048. var path = '(?:[/?#][^\\s"]*)?';
  28049. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|" + host + domain + tld + ")" + port + path;
  28050. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  28051. return urlReg;
  28052. };
  28053. var pattern$2 = {
  28054. 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,}))$/,
  28055. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  28056. };
  28057. var types = {
  28058. integer: function integer(value) {
  28059. return types.number(value) && parseInt(value, 10) === value;
  28060. },
  28061. "float": function float(value) {
  28062. return types.number(value) && !types.integer(value);
  28063. },
  28064. array: function array(value) {
  28065. return Array.isArray(value);
  28066. },
  28067. regexp: function regexp(value) {
  28068. if (value instanceof RegExp) {
  28069. return true;
  28070. }
  28071. try {
  28072. return !!new RegExp(value);
  28073. } catch (e) {
  28074. return false;
  28075. }
  28076. },
  28077. date: function date(value) {
  28078. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  28079. },
  28080. number: function number(value) {
  28081. if (isNaN(value)) {
  28082. return false;
  28083. }
  28084. return typeof value === "number";
  28085. },
  28086. object: function object(value) {
  28087. return typeof value === "object" && !types.array(value);
  28088. },
  28089. method: function method(value) {
  28090. return typeof value === "function";
  28091. },
  28092. email: function email(value) {
  28093. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  28094. },
  28095. url: function url(value) {
  28096. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  28097. },
  28098. hex: function hex(value) {
  28099. return typeof value === "string" && !!value.match(pattern$2.hex);
  28100. }
  28101. };
  28102. var type$1 = function type(rule, value, source, errors, options) {
  28103. if (rule.required && value === void 0) {
  28104. required$1(rule, value, source, errors, options);
  28105. return;
  28106. }
  28107. var custom = ["integer", "float", "array", "regexp", "object", "method", "email", "number", "date", "url", "hex"];
  28108. var ruleType = rule.type;
  28109. if (custom.indexOf(ruleType) > -1) {
  28110. if (!types[ruleType](value)) {
  28111. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  28112. }
  28113. } else if (ruleType && typeof value !== rule.type) {
  28114. errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  28115. }
  28116. };
  28117. var range = function range2(rule, value, source, errors, options) {
  28118. var len = typeof rule.len === "number";
  28119. var min = typeof rule.min === "number";
  28120. var max = typeof rule.max === "number";
  28121. var spRegexp = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  28122. var val = value;
  28123. var key = null;
  28124. var num = typeof value === "number";
  28125. var str = typeof value === "string";
  28126. var arr = Array.isArray(value);
  28127. if (num) {
  28128. key = "number";
  28129. } else if (str) {
  28130. key = "string";
  28131. } else if (arr) {
  28132. key = "array";
  28133. }
  28134. if (!key) {
  28135. return false;
  28136. }
  28137. if (arr) {
  28138. val = value.length;
  28139. }
  28140. if (str) {
  28141. val = value.replace(spRegexp, "_").length;
  28142. }
  28143. if (len) {
  28144. if (val !== rule.len) {
  28145. errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  28146. }
  28147. } else if (min && !max && val < rule.min) {
  28148. errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  28149. } else if (max && !min && val > rule.max) {
  28150. errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  28151. } else if (min && max && (val < rule.min || val > rule.max)) {
  28152. errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  28153. }
  28154. };
  28155. var ENUM$1 = "enum";
  28156. var enumerable$1 = function enumerable(rule, value, source, errors, options) {
  28157. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  28158. if (rule[ENUM$1].indexOf(value) === -1) {
  28159. errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  28160. }
  28161. };
  28162. var pattern$1 = function pattern(rule, value, source, errors, options) {
  28163. if (rule.pattern) {
  28164. if (rule.pattern instanceof RegExp) {
  28165. rule.pattern.lastIndex = 0;
  28166. if (!rule.pattern.test(value)) {
  28167. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  28168. }
  28169. } else if (typeof rule.pattern === "string") {
  28170. var _pattern = new RegExp(rule.pattern);
  28171. if (!_pattern.test(value)) {
  28172. errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  28173. }
  28174. }
  28175. }
  28176. };
  28177. var rules = {
  28178. required: required$1,
  28179. whitespace,
  28180. type: type$1,
  28181. range,
  28182. "enum": enumerable$1,
  28183. pattern: pattern$1
  28184. };
  28185. var string = function string2(rule, value, callback, source, options) {
  28186. var errors = [];
  28187. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28188. if (validate) {
  28189. if (isEmptyValue(value, "string") && !rule.required) {
  28190. return callback();
  28191. }
  28192. rules.required(rule, value, source, errors, options, "string");
  28193. if (!isEmptyValue(value, "string")) {
  28194. rules.type(rule, value, source, errors, options);
  28195. rules.range(rule, value, source, errors, options);
  28196. rules.pattern(rule, value, source, errors, options);
  28197. if (rule.whitespace === true) {
  28198. rules.whitespace(rule, value, source, errors, options);
  28199. }
  28200. }
  28201. }
  28202. callback(errors);
  28203. };
  28204. var method2 = function method3(rule, value, callback, source, options) {
  28205. var errors = [];
  28206. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28207. if (validate) {
  28208. if (isEmptyValue(value) && !rule.required) {
  28209. return callback();
  28210. }
  28211. rules.required(rule, value, source, errors, options);
  28212. if (value !== void 0) {
  28213. rules.type(rule, value, source, errors, options);
  28214. }
  28215. }
  28216. callback(errors);
  28217. };
  28218. var number2 = function number3(rule, value, callback, source, options) {
  28219. var errors = [];
  28220. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28221. if (validate) {
  28222. if (value === "") {
  28223. value = void 0;
  28224. }
  28225. if (isEmptyValue(value) && !rule.required) {
  28226. return callback();
  28227. }
  28228. rules.required(rule, value, source, errors, options);
  28229. if (value !== void 0) {
  28230. rules.type(rule, value, source, errors, options);
  28231. rules.range(rule, value, source, errors, options);
  28232. }
  28233. }
  28234. callback(errors);
  28235. };
  28236. var _boolean = function _boolean2(rule, value, callback, source, options) {
  28237. var errors = [];
  28238. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28239. if (validate) {
  28240. if (isEmptyValue(value) && !rule.required) {
  28241. return callback();
  28242. }
  28243. rules.required(rule, value, source, errors, options);
  28244. if (value !== void 0) {
  28245. rules.type(rule, value, source, errors, options);
  28246. }
  28247. }
  28248. callback(errors);
  28249. };
  28250. var regexp2 = function regexp3(rule, value, callback, source, options) {
  28251. var errors = [];
  28252. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28253. if (validate) {
  28254. if (isEmptyValue(value) && !rule.required) {
  28255. return callback();
  28256. }
  28257. rules.required(rule, value, source, errors, options);
  28258. if (!isEmptyValue(value)) {
  28259. rules.type(rule, value, source, errors, options);
  28260. }
  28261. }
  28262. callback(errors);
  28263. };
  28264. var integer2 = function integer3(rule, value, callback, source, options) {
  28265. var errors = [];
  28266. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28267. if (validate) {
  28268. if (isEmptyValue(value) && !rule.required) {
  28269. return callback();
  28270. }
  28271. rules.required(rule, value, source, errors, options);
  28272. if (value !== void 0) {
  28273. rules.type(rule, value, source, errors, options);
  28274. rules.range(rule, value, source, errors, options);
  28275. }
  28276. }
  28277. callback(errors);
  28278. };
  28279. var floatFn = function floatFn2(rule, value, callback, source, options) {
  28280. var errors = [];
  28281. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28282. if (validate) {
  28283. if (isEmptyValue(value) && !rule.required) {
  28284. return callback();
  28285. }
  28286. rules.required(rule, value, source, errors, options);
  28287. if (value !== void 0) {
  28288. rules.type(rule, value, source, errors, options);
  28289. rules.range(rule, value, source, errors, options);
  28290. }
  28291. }
  28292. callback(errors);
  28293. };
  28294. var array2 = function array3(rule, value, callback, source, options) {
  28295. var errors = [];
  28296. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28297. if (validate) {
  28298. if ((value === void 0 || value === null) && !rule.required) {
  28299. return callback();
  28300. }
  28301. rules.required(rule, value, source, errors, options, "array");
  28302. if (value !== void 0 && value !== null) {
  28303. rules.type(rule, value, source, errors, options);
  28304. rules.range(rule, value, source, errors, options);
  28305. }
  28306. }
  28307. callback(errors);
  28308. };
  28309. var object2 = function object3(rule, value, callback, source, options) {
  28310. var errors = [];
  28311. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28312. if (validate) {
  28313. if (isEmptyValue(value) && !rule.required) {
  28314. return callback();
  28315. }
  28316. rules.required(rule, value, source, errors, options);
  28317. if (value !== void 0) {
  28318. rules.type(rule, value, source, errors, options);
  28319. }
  28320. }
  28321. callback(errors);
  28322. };
  28323. var ENUM = "enum";
  28324. var enumerable2 = function enumerable3(rule, value, callback, source, options) {
  28325. var errors = [];
  28326. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28327. if (validate) {
  28328. if (isEmptyValue(value) && !rule.required) {
  28329. return callback();
  28330. }
  28331. rules.required(rule, value, source, errors, options);
  28332. if (value !== void 0) {
  28333. rules[ENUM](rule, value, source, errors, options);
  28334. }
  28335. }
  28336. callback(errors);
  28337. };
  28338. var pattern2 = function pattern3(rule, value, callback, source, options) {
  28339. var errors = [];
  28340. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28341. if (validate) {
  28342. if (isEmptyValue(value, "string") && !rule.required) {
  28343. return callback();
  28344. }
  28345. rules.required(rule, value, source, errors, options);
  28346. if (!isEmptyValue(value, "string")) {
  28347. rules.pattern(rule, value, source, errors, options);
  28348. }
  28349. }
  28350. callback(errors);
  28351. };
  28352. var date2 = function date3(rule, value, callback, source, options) {
  28353. var errors = [];
  28354. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28355. if (validate) {
  28356. if (isEmptyValue(value, "date") && !rule.required) {
  28357. return callback();
  28358. }
  28359. rules.required(rule, value, source, errors, options);
  28360. if (!isEmptyValue(value, "date")) {
  28361. var dateObject;
  28362. if (value instanceof Date) {
  28363. dateObject = value;
  28364. } else {
  28365. dateObject = new Date(value);
  28366. }
  28367. rules.type(rule, dateObject, source, errors, options);
  28368. if (dateObject) {
  28369. rules.range(rule, dateObject.getTime(), source, errors, options);
  28370. }
  28371. }
  28372. }
  28373. callback(errors);
  28374. };
  28375. var required2 = function required3(rule, value, callback, source, options) {
  28376. var errors = [];
  28377. var type4 = Array.isArray(value) ? "array" : typeof value;
  28378. rules.required(rule, value, source, errors, options, type4);
  28379. callback(errors);
  28380. };
  28381. var type2 = function type3(rule, value, callback, source, options) {
  28382. var ruleType = rule.type;
  28383. var errors = [];
  28384. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28385. if (validate) {
  28386. if (isEmptyValue(value, ruleType) && !rule.required) {
  28387. return callback();
  28388. }
  28389. rules.required(rule, value, source, errors, options, ruleType);
  28390. if (!isEmptyValue(value, ruleType)) {
  28391. rules.type(rule, value, source, errors, options);
  28392. }
  28393. }
  28394. callback(errors);
  28395. };
  28396. var any = function any2(rule, value, callback, source, options) {
  28397. var errors = [];
  28398. var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
  28399. if (validate) {
  28400. if (isEmptyValue(value) && !rule.required) {
  28401. return callback();
  28402. }
  28403. rules.required(rule, value, source, errors, options);
  28404. }
  28405. callback(errors);
  28406. };
  28407. var validators = {
  28408. string,
  28409. method: method2,
  28410. number: number2,
  28411. "boolean": _boolean,
  28412. regexp: regexp2,
  28413. integer: integer2,
  28414. "float": floatFn,
  28415. array: array2,
  28416. object: object2,
  28417. "enum": enumerable2,
  28418. pattern: pattern2,
  28419. date: date2,
  28420. url: type2,
  28421. hex: type2,
  28422. email: type2,
  28423. required: required2,
  28424. any
  28425. };
  28426. function newMessages() {
  28427. return {
  28428. "default": "Validation error on field %s",
  28429. required: "%s is required",
  28430. "enum": "%s must be one of %s",
  28431. whitespace: "%s cannot be empty",
  28432. date: {
  28433. format: "%s date %s is invalid for format %s",
  28434. parse: "%s date could not be parsed, %s is invalid ",
  28435. invalid: "%s date %s is invalid"
  28436. },
  28437. types: {
  28438. string: "%s is not a %s",
  28439. method: "%s is not a %s (function)",
  28440. array: "%s is not an %s",
  28441. object: "%s is not an %s",
  28442. number: "%s is not a %s",
  28443. date: "%s is not a %s",
  28444. "boolean": "%s is not a %s",
  28445. integer: "%s is not an %s",
  28446. "float": "%s is not a %s",
  28447. regexp: "%s is not a valid %s",
  28448. email: "%s is not a valid %s",
  28449. url: "%s is not a valid %s",
  28450. hex: "%s is not a valid %s"
  28451. },
  28452. string: {
  28453. len: "%s must be exactly %s characters",
  28454. min: "%s must be at least %s characters",
  28455. max: "%s cannot be longer than %s characters",
  28456. range: "%s must be between %s and %s characters"
  28457. },
  28458. number: {
  28459. len: "%s must equal %s",
  28460. min: "%s cannot be less than %s",
  28461. max: "%s cannot be greater than %s",
  28462. range: "%s must be between %s and %s"
  28463. },
  28464. array: {
  28465. len: "%s must be exactly %s in length",
  28466. min: "%s cannot be less than %s in length",
  28467. max: "%s cannot be greater than %s in length",
  28468. range: "%s must be between %s and %s in length"
  28469. },
  28470. pattern: {
  28471. mismatch: "%s value %s does not match pattern %s"
  28472. },
  28473. clone: function clone() {
  28474. var cloned = JSON.parse(JSON.stringify(this));
  28475. cloned.clone = this.clone;
  28476. return cloned;
  28477. }
  28478. };
  28479. }
  28480. var messages = newMessages();
  28481. var Schema = /* @__PURE__ */ function() {
  28482. function Schema2(descriptor) {
  28483. this.rules = null;
  28484. this._messages = messages;
  28485. this.define(descriptor);
  28486. }
  28487. var _proto = Schema2.prototype;
  28488. _proto.define = function define(rules2) {
  28489. var _this = this;
  28490. if (!rules2) {
  28491. throw new Error("Cannot configure a schema with no rules");
  28492. }
  28493. if (typeof rules2 !== "object" || Array.isArray(rules2)) {
  28494. throw new Error("Rules must be an object");
  28495. }
  28496. this.rules = {};
  28497. Object.keys(rules2).forEach(function(name) {
  28498. var item = rules2[name];
  28499. _this.rules[name] = Array.isArray(item) ? item : [item];
  28500. });
  28501. };
  28502. _proto.messages = function messages2(_messages) {
  28503. if (_messages) {
  28504. this._messages = deepMerge(newMessages(), _messages);
  28505. }
  28506. return this._messages;
  28507. };
  28508. _proto.validate = function validate(source_, o, oc) {
  28509. var _this2 = this;
  28510. if (o === void 0) {
  28511. o = {};
  28512. }
  28513. if (oc === void 0) {
  28514. oc = function oc2() {
  28515. };
  28516. }
  28517. var source = source_;
  28518. var options = o;
  28519. var callback = oc;
  28520. if (typeof options === "function") {
  28521. callback = options;
  28522. options = {};
  28523. }
  28524. if (!this.rules || Object.keys(this.rules).length === 0) {
  28525. if (callback) {
  28526. callback(null, source);
  28527. }
  28528. return Promise.resolve(source);
  28529. }
  28530. function complete(results) {
  28531. var errors = [];
  28532. var fields = {};
  28533. function add(e) {
  28534. if (Array.isArray(e)) {
  28535. var _errors;
  28536. errors = (_errors = errors).concat.apply(_errors, e);
  28537. } else {
  28538. errors.push(e);
  28539. }
  28540. }
  28541. for (var i = 0; i < results.length; i++) {
  28542. add(results[i]);
  28543. }
  28544. if (!errors.length) {
  28545. callback(null, source);
  28546. } else {
  28547. fields = convertFieldsError(errors);
  28548. callback(errors, fields);
  28549. }
  28550. }
  28551. if (options.messages) {
  28552. var messages$1 = this.messages();
  28553. if (messages$1 === messages) {
  28554. messages$1 = newMessages();
  28555. }
  28556. deepMerge(messages$1, options.messages);
  28557. options.messages = messages$1;
  28558. } else {
  28559. options.messages = this.messages();
  28560. }
  28561. var series = {};
  28562. var keys = options.keys || Object.keys(this.rules);
  28563. keys.forEach(function(z) {
  28564. var arr = _this2.rules[z];
  28565. var value = source[z];
  28566. arr.forEach(function(r) {
  28567. var rule = r;
  28568. if (typeof rule.transform === "function") {
  28569. if (source === source_) {
  28570. source = _extends({}, source);
  28571. }
  28572. value = source[z] = rule.transform(value);
  28573. }
  28574. if (typeof rule === "function") {
  28575. rule = {
  28576. validator: rule
  28577. };
  28578. } else {
  28579. rule = _extends({}, rule);
  28580. }
  28581. rule.validator = _this2.getValidationMethod(rule);
  28582. if (!rule.validator) {
  28583. return;
  28584. }
  28585. rule.field = z;
  28586. rule.fullField = rule.fullField || z;
  28587. rule.type = _this2.getType(rule);
  28588. series[z] = series[z] || [];
  28589. series[z].push({
  28590. rule,
  28591. value,
  28592. source,
  28593. field: z
  28594. });
  28595. });
  28596. });
  28597. var errorFields = {};
  28598. return asyncMap(series, options, function(data, doIt) {
  28599. var rule = data.rule;
  28600. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  28601. deep = deep && (rule.required || !rule.required && data.value);
  28602. rule.field = data.field;
  28603. function addFullField(key, schema) {
  28604. return _extends({}, schema, {
  28605. fullField: rule.fullField + "." + key,
  28606. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  28607. });
  28608. }
  28609. function cb(e) {
  28610. if (e === void 0) {
  28611. e = [];
  28612. }
  28613. var errorList = Array.isArray(e) ? e : [e];
  28614. if (!options.suppressWarning && errorList.length) {
  28615. Schema2.warning("async-validator:", errorList);
  28616. }
  28617. if (errorList.length && rule.message !== void 0) {
  28618. errorList = [].concat(rule.message);
  28619. }
  28620. var filledErrors = errorList.map(complementError(rule, source));
  28621. if (options.first && filledErrors.length) {
  28622. errorFields[rule.field] = 1;
  28623. return doIt(filledErrors);
  28624. }
  28625. if (!deep) {
  28626. doIt(filledErrors);
  28627. } else {
  28628. if (rule.required && !data.value) {
  28629. if (rule.message !== void 0) {
  28630. filledErrors = [].concat(rule.message).map(complementError(rule, source));
  28631. } else if (options.error) {
  28632. filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  28633. }
  28634. return doIt(filledErrors);
  28635. }
  28636. var fieldsSchema = {};
  28637. if (rule.defaultField) {
  28638. Object.keys(data.value).map(function(key) {
  28639. fieldsSchema[key] = rule.defaultField;
  28640. });
  28641. }
  28642. fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
  28643. var paredFieldsSchema = {};
  28644. Object.keys(fieldsSchema).forEach(function(field) {
  28645. var fieldSchema = fieldsSchema[field];
  28646. var fieldSchemaList = Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema];
  28647. paredFieldsSchema[field] = fieldSchemaList.map(addFullField.bind(null, field));
  28648. });
  28649. var schema = new Schema2(paredFieldsSchema);
  28650. schema.messages(options.messages);
  28651. if (data.rule.options) {
  28652. data.rule.options.messages = options.messages;
  28653. data.rule.options.error = options.error;
  28654. }
  28655. schema.validate(data.value, data.rule.options || options, function(errs) {
  28656. var finalErrors = [];
  28657. if (filledErrors && filledErrors.length) {
  28658. finalErrors.push.apply(finalErrors, filledErrors);
  28659. }
  28660. if (errs && errs.length) {
  28661. finalErrors.push.apply(finalErrors, errs);
  28662. }
  28663. doIt(finalErrors.length ? finalErrors : null);
  28664. });
  28665. }
  28666. }
  28667. var res;
  28668. if (rule.asyncValidator) {
  28669. res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  28670. } else if (rule.validator) {
  28671. try {
  28672. res = rule.validator(rule, data.value, cb, data.source, options);
  28673. } catch (error) {
  28674. console.error == null ? void 0 : console.error(error);
  28675. if (!options.suppressValidatorError) {
  28676. setTimeout(function() {
  28677. throw error;
  28678. }, 0);
  28679. }
  28680. cb(error.message);
  28681. }
  28682. if (res === true) {
  28683. cb();
  28684. } else if (res === false) {
  28685. cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  28686. } else if (res instanceof Array) {
  28687. cb(res);
  28688. } else if (res instanceof Error) {
  28689. cb(res.message);
  28690. }
  28691. }
  28692. if (res && res.then) {
  28693. res.then(function() {
  28694. return cb();
  28695. }, function(e) {
  28696. return cb(e);
  28697. });
  28698. }
  28699. }, function(results) {
  28700. complete(results);
  28701. }, source);
  28702. };
  28703. _proto.getType = function getType(rule) {
  28704. if (rule.type === void 0 && rule.pattern instanceof RegExp) {
  28705. rule.type = "pattern";
  28706. }
  28707. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) {
  28708. throw new Error(format("Unknown rule type %s", rule.type));
  28709. }
  28710. return rule.type || "string";
  28711. };
  28712. _proto.getValidationMethod = function getValidationMethod(rule) {
  28713. if (typeof rule.validator === "function") {
  28714. return rule.validator;
  28715. }
  28716. var keys = Object.keys(rule);
  28717. var messageIndex = keys.indexOf("message");
  28718. if (messageIndex !== -1) {
  28719. keys.splice(messageIndex, 1);
  28720. }
  28721. if (keys.length === 1 && keys[0] === "required") {
  28722. return validators.required;
  28723. }
  28724. return validators[this.getType(rule)] || void 0;
  28725. };
  28726. return Schema2;
  28727. }();
  28728. Schema.register = function register(type4, validator) {
  28729. if (typeof validator !== "function") {
  28730. throw new Error("Cannot register a validator by type, validator is not a function");
  28731. }
  28732. validators[type4] = validator;
  28733. };
  28734. Schema.warning = warning;
  28735. Schema.messages = messages;
  28736. Schema.validators = validators;
  28737. const formItemValidateStates = [
  28738. "",
  28739. "error",
  28740. "validating",
  28741. "success"
  28742. ];
  28743. const formItemProps = buildProps({
  28744. label: String,
  28745. labelWidth: {
  28746. type: [String, Number],
  28747. default: ""
  28748. },
  28749. prop: {
  28750. type: definePropType([String, Array])
  28751. },
  28752. required: {
  28753. type: Boolean,
  28754. default: void 0
  28755. },
  28756. rules: {
  28757. type: definePropType([Object, Array])
  28758. },
  28759. error: String,
  28760. validateStatus: {
  28761. type: String,
  28762. values: formItemValidateStates
  28763. },
  28764. for: String,
  28765. inlineMessage: {
  28766. type: [String, Boolean],
  28767. default: ""
  28768. },
  28769. showMessage: {
  28770. type: Boolean,
  28771. default: true
  28772. },
  28773. size: {
  28774. type: String,
  28775. values: componentSizes
  28776. }
  28777. });
  28778. const COMPONENT_NAME$d = "ElLabelWrap";
  28779. var FormLabelWrap = vue.defineComponent({
  28780. name: COMPONENT_NAME$d,
  28781. props: {
  28782. isAutoWidth: Boolean,
  28783. updateAll: Boolean
  28784. },
  28785. setup(props, {
  28786. slots
  28787. }) {
  28788. const formContext = vue.inject(formContextKey, void 0);
  28789. const formItemContext = vue.inject(formItemContextKey);
  28790. if (!formItemContext)
  28791. throwError(COMPONENT_NAME$d, "usage: <el-form-item><label-wrap /></el-form-item>");
  28792. const ns = useNamespace("form");
  28793. const el = vue.ref();
  28794. const computedWidth = vue.ref(0);
  28795. const getLabelWidth = () => {
  28796. var _a;
  28797. if ((_a = el.value) == null ? void 0 : _a.firstElementChild) {
  28798. const width = window.getComputedStyle(el.value.firstElementChild).width;
  28799. return Math.ceil(Number.parseFloat(width));
  28800. } else {
  28801. return 0;
  28802. }
  28803. };
  28804. const updateLabelWidth = (action = "update") => {
  28805. vue.nextTick(() => {
  28806. if (slots.default && props.isAutoWidth) {
  28807. if (action === "update") {
  28808. computedWidth.value = getLabelWidth();
  28809. } else if (action === "remove") {
  28810. formContext == null ? void 0 : formContext.deregisterLabelWidth(computedWidth.value);
  28811. }
  28812. }
  28813. });
  28814. };
  28815. const updateLabelWidthFn = () => updateLabelWidth("update");
  28816. vue.onMounted(() => {
  28817. updateLabelWidthFn();
  28818. });
  28819. vue.onBeforeUnmount(() => {
  28820. updateLabelWidth("remove");
  28821. });
  28822. vue.onUpdated(() => updateLabelWidthFn());
  28823. vue.watch(computedWidth, (val, oldVal) => {
  28824. if (props.updateAll) {
  28825. formContext == null ? void 0 : formContext.registerLabelWidth(val, oldVal);
  28826. }
  28827. });
  28828. useResizeObserver(vue.computed(() => {
  28829. var _a, _b;
  28830. return (_b = (_a = el.value) == null ? void 0 : _a.firstElementChild) != null ? _b : null;
  28831. }), updateLabelWidthFn);
  28832. return () => {
  28833. var _a, _b;
  28834. if (!slots)
  28835. return null;
  28836. const {
  28837. isAutoWidth
  28838. } = props;
  28839. if (isAutoWidth) {
  28840. const autoLabelWidth = formContext == null ? void 0 : formContext.autoLabelWidth;
  28841. const hasLabel = formItemContext == null ? void 0 : formItemContext.hasLabel;
  28842. const style = {};
  28843. if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") {
  28844. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  28845. const marginPosition = formContext.labelPosition === "left" ? "marginRight" : "marginLeft";
  28846. if (marginWidth) {
  28847. style[marginPosition] = `${marginWidth}px`;
  28848. }
  28849. }
  28850. return vue.createVNode("div", {
  28851. "ref": el,
  28852. "class": [ns.be("item", "label-wrap")],
  28853. "style": style
  28854. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  28855. } else {
  28856. return vue.createVNode(vue.Fragment, {
  28857. "ref": el
  28858. }, [(_b = slots.default) == null ? void 0 : _b.call(slots)]);
  28859. }
  28860. };
  28861. }
  28862. });
  28863. const _hoisted_1$v = ["role", "aria-labelledby"];
  28864. const __default__$I = vue.defineComponent({
  28865. name: "ElFormItem"
  28866. });
  28867. const _sfc_main$Z = /* @__PURE__ */ vue.defineComponent({
  28868. ...__default__$I,
  28869. props: formItemProps,
  28870. setup(__props, { expose }) {
  28871. const props = __props;
  28872. const slots = vue.useSlots();
  28873. const formContext = vue.inject(formContextKey, void 0);
  28874. const parentFormItemContext = vue.inject(formItemContextKey, void 0);
  28875. const _size = useSize(void 0, { formItem: false });
  28876. const ns = useNamespace("form-item");
  28877. const labelId = useId().value;
  28878. const inputIds = vue.ref([]);
  28879. const validateState = vue.ref("");
  28880. const validateStateDebounced = refDebounced(validateState, 100);
  28881. const validateMessage = vue.ref("");
  28882. const formItemRef = vue.ref();
  28883. let initialValue = void 0;
  28884. let isResettingField = false;
  28885. const labelStyle = vue.computed(() => {
  28886. if ((formContext == null ? void 0 : formContext.labelPosition) === "top") {
  28887. return {};
  28888. }
  28889. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  28890. if (labelWidth)
  28891. return { width: labelWidth };
  28892. return {};
  28893. });
  28894. const contentStyle = vue.computed(() => {
  28895. if ((formContext == null ? void 0 : formContext.labelPosition) === "top" || (formContext == null ? void 0 : formContext.inline)) {
  28896. return {};
  28897. }
  28898. if (!props.label && !props.labelWidth && isNested) {
  28899. return {};
  28900. }
  28901. const labelWidth = addUnit(props.labelWidth || (formContext == null ? void 0 : formContext.labelWidth) || "");
  28902. if (!props.label && !slots.label) {
  28903. return { marginLeft: labelWidth };
  28904. }
  28905. return {};
  28906. });
  28907. const formItemClasses = vue.computed(() => [
  28908. ns.b(),
  28909. ns.m(_size.value),
  28910. ns.is("error", validateState.value === "error"),
  28911. ns.is("validating", validateState.value === "validating"),
  28912. ns.is("success", validateState.value === "success"),
  28913. ns.is("required", isRequired.value || props.required),
  28914. ns.is("no-asterisk", formContext == null ? void 0 : formContext.hideRequiredAsterisk),
  28915. (formContext == null ? void 0 : formContext.requireAsteriskPosition) === "right" ? "asterisk-right" : "asterisk-left",
  28916. { [ns.m("feedback")]: formContext == null ? void 0 : formContext.statusIcon }
  28917. ]);
  28918. const _inlineMessage = vue.computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : (formContext == null ? void 0 : formContext.inlineMessage) || false);
  28919. const validateClasses = vue.computed(() => [
  28920. ns.e("error"),
  28921. { [ns.em("error", "inline")]: _inlineMessage.value }
  28922. ]);
  28923. const propString = vue.computed(() => {
  28924. if (!props.prop)
  28925. return "";
  28926. return isString(props.prop) ? props.prop : props.prop.join(".");
  28927. });
  28928. const hasLabel = vue.computed(() => {
  28929. return !!(props.label || slots.label);
  28930. });
  28931. const labelFor = vue.computed(() => {
  28932. return props.for || inputIds.value.length === 1 ? inputIds.value[0] : void 0;
  28933. });
  28934. const isGroup = vue.computed(() => {
  28935. return !labelFor.value && hasLabel.value;
  28936. });
  28937. const isNested = !!parentFormItemContext;
  28938. const fieldValue = vue.computed(() => {
  28939. const model = formContext == null ? void 0 : formContext.model;
  28940. if (!model || !props.prop) {
  28941. return;
  28942. }
  28943. return getProp(model, props.prop).value;
  28944. });
  28945. const normalizedRules = vue.computed(() => {
  28946. const { required } = props;
  28947. const rules = [];
  28948. if (props.rules) {
  28949. rules.push(...castArray$1(props.rules));
  28950. }
  28951. const formRules = formContext == null ? void 0 : formContext.rules;
  28952. if (formRules && props.prop) {
  28953. const _rules = getProp(formRules, props.prop).value;
  28954. if (_rules) {
  28955. rules.push(...castArray$1(_rules));
  28956. }
  28957. }
  28958. if (required !== void 0) {
  28959. const requiredRules = rules.map((rule, i) => [rule, i]).filter(([rule]) => Object.keys(rule).includes("required"));
  28960. if (requiredRules.length > 0) {
  28961. for (const [rule, i] of requiredRules) {
  28962. if (rule.required === required)
  28963. continue;
  28964. rules[i] = { ...rule, required };
  28965. }
  28966. } else {
  28967. rules.push({ required });
  28968. }
  28969. }
  28970. return rules;
  28971. });
  28972. const validateEnabled = vue.computed(() => normalizedRules.value.length > 0);
  28973. const getFilteredRule = (trigger) => {
  28974. const rules = normalizedRules.value;
  28975. return rules.filter((rule) => {
  28976. if (!rule.trigger || !trigger)
  28977. return true;
  28978. if (Array.isArray(rule.trigger)) {
  28979. return rule.trigger.includes(trigger);
  28980. } else {
  28981. return rule.trigger === trigger;
  28982. }
  28983. }).map(({ trigger: trigger2, ...rule }) => rule);
  28984. };
  28985. const isRequired = vue.computed(() => normalizedRules.value.some((rule) => rule.required));
  28986. const shouldShowError = vue.computed(() => {
  28987. var _a;
  28988. return validateStateDebounced.value === "error" && props.showMessage && ((_a = formContext == null ? void 0 : formContext.showMessage) != null ? _a : true);
  28989. });
  28990. const currentLabel = vue.computed(() => `${props.label || ""}${(formContext == null ? void 0 : formContext.labelSuffix) || ""}`);
  28991. const setValidationState = (state) => {
  28992. validateState.value = state;
  28993. };
  28994. const onValidationFailed = (error) => {
  28995. var _a, _b;
  28996. const { errors, fields } = error;
  28997. if (!errors || !fields) {
  28998. console.error(error);
  28999. }
  29000. setValidationState("error");
  29001. validateMessage.value = errors ? (_b = (_a = errors == null ? void 0 : errors[0]) == null ? void 0 : _a.message) != null ? _b : `${props.prop} is required` : "";
  29002. formContext == null ? void 0 : formContext.emit("validate", props.prop, false, validateMessage.value);
  29003. };
  29004. const onValidationSucceeded = () => {
  29005. setValidationState("success");
  29006. formContext == null ? void 0 : formContext.emit("validate", props.prop, true, "");
  29007. };
  29008. const doValidate = async (rules) => {
  29009. const modelName = propString.value;
  29010. const validator = new Schema({
  29011. [modelName]: rules
  29012. });
  29013. return validator.validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  29014. onValidationSucceeded();
  29015. return true;
  29016. }).catch((err) => {
  29017. onValidationFailed(err);
  29018. return Promise.reject(err);
  29019. });
  29020. };
  29021. const validate = async (trigger, callback) => {
  29022. if (isResettingField || !props.prop) {
  29023. return false;
  29024. }
  29025. const hasCallback = isFunction(callback);
  29026. if (!validateEnabled.value) {
  29027. callback == null ? void 0 : callback(false);
  29028. return false;
  29029. }
  29030. const rules = getFilteredRule(trigger);
  29031. if (rules.length === 0) {
  29032. callback == null ? void 0 : callback(true);
  29033. return true;
  29034. }
  29035. setValidationState("validating");
  29036. return doValidate(rules).then(() => {
  29037. callback == null ? void 0 : callback(true);
  29038. return true;
  29039. }).catch((err) => {
  29040. const { fields } = err;
  29041. callback == null ? void 0 : callback(false, fields);
  29042. return hasCallback ? false : Promise.reject(fields);
  29043. });
  29044. };
  29045. const clearValidate = () => {
  29046. setValidationState("");
  29047. validateMessage.value = "";
  29048. isResettingField = false;
  29049. };
  29050. const resetField = async () => {
  29051. const model = formContext == null ? void 0 : formContext.model;
  29052. if (!model || !props.prop)
  29053. return;
  29054. const computedValue = getProp(model, props.prop);
  29055. isResettingField = true;
  29056. computedValue.value = clone(initialValue);
  29057. await vue.nextTick();
  29058. clearValidate();
  29059. isResettingField = false;
  29060. };
  29061. const addInputId = (id) => {
  29062. if (!inputIds.value.includes(id)) {
  29063. inputIds.value.push(id);
  29064. }
  29065. };
  29066. const removeInputId = (id) => {
  29067. inputIds.value = inputIds.value.filter((listId) => listId !== id);
  29068. };
  29069. vue.watch(() => props.error, (val) => {
  29070. validateMessage.value = val || "";
  29071. setValidationState(val ? "error" : "");
  29072. }, { immediate: true });
  29073. vue.watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  29074. const context = vue.reactive({
  29075. ...vue.toRefs(props),
  29076. $el: formItemRef,
  29077. size: _size,
  29078. validateState,
  29079. labelId,
  29080. inputIds,
  29081. isGroup,
  29082. hasLabel,
  29083. addInputId,
  29084. removeInputId,
  29085. resetField,
  29086. clearValidate,
  29087. validate
  29088. });
  29089. vue.provide(formItemContextKey, context);
  29090. vue.onMounted(() => {
  29091. if (props.prop) {
  29092. formContext == null ? void 0 : formContext.addField(context);
  29093. initialValue = clone(fieldValue.value);
  29094. }
  29095. });
  29096. vue.onBeforeUnmount(() => {
  29097. formContext == null ? void 0 : formContext.removeField(context);
  29098. });
  29099. expose({
  29100. size: _size,
  29101. validateMessage,
  29102. validateState,
  29103. validate,
  29104. clearValidate,
  29105. resetField
  29106. });
  29107. return (_ctx, _cache) => {
  29108. var _a;
  29109. return vue.openBlock(), vue.createElementBlock("div", {
  29110. ref_key: "formItemRef",
  29111. ref: formItemRef,
  29112. class: vue.normalizeClass(vue.unref(formItemClasses)),
  29113. role: vue.unref(isGroup) ? "group" : void 0,
  29114. "aria-labelledby": vue.unref(isGroup) ? vue.unref(labelId) : void 0
  29115. }, [
  29116. vue.createVNode(vue.unref(FormLabelWrap), {
  29117. "is-auto-width": vue.unref(labelStyle).width === "auto",
  29118. "update-all": ((_a = vue.unref(formContext)) == null ? void 0 : _a.labelWidth) === "auto"
  29119. }, {
  29120. default: vue.withCtx(() => [
  29121. vue.unref(hasLabel) ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(labelFor) ? "label" : "div"), {
  29122. key: 0,
  29123. id: vue.unref(labelId),
  29124. for: vue.unref(labelFor),
  29125. class: vue.normalizeClass(vue.unref(ns).e("label")),
  29126. style: vue.normalizeStyle(vue.unref(labelStyle))
  29127. }, {
  29128. default: vue.withCtx(() => [
  29129. vue.renderSlot(_ctx.$slots, "label", { label: vue.unref(currentLabel) }, () => [
  29130. vue.createTextVNode(vue.toDisplayString(vue.unref(currentLabel)), 1)
  29131. ])
  29132. ]),
  29133. _: 3
  29134. }, 8, ["id", "for", "class", "style"])) : vue.createCommentVNode("v-if", true)
  29135. ]),
  29136. _: 3
  29137. }, 8, ["is-auto-width", "update-all"]),
  29138. vue.createElementVNode("div", {
  29139. class: vue.normalizeClass(vue.unref(ns).e("content")),
  29140. style: vue.normalizeStyle(vue.unref(contentStyle))
  29141. }, [
  29142. vue.renderSlot(_ctx.$slots, "default"),
  29143. vue.createVNode(vue.Transition, {
  29144. name: `${vue.unref(ns).namespace.value}-zoom-in-top`
  29145. }, {
  29146. default: vue.withCtx(() => [
  29147. vue.unref(shouldShowError) ? vue.renderSlot(_ctx.$slots, "error", {
  29148. key: 0,
  29149. error: validateMessage.value
  29150. }, () => [
  29151. vue.createElementVNode("div", {
  29152. class: vue.normalizeClass(vue.unref(validateClasses))
  29153. }, vue.toDisplayString(validateMessage.value), 3)
  29154. ]) : vue.createCommentVNode("v-if", true)
  29155. ]),
  29156. _: 3
  29157. }, 8, ["name"])
  29158. ], 6)
  29159. ], 10, _hoisted_1$v);
  29160. };
  29161. }
  29162. });
  29163. var FormItem = /* @__PURE__ */ _export_sfc(_sfc_main$Z, [["__file", "form-item.vue"]]);
  29164. const ElForm = withInstall(Form, {
  29165. FormItem
  29166. });
  29167. const ElFormItem = withNoopInstall(FormItem);
  29168. const imageViewerProps = buildProps({
  29169. urlList: {
  29170. type: definePropType(Array),
  29171. default: () => mutable([])
  29172. },
  29173. zIndex: {
  29174. type: Number
  29175. },
  29176. initialIndex: {
  29177. type: Number,
  29178. default: 0
  29179. },
  29180. infinite: {
  29181. type: Boolean,
  29182. default: true
  29183. },
  29184. hideOnClickModal: {
  29185. type: Boolean,
  29186. default: false
  29187. },
  29188. teleported: {
  29189. type: Boolean,
  29190. default: false
  29191. },
  29192. closeOnPressEscape: {
  29193. type: Boolean,
  29194. default: true
  29195. }
  29196. });
  29197. const imageViewerEmits = {
  29198. close: () => true,
  29199. switch: (index) => isNumber(index)
  29200. };
  29201. const _hoisted_1$u = ["src"];
  29202. const __default__$H = vue.defineComponent({
  29203. name: "ElImageViewer"
  29204. });
  29205. const _sfc_main$Y = /* @__PURE__ */ vue.defineComponent({
  29206. ...__default__$H,
  29207. props: imageViewerProps,
  29208. emits: imageViewerEmits,
  29209. setup(__props, { expose, emit }) {
  29210. const props = __props;
  29211. const modes = {
  29212. CONTAIN: {
  29213. name: "contain",
  29214. icon: vue.markRaw(full_screen_default)
  29215. },
  29216. ORIGINAL: {
  29217. name: "original",
  29218. icon: vue.markRaw(scale_to_original_default)
  29219. }
  29220. };
  29221. const mousewheelEventName = isFirefox() ? "DOMMouseScroll" : "mousewheel";
  29222. const { t } = useLocale();
  29223. const ns = useNamespace("image-viewer");
  29224. const { nextZIndex } = useZIndex();
  29225. const wrapper = vue.ref();
  29226. const imgRefs = vue.ref([]);
  29227. const scopeEventListener = vue.effectScope();
  29228. const loading = vue.ref(true);
  29229. const activeIndex = vue.ref(props.initialIndex);
  29230. const mode = vue.shallowRef(modes.CONTAIN);
  29231. const transform = vue.ref({
  29232. scale: 1,
  29233. deg: 0,
  29234. offsetX: 0,
  29235. offsetY: 0,
  29236. enableTransition: false
  29237. });
  29238. const isSingle = vue.computed(() => {
  29239. const { urlList } = props;
  29240. return urlList.length <= 1;
  29241. });
  29242. const isFirst = vue.computed(() => {
  29243. return activeIndex.value === 0;
  29244. });
  29245. const isLast = vue.computed(() => {
  29246. return activeIndex.value === props.urlList.length - 1;
  29247. });
  29248. const currentImg = vue.computed(() => {
  29249. return props.urlList[activeIndex.value];
  29250. });
  29251. const imgStyle = vue.computed(() => {
  29252. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  29253. let translateX = offsetX / scale;
  29254. let translateY = offsetY / scale;
  29255. switch (deg % 360) {
  29256. case 90:
  29257. case -270:
  29258. [translateX, translateY] = [translateY, -translateX];
  29259. break;
  29260. case 180:
  29261. case -180:
  29262. [translateX, translateY] = [-translateX, -translateY];
  29263. break;
  29264. case 270:
  29265. case -90:
  29266. [translateX, translateY] = [-translateY, translateX];
  29267. break;
  29268. }
  29269. const style = {
  29270. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  29271. transition: enableTransition ? "transform .3s" : ""
  29272. };
  29273. if (mode.value.name === modes.CONTAIN.name) {
  29274. style.maxWidth = style.maxHeight = "100%";
  29275. }
  29276. return style;
  29277. });
  29278. const computedZIndex = vue.computed(() => {
  29279. return isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  29280. });
  29281. function hide() {
  29282. unregisterEventListener();
  29283. emit("close");
  29284. }
  29285. function registerEventListener() {
  29286. const keydownHandler = throttle((e) => {
  29287. switch (e.code) {
  29288. case EVENT_CODE.esc:
  29289. props.closeOnPressEscape && hide();
  29290. break;
  29291. case EVENT_CODE.space:
  29292. toggleMode();
  29293. break;
  29294. case EVENT_CODE.left:
  29295. prev();
  29296. break;
  29297. case EVENT_CODE.up:
  29298. handleActions("zoomIn");
  29299. break;
  29300. case EVENT_CODE.right:
  29301. next();
  29302. break;
  29303. case EVENT_CODE.down:
  29304. handleActions("zoomOut");
  29305. break;
  29306. }
  29307. });
  29308. const mousewheelHandler = throttle((e) => {
  29309. const delta = e.wheelDelta ? e.wheelDelta : -e.detail;
  29310. if (delta > 0) {
  29311. handleActions("zoomIn", {
  29312. zoomRate: 1.2,
  29313. enableTransition: false
  29314. });
  29315. } else {
  29316. handleActions("zoomOut", {
  29317. zoomRate: 1.2,
  29318. enableTransition: false
  29319. });
  29320. }
  29321. });
  29322. scopeEventListener.run(() => {
  29323. useEventListener(document, "keydown", keydownHandler);
  29324. useEventListener(document, mousewheelEventName, mousewheelHandler);
  29325. });
  29326. }
  29327. function unregisterEventListener() {
  29328. scopeEventListener.stop();
  29329. }
  29330. function handleImgLoad() {
  29331. loading.value = false;
  29332. }
  29333. function handleImgError(e) {
  29334. loading.value = false;
  29335. e.target.alt = t("el.image.error");
  29336. }
  29337. function handleMouseDown(e) {
  29338. if (loading.value || e.button !== 0 || !wrapper.value)
  29339. return;
  29340. transform.value.enableTransition = false;
  29341. const { offsetX, offsetY } = transform.value;
  29342. const startX = e.pageX;
  29343. const startY = e.pageY;
  29344. const dragHandler = throttle((ev) => {
  29345. transform.value = {
  29346. ...transform.value,
  29347. offsetX: offsetX + ev.pageX - startX,
  29348. offsetY: offsetY + ev.pageY - startY
  29349. };
  29350. });
  29351. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  29352. useEventListener(document, "mouseup", () => {
  29353. removeMousemove();
  29354. });
  29355. e.preventDefault();
  29356. }
  29357. function reset() {
  29358. transform.value = {
  29359. scale: 1,
  29360. deg: 0,
  29361. offsetX: 0,
  29362. offsetY: 0,
  29363. enableTransition: false
  29364. };
  29365. }
  29366. function toggleMode() {
  29367. if (loading.value)
  29368. return;
  29369. const modeNames = keysOf(modes);
  29370. const modeValues = Object.values(modes);
  29371. const currentMode = mode.value.name;
  29372. const index = modeValues.findIndex((i) => i.name === currentMode);
  29373. const nextIndex = (index + 1) % modeNames.length;
  29374. mode.value = modes[modeNames[nextIndex]];
  29375. reset();
  29376. }
  29377. function setActiveItem(index) {
  29378. const len = props.urlList.length;
  29379. activeIndex.value = (index + len) % len;
  29380. }
  29381. function prev() {
  29382. if (isFirst.value && !props.infinite)
  29383. return;
  29384. setActiveItem(activeIndex.value - 1);
  29385. }
  29386. function next() {
  29387. if (isLast.value && !props.infinite)
  29388. return;
  29389. setActiveItem(activeIndex.value + 1);
  29390. }
  29391. function handleActions(action, options = {}) {
  29392. if (loading.value)
  29393. return;
  29394. const { zoomRate, rotateDeg, enableTransition } = {
  29395. zoomRate: 1.4,
  29396. rotateDeg: 90,
  29397. enableTransition: true,
  29398. ...options
  29399. };
  29400. switch (action) {
  29401. case "zoomOut":
  29402. if (transform.value.scale > 0.2) {
  29403. transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  29404. }
  29405. break;
  29406. case "zoomIn":
  29407. if (transform.value.scale < 7) {
  29408. transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  29409. }
  29410. break;
  29411. case "clockwise":
  29412. transform.value.deg += rotateDeg;
  29413. break;
  29414. case "anticlockwise":
  29415. transform.value.deg -= rotateDeg;
  29416. break;
  29417. }
  29418. transform.value.enableTransition = enableTransition;
  29419. }
  29420. vue.watch(currentImg, () => {
  29421. vue.nextTick(() => {
  29422. const $img = imgRefs.value[0];
  29423. if (!($img == null ? void 0 : $img.complete)) {
  29424. loading.value = true;
  29425. }
  29426. });
  29427. });
  29428. vue.watch(activeIndex, (val) => {
  29429. reset();
  29430. emit("switch", val);
  29431. });
  29432. vue.onMounted(() => {
  29433. var _a, _b;
  29434. registerEventListener();
  29435. (_b = (_a = wrapper.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  29436. });
  29437. expose({
  29438. setActiveItem
  29439. });
  29440. return (_ctx, _cache) => {
  29441. return vue.openBlock(), vue.createBlock(vue.Teleport, {
  29442. to: "body",
  29443. disabled: !_ctx.teleported
  29444. }, [
  29445. vue.createVNode(vue.Transition, {
  29446. name: "viewer-fade",
  29447. appear: ""
  29448. }, {
  29449. default: vue.withCtx(() => [
  29450. vue.createElementVNode("div", {
  29451. ref_key: "wrapper",
  29452. ref: wrapper,
  29453. tabindex: -1,
  29454. class: vue.normalizeClass(vue.unref(ns).e("wrapper")),
  29455. style: vue.normalizeStyle({ zIndex: vue.unref(computedZIndex) })
  29456. }, [
  29457. vue.createElementVNode("div", {
  29458. class: vue.normalizeClass(vue.unref(ns).e("mask")),
  29459. onClick: _cache[0] || (_cache[0] = vue.withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"]))
  29460. }, null, 2),
  29461. vue.createCommentVNode(" CLOSE "),
  29462. vue.createElementVNode("span", {
  29463. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("close")]),
  29464. onClick: hide
  29465. }, [
  29466. vue.createVNode(vue.unref(ElIcon), null, {
  29467. default: vue.withCtx(() => [
  29468. vue.createVNode(vue.unref(close_default))
  29469. ]),
  29470. _: 1
  29471. })
  29472. ], 2),
  29473. vue.createCommentVNode(" ARROW "),
  29474. !vue.unref(isSingle) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  29475. vue.createElementVNode("span", {
  29476. class: vue.normalizeClass([
  29477. vue.unref(ns).e("btn"),
  29478. vue.unref(ns).e("prev"),
  29479. vue.unref(ns).is("disabled", !_ctx.infinite && vue.unref(isFirst))
  29480. ]),
  29481. onClick: prev
  29482. }, [
  29483. vue.createVNode(vue.unref(ElIcon), null, {
  29484. default: vue.withCtx(() => [
  29485. vue.createVNode(vue.unref(arrow_left_default))
  29486. ]),
  29487. _: 1
  29488. })
  29489. ], 2),
  29490. vue.createElementVNode("span", {
  29491. class: vue.normalizeClass([
  29492. vue.unref(ns).e("btn"),
  29493. vue.unref(ns).e("next"),
  29494. vue.unref(ns).is("disabled", !_ctx.infinite && vue.unref(isLast))
  29495. ]),
  29496. onClick: next
  29497. }, [
  29498. vue.createVNode(vue.unref(ElIcon), null, {
  29499. default: vue.withCtx(() => [
  29500. vue.createVNode(vue.unref(arrow_right_default))
  29501. ]),
  29502. _: 1
  29503. })
  29504. ], 2)
  29505. ], 64)) : vue.createCommentVNode("v-if", true),
  29506. vue.createCommentVNode(" ACTIONS "),
  29507. vue.createElementVNode("div", {
  29508. class: vue.normalizeClass([vue.unref(ns).e("btn"), vue.unref(ns).e("actions")])
  29509. }, [
  29510. vue.createElementVNode("div", {
  29511. class: vue.normalizeClass(vue.unref(ns).e("actions__inner"))
  29512. }, [
  29513. vue.createVNode(vue.unref(ElIcon), {
  29514. onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut"))
  29515. }, {
  29516. default: vue.withCtx(() => [
  29517. vue.createVNode(vue.unref(zoom_out_default))
  29518. ]),
  29519. _: 1
  29520. }),
  29521. vue.createVNode(vue.unref(ElIcon), {
  29522. onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn"))
  29523. }, {
  29524. default: vue.withCtx(() => [
  29525. vue.createVNode(vue.unref(zoom_in_default))
  29526. ]),
  29527. _: 1
  29528. }),
  29529. vue.createElementVNode("i", {
  29530. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  29531. }, null, 2),
  29532. vue.createVNode(vue.unref(ElIcon), { onClick: toggleMode }, {
  29533. default: vue.withCtx(() => [
  29534. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(mode).icon)))
  29535. ]),
  29536. _: 1
  29537. }),
  29538. vue.createElementVNode("i", {
  29539. class: vue.normalizeClass(vue.unref(ns).e("actions__divider"))
  29540. }, null, 2),
  29541. vue.createVNode(vue.unref(ElIcon), {
  29542. onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise"))
  29543. }, {
  29544. default: vue.withCtx(() => [
  29545. vue.createVNode(vue.unref(refresh_left_default))
  29546. ]),
  29547. _: 1
  29548. }),
  29549. vue.createVNode(vue.unref(ElIcon), {
  29550. onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise"))
  29551. }, {
  29552. default: vue.withCtx(() => [
  29553. vue.createVNode(vue.unref(refresh_right_default))
  29554. ]),
  29555. _: 1
  29556. })
  29557. ], 2)
  29558. ], 2),
  29559. vue.createCommentVNode(" CANVAS "),
  29560. vue.createElementVNode("div", {
  29561. class: vue.normalizeClass(vue.unref(ns).e("canvas"))
  29562. }, [
  29563. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.urlList, (url, i) => {
  29564. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("img", {
  29565. ref_for: true,
  29566. ref: (el) => imgRefs.value[i] = el,
  29567. key: url,
  29568. src: url,
  29569. style: vue.normalizeStyle(vue.unref(imgStyle)),
  29570. class: vue.normalizeClass(vue.unref(ns).e("img")),
  29571. onLoad: handleImgLoad,
  29572. onError: handleImgError,
  29573. onMousedown: handleMouseDown
  29574. }, null, 46, _hoisted_1$u)), [
  29575. [vue.vShow, i === activeIndex.value]
  29576. ]);
  29577. }), 128))
  29578. ], 2),
  29579. vue.renderSlot(_ctx.$slots, "default")
  29580. ], 6)
  29581. ]),
  29582. _: 3
  29583. })
  29584. ], 8, ["disabled"]);
  29585. };
  29586. }
  29587. });
  29588. var ImageViewer = /* @__PURE__ */ _export_sfc(_sfc_main$Y, [["__file", "image-viewer.vue"]]);
  29589. const ElImageViewer = withInstall(ImageViewer);
  29590. const imageProps = buildProps({
  29591. hideOnClickModal: {
  29592. type: Boolean,
  29593. default: false
  29594. },
  29595. src: {
  29596. type: String,
  29597. default: ""
  29598. },
  29599. fit: {
  29600. type: String,
  29601. values: ["", "contain", "cover", "fill", "none", "scale-down"],
  29602. default: ""
  29603. },
  29604. loading: {
  29605. type: String,
  29606. values: ["eager", "lazy"]
  29607. },
  29608. lazy: {
  29609. type: Boolean,
  29610. default: false
  29611. },
  29612. scrollContainer: {
  29613. type: definePropType([String, Object])
  29614. },
  29615. previewSrcList: {
  29616. type: definePropType(Array),
  29617. default: () => mutable([])
  29618. },
  29619. previewTeleported: {
  29620. type: Boolean,
  29621. default: false
  29622. },
  29623. zIndex: {
  29624. type: Number
  29625. },
  29626. initialIndex: {
  29627. type: Number,
  29628. default: 0
  29629. },
  29630. infinite: {
  29631. type: Boolean,
  29632. default: true
  29633. },
  29634. closeOnPressEscape: {
  29635. type: Boolean,
  29636. default: true
  29637. }
  29638. });
  29639. const imageEmits = {
  29640. load: (evt) => evt instanceof Event,
  29641. error: (evt) => evt instanceof Event,
  29642. switch: (val) => isNumber(val),
  29643. close: () => true,
  29644. show: () => true
  29645. };
  29646. const _hoisted_1$t = ["src", "loading"];
  29647. const _hoisted_2$j = { key: 0 };
  29648. const __default__$G = vue.defineComponent({
  29649. name: "ElImage",
  29650. inheritAttrs: false
  29651. });
  29652. const _sfc_main$X = /* @__PURE__ */ vue.defineComponent({
  29653. ...__default__$G,
  29654. props: imageProps,
  29655. emits: imageEmits,
  29656. setup(__props, { emit }) {
  29657. const props = __props;
  29658. let prevOverflow = "";
  29659. const { t } = useLocale();
  29660. const ns = useNamespace("image");
  29661. const rawAttrs = vue.useAttrs();
  29662. const attrs = useAttrs();
  29663. const imageSrc = vue.ref();
  29664. const hasLoadError = vue.ref(false);
  29665. const isLoading = vue.ref(true);
  29666. const showViewer = vue.ref(false);
  29667. const container = vue.ref();
  29668. const _scrollContainer = vue.ref();
  29669. const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
  29670. let stopScrollListener;
  29671. let stopWheelListener;
  29672. const containerStyle = vue.computed(() => rawAttrs.style);
  29673. const imageStyle = vue.computed(() => {
  29674. const { fit } = props;
  29675. if (isClient && fit) {
  29676. return { objectFit: fit };
  29677. }
  29678. return {};
  29679. });
  29680. const preview = vue.computed(() => {
  29681. const { previewSrcList } = props;
  29682. return Array.isArray(previewSrcList) && previewSrcList.length > 0;
  29683. });
  29684. const imageIndex = vue.computed(() => {
  29685. const { previewSrcList, initialIndex } = props;
  29686. let previewIndex = initialIndex;
  29687. if (initialIndex > previewSrcList.length - 1) {
  29688. previewIndex = 0;
  29689. }
  29690. return previewIndex;
  29691. });
  29692. const isManual = vue.computed(() => {
  29693. if (props.loading === "eager")
  29694. return false;
  29695. return !supportLoading && props.loading === "lazy" || props.lazy;
  29696. });
  29697. const loadImage = () => {
  29698. if (!isClient)
  29699. return;
  29700. isLoading.value = true;
  29701. hasLoadError.value = false;
  29702. imageSrc.value = props.src;
  29703. };
  29704. function handleLoad(event) {
  29705. isLoading.value = false;
  29706. hasLoadError.value = false;
  29707. emit("load", event);
  29708. }
  29709. function handleError(event) {
  29710. isLoading.value = false;
  29711. hasLoadError.value = true;
  29712. emit("error", event);
  29713. }
  29714. function handleLazyLoad() {
  29715. if (isInContainer(container.value, _scrollContainer.value)) {
  29716. loadImage();
  29717. removeLazyLoadListener();
  29718. }
  29719. }
  29720. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200);
  29721. async function addLazyLoadListener() {
  29722. var _a;
  29723. if (!isClient)
  29724. return;
  29725. await vue.nextTick();
  29726. const { scrollContainer } = props;
  29727. if (isElement$1(scrollContainer)) {
  29728. _scrollContainer.value = scrollContainer;
  29729. } else if (isString(scrollContainer) && scrollContainer !== "") {
  29730. _scrollContainer.value = (_a = document.querySelector(scrollContainer)) != null ? _a : void 0;
  29731. } else if (container.value) {
  29732. _scrollContainer.value = getScrollContainer(container.value);
  29733. }
  29734. if (_scrollContainer.value) {
  29735. stopScrollListener = useEventListener(_scrollContainer, "scroll", lazyLoadHandler);
  29736. setTimeout(() => handleLazyLoad(), 100);
  29737. }
  29738. }
  29739. function removeLazyLoadListener() {
  29740. if (!isClient || !_scrollContainer.value || !lazyLoadHandler)
  29741. return;
  29742. stopScrollListener == null ? void 0 : stopScrollListener();
  29743. _scrollContainer.value = void 0;
  29744. }
  29745. function wheelHandler(e) {
  29746. if (!e.ctrlKey)
  29747. return;
  29748. if (e.deltaY < 0) {
  29749. e.preventDefault();
  29750. return false;
  29751. } else if (e.deltaY > 0) {
  29752. e.preventDefault();
  29753. return false;
  29754. }
  29755. }
  29756. function clickHandler() {
  29757. if (!preview.value)
  29758. return;
  29759. stopWheelListener = useEventListener("wheel", wheelHandler, {
  29760. passive: false
  29761. });
  29762. prevOverflow = document.body.style.overflow;
  29763. document.body.style.overflow = "hidden";
  29764. showViewer.value = true;
  29765. emit("show");
  29766. }
  29767. function closeViewer() {
  29768. stopWheelListener == null ? void 0 : stopWheelListener();
  29769. document.body.style.overflow = prevOverflow;
  29770. showViewer.value = false;
  29771. emit("close");
  29772. }
  29773. function switchViewer(val) {
  29774. emit("switch", val);
  29775. }
  29776. vue.watch(() => props.src, () => {
  29777. if (isManual.value) {
  29778. isLoading.value = true;
  29779. hasLoadError.value = false;
  29780. removeLazyLoadListener();
  29781. addLazyLoadListener();
  29782. } else {
  29783. loadImage();
  29784. }
  29785. });
  29786. vue.onMounted(() => {
  29787. if (isManual.value) {
  29788. addLazyLoadListener();
  29789. } else {
  29790. loadImage();
  29791. }
  29792. });
  29793. return (_ctx, _cache) => {
  29794. return vue.openBlock(), vue.createElementBlock("div", {
  29795. ref_key: "container",
  29796. ref: container,
  29797. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.$attrs.class]),
  29798. style: vue.normalizeStyle(vue.unref(containerStyle))
  29799. }, [
  29800. imageSrc.value !== void 0 && !hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("img", vue.mergeProps({ key: 0 }, vue.unref(attrs), {
  29801. src: imageSrc.value,
  29802. loading: _ctx.loading,
  29803. style: vue.unref(imageStyle),
  29804. class: [
  29805. vue.unref(ns).e("inner"),
  29806. vue.unref(preview) && vue.unref(ns).e("preview"),
  29807. isLoading.value && vue.unref(ns).is("loading")
  29808. ],
  29809. onClick: clickHandler,
  29810. onLoad: handleLoad,
  29811. onError: handleError
  29812. }), null, 16, _hoisted_1$t)) : vue.createCommentVNode("v-if", true),
  29813. isLoading.value || hasLoadError.value ? (vue.openBlock(), vue.createElementBlock("div", {
  29814. key: 1,
  29815. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  29816. }, [
  29817. isLoading.value ? vue.renderSlot(_ctx.$slots, "placeholder", { key: 0 }, () => [
  29818. vue.createElementVNode("div", {
  29819. class: vue.normalizeClass(vue.unref(ns).e("placeholder"))
  29820. }, null, 2)
  29821. ]) : hasLoadError.value ? vue.renderSlot(_ctx.$slots, "error", { key: 1 }, () => [
  29822. vue.createElementVNode("div", {
  29823. class: vue.normalizeClass(vue.unref(ns).e("error"))
  29824. }, vue.toDisplayString(vue.unref(t)("el.image.error")), 3)
  29825. ]) : vue.createCommentVNode("v-if", true)
  29826. ], 2)) : vue.createCommentVNode("v-if", true),
  29827. vue.unref(preview) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  29828. showViewer.value ? (vue.openBlock(), vue.createBlock(vue.unref(ElImageViewer), {
  29829. key: 0,
  29830. "z-index": _ctx.zIndex,
  29831. "initial-index": vue.unref(imageIndex),
  29832. infinite: _ctx.infinite,
  29833. "url-list": _ctx.previewSrcList,
  29834. "hide-on-click-modal": _ctx.hideOnClickModal,
  29835. teleported: _ctx.previewTeleported,
  29836. "close-on-press-escape": _ctx.closeOnPressEscape,
  29837. onClose: closeViewer,
  29838. onSwitch: switchViewer
  29839. }, {
  29840. default: vue.withCtx(() => [
  29841. _ctx.$slots.viewer ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$j, [
  29842. vue.renderSlot(_ctx.$slots, "viewer")
  29843. ])) : vue.createCommentVNode("v-if", true)
  29844. ]),
  29845. _: 3
  29846. }, 8, ["z-index", "initial-index", "infinite", "url-list", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : vue.createCommentVNode("v-if", true)
  29847. ], 64)) : vue.createCommentVNode("v-if", true)
  29848. ], 6);
  29849. };
  29850. }
  29851. });
  29852. var Image = /* @__PURE__ */ _export_sfc(_sfc_main$X, [["__file", "image.vue"]]);
  29853. const ElImage = withInstall(Image);
  29854. const inputNumberProps = buildProps({
  29855. id: {
  29856. type: String,
  29857. default: void 0
  29858. },
  29859. step: {
  29860. type: Number,
  29861. default: 1
  29862. },
  29863. stepStrictly: Boolean,
  29864. max: {
  29865. type: Number,
  29866. default: Number.POSITIVE_INFINITY
  29867. },
  29868. min: {
  29869. type: Number,
  29870. default: Number.NEGATIVE_INFINITY
  29871. },
  29872. modelValue: Number,
  29873. readonly: Boolean,
  29874. disabled: Boolean,
  29875. size: useSizeProp,
  29876. controls: {
  29877. type: Boolean,
  29878. default: true
  29879. },
  29880. controlsPosition: {
  29881. type: String,
  29882. default: "",
  29883. values: ["", "right"]
  29884. },
  29885. valueOnClear: {
  29886. type: [String, Number, null],
  29887. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  29888. default: null
  29889. },
  29890. name: String,
  29891. label: String,
  29892. placeholder: String,
  29893. precision: {
  29894. type: Number,
  29895. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  29896. },
  29897. validateEvent: {
  29898. type: Boolean,
  29899. default: true
  29900. }
  29901. });
  29902. const inputNumberEmits = {
  29903. [CHANGE_EVENT]: (prev, cur) => prev !== cur,
  29904. blur: (e) => e instanceof FocusEvent,
  29905. focus: (e) => e instanceof FocusEvent,
  29906. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  29907. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  29908. };
  29909. const _hoisted_1$s = ["aria-label", "onKeydown"];
  29910. const _hoisted_2$i = ["aria-label", "onKeydown"];
  29911. const __default__$F = vue.defineComponent({
  29912. name: "ElInputNumber"
  29913. });
  29914. const _sfc_main$W = /* @__PURE__ */ vue.defineComponent({
  29915. ...__default__$F,
  29916. props: inputNumberProps,
  29917. emits: inputNumberEmits,
  29918. setup(__props, { expose, emit }) {
  29919. const props = __props;
  29920. const { t } = useLocale();
  29921. const ns = useNamespace("input-number");
  29922. const input = vue.ref();
  29923. const data = vue.reactive({
  29924. currentValue: props.modelValue,
  29925. userInput: null
  29926. });
  29927. const { formItem } = useFormItem();
  29928. const minDisabled = vue.computed(() => isNumber(props.modelValue) && ensurePrecision(props.modelValue, -1) < props.min);
  29929. const maxDisabled = vue.computed(() => isNumber(props.modelValue) && ensurePrecision(props.modelValue) > props.max);
  29930. const numPrecision = vue.computed(() => {
  29931. const stepPrecision = getPrecision(props.step);
  29932. if (!isUndefined(props.precision)) {
  29933. if (stepPrecision > props.precision) ;
  29934. return props.precision;
  29935. } else {
  29936. return Math.max(getPrecision(props.modelValue), stepPrecision);
  29937. }
  29938. });
  29939. const controlsAtRight = vue.computed(() => {
  29940. return props.controls && props.controlsPosition === "right";
  29941. });
  29942. const inputNumberSize = useSize();
  29943. const inputNumberDisabled = useDisabled();
  29944. const displayValue = vue.computed(() => {
  29945. if (data.userInput !== null) {
  29946. return data.userInput;
  29947. }
  29948. let currentValue = data.currentValue;
  29949. if (isNil(currentValue))
  29950. return "";
  29951. if (isNumber(currentValue)) {
  29952. if (Number.isNaN(currentValue))
  29953. return "";
  29954. if (!isUndefined(props.precision)) {
  29955. currentValue = currentValue.toFixed(props.precision);
  29956. }
  29957. }
  29958. return currentValue;
  29959. });
  29960. const toPrecision = (num, pre) => {
  29961. if (isUndefined(pre))
  29962. pre = numPrecision.value;
  29963. if (pre === 0)
  29964. return Math.round(num);
  29965. let snum = String(num);
  29966. const pointPos = snum.indexOf(".");
  29967. if (pointPos === -1)
  29968. return num;
  29969. const nums = snum.replace(".", "").split("");
  29970. const datum = nums[pointPos + pre];
  29971. if (!datum)
  29972. return num;
  29973. const length = snum.length;
  29974. if (snum.charAt(length - 1) === "5") {
  29975. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  29976. }
  29977. return Number.parseFloat(Number(snum).toFixed(pre));
  29978. };
  29979. const getPrecision = (value) => {
  29980. if (isNil(value))
  29981. return 0;
  29982. const valueString = value.toString();
  29983. const dotPosition = valueString.indexOf(".");
  29984. let precision = 0;
  29985. if (dotPosition !== -1) {
  29986. precision = valueString.length - dotPosition - 1;
  29987. }
  29988. return precision;
  29989. };
  29990. const ensurePrecision = (val, coefficient = 1) => {
  29991. if (!isNumber(val))
  29992. return data.currentValue;
  29993. return toPrecision(val + props.step * coefficient);
  29994. };
  29995. const increase = () => {
  29996. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  29997. return;
  29998. const value = Number(displayValue.value) || 0;
  29999. const newVal = ensurePrecision(value);
  30000. setCurrentValue(newVal);
  30001. emit(INPUT_EVENT, data.currentValue);
  30002. };
  30003. const decrease = () => {
  30004. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  30005. return;
  30006. const value = Number(displayValue.value) || 0;
  30007. const newVal = ensurePrecision(value, -1);
  30008. setCurrentValue(newVal);
  30009. emit(INPUT_EVENT, data.currentValue);
  30010. };
  30011. const verifyValue = (value, update) => {
  30012. const { max, min, step, precision, stepStrictly, valueOnClear } = props;
  30013. let newVal = Number(value);
  30014. if (isNil(value) || Number.isNaN(newVal)) {
  30015. return null;
  30016. }
  30017. if (value === "") {
  30018. if (valueOnClear === null) {
  30019. return null;
  30020. }
  30021. newVal = isString(valueOnClear) ? { min, max }[valueOnClear] : valueOnClear;
  30022. }
  30023. if (stepStrictly) {
  30024. newVal = toPrecision(Math.round(newVal / step) * step, precision);
  30025. }
  30026. if (!isUndefined(precision)) {
  30027. newVal = toPrecision(newVal, precision);
  30028. }
  30029. if (newVal > max || newVal < min) {
  30030. newVal = newVal > max ? max : min;
  30031. update && emit(UPDATE_MODEL_EVENT, newVal);
  30032. }
  30033. return newVal;
  30034. };
  30035. const setCurrentValue = (value) => {
  30036. var _a;
  30037. const oldVal = data.currentValue;
  30038. const newVal = verifyValue(value);
  30039. if (oldVal === newVal)
  30040. return;
  30041. data.userInput = null;
  30042. emit(UPDATE_MODEL_EVENT, newVal);
  30043. emit(CHANGE_EVENT, newVal, oldVal);
  30044. if (props.validateEvent) {
  30045. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  30046. }
  30047. data.currentValue = newVal;
  30048. };
  30049. const handleInput = (value) => {
  30050. data.userInput = value;
  30051. emit(INPUT_EVENT, value === "" ? null : Number(value));
  30052. };
  30053. const handleInputChange = (value) => {
  30054. const newVal = value !== "" ? Number(value) : "";
  30055. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  30056. setCurrentValue(newVal);
  30057. }
  30058. data.userInput = null;
  30059. };
  30060. const focus = () => {
  30061. var _a, _b;
  30062. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  30063. };
  30064. const blur = () => {
  30065. var _a, _b;
  30066. (_b = (_a = input.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  30067. };
  30068. const handleFocus = (event) => {
  30069. emit("focus", event);
  30070. };
  30071. const handleBlur = (event) => {
  30072. var _a;
  30073. emit("blur", event);
  30074. if (props.validateEvent) {
  30075. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur").catch((err) => debugWarn());
  30076. }
  30077. };
  30078. vue.watch(() => props.modelValue, (value) => {
  30079. data.currentValue = verifyValue(value, true);
  30080. data.userInput = null;
  30081. }, { immediate: true });
  30082. vue.onMounted(() => {
  30083. var _a;
  30084. const { min, max, modelValue } = props;
  30085. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  30086. innerInput.setAttribute("role", "spinbutton");
  30087. if (Number.isFinite(max)) {
  30088. innerInput.setAttribute("aria-valuemax", String(max));
  30089. } else {
  30090. innerInput.removeAttribute("aria-valuemax");
  30091. }
  30092. if (Number.isFinite(min)) {
  30093. innerInput.setAttribute("aria-valuemin", String(min));
  30094. } else {
  30095. innerInput.removeAttribute("aria-valuemin");
  30096. }
  30097. innerInput.setAttribute("aria-valuenow", String(data.currentValue));
  30098. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  30099. if (!isNumber(modelValue) && modelValue != null) {
  30100. let val = Number(modelValue);
  30101. if (Number.isNaN(val)) {
  30102. val = null;
  30103. }
  30104. emit(UPDATE_MODEL_EVENT, val);
  30105. }
  30106. });
  30107. vue.onUpdated(() => {
  30108. var _a;
  30109. const innerInput = (_a = input.value) == null ? void 0 : _a.input;
  30110. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${data.currentValue}`);
  30111. });
  30112. expose({
  30113. focus,
  30114. blur
  30115. });
  30116. return (_ctx, _cache) => {
  30117. return vue.openBlock(), vue.createElementBlock("div", {
  30118. class: vue.normalizeClass([
  30119. vue.unref(ns).b(),
  30120. vue.unref(ns).m(vue.unref(inputNumberSize)),
  30121. vue.unref(ns).is("disabled", vue.unref(inputNumberDisabled)),
  30122. vue.unref(ns).is("without-controls", !_ctx.controls),
  30123. vue.unref(ns).is("controls-right", vue.unref(controlsAtRight))
  30124. ]),
  30125. onDragstart: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  30126. }, ["prevent"]))
  30127. }, [
  30128. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  30129. key: 0,
  30130. role: "button",
  30131. "aria-label": vue.unref(t)("el.inputNumber.decrease"),
  30132. class: vue.normalizeClass([vue.unref(ns).e("decrease"), vue.unref(ns).is("disabled", vue.unref(minDisabled))]),
  30133. onKeydown: vue.withKeys(decrease, ["enter"])
  30134. }, [
  30135. vue.createVNode(vue.unref(ElIcon), null, {
  30136. default: vue.withCtx(() => [
  30137. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_down_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(minus_default), { key: 1 }))
  30138. ]),
  30139. _: 1
  30140. })
  30141. ], 42, _hoisted_1$s)), [
  30142. [vue.unref(vRepeatClick), decrease]
  30143. ]) : vue.createCommentVNode("v-if", true),
  30144. _ctx.controls ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  30145. key: 1,
  30146. role: "button",
  30147. "aria-label": vue.unref(t)("el.inputNumber.increase"),
  30148. class: vue.normalizeClass([vue.unref(ns).e("increase"), vue.unref(ns).is("disabled", vue.unref(maxDisabled))]),
  30149. onKeydown: vue.withKeys(increase, ["enter"])
  30150. }, [
  30151. vue.createVNode(vue.unref(ElIcon), null, {
  30152. default: vue.withCtx(() => [
  30153. vue.unref(controlsAtRight) ? (vue.openBlock(), vue.createBlock(vue.unref(arrow_up_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(plus_default), { key: 1 }))
  30154. ]),
  30155. _: 1
  30156. })
  30157. ], 42, _hoisted_2$i)), [
  30158. [vue.unref(vRepeatClick), increase]
  30159. ]) : vue.createCommentVNode("v-if", true),
  30160. vue.createVNode(vue.unref(ElInput), {
  30161. id: _ctx.id,
  30162. ref_key: "input",
  30163. ref: input,
  30164. type: "number",
  30165. step: _ctx.step,
  30166. "model-value": vue.unref(displayValue),
  30167. placeholder: _ctx.placeholder,
  30168. readonly: _ctx.readonly,
  30169. disabled: vue.unref(inputNumberDisabled),
  30170. size: vue.unref(inputNumberSize),
  30171. max: _ctx.max,
  30172. min: _ctx.min,
  30173. name: _ctx.name,
  30174. label: _ctx.label,
  30175. "validate-event": false,
  30176. onKeydown: [
  30177. vue.withKeys(vue.withModifiers(increase, ["prevent"]), ["up"]),
  30178. vue.withKeys(vue.withModifiers(decrease, ["prevent"]), ["down"])
  30179. ],
  30180. onBlur: handleBlur,
  30181. onFocus: handleFocus,
  30182. onInput: handleInput,
  30183. onChange: handleInputChange
  30184. }, null, 8, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "label", "onKeydown"])
  30185. ], 34);
  30186. };
  30187. }
  30188. });
  30189. var InputNumber = /* @__PURE__ */ _export_sfc(_sfc_main$W, [["__file", "input-number.vue"]]);
  30190. const ElInputNumber = withInstall(InputNumber);
  30191. const linkProps = buildProps({
  30192. type: {
  30193. type: String,
  30194. values: ["primary", "success", "warning", "info", "danger", "default"],
  30195. default: "default"
  30196. },
  30197. underline: {
  30198. type: Boolean,
  30199. default: true
  30200. },
  30201. disabled: { type: Boolean, default: false },
  30202. href: { type: String, default: "" },
  30203. icon: {
  30204. type: iconPropType
  30205. }
  30206. });
  30207. const linkEmits = {
  30208. click: (evt) => evt instanceof MouseEvent
  30209. };
  30210. const _hoisted_1$r = ["href"];
  30211. const __default__$E = vue.defineComponent({
  30212. name: "ElLink"
  30213. });
  30214. const _sfc_main$V = /* @__PURE__ */ vue.defineComponent({
  30215. ...__default__$E,
  30216. props: linkProps,
  30217. emits: linkEmits,
  30218. setup(__props, { emit }) {
  30219. const props = __props;
  30220. const ns = useNamespace("link");
  30221. function handleClick(event) {
  30222. if (!props.disabled)
  30223. emit("click", event);
  30224. }
  30225. return (_ctx, _cache) => {
  30226. return vue.openBlock(), vue.createElementBlock("a", {
  30227. class: vue.normalizeClass([
  30228. vue.unref(ns).b(),
  30229. vue.unref(ns).m(_ctx.type),
  30230. vue.unref(ns).is("disabled", _ctx.disabled),
  30231. vue.unref(ns).is("underline", _ctx.underline && !_ctx.disabled)
  30232. ]),
  30233. href: _ctx.disabled || !_ctx.href ? void 0 : _ctx.href,
  30234. onClick: handleClick
  30235. }, [
  30236. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  30237. default: vue.withCtx(() => [
  30238. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  30239. ]),
  30240. _: 1
  30241. })) : vue.createCommentVNode("v-if", true),
  30242. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("span", {
  30243. key: 1,
  30244. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  30245. }, [
  30246. vue.renderSlot(_ctx.$slots, "default")
  30247. ], 2)) : vue.createCommentVNode("v-if", true),
  30248. _ctx.$slots.icon ? vue.renderSlot(_ctx.$slots, "icon", { key: 2 }) : vue.createCommentVNode("v-if", true)
  30249. ], 10, _hoisted_1$r);
  30250. };
  30251. }
  30252. });
  30253. var Link = /* @__PURE__ */ _export_sfc(_sfc_main$V, [["__file", "link.vue"]]);
  30254. const ElLink = withInstall(Link);
  30255. class SubMenu$1 {
  30256. constructor(parent, domNode) {
  30257. this.parent = parent;
  30258. this.domNode = domNode;
  30259. this.subIndex = 0;
  30260. this.subIndex = 0;
  30261. this.init();
  30262. }
  30263. init() {
  30264. this.subMenuItems = this.domNode.querySelectorAll("li");
  30265. this.addListeners();
  30266. }
  30267. gotoSubIndex(idx) {
  30268. if (idx === this.subMenuItems.length) {
  30269. idx = 0;
  30270. } else if (idx < 0) {
  30271. idx = this.subMenuItems.length - 1;
  30272. }
  30273. this.subMenuItems[idx].focus();
  30274. this.subIndex = idx;
  30275. }
  30276. addListeners() {
  30277. const parentNode = this.parent.domNode;
  30278. Array.prototype.forEach.call(this.subMenuItems, (el) => {
  30279. el.addEventListener("keydown", (event) => {
  30280. let prevDef = false;
  30281. switch (event.code) {
  30282. case EVENT_CODE.down: {
  30283. this.gotoSubIndex(this.subIndex + 1);
  30284. prevDef = true;
  30285. break;
  30286. }
  30287. case EVENT_CODE.up: {
  30288. this.gotoSubIndex(this.subIndex - 1);
  30289. prevDef = true;
  30290. break;
  30291. }
  30292. case EVENT_CODE.tab: {
  30293. triggerEvent(parentNode, "mouseleave");
  30294. break;
  30295. }
  30296. case EVENT_CODE.enter:
  30297. case EVENT_CODE.space: {
  30298. prevDef = true;
  30299. event.currentTarget.click();
  30300. break;
  30301. }
  30302. }
  30303. if (prevDef) {
  30304. event.preventDefault();
  30305. event.stopPropagation();
  30306. }
  30307. return false;
  30308. });
  30309. });
  30310. }
  30311. }
  30312. var SubMenu$2 = SubMenu$1;
  30313. class MenuItem$1 {
  30314. constructor(domNode, namespace) {
  30315. this.domNode = domNode;
  30316. this.submenu = null;
  30317. this.submenu = null;
  30318. this.init(namespace);
  30319. }
  30320. init(namespace) {
  30321. this.domNode.setAttribute("tabindex", "0");
  30322. const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
  30323. if (menuChild) {
  30324. this.submenu = new SubMenu$2(this, menuChild);
  30325. }
  30326. this.addListeners();
  30327. }
  30328. addListeners() {
  30329. this.domNode.addEventListener("keydown", (event) => {
  30330. let prevDef = false;
  30331. switch (event.code) {
  30332. case EVENT_CODE.down: {
  30333. triggerEvent(event.currentTarget, "mouseenter");
  30334. this.submenu && this.submenu.gotoSubIndex(0);
  30335. prevDef = true;
  30336. break;
  30337. }
  30338. case EVENT_CODE.up: {
  30339. triggerEvent(event.currentTarget, "mouseenter");
  30340. this.submenu && this.submenu.gotoSubIndex(this.submenu.subMenuItems.length - 1);
  30341. prevDef = true;
  30342. break;
  30343. }
  30344. case EVENT_CODE.tab: {
  30345. triggerEvent(event.currentTarget, "mouseleave");
  30346. break;
  30347. }
  30348. case EVENT_CODE.enter:
  30349. case EVENT_CODE.space: {
  30350. prevDef = true;
  30351. event.currentTarget.click();
  30352. break;
  30353. }
  30354. }
  30355. if (prevDef) {
  30356. event.preventDefault();
  30357. }
  30358. });
  30359. }
  30360. }
  30361. var MenuItem$2 = MenuItem$1;
  30362. class Menu$1 {
  30363. constructor(domNode, namespace) {
  30364. this.domNode = domNode;
  30365. this.init(namespace);
  30366. }
  30367. init(namespace) {
  30368. const menuChildren = this.domNode.childNodes;
  30369. Array.from(menuChildren).forEach((child) => {
  30370. if (child.nodeType === 1) {
  30371. new MenuItem$2(child, namespace);
  30372. }
  30373. });
  30374. }
  30375. }
  30376. var Menubar = Menu$1;
  30377. const _sfc_main$U = vue.defineComponent({
  30378. name: "ElMenuCollapseTransition",
  30379. setup() {
  30380. const ns = useNamespace("menu");
  30381. const listeners = {
  30382. onBeforeEnter: (el) => el.style.opacity = "0.2",
  30383. onEnter(el, done) {
  30384. addClass(el, `${ns.namespace.value}-opacity-transition`);
  30385. el.style.opacity = "1";
  30386. done();
  30387. },
  30388. onAfterEnter(el) {
  30389. removeClass(el, `${ns.namespace.value}-opacity-transition`);
  30390. el.style.opacity = "";
  30391. },
  30392. onBeforeLeave(el) {
  30393. if (!el.dataset) {
  30394. el.dataset = {};
  30395. }
  30396. if (hasClass(el, ns.m("collapse"))) {
  30397. removeClass(el, ns.m("collapse"));
  30398. el.dataset.oldOverflow = el.style.overflow;
  30399. el.dataset.scrollWidth = el.clientWidth.toString();
  30400. addClass(el, ns.m("collapse"));
  30401. } else {
  30402. addClass(el, ns.m("collapse"));
  30403. el.dataset.oldOverflow = el.style.overflow;
  30404. el.dataset.scrollWidth = el.clientWidth.toString();
  30405. removeClass(el, ns.m("collapse"));
  30406. }
  30407. el.style.width = `${el.scrollWidth}px`;
  30408. el.style.overflow = "hidden";
  30409. },
  30410. onLeave(el) {
  30411. addClass(el, "horizontal-collapse-transition");
  30412. el.style.width = `${el.dataset.scrollWidth}px`;
  30413. }
  30414. };
  30415. return {
  30416. listeners
  30417. };
  30418. }
  30419. });
  30420. function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
  30421. return vue.openBlock(), vue.createBlock(vue.Transition, vue.mergeProps({ mode: "out-in" }, _ctx.listeners), {
  30422. default: vue.withCtx(() => [
  30423. vue.renderSlot(_ctx.$slots, "default")
  30424. ]),
  30425. _: 3
  30426. }, 16);
  30427. }
  30428. var ElMenuCollapseTransition = /* @__PURE__ */ _export_sfc(_sfc_main$U, [["render", _sfc_render$e], ["__file", "menu-collapse-transition.vue"]]);
  30429. function useMenu(instance, currentIndex) {
  30430. const indexPath = vue.computed(() => {
  30431. let parent = instance.parent;
  30432. const path = [currentIndex.value];
  30433. while (parent.type.name !== "ElMenu") {
  30434. if (parent.props.index) {
  30435. path.unshift(parent.props.index);
  30436. }
  30437. parent = parent.parent;
  30438. }
  30439. return path;
  30440. });
  30441. const parentMenu = vue.computed(() => {
  30442. let parent = instance.parent;
  30443. while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) {
  30444. parent = parent.parent;
  30445. }
  30446. return parent;
  30447. });
  30448. return {
  30449. parentMenu,
  30450. indexPath
  30451. };
  30452. }
  30453. function useMenuColor(props) {
  30454. const menuBarColor = vue.computed(() => {
  30455. const color = props.backgroundColor;
  30456. if (!color) {
  30457. return "";
  30458. } else {
  30459. return new TinyColor(color).shade(20).toString();
  30460. }
  30461. });
  30462. return menuBarColor;
  30463. }
  30464. const useMenuCssVar = (props, level) => {
  30465. const ns = useNamespace("menu");
  30466. return vue.computed(() => {
  30467. return ns.cssVarBlock({
  30468. "text-color": props.textColor || "",
  30469. "hover-text-color": props.textColor || "",
  30470. "bg-color": props.backgroundColor || "",
  30471. "hover-bg-color": useMenuColor(props).value || "",
  30472. "active-color": props.activeTextColor || "",
  30473. level: `${level}`
  30474. });
  30475. });
  30476. };
  30477. const subMenuProps = buildProps({
  30478. index: {
  30479. type: String,
  30480. required: true
  30481. },
  30482. showTimeout: {
  30483. type: Number,
  30484. default: 300
  30485. },
  30486. hideTimeout: {
  30487. type: Number,
  30488. default: 300
  30489. },
  30490. popperClass: String,
  30491. disabled: Boolean,
  30492. popperAppendToBody: {
  30493. type: Boolean,
  30494. default: void 0
  30495. },
  30496. popperOffset: {
  30497. type: Number,
  30498. default: 6
  30499. },
  30500. expandCloseIcon: {
  30501. type: iconPropType
  30502. },
  30503. expandOpenIcon: {
  30504. type: iconPropType
  30505. },
  30506. collapseCloseIcon: {
  30507. type: iconPropType
  30508. },
  30509. collapseOpenIcon: {
  30510. type: iconPropType
  30511. }
  30512. });
  30513. const COMPONENT_NAME$c = "ElSubMenu";
  30514. var SubMenu = vue.defineComponent({
  30515. name: COMPONENT_NAME$c,
  30516. props: subMenuProps,
  30517. setup(props, { slots, expose }) {
  30518. const instance = vue.getCurrentInstance();
  30519. const { indexPath, parentMenu } = useMenu(instance, vue.computed(() => props.index));
  30520. const nsMenu = useNamespace("menu");
  30521. const nsSubMenu = useNamespace("sub-menu");
  30522. const rootMenu = vue.inject("rootMenu");
  30523. if (!rootMenu)
  30524. throwError(COMPONENT_NAME$c, "can not inject root menu");
  30525. const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`);
  30526. if (!subMenu)
  30527. throwError(COMPONENT_NAME$c, "can not inject sub menu");
  30528. const items = vue.ref({});
  30529. const subMenus = vue.ref({});
  30530. let timeout;
  30531. const mouseInChild = vue.ref(false);
  30532. const verticalTitleRef = vue.ref();
  30533. const vPopper = vue.ref(null);
  30534. const currentPlacement = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
  30535. const subMenuTitleIcon = vue.computed(() => {
  30536. 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;
  30537. });
  30538. const isFirstLevel = vue.computed(() => {
  30539. return subMenu.level === 0;
  30540. });
  30541. const appendToBody = vue.computed(() => {
  30542. return props.popperAppendToBody === void 0 ? isFirstLevel.value : Boolean(props.popperAppendToBody);
  30543. });
  30544. const menuTransitionName = vue.computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
  30545. const fallbackPlacements = vue.computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
  30546. "bottom-start",
  30547. "bottom-end",
  30548. "top-start",
  30549. "top-end",
  30550. "right-start",
  30551. "left-start"
  30552. ] : [
  30553. "right-start",
  30554. "left-start",
  30555. "bottom-start",
  30556. "bottom-end",
  30557. "top-start",
  30558. "top-end"
  30559. ]);
  30560. const opened = vue.computed(() => rootMenu.openedMenus.includes(props.index));
  30561. const active = vue.computed(() => {
  30562. let isActive = false;
  30563. Object.values(items.value).forEach((item2) => {
  30564. if (item2.active) {
  30565. isActive = true;
  30566. }
  30567. });
  30568. Object.values(subMenus.value).forEach((subItem) => {
  30569. if (subItem.active) {
  30570. isActive = true;
  30571. }
  30572. });
  30573. return isActive;
  30574. });
  30575. const backgroundColor = vue.computed(() => rootMenu.props.backgroundColor || "");
  30576. const activeTextColor = vue.computed(() => rootMenu.props.activeTextColor || "");
  30577. const textColor = vue.computed(() => rootMenu.props.textColor || "");
  30578. const mode = vue.computed(() => rootMenu.props.mode);
  30579. const item = vue.reactive({
  30580. index: props.index,
  30581. indexPath,
  30582. active
  30583. });
  30584. const titleStyle = vue.computed(() => {
  30585. if (mode.value !== "horizontal") {
  30586. return {
  30587. color: textColor.value
  30588. };
  30589. }
  30590. return {
  30591. borderBottomColor: active.value ? rootMenu.props.activeTextColor ? activeTextColor.value : "" : "transparent",
  30592. color: active.value ? activeTextColor.value : textColor.value
  30593. };
  30594. });
  30595. const doDestroy = () => {
  30596. var _a, _b, _c;
  30597. return (_c = (_b = (_a = vPopper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.popperInstanceRef) == null ? void 0 : _c.destroy();
  30598. };
  30599. const handleCollapseToggle = (value) => {
  30600. if (!value) {
  30601. doDestroy();
  30602. }
  30603. };
  30604. const handleClick = () => {
  30605. if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled)
  30606. return;
  30607. rootMenu.handleSubMenuClick({
  30608. index: props.index,
  30609. indexPath: indexPath.value,
  30610. active: active.value
  30611. });
  30612. };
  30613. const handleMouseenter = (event, showTimeout = props.showTimeout) => {
  30614. var _a;
  30615. if (event.type === "focus") {
  30616. return;
  30617. }
  30618. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
  30619. return;
  30620. }
  30621. subMenu.mouseInChild.value = true;
  30622. timeout == null ? void 0 : timeout();
  30623. ({ stop: timeout } = useTimeoutFn(() => {
  30624. rootMenu.openMenu(props.index, indexPath.value);
  30625. }, showTimeout));
  30626. if (appendToBody.value) {
  30627. (_a = parentMenu.value.vnode.el) == null ? void 0 : _a.dispatchEvent(new MouseEvent("mouseenter"));
  30628. }
  30629. };
  30630. const handleMouseleave = (deepDispatch = false) => {
  30631. var _a, _b;
  30632. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
  30633. return;
  30634. }
  30635. timeout == null ? void 0 : timeout();
  30636. subMenu.mouseInChild.value = false;
  30637. ({ stop: timeout } = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), props.hideTimeout));
  30638. if (appendToBody.value && deepDispatch) {
  30639. if (((_a = instance.parent) == null ? void 0 : _a.type.name) === "ElSubMenu") {
  30640. (_b = subMenu.handleMouseleave) == null ? void 0 : _b.call(subMenu, true);
  30641. }
  30642. }
  30643. };
  30644. vue.watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
  30645. {
  30646. const addSubMenu = (item2) => {
  30647. subMenus.value[item2.index] = item2;
  30648. };
  30649. const removeSubMenu = (item2) => {
  30650. delete subMenus.value[item2.index];
  30651. };
  30652. vue.provide(`subMenu:${instance.uid}`, {
  30653. addSubMenu,
  30654. removeSubMenu,
  30655. handleMouseleave,
  30656. mouseInChild,
  30657. level: subMenu.level + 1
  30658. });
  30659. }
  30660. expose({
  30661. opened
  30662. });
  30663. vue.onMounted(() => {
  30664. rootMenu.addSubMenu(item);
  30665. subMenu.addSubMenu(item);
  30666. });
  30667. vue.onBeforeUnmount(() => {
  30668. subMenu.removeSubMenu(item);
  30669. rootMenu.removeSubMenu(item);
  30670. });
  30671. return () => {
  30672. var _a;
  30673. const titleTag = [
  30674. (_a = slots.title) == null ? void 0 : _a.call(slots),
  30675. vue.h(ElIcon, {
  30676. class: nsSubMenu.e("icon-arrow"),
  30677. style: {
  30678. transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none"
  30679. }
  30680. }, {
  30681. default: () => isString(subMenuTitleIcon.value) ? vue.h(instance.appContext.components[subMenuTitleIcon.value]) : vue.h(subMenuTitleIcon.value)
  30682. })
  30683. ];
  30684. const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
  30685. const child = rootMenu.isMenuPopup ? vue.h(ElTooltip, {
  30686. ref: vPopper,
  30687. visible: opened.value,
  30688. effect: "light",
  30689. pure: true,
  30690. offset: props.popperOffset,
  30691. showArrow: false,
  30692. persistent: true,
  30693. popperClass: props.popperClass,
  30694. placement: currentPlacement.value,
  30695. teleported: appendToBody.value,
  30696. fallbackPlacements: fallbackPlacements.value,
  30697. transition: menuTransitionName.value,
  30698. gpuAcceleration: false
  30699. }, {
  30700. content: () => {
  30701. var _a2;
  30702. return vue.h("div", {
  30703. class: [
  30704. nsMenu.m(mode.value),
  30705. nsMenu.m("popup-container"),
  30706. props.popperClass
  30707. ],
  30708. onMouseenter: (evt) => handleMouseenter(evt, 100),
  30709. onMouseleave: () => handleMouseleave(true),
  30710. onFocus: (evt) => handleMouseenter(evt, 100)
  30711. }, [
  30712. vue.h("ul", {
  30713. class: [
  30714. nsMenu.b(),
  30715. nsMenu.m("popup"),
  30716. nsMenu.m(`popup-${currentPlacement.value}`)
  30717. ],
  30718. style: ulStyle.value
  30719. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)])
  30720. ]);
  30721. },
  30722. default: () => vue.h("div", {
  30723. class: nsSubMenu.e("title"),
  30724. style: [
  30725. titleStyle.value,
  30726. { backgroundColor: backgroundColor.value }
  30727. ],
  30728. onClick: handleClick
  30729. }, titleTag)
  30730. }) : vue.h(vue.Fragment, {}, [
  30731. vue.h("div", {
  30732. class: nsSubMenu.e("title"),
  30733. style: [
  30734. titleStyle.value,
  30735. { backgroundColor: backgroundColor.value }
  30736. ],
  30737. ref: verticalTitleRef,
  30738. onClick: handleClick
  30739. }, titleTag),
  30740. vue.h(_CollapseTransition, {}, {
  30741. default: () => {
  30742. var _a2;
  30743. return vue.withDirectives(vue.h("ul", {
  30744. role: "menu",
  30745. class: [nsMenu.b(), nsMenu.m("inline")],
  30746. style: ulStyle.value
  30747. }, [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)]), [[vue.vShow, opened.value]]);
  30748. }
  30749. })
  30750. ]);
  30751. return vue.h("li", {
  30752. class: [
  30753. nsSubMenu.b(),
  30754. nsSubMenu.is("active", active.value),
  30755. nsSubMenu.is("opened", opened.value),
  30756. nsSubMenu.is("disabled", props.disabled)
  30757. ],
  30758. role: "menuitem",
  30759. ariaHaspopup: true,
  30760. ariaExpanded: opened.value,
  30761. onMouseenter: handleMouseenter,
  30762. onMouseleave: () => handleMouseleave(true),
  30763. onFocus: handleMouseenter
  30764. }, [child]);
  30765. };
  30766. }
  30767. });
  30768. const menuProps = buildProps({
  30769. mode: {
  30770. type: String,
  30771. values: ["horizontal", "vertical"],
  30772. default: "vertical"
  30773. },
  30774. defaultActive: {
  30775. type: String,
  30776. default: ""
  30777. },
  30778. defaultOpeneds: {
  30779. type: definePropType(Array),
  30780. default: () => mutable([])
  30781. },
  30782. uniqueOpened: Boolean,
  30783. router: Boolean,
  30784. menuTrigger: {
  30785. type: String,
  30786. values: ["hover", "click"],
  30787. default: "hover"
  30788. },
  30789. collapse: Boolean,
  30790. backgroundColor: String,
  30791. textColor: String,
  30792. activeTextColor: String,
  30793. collapseTransition: {
  30794. type: Boolean,
  30795. default: true
  30796. },
  30797. ellipsis: {
  30798. type: Boolean,
  30799. default: true
  30800. }
  30801. });
  30802. const checkIndexPath = (indexPath) => Array.isArray(indexPath) && indexPath.every((path) => isString(path));
  30803. const menuEmits = {
  30804. close: (index, indexPath) => isString(index) && checkIndexPath(indexPath),
  30805. open: (index, indexPath) => isString(index) && checkIndexPath(indexPath),
  30806. select: (index, indexPath, item, routerResult) => isString(index) && checkIndexPath(indexPath) && isObject$1(item) && (routerResult === void 0 || routerResult instanceof Promise)
  30807. };
  30808. var Menu = vue.defineComponent({
  30809. name: "ElMenu",
  30810. props: menuProps,
  30811. emits: menuEmits,
  30812. setup(props, { emit, slots, expose }) {
  30813. const instance = vue.getCurrentInstance();
  30814. const router = instance.appContext.config.globalProperties.$router;
  30815. const menu = vue.ref();
  30816. const nsMenu = useNamespace("menu");
  30817. const nsSubMenu = useNamespace("sub-menu");
  30818. const sliceIndex = vue.ref(-1);
  30819. const openedMenus = vue.ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
  30820. const activeIndex = vue.ref(props.defaultActive);
  30821. const items = vue.ref({});
  30822. const subMenus = vue.ref({});
  30823. const isMenuPopup = vue.computed(() => {
  30824. return props.mode === "horizontal" || props.mode === "vertical" && props.collapse;
  30825. });
  30826. const initMenu = () => {
  30827. const activeItem = activeIndex.value && items.value[activeIndex.value];
  30828. if (!activeItem || props.mode === "horizontal" || props.collapse)
  30829. return;
  30830. const indexPath = activeItem.indexPath;
  30831. indexPath.forEach((index) => {
  30832. const subMenu = subMenus.value[index];
  30833. subMenu && openMenu(index, subMenu.indexPath);
  30834. });
  30835. };
  30836. const openMenu = (index, indexPath) => {
  30837. if (openedMenus.value.includes(index))
  30838. return;
  30839. if (props.uniqueOpened) {
  30840. openedMenus.value = openedMenus.value.filter((index2) => indexPath.includes(index2));
  30841. }
  30842. openedMenus.value.push(index);
  30843. emit("open", index, indexPath);
  30844. };
  30845. const closeMenu = (index, indexPath) => {
  30846. const i = openedMenus.value.indexOf(index);
  30847. if (i !== -1) {
  30848. openedMenus.value.splice(i, 1);
  30849. }
  30850. emit("close", index, indexPath);
  30851. };
  30852. const handleSubMenuClick = ({
  30853. index,
  30854. indexPath
  30855. }) => {
  30856. const isOpened = openedMenus.value.includes(index);
  30857. if (isOpened) {
  30858. closeMenu(index, indexPath);
  30859. } else {
  30860. openMenu(index, indexPath);
  30861. }
  30862. };
  30863. const handleMenuItemClick = (menuItem) => {
  30864. if (props.mode === "horizontal" || props.collapse) {
  30865. openedMenus.value = [];
  30866. }
  30867. const { index, indexPath } = menuItem;
  30868. if (index === void 0 || indexPath === void 0)
  30869. return;
  30870. if (props.router && router) {
  30871. const route = menuItem.route || index;
  30872. const routerResult = router.push(route).then((res) => {
  30873. if (!res)
  30874. activeIndex.value = index;
  30875. return res;
  30876. });
  30877. emit("select", index, indexPath, { index, indexPath, route }, routerResult);
  30878. } else {
  30879. activeIndex.value = index;
  30880. emit("select", index, indexPath, { index, indexPath });
  30881. }
  30882. };
  30883. const updateActiveIndex = (val) => {
  30884. const itemsInData = items.value;
  30885. const item = itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive];
  30886. if (item) {
  30887. activeIndex.value = item.index;
  30888. } else {
  30889. activeIndex.value = val;
  30890. }
  30891. };
  30892. const calcSliceIndex = () => {
  30893. var _a, _b;
  30894. if (!menu.value)
  30895. return -1;
  30896. const items2 = Array.from((_b = (_a = menu.value) == null ? void 0 : _a.childNodes) != null ? _b : []).filter((item) => item.nodeName !== "#text" || item.nodeValue);
  30897. const moreItemWidth = 64;
  30898. const paddingLeft = Number.parseInt(getComputedStyle(menu.value).paddingLeft, 10);
  30899. const paddingRight = Number.parseInt(getComputedStyle(menu.value).paddingRight, 10);
  30900. const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
  30901. let calcWidth = 0;
  30902. let sliceIndex2 = 0;
  30903. items2.forEach((item, index) => {
  30904. calcWidth += item.offsetWidth || 0;
  30905. if (calcWidth <= menuWidth - moreItemWidth) {
  30906. sliceIndex2 = index + 1;
  30907. }
  30908. });
  30909. return sliceIndex2 === items2.length ? -1 : sliceIndex2;
  30910. };
  30911. const debounce = (fn, wait = 33.34) => {
  30912. let timmer;
  30913. return () => {
  30914. timmer && clearTimeout(timmer);
  30915. timmer = setTimeout(() => {
  30916. fn();
  30917. }, wait);
  30918. };
  30919. };
  30920. let isFirstTimeRender = true;
  30921. const handleResize = () => {
  30922. const callback = () => {
  30923. sliceIndex.value = -1;
  30924. vue.nextTick(() => {
  30925. sliceIndex.value = calcSliceIndex();
  30926. });
  30927. };
  30928. isFirstTimeRender ? callback() : debounce(callback)();
  30929. isFirstTimeRender = false;
  30930. };
  30931. vue.watch(() => props.defaultActive, (currentActive) => {
  30932. if (!items.value[currentActive]) {
  30933. activeIndex.value = "";
  30934. }
  30935. updateActiveIndex(currentActive);
  30936. });
  30937. vue.watch(() => props.collapse, (value) => {
  30938. if (value)
  30939. openedMenus.value = [];
  30940. });
  30941. vue.watch(items.value, initMenu);
  30942. let resizeStopper;
  30943. vue.watchEffect(() => {
  30944. if (props.mode === "horizontal" && props.ellipsis)
  30945. resizeStopper = useResizeObserver(menu, handleResize).stop;
  30946. else
  30947. resizeStopper == null ? void 0 : resizeStopper();
  30948. });
  30949. {
  30950. const addSubMenu = (item) => {
  30951. subMenus.value[item.index] = item;
  30952. };
  30953. const removeSubMenu = (item) => {
  30954. delete subMenus.value[item.index];
  30955. };
  30956. const addMenuItem = (item) => {
  30957. items.value[item.index] = item;
  30958. };
  30959. const removeMenuItem = (item) => {
  30960. delete items.value[item.index];
  30961. };
  30962. vue.provide("rootMenu", vue.reactive({
  30963. props,
  30964. openedMenus,
  30965. items,
  30966. subMenus,
  30967. activeIndex,
  30968. isMenuPopup,
  30969. addMenuItem,
  30970. removeMenuItem,
  30971. addSubMenu,
  30972. removeSubMenu,
  30973. openMenu,
  30974. closeMenu,
  30975. handleMenuItemClick,
  30976. handleSubMenuClick
  30977. }));
  30978. vue.provide(`subMenu:${instance.uid}`, {
  30979. addSubMenu,
  30980. removeSubMenu,
  30981. mouseInChild: vue.ref(false),
  30982. level: 0
  30983. });
  30984. }
  30985. vue.onMounted(() => {
  30986. if (props.mode === "horizontal") {
  30987. new Menubar(instance.vnode.el, nsMenu.namespace.value);
  30988. }
  30989. });
  30990. {
  30991. const open = (index) => {
  30992. const { indexPath } = subMenus.value[index];
  30993. indexPath.forEach((i) => openMenu(i, indexPath));
  30994. };
  30995. expose({
  30996. open,
  30997. close: closeMenu,
  30998. handleResize
  30999. });
  31000. }
  31001. return () => {
  31002. var _a, _b;
  31003. let slot = (_b = (_a = slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : [];
  31004. const vShowMore = [];
  31005. if (props.mode === "horizontal" && menu.value) {
  31006. const originalSlot = flattedChildren(slot);
  31007. const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
  31008. const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
  31009. if ((slotMore == null ? void 0 : slotMore.length) && props.ellipsis) {
  31010. slot = slotDefault;
  31011. vShowMore.push(vue.h(SubMenu, {
  31012. index: "sub-menu-more",
  31013. class: nsSubMenu.e("hide-arrow")
  31014. }, {
  31015. title: () => vue.h(ElIcon, {
  31016. class: nsSubMenu.e("icon-more")
  31017. }, { default: () => vue.h(more_default) }),
  31018. default: () => slotMore
  31019. }));
  31020. }
  31021. }
  31022. const ulStyle = useMenuCssVar(props, 0);
  31023. const vMenu = vue.h("ul", {
  31024. key: String(props.collapse),
  31025. role: "menubar",
  31026. ref: menu,
  31027. style: ulStyle.value,
  31028. class: {
  31029. [nsMenu.b()]: true,
  31030. [nsMenu.m(props.mode)]: true,
  31031. [nsMenu.m("collapse")]: props.collapse
  31032. }
  31033. }, [...slot, ...vShowMore]);
  31034. if (props.collapseTransition && props.mode === "vertical") {
  31035. return vue.h(ElMenuCollapseTransition, () => vMenu);
  31036. }
  31037. return vMenu;
  31038. };
  31039. }
  31040. });
  31041. const menuItemProps = buildProps({
  31042. index: {
  31043. type: definePropType([String, null]),
  31044. default: null
  31045. },
  31046. route: {
  31047. type: definePropType([String, Object])
  31048. },
  31049. disabled: Boolean
  31050. });
  31051. const menuItemEmits = {
  31052. click: (item) => isString(item.index) && Array.isArray(item.indexPath)
  31053. };
  31054. const COMPONENT_NAME$b = "ElMenuItem";
  31055. const _sfc_main$T = vue.defineComponent({
  31056. name: COMPONENT_NAME$b,
  31057. components: {
  31058. ElTooltip
  31059. },
  31060. props: menuItemProps,
  31061. emits: menuItemEmits,
  31062. setup(props, { emit }) {
  31063. const instance = vue.getCurrentInstance();
  31064. const rootMenu = vue.inject("rootMenu");
  31065. const nsMenu = useNamespace("menu");
  31066. const nsMenuItem = useNamespace("menu-item");
  31067. if (!rootMenu)
  31068. throwError(COMPONENT_NAME$b, "can not inject root menu");
  31069. const { parentMenu, indexPath } = useMenu(instance, vue.toRef(props, "index"));
  31070. const subMenu = vue.inject(`subMenu:${parentMenu.value.uid}`);
  31071. if (!subMenu)
  31072. throwError(COMPONENT_NAME$b, "can not inject sub menu");
  31073. const active = vue.computed(() => props.index === rootMenu.activeIndex);
  31074. const item = vue.reactive({
  31075. index: props.index,
  31076. indexPath,
  31077. active
  31078. });
  31079. const handleClick = () => {
  31080. if (!props.disabled) {
  31081. rootMenu.handleMenuItemClick({
  31082. index: props.index,
  31083. indexPath: indexPath.value,
  31084. route: props.route
  31085. });
  31086. emit("click", item);
  31087. }
  31088. };
  31089. vue.onMounted(() => {
  31090. subMenu.addSubMenu(item);
  31091. rootMenu.addMenuItem(item);
  31092. });
  31093. vue.onBeforeUnmount(() => {
  31094. subMenu.removeSubMenu(item);
  31095. rootMenu.removeMenuItem(item);
  31096. });
  31097. return {
  31098. Effect,
  31099. parentMenu,
  31100. rootMenu,
  31101. active,
  31102. nsMenu,
  31103. nsMenuItem,
  31104. handleClick
  31105. };
  31106. }
  31107. });
  31108. function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
  31109. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  31110. return vue.openBlock(), vue.createElementBlock("li", {
  31111. class: vue.normalizeClass([
  31112. _ctx.nsMenuItem.b(),
  31113. _ctx.nsMenuItem.is("active", _ctx.active),
  31114. _ctx.nsMenuItem.is("disabled", _ctx.disabled)
  31115. ]),
  31116. role: "menuitem",
  31117. tabindex: "-1",
  31118. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  31119. }, [
  31120. _ctx.parentMenu.type.name === "ElMenu" && _ctx.rootMenu.props.collapse && _ctx.$slots.title ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  31121. key: 0,
  31122. effect: _ctx.Effect.DARK,
  31123. placement: "right",
  31124. "fallback-placements": ["left"],
  31125. persistent: ""
  31126. }, {
  31127. content: vue.withCtx(() => [
  31128. vue.renderSlot(_ctx.$slots, "title")
  31129. ]),
  31130. default: vue.withCtx(() => [
  31131. vue.createElementVNode("div", {
  31132. class: vue.normalizeClass(_ctx.nsMenu.be("tooltip", "trigger"))
  31133. }, [
  31134. vue.renderSlot(_ctx.$slots, "default")
  31135. ], 2)
  31136. ]),
  31137. _: 3
  31138. }, 8, ["effect"])) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  31139. vue.renderSlot(_ctx.$slots, "default"),
  31140. vue.renderSlot(_ctx.$slots, "title")
  31141. ], 64))
  31142. ], 2);
  31143. }
  31144. var MenuItem = /* @__PURE__ */ _export_sfc(_sfc_main$T, [["render", _sfc_render$d], ["__file", "menu-item.vue"]]);
  31145. const menuItemGroupProps = {
  31146. title: String
  31147. };
  31148. const COMPONENT_NAME$a = "ElMenuItemGroup";
  31149. const _sfc_main$S = vue.defineComponent({
  31150. name: COMPONENT_NAME$a,
  31151. props: menuItemGroupProps,
  31152. setup() {
  31153. const ns = useNamespace("menu-item-group");
  31154. return {
  31155. ns
  31156. };
  31157. }
  31158. });
  31159. function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
  31160. return vue.openBlock(), vue.createElementBlock("li", {
  31161. class: vue.normalizeClass(_ctx.ns.b())
  31162. }, [
  31163. vue.createElementVNode("div", {
  31164. class: vue.normalizeClass(_ctx.ns.e("title"))
  31165. }, [
  31166. !_ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  31167. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  31168. ], 64)) : vue.renderSlot(_ctx.$slots, "title", { key: 1 })
  31169. ], 2),
  31170. vue.createElementVNode("ul", null, [
  31171. vue.renderSlot(_ctx.$slots, "default")
  31172. ])
  31173. ], 2);
  31174. }
  31175. var MenuItemGroup = /* @__PURE__ */ _export_sfc(_sfc_main$S, [["render", _sfc_render$c], ["__file", "menu-item-group.vue"]]);
  31176. const ElMenu = withInstall(Menu, {
  31177. MenuItem,
  31178. MenuItemGroup,
  31179. SubMenu
  31180. });
  31181. const ElMenuItem = withNoopInstall(MenuItem);
  31182. const ElMenuItemGroup = withNoopInstall(MenuItemGroup);
  31183. const ElSubMenu = withNoopInstall(SubMenu);
  31184. const pageHeaderProps = buildProps({
  31185. icon: {
  31186. type: iconPropType,
  31187. default: () => back_default
  31188. },
  31189. title: String,
  31190. content: {
  31191. type: String,
  31192. default: ""
  31193. }
  31194. });
  31195. const pageHeaderEmits = {
  31196. back: () => true
  31197. };
  31198. const _hoisted_1$q = ["aria-label"];
  31199. const __default__$D = vue.defineComponent({
  31200. name: "ElPageHeader"
  31201. });
  31202. const _sfc_main$R = /* @__PURE__ */ vue.defineComponent({
  31203. ...__default__$D,
  31204. props: pageHeaderProps,
  31205. emits: pageHeaderEmits,
  31206. setup(__props, { emit }) {
  31207. const slots = vue.useSlots();
  31208. const { t } = useLocale();
  31209. const ns = useNamespace("page-header");
  31210. const kls = vue.computed(() => {
  31211. return [
  31212. ns.b(),
  31213. {
  31214. [ns.m("has-breadcrumb")]: !!slots.breadcrumb,
  31215. [ns.m("has-extra")]: !!slots.extra,
  31216. [ns.is("contentful")]: !!slots.default
  31217. }
  31218. ];
  31219. });
  31220. function handleClick() {
  31221. emit("back");
  31222. }
  31223. return (_ctx, _cache) => {
  31224. return vue.openBlock(), vue.createElementBlock("div", {
  31225. class: vue.normalizeClass(vue.unref(kls))
  31226. }, [
  31227. vue.createElementVNode("div", {
  31228. class: vue.normalizeClass(vue.unref(ns).e("breadcrumb"))
  31229. }, [
  31230. vue.renderSlot(_ctx.$slots, "breadcrumb")
  31231. ], 2),
  31232. vue.createElementVNode("div", {
  31233. class: vue.normalizeClass(vue.unref(ns).e("header"))
  31234. }, [
  31235. vue.createElementVNode("div", {
  31236. class: vue.normalizeClass(vue.unref(ns).e("left"))
  31237. }, [
  31238. vue.createElementVNode("div", {
  31239. class: vue.normalizeClass(vue.unref(ns).e("back")),
  31240. role: "button",
  31241. tabindex: "0",
  31242. onClick: handleClick
  31243. }, [
  31244. _ctx.icon || _ctx.$slots.icon ? (vue.openBlock(), vue.createElementBlock("div", {
  31245. key: 0,
  31246. "aria-label": _ctx.title || vue.unref(t)("el.pageHeader.title"),
  31247. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  31248. }, [
  31249. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  31250. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  31251. default: vue.withCtx(() => [
  31252. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  31253. ]),
  31254. _: 1
  31255. })) : vue.createCommentVNode("v-if", true)
  31256. ])
  31257. ], 10, _hoisted_1$q)) : vue.createCommentVNode("v-if", true),
  31258. vue.createElementVNode("div", {
  31259. class: vue.normalizeClass(vue.unref(ns).e("title"))
  31260. }, [
  31261. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  31262. vue.createTextVNode(vue.toDisplayString(_ctx.title || vue.unref(t)("el.pageHeader.title")), 1)
  31263. ])
  31264. ], 2)
  31265. ], 2),
  31266. vue.createVNode(vue.unref(ElDivider), { direction: "vertical" }),
  31267. vue.createElementVNode("div", {
  31268. class: vue.normalizeClass(vue.unref(ns).e("content"))
  31269. }, [
  31270. vue.renderSlot(_ctx.$slots, "content", {}, () => [
  31271. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  31272. ])
  31273. ], 2)
  31274. ], 2),
  31275. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  31276. key: 0,
  31277. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  31278. }, [
  31279. vue.renderSlot(_ctx.$slots, "extra")
  31280. ], 2)) : vue.createCommentVNode("v-if", true)
  31281. ], 2),
  31282. _ctx.$slots.default ? (vue.openBlock(), vue.createElementBlock("div", {
  31283. key: 0,
  31284. class: vue.normalizeClass(vue.unref(ns).e("main"))
  31285. }, [
  31286. vue.renderSlot(_ctx.$slots, "default")
  31287. ], 2)) : vue.createCommentVNode("v-if", true)
  31288. ], 2);
  31289. };
  31290. }
  31291. });
  31292. var PageHeader = /* @__PURE__ */ _export_sfc(_sfc_main$R, [["__file", "page-header.vue"]]);
  31293. const ElPageHeader = withInstall(PageHeader);
  31294. const paginationPrevProps = buildProps({
  31295. disabled: Boolean,
  31296. currentPage: {
  31297. type: Number,
  31298. default: 1
  31299. },
  31300. prevText: {
  31301. type: String
  31302. },
  31303. prevIcon: {
  31304. type: iconPropType
  31305. }
  31306. });
  31307. const paginationPrevEmits = {
  31308. click: (evt) => evt instanceof MouseEvent
  31309. };
  31310. const _hoisted_1$p = ["disabled", "aria-disabled"];
  31311. const _hoisted_2$h = { key: 0 };
  31312. const __default__$C = vue.defineComponent({
  31313. name: "ElPaginationPrev"
  31314. });
  31315. const _sfc_main$Q = /* @__PURE__ */ vue.defineComponent({
  31316. ...__default__$C,
  31317. props: paginationPrevProps,
  31318. emits: paginationPrevEmits,
  31319. setup(__props) {
  31320. const props = __props;
  31321. const internalDisabled = vue.computed(() => props.disabled || props.currentPage <= 1);
  31322. return (_ctx, _cache) => {
  31323. return vue.openBlock(), vue.createElementBlock("button", {
  31324. type: "button",
  31325. class: "btn-prev",
  31326. disabled: vue.unref(internalDisabled),
  31327. "aria-disabled": vue.unref(internalDisabled),
  31328. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
  31329. }, [
  31330. _ctx.prevText ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$h, vue.toDisplayString(_ctx.prevText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  31331. default: vue.withCtx(() => [
  31332. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prevIcon)))
  31333. ]),
  31334. _: 1
  31335. }))
  31336. ], 8, _hoisted_1$p);
  31337. };
  31338. }
  31339. });
  31340. var Prev = /* @__PURE__ */ _export_sfc(_sfc_main$Q, [["__file", "prev.vue"]]);
  31341. const paginationNextProps = buildProps({
  31342. disabled: Boolean,
  31343. currentPage: {
  31344. type: Number,
  31345. default: 1
  31346. },
  31347. pageCount: {
  31348. type: Number,
  31349. default: 50
  31350. },
  31351. nextText: {
  31352. type: String
  31353. },
  31354. nextIcon: {
  31355. type: iconPropType
  31356. }
  31357. });
  31358. const _hoisted_1$o = ["disabled", "aria-disabled"];
  31359. const _hoisted_2$g = { key: 0 };
  31360. const __default__$B = vue.defineComponent({
  31361. name: "ElPaginationNext"
  31362. });
  31363. const _sfc_main$P = /* @__PURE__ */ vue.defineComponent({
  31364. ...__default__$B,
  31365. props: paginationNextProps,
  31366. emits: ["click"],
  31367. setup(__props) {
  31368. const props = __props;
  31369. const internalDisabled = vue.computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
  31370. return (_ctx, _cache) => {
  31371. return vue.openBlock(), vue.createElementBlock("button", {
  31372. type: "button",
  31373. class: "btn-next",
  31374. disabled: vue.unref(internalDisabled),
  31375. "aria-disabled": vue.unref(internalDisabled),
  31376. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
  31377. }, [
  31378. _ctx.nextText ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$g, vue.toDisplayString(_ctx.nextText), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  31379. default: vue.withCtx(() => [
  31380. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.nextIcon)))
  31381. ]),
  31382. _: 1
  31383. }))
  31384. ], 8, _hoisted_1$o);
  31385. };
  31386. }
  31387. });
  31388. var Next = /* @__PURE__ */ _export_sfc(_sfc_main$P, [["__file", "next.vue"]]);
  31389. const selectGroupKey = "ElSelectGroup";
  31390. const selectKey = "ElSelect";
  31391. function useOption$1(props, states) {
  31392. const select = vue.inject(selectKey);
  31393. const selectGroup = vue.inject(selectGroupKey, { disabled: false });
  31394. const isObject = vue.computed(() => {
  31395. return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]";
  31396. });
  31397. const itemSelected = vue.computed(() => {
  31398. if (!select.props.multiple) {
  31399. return isEqual(props.value, select.props.modelValue);
  31400. } else {
  31401. return contains(select.props.modelValue, props.value);
  31402. }
  31403. });
  31404. const limitReached = vue.computed(() => {
  31405. if (select.props.multiple) {
  31406. const modelValue = select.props.modelValue || [];
  31407. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  31408. } else {
  31409. return false;
  31410. }
  31411. });
  31412. const currentLabel = vue.computed(() => {
  31413. return props.label || (isObject.value ? "" : props.value);
  31414. });
  31415. const currentValue = vue.computed(() => {
  31416. return props.value || props.label || "";
  31417. });
  31418. const isDisabled = vue.computed(() => {
  31419. return props.disabled || states.groupDisabled || limitReached.value;
  31420. });
  31421. const instance = vue.getCurrentInstance();
  31422. const contains = (arr = [], target) => {
  31423. if (!isObject.value) {
  31424. return arr && arr.includes(target);
  31425. } else {
  31426. const valueKey = select.props.valueKey;
  31427. return arr && arr.some((item) => {
  31428. return vue.toRaw(get(item, valueKey)) === get(target, valueKey);
  31429. });
  31430. }
  31431. };
  31432. const isEqual = (a, b) => {
  31433. if (!isObject.value) {
  31434. return a === b;
  31435. } else {
  31436. const { valueKey } = select.props;
  31437. return get(a, valueKey) === get(b, valueKey);
  31438. }
  31439. };
  31440. const hoverItem = () => {
  31441. if (!props.disabled && !selectGroup.disabled) {
  31442. select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
  31443. }
  31444. };
  31445. vue.watch(() => currentLabel.value, () => {
  31446. if (!props.created && !select.props.remote)
  31447. select.setSelected();
  31448. });
  31449. vue.watch(() => props.value, (val, oldVal) => {
  31450. const { remote, valueKey } = select.props;
  31451. if (!Object.is(val, oldVal)) {
  31452. select.onOptionDestroy(oldVal, instance.proxy);
  31453. select.onOptionCreate(instance.proxy);
  31454. }
  31455. if (!props.created && !remote) {
  31456. if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) {
  31457. return;
  31458. }
  31459. select.setSelected();
  31460. }
  31461. });
  31462. vue.watch(() => selectGroup.disabled, () => {
  31463. states.groupDisabled = selectGroup.disabled;
  31464. }, { immediate: true });
  31465. const { queryChange } = vue.toRaw(select);
  31466. vue.watch(queryChange, (changes) => {
  31467. const { query } = vue.unref(changes);
  31468. const regexp = new RegExp(escapeStringRegexp(query), "i");
  31469. states.visible = regexp.test(currentLabel.value) || props.created;
  31470. if (!states.visible) {
  31471. select.filteredOptionsCount--;
  31472. }
  31473. });
  31474. return {
  31475. select,
  31476. currentLabel,
  31477. currentValue,
  31478. itemSelected,
  31479. isDisabled,
  31480. hoverItem
  31481. };
  31482. }
  31483. const _sfc_main$O = vue.defineComponent({
  31484. name: "ElOption",
  31485. componentName: "ElOption",
  31486. props: {
  31487. value: {
  31488. required: true,
  31489. type: [String, Number, Boolean, Object]
  31490. },
  31491. label: [String, Number],
  31492. created: Boolean,
  31493. disabled: {
  31494. type: Boolean,
  31495. default: false
  31496. }
  31497. },
  31498. setup(props) {
  31499. const ns = useNamespace("select");
  31500. const states = vue.reactive({
  31501. index: -1,
  31502. groupDisabled: false,
  31503. visible: true,
  31504. hitState: false,
  31505. hover: false
  31506. });
  31507. const { currentLabel, itemSelected, isDisabled, select, hoverItem } = useOption$1(props, states);
  31508. const { visible, hover } = vue.toRefs(states);
  31509. const vm = vue.getCurrentInstance().proxy;
  31510. select.onOptionCreate(vm);
  31511. vue.onBeforeUnmount(() => {
  31512. const key = vm.value;
  31513. const { selected } = select;
  31514. const selectedOptions = select.props.multiple ? selected : [selected];
  31515. const doesSelected = selectedOptions.some((item) => {
  31516. return item.value === vm.value;
  31517. });
  31518. vue.nextTick(() => {
  31519. if (select.cachedOptions.get(key) === vm && !doesSelected) {
  31520. select.cachedOptions.delete(key);
  31521. }
  31522. });
  31523. select.onOptionDestroy(key, vm);
  31524. });
  31525. function selectOptionClick() {
  31526. if (props.disabled !== true && states.groupDisabled !== true) {
  31527. select.handleOptionSelect(vm, true);
  31528. }
  31529. }
  31530. return {
  31531. ns,
  31532. currentLabel,
  31533. itemSelected,
  31534. isDisabled,
  31535. select,
  31536. hoverItem,
  31537. visible,
  31538. hover,
  31539. selectOptionClick,
  31540. states
  31541. };
  31542. }
  31543. });
  31544. function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
  31545. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("li", {
  31546. class: vue.normalizeClass([
  31547. _ctx.ns.be("dropdown", "item"),
  31548. _ctx.ns.is("disabled", _ctx.isDisabled),
  31549. {
  31550. selected: _ctx.itemSelected,
  31551. hover: _ctx.hover
  31552. }
  31553. ]),
  31554. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  31555. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  31556. }, [
  31557. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  31558. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.currentLabel), 1)
  31559. ])
  31560. ], 34)), [
  31561. [vue.vShow, _ctx.visible]
  31562. ]);
  31563. }
  31564. var Option = /* @__PURE__ */ _export_sfc(_sfc_main$O, [["render", _sfc_render$b], ["__file", "option.vue"]]);
  31565. const _sfc_main$N = vue.defineComponent({
  31566. name: "ElSelectDropdown",
  31567. componentName: "ElSelectDropdown",
  31568. setup() {
  31569. const select = vue.inject(selectKey);
  31570. const ns = useNamespace("select");
  31571. const popperClass = vue.computed(() => select.props.popperClass);
  31572. const isMultiple = vue.computed(() => select.props.multiple);
  31573. const isFitInputWidth = vue.computed(() => select.props.fitInputWidth);
  31574. const minWidth = vue.ref("");
  31575. function updateMinWidth() {
  31576. var _a;
  31577. minWidth.value = `${(_a = select.selectWrapper) == null ? void 0 : _a.offsetWidth}px`;
  31578. }
  31579. vue.onMounted(() => {
  31580. updateMinWidth();
  31581. useResizeObserver(select.selectWrapper, updateMinWidth);
  31582. });
  31583. return {
  31584. ns,
  31585. minWidth,
  31586. popperClass,
  31587. isMultiple,
  31588. isFitInputWidth
  31589. };
  31590. }
  31591. });
  31592. function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
  31593. return vue.openBlock(), vue.createElementBlock("div", {
  31594. class: vue.normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  31595. style: vue.normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  31596. }, [
  31597. vue.renderSlot(_ctx.$slots, "default")
  31598. ], 6);
  31599. }
  31600. var ElSelectMenu$1 = /* @__PURE__ */ _export_sfc(_sfc_main$N, [["render", _sfc_render$a], ["__file", "select-dropdown.vue"]]);
  31601. function useSelectStates(props) {
  31602. const { t } = useLocale();
  31603. return vue.reactive({
  31604. options: /* @__PURE__ */ new Map(),
  31605. cachedOptions: /* @__PURE__ */ new Map(),
  31606. createdLabel: null,
  31607. createdSelected: false,
  31608. selected: props.multiple ? [] : {},
  31609. inputLength: 20,
  31610. inputWidth: 0,
  31611. optionsCount: 0,
  31612. filteredOptionsCount: 0,
  31613. visible: false,
  31614. softFocus: false,
  31615. selectedLabel: "",
  31616. hoverIndex: -1,
  31617. query: "",
  31618. previousQuery: null,
  31619. inputHovering: false,
  31620. cachedPlaceHolder: "",
  31621. currentPlaceholder: t("el.select.placeholder"),
  31622. menuVisibleOnFocus: false,
  31623. isOnComposition: false,
  31624. isSilentBlur: false,
  31625. prefixWidth: 11,
  31626. tagInMultiLine: false,
  31627. mouseEnter: false
  31628. });
  31629. }
  31630. const useSelect$3 = (props, states, ctx) => {
  31631. const { t } = useLocale();
  31632. const ns = useNamespace("select");
  31633. useDeprecated({
  31634. from: "suffixTransition",
  31635. replacement: "override style scheme",
  31636. version: "2.3.0",
  31637. scope: "props",
  31638. ref: "https://element-plus.org/en-US/component/select.html#select-attributes"
  31639. }, vue.computed(() => props.suffixTransition === false));
  31640. const reference = vue.ref(null);
  31641. const input = vue.ref(null);
  31642. const tooltipRef = vue.ref(null);
  31643. const tags = vue.ref(null);
  31644. const selectWrapper = vue.ref(null);
  31645. const scrollbar = vue.ref(null);
  31646. const hoverOption = vue.ref(-1);
  31647. const queryChange = vue.shallowRef({ query: "" });
  31648. const groupQueryChange = vue.shallowRef("");
  31649. const { form, formItem } = useFormItem();
  31650. const readonly = vue.computed(() => !props.filterable || props.multiple || !states.visible);
  31651. const selectDisabled = vue.computed(() => props.disabled || (form == null ? void 0 : form.disabled));
  31652. const showClose = vue.computed(() => {
  31653. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
  31654. const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
  31655. return criteria;
  31656. });
  31657. const iconComponent = vue.computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  31658. const iconReverse = vue.computed(() => ns.is("reverse", iconComponent.value && states.visible && props.suffixTransition));
  31659. const debounce$1 = vue.computed(() => props.remote ? 300 : 0);
  31660. const emptyText = vue.computed(() => {
  31661. if (props.loading) {
  31662. return props.loadingText || t("el.select.loading");
  31663. } else {
  31664. if (props.remote && states.query === "" && states.options.size === 0)
  31665. return false;
  31666. if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
  31667. return props.noMatchText || t("el.select.noMatch");
  31668. }
  31669. if (states.options.size === 0) {
  31670. return props.noDataText || t("el.select.noData");
  31671. }
  31672. }
  31673. return null;
  31674. });
  31675. const optionsArray = vue.computed(() => Array.from(states.options.values()));
  31676. const cachedOptionsArray = vue.computed(() => Array.from(states.cachedOptions.values()));
  31677. const showNewOption = vue.computed(() => {
  31678. const hasExistingOption = optionsArray.value.filter((option) => {
  31679. return !option.created;
  31680. }).some((option) => {
  31681. return option.currentLabel === states.query;
  31682. });
  31683. return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
  31684. });
  31685. const selectSize = useSize();
  31686. const collapseTagSize = vue.computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  31687. const dropMenuVisible = vue.computed({
  31688. get() {
  31689. return states.visible && emptyText.value !== false;
  31690. },
  31691. set(val) {
  31692. states.visible = val;
  31693. }
  31694. });
  31695. vue.watch([() => selectDisabled.value, () => selectSize.value, () => form == null ? void 0 : form.size], () => {
  31696. vue.nextTick(() => {
  31697. resetInputHeight();
  31698. });
  31699. });
  31700. vue.watch(() => props.placeholder, (val) => {
  31701. states.cachedPlaceHolder = states.currentPlaceholder = val;
  31702. });
  31703. vue.watch(() => props.modelValue, (val, oldVal) => {
  31704. if (props.multiple) {
  31705. resetInputHeight();
  31706. if (val && val.length > 0 || input.value && states.query !== "") {
  31707. states.currentPlaceholder = "";
  31708. } else {
  31709. states.currentPlaceholder = states.cachedPlaceHolder;
  31710. }
  31711. if (props.filterable && !props.reserveKeyword) {
  31712. states.query = "";
  31713. handleQueryChange(states.query);
  31714. }
  31715. }
  31716. setSelected();
  31717. if (props.filterable && !props.multiple) {
  31718. states.inputLength = 20;
  31719. }
  31720. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  31721. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  31722. }
  31723. }, {
  31724. flush: "post",
  31725. deep: true
  31726. });
  31727. vue.watch(() => states.visible, (val) => {
  31728. var _a, _b, _c;
  31729. if (!val) {
  31730. if (props.filterable) {
  31731. if (isFunction(props.filterMethod)) {
  31732. props.filterMethod("");
  31733. }
  31734. if (isFunction(props.remoteMethod)) {
  31735. props.remoteMethod("");
  31736. }
  31737. }
  31738. input.value && input.value.blur();
  31739. states.query = "";
  31740. states.previousQuery = null;
  31741. states.selectedLabel = "";
  31742. states.inputLength = 20;
  31743. states.menuVisibleOnFocus = false;
  31744. resetHoverIndex();
  31745. vue.nextTick(() => {
  31746. if (input.value && input.value.value === "" && states.selected.length === 0) {
  31747. states.currentPlaceholder = states.cachedPlaceHolder;
  31748. }
  31749. });
  31750. if (!props.multiple) {
  31751. if (states.selected) {
  31752. if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
  31753. states.selectedLabel = states.createdLabel;
  31754. } else {
  31755. states.selectedLabel = states.selected.currentLabel;
  31756. }
  31757. if (props.filterable)
  31758. states.query = states.selectedLabel;
  31759. }
  31760. if (props.filterable) {
  31761. states.currentPlaceholder = states.cachedPlaceHolder;
  31762. }
  31763. }
  31764. } else {
  31765. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  31766. if (props.filterable) {
  31767. states.filteredOptionsCount = states.optionsCount;
  31768. states.query = props.remote ? "" : states.selectedLabel;
  31769. if (props.multiple) {
  31770. (_c = input.value) == null ? void 0 : _c.focus();
  31771. } else {
  31772. if (states.selectedLabel) {
  31773. states.currentPlaceholder = `${states.selectedLabel}`;
  31774. states.selectedLabel = "";
  31775. }
  31776. }
  31777. handleQueryChange(states.query);
  31778. if (!props.multiple && !props.remote) {
  31779. queryChange.value.query = "";
  31780. vue.triggerRef(queryChange);
  31781. vue.triggerRef(groupQueryChange);
  31782. }
  31783. }
  31784. }
  31785. ctx.emit("visible-change", val);
  31786. });
  31787. vue.watch(() => states.options.entries(), () => {
  31788. var _a, _b, _c;
  31789. if (!isClient)
  31790. return;
  31791. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  31792. if (props.multiple) {
  31793. resetInputHeight();
  31794. }
  31795. const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
  31796. if (!Array.from(inputs).includes(document.activeElement)) {
  31797. setSelected();
  31798. }
  31799. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  31800. checkDefaultFirstOption();
  31801. }
  31802. }, {
  31803. flush: "post"
  31804. });
  31805. vue.watch(() => states.hoverIndex, (val) => {
  31806. if (isNumber(val) && val > -1) {
  31807. hoverOption.value = optionsArray.value[val] || {};
  31808. } else {
  31809. hoverOption.value = {};
  31810. }
  31811. optionsArray.value.forEach((option) => {
  31812. option.hover = hoverOption.value === option;
  31813. });
  31814. });
  31815. const resetInputHeight = () => {
  31816. if (props.collapseTags && !props.filterable)
  31817. return;
  31818. vue.nextTick(() => {
  31819. var _a, _b;
  31820. if (!reference.value)
  31821. return;
  31822. const input2 = reference.value.$el.querySelector("input");
  31823. const _tags = tags.value;
  31824. const sizeInMap = getComponentSize(selectSize.value || (form == null ? void 0 : form.size));
  31825. input2.style.height = `${(states.selected.length === 0 ? sizeInMap : Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)) - 2}px`;
  31826. states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap;
  31827. if (states.visible && emptyText.value !== false) {
  31828. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  31829. }
  31830. });
  31831. };
  31832. const handleQueryChange = async (val) => {
  31833. if (states.previousQuery === val || states.isOnComposition)
  31834. return;
  31835. if (states.previousQuery === null && (isFunction(props.filterMethod) || isFunction(props.remoteMethod))) {
  31836. states.previousQuery = val;
  31837. return;
  31838. }
  31839. states.previousQuery = val;
  31840. vue.nextTick(() => {
  31841. var _a, _b;
  31842. if (states.visible)
  31843. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  31844. });
  31845. states.hoverIndex = -1;
  31846. if (props.multiple && props.filterable) {
  31847. vue.nextTick(() => {
  31848. const length = input.value.value.length * 15 + 20;
  31849. states.inputLength = props.collapseTags ? Math.min(50, length) : length;
  31850. managePlaceholder();
  31851. resetInputHeight();
  31852. });
  31853. }
  31854. if (props.remote && isFunction(props.remoteMethod)) {
  31855. states.hoverIndex = -1;
  31856. props.remoteMethod(val);
  31857. } else if (isFunction(props.filterMethod)) {
  31858. props.filterMethod(val);
  31859. vue.triggerRef(groupQueryChange);
  31860. } else {
  31861. states.filteredOptionsCount = states.optionsCount;
  31862. queryChange.value.query = val;
  31863. vue.triggerRef(queryChange);
  31864. vue.triggerRef(groupQueryChange);
  31865. }
  31866. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  31867. await vue.nextTick();
  31868. checkDefaultFirstOption();
  31869. }
  31870. };
  31871. const managePlaceholder = () => {
  31872. if (states.currentPlaceholder !== "") {
  31873. states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
  31874. }
  31875. };
  31876. const checkDefaultFirstOption = () => {
  31877. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  31878. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  31879. const firstOriginOption = optionsInDropdown[0];
  31880. states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  31881. };
  31882. const setSelected = () => {
  31883. var _a;
  31884. if (!props.multiple) {
  31885. const option = getOption(props.modelValue);
  31886. if ((_a = option.props) == null ? void 0 : _a.created) {
  31887. states.createdLabel = option.props.value;
  31888. states.createdSelected = true;
  31889. } else {
  31890. states.createdSelected = false;
  31891. }
  31892. states.selectedLabel = option.currentLabel;
  31893. states.selected = option;
  31894. if (props.filterable)
  31895. states.query = states.selectedLabel;
  31896. return;
  31897. } else {
  31898. states.selectedLabel = "";
  31899. }
  31900. const result = [];
  31901. if (Array.isArray(props.modelValue)) {
  31902. props.modelValue.forEach((value) => {
  31903. result.push(getOption(value));
  31904. });
  31905. }
  31906. states.selected = result;
  31907. vue.nextTick(() => {
  31908. resetInputHeight();
  31909. });
  31910. };
  31911. const getOption = (value) => {
  31912. let option;
  31913. const isObjectValue = toRawType(value).toLowerCase() === "object";
  31914. const isNull = toRawType(value).toLowerCase() === "null";
  31915. const isUndefined = toRawType(value).toLowerCase() === "undefined";
  31916. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  31917. const cachedOption = cachedOptionsArray.value[i];
  31918. const isEqualValue = isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value;
  31919. if (isEqualValue) {
  31920. option = {
  31921. value,
  31922. currentLabel: cachedOption.currentLabel,
  31923. isDisabled: cachedOption.isDisabled
  31924. };
  31925. break;
  31926. }
  31927. }
  31928. if (option)
  31929. return option;
  31930. const label = isObjectValue ? value.label : !isNull && !isUndefined ? value : "";
  31931. const newOption = {
  31932. value,
  31933. currentLabel: label
  31934. };
  31935. if (props.multiple) {
  31936. newOption.hitState = false;
  31937. }
  31938. return newOption;
  31939. };
  31940. const resetHoverIndex = () => {
  31941. setTimeout(() => {
  31942. const valueKey = props.valueKey;
  31943. if (!props.multiple) {
  31944. states.hoverIndex = optionsArray.value.findIndex((item) => {
  31945. return getValueKey(item) === getValueKey(states.selected);
  31946. });
  31947. } else {
  31948. if (states.selected.length > 0) {
  31949. states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
  31950. return optionsArray.value.findIndex((item) => {
  31951. return get(item, valueKey) === get(selected, valueKey);
  31952. });
  31953. }));
  31954. } else {
  31955. states.hoverIndex = -1;
  31956. }
  31957. }
  31958. }, 300);
  31959. };
  31960. const handleResize = () => {
  31961. var _a, _b;
  31962. resetInputWidth();
  31963. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  31964. if (props.multiple && !props.filterable)
  31965. resetInputHeight();
  31966. };
  31967. const resetInputWidth = () => {
  31968. var _a;
  31969. states.inputWidth = (_a = reference.value) == null ? void 0 : _a.$el.getBoundingClientRect().width;
  31970. };
  31971. const onInputChange = () => {
  31972. if (props.filterable && states.query !== states.selectedLabel) {
  31973. states.query = states.selectedLabel;
  31974. handleQueryChange(states.query);
  31975. }
  31976. };
  31977. const debouncedOnInputChange = debounce(() => {
  31978. onInputChange();
  31979. }, debounce$1.value);
  31980. const debouncedQueryChange = debounce((e) => {
  31981. handleQueryChange(e.target.value);
  31982. }, debounce$1.value);
  31983. const emitChange = (val) => {
  31984. if (!isEqual$1(props.modelValue, val)) {
  31985. ctx.emit(CHANGE_EVENT, val);
  31986. }
  31987. };
  31988. const deletePrevTag = (e) => {
  31989. if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
  31990. const value = props.modelValue.slice();
  31991. value.pop();
  31992. ctx.emit(UPDATE_MODEL_EVENT, value);
  31993. emitChange(value);
  31994. }
  31995. if (e.target.value.length === 1 && props.modelValue.length === 0) {
  31996. states.currentPlaceholder = states.cachedPlaceHolder;
  31997. }
  31998. };
  31999. const deleteTag = (event, tag) => {
  32000. const index = states.selected.indexOf(tag);
  32001. if (index > -1 && !selectDisabled.value) {
  32002. const value = props.modelValue.slice();
  32003. value.splice(index, 1);
  32004. ctx.emit(UPDATE_MODEL_EVENT, value);
  32005. emitChange(value);
  32006. ctx.emit("remove-tag", tag.value);
  32007. }
  32008. event.stopPropagation();
  32009. };
  32010. const deleteSelected = (event) => {
  32011. event.stopPropagation();
  32012. const value = props.multiple ? [] : "";
  32013. if (!isString(value)) {
  32014. for (const item of states.selected) {
  32015. if (item.isDisabled)
  32016. value.push(item.value);
  32017. }
  32018. }
  32019. ctx.emit(UPDATE_MODEL_EVENT, value);
  32020. emitChange(value);
  32021. states.hoverIndex = -1;
  32022. states.visible = false;
  32023. ctx.emit("clear");
  32024. };
  32025. const handleOptionSelect = (option, byClick) => {
  32026. var _a;
  32027. if (props.multiple) {
  32028. const value = (props.modelValue || []).slice();
  32029. const optionIndex = getValueIndex(value, option.value);
  32030. if (optionIndex > -1) {
  32031. value.splice(optionIndex, 1);
  32032. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  32033. value.push(option.value);
  32034. }
  32035. ctx.emit(UPDATE_MODEL_EVENT, value);
  32036. emitChange(value);
  32037. if (option.created) {
  32038. states.query = "";
  32039. handleQueryChange("");
  32040. states.inputLength = 20;
  32041. }
  32042. if (props.filterable)
  32043. (_a = input.value) == null ? void 0 : _a.focus();
  32044. } else {
  32045. ctx.emit(UPDATE_MODEL_EVENT, option.value);
  32046. emitChange(option.value);
  32047. states.visible = false;
  32048. }
  32049. states.isSilentBlur = byClick;
  32050. setSoftFocus();
  32051. if (states.visible)
  32052. return;
  32053. vue.nextTick(() => {
  32054. scrollToOption(option);
  32055. });
  32056. };
  32057. const getValueIndex = (arr = [], value) => {
  32058. if (!isObject$1(value))
  32059. return arr.indexOf(value);
  32060. const valueKey = props.valueKey;
  32061. let index = -1;
  32062. arr.some((item, i) => {
  32063. if (vue.toRaw(get(item, valueKey)) === get(value, valueKey)) {
  32064. index = i;
  32065. return true;
  32066. }
  32067. return false;
  32068. });
  32069. return index;
  32070. };
  32071. const setSoftFocus = () => {
  32072. states.softFocus = true;
  32073. const _input = input.value || reference.value;
  32074. if (_input) {
  32075. _input == null ? void 0 : _input.focus();
  32076. }
  32077. };
  32078. const scrollToOption = (option) => {
  32079. var _a, _b, _c, _d, _e;
  32080. const targetOption = Array.isArray(option) ? option[0] : option;
  32081. let target = null;
  32082. if (targetOption == null ? void 0 : targetOption.value) {
  32083. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  32084. if (options.length > 0) {
  32085. target = options[0].$el;
  32086. }
  32087. }
  32088. if (tooltipRef.value && target) {
  32089. 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, `.${ns.be("dropdown", "wrap")}`);
  32090. if (menu) {
  32091. scrollIntoView(menu, target);
  32092. }
  32093. }
  32094. (_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
  32095. };
  32096. const onOptionCreate = (vm) => {
  32097. states.optionsCount++;
  32098. states.filteredOptionsCount++;
  32099. states.options.set(vm.value, vm);
  32100. states.cachedOptions.set(vm.value, vm);
  32101. };
  32102. const onOptionDestroy = (key, vm) => {
  32103. if (states.options.get(key) === vm) {
  32104. states.optionsCount--;
  32105. states.filteredOptionsCount--;
  32106. states.options.delete(key);
  32107. }
  32108. };
  32109. const resetInputState = (e) => {
  32110. if (e.code !== EVENT_CODE.backspace)
  32111. toggleLastOptionHitState(false);
  32112. states.inputLength = input.value.value.length * 15 + 20;
  32113. resetInputHeight();
  32114. };
  32115. const toggleLastOptionHitState = (hit) => {
  32116. if (!Array.isArray(states.selected))
  32117. return;
  32118. const option = states.selected[states.selected.length - 1];
  32119. if (!option)
  32120. return;
  32121. if (hit === true || hit === false) {
  32122. option.hitState = hit;
  32123. return hit;
  32124. }
  32125. option.hitState = !option.hitState;
  32126. return option.hitState;
  32127. };
  32128. const handleComposition = (event) => {
  32129. const text = event.target.value;
  32130. if (event.type === "compositionend") {
  32131. states.isOnComposition = false;
  32132. vue.nextTick(() => handleQueryChange(text));
  32133. } else {
  32134. const lastCharacter = text[text.length - 1] || "";
  32135. states.isOnComposition = !isKorean(lastCharacter);
  32136. }
  32137. };
  32138. const handleMenuEnter = () => {
  32139. vue.nextTick(() => scrollToOption(states.selected));
  32140. };
  32141. const handleFocus = (event) => {
  32142. if (!states.softFocus) {
  32143. if (props.automaticDropdown || props.filterable) {
  32144. if (props.filterable && !states.visible) {
  32145. states.menuVisibleOnFocus = true;
  32146. }
  32147. states.visible = true;
  32148. }
  32149. ctx.emit("focus", event);
  32150. } else {
  32151. states.softFocus = false;
  32152. }
  32153. };
  32154. const blur = () => {
  32155. var _a;
  32156. states.visible = false;
  32157. (_a = reference.value) == null ? void 0 : _a.blur();
  32158. };
  32159. const handleBlur = (event) => {
  32160. vue.nextTick(() => {
  32161. if (states.isSilentBlur) {
  32162. states.isSilentBlur = false;
  32163. } else {
  32164. ctx.emit("blur", event);
  32165. }
  32166. });
  32167. states.softFocus = false;
  32168. };
  32169. const handleClearClick = (event) => {
  32170. deleteSelected(event);
  32171. };
  32172. const handleClose = () => {
  32173. states.visible = false;
  32174. };
  32175. const handleKeydownEscape = (event) => {
  32176. if (states.visible) {
  32177. event.preventDefault();
  32178. event.stopPropagation();
  32179. states.visible = false;
  32180. }
  32181. };
  32182. const toggleMenu = (e) => {
  32183. var _a;
  32184. if (e && !states.mouseEnter) {
  32185. return;
  32186. }
  32187. if (!selectDisabled.value) {
  32188. if (states.menuVisibleOnFocus) {
  32189. states.menuVisibleOnFocus = false;
  32190. } else {
  32191. if (!tooltipRef.value || !tooltipRef.value.isFocusInsideContent()) {
  32192. states.visible = !states.visible;
  32193. }
  32194. }
  32195. if (states.visible) {
  32196. (_a = input.value || reference.value) == null ? void 0 : _a.focus();
  32197. }
  32198. }
  32199. };
  32200. const selectOption = () => {
  32201. if (!states.visible) {
  32202. toggleMenu();
  32203. } else {
  32204. if (optionsArray.value[states.hoverIndex]) {
  32205. handleOptionSelect(optionsArray.value[states.hoverIndex], void 0);
  32206. }
  32207. }
  32208. };
  32209. const getValueKey = (item) => {
  32210. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  32211. };
  32212. const optionsAllDisabled = vue.computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  32213. const navigateOptions = (direction) => {
  32214. if (!states.visible) {
  32215. states.visible = true;
  32216. return;
  32217. }
  32218. if (states.options.size === 0 || states.filteredOptionsCount === 0)
  32219. return;
  32220. if (states.isOnComposition)
  32221. return;
  32222. if (!optionsAllDisabled.value) {
  32223. if (direction === "next") {
  32224. states.hoverIndex++;
  32225. if (states.hoverIndex === states.options.size) {
  32226. states.hoverIndex = 0;
  32227. }
  32228. } else if (direction === "prev") {
  32229. states.hoverIndex--;
  32230. if (states.hoverIndex < 0) {
  32231. states.hoverIndex = states.options.size - 1;
  32232. }
  32233. }
  32234. const option = optionsArray.value[states.hoverIndex];
  32235. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  32236. navigateOptions(direction);
  32237. }
  32238. vue.nextTick(() => scrollToOption(hoverOption.value));
  32239. }
  32240. };
  32241. const handleMouseEnter = () => {
  32242. states.mouseEnter = true;
  32243. };
  32244. const handleMouseLeave = () => {
  32245. states.mouseEnter = false;
  32246. };
  32247. return {
  32248. optionsArray,
  32249. selectSize,
  32250. handleResize,
  32251. debouncedOnInputChange,
  32252. debouncedQueryChange,
  32253. deletePrevTag,
  32254. deleteTag,
  32255. deleteSelected,
  32256. handleOptionSelect,
  32257. scrollToOption,
  32258. readonly,
  32259. resetInputHeight,
  32260. showClose,
  32261. iconComponent,
  32262. iconReverse,
  32263. showNewOption,
  32264. collapseTagSize,
  32265. setSelected,
  32266. managePlaceholder,
  32267. selectDisabled,
  32268. emptyText,
  32269. toggleLastOptionHitState,
  32270. resetInputState,
  32271. handleComposition,
  32272. onOptionCreate,
  32273. onOptionDestroy,
  32274. handleMenuEnter,
  32275. handleFocus,
  32276. blur,
  32277. handleBlur,
  32278. handleClearClick,
  32279. handleClose,
  32280. handleKeydownEscape,
  32281. toggleMenu,
  32282. selectOption,
  32283. getValueKey,
  32284. navigateOptions,
  32285. dropMenuVisible,
  32286. queryChange,
  32287. groupQueryChange,
  32288. reference,
  32289. input,
  32290. tooltipRef,
  32291. tags,
  32292. selectWrapper,
  32293. scrollbar,
  32294. handleMouseEnter,
  32295. handleMouseLeave
  32296. };
  32297. };
  32298. const COMPONENT_NAME$9 = "ElSelect";
  32299. const _sfc_main$M = vue.defineComponent({
  32300. name: COMPONENT_NAME$9,
  32301. componentName: COMPONENT_NAME$9,
  32302. components: {
  32303. ElInput,
  32304. ElSelectMenu: ElSelectMenu$1,
  32305. ElOption: Option,
  32306. ElTag,
  32307. ElScrollbar,
  32308. ElTooltip,
  32309. ElIcon
  32310. },
  32311. directives: { ClickOutside },
  32312. props: {
  32313. name: String,
  32314. id: String,
  32315. modelValue: {
  32316. type: [Array, String, Number, Boolean, Object],
  32317. default: void 0
  32318. },
  32319. autocomplete: {
  32320. type: String,
  32321. default: "off"
  32322. },
  32323. automaticDropdown: Boolean,
  32324. size: {
  32325. type: String,
  32326. validator: isValidComponentSize
  32327. },
  32328. effect: {
  32329. type: String,
  32330. default: "light"
  32331. },
  32332. disabled: Boolean,
  32333. clearable: Boolean,
  32334. filterable: Boolean,
  32335. allowCreate: Boolean,
  32336. loading: Boolean,
  32337. popperClass: {
  32338. type: String,
  32339. default: ""
  32340. },
  32341. remote: Boolean,
  32342. loadingText: String,
  32343. noMatchText: String,
  32344. noDataText: String,
  32345. remoteMethod: Function,
  32346. filterMethod: Function,
  32347. multiple: Boolean,
  32348. multipleLimit: {
  32349. type: Number,
  32350. default: 0
  32351. },
  32352. placeholder: {
  32353. type: String
  32354. },
  32355. defaultFirstOption: Boolean,
  32356. reserveKeyword: {
  32357. type: Boolean,
  32358. default: true
  32359. },
  32360. valueKey: {
  32361. type: String,
  32362. default: "value"
  32363. },
  32364. collapseTags: Boolean,
  32365. collapseTagsTooltip: {
  32366. type: Boolean,
  32367. default: false
  32368. },
  32369. teleported: useTooltipContentProps.teleported,
  32370. persistent: {
  32371. type: Boolean,
  32372. default: true
  32373. },
  32374. clearIcon: {
  32375. type: iconPropType,
  32376. default: circle_close_default
  32377. },
  32378. fitInputWidth: {
  32379. type: Boolean,
  32380. default: false
  32381. },
  32382. suffixIcon: {
  32383. type: iconPropType,
  32384. default: arrow_down_default
  32385. },
  32386. tagType: { ...tagProps.type, default: "info" },
  32387. validateEvent: {
  32388. type: Boolean,
  32389. default: true
  32390. },
  32391. remoteShowSuffix: {
  32392. type: Boolean,
  32393. default: false
  32394. },
  32395. suffixTransition: {
  32396. type: Boolean,
  32397. default: true
  32398. },
  32399. placement: {
  32400. type: String,
  32401. values: Ee,
  32402. default: "bottom-start"
  32403. }
  32404. },
  32405. emits: [
  32406. UPDATE_MODEL_EVENT,
  32407. CHANGE_EVENT,
  32408. "remove-tag",
  32409. "clear",
  32410. "visible-change",
  32411. "focus",
  32412. "blur"
  32413. ],
  32414. setup(props, ctx) {
  32415. const nsSelect = useNamespace("select");
  32416. const nsInput = useNamespace("input");
  32417. const { t } = useLocale();
  32418. const states = useSelectStates(props);
  32419. const {
  32420. optionsArray,
  32421. selectSize,
  32422. readonly,
  32423. handleResize,
  32424. collapseTagSize,
  32425. debouncedOnInputChange,
  32426. debouncedQueryChange,
  32427. deletePrevTag,
  32428. deleteTag,
  32429. deleteSelected,
  32430. handleOptionSelect,
  32431. scrollToOption,
  32432. setSelected,
  32433. resetInputHeight,
  32434. managePlaceholder,
  32435. showClose,
  32436. selectDisabled,
  32437. iconComponent,
  32438. iconReverse,
  32439. showNewOption,
  32440. emptyText,
  32441. toggleLastOptionHitState,
  32442. resetInputState,
  32443. handleComposition,
  32444. onOptionCreate,
  32445. onOptionDestroy,
  32446. handleMenuEnter,
  32447. handleFocus,
  32448. blur,
  32449. handleBlur,
  32450. handleClearClick,
  32451. handleClose,
  32452. handleKeydownEscape,
  32453. toggleMenu,
  32454. selectOption,
  32455. getValueKey,
  32456. navigateOptions,
  32457. dropMenuVisible,
  32458. reference,
  32459. input,
  32460. tooltipRef,
  32461. tags,
  32462. selectWrapper,
  32463. scrollbar,
  32464. queryChange,
  32465. groupQueryChange,
  32466. handleMouseEnter,
  32467. handleMouseLeave
  32468. } = useSelect$3(props, states, ctx);
  32469. const { focus } = useFocus(reference);
  32470. const {
  32471. inputWidth,
  32472. selected,
  32473. inputLength,
  32474. filteredOptionsCount,
  32475. visible,
  32476. softFocus,
  32477. selectedLabel,
  32478. hoverIndex,
  32479. query,
  32480. inputHovering,
  32481. currentPlaceholder,
  32482. menuVisibleOnFocus,
  32483. isOnComposition,
  32484. isSilentBlur,
  32485. options,
  32486. cachedOptions,
  32487. optionsCount,
  32488. prefixWidth,
  32489. tagInMultiLine
  32490. } = vue.toRefs(states);
  32491. const wrapperKls = vue.computed(() => {
  32492. const classList = [nsSelect.b()];
  32493. const _selectSize = vue.unref(selectSize);
  32494. if (_selectSize) {
  32495. classList.push(nsSelect.m(_selectSize));
  32496. }
  32497. if (props.disabled) {
  32498. classList.push(nsSelect.m("disabled"));
  32499. }
  32500. return classList;
  32501. });
  32502. const selectTagsStyle = vue.computed(() => ({
  32503. maxWidth: `${vue.unref(inputWidth) - 32}px`,
  32504. width: "100%"
  32505. }));
  32506. const tagTextStyle = vue.computed(() => {
  32507. const maxWidth = vue.unref(inputWidth) > 123 ? vue.unref(inputWidth) - 123 : vue.unref(inputWidth) - 75;
  32508. return { maxWidth: `${maxWidth}px` };
  32509. });
  32510. vue.provide(selectKey, vue.reactive({
  32511. props,
  32512. options,
  32513. optionsArray,
  32514. cachedOptions,
  32515. optionsCount,
  32516. filteredOptionsCount,
  32517. hoverIndex,
  32518. handleOptionSelect,
  32519. onOptionCreate,
  32520. onOptionDestroy,
  32521. selectWrapper,
  32522. selected,
  32523. setSelected,
  32524. queryChange,
  32525. groupQueryChange
  32526. }));
  32527. vue.onMounted(() => {
  32528. states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || t("el.select.placeholder");
  32529. if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
  32530. currentPlaceholder.value = "";
  32531. }
  32532. useResizeObserver(selectWrapper, handleResize);
  32533. if (props.remote && props.multiple) {
  32534. resetInputHeight();
  32535. }
  32536. vue.nextTick(() => {
  32537. const refEl = reference.value && reference.value.$el;
  32538. if (!refEl)
  32539. return;
  32540. inputWidth.value = refEl.getBoundingClientRect().width;
  32541. if (ctx.slots.prefix) {
  32542. const prefix = refEl.querySelector(`.${nsInput.e("prefix")}`);
  32543. prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30);
  32544. }
  32545. });
  32546. setSelected();
  32547. });
  32548. if (props.multiple && !Array.isArray(props.modelValue)) {
  32549. ctx.emit(UPDATE_MODEL_EVENT, []);
  32550. }
  32551. if (!props.multiple && Array.isArray(props.modelValue)) {
  32552. ctx.emit(UPDATE_MODEL_EVENT, "");
  32553. }
  32554. const popperPaneRef = vue.computed(() => {
  32555. var _a, _b;
  32556. return (_b = (_a = tooltipRef.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  32557. });
  32558. return {
  32559. tagInMultiLine,
  32560. prefixWidth,
  32561. selectSize,
  32562. readonly,
  32563. handleResize,
  32564. collapseTagSize,
  32565. debouncedOnInputChange,
  32566. debouncedQueryChange,
  32567. deletePrevTag,
  32568. deleteTag,
  32569. deleteSelected,
  32570. handleOptionSelect,
  32571. scrollToOption,
  32572. inputWidth,
  32573. selected,
  32574. inputLength,
  32575. filteredOptionsCount,
  32576. visible,
  32577. softFocus,
  32578. selectedLabel,
  32579. hoverIndex,
  32580. query,
  32581. inputHovering,
  32582. currentPlaceholder,
  32583. menuVisibleOnFocus,
  32584. isOnComposition,
  32585. isSilentBlur,
  32586. options,
  32587. resetInputHeight,
  32588. managePlaceholder,
  32589. showClose,
  32590. selectDisabled,
  32591. iconComponent,
  32592. iconReverse,
  32593. showNewOption,
  32594. emptyText,
  32595. toggleLastOptionHitState,
  32596. resetInputState,
  32597. handleComposition,
  32598. handleMenuEnter,
  32599. handleFocus,
  32600. blur,
  32601. handleBlur,
  32602. handleClearClick,
  32603. handleClose,
  32604. handleKeydownEscape,
  32605. toggleMenu,
  32606. selectOption,
  32607. getValueKey,
  32608. navigateOptions,
  32609. dropMenuVisible,
  32610. focus,
  32611. reference,
  32612. input,
  32613. tooltipRef,
  32614. popperPaneRef,
  32615. tags,
  32616. selectWrapper,
  32617. scrollbar,
  32618. wrapperKls,
  32619. selectTagsStyle,
  32620. nsSelect,
  32621. tagTextStyle,
  32622. handleMouseEnter,
  32623. handleMouseLeave
  32624. };
  32625. }
  32626. });
  32627. const _hoisted_1$n = ["disabled", "autocomplete"];
  32628. const _hoisted_2$f = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
  32629. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  32630. const _component_el_tag = vue.resolveComponent("el-tag");
  32631. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  32632. const _component_el_icon = vue.resolveComponent("el-icon");
  32633. const _component_el_input = vue.resolveComponent("el-input");
  32634. const _component_el_option = vue.resolveComponent("el-option");
  32635. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  32636. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  32637. const _directive_click_outside = vue.resolveDirective("click-outside");
  32638. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  32639. ref: "selectWrapper",
  32640. class: vue.normalizeClass(_ctx.wrapperKls),
  32641. onMouseenter: _cache[22] || (_cache[22] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  32642. onMouseleave: _cache[23] || (_cache[23] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  32643. onClick: _cache[24] || (_cache[24] = vue.withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  32644. }, [
  32645. vue.createVNode(_component_el_tooltip, {
  32646. ref: "tooltipRef",
  32647. visible: _ctx.dropMenuVisible,
  32648. placement: _ctx.placement,
  32649. teleported: _ctx.teleported,
  32650. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  32651. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  32652. effect: _ctx.effect,
  32653. pure: "",
  32654. trigger: "click",
  32655. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  32656. "stop-popper-mouse-event": false,
  32657. "gpu-acceleration": false,
  32658. persistent: _ctx.persistent,
  32659. onShow: _ctx.handleMenuEnter
  32660. }, {
  32661. default: vue.withCtx(() => [
  32662. vue.createElementVNode("div", {
  32663. class: "select-trigger",
  32664. onMouseenter: _cache[20] || (_cache[20] = ($event) => _ctx.inputHovering = true),
  32665. onMouseleave: _cache[21] || (_cache[21] = ($event) => _ctx.inputHovering = false)
  32666. }, [
  32667. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", {
  32668. key: 0,
  32669. ref: "tags",
  32670. class: vue.normalizeClass(_ctx.nsSelect.e("tags")),
  32671. style: vue.normalizeStyle(_ctx.selectTagsStyle)
  32672. }, [
  32673. _ctx.collapseTags && _ctx.selected.length ? (vue.openBlock(), vue.createElementBlock("span", {
  32674. key: 0,
  32675. class: vue.normalizeClass([
  32676. _ctx.nsSelect.b("tags-wrapper"),
  32677. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  32678. ])
  32679. }, [
  32680. vue.createVNode(_component_el_tag, {
  32681. closable: !_ctx.selectDisabled && !_ctx.selected[0].isDisabled,
  32682. size: _ctx.collapseTagSize,
  32683. hit: _ctx.selected[0].hitState,
  32684. type: _ctx.tagType,
  32685. "disable-transitions": "",
  32686. onClose: _cache[0] || (_cache[0] = ($event) => _ctx.deleteTag($event, _ctx.selected[0]))
  32687. }, {
  32688. default: vue.withCtx(() => [
  32689. vue.createElementVNode("span", {
  32690. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text")),
  32691. style: vue.normalizeStyle(_ctx.tagTextStyle)
  32692. }, vue.toDisplayString(_ctx.selected[0].currentLabel), 7)
  32693. ]),
  32694. _: 1
  32695. }, 8, ["closable", "size", "hit", "type"]),
  32696. _ctx.selected.length > 1 ? (vue.openBlock(), vue.createBlock(_component_el_tag, {
  32697. key: 0,
  32698. closable: false,
  32699. size: _ctx.collapseTagSize,
  32700. type: _ctx.tagType,
  32701. "disable-transitions": ""
  32702. }, {
  32703. default: vue.withCtx(() => [
  32704. _ctx.collapseTagsTooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  32705. key: 0,
  32706. disabled: _ctx.dropMenuVisible,
  32707. "fallback-placements": ["bottom", "top", "right", "left"],
  32708. effect: _ctx.effect,
  32709. placement: "bottom",
  32710. teleported: _ctx.teleported
  32711. }, {
  32712. default: vue.withCtx(() => [
  32713. vue.createElementVNode("span", {
  32714. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  32715. }, "+ " + vue.toDisplayString(_ctx.selected.length - 1), 3)
  32716. ]),
  32717. content: vue.withCtx(() => [
  32718. vue.createElementVNode("div", {
  32719. class: vue.normalizeClass(_ctx.nsSelect.e("collapse-tags"))
  32720. }, [
  32721. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.selected.slice(1), (item, idx) => {
  32722. return vue.openBlock(), vue.createElementBlock("div", {
  32723. key: idx,
  32724. class: vue.normalizeClass(_ctx.nsSelect.e("collapse-tag"))
  32725. }, [
  32726. (vue.openBlock(), vue.createBlock(_component_el_tag, {
  32727. key: _ctx.getValueKey(item),
  32728. class: "in-tooltip",
  32729. closable: !_ctx.selectDisabled && !item.isDisabled,
  32730. size: _ctx.collapseTagSize,
  32731. hit: item.hitState,
  32732. type: _ctx.tagType,
  32733. "disable-transitions": "",
  32734. style: { margin: "2px" },
  32735. onClose: ($event) => _ctx.deleteTag($event, item)
  32736. }, {
  32737. default: vue.withCtx(() => [
  32738. vue.createElementVNode("span", {
  32739. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text")),
  32740. style: vue.normalizeStyle({
  32741. maxWidth: _ctx.inputWidth - 75 + "px"
  32742. })
  32743. }, vue.toDisplayString(item.currentLabel), 7)
  32744. ]),
  32745. _: 2
  32746. }, 1032, ["closable", "size", "hit", "type", "onClose"]))
  32747. ], 2);
  32748. }), 128))
  32749. ], 2)
  32750. ]),
  32751. _: 1
  32752. }, 8, ["disabled", "effect", "teleported"])) : (vue.openBlock(), vue.createElementBlock("span", {
  32753. key: 1,
  32754. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text"))
  32755. }, "+ " + vue.toDisplayString(_ctx.selected.length - 1), 3))
  32756. ]),
  32757. _: 1
  32758. }, 8, ["size", "type"])) : vue.createCommentVNode("v-if", true)
  32759. ], 2)) : vue.createCommentVNode("v-if", true),
  32760. vue.createCommentVNode(" <div> "),
  32761. !_ctx.collapseTags ? (vue.openBlock(), vue.createBlock(vue.Transition, {
  32762. key: 1,
  32763. onAfterLeave: _ctx.resetInputHeight
  32764. }, {
  32765. default: vue.withCtx(() => [
  32766. vue.createElementVNode("span", {
  32767. class: vue.normalizeClass([
  32768. _ctx.nsSelect.b("tags-wrapper"),
  32769. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  32770. ])
  32771. }, [
  32772. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.selected, (item) => {
  32773. return vue.openBlock(), vue.createBlock(_component_el_tag, {
  32774. key: _ctx.getValueKey(item),
  32775. closable: !_ctx.selectDisabled && !item.isDisabled,
  32776. size: _ctx.collapseTagSize,
  32777. hit: item.hitState,
  32778. type: _ctx.tagType,
  32779. "disable-transitions": "",
  32780. onClose: ($event) => _ctx.deleteTag($event, item)
  32781. }, {
  32782. default: vue.withCtx(() => [
  32783. vue.createElementVNode("span", {
  32784. class: vue.normalizeClass(_ctx.nsSelect.e("tags-text")),
  32785. style: vue.normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
  32786. }, vue.toDisplayString(item.currentLabel), 7)
  32787. ]),
  32788. _: 2
  32789. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  32790. }), 128))
  32791. ], 2)
  32792. ]),
  32793. _: 1
  32794. }, 8, ["onAfterLeave"])) : vue.createCommentVNode("v-if", true),
  32795. vue.createCommentVNode(" </div> "),
  32796. _ctx.filterable ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("input", {
  32797. key: 2,
  32798. ref: "input",
  32799. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.query = $event),
  32800. type: "text",
  32801. class: vue.normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  32802. disabled: _ctx.selectDisabled,
  32803. autocomplete: _ctx.autocomplete,
  32804. style: vue.normalizeStyle({
  32805. marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "",
  32806. flexGrow: 1,
  32807. width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`,
  32808. maxWidth: `${_ctx.inputWidth - 42}px`
  32809. }),
  32810. onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  32811. onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  32812. onKeyup: _cache[4] || (_cache[4] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
  32813. onKeydown: [
  32814. _cache[5] || (_cache[5] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
  32815. _cache[6] || (_cache[6] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
  32816. _cache[7] || (_cache[7] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
  32817. _cache[8] || (_cache[8] = vue.withKeys((...args) => _ctx.handleKeydownEscape && _ctx.handleKeydownEscape(...args), ["esc"])),
  32818. _cache[9] || (_cache[9] = vue.withKeys(vue.withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
  32819. _cache[10] || (_cache[10] = vue.withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
  32820. _cache[11] || (_cache[11] = vue.withKeys(($event) => _ctx.visible = false, ["tab"]))
  32821. ],
  32822. onCompositionstart: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  32823. onCompositionupdate: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  32824. onCompositionend: _cache[14] || (_cache[14] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  32825. onInput: _cache[15] || (_cache[15] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
  32826. }, null, 46, _hoisted_1$n)), [
  32827. [vue.vModelText, _ctx.query]
  32828. ]) : vue.createCommentVNode("v-if", true)
  32829. ], 6)) : vue.createCommentVNode("v-if", true),
  32830. vue.createVNode(_component_el_input, {
  32831. id: _ctx.id,
  32832. ref: "reference",
  32833. modelValue: _ctx.selectedLabel,
  32834. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => _ctx.selectedLabel = $event),
  32835. type: "text",
  32836. placeholder: _ctx.currentPlaceholder,
  32837. name: _ctx.name,
  32838. autocomplete: _ctx.autocomplete,
  32839. size: _ctx.selectSize,
  32840. disabled: _ctx.selectDisabled,
  32841. readonly: _ctx.readonly,
  32842. "validate-event": false,
  32843. class: vue.normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
  32844. tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
  32845. onFocus: _ctx.handleFocus,
  32846. onBlur: _ctx.handleBlur,
  32847. onInput: _ctx.debouncedOnInputChange,
  32848. onPaste: _ctx.debouncedOnInputChange,
  32849. onCompositionstart: _ctx.handleComposition,
  32850. onCompositionupdate: _ctx.handleComposition,
  32851. onCompositionend: _ctx.handleComposition,
  32852. onKeydown: [
  32853. _cache[17] || (_cache[17] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
  32854. _cache[18] || (_cache[18] = vue.withKeys(vue.withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
  32855. vue.withKeys(vue.withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  32856. vue.withKeys(_ctx.handleKeydownEscape, ["esc"]),
  32857. _cache[19] || (_cache[19] = vue.withKeys(($event) => _ctx.visible = false, ["tab"]))
  32858. ]
  32859. }, vue.createSlots({
  32860. suffix: vue.withCtx(() => [
  32861. _ctx.iconComponent && !_ctx.showClose ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  32862. key: 0,
  32863. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  32864. }, {
  32865. default: vue.withCtx(() => [
  32866. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  32867. ]),
  32868. _: 1
  32869. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  32870. _ctx.showClose && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  32871. key: 1,
  32872. class: vue.normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
  32873. onClick: _ctx.handleClearClick
  32874. }, {
  32875. default: vue.withCtx(() => [
  32876. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  32877. ]),
  32878. _: 1
  32879. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  32880. ]),
  32881. _: 2
  32882. }, [
  32883. _ctx.$slots.prefix ? {
  32884. name: "prefix",
  32885. fn: vue.withCtx(() => [
  32886. vue.createElementVNode("div", _hoisted_2$f, [
  32887. vue.renderSlot(_ctx.$slots, "prefix")
  32888. ])
  32889. ])
  32890. } : void 0
  32891. ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
  32892. ], 32)
  32893. ]),
  32894. content: vue.withCtx(() => [
  32895. vue.createVNode(_component_el_select_menu, null, {
  32896. default: vue.withCtx(() => [
  32897. vue.withDirectives(vue.createVNode(_component_el_scrollbar, {
  32898. ref: "scrollbar",
  32899. tag: "ul",
  32900. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  32901. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  32902. class: vue.normalizeClass([
  32903. _ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0)
  32904. ])
  32905. }, {
  32906. default: vue.withCtx(() => [
  32907. _ctx.showNewOption ? (vue.openBlock(), vue.createBlock(_component_el_option, {
  32908. key: 0,
  32909. value: _ctx.query,
  32910. created: true
  32911. }, null, 8, ["value"])) : vue.createCommentVNode("v-if", true),
  32912. vue.renderSlot(_ctx.$slots, "default")
  32913. ]),
  32914. _: 3
  32915. }, 8, ["wrap-class", "view-class", "class"]), [
  32916. [vue.vShow, _ctx.options.size > 0 && !_ctx.loading]
  32917. ]),
  32918. _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  32919. _ctx.$slots.empty ? vue.renderSlot(_ctx.$slots, "empty", { key: 0 }) : (vue.openBlock(), vue.createElementBlock("p", {
  32920. key: 1,
  32921. class: vue.normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  32922. }, vue.toDisplayString(_ctx.emptyText), 3))
  32923. ], 64)) : vue.createCommentVNode("v-if", true)
  32924. ]),
  32925. _: 3
  32926. })
  32927. ]),
  32928. _: 3
  32929. }, 8, ["visible", "placement", "teleported", "popper-class", "effect", "transition", "persistent", "onShow"])
  32930. ], 34)), [
  32931. [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
  32932. ]);
  32933. }
  32934. var Select$1 = /* @__PURE__ */ _export_sfc(_sfc_main$M, [["render", _sfc_render$9], ["__file", "select.vue"]]);
  32935. const _sfc_main$L = vue.defineComponent({
  32936. name: "ElOptionGroup",
  32937. componentName: "ElOptionGroup",
  32938. props: {
  32939. label: String,
  32940. disabled: {
  32941. type: Boolean,
  32942. default: false
  32943. }
  32944. },
  32945. setup(props) {
  32946. const ns = useNamespace("select");
  32947. const visible = vue.ref(true);
  32948. const instance = vue.getCurrentInstance();
  32949. const children = vue.ref([]);
  32950. vue.provide(selectGroupKey, vue.reactive({
  32951. ...vue.toRefs(props)
  32952. }));
  32953. const select = vue.inject(selectKey);
  32954. vue.onMounted(() => {
  32955. children.value = flattedChildren(instance.subTree);
  32956. });
  32957. const flattedChildren = (node) => {
  32958. const children2 = [];
  32959. if (Array.isArray(node.children)) {
  32960. node.children.forEach((child) => {
  32961. var _a;
  32962. if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
  32963. children2.push(child.component.proxy);
  32964. } else if ((_a = child.children) == null ? void 0 : _a.length) {
  32965. children2.push(...flattedChildren(child));
  32966. }
  32967. });
  32968. }
  32969. return children2;
  32970. };
  32971. const { groupQueryChange } = vue.toRaw(select);
  32972. vue.watch(groupQueryChange, () => {
  32973. visible.value = children.value.some((option) => option.visible === true);
  32974. }, { flush: "post" });
  32975. return {
  32976. visible,
  32977. ns
  32978. };
  32979. }
  32980. });
  32981. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  32982. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("ul", {
  32983. class: vue.normalizeClass(_ctx.ns.be("group", "wrap"))
  32984. }, [
  32985. vue.createElementVNode("li", {
  32986. class: vue.normalizeClass(_ctx.ns.be("group", "title"))
  32987. }, vue.toDisplayString(_ctx.label), 3),
  32988. vue.createElementVNode("li", null, [
  32989. vue.createElementVNode("ul", {
  32990. class: vue.normalizeClass(_ctx.ns.b("group"))
  32991. }, [
  32992. vue.renderSlot(_ctx.$slots, "default")
  32993. ], 2)
  32994. ])
  32995. ], 2)), [
  32996. [vue.vShow, _ctx.visible]
  32997. ]);
  32998. }
  32999. var OptionGroup = /* @__PURE__ */ _export_sfc(_sfc_main$L, [["render", _sfc_render$8], ["__file", "option-group.vue"]]);
  33000. const ElSelect = withInstall(Select$1, {
  33001. Option,
  33002. OptionGroup
  33003. });
  33004. const ElOption = withNoopInstall(Option);
  33005. const ElOptionGroup = withNoopInstall(OptionGroup);
  33006. const usePagination = () => vue.inject(elPaginationKey, {});
  33007. const paginationSizesProps = buildProps({
  33008. pageSize: {
  33009. type: Number,
  33010. required: true
  33011. },
  33012. pageSizes: {
  33013. type: definePropType(Array),
  33014. default: () => mutable([10, 20, 30, 40, 50, 100])
  33015. },
  33016. popperClass: {
  33017. type: String
  33018. },
  33019. disabled: Boolean,
  33020. size: {
  33021. type: String,
  33022. values: componentSizes
  33023. }
  33024. });
  33025. const __default__$A = vue.defineComponent({
  33026. name: "ElPaginationSizes"
  33027. });
  33028. const _sfc_main$K = /* @__PURE__ */ vue.defineComponent({
  33029. ...__default__$A,
  33030. props: paginationSizesProps,
  33031. emits: ["page-size-change"],
  33032. setup(__props, { emit }) {
  33033. const props = __props;
  33034. const { t } = useLocale();
  33035. const ns = useNamespace("pagination");
  33036. const pagination = usePagination();
  33037. const innerPageSize = vue.ref(props.pageSize);
  33038. vue.watch(() => props.pageSizes, (newVal, oldVal) => {
  33039. if (isEqual$1(newVal, oldVal))
  33040. return;
  33041. if (Array.isArray(newVal)) {
  33042. const pageSize = newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0];
  33043. emit("page-size-change", pageSize);
  33044. }
  33045. });
  33046. vue.watch(() => props.pageSize, (newVal) => {
  33047. innerPageSize.value = newVal;
  33048. });
  33049. const innerPageSizes = vue.computed(() => props.pageSizes);
  33050. function handleChange(val) {
  33051. var _a;
  33052. if (val !== innerPageSize.value) {
  33053. innerPageSize.value = val;
  33054. (_a = pagination.handleSizeChange) == null ? void 0 : _a.call(pagination, Number(val));
  33055. }
  33056. }
  33057. return (_ctx, _cache) => {
  33058. return vue.openBlock(), vue.createElementBlock("span", {
  33059. class: vue.normalizeClass(vue.unref(ns).e("sizes"))
  33060. }, [
  33061. vue.createVNode(vue.unref(ElSelect), {
  33062. "model-value": innerPageSize.value,
  33063. disabled: _ctx.disabled,
  33064. "popper-class": _ctx.popperClass,
  33065. size: _ctx.size,
  33066. "validate-event": false,
  33067. onChange: handleChange
  33068. }, {
  33069. default: vue.withCtx(() => [
  33070. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(innerPageSizes), (item) => {
  33071. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  33072. key: item,
  33073. value: item,
  33074. label: item + vue.unref(t)("el.pagination.pagesize")
  33075. }, null, 8, ["value", "label"]);
  33076. }), 128))
  33077. ]),
  33078. _: 1
  33079. }, 8, ["model-value", "disabled", "popper-class", "size"])
  33080. ], 2);
  33081. };
  33082. }
  33083. });
  33084. var Sizes = /* @__PURE__ */ _export_sfc(_sfc_main$K, [["__file", "sizes.vue"]]);
  33085. const _hoisted_1$m = ["disabled"];
  33086. const __default__$z = vue.defineComponent({
  33087. name: "ElPaginationJumper"
  33088. });
  33089. const _sfc_main$J = /* @__PURE__ */ vue.defineComponent({
  33090. ...__default__$z,
  33091. setup(__props) {
  33092. const { t } = useLocale();
  33093. const ns = useNamespace("pagination");
  33094. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  33095. const userInput = vue.ref();
  33096. const innerValue = vue.computed(() => {
  33097. var _a;
  33098. return (_a = userInput.value) != null ? _a : currentPage == null ? void 0 : currentPage.value;
  33099. });
  33100. function handleInput(val) {
  33101. userInput.value = +val;
  33102. }
  33103. function handleChange(val) {
  33104. val = Math.trunc(+val);
  33105. changeEvent == null ? void 0 : changeEvent(+val);
  33106. userInput.value = void 0;
  33107. }
  33108. return (_ctx, _cache) => {
  33109. return vue.openBlock(), vue.createElementBlock("span", {
  33110. class: vue.normalizeClass(vue.unref(ns).e("jump")),
  33111. disabled: vue.unref(disabled)
  33112. }, [
  33113. vue.createTextVNode(vue.toDisplayString(vue.unref(t)("el.pagination.goto")) + " ", 1),
  33114. vue.createVNode(vue.unref(ElInput), {
  33115. size: "small",
  33116. class: vue.normalizeClass([vue.unref(ns).e("editor"), vue.unref(ns).is("in-pagination")]),
  33117. min: 1,
  33118. max: vue.unref(pageCount),
  33119. disabled: vue.unref(disabled),
  33120. "model-value": vue.unref(innerValue),
  33121. "validate-event": false,
  33122. type: "number",
  33123. "onUpdate:modelValue": handleInput,
  33124. onChange: handleChange
  33125. }, null, 8, ["class", "max", "disabled", "model-value"]),
  33126. vue.createTextVNode(" " + vue.toDisplayString(vue.unref(t)("el.pagination.pageClassifier")), 1)
  33127. ], 10, _hoisted_1$m);
  33128. };
  33129. }
  33130. });
  33131. var Jumper = /* @__PURE__ */ _export_sfc(_sfc_main$J, [["__file", "jumper.vue"]]);
  33132. const paginationTotalProps = buildProps({
  33133. total: {
  33134. type: Number,
  33135. default: 1e3
  33136. }
  33137. });
  33138. const _hoisted_1$l = ["disabled"];
  33139. const __default__$y = vue.defineComponent({
  33140. name: "ElPaginationTotal"
  33141. });
  33142. const _sfc_main$I = /* @__PURE__ */ vue.defineComponent({
  33143. ...__default__$y,
  33144. props: paginationTotalProps,
  33145. setup(__props) {
  33146. const { t } = useLocale();
  33147. const ns = useNamespace("pagination");
  33148. const { disabled } = usePagination();
  33149. return (_ctx, _cache) => {
  33150. return vue.openBlock(), vue.createElementBlock("span", {
  33151. class: vue.normalizeClass(vue.unref(ns).e("total")),
  33152. disabled: vue.unref(disabled)
  33153. }, vue.toDisplayString(vue.unref(t)("el.pagination.total", {
  33154. total: _ctx.total
  33155. })), 11, _hoisted_1$l);
  33156. };
  33157. }
  33158. });
  33159. var Total = /* @__PURE__ */ _export_sfc(_sfc_main$I, [["__file", "total.vue"]]);
  33160. const paginationPagerProps = buildProps({
  33161. currentPage: {
  33162. type: Number,
  33163. default: 1
  33164. },
  33165. pageCount: {
  33166. type: Number,
  33167. required: true
  33168. },
  33169. pagerCount: {
  33170. type: Number,
  33171. default: 7
  33172. },
  33173. disabled: Boolean
  33174. });
  33175. const _hoisted_1$k = ["onKeyup"];
  33176. const _hoisted_2$e = ["aria-current", "tabindex"];
  33177. const _hoisted_3$7 = ["tabindex"];
  33178. const _hoisted_4$5 = ["aria-current", "tabindex"];
  33179. const _hoisted_5$4 = ["tabindex"];
  33180. const _hoisted_6 = ["aria-current", "tabindex"];
  33181. const __default__$x = vue.defineComponent({
  33182. name: "ElPaginationPager"
  33183. });
  33184. const _sfc_main$H = /* @__PURE__ */ vue.defineComponent({
  33185. ...__default__$x,
  33186. props: paginationPagerProps,
  33187. emits: ["change"],
  33188. setup(__props, { emit }) {
  33189. const props = __props;
  33190. const nsPager = useNamespace("pager");
  33191. const nsIcon = useNamespace("icon");
  33192. const showPrevMore = vue.ref(false);
  33193. const showNextMore = vue.ref(false);
  33194. const quickPrevHover = vue.ref(false);
  33195. const quickNextHover = vue.ref(false);
  33196. const quickPrevFocus = vue.ref(false);
  33197. const quickNextFocus = vue.ref(false);
  33198. const pagers = vue.computed(() => {
  33199. const pagerCount = props.pagerCount;
  33200. const halfPagerCount = (pagerCount - 1) / 2;
  33201. const currentPage = Number(props.currentPage);
  33202. const pageCount = Number(props.pageCount);
  33203. let showPrevMore2 = false;
  33204. let showNextMore2 = false;
  33205. if (pageCount > pagerCount) {
  33206. if (currentPage > pagerCount - halfPagerCount) {
  33207. showPrevMore2 = true;
  33208. }
  33209. if (currentPage < pageCount - halfPagerCount) {
  33210. showNextMore2 = true;
  33211. }
  33212. }
  33213. const array = [];
  33214. if (showPrevMore2 && !showNextMore2) {
  33215. const startPage = pageCount - (pagerCount - 2);
  33216. for (let i = startPage; i < pageCount; i++) {
  33217. array.push(i);
  33218. }
  33219. } else if (!showPrevMore2 && showNextMore2) {
  33220. for (let i = 2; i < pagerCount; i++) {
  33221. array.push(i);
  33222. }
  33223. } else if (showPrevMore2 && showNextMore2) {
  33224. const offset = Math.floor(pagerCount / 2) - 1;
  33225. for (let i = currentPage - offset; i <= currentPage + offset; i++) {
  33226. array.push(i);
  33227. }
  33228. } else {
  33229. for (let i = 2; i < pageCount; i++) {
  33230. array.push(i);
  33231. }
  33232. }
  33233. return array;
  33234. });
  33235. const tabindex = vue.computed(() => props.disabled ? -1 : 0);
  33236. vue.watchEffect(() => {
  33237. const halfPagerCount = (props.pagerCount - 1) / 2;
  33238. showPrevMore.value = false;
  33239. showNextMore.value = false;
  33240. if (props.pageCount > props.pagerCount) {
  33241. if (props.currentPage > props.pagerCount - halfPagerCount) {
  33242. showPrevMore.value = true;
  33243. }
  33244. if (props.currentPage < props.pageCount - halfPagerCount) {
  33245. showNextMore.value = true;
  33246. }
  33247. }
  33248. });
  33249. function onMouseEnter(forward = false) {
  33250. if (props.disabled)
  33251. return;
  33252. if (forward) {
  33253. quickPrevHover.value = true;
  33254. } else {
  33255. quickNextHover.value = true;
  33256. }
  33257. }
  33258. function onFocus(forward = false) {
  33259. if (forward) {
  33260. quickPrevFocus.value = true;
  33261. } else {
  33262. quickNextFocus.value = true;
  33263. }
  33264. }
  33265. function onEnter(e) {
  33266. const target = e.target;
  33267. if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
  33268. const newPage = Number(target.textContent);
  33269. if (newPage !== props.currentPage) {
  33270. emit("change", newPage);
  33271. }
  33272. } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) {
  33273. onPagerClick(e);
  33274. }
  33275. }
  33276. function onPagerClick(event) {
  33277. const target = event.target;
  33278. if (target.tagName.toLowerCase() === "ul" || props.disabled) {
  33279. return;
  33280. }
  33281. let newPage = Number(target.textContent);
  33282. const pageCount = props.pageCount;
  33283. const currentPage = props.currentPage;
  33284. const pagerCountOffset = props.pagerCount - 2;
  33285. if (target.className.includes("more")) {
  33286. if (target.className.includes("quickprev")) {
  33287. newPage = currentPage - pagerCountOffset;
  33288. } else if (target.className.includes("quicknext")) {
  33289. newPage = currentPage + pagerCountOffset;
  33290. }
  33291. }
  33292. if (!Number.isNaN(+newPage)) {
  33293. if (newPage < 1) {
  33294. newPage = 1;
  33295. }
  33296. if (newPage > pageCount) {
  33297. newPage = pageCount;
  33298. }
  33299. }
  33300. if (newPage !== currentPage) {
  33301. emit("change", newPage);
  33302. }
  33303. }
  33304. return (_ctx, _cache) => {
  33305. return vue.openBlock(), vue.createElementBlock("ul", {
  33306. class: vue.normalizeClass(vue.unref(nsPager).b()),
  33307. onClick: onPagerClick,
  33308. onKeyup: vue.withKeys(onEnter, ["enter"])
  33309. }, [
  33310. _ctx.pageCount > 0 ? (vue.openBlock(), vue.createElementBlock("li", {
  33311. key: 0,
  33312. class: vue.normalizeClass([[
  33313. vue.unref(nsPager).is("active", _ctx.currentPage === 1),
  33314. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33315. ], "number"]),
  33316. "aria-current": _ctx.currentPage === 1,
  33317. tabindex: vue.unref(tabindex)
  33318. }, " 1 ", 10, _hoisted_2$e)) : vue.createCommentVNode("v-if", true),
  33319. showPrevMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  33320. key: 1,
  33321. class: vue.normalizeClass([
  33322. "more",
  33323. "btn-quickprev",
  33324. vue.unref(nsIcon).b(),
  33325. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33326. ]),
  33327. tabindex: vue.unref(tabindex),
  33328. onMouseenter: _cache[0] || (_cache[0] = ($event) => onMouseEnter(true)),
  33329. onMouseleave: _cache[1] || (_cache[1] = ($event) => quickPrevHover.value = false),
  33330. onFocus: _cache[2] || (_cache[2] = ($event) => onFocus(true)),
  33331. onBlur: _cache[3] || (_cache[3] = ($event) => quickPrevFocus.value = false)
  33332. }, [
  33333. quickPrevHover.value || quickPrevFocus.value ? (vue.openBlock(), vue.createBlock(vue.unref(d_arrow_left_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(more_filled_default), { key: 1 }))
  33334. ], 42, _hoisted_3$7)) : vue.createCommentVNode("v-if", true),
  33335. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(pagers), (pager) => {
  33336. return vue.openBlock(), vue.createElementBlock("li", {
  33337. key: pager,
  33338. class: vue.normalizeClass([[
  33339. vue.unref(nsPager).is("active", _ctx.currentPage === pager),
  33340. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33341. ], "number"]),
  33342. "aria-current": _ctx.currentPage === pager,
  33343. tabindex: vue.unref(tabindex)
  33344. }, vue.toDisplayString(pager), 11, _hoisted_4$5);
  33345. }), 128)),
  33346. showNextMore.value ? (vue.openBlock(), vue.createElementBlock("li", {
  33347. key: 2,
  33348. class: vue.normalizeClass([
  33349. "more",
  33350. "btn-quicknext",
  33351. vue.unref(nsIcon).b(),
  33352. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33353. ]),
  33354. tabindex: vue.unref(tabindex),
  33355. onMouseenter: _cache[4] || (_cache[4] = ($event) => onMouseEnter()),
  33356. onMouseleave: _cache[5] || (_cache[5] = ($event) => quickNextHover.value = false),
  33357. onFocus: _cache[6] || (_cache[6] = ($event) => onFocus()),
  33358. onBlur: _cache[7] || (_cache[7] = ($event) => quickNextFocus.value = false)
  33359. }, [
  33360. quickNextHover.value || quickNextFocus.value ? (vue.openBlock(), vue.createBlock(vue.unref(d_arrow_right_default), { key: 0 })) : (vue.openBlock(), vue.createBlock(vue.unref(more_filled_default), { key: 1 }))
  33361. ], 42, _hoisted_5$4)) : vue.createCommentVNode("v-if", true),
  33362. _ctx.pageCount > 1 ? (vue.openBlock(), vue.createElementBlock("li", {
  33363. key: 3,
  33364. class: vue.normalizeClass([[
  33365. vue.unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount),
  33366. vue.unref(nsPager).is("disabled", _ctx.disabled)
  33367. ], "number"]),
  33368. "aria-current": _ctx.currentPage === _ctx.pageCount,
  33369. tabindex: vue.unref(tabindex)
  33370. }, vue.toDisplayString(_ctx.pageCount), 11, _hoisted_6)) : vue.createCommentVNode("v-if", true)
  33371. ], 42, _hoisted_1$k);
  33372. };
  33373. }
  33374. });
  33375. var Pager = /* @__PURE__ */ _export_sfc(_sfc_main$H, [["__file", "pager.vue"]]);
  33376. const isAbsent = (v) => typeof v !== "number";
  33377. const paginationProps = buildProps({
  33378. total: Number,
  33379. pageSize: Number,
  33380. defaultPageSize: Number,
  33381. currentPage: Number,
  33382. defaultCurrentPage: Number,
  33383. pageCount: Number,
  33384. pagerCount: {
  33385. type: Number,
  33386. validator: (value) => {
  33387. return typeof value === "number" && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
  33388. },
  33389. default: 7
  33390. },
  33391. layout: {
  33392. type: String,
  33393. default: ["prev", "pager", "next", "jumper", "->", "total"].join(", ")
  33394. },
  33395. pageSizes: {
  33396. type: definePropType(Array),
  33397. default: () => mutable([10, 20, 30, 40, 50, 100])
  33398. },
  33399. popperClass: {
  33400. type: String,
  33401. default: ""
  33402. },
  33403. prevText: {
  33404. type: String,
  33405. default: ""
  33406. },
  33407. prevIcon: {
  33408. type: iconPropType,
  33409. default: () => arrow_left_default
  33410. },
  33411. nextText: {
  33412. type: String,
  33413. default: ""
  33414. },
  33415. nextIcon: {
  33416. type: iconPropType,
  33417. default: () => arrow_right_default
  33418. },
  33419. small: Boolean,
  33420. background: Boolean,
  33421. disabled: Boolean,
  33422. hideOnSinglePage: Boolean
  33423. });
  33424. const paginationEmits = {
  33425. "update:current-page": (val) => typeof val === "number",
  33426. "update:page-size": (val) => typeof val === "number",
  33427. "size-change": (val) => typeof val === "number",
  33428. "current-change": (val) => typeof val === "number",
  33429. "prev-click": (val) => typeof val === "number",
  33430. "next-click": (val) => typeof val === "number"
  33431. };
  33432. const componentName = "ElPagination";
  33433. var Pagination = vue.defineComponent({
  33434. name: componentName,
  33435. props: paginationProps,
  33436. emits: paginationEmits,
  33437. setup(props, { emit, slots }) {
  33438. const { t } = useLocale();
  33439. const ns = useNamespace("pagination");
  33440. const vnodeProps = vue.getCurrentInstance().vnode.props || {};
  33441. const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
  33442. const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
  33443. const assertValidUsage = vue.computed(() => {
  33444. if (isAbsent(props.total) && isAbsent(props.pageCount))
  33445. return false;
  33446. if (!isAbsent(props.currentPage) && !hasCurrentPageListener)
  33447. return false;
  33448. if (props.layout.includes("sizes")) {
  33449. if (!isAbsent(props.pageCount)) {
  33450. if (!hasPageSizeListener)
  33451. return false;
  33452. } else if (!isAbsent(props.total)) {
  33453. if (!isAbsent(props.pageSize)) {
  33454. if (!hasPageSizeListener) {
  33455. return false;
  33456. }
  33457. }
  33458. }
  33459. }
  33460. return true;
  33461. });
  33462. const innerPageSize = vue.ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
  33463. const innerCurrentPage = vue.ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
  33464. const pageSizeBridge = vue.computed({
  33465. get() {
  33466. return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
  33467. },
  33468. set(v) {
  33469. if (isAbsent(props.pageSize)) {
  33470. innerPageSize.value = v;
  33471. }
  33472. if (hasPageSizeListener) {
  33473. emit("update:page-size", v);
  33474. emit("size-change", v);
  33475. }
  33476. }
  33477. });
  33478. const pageCountBridge = vue.computed(() => {
  33479. let pageCount = 0;
  33480. if (!isAbsent(props.pageCount)) {
  33481. pageCount = props.pageCount;
  33482. } else if (!isAbsent(props.total)) {
  33483. pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
  33484. }
  33485. return pageCount;
  33486. });
  33487. const currentPageBridge = vue.computed({
  33488. get() {
  33489. return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
  33490. },
  33491. set(v) {
  33492. let newCurrentPage = v;
  33493. if (v < 1) {
  33494. newCurrentPage = 1;
  33495. } else if (v > pageCountBridge.value) {
  33496. newCurrentPage = pageCountBridge.value;
  33497. }
  33498. if (isAbsent(props.currentPage)) {
  33499. innerCurrentPage.value = newCurrentPage;
  33500. }
  33501. if (hasCurrentPageListener) {
  33502. emit("update:current-page", newCurrentPage);
  33503. emit("current-change", newCurrentPage);
  33504. }
  33505. }
  33506. });
  33507. vue.watch(pageCountBridge, (val) => {
  33508. if (currentPageBridge.value > val)
  33509. currentPageBridge.value = val;
  33510. });
  33511. function handleCurrentChange(val) {
  33512. currentPageBridge.value = val;
  33513. }
  33514. function handleSizeChange(val) {
  33515. pageSizeBridge.value = val;
  33516. const newPageCount = pageCountBridge.value;
  33517. if (currentPageBridge.value > newPageCount) {
  33518. currentPageBridge.value = newPageCount;
  33519. }
  33520. }
  33521. function prev() {
  33522. if (props.disabled)
  33523. return;
  33524. currentPageBridge.value -= 1;
  33525. emit("prev-click", currentPageBridge.value);
  33526. }
  33527. function next() {
  33528. if (props.disabled)
  33529. return;
  33530. currentPageBridge.value += 1;
  33531. emit("next-click", currentPageBridge.value);
  33532. }
  33533. function addClass(element, cls) {
  33534. if (element) {
  33535. if (!element.props) {
  33536. element.props = {};
  33537. }
  33538. element.props.class = [element.props.class, cls].join(" ");
  33539. }
  33540. }
  33541. vue.provide(elPaginationKey, {
  33542. pageCount: pageCountBridge,
  33543. disabled: vue.computed(() => props.disabled),
  33544. currentPage: currentPageBridge,
  33545. changeEvent: handleCurrentChange,
  33546. handleSizeChange
  33547. });
  33548. return () => {
  33549. var _a, _b;
  33550. if (!assertValidUsage.value) {
  33551. debugWarn(componentName, t("el.pagination.deprecationWarning"));
  33552. return null;
  33553. }
  33554. if (!props.layout)
  33555. return null;
  33556. if (props.hideOnSinglePage && pageCountBridge.value <= 1)
  33557. return null;
  33558. const rootChildren = [];
  33559. const rightWrapperChildren = [];
  33560. const rightWrapperRoot = vue.h("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
  33561. const TEMPLATE_MAP = {
  33562. prev: vue.h(Prev, {
  33563. disabled: props.disabled,
  33564. currentPage: currentPageBridge.value,
  33565. prevText: props.prevText,
  33566. prevIcon: props.prevIcon,
  33567. onClick: prev
  33568. }),
  33569. jumper: vue.h(Jumper),
  33570. pager: vue.h(Pager, {
  33571. currentPage: currentPageBridge.value,
  33572. pageCount: pageCountBridge.value,
  33573. pagerCount: props.pagerCount,
  33574. onChange: handleCurrentChange,
  33575. disabled: props.disabled
  33576. }),
  33577. next: vue.h(Next, {
  33578. disabled: props.disabled,
  33579. currentPage: currentPageBridge.value,
  33580. pageCount: pageCountBridge.value,
  33581. nextText: props.nextText,
  33582. nextIcon: props.nextIcon,
  33583. onClick: next
  33584. }),
  33585. sizes: vue.h(Sizes, {
  33586. pageSize: pageSizeBridge.value,
  33587. pageSizes: props.pageSizes,
  33588. popperClass: props.popperClass,
  33589. disabled: props.disabled,
  33590. size: props.small ? "small" : "default"
  33591. }),
  33592. slot: (_b = (_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots)) != null ? _b : null,
  33593. total: vue.h(Total, { total: isAbsent(props.total) ? 0 : props.total })
  33594. };
  33595. const components = props.layout.split(",").map((item) => item.trim());
  33596. let haveRightWrapper = false;
  33597. components.forEach((c) => {
  33598. if (c === "->") {
  33599. haveRightWrapper = true;
  33600. return;
  33601. }
  33602. if (!haveRightWrapper) {
  33603. rootChildren.push(TEMPLATE_MAP[c]);
  33604. } else {
  33605. rightWrapperChildren.push(TEMPLATE_MAP[c]);
  33606. }
  33607. });
  33608. addClass(rootChildren[0], ns.is("first"));
  33609. addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
  33610. if (haveRightWrapper && rightWrapperChildren.length > 0) {
  33611. addClass(rightWrapperChildren[0], ns.is("first"));
  33612. addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
  33613. rootChildren.push(rightWrapperRoot);
  33614. }
  33615. return vue.h("div", {
  33616. role: "pagination",
  33617. "aria-label": "pagination",
  33618. class: [
  33619. ns.b(),
  33620. ns.is("background", props.background),
  33621. {
  33622. [ns.m("small")]: props.small
  33623. }
  33624. ]
  33625. }, rootChildren);
  33626. };
  33627. }
  33628. });
  33629. const ElPagination = withInstall(Pagination);
  33630. const popconfirmProps = buildProps({
  33631. title: String,
  33632. confirmButtonText: String,
  33633. cancelButtonText: String,
  33634. confirmButtonType: {
  33635. type: String,
  33636. values: buttonTypes,
  33637. default: "primary"
  33638. },
  33639. cancelButtonType: {
  33640. type: String,
  33641. values: buttonTypes,
  33642. default: "text"
  33643. },
  33644. icon: {
  33645. type: iconPropType,
  33646. default: () => question_filled_default
  33647. },
  33648. iconColor: {
  33649. type: String,
  33650. default: "#f90"
  33651. },
  33652. hideIcon: {
  33653. type: Boolean,
  33654. default: false
  33655. },
  33656. hideAfter: {
  33657. type: Number,
  33658. default: 200
  33659. },
  33660. onConfirm: {
  33661. type: definePropType(Function)
  33662. },
  33663. onCancel: {
  33664. type: definePropType(Function)
  33665. },
  33666. teleported: useTooltipContentProps.teleported,
  33667. persistent: useTooltipContentProps.persistent,
  33668. width: {
  33669. type: [String, Number],
  33670. default: 150
  33671. }
  33672. });
  33673. const __default__$w = vue.defineComponent({
  33674. name: "ElPopconfirm"
  33675. });
  33676. const _sfc_main$G = /* @__PURE__ */ vue.defineComponent({
  33677. ...__default__$w,
  33678. props: popconfirmProps,
  33679. setup(__props) {
  33680. const props = __props;
  33681. const { t } = useLocale();
  33682. const ns = useNamespace("popconfirm");
  33683. const tooltipRef = vue.ref();
  33684. const hidePopper = () => {
  33685. var _a, _b;
  33686. (_b = (_a = tooltipRef.value) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a);
  33687. };
  33688. const style = vue.computed(() => {
  33689. return {
  33690. width: addUnit(props.width)
  33691. };
  33692. });
  33693. const confirm = (e) => {
  33694. var _a;
  33695. (_a = props.onConfirm) == null ? void 0 : _a.call(props, e);
  33696. hidePopper();
  33697. };
  33698. const cancel = (e) => {
  33699. var _a;
  33700. (_a = props.onCancel) == null ? void 0 : _a.call(props, e);
  33701. hidePopper();
  33702. };
  33703. const finalConfirmButtonText = vue.computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
  33704. const finalCancelButtonText = vue.computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
  33705. return (_ctx, _cache) => {
  33706. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  33707. ref_key: "tooltipRef",
  33708. ref: tooltipRef,
  33709. trigger: "click",
  33710. effect: "light"
  33711. }, _ctx.$attrs, {
  33712. "popper-class": `${vue.unref(ns).namespace.value}-popover`,
  33713. "popper-style": vue.unref(style),
  33714. teleported: _ctx.teleported,
  33715. "fallback-placements": ["bottom", "top", "right", "left"],
  33716. "hide-after": _ctx.hideAfter,
  33717. persistent: _ctx.persistent
  33718. }), {
  33719. content: vue.withCtx(() => [
  33720. vue.createElementVNode("div", {
  33721. class: vue.normalizeClass(vue.unref(ns).b())
  33722. }, [
  33723. vue.createElementVNode("div", {
  33724. class: vue.normalizeClass(vue.unref(ns).e("main"))
  33725. }, [
  33726. !_ctx.hideIcon && _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  33727. key: 0,
  33728. class: vue.normalizeClass(vue.unref(ns).e("icon")),
  33729. style: vue.normalizeStyle({ color: _ctx.iconColor })
  33730. }, {
  33731. default: vue.withCtx(() => [
  33732. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  33733. ]),
  33734. _: 1
  33735. }, 8, ["class", "style"])) : vue.createCommentVNode("v-if", true),
  33736. vue.createTextVNode(" " + vue.toDisplayString(_ctx.title), 1)
  33737. ], 2),
  33738. vue.createElementVNode("div", {
  33739. class: vue.normalizeClass(vue.unref(ns).e("action"))
  33740. }, [
  33741. vue.createVNode(vue.unref(ElButton), {
  33742. size: "small",
  33743. type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
  33744. text: _ctx.cancelButtonType === "text",
  33745. onClick: cancel
  33746. }, {
  33747. default: vue.withCtx(() => [
  33748. vue.createTextVNode(vue.toDisplayString(vue.unref(finalCancelButtonText)), 1)
  33749. ]),
  33750. _: 1
  33751. }, 8, ["type", "text"]),
  33752. vue.createVNode(vue.unref(ElButton), {
  33753. size: "small",
  33754. type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
  33755. text: _ctx.confirmButtonType === "text",
  33756. onClick: confirm
  33757. }, {
  33758. default: vue.withCtx(() => [
  33759. vue.createTextVNode(vue.toDisplayString(vue.unref(finalConfirmButtonText)), 1)
  33760. ]),
  33761. _: 1
  33762. }, 8, ["type", "text"])
  33763. ], 2)
  33764. ], 2)
  33765. ]),
  33766. default: vue.withCtx(() => [
  33767. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  33768. ]),
  33769. _: 3
  33770. }, 16, ["popper-class", "popper-style", "teleported", "hide-after", "persistent"]);
  33771. };
  33772. }
  33773. });
  33774. var Popconfirm = /* @__PURE__ */ _export_sfc(_sfc_main$G, [["__file", "popconfirm.vue"]]);
  33775. const ElPopconfirm = withInstall(Popconfirm);
  33776. const popoverProps = buildProps({
  33777. trigger: useTooltipTriggerProps.trigger,
  33778. placement: dropdownProps.placement,
  33779. disabled: useTooltipTriggerProps.disabled,
  33780. visible: useTooltipContentProps.visible,
  33781. transition: useTooltipContentProps.transition,
  33782. popperOptions: dropdownProps.popperOptions,
  33783. tabindex: dropdownProps.tabindex,
  33784. content: useTooltipContentProps.content,
  33785. popperStyle: useTooltipContentProps.popperStyle,
  33786. popperClass: useTooltipContentProps.popperClass,
  33787. enterable: {
  33788. ...useTooltipContentProps.enterable,
  33789. default: true
  33790. },
  33791. effect: {
  33792. ...useTooltipContentProps.effect,
  33793. default: "light"
  33794. },
  33795. teleported: useTooltipContentProps.teleported,
  33796. title: String,
  33797. width: {
  33798. type: [String, Number],
  33799. default: 150
  33800. },
  33801. offset: {
  33802. type: Number,
  33803. default: void 0
  33804. },
  33805. showAfter: {
  33806. type: Number,
  33807. default: 0
  33808. },
  33809. hideAfter: {
  33810. type: Number,
  33811. default: 200
  33812. },
  33813. autoClose: {
  33814. type: Number,
  33815. default: 0
  33816. },
  33817. showArrow: {
  33818. type: Boolean,
  33819. default: true
  33820. },
  33821. persistent: {
  33822. type: Boolean,
  33823. default: true
  33824. },
  33825. "onUpdate:visible": {
  33826. type: Function
  33827. }
  33828. });
  33829. const popoverEmits = {
  33830. "update:visible": (value) => isBoolean(value),
  33831. "before-enter": () => true,
  33832. "before-leave": () => true,
  33833. "after-enter": () => true,
  33834. "after-leave": () => true
  33835. };
  33836. const updateEventKeyRaw = `onUpdate:visible`;
  33837. const __default__$v = vue.defineComponent({
  33838. name: "ElPopover"
  33839. });
  33840. const _sfc_main$F = /* @__PURE__ */ vue.defineComponent({
  33841. ...__default__$v,
  33842. props: popoverProps,
  33843. emits: popoverEmits,
  33844. setup(__props, { expose, emit }) {
  33845. const props = __props;
  33846. const onUpdateVisible = vue.computed(() => {
  33847. return props[updateEventKeyRaw];
  33848. });
  33849. const ns = useNamespace("popover");
  33850. const tooltipRef = vue.ref();
  33851. const popperRef = vue.computed(() => {
  33852. var _a;
  33853. return (_a = vue.unref(tooltipRef)) == null ? void 0 : _a.popperRef;
  33854. });
  33855. const style = vue.computed(() => {
  33856. return [
  33857. {
  33858. width: addUnit(props.width)
  33859. },
  33860. props.popperStyle
  33861. ];
  33862. });
  33863. const kls = vue.computed(() => {
  33864. return [ns.b(), props.popperClass, { [ns.m("plain")]: !!props.content }];
  33865. });
  33866. const gpuAcceleration = vue.computed(() => {
  33867. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  33868. });
  33869. const hide = () => {
  33870. var _a;
  33871. (_a = tooltipRef.value) == null ? void 0 : _a.hide();
  33872. };
  33873. const beforeEnter = () => {
  33874. emit("before-enter");
  33875. };
  33876. const beforeLeave = () => {
  33877. emit("before-leave");
  33878. };
  33879. const afterEnter = () => {
  33880. emit("after-enter");
  33881. };
  33882. const afterLeave = () => {
  33883. emit("update:visible", false);
  33884. emit("after-leave");
  33885. };
  33886. expose({
  33887. popperRef,
  33888. hide
  33889. });
  33890. return (_ctx, _cache) => {
  33891. return vue.openBlock(), vue.createBlock(vue.unref(ElTooltip), vue.mergeProps({
  33892. ref_key: "tooltipRef",
  33893. ref: tooltipRef
  33894. }, _ctx.$attrs, {
  33895. trigger: _ctx.trigger,
  33896. placement: _ctx.placement,
  33897. disabled: _ctx.disabled,
  33898. visible: _ctx.visible,
  33899. transition: _ctx.transition,
  33900. "popper-options": _ctx.popperOptions,
  33901. tabindex: _ctx.tabindex,
  33902. content: _ctx.content,
  33903. offset: _ctx.offset,
  33904. "show-after": _ctx.showAfter,
  33905. "hide-after": _ctx.hideAfter,
  33906. "auto-close": _ctx.autoClose,
  33907. "show-arrow": _ctx.showArrow,
  33908. "aria-label": _ctx.title,
  33909. effect: _ctx.effect,
  33910. enterable: _ctx.enterable,
  33911. "popper-class": vue.unref(kls),
  33912. "popper-style": vue.unref(style),
  33913. teleported: _ctx.teleported,
  33914. persistent: _ctx.persistent,
  33915. "gpu-acceleration": vue.unref(gpuAcceleration),
  33916. "onUpdate:visible": vue.unref(onUpdateVisible),
  33917. onBeforeShow: beforeEnter,
  33918. onBeforeHide: beforeLeave,
  33919. onShow: afterEnter,
  33920. onHide: afterLeave
  33921. }), {
  33922. content: vue.withCtx(() => [
  33923. _ctx.title ? (vue.openBlock(), vue.createElementBlock("div", {
  33924. key: 0,
  33925. class: vue.normalizeClass(vue.unref(ns).e("title")),
  33926. role: "title"
  33927. }, vue.toDisplayString(_ctx.title), 3)) : vue.createCommentVNode("v-if", true),
  33928. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  33929. vue.createTextVNode(vue.toDisplayString(_ctx.content), 1)
  33930. ])
  33931. ]),
  33932. default: vue.withCtx(() => [
  33933. _ctx.$slots.reference ? vue.renderSlot(_ctx.$slots, "reference", { key: 0 }) : vue.createCommentVNode("v-if", true)
  33934. ]),
  33935. _: 3
  33936. }, 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"]);
  33937. };
  33938. }
  33939. });
  33940. var Popover = /* @__PURE__ */ _export_sfc(_sfc_main$F, [["__file", "popover.vue"]]);
  33941. const attachEvents = (el, binding) => {
  33942. const popperComponent = binding.arg || binding.value;
  33943. const popover = popperComponent == null ? void 0 : popperComponent.popperRef;
  33944. if (popover) {
  33945. popover.triggerRef = el;
  33946. }
  33947. };
  33948. var PopoverDirective = {
  33949. mounted(el, binding) {
  33950. attachEvents(el, binding);
  33951. },
  33952. updated(el, binding) {
  33953. attachEvents(el, binding);
  33954. }
  33955. };
  33956. const VPopover = "popover";
  33957. const ElPopoverDirective = withInstallDirective(PopoverDirective, VPopover);
  33958. const ElPopover = withInstall(Popover, {
  33959. directive: ElPopoverDirective
  33960. });
  33961. const progressProps = buildProps({
  33962. type: {
  33963. type: String,
  33964. default: "line",
  33965. values: ["line", "circle", "dashboard"]
  33966. },
  33967. percentage: {
  33968. type: Number,
  33969. default: 0,
  33970. validator: (val) => val >= 0 && val <= 100
  33971. },
  33972. status: {
  33973. type: String,
  33974. default: "",
  33975. values: ["", "success", "exception", "warning"]
  33976. },
  33977. indeterminate: {
  33978. type: Boolean,
  33979. default: false
  33980. },
  33981. duration: {
  33982. type: Number,
  33983. default: 3
  33984. },
  33985. strokeWidth: {
  33986. type: Number,
  33987. default: 6
  33988. },
  33989. strokeLinecap: {
  33990. type: definePropType(String),
  33991. default: "round"
  33992. },
  33993. textInside: {
  33994. type: Boolean,
  33995. default: false
  33996. },
  33997. width: {
  33998. type: Number,
  33999. default: 126
  34000. },
  34001. showText: {
  34002. type: Boolean,
  34003. default: true
  34004. },
  34005. color: {
  34006. type: definePropType([
  34007. String,
  34008. Array,
  34009. Function
  34010. ]),
  34011. default: ""
  34012. },
  34013. format: {
  34014. type: definePropType(Function),
  34015. default: (percentage) => `${percentage}%`
  34016. }
  34017. });
  34018. const _hoisted_1$j = ["aria-valuenow"];
  34019. const _hoisted_2$d = { viewBox: "0 0 100 100" };
  34020. const _hoisted_3$6 = ["d", "stroke", "stroke-width"];
  34021. const _hoisted_4$4 = ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"];
  34022. const _hoisted_5$3 = { key: 0 };
  34023. const __default__$u = vue.defineComponent({
  34024. name: "ElProgress"
  34025. });
  34026. const _sfc_main$E = /* @__PURE__ */ vue.defineComponent({
  34027. ...__default__$u,
  34028. props: progressProps,
  34029. setup(__props) {
  34030. const props = __props;
  34031. const STATUS_COLOR_MAP = {
  34032. success: "#13ce66",
  34033. exception: "#ff4949",
  34034. warning: "#e6a23c",
  34035. default: "#20a0ff"
  34036. };
  34037. const ns = useNamespace("progress");
  34038. const barStyle = vue.computed(() => ({
  34039. width: `${props.percentage}%`,
  34040. animationDuration: `${props.duration}s`,
  34041. backgroundColor: getCurrentColor(props.percentage)
  34042. }));
  34043. const relativeStrokeWidth = vue.computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  34044. const radius = vue.computed(() => {
  34045. if (["circle", "dashboard"].includes(props.type)) {
  34046. return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  34047. }
  34048. return 0;
  34049. });
  34050. const trackPath = vue.computed(() => {
  34051. const r = radius.value;
  34052. const isDashboard = props.type === "dashboard";
  34053. return `
  34054. M 50 50
  34055. m 0 ${isDashboard ? "" : "-"}${r}
  34056. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  34057. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  34058. `;
  34059. });
  34060. const perimeter = vue.computed(() => 2 * Math.PI * radius.value);
  34061. const rate = vue.computed(() => props.type === "dashboard" ? 0.75 : 1);
  34062. const strokeDashoffset = vue.computed(() => {
  34063. const offset = -1 * perimeter.value * (1 - rate.value) / 2;
  34064. return `${offset}px`;
  34065. });
  34066. const trailPathStyle = vue.computed(() => ({
  34067. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  34068. strokeDashoffset: strokeDashoffset.value
  34069. }));
  34070. const circlePathStyle = vue.computed(() => ({
  34071. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  34072. strokeDashoffset: strokeDashoffset.value,
  34073. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
  34074. }));
  34075. const stroke = vue.computed(() => {
  34076. let ret;
  34077. if (props.color) {
  34078. ret = getCurrentColor(props.percentage);
  34079. } else {
  34080. ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
  34081. }
  34082. return ret;
  34083. });
  34084. const statusIcon = vue.computed(() => {
  34085. if (props.status === "warning") {
  34086. return warning_filled_default;
  34087. }
  34088. if (props.type === "line") {
  34089. return props.status === "success" ? circle_check_default : circle_close_default;
  34090. } else {
  34091. return props.status === "success" ? check_default : close_default;
  34092. }
  34093. });
  34094. const progressTextSize = vue.computed(() => {
  34095. return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
  34096. });
  34097. const content = vue.computed(() => props.format(props.percentage));
  34098. function getColors(color) {
  34099. const span = 100 / color.length;
  34100. const seriesColors = color.map((seriesColor, index) => {
  34101. if (isString(seriesColor)) {
  34102. return {
  34103. color: seriesColor,
  34104. percentage: (index + 1) * span
  34105. };
  34106. }
  34107. return seriesColor;
  34108. });
  34109. return seriesColors.sort((a, b) => a.percentage - b.percentage);
  34110. }
  34111. const getCurrentColor = (percentage) => {
  34112. var _a;
  34113. const { color } = props;
  34114. if (isFunction(color)) {
  34115. return color(percentage);
  34116. } else if (isString(color)) {
  34117. return color;
  34118. } else {
  34119. const colors = getColors(color);
  34120. for (const color2 of colors) {
  34121. if (color2.percentage > percentage)
  34122. return color2.color;
  34123. }
  34124. return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color;
  34125. }
  34126. };
  34127. return (_ctx, _cache) => {
  34128. return vue.openBlock(), vue.createElementBlock("div", {
  34129. class: vue.normalizeClass([
  34130. vue.unref(ns).b(),
  34131. vue.unref(ns).m(_ctx.type),
  34132. vue.unref(ns).is(_ctx.status),
  34133. {
  34134. [vue.unref(ns).m("without-text")]: !_ctx.showText,
  34135. [vue.unref(ns).m("text-inside")]: _ctx.textInside
  34136. }
  34137. ]),
  34138. role: "progressbar",
  34139. "aria-valuenow": _ctx.percentage,
  34140. "aria-valuemin": "0",
  34141. "aria-valuemax": "100"
  34142. }, [
  34143. _ctx.type === "line" ? (vue.openBlock(), vue.createElementBlock("div", {
  34144. key: 0,
  34145. class: vue.normalizeClass(vue.unref(ns).b("bar"))
  34146. }, [
  34147. vue.createElementVNode("div", {
  34148. class: vue.normalizeClass(vue.unref(ns).be("bar", "outer")),
  34149. style: vue.normalizeStyle({ height: `${_ctx.strokeWidth}px` })
  34150. }, [
  34151. vue.createElementVNode("div", {
  34152. class: vue.normalizeClass([
  34153. vue.unref(ns).be("bar", "inner"),
  34154. { [vue.unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate }
  34155. ]),
  34156. style: vue.normalizeStyle(vue.unref(barStyle))
  34157. }, [
  34158. (_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  34159. key: 0,
  34160. class: vue.normalizeClass(vue.unref(ns).be("bar", "innerText"))
  34161. }, [
  34162. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  34163. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(content)), 1)
  34164. ])
  34165. ], 2)) : vue.createCommentVNode("v-if", true)
  34166. ], 6)
  34167. ], 6)
  34168. ], 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  34169. key: 1,
  34170. class: vue.normalizeClass(vue.unref(ns).b("circle")),
  34171. style: vue.normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
  34172. }, [
  34173. (vue.openBlock(), vue.createElementBlock("svg", _hoisted_2$d, [
  34174. vue.createElementVNode("path", {
  34175. class: vue.normalizeClass(vue.unref(ns).be("circle", "track")),
  34176. d: vue.unref(trackPath),
  34177. stroke: `var(${vue.unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
  34178. "stroke-width": vue.unref(relativeStrokeWidth),
  34179. fill: "none",
  34180. style: vue.normalizeStyle(vue.unref(trailPathStyle))
  34181. }, null, 14, _hoisted_3$6),
  34182. vue.createElementVNode("path", {
  34183. class: vue.normalizeClass(vue.unref(ns).be("circle", "path")),
  34184. d: vue.unref(trackPath),
  34185. stroke: vue.unref(stroke),
  34186. fill: "none",
  34187. opacity: _ctx.percentage ? 1 : 0,
  34188. "stroke-linecap": _ctx.strokeLinecap,
  34189. "stroke-width": vue.unref(relativeStrokeWidth),
  34190. style: vue.normalizeStyle(vue.unref(circlePathStyle))
  34191. }, null, 14, _hoisted_4$4)
  34192. ]))
  34193. ], 6)),
  34194. (_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (vue.openBlock(), vue.createElementBlock("div", {
  34195. key: 2,
  34196. class: vue.normalizeClass(vue.unref(ns).e("text")),
  34197. style: vue.normalizeStyle({ fontSize: `${vue.unref(progressTextSize)}px` })
  34198. }, [
  34199. vue.renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
  34200. !_ctx.status ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5$3, vue.toDisplayString(vue.unref(content)), 1)) : (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 1 }, {
  34201. default: vue.withCtx(() => [
  34202. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(statusIcon))))
  34203. ]),
  34204. _: 1
  34205. }))
  34206. ])
  34207. ], 6)) : vue.createCommentVNode("v-if", true)
  34208. ], 10, _hoisted_1$j);
  34209. };
  34210. }
  34211. });
  34212. var Progress = /* @__PURE__ */ _export_sfc(_sfc_main$E, [["__file", "progress.vue"]]);
  34213. const ElProgress = withInstall(Progress);
  34214. const rateProps = buildProps({
  34215. modelValue: {
  34216. type: Number,
  34217. default: 0
  34218. },
  34219. id: {
  34220. type: String,
  34221. default: void 0
  34222. },
  34223. lowThreshold: {
  34224. type: Number,
  34225. default: 2
  34226. },
  34227. highThreshold: {
  34228. type: Number,
  34229. default: 4
  34230. },
  34231. max: {
  34232. type: Number,
  34233. default: 5
  34234. },
  34235. colors: {
  34236. type: definePropType([Array, Object]),
  34237. default: () => mutable(["", "", ""])
  34238. },
  34239. voidColor: {
  34240. type: String,
  34241. default: ""
  34242. },
  34243. disabledVoidColor: {
  34244. type: String,
  34245. default: ""
  34246. },
  34247. icons: {
  34248. type: definePropType([Array, Object]),
  34249. default: () => [star_filled_default, star_filled_default, star_filled_default]
  34250. },
  34251. voidIcon: {
  34252. type: iconPropType,
  34253. default: () => star_default
  34254. },
  34255. disabledVoidIcon: {
  34256. type: iconPropType,
  34257. default: () => star_filled_default
  34258. },
  34259. disabled: {
  34260. type: Boolean
  34261. },
  34262. allowHalf: {
  34263. type: Boolean
  34264. },
  34265. showText: {
  34266. type: Boolean
  34267. },
  34268. showScore: {
  34269. type: Boolean
  34270. },
  34271. textColor: {
  34272. type: String,
  34273. default: ""
  34274. },
  34275. texts: {
  34276. type: definePropType(Array),
  34277. default: () => mutable([
  34278. "Extremely bad",
  34279. "Disappointed",
  34280. "Fair",
  34281. "Satisfied",
  34282. "Surprise"
  34283. ])
  34284. },
  34285. scoreTemplate: {
  34286. type: String,
  34287. default: "{value}"
  34288. },
  34289. size: {
  34290. type: String,
  34291. validator: isValidComponentSize
  34292. },
  34293. label: {
  34294. type: String,
  34295. default: void 0
  34296. },
  34297. clearable: {
  34298. type: Boolean,
  34299. default: false
  34300. }
  34301. });
  34302. const rateEmits = {
  34303. [CHANGE_EVENT]: (value) => isNumber(value),
  34304. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  34305. };
  34306. const _hoisted_1$i = ["id", "aria-label", "aria-labelledby", "aria-valuenow", "aria-valuetext", "aria-valuemax"];
  34307. const _hoisted_2$c = ["onMousemove", "onClick"];
  34308. const __default__$t = vue.defineComponent({
  34309. name: "ElRate"
  34310. });
  34311. const _sfc_main$D = /* @__PURE__ */ vue.defineComponent({
  34312. ...__default__$t,
  34313. props: rateProps,
  34314. emits: rateEmits,
  34315. setup(__props, { expose, emit }) {
  34316. const props = __props;
  34317. function getValueFromMap(value, map) {
  34318. const isExcludedObject = (val) => isObject$1(val);
  34319. const matchedKeys = Object.keys(map).map((key) => +key).filter((key) => {
  34320. const val = map[key];
  34321. const excluded = isExcludedObject(val) ? val.excluded : false;
  34322. return excluded ? value < key : value <= key;
  34323. }).sort((a, b) => a - b);
  34324. const matchedValue = map[matchedKeys[0]];
  34325. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  34326. }
  34327. const formContext = vue.inject(formContextKey, void 0);
  34328. const formItemContext = vue.inject(formItemContextKey, void 0);
  34329. const rateSize = useSize();
  34330. const ns = useNamespace("rate");
  34331. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  34332. formItemContext
  34333. });
  34334. const currentValue = vue.ref(props.modelValue);
  34335. const hoverIndex = vue.ref(-1);
  34336. const pointerAtLeftHalf = vue.ref(true);
  34337. const rateClasses = vue.computed(() => [ns.b(), ns.m(rateSize.value)]);
  34338. const rateDisabled = vue.computed(() => props.disabled || (formContext == null ? void 0 : formContext.disabled));
  34339. const rateStyles = vue.computed(() => {
  34340. return ns.cssVarBlock({
  34341. "void-color": props.voidColor,
  34342. "disabled-void-color": props.disabledVoidColor,
  34343. "fill-color": activeColor.value
  34344. });
  34345. });
  34346. const text = vue.computed(() => {
  34347. let result = "";
  34348. if (props.showScore) {
  34349. result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  34350. } else if (props.showText) {
  34351. result = props.texts[Math.ceil(currentValue.value) - 1];
  34352. }
  34353. return result;
  34354. });
  34355. const valueDecimal = vue.computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  34356. const colorMap = vue.computed(() => isArray(props.colors) ? {
  34357. [props.lowThreshold]: props.colors[0],
  34358. [props.highThreshold]: { value: props.colors[1], excluded: true },
  34359. [props.max]: props.colors[2]
  34360. } : props.colors);
  34361. const activeColor = vue.computed(() => {
  34362. const color = getValueFromMap(currentValue.value, colorMap.value);
  34363. return isObject$1(color) ? "" : color;
  34364. });
  34365. const decimalStyle = vue.computed(() => {
  34366. let width = "";
  34367. if (rateDisabled.value) {
  34368. width = `${valueDecimal.value}%`;
  34369. } else if (props.allowHalf) {
  34370. width = "50%";
  34371. }
  34372. return {
  34373. color: activeColor.value,
  34374. width
  34375. };
  34376. });
  34377. const componentMap = vue.computed(() => {
  34378. let icons = isArray(props.icons) ? [...props.icons] : { ...props.icons };
  34379. icons = vue.markRaw(icons);
  34380. return isArray(icons) ? {
  34381. [props.lowThreshold]: icons[0],
  34382. [props.highThreshold]: {
  34383. value: icons[1],
  34384. excluded: true
  34385. },
  34386. [props.max]: icons[2]
  34387. } : icons;
  34388. });
  34389. const decimalIconComponent = vue.computed(() => getValueFromMap(props.modelValue, componentMap.value));
  34390. const voidComponent = vue.computed(() => rateDisabled.value ? isString(props.disabledVoidIcon) ? props.disabledVoidIcon : vue.markRaw(props.disabledVoidIcon) : isString(props.voidIcon) ? props.voidIcon : vue.markRaw(props.voidIcon));
  34391. const activeComponent = vue.computed(() => getValueFromMap(currentValue.value, componentMap.value));
  34392. function showDecimalIcon(item) {
  34393. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  34394. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - 0.5 <= currentValue.value && item > currentValue.value;
  34395. return showWhenDisabled || showWhenAllowHalf;
  34396. }
  34397. function emitValue(value) {
  34398. if (props.clearable && value === props.modelValue) {
  34399. value = 0;
  34400. }
  34401. emit(UPDATE_MODEL_EVENT, value);
  34402. if (props.modelValue !== value) {
  34403. emit("change", value);
  34404. }
  34405. }
  34406. function selectValue(value) {
  34407. if (rateDisabled.value) {
  34408. return;
  34409. }
  34410. if (props.allowHalf && pointerAtLeftHalf.value) {
  34411. emitValue(currentValue.value);
  34412. } else {
  34413. emitValue(value);
  34414. }
  34415. }
  34416. function handleKey(e) {
  34417. if (rateDisabled.value) {
  34418. return;
  34419. }
  34420. let _currentValue = currentValue.value;
  34421. const code = e.code;
  34422. if (code === EVENT_CODE.up || code === EVENT_CODE.right) {
  34423. if (props.allowHalf) {
  34424. _currentValue += 0.5;
  34425. } else {
  34426. _currentValue += 1;
  34427. }
  34428. e.stopPropagation();
  34429. e.preventDefault();
  34430. } else if (code === EVENT_CODE.left || code === EVENT_CODE.down) {
  34431. if (props.allowHalf) {
  34432. _currentValue -= 0.5;
  34433. } else {
  34434. _currentValue -= 1;
  34435. }
  34436. e.stopPropagation();
  34437. e.preventDefault();
  34438. }
  34439. _currentValue = _currentValue < 0 ? 0 : _currentValue;
  34440. _currentValue = _currentValue > props.max ? props.max : _currentValue;
  34441. emit(UPDATE_MODEL_EVENT, _currentValue);
  34442. emit("change", _currentValue);
  34443. return _currentValue;
  34444. }
  34445. function setCurrentValue(value, event) {
  34446. if (rateDisabled.value) {
  34447. return;
  34448. }
  34449. if (props.allowHalf) {
  34450. let target = event.target;
  34451. if (hasClass(target, ns.e("item"))) {
  34452. target = target.querySelector(`.${ns.e("icon")}`);
  34453. }
  34454. if (target.clientWidth === 0 || hasClass(target, ns.e("decimal"))) {
  34455. target = target.parentNode;
  34456. }
  34457. pointerAtLeftHalf.value = event.offsetX * 2 <= target.clientWidth;
  34458. currentValue.value = pointerAtLeftHalf.value ? value - 0.5 : value;
  34459. } else {
  34460. currentValue.value = value;
  34461. }
  34462. hoverIndex.value = value;
  34463. }
  34464. function resetCurrentValue() {
  34465. if (rateDisabled.value) {
  34466. return;
  34467. }
  34468. if (props.allowHalf) {
  34469. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  34470. }
  34471. currentValue.value = props.modelValue;
  34472. hoverIndex.value = -1;
  34473. }
  34474. vue.watch(() => props.modelValue, (val) => {
  34475. currentValue.value = val;
  34476. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  34477. });
  34478. if (!props.modelValue) {
  34479. emit(UPDATE_MODEL_EVENT, 0);
  34480. }
  34481. expose({
  34482. setCurrentValue,
  34483. resetCurrentValue
  34484. });
  34485. return (_ctx, _cache) => {
  34486. var _a;
  34487. return vue.openBlock(), vue.createElementBlock("div", {
  34488. id: vue.unref(inputId),
  34489. class: vue.normalizeClass([vue.unref(rateClasses), vue.unref(ns).is("disabled", vue.unref(rateDisabled))]),
  34490. role: "slider",
  34491. "aria-label": !vue.unref(isLabeledByFormItem) ? _ctx.label || "rating" : void 0,
  34492. "aria-labelledby": vue.unref(isLabeledByFormItem) ? (_a = vue.unref(formItemContext)) == null ? void 0 : _a.labelId : void 0,
  34493. "aria-valuenow": currentValue.value,
  34494. "aria-valuetext": vue.unref(text) || void 0,
  34495. "aria-valuemin": "0",
  34496. "aria-valuemax": _ctx.max,
  34497. tabindex: "0",
  34498. style: vue.normalizeStyle(vue.unref(rateStyles)),
  34499. onKeydown: handleKey
  34500. }, [
  34501. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.max, (item, key) => {
  34502. return vue.openBlock(), vue.createElementBlock("span", {
  34503. key,
  34504. class: vue.normalizeClass(vue.unref(ns).e("item")),
  34505. onMousemove: ($event) => setCurrentValue(item, $event),
  34506. onMouseleave: resetCurrentValue,
  34507. onClick: ($event) => selectValue(item)
  34508. }, [
  34509. vue.createVNode(vue.unref(ElIcon), {
  34510. class: vue.normalizeClass([
  34511. vue.unref(ns).e("icon"),
  34512. { hover: hoverIndex.value === item },
  34513. vue.unref(ns).is("active", item <= currentValue.value)
  34514. ])
  34515. }, {
  34516. default: vue.withCtx(() => [
  34517. !showDecimalIcon(item) ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  34518. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(activeComponent)), null, null, 512)), [
  34519. [vue.vShow, item <= currentValue.value]
  34520. ]),
  34521. vue.withDirectives((vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(voidComponent)), null, null, 512)), [
  34522. [vue.vShow, !(item <= currentValue.value)]
  34523. ])
  34524. ], 64)) : vue.createCommentVNode("v-if", true),
  34525. showDecimalIcon(item) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  34526. key: 1,
  34527. style: vue.normalizeStyle(vue.unref(decimalStyle)),
  34528. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).e("decimal")])
  34529. }, {
  34530. default: vue.withCtx(() => [
  34531. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(decimalIconComponent))))
  34532. ]),
  34533. _: 1
  34534. }, 8, ["style", "class"])) : vue.createCommentVNode("v-if", true)
  34535. ]),
  34536. _: 2
  34537. }, 1032, ["class"])
  34538. ], 42, _hoisted_2$c);
  34539. }), 128)),
  34540. _ctx.showText || _ctx.showScore ? (vue.openBlock(), vue.createElementBlock("span", {
  34541. key: 0,
  34542. class: vue.normalizeClass(vue.unref(ns).e("text"))
  34543. }, vue.toDisplayString(vue.unref(text)), 3)) : vue.createCommentVNode("v-if", true)
  34544. ], 46, _hoisted_1$i);
  34545. };
  34546. }
  34547. });
  34548. var Rate = /* @__PURE__ */ _export_sfc(_sfc_main$D, [["__file", "rate.vue"]]);
  34549. const ElRate = withInstall(Rate);
  34550. const IconMap = {
  34551. success: "icon-success",
  34552. warning: "icon-warning",
  34553. error: "icon-error",
  34554. info: "icon-info"
  34555. };
  34556. const IconComponentMap = {
  34557. [IconMap.success]: circle_check_filled_default,
  34558. [IconMap.warning]: warning_filled_default,
  34559. [IconMap.error]: circle_close_filled_default,
  34560. [IconMap.info]: info_filled_default
  34561. };
  34562. const resultProps = buildProps({
  34563. title: {
  34564. type: String,
  34565. default: ""
  34566. },
  34567. subTitle: {
  34568. type: String,
  34569. default: ""
  34570. },
  34571. icon: {
  34572. type: String,
  34573. values: ["success", "warning", "info", "error"],
  34574. default: "info"
  34575. }
  34576. });
  34577. const __default__$s = vue.defineComponent({
  34578. name: "ElResult"
  34579. });
  34580. const _sfc_main$C = /* @__PURE__ */ vue.defineComponent({
  34581. ...__default__$s,
  34582. props: resultProps,
  34583. setup(__props) {
  34584. const props = __props;
  34585. const ns = useNamespace("result");
  34586. const resultIcon = vue.computed(() => {
  34587. const icon = props.icon;
  34588. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  34589. const iconComponent = IconComponentMap[iconClass] || IconComponentMap["icon-info"];
  34590. return {
  34591. class: iconClass,
  34592. component: iconComponent
  34593. };
  34594. });
  34595. return (_ctx, _cache) => {
  34596. return vue.openBlock(), vue.createElementBlock("div", {
  34597. class: vue.normalizeClass(vue.unref(ns).b())
  34598. }, [
  34599. vue.createElementVNode("div", {
  34600. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  34601. }, [
  34602. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  34603. vue.unref(resultIcon).component ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(resultIcon).component), {
  34604. key: 0,
  34605. class: vue.normalizeClass(vue.unref(resultIcon).class)
  34606. }, null, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  34607. ])
  34608. ], 2),
  34609. _ctx.title || _ctx.$slots.title ? (vue.openBlock(), vue.createElementBlock("div", {
  34610. key: 0,
  34611. class: vue.normalizeClass(vue.unref(ns).e("title"))
  34612. }, [
  34613. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  34614. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.title), 1)
  34615. ])
  34616. ], 2)) : vue.createCommentVNode("v-if", true),
  34617. _ctx.subTitle || _ctx.$slots["sub-title"] ? (vue.openBlock(), vue.createElementBlock("div", {
  34618. key: 1,
  34619. class: vue.normalizeClass(vue.unref(ns).e("subtitle"))
  34620. }, [
  34621. vue.renderSlot(_ctx.$slots, "sub-title", {}, () => [
  34622. vue.createElementVNode("p", null, vue.toDisplayString(_ctx.subTitle), 1)
  34623. ])
  34624. ], 2)) : vue.createCommentVNode("v-if", true),
  34625. _ctx.$slots.extra ? (vue.openBlock(), vue.createElementBlock("div", {
  34626. key: 2,
  34627. class: vue.normalizeClass(vue.unref(ns).e("extra"))
  34628. }, [
  34629. vue.renderSlot(_ctx.$slots, "extra")
  34630. ], 2)) : vue.createCommentVNode("v-if", true)
  34631. ], 2);
  34632. };
  34633. }
  34634. });
  34635. var Result = /* @__PURE__ */ _export_sfc(_sfc_main$C, [["__file", "result.vue"]]);
  34636. const ElResult = withInstall(Result);
  34637. const RowJustify = [
  34638. "start",
  34639. "center",
  34640. "end",
  34641. "space-around",
  34642. "space-between",
  34643. "space-evenly"
  34644. ];
  34645. const RowAlign = ["top", "middle", "bottom"];
  34646. const rowProps = buildProps({
  34647. tag: {
  34648. type: String,
  34649. default: "div"
  34650. },
  34651. gutter: {
  34652. type: Number,
  34653. default: 0
  34654. },
  34655. justify: {
  34656. type: String,
  34657. values: RowJustify,
  34658. default: "start"
  34659. },
  34660. align: {
  34661. type: String,
  34662. values: RowAlign,
  34663. default: "top"
  34664. }
  34665. });
  34666. const __default__$r = vue.defineComponent({
  34667. name: "ElRow"
  34668. });
  34669. const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
  34670. ...__default__$r,
  34671. props: rowProps,
  34672. setup(__props) {
  34673. const props = __props;
  34674. const ns = useNamespace("row");
  34675. const gutter = vue.computed(() => props.gutter);
  34676. vue.provide(rowContextKey, {
  34677. gutter
  34678. });
  34679. const style = vue.computed(() => {
  34680. const styles = {};
  34681. if (!props.gutter) {
  34682. return styles;
  34683. }
  34684. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  34685. return styles;
  34686. });
  34687. return (_ctx, _cache) => {
  34688. return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tag), {
  34689. class: vue.normalizeClass([
  34690. vue.unref(ns).b(),
  34691. vue.unref(ns).is(`justify-${props.justify}`, _ctx.justify !== "start"),
  34692. vue.unref(ns).is(`align-${props.align}`, _ctx.align !== "top")
  34693. ]),
  34694. style: vue.normalizeStyle(vue.unref(style))
  34695. }, {
  34696. default: vue.withCtx(() => [
  34697. vue.renderSlot(_ctx.$slots, "default")
  34698. ]),
  34699. _: 3
  34700. }, 8, ["class", "style"]);
  34701. };
  34702. }
  34703. });
  34704. var Row$1 = /* @__PURE__ */ _export_sfc(_sfc_main$B, [["__file", "row.vue"]]);
  34705. const ElRow = withInstall(Row$1);
  34706. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  34707. return typeof value === "number" && value !== value;
  34708. };
  34709. function isEqual(first, second) {
  34710. if (first === second) {
  34711. return true;
  34712. }
  34713. if (safeIsNaN(first) && safeIsNaN(second)) {
  34714. return true;
  34715. }
  34716. return false;
  34717. }
  34718. function areInputsEqual(newInputs, lastInputs) {
  34719. if (newInputs.length !== lastInputs.length) {
  34720. return false;
  34721. }
  34722. for (var i = 0; i < newInputs.length; i++) {
  34723. if (!isEqual(newInputs[i], lastInputs[i])) {
  34724. return false;
  34725. }
  34726. }
  34727. return true;
  34728. }
  34729. function memoizeOne(resultFn, isEqual2) {
  34730. if (isEqual2 === void 0) {
  34731. isEqual2 = areInputsEqual;
  34732. }
  34733. var cache = null;
  34734. function memoized() {
  34735. var newArgs = [];
  34736. for (var _i = 0; _i < arguments.length; _i++) {
  34737. newArgs[_i] = arguments[_i];
  34738. }
  34739. if (cache && cache.lastThis === this && isEqual2(newArgs, cache.lastArgs)) {
  34740. return cache.lastResult;
  34741. }
  34742. var lastResult = resultFn.apply(this, newArgs);
  34743. cache = {
  34744. lastResult,
  34745. lastArgs: newArgs,
  34746. lastThis: this
  34747. };
  34748. return lastResult;
  34749. }
  34750. memoized.clear = function clear() {
  34751. cache = null;
  34752. };
  34753. return memoized;
  34754. }
  34755. const useCache = () => {
  34756. const vm = vue.getCurrentInstance();
  34757. const props = vm.proxy.$props;
  34758. return vue.computed(() => {
  34759. const _getItemStyleCache = (_, __, ___) => ({});
  34760. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  34761. });
  34762. };
  34763. const DEFAULT_DYNAMIC_LIST_ITEM_SIZE = 50;
  34764. const ITEM_RENDER_EVT = "itemRendered";
  34765. const SCROLL_EVT = "scroll";
  34766. const FORWARD = "forward";
  34767. const BACKWARD = "backward";
  34768. const AUTO_ALIGNMENT = "auto";
  34769. const SMART_ALIGNMENT = "smart";
  34770. const START_ALIGNMENT = "start";
  34771. const CENTERED_ALIGNMENT = "center";
  34772. const END_ALIGNMENT = "end";
  34773. const HORIZONTAL = "horizontal";
  34774. const VERTICAL = "vertical";
  34775. const LTR = "ltr";
  34776. const RTL = "rtl";
  34777. const RTL_OFFSET_NAG = "negative";
  34778. const RTL_OFFSET_POS_ASC = "positive-ascending";
  34779. const RTL_OFFSET_POS_DESC = "positive-descending";
  34780. const ScrollbarDirKey = {
  34781. [HORIZONTAL]: "left",
  34782. [VERTICAL]: "top"
  34783. };
  34784. const SCROLLBAR_MIN_SIZE = 20;
  34785. const LayoutKeys = {
  34786. [HORIZONTAL]: "deltaX",
  34787. [VERTICAL]: "deltaY"
  34788. };
  34789. const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
  34790. let frameHandle;
  34791. let offset = 0;
  34792. const hasReachedEdge = (offset2) => {
  34793. const edgeReached = offset2 < 0 && atStartEdge.value || offset2 > 0 && atEndEdge.value;
  34794. return edgeReached;
  34795. };
  34796. const onWheel = (e) => {
  34797. cAF(frameHandle);
  34798. const newOffset = e[LayoutKeys[layout.value]];
  34799. if (hasReachedEdge(offset) && hasReachedEdge(offset + newOffset))
  34800. return;
  34801. offset += newOffset;
  34802. if (!isFirefox()) {
  34803. e.preventDefault();
  34804. }
  34805. frameHandle = rAF(() => {
  34806. onWheelDelta(offset);
  34807. offset = 0;
  34808. });
  34809. };
  34810. return {
  34811. hasReachedEdge,
  34812. onWheel
  34813. };
  34814. };
  34815. var useWheel$1 = useWheel;
  34816. const itemSize$1 = buildProp({
  34817. type: definePropType([Number, Function]),
  34818. required: true
  34819. });
  34820. const estimatedItemSize = buildProp({
  34821. type: Number
  34822. });
  34823. const cache = buildProp({
  34824. type: Number,
  34825. default: 2
  34826. });
  34827. const direction = buildProp({
  34828. type: String,
  34829. values: ["ltr", "rtl"],
  34830. default: "ltr"
  34831. });
  34832. const initScrollOffset = buildProp({
  34833. type: Number,
  34834. default: 0
  34835. });
  34836. const total = buildProp({
  34837. type: Number,
  34838. required: true
  34839. });
  34840. const layout = buildProp({
  34841. type: String,
  34842. values: ["horizontal", "vertical"],
  34843. default: VERTICAL
  34844. });
  34845. const virtualizedProps = buildProps({
  34846. className: {
  34847. type: String,
  34848. default: ""
  34849. },
  34850. containerElement: {
  34851. type: definePropType([String, Object]),
  34852. default: "div"
  34853. },
  34854. data: {
  34855. type: definePropType(Array),
  34856. default: () => mutable([])
  34857. },
  34858. direction,
  34859. height: {
  34860. type: [String, Number],
  34861. required: true
  34862. },
  34863. innerElement: {
  34864. type: [String, Object],
  34865. default: "div"
  34866. },
  34867. style: {
  34868. type: definePropType([Object, String, Array])
  34869. },
  34870. useIsScrolling: {
  34871. type: Boolean,
  34872. default: false
  34873. },
  34874. width: {
  34875. type: [Number, String],
  34876. required: false
  34877. },
  34878. perfMode: {
  34879. type: Boolean,
  34880. default: true
  34881. },
  34882. scrollbarAlwaysOn: {
  34883. type: Boolean,
  34884. default: false
  34885. }
  34886. });
  34887. const virtualizedListProps = buildProps({
  34888. cache,
  34889. estimatedItemSize,
  34890. layout,
  34891. initScrollOffset,
  34892. total,
  34893. itemSize: itemSize$1,
  34894. ...virtualizedProps
  34895. });
  34896. const scrollbarSize = {
  34897. type: Number,
  34898. default: 6
  34899. };
  34900. const startGap = { type: Number, default: 0 };
  34901. const endGap = { type: Number, default: 2 };
  34902. const virtualizedGridProps = buildProps({
  34903. columnCache: cache,
  34904. columnWidth: itemSize$1,
  34905. estimatedColumnWidth: estimatedItemSize,
  34906. estimatedRowHeight: estimatedItemSize,
  34907. initScrollLeft: initScrollOffset,
  34908. initScrollTop: initScrollOffset,
  34909. itemKey: {
  34910. type: definePropType(Function),
  34911. default: ({
  34912. columnIndex,
  34913. rowIndex
  34914. }) => `${rowIndex}:${columnIndex}`
  34915. },
  34916. rowCache: cache,
  34917. rowHeight: itemSize$1,
  34918. totalColumn: total,
  34919. totalRow: total,
  34920. hScrollbarSize: scrollbarSize,
  34921. vScrollbarSize: scrollbarSize,
  34922. scrollbarStartGap: startGap,
  34923. scrollbarEndGap: endGap,
  34924. ...virtualizedProps
  34925. });
  34926. const virtualizedScrollbarProps = buildProps({
  34927. alwaysOn: Boolean,
  34928. class: String,
  34929. layout,
  34930. total,
  34931. ratio: {
  34932. type: Number,
  34933. required: true
  34934. },
  34935. clientSize: {
  34936. type: Number,
  34937. required: true
  34938. },
  34939. scrollFrom: {
  34940. type: Number,
  34941. required: true
  34942. },
  34943. scrollbarSize,
  34944. startGap,
  34945. endGap,
  34946. visible: Boolean
  34947. });
  34948. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  34949. const isHorizontal = (dir) => dir === LTR || dir === RTL || dir === HORIZONTAL;
  34950. const isRTL = (dir) => dir === RTL;
  34951. let cachedRTLResult = null;
  34952. function getRTLOffsetType(recalculate = false) {
  34953. if (cachedRTLResult === null || recalculate) {
  34954. const outerDiv = document.createElement("div");
  34955. const outerStyle = outerDiv.style;
  34956. outerStyle.width = "50px";
  34957. outerStyle.height = "50px";
  34958. outerStyle.overflow = "scroll";
  34959. outerStyle.direction = "rtl";
  34960. const innerDiv = document.createElement("div");
  34961. const innerStyle = innerDiv.style;
  34962. innerStyle.width = "100px";
  34963. innerStyle.height = "100px";
  34964. outerDiv.appendChild(innerDiv);
  34965. document.body.appendChild(outerDiv);
  34966. if (outerDiv.scrollLeft > 0) {
  34967. cachedRTLResult = RTL_OFFSET_POS_DESC;
  34968. } else {
  34969. outerDiv.scrollLeft = 1;
  34970. if (outerDiv.scrollLeft === 0) {
  34971. cachedRTLResult = RTL_OFFSET_NAG;
  34972. } else {
  34973. cachedRTLResult = RTL_OFFSET_POS_ASC;
  34974. }
  34975. }
  34976. document.body.removeChild(outerDiv);
  34977. return cachedRTLResult;
  34978. }
  34979. return cachedRTLResult;
  34980. }
  34981. function renderThumbStyle({ move, size, bar }, layout) {
  34982. const style = {};
  34983. const translate = `translate${bar.axis}(${move}px)`;
  34984. style[bar.size] = size;
  34985. style.transform = translate;
  34986. style.msTransform = translate;
  34987. style.webkitTransform = translate;
  34988. if (layout === "horizontal") {
  34989. style.height = "100%";
  34990. } else {
  34991. style.width = "100%";
  34992. }
  34993. return style;
  34994. }
  34995. const ScrollBar = vue.defineComponent({
  34996. name: "ElVirtualScrollBar",
  34997. props: virtualizedScrollbarProps,
  34998. emits: ["scroll", "start-move", "stop-move"],
  34999. setup(props, { emit }) {
  35000. const GAP = vue.computed(() => props.startGap + props.endGap);
  35001. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  35002. const nsScrollbar = useNamespace("scrollbar");
  35003. const trackRef = vue.ref();
  35004. const thumbRef = vue.ref();
  35005. let frameHandle = null;
  35006. let onselectstartStore = null;
  35007. const state = vue.reactive({
  35008. isDragging: false,
  35009. traveled: 0
  35010. });
  35011. const bar = vue.computed(() => BAR_MAP[props.layout]);
  35012. const trackSize = vue.computed(() => props.clientSize - vue.unref(GAP));
  35013. const trackStyle = vue.computed(() => ({
  35014. position: "absolute",
  35015. width: `${HORIZONTAL === props.layout ? trackSize.value : props.scrollbarSize}px`,
  35016. height: `${HORIZONTAL === props.layout ? props.scrollbarSize : trackSize.value}px`,
  35017. [ScrollbarDirKey[props.layout]]: "2px",
  35018. right: "2px",
  35019. bottom: "2px",
  35020. borderRadius: "4px"
  35021. }));
  35022. const thumbSize = vue.computed(() => {
  35023. const ratio = props.ratio;
  35024. const clientSize = props.clientSize;
  35025. if (ratio >= 100) {
  35026. return Number.POSITIVE_INFINITY;
  35027. }
  35028. if (ratio >= 50) {
  35029. return ratio * clientSize / 100;
  35030. }
  35031. const SCROLLBAR_MAX_SIZE = clientSize / 3;
  35032. return Math.floor(Math.min(Math.max(ratio * clientSize, SCROLLBAR_MIN_SIZE), SCROLLBAR_MAX_SIZE));
  35033. });
  35034. const thumbStyle = vue.computed(() => {
  35035. if (!Number.isFinite(thumbSize.value)) {
  35036. return {
  35037. display: "none"
  35038. };
  35039. }
  35040. const thumb = `${thumbSize.value}px`;
  35041. const style = renderThumbStyle({
  35042. bar: bar.value,
  35043. size: thumb,
  35044. move: state.traveled
  35045. }, props.layout);
  35046. return style;
  35047. });
  35048. const totalSteps = vue.computed(() => Math.floor(props.clientSize - thumbSize.value - vue.unref(GAP)));
  35049. const attachEvents = () => {
  35050. window.addEventListener("mousemove", onMouseMove);
  35051. window.addEventListener("mouseup", onMouseUp);
  35052. const thumbEl = vue.unref(thumbRef);
  35053. if (!thumbEl)
  35054. return;
  35055. onselectstartStore = document.onselectstart;
  35056. document.onselectstart = () => false;
  35057. thumbEl.addEventListener("touchmove", onMouseMove);
  35058. thumbEl.addEventListener("touchend", onMouseUp);
  35059. };
  35060. const detachEvents = () => {
  35061. window.removeEventListener("mousemove", onMouseMove);
  35062. window.removeEventListener("mouseup", onMouseUp);
  35063. document.onselectstart = onselectstartStore;
  35064. onselectstartStore = null;
  35065. const thumbEl = vue.unref(thumbRef);
  35066. if (!thumbEl)
  35067. return;
  35068. thumbEl.removeEventListener("touchmove", onMouseMove);
  35069. thumbEl.removeEventListener("touchend", onMouseUp);
  35070. };
  35071. const onThumbMouseDown = (e) => {
  35072. e.stopImmediatePropagation();
  35073. if (e.ctrlKey || [1, 2].includes(e.button)) {
  35074. return;
  35075. }
  35076. state.isDragging = true;
  35077. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  35078. emit("start-move");
  35079. attachEvents();
  35080. };
  35081. const onMouseUp = () => {
  35082. state.isDragging = false;
  35083. state[bar.value.axis] = 0;
  35084. emit("stop-move");
  35085. detachEvents();
  35086. };
  35087. const onMouseMove = (e) => {
  35088. const { isDragging } = state;
  35089. if (!isDragging)
  35090. return;
  35091. if (!thumbRef.value || !trackRef.value)
  35092. return;
  35093. const prevPage = state[bar.value.axis];
  35094. if (!prevPage)
  35095. return;
  35096. cAF(frameHandle);
  35097. const offset = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  35098. const thumbClickPosition = thumbRef.value[bar.value.offset] - prevPage;
  35099. const distance = offset - thumbClickPosition;
  35100. frameHandle = rAF(() => {
  35101. state.traveled = Math.max(props.startGap, Math.min(distance, totalSteps.value));
  35102. emit("scroll", distance, totalSteps.value);
  35103. });
  35104. };
  35105. const clickTrackHandler = (e) => {
  35106. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  35107. const thumbHalf = thumbRef.value[bar.value.offset] / 2;
  35108. const distance = offset - thumbHalf;
  35109. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  35110. emit("scroll", distance, totalSteps.value);
  35111. };
  35112. vue.watch(() => props.scrollFrom, (v) => {
  35113. if (state.isDragging)
  35114. return;
  35115. state.traveled = Math.ceil(v * totalSteps.value);
  35116. });
  35117. vue.onBeforeUnmount(() => {
  35118. detachEvents();
  35119. });
  35120. return () => {
  35121. return vue.h("div", {
  35122. role: "presentation",
  35123. ref: trackRef,
  35124. class: [
  35125. nsVirtualScrollbar.b(),
  35126. props.class,
  35127. (props.alwaysOn || state.isDragging) && "always-on"
  35128. ],
  35129. style: trackStyle.value,
  35130. onMousedown: vue.withModifiers(clickTrackHandler, ["stop", "prevent"]),
  35131. onTouchstartPrevent: onThumbMouseDown
  35132. }, vue.h("div", {
  35133. ref: thumbRef,
  35134. class: nsScrollbar.e("thumb"),
  35135. style: thumbStyle.value,
  35136. onMousedown: onThumbMouseDown
  35137. }, []));
  35138. };
  35139. }
  35140. });
  35141. var Scrollbar = ScrollBar;
  35142. const createList = ({
  35143. name,
  35144. getOffset,
  35145. getItemSize,
  35146. getItemOffset,
  35147. getEstimatedTotalSize,
  35148. getStartIndexForOffset,
  35149. getStopIndexForStartIndex,
  35150. initCache,
  35151. clearCache,
  35152. validateProps
  35153. }) => {
  35154. return vue.defineComponent({
  35155. name: name != null ? name : "ElVirtualList",
  35156. props: virtualizedListProps,
  35157. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  35158. setup(props, { emit, expose }) {
  35159. validateProps(props);
  35160. const instance = vue.getCurrentInstance();
  35161. const ns = useNamespace("vl");
  35162. const dynamicSizeCache = vue.ref(initCache(props, instance));
  35163. const getItemStyleCache = useCache();
  35164. const windowRef = vue.ref();
  35165. const innerRef = vue.ref();
  35166. const scrollbarRef = vue.ref();
  35167. const states = vue.ref({
  35168. isScrolling: false,
  35169. scrollDir: "forward",
  35170. scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0,
  35171. updateRequested: false,
  35172. isScrollbarDragging: false,
  35173. scrollbarAlwaysOn: props.scrollbarAlwaysOn
  35174. });
  35175. const itemsToRender = vue.computed(() => {
  35176. const { total, cache } = props;
  35177. const { isScrolling, scrollDir, scrollOffset } = vue.unref(states);
  35178. if (total === 0) {
  35179. return [0, 0, 0, 0];
  35180. }
  35181. const startIndex = getStartIndexForOffset(props, scrollOffset, vue.unref(dynamicSizeCache));
  35182. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, vue.unref(dynamicSizeCache));
  35183. const cacheBackward = !isScrolling || scrollDir === BACKWARD ? Math.max(1, cache) : 1;
  35184. const cacheForward = !isScrolling || scrollDir === FORWARD ? Math.max(1, cache) : 1;
  35185. return [
  35186. Math.max(0, startIndex - cacheBackward),
  35187. Math.max(0, Math.min(total - 1, stopIndex + cacheForward)),
  35188. startIndex,
  35189. stopIndex
  35190. ];
  35191. });
  35192. const estimatedTotalSize = vue.computed(() => getEstimatedTotalSize(props, vue.unref(dynamicSizeCache)));
  35193. const _isHorizontal = vue.computed(() => isHorizontal(props.layout));
  35194. const windowStyle = vue.computed(() => [
  35195. {
  35196. position: "relative",
  35197. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  35198. WebkitOverflowScrolling: "touch",
  35199. willChange: "transform"
  35200. },
  35201. {
  35202. direction: props.direction,
  35203. height: isNumber(props.height) ? `${props.height}px` : props.height,
  35204. width: isNumber(props.width) ? `${props.width}px` : props.width
  35205. },
  35206. props.style
  35207. ]);
  35208. const innerStyle = vue.computed(() => {
  35209. const size = vue.unref(estimatedTotalSize);
  35210. const horizontal = vue.unref(_isHorizontal);
  35211. return {
  35212. height: horizontal ? "100%" : `${size}px`,
  35213. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  35214. width: horizontal ? `${size}px` : "100%"
  35215. };
  35216. });
  35217. const clientSize = vue.computed(() => _isHorizontal.value ? props.width : props.height);
  35218. const { onWheel } = useWheel$1({
  35219. atStartEdge: vue.computed(() => states.value.scrollOffset <= 0),
  35220. atEndEdge: vue.computed(() => states.value.scrollOffset >= estimatedTotalSize.value),
  35221. layout: vue.computed(() => props.layout)
  35222. }, (offset) => {
  35223. var _a, _b;
  35224. (_b = (_a = scrollbarRef.value).onMouseUp) == null ? void 0 : _b.call(_a);
  35225. scrollTo(Math.min(states.value.scrollOffset + offset, estimatedTotalSize.value - clientSize.value));
  35226. });
  35227. const emitEvents = () => {
  35228. const { total } = props;
  35229. if (total > 0) {
  35230. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = vue.unref(itemsToRender);
  35231. emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  35232. }
  35233. const { scrollDir, scrollOffset, updateRequested } = vue.unref(states);
  35234. emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  35235. };
  35236. const scrollVertically = (e) => {
  35237. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  35238. const _states = vue.unref(states);
  35239. if (_states.scrollOffset === scrollTop) {
  35240. return;
  35241. }
  35242. const scrollOffset = Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight));
  35243. states.value = {
  35244. ..._states,
  35245. isScrolling: true,
  35246. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  35247. scrollOffset,
  35248. updateRequested: false
  35249. };
  35250. vue.nextTick(resetIsScrolling);
  35251. };
  35252. const scrollHorizontally = (e) => {
  35253. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  35254. const _states = vue.unref(states);
  35255. if (_states.scrollOffset === scrollLeft) {
  35256. return;
  35257. }
  35258. const { direction } = props;
  35259. let scrollOffset = scrollLeft;
  35260. if (direction === RTL) {
  35261. switch (getRTLOffsetType()) {
  35262. case RTL_OFFSET_NAG: {
  35263. scrollOffset = -scrollLeft;
  35264. break;
  35265. }
  35266. case RTL_OFFSET_POS_DESC: {
  35267. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  35268. break;
  35269. }
  35270. }
  35271. }
  35272. scrollOffset = Math.max(0, Math.min(scrollOffset, scrollWidth - clientWidth));
  35273. states.value = {
  35274. ..._states,
  35275. isScrolling: true,
  35276. scrollDir: getScrollDir(_states.scrollOffset, scrollOffset),
  35277. scrollOffset,
  35278. updateRequested: false
  35279. };
  35280. vue.nextTick(resetIsScrolling);
  35281. };
  35282. const onScroll = (e) => {
  35283. vue.unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  35284. emitEvents();
  35285. };
  35286. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  35287. const offset = (estimatedTotalSize.value - clientSize.value) / totalSteps * distanceToGo;
  35288. scrollTo(Math.min(estimatedTotalSize.value - clientSize.value, offset));
  35289. };
  35290. const scrollTo = (offset) => {
  35291. offset = Math.max(offset, 0);
  35292. if (offset === vue.unref(states).scrollOffset) {
  35293. return;
  35294. }
  35295. states.value = {
  35296. ...vue.unref(states),
  35297. scrollOffset: offset,
  35298. scrollDir: getScrollDir(vue.unref(states).scrollOffset, offset),
  35299. updateRequested: true
  35300. };
  35301. vue.nextTick(resetIsScrolling);
  35302. };
  35303. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  35304. const { scrollOffset } = vue.unref(states);
  35305. idx = Math.max(0, Math.min(idx, props.total - 1));
  35306. scrollTo(getOffset(props, idx, alignment, scrollOffset, vue.unref(dynamicSizeCache)));
  35307. };
  35308. const getItemStyle = (idx) => {
  35309. const { direction, itemSize, layout } = props;
  35310. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize, clearCache && layout, clearCache && direction);
  35311. let style;
  35312. if (hasOwn(itemStyleCache, String(idx))) {
  35313. style = itemStyleCache[idx];
  35314. } else {
  35315. const offset = getItemOffset(props, idx, vue.unref(dynamicSizeCache));
  35316. const size = getItemSize(props, idx, vue.unref(dynamicSizeCache));
  35317. const horizontal = vue.unref(_isHorizontal);
  35318. const isRtl = direction === RTL;
  35319. const offsetHorizontal = horizontal ? offset : 0;
  35320. itemStyleCache[idx] = style = {
  35321. position: "absolute",
  35322. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  35323. right: isRtl ? `${offsetHorizontal}px` : void 0,
  35324. top: !horizontal ? `${offset}px` : 0,
  35325. height: !horizontal ? `${size}px` : "100%",
  35326. width: horizontal ? `${size}px` : "100%"
  35327. };
  35328. }
  35329. return style;
  35330. };
  35331. const resetIsScrolling = () => {
  35332. states.value.isScrolling = false;
  35333. vue.nextTick(() => {
  35334. getItemStyleCache.value(-1, null, null);
  35335. });
  35336. };
  35337. const resetScrollTop = () => {
  35338. const window = windowRef.value;
  35339. if (window) {
  35340. window.scrollTop = 0;
  35341. }
  35342. };
  35343. vue.onMounted(() => {
  35344. if (!isClient)
  35345. return;
  35346. const { initScrollOffset } = props;
  35347. const windowElement = vue.unref(windowRef);
  35348. if (isNumber(initScrollOffset) && windowElement) {
  35349. if (vue.unref(_isHorizontal)) {
  35350. windowElement.scrollLeft = initScrollOffset;
  35351. } else {
  35352. windowElement.scrollTop = initScrollOffset;
  35353. }
  35354. }
  35355. emitEvents();
  35356. });
  35357. vue.onUpdated(() => {
  35358. const { direction, layout } = props;
  35359. const { scrollOffset, updateRequested } = vue.unref(states);
  35360. const windowElement = vue.unref(windowRef);
  35361. if (updateRequested && windowElement) {
  35362. if (layout === HORIZONTAL) {
  35363. if (direction === RTL) {
  35364. switch (getRTLOffsetType()) {
  35365. case RTL_OFFSET_NAG: {
  35366. windowElement.scrollLeft = -scrollOffset;
  35367. break;
  35368. }
  35369. case RTL_OFFSET_POS_ASC: {
  35370. windowElement.scrollLeft = scrollOffset;
  35371. break;
  35372. }
  35373. default: {
  35374. const { clientWidth, scrollWidth } = windowElement;
  35375. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  35376. break;
  35377. }
  35378. }
  35379. } else {
  35380. windowElement.scrollLeft = scrollOffset;
  35381. }
  35382. } else {
  35383. windowElement.scrollTop = scrollOffset;
  35384. }
  35385. }
  35386. });
  35387. const api = {
  35388. ns,
  35389. clientSize,
  35390. estimatedTotalSize,
  35391. windowStyle,
  35392. windowRef,
  35393. innerRef,
  35394. innerStyle,
  35395. itemsToRender,
  35396. scrollbarRef,
  35397. states,
  35398. getItemStyle,
  35399. onScroll,
  35400. onScrollbarScroll,
  35401. onWheel,
  35402. scrollTo,
  35403. scrollToItem,
  35404. resetScrollTop
  35405. };
  35406. expose({
  35407. windowRef,
  35408. innerRef,
  35409. getItemStyleCache,
  35410. scrollTo,
  35411. scrollToItem,
  35412. resetScrollTop,
  35413. states
  35414. });
  35415. return api;
  35416. },
  35417. render(ctx) {
  35418. var _a;
  35419. const {
  35420. $slots,
  35421. className,
  35422. clientSize,
  35423. containerElement,
  35424. data,
  35425. getItemStyle,
  35426. innerElement,
  35427. itemsToRender,
  35428. innerStyle,
  35429. layout,
  35430. total,
  35431. onScroll,
  35432. onScrollbarScroll,
  35433. onWheel,
  35434. states,
  35435. useIsScrolling,
  35436. windowStyle,
  35437. ns
  35438. } = ctx;
  35439. const [start, end] = itemsToRender;
  35440. const Container = vue.resolveDynamicComponent(containerElement);
  35441. const Inner = vue.resolveDynamicComponent(innerElement);
  35442. const children = [];
  35443. if (total > 0) {
  35444. for (let i = start; i <= end; i++) {
  35445. children.push((_a = $slots.default) == null ? void 0 : _a.call($slots, {
  35446. data,
  35447. key: i,
  35448. index: i,
  35449. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  35450. style: getItemStyle(i)
  35451. }));
  35452. }
  35453. }
  35454. const InnerNode = [
  35455. vue.h(Inner, {
  35456. style: innerStyle,
  35457. ref: "innerRef"
  35458. }, !isString(Inner) ? {
  35459. default: () => children
  35460. } : children)
  35461. ];
  35462. const scrollbar = vue.h(Scrollbar, {
  35463. ref: "scrollbarRef",
  35464. clientSize,
  35465. layout,
  35466. onScroll: onScrollbarScroll,
  35467. ratio: clientSize * 100 / this.estimatedTotalSize,
  35468. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  35469. total
  35470. });
  35471. const listContainer = vue.h(Container, {
  35472. class: [ns.e("window"), className],
  35473. style: windowStyle,
  35474. onScroll,
  35475. onWheel,
  35476. ref: "windowRef",
  35477. key: 0
  35478. }, !isString(Container) ? { default: () => [InnerNode] } : [InnerNode]);
  35479. return vue.h("div", {
  35480. key: 0,
  35481. class: [ns.e("wrapper"), states.scrollbarAlwaysOn ? "always-on" : ""]
  35482. }, [listContainer, scrollbar]);
  35483. }
  35484. });
  35485. };
  35486. var createList$1 = createList;
  35487. const FixedSizeList = createList$1({
  35488. name: "ElFixedSizeList",
  35489. getItemOffset: ({ itemSize }, index) => index * itemSize,
  35490. getItemSize: ({ itemSize }) => itemSize,
  35491. getEstimatedTotalSize: ({ total, itemSize }) => itemSize * total,
  35492. getOffset: ({ height, total, itemSize, layout, width }, index, alignment, scrollOffset) => {
  35493. const size = isHorizontal(layout) ? width : height;
  35494. const lastItemOffset = Math.max(0, total * itemSize - size);
  35495. const maxOffset = Math.min(lastItemOffset, index * itemSize);
  35496. const minOffset = Math.max(0, (index + 1) * itemSize - size);
  35497. if (alignment === SMART_ALIGNMENT) {
  35498. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  35499. alignment = AUTO_ALIGNMENT;
  35500. } else {
  35501. alignment = CENTERED_ALIGNMENT;
  35502. }
  35503. }
  35504. switch (alignment) {
  35505. case START_ALIGNMENT: {
  35506. return maxOffset;
  35507. }
  35508. case END_ALIGNMENT: {
  35509. return minOffset;
  35510. }
  35511. case CENTERED_ALIGNMENT: {
  35512. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  35513. if (middleOffset < Math.ceil(size / 2)) {
  35514. return 0;
  35515. } else if (middleOffset > lastItemOffset + Math.floor(size / 2)) {
  35516. return lastItemOffset;
  35517. } else {
  35518. return middleOffset;
  35519. }
  35520. }
  35521. case AUTO_ALIGNMENT:
  35522. default: {
  35523. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  35524. return scrollOffset;
  35525. } else if (scrollOffset < minOffset) {
  35526. return minOffset;
  35527. } else {
  35528. return maxOffset;
  35529. }
  35530. }
  35531. }
  35532. },
  35533. getStartIndexForOffset: ({ total, itemSize }, offset) => Math.max(0, Math.min(total - 1, Math.floor(offset / itemSize))),
  35534. getStopIndexForStartIndex: ({ height, total, itemSize, layout, width }, startIndex, scrollOffset) => {
  35535. const offset = startIndex * itemSize;
  35536. const size = isHorizontal(layout) ? width : height;
  35537. const numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
  35538. return Math.max(0, Math.min(total - 1, startIndex + numVisibleItems - 1));
  35539. },
  35540. initCache() {
  35541. return void 0;
  35542. },
  35543. clearCache: true,
  35544. validateProps() {
  35545. }
  35546. });
  35547. var FixedSizeList$1 = FixedSizeList;
  35548. const getItemFromCache$1 = (props, index, listCache) => {
  35549. const { itemSize } = props;
  35550. const { items, lastVisitedIndex } = listCache;
  35551. if (index > lastVisitedIndex) {
  35552. let offset = 0;
  35553. if (lastVisitedIndex >= 0) {
  35554. const item = items[lastVisitedIndex];
  35555. offset = item.offset + item.size;
  35556. }
  35557. for (let i = lastVisitedIndex + 1; i <= index; i++) {
  35558. const size = itemSize(i);
  35559. items[i] = {
  35560. offset,
  35561. size
  35562. };
  35563. offset += size;
  35564. }
  35565. listCache.lastVisitedIndex = index;
  35566. }
  35567. return items[index];
  35568. };
  35569. const findItem$1 = (props, listCache, offset) => {
  35570. const { items, lastVisitedIndex } = listCache;
  35571. const lastVisitedOffset = lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0;
  35572. if (lastVisitedOffset >= offset) {
  35573. return bs$1(props, listCache, 0, lastVisitedIndex, offset);
  35574. }
  35575. return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset);
  35576. };
  35577. const bs$1 = (props, listCache, low, high, offset) => {
  35578. while (low <= high) {
  35579. const mid = low + Math.floor((high - low) / 2);
  35580. const currentOffset = getItemFromCache$1(props, mid, listCache).offset;
  35581. if (currentOffset === offset) {
  35582. return mid;
  35583. } else if (currentOffset < offset) {
  35584. low = mid + 1;
  35585. } else if (currentOffset > offset) {
  35586. high = mid - 1;
  35587. }
  35588. }
  35589. return Math.max(0, low - 1);
  35590. };
  35591. const es$1 = (props, listCache, index, offset) => {
  35592. const { total } = props;
  35593. let exponent = 1;
  35594. while (index < total && getItemFromCache$1(props, index, listCache).offset < offset) {
  35595. index += exponent;
  35596. exponent *= 2;
  35597. }
  35598. return bs$1(props, listCache, Math.floor(index / 2), Math.min(index, total - 1), offset);
  35599. };
  35600. const getEstimatedTotalSize = ({ total }, { items, estimatedItemSize, lastVisitedIndex }) => {
  35601. let totalSizeOfMeasuredItems = 0;
  35602. if (lastVisitedIndex >= total) {
  35603. lastVisitedIndex = total - 1;
  35604. }
  35605. if (lastVisitedIndex >= 0) {
  35606. const item = items[lastVisitedIndex];
  35607. totalSizeOfMeasuredItems = item.offset + item.size;
  35608. }
  35609. const numUnmeasuredItems = total - lastVisitedIndex - 1;
  35610. const totalSizeOfUnmeasuredItems = numUnmeasuredItems * estimatedItemSize;
  35611. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  35612. };
  35613. const DynamicSizeList = createList$1({
  35614. name: "ElDynamicSizeList",
  35615. getItemOffset: (props, index, listCache) => getItemFromCache$1(props, index, listCache).offset,
  35616. getItemSize: (_, index, { items }) => items[index].size,
  35617. getEstimatedTotalSize,
  35618. getOffset: (props, index, alignment, scrollOffset, listCache) => {
  35619. const { height, layout, width } = props;
  35620. const size = isHorizontal(layout) ? width : height;
  35621. const item = getItemFromCache$1(props, index, listCache);
  35622. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  35623. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset));
  35624. const minOffset = Math.max(0, item.offset - size + item.size);
  35625. if (alignment === SMART_ALIGNMENT) {
  35626. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  35627. alignment = AUTO_ALIGNMENT;
  35628. } else {
  35629. alignment = CENTERED_ALIGNMENT;
  35630. }
  35631. }
  35632. switch (alignment) {
  35633. case START_ALIGNMENT: {
  35634. return maxOffset;
  35635. }
  35636. case END_ALIGNMENT: {
  35637. return minOffset;
  35638. }
  35639. case CENTERED_ALIGNMENT: {
  35640. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  35641. }
  35642. case AUTO_ALIGNMENT:
  35643. default: {
  35644. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  35645. return scrollOffset;
  35646. } else if (scrollOffset < minOffset) {
  35647. return minOffset;
  35648. } else {
  35649. return maxOffset;
  35650. }
  35651. }
  35652. }
  35653. },
  35654. getStartIndexForOffset: (props, offset, listCache) => findItem$1(props, listCache, offset),
  35655. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  35656. const { height, total, layout, width } = props;
  35657. const size = isHorizontal(layout) ? width : height;
  35658. const item = getItemFromCache$1(props, startIndex, listCache);
  35659. const maxOffset = scrollOffset + size;
  35660. let offset = item.offset + item.size;
  35661. let stopIndex = startIndex;
  35662. while (stopIndex < total - 1 && offset < maxOffset) {
  35663. stopIndex++;
  35664. offset += getItemFromCache$1(props, stopIndex, listCache).size;
  35665. }
  35666. return stopIndex;
  35667. },
  35668. initCache({ estimatedItemSize = DEFAULT_DYNAMIC_LIST_ITEM_SIZE }, instance) {
  35669. const cache = {
  35670. items: {},
  35671. estimatedItemSize,
  35672. lastVisitedIndex: -1
  35673. };
  35674. cache.clearCacheAfterIndex = (index, forceUpdate = true) => {
  35675. var _a, _b;
  35676. cache.lastVisitedIndex = Math.min(cache.lastVisitedIndex, index - 1);
  35677. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache(-1);
  35678. if (forceUpdate) {
  35679. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  35680. }
  35681. };
  35682. return cache;
  35683. },
  35684. clearCache: false,
  35685. validateProps: ({ itemSize }) => {
  35686. }
  35687. });
  35688. var DynamicSizeList$1 = DynamicSizeList;
  35689. const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => {
  35690. let frameHandle = null;
  35691. let xOffset = 0;
  35692. let yOffset = 0;
  35693. const hasReachedEdge = (x, y) => {
  35694. const xEdgeReached = x < 0 && atXStartEdge.value || x > 0 && atXEndEdge.value;
  35695. const yEdgeReached = y < 0 && atYStartEdge.value || y > 0 && atYEndEdge.value;
  35696. return xEdgeReached && yEdgeReached;
  35697. };
  35698. const onWheel = (e) => {
  35699. cAF(frameHandle);
  35700. let x = e.deltaX;
  35701. let y = e.deltaY;
  35702. if (Math.abs(x) > Math.abs(y)) {
  35703. y = 0;
  35704. } else {
  35705. x = 0;
  35706. }
  35707. if (e.shiftKey && y !== 0) {
  35708. x = y;
  35709. y = 0;
  35710. }
  35711. if (hasReachedEdge(xOffset, yOffset) && hasReachedEdge(xOffset + x, yOffset + y))
  35712. return;
  35713. xOffset += x;
  35714. yOffset += y;
  35715. if (!isFirefox()) {
  35716. e.preventDefault();
  35717. }
  35718. frameHandle = rAF(() => {
  35719. onWheelDelta(xOffset, yOffset);
  35720. xOffset = 0;
  35721. yOffset = 0;
  35722. });
  35723. };
  35724. return {
  35725. hasReachedEdge,
  35726. onWheel
  35727. };
  35728. };
  35729. const createGrid = ({
  35730. name,
  35731. clearCache,
  35732. getColumnPosition,
  35733. getColumnStartIndexForOffset,
  35734. getColumnStopIndexForStartIndex,
  35735. getEstimatedTotalHeight,
  35736. getEstimatedTotalWidth,
  35737. getColumnOffset,
  35738. getRowOffset,
  35739. getRowPosition,
  35740. getRowStartIndexForOffset,
  35741. getRowStopIndexForStartIndex,
  35742. initCache,
  35743. injectToInstance,
  35744. validateProps
  35745. }) => {
  35746. return vue.defineComponent({
  35747. name: name != null ? name : "ElVirtualList",
  35748. props: virtualizedGridProps,
  35749. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  35750. setup(props, { emit, expose, slots }) {
  35751. const ns = useNamespace("vl");
  35752. validateProps(props);
  35753. const instance = vue.getCurrentInstance();
  35754. const cache = vue.ref(initCache(props, instance));
  35755. injectToInstance == null ? void 0 : injectToInstance(instance, cache);
  35756. const windowRef = vue.ref();
  35757. const hScrollbar = vue.ref();
  35758. const vScrollbar = vue.ref();
  35759. const innerRef = vue.ref(null);
  35760. const states = vue.ref({
  35761. isScrolling: false,
  35762. scrollLeft: isNumber(props.initScrollLeft) ? props.initScrollLeft : 0,
  35763. scrollTop: isNumber(props.initScrollTop) ? props.initScrollTop : 0,
  35764. updateRequested: false,
  35765. xAxisScrollDir: FORWARD,
  35766. yAxisScrollDir: FORWARD
  35767. });
  35768. const getItemStyleCache = useCache();
  35769. const parsedHeight = vue.computed(() => Number.parseInt(`${props.height}`, 10));
  35770. const parsedWidth = vue.computed(() => Number.parseInt(`${props.width}`, 10));
  35771. const columnsToRender = vue.computed(() => {
  35772. const { totalColumn, totalRow, columnCache } = props;
  35773. const { isScrolling, xAxisScrollDir, scrollLeft } = vue.unref(states);
  35774. if (totalColumn === 0 || totalRow === 0) {
  35775. return [0, 0, 0, 0];
  35776. }
  35777. const startIndex = getColumnStartIndexForOffset(props, scrollLeft, vue.unref(cache));
  35778. const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, vue.unref(cache));
  35779. const cacheBackward = !isScrolling || xAxisScrollDir === BACKWARD ? Math.max(1, columnCache) : 1;
  35780. const cacheForward = !isScrolling || xAxisScrollDir === FORWARD ? Math.max(1, columnCache) : 1;
  35781. return [
  35782. Math.max(0, startIndex - cacheBackward),
  35783. Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)),
  35784. startIndex,
  35785. stopIndex
  35786. ];
  35787. });
  35788. const rowsToRender = vue.computed(() => {
  35789. const { totalColumn, totalRow, rowCache } = props;
  35790. const { isScrolling, yAxisScrollDir, scrollTop } = vue.unref(states);
  35791. if (totalColumn === 0 || totalRow === 0) {
  35792. return [0, 0, 0, 0];
  35793. }
  35794. const startIndex = getRowStartIndexForOffset(props, scrollTop, vue.unref(cache));
  35795. const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, vue.unref(cache));
  35796. const cacheBackward = !isScrolling || yAxisScrollDir === BACKWARD ? Math.max(1, rowCache) : 1;
  35797. const cacheForward = !isScrolling || yAxisScrollDir === FORWARD ? Math.max(1, rowCache) : 1;
  35798. return [
  35799. Math.max(0, startIndex - cacheBackward),
  35800. Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)),
  35801. startIndex,
  35802. stopIndex
  35803. ];
  35804. });
  35805. const estimatedTotalHeight = vue.computed(() => getEstimatedTotalHeight(props, vue.unref(cache)));
  35806. const estimatedTotalWidth = vue.computed(() => getEstimatedTotalWidth(props, vue.unref(cache)));
  35807. const windowStyle = vue.computed(() => {
  35808. var _a;
  35809. return [
  35810. {
  35811. position: "relative",
  35812. overflow: "hidden",
  35813. WebkitOverflowScrolling: "touch",
  35814. willChange: "transform"
  35815. },
  35816. {
  35817. direction: props.direction,
  35818. height: isNumber(props.height) ? `${props.height}px` : props.height,
  35819. width: isNumber(props.width) ? `${props.width}px` : props.width
  35820. },
  35821. (_a = props.style) != null ? _a : {}
  35822. ];
  35823. });
  35824. const innerStyle = vue.computed(() => {
  35825. const width = `${vue.unref(estimatedTotalWidth)}px`;
  35826. const height = `${vue.unref(estimatedTotalHeight)}px`;
  35827. return {
  35828. height,
  35829. pointerEvents: vue.unref(states).isScrolling ? "none" : void 0,
  35830. width
  35831. };
  35832. });
  35833. const emitEvents = () => {
  35834. const { totalColumn, totalRow } = props;
  35835. if (totalColumn > 0 && totalRow > 0) {
  35836. const [
  35837. columnCacheStart,
  35838. columnCacheEnd,
  35839. columnVisibleStart,
  35840. columnVisibleEnd
  35841. ] = vue.unref(columnsToRender);
  35842. const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = vue.unref(rowsToRender);
  35843. emit(ITEM_RENDER_EVT, {
  35844. columnCacheStart,
  35845. columnCacheEnd,
  35846. rowCacheStart,
  35847. rowCacheEnd,
  35848. columnVisibleStart,
  35849. columnVisibleEnd,
  35850. rowVisibleStart,
  35851. rowVisibleEnd
  35852. });
  35853. }
  35854. const {
  35855. scrollLeft,
  35856. scrollTop,
  35857. updateRequested,
  35858. xAxisScrollDir,
  35859. yAxisScrollDir
  35860. } = vue.unref(states);
  35861. emit(SCROLL_EVT, {
  35862. xAxisScrollDir,
  35863. scrollLeft,
  35864. yAxisScrollDir,
  35865. scrollTop,
  35866. updateRequested
  35867. });
  35868. };
  35869. const onScroll = (e) => {
  35870. const {
  35871. clientHeight,
  35872. clientWidth,
  35873. scrollHeight,
  35874. scrollLeft,
  35875. scrollTop,
  35876. scrollWidth
  35877. } = e.currentTarget;
  35878. const _states = vue.unref(states);
  35879. if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) {
  35880. return;
  35881. }
  35882. let _scrollLeft = scrollLeft;
  35883. if (isRTL(props.direction)) {
  35884. switch (getRTLOffsetType()) {
  35885. case RTL_OFFSET_NAG:
  35886. _scrollLeft = -scrollLeft;
  35887. break;
  35888. case RTL_OFFSET_POS_DESC:
  35889. _scrollLeft = scrollWidth - clientWidth - scrollLeft;
  35890. break;
  35891. }
  35892. }
  35893. states.value = {
  35894. ..._states,
  35895. isScrolling: true,
  35896. scrollLeft: _scrollLeft,
  35897. scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)),
  35898. updateRequested: true,
  35899. xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft),
  35900. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop)
  35901. };
  35902. vue.nextTick(() => resetIsScrolling());
  35903. onUpdated();
  35904. emitEvents();
  35905. };
  35906. const onVerticalScroll = (distance, totalSteps) => {
  35907. const height = vue.unref(parsedHeight);
  35908. const offset = (estimatedTotalHeight.value - height) / totalSteps * distance;
  35909. scrollTo({
  35910. scrollTop: Math.min(estimatedTotalHeight.value - height, offset)
  35911. });
  35912. };
  35913. const onHorizontalScroll = (distance, totalSteps) => {
  35914. const width = vue.unref(parsedWidth);
  35915. const offset = (estimatedTotalWidth.value - width) / totalSteps * distance;
  35916. scrollTo({
  35917. scrollLeft: Math.min(estimatedTotalWidth.value - width, offset)
  35918. });
  35919. };
  35920. const { onWheel } = useGridWheel({
  35921. atXStartEdge: vue.computed(() => states.value.scrollLeft <= 0),
  35922. atXEndEdge: vue.computed(() => states.value.scrollLeft >= estimatedTotalWidth.value),
  35923. atYStartEdge: vue.computed(() => states.value.scrollTop <= 0),
  35924. atYEndEdge: vue.computed(() => states.value.scrollTop >= estimatedTotalHeight.value)
  35925. }, (x, y) => {
  35926. var _a, _b, _c, _d;
  35927. (_b = (_a = hScrollbar.value) == null ? void 0 : _a.onMouseUp) == null ? void 0 : _b.call(_a);
  35928. (_d = (_c = hScrollbar.value) == null ? void 0 : _c.onMouseUp) == null ? void 0 : _d.call(_c);
  35929. const width = vue.unref(parsedWidth);
  35930. const height = vue.unref(parsedHeight);
  35931. scrollTo({
  35932. scrollLeft: Math.min(states.value.scrollLeft + x, estimatedTotalWidth.value - width),
  35933. scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height)
  35934. });
  35935. });
  35936. const scrollTo = ({
  35937. scrollLeft = states.value.scrollLeft,
  35938. scrollTop = states.value.scrollTop
  35939. }) => {
  35940. scrollLeft = Math.max(scrollLeft, 0);
  35941. scrollTop = Math.max(scrollTop, 0);
  35942. const _states = vue.unref(states);
  35943. if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) {
  35944. return;
  35945. }
  35946. states.value = {
  35947. ..._states,
  35948. xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft),
  35949. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop),
  35950. scrollLeft,
  35951. scrollTop,
  35952. updateRequested: true
  35953. };
  35954. vue.nextTick(() => resetIsScrolling());
  35955. onUpdated();
  35956. emitEvents();
  35957. };
  35958. const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => {
  35959. const _states = vue.unref(states);
  35960. columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1));
  35961. rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1));
  35962. const scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  35963. const _cache = vue.unref(cache);
  35964. const estimatedHeight = getEstimatedTotalHeight(props, _cache);
  35965. const estimatedWidth = getEstimatedTotalWidth(props, _cache);
  35966. scrollTo({
  35967. scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth : 0),
  35968. scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth : 0)
  35969. });
  35970. };
  35971. const getItemStyle = (rowIndex, columnIndex) => {
  35972. const { columnWidth, direction, rowHeight } = props;
  35973. const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction);
  35974. const key = `${rowIndex},${columnIndex}`;
  35975. if (hasOwn(itemStyleCache, key)) {
  35976. return itemStyleCache[key];
  35977. } else {
  35978. const [, left] = getColumnPosition(props, columnIndex, vue.unref(cache));
  35979. const _cache = vue.unref(cache);
  35980. const rtl = isRTL(direction);
  35981. const [height, top] = getRowPosition(props, rowIndex, _cache);
  35982. const [width] = getColumnPosition(props, columnIndex, _cache);
  35983. itemStyleCache[key] = {
  35984. position: "absolute",
  35985. left: rtl ? void 0 : `${left}px`,
  35986. right: rtl ? `${left}px` : void 0,
  35987. top: `${top}px`,
  35988. height: `${height}px`,
  35989. width: `${width}px`
  35990. };
  35991. return itemStyleCache[key];
  35992. }
  35993. };
  35994. const resetIsScrolling = () => {
  35995. states.value.isScrolling = false;
  35996. vue.nextTick(() => {
  35997. getItemStyleCache.value(-1, null, null);
  35998. });
  35999. };
  36000. vue.onMounted(() => {
  36001. if (!isClient)
  36002. return;
  36003. const { initScrollLeft, initScrollTop } = props;
  36004. const windowElement = vue.unref(windowRef);
  36005. if (windowElement) {
  36006. if (isNumber(initScrollLeft)) {
  36007. windowElement.scrollLeft = initScrollLeft;
  36008. }
  36009. if (isNumber(initScrollTop)) {
  36010. windowElement.scrollTop = initScrollTop;
  36011. }
  36012. }
  36013. emitEvents();
  36014. });
  36015. const onUpdated = () => {
  36016. const { direction } = props;
  36017. const { scrollLeft, scrollTop, updateRequested } = vue.unref(states);
  36018. const windowElement = vue.unref(windowRef);
  36019. if (updateRequested && windowElement) {
  36020. if (direction === RTL) {
  36021. switch (getRTLOffsetType()) {
  36022. case RTL_OFFSET_NAG: {
  36023. windowElement.scrollLeft = -scrollLeft;
  36024. break;
  36025. }
  36026. case RTL_OFFSET_POS_ASC: {
  36027. windowElement.scrollLeft = scrollLeft;
  36028. break;
  36029. }
  36030. default: {
  36031. const { clientWidth, scrollWidth } = windowElement;
  36032. windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft;
  36033. break;
  36034. }
  36035. }
  36036. } else {
  36037. windowElement.scrollLeft = Math.max(0, scrollLeft);
  36038. }
  36039. windowElement.scrollTop = Math.max(0, scrollTop);
  36040. }
  36041. };
  36042. const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy;
  36043. expose({
  36044. windowRef,
  36045. innerRef,
  36046. getItemStyleCache,
  36047. scrollTo,
  36048. scrollToItem,
  36049. states,
  36050. resetAfterColumnIndex,
  36051. resetAfterRowIndex,
  36052. resetAfter
  36053. });
  36054. const renderScrollbars = () => {
  36055. const {
  36056. scrollbarAlwaysOn,
  36057. scrollbarStartGap,
  36058. scrollbarEndGap,
  36059. totalColumn,
  36060. totalRow
  36061. } = props;
  36062. const width = vue.unref(parsedWidth);
  36063. const height = vue.unref(parsedHeight);
  36064. const estimatedWidth = vue.unref(estimatedTotalWidth);
  36065. const estimatedHeight = vue.unref(estimatedTotalHeight);
  36066. const { scrollLeft, scrollTop } = vue.unref(states);
  36067. const horizontalScrollbar = vue.h(Scrollbar, {
  36068. ref: hScrollbar,
  36069. alwaysOn: scrollbarAlwaysOn,
  36070. startGap: scrollbarStartGap,
  36071. endGap: scrollbarEndGap,
  36072. class: ns.e("horizontal"),
  36073. clientSize: width,
  36074. layout: "horizontal",
  36075. onScroll: onHorizontalScroll,
  36076. ratio: width * 100 / estimatedWidth,
  36077. scrollFrom: scrollLeft / (estimatedWidth - width),
  36078. total: totalRow,
  36079. visible: true
  36080. });
  36081. const verticalScrollbar = vue.h(Scrollbar, {
  36082. ref: vScrollbar,
  36083. alwaysOn: scrollbarAlwaysOn,
  36084. startGap: scrollbarStartGap,
  36085. endGap: scrollbarEndGap,
  36086. class: ns.e("vertical"),
  36087. clientSize: height,
  36088. layout: "vertical",
  36089. onScroll: onVerticalScroll,
  36090. ratio: height * 100 / estimatedHeight,
  36091. scrollFrom: scrollTop / (estimatedHeight - height),
  36092. total: totalColumn,
  36093. visible: true
  36094. });
  36095. return {
  36096. horizontalScrollbar,
  36097. verticalScrollbar
  36098. };
  36099. };
  36100. const renderItems = () => {
  36101. var _a;
  36102. const [columnStart, columnEnd] = vue.unref(columnsToRender);
  36103. const [rowStart, rowEnd] = vue.unref(rowsToRender);
  36104. const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props;
  36105. const children = [];
  36106. if (totalRow > 0 && totalColumn > 0) {
  36107. for (let row = rowStart; row <= rowEnd; row++) {
  36108. for (let column = columnStart; column <= columnEnd; column++) {
  36109. children.push((_a = slots.default) == null ? void 0 : _a.call(slots, {
  36110. columnIndex: column,
  36111. data,
  36112. key: itemKey({ columnIndex: column, data, rowIndex: row }),
  36113. isScrolling: useIsScrolling ? vue.unref(states).isScrolling : void 0,
  36114. style: getItemStyle(row, column),
  36115. rowIndex: row
  36116. }));
  36117. }
  36118. }
  36119. }
  36120. return children;
  36121. };
  36122. const renderInner = () => {
  36123. const Inner = vue.resolveDynamicComponent(props.innerElement);
  36124. const children = renderItems();
  36125. return [
  36126. vue.h(Inner, {
  36127. style: vue.unref(innerStyle),
  36128. ref: innerRef
  36129. }, !isString(Inner) ? {
  36130. default: () => children
  36131. } : children)
  36132. ];
  36133. };
  36134. const renderWindow = () => {
  36135. const Container = vue.resolveDynamicComponent(props.containerElement);
  36136. const { horizontalScrollbar, verticalScrollbar } = renderScrollbars();
  36137. const Inner = renderInner();
  36138. return vue.h("div", {
  36139. key: 0,
  36140. class: ns.e("wrapper")
  36141. }, [
  36142. vue.h(Container, {
  36143. class: props.className,
  36144. style: vue.unref(windowStyle),
  36145. onScroll,
  36146. onWheel,
  36147. ref: windowRef
  36148. }, !isString(Container) ? { default: () => Inner } : Inner),
  36149. horizontalScrollbar,
  36150. verticalScrollbar
  36151. ]);
  36152. };
  36153. return renderWindow;
  36154. }
  36155. });
  36156. };
  36157. var createGrid$1 = createGrid;
  36158. const FixedSizeGrid = createGrid$1({
  36159. name: "ElFixedSizeGrid",
  36160. getColumnPosition: ({ columnWidth }, index) => [
  36161. columnWidth,
  36162. index * columnWidth
  36163. ],
  36164. getRowPosition: ({ rowHeight }, index) => [
  36165. rowHeight,
  36166. index * rowHeight
  36167. ],
  36168. getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow,
  36169. getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn,
  36170. getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _, scrollBarWidth) => {
  36171. width = Number(width);
  36172. const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width);
  36173. const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
  36174. const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth + columnWidth);
  36175. if (alignment === "smart") {
  36176. if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) {
  36177. alignment = AUTO_ALIGNMENT;
  36178. } else {
  36179. alignment = CENTERED_ALIGNMENT;
  36180. }
  36181. }
  36182. switch (alignment) {
  36183. case START_ALIGNMENT:
  36184. return maxOffset;
  36185. case END_ALIGNMENT:
  36186. return minOffset;
  36187. case CENTERED_ALIGNMENT: {
  36188. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  36189. if (middleOffset < Math.ceil(width / 2)) {
  36190. return 0;
  36191. } else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) {
  36192. return lastColumnOffset;
  36193. } else {
  36194. return middleOffset;
  36195. }
  36196. }
  36197. case AUTO_ALIGNMENT:
  36198. default:
  36199. if (scrollLeft >= minOffset && scrollLeft <= maxOffset) {
  36200. return scrollLeft;
  36201. } else if (minOffset > maxOffset) {
  36202. return minOffset;
  36203. } else if (scrollLeft < minOffset) {
  36204. return minOffset;
  36205. } else {
  36206. return maxOffset;
  36207. }
  36208. }
  36209. },
  36210. getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _, scrollBarWidth) => {
  36211. height = Number(height);
  36212. const lastRowOffset = Math.max(0, totalRow * rowHeight - height);
  36213. const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
  36214. const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth + rowHeight);
  36215. if (align === SMART_ALIGNMENT) {
  36216. if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) {
  36217. align = AUTO_ALIGNMENT;
  36218. } else {
  36219. align = CENTERED_ALIGNMENT;
  36220. }
  36221. }
  36222. switch (align) {
  36223. case START_ALIGNMENT:
  36224. return maxOffset;
  36225. case END_ALIGNMENT:
  36226. return minOffset;
  36227. case CENTERED_ALIGNMENT: {
  36228. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  36229. if (middleOffset < Math.ceil(height / 2)) {
  36230. return 0;
  36231. } else if (middleOffset > lastRowOffset + Math.floor(height / 2)) {
  36232. return lastRowOffset;
  36233. } else {
  36234. return middleOffset;
  36235. }
  36236. }
  36237. case AUTO_ALIGNMENT:
  36238. default:
  36239. if (scrollTop >= minOffset && scrollTop <= maxOffset) {
  36240. return scrollTop;
  36241. } else if (minOffset > maxOffset) {
  36242. return minOffset;
  36243. } else if (scrollTop < minOffset) {
  36244. return minOffset;
  36245. } else {
  36246. return maxOffset;
  36247. }
  36248. }
  36249. },
  36250. getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))),
  36251. getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => {
  36252. const left = startIndex * columnWidth;
  36253. const visibleColumnsCount = Math.ceil((width + scrollLeft - left) / columnWidth);
  36254. return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1));
  36255. },
  36256. getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))),
  36257. getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => {
  36258. const top = startIndex * rowHeight;
  36259. const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
  36260. return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1));
  36261. },
  36262. initCache: () => void 0,
  36263. clearCache: true,
  36264. validateProps: ({ columnWidth, rowHeight }) => {
  36265. }
  36266. });
  36267. var FixedSizeGrid$1 = FixedSizeGrid;
  36268. const { max, min, floor } = Math;
  36269. const ACCESS_SIZER_KEY_MAP = {
  36270. column: "columnWidth",
  36271. row: "rowHeight"
  36272. };
  36273. const ACCESS_LAST_VISITED_KEY_MAP = {
  36274. column: "lastVisitedColumnIndex",
  36275. row: "lastVisitedRowIndex"
  36276. };
  36277. const getItemFromCache = (props, index, gridCache, type) => {
  36278. const [cachedItems, sizer, lastVisited] = [
  36279. gridCache[type],
  36280. props[ACCESS_SIZER_KEY_MAP[type]],
  36281. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  36282. ];
  36283. if (index > lastVisited) {
  36284. let offset = 0;
  36285. if (lastVisited >= 0) {
  36286. const item = cachedItems[lastVisited];
  36287. offset = item.offset + item.size;
  36288. }
  36289. for (let i = lastVisited + 1; i <= index; i++) {
  36290. const size = sizer(i);
  36291. cachedItems[i] = {
  36292. offset,
  36293. size
  36294. };
  36295. offset += size;
  36296. }
  36297. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] = index;
  36298. }
  36299. return cachedItems[index];
  36300. };
  36301. const bs = (props, gridCache, low, high, offset, type) => {
  36302. while (low <= high) {
  36303. const mid = low + floor((high - low) / 2);
  36304. const currentOffset = getItemFromCache(props, mid, gridCache, type).offset;
  36305. if (currentOffset === offset) {
  36306. return mid;
  36307. } else if (currentOffset < offset) {
  36308. low = mid + 1;
  36309. } else {
  36310. high = mid - 1;
  36311. }
  36312. }
  36313. return max(0, low - 1);
  36314. };
  36315. const es = (props, gridCache, idx, offset, type) => {
  36316. const total = type === "column" ? props.totalColumn : props.totalRow;
  36317. let exponent = 1;
  36318. while (idx < total && getItemFromCache(props, idx, gridCache, type).offset < offset) {
  36319. idx += exponent;
  36320. exponent *= 2;
  36321. }
  36322. return bs(props, gridCache, floor(idx / 2), min(idx, total - 1), offset, type);
  36323. };
  36324. const findItem = (props, gridCache, offset, type) => {
  36325. const [cache, lastVisitedIndex] = [
  36326. gridCache[type],
  36327. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  36328. ];
  36329. const lastVisitedItemOffset = lastVisitedIndex > 0 ? cache[lastVisitedIndex].offset : 0;
  36330. if (lastVisitedItemOffset >= offset) {
  36331. return bs(props, gridCache, 0, lastVisitedIndex, offset, type);
  36332. }
  36333. return es(props, gridCache, max(0, lastVisitedIndex), offset, type);
  36334. };
  36335. const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => {
  36336. let sizeOfVisitedRows = 0;
  36337. if (lastVisitedRowIndex >= totalRow) {
  36338. lastVisitedRowIndex = totalRow - 1;
  36339. }
  36340. if (lastVisitedRowIndex >= 0) {
  36341. const item = row[lastVisitedRowIndex];
  36342. sizeOfVisitedRows = item.offset + item.size;
  36343. }
  36344. const unvisitedItems = totalRow - lastVisitedRowIndex - 1;
  36345. const sizeOfUnvisitedItems = unvisitedItems * estimatedRowHeight;
  36346. return sizeOfVisitedRows + sizeOfUnvisitedItems;
  36347. };
  36348. const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => {
  36349. let sizeOfVisitedColumns = 0;
  36350. if (lastVisitedColumnIndex > totalColumn) {
  36351. lastVisitedColumnIndex = totalColumn - 1;
  36352. }
  36353. if (lastVisitedColumnIndex >= 0) {
  36354. const item = column[lastVisitedColumnIndex];
  36355. sizeOfVisitedColumns = item.offset + item.size;
  36356. }
  36357. const unvisitedItems = totalColumn - lastVisitedColumnIndex - 1;
  36358. const sizeOfUnvisitedItems = unvisitedItems * estimatedColumnWidth;
  36359. return sizeOfVisitedColumns + sizeOfUnvisitedItems;
  36360. };
  36361. const ACCESS_ESTIMATED_SIZE_KEY_MAP = {
  36362. column: getEstimatedTotalWidth,
  36363. row: getEstimatedTotalHeight
  36364. };
  36365. const getOffset$1 = (props, index, alignment, scrollOffset, cache, type, scrollBarWidth) => {
  36366. const [size, estimatedSizeAssociates] = [
  36367. type === "row" ? props.height : props.width,
  36368. ACCESS_ESTIMATED_SIZE_KEY_MAP[type]
  36369. ];
  36370. const item = getItemFromCache(props, index, cache, type);
  36371. const estimatedSize = estimatedSizeAssociates(props, cache);
  36372. const maxOffset = max(0, min(estimatedSize - size, item.offset));
  36373. const minOffset = max(0, item.offset - size + scrollBarWidth + item.size);
  36374. if (alignment === SMART_ALIGNMENT) {
  36375. if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) {
  36376. alignment = AUTO_ALIGNMENT;
  36377. } else {
  36378. alignment = CENTERED_ALIGNMENT;
  36379. }
  36380. }
  36381. switch (alignment) {
  36382. case START_ALIGNMENT: {
  36383. return maxOffset;
  36384. }
  36385. case END_ALIGNMENT: {
  36386. return minOffset;
  36387. }
  36388. case CENTERED_ALIGNMENT: {
  36389. return Math.round(minOffset + (maxOffset - minOffset) / 2);
  36390. }
  36391. case AUTO_ALIGNMENT:
  36392. default: {
  36393. if (scrollOffset >= minOffset && scrollOffset <= maxOffset) {
  36394. return scrollOffset;
  36395. } else if (minOffset > maxOffset) {
  36396. return minOffset;
  36397. } else if (scrollOffset < minOffset) {
  36398. return minOffset;
  36399. } else {
  36400. return maxOffset;
  36401. }
  36402. }
  36403. }
  36404. };
  36405. const DynamicSizeGrid = createGrid$1({
  36406. name: "ElDynamicSizeGrid",
  36407. getColumnPosition: (props, idx, cache) => {
  36408. const item = getItemFromCache(props, idx, cache, "column");
  36409. return [item.size, item.offset];
  36410. },
  36411. getRowPosition: (props, idx, cache) => {
  36412. const item = getItemFromCache(props, idx, cache, "row");
  36413. return [item.size, item.offset];
  36414. },
  36415. getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache, scrollBarWidth) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache, "column", scrollBarWidth),
  36416. getRowOffset: (props, rowIndex, alignment, scrollTop, cache, scrollBarWidth) => getOffset$1(props, rowIndex, alignment, scrollTop, cache, "row", scrollBarWidth),
  36417. getColumnStartIndexForOffset: (props, scrollLeft, cache) => findItem(props, cache, scrollLeft, "column"),
  36418. getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache) => {
  36419. const item = getItemFromCache(props, startIndex, cache, "column");
  36420. const maxOffset = scrollLeft + props.width;
  36421. let offset = item.offset + item.size;
  36422. let stopIndex = startIndex;
  36423. while (stopIndex < props.totalColumn - 1 && offset < maxOffset) {
  36424. stopIndex++;
  36425. offset += getItemFromCache(props, startIndex, cache, "column").size;
  36426. }
  36427. return stopIndex;
  36428. },
  36429. getEstimatedTotalHeight,
  36430. getEstimatedTotalWidth,
  36431. getRowStartIndexForOffset: (props, scrollTop, cache) => findItem(props, cache, scrollTop, "row"),
  36432. getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache) => {
  36433. const { totalRow, height } = props;
  36434. const item = getItemFromCache(props, startIndex, cache, "row");
  36435. const maxOffset = scrollTop + height;
  36436. let offset = item.size + item.offset;
  36437. let stopIndex = startIndex;
  36438. while (stopIndex < totalRow - 1 && offset < maxOffset) {
  36439. stopIndex++;
  36440. offset += getItemFromCache(props, stopIndex, cache, "row").size;
  36441. }
  36442. return stopIndex;
  36443. },
  36444. injectToInstance: (instance, cache) => {
  36445. const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => {
  36446. var _a, _b;
  36447. forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate;
  36448. if (isNumber(columnIndex)) {
  36449. cache.value.lastVisitedColumnIndex = Math.min(cache.value.lastVisitedColumnIndex, columnIndex - 1);
  36450. }
  36451. if (isNumber(rowIndex)) {
  36452. cache.value.lastVisitedRowIndex = Math.min(cache.value.lastVisitedRowIndex, rowIndex - 1);
  36453. }
  36454. (_a = instance.exposed) == null ? void 0 : _a.getItemStyleCache.value(-1, null, null);
  36455. if (forceUpdate)
  36456. (_b = instance.proxy) == null ? void 0 : _b.$forceUpdate();
  36457. };
  36458. const resetAfterColumnIndex = (columnIndex, forceUpdate) => {
  36459. resetAfter({
  36460. columnIndex
  36461. }, forceUpdate);
  36462. };
  36463. const resetAfterRowIndex = (rowIndex, forceUpdate) => {
  36464. resetAfter({
  36465. rowIndex
  36466. }, forceUpdate);
  36467. };
  36468. Object.assign(instance.proxy, {
  36469. resetAfterColumnIndex,
  36470. resetAfterRowIndex,
  36471. resetAfter
  36472. });
  36473. },
  36474. initCache: ({
  36475. estimatedColumnWidth = DEFAULT_DYNAMIC_LIST_ITEM_SIZE,
  36476. estimatedRowHeight = DEFAULT_DYNAMIC_LIST_ITEM_SIZE
  36477. }) => {
  36478. const cache = {
  36479. column: {},
  36480. estimatedColumnWidth,
  36481. estimatedRowHeight,
  36482. lastVisitedColumnIndex: -1,
  36483. lastVisitedRowIndex: -1,
  36484. row: {}
  36485. };
  36486. return cache;
  36487. },
  36488. clearCache: false,
  36489. validateProps: ({ columnWidth, rowHeight }) => {
  36490. }
  36491. });
  36492. var DynamicSizeGrid$1 = DynamicSizeGrid;
  36493. const _sfc_main$A = vue.defineComponent({
  36494. props: {
  36495. item: {
  36496. type: Object,
  36497. required: true
  36498. },
  36499. style: Object,
  36500. height: Number
  36501. },
  36502. setup() {
  36503. const ns = useNamespace("select");
  36504. return {
  36505. ns
  36506. };
  36507. }
  36508. });
  36509. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  36510. return _ctx.item.isTitle ? (vue.openBlock(), vue.createElementBlock("div", {
  36511. key: 0,
  36512. class: vue.normalizeClass(_ctx.ns.be("group", "title")),
  36513. style: vue.normalizeStyle([_ctx.style, { lineHeight: `${_ctx.height}px` }])
  36514. }, vue.toDisplayString(_ctx.item.label), 7)) : (vue.openBlock(), vue.createElementBlock("div", {
  36515. key: 1,
  36516. class: vue.normalizeClass(_ctx.ns.be("group", "split")),
  36517. style: vue.normalizeStyle(_ctx.style)
  36518. }, [
  36519. vue.createElementVNode("span", {
  36520. class: vue.normalizeClass(_ctx.ns.be("group", "split-dash")),
  36521. style: vue.normalizeStyle({ top: `${_ctx.height / 2}px` })
  36522. }, null, 6)
  36523. ], 6));
  36524. }
  36525. var GroupItem = /* @__PURE__ */ _export_sfc(_sfc_main$A, [["render", _sfc_render$7], ["__file", "group-item.vue"]]);
  36526. function useOption(props, { emit }) {
  36527. return {
  36528. hoverItem: () => {
  36529. if (!props.disabled) {
  36530. emit("hover", props.index);
  36531. }
  36532. },
  36533. selectOptionClick: () => {
  36534. if (!props.disabled) {
  36535. emit("select", props.item, props.index);
  36536. }
  36537. }
  36538. };
  36539. }
  36540. const SelectProps = {
  36541. allowCreate: Boolean,
  36542. autocomplete: {
  36543. type: String,
  36544. default: "none"
  36545. },
  36546. automaticDropdown: Boolean,
  36547. clearable: Boolean,
  36548. clearIcon: {
  36549. type: [String, Object],
  36550. default: circle_close_default
  36551. },
  36552. effect: {
  36553. type: String,
  36554. default: "light"
  36555. },
  36556. collapseTags: Boolean,
  36557. collapseTagsTooltip: {
  36558. type: Boolean,
  36559. default: false
  36560. },
  36561. defaultFirstOption: Boolean,
  36562. disabled: Boolean,
  36563. estimatedOptionHeight: {
  36564. type: Number,
  36565. default: void 0
  36566. },
  36567. filterable: Boolean,
  36568. filterMethod: Function,
  36569. height: {
  36570. type: Number,
  36571. default: 170
  36572. },
  36573. itemHeight: {
  36574. type: Number,
  36575. default: 34
  36576. },
  36577. id: String,
  36578. loading: Boolean,
  36579. loadingText: String,
  36580. label: String,
  36581. modelValue: [Array, String, Number, Boolean, Object],
  36582. multiple: Boolean,
  36583. multipleLimit: {
  36584. type: Number,
  36585. default: 0
  36586. },
  36587. name: String,
  36588. noDataText: String,
  36589. noMatchText: String,
  36590. remoteMethod: Function,
  36591. reserveKeyword: {
  36592. type: Boolean,
  36593. default: true
  36594. },
  36595. options: {
  36596. type: Array,
  36597. required: true
  36598. },
  36599. placeholder: {
  36600. type: String
  36601. },
  36602. teleported: useTooltipContentProps.teleported,
  36603. persistent: {
  36604. type: Boolean,
  36605. default: true
  36606. },
  36607. popperClass: {
  36608. type: String,
  36609. default: ""
  36610. },
  36611. popperOptions: {
  36612. type: Object,
  36613. default: () => ({})
  36614. },
  36615. remote: Boolean,
  36616. size: {
  36617. type: String,
  36618. validator: isValidComponentSize
  36619. },
  36620. valueKey: {
  36621. type: String,
  36622. default: "value"
  36623. },
  36624. scrollbarAlwaysOn: {
  36625. type: Boolean,
  36626. default: false
  36627. },
  36628. validateEvent: {
  36629. type: Boolean,
  36630. default: true
  36631. },
  36632. placement: {
  36633. type: definePropType(String),
  36634. values: Ee,
  36635. default: "bottom-start"
  36636. }
  36637. };
  36638. const OptionProps = {
  36639. data: Array,
  36640. disabled: Boolean,
  36641. hovering: Boolean,
  36642. item: Object,
  36643. index: Number,
  36644. style: Object,
  36645. selected: Boolean,
  36646. created: Boolean
  36647. };
  36648. const _sfc_main$z = vue.defineComponent({
  36649. props: OptionProps,
  36650. emits: ["select", "hover"],
  36651. setup(props, { emit }) {
  36652. const ns = useNamespace("select");
  36653. const { hoverItem, selectOptionClick } = useOption(props, { emit });
  36654. return {
  36655. ns,
  36656. hoverItem,
  36657. selectOptionClick
  36658. };
  36659. }
  36660. });
  36661. const _hoisted_1$h = ["aria-selected"];
  36662. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  36663. return vue.openBlock(), vue.createElementBlock("li", {
  36664. "aria-selected": _ctx.selected,
  36665. style: vue.normalizeStyle(_ctx.style),
  36666. class: vue.normalizeClass([
  36667. _ctx.ns.be("dropdown", "option-item"),
  36668. _ctx.ns.is("selected", _ctx.selected),
  36669. _ctx.ns.is("disabled", _ctx.disabled),
  36670. _ctx.ns.is("created", _ctx.created),
  36671. { hover: _ctx.hovering }
  36672. ]),
  36673. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  36674. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  36675. }, [
  36676. vue.renderSlot(_ctx.$slots, "default", {
  36677. item: _ctx.item,
  36678. index: _ctx.index,
  36679. disabled: _ctx.disabled
  36680. }, () => [
  36681. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.item.label), 1)
  36682. ])
  36683. ], 46, _hoisted_1$h);
  36684. }
  36685. var OptionItem = /* @__PURE__ */ _export_sfc(_sfc_main$z, [["render", _sfc_render$6], ["__file", "option-item.vue"]]);
  36686. const selectV2InjectionKey = "ElSelectV2Injection";
  36687. var ElSelectMenu = vue.defineComponent({
  36688. name: "ElSelectDropdown",
  36689. props: {
  36690. data: {
  36691. type: Array,
  36692. required: true
  36693. },
  36694. hoveringIndex: Number,
  36695. width: Number
  36696. },
  36697. setup(props, {
  36698. slots,
  36699. expose
  36700. }) {
  36701. const select = vue.inject(selectV2InjectionKey);
  36702. const ns = useNamespace("select");
  36703. const cachedHeights = vue.ref([]);
  36704. const listRef = vue.ref();
  36705. const size = vue.computed(() => props.data.length);
  36706. vue.watch(() => size.value, () => {
  36707. var _a, _b;
  36708. (_b = (_a = select.popper.value).updatePopper) == null ? void 0 : _b.call(_a);
  36709. });
  36710. const isSized = vue.computed(() => isUndefined(select.props.estimatedOptionHeight));
  36711. const listProps = vue.computed(() => {
  36712. if (isSized.value) {
  36713. return {
  36714. itemSize: select.props.itemHeight
  36715. };
  36716. }
  36717. return {
  36718. estimatedSize: select.props.estimatedOptionHeight,
  36719. itemSize: (idx) => cachedHeights.value[idx]
  36720. };
  36721. });
  36722. const contains = (arr = [], target) => {
  36723. const {
  36724. props: {
  36725. valueKey
  36726. }
  36727. } = select;
  36728. if (!isObject$1(target)) {
  36729. return arr.includes(target);
  36730. }
  36731. return arr && arr.some((item) => {
  36732. return get(item, valueKey) === get(target, valueKey);
  36733. });
  36734. };
  36735. const isEqual = (selected, target) => {
  36736. if (!isObject$1(target)) {
  36737. return selected === target;
  36738. } else {
  36739. const {
  36740. valueKey
  36741. } = select.props;
  36742. return get(selected, valueKey) === get(target, valueKey);
  36743. }
  36744. };
  36745. const isItemSelected = (modelValue, target) => {
  36746. const {
  36747. valueKey
  36748. } = select.props;
  36749. if (select.props.multiple) {
  36750. return contains(modelValue, get(target, valueKey));
  36751. }
  36752. return isEqual(modelValue, get(target, valueKey));
  36753. };
  36754. const isItemDisabled = (modelValue, selected) => {
  36755. const {
  36756. disabled,
  36757. multiple,
  36758. multipleLimit
  36759. } = select.props;
  36760. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  36761. };
  36762. const isItemHovering = (target) => props.hoveringIndex === target;
  36763. const scrollToItem = (index) => {
  36764. const list = listRef.value;
  36765. if (list) {
  36766. list.scrollToItem(index);
  36767. }
  36768. };
  36769. const resetScrollTop = () => {
  36770. const list = listRef.value;
  36771. if (list) {
  36772. list.resetScrollTop();
  36773. }
  36774. };
  36775. expose({
  36776. listRef,
  36777. isSized,
  36778. isItemDisabled,
  36779. isItemHovering,
  36780. isItemSelected,
  36781. scrollToItem,
  36782. resetScrollTop
  36783. });
  36784. const Item = (itemProps) => {
  36785. const {
  36786. index,
  36787. data,
  36788. style
  36789. } = itemProps;
  36790. const sized = vue.unref(isSized);
  36791. const {
  36792. itemSize,
  36793. estimatedSize
  36794. } = vue.unref(listProps);
  36795. const {
  36796. modelValue
  36797. } = select.props;
  36798. const {
  36799. onSelect,
  36800. onHover
  36801. } = select;
  36802. const item = data[index];
  36803. if (item.type === "Group") {
  36804. return vue.createVNode(GroupItem, {
  36805. "item": item,
  36806. "style": style,
  36807. "height": sized ? itemSize : estimatedSize
  36808. }, null);
  36809. }
  36810. const isSelected = isItemSelected(modelValue, item);
  36811. const isDisabled = isItemDisabled(modelValue, isSelected);
  36812. const isHovering = isItemHovering(index);
  36813. return vue.createVNode(OptionItem, vue.mergeProps(itemProps, {
  36814. "selected": isSelected,
  36815. "disabled": item.disabled || isDisabled,
  36816. "created": !!item.created,
  36817. "hovering": isHovering,
  36818. "item": item,
  36819. "onSelect": onSelect,
  36820. "onHover": onHover
  36821. }), {
  36822. default: (props2) => {
  36823. var _a;
  36824. return ((_a = slots.default) == null ? void 0 : _a.call(slots, props2)) || vue.createVNode("span", null, [item.label]);
  36825. }
  36826. });
  36827. };
  36828. const {
  36829. onKeyboardNavigate,
  36830. onKeyboardSelect
  36831. } = select;
  36832. const onForward = () => {
  36833. onKeyboardNavigate("forward");
  36834. };
  36835. const onBackward = () => {
  36836. onKeyboardNavigate("backward");
  36837. };
  36838. const onEscOrTab = () => {
  36839. select.expanded = false;
  36840. };
  36841. const onKeydown = (e) => {
  36842. const {
  36843. code
  36844. } = e;
  36845. const {
  36846. tab,
  36847. esc,
  36848. down,
  36849. up,
  36850. enter
  36851. } = EVENT_CODE;
  36852. if (code !== tab) {
  36853. e.preventDefault();
  36854. e.stopPropagation();
  36855. }
  36856. switch (code) {
  36857. case tab:
  36858. case esc: {
  36859. onEscOrTab();
  36860. break;
  36861. }
  36862. case down: {
  36863. onForward();
  36864. break;
  36865. }
  36866. case up: {
  36867. onBackward();
  36868. break;
  36869. }
  36870. case enter: {
  36871. onKeyboardSelect();
  36872. break;
  36873. }
  36874. }
  36875. };
  36876. return () => {
  36877. var _a;
  36878. const {
  36879. data,
  36880. width
  36881. } = props;
  36882. const {
  36883. height,
  36884. multiple,
  36885. scrollbarAlwaysOn
  36886. } = select.props;
  36887. if (data.length === 0) {
  36888. return vue.createVNode("div", {
  36889. "class": ns.b("dropdown"),
  36890. "style": {
  36891. width: `${width}px`
  36892. }
  36893. }, [(_a = slots.empty) == null ? void 0 : _a.call(slots)]);
  36894. }
  36895. const List = vue.unref(isSized) ? FixedSizeList$1 : DynamicSizeList$1;
  36896. return vue.createVNode("div", {
  36897. "class": [ns.b("dropdown"), ns.is("multiple", multiple)]
  36898. }, [vue.createVNode(List, vue.mergeProps({
  36899. "ref": listRef
  36900. }, vue.unref(listProps), {
  36901. "className": ns.be("dropdown", "list"),
  36902. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  36903. "data": data,
  36904. "height": height,
  36905. "width": width,
  36906. "total": data.length,
  36907. "onKeydown": onKeydown
  36908. }), {
  36909. default: (props2) => vue.createVNode(Item, props2, null)
  36910. })]);
  36911. };
  36912. }
  36913. });
  36914. function useAllowCreate(props, states) {
  36915. const createOptionCount = vue.ref(0);
  36916. const cachedSelectedOption = vue.ref(null);
  36917. const enableAllowCreateMode = vue.computed(() => {
  36918. return props.allowCreate && props.filterable;
  36919. });
  36920. function hasExistingOption(query) {
  36921. const hasValue = (option) => option.value === query;
  36922. return props.options && props.options.some(hasValue) || states.createdOptions.some(hasValue);
  36923. }
  36924. function selectNewOption(option) {
  36925. if (!enableAllowCreateMode.value) {
  36926. return;
  36927. }
  36928. if (props.multiple && option.created) {
  36929. createOptionCount.value++;
  36930. } else {
  36931. cachedSelectedOption.value = option;
  36932. }
  36933. }
  36934. function createNewOption(query) {
  36935. if (enableAllowCreateMode.value) {
  36936. if (query && query.length > 0 && !hasExistingOption(query)) {
  36937. const newOption = {
  36938. value: query,
  36939. label: query,
  36940. created: true,
  36941. disabled: false
  36942. };
  36943. if (states.createdOptions.length >= createOptionCount.value) {
  36944. states.createdOptions[createOptionCount.value] = newOption;
  36945. } else {
  36946. states.createdOptions.push(newOption);
  36947. }
  36948. } else {
  36949. if (props.multiple) {
  36950. states.createdOptions.length = createOptionCount.value;
  36951. } else {
  36952. const selectedOption = cachedSelectedOption.value;
  36953. states.createdOptions.length = 0;
  36954. if (selectedOption && selectedOption.created) {
  36955. states.createdOptions.push(selectedOption);
  36956. }
  36957. }
  36958. }
  36959. }
  36960. }
  36961. function removeNewOption(option) {
  36962. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === option.label) {
  36963. return;
  36964. }
  36965. const idx = states.createdOptions.findIndex((it) => it.value === option.value);
  36966. if (~idx) {
  36967. states.createdOptions.splice(idx, 1);
  36968. createOptionCount.value--;
  36969. }
  36970. }
  36971. function clearAllNewOption() {
  36972. if (enableAllowCreateMode.value) {
  36973. states.createdOptions.length = 0;
  36974. createOptionCount.value = 0;
  36975. }
  36976. }
  36977. return {
  36978. createNewOption,
  36979. removeNewOption,
  36980. selectNewOption,
  36981. clearAllNewOption
  36982. };
  36983. }
  36984. const flattenOptions = (options) => {
  36985. const flattened = [];
  36986. options.forEach((option) => {
  36987. if (isArray(option.options)) {
  36988. flattened.push({
  36989. label: option.label,
  36990. isTitle: true,
  36991. type: "Group"
  36992. });
  36993. option.options.forEach((o) => {
  36994. flattened.push(o);
  36995. });
  36996. flattened.push({
  36997. type: "Group"
  36998. });
  36999. } else {
  37000. flattened.push(option);
  37001. }
  37002. });
  37003. return flattened;
  37004. };
  37005. function useInput(handleInput) {
  37006. const isComposing = vue.ref(false);
  37007. const handleCompositionStart = () => {
  37008. isComposing.value = true;
  37009. };
  37010. const handleCompositionUpdate = (event) => {
  37011. const text = event.target.value;
  37012. const lastCharacter = text[text.length - 1] || "";
  37013. isComposing.value = !isKorean(lastCharacter);
  37014. };
  37015. const handleCompositionEnd = (event) => {
  37016. if (isComposing.value) {
  37017. isComposing.value = false;
  37018. if (isFunction(handleInput)) {
  37019. handleInput(event);
  37020. }
  37021. }
  37022. };
  37023. return {
  37024. handleCompositionStart,
  37025. handleCompositionUpdate,
  37026. handleCompositionEnd
  37027. };
  37028. }
  37029. const DEFAULT_INPUT_PLACEHOLDER = "";
  37030. const MINIMUM_INPUT_WIDTH = 11;
  37031. const TAG_BASE_WIDTH = {
  37032. larget: 51,
  37033. default: 42,
  37034. small: 33
  37035. };
  37036. const useSelect$1 = (props, emit) => {
  37037. const { t } = useLocale();
  37038. const nsSelectV2 = useNamespace("select-v2");
  37039. const nsInput = useNamespace("input");
  37040. const { form: elForm, formItem: elFormItem } = useFormItem();
  37041. const states = vue.reactive({
  37042. inputValue: DEFAULT_INPUT_PLACEHOLDER,
  37043. displayInputValue: DEFAULT_INPUT_PLACEHOLDER,
  37044. calculatedWidth: 0,
  37045. cachedPlaceholder: "",
  37046. cachedOptions: [],
  37047. createdOptions: [],
  37048. createdLabel: "",
  37049. createdSelected: false,
  37050. currentPlaceholder: "",
  37051. hoveringIndex: -1,
  37052. comboBoxHovering: false,
  37053. isOnComposition: false,
  37054. isSilentBlur: false,
  37055. isComposing: false,
  37056. inputLength: 20,
  37057. selectWidth: 200,
  37058. initialInputHeight: 0,
  37059. previousQuery: null,
  37060. previousValue: void 0,
  37061. query: "",
  37062. selectedLabel: "",
  37063. softFocus: false,
  37064. tagInMultiLine: false
  37065. });
  37066. const selectedIndex = vue.ref(-1);
  37067. const popperSize = vue.ref(-1);
  37068. const controlRef = vue.ref(null);
  37069. const inputRef = vue.ref(null);
  37070. const menuRef = vue.ref(null);
  37071. const popper = vue.ref(null);
  37072. const selectRef = vue.ref(null);
  37073. const selectionRef = vue.ref(null);
  37074. const calculatorRef = vue.ref(null);
  37075. const expanded = vue.ref(false);
  37076. const selectDisabled = vue.computed(() => props.disabled || (elForm == null ? void 0 : elForm.disabled));
  37077. const popupHeight = vue.computed(() => {
  37078. const totalHeight = filteredOptions.value.length * 34;
  37079. return totalHeight > props.height ? props.height : totalHeight;
  37080. });
  37081. const hasModelValue = vue.computed(() => {
  37082. return !isNil(props.modelValue);
  37083. });
  37084. const showClearBtn = vue.computed(() => {
  37085. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : hasModelValue.value;
  37086. const criteria = props.clearable && !selectDisabled.value && states.comboBoxHovering && hasValue;
  37087. return criteria;
  37088. });
  37089. const iconComponent = vue.computed(() => props.remote && props.filterable ? "" : arrow_up_default);
  37090. const iconReverse = vue.computed(() => iconComponent.value && nsSelectV2.is("reverse", expanded.value));
  37091. const validateState = vue.computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
  37092. const validateIcon = vue.computed(() => ValidateComponentsMap[validateState.value]);
  37093. const debounce$1 = vue.computed(() => props.remote ? 300 : 0);
  37094. const emptyText = vue.computed(() => {
  37095. const options = filteredOptions.value;
  37096. if (props.loading) {
  37097. return props.loadingText || t("el.select.loading");
  37098. } else {
  37099. if (props.remote && states.inputValue === "" && options.length === 0)
  37100. return false;
  37101. if (props.filterable && states.inputValue && options.length > 0) {
  37102. return props.noMatchText || t("el.select.noMatch");
  37103. }
  37104. if (options.length === 0) {
  37105. return props.noDataText || t("el.select.noData");
  37106. }
  37107. }
  37108. return null;
  37109. });
  37110. const filteredOptions = vue.computed(() => {
  37111. const isValidOption = (o) => {
  37112. var _a;
  37113. const query = states.inputValue;
  37114. const containsQueryString = query ? (_a = o.label) == null ? void 0 : _a.includes(query) : true;
  37115. return containsQueryString;
  37116. };
  37117. if (props.loading) {
  37118. return [];
  37119. }
  37120. return flattenOptions(props.options.concat(states.createdOptions).map((v) => {
  37121. if (isArray(v.options)) {
  37122. const filtered = v.options.filter(isValidOption);
  37123. if (filtered.length > 0) {
  37124. return {
  37125. ...v,
  37126. options: filtered
  37127. };
  37128. }
  37129. } else {
  37130. if (props.remote || isValidOption(v)) {
  37131. return v;
  37132. }
  37133. }
  37134. return null;
  37135. }).filter((v) => v !== null));
  37136. });
  37137. const optionsAllDisabled = vue.computed(() => filteredOptions.value.every((option) => option.disabled));
  37138. const selectSize = useSize();
  37139. const collapseTagSize = vue.computed(() => selectSize.value === "small" ? "small" : "default");
  37140. const tagMaxWidth = vue.computed(() => {
  37141. const select = selectionRef.value;
  37142. const size = collapseTagSize.value || "default";
  37143. const paddingLeft = select ? Number.parseInt(getComputedStyle(select).paddingLeft) : 0;
  37144. const paddingRight = select ? Number.parseInt(getComputedStyle(select).paddingRight) : 0;
  37145. return states.selectWidth - paddingRight - paddingLeft - TAG_BASE_WIDTH[size];
  37146. });
  37147. const calculatePopperSize = () => {
  37148. var _a;
  37149. popperSize.value = ((_a = selectRef.value) == null ? void 0 : _a.offsetWidth) || 200;
  37150. };
  37151. const inputWrapperStyle = vue.computed(() => {
  37152. return {
  37153. width: `${states.calculatedWidth === 0 ? MINIMUM_INPUT_WIDTH : Math.ceil(states.calculatedWidth) + MINIMUM_INPUT_WIDTH}px`
  37154. };
  37155. });
  37156. const shouldShowPlaceholder = vue.computed(() => {
  37157. if (isArray(props.modelValue)) {
  37158. return props.modelValue.length === 0 && !states.displayInputValue;
  37159. }
  37160. return props.filterable ? states.displayInputValue.length === 0 : true;
  37161. });
  37162. const currentPlaceholder = vue.computed(() => {
  37163. const _placeholder = props.placeholder || t("el.select.placeholder");
  37164. return props.multiple || isNil(props.modelValue) ? _placeholder : states.selectedLabel;
  37165. });
  37166. const popperRef = vue.computed(() => {
  37167. var _a, _b;
  37168. return (_b = (_a = popper.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  37169. });
  37170. const indexRef = vue.computed(() => {
  37171. if (props.multiple) {
  37172. const len = props.modelValue.length;
  37173. if (props.modelValue.length > 0) {
  37174. return filteredOptions.value.findIndex((o) => o.value === props.modelValue[len - 1]);
  37175. }
  37176. } else {
  37177. if (props.modelValue) {
  37178. return filteredOptions.value.findIndex((o) => o.value === props.modelValue);
  37179. }
  37180. }
  37181. return -1;
  37182. });
  37183. const dropdownMenuVisible = vue.computed({
  37184. get() {
  37185. return expanded.value && emptyText.value !== false;
  37186. },
  37187. set(val) {
  37188. expanded.value = val;
  37189. }
  37190. });
  37191. const {
  37192. createNewOption,
  37193. removeNewOption,
  37194. selectNewOption,
  37195. clearAllNewOption
  37196. } = useAllowCreate(props, states);
  37197. const {
  37198. handleCompositionStart,
  37199. handleCompositionUpdate,
  37200. handleCompositionEnd
  37201. } = useInput((e) => onInput(e));
  37202. const focusAndUpdatePopup = () => {
  37203. var _a, _b, _c;
  37204. (_b = (_a = inputRef.value).focus) == null ? void 0 : _b.call(_a);
  37205. (_c = popper.value) == null ? void 0 : _c.updatePopper();
  37206. };
  37207. const toggleMenu = () => {
  37208. if (props.automaticDropdown)
  37209. return;
  37210. if (!selectDisabled.value) {
  37211. if (states.isComposing)
  37212. states.softFocus = true;
  37213. return vue.nextTick(() => {
  37214. var _a, _b;
  37215. expanded.value = !expanded.value;
  37216. (_b = (_a = inputRef.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  37217. });
  37218. }
  37219. };
  37220. const onInputChange = () => {
  37221. if (props.filterable && states.inputValue !== states.selectedLabel) {
  37222. states.query = states.selectedLabel;
  37223. }
  37224. handleQueryChange(states.inputValue);
  37225. return vue.nextTick(() => {
  37226. createNewOption(states.inputValue);
  37227. });
  37228. };
  37229. const debouncedOnInputChange = debounce(onInputChange, debounce$1.value);
  37230. const handleQueryChange = (val) => {
  37231. if (states.previousQuery === val) {
  37232. return;
  37233. }
  37234. states.previousQuery = val;
  37235. if (props.filterable && isFunction(props.filterMethod)) {
  37236. props.filterMethod(val);
  37237. } else if (props.filterable && props.remote && isFunction(props.remoteMethod)) {
  37238. props.remoteMethod(val);
  37239. }
  37240. };
  37241. const emitChange = (val) => {
  37242. if (!isEqual$1(props.modelValue, val)) {
  37243. emit(CHANGE_EVENT, val);
  37244. }
  37245. };
  37246. const update = (val) => {
  37247. emit(UPDATE_MODEL_EVENT, val);
  37248. emitChange(val);
  37249. states.previousValue = val == null ? void 0 : val.toString();
  37250. };
  37251. const getValueIndex = (arr = [], value) => {
  37252. if (!isObject$1(value)) {
  37253. return arr.indexOf(value);
  37254. }
  37255. const valueKey = props.valueKey;
  37256. let index = -1;
  37257. arr.some((item, i) => {
  37258. if (get(item, valueKey) === get(value, valueKey)) {
  37259. index = i;
  37260. return true;
  37261. }
  37262. return false;
  37263. });
  37264. return index;
  37265. };
  37266. const getValueKey = (item) => {
  37267. return isObject$1(item) ? get(item, props.valueKey) : item;
  37268. };
  37269. const getLabel = (item) => {
  37270. return isObject$1(item) ? item.label : item;
  37271. };
  37272. const resetInputHeight = () => {
  37273. if (props.collapseTags && !props.filterable) {
  37274. return;
  37275. }
  37276. return vue.nextTick(() => {
  37277. var _a, _b;
  37278. if (!inputRef.value)
  37279. return;
  37280. const selection = selectionRef.value;
  37281. selectRef.value.height = selection.offsetHeight;
  37282. if (expanded.value && emptyText.value !== false) {
  37283. (_b = (_a = popper.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  37284. }
  37285. });
  37286. };
  37287. const handleResize = () => {
  37288. var _a, _b;
  37289. resetInputWidth();
  37290. calculatePopperSize();
  37291. (_b = (_a = popper.value) == null ? void 0 : _a.updatePopper) == null ? void 0 : _b.call(_a);
  37292. if (props.multiple) {
  37293. return resetInputHeight();
  37294. }
  37295. };
  37296. const resetInputWidth = () => {
  37297. const select = selectionRef.value;
  37298. if (select) {
  37299. states.selectWidth = select.getBoundingClientRect().width;
  37300. }
  37301. };
  37302. const onSelect = (option, idx, byClick = true) => {
  37303. var _a, _b;
  37304. if (props.multiple) {
  37305. let selectedOptions = props.modelValue.slice();
  37306. const index = getValueIndex(selectedOptions, getValueKey(option));
  37307. if (index > -1) {
  37308. selectedOptions = [
  37309. ...selectedOptions.slice(0, index),
  37310. ...selectedOptions.slice(index + 1)
  37311. ];
  37312. states.cachedOptions.splice(index, 1);
  37313. removeNewOption(option);
  37314. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  37315. selectedOptions = [...selectedOptions, getValueKey(option)];
  37316. states.cachedOptions.push(option);
  37317. selectNewOption(option);
  37318. updateHoveringIndex(idx);
  37319. }
  37320. update(selectedOptions);
  37321. if (option.created) {
  37322. states.query = "";
  37323. handleQueryChange("");
  37324. states.inputLength = 20;
  37325. }
  37326. if (props.filterable && !props.reserveKeyword) {
  37327. (_b = (_a = inputRef.value).focus) == null ? void 0 : _b.call(_a);
  37328. onUpdateInputValue("");
  37329. }
  37330. if (props.filterable) {
  37331. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  37332. }
  37333. resetInputHeight();
  37334. setSoftFocus();
  37335. } else {
  37336. selectedIndex.value = idx;
  37337. states.selectedLabel = option.label;
  37338. update(getValueKey(option));
  37339. expanded.value = false;
  37340. states.isComposing = false;
  37341. states.isSilentBlur = byClick;
  37342. selectNewOption(option);
  37343. if (!option.created) {
  37344. clearAllNewOption();
  37345. }
  37346. updateHoveringIndex(idx);
  37347. }
  37348. };
  37349. const deleteTag = (event, tag) => {
  37350. const { valueKey } = props;
  37351. const index = props.modelValue.indexOf(get(tag, valueKey));
  37352. if (index > -1 && !selectDisabled.value) {
  37353. const value = [
  37354. ...props.modelValue.slice(0, index),
  37355. ...props.modelValue.slice(index + 1)
  37356. ];
  37357. states.cachedOptions.splice(index, 1);
  37358. update(value);
  37359. emit("remove-tag", get(tag, valueKey));
  37360. states.softFocus = true;
  37361. removeNewOption(tag);
  37362. return vue.nextTick(focusAndUpdatePopup);
  37363. }
  37364. event.stopPropagation();
  37365. };
  37366. const handleFocus = (event) => {
  37367. const focused = states.isComposing;
  37368. states.isComposing = true;
  37369. if (!states.softFocus) {
  37370. if (!focused)
  37371. emit("focus", event);
  37372. } else {
  37373. states.softFocus = false;
  37374. }
  37375. };
  37376. const handleBlur = (event) => {
  37377. states.softFocus = false;
  37378. return vue.nextTick(() => {
  37379. var _a, _b;
  37380. (_b = (_a = inputRef.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  37381. if (calculatorRef.value) {
  37382. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  37383. }
  37384. if (states.isSilentBlur) {
  37385. states.isSilentBlur = false;
  37386. } else {
  37387. if (states.isComposing) {
  37388. emit("blur", event);
  37389. }
  37390. }
  37391. states.isComposing = false;
  37392. });
  37393. };
  37394. const handleEsc = () => {
  37395. if (states.displayInputValue.length > 0) {
  37396. onUpdateInputValue("");
  37397. } else {
  37398. expanded.value = false;
  37399. }
  37400. };
  37401. const handleDel = (e) => {
  37402. if (states.displayInputValue.length === 0) {
  37403. e.preventDefault();
  37404. const selected = props.modelValue.slice();
  37405. selected.pop();
  37406. removeNewOption(states.cachedOptions.pop());
  37407. update(selected);
  37408. }
  37409. };
  37410. const handleClear = () => {
  37411. let emptyValue;
  37412. if (isArray(props.modelValue)) {
  37413. emptyValue = [];
  37414. } else {
  37415. emptyValue = void 0;
  37416. }
  37417. states.softFocus = true;
  37418. if (props.multiple) {
  37419. states.cachedOptions = [];
  37420. } else {
  37421. states.selectedLabel = "";
  37422. }
  37423. expanded.value = false;
  37424. update(emptyValue);
  37425. emit("clear");
  37426. clearAllNewOption();
  37427. return vue.nextTick(focusAndUpdatePopup);
  37428. };
  37429. const onUpdateInputValue = (val) => {
  37430. states.displayInputValue = val;
  37431. states.inputValue = val;
  37432. };
  37433. const onKeyboardNavigate = (direction, hoveringIndex = void 0) => {
  37434. const options = filteredOptions.value;
  37435. if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value) {
  37436. return;
  37437. }
  37438. if (!expanded.value) {
  37439. return toggleMenu();
  37440. }
  37441. if (hoveringIndex === void 0) {
  37442. hoveringIndex = states.hoveringIndex;
  37443. }
  37444. let newIndex = -1;
  37445. if (direction === "forward") {
  37446. newIndex = hoveringIndex + 1;
  37447. if (newIndex >= options.length) {
  37448. newIndex = 0;
  37449. }
  37450. } else if (direction === "backward") {
  37451. newIndex = hoveringIndex - 1;
  37452. if (newIndex < 0 || newIndex >= options.length) {
  37453. newIndex = options.length - 1;
  37454. }
  37455. }
  37456. const option = options[newIndex];
  37457. if (option.disabled || option.type === "Group") {
  37458. return onKeyboardNavigate(direction, newIndex);
  37459. } else {
  37460. updateHoveringIndex(newIndex);
  37461. scrollToItem(newIndex);
  37462. }
  37463. };
  37464. const onKeyboardSelect = () => {
  37465. if (!expanded.value) {
  37466. return toggleMenu();
  37467. } else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) {
  37468. onSelect(filteredOptions.value[states.hoveringIndex], states.hoveringIndex, false);
  37469. }
  37470. };
  37471. const updateHoveringIndex = (idx) => {
  37472. states.hoveringIndex = idx;
  37473. };
  37474. const resetHoveringIndex = () => {
  37475. states.hoveringIndex = -1;
  37476. };
  37477. const setSoftFocus = () => {
  37478. var _a;
  37479. const _input = inputRef.value;
  37480. if (_input) {
  37481. (_a = _input.focus) == null ? void 0 : _a.call(_input);
  37482. }
  37483. };
  37484. const onInput = (event) => {
  37485. const value = event.target.value;
  37486. onUpdateInputValue(value);
  37487. if (states.displayInputValue.length > 0 && !expanded.value) {
  37488. expanded.value = true;
  37489. }
  37490. states.calculatedWidth = calculatorRef.value.getBoundingClientRect().width;
  37491. if (props.multiple) {
  37492. resetInputHeight();
  37493. }
  37494. if (props.remote) {
  37495. debouncedOnInputChange();
  37496. } else {
  37497. return onInputChange();
  37498. }
  37499. };
  37500. const handleClickOutside = () => {
  37501. expanded.value = false;
  37502. return handleBlur();
  37503. };
  37504. const handleMenuEnter = () => {
  37505. states.inputValue = states.displayInputValue;
  37506. return vue.nextTick(() => {
  37507. if (~indexRef.value) {
  37508. updateHoveringIndex(indexRef.value);
  37509. scrollToItem(states.hoveringIndex);
  37510. }
  37511. });
  37512. };
  37513. const scrollToItem = (index) => {
  37514. menuRef.value.scrollToItem(index);
  37515. };
  37516. const initStates = () => {
  37517. resetHoveringIndex();
  37518. if (props.multiple) {
  37519. if (props.modelValue.length > 0) {
  37520. let initHovering = false;
  37521. states.cachedOptions.length = 0;
  37522. states.previousValue = props.modelValue.toString();
  37523. props.modelValue.forEach((selected) => {
  37524. const itemIndex = filteredOptions.value.findIndex((option) => getValueKey(option) === selected);
  37525. if (~itemIndex) {
  37526. states.cachedOptions.push(filteredOptions.value[itemIndex]);
  37527. if (!initHovering) {
  37528. updateHoveringIndex(itemIndex);
  37529. }
  37530. initHovering = true;
  37531. }
  37532. });
  37533. } else {
  37534. states.cachedOptions = [];
  37535. states.previousValue = void 0;
  37536. }
  37537. } else {
  37538. if (hasModelValue.value) {
  37539. states.previousValue = props.modelValue;
  37540. const options = filteredOptions.value;
  37541. const selectedItemIndex = options.findIndex((option) => getValueKey(option) === getValueKey(props.modelValue));
  37542. if (~selectedItemIndex) {
  37543. states.selectedLabel = options[selectedItemIndex].label;
  37544. updateHoveringIndex(selectedItemIndex);
  37545. } else {
  37546. states.selectedLabel = `${props.modelValue}`;
  37547. }
  37548. } else {
  37549. states.selectedLabel = "";
  37550. states.previousValue = void 0;
  37551. }
  37552. }
  37553. clearAllNewOption();
  37554. calculatePopperSize();
  37555. };
  37556. vue.watch(expanded, (val) => {
  37557. var _a, _b;
  37558. emit("visible-change", val);
  37559. if (val) {
  37560. (_b = (_a = popper.value).update) == null ? void 0 : _b.call(_a);
  37561. } else {
  37562. states.displayInputValue = "";
  37563. states.previousQuery = null;
  37564. createNewOption("");
  37565. }
  37566. });
  37567. vue.watch(() => props.modelValue, (val, oldVal) => {
  37568. var _a;
  37569. if (!val || val.toString() !== states.previousValue) {
  37570. initStates();
  37571. }
  37572. if (!isEqual$1(val, oldVal) && props.validateEvent) {
  37573. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  37574. }
  37575. }, {
  37576. deep: true
  37577. });
  37578. vue.watch(() => props.options, () => {
  37579. const input = inputRef.value;
  37580. if (!input || input && document.activeElement !== input) {
  37581. initStates();
  37582. }
  37583. }, {
  37584. deep: true
  37585. });
  37586. vue.watch(filteredOptions, () => {
  37587. return vue.nextTick(menuRef.value.resetScrollTop);
  37588. });
  37589. vue.onMounted(() => {
  37590. initStates();
  37591. });
  37592. useResizeObserver(selectRef, handleResize);
  37593. return {
  37594. collapseTagSize,
  37595. currentPlaceholder,
  37596. expanded,
  37597. emptyText,
  37598. popupHeight,
  37599. debounce: debounce$1,
  37600. filteredOptions,
  37601. iconComponent,
  37602. iconReverse,
  37603. inputWrapperStyle,
  37604. popperSize,
  37605. dropdownMenuVisible,
  37606. hasModelValue,
  37607. shouldShowPlaceholder,
  37608. selectDisabled,
  37609. selectSize,
  37610. showClearBtn,
  37611. states,
  37612. tagMaxWidth,
  37613. nsSelectV2,
  37614. nsInput,
  37615. calculatorRef,
  37616. controlRef,
  37617. inputRef,
  37618. menuRef,
  37619. popper,
  37620. selectRef,
  37621. selectionRef,
  37622. popperRef,
  37623. validateState,
  37624. validateIcon,
  37625. debouncedOnInputChange,
  37626. deleteTag,
  37627. getLabel,
  37628. getValueKey,
  37629. handleBlur,
  37630. handleClear,
  37631. handleClickOutside,
  37632. handleDel,
  37633. handleEsc,
  37634. handleFocus,
  37635. handleMenuEnter,
  37636. handleResize,
  37637. toggleMenu,
  37638. scrollTo: scrollToItem,
  37639. onInput,
  37640. onKeyboardNavigate,
  37641. onKeyboardSelect,
  37642. onSelect,
  37643. onHover: updateHoveringIndex,
  37644. onUpdateInputValue,
  37645. handleCompositionStart,
  37646. handleCompositionEnd,
  37647. handleCompositionUpdate
  37648. };
  37649. };
  37650. var useSelect$2 = useSelect$1;
  37651. const _sfc_main$y = vue.defineComponent({
  37652. name: "ElSelectV2",
  37653. components: {
  37654. ElSelectMenu,
  37655. ElTag,
  37656. ElTooltip,
  37657. ElIcon
  37658. },
  37659. directives: { ClickOutside, ModelText: vue.vModelText },
  37660. props: SelectProps,
  37661. emits: [
  37662. UPDATE_MODEL_EVENT,
  37663. CHANGE_EVENT,
  37664. "remove-tag",
  37665. "clear",
  37666. "visible-change",
  37667. "focus",
  37668. "blur"
  37669. ],
  37670. setup(props, { emit }) {
  37671. const API = useSelect$2(props, emit);
  37672. vue.provide(selectV2InjectionKey, {
  37673. props: vue.reactive({
  37674. ...vue.toRefs(props),
  37675. height: API.popupHeight
  37676. }),
  37677. popper: API.popper,
  37678. onSelect: API.onSelect,
  37679. onHover: API.onHover,
  37680. onKeyboardNavigate: API.onKeyboardNavigate,
  37681. onKeyboardSelect: API.onKeyboardSelect
  37682. });
  37683. return API;
  37684. }
  37685. });
  37686. const _hoisted_1$g = { key: 0 };
  37687. const _hoisted_2$b = ["id", "autocomplete", "aria-expanded", "aria-labelledby", "disabled", "readonly", "name", "unselectable"];
  37688. const _hoisted_3$5 = ["textContent"];
  37689. const _hoisted_4$3 = ["id", "aria-labelledby", "aria-expanded", "autocomplete", "disabled", "name", "readonly", "unselectable"];
  37690. const _hoisted_5$2 = ["textContent"];
  37691. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  37692. const _component_el_tag = vue.resolveComponent("el-tag");
  37693. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  37694. const _component_el_icon = vue.resolveComponent("el-icon");
  37695. const _component_el_select_menu = vue.resolveComponent("el-select-menu");
  37696. const _directive_model_text = vue.resolveDirective("model-text");
  37697. const _directive_click_outside = vue.resolveDirective("click-outside");
  37698. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  37699. ref: "selectRef",
  37700. class: vue.normalizeClass([_ctx.nsSelectV2.b(), _ctx.nsSelectV2.m(_ctx.selectSize)]),
  37701. onClick: _cache[25] || (_cache[25] = vue.withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"])),
  37702. onMouseenter: _cache[26] || (_cache[26] = ($event) => _ctx.states.comboBoxHovering = true),
  37703. onMouseleave: _cache[27] || (_cache[27] = ($event) => _ctx.states.comboBoxHovering = false)
  37704. }, [
  37705. vue.createVNode(_component_el_tooltip, {
  37706. ref: "popper",
  37707. visible: _ctx.dropdownMenuVisible,
  37708. teleported: _ctx.teleported,
  37709. "popper-class": [_ctx.nsSelectV2.e("popper"), _ctx.popperClass],
  37710. "gpu-acceleration": false,
  37711. "stop-popper-mouse-event": false,
  37712. "popper-options": _ctx.popperOptions,
  37713. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  37714. effect: _ctx.effect,
  37715. placement: _ctx.placement,
  37716. pure: "",
  37717. transition: `${_ctx.nsSelectV2.namespace.value}-zoom-in-top`,
  37718. trigger: "click",
  37719. persistent: _ctx.persistent,
  37720. onBeforeShow: _ctx.handleMenuEnter,
  37721. onHide: _cache[24] || (_cache[24] = ($event) => _ctx.states.inputValue = _ctx.states.displayInputValue)
  37722. }, {
  37723. default: vue.withCtx(() => {
  37724. var _a;
  37725. return [
  37726. vue.createElementVNode("div", {
  37727. ref: "selectionRef",
  37728. class: vue.normalizeClass([
  37729. _ctx.nsSelectV2.e("wrapper"),
  37730. _ctx.nsSelectV2.is("focused", _ctx.states.isComposing || _ctx.expanded),
  37731. _ctx.nsSelectV2.is("hovering", _ctx.states.comboBoxHovering),
  37732. _ctx.nsSelectV2.is("filterable", _ctx.filterable),
  37733. _ctx.nsSelectV2.is("disabled", _ctx.selectDisabled)
  37734. ])
  37735. }, [
  37736. _ctx.$slots.prefix ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
  37737. vue.renderSlot(_ctx.$slots, "prefix")
  37738. ])) : vue.createCommentVNode("v-if", true),
  37739. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", {
  37740. key: 1,
  37741. class: vue.normalizeClass(_ctx.nsSelectV2.e("selection"))
  37742. }, [
  37743. _ctx.collapseTags && _ctx.modelValue.length > 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  37744. key: 0,
  37745. class: vue.normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  37746. }, [
  37747. vue.createVNode(_component_el_tag, {
  37748. closable: !_ctx.selectDisabled && !((_a = _ctx.states.cachedOptions[0]) == null ? void 0 : _a.disable),
  37749. size: _ctx.collapseTagSize,
  37750. type: "info",
  37751. "disable-transitions": "",
  37752. onClose: _cache[0] || (_cache[0] = ($event) => _ctx.deleteTag($event, _ctx.states.cachedOptions[0]))
  37753. }, {
  37754. default: vue.withCtx(() => {
  37755. var _a2;
  37756. return [
  37757. vue.createElementVNode("span", {
  37758. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  37759. style: vue.normalizeStyle({
  37760. maxWidth: `${_ctx.tagMaxWidth}px`
  37761. })
  37762. }, vue.toDisplayString((_a2 = _ctx.states.cachedOptions[0]) == null ? void 0 : _a2.label), 7)
  37763. ];
  37764. }),
  37765. _: 1
  37766. }, 8, ["closable", "size"]),
  37767. _ctx.modelValue.length > 1 ? (vue.openBlock(), vue.createBlock(_component_el_tag, {
  37768. key: 0,
  37769. closable: false,
  37770. size: _ctx.collapseTagSize,
  37771. type: "info",
  37772. "disable-transitions": ""
  37773. }, {
  37774. default: vue.withCtx(() => [
  37775. _ctx.collapseTagsTooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  37776. key: 0,
  37777. disabled: _ctx.dropdownMenuVisible,
  37778. "fallback-placements": ["bottom", "top", "right", "left"],
  37779. effect: _ctx.effect,
  37780. placement: "bottom",
  37781. teleported: false
  37782. }, {
  37783. default: vue.withCtx(() => [
  37784. vue.createElementVNode("span", {
  37785. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  37786. style: vue.normalizeStyle({
  37787. maxWidth: `${_ctx.tagMaxWidth}px`
  37788. })
  37789. }, "+ " + vue.toDisplayString(_ctx.modelValue.length - 1), 7)
  37790. ]),
  37791. content: vue.withCtx(() => [
  37792. vue.createElementVNode("div", {
  37793. class: vue.normalizeClass(_ctx.nsSelectV2.e("selection"))
  37794. }, [
  37795. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.states.cachedOptions.slice(1), (selected, idx) => {
  37796. return vue.openBlock(), vue.createElementBlock("div", {
  37797. key: idx,
  37798. class: vue.normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  37799. }, [
  37800. (vue.openBlock(), vue.createBlock(_component_el_tag, {
  37801. key: _ctx.getValueKey(selected),
  37802. closable: !_ctx.selectDisabled && !selected.disabled,
  37803. size: _ctx.collapseTagSize,
  37804. class: "in-tooltip",
  37805. type: "info",
  37806. "disable-transitions": "",
  37807. onClose: ($event) => _ctx.deleteTag($event, selected)
  37808. }, {
  37809. default: vue.withCtx(() => [
  37810. vue.createElementVNode("span", {
  37811. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  37812. style: vue.normalizeStyle({
  37813. maxWidth: `${_ctx.tagMaxWidth}px`
  37814. })
  37815. }, vue.toDisplayString(_ctx.getLabel(selected)), 7)
  37816. ]),
  37817. _: 2
  37818. }, 1032, ["closable", "size", "onClose"]))
  37819. ], 2);
  37820. }), 128))
  37821. ], 2)
  37822. ]),
  37823. _: 1
  37824. }, 8, ["disabled", "effect"])) : (vue.openBlock(), vue.createElementBlock("span", {
  37825. key: 1,
  37826. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  37827. style: vue.normalizeStyle({
  37828. maxWidth: `${_ctx.tagMaxWidth}px`
  37829. })
  37830. }, "+ " + vue.toDisplayString(_ctx.modelValue.length - 1), 7))
  37831. ]),
  37832. _: 1
  37833. }, 8, ["size"])) : vue.createCommentVNode("v-if", true)
  37834. ], 2)) : (vue.openBlock(true), vue.createElementBlock(vue.Fragment, { key: 1 }, vue.renderList(_ctx.states.cachedOptions, (selected, idx) => {
  37835. return vue.openBlock(), vue.createElementBlock("div", {
  37836. key: idx,
  37837. class: vue.normalizeClass(_ctx.nsSelectV2.e("selected-item"))
  37838. }, [
  37839. (vue.openBlock(), vue.createBlock(_component_el_tag, {
  37840. key: _ctx.getValueKey(selected),
  37841. closable: !_ctx.selectDisabled && !selected.disabled,
  37842. size: _ctx.collapseTagSize,
  37843. type: "info",
  37844. "disable-transitions": "",
  37845. onClose: ($event) => _ctx.deleteTag($event, selected)
  37846. }, {
  37847. default: vue.withCtx(() => [
  37848. vue.createElementVNode("span", {
  37849. class: vue.normalizeClass(_ctx.nsSelectV2.e("tags-text")),
  37850. style: vue.normalizeStyle({
  37851. maxWidth: `${_ctx.tagMaxWidth}px`
  37852. })
  37853. }, vue.toDisplayString(_ctx.getLabel(selected)), 7)
  37854. ]),
  37855. _: 2
  37856. }, 1032, ["closable", "size", "onClose"]))
  37857. ], 2);
  37858. }), 128)),
  37859. vue.createElementVNode("div", {
  37860. class: vue.normalizeClass([
  37861. _ctx.nsSelectV2.e("selected-item"),
  37862. _ctx.nsSelectV2.e("input-wrapper")
  37863. ]),
  37864. style: vue.normalizeStyle(_ctx.inputWrapperStyle)
  37865. }, [
  37866. vue.withDirectives(vue.createElementVNode("input", {
  37867. id: _ctx.id,
  37868. ref: "inputRef",
  37869. autocomplete: _ctx.autocomplete,
  37870. "aria-autocomplete": "list",
  37871. "aria-haspopup": "listbox",
  37872. autocapitalize: "off",
  37873. "aria-expanded": _ctx.expanded,
  37874. "aria-labelledby": _ctx.label,
  37875. class: vue.normalizeClass([
  37876. _ctx.nsSelectV2.is(_ctx.selectSize),
  37877. _ctx.nsSelectV2.e("combobox-input")
  37878. ]),
  37879. disabled: _ctx.disabled,
  37880. role: "combobox",
  37881. readonly: !_ctx.filterable,
  37882. spellcheck: "false",
  37883. type: "text",
  37884. name: _ctx.name,
  37885. unselectable: _ctx.expanded ? "on" : void 0,
  37886. "onUpdate:modelValue": _cache[1] || (_cache[1] = (...args) => _ctx.onUpdateInputValue && _ctx.onUpdateInputValue(...args)),
  37887. onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  37888. onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  37889. onInput: _cache[4] || (_cache[4] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  37890. onCompositionstart: _cache[5] || (_cache[5] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  37891. onCompositionupdate: _cache[6] || (_cache[6] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  37892. onCompositionend: _cache[7] || (_cache[7] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  37893. onKeydown: [
  37894. _cache[8] || (_cache[8] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
  37895. _cache[9] || (_cache[9] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
  37896. _cache[10] || (_cache[10] = vue.withKeys(vue.withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])),
  37897. _cache[11] || (_cache[11] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"])),
  37898. _cache[12] || (_cache[12] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleDel && _ctx.handleDel(...args), ["stop"]), ["delete"]))
  37899. ]
  37900. }, null, 42, _hoisted_2$b), [
  37901. [_directive_model_text, _ctx.states.displayInputValue]
  37902. ]),
  37903. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  37904. key: 0,
  37905. ref: "calculatorRef",
  37906. "aria-hidden": "true",
  37907. class: vue.normalizeClass(_ctx.nsSelectV2.e("input-calculator")),
  37908. textContent: vue.toDisplayString(_ctx.states.displayInputValue)
  37909. }, null, 10, _hoisted_3$5)) : vue.createCommentVNode("v-if", true)
  37910. ], 6)
  37911. ], 2)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  37912. vue.createElementVNode("div", {
  37913. class: vue.normalizeClass([
  37914. _ctx.nsSelectV2.e("selected-item"),
  37915. _ctx.nsSelectV2.e("input-wrapper")
  37916. ])
  37917. }, [
  37918. vue.withDirectives(vue.createElementVNode("input", {
  37919. id: _ctx.id,
  37920. ref: "inputRef",
  37921. "aria-autocomplete": "list",
  37922. "aria-haspopup": "listbox",
  37923. "aria-labelledby": _ctx.label,
  37924. "aria-expanded": _ctx.expanded,
  37925. autocapitalize: "off",
  37926. autocomplete: _ctx.autocomplete,
  37927. class: vue.normalizeClass(_ctx.nsSelectV2.e("combobox-input")),
  37928. disabled: _ctx.disabled,
  37929. name: _ctx.name,
  37930. role: "combobox",
  37931. readonly: !_ctx.filterable,
  37932. spellcheck: "false",
  37933. type: "text",
  37934. unselectable: _ctx.expanded ? "on" : void 0,
  37935. onCompositionstart: _cache[13] || (_cache[13] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  37936. onCompositionupdate: _cache[14] || (_cache[14] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  37937. onCompositionend: _cache[15] || (_cache[15] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  37938. onFocus: _cache[16] || (_cache[16] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  37939. onBlur: _cache[17] || (_cache[17] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  37940. onInput: _cache[18] || (_cache[18] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  37941. onKeydown: [
  37942. _cache[19] || (_cache[19] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
  37943. _cache[20] || (_cache[20] = vue.withKeys(vue.withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
  37944. _cache[21] || (_cache[21] = vue.withKeys(vue.withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])),
  37945. _cache[22] || (_cache[22] = vue.withKeys(vue.withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"]))
  37946. ],
  37947. "onUpdate:modelValue": _cache[23] || (_cache[23] = (...args) => _ctx.onUpdateInputValue && _ctx.onUpdateInputValue(...args))
  37948. }, null, 42, _hoisted_4$3), [
  37949. [_directive_model_text, _ctx.states.displayInputValue]
  37950. ])
  37951. ], 2),
  37952. _ctx.filterable ? (vue.openBlock(), vue.createElementBlock("span", {
  37953. key: 0,
  37954. ref: "calculatorRef",
  37955. "aria-hidden": "true",
  37956. class: vue.normalizeClass([
  37957. _ctx.nsSelectV2.e("selected-item"),
  37958. _ctx.nsSelectV2.e("input-calculator")
  37959. ]),
  37960. textContent: vue.toDisplayString(_ctx.states.displayInputValue)
  37961. }, null, 10, _hoisted_5$2)) : vue.createCommentVNode("v-if", true)
  37962. ], 64)),
  37963. _ctx.shouldShowPlaceholder ? (vue.openBlock(), vue.createElementBlock("span", {
  37964. key: 3,
  37965. class: vue.normalizeClass([
  37966. _ctx.nsSelectV2.e("placeholder"),
  37967. _ctx.nsSelectV2.is("transparent", _ctx.multiple ? _ctx.modelValue.length === 0 : !_ctx.hasModelValue)
  37968. ])
  37969. }, vue.toDisplayString(_ctx.currentPlaceholder), 3)) : vue.createCommentVNode("v-if", true),
  37970. vue.createElementVNode("span", {
  37971. class: vue.normalizeClass(_ctx.nsSelectV2.e("suffix"))
  37972. }, [
  37973. _ctx.iconComponent ? vue.withDirectives((vue.openBlock(), vue.createBlock(_component_el_icon, {
  37974. key: 0,
  37975. class: vue.normalizeClass([_ctx.nsSelectV2.e("caret"), _ctx.nsInput.e("icon"), _ctx.iconReverse])
  37976. }, {
  37977. default: vue.withCtx(() => [
  37978. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  37979. ]),
  37980. _: 1
  37981. }, 8, ["class"])), [
  37982. [vue.vShow, !_ctx.showClearBtn]
  37983. ]) : vue.createCommentVNode("v-if", true),
  37984. _ctx.showClearBtn && _ctx.clearIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  37985. key: 1,
  37986. class: vue.normalizeClass([_ctx.nsSelectV2.e("caret"), _ctx.nsInput.e("icon")]),
  37987. onClick: vue.withModifiers(_ctx.handleClear, ["prevent", "stop"])
  37988. }, {
  37989. default: vue.withCtx(() => [
  37990. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.clearIcon)))
  37991. ]),
  37992. _: 1
  37993. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  37994. _ctx.validateState && _ctx.validateIcon ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  37995. key: 2,
  37996. class: vue.normalizeClass([_ctx.nsInput.e("icon"), _ctx.nsInput.e("validateIcon")])
  37997. }, {
  37998. default: vue.withCtx(() => [
  37999. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.validateIcon)))
  38000. ]),
  38001. _: 1
  38002. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  38003. ], 2)
  38004. ], 2)
  38005. ];
  38006. }),
  38007. content: vue.withCtx(() => [
  38008. vue.createVNode(_component_el_select_menu, {
  38009. ref: "menuRef",
  38010. data: _ctx.filteredOptions,
  38011. width: _ctx.popperSize,
  38012. "hovering-index": _ctx.states.hoveringIndex,
  38013. "scrollbar-always-on": _ctx.scrollbarAlwaysOn
  38014. }, {
  38015. default: vue.withCtx((scope) => [
  38016. vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(scope)))
  38017. ]),
  38018. empty: vue.withCtx(() => [
  38019. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  38020. vue.createElementVNode("p", {
  38021. class: vue.normalizeClass(_ctx.nsSelectV2.e("empty"))
  38022. }, vue.toDisplayString(_ctx.emptyText ? _ctx.emptyText : ""), 3)
  38023. ])
  38024. ]),
  38025. _: 3
  38026. }, 8, ["data", "width", "hovering-index", "scrollbar-always-on"])
  38027. ]),
  38028. _: 3
  38029. }, 8, ["visible", "teleported", "popper-class", "popper-options", "effect", "placement", "transition", "persistent", "onBeforeShow"])
  38030. ], 34)), [
  38031. [_directive_click_outside, _ctx.handleClickOutside, _ctx.popperRef]
  38032. ]);
  38033. }
  38034. var Select = /* @__PURE__ */ _export_sfc(_sfc_main$y, [["render", _sfc_render$5], ["__file", "select.vue"]]);
  38035. Select.install = (app) => {
  38036. app.component(Select.name, Select);
  38037. };
  38038. const _Select = Select;
  38039. const ElSelectV2 = _Select;
  38040. const skeletonProps = buildProps({
  38041. animated: {
  38042. type: Boolean,
  38043. default: false
  38044. },
  38045. count: {
  38046. type: Number,
  38047. default: 1
  38048. },
  38049. rows: {
  38050. type: Number,
  38051. default: 3
  38052. },
  38053. loading: {
  38054. type: Boolean,
  38055. default: true
  38056. },
  38057. throttle: {
  38058. type: Number
  38059. }
  38060. });
  38061. const skeletonItemProps = buildProps({
  38062. variant: {
  38063. type: String,
  38064. values: [
  38065. "circle",
  38066. "rect",
  38067. "h1",
  38068. "h3",
  38069. "text",
  38070. "caption",
  38071. "p",
  38072. "image",
  38073. "button"
  38074. ],
  38075. default: "text"
  38076. }
  38077. });
  38078. const __default__$q = vue.defineComponent({
  38079. name: "ElSkeletonItem"
  38080. });
  38081. const _sfc_main$x = /* @__PURE__ */ vue.defineComponent({
  38082. ...__default__$q,
  38083. props: skeletonItemProps,
  38084. setup(__props) {
  38085. const ns = useNamespace("skeleton");
  38086. return (_ctx, _cache) => {
  38087. return vue.openBlock(), vue.createElementBlock("div", {
  38088. class: vue.normalizeClass([vue.unref(ns).e("item"), vue.unref(ns).e(_ctx.variant)])
  38089. }, [
  38090. _ctx.variant === "image" ? (vue.openBlock(), vue.createBlock(vue.unref(picture_filled_default), { key: 0 })) : vue.createCommentVNode("v-if", true)
  38091. ], 2);
  38092. };
  38093. }
  38094. });
  38095. var SkeletonItem = /* @__PURE__ */ _export_sfc(_sfc_main$x, [["__file", "skeleton-item.vue"]]);
  38096. const __default__$p = vue.defineComponent({
  38097. name: "ElSkeleton"
  38098. });
  38099. const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
  38100. ...__default__$p,
  38101. props: skeletonProps,
  38102. setup(__props, { expose }) {
  38103. const props = __props;
  38104. const ns = useNamespace("skeleton");
  38105. const uiLoading = useThrottleRender(vue.toRef(props, "loading"), props.throttle);
  38106. expose({
  38107. uiLoading
  38108. });
  38109. return (_ctx, _cache) => {
  38110. return vue.unref(uiLoading) ? (vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
  38111. key: 0,
  38112. class: [vue.unref(ns).b(), vue.unref(ns).is("animated", _ctx.animated)]
  38113. }, _ctx.$attrs), [
  38114. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.count, (i) => {
  38115. return vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: i }, [
  38116. _ctx.loading ? vue.renderSlot(_ctx.$slots, "template", { key: i }, () => [
  38117. vue.createVNode(SkeletonItem, {
  38118. class: vue.normalizeClass(vue.unref(ns).is("first")),
  38119. variant: "p"
  38120. }, null, 8, ["class"]),
  38121. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.rows, (item) => {
  38122. return vue.openBlock(), vue.createBlock(SkeletonItem, {
  38123. key: item,
  38124. class: vue.normalizeClass([
  38125. vue.unref(ns).e("paragraph"),
  38126. vue.unref(ns).is("last", item === _ctx.rows && _ctx.rows > 1)
  38127. ]),
  38128. variant: "p"
  38129. }, null, 8, ["class"]);
  38130. }), 128))
  38131. ]) : vue.createCommentVNode("v-if", true)
  38132. ], 64);
  38133. }), 128))
  38134. ], 16)) : vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.mergeProps({ key: 1 }, _ctx.$attrs)));
  38135. };
  38136. }
  38137. });
  38138. var Skeleton = /* @__PURE__ */ _export_sfc(_sfc_main$w, [["__file", "skeleton.vue"]]);
  38139. const ElSkeleton = withInstall(Skeleton, {
  38140. SkeletonItem
  38141. });
  38142. const ElSkeletonItem = withNoopInstall(SkeletonItem);
  38143. const sliderProps = buildProps({
  38144. modelValue: {
  38145. type: definePropType([Number, Array]),
  38146. default: 0
  38147. },
  38148. id: {
  38149. type: String,
  38150. default: void 0
  38151. },
  38152. min: {
  38153. type: Number,
  38154. default: 0
  38155. },
  38156. max: {
  38157. type: Number,
  38158. default: 100
  38159. },
  38160. step: {
  38161. type: Number,
  38162. default: 1
  38163. },
  38164. showInput: Boolean,
  38165. showInputControls: {
  38166. type: Boolean,
  38167. default: true
  38168. },
  38169. size: useSizeProp,
  38170. inputSize: useSizeProp,
  38171. showStops: Boolean,
  38172. showTooltip: {
  38173. type: Boolean,
  38174. default: true
  38175. },
  38176. formatTooltip: {
  38177. type: definePropType(Function),
  38178. default: void 0
  38179. },
  38180. disabled: Boolean,
  38181. range: Boolean,
  38182. vertical: Boolean,
  38183. height: String,
  38184. debounce: {
  38185. type: Number,
  38186. default: 300
  38187. },
  38188. label: {
  38189. type: String,
  38190. default: void 0
  38191. },
  38192. rangeStartLabel: {
  38193. type: String,
  38194. default: void 0
  38195. },
  38196. rangeEndLabel: {
  38197. type: String,
  38198. default: void 0
  38199. },
  38200. formatValueText: {
  38201. type: definePropType(Function),
  38202. default: void 0
  38203. },
  38204. tooltipClass: {
  38205. type: String,
  38206. default: void 0
  38207. },
  38208. placement: {
  38209. type: String,
  38210. values: Ee,
  38211. default: "top"
  38212. },
  38213. marks: {
  38214. type: definePropType(Object)
  38215. },
  38216. validateEvent: {
  38217. type: Boolean,
  38218. default: true
  38219. }
  38220. });
  38221. const isValidValue$1 = (value) => isNumber(value) || isArray(value) && value.every(isNumber);
  38222. const sliderEmits = {
  38223. [UPDATE_MODEL_EVENT]: isValidValue$1,
  38224. [INPUT_EVENT]: isValidValue$1,
  38225. [CHANGE_EVENT]: isValidValue$1
  38226. };
  38227. const useLifecycle = (props, initData, resetSize) => {
  38228. const sliderWrapper = vue.ref();
  38229. vue.onMounted(async () => {
  38230. if (props.range) {
  38231. if (Array.isArray(props.modelValue)) {
  38232. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  38233. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  38234. } else {
  38235. initData.firstValue = props.min;
  38236. initData.secondValue = props.max;
  38237. }
  38238. initData.oldValue = [initData.firstValue, initData.secondValue];
  38239. } else {
  38240. if (typeof props.modelValue !== "number" || Number.isNaN(props.modelValue)) {
  38241. initData.firstValue = props.min;
  38242. } else {
  38243. initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  38244. }
  38245. initData.oldValue = initData.firstValue;
  38246. }
  38247. useEventListener(window, "resize", resetSize);
  38248. await vue.nextTick();
  38249. resetSize();
  38250. });
  38251. return {
  38252. sliderWrapper
  38253. };
  38254. };
  38255. const useMarks = (props) => {
  38256. return vue.computed(() => {
  38257. if (!props.marks) {
  38258. return [];
  38259. }
  38260. const marksKeys = Object.keys(props.marks);
  38261. return marksKeys.map(Number.parseFloat).sort((a, b) => a - b).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  38262. point,
  38263. position: (point - props.min) * 100 / (props.max - props.min),
  38264. mark: props.marks[point]
  38265. }));
  38266. });
  38267. };
  38268. const useSlide = (props, initData, emit) => {
  38269. const { form: elForm, formItem: elFormItem } = useFormItem();
  38270. const slider = vue.shallowRef();
  38271. const firstButton = vue.ref();
  38272. const secondButton = vue.ref();
  38273. const buttonRefs = {
  38274. firstButton,
  38275. secondButton
  38276. };
  38277. const sliderDisabled = vue.computed(() => {
  38278. return props.disabled || (elForm == null ? void 0 : elForm.disabled) || false;
  38279. });
  38280. const minValue = vue.computed(() => {
  38281. return Math.min(initData.firstValue, initData.secondValue);
  38282. });
  38283. const maxValue = vue.computed(() => {
  38284. return Math.max(initData.firstValue, initData.secondValue);
  38285. });
  38286. const barSize = vue.computed(() => {
  38287. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  38288. });
  38289. const barStart = vue.computed(() => {
  38290. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  38291. });
  38292. const runwayStyle = vue.computed(() => {
  38293. return props.vertical ? { height: props.height } : {};
  38294. });
  38295. const barStyle = vue.computed(() => {
  38296. return props.vertical ? {
  38297. height: barSize.value,
  38298. bottom: barStart.value
  38299. } : {
  38300. width: barSize.value,
  38301. left: barStart.value
  38302. };
  38303. });
  38304. const resetSize = () => {
  38305. if (slider.value) {
  38306. initData.sliderSize = slider.value[`client${props.vertical ? "Height" : "Width"}`];
  38307. }
  38308. };
  38309. const getButtonRefByPercent = (percent) => {
  38310. const targetValue = props.min + percent * (props.max - props.min) / 100;
  38311. if (!props.range) {
  38312. return firstButton;
  38313. }
  38314. let buttonRefName;
  38315. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) {
  38316. buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  38317. } else {
  38318. buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  38319. }
  38320. return buttonRefs[buttonRefName];
  38321. };
  38322. const setPosition = (percent) => {
  38323. const buttonRef = getButtonRefByPercent(percent);
  38324. buttonRef.value.setPosition(percent);
  38325. return buttonRef;
  38326. };
  38327. const setFirstValue = (firstValue) => {
  38328. initData.firstValue = firstValue;
  38329. _emit(props.range ? [minValue.value, maxValue.value] : firstValue);
  38330. };
  38331. const setSecondValue = (secondValue) => {
  38332. initData.secondValue = secondValue;
  38333. if (props.range) {
  38334. _emit([minValue.value, maxValue.value]);
  38335. }
  38336. };
  38337. const _emit = (val) => {
  38338. emit(UPDATE_MODEL_EVENT, val);
  38339. emit(INPUT_EVENT, val);
  38340. };
  38341. const emitChange = async () => {
  38342. await vue.nextTick();
  38343. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  38344. };
  38345. const handleSliderPointerEvent = (event) => {
  38346. var _a, _b, _c, _d, _e, _f;
  38347. if (sliderDisabled.value || initData.dragging)
  38348. return;
  38349. resetSize();
  38350. let newPercent = 0;
  38351. if (props.vertical) {
  38352. const clientY = (_c = (_b = (_a = event.touches) == null ? void 0 : _a.item(0)) == null ? void 0 : _b.clientY) != null ? _c : event.clientY;
  38353. const sliderOffsetBottom = slider.value.getBoundingClientRect().bottom;
  38354. newPercent = (sliderOffsetBottom - clientY) / initData.sliderSize * 100;
  38355. } else {
  38356. const clientX = (_f = (_e = (_d = event.touches) == null ? void 0 : _d.item(0)) == null ? void 0 : _e.clientX) != null ? _f : event.clientX;
  38357. const sliderOffsetLeft = slider.value.getBoundingClientRect().left;
  38358. newPercent = (clientX - sliderOffsetLeft) / initData.sliderSize * 100;
  38359. }
  38360. if (newPercent < 0 || newPercent > 100)
  38361. return;
  38362. return setPosition(newPercent);
  38363. };
  38364. const onSliderWrapperPrevent = (event) => {
  38365. var _a, _b;
  38366. if (((_a = buttonRefs["firstButton"].value) == null ? void 0 : _a.dragging) || ((_b = buttonRefs["secondButton"].value) == null ? void 0 : _b.dragging)) {
  38367. event.preventDefault();
  38368. }
  38369. };
  38370. const onSliderDown = async (event) => {
  38371. const buttonRef = handleSliderPointerEvent(event);
  38372. if (buttonRef) {
  38373. await vue.nextTick();
  38374. buttonRef.value.onButtonDown(event);
  38375. }
  38376. };
  38377. const onSliderClick = (event) => {
  38378. const buttonRef = handleSliderPointerEvent(event);
  38379. if (buttonRef) {
  38380. emitChange();
  38381. }
  38382. };
  38383. return {
  38384. elFormItem,
  38385. slider,
  38386. firstButton,
  38387. secondButton,
  38388. sliderDisabled,
  38389. minValue,
  38390. maxValue,
  38391. runwayStyle,
  38392. barStyle,
  38393. resetSize,
  38394. setPosition,
  38395. emitChange,
  38396. onSliderWrapperPrevent,
  38397. onSliderClick,
  38398. onSliderDown,
  38399. setFirstValue,
  38400. setSecondValue
  38401. };
  38402. };
  38403. const { left, down, right, up, home, end, pageUp, pageDown } = EVENT_CODE;
  38404. const useTooltip = (props, formatTooltip, showTooltip) => {
  38405. const tooltip = vue.ref();
  38406. const tooltipVisible = vue.ref(false);
  38407. const enableFormat = vue.computed(() => {
  38408. return formatTooltip.value instanceof Function;
  38409. });
  38410. const formatValue = vue.computed(() => {
  38411. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  38412. });
  38413. const displayTooltip = debounce(() => {
  38414. showTooltip.value && (tooltipVisible.value = true);
  38415. }, 50);
  38416. const hideTooltip = debounce(() => {
  38417. showTooltip.value && (tooltipVisible.value = false);
  38418. }, 50);
  38419. return {
  38420. tooltip,
  38421. tooltipVisible,
  38422. formatValue,
  38423. displayTooltip,
  38424. hideTooltip
  38425. };
  38426. };
  38427. const useSliderButton = (props, initData, emit) => {
  38428. const {
  38429. disabled,
  38430. min,
  38431. max,
  38432. step,
  38433. showTooltip,
  38434. precision,
  38435. sliderSize,
  38436. formatTooltip,
  38437. emitChange,
  38438. resetSize,
  38439. updateDragging
  38440. } = vue.inject(sliderContextKey);
  38441. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  38442. const button = vue.ref();
  38443. const currentPosition = vue.computed(() => {
  38444. return `${(props.modelValue - min.value) / (max.value - min.value) * 100}%`;
  38445. });
  38446. const wrapperStyle = vue.computed(() => {
  38447. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  38448. });
  38449. const handleMouseEnter = () => {
  38450. initData.hovering = true;
  38451. displayTooltip();
  38452. };
  38453. const handleMouseLeave = () => {
  38454. initData.hovering = false;
  38455. if (!initData.dragging) {
  38456. hideTooltip();
  38457. }
  38458. };
  38459. const onButtonDown = (event) => {
  38460. if (disabled.value)
  38461. return;
  38462. event.preventDefault();
  38463. onDragStart(event);
  38464. window.addEventListener("mousemove", onDragging);
  38465. window.addEventListener("touchmove", onDragging);
  38466. window.addEventListener("mouseup", onDragEnd);
  38467. window.addEventListener("touchend", onDragEnd);
  38468. window.addEventListener("contextmenu", onDragEnd);
  38469. button.value.focus();
  38470. };
  38471. const incrementPosition = (amount) => {
  38472. if (disabled.value)
  38473. return;
  38474. initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max.value - min.value) * 100;
  38475. setPosition(initData.newPosition);
  38476. emitChange();
  38477. };
  38478. const onLeftKeyDown = () => {
  38479. incrementPosition(-step.value);
  38480. };
  38481. const onRightKeyDown = () => {
  38482. incrementPosition(step.value);
  38483. };
  38484. const onPageDownKeyDown = () => {
  38485. incrementPosition(-step.value * 4);
  38486. };
  38487. const onPageUpKeyDown = () => {
  38488. incrementPosition(step.value * 4);
  38489. };
  38490. const onHomeKeyDown = () => {
  38491. if (disabled.value)
  38492. return;
  38493. setPosition(0);
  38494. emitChange();
  38495. };
  38496. const onEndKeyDown = () => {
  38497. if (disabled.value)
  38498. return;
  38499. setPosition(100);
  38500. emitChange();
  38501. };
  38502. const onKeyDown = (event) => {
  38503. let isPreventDefault = true;
  38504. if ([left, down].includes(event.key)) {
  38505. onLeftKeyDown();
  38506. } else if ([right, up].includes(event.key)) {
  38507. onRightKeyDown();
  38508. } else if (event.key === home) {
  38509. onHomeKeyDown();
  38510. } else if (event.key === end) {
  38511. onEndKeyDown();
  38512. } else if (event.key === pageDown) {
  38513. onPageDownKeyDown();
  38514. } else if (event.key === pageUp) {
  38515. onPageUpKeyDown();
  38516. } else {
  38517. isPreventDefault = false;
  38518. }
  38519. isPreventDefault && event.preventDefault();
  38520. };
  38521. const getClientXY = (event) => {
  38522. let clientX;
  38523. let clientY;
  38524. if (event.type.startsWith("touch")) {
  38525. clientY = event.touches[0].clientY;
  38526. clientX = event.touches[0].clientX;
  38527. } else {
  38528. clientY = event.clientY;
  38529. clientX = event.clientX;
  38530. }
  38531. return {
  38532. clientX,
  38533. clientY
  38534. };
  38535. };
  38536. const onDragStart = (event) => {
  38537. initData.dragging = true;
  38538. initData.isClick = true;
  38539. const { clientX, clientY } = getClientXY(event);
  38540. if (props.vertical) {
  38541. initData.startY = clientY;
  38542. } else {
  38543. initData.startX = clientX;
  38544. }
  38545. initData.startPosition = Number.parseFloat(currentPosition.value);
  38546. initData.newPosition = initData.startPosition;
  38547. };
  38548. const onDragging = (event) => {
  38549. if (initData.dragging) {
  38550. initData.isClick = false;
  38551. displayTooltip();
  38552. resetSize();
  38553. let diff;
  38554. const { clientX, clientY } = getClientXY(event);
  38555. if (props.vertical) {
  38556. initData.currentY = clientY;
  38557. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  38558. } else {
  38559. initData.currentX = clientX;
  38560. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  38561. }
  38562. initData.newPosition = initData.startPosition + diff;
  38563. setPosition(initData.newPosition);
  38564. }
  38565. };
  38566. const onDragEnd = () => {
  38567. if (initData.dragging) {
  38568. setTimeout(() => {
  38569. initData.dragging = false;
  38570. if (!initData.hovering) {
  38571. hideTooltip();
  38572. }
  38573. if (!initData.isClick) {
  38574. setPosition(initData.newPosition);
  38575. }
  38576. emitChange();
  38577. }, 0);
  38578. window.removeEventListener("mousemove", onDragging);
  38579. window.removeEventListener("touchmove", onDragging);
  38580. window.removeEventListener("mouseup", onDragEnd);
  38581. window.removeEventListener("touchend", onDragEnd);
  38582. window.removeEventListener("contextmenu", onDragEnd);
  38583. }
  38584. };
  38585. const setPosition = async (newPosition) => {
  38586. if (newPosition === null || Number.isNaN(+newPosition))
  38587. return;
  38588. if (newPosition < 0) {
  38589. newPosition = 0;
  38590. } else if (newPosition > 100) {
  38591. newPosition = 100;
  38592. }
  38593. const lengthPerStep = 100 / ((max.value - min.value) / step.value);
  38594. const steps = Math.round(newPosition / lengthPerStep);
  38595. let value = steps * lengthPerStep * (max.value - min.value) * 0.01 + min.value;
  38596. value = Number.parseFloat(value.toFixed(precision.value));
  38597. if (value !== props.modelValue) {
  38598. emit(UPDATE_MODEL_EVENT, value);
  38599. }
  38600. if (!initData.dragging && props.modelValue !== initData.oldValue) {
  38601. initData.oldValue = props.modelValue;
  38602. }
  38603. await vue.nextTick();
  38604. initData.dragging && displayTooltip();
  38605. tooltip.value.updatePopper();
  38606. };
  38607. vue.watch(() => initData.dragging, (val) => {
  38608. updateDragging(val);
  38609. });
  38610. return {
  38611. disabled,
  38612. button,
  38613. tooltip,
  38614. tooltipVisible,
  38615. showTooltip,
  38616. wrapperStyle,
  38617. formatValue,
  38618. handleMouseEnter,
  38619. handleMouseLeave,
  38620. onButtonDown,
  38621. onKeyDown,
  38622. setPosition
  38623. };
  38624. };
  38625. const useStops = (props, initData, minValue, maxValue) => {
  38626. const stops = vue.computed(() => {
  38627. if (!props.showStops || props.min > props.max)
  38628. return [];
  38629. if (props.step === 0) {
  38630. return [];
  38631. }
  38632. const stopCount = (props.max - props.min) / props.step;
  38633. const stepWidth = 100 * props.step / (props.max - props.min);
  38634. const result = Array.from({ length: stopCount - 1 }).map((_, index) => (index + 1) * stepWidth);
  38635. if (props.range) {
  38636. return result.filter((step) => {
  38637. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  38638. });
  38639. } else {
  38640. return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  38641. }
  38642. });
  38643. const getStopStyle = (position) => {
  38644. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  38645. };
  38646. return {
  38647. stops,
  38648. getStopStyle
  38649. };
  38650. };
  38651. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem) => {
  38652. const _emit = (val) => {
  38653. emit(UPDATE_MODEL_EVENT, val);
  38654. emit(INPUT_EVENT, val);
  38655. };
  38656. const valueChanged = () => {
  38657. if (props.range) {
  38658. return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  38659. } else {
  38660. return props.modelValue !== initData.oldValue;
  38661. }
  38662. };
  38663. const setValues = () => {
  38664. var _a, _b;
  38665. if (props.min > props.max) {
  38666. throwError("Slider", "min should not be greater than max.");
  38667. return;
  38668. }
  38669. const val = props.modelValue;
  38670. if (props.range && Array.isArray(val)) {
  38671. if (val[1] < props.min) {
  38672. _emit([props.min, props.min]);
  38673. } else if (val[0] > props.max) {
  38674. _emit([props.max, props.max]);
  38675. } else if (val[0] < props.min) {
  38676. _emit([props.min, val[1]]);
  38677. } else if (val[1] > props.max) {
  38678. _emit([val[0], props.max]);
  38679. } else {
  38680. initData.firstValue = val[0];
  38681. initData.secondValue = val[1];
  38682. if (valueChanged()) {
  38683. if (props.validateEvent) {
  38684. (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn());
  38685. }
  38686. initData.oldValue = val.slice();
  38687. }
  38688. }
  38689. } else if (!props.range && typeof val === "number" && !Number.isNaN(val)) {
  38690. if (val < props.min) {
  38691. _emit(props.min);
  38692. } else if (val > props.max) {
  38693. _emit(props.max);
  38694. } else {
  38695. initData.firstValue = val;
  38696. if (valueChanged()) {
  38697. if (props.validateEvent) {
  38698. (_b = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _b.call(elFormItem, "change").catch((err) => debugWarn());
  38699. }
  38700. initData.oldValue = val;
  38701. }
  38702. }
  38703. }
  38704. };
  38705. setValues();
  38706. vue.watch(() => initData.dragging, (val) => {
  38707. if (!val) {
  38708. setValues();
  38709. }
  38710. });
  38711. vue.watch(() => props.modelValue, (val, oldVal) => {
  38712. if (initData.dragging || Array.isArray(val) && Array.isArray(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) {
  38713. return;
  38714. }
  38715. setValues();
  38716. }, {
  38717. deep: true
  38718. });
  38719. vue.watch(() => [props.min, props.max], () => {
  38720. setValues();
  38721. });
  38722. };
  38723. const sliderButtonProps = buildProps({
  38724. modelValue: {
  38725. type: Number,
  38726. default: 0
  38727. },
  38728. vertical: Boolean,
  38729. tooltipClass: String,
  38730. placement: {
  38731. type: String,
  38732. values: Ee,
  38733. default: "top"
  38734. }
  38735. });
  38736. const sliderButtonEmits = {
  38737. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  38738. };
  38739. const _hoisted_1$f = ["tabindex"];
  38740. const __default__$o = vue.defineComponent({
  38741. name: "ElSliderButton"
  38742. });
  38743. const _sfc_main$v = /* @__PURE__ */ vue.defineComponent({
  38744. ...__default__$o,
  38745. props: sliderButtonProps,
  38746. emits: sliderButtonEmits,
  38747. setup(__props, { expose, emit }) {
  38748. const props = __props;
  38749. const ns = useNamespace("slider");
  38750. const initData = vue.reactive({
  38751. hovering: false,
  38752. dragging: false,
  38753. isClick: false,
  38754. startX: 0,
  38755. currentX: 0,
  38756. startY: 0,
  38757. currentY: 0,
  38758. startPosition: 0,
  38759. newPosition: 0,
  38760. oldValue: props.modelValue
  38761. });
  38762. const {
  38763. disabled,
  38764. button,
  38765. tooltip,
  38766. showTooltip,
  38767. tooltipVisible,
  38768. wrapperStyle,
  38769. formatValue,
  38770. handleMouseEnter,
  38771. handleMouseLeave,
  38772. onButtonDown,
  38773. onKeyDown,
  38774. setPosition
  38775. } = useSliderButton(props, initData, emit);
  38776. const { hovering, dragging } = vue.toRefs(initData);
  38777. expose({
  38778. onButtonDown,
  38779. onKeyDown,
  38780. setPosition,
  38781. hovering,
  38782. dragging
  38783. });
  38784. return (_ctx, _cache) => {
  38785. return vue.openBlock(), vue.createElementBlock("div", {
  38786. ref_key: "button",
  38787. ref: button,
  38788. class: vue.normalizeClass([vue.unref(ns).e("button-wrapper"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }]),
  38789. style: vue.normalizeStyle(vue.unref(wrapperStyle)),
  38790. tabindex: vue.unref(disabled) ? -1 : 0,
  38791. onMouseenter: _cache[0] || (_cache[0] = (...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args)),
  38792. onMouseleave: _cache[1] || (_cache[1] = (...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args)),
  38793. onMousedown: _cache[2] || (_cache[2] = (...args) => vue.unref(onButtonDown) && vue.unref(onButtonDown)(...args)),
  38794. onTouchstart: _cache[3] || (_cache[3] = (...args) => vue.unref(onButtonDown) && vue.unref(onButtonDown)(...args)),
  38795. onFocus: _cache[4] || (_cache[4] = (...args) => vue.unref(handleMouseEnter) && vue.unref(handleMouseEnter)(...args)),
  38796. onBlur: _cache[5] || (_cache[5] = (...args) => vue.unref(handleMouseLeave) && vue.unref(handleMouseLeave)(...args)),
  38797. onKeydown: _cache[6] || (_cache[6] = (...args) => vue.unref(onKeyDown) && vue.unref(onKeyDown)(...args))
  38798. }, [
  38799. vue.createVNode(vue.unref(ElTooltip), {
  38800. ref_key: "tooltip",
  38801. ref: tooltip,
  38802. visible: vue.unref(tooltipVisible),
  38803. placement: _ctx.placement,
  38804. "fallback-placements": ["top", "bottom", "right", "left"],
  38805. "stop-popper-mouse-event": false,
  38806. "popper-class": _ctx.tooltipClass,
  38807. disabled: !vue.unref(showTooltip),
  38808. persistent: ""
  38809. }, {
  38810. content: vue.withCtx(() => [
  38811. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(formatValue)), 1)
  38812. ]),
  38813. default: vue.withCtx(() => [
  38814. vue.createElementVNode("div", {
  38815. class: vue.normalizeClass([vue.unref(ns).e("button"), { hover: vue.unref(hovering), dragging: vue.unref(dragging) }])
  38816. }, null, 2)
  38817. ]),
  38818. _: 1
  38819. }, 8, ["visible", "placement", "popper-class", "disabled"])
  38820. ], 46, _hoisted_1$f);
  38821. };
  38822. }
  38823. });
  38824. var SliderButton = /* @__PURE__ */ _export_sfc(_sfc_main$v, [["__file", "button.vue"]]);
  38825. const sliderMarkerProps = buildProps({
  38826. mark: {
  38827. type: definePropType([String, Object]),
  38828. default: void 0
  38829. }
  38830. });
  38831. var SliderMarker = vue.defineComponent({
  38832. name: "ElSliderMarker",
  38833. props: sliderMarkerProps,
  38834. setup(props) {
  38835. const ns = useNamespace("slider");
  38836. const label = vue.computed(() => {
  38837. return isString(props.mark) ? props.mark : props.mark.label;
  38838. });
  38839. const style = vue.computed(() => isString(props.mark) ? void 0 : props.mark.style);
  38840. return () => vue.h("div", {
  38841. class: ns.e("marks-text"),
  38842. style: style.value
  38843. }, label.value);
  38844. }
  38845. });
  38846. const _hoisted_1$e = ["id", "role", "aria-label", "aria-labelledby"];
  38847. const _hoisted_2$a = { key: 1 };
  38848. const __default__$n = vue.defineComponent({
  38849. name: "ElSlider"
  38850. });
  38851. const _sfc_main$u = /* @__PURE__ */ vue.defineComponent({
  38852. ...__default__$n,
  38853. props: sliderProps,
  38854. emits: sliderEmits,
  38855. setup(__props, { expose, emit }) {
  38856. const props = __props;
  38857. const ns = useNamespace("slider");
  38858. const { t } = useLocale();
  38859. const initData = vue.reactive({
  38860. firstValue: 0,
  38861. secondValue: 0,
  38862. oldValue: 0,
  38863. dragging: false,
  38864. sliderSize: 1
  38865. });
  38866. const {
  38867. elFormItem,
  38868. slider,
  38869. firstButton,
  38870. secondButton,
  38871. sliderDisabled,
  38872. minValue,
  38873. maxValue,
  38874. runwayStyle,
  38875. barStyle,
  38876. resetSize,
  38877. emitChange,
  38878. onSliderWrapperPrevent,
  38879. onSliderClick,
  38880. onSliderDown,
  38881. setFirstValue,
  38882. setSecondValue
  38883. } = useSlide(props, initData, emit);
  38884. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  38885. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  38886. formItemContext: elFormItem
  38887. });
  38888. const sliderWrapperSize = useSize();
  38889. const sliderInputSize = vue.computed(() => props.inputSize || sliderWrapperSize.value);
  38890. const groupLabel = vue.computed(() => {
  38891. return props.label || t("el.slider.defaultLabel", {
  38892. min: props.min,
  38893. max: props.max
  38894. });
  38895. });
  38896. const firstButtonLabel = vue.computed(() => {
  38897. if (props.range) {
  38898. return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel");
  38899. } else {
  38900. return groupLabel.value;
  38901. }
  38902. });
  38903. const firstValueText = vue.computed(() => {
  38904. return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`;
  38905. });
  38906. const secondButtonLabel = vue.computed(() => {
  38907. return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel");
  38908. });
  38909. const secondValueText = vue.computed(() => {
  38910. return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`;
  38911. });
  38912. const sliderKls = vue.computed(() => [
  38913. ns.b(),
  38914. ns.m(sliderWrapperSize.value),
  38915. ns.is("vertical", props.vertical),
  38916. { [ns.m("with-input")]: props.showInput }
  38917. ]);
  38918. const markList = useMarks(props);
  38919. useWatch(props, initData, minValue, maxValue, emit, elFormItem);
  38920. const precision = vue.computed(() => {
  38921. const precisions = [props.min, props.max, props.step].map((item) => {
  38922. const decimal = `${item}`.split(".")[1];
  38923. return decimal ? decimal.length : 0;
  38924. });
  38925. return Math.max.apply(null, precisions);
  38926. });
  38927. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  38928. const { firstValue, secondValue, sliderSize } = vue.toRefs(initData);
  38929. const updateDragging = (val) => {
  38930. initData.dragging = val;
  38931. };
  38932. vue.provide(sliderContextKey, {
  38933. ...vue.toRefs(props),
  38934. sliderSize,
  38935. disabled: sliderDisabled,
  38936. precision,
  38937. emitChange,
  38938. resetSize,
  38939. updateDragging
  38940. });
  38941. expose({
  38942. onSliderClick
  38943. });
  38944. return (_ctx, _cache) => {
  38945. var _a, _b;
  38946. return vue.openBlock(), vue.createElementBlock("div", {
  38947. id: _ctx.range ? vue.unref(inputId) : void 0,
  38948. ref_key: "sliderWrapper",
  38949. ref: sliderWrapper,
  38950. class: vue.normalizeClass(vue.unref(sliderKls)),
  38951. role: _ctx.range ? "group" : void 0,
  38952. "aria-label": _ctx.range && !vue.unref(isLabeledByFormItem) ? vue.unref(groupLabel) : void 0,
  38953. "aria-labelledby": _ctx.range && vue.unref(isLabeledByFormItem) ? (_a = vue.unref(elFormItem)) == null ? void 0 : _a.labelId : void 0,
  38954. onTouchstart: _cache[2] || (_cache[2] = (...args) => vue.unref(onSliderWrapperPrevent) && vue.unref(onSliderWrapperPrevent)(...args)),
  38955. onTouchmove: _cache[3] || (_cache[3] = (...args) => vue.unref(onSliderWrapperPrevent) && vue.unref(onSliderWrapperPrevent)(...args))
  38956. }, [
  38957. vue.createElementVNode("div", {
  38958. ref_key: "slider",
  38959. ref: slider,
  38960. class: vue.normalizeClass([
  38961. vue.unref(ns).e("runway"),
  38962. { "show-input": _ctx.showInput && !_ctx.range },
  38963. vue.unref(ns).is("disabled", vue.unref(sliderDisabled))
  38964. ]),
  38965. style: vue.normalizeStyle(vue.unref(runwayStyle)),
  38966. onMousedown: _cache[0] || (_cache[0] = (...args) => vue.unref(onSliderDown) && vue.unref(onSliderDown)(...args)),
  38967. onTouchstart: _cache[1] || (_cache[1] = (...args) => vue.unref(onSliderDown) && vue.unref(onSliderDown)(...args))
  38968. }, [
  38969. vue.createElementVNode("div", {
  38970. class: vue.normalizeClass(vue.unref(ns).e("bar")),
  38971. style: vue.normalizeStyle(vue.unref(barStyle))
  38972. }, null, 6),
  38973. vue.createVNode(SliderButton, {
  38974. id: !_ctx.range ? vue.unref(inputId) : void 0,
  38975. ref_key: "firstButton",
  38976. ref: firstButton,
  38977. "model-value": vue.unref(firstValue),
  38978. vertical: _ctx.vertical,
  38979. "tooltip-class": _ctx.tooltipClass,
  38980. placement: _ctx.placement,
  38981. role: "slider",
  38982. "aria-label": _ctx.range || !vue.unref(isLabeledByFormItem) ? vue.unref(firstButtonLabel) : void 0,
  38983. "aria-labelledby": !_ctx.range && vue.unref(isLabeledByFormItem) ? (_b = vue.unref(elFormItem)) == null ? void 0 : _b.labelId : void 0,
  38984. "aria-valuemin": _ctx.min,
  38985. "aria-valuemax": _ctx.range ? vue.unref(secondValue) : _ctx.max,
  38986. "aria-valuenow": vue.unref(firstValue),
  38987. "aria-valuetext": vue.unref(firstValueText),
  38988. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  38989. "aria-disabled": vue.unref(sliderDisabled),
  38990. "onUpdate:modelValue": vue.unref(setFirstValue)
  38991. }, 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"]),
  38992. _ctx.range ? (vue.openBlock(), vue.createBlock(SliderButton, {
  38993. key: 0,
  38994. ref_key: "secondButton",
  38995. ref: secondButton,
  38996. "model-value": vue.unref(secondValue),
  38997. vertical: _ctx.vertical,
  38998. "tooltip-class": _ctx.tooltipClass,
  38999. placement: _ctx.placement,
  39000. role: "slider",
  39001. "aria-label": vue.unref(secondButtonLabel),
  39002. "aria-valuemin": vue.unref(firstValue),
  39003. "aria-valuemax": _ctx.max,
  39004. "aria-valuenow": vue.unref(secondValue),
  39005. "aria-valuetext": vue.unref(secondValueText),
  39006. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  39007. "aria-disabled": vue.unref(sliderDisabled),
  39008. "onUpdate:modelValue": vue.unref(setSecondValue)
  39009. }, null, 8, ["model-value", "vertical", "tooltip-class", "placement", "aria-label", "aria-valuemin", "aria-valuemax", "aria-valuenow", "aria-valuetext", "aria-orientation", "aria-disabled", "onUpdate:modelValue"])) : vue.createCommentVNode("v-if", true),
  39010. _ctx.showStops ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2$a, [
  39011. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(stops), (item, key) => {
  39012. return vue.openBlock(), vue.createElementBlock("div", {
  39013. key,
  39014. class: vue.normalizeClass(vue.unref(ns).e("stop")),
  39015. style: vue.normalizeStyle(vue.unref(getStopStyle)(item))
  39016. }, null, 6);
  39017. }), 128))
  39018. ])) : vue.createCommentVNode("v-if", true),
  39019. vue.unref(markList).length > 0 ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
  39020. vue.createElementVNode("div", null, [
  39021. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  39022. return vue.openBlock(), vue.createElementBlock("div", {
  39023. key,
  39024. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position)),
  39025. class: vue.normalizeClass([vue.unref(ns).e("stop"), vue.unref(ns).e("marks-stop")])
  39026. }, null, 6);
  39027. }), 128))
  39028. ]),
  39029. vue.createElementVNode("div", {
  39030. class: vue.normalizeClass(vue.unref(ns).e("marks"))
  39031. }, [
  39032. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(markList), (item, key) => {
  39033. return vue.openBlock(), vue.createBlock(vue.unref(SliderMarker), {
  39034. key,
  39035. mark: item.mark,
  39036. style: vue.normalizeStyle(vue.unref(getStopStyle)(item.position))
  39037. }, null, 8, ["mark", "style"]);
  39038. }), 128))
  39039. ], 2)
  39040. ], 64)) : vue.createCommentVNode("v-if", true)
  39041. ], 38),
  39042. _ctx.showInput && !_ctx.range ? (vue.openBlock(), vue.createBlock(vue.unref(ElInputNumber), {
  39043. key: 0,
  39044. ref: "input",
  39045. "model-value": vue.unref(firstValue),
  39046. class: vue.normalizeClass(vue.unref(ns).e("input")),
  39047. step: _ctx.step,
  39048. disabled: vue.unref(sliderDisabled),
  39049. controls: _ctx.showInputControls,
  39050. min: _ctx.min,
  39051. max: _ctx.max,
  39052. debounce: _ctx.debounce,
  39053. size: vue.unref(sliderInputSize),
  39054. "onUpdate:modelValue": vue.unref(setFirstValue),
  39055. onChange: vue.unref(emitChange)
  39056. }, null, 8, ["model-value", "class", "step", "disabled", "controls", "min", "max", "debounce", "size", "onUpdate:modelValue", "onChange"])) : vue.createCommentVNode("v-if", true)
  39057. ], 42, _hoisted_1$e);
  39058. };
  39059. }
  39060. });
  39061. var Slider = /* @__PURE__ */ _export_sfc(_sfc_main$u, [["__file", "slider.vue"]]);
  39062. const ElSlider = withInstall(Slider);
  39063. const spaceItemProps = buildProps({
  39064. prefixCls: {
  39065. type: String
  39066. }
  39067. });
  39068. const SpaceItem = vue.defineComponent({
  39069. name: "ElSpaceItem",
  39070. props: spaceItemProps,
  39071. setup(props, { slots }) {
  39072. const ns = useNamespace("space");
  39073. const classes = vue.computed(() => `${props.prefixCls || ns.b()}__item`);
  39074. return () => vue.h("div", { class: classes.value }, vue.renderSlot(slots, "default"));
  39075. }
  39076. });
  39077. var Item = SpaceItem;
  39078. const SIZE_MAP = {
  39079. small: 8,
  39080. default: 12,
  39081. large: 16
  39082. };
  39083. function useSpace(props) {
  39084. const ns = useNamespace("space");
  39085. const classes = vue.computed(() => [ns.b(), ns.m(props.direction), props.class]);
  39086. const horizontalSize = vue.ref(0);
  39087. const verticalSize = vue.ref(0);
  39088. const containerStyle = vue.computed(() => {
  39089. const wrapKls = props.wrap || props.fill ? { flexWrap: "wrap", marginBottom: `-${verticalSize.value}px` } : {};
  39090. const alignment = {
  39091. alignItems: props.alignment
  39092. };
  39093. return [wrapKls, alignment, props.style];
  39094. });
  39095. const itemStyle = vue.computed(() => {
  39096. const itemBaseStyle = {
  39097. paddingBottom: `${verticalSize.value}px`,
  39098. marginRight: `${horizontalSize.value}px`
  39099. };
  39100. const fillStyle = props.fill ? { flexGrow: 1, minWidth: `${props.fillRatio}%` } : {};
  39101. return [itemBaseStyle, fillStyle];
  39102. });
  39103. vue.watchEffect(() => {
  39104. const { size = "small", wrap, direction: dir, fill } = props;
  39105. if (isArray(size)) {
  39106. const [h = 0, v = 0] = size;
  39107. horizontalSize.value = h;
  39108. verticalSize.value = v;
  39109. } else {
  39110. let val;
  39111. if (isNumber(size)) {
  39112. val = size;
  39113. } else {
  39114. val = SIZE_MAP[size || "small"] || SIZE_MAP.small;
  39115. }
  39116. if ((wrap || fill) && dir === "horizontal") {
  39117. horizontalSize.value = verticalSize.value = val;
  39118. } else {
  39119. if (dir === "horizontal") {
  39120. horizontalSize.value = val;
  39121. verticalSize.value = 0;
  39122. } else {
  39123. verticalSize.value = val;
  39124. horizontalSize.value = 0;
  39125. }
  39126. }
  39127. }
  39128. });
  39129. return {
  39130. classes,
  39131. containerStyle,
  39132. itemStyle
  39133. };
  39134. }
  39135. const spaceProps = buildProps({
  39136. direction: {
  39137. type: String,
  39138. values: ["horizontal", "vertical"],
  39139. default: "horizontal"
  39140. },
  39141. class: {
  39142. type: definePropType([
  39143. String,
  39144. Object,
  39145. Array
  39146. ]),
  39147. default: ""
  39148. },
  39149. style: {
  39150. type: definePropType([String, Array, Object]),
  39151. default: ""
  39152. },
  39153. alignment: {
  39154. type: definePropType(String),
  39155. default: "center"
  39156. },
  39157. prefixCls: {
  39158. type: String
  39159. },
  39160. spacer: {
  39161. type: definePropType([Object, String, Number, Array]),
  39162. default: null,
  39163. validator: (val) => vue.isVNode(val) || isNumber(val) || isString(val)
  39164. },
  39165. wrap: Boolean,
  39166. fill: Boolean,
  39167. fillRatio: {
  39168. type: Number,
  39169. default: 100
  39170. },
  39171. size: {
  39172. type: [String, Array, Number],
  39173. values: componentSizes,
  39174. validator: (val) => {
  39175. return isNumber(val) || isArray(val) && val.length === 2 && val.every(isNumber);
  39176. }
  39177. }
  39178. });
  39179. var Space = vue.defineComponent({
  39180. name: "ElSpace",
  39181. props: spaceProps,
  39182. setup(props, { slots }) {
  39183. const { classes, containerStyle, itemStyle } = useSpace(props);
  39184. function extractChildren(children, parentKey = "", extractedChildren = []) {
  39185. const { prefixCls } = props;
  39186. children.forEach((child, loopKey) => {
  39187. if (isFragment(child)) {
  39188. if (isArray(child.children)) {
  39189. child.children.forEach((nested, key) => {
  39190. if (isFragment(nested) && isArray(nested.children)) {
  39191. extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
  39192. } else {
  39193. extractedChildren.push(vue.createVNode(Item, {
  39194. style: itemStyle.value,
  39195. prefixCls,
  39196. key: `nested-${parentKey + key}`
  39197. }, {
  39198. default: () => [nested]
  39199. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  39200. }
  39201. });
  39202. }
  39203. } else if (isValidElementNode(child)) {
  39204. extractedChildren.push(vue.createVNode(Item, {
  39205. style: itemStyle.value,
  39206. prefixCls,
  39207. key: `LoopKey${parentKey + loopKey}`
  39208. }, {
  39209. default: () => [child]
  39210. }, PatchFlags.PROPS | PatchFlags.STYLE, ["style", "prefixCls"]));
  39211. }
  39212. });
  39213. return extractedChildren;
  39214. }
  39215. return () => {
  39216. var _a;
  39217. const { spacer, direction } = props;
  39218. const children = vue.renderSlot(slots, "default", { key: 0 }, () => []);
  39219. if (((_a = children.children) != null ? _a : []).length === 0)
  39220. return null;
  39221. if (isArray(children.children)) {
  39222. let extractedChildren = extractChildren(children.children);
  39223. if (spacer) {
  39224. const len = extractedChildren.length - 1;
  39225. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  39226. const children2 = [...acc, child];
  39227. if (idx !== len) {
  39228. children2.push(vue.createVNode("span", {
  39229. style: [
  39230. itemStyle.value,
  39231. direction === "vertical" ? "width: 100%" : null
  39232. ],
  39233. key: idx
  39234. }, [
  39235. vue.isVNode(spacer) ? spacer : vue.createTextVNode(spacer, PatchFlags.TEXT)
  39236. ], PatchFlags.STYLE));
  39237. }
  39238. return children2;
  39239. }, []);
  39240. }
  39241. return vue.createVNode("div", {
  39242. class: classes.value,
  39243. style: containerStyle.value
  39244. }, extractedChildren, PatchFlags.STYLE | PatchFlags.CLASS);
  39245. }
  39246. return children.children;
  39247. };
  39248. }
  39249. });
  39250. const ElSpace = withInstall(Space);
  39251. const stepsProps = buildProps({
  39252. space: {
  39253. type: [Number, String],
  39254. default: ""
  39255. },
  39256. active: {
  39257. type: Number,
  39258. default: 0
  39259. },
  39260. direction: {
  39261. type: String,
  39262. default: "horizontal",
  39263. values: ["horizontal", "vertical"]
  39264. },
  39265. alignCenter: {
  39266. type: Boolean
  39267. },
  39268. simple: {
  39269. type: Boolean
  39270. },
  39271. finishStatus: {
  39272. type: String,
  39273. values: ["wait", "process", "finish", "error", "success"],
  39274. default: "finish"
  39275. },
  39276. processStatus: {
  39277. type: String,
  39278. values: ["wait", "process", "finish", "error", "success"],
  39279. default: "process"
  39280. }
  39281. });
  39282. const stepsEmits = {
  39283. [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber)
  39284. };
  39285. const __default__$m = vue.defineComponent({
  39286. name: "ElSteps"
  39287. });
  39288. const _sfc_main$t = /* @__PURE__ */ vue.defineComponent({
  39289. ...__default__$m,
  39290. props: stepsProps,
  39291. emits: stepsEmits,
  39292. setup(__props, { emit }) {
  39293. const props = __props;
  39294. const ns = useNamespace("steps");
  39295. const steps = vue.ref([]);
  39296. vue.watch(steps, () => {
  39297. steps.value.forEach((instance, index) => {
  39298. instance.setIndex(index);
  39299. });
  39300. });
  39301. vue.provide("ElSteps", { props, steps });
  39302. vue.watch(() => props.active, (newVal, oldVal) => {
  39303. emit(CHANGE_EVENT, newVal, oldVal);
  39304. });
  39305. return (_ctx, _cache) => {
  39306. return vue.openBlock(), vue.createElementBlock("div", {
  39307. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.simple ? "simple" : _ctx.direction)])
  39308. }, [
  39309. vue.renderSlot(_ctx.$slots, "default")
  39310. ], 2);
  39311. };
  39312. }
  39313. });
  39314. var Steps = /* @__PURE__ */ _export_sfc(_sfc_main$t, [["__file", "steps.vue"]]);
  39315. const stepProps = buildProps({
  39316. title: {
  39317. type: String,
  39318. default: ""
  39319. },
  39320. icon: {
  39321. type: iconPropType
  39322. },
  39323. description: {
  39324. type: String,
  39325. default: ""
  39326. },
  39327. status: {
  39328. type: String,
  39329. values: ["", "wait", "process", "finish", "error", "success"],
  39330. default: ""
  39331. }
  39332. });
  39333. const __default__$l = vue.defineComponent({
  39334. name: "ElStep"
  39335. });
  39336. const _sfc_main$s = vue.defineComponent({
  39337. ...__default__$l,
  39338. props: stepProps,
  39339. setup(__props) {
  39340. const props = __props;
  39341. const ns = useNamespace("step");
  39342. const index = vue.ref(-1);
  39343. const lineStyle = vue.ref({});
  39344. const internalStatus = vue.ref("");
  39345. const parent = vue.inject("ElSteps");
  39346. const currentInstance = vue.getCurrentInstance();
  39347. vue.onMounted(() => {
  39348. vue.watch([
  39349. () => parent.props.active,
  39350. () => parent.props.processStatus,
  39351. () => parent.props.finishStatus
  39352. ], ([active]) => {
  39353. updateStatus(active);
  39354. }, { immediate: true });
  39355. });
  39356. vue.onBeforeUnmount(() => {
  39357. parent.steps.value = parent.steps.value.filter((instance) => instance.uid !== (currentInstance == null ? void 0 : currentInstance.uid));
  39358. });
  39359. const currentStatus = vue.computed(() => {
  39360. return props.status || internalStatus.value;
  39361. });
  39362. const prevStatus = vue.computed(() => {
  39363. const prevStep = parent.steps.value[index.value - 1];
  39364. return prevStep ? prevStep.currentStatus : "wait";
  39365. });
  39366. const isCenter = vue.computed(() => {
  39367. return parent.props.alignCenter;
  39368. });
  39369. const isVertical = vue.computed(() => {
  39370. return parent.props.direction === "vertical";
  39371. });
  39372. const isSimple = vue.computed(() => {
  39373. return parent.props.simple;
  39374. });
  39375. const stepsCount = vue.computed(() => {
  39376. return parent.steps.value.length;
  39377. });
  39378. const isLast = vue.computed(() => {
  39379. var _a;
  39380. return ((_a = parent.steps.value[stepsCount.value - 1]) == null ? void 0 : _a.uid) === (currentInstance == null ? void 0 : currentInstance.uid);
  39381. });
  39382. const space = vue.computed(() => {
  39383. return isSimple.value ? "" : parent.props.space;
  39384. });
  39385. const style = vue.computed(() => {
  39386. const style2 = {
  39387. flexBasis: typeof space.value === "number" ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%`
  39388. };
  39389. if (isVertical.value)
  39390. return style2;
  39391. if (isLast.value) {
  39392. style2.maxWidth = `${100 / stepsCount.value}%`;
  39393. }
  39394. return style2;
  39395. });
  39396. const setIndex = (val) => {
  39397. index.value = val;
  39398. };
  39399. const calcProgress = (status) => {
  39400. let step = 100;
  39401. const style2 = {};
  39402. style2.transitionDelay = `${150 * index.value}ms`;
  39403. if (status === parent.props.processStatus) {
  39404. step = 0;
  39405. } else if (status === "wait") {
  39406. step = 0;
  39407. style2.transitionDelay = `${-150 * index.value}ms`;
  39408. }
  39409. style2.borderWidth = step && !isSimple.value ? "1px" : 0;
  39410. style2[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
  39411. lineStyle.value = style2;
  39412. };
  39413. const updateStatus = (activeIndex) => {
  39414. if (activeIndex > index.value) {
  39415. internalStatus.value = parent.props.finishStatus;
  39416. } else if (activeIndex === index.value && prevStatus.value !== "error") {
  39417. internalStatus.value = parent.props.processStatus;
  39418. } else {
  39419. internalStatus.value = "wait";
  39420. }
  39421. const prevChild = parent.steps.value[index.value - 1];
  39422. if (prevChild)
  39423. prevChild.calcProgress(internalStatus.value);
  39424. };
  39425. const stepItemState = vue.reactive({
  39426. uid: vue.computed(() => currentInstance == null ? void 0 : currentInstance.uid),
  39427. currentStatus,
  39428. setIndex,
  39429. calcProgress
  39430. });
  39431. parent.steps.value = [...parent.steps.value, stepItemState];
  39432. return (_ctx, _cache) => {
  39433. return vue.openBlock(), vue.createElementBlock("div", {
  39434. style: vue.normalizeStyle(vue.unref(style)),
  39435. class: vue.normalizeClass([
  39436. vue.unref(ns).b(),
  39437. vue.unref(ns).is(vue.unref(isSimple) ? "simple" : vue.unref(parent).props.direction),
  39438. vue.unref(ns).is("flex", vue.unref(isLast) && !vue.unref(space) && !vue.unref(isCenter)),
  39439. vue.unref(ns).is("center", vue.unref(isCenter) && !vue.unref(isVertical) && !vue.unref(isSimple))
  39440. ])
  39441. }, [
  39442. vue.createCommentVNode(" icon & line "),
  39443. vue.createElementVNode("div", {
  39444. class: vue.normalizeClass([vue.unref(ns).e("head"), vue.unref(ns).is(vue.unref(currentStatus))])
  39445. }, [
  39446. !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  39447. key: 0,
  39448. class: vue.normalizeClass(vue.unref(ns).e("line"))
  39449. }, [
  39450. vue.createElementVNode("i", {
  39451. class: vue.normalizeClass(vue.unref(ns).e("line-inner")),
  39452. style: vue.normalizeStyle(lineStyle.value)
  39453. }, null, 6)
  39454. ], 2)) : vue.createCommentVNode("v-if", true),
  39455. vue.createElementVNode("div", {
  39456. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(ns).is(_ctx.icon || _ctx.$slots.icon ? "icon" : "text")])
  39457. }, [
  39458. vue.renderSlot(_ctx.$slots, "icon", {}, () => [
  39459. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  39460. key: 0,
  39461. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  39462. }, {
  39463. default: vue.withCtx(() => [
  39464. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  39465. ]),
  39466. _: 1
  39467. }, 8, ["class"])) : vue.unref(currentStatus) === "success" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  39468. key: 1,
  39469. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  39470. }, {
  39471. default: vue.withCtx(() => [
  39472. vue.createVNode(vue.unref(check_default))
  39473. ]),
  39474. _: 1
  39475. }, 8, ["class"])) : vue.unref(currentStatus) === "error" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  39476. key: 2,
  39477. class: vue.normalizeClass([vue.unref(ns).e("icon-inner"), vue.unref(ns).is("status")])
  39478. }, {
  39479. default: vue.withCtx(() => [
  39480. vue.createVNode(vue.unref(close_default))
  39481. ]),
  39482. _: 1
  39483. }, 8, ["class"])) : !vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  39484. key: 3,
  39485. class: vue.normalizeClass(vue.unref(ns).e("icon-inner"))
  39486. }, vue.toDisplayString(index.value + 1), 3)) : vue.createCommentVNode("v-if", true)
  39487. ])
  39488. ], 2)
  39489. ], 2),
  39490. vue.createCommentVNode(" title & description "),
  39491. vue.createElementVNode("div", {
  39492. class: vue.normalizeClass(vue.unref(ns).e("main"))
  39493. }, [
  39494. vue.createElementVNode("div", {
  39495. class: vue.normalizeClass([vue.unref(ns).e("title"), vue.unref(ns).is(vue.unref(currentStatus))])
  39496. }, [
  39497. vue.renderSlot(_ctx.$slots, "title", {}, () => [
  39498. vue.createTextVNode(vue.toDisplayString(_ctx.title), 1)
  39499. ])
  39500. ], 2),
  39501. vue.unref(isSimple) ? (vue.openBlock(), vue.createElementBlock("div", {
  39502. key: 0,
  39503. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  39504. }, null, 2)) : (vue.openBlock(), vue.createElementBlock("div", {
  39505. key: 1,
  39506. class: vue.normalizeClass([vue.unref(ns).e("description"), vue.unref(ns).is(vue.unref(currentStatus))])
  39507. }, [
  39508. vue.renderSlot(_ctx.$slots, "description", {}, () => [
  39509. vue.createTextVNode(vue.toDisplayString(_ctx.description), 1)
  39510. ])
  39511. ], 2))
  39512. ], 2)
  39513. ], 6);
  39514. };
  39515. }
  39516. });
  39517. var Step = /* @__PURE__ */ _export_sfc(_sfc_main$s, [["__file", "item.vue"]]);
  39518. const ElSteps = withInstall(Steps, {
  39519. Step
  39520. });
  39521. const ElStep = withNoopInstall(Step);
  39522. const switchProps = buildProps({
  39523. modelValue: {
  39524. type: [Boolean, String, Number],
  39525. default: false
  39526. },
  39527. value: {
  39528. type: [Boolean, String, Number],
  39529. default: false
  39530. },
  39531. disabled: {
  39532. type: Boolean,
  39533. default: false
  39534. },
  39535. width: {
  39536. type: [String, Number],
  39537. default: ""
  39538. },
  39539. inlinePrompt: {
  39540. type: Boolean,
  39541. default: false
  39542. },
  39543. activeIcon: {
  39544. type: iconPropType
  39545. },
  39546. inactiveIcon: {
  39547. type: iconPropType
  39548. },
  39549. activeText: {
  39550. type: String,
  39551. default: ""
  39552. },
  39553. inactiveText: {
  39554. type: String,
  39555. default: ""
  39556. },
  39557. activeColor: {
  39558. type: String,
  39559. default: ""
  39560. },
  39561. inactiveColor: {
  39562. type: String,
  39563. default: ""
  39564. },
  39565. borderColor: {
  39566. type: String,
  39567. default: ""
  39568. },
  39569. activeValue: {
  39570. type: [Boolean, String, Number],
  39571. default: true
  39572. },
  39573. inactiveValue: {
  39574. type: [Boolean, String, Number],
  39575. default: false
  39576. },
  39577. name: {
  39578. type: String,
  39579. default: ""
  39580. },
  39581. validateEvent: {
  39582. type: Boolean,
  39583. default: true
  39584. },
  39585. id: String,
  39586. loading: {
  39587. type: Boolean,
  39588. default: false
  39589. },
  39590. beforeChange: {
  39591. type: definePropType(Function)
  39592. },
  39593. size: {
  39594. type: String,
  39595. validator: isValidComponentSize
  39596. },
  39597. tabindex: {
  39598. type: [String, Number]
  39599. }
  39600. });
  39601. const switchEmits = {
  39602. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  39603. [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  39604. [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
  39605. };
  39606. const _hoisted_1$d = ["onClick"];
  39607. const _hoisted_2$9 = ["id", "aria-checked", "aria-disabled", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"];
  39608. const _hoisted_3$4 = ["aria-hidden"];
  39609. const _hoisted_4$2 = ["aria-hidden"];
  39610. const _hoisted_5$1 = ["aria-hidden"];
  39611. const COMPONENT_NAME$8 = "ElSwitch";
  39612. const __default__$k = vue.defineComponent({
  39613. name: COMPONENT_NAME$8
  39614. });
  39615. const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
  39616. ...__default__$k,
  39617. props: switchProps,
  39618. emits: switchEmits,
  39619. setup(__props, { expose, emit }) {
  39620. const props = __props;
  39621. const vm = vue.getCurrentInstance();
  39622. const { formItem } = useFormItem();
  39623. const switchSize = useSize();
  39624. const ns = useNamespace("switch");
  39625. useDeprecated({
  39626. from: '"value"',
  39627. replacement: '"model-value" or "v-model"',
  39628. scope: COMPONENT_NAME$8,
  39629. version: "2.3.0",
  39630. ref: "https://element-plus.org/en-US/component/switch.html#attributes",
  39631. type: "Attribute"
  39632. }, vue.computed(() => {
  39633. var _a;
  39634. return !!((_a = vm.vnode.props) == null ? void 0 : _a.value);
  39635. }));
  39636. const { inputId } = useFormItemInputId(props, {
  39637. formItemContext: formItem
  39638. });
  39639. const switchDisabled = useDisabled(vue.computed(() => props.loading));
  39640. const isControlled = vue.ref(props.modelValue !== false);
  39641. const input = vue.ref();
  39642. const core = vue.ref();
  39643. const switchKls = vue.computed(() => [
  39644. ns.b(),
  39645. ns.m(switchSize.value),
  39646. ns.is("disabled", switchDisabled.value),
  39647. ns.is("checked", checked.value)
  39648. ]);
  39649. const coreStyle = vue.computed(() => ({
  39650. width: addUnit(props.width)
  39651. }));
  39652. vue.watch(() => props.modelValue, () => {
  39653. isControlled.value = true;
  39654. });
  39655. vue.watch(() => props.value, () => {
  39656. isControlled.value = false;
  39657. });
  39658. const actualValue = vue.computed(() => {
  39659. return isControlled.value ? props.modelValue : props.value;
  39660. });
  39661. const checked = vue.computed(() => actualValue.value === props.activeValue);
  39662. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  39663. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  39664. emit(CHANGE_EVENT, props.inactiveValue);
  39665. emit(INPUT_EVENT, props.inactiveValue);
  39666. }
  39667. vue.watch(checked, (val) => {
  39668. var _a;
  39669. input.value.checked = val;
  39670. if (props.validateEvent) {
  39671. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  39672. }
  39673. });
  39674. const handleChange = () => {
  39675. const val = checked.value ? props.inactiveValue : props.activeValue;
  39676. emit(UPDATE_MODEL_EVENT, val);
  39677. emit(CHANGE_EVENT, val);
  39678. emit(INPUT_EVENT, val);
  39679. vue.nextTick(() => {
  39680. input.value.checked = checked.value;
  39681. });
  39682. };
  39683. const switchValue = () => {
  39684. if (switchDisabled.value)
  39685. return;
  39686. const { beforeChange } = props;
  39687. if (!beforeChange) {
  39688. handleChange();
  39689. return;
  39690. }
  39691. const shouldChange = beforeChange();
  39692. const isPromiseOrBool = [
  39693. isPromise(shouldChange),
  39694. isBoolean(shouldChange)
  39695. ].includes(true);
  39696. if (!isPromiseOrBool) {
  39697. throwError(COMPONENT_NAME$8, "beforeChange must return type `Promise<boolean>` or `boolean`");
  39698. }
  39699. if (isPromise(shouldChange)) {
  39700. shouldChange.then((result) => {
  39701. if (result) {
  39702. handleChange();
  39703. }
  39704. }).catch((e) => {
  39705. });
  39706. } else if (shouldChange) {
  39707. handleChange();
  39708. }
  39709. };
  39710. const styles = vue.computed(() => {
  39711. return ns.cssVarBlock({
  39712. ...props.activeColor ? { "on-color": props.activeColor } : null,
  39713. ...props.inactiveColor ? { "off-color": props.inactiveColor } : null,
  39714. ...props.borderColor ? { "border-color": props.borderColor } : null
  39715. });
  39716. });
  39717. const focus = () => {
  39718. var _a, _b;
  39719. (_b = (_a = input.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  39720. };
  39721. vue.onMounted(() => {
  39722. input.value.checked = checked.value;
  39723. });
  39724. expose({
  39725. focus,
  39726. checked
  39727. });
  39728. return (_ctx, _cache) => {
  39729. return vue.openBlock(), vue.createElementBlock("div", {
  39730. class: vue.normalizeClass(vue.unref(switchKls)),
  39731. style: vue.normalizeStyle(vue.unref(styles)),
  39732. onClick: vue.withModifiers(switchValue, ["prevent"])
  39733. }, [
  39734. vue.createElementVNode("input", {
  39735. id: vue.unref(inputId),
  39736. ref_key: "input",
  39737. ref: input,
  39738. class: vue.normalizeClass(vue.unref(ns).e("input")),
  39739. type: "checkbox",
  39740. role: "switch",
  39741. "aria-checked": vue.unref(checked),
  39742. "aria-disabled": vue.unref(switchDisabled),
  39743. name: _ctx.name,
  39744. "true-value": _ctx.activeValue,
  39745. "false-value": _ctx.inactiveValue,
  39746. disabled: vue.unref(switchDisabled),
  39747. tabindex: _ctx.tabindex,
  39748. onChange: handleChange,
  39749. onKeydown: vue.withKeys(switchValue, ["enter"])
  39750. }, null, 42, _hoisted_2$9),
  39751. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (vue.openBlock(), vue.createElementBlock("span", {
  39752. key: 0,
  39753. class: vue.normalizeClass([
  39754. vue.unref(ns).e("label"),
  39755. vue.unref(ns).em("label", "left"),
  39756. vue.unref(ns).is("active", !vue.unref(checked))
  39757. ])
  39758. }, [
  39759. _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  39760. default: vue.withCtx(() => [
  39761. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.inactiveIcon)))
  39762. ]),
  39763. _: 1
  39764. })) : vue.createCommentVNode("v-if", true),
  39765. !_ctx.inactiveIcon && _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  39766. key: 1,
  39767. "aria-hidden": vue.unref(checked)
  39768. }, vue.toDisplayString(_ctx.inactiveText), 9, _hoisted_3$4)) : vue.createCommentVNode("v-if", true)
  39769. ], 2)) : vue.createCommentVNode("v-if", true),
  39770. vue.createElementVNode("span", {
  39771. ref_key: "core",
  39772. ref: core,
  39773. class: vue.normalizeClass(vue.unref(ns).e("core")),
  39774. style: vue.normalizeStyle(vue.unref(coreStyle))
  39775. }, [
  39776. _ctx.inlinePrompt ? (vue.openBlock(), vue.createElementBlock("div", {
  39777. key: 0,
  39778. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  39779. }, [
  39780. _ctx.activeIcon || _ctx.inactiveIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  39781. key: 0,
  39782. class: vue.normalizeClass(vue.unref(ns).is("icon"))
  39783. }, {
  39784. default: vue.withCtx(() => [
  39785. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  39786. ]),
  39787. _: 1
  39788. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (vue.openBlock(), vue.createElementBlock("span", {
  39789. key: 1,
  39790. class: vue.normalizeClass(vue.unref(ns).is("text")),
  39791. "aria-hidden": !vue.unref(checked)
  39792. }, vue.toDisplayString(vue.unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, _hoisted_4$2)) : vue.createCommentVNode("v-if", true)
  39793. ], 2)) : vue.createCommentVNode("v-if", true),
  39794. vue.createElementVNode("div", {
  39795. class: vue.normalizeClass(vue.unref(ns).e("action"))
  39796. }, [
  39797. _ctx.loading ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  39798. key: 0,
  39799. class: vue.normalizeClass(vue.unref(ns).is("loading"))
  39800. }, {
  39801. default: vue.withCtx(() => [
  39802. vue.createVNode(vue.unref(loading_default))
  39803. ]),
  39804. _: 1
  39805. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  39806. ], 2)
  39807. ], 6),
  39808. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (vue.openBlock(), vue.createElementBlock("span", {
  39809. key: 1,
  39810. class: vue.normalizeClass([
  39811. vue.unref(ns).e("label"),
  39812. vue.unref(ns).em("label", "right"),
  39813. vue.unref(ns).is("active", vue.unref(checked))
  39814. ])
  39815. }, [
  39816. _ctx.activeIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), { key: 0 }, {
  39817. default: vue.withCtx(() => [
  39818. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.activeIcon)))
  39819. ]),
  39820. _: 1
  39821. })) : vue.createCommentVNode("v-if", true),
  39822. !_ctx.activeIcon && _ctx.activeText ? (vue.openBlock(), vue.createElementBlock("span", {
  39823. key: 1,
  39824. "aria-hidden": !vue.unref(checked)
  39825. }, vue.toDisplayString(_ctx.activeText), 9, _hoisted_5$1)) : vue.createCommentVNode("v-if", true)
  39826. ], 2)) : vue.createCommentVNode("v-if", true)
  39827. ], 14, _hoisted_1$d);
  39828. };
  39829. }
  39830. });
  39831. var Switch = /* @__PURE__ */ _export_sfc(_sfc_main$r, [["__file", "switch.vue"]]);
  39832. const ElSwitch = withInstall(Switch);
  39833. var matchHtmlRegExp = /["'&<>]/;
  39834. var escapeHtml_1 = escapeHtml;
  39835. function escapeHtml(string) {
  39836. var str = "" + string;
  39837. var match = matchHtmlRegExp.exec(str);
  39838. if (!match) {
  39839. return str;
  39840. }
  39841. var escape;
  39842. var html = "";
  39843. var index = 0;
  39844. var lastIndex = 0;
  39845. for (index = match.index; index < str.length; index++) {
  39846. switch (str.charCodeAt(index)) {
  39847. case 34:
  39848. escape = "&quot;";
  39849. break;
  39850. case 38:
  39851. escape = "&amp;";
  39852. break;
  39853. case 39:
  39854. escape = "&#39;";
  39855. break;
  39856. case 60:
  39857. escape = "&lt;";
  39858. break;
  39859. case 62:
  39860. escape = "&gt;";
  39861. break;
  39862. default:
  39863. continue;
  39864. }
  39865. if (lastIndex !== index) {
  39866. html += str.substring(lastIndex, index);
  39867. }
  39868. lastIndex = index + 1;
  39869. html += escape;
  39870. }
  39871. return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
  39872. }
  39873. /*!
  39874. * escape-html
  39875. * Copyright(c) 2012-2013 TJ Holowaychuk
  39876. * Copyright(c) 2015 Andreas Lubbe
  39877. * Copyright(c) 2015 Tiancheng "Timothy" Gu
  39878. * MIT Licensed
  39879. */
  39880. const getCell = function(event) {
  39881. var _a;
  39882. return (_a = event.target) == null ? void 0 : _a.closest("td");
  39883. };
  39884. const isObject = function(obj) {
  39885. return obj !== null && typeof obj === "object";
  39886. };
  39887. const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
  39888. if (!sortKey && !sortMethod && (!sortBy || Array.isArray(sortBy) && !sortBy.length)) {
  39889. return array;
  39890. }
  39891. if (typeof reverse === "string") {
  39892. reverse = reverse === "descending" ? -1 : 1;
  39893. } else {
  39894. reverse = reverse && reverse < 0 ? -1 : 1;
  39895. }
  39896. const getKey = sortMethod ? null : function(value, index) {
  39897. if (sortBy) {
  39898. if (!Array.isArray(sortBy)) {
  39899. sortBy = [sortBy];
  39900. }
  39901. return sortBy.map((by) => {
  39902. if (typeof by === "string") {
  39903. return get(value, by);
  39904. } else {
  39905. return by(value, index, array);
  39906. }
  39907. });
  39908. }
  39909. if (sortKey !== "$key") {
  39910. if (isObject(value) && "$value" in value)
  39911. value = value.$value;
  39912. }
  39913. return [isObject(value) ? get(value, sortKey) : value];
  39914. };
  39915. const compare = function(a, b) {
  39916. if (sortMethod) {
  39917. return sortMethod(a.value, b.value);
  39918. }
  39919. for (let i = 0, len = a.key.length; i < len; i++) {
  39920. if (a.key[i] < b.key[i]) {
  39921. return -1;
  39922. }
  39923. if (a.key[i] > b.key[i]) {
  39924. return 1;
  39925. }
  39926. }
  39927. return 0;
  39928. };
  39929. return array.map((value, index) => {
  39930. return {
  39931. value,
  39932. index,
  39933. key: getKey ? getKey(value, index) : null
  39934. };
  39935. }).sort((a, b) => {
  39936. let order = compare(a, b);
  39937. if (!order) {
  39938. order = a.index - b.index;
  39939. }
  39940. return order * +reverse;
  39941. }).map((item) => item.value);
  39942. };
  39943. const getColumnById = function(table, columnId) {
  39944. let column = null;
  39945. table.columns.forEach((item) => {
  39946. if (item.id === columnId) {
  39947. column = item;
  39948. }
  39949. });
  39950. return column;
  39951. };
  39952. const getColumnByKey = function(table, columnKey) {
  39953. let column = null;
  39954. for (let i = 0; i < table.columns.length; i++) {
  39955. const item = table.columns[i];
  39956. if (item.columnKey === columnKey) {
  39957. column = item;
  39958. break;
  39959. }
  39960. }
  39961. if (!column)
  39962. throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  39963. return column;
  39964. };
  39965. const getColumnByCell = function(table, cell, namespace) {
  39966. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  39967. if (matches) {
  39968. return getColumnById(table, matches[0]);
  39969. }
  39970. return null;
  39971. };
  39972. const getRowIdentity = (row, rowKey) => {
  39973. if (!row)
  39974. throw new Error("Row is required when get row identity");
  39975. if (typeof rowKey === "string") {
  39976. if (!rowKey.includes(".")) {
  39977. return `${row[rowKey]}`;
  39978. }
  39979. const key = rowKey.split(".");
  39980. let current = row;
  39981. for (const element of key) {
  39982. current = current[element];
  39983. }
  39984. return `${current}`;
  39985. } else if (typeof rowKey === "function") {
  39986. return rowKey.call(null, row);
  39987. }
  39988. };
  39989. const getKeysMap = function(array, rowKey) {
  39990. const arrayMap = {};
  39991. (array || []).forEach((row, index) => {
  39992. arrayMap[getRowIdentity(row, rowKey)] = { row, index };
  39993. });
  39994. return arrayMap;
  39995. };
  39996. function mergeOptions(defaults, config) {
  39997. const options = {};
  39998. let key;
  39999. for (key in defaults) {
  40000. options[key] = defaults[key];
  40001. }
  40002. for (key in config) {
  40003. if (hasOwn(config, key)) {
  40004. const value = config[key];
  40005. if (typeof value !== "undefined") {
  40006. options[key] = value;
  40007. }
  40008. }
  40009. }
  40010. return options;
  40011. }
  40012. function parseWidth(width) {
  40013. if (width === "")
  40014. return width;
  40015. if (width !== void 0) {
  40016. width = Number.parseInt(width, 10);
  40017. if (Number.isNaN(width)) {
  40018. width = "";
  40019. }
  40020. }
  40021. return width;
  40022. }
  40023. function parseMinWidth(minWidth) {
  40024. if (minWidth === "")
  40025. return minWidth;
  40026. if (minWidth !== void 0) {
  40027. minWidth = parseWidth(minWidth);
  40028. if (Number.isNaN(minWidth)) {
  40029. minWidth = 80;
  40030. }
  40031. }
  40032. return minWidth;
  40033. }
  40034. function parseHeight(height) {
  40035. if (typeof height === "number") {
  40036. return height;
  40037. }
  40038. if (typeof height === "string") {
  40039. if (/^\d+(?:px)?$/.test(height)) {
  40040. return Number.parseInt(height, 10);
  40041. } else {
  40042. return height;
  40043. }
  40044. }
  40045. return null;
  40046. }
  40047. function compose(...funcs) {
  40048. if (funcs.length === 0) {
  40049. return (arg) => arg;
  40050. }
  40051. if (funcs.length === 1) {
  40052. return funcs[0];
  40053. }
  40054. return funcs.reduce((a, b) => (...args) => a(b(...args)));
  40055. }
  40056. function toggleRowStatus(statusArr, row, newVal) {
  40057. let changed = false;
  40058. const index = statusArr.indexOf(row);
  40059. const included = index !== -1;
  40060. const toggleStatus = (type) => {
  40061. if (type === "add") {
  40062. statusArr.push(row);
  40063. } else {
  40064. statusArr.splice(index, 1);
  40065. }
  40066. changed = true;
  40067. if (isArray(row.children)) {
  40068. row.children.forEach((item) => {
  40069. toggleRowStatus(statusArr, item, newVal != null ? newVal : !included);
  40070. });
  40071. }
  40072. };
  40073. if (isBoolean(newVal)) {
  40074. if (newVal && !included) {
  40075. toggleStatus("add");
  40076. } else if (!newVal && included) {
  40077. toggleStatus("remove");
  40078. }
  40079. } else {
  40080. included ? toggleStatus("remove") : toggleStatus("add");
  40081. }
  40082. return changed;
  40083. }
  40084. function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren") {
  40085. const isNil = (array) => !(Array.isArray(array) && array.length);
  40086. function _walker(parent, children, level) {
  40087. cb(parent, children, level);
  40088. children.forEach((item) => {
  40089. if (item[lazyKey]) {
  40090. cb(item, null, level + 1);
  40091. return;
  40092. }
  40093. const children2 = item[childrenKey];
  40094. if (!isNil(children2)) {
  40095. _walker(item, children2, level + 1);
  40096. }
  40097. });
  40098. }
  40099. root.forEach((item) => {
  40100. if (item[lazyKey]) {
  40101. cb(item, null, 0);
  40102. return;
  40103. }
  40104. const children = item[childrenKey];
  40105. if (!isNil(children)) {
  40106. _walker(item, children, 0);
  40107. }
  40108. });
  40109. }
  40110. let removePopper;
  40111. function createTablePopper(parentNode, trigger, popperContent, popperOptions, tooltipEffect) {
  40112. const { nextZIndex } = useZIndex();
  40113. const ns = parentNode == null ? void 0 : parentNode.dataset.prefix;
  40114. const scrollContainer = parentNode == null ? void 0 : parentNode.querySelector(`.${ns}-scrollbar__wrap`);
  40115. function renderContent() {
  40116. const isLight = tooltipEffect === "light";
  40117. const content2 = document.createElement("div");
  40118. content2.className = `${ns}-popper ${isLight ? "is-light" : "is-dark"}`;
  40119. popperContent = escapeHtml_1(popperContent);
  40120. content2.innerHTML = popperContent;
  40121. content2.style.zIndex = String(nextZIndex());
  40122. parentNode == null ? void 0 : parentNode.appendChild(content2);
  40123. return content2;
  40124. }
  40125. function renderArrow() {
  40126. const arrow2 = document.createElement("div");
  40127. arrow2.className = `${ns}-popper__arrow`;
  40128. return arrow2;
  40129. }
  40130. function showPopper() {
  40131. popperInstance && popperInstance.update();
  40132. }
  40133. removePopper == null ? void 0 : removePopper();
  40134. removePopper = () => {
  40135. try {
  40136. popperInstance && popperInstance.destroy();
  40137. content && (parentNode == null ? void 0 : parentNode.removeChild(content));
  40138. trigger.removeEventListener("mouseenter", showPopper);
  40139. trigger.removeEventListener("mouseleave", removePopper);
  40140. scrollContainer == null ? void 0 : scrollContainer.removeEventListener("scroll", removePopper);
  40141. removePopper = void 0;
  40142. } catch (e) {
  40143. }
  40144. };
  40145. let popperInstance = null;
  40146. const content = renderContent();
  40147. const arrow = renderArrow();
  40148. content.appendChild(arrow);
  40149. popperInstance = yn(trigger, content, {
  40150. strategy: "absolute",
  40151. modifiers: [
  40152. {
  40153. name: "offset",
  40154. options: {
  40155. offset: [0, 8]
  40156. }
  40157. },
  40158. {
  40159. name: "arrow",
  40160. options: {
  40161. element: arrow,
  40162. padding: 10
  40163. }
  40164. }
  40165. ],
  40166. ...popperOptions
  40167. });
  40168. trigger.addEventListener("mouseenter", showPopper);
  40169. trigger.addEventListener("mouseleave", removePopper);
  40170. scrollContainer == null ? void 0 : scrollContainer.addEventListener("scroll", removePopper);
  40171. return popperInstance;
  40172. }
  40173. function getCurrentColumns(column) {
  40174. if (column.children) {
  40175. return flatMap(column.children, getCurrentColumns);
  40176. } else {
  40177. return [column];
  40178. }
  40179. }
  40180. function getColSpan(colSpan, column) {
  40181. return colSpan + column.colSpan;
  40182. }
  40183. const isFixedColumn = (index, fixed, store, realColumns) => {
  40184. let start = 0;
  40185. let after = index;
  40186. const columns = store.states.columns.value;
  40187. if (realColumns) {
  40188. const curColumns = getCurrentColumns(realColumns[index]);
  40189. const preColumns = columns.slice(0, columns.indexOf(curColumns[0]));
  40190. start = preColumns.reduce(getColSpan, 0);
  40191. after = start + curColumns.reduce(getColSpan, 0) - 1;
  40192. } else {
  40193. start = index;
  40194. }
  40195. let fixedLayout;
  40196. switch (fixed) {
  40197. case "left":
  40198. if (after < store.states.fixedLeafColumnsLength.value) {
  40199. fixedLayout = "left";
  40200. }
  40201. break;
  40202. case "right":
  40203. if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  40204. fixedLayout = "right";
  40205. }
  40206. break;
  40207. default:
  40208. if (after < store.states.fixedLeafColumnsLength.value) {
  40209. fixedLayout = "left";
  40210. } else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) {
  40211. fixedLayout = "right";
  40212. }
  40213. }
  40214. return fixedLayout ? {
  40215. direction: fixedLayout,
  40216. start,
  40217. after
  40218. } : {};
  40219. };
  40220. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
  40221. const classes = [];
  40222. const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
  40223. if (direction) {
  40224. const isLeft = direction === "left";
  40225. classes.push(`${namespace}-fixed-column--${direction}`);
  40226. if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) {
  40227. classes.push("is-last-column");
  40228. } else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) {
  40229. classes.push("is-first-column");
  40230. }
  40231. }
  40232. return classes;
  40233. };
  40234. function getOffset(offset, column) {
  40235. return offset + (column.realWidth === null || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  40236. }
  40237. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  40238. const {
  40239. direction,
  40240. start = 0,
  40241. after = 0
  40242. } = isFixedColumn(index, fixed, store, realColumns);
  40243. if (!direction) {
  40244. return;
  40245. }
  40246. const styles = {};
  40247. const isLeft = direction === "left";
  40248. const columns = store.states.columns.value;
  40249. if (isLeft) {
  40250. styles.left = columns.slice(0, start).reduce(getOffset, 0);
  40251. } else {
  40252. styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
  40253. }
  40254. return styles;
  40255. };
  40256. const ensurePosition = (style, key) => {
  40257. if (!style)
  40258. return;
  40259. if (!Number.isNaN(style[key])) {
  40260. style[key] = `${style[key]}px`;
  40261. }
  40262. };
  40263. function useExpand(watcherData) {
  40264. const instance = vue.getCurrentInstance();
  40265. const defaultExpandAll = vue.ref(false);
  40266. const expandRows = vue.ref([]);
  40267. const updateExpandRows = () => {
  40268. const data = watcherData.data.value || [];
  40269. const rowKey = watcherData.rowKey.value;
  40270. if (defaultExpandAll.value) {
  40271. expandRows.value = data.slice();
  40272. } else if (rowKey) {
  40273. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  40274. expandRows.value = data.reduce((prev, row) => {
  40275. const rowId = getRowIdentity(row, rowKey);
  40276. const rowInfo = expandRowsMap[rowId];
  40277. if (rowInfo) {
  40278. prev.push(row);
  40279. }
  40280. return prev;
  40281. }, []);
  40282. } else {
  40283. expandRows.value = [];
  40284. }
  40285. };
  40286. const toggleRowExpansion = (row, expanded) => {
  40287. const changed = toggleRowStatus(expandRows.value, row, expanded);
  40288. if (changed) {
  40289. instance.emit("expand-change", row, expandRows.value.slice());
  40290. }
  40291. };
  40292. const setExpandRowKeys = (rowKeys) => {
  40293. instance.store.assertRowKey();
  40294. const data = watcherData.data.value || [];
  40295. const rowKey = watcherData.rowKey.value;
  40296. const keysMap = getKeysMap(data, rowKey);
  40297. expandRows.value = rowKeys.reduce((prev, cur) => {
  40298. const info = keysMap[cur];
  40299. if (info) {
  40300. prev.push(info.row);
  40301. }
  40302. return prev;
  40303. }, []);
  40304. };
  40305. const isRowExpanded = (row) => {
  40306. const rowKey = watcherData.rowKey.value;
  40307. if (rowKey) {
  40308. const expandMap = getKeysMap(expandRows.value, rowKey);
  40309. return !!expandMap[getRowIdentity(row, rowKey)];
  40310. }
  40311. return expandRows.value.includes(row);
  40312. };
  40313. return {
  40314. updateExpandRows,
  40315. toggleRowExpansion,
  40316. setExpandRowKeys,
  40317. isRowExpanded,
  40318. states: {
  40319. expandRows,
  40320. defaultExpandAll
  40321. }
  40322. };
  40323. }
  40324. function useCurrent(watcherData) {
  40325. const instance = vue.getCurrentInstance();
  40326. const _currentRowKey = vue.ref(null);
  40327. const currentRow = vue.ref(null);
  40328. const setCurrentRowKey = (key) => {
  40329. instance.store.assertRowKey();
  40330. _currentRowKey.value = key;
  40331. setCurrentRowByKey(key);
  40332. };
  40333. const restoreCurrentRowKey = () => {
  40334. _currentRowKey.value = null;
  40335. };
  40336. const setCurrentRowByKey = (key) => {
  40337. const { data, rowKey } = watcherData;
  40338. let _currentRow = null;
  40339. if (rowKey.value) {
  40340. _currentRow = (vue.unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key);
  40341. }
  40342. currentRow.value = _currentRow;
  40343. instance.emit("current-change", currentRow.value, null);
  40344. };
  40345. const updateCurrentRow = (_currentRow) => {
  40346. const oldCurrentRow = currentRow.value;
  40347. if (_currentRow && _currentRow !== oldCurrentRow) {
  40348. currentRow.value = _currentRow;
  40349. instance.emit("current-change", currentRow.value, oldCurrentRow);
  40350. return;
  40351. }
  40352. if (!_currentRow && oldCurrentRow) {
  40353. currentRow.value = null;
  40354. instance.emit("current-change", null, oldCurrentRow);
  40355. }
  40356. };
  40357. const updateCurrentRowData = () => {
  40358. const rowKey = watcherData.rowKey.value;
  40359. const data = watcherData.data.value || [];
  40360. const oldCurrentRow = currentRow.value;
  40361. if (!data.includes(oldCurrentRow) && oldCurrentRow) {
  40362. if (rowKey) {
  40363. const currentRowKey = getRowIdentity(oldCurrentRow, rowKey);
  40364. setCurrentRowByKey(currentRowKey);
  40365. } else {
  40366. currentRow.value = null;
  40367. }
  40368. if (currentRow.value === null) {
  40369. instance.emit("current-change", null, oldCurrentRow);
  40370. }
  40371. } else if (_currentRowKey.value) {
  40372. setCurrentRowByKey(_currentRowKey.value);
  40373. restoreCurrentRowKey();
  40374. }
  40375. };
  40376. return {
  40377. setCurrentRowKey,
  40378. restoreCurrentRowKey,
  40379. setCurrentRowByKey,
  40380. updateCurrentRow,
  40381. updateCurrentRowData,
  40382. states: {
  40383. _currentRowKey,
  40384. currentRow
  40385. }
  40386. };
  40387. }
  40388. function useTree$2(watcherData) {
  40389. const expandRowKeys = vue.ref([]);
  40390. const treeData = vue.ref({});
  40391. const indent = vue.ref(16);
  40392. const lazy = vue.ref(false);
  40393. const lazyTreeNodeMap = vue.ref({});
  40394. const lazyColumnIdentifier = vue.ref("hasChildren");
  40395. const childrenColumnName = vue.ref("children");
  40396. const instance = vue.getCurrentInstance();
  40397. const normalizedData = vue.computed(() => {
  40398. if (!watcherData.rowKey.value)
  40399. return {};
  40400. const data = watcherData.data.value || [];
  40401. return normalize(data);
  40402. });
  40403. const normalizedLazyNode = vue.computed(() => {
  40404. const rowKey = watcherData.rowKey.value;
  40405. const keys = Object.keys(lazyTreeNodeMap.value);
  40406. const res = {};
  40407. if (!keys.length)
  40408. return res;
  40409. keys.forEach((key) => {
  40410. if (lazyTreeNodeMap.value[key].length) {
  40411. const item = { children: [] };
  40412. lazyTreeNodeMap.value[key].forEach((row) => {
  40413. const currentRowKey = getRowIdentity(row, rowKey);
  40414. item.children.push(currentRowKey);
  40415. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) {
  40416. res[currentRowKey] = { children: [] };
  40417. }
  40418. });
  40419. res[key] = item;
  40420. }
  40421. });
  40422. return res;
  40423. });
  40424. const normalize = (data) => {
  40425. const rowKey = watcherData.rowKey.value;
  40426. const res = {};
  40427. walkTreeNode(data, (parent, children, level) => {
  40428. const parentId = getRowIdentity(parent, rowKey);
  40429. if (Array.isArray(children)) {
  40430. res[parentId] = {
  40431. children: children.map((row) => getRowIdentity(row, rowKey)),
  40432. level
  40433. };
  40434. } else if (lazy.value) {
  40435. res[parentId] = {
  40436. children: [],
  40437. lazy: true,
  40438. level
  40439. };
  40440. }
  40441. }, childrenColumnName.value, lazyColumnIdentifier.value);
  40442. return res;
  40443. };
  40444. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll = ((_a) => (_a = instance.store) == null ? void 0 : _a.states.defaultExpandAll.value)()) => {
  40445. var _a2;
  40446. const nested = normalizedData.value;
  40447. const normalizedLazyNode_ = normalizedLazyNode.value;
  40448. const keys = Object.keys(nested);
  40449. const newTreeData = {};
  40450. if (keys.length) {
  40451. const oldTreeData = vue.unref(treeData);
  40452. const rootLazyRowKeys = [];
  40453. const getExpanded = (oldValue, key) => {
  40454. if (ifChangeExpandRowKeys) {
  40455. if (expandRowKeys.value) {
  40456. return ifExpandAll || expandRowKeys.value.includes(key);
  40457. } else {
  40458. return !!(ifExpandAll || (oldValue == null ? void 0 : oldValue.expanded));
  40459. }
  40460. } else {
  40461. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  40462. return !!((oldValue == null ? void 0 : oldValue.expanded) || included);
  40463. }
  40464. };
  40465. keys.forEach((key) => {
  40466. const oldValue = oldTreeData[key];
  40467. const newValue = { ...nested[key] };
  40468. newValue.expanded = getExpanded(oldValue, key);
  40469. if (newValue.lazy) {
  40470. const { loaded = false, loading = false } = oldValue || {};
  40471. newValue.loaded = !!loaded;
  40472. newValue.loading = !!loading;
  40473. rootLazyRowKeys.push(key);
  40474. }
  40475. newTreeData[key] = newValue;
  40476. });
  40477. const lazyKeys = Object.keys(normalizedLazyNode_);
  40478. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) {
  40479. lazyKeys.forEach((key) => {
  40480. const oldValue = oldTreeData[key];
  40481. const lazyNodeChildren = normalizedLazyNode_[key].children;
  40482. if (rootLazyRowKeys.includes(key)) {
  40483. if (newTreeData[key].children.length !== 0) {
  40484. throw new Error("[ElTable]children must be an empty array.");
  40485. }
  40486. newTreeData[key].children = lazyNodeChildren;
  40487. } else {
  40488. const { loaded = false, loading = false } = oldValue || {};
  40489. newTreeData[key] = {
  40490. lazy: true,
  40491. loaded: !!loaded,
  40492. loading: !!loading,
  40493. expanded: getExpanded(oldValue, key),
  40494. children: lazyNodeChildren,
  40495. level: ""
  40496. };
  40497. }
  40498. });
  40499. }
  40500. }
  40501. treeData.value = newTreeData;
  40502. (_a2 = instance.store) == null ? void 0 : _a2.updateTableScrollY();
  40503. };
  40504. vue.watch(() => expandRowKeys.value, () => {
  40505. updateTreeData(true);
  40506. });
  40507. vue.watch(() => normalizedData.value, () => {
  40508. updateTreeData();
  40509. });
  40510. vue.watch(() => normalizedLazyNode.value, () => {
  40511. updateTreeData();
  40512. });
  40513. const updateTreeExpandKeys = (value) => {
  40514. expandRowKeys.value = value;
  40515. updateTreeData();
  40516. };
  40517. const toggleTreeExpansion = (row, expanded) => {
  40518. instance.store.assertRowKey();
  40519. const rowKey = watcherData.rowKey.value;
  40520. const id = getRowIdentity(row, rowKey);
  40521. const data = id && treeData.value[id];
  40522. if (id && data && "expanded" in data) {
  40523. const oldExpanded = data.expanded;
  40524. expanded = typeof expanded === "undefined" ? !data.expanded : expanded;
  40525. treeData.value[id].expanded = expanded;
  40526. if (oldExpanded !== expanded) {
  40527. instance.emit("expand-change", row, expanded);
  40528. }
  40529. instance.store.updateTableScrollY();
  40530. }
  40531. };
  40532. const loadOrToggle = (row) => {
  40533. instance.store.assertRowKey();
  40534. const rowKey = watcherData.rowKey.value;
  40535. const id = getRowIdentity(row, rowKey);
  40536. const data = treeData.value[id];
  40537. if (lazy.value && data && "loaded" in data && !data.loaded) {
  40538. loadData(row, id, data);
  40539. } else {
  40540. toggleTreeExpansion(row, void 0);
  40541. }
  40542. };
  40543. const loadData = (row, key, treeNode) => {
  40544. const { load } = instance.props;
  40545. if (load && !treeData.value[key].loaded) {
  40546. treeData.value[key].loading = true;
  40547. load(row, treeNode, (data) => {
  40548. if (!Array.isArray(data)) {
  40549. throw new TypeError("[ElTable] data must be an array");
  40550. }
  40551. treeData.value[key].loading = false;
  40552. treeData.value[key].loaded = true;
  40553. treeData.value[key].expanded = true;
  40554. if (data.length) {
  40555. lazyTreeNodeMap.value[key] = data;
  40556. }
  40557. instance.emit("expand-change", row, true);
  40558. });
  40559. }
  40560. };
  40561. return {
  40562. loadData,
  40563. loadOrToggle,
  40564. toggleTreeExpansion,
  40565. updateTreeExpandKeys,
  40566. updateTreeData,
  40567. normalize,
  40568. states: {
  40569. expandRowKeys,
  40570. treeData,
  40571. indent,
  40572. lazy,
  40573. lazyTreeNodeMap,
  40574. lazyColumnIdentifier,
  40575. childrenColumnName
  40576. }
  40577. };
  40578. }
  40579. const sortData = (data, states) => {
  40580. const sortingColumn = states.sortingColumn;
  40581. if (!sortingColumn || typeof sortingColumn.sortable === "string") {
  40582. return data;
  40583. }
  40584. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  40585. };
  40586. const doFlattenColumns = (columns) => {
  40587. const result = [];
  40588. columns.forEach((column) => {
  40589. if (column.children) {
  40590. result.push.apply(result, doFlattenColumns(column.children));
  40591. } else {
  40592. result.push(column);
  40593. }
  40594. });
  40595. return result;
  40596. };
  40597. function useWatcher$1() {
  40598. var _a;
  40599. const instance = vue.getCurrentInstance();
  40600. const { size: tableSize } = vue.toRefs((_a = instance.proxy) == null ? void 0 : _a.$props);
  40601. const rowKey = vue.ref(null);
  40602. const data = vue.ref([]);
  40603. const _data = vue.ref([]);
  40604. const isComplex = vue.ref(false);
  40605. const _columns = vue.ref([]);
  40606. const originColumns = vue.ref([]);
  40607. const columns = vue.ref([]);
  40608. const fixedColumns = vue.ref([]);
  40609. const rightFixedColumns = vue.ref([]);
  40610. const leafColumns = vue.ref([]);
  40611. const fixedLeafColumns = vue.ref([]);
  40612. const rightFixedLeafColumns = vue.ref([]);
  40613. const leafColumnsLength = vue.ref(0);
  40614. const fixedLeafColumnsLength = vue.ref(0);
  40615. const rightFixedLeafColumnsLength = vue.ref(0);
  40616. const isAllSelected = vue.ref(false);
  40617. const selection = vue.ref([]);
  40618. const reserveSelection = vue.ref(false);
  40619. const selectOnIndeterminate = vue.ref(false);
  40620. const selectable = vue.ref(null);
  40621. const filters = vue.ref({});
  40622. const filteredData = vue.ref(null);
  40623. const sortingColumn = vue.ref(null);
  40624. const sortProp = vue.ref(null);
  40625. const sortOrder = vue.ref(null);
  40626. const hoverRow = vue.ref(null);
  40627. vue.watch(data, () => instance.state && scheduleLayout(false), {
  40628. deep: true
  40629. });
  40630. const assertRowKey = () => {
  40631. if (!rowKey.value)
  40632. throw new Error("[ElTable] prop row-key is required");
  40633. };
  40634. const updateChildFixed = (column) => {
  40635. var _a2;
  40636. (_a2 = column.children) == null ? void 0 : _a2.forEach((childColumn) => {
  40637. childColumn.fixed = column.fixed;
  40638. updateChildFixed(childColumn);
  40639. });
  40640. };
  40641. const updateColumns = () => {
  40642. _columns.value.forEach((column) => {
  40643. updateChildFixed(column);
  40644. });
  40645. fixedColumns.value = _columns.value.filter((column) => column.fixed === true || column.fixed === "left");
  40646. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  40647. if (fixedColumns.value.length > 0 && _columns.value[0] && _columns.value[0].type === "selection" && !_columns.value[0].fixed) {
  40648. _columns.value[0].fixed = true;
  40649. fixedColumns.value.unshift(_columns.value[0]);
  40650. }
  40651. const notFixedColumns = _columns.value.filter((column) => !column.fixed);
  40652. originColumns.value = [].concat(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  40653. const leafColumns2 = doFlattenColumns(notFixedColumns);
  40654. const fixedLeafColumns2 = doFlattenColumns(fixedColumns.value);
  40655. const rightFixedLeafColumns2 = doFlattenColumns(rightFixedColumns.value);
  40656. leafColumnsLength.value = leafColumns2.length;
  40657. fixedLeafColumnsLength.value = fixedLeafColumns2.length;
  40658. rightFixedLeafColumnsLength.value = rightFixedLeafColumns2.length;
  40659. columns.value = [].concat(fixedLeafColumns2).concat(leafColumns2).concat(rightFixedLeafColumns2);
  40660. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  40661. };
  40662. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  40663. if (needUpdateColumns) {
  40664. updateColumns();
  40665. }
  40666. if (immediate) {
  40667. instance.state.doLayout();
  40668. } else {
  40669. instance.state.debouncedUpdateLayout();
  40670. }
  40671. };
  40672. const isSelected = (row) => {
  40673. return selection.value.includes(row);
  40674. };
  40675. const clearSelection = () => {
  40676. isAllSelected.value = false;
  40677. const oldSelection = selection.value;
  40678. if (oldSelection.length) {
  40679. selection.value = [];
  40680. instance.emit("selection-change", []);
  40681. }
  40682. };
  40683. const cleanSelection = () => {
  40684. let deleted;
  40685. if (rowKey.value) {
  40686. deleted = [];
  40687. const selectedMap = getKeysMap(selection.value, rowKey.value);
  40688. const dataMap = getKeysMap(data.value, rowKey.value);
  40689. for (const key in selectedMap) {
  40690. if (hasOwn(selectedMap, key) && !dataMap[key]) {
  40691. deleted.push(selectedMap[key].row);
  40692. }
  40693. }
  40694. } else {
  40695. deleted = selection.value.filter((item) => !data.value.includes(item));
  40696. }
  40697. if (deleted.length) {
  40698. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  40699. selection.value = newSelection;
  40700. instance.emit("selection-change", newSelection.slice());
  40701. }
  40702. };
  40703. const getSelectionRows = () => {
  40704. return (selection.value || []).slice();
  40705. };
  40706. const toggleRowSelection = (row, selected = void 0, emitChange = true) => {
  40707. const changed = toggleRowStatus(selection.value, row, selected);
  40708. if (changed) {
  40709. const newSelection = (selection.value || []).slice();
  40710. if (emitChange) {
  40711. instance.emit("select", newSelection, row);
  40712. }
  40713. instance.emit("selection-change", newSelection);
  40714. }
  40715. };
  40716. const _toggleAllSelection = () => {
  40717. var _a2, _b;
  40718. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  40719. isAllSelected.value = value;
  40720. let selectionChanged = false;
  40721. let childrenCount = 0;
  40722. const rowKey2 = (_b = (_a2 = instance == null ? void 0 : instance.store) == null ? void 0 : _a2.states) == null ? void 0 : _b.rowKey.value;
  40723. data.value.forEach((row, index) => {
  40724. const rowIndex = index + childrenCount;
  40725. if (selectable.value) {
  40726. if (selectable.value.call(null, row, rowIndex) && toggleRowStatus(selection.value, row, value)) {
  40727. selectionChanged = true;
  40728. }
  40729. } else {
  40730. if (toggleRowStatus(selection.value, row, value)) {
  40731. selectionChanged = true;
  40732. }
  40733. }
  40734. childrenCount += getChildrenCount(getRowIdentity(row, rowKey2));
  40735. });
  40736. if (selectionChanged) {
  40737. instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  40738. }
  40739. instance.emit("select-all", selection.value);
  40740. };
  40741. const updateSelectionByRowKey = () => {
  40742. const selectedMap = getKeysMap(selection.value, rowKey.value);
  40743. data.value.forEach((row) => {
  40744. const rowId = getRowIdentity(row, rowKey.value);
  40745. const rowInfo = selectedMap[rowId];
  40746. if (rowInfo) {
  40747. selection.value[rowInfo.index] = row;
  40748. }
  40749. });
  40750. };
  40751. const updateAllSelected = () => {
  40752. var _a2, _b, _c;
  40753. if (((_a2 = data.value) == null ? void 0 : _a2.length) === 0) {
  40754. isAllSelected.value = false;
  40755. return;
  40756. }
  40757. let selectedMap;
  40758. if (rowKey.value) {
  40759. selectedMap = getKeysMap(selection.value, rowKey.value);
  40760. }
  40761. const isSelected2 = function(row) {
  40762. if (selectedMap) {
  40763. return !!selectedMap[getRowIdentity(row, rowKey.value)];
  40764. } else {
  40765. return selection.value.includes(row);
  40766. }
  40767. };
  40768. let isAllSelected_ = true;
  40769. let selectedCount = 0;
  40770. let childrenCount = 0;
  40771. for (let i = 0, j = (data.value || []).length; i < j; i++) {
  40772. const keyProp = (_c = (_b = instance == null ? void 0 : instance.store) == null ? void 0 : _b.states) == null ? void 0 : _c.rowKey.value;
  40773. const rowIndex = i + childrenCount;
  40774. const item = data.value[i];
  40775. const isRowSelectable = selectable.value && selectable.value.call(null, item, rowIndex);
  40776. if (!isSelected2(item)) {
  40777. if (!selectable.value || isRowSelectable) {
  40778. isAllSelected_ = false;
  40779. break;
  40780. }
  40781. } else {
  40782. selectedCount++;
  40783. }
  40784. childrenCount += getChildrenCount(getRowIdentity(item, keyProp));
  40785. }
  40786. if (selectedCount === 0)
  40787. isAllSelected_ = false;
  40788. isAllSelected.value = isAllSelected_;
  40789. };
  40790. const getChildrenCount = (rowKey2) => {
  40791. var _a2;
  40792. if (!instance || !instance.store)
  40793. return 0;
  40794. const { treeData } = instance.store.states;
  40795. let count = 0;
  40796. const children = (_a2 = treeData.value[rowKey2]) == null ? void 0 : _a2.children;
  40797. if (children) {
  40798. count += children.length;
  40799. children.forEach((childKey) => {
  40800. count += getChildrenCount(childKey);
  40801. });
  40802. }
  40803. return count;
  40804. };
  40805. const updateFilters = (columns2, values) => {
  40806. if (!Array.isArray(columns2)) {
  40807. columns2 = [columns2];
  40808. }
  40809. const filters_ = {};
  40810. columns2.forEach((col) => {
  40811. filters.value[col.id] = values;
  40812. filters_[col.columnKey || col.id] = values;
  40813. });
  40814. return filters_;
  40815. };
  40816. const updateSort = (column, prop, order) => {
  40817. if (sortingColumn.value && sortingColumn.value !== column) {
  40818. sortingColumn.value.order = null;
  40819. }
  40820. sortingColumn.value = column;
  40821. sortProp.value = prop;
  40822. sortOrder.value = order;
  40823. };
  40824. const execFilter = () => {
  40825. let sourceData = vue.unref(_data);
  40826. Object.keys(filters.value).forEach((columnId) => {
  40827. const values = filters.value[columnId];
  40828. if (!values || values.length === 0)
  40829. return;
  40830. const column = getColumnById({
  40831. columns: columns.value
  40832. }, columnId);
  40833. if (column && column.filterMethod) {
  40834. sourceData = sourceData.filter((row) => {
  40835. return values.some((value) => column.filterMethod.call(null, value, row, column));
  40836. });
  40837. }
  40838. });
  40839. filteredData.value = sourceData;
  40840. };
  40841. const execSort = () => {
  40842. data.value = sortData(filteredData.value, {
  40843. sortingColumn: sortingColumn.value,
  40844. sortProp: sortProp.value,
  40845. sortOrder: sortOrder.value
  40846. });
  40847. };
  40848. const execQuery = (ignore = void 0) => {
  40849. if (!(ignore && ignore.filter)) {
  40850. execFilter();
  40851. }
  40852. execSort();
  40853. };
  40854. const clearFilter = (columnKeys) => {
  40855. const { tableHeaderRef } = instance.refs;
  40856. if (!tableHeaderRef)
  40857. return;
  40858. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  40859. const keys = Object.keys(panels);
  40860. if (!keys.length)
  40861. return;
  40862. if (typeof columnKeys === "string") {
  40863. columnKeys = [columnKeys];
  40864. }
  40865. if (Array.isArray(columnKeys)) {
  40866. const columns_ = columnKeys.map((key) => getColumnByKey({
  40867. columns: columns.value
  40868. }, key));
  40869. keys.forEach((key) => {
  40870. const column = columns_.find((col) => col.id === key);
  40871. if (column) {
  40872. column.filteredValue = [];
  40873. }
  40874. });
  40875. instance.store.commit("filterChange", {
  40876. column: columns_,
  40877. values: [],
  40878. silent: true,
  40879. multi: true
  40880. });
  40881. } else {
  40882. keys.forEach((key) => {
  40883. const column = columns.value.find((col) => col.id === key);
  40884. if (column) {
  40885. column.filteredValue = [];
  40886. }
  40887. });
  40888. filters.value = {};
  40889. instance.store.commit("filterChange", {
  40890. column: {},
  40891. values: [],
  40892. silent: true
  40893. });
  40894. }
  40895. };
  40896. const clearSort = () => {
  40897. if (!sortingColumn.value)
  40898. return;
  40899. updateSort(null, null, null);
  40900. instance.store.commit("changeSortCondition", {
  40901. silent: true
  40902. });
  40903. };
  40904. const {
  40905. setExpandRowKeys,
  40906. toggleRowExpansion,
  40907. updateExpandRows,
  40908. states: expandStates,
  40909. isRowExpanded
  40910. } = useExpand({
  40911. data,
  40912. rowKey
  40913. });
  40914. const {
  40915. updateTreeExpandKeys,
  40916. toggleTreeExpansion,
  40917. updateTreeData,
  40918. loadOrToggle,
  40919. states: treeStates
  40920. } = useTree$2({
  40921. data,
  40922. rowKey
  40923. });
  40924. const {
  40925. updateCurrentRowData,
  40926. updateCurrentRow,
  40927. setCurrentRowKey,
  40928. states: currentData
  40929. } = useCurrent({
  40930. data,
  40931. rowKey
  40932. });
  40933. const setExpandRowKeysAdapter = (val) => {
  40934. setExpandRowKeys(val);
  40935. updateTreeExpandKeys(val);
  40936. };
  40937. const toggleRowExpansionAdapter = (row, expanded) => {
  40938. const hasExpandColumn = columns.value.some(({ type }) => type === "expand");
  40939. if (hasExpandColumn) {
  40940. toggleRowExpansion(row, expanded);
  40941. } else {
  40942. toggleTreeExpansion(row, expanded);
  40943. }
  40944. };
  40945. return {
  40946. assertRowKey,
  40947. updateColumns,
  40948. scheduleLayout,
  40949. isSelected,
  40950. clearSelection,
  40951. cleanSelection,
  40952. getSelectionRows,
  40953. toggleRowSelection,
  40954. _toggleAllSelection,
  40955. toggleAllSelection: null,
  40956. updateSelectionByRowKey,
  40957. updateAllSelected,
  40958. updateFilters,
  40959. updateCurrentRow,
  40960. updateSort,
  40961. execFilter,
  40962. execSort,
  40963. execQuery,
  40964. clearFilter,
  40965. clearSort,
  40966. toggleRowExpansion,
  40967. setExpandRowKeysAdapter,
  40968. setCurrentRowKey,
  40969. toggleRowExpansionAdapter,
  40970. isRowExpanded,
  40971. updateExpandRows,
  40972. updateCurrentRowData,
  40973. loadOrToggle,
  40974. updateTreeData,
  40975. states: {
  40976. tableSize,
  40977. rowKey,
  40978. data,
  40979. _data,
  40980. isComplex,
  40981. _columns,
  40982. originColumns,
  40983. columns,
  40984. fixedColumns,
  40985. rightFixedColumns,
  40986. leafColumns,
  40987. fixedLeafColumns,
  40988. rightFixedLeafColumns,
  40989. leafColumnsLength,
  40990. fixedLeafColumnsLength,
  40991. rightFixedLeafColumnsLength,
  40992. isAllSelected,
  40993. selection,
  40994. reserveSelection,
  40995. selectOnIndeterminate,
  40996. selectable,
  40997. filters,
  40998. filteredData,
  40999. sortingColumn,
  41000. sortProp,
  41001. sortOrder,
  41002. hoverRow,
  41003. ...expandStates,
  41004. ...treeStates,
  41005. ...currentData
  41006. }
  41007. };
  41008. }
  41009. function replaceColumn(array, column) {
  41010. return array.map((item) => {
  41011. var _a;
  41012. if (item.id === column.id) {
  41013. return column;
  41014. } else if ((_a = item.children) == null ? void 0 : _a.length) {
  41015. item.children = replaceColumn(item.children, column);
  41016. }
  41017. return item;
  41018. });
  41019. }
  41020. function sortColumn(array) {
  41021. array.forEach((item) => {
  41022. var _a, _b;
  41023. item.no = (_a = item.getColumnIndex) == null ? void 0 : _a.call(item);
  41024. if ((_b = item.children) == null ? void 0 : _b.length) {
  41025. sortColumn(item.children);
  41026. }
  41027. });
  41028. array.sort((cur, pre) => cur.no - pre.no);
  41029. }
  41030. function useStore() {
  41031. const instance = vue.getCurrentInstance();
  41032. const watcher = useWatcher$1();
  41033. const ns = useNamespace("table");
  41034. const mutations = {
  41035. setData(states, data) {
  41036. const dataInstanceChanged = vue.unref(states._data) !== data;
  41037. states.data.value = data;
  41038. states._data.value = data;
  41039. instance.store.execQuery();
  41040. instance.store.updateCurrentRowData();
  41041. instance.store.updateExpandRows();
  41042. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  41043. if (vue.unref(states.reserveSelection)) {
  41044. instance.store.assertRowKey();
  41045. instance.store.updateSelectionByRowKey();
  41046. } else {
  41047. if (dataInstanceChanged) {
  41048. instance.store.clearSelection();
  41049. } else {
  41050. instance.store.cleanSelection();
  41051. }
  41052. }
  41053. instance.store.updateAllSelected();
  41054. if (instance.$ready) {
  41055. instance.store.scheduleLayout();
  41056. }
  41057. },
  41058. insertColumn(states, column, parent) {
  41059. const array = vue.unref(states._columns);
  41060. let newColumns = [];
  41061. if (!parent) {
  41062. array.push(column);
  41063. newColumns = array;
  41064. } else {
  41065. if (parent && !parent.children) {
  41066. parent.children = [];
  41067. }
  41068. parent.children.push(column);
  41069. newColumns = replaceColumn(array, parent);
  41070. }
  41071. sortColumn(newColumns);
  41072. states._columns.value = newColumns;
  41073. if (column.type === "selection") {
  41074. states.selectable.value = column.selectable;
  41075. states.reserveSelection.value = column.reserveSelection;
  41076. }
  41077. if (instance.$ready) {
  41078. instance.store.updateColumns();
  41079. instance.store.scheduleLayout();
  41080. }
  41081. },
  41082. removeColumn(states, column, parent) {
  41083. const array = vue.unref(states._columns) || [];
  41084. if (parent) {
  41085. parent.children.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  41086. if (parent.children.length === 0) {
  41087. delete parent.children;
  41088. }
  41089. states._columns.value = replaceColumn(array, parent);
  41090. } else {
  41091. const index = array.indexOf(column);
  41092. if (index > -1) {
  41093. array.splice(index, 1);
  41094. states._columns.value = array;
  41095. }
  41096. }
  41097. if (instance.$ready) {
  41098. instance.store.updateColumns();
  41099. instance.store.scheduleLayout();
  41100. }
  41101. },
  41102. sort(states, options) {
  41103. const { prop, order, init } = options;
  41104. if (prop) {
  41105. const column = vue.unref(states.columns).find((column2) => column2.property === prop);
  41106. if (column) {
  41107. column.order = order;
  41108. instance.store.updateSort(column, prop, order);
  41109. instance.store.commit("changeSortCondition", { init });
  41110. }
  41111. }
  41112. },
  41113. changeSortCondition(states, options) {
  41114. const { sortingColumn, sortProp, sortOrder } = states;
  41115. const columnValue = vue.unref(sortingColumn), propValue = vue.unref(sortProp), orderValue = vue.unref(sortOrder);
  41116. if (orderValue === null) {
  41117. states.sortingColumn.value = null;
  41118. states.sortProp.value = null;
  41119. }
  41120. const ignore = { filter: true };
  41121. instance.store.execQuery(ignore);
  41122. if (!options || !(options.silent || options.init)) {
  41123. instance.emit("sort-change", {
  41124. column: columnValue,
  41125. prop: propValue,
  41126. order: orderValue
  41127. });
  41128. }
  41129. instance.store.updateTableScrollY();
  41130. },
  41131. filterChange(_states, options) {
  41132. const { column, values, silent } = options;
  41133. const newFilters = instance.store.updateFilters(column, values);
  41134. instance.store.execQuery();
  41135. if (!silent) {
  41136. instance.emit("filter-change", newFilters);
  41137. }
  41138. instance.store.updateTableScrollY();
  41139. },
  41140. toggleAllSelection() {
  41141. instance.store.toggleAllSelection();
  41142. },
  41143. rowSelectedChanged(_states, row) {
  41144. instance.store.toggleRowSelection(row);
  41145. instance.store.updateAllSelected();
  41146. },
  41147. setHoverRow(states, row) {
  41148. states.hoverRow.value = row;
  41149. },
  41150. setCurrentRow(_states, row) {
  41151. instance.store.updateCurrentRow(row);
  41152. }
  41153. };
  41154. const commit = function(name, ...args) {
  41155. const mutations2 = instance.store.mutations;
  41156. if (mutations2[name]) {
  41157. mutations2[name].apply(instance, [instance.store.states].concat(args));
  41158. } else {
  41159. throw new Error(`Action not found: ${name}`);
  41160. }
  41161. };
  41162. const updateTableScrollY = function() {
  41163. vue.nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  41164. };
  41165. return {
  41166. ns,
  41167. ...watcher,
  41168. mutations,
  41169. commit,
  41170. updateTableScrollY
  41171. };
  41172. }
  41173. const InitialStateMap = {
  41174. rowKey: "rowKey",
  41175. defaultExpandAll: "defaultExpandAll",
  41176. selectOnIndeterminate: "selectOnIndeterminate",
  41177. indent: "indent",
  41178. lazy: "lazy",
  41179. data: "data",
  41180. ["treeProps.hasChildren"]: {
  41181. key: "lazyColumnIdentifier",
  41182. default: "hasChildren"
  41183. },
  41184. ["treeProps.children"]: {
  41185. key: "childrenColumnName",
  41186. default: "children"
  41187. }
  41188. };
  41189. function createStore(table, props) {
  41190. if (!table) {
  41191. throw new Error("Table is required.");
  41192. }
  41193. const store = useStore();
  41194. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  41195. Object.keys(InitialStateMap).forEach((key) => {
  41196. handleValue(getArrKeysValue(props, key), key, store);
  41197. });
  41198. proxyTableProps(store, props);
  41199. return store;
  41200. }
  41201. function proxyTableProps(store, props) {
  41202. Object.keys(InitialStateMap).forEach((key) => {
  41203. vue.watch(() => getArrKeysValue(props, key), (value) => {
  41204. handleValue(value, key, store);
  41205. });
  41206. });
  41207. }
  41208. function handleValue(value, propsKey, store) {
  41209. let newVal = value;
  41210. let storeKey = InitialStateMap[propsKey];
  41211. if (typeof InitialStateMap[propsKey] === "object") {
  41212. storeKey = storeKey.key;
  41213. newVal = newVal || InitialStateMap[propsKey].default;
  41214. }
  41215. store.states[storeKey].value = newVal;
  41216. }
  41217. function getArrKeysValue(props, keys) {
  41218. if (keys.includes(".")) {
  41219. const keyList = keys.split(".");
  41220. let value = props;
  41221. keyList.forEach((key) => {
  41222. value = value[key];
  41223. });
  41224. return value;
  41225. } else {
  41226. return props[keys];
  41227. }
  41228. }
  41229. class TableLayout {
  41230. constructor(options) {
  41231. this.observers = [];
  41232. this.table = null;
  41233. this.store = null;
  41234. this.columns = [];
  41235. this.fit = true;
  41236. this.showHeader = true;
  41237. this.height = vue.ref(null);
  41238. this.scrollX = vue.ref(false);
  41239. this.scrollY = vue.ref(false);
  41240. this.bodyWidth = vue.ref(null);
  41241. this.fixedWidth = vue.ref(null);
  41242. this.rightFixedWidth = vue.ref(null);
  41243. this.gutterWidth = 0;
  41244. for (const name in options) {
  41245. if (hasOwn(options, name)) {
  41246. if (vue.isRef(this[name])) {
  41247. this[name].value = options[name];
  41248. } else {
  41249. this[name] = options[name];
  41250. }
  41251. }
  41252. }
  41253. if (!this.table) {
  41254. throw new Error("Table is required for Table Layout");
  41255. }
  41256. if (!this.store) {
  41257. throw new Error("Store is required for Table Layout");
  41258. }
  41259. }
  41260. updateScrollY() {
  41261. const height = this.height.value;
  41262. if (height === null)
  41263. return false;
  41264. const scrollBarRef = this.table.refs.scrollBarRef;
  41265. if (this.table.vnode.el && scrollBarRef) {
  41266. let scrollY = true;
  41267. const prevScrollY = this.scrollY.value;
  41268. scrollY = scrollBarRef.wrap$.scrollHeight > scrollBarRef.wrap$.clientHeight;
  41269. this.scrollY.value = scrollY;
  41270. return prevScrollY !== scrollY;
  41271. }
  41272. return false;
  41273. }
  41274. setHeight(value, prop = "height") {
  41275. if (!isClient)
  41276. return;
  41277. const el = this.table.vnode.el;
  41278. value = parseHeight(value);
  41279. this.height.value = Number(value);
  41280. if (!el && (value || value === 0))
  41281. return vue.nextTick(() => this.setHeight(value, prop));
  41282. if (typeof value === "number") {
  41283. el.style[prop] = `${value}px`;
  41284. this.updateElsHeight();
  41285. } else if (typeof value === "string") {
  41286. el.style[prop] = value;
  41287. this.updateElsHeight();
  41288. }
  41289. }
  41290. setMaxHeight(value) {
  41291. this.setHeight(value, "max-height");
  41292. }
  41293. getFlattenColumns() {
  41294. const flattenColumns = [];
  41295. const columns = this.table.store.states.columns.value;
  41296. columns.forEach((column) => {
  41297. if (column.isColumnGroup) {
  41298. flattenColumns.push.apply(flattenColumns, column.columns);
  41299. } else {
  41300. flattenColumns.push(column);
  41301. }
  41302. });
  41303. return flattenColumns;
  41304. }
  41305. updateElsHeight() {
  41306. this.updateScrollY();
  41307. this.notifyObservers("scrollable");
  41308. }
  41309. headerDisplayNone(elm) {
  41310. if (!elm)
  41311. return true;
  41312. let headerChild = elm;
  41313. while (headerChild.tagName !== "DIV") {
  41314. if (getComputedStyle(headerChild).display === "none") {
  41315. return true;
  41316. }
  41317. headerChild = headerChild.parentElement;
  41318. }
  41319. return false;
  41320. }
  41321. updateColumnsWidth() {
  41322. if (!isClient)
  41323. return;
  41324. const fit = this.fit;
  41325. const bodyWidth = this.table.vnode.el.clientWidth;
  41326. let bodyMinWidth = 0;
  41327. const flattenColumns = this.getFlattenColumns();
  41328. const flexColumns = flattenColumns.filter((column) => typeof column.width !== "number");
  41329. flattenColumns.forEach((column) => {
  41330. if (typeof column.width === "number" && column.realWidth)
  41331. column.realWidth = null;
  41332. });
  41333. if (flexColumns.length > 0 && fit) {
  41334. flattenColumns.forEach((column) => {
  41335. bodyMinWidth += Number(column.width || column.minWidth || 80);
  41336. });
  41337. if (bodyMinWidth <= bodyWidth) {
  41338. this.scrollX.value = false;
  41339. const totalFlexWidth = bodyWidth - bodyMinWidth;
  41340. if (flexColumns.length === 1) {
  41341. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  41342. } else {
  41343. const allColumnsWidth = flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  41344. const flexWidthPerPixel = totalFlexWidth / allColumnsWidth;
  41345. let noneFirstWidth = 0;
  41346. flexColumns.forEach((column, index) => {
  41347. if (index === 0)
  41348. return;
  41349. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  41350. noneFirstWidth += flexWidth;
  41351. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  41352. });
  41353. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  41354. }
  41355. } else {
  41356. this.scrollX.value = true;
  41357. flexColumns.forEach((column) => {
  41358. column.realWidth = Number(column.minWidth);
  41359. });
  41360. }
  41361. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  41362. this.table.state.resizeState.value.width = this.bodyWidth.value;
  41363. } else {
  41364. flattenColumns.forEach((column) => {
  41365. if (!column.width && !column.minWidth) {
  41366. column.realWidth = 80;
  41367. } else {
  41368. column.realWidth = Number(column.width || column.minWidth);
  41369. }
  41370. bodyMinWidth += column.realWidth;
  41371. });
  41372. this.scrollX.value = bodyMinWidth > bodyWidth;
  41373. this.bodyWidth.value = bodyMinWidth;
  41374. }
  41375. const fixedColumns = this.store.states.fixedColumns.value;
  41376. if (fixedColumns.length > 0) {
  41377. let fixedWidth = 0;
  41378. fixedColumns.forEach((column) => {
  41379. fixedWidth += Number(column.realWidth || column.width);
  41380. });
  41381. this.fixedWidth.value = fixedWidth;
  41382. }
  41383. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  41384. if (rightFixedColumns.length > 0) {
  41385. let rightFixedWidth = 0;
  41386. rightFixedColumns.forEach((column) => {
  41387. rightFixedWidth += Number(column.realWidth || column.width);
  41388. });
  41389. this.rightFixedWidth.value = rightFixedWidth;
  41390. }
  41391. this.notifyObservers("columns");
  41392. }
  41393. addObserver(observer) {
  41394. this.observers.push(observer);
  41395. }
  41396. removeObserver(observer) {
  41397. const index = this.observers.indexOf(observer);
  41398. if (index !== -1) {
  41399. this.observers.splice(index, 1);
  41400. }
  41401. }
  41402. notifyObservers(event) {
  41403. const observers = this.observers;
  41404. observers.forEach((observer) => {
  41405. var _a, _b;
  41406. switch (event) {
  41407. case "columns":
  41408. (_a = observer.state) == null ? void 0 : _a.onColumnsChange(this);
  41409. break;
  41410. case "scrollable":
  41411. (_b = observer.state) == null ? void 0 : _b.onScrollableChange(this);
  41412. break;
  41413. default:
  41414. throw new Error(`Table Layout don't have event ${event}.`);
  41415. }
  41416. });
  41417. }
  41418. }
  41419. var TableLayout$1 = TableLayout;
  41420. const { CheckboxGroup: ElCheckboxGroup } = ElCheckbox;
  41421. const _sfc_main$q = vue.defineComponent({
  41422. name: "ElTableFilterPanel",
  41423. components: {
  41424. ElCheckbox,
  41425. ElCheckboxGroup,
  41426. ElScrollbar,
  41427. ElTooltip,
  41428. ElIcon,
  41429. ArrowDown: arrow_down_default,
  41430. ArrowUp: arrow_up_default
  41431. },
  41432. directives: { ClickOutside },
  41433. props: {
  41434. placement: {
  41435. type: String,
  41436. default: "bottom-start"
  41437. },
  41438. store: {
  41439. type: Object
  41440. },
  41441. column: {
  41442. type: Object
  41443. },
  41444. upDataColumn: {
  41445. type: Function
  41446. }
  41447. },
  41448. setup(props) {
  41449. const instance = vue.getCurrentInstance();
  41450. const { t } = useLocale();
  41451. const ns = useNamespace("table-filter");
  41452. const parent = instance == null ? void 0 : instance.parent;
  41453. if (!parent.filterPanels.value[props.column.id]) {
  41454. parent.filterPanels.value[props.column.id] = instance;
  41455. }
  41456. const tooltipVisible = vue.ref(false);
  41457. const tooltip = vue.ref(null);
  41458. const filters = vue.computed(() => {
  41459. return props.column && props.column.filters;
  41460. });
  41461. const filterValue = vue.computed({
  41462. get: () => {
  41463. var _a;
  41464. return (((_a = props.column) == null ? void 0 : _a.filteredValue) || [])[0];
  41465. },
  41466. set: (value) => {
  41467. if (filteredValue.value) {
  41468. if (typeof value !== "undefined" && value !== null) {
  41469. filteredValue.value.splice(0, 1, value);
  41470. } else {
  41471. filteredValue.value.splice(0, 1);
  41472. }
  41473. }
  41474. }
  41475. });
  41476. const filteredValue = vue.computed({
  41477. get() {
  41478. if (props.column) {
  41479. return props.column.filteredValue || [];
  41480. }
  41481. return [];
  41482. },
  41483. set(value) {
  41484. if (props.column) {
  41485. props.upDataColumn("filteredValue", value);
  41486. }
  41487. }
  41488. });
  41489. const multiple = vue.computed(() => {
  41490. if (props.column) {
  41491. return props.column.filterMultiple;
  41492. }
  41493. return true;
  41494. });
  41495. const isActive = (filter) => {
  41496. return filter.value === filterValue.value;
  41497. };
  41498. const hidden = () => {
  41499. tooltipVisible.value = false;
  41500. };
  41501. const showFilterPanel = (e) => {
  41502. e.stopPropagation();
  41503. tooltipVisible.value = !tooltipVisible.value;
  41504. };
  41505. const hideFilterPanel = () => {
  41506. tooltipVisible.value = false;
  41507. };
  41508. const handleConfirm = () => {
  41509. confirmFilter(filteredValue.value);
  41510. hidden();
  41511. };
  41512. const handleReset = () => {
  41513. filteredValue.value = [];
  41514. confirmFilter(filteredValue.value);
  41515. hidden();
  41516. };
  41517. const handleSelect = (_filterValue) => {
  41518. filterValue.value = _filterValue;
  41519. if (typeof _filterValue !== "undefined" && _filterValue !== null) {
  41520. confirmFilter(filteredValue.value);
  41521. } else {
  41522. confirmFilter([]);
  41523. }
  41524. hidden();
  41525. };
  41526. const confirmFilter = (filteredValue2) => {
  41527. props.store.commit("filterChange", {
  41528. column: props.column,
  41529. values: filteredValue2
  41530. });
  41531. props.store.updateAllSelected();
  41532. };
  41533. vue.watch(tooltipVisible, (value) => {
  41534. if (props.column) {
  41535. props.upDataColumn("filterOpened", value);
  41536. }
  41537. }, {
  41538. immediate: true
  41539. });
  41540. const popperPaneRef = vue.computed(() => {
  41541. var _a, _b;
  41542. return (_b = (_a = tooltip.value) == null ? void 0 : _a.popperRef) == null ? void 0 : _b.contentRef;
  41543. });
  41544. return {
  41545. tooltipVisible,
  41546. multiple,
  41547. filteredValue,
  41548. filterValue,
  41549. filters,
  41550. handleConfirm,
  41551. handleReset,
  41552. handleSelect,
  41553. isActive,
  41554. t,
  41555. ns,
  41556. showFilterPanel,
  41557. hideFilterPanel,
  41558. popperPaneRef,
  41559. tooltip
  41560. };
  41561. }
  41562. });
  41563. const _hoisted_1$c = { key: 0 };
  41564. const _hoisted_2$8 = ["disabled"];
  41565. const _hoisted_3$3 = ["label", "onClick"];
  41566. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  41567. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  41568. const _component_el_checkbox_group = vue.resolveComponent("el-checkbox-group");
  41569. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  41570. const _component_arrow_up = vue.resolveComponent("arrow-up");
  41571. const _component_arrow_down = vue.resolveComponent("arrow-down");
  41572. const _component_el_icon = vue.resolveComponent("el-icon");
  41573. const _component_el_tooltip = vue.resolveComponent("el-tooltip");
  41574. const _directive_click_outside = vue.resolveDirective("click-outside");
  41575. return vue.openBlock(), vue.createBlock(_component_el_tooltip, {
  41576. ref: "tooltip",
  41577. visible: _ctx.tooltipVisible,
  41578. offset: 0,
  41579. placement: _ctx.placement,
  41580. "show-arrow": false,
  41581. "stop-popper-mouse-event": false,
  41582. teleported: "",
  41583. effect: "light",
  41584. pure: "",
  41585. "popper-class": _ctx.ns.b(),
  41586. persistent: ""
  41587. }, {
  41588. content: vue.withCtx(() => [
  41589. _ctx.multiple ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, [
  41590. vue.createElementVNode("div", {
  41591. class: vue.normalizeClass(_ctx.ns.e("content"))
  41592. }, [
  41593. vue.createVNode(_component_el_scrollbar, {
  41594. "wrap-class": _ctx.ns.e("wrap")
  41595. }, {
  41596. default: vue.withCtx(() => [
  41597. vue.createVNode(_component_el_checkbox_group, {
  41598. modelValue: _ctx.filteredValue,
  41599. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
  41600. class: vue.normalizeClass(_ctx.ns.e("checkbox-group"))
  41601. }, {
  41602. default: vue.withCtx(() => [
  41603. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  41604. return vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  41605. key: filter.value,
  41606. label: filter.value
  41607. }, {
  41608. default: vue.withCtx(() => [
  41609. vue.createTextVNode(vue.toDisplayString(filter.text), 1)
  41610. ]),
  41611. _: 2
  41612. }, 1032, ["label"]);
  41613. }), 128))
  41614. ]),
  41615. _: 1
  41616. }, 8, ["modelValue", "class"])
  41617. ]),
  41618. _: 1
  41619. }, 8, ["wrap-class"])
  41620. ], 2),
  41621. vue.createElementVNode("div", {
  41622. class: vue.normalizeClass(_ctx.ns.e("bottom"))
  41623. }, [
  41624. vue.createElementVNode("button", {
  41625. class: vue.normalizeClass({ [_ctx.ns.is("disabled")]: _ctx.filteredValue.length === 0 }),
  41626. disabled: _ctx.filteredValue.length === 0,
  41627. type: "button",
  41628. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
  41629. }, vue.toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_2$8),
  41630. vue.createElementVNode("button", {
  41631. type: "button",
  41632. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
  41633. }, vue.toDisplayString(_ctx.t("el.table.resetFilter")), 1)
  41634. ], 2)
  41635. ])) : (vue.openBlock(), vue.createElementBlock("ul", {
  41636. key: 1,
  41637. class: vue.normalizeClass(_ctx.ns.e("list"))
  41638. }, [
  41639. vue.createElementVNode("li", {
  41640. class: vue.normalizeClass([
  41641. _ctx.ns.e("list-item"),
  41642. {
  41643. [_ctx.ns.is("active")]: _ctx.filterValue === void 0 || _ctx.filterValue === null
  41644. }
  41645. ]),
  41646. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null))
  41647. }, vue.toDisplayString(_ctx.t("el.table.clearFilter")), 3),
  41648. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.filters, (filter) => {
  41649. return vue.openBlock(), vue.createElementBlock("li", {
  41650. key: filter.value,
  41651. class: vue.normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  41652. label: filter.value,
  41653. onClick: ($event) => _ctx.handleSelect(filter.value)
  41654. }, vue.toDisplayString(filter.text), 11, _hoisted_3$3);
  41655. }), 128))
  41656. ], 2))
  41657. ]),
  41658. default: vue.withCtx(() => [
  41659. vue.withDirectives((vue.openBlock(), vue.createElementBlock("span", {
  41660. class: vue.normalizeClass([
  41661. `${_ctx.ns.namespace.value}-table__column-filter-trigger`,
  41662. `${_ctx.ns.namespace.value}-none-outline`
  41663. ]),
  41664. onClick: _cache[4] || (_cache[4] = (...args) => _ctx.showFilterPanel && _ctx.showFilterPanel(...args))
  41665. }, [
  41666. vue.createVNode(_component_el_icon, null, {
  41667. default: vue.withCtx(() => [
  41668. _ctx.column.filterOpened ? (vue.openBlock(), vue.createBlock(_component_arrow_up, { key: 0 })) : (vue.openBlock(), vue.createBlock(_component_arrow_down, { key: 1 }))
  41669. ]),
  41670. _: 1
  41671. })
  41672. ], 2)), [
  41673. [_directive_click_outside, _ctx.hideFilterPanel, _ctx.popperPaneRef]
  41674. ])
  41675. ]),
  41676. _: 1
  41677. }, 8, ["visible", "placement", "popper-class"]);
  41678. }
  41679. var FilterPanel = /* @__PURE__ */ _export_sfc(_sfc_main$q, [["render", _sfc_render$4], ["__file", "filter-panel.vue"]]);
  41680. function useLayoutObserver(root) {
  41681. const instance = vue.getCurrentInstance();
  41682. vue.onBeforeMount(() => {
  41683. tableLayout.value.addObserver(instance);
  41684. });
  41685. vue.onMounted(() => {
  41686. onColumnsChange(tableLayout.value);
  41687. onScrollableChange(tableLayout.value);
  41688. });
  41689. vue.onUpdated(() => {
  41690. onColumnsChange(tableLayout.value);
  41691. onScrollableChange(tableLayout.value);
  41692. });
  41693. vue.onUnmounted(() => {
  41694. tableLayout.value.removeObserver(instance);
  41695. });
  41696. const tableLayout = vue.computed(() => {
  41697. const layout = root.layout;
  41698. if (!layout) {
  41699. throw new Error("Can not find table layout.");
  41700. }
  41701. return layout;
  41702. });
  41703. const onColumnsChange = (layout) => {
  41704. var _a;
  41705. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col")) || [];
  41706. if (!cols.length)
  41707. return;
  41708. const flattenColumns = layout.getFlattenColumns();
  41709. const columnsMap = {};
  41710. flattenColumns.forEach((column) => {
  41711. columnsMap[column.id] = column;
  41712. });
  41713. for (let i = 0, j = cols.length; i < j; i++) {
  41714. const col = cols[i];
  41715. const name = col.getAttribute("name");
  41716. const column = columnsMap[name];
  41717. if (column) {
  41718. col.setAttribute("width", column.realWidth || column.width);
  41719. }
  41720. }
  41721. };
  41722. const onScrollableChange = (layout) => {
  41723. var _a, _b;
  41724. const cols = ((_a = root.vnode.el) == null ? void 0 : _a.querySelectorAll("colgroup > col[name=gutter]")) || [];
  41725. for (let i = 0, j = cols.length; i < j; i++) {
  41726. const col = cols[i];
  41727. col.setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  41728. }
  41729. const ths = ((_b = root.vnode.el) == null ? void 0 : _b.querySelectorAll("th.gutter")) || [];
  41730. for (let i = 0, j = ths.length; i < j; i++) {
  41731. const th = ths[i];
  41732. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  41733. th.style.display = layout.scrollY.value ? "" : "none";
  41734. }
  41735. };
  41736. return {
  41737. tableLayout: tableLayout.value,
  41738. onColumnsChange,
  41739. onScrollableChange
  41740. };
  41741. }
  41742. const TABLE_INJECTION_KEY = Symbol("ElTable");
  41743. function useEvent(props, emit) {
  41744. const instance = vue.getCurrentInstance();
  41745. const parent = vue.inject(TABLE_INJECTION_KEY);
  41746. const handleFilterClick = (event) => {
  41747. event.stopPropagation();
  41748. return;
  41749. };
  41750. const handleHeaderClick = (event, column) => {
  41751. if (!column.filters && column.sortable) {
  41752. handleSortClick(event, column, false);
  41753. } else if (column.filterable && !column.sortable) {
  41754. handleFilterClick(event);
  41755. }
  41756. parent == null ? void 0 : parent.emit("header-click", column, event);
  41757. };
  41758. const handleHeaderContextMenu = (event, column) => {
  41759. parent == null ? void 0 : parent.emit("header-contextmenu", column, event);
  41760. };
  41761. const draggingColumn = vue.ref(null);
  41762. const dragging = vue.ref(false);
  41763. const dragState = vue.ref({});
  41764. const handleMouseDown = (event, column) => {
  41765. if (!isClient)
  41766. return;
  41767. if (column.children && column.children.length > 0)
  41768. return;
  41769. if (draggingColumn.value && props.border) {
  41770. dragging.value = true;
  41771. const table = parent;
  41772. emit("set-drag-visible", true);
  41773. const tableEl = table == null ? void 0 : table.vnode.el;
  41774. const tableLeft = tableEl.getBoundingClientRect().left;
  41775. const columnEl = instance.vnode.el.querySelector(`th.${column.id}`);
  41776. const columnRect = columnEl.getBoundingClientRect();
  41777. const minLeft = columnRect.left - tableLeft + 30;
  41778. addClass(columnEl, "noclick");
  41779. dragState.value = {
  41780. startMouseLeft: event.clientX,
  41781. startLeft: columnRect.right - tableLeft,
  41782. startColumnLeft: columnRect.left - tableLeft,
  41783. tableLeft
  41784. };
  41785. const resizeProxy = table == null ? void 0 : table.refs.resizeProxy;
  41786. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  41787. document.onselectstart = function() {
  41788. return false;
  41789. };
  41790. document.ondragstart = function() {
  41791. return false;
  41792. };
  41793. const handleMouseMove2 = (event2) => {
  41794. const deltaLeft = event2.clientX - dragState.value.startMouseLeft;
  41795. const proxyLeft = dragState.value.startLeft + deltaLeft;
  41796. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  41797. };
  41798. const handleMouseUp = () => {
  41799. if (dragging.value) {
  41800. const { startColumnLeft, startLeft } = dragState.value;
  41801. const finalLeft = Number.parseInt(resizeProxy.style.left, 10);
  41802. const columnWidth = finalLeft - startColumnLeft;
  41803. column.width = column.realWidth = columnWidth;
  41804. table == null ? void 0 : table.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  41805. requestAnimationFrame(() => {
  41806. props.store.scheduleLayout(false, true);
  41807. });
  41808. document.body.style.cursor = "";
  41809. dragging.value = false;
  41810. draggingColumn.value = null;
  41811. dragState.value = {};
  41812. emit("set-drag-visible", false);
  41813. }
  41814. document.removeEventListener("mousemove", handleMouseMove2);
  41815. document.removeEventListener("mouseup", handleMouseUp);
  41816. document.onselectstart = null;
  41817. document.ondragstart = null;
  41818. setTimeout(() => {
  41819. removeClass(columnEl, "noclick");
  41820. }, 0);
  41821. };
  41822. document.addEventListener("mousemove", handleMouseMove2);
  41823. document.addEventListener("mouseup", handleMouseUp);
  41824. }
  41825. };
  41826. const handleMouseMove = (event, column) => {
  41827. var _a;
  41828. if (column.children && column.children.length > 0)
  41829. return;
  41830. const target = (_a = event.target) == null ? void 0 : _a.closest("th");
  41831. if (!column || !column.resizable)
  41832. return;
  41833. if (!dragging.value && props.border) {
  41834. const rect = target.getBoundingClientRect();
  41835. const bodyStyle = document.body.style;
  41836. if (rect.width > 12 && rect.right - event.pageX < 8) {
  41837. bodyStyle.cursor = "col-resize";
  41838. if (hasClass(target, "is-sortable")) {
  41839. target.style.cursor = "col-resize";
  41840. }
  41841. draggingColumn.value = column;
  41842. } else if (!dragging.value) {
  41843. bodyStyle.cursor = "";
  41844. if (hasClass(target, "is-sortable")) {
  41845. target.style.cursor = "pointer";
  41846. }
  41847. draggingColumn.value = null;
  41848. }
  41849. }
  41850. };
  41851. const handleMouseOut = () => {
  41852. if (!isClient)
  41853. return;
  41854. document.body.style.cursor = "";
  41855. };
  41856. const toggleOrder = ({ order, sortOrders }) => {
  41857. if (order === "")
  41858. return sortOrders[0];
  41859. const index = sortOrders.indexOf(order || null);
  41860. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  41861. };
  41862. const handleSortClick = (event, column, givenOrder) => {
  41863. var _a;
  41864. event.stopPropagation();
  41865. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  41866. const target = (_a = event.target) == null ? void 0 : _a.closest("th");
  41867. if (target) {
  41868. if (hasClass(target, "noclick")) {
  41869. removeClass(target, "noclick");
  41870. return;
  41871. }
  41872. }
  41873. if (!column.sortable)
  41874. return;
  41875. const states = props.store.states;
  41876. let sortProp = states.sortProp.value;
  41877. let sortOrder;
  41878. const sortingColumn = states.sortingColumn.value;
  41879. if (sortingColumn !== column || sortingColumn === column && sortingColumn.order === null) {
  41880. if (sortingColumn) {
  41881. sortingColumn.order = null;
  41882. }
  41883. states.sortingColumn.value = column;
  41884. sortProp = column.property;
  41885. }
  41886. if (!order) {
  41887. sortOrder = column.order = null;
  41888. } else {
  41889. sortOrder = column.order = order;
  41890. }
  41891. states.sortProp.value = sortProp;
  41892. states.sortOrder.value = sortOrder;
  41893. parent == null ? void 0 : parent.store.commit("changeSortCondition");
  41894. };
  41895. return {
  41896. handleHeaderClick,
  41897. handleHeaderContextMenu,
  41898. handleMouseDown,
  41899. handleMouseMove,
  41900. handleMouseOut,
  41901. handleSortClick,
  41902. handleFilterClick
  41903. };
  41904. }
  41905. function useStyle$2(props) {
  41906. const parent = vue.inject(TABLE_INJECTION_KEY);
  41907. const ns = useNamespace("table");
  41908. const getHeaderRowStyle = (rowIndex) => {
  41909. const headerRowStyle = parent == null ? void 0 : parent.props.headerRowStyle;
  41910. if (typeof headerRowStyle === "function") {
  41911. return headerRowStyle.call(null, { rowIndex });
  41912. }
  41913. return headerRowStyle;
  41914. };
  41915. const getHeaderRowClass = (rowIndex) => {
  41916. const classes = [];
  41917. const headerRowClassName = parent == null ? void 0 : parent.props.headerRowClassName;
  41918. if (typeof headerRowClassName === "string") {
  41919. classes.push(headerRowClassName);
  41920. } else if (typeof headerRowClassName === "function") {
  41921. classes.push(headerRowClassName.call(null, { rowIndex }));
  41922. }
  41923. return classes.join(" ");
  41924. };
  41925. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  41926. var _a;
  41927. let headerCellStyles = (_a = parent == null ? void 0 : parent.props.headerCellStyle) != null ? _a : {};
  41928. if (typeof headerCellStyles === "function") {
  41929. headerCellStyles = headerCellStyles.call(null, {
  41930. rowIndex,
  41931. columnIndex,
  41932. row,
  41933. column
  41934. });
  41935. }
  41936. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  41937. ensurePosition(fixedStyle, "left");
  41938. ensurePosition(fixedStyle, "right");
  41939. return Object.assign({}, headerCellStyles, fixedStyle);
  41940. };
  41941. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  41942. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  41943. const classes = [
  41944. column.id,
  41945. column.order,
  41946. column.headerAlign,
  41947. column.className,
  41948. column.labelClassName,
  41949. ...fixedClasses
  41950. ];
  41951. if (!column.children) {
  41952. classes.push("is-leaf");
  41953. }
  41954. if (column.sortable) {
  41955. classes.push("is-sortable");
  41956. }
  41957. const headerCellClassName = parent == null ? void 0 : parent.props.headerCellClassName;
  41958. if (typeof headerCellClassName === "string") {
  41959. classes.push(headerCellClassName);
  41960. } else if (typeof headerCellClassName === "function") {
  41961. classes.push(headerCellClassName.call(null, {
  41962. rowIndex,
  41963. columnIndex,
  41964. row,
  41965. column
  41966. }));
  41967. }
  41968. classes.push(ns.e("cell"));
  41969. return classes.filter((className) => Boolean(className)).join(" ");
  41970. };
  41971. return {
  41972. getHeaderRowStyle,
  41973. getHeaderRowClass,
  41974. getHeaderCellStyle,
  41975. getHeaderCellClass
  41976. };
  41977. }
  41978. const getAllColumns = (columns) => {
  41979. const result = [];
  41980. columns.forEach((column) => {
  41981. if (column.children) {
  41982. result.push(column);
  41983. result.push.apply(result, getAllColumns(column.children));
  41984. } else {
  41985. result.push(column);
  41986. }
  41987. });
  41988. return result;
  41989. };
  41990. const convertToRows = (originColumns) => {
  41991. let maxLevel = 1;
  41992. const traverse = (column, parent) => {
  41993. if (parent) {
  41994. column.level = parent.level + 1;
  41995. if (maxLevel < column.level) {
  41996. maxLevel = column.level;
  41997. }
  41998. }
  41999. if (column.children) {
  42000. let colSpan = 0;
  42001. column.children.forEach((subColumn) => {
  42002. traverse(subColumn, column);
  42003. colSpan += subColumn.colSpan;
  42004. });
  42005. column.colSpan = colSpan;
  42006. } else {
  42007. column.colSpan = 1;
  42008. }
  42009. };
  42010. originColumns.forEach((column) => {
  42011. column.level = 1;
  42012. traverse(column, void 0);
  42013. });
  42014. const rows = [];
  42015. for (let i = 0; i < maxLevel; i++) {
  42016. rows.push([]);
  42017. }
  42018. const allColumns = getAllColumns(originColumns);
  42019. allColumns.forEach((column) => {
  42020. if (!column.children) {
  42021. column.rowSpan = maxLevel - column.level + 1;
  42022. } else {
  42023. column.rowSpan = 1;
  42024. column.children.forEach((col) => col.isSubColumn = true);
  42025. }
  42026. rows[column.level - 1].push(column);
  42027. });
  42028. return rows;
  42029. };
  42030. function useUtils$1(props) {
  42031. const parent = vue.inject(TABLE_INJECTION_KEY);
  42032. const columnRows = vue.computed(() => {
  42033. return convertToRows(props.store.states.originColumns.value);
  42034. });
  42035. const isGroup = vue.computed(() => {
  42036. const result = columnRows.value.length > 1;
  42037. if (result && parent) {
  42038. parent.state.isGroup.value = true;
  42039. }
  42040. return result;
  42041. });
  42042. const toggleAllSelection = (event) => {
  42043. event.stopPropagation();
  42044. parent == null ? void 0 : parent.store.commit("toggleAllSelection");
  42045. };
  42046. return {
  42047. isGroup,
  42048. toggleAllSelection,
  42049. columnRows
  42050. };
  42051. }
  42052. var TableHeader = vue.defineComponent({
  42053. name: "ElTableHeader",
  42054. components: {
  42055. ElCheckbox
  42056. },
  42057. props: {
  42058. fixed: {
  42059. type: String,
  42060. default: ""
  42061. },
  42062. store: {
  42063. required: true,
  42064. type: Object
  42065. },
  42066. border: Boolean,
  42067. defaultSort: {
  42068. type: Object,
  42069. default: () => {
  42070. return {
  42071. prop: "",
  42072. order: ""
  42073. };
  42074. }
  42075. }
  42076. },
  42077. setup(props, { emit }) {
  42078. const instance = vue.getCurrentInstance();
  42079. const parent = vue.inject(TABLE_INJECTION_KEY);
  42080. const ns = useNamespace("table");
  42081. const filterPanels = vue.ref({});
  42082. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  42083. vue.onMounted(async () => {
  42084. await vue.nextTick();
  42085. await vue.nextTick();
  42086. const { prop, order } = props.defaultSort;
  42087. parent == null ? void 0 : parent.store.commit("sort", { prop, order, init: true });
  42088. });
  42089. const {
  42090. handleHeaderClick,
  42091. handleHeaderContextMenu,
  42092. handleMouseDown,
  42093. handleMouseMove,
  42094. handleMouseOut,
  42095. handleSortClick,
  42096. handleFilterClick
  42097. } = useEvent(props, emit);
  42098. const {
  42099. getHeaderRowStyle,
  42100. getHeaderRowClass,
  42101. getHeaderCellStyle,
  42102. getHeaderCellClass
  42103. } = useStyle$2(props);
  42104. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  42105. instance.state = {
  42106. onColumnsChange,
  42107. onScrollableChange
  42108. };
  42109. instance.filterPanels = filterPanels;
  42110. return {
  42111. ns,
  42112. filterPanels,
  42113. onColumnsChange,
  42114. onScrollableChange,
  42115. columnRows,
  42116. getHeaderRowClass,
  42117. getHeaderRowStyle,
  42118. getHeaderCellClass,
  42119. getHeaderCellStyle,
  42120. handleHeaderClick,
  42121. handleHeaderContextMenu,
  42122. handleMouseDown,
  42123. handleMouseMove,
  42124. handleMouseOut,
  42125. handleSortClick,
  42126. handleFilterClick,
  42127. isGroup,
  42128. toggleAllSelection
  42129. };
  42130. },
  42131. render() {
  42132. const {
  42133. ns,
  42134. isGroup,
  42135. columnRows,
  42136. getHeaderCellStyle,
  42137. getHeaderCellClass,
  42138. getHeaderRowClass,
  42139. getHeaderRowStyle,
  42140. handleHeaderClick,
  42141. handleHeaderContextMenu,
  42142. handleMouseDown,
  42143. handleMouseMove,
  42144. handleSortClick,
  42145. handleMouseOut,
  42146. store,
  42147. $parent
  42148. } = this;
  42149. let rowSpan = 1;
  42150. return vue.h("thead", {
  42151. class: { [ns.is("group")]: isGroup }
  42152. }, columnRows.map((subColumns, rowIndex) => vue.h("tr", {
  42153. class: getHeaderRowClass(rowIndex),
  42154. key: rowIndex,
  42155. style: getHeaderRowStyle(rowIndex)
  42156. }, subColumns.map((column, cellIndex) => {
  42157. if (column.rowSpan > rowSpan) {
  42158. rowSpan = column.rowSpan;
  42159. }
  42160. return vue.h("th", {
  42161. class: getHeaderCellClass(rowIndex, cellIndex, subColumns, column),
  42162. colspan: column.colSpan,
  42163. key: `${column.id}-thead`,
  42164. rowspan: column.rowSpan,
  42165. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  42166. onClick: ($event) => handleHeaderClick($event, column),
  42167. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  42168. onMousedown: ($event) => handleMouseDown($event, column),
  42169. onMousemove: ($event) => handleMouseMove($event, column),
  42170. onMouseout: handleMouseOut
  42171. }, [
  42172. vue.h("div", {
  42173. class: [
  42174. "cell",
  42175. column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""
  42176. ]
  42177. }, [
  42178. column.renderHeader ? column.renderHeader({
  42179. column,
  42180. $index: cellIndex,
  42181. store,
  42182. _self: $parent
  42183. }) : column.label,
  42184. column.sortable && vue.h("span", {
  42185. onClick: ($event) => handleSortClick($event, column),
  42186. class: "caret-wrapper"
  42187. }, [
  42188. vue.h("i", {
  42189. onClick: ($event) => handleSortClick($event, column, "ascending"),
  42190. class: "sort-caret ascending"
  42191. }),
  42192. vue.h("i", {
  42193. onClick: ($event) => handleSortClick($event, column, "descending"),
  42194. class: "sort-caret descending"
  42195. })
  42196. ]),
  42197. column.filterable && vue.h(FilterPanel, {
  42198. store,
  42199. placement: column.filterPlacement || "bottom-start",
  42200. column,
  42201. upDataColumn: (key, value) => {
  42202. column[key] = value;
  42203. }
  42204. })
  42205. ])
  42206. ]);
  42207. }))));
  42208. }
  42209. });
  42210. function useEvents(props) {
  42211. const parent = vue.inject(TABLE_INJECTION_KEY);
  42212. const tooltipContent = vue.ref("");
  42213. const tooltipTrigger = vue.ref(vue.h("div"));
  42214. const handleEvent = (event, row, name) => {
  42215. var _a;
  42216. const table = parent;
  42217. const cell = getCell(event);
  42218. let column;
  42219. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  42220. if (cell) {
  42221. column = getColumnByCell({
  42222. columns: props.store.states.columns.value
  42223. }, cell, namespace);
  42224. if (column) {
  42225. table == null ? void 0 : table.emit(`cell-${name}`, row, column, cell, event);
  42226. }
  42227. }
  42228. table == null ? void 0 : table.emit(`row-${name}`, row, column, event);
  42229. };
  42230. const handleDoubleClick = (event, row) => {
  42231. handleEvent(event, row, "dblclick");
  42232. };
  42233. const handleClick = (event, row) => {
  42234. props.store.commit("setCurrentRow", row);
  42235. handleEvent(event, row, "click");
  42236. };
  42237. const handleContextMenu = (event, row) => {
  42238. handleEvent(event, row, "contextmenu");
  42239. };
  42240. const handleMouseEnter = debounce((index) => {
  42241. props.store.commit("setHoverRow", index);
  42242. }, 30);
  42243. const handleMouseLeave = debounce(() => {
  42244. props.store.commit("setHoverRow", null);
  42245. }, 30);
  42246. const handleCellMouseEnter = (event, row, tooltipEffect) => {
  42247. var _a;
  42248. const table = parent;
  42249. const cell = getCell(event);
  42250. const namespace = (_a = table == null ? void 0 : table.vnode.el) == null ? void 0 : _a.dataset.prefix;
  42251. if (cell) {
  42252. const column = getColumnByCell({
  42253. columns: props.store.states.columns.value
  42254. }, cell, namespace);
  42255. const hoverState = table.hoverState = { cell, column, row };
  42256. table == null ? void 0 : table.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  42257. }
  42258. const cellChild = event.target.querySelector(".cell");
  42259. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length)) {
  42260. return;
  42261. }
  42262. const range = document.createRange();
  42263. range.setStart(cellChild, 0);
  42264. range.setEnd(cellChild, cellChild.childNodes.length);
  42265. const rangeWidth = range.getBoundingClientRect().width;
  42266. const padding = (Number.parseInt(getStyle(cellChild, "paddingLeft"), 10) || 0) + (Number.parseInt(getStyle(cellChild, "paddingRight"), 10) || 0);
  42267. if (rangeWidth + padding > cellChild.offsetWidth || cellChild.scrollWidth > cellChild.offsetWidth) {
  42268. createTablePopper(parent == null ? void 0 : parent.refs.tableWrapper, cell, cell.innerText || cell.textContent, {
  42269. placement: "top",
  42270. strategy: "fixed"
  42271. }, tooltipEffect);
  42272. }
  42273. };
  42274. const handleCellMouseLeave = (event) => {
  42275. const cell = getCell(event);
  42276. if (!cell)
  42277. return;
  42278. const oldHoverState = parent == null ? void 0 : parent.hoverState;
  42279. 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);
  42280. };
  42281. return {
  42282. handleDoubleClick,
  42283. handleClick,
  42284. handleContextMenu,
  42285. handleMouseEnter,
  42286. handleMouseLeave,
  42287. handleCellMouseEnter,
  42288. handleCellMouseLeave,
  42289. tooltipContent,
  42290. tooltipTrigger
  42291. };
  42292. }
  42293. function useStyles$1(props) {
  42294. const parent = vue.inject(TABLE_INJECTION_KEY);
  42295. const ns = useNamespace("table");
  42296. const getRowStyle = (row, rowIndex) => {
  42297. const rowStyle = parent == null ? void 0 : parent.props.rowStyle;
  42298. if (typeof rowStyle === "function") {
  42299. return rowStyle.call(null, {
  42300. row,
  42301. rowIndex
  42302. });
  42303. }
  42304. return rowStyle || null;
  42305. };
  42306. const getRowClass = (row, rowIndex) => {
  42307. const classes = [ns.e("row")];
  42308. if ((parent == null ? void 0 : parent.props.highlightCurrentRow) && row === props.store.states.currentRow.value) {
  42309. classes.push("current-row");
  42310. }
  42311. if (props.stripe && rowIndex % 2 === 1) {
  42312. classes.push(ns.em("row", "striped"));
  42313. }
  42314. const rowClassName = parent == null ? void 0 : parent.props.rowClassName;
  42315. if (typeof rowClassName === "string") {
  42316. classes.push(rowClassName);
  42317. } else if (typeof rowClassName === "function") {
  42318. classes.push(rowClassName.call(null, {
  42319. row,
  42320. rowIndex
  42321. }));
  42322. }
  42323. return classes;
  42324. };
  42325. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  42326. const cellStyle = parent == null ? void 0 : parent.props.cellStyle;
  42327. let cellStyles = cellStyle != null ? cellStyle : {};
  42328. if (typeof cellStyle === "function") {
  42329. cellStyles = cellStyle.call(null, {
  42330. rowIndex,
  42331. columnIndex,
  42332. row,
  42333. column
  42334. });
  42335. }
  42336. const fixedStyle = getFixedColumnOffset(columnIndex, props == null ? void 0 : props.fixed, props.store);
  42337. ensurePosition(fixedStyle, "left");
  42338. ensurePosition(fixedStyle, "right");
  42339. return Object.assign({}, cellStyles, fixedStyle);
  42340. };
  42341. const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
  42342. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props == null ? void 0 : props.fixed, props.store, void 0, offset);
  42343. const classes = [column.id, column.align, column.className, ...fixedClasses];
  42344. const cellClassName = parent == null ? void 0 : parent.props.cellClassName;
  42345. if (typeof cellClassName === "string") {
  42346. classes.push(cellClassName);
  42347. } else if (typeof cellClassName === "function") {
  42348. classes.push(cellClassName.call(null, {
  42349. rowIndex,
  42350. columnIndex,
  42351. row,
  42352. column
  42353. }));
  42354. }
  42355. classes.push(ns.e("cell"));
  42356. return classes.filter((className) => Boolean(className)).join(" ");
  42357. };
  42358. const getSpan = (row, column, rowIndex, columnIndex) => {
  42359. let rowspan = 1;
  42360. let colspan = 1;
  42361. const fn = parent == null ? void 0 : parent.props.spanMethod;
  42362. if (typeof fn === "function") {
  42363. const result = fn({
  42364. row,
  42365. column,
  42366. rowIndex,
  42367. columnIndex
  42368. });
  42369. if (Array.isArray(result)) {
  42370. rowspan = result[0];
  42371. colspan = result[1];
  42372. } else if (typeof result === "object") {
  42373. rowspan = result.rowspan;
  42374. colspan = result.colspan;
  42375. }
  42376. }
  42377. return { rowspan, colspan };
  42378. };
  42379. const getColspanRealWidth = (columns, colspan, index) => {
  42380. if (colspan < 1) {
  42381. return columns[index].realWidth;
  42382. }
  42383. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  42384. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  42385. };
  42386. return {
  42387. getRowStyle,
  42388. getRowClass,
  42389. getCellStyle,
  42390. getCellClass,
  42391. getSpan,
  42392. getColspanRealWidth
  42393. };
  42394. }
  42395. function useRender$1(props) {
  42396. const parent = vue.inject(TABLE_INJECTION_KEY);
  42397. const ns = useNamespace("table");
  42398. const {
  42399. handleDoubleClick,
  42400. handleClick,
  42401. handleContextMenu,
  42402. handleMouseEnter,
  42403. handleMouseLeave,
  42404. handleCellMouseEnter,
  42405. handleCellMouseLeave,
  42406. tooltipContent,
  42407. tooltipTrigger
  42408. } = useEvents(props);
  42409. const {
  42410. getRowStyle,
  42411. getRowClass,
  42412. getCellStyle,
  42413. getCellClass,
  42414. getSpan,
  42415. getColspanRealWidth
  42416. } = useStyles$1(props);
  42417. const firstDefaultColumnIndex = vue.computed(() => {
  42418. return props.store.states.columns.value.findIndex(({ type }) => type === "default");
  42419. });
  42420. const getKeyOfRow = (row, index) => {
  42421. const rowKey = parent.props.rowKey;
  42422. if (rowKey) {
  42423. return getRowIdentity(row, rowKey);
  42424. }
  42425. return index;
  42426. };
  42427. const rowRender = (row, $index, treeRowData, expanded = false) => {
  42428. const { tooltipEffect, store } = props;
  42429. const { indent, columns } = store.states;
  42430. const rowClasses = getRowClass(row, $index);
  42431. let display = true;
  42432. if (treeRowData) {
  42433. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  42434. display = treeRowData.display;
  42435. }
  42436. const displayStyle = display ? null : {
  42437. display: "none"
  42438. };
  42439. return vue.h("tr", {
  42440. style: [displayStyle, getRowStyle(row, $index)],
  42441. class: rowClasses,
  42442. key: getKeyOfRow(row, $index),
  42443. onDblclick: ($event) => handleDoubleClick($event, row),
  42444. onClick: ($event) => handleClick($event, row),
  42445. onContextmenu: ($event) => handleContextMenu($event, row),
  42446. onMouseenter: () => handleMouseEnter($index),
  42447. onMouseleave: handleMouseLeave
  42448. }, columns.value.map((column, cellIndex) => {
  42449. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  42450. if (!rowspan || !colspan) {
  42451. return null;
  42452. }
  42453. const columnData = { ...column };
  42454. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  42455. const data = {
  42456. store: props.store,
  42457. _self: props.context || parent,
  42458. column: columnData,
  42459. row,
  42460. $index,
  42461. cellIndex,
  42462. expanded
  42463. };
  42464. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  42465. data.treeNode = {
  42466. indent: treeRowData.level * indent.value,
  42467. level: treeRowData.level
  42468. };
  42469. if (typeof treeRowData.expanded === "boolean") {
  42470. data.treeNode.expanded = treeRowData.expanded;
  42471. if ("loading" in treeRowData) {
  42472. data.treeNode.loading = treeRowData.loading;
  42473. }
  42474. if ("noLazyChildren" in treeRowData) {
  42475. data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  42476. }
  42477. }
  42478. }
  42479. const baseKey = `${$index},${cellIndex}`;
  42480. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  42481. const tdChildren = cellChildren(cellIndex, column, data);
  42482. return vue.h("td", {
  42483. style: getCellStyle($index, cellIndex, row, column),
  42484. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  42485. key: `${patchKey}${baseKey}`,
  42486. rowspan,
  42487. colspan,
  42488. onMouseenter: ($event) => handleCellMouseEnter($event, row, tooltipEffect),
  42489. onMouseleave: handleCellMouseLeave
  42490. }, [tdChildren]);
  42491. }));
  42492. };
  42493. const cellChildren = (cellIndex, column, data) => {
  42494. return column.renderCell(data);
  42495. };
  42496. const wrappedRowRender = (row, $index) => {
  42497. const store = props.store;
  42498. const { isRowExpanded, assertRowKey } = store;
  42499. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  42500. const columns = store.states.columns.value;
  42501. const hasExpandColumn = columns.some(({ type }) => type === "expand");
  42502. if (hasExpandColumn) {
  42503. const expanded = isRowExpanded(row);
  42504. const tr = rowRender(row, $index, void 0, expanded);
  42505. const renderExpanded = parent.renderExpanded;
  42506. if (expanded) {
  42507. if (!renderExpanded) {
  42508. console.error("[Element Error]renderExpanded is required.");
  42509. return tr;
  42510. }
  42511. return [
  42512. [
  42513. tr,
  42514. vue.h("tr", {
  42515. key: `expanded-row__${tr.key}`
  42516. }, [
  42517. vue.h("td", {
  42518. colspan: columns.length,
  42519. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  42520. }, [renderExpanded({ row, $index, store, expanded })])
  42521. ])
  42522. ]
  42523. ];
  42524. } else {
  42525. return [[tr]];
  42526. }
  42527. } else if (Object.keys(treeData.value).length) {
  42528. assertRowKey();
  42529. const key = getRowIdentity(row, rowKey.value);
  42530. let cur = treeData.value[key];
  42531. let treeRowData = null;
  42532. if (cur) {
  42533. treeRowData = {
  42534. expanded: cur.expanded,
  42535. level: cur.level,
  42536. display: true
  42537. };
  42538. if (typeof cur.lazy === "boolean") {
  42539. if (typeof cur.loaded === "boolean" && cur.loaded) {
  42540. treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  42541. }
  42542. treeRowData.loading = cur.loading;
  42543. }
  42544. }
  42545. const tmp = [rowRender(row, $index, treeRowData)];
  42546. if (cur) {
  42547. let i = 0;
  42548. const traverse = (children, parent2) => {
  42549. if (!(children && children.length && parent2))
  42550. return;
  42551. children.forEach((node) => {
  42552. const innerTreeRowData = {
  42553. display: parent2.display && parent2.expanded,
  42554. level: parent2.level + 1,
  42555. expanded: false,
  42556. noLazyChildren: false,
  42557. loading: false
  42558. };
  42559. const childKey = getRowIdentity(node, rowKey.value);
  42560. if (childKey === void 0 || childKey === null) {
  42561. throw new Error("For nested data item, row-key is required.");
  42562. }
  42563. cur = { ...treeData.value[childKey] };
  42564. if (cur) {
  42565. innerTreeRowData.expanded = cur.expanded;
  42566. cur.level = cur.level || innerTreeRowData.level;
  42567. cur.display = !!(cur.expanded && innerTreeRowData.display);
  42568. if (typeof cur.lazy === "boolean") {
  42569. if (typeof cur.loaded === "boolean" && cur.loaded) {
  42570. innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  42571. }
  42572. innerTreeRowData.loading = cur.loading;
  42573. }
  42574. }
  42575. i++;
  42576. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  42577. if (cur) {
  42578. const nodes2 = lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value];
  42579. traverse(nodes2, cur);
  42580. }
  42581. });
  42582. };
  42583. cur.display = true;
  42584. const nodes = lazyTreeNodeMap.value[key] || row[childrenColumnName.value];
  42585. traverse(nodes, cur);
  42586. }
  42587. return tmp;
  42588. } else {
  42589. return rowRender(row, $index, void 0);
  42590. }
  42591. };
  42592. return {
  42593. wrappedRowRender,
  42594. tooltipContent,
  42595. tooltipTrigger
  42596. };
  42597. }
  42598. const defaultProps$2 = {
  42599. store: {
  42600. required: true,
  42601. type: Object
  42602. },
  42603. stripe: Boolean,
  42604. tooltipEffect: String,
  42605. context: {
  42606. default: () => ({}),
  42607. type: Object
  42608. },
  42609. rowClassName: [String, Function],
  42610. rowStyle: [Object, Function],
  42611. fixed: {
  42612. type: String,
  42613. default: ""
  42614. },
  42615. highlight: Boolean
  42616. };
  42617. var defaultProps$3 = defaultProps$2;
  42618. var TableBody = vue.defineComponent({
  42619. name: "ElTableBody",
  42620. props: defaultProps$3,
  42621. setup(props) {
  42622. const instance = vue.getCurrentInstance();
  42623. const parent = vue.inject(TABLE_INJECTION_KEY);
  42624. const ns = useNamespace("table");
  42625. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  42626. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  42627. vue.watch(props.store.states.hoverRow, (newVal, oldVal) => {
  42628. if (!props.store.states.isComplex.value || !isClient)
  42629. return;
  42630. let raf = window.requestAnimationFrame;
  42631. if (!raf) {
  42632. raf = (fn) => window.setTimeout(fn, 16);
  42633. }
  42634. raf(() => {
  42635. const el = instance == null ? void 0 : instance.vnode.el;
  42636. const rows = Array.from((el == null ? void 0 : el.children) || []).filter((e) => e == null ? void 0 : e.classList.contains(`${ns.e("row")}`));
  42637. const oldRow = rows[oldVal];
  42638. const newRow = rows[newVal];
  42639. if (oldRow) {
  42640. removeClass(oldRow, "hover-row");
  42641. }
  42642. if (newRow) {
  42643. addClass(newRow, "hover-row");
  42644. }
  42645. });
  42646. });
  42647. vue.onUnmounted(() => {
  42648. var _a;
  42649. (_a = removePopper) == null ? void 0 : _a();
  42650. });
  42651. return {
  42652. ns,
  42653. onColumnsChange,
  42654. onScrollableChange,
  42655. wrappedRowRender,
  42656. tooltipContent,
  42657. tooltipTrigger
  42658. };
  42659. },
  42660. render() {
  42661. const { wrappedRowRender, store } = this;
  42662. const data = store.states.data.value || [];
  42663. return vue.h("tbody", {}, [
  42664. data.reduce((acc, row) => {
  42665. return acc.concat(wrappedRowRender(row, acc.length));
  42666. }, [])
  42667. ]);
  42668. }
  42669. });
  42670. function hColgroup(props) {
  42671. const isAuto = props.tableLayout === "auto";
  42672. let columns = props.columns || [];
  42673. if (isAuto) {
  42674. if (columns.every((column) => column.width === void 0)) {
  42675. columns = [];
  42676. }
  42677. }
  42678. const getPropsData = (column) => {
  42679. const propsData = {
  42680. key: `${props.tableLayout}_${column.id}`,
  42681. style: {},
  42682. name: void 0
  42683. };
  42684. if (isAuto) {
  42685. propsData.style = {
  42686. width: `${column.width}px`
  42687. };
  42688. } else {
  42689. propsData.name = column.id;
  42690. }
  42691. return propsData;
  42692. };
  42693. return vue.h("colgroup", {}, columns.map((column) => vue.h("col", getPropsData(column))));
  42694. }
  42695. hColgroup.props = ["columns", "tableLayout"];
  42696. function useMapState() {
  42697. const table = vue.inject(TABLE_INJECTION_KEY);
  42698. const store = table == null ? void 0 : table.store;
  42699. const leftFixedLeafCount = vue.computed(() => {
  42700. return store.states.fixedLeafColumnsLength.value;
  42701. });
  42702. const rightFixedLeafCount = vue.computed(() => {
  42703. return store.states.rightFixedColumns.value.length;
  42704. });
  42705. const columnsCount = vue.computed(() => {
  42706. return store.states.columns.value.length;
  42707. });
  42708. const leftFixedCount = vue.computed(() => {
  42709. return store.states.fixedColumns.value.length;
  42710. });
  42711. const rightFixedCount = vue.computed(() => {
  42712. return store.states.rightFixedColumns.value.length;
  42713. });
  42714. return {
  42715. leftFixedLeafCount,
  42716. rightFixedLeafCount,
  42717. columnsCount,
  42718. leftFixedCount,
  42719. rightFixedCount,
  42720. columns: store.states.columns
  42721. };
  42722. }
  42723. function useStyle$1(props) {
  42724. const { columns } = useMapState();
  42725. const ns = useNamespace("table");
  42726. const getCellClasses = (columns2, cellIndex) => {
  42727. const column = columns2[cellIndex];
  42728. const classes = [
  42729. ns.e("cell"),
  42730. column.id,
  42731. column.align,
  42732. column.labelClassName,
  42733. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  42734. ];
  42735. if (column.className) {
  42736. classes.push(column.className);
  42737. }
  42738. if (!column.children) {
  42739. classes.push(ns.is("leaf"));
  42740. }
  42741. return classes;
  42742. };
  42743. const getCellStyles = (column, cellIndex) => {
  42744. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  42745. ensurePosition(fixedStyle, "left");
  42746. ensurePosition(fixedStyle, "right");
  42747. return fixedStyle;
  42748. };
  42749. return {
  42750. getCellClasses,
  42751. getCellStyles,
  42752. columns
  42753. };
  42754. }
  42755. var TableFooter = vue.defineComponent({
  42756. name: "ElTableFooter",
  42757. props: {
  42758. fixed: {
  42759. type: String,
  42760. default: ""
  42761. },
  42762. store: {
  42763. required: true,
  42764. type: Object
  42765. },
  42766. summaryMethod: Function,
  42767. sumText: String,
  42768. border: Boolean,
  42769. defaultSort: {
  42770. type: Object,
  42771. default: () => {
  42772. return {
  42773. prop: "",
  42774. order: ""
  42775. };
  42776. }
  42777. }
  42778. },
  42779. setup(props) {
  42780. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  42781. const ns = useNamespace("table");
  42782. return {
  42783. ns,
  42784. getCellClasses,
  42785. getCellStyles,
  42786. columns
  42787. };
  42788. },
  42789. render() {
  42790. const {
  42791. columns,
  42792. getCellStyles,
  42793. getCellClasses,
  42794. summaryMethod,
  42795. sumText,
  42796. ns
  42797. } = this;
  42798. const data = this.store.states.data.value;
  42799. let sums = [];
  42800. if (summaryMethod) {
  42801. sums = summaryMethod({
  42802. columns,
  42803. data
  42804. });
  42805. } else {
  42806. columns.forEach((column, index) => {
  42807. if (index === 0) {
  42808. sums[index] = sumText;
  42809. return;
  42810. }
  42811. const values = data.map((item) => Number(item[column.property]));
  42812. const precisions = [];
  42813. let notNumber = true;
  42814. values.forEach((value) => {
  42815. if (!Number.isNaN(+value)) {
  42816. notNumber = false;
  42817. const decimal = `${value}`.split(".")[1];
  42818. precisions.push(decimal ? decimal.length : 0);
  42819. }
  42820. });
  42821. const precision = Math.max.apply(null, precisions);
  42822. if (!notNumber) {
  42823. sums[index] = values.reduce((prev, curr) => {
  42824. const value = Number(curr);
  42825. if (!Number.isNaN(+value)) {
  42826. return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  42827. } else {
  42828. return prev;
  42829. }
  42830. }, 0);
  42831. } else {
  42832. sums[index] = "";
  42833. }
  42834. });
  42835. }
  42836. return vue.h("table", {
  42837. class: ns.e("footer"),
  42838. cellspacing: "0",
  42839. cellpadding: "0",
  42840. border: "0"
  42841. }, [
  42842. hColgroup({
  42843. columns
  42844. }),
  42845. vue.h("tbody", [
  42846. vue.h("tr", {}, [
  42847. ...columns.map((column, cellIndex) => vue.h("td", {
  42848. key: cellIndex,
  42849. colspan: column.colSpan,
  42850. rowspan: column.rowSpan,
  42851. class: getCellClasses(columns, cellIndex),
  42852. style: getCellStyles(column, cellIndex)
  42853. }, [
  42854. vue.h("div", {
  42855. class: ["cell", column.labelClassName]
  42856. }, [sums[cellIndex]])
  42857. ]))
  42858. ])
  42859. ])
  42860. ]);
  42861. }
  42862. });
  42863. function useUtils(store) {
  42864. const setCurrentRow = (row) => {
  42865. store.commit("setCurrentRow", row);
  42866. };
  42867. const getSelectionRows = () => {
  42868. return store.getSelectionRows();
  42869. };
  42870. const toggleRowSelection = (row, selected) => {
  42871. store.toggleRowSelection(row, selected, false);
  42872. store.updateAllSelected();
  42873. };
  42874. const clearSelection = () => {
  42875. store.clearSelection();
  42876. };
  42877. const clearFilter = (columnKeys) => {
  42878. store.clearFilter(columnKeys);
  42879. };
  42880. const toggleAllSelection = () => {
  42881. store.commit("toggleAllSelection");
  42882. };
  42883. const toggleRowExpansion = (row, expanded) => {
  42884. store.toggleRowExpansionAdapter(row, expanded);
  42885. };
  42886. const clearSort = () => {
  42887. store.clearSort();
  42888. };
  42889. const sort = (prop, order) => {
  42890. store.commit("sort", { prop, order });
  42891. };
  42892. return {
  42893. setCurrentRow,
  42894. getSelectionRows,
  42895. toggleRowSelection,
  42896. clearSelection,
  42897. clearFilter,
  42898. toggleAllSelection,
  42899. toggleRowExpansion,
  42900. clearSort,
  42901. sort
  42902. };
  42903. }
  42904. function useStyle(props, layout, store, table) {
  42905. const isHidden = vue.ref(false);
  42906. const renderExpanded = vue.ref(null);
  42907. const resizeProxyVisible = vue.ref(false);
  42908. const setDragVisible = (visible) => {
  42909. resizeProxyVisible.value = visible;
  42910. };
  42911. const resizeState = vue.ref({
  42912. width: null,
  42913. height: null,
  42914. headerHeight: null
  42915. });
  42916. const isGroup = vue.ref(false);
  42917. const scrollbarViewStyle = {
  42918. display: "inline-block",
  42919. verticalAlign: "middle"
  42920. };
  42921. const tableWidth = vue.ref();
  42922. const tableScrollHeight = vue.ref(0);
  42923. const bodyScrollHeight = vue.ref(0);
  42924. const headerScrollHeight = vue.ref(0);
  42925. const footerScrollHeight = vue.ref(0);
  42926. vue.watchEffect(() => {
  42927. layout.setHeight(props.height);
  42928. });
  42929. vue.watchEffect(() => {
  42930. layout.setMaxHeight(props.maxHeight);
  42931. });
  42932. vue.watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  42933. if (!vue.unref(rowKey) || !vue.unref(currentRowKey))
  42934. return;
  42935. store.setCurrentRowKey(`${currentRowKey}`);
  42936. }, {
  42937. immediate: true
  42938. });
  42939. vue.watch(() => props.data, (data) => {
  42940. table.store.commit("setData", data);
  42941. }, {
  42942. immediate: true,
  42943. deep: true
  42944. });
  42945. vue.watchEffect(() => {
  42946. if (props.expandRowKeys) {
  42947. store.setExpandRowKeysAdapter(props.expandRowKeys);
  42948. }
  42949. });
  42950. const handleMouseLeave = () => {
  42951. table.store.commit("setHoverRow", null);
  42952. if (table.hoverState)
  42953. table.hoverState = null;
  42954. };
  42955. const handleHeaderFooterMousewheel = (event, data) => {
  42956. const { pixelX, pixelY } = data;
  42957. if (Math.abs(pixelX) >= Math.abs(pixelY)) {
  42958. table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  42959. }
  42960. };
  42961. const shouldUpdateHeight = vue.computed(() => {
  42962. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  42963. });
  42964. const tableBodyStyles = vue.computed(() => {
  42965. return {
  42966. width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : ""
  42967. };
  42968. });
  42969. const doLayout = () => {
  42970. if (shouldUpdateHeight.value) {
  42971. layout.updateElsHeight();
  42972. }
  42973. layout.updateColumnsWidth();
  42974. requestAnimationFrame(syncPosition);
  42975. };
  42976. vue.onMounted(async () => {
  42977. await vue.nextTick();
  42978. store.updateColumns();
  42979. bindEvents();
  42980. requestAnimationFrame(doLayout);
  42981. const el = table.vnode.el;
  42982. const tableHeader = table.refs.headerWrapper;
  42983. if (props.flexible && el && el.parentElement) {
  42984. el.parentElement.style.minWidth = "0";
  42985. }
  42986. resizeState.value = {
  42987. width: tableWidth.value = el.offsetWidth,
  42988. height: el.offsetHeight,
  42989. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  42990. };
  42991. store.states.columns.value.forEach((column) => {
  42992. if (column.filteredValue && column.filteredValue.length) {
  42993. table.store.commit("filterChange", {
  42994. column,
  42995. values: column.filteredValue,
  42996. silent: true
  42997. });
  42998. }
  42999. });
  43000. table.$ready = true;
  43001. });
  43002. const setScrollClassByEl = (el, className) => {
  43003. if (!el)
  43004. return;
  43005. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  43006. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  43007. el.className = classList.join(" ");
  43008. };
  43009. const setScrollClass = (className) => {
  43010. const { tableWrapper } = table.refs;
  43011. setScrollClassByEl(tableWrapper, className);
  43012. };
  43013. const hasScrollClass = (className) => {
  43014. const { tableWrapper } = table.refs;
  43015. return !!(tableWrapper && tableWrapper.classList.contains(className));
  43016. };
  43017. const syncPosition = function() {
  43018. if (!table.refs.scrollBarRef)
  43019. return;
  43020. if (!layout.scrollX.value) {
  43021. const scrollingNoneClass = "is-scrolling-none";
  43022. if (!hasScrollClass(scrollingNoneClass)) {
  43023. setScrollClass(scrollingNoneClass);
  43024. }
  43025. return;
  43026. }
  43027. const scrollContainer = table.refs.scrollBarRef.wrap$;
  43028. if (!scrollContainer)
  43029. return;
  43030. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  43031. const { headerWrapper, footerWrapper } = table.refs;
  43032. if (headerWrapper)
  43033. headerWrapper.scrollLeft = scrollLeft;
  43034. if (footerWrapper)
  43035. footerWrapper.scrollLeft = scrollLeft;
  43036. const maxScrollLeftPosition = scrollWidth - offsetWidth - 1;
  43037. if (scrollLeft >= maxScrollLeftPosition) {
  43038. setScrollClass("is-scrolling-right");
  43039. } else if (scrollLeft === 0) {
  43040. setScrollClass("is-scrolling-left");
  43041. } else {
  43042. setScrollClass("is-scrolling-middle");
  43043. }
  43044. };
  43045. const bindEvents = () => {
  43046. if (!table.refs.scrollBarRef)
  43047. return;
  43048. if (table.refs.scrollBarRef.wrap$) {
  43049. useEventListener(table.refs.scrollBarRef.wrap$, "scroll", syncPosition, {
  43050. passive: true
  43051. });
  43052. }
  43053. if (props.fit) {
  43054. useResizeObserver(table.vnode.el, resizeListener);
  43055. } else {
  43056. useEventListener(window, "resize", resizeListener);
  43057. }
  43058. useResizeObserver(table.refs.bodyWrapper, () => {
  43059. var _a, _b;
  43060. resizeListener();
  43061. (_b = (_a = table.refs) == null ? void 0 : _a.scrollBarRef) == null ? void 0 : _b.update();
  43062. });
  43063. };
  43064. const resizeListener = () => {
  43065. var _a, _b, _c;
  43066. const el = table.vnode.el;
  43067. if (!table.$ready || !el)
  43068. return;
  43069. let shouldUpdateLayout = false;
  43070. const {
  43071. width: oldWidth,
  43072. height: oldHeight,
  43073. headerHeight: oldHeaderHeight
  43074. } = resizeState.value;
  43075. const width = tableWidth.value = el.offsetWidth;
  43076. if (oldWidth !== width) {
  43077. shouldUpdateLayout = true;
  43078. }
  43079. const height = el.offsetHeight;
  43080. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) {
  43081. shouldUpdateLayout = true;
  43082. }
  43083. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : (_a = table.refs.tableHeaderRef) == null ? void 0 : _a.$el;
  43084. if (props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) !== oldHeaderHeight) {
  43085. shouldUpdateLayout = true;
  43086. }
  43087. tableScrollHeight.value = ((_b = table.refs.tableWrapper) == null ? void 0 : _b.scrollHeight) || 0;
  43088. headerScrollHeight.value = (tableHeader == null ? void 0 : tableHeader.scrollHeight) || 0;
  43089. footerScrollHeight.value = ((_c = table.refs.footerWrapper) == null ? void 0 : _c.offsetHeight) || 0;
  43090. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value;
  43091. if (shouldUpdateLayout) {
  43092. resizeState.value = {
  43093. width,
  43094. height,
  43095. headerHeight: props.showHeader && (tableHeader == null ? void 0 : tableHeader.offsetHeight) || 0
  43096. };
  43097. doLayout();
  43098. }
  43099. };
  43100. const tableSize = useSize();
  43101. const bodyWidth = vue.computed(() => {
  43102. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  43103. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  43104. });
  43105. const tableLayout = vue.computed(() => {
  43106. if (props.maxHeight)
  43107. return "fixed";
  43108. return props.tableLayout;
  43109. });
  43110. const emptyBlockStyle = vue.computed(() => {
  43111. if (props.data && props.data.length)
  43112. return null;
  43113. let height = "100%";
  43114. if (props.height && bodyScrollHeight.value) {
  43115. height = `${bodyScrollHeight.value}px`;
  43116. }
  43117. const width = tableWidth.value;
  43118. return {
  43119. width: width ? `${width}px` : "",
  43120. height
  43121. };
  43122. });
  43123. const tableInnerStyle = vue.computed(() => {
  43124. if (props.height) {
  43125. return {
  43126. height: !Number.isNaN(Number(props.height)) ? `${props.height}px` : props.height
  43127. };
  43128. }
  43129. if (props.maxHeight) {
  43130. return {
  43131. maxHeight: !Number.isNaN(Number(props.maxHeight)) ? `${props.maxHeight}px` : props.maxHeight
  43132. };
  43133. }
  43134. return {};
  43135. });
  43136. const scrollbarStyle = vue.computed(() => {
  43137. if (props.height) {
  43138. return {
  43139. height: "100%"
  43140. };
  43141. }
  43142. if (props.maxHeight) {
  43143. if (!Number.isNaN(Number(props.maxHeight))) {
  43144. const maxHeight = props.maxHeight;
  43145. const reachMaxHeight = tableScrollHeight.value >= Number(maxHeight);
  43146. if (reachMaxHeight) {
  43147. return {
  43148. maxHeight: `${tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value}px`
  43149. };
  43150. }
  43151. } else {
  43152. return {
  43153. maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)`
  43154. };
  43155. }
  43156. }
  43157. return {};
  43158. });
  43159. const handleFixedMousewheel = (event, data) => {
  43160. const bodyWrapper = table.refs.bodyWrapper;
  43161. if (Math.abs(data.spinY) > 0) {
  43162. const currentScrollTop = bodyWrapper.scrollTop;
  43163. if (data.pixelY < 0 && currentScrollTop !== 0) {
  43164. event.preventDefault();
  43165. }
  43166. if (data.pixelY > 0 && bodyWrapper.scrollHeight - bodyWrapper.clientHeight > currentScrollTop) {
  43167. event.preventDefault();
  43168. }
  43169. bodyWrapper.scrollTop += Math.ceil(data.pixelY / 5);
  43170. } else {
  43171. bodyWrapper.scrollLeft += Math.ceil(data.pixelX / 5);
  43172. }
  43173. };
  43174. return {
  43175. isHidden,
  43176. renderExpanded,
  43177. setDragVisible,
  43178. isGroup,
  43179. handleMouseLeave,
  43180. handleHeaderFooterMousewheel,
  43181. tableSize,
  43182. emptyBlockStyle,
  43183. handleFixedMousewheel,
  43184. resizeProxyVisible,
  43185. bodyWidth,
  43186. resizeState,
  43187. doLayout,
  43188. tableBodyStyles,
  43189. tableLayout,
  43190. scrollbarViewStyle,
  43191. tableInnerStyle,
  43192. scrollbarStyle
  43193. };
  43194. }
  43195. var defaultProps$1 = {
  43196. data: {
  43197. type: Array,
  43198. default: () => []
  43199. },
  43200. size: String,
  43201. width: [String, Number],
  43202. height: [String, Number],
  43203. maxHeight: [String, Number],
  43204. fit: {
  43205. type: Boolean,
  43206. default: true
  43207. },
  43208. stripe: Boolean,
  43209. border: Boolean,
  43210. rowKey: [String, Function],
  43211. showHeader: {
  43212. type: Boolean,
  43213. default: true
  43214. },
  43215. showSummary: Boolean,
  43216. sumText: String,
  43217. summaryMethod: Function,
  43218. rowClassName: [String, Function],
  43219. rowStyle: [Object, Function],
  43220. cellClassName: [String, Function],
  43221. cellStyle: [Object, Function],
  43222. headerRowClassName: [String, Function],
  43223. headerRowStyle: [Object, Function],
  43224. headerCellClassName: [String, Function],
  43225. headerCellStyle: [Object, Function],
  43226. highlightCurrentRow: Boolean,
  43227. currentRowKey: [String, Number],
  43228. emptyText: String,
  43229. expandRowKeys: Array,
  43230. defaultExpandAll: Boolean,
  43231. defaultSort: Object,
  43232. tooltipEffect: String,
  43233. spanMethod: Function,
  43234. selectOnIndeterminate: {
  43235. type: Boolean,
  43236. default: true
  43237. },
  43238. indent: {
  43239. type: Number,
  43240. default: 16
  43241. },
  43242. treeProps: {
  43243. type: Object,
  43244. default: () => {
  43245. return {
  43246. hasChildren: "hasChildren",
  43247. children: "children"
  43248. };
  43249. }
  43250. },
  43251. lazy: Boolean,
  43252. load: Function,
  43253. style: {
  43254. type: Object,
  43255. default: () => ({})
  43256. },
  43257. className: {
  43258. type: String,
  43259. default: ""
  43260. },
  43261. tableLayout: {
  43262. type: String,
  43263. default: "fixed"
  43264. },
  43265. scrollbarAlwaysOn: {
  43266. type: Boolean,
  43267. default: false
  43268. },
  43269. flexible: Boolean
  43270. };
  43271. const useScrollbar$1 = () => {
  43272. const scrollBarRef = vue.ref();
  43273. const scrollTo = (options, yCoord) => {
  43274. const scrollbar = scrollBarRef.value;
  43275. if (scrollbar) {
  43276. scrollbar.scrollTo(options, yCoord);
  43277. }
  43278. };
  43279. const setScrollPosition = (position, offset) => {
  43280. const scrollbar = scrollBarRef.value;
  43281. if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) {
  43282. scrollbar[`setScroll${position}`](offset);
  43283. }
  43284. };
  43285. const setScrollTop = (top) => setScrollPosition("Top", top);
  43286. const setScrollLeft = (left) => setScrollPosition("Left", left);
  43287. return {
  43288. scrollBarRef,
  43289. scrollTo,
  43290. setScrollTop,
  43291. setScrollLeft
  43292. };
  43293. };
  43294. let tableIdSeed = 1;
  43295. const _sfc_main$p = vue.defineComponent({
  43296. name: "ElTable",
  43297. directives: {
  43298. Mousewheel
  43299. },
  43300. components: {
  43301. TableHeader,
  43302. TableBody,
  43303. TableFooter,
  43304. ElScrollbar,
  43305. hColgroup
  43306. },
  43307. props: defaultProps$1,
  43308. emits: [
  43309. "select",
  43310. "select-all",
  43311. "selection-change",
  43312. "cell-mouse-enter",
  43313. "cell-mouse-leave",
  43314. "cell-contextmenu",
  43315. "cell-click",
  43316. "cell-dblclick",
  43317. "row-click",
  43318. "row-contextmenu",
  43319. "row-dblclick",
  43320. "header-click",
  43321. "header-contextmenu",
  43322. "sort-change",
  43323. "filter-change",
  43324. "current-change",
  43325. "header-dragend",
  43326. "expand-change"
  43327. ],
  43328. setup(props) {
  43329. const { t } = useLocale();
  43330. const ns = useNamespace("table");
  43331. const table = vue.getCurrentInstance();
  43332. vue.provide(TABLE_INJECTION_KEY, table);
  43333. const store = createStore(table, props);
  43334. table.store = store;
  43335. const layout = new TableLayout$1({
  43336. store: table.store,
  43337. table,
  43338. fit: props.fit,
  43339. showHeader: props.showHeader
  43340. });
  43341. table.layout = layout;
  43342. const isEmpty = vue.computed(() => (store.states.data.value || []).length === 0);
  43343. const {
  43344. setCurrentRow,
  43345. getSelectionRows,
  43346. toggleRowSelection,
  43347. clearSelection,
  43348. clearFilter,
  43349. toggleAllSelection,
  43350. toggleRowExpansion,
  43351. clearSort,
  43352. sort
  43353. } = useUtils(store);
  43354. const {
  43355. isHidden,
  43356. renderExpanded,
  43357. setDragVisible,
  43358. isGroup,
  43359. handleMouseLeave,
  43360. handleHeaderFooterMousewheel,
  43361. tableSize,
  43362. emptyBlockStyle,
  43363. handleFixedMousewheel,
  43364. resizeProxyVisible,
  43365. bodyWidth,
  43366. resizeState,
  43367. doLayout,
  43368. tableBodyStyles,
  43369. tableLayout,
  43370. scrollbarViewStyle,
  43371. tableInnerStyle,
  43372. scrollbarStyle
  43373. } = useStyle(props, layout, store, table);
  43374. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1();
  43375. const debouncedUpdateLayout = debounce(doLayout, 50);
  43376. const tableId = `${ns.namespace.value}-table_${tableIdSeed++}`;
  43377. table.tableId = tableId;
  43378. table.state = {
  43379. isGroup,
  43380. resizeState,
  43381. doLayout,
  43382. debouncedUpdateLayout
  43383. };
  43384. const computedSumText = vue.computed(() => props.sumText || t("el.table.sumText"));
  43385. const computedEmptyText = vue.computed(() => {
  43386. return props.emptyText || t("el.table.emptyText");
  43387. });
  43388. return {
  43389. ns,
  43390. layout,
  43391. store,
  43392. handleHeaderFooterMousewheel,
  43393. handleMouseLeave,
  43394. tableId,
  43395. tableSize,
  43396. isHidden,
  43397. isEmpty,
  43398. renderExpanded,
  43399. resizeProxyVisible,
  43400. resizeState,
  43401. isGroup,
  43402. bodyWidth,
  43403. tableBodyStyles,
  43404. emptyBlockStyle,
  43405. debouncedUpdateLayout,
  43406. handleFixedMousewheel,
  43407. setCurrentRow,
  43408. getSelectionRows,
  43409. toggleRowSelection,
  43410. clearSelection,
  43411. clearFilter,
  43412. toggleAllSelection,
  43413. toggleRowExpansion,
  43414. clearSort,
  43415. doLayout,
  43416. sort,
  43417. t,
  43418. setDragVisible,
  43419. context: table,
  43420. computedSumText,
  43421. computedEmptyText,
  43422. tableLayout,
  43423. scrollbarViewStyle,
  43424. tableInnerStyle,
  43425. scrollbarStyle,
  43426. scrollBarRef,
  43427. scrollTo,
  43428. setScrollLeft,
  43429. setScrollTop
  43430. };
  43431. }
  43432. });
  43433. const _hoisted_1$b = ["data-prefix"];
  43434. const _hoisted_2$7 = {
  43435. ref: "hiddenColumns",
  43436. class: "hidden-columns"
  43437. };
  43438. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  43439. const _component_hColgroup = vue.resolveComponent("hColgroup");
  43440. const _component_table_header = vue.resolveComponent("table-header");
  43441. const _component_table_body = vue.resolveComponent("table-body");
  43442. const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
  43443. const _component_table_footer = vue.resolveComponent("table-footer");
  43444. const _directive_mousewheel = vue.resolveDirective("mousewheel");
  43445. return vue.openBlock(), vue.createElementBlock("div", {
  43446. ref: "tableWrapper",
  43447. class: vue.normalizeClass([
  43448. {
  43449. [_ctx.ns.m("fit")]: _ctx.fit,
  43450. [_ctx.ns.m("striped")]: _ctx.stripe,
  43451. [_ctx.ns.m("border")]: _ctx.border || _ctx.isGroup,
  43452. [_ctx.ns.m("hidden")]: _ctx.isHidden,
  43453. [_ctx.ns.m("group")]: _ctx.isGroup,
  43454. [_ctx.ns.m("fluid-height")]: _ctx.maxHeight,
  43455. [_ctx.ns.m("scrollable-x")]: _ctx.layout.scrollX.value,
  43456. [_ctx.ns.m("scrollable-y")]: _ctx.layout.scrollY.value,
  43457. [_ctx.ns.m("enable-row-hover")]: !_ctx.store.states.isComplex.value,
  43458. [_ctx.ns.m("enable-row-transition")]: (_ctx.store.states.data.value || []).length !== 0 && (_ctx.store.states.data.value || []).length < 100,
  43459. "has-footer": _ctx.showSummary
  43460. },
  43461. _ctx.ns.m(_ctx.tableSize),
  43462. _ctx.className,
  43463. _ctx.ns.b(),
  43464. _ctx.ns.m(`layout-${_ctx.tableLayout}`)
  43465. ]),
  43466. style: vue.normalizeStyle(_ctx.style),
  43467. "data-prefix": _ctx.ns.namespace.value,
  43468. onMouseleave: _cache[0] || (_cache[0] = ($event) => _ctx.handleMouseLeave())
  43469. }, [
  43470. vue.createElementVNode("div", {
  43471. class: vue.normalizeClass(_ctx.ns.e("inner-wrapper")),
  43472. style: vue.normalizeStyle(_ctx.tableInnerStyle)
  43473. }, [
  43474. vue.createElementVNode("div", _hoisted_2$7, [
  43475. vue.renderSlot(_ctx.$slots, "default")
  43476. ], 512),
  43477. _ctx.showHeader && _ctx.tableLayout === "fixed" ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  43478. key: 0,
  43479. ref: "headerWrapper",
  43480. class: vue.normalizeClass(_ctx.ns.e("header-wrapper"))
  43481. }, [
  43482. vue.createElementVNode("table", {
  43483. ref: "tableHeader",
  43484. class: vue.normalizeClass(_ctx.ns.e("header")),
  43485. style: vue.normalizeStyle(_ctx.tableBodyStyles),
  43486. border: "0",
  43487. cellpadding: "0",
  43488. cellspacing: "0"
  43489. }, [
  43490. vue.createVNode(_component_hColgroup, {
  43491. columns: _ctx.store.states.columns.value,
  43492. "table-layout": _ctx.tableLayout
  43493. }, null, 8, ["columns", "table-layout"]),
  43494. vue.createVNode(_component_table_header, {
  43495. ref: "tableHeaderRef",
  43496. border: _ctx.border,
  43497. "default-sort": _ctx.defaultSort,
  43498. store: _ctx.store,
  43499. onSetDragVisible: _ctx.setDragVisible
  43500. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])
  43501. ], 6)
  43502. ], 2)), [
  43503. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  43504. ]) : vue.createCommentVNode("v-if", true),
  43505. vue.createElementVNode("div", {
  43506. ref: "bodyWrapper",
  43507. class: vue.normalizeClass(_ctx.ns.e("body-wrapper"))
  43508. }, [
  43509. vue.createVNode(_component_el_scrollbar, {
  43510. ref: "scrollBarRef",
  43511. "view-style": _ctx.scrollbarViewStyle,
  43512. "wrap-style": _ctx.scrollbarStyle,
  43513. always: _ctx.scrollbarAlwaysOn
  43514. }, {
  43515. default: vue.withCtx(() => [
  43516. vue.createElementVNode("table", {
  43517. ref: "tableBody",
  43518. class: vue.normalizeClass(_ctx.ns.e("body")),
  43519. cellspacing: "0",
  43520. cellpadding: "0",
  43521. border: "0",
  43522. style: vue.normalizeStyle({
  43523. width: _ctx.bodyWidth,
  43524. tableLayout: _ctx.tableLayout
  43525. })
  43526. }, [
  43527. vue.createVNode(_component_hColgroup, {
  43528. columns: _ctx.store.states.columns.value,
  43529. "table-layout": _ctx.tableLayout
  43530. }, null, 8, ["columns", "table-layout"]),
  43531. _ctx.showHeader && _ctx.tableLayout === "auto" ? (vue.openBlock(), vue.createBlock(_component_table_header, {
  43532. key: 0,
  43533. ref: "tableHeaderRef",
  43534. border: _ctx.border,
  43535. "default-sort": _ctx.defaultSort,
  43536. store: _ctx.store,
  43537. onSetDragVisible: _ctx.setDragVisible
  43538. }, null, 8, ["border", "default-sort", "store", "onSetDragVisible"])) : vue.createCommentVNode("v-if", true),
  43539. vue.createVNode(_component_table_body, {
  43540. context: _ctx.context,
  43541. highlight: _ctx.highlightCurrentRow,
  43542. "row-class-name": _ctx.rowClassName,
  43543. "tooltip-effect": _ctx.tooltipEffect,
  43544. "row-style": _ctx.rowStyle,
  43545. store: _ctx.store,
  43546. stripe: _ctx.stripe
  43547. }, null, 8, ["context", "highlight", "row-class-name", "tooltip-effect", "row-style", "store", "stripe"])
  43548. ], 6),
  43549. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  43550. key: 0,
  43551. ref: "emptyBlock",
  43552. style: vue.normalizeStyle(_ctx.emptyBlockStyle),
  43553. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  43554. }, [
  43555. vue.createElementVNode("span", {
  43556. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  43557. }, [
  43558. vue.renderSlot(_ctx.$slots, "empty", {}, () => [
  43559. vue.createTextVNode(vue.toDisplayString(_ctx.computedEmptyText), 1)
  43560. ])
  43561. ], 2)
  43562. ], 6)) : vue.createCommentVNode("v-if", true),
  43563. _ctx.$slots.append ? (vue.openBlock(), vue.createElementBlock("div", {
  43564. key: 1,
  43565. ref: "appendWrapper",
  43566. class: vue.normalizeClass(_ctx.ns.e("append-wrapper"))
  43567. }, [
  43568. vue.renderSlot(_ctx.$slots, "append")
  43569. ], 2)) : vue.createCommentVNode("v-if", true)
  43570. ]),
  43571. _: 3
  43572. }, 8, ["view-style", "wrap-style", "always"])
  43573. ], 2),
  43574. _ctx.showSummary ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  43575. key: 1,
  43576. ref: "footerWrapper",
  43577. class: vue.normalizeClass(_ctx.ns.e("footer-wrapper"))
  43578. }, [
  43579. vue.createVNode(_component_table_footer, {
  43580. border: _ctx.border,
  43581. "default-sort": _ctx.defaultSort,
  43582. store: _ctx.store,
  43583. style: vue.normalizeStyle(_ctx.tableBodyStyles),
  43584. "sum-text": _ctx.computedSumText,
  43585. "summary-method": _ctx.summaryMethod
  43586. }, null, 8, ["border", "default-sort", "store", "style", "sum-text", "summary-method"])
  43587. ], 2)), [
  43588. [vue.vShow, !_ctx.isEmpty],
  43589. [_directive_mousewheel, _ctx.handleHeaderFooterMousewheel]
  43590. ]) : vue.createCommentVNode("v-if", true),
  43591. _ctx.border || _ctx.isGroup ? (vue.openBlock(), vue.createElementBlock("div", {
  43592. key: 2,
  43593. class: vue.normalizeClass(_ctx.ns.e("border-left-patch"))
  43594. }, null, 2)) : vue.createCommentVNode("v-if", true)
  43595. ], 6),
  43596. vue.withDirectives(vue.createElementVNode("div", {
  43597. ref: "resizeProxy",
  43598. class: vue.normalizeClass(_ctx.ns.e("column-resize-proxy"))
  43599. }, null, 2), [
  43600. [vue.vShow, _ctx.resizeProxyVisible]
  43601. ])
  43602. ], 46, _hoisted_1$b);
  43603. }
  43604. var Table = /* @__PURE__ */ _export_sfc(_sfc_main$p, [["render", _sfc_render$3], ["__file", "table.vue"]]);
  43605. const defaultClassNames = {
  43606. selection: "table-column--selection",
  43607. expand: "table__expand-column"
  43608. };
  43609. const cellStarts = {
  43610. default: {
  43611. order: ""
  43612. },
  43613. selection: {
  43614. width: 48,
  43615. minWidth: 48,
  43616. realWidth: 48,
  43617. order: ""
  43618. },
  43619. expand: {
  43620. width: 48,
  43621. minWidth: 48,
  43622. realWidth: 48,
  43623. order: ""
  43624. },
  43625. index: {
  43626. width: 48,
  43627. minWidth: 48,
  43628. realWidth: 48,
  43629. order: ""
  43630. }
  43631. };
  43632. const getDefaultClassName = (type) => {
  43633. return defaultClassNames[type] || "";
  43634. };
  43635. const cellForced = {
  43636. selection: {
  43637. renderHeader({ store }) {
  43638. function isDisabled() {
  43639. return store.states.data.value && store.states.data.value.length === 0;
  43640. }
  43641. return vue.h(ElCheckbox, {
  43642. disabled: isDisabled(),
  43643. size: store.states.tableSize.value,
  43644. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  43645. "onUpdate:modelValue": store.toggleAllSelection,
  43646. modelValue: store.states.isAllSelected.value
  43647. });
  43648. },
  43649. renderCell({
  43650. row,
  43651. column,
  43652. store,
  43653. $index
  43654. }) {
  43655. return vue.h(ElCheckbox, {
  43656. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  43657. size: store.states.tableSize.value,
  43658. onChange: () => {
  43659. store.commit("rowSelectedChanged", row);
  43660. },
  43661. onClick: (event) => event.stopPropagation(),
  43662. modelValue: store.isSelected(row)
  43663. });
  43664. },
  43665. sortable: false,
  43666. resizable: false
  43667. },
  43668. index: {
  43669. renderHeader({ column }) {
  43670. return column.label || "#";
  43671. },
  43672. renderCell({
  43673. column,
  43674. $index
  43675. }) {
  43676. let i = $index + 1;
  43677. const index = column.index;
  43678. if (typeof index === "number") {
  43679. i = $index + index;
  43680. } else if (typeof index === "function") {
  43681. i = index($index);
  43682. }
  43683. return vue.h("div", {}, [i]);
  43684. },
  43685. sortable: false
  43686. },
  43687. expand: {
  43688. renderHeader({ column }) {
  43689. return column.label || "";
  43690. },
  43691. renderCell({
  43692. row,
  43693. store,
  43694. expanded
  43695. }) {
  43696. const { ns } = store;
  43697. const classes = [ns.e("expand-icon")];
  43698. if (expanded) {
  43699. classes.push(ns.em("expand-icon", "expanded"));
  43700. }
  43701. const callback = function(e) {
  43702. e.stopPropagation();
  43703. store.toggleRowExpansion(row);
  43704. };
  43705. return vue.h("div", {
  43706. class: classes,
  43707. onClick: callback
  43708. }, {
  43709. default: () => {
  43710. return [
  43711. vue.h(ElIcon, null, {
  43712. default: () => {
  43713. return [vue.h(arrow_right_default)];
  43714. }
  43715. })
  43716. ];
  43717. }
  43718. });
  43719. },
  43720. sortable: false,
  43721. resizable: false
  43722. }
  43723. };
  43724. function defaultRenderCell({
  43725. row,
  43726. column,
  43727. $index
  43728. }) {
  43729. var _a;
  43730. const property = column.property;
  43731. const value = property && getProp(row, property).value;
  43732. if (column && column.formatter) {
  43733. return column.formatter(row, column, value, $index);
  43734. }
  43735. return ((_a = value == null ? void 0 : value.toString) == null ? void 0 : _a.call(value)) || "";
  43736. }
  43737. function treeCellPrefix({
  43738. row,
  43739. treeNode,
  43740. store
  43741. }, createPlacehoder = false) {
  43742. const { ns } = store;
  43743. if (!treeNode) {
  43744. if (createPlacehoder) {
  43745. return [
  43746. vue.h("span", {
  43747. class: ns.e("placeholder")
  43748. })
  43749. ];
  43750. }
  43751. return null;
  43752. }
  43753. const ele = [];
  43754. const callback = function(e) {
  43755. e.stopPropagation();
  43756. if (treeNode.loading) {
  43757. return;
  43758. }
  43759. store.loadOrToggle(row);
  43760. };
  43761. if (treeNode.indent) {
  43762. ele.push(vue.h("span", {
  43763. class: ns.e("indent"),
  43764. style: { "padding-left": `${treeNode.indent}px` }
  43765. }));
  43766. }
  43767. if (typeof treeNode.expanded === "boolean" && !treeNode.noLazyChildren) {
  43768. const expandClasses = [
  43769. ns.e("expand-icon"),
  43770. treeNode.expanded ? ns.em("expand-icon", "expanded") : ""
  43771. ];
  43772. let icon = arrow_right_default;
  43773. if (treeNode.loading) {
  43774. icon = loading_default;
  43775. }
  43776. ele.push(vue.h("div", {
  43777. class: expandClasses,
  43778. onClick: callback
  43779. }, {
  43780. default: () => {
  43781. return [
  43782. vue.h(ElIcon, { class: { [ns.is("loading")]: treeNode.loading } }, {
  43783. default: () => [vue.h(icon)]
  43784. })
  43785. ];
  43786. }
  43787. }));
  43788. } else {
  43789. ele.push(vue.h("span", {
  43790. class: ns.e("placeholder")
  43791. }));
  43792. }
  43793. return ele;
  43794. }
  43795. function getAllAliases(props, aliases) {
  43796. return props.reduce((prev, cur) => {
  43797. prev[cur] = cur;
  43798. return prev;
  43799. }, aliases);
  43800. }
  43801. function useWatcher(owner, props_) {
  43802. const instance = vue.getCurrentInstance();
  43803. const registerComplexWatchers = () => {
  43804. const props = ["fixed"];
  43805. const aliases = {
  43806. realWidth: "width",
  43807. realMinWidth: "minWidth"
  43808. };
  43809. const allAliases = getAllAliases(props, aliases);
  43810. Object.keys(allAliases).forEach((key) => {
  43811. const columnKey = aliases[key];
  43812. if (hasOwn(props_, columnKey)) {
  43813. vue.watch(() => props_[columnKey], (newVal) => {
  43814. let value = newVal;
  43815. if (columnKey === "width" && key === "realWidth") {
  43816. value = parseWidth(newVal);
  43817. }
  43818. if (columnKey === "minWidth" && key === "realMinWidth") {
  43819. value = parseMinWidth(newVal);
  43820. }
  43821. instance.columnConfig.value[columnKey] = value;
  43822. instance.columnConfig.value[key] = value;
  43823. const updateColumns = columnKey === "fixed";
  43824. owner.value.store.scheduleLayout(updateColumns);
  43825. });
  43826. }
  43827. });
  43828. };
  43829. const registerNormalWatchers = () => {
  43830. const props = [
  43831. "label",
  43832. "filters",
  43833. "filterMultiple",
  43834. "sortable",
  43835. "index",
  43836. "formatter",
  43837. "className",
  43838. "labelClassName",
  43839. "showOverflowTooltip"
  43840. ];
  43841. const aliases = {
  43842. property: "prop",
  43843. align: "realAlign",
  43844. headerAlign: "realHeaderAlign"
  43845. };
  43846. const allAliases = getAllAliases(props, aliases);
  43847. Object.keys(allAliases).forEach((key) => {
  43848. const columnKey = aliases[key];
  43849. if (hasOwn(props_, columnKey)) {
  43850. vue.watch(() => props_[columnKey], (newVal) => {
  43851. instance.columnConfig.value[key] = newVal;
  43852. });
  43853. }
  43854. });
  43855. };
  43856. return {
  43857. registerComplexWatchers,
  43858. registerNormalWatchers
  43859. };
  43860. }
  43861. function useRender(props, slots, owner) {
  43862. const instance = vue.getCurrentInstance();
  43863. const columnId = vue.ref("");
  43864. const isSubColumn = vue.ref(false);
  43865. const realAlign = vue.ref();
  43866. const realHeaderAlign = vue.ref();
  43867. const ns = useNamespace("table");
  43868. vue.watchEffect(() => {
  43869. realAlign.value = props.align ? `is-${props.align}` : null;
  43870. realAlign.value;
  43871. });
  43872. vue.watchEffect(() => {
  43873. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  43874. realHeaderAlign.value;
  43875. });
  43876. const columnOrTableParent = vue.computed(() => {
  43877. let parent = instance.vnode.vParent || instance.parent;
  43878. while (parent && !parent.tableId && !parent.columnId) {
  43879. parent = parent.vnode.vParent || parent.parent;
  43880. }
  43881. return parent;
  43882. });
  43883. const hasTreeColumn = vue.computed(() => {
  43884. const { store } = instance.parent;
  43885. if (!store)
  43886. return false;
  43887. const { treeData } = store.states;
  43888. const treeDataValue = treeData.value;
  43889. return treeDataValue && Object.keys(treeDataValue).length > 0;
  43890. });
  43891. const realWidth = vue.ref(parseWidth(props.width));
  43892. const realMinWidth = vue.ref(parseMinWidth(props.minWidth));
  43893. const setColumnWidth = (column) => {
  43894. if (realWidth.value)
  43895. column.width = realWidth.value;
  43896. if (realMinWidth.value) {
  43897. column.minWidth = realMinWidth.value;
  43898. }
  43899. if (!realWidth.value && realMinWidth.value) {
  43900. column.width = void 0;
  43901. }
  43902. if (!column.minWidth) {
  43903. column.minWidth = 80;
  43904. }
  43905. column.realWidth = Number(column.width === void 0 ? column.minWidth : column.width);
  43906. return column;
  43907. };
  43908. const setColumnForcedProps = (column) => {
  43909. const type = column.type;
  43910. const source = cellForced[type] || {};
  43911. Object.keys(source).forEach((prop) => {
  43912. const value = source[prop];
  43913. if (prop !== "className" && value !== void 0) {
  43914. column[prop] = value;
  43915. }
  43916. });
  43917. const className = getDefaultClassName(type);
  43918. if (className) {
  43919. const forceClass = `${vue.unref(ns.namespace)}-${className}`;
  43920. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  43921. }
  43922. return column;
  43923. };
  43924. const checkSubColumn = (children) => {
  43925. if (Array.isArray(children)) {
  43926. children.forEach((child) => check(child));
  43927. } else {
  43928. check(children);
  43929. }
  43930. function check(item) {
  43931. var _a;
  43932. if (((_a = item == null ? void 0 : item.type) == null ? void 0 : _a.name) === "ElTableColumn") {
  43933. item.vParent = instance;
  43934. }
  43935. }
  43936. };
  43937. const setColumnRenders = (column) => {
  43938. if (props.renderHeader) ; else if (column.type !== "selection") {
  43939. column.renderHeader = (scope) => {
  43940. instance.columnConfig.value["label"];
  43941. const renderHeader = slots.header;
  43942. return renderHeader ? renderHeader(scope) : column.label;
  43943. };
  43944. }
  43945. let originRenderCell = column.renderCell;
  43946. if (column.type === "expand") {
  43947. column.renderCell = (data) => vue.h("div", {
  43948. class: "cell"
  43949. }, [originRenderCell(data)]);
  43950. owner.value.renderExpanded = (data) => {
  43951. return slots.default ? slots.default(data) : slots.default;
  43952. };
  43953. } else {
  43954. originRenderCell = originRenderCell || defaultRenderCell;
  43955. column.renderCell = (data) => {
  43956. let children = null;
  43957. if (slots.default) {
  43958. const vnodes = slots.default(data);
  43959. children = vnodes.some((v) => v.type !== vue.Comment) ? vnodes : originRenderCell(data);
  43960. } else {
  43961. children = originRenderCell(data);
  43962. }
  43963. const shouldCreatePlaceholder = hasTreeColumn.value && data.cellIndex === 0 && data.column.type !== "selection";
  43964. const prefix = treeCellPrefix(data, shouldCreatePlaceholder);
  43965. const props2 = {
  43966. class: "cell",
  43967. style: {}
  43968. };
  43969. if (column.showOverflowTooltip) {
  43970. props2.class = `${props2.class} ${vue.unref(ns.namespace)}-tooltip`;
  43971. props2.style = {
  43972. width: `${(data.column.realWidth || Number(data.column.width)) - 1}px`
  43973. };
  43974. }
  43975. checkSubColumn(children);
  43976. return vue.h("div", props2, [prefix, children]);
  43977. };
  43978. }
  43979. return column;
  43980. };
  43981. const getPropsData = (...propsKey) => {
  43982. return propsKey.reduce((prev, cur) => {
  43983. if (Array.isArray(cur)) {
  43984. cur.forEach((key) => {
  43985. prev[key] = props[key];
  43986. });
  43987. }
  43988. return prev;
  43989. }, {});
  43990. };
  43991. const getColumnElIndex = (children, child) => {
  43992. return Array.prototype.indexOf.call(children, child);
  43993. };
  43994. return {
  43995. columnId,
  43996. realAlign,
  43997. isSubColumn,
  43998. realHeaderAlign,
  43999. columnOrTableParent,
  44000. setColumnWidth,
  44001. setColumnForcedProps,
  44002. setColumnRenders,
  44003. getPropsData,
  44004. getColumnElIndex
  44005. };
  44006. }
  44007. var defaultProps = {
  44008. type: {
  44009. type: String,
  44010. default: "default"
  44011. },
  44012. label: String,
  44013. className: String,
  44014. labelClassName: String,
  44015. property: String,
  44016. prop: String,
  44017. width: {
  44018. type: [String, Number],
  44019. default: ""
  44020. },
  44021. minWidth: {
  44022. type: [String, Number],
  44023. default: ""
  44024. },
  44025. renderHeader: Function,
  44026. sortable: {
  44027. type: [Boolean, String],
  44028. default: false
  44029. },
  44030. sortMethod: Function,
  44031. sortBy: [String, Function, Array],
  44032. resizable: {
  44033. type: Boolean,
  44034. default: true
  44035. },
  44036. columnKey: String,
  44037. align: String,
  44038. headerAlign: String,
  44039. showTooltipWhenOverflow: Boolean,
  44040. showOverflowTooltip: Boolean,
  44041. fixed: [Boolean, String],
  44042. formatter: Function,
  44043. selectable: Function,
  44044. reserveSelection: Boolean,
  44045. filterMethod: Function,
  44046. filteredValue: Array,
  44047. filters: Array,
  44048. filterPlacement: String,
  44049. filterMultiple: {
  44050. type: Boolean,
  44051. default: true
  44052. },
  44053. index: [Number, Function],
  44054. sortOrders: {
  44055. type: Array,
  44056. default: () => {
  44057. return ["ascending", "descending", null];
  44058. },
  44059. validator: (val) => {
  44060. return val.every((order) => ["ascending", "descending", null].includes(order));
  44061. }
  44062. }
  44063. };
  44064. let columnIdSeed = 1;
  44065. var ElTableColumn$1 = vue.defineComponent({
  44066. name: "ElTableColumn",
  44067. components: {
  44068. ElCheckbox
  44069. },
  44070. props: defaultProps,
  44071. setup(props, { slots }) {
  44072. const instance = vue.getCurrentInstance();
  44073. const columnConfig = vue.ref({});
  44074. const owner = vue.computed(() => {
  44075. let parent2 = instance.parent;
  44076. while (parent2 && !parent2.tableId) {
  44077. parent2 = parent2.parent;
  44078. }
  44079. return parent2;
  44080. });
  44081. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  44082. const {
  44083. columnId,
  44084. isSubColumn,
  44085. realHeaderAlign,
  44086. columnOrTableParent,
  44087. setColumnWidth,
  44088. setColumnForcedProps,
  44089. setColumnRenders,
  44090. getPropsData,
  44091. getColumnElIndex,
  44092. realAlign
  44093. } = useRender(props, slots, owner);
  44094. const parent = columnOrTableParent.value;
  44095. columnId.value = `${parent.tableId || parent.columnId}_column_${columnIdSeed++}`;
  44096. vue.onBeforeMount(() => {
  44097. isSubColumn.value = owner.value !== parent;
  44098. const type = props.type || "default";
  44099. const sortable = props.sortable === "" ? true : props.sortable;
  44100. const defaults = {
  44101. ...cellStarts[type],
  44102. id: columnId.value,
  44103. type,
  44104. property: props.prop || props.property,
  44105. align: realAlign,
  44106. headerAlign: realHeaderAlign,
  44107. showOverflowTooltip: props.showOverflowTooltip || props.showTooltipWhenOverflow,
  44108. filterable: props.filters || props.filterMethod,
  44109. filteredValue: [],
  44110. filterPlacement: "",
  44111. isColumnGroup: false,
  44112. isSubColumn: false,
  44113. filterOpened: false,
  44114. sortable,
  44115. index: props.index,
  44116. rawColumnKey: instance.vnode.key
  44117. };
  44118. const basicProps = [
  44119. "columnKey",
  44120. "label",
  44121. "className",
  44122. "labelClassName",
  44123. "type",
  44124. "renderHeader",
  44125. "formatter",
  44126. "fixed",
  44127. "resizable"
  44128. ];
  44129. const sortProps = ["sortMethod", "sortBy", "sortOrders"];
  44130. const selectProps = ["selectable", "reserveSelection"];
  44131. const filterProps = [
  44132. "filterMethod",
  44133. "filters",
  44134. "filterMultiple",
  44135. "filterOpened",
  44136. "filteredValue",
  44137. "filterPlacement"
  44138. ];
  44139. let column = getPropsData(basicProps, sortProps, selectProps, filterProps);
  44140. column = mergeOptions(defaults, column);
  44141. const chains = compose(setColumnRenders, setColumnWidth, setColumnForcedProps);
  44142. column = chains(column);
  44143. columnConfig.value = column;
  44144. registerNormalWatchers();
  44145. registerComplexWatchers();
  44146. });
  44147. vue.onMounted(() => {
  44148. var _a;
  44149. const parent2 = columnOrTableParent.value;
  44150. const children = isSubColumn.value ? parent2.vnode.el.children : (_a = parent2.refs.hiddenColumns) == null ? void 0 : _a.children;
  44151. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  44152. columnConfig.value.getColumnIndex = getColumnIndex;
  44153. const columnIndex = getColumnIndex();
  44154. columnIndex > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? parent2.columnConfig.value : null);
  44155. });
  44156. vue.onBeforeUnmount(() => {
  44157. owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? parent.columnConfig.value : null);
  44158. });
  44159. instance.columnId = columnId.value;
  44160. instance.columnConfig = columnConfig;
  44161. return;
  44162. },
  44163. render() {
  44164. var _a, _b, _c;
  44165. try {
  44166. const renderDefault = (_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a, {
  44167. row: {},
  44168. column: {},
  44169. $index: -1
  44170. });
  44171. const children = [];
  44172. if (Array.isArray(renderDefault)) {
  44173. for (const childNode of renderDefault) {
  44174. if (((_c = childNode.type) == null ? void 0 : _c.name) === "ElTableColumn" || childNode.shapeFlag & 2) {
  44175. children.push(childNode);
  44176. } else if (childNode.type === vue.Fragment && Array.isArray(childNode.children)) {
  44177. childNode.children.forEach((vnode2) => {
  44178. if ((vnode2 == null ? void 0 : vnode2.patchFlag) !== 1024 && !isString(vnode2 == null ? void 0 : vnode2.children)) {
  44179. children.push(vnode2);
  44180. }
  44181. });
  44182. }
  44183. }
  44184. }
  44185. const vnode = vue.h("div", children);
  44186. return vnode;
  44187. } catch (e) {
  44188. return vue.h("div", []);
  44189. }
  44190. }
  44191. });
  44192. const ElTable = withInstall(Table, {
  44193. TableColumn: ElTableColumn$1
  44194. });
  44195. const ElTableColumn = withNoopInstall(ElTableColumn$1);
  44196. var SortOrder = /* @__PURE__ */ ((SortOrder2) => {
  44197. SortOrder2["ASC"] = "asc";
  44198. SortOrder2["DESC"] = "desc";
  44199. return SortOrder2;
  44200. })(SortOrder || {});
  44201. var Alignment = /* @__PURE__ */ ((Alignment2) => {
  44202. Alignment2["CENTER"] = "center";
  44203. Alignment2["RIGHT"] = "right";
  44204. return Alignment2;
  44205. })(Alignment || {});
  44206. var FixedDir = /* @__PURE__ */ ((FixedDir2) => {
  44207. FixedDir2["LEFT"] = "left";
  44208. FixedDir2["RIGHT"] = "right";
  44209. return FixedDir2;
  44210. })(FixedDir || {});
  44211. const oppositeOrderMap = {
  44212. ["asc" /* ASC */]: "desc" /* DESC */,
  44213. ["desc" /* DESC */]: "asc" /* ASC */
  44214. };
  44215. const placeholderSign = Symbol("placeholder");
  44216. const calcColumnStyle = (column, fixedColumn, fixed) => {
  44217. var _a;
  44218. const flex = {
  44219. flexGrow: 0,
  44220. flexShrink: 0,
  44221. ...fixed ? {} : {
  44222. flexGrow: column.flexGrow || 0,
  44223. flexShrink: column.flexShrink || 1
  44224. }
  44225. };
  44226. if (!fixed) {
  44227. flex.flexShrink = 1;
  44228. }
  44229. const style = {
  44230. ...(_a = column.style) != null ? _a : {},
  44231. ...flex,
  44232. flexBasis: "auto",
  44233. width: column.width
  44234. };
  44235. if (!fixedColumn) {
  44236. if (column.maxWidth)
  44237. style.maxWidth = column.maxWidth;
  44238. if (column.minWidth)
  44239. style.minWidth = column.minWidth;
  44240. }
  44241. return style;
  44242. };
  44243. function useColumns(props, columns, fixed) {
  44244. const visibleColumns = vue.computed(() => {
  44245. return vue.unref(columns).filter((column) => !column.hidden);
  44246. });
  44247. const fixedColumnsOnLeft = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true));
  44248. const fixedColumnsOnRight = vue.computed(() => vue.unref(visibleColumns).filter((column) => column.fixed === "right"));
  44249. const normalColumns = vue.computed(() => vue.unref(visibleColumns).filter((column) => !column.fixed));
  44250. const mainColumns = vue.computed(() => {
  44251. const ret = [];
  44252. vue.unref(fixedColumnsOnLeft).forEach((column) => {
  44253. ret.push({
  44254. ...column,
  44255. placeholderSign
  44256. });
  44257. });
  44258. vue.unref(normalColumns).forEach((column) => {
  44259. ret.push(column);
  44260. });
  44261. vue.unref(fixedColumnsOnRight).forEach((column) => {
  44262. ret.push({
  44263. ...column,
  44264. placeholderSign
  44265. });
  44266. });
  44267. return ret;
  44268. });
  44269. const hasFixedColumns = vue.computed(() => {
  44270. return vue.unref(fixedColumnsOnLeft).length || vue.unref(fixedColumnsOnRight).length;
  44271. });
  44272. const columnsStyles = vue.computed(() => {
  44273. const _columns = vue.unref(columns);
  44274. return _columns.reduce((style, column) => {
  44275. style[column.key] = calcColumnStyle(column, vue.unref(fixed), props.fixed);
  44276. return style;
  44277. }, {});
  44278. });
  44279. const columnsTotalWidth = vue.computed(() => {
  44280. return vue.unref(visibleColumns).reduce((width, column) => width + column.width, 0);
  44281. });
  44282. const getColumn = (key) => {
  44283. return vue.unref(columns).find((column) => column.key === key);
  44284. };
  44285. const getColumnStyle = (key) => {
  44286. return vue.unref(columnsStyles)[key];
  44287. };
  44288. const updateColumnWidth = (column, width) => {
  44289. column.width = width;
  44290. };
  44291. function onColumnSorted(e) {
  44292. var _a;
  44293. const { key } = e.currentTarget.dataset;
  44294. if (!key)
  44295. return;
  44296. const { sortState, sortBy } = props;
  44297. let order = SortOrder.ASC;
  44298. if (isObject$1(sortState)) {
  44299. order = oppositeOrderMap[sortState[key]];
  44300. } else {
  44301. order = oppositeOrderMap[sortBy.order];
  44302. }
  44303. (_a = props.onColumnSort) == null ? void 0 : _a.call(props, { column: getColumn(key), key, order });
  44304. }
  44305. return {
  44306. columns,
  44307. columnsStyles,
  44308. columnsTotalWidth,
  44309. fixedColumnsOnLeft,
  44310. fixedColumnsOnRight,
  44311. hasFixedColumns,
  44312. mainColumns,
  44313. normalColumns,
  44314. visibleColumns,
  44315. getColumn,
  44316. getColumnStyle,
  44317. updateColumnWidth,
  44318. onColumnSorted
  44319. };
  44320. }
  44321. const useScrollbar = (props, {
  44322. mainTableRef,
  44323. leftTableRef,
  44324. rightTableRef,
  44325. onMaybeEndReached
  44326. }) => {
  44327. const scrollPos = vue.ref({ scrollLeft: 0, scrollTop: 0 });
  44328. function doScroll(params) {
  44329. var _a, _b, _c;
  44330. const { scrollTop } = params;
  44331. (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo(params);
  44332. (_b = leftTableRef.value) == null ? void 0 : _b.scrollToTop(scrollTop);
  44333. (_c = rightTableRef.value) == null ? void 0 : _c.scrollToTop(scrollTop);
  44334. }
  44335. function scrollTo(params) {
  44336. scrollPos.value = params;
  44337. doScroll(params);
  44338. }
  44339. function scrollToTop(scrollTop) {
  44340. scrollPos.value.scrollTop = scrollTop;
  44341. doScroll(vue.unref(scrollPos));
  44342. }
  44343. function scrollToLeft(scrollLeft) {
  44344. var _a, _b;
  44345. scrollPos.value.scrollLeft = scrollLeft;
  44346. (_b = (_a = mainTableRef.value) == null ? void 0 : _a.scrollTo) == null ? void 0 : _b.call(_a, vue.unref(scrollPos));
  44347. }
  44348. function onScroll(params) {
  44349. var _a;
  44350. scrollTo(params);
  44351. (_a = props.onScroll) == null ? void 0 : _a.call(props, params);
  44352. }
  44353. function onVerticalScroll({ scrollTop }) {
  44354. const { scrollTop: currentScrollTop } = vue.unref(scrollPos);
  44355. if (scrollTop !== currentScrollTop)
  44356. scrollToTop(scrollTop);
  44357. }
  44358. function scrollToRow(row, strategy = "auto") {
  44359. var _a;
  44360. (_a = mainTableRef.value) == null ? void 0 : _a.scrollToRow(row, strategy);
  44361. }
  44362. vue.watch(() => vue.unref(scrollPos).scrollTop, (cur, prev) => {
  44363. if (cur > prev)
  44364. onMaybeEndReached();
  44365. });
  44366. return {
  44367. scrollPos,
  44368. scrollTo,
  44369. scrollToLeft,
  44370. scrollToTop,
  44371. scrollToRow,
  44372. onScroll,
  44373. onVerticalScroll
  44374. };
  44375. };
  44376. const useRow = (props, { mainTableRef, leftTableRef, rightTableRef, onMaybeEndReached }) => {
  44377. const vm = vue.getCurrentInstance();
  44378. const { emit } = vm;
  44379. const isResetting = vue.shallowRef(false);
  44380. const hoveringRowKey = vue.shallowRef(null);
  44381. const expandedRowKeys = vue.ref(props.defaultExpandedRowKeys || []);
  44382. const lastRenderedRowIndex = vue.ref(-1);
  44383. const resetIndex = vue.shallowRef(null);
  44384. const rowHeights = vue.ref({});
  44385. const pendingRowHeights = vue.ref({});
  44386. const leftTableHeights = vue.shallowRef({});
  44387. const mainTableHeights = vue.shallowRef({});
  44388. const rightTableHeights = vue.shallowRef({});
  44389. const isDynamic = vue.computed(() => isNumber(props.estimatedRowHeight));
  44390. function onRowsRendered(params) {
  44391. var _a;
  44392. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, params);
  44393. if (params.rowCacheEnd > vue.unref(lastRenderedRowIndex)) {
  44394. lastRenderedRowIndex.value = params.rowCacheEnd;
  44395. }
  44396. }
  44397. function onRowHovered({ hovered, rowKey }) {
  44398. hoveringRowKey.value = hovered ? rowKey : null;
  44399. }
  44400. function onRowExpanded({
  44401. expanded,
  44402. rowData,
  44403. rowIndex,
  44404. rowKey
  44405. }) {
  44406. var _a, _b;
  44407. const _expandedRowKeys = [...vue.unref(expandedRowKeys)];
  44408. const currentKeyIndex = _expandedRowKeys.indexOf(rowKey);
  44409. if (expanded) {
  44410. if (currentKeyIndex === -1)
  44411. _expandedRowKeys.push(rowKey);
  44412. } else {
  44413. if (currentKeyIndex > -1)
  44414. _expandedRowKeys.splice(currentKeyIndex, 1);
  44415. }
  44416. expandedRowKeys.value = _expandedRowKeys;
  44417. emit("update:expandedRowKeys", _expandedRowKeys);
  44418. (_a = props.onRowExpand) == null ? void 0 : _a.call(props, {
  44419. expanded,
  44420. rowData,
  44421. rowIndex,
  44422. rowKey
  44423. });
  44424. (_b = props.onExpandedRowsChange) == null ? void 0 : _b.call(props, _expandedRowKeys);
  44425. }
  44426. const flushingRowHeights = debounce(() => {
  44427. var _a, _b, _c, _d;
  44428. isResetting.value = true;
  44429. rowHeights.value = { ...vue.unref(rowHeights), ...vue.unref(pendingRowHeights) };
  44430. resetAfterIndex(vue.unref(resetIndex), false);
  44431. pendingRowHeights.value = {};
  44432. resetIndex.value = null;
  44433. (_a = mainTableRef.value) == null ? void 0 : _a.forceUpdate();
  44434. (_b = leftTableRef.value) == null ? void 0 : _b.forceUpdate();
  44435. (_c = rightTableRef.value) == null ? void 0 : _c.forceUpdate();
  44436. (_d = vm.proxy) == null ? void 0 : _d.$forceUpdate();
  44437. isResetting.value = false;
  44438. }, 0);
  44439. function resetAfterIndex(index, forceUpdate = false) {
  44440. if (!vue.unref(isDynamic))
  44441. return;
  44442. [mainTableRef, leftTableRef, rightTableRef].forEach((tableRef) => {
  44443. const table = vue.unref(tableRef);
  44444. if (table)
  44445. table.resetAfterRowIndex(index, forceUpdate);
  44446. });
  44447. }
  44448. function resetHeights(rowKey, height, rowIdx) {
  44449. const resetIdx = vue.unref(resetIndex);
  44450. if (resetIdx === null) {
  44451. resetIndex.value = rowIdx;
  44452. } else {
  44453. if (resetIdx > rowIdx) {
  44454. resetIndex.value = rowIdx;
  44455. }
  44456. }
  44457. pendingRowHeights.value[rowKey] = height;
  44458. }
  44459. function onRowHeightChange({ rowKey, height, rowIndex }, fixedDir) {
  44460. if (!fixedDir) {
  44461. mainTableHeights.value[rowKey] = height;
  44462. } else {
  44463. if (fixedDir === FixedDir.RIGHT) {
  44464. rightTableHeights.value[rowKey] = height;
  44465. } else {
  44466. leftTableHeights.value[rowKey] = height;
  44467. }
  44468. }
  44469. const maximumHeight = Math.max(...[leftTableHeights, rightTableHeights, mainTableHeights].map((records) => records.value[rowKey] || 0));
  44470. if (vue.unref(rowHeights)[rowKey] !== maximumHeight) {
  44471. resetHeights(rowKey, maximumHeight, rowIndex);
  44472. flushingRowHeights();
  44473. }
  44474. }
  44475. vue.watch(lastRenderedRowIndex, () => onMaybeEndReached());
  44476. return {
  44477. hoveringRowKey,
  44478. expandedRowKeys,
  44479. lastRenderedRowIndex,
  44480. isDynamic,
  44481. isResetting,
  44482. rowHeights,
  44483. resetAfterIndex,
  44484. onRowExpanded,
  44485. onRowHovered,
  44486. onRowsRendered,
  44487. onRowHeightChange
  44488. };
  44489. };
  44490. const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => {
  44491. const depthMap = vue.ref({});
  44492. const flattenedData = vue.computed(() => {
  44493. const depths = {};
  44494. const { data: data2, rowKey } = props;
  44495. const _expandedRowKeys = vue.unref(expandedRowKeys);
  44496. if (!_expandedRowKeys || !_expandedRowKeys.length)
  44497. return data2;
  44498. const array = [];
  44499. const keysSet = /* @__PURE__ */ new Set();
  44500. _expandedRowKeys.forEach((x) => keysSet.add(x));
  44501. let copy = data2.slice();
  44502. copy.forEach((x) => depths[x[rowKey]] = 0);
  44503. while (copy.length > 0) {
  44504. const item = copy.shift();
  44505. array.push(item);
  44506. if (keysSet.has(item[rowKey]) && Array.isArray(item.children) && item.children.length > 0) {
  44507. copy = [...item.children, ...copy];
  44508. item.children.forEach((child) => depths[child[rowKey]] = depths[item[rowKey]] + 1);
  44509. }
  44510. }
  44511. depthMap.value = depths;
  44512. return array;
  44513. });
  44514. const data = vue.computed(() => {
  44515. const { data: data2, expandColumnKey } = props;
  44516. return expandColumnKey ? vue.unref(flattenedData) : data2;
  44517. });
  44518. vue.watch(data, (val, prev) => {
  44519. if (val !== prev) {
  44520. lastRenderedRowIndex.value = -1;
  44521. resetAfterIndex(0, true);
  44522. }
  44523. });
  44524. return {
  44525. data,
  44526. depthMap
  44527. };
  44528. };
  44529. const sumReducer = (sum2, num) => sum2 + num;
  44530. const sum = (listLike) => {
  44531. return isArray(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  44532. };
  44533. const tryCall = (fLike, params, defaultRet = {}) => {
  44534. return isFunction(fLike) ? fLike(params) : fLike != null ? fLike : defaultRet;
  44535. };
  44536. const enforceUnit = (style) => {
  44537. ["width", "maxWidth", "minWidth", "height"].forEach((key) => {
  44538. style[key] = addUnit(style[key]);
  44539. });
  44540. return style;
  44541. };
  44542. const componentToSlot = (ComponentLike) => vue.isVNode(ComponentLike) ? (props) => vue.h(ComponentLike, props) : ComponentLike;
  44543. const useStyles = (props, {
  44544. columnsTotalWidth,
  44545. data,
  44546. fixedColumnsOnLeft,
  44547. fixedColumnsOnRight
  44548. }) => {
  44549. const bodyWidth = vue.computed(() => {
  44550. const { fixed, width, vScrollbarSize } = props;
  44551. const ret = width - vScrollbarSize;
  44552. return fixed ? Math.max(Math.round(vue.unref(columnsTotalWidth)), ret) : ret;
  44553. });
  44554. const headerWidth = vue.computed(() => vue.unref(bodyWidth) + (props.fixed ? props.vScrollbarSize : 0));
  44555. const mainTableHeight = vue.computed(() => {
  44556. const { height = 0, maxHeight = 0, footerHeight: footerHeight2, hScrollbarSize } = props;
  44557. if (maxHeight > 0) {
  44558. const _fixedRowsHeight = vue.unref(fixedRowsHeight);
  44559. const _rowsHeight = vue.unref(rowsHeight);
  44560. const _headerHeight = vue.unref(headerHeight);
  44561. const total = _headerHeight + _fixedRowsHeight + _rowsHeight + hScrollbarSize;
  44562. return Math.min(total, maxHeight - footerHeight2);
  44563. }
  44564. return height - footerHeight2;
  44565. });
  44566. const rowsHeight = vue.computed(() => {
  44567. const { rowHeight, estimatedRowHeight } = props;
  44568. const _data = vue.unref(data);
  44569. if (isNumber(estimatedRowHeight)) {
  44570. return _data.length * estimatedRowHeight;
  44571. }
  44572. return _data.length * rowHeight;
  44573. });
  44574. const fixedTableHeight = vue.computed(() => {
  44575. const { maxHeight } = props;
  44576. const tableHeight = vue.unref(mainTableHeight);
  44577. if (isNumber(maxHeight) && maxHeight > 0)
  44578. return tableHeight;
  44579. const totalHeight = vue.unref(rowsHeight) + vue.unref(headerHeight) + vue.unref(fixedRowsHeight);
  44580. return Math.min(tableHeight, totalHeight);
  44581. });
  44582. const mapColumn = (column) => column.width;
  44583. const leftTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnLeft).map(mapColumn)));
  44584. const rightTableWidth = vue.computed(() => sum(vue.unref(fixedColumnsOnRight).map(mapColumn)));
  44585. const headerHeight = vue.computed(() => sum(props.headerHeight));
  44586. const fixedRowsHeight = vue.computed(() => {
  44587. var _a;
  44588. return (((_a = props.fixedData) == null ? void 0 : _a.length) || 0) * props.rowHeight;
  44589. });
  44590. const windowHeight = vue.computed(() => {
  44591. return vue.unref(mainTableHeight) - vue.unref(headerHeight) - vue.unref(fixedRowsHeight);
  44592. });
  44593. const rootStyle = vue.computed(() => {
  44594. const { style = {}, height, width } = props;
  44595. return enforceUnit({
  44596. ...style,
  44597. height,
  44598. width
  44599. });
  44600. });
  44601. const footerHeight = vue.computed(() => enforceUnit({ height: props.footerHeight }));
  44602. const emptyStyle = vue.computed(() => ({
  44603. top: addUnit(vue.unref(headerHeight)),
  44604. bottom: addUnit(props.footerHeight),
  44605. width: addUnit(props.width)
  44606. }));
  44607. return {
  44608. bodyWidth,
  44609. fixedTableHeight,
  44610. mainTableHeight,
  44611. leftTableWidth,
  44612. rightTableWidth,
  44613. headerWidth,
  44614. rowsHeight,
  44615. windowHeight,
  44616. footerHeight,
  44617. emptyStyle,
  44618. rootStyle,
  44619. headerHeight
  44620. };
  44621. };
  44622. const useAutoResize = (props) => {
  44623. const sizer = vue.ref();
  44624. const width$ = vue.ref(0);
  44625. const height$ = vue.ref(0);
  44626. let resizerStopper;
  44627. vue.onMounted(() => {
  44628. resizerStopper = useResizeObserver(sizer, ([entry]) => {
  44629. const { width, height } = entry.contentRect;
  44630. const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
  44631. const left = Number.parseInt(paddingLeft) || 0;
  44632. const right = Number.parseInt(paddingRight) || 0;
  44633. const top = Number.parseInt(paddingTop) || 0;
  44634. const bottom = Number.parseInt(paddingBottom) || 0;
  44635. width$.value = width - left - right;
  44636. height$.value = height - top - bottom;
  44637. }).stop;
  44638. });
  44639. vue.onBeforeUnmount(() => {
  44640. resizerStopper == null ? void 0 : resizerStopper();
  44641. });
  44642. vue.watch([width$, height$], ([width, height]) => {
  44643. var _a;
  44644. (_a = props.onResize) == null ? void 0 : _a.call(props, {
  44645. width,
  44646. height
  44647. });
  44648. });
  44649. return {
  44650. sizer,
  44651. width: width$,
  44652. height: height$
  44653. };
  44654. };
  44655. function useTable(props) {
  44656. const mainTableRef = vue.ref();
  44657. const leftTableRef = vue.ref();
  44658. const rightTableRef = vue.ref();
  44659. const {
  44660. columns,
  44661. columnsStyles,
  44662. columnsTotalWidth,
  44663. fixedColumnsOnLeft,
  44664. fixedColumnsOnRight,
  44665. hasFixedColumns,
  44666. mainColumns,
  44667. onColumnSorted
  44668. } = useColumns(props, vue.toRef(props, "columns"), vue.toRef(props, "fixed"));
  44669. const {
  44670. scrollTo,
  44671. scrollToLeft,
  44672. scrollToTop,
  44673. scrollToRow,
  44674. onScroll,
  44675. onVerticalScroll,
  44676. scrollPos
  44677. } = useScrollbar(props, {
  44678. mainTableRef,
  44679. leftTableRef,
  44680. rightTableRef,
  44681. onMaybeEndReached
  44682. });
  44683. const {
  44684. expandedRowKeys,
  44685. hoveringRowKey,
  44686. lastRenderedRowIndex,
  44687. isDynamic,
  44688. isResetting,
  44689. rowHeights,
  44690. resetAfterIndex,
  44691. onRowExpanded,
  44692. onRowHeightChange,
  44693. onRowHovered,
  44694. onRowsRendered
  44695. } = useRow(props, {
  44696. mainTableRef,
  44697. leftTableRef,
  44698. rightTableRef,
  44699. onMaybeEndReached
  44700. });
  44701. const { data, depthMap } = useData(props, {
  44702. expandedRowKeys,
  44703. lastRenderedRowIndex,
  44704. resetAfterIndex
  44705. });
  44706. const {
  44707. bodyWidth,
  44708. fixedTableHeight,
  44709. mainTableHeight,
  44710. leftTableWidth,
  44711. rightTableWidth,
  44712. headerWidth,
  44713. rowsHeight,
  44714. windowHeight,
  44715. footerHeight,
  44716. emptyStyle,
  44717. rootStyle,
  44718. headerHeight
  44719. } = useStyles(props, {
  44720. columnsTotalWidth,
  44721. data,
  44722. fixedColumnsOnLeft,
  44723. fixedColumnsOnRight
  44724. });
  44725. const isScrolling = vue.shallowRef(false);
  44726. const containerRef = vue.ref();
  44727. const showEmpty = vue.computed(() => {
  44728. const noData = vue.unref(data).length === 0;
  44729. return isArray(props.fixedData) ? props.fixedData.length === 0 && noData : noData;
  44730. });
  44731. function getRowHeight(rowIndex) {
  44732. const { estimatedRowHeight, rowHeight, rowKey } = props;
  44733. if (!estimatedRowHeight)
  44734. return rowHeight;
  44735. return vue.unref(rowHeights)[vue.unref(data)[rowIndex][rowKey]] || estimatedRowHeight;
  44736. }
  44737. function onMaybeEndReached() {
  44738. const { onEndReached } = props;
  44739. if (!onEndReached)
  44740. return;
  44741. const { scrollTop } = vue.unref(scrollPos);
  44742. const _totalHeight = vue.unref(rowsHeight);
  44743. const clientHeight = vue.unref(windowHeight);
  44744. const heightUntilEnd = _totalHeight - (scrollTop + clientHeight) + props.hScrollbarSize;
  44745. if (vue.unref(lastRenderedRowIndex) >= 0 && _totalHeight === scrollTop + vue.unref(mainTableHeight) - vue.unref(headerHeight)) {
  44746. onEndReached(heightUntilEnd);
  44747. }
  44748. }
  44749. vue.watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, {
  44750. deep: true
  44751. });
  44752. return {
  44753. columns,
  44754. containerRef,
  44755. mainTableRef,
  44756. leftTableRef,
  44757. rightTableRef,
  44758. isDynamic,
  44759. isResetting,
  44760. isScrolling,
  44761. hoveringRowKey,
  44762. hasFixedColumns,
  44763. columnsStyles,
  44764. columnsTotalWidth,
  44765. data,
  44766. expandedRowKeys,
  44767. depthMap,
  44768. fixedColumnsOnLeft,
  44769. fixedColumnsOnRight,
  44770. mainColumns,
  44771. bodyWidth,
  44772. emptyStyle,
  44773. rootStyle,
  44774. headerWidth,
  44775. footerHeight,
  44776. mainTableHeight,
  44777. fixedTableHeight,
  44778. leftTableWidth,
  44779. rightTableWidth,
  44780. showEmpty,
  44781. getRowHeight,
  44782. onColumnSorted,
  44783. onRowHovered,
  44784. onRowExpanded,
  44785. onRowsRendered,
  44786. onRowHeightChange,
  44787. scrollTo,
  44788. scrollToLeft,
  44789. scrollToTop,
  44790. scrollToRow,
  44791. onScroll,
  44792. onVerticalScroll
  44793. };
  44794. }
  44795. const TableV2InjectionKey = Symbol("tableV2");
  44796. const classType = String;
  44797. const columns = {
  44798. type: definePropType(Array),
  44799. required: true
  44800. };
  44801. const fixedDataType = {
  44802. type: definePropType(Array)
  44803. };
  44804. const dataType = {
  44805. ...fixedDataType,
  44806. required: true
  44807. };
  44808. const expandColumnKey = String;
  44809. const expandKeys = {
  44810. type: definePropType(Array),
  44811. default: () => mutable([])
  44812. };
  44813. const requiredNumber = {
  44814. type: Number,
  44815. required: true
  44816. };
  44817. const rowKey = {
  44818. type: definePropType([String, Number, Symbol]),
  44819. default: "id"
  44820. };
  44821. const styleType = {
  44822. type: definePropType(Object)
  44823. };
  44824. const tableV2RowProps = buildProps({
  44825. class: String,
  44826. columns,
  44827. columnsStyles: {
  44828. type: definePropType(Object),
  44829. required: true
  44830. },
  44831. depth: Number,
  44832. expandColumnKey,
  44833. estimatedRowHeight: {
  44834. ...virtualizedGridProps.estimatedRowHeight,
  44835. default: void 0
  44836. },
  44837. isScrolling: Boolean,
  44838. onRowExpand: {
  44839. type: definePropType(Function)
  44840. },
  44841. onRowHover: {
  44842. type: definePropType(Function)
  44843. },
  44844. onRowHeightChange: {
  44845. type: definePropType(Function)
  44846. },
  44847. rowData: {
  44848. type: definePropType(Object),
  44849. required: true
  44850. },
  44851. rowEventHandlers: {
  44852. type: definePropType(Object)
  44853. },
  44854. rowIndex: {
  44855. type: Number,
  44856. required: true
  44857. },
  44858. rowKey,
  44859. style: {
  44860. type: definePropType(Object)
  44861. }
  44862. });
  44863. const requiredNumberType = {
  44864. type: Number,
  44865. required: true
  44866. };
  44867. const tableV2HeaderProps = buildProps({
  44868. class: String,
  44869. columns,
  44870. fixedHeaderData: {
  44871. type: definePropType(Array)
  44872. },
  44873. headerData: {
  44874. type: definePropType(Array),
  44875. required: true
  44876. },
  44877. headerHeight: {
  44878. type: definePropType([Number, Array]),
  44879. default: 50
  44880. },
  44881. rowWidth: requiredNumberType,
  44882. rowHeight: {
  44883. type: Number,
  44884. default: 50
  44885. },
  44886. height: requiredNumberType,
  44887. width: requiredNumberType
  44888. });
  44889. const tableV2GridProps = buildProps({
  44890. columns,
  44891. data: dataType,
  44892. fixedData: fixedDataType,
  44893. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  44894. width: requiredNumber,
  44895. height: requiredNumber,
  44896. headerWidth: requiredNumber,
  44897. headerHeight: tableV2HeaderProps.headerHeight,
  44898. bodyWidth: requiredNumber,
  44899. rowHeight: requiredNumber,
  44900. cache: virtualizedListProps.cache,
  44901. useIsScrolling: Boolean,
  44902. scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
  44903. scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
  44904. scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
  44905. class: classType,
  44906. style: styleType,
  44907. containerStyle: styleType,
  44908. getRowHeight: {
  44909. type: definePropType(Function),
  44910. required: true
  44911. },
  44912. rowKey: tableV2RowProps.rowKey,
  44913. onRowsRendered: {
  44914. type: definePropType(Function)
  44915. },
  44916. onScroll: {
  44917. type: definePropType(Function)
  44918. }
  44919. });
  44920. const tableV2Props = buildProps({
  44921. cache: tableV2GridProps.cache,
  44922. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  44923. rowKey,
  44924. headerClass: {
  44925. type: definePropType([
  44926. String,
  44927. Function
  44928. ])
  44929. },
  44930. headerProps: {
  44931. type: definePropType([
  44932. Object,
  44933. Function
  44934. ])
  44935. },
  44936. headerCellProps: {
  44937. type: definePropType([
  44938. Object,
  44939. Function
  44940. ])
  44941. },
  44942. headerHeight: tableV2HeaderProps.headerHeight,
  44943. footerHeight: {
  44944. type: Number,
  44945. default: 0
  44946. },
  44947. rowClass: {
  44948. type: definePropType([String, Function])
  44949. },
  44950. rowProps: {
  44951. type: definePropType([Object, Function])
  44952. },
  44953. rowHeight: {
  44954. type: Number,
  44955. default: 50
  44956. },
  44957. cellProps: {
  44958. type: definePropType([
  44959. Object,
  44960. Function
  44961. ])
  44962. },
  44963. columns,
  44964. data: dataType,
  44965. dataGetter: {
  44966. type: definePropType(Function)
  44967. },
  44968. fixedData: fixedDataType,
  44969. expandColumnKey: tableV2RowProps.expandColumnKey,
  44970. expandedRowKeys: expandKeys,
  44971. defaultExpandedRowKeys: expandKeys,
  44972. class: classType,
  44973. fixed: Boolean,
  44974. style: {
  44975. type: definePropType(Object)
  44976. },
  44977. width: requiredNumber,
  44978. height: requiredNumber,
  44979. maxHeight: Number,
  44980. useIsScrolling: Boolean,
  44981. indentSize: {
  44982. type: Number,
  44983. default: 12
  44984. },
  44985. iconSize: {
  44986. type: Number,
  44987. default: 12
  44988. },
  44989. hScrollbarSize: virtualizedGridProps.hScrollbarSize,
  44990. vScrollbarSize: virtualizedGridProps.vScrollbarSize,
  44991. scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,
  44992. sortBy: {
  44993. type: definePropType(Object),
  44994. default: () => ({})
  44995. },
  44996. sortState: {
  44997. type: definePropType(Object),
  44998. default: void 0
  44999. },
  45000. onColumnSort: {
  45001. type: definePropType(Function)
  45002. },
  45003. onExpandedRowsChange: {
  45004. type: definePropType(Function)
  45005. },
  45006. onEndReached: {
  45007. type: definePropType(Function)
  45008. },
  45009. onRowExpand: tableV2RowProps.onRowExpand,
  45010. onScroll: tableV2GridProps.onScroll,
  45011. onRowsRendered: tableV2GridProps.onRowsRendered,
  45012. rowEventHandlers: tableV2RowProps.rowEventHandlers
  45013. });
  45014. const TableV2Cell = (props, {
  45015. slots
  45016. }) => {
  45017. var _a;
  45018. const {
  45019. cellData,
  45020. style
  45021. } = props;
  45022. const displayText = ((_a = cellData == null ? void 0 : cellData.toString) == null ? void 0 : _a.call(cellData)) || "";
  45023. return vue.createVNode("div", {
  45024. "class": props.class,
  45025. "title": displayText,
  45026. "style": style
  45027. }, [slots.default ? slots.default(props) : displayText]);
  45028. };
  45029. TableV2Cell.displayName = "ElTableV2Cell";
  45030. TableV2Cell.inheritAttrs = false;
  45031. var TableCell = TableV2Cell;
  45032. const HeaderCell = (props, {
  45033. slots
  45034. }) => {
  45035. var _a, _b;
  45036. return slots.default ? slots.default(props) : vue.createVNode("div", {
  45037. "class": props.class,
  45038. "title": (_a = props.column) == null ? void 0 : _a.title
  45039. }, [(_b = props.column) == null ? void 0 : _b.title]);
  45040. };
  45041. HeaderCell.displayName = "ElTableV2HeaderCell";
  45042. HeaderCell.inheritAttrs = false;
  45043. var HeaderCell$1 = HeaderCell;
  45044. const tableV2HeaderRowProps = buildProps({
  45045. class: String,
  45046. columns,
  45047. columnsStyles: {
  45048. type: definePropType(Object),
  45049. required: true
  45050. },
  45051. headerIndex: Number,
  45052. style: { type: definePropType(Object) }
  45053. });
  45054. const TableV2HeaderRow = vue.defineComponent({
  45055. name: "ElTableV2HeaderRow",
  45056. props: tableV2HeaderRowProps,
  45057. setup(props, {
  45058. slots
  45059. }) {
  45060. return () => {
  45061. const {
  45062. columns,
  45063. columnsStyles,
  45064. headerIndex,
  45065. style
  45066. } = props;
  45067. let Cells = columns.map((column, columnIndex) => {
  45068. return slots.cell({
  45069. columns,
  45070. column,
  45071. columnIndex,
  45072. headerIndex,
  45073. style: columnsStyles[column.key]
  45074. });
  45075. });
  45076. if (slots.header) {
  45077. Cells = slots.header({
  45078. cells: Cells.map((node) => {
  45079. if (isArray(node) && node.length === 1) {
  45080. return node[0];
  45081. }
  45082. return node;
  45083. }),
  45084. columns,
  45085. headerIndex
  45086. });
  45087. }
  45088. return vue.createVNode("div", {
  45089. "class": props.class,
  45090. "style": style
  45091. }, [Cells]);
  45092. };
  45093. }
  45094. });
  45095. var HeaderRow = TableV2HeaderRow;
  45096. const COMPONENT_NAME$7 = "ElTableV2Header";
  45097. const TableV2Header = vue.defineComponent({
  45098. name: COMPONENT_NAME$7,
  45099. props: tableV2HeaderProps,
  45100. setup(props, {
  45101. slots,
  45102. expose
  45103. }) {
  45104. const ns = useNamespace("table-v2");
  45105. const headerRef = vue.ref();
  45106. const headerStyle = vue.computed(() => enforceUnit({
  45107. width: props.width,
  45108. height: props.height
  45109. }));
  45110. const rowStyle = vue.computed(() => enforceUnit({
  45111. width: props.rowWidth,
  45112. height: props.height
  45113. }));
  45114. const headerHeights = vue.computed(() => castArray$1(vue.unref(props.headerHeight)));
  45115. const scrollToLeft = (left) => {
  45116. const headerEl = vue.unref(headerRef);
  45117. vue.nextTick(() => {
  45118. (headerEl == null ? void 0 : headerEl.scroll) && headerEl.scroll({
  45119. left
  45120. });
  45121. });
  45122. };
  45123. const renderFixedRows = () => {
  45124. const fixedRowClassName = ns.e("fixed-header-row");
  45125. const {
  45126. columns,
  45127. fixedHeaderData,
  45128. rowHeight
  45129. } = props;
  45130. return fixedHeaderData == null ? void 0 : fixedHeaderData.map((fixedRowData, fixedRowIndex) => {
  45131. var _a;
  45132. const style = enforceUnit({
  45133. height: rowHeight,
  45134. width: "100%"
  45135. });
  45136. return (_a = slots.fixed) == null ? void 0 : _a.call(slots, {
  45137. class: fixedRowClassName,
  45138. columns,
  45139. rowData: fixedRowData,
  45140. rowIndex: -(fixedRowIndex + 1),
  45141. style
  45142. });
  45143. });
  45144. };
  45145. const renderDynamicRows = () => {
  45146. const dynamicRowClassName = ns.e("dynamic-header-row");
  45147. const {
  45148. columns
  45149. } = props;
  45150. return vue.unref(headerHeights).map((rowHeight, rowIndex) => {
  45151. var _a;
  45152. const style = enforceUnit({
  45153. width: "100%",
  45154. height: rowHeight
  45155. });
  45156. return (_a = slots.dynamic) == null ? void 0 : _a.call(slots, {
  45157. class: dynamicRowClassName,
  45158. columns,
  45159. headerIndex: rowIndex,
  45160. style
  45161. });
  45162. });
  45163. };
  45164. expose({
  45165. scrollToLeft
  45166. });
  45167. return () => {
  45168. if (props.height <= 0)
  45169. return;
  45170. return vue.createVNode("div", {
  45171. "ref": headerRef,
  45172. "class": props.class,
  45173. "style": vue.unref(headerStyle)
  45174. }, [vue.createVNode("div", {
  45175. "style": vue.unref(rowStyle),
  45176. "class": ns.e("header")
  45177. }, [renderDynamicRows(), renderFixedRows()])]);
  45178. };
  45179. }
  45180. });
  45181. var Header = TableV2Header;
  45182. const useTableRow = (props) => {
  45183. const {
  45184. isScrolling
  45185. } = vue.inject(TableV2InjectionKey);
  45186. const measured = vue.ref(false);
  45187. const rowRef = vue.ref();
  45188. const measurable = vue.computed(() => {
  45189. return isNumber(props.estimatedRowHeight) && props.rowIndex >= 0;
  45190. });
  45191. const doMeasure = (isInit = false) => {
  45192. const $rowRef = vue.unref(rowRef);
  45193. if (!$rowRef)
  45194. return;
  45195. const {
  45196. columns,
  45197. onRowHeightChange,
  45198. rowKey,
  45199. rowIndex,
  45200. style
  45201. } = props;
  45202. const {
  45203. height
  45204. } = $rowRef.getBoundingClientRect();
  45205. measured.value = true;
  45206. vue.nextTick(() => {
  45207. if (isInit || height !== Number.parseInt(style.height)) {
  45208. const firstColumn = columns[0];
  45209. const isPlaceholder = (firstColumn == null ? void 0 : firstColumn.placeholderSign) === placeholderSign;
  45210. onRowHeightChange == null ? void 0 : onRowHeightChange({
  45211. rowKey,
  45212. height,
  45213. rowIndex
  45214. }, firstColumn && !isPlaceholder && firstColumn.fixed);
  45215. }
  45216. });
  45217. };
  45218. const eventHandlers = vue.computed(() => {
  45219. const {
  45220. rowData,
  45221. rowIndex,
  45222. rowKey,
  45223. onRowHover
  45224. } = props;
  45225. const handlers = props.rowEventHandlers || {};
  45226. const eventHandlers2 = {};
  45227. Object.entries(handlers).forEach(([eventName, handler]) => {
  45228. if (isFunction(handler)) {
  45229. eventHandlers2[eventName] = (event) => {
  45230. handler({
  45231. event,
  45232. rowData,
  45233. rowIndex,
  45234. rowKey
  45235. });
  45236. };
  45237. }
  45238. });
  45239. if (onRowHover) {
  45240. [{
  45241. name: "onMouseleave",
  45242. hovered: false
  45243. }, {
  45244. name: "onMouseenter",
  45245. hovered: true
  45246. }].forEach(({
  45247. name,
  45248. hovered
  45249. }) => {
  45250. const existedHandler = eventHandlers2[name];
  45251. eventHandlers2[name] = (event) => {
  45252. onRowHover({
  45253. event,
  45254. hovered,
  45255. rowData,
  45256. rowIndex,
  45257. rowKey
  45258. });
  45259. existedHandler == null ? void 0 : existedHandler(event);
  45260. };
  45261. });
  45262. }
  45263. return eventHandlers2;
  45264. });
  45265. const onExpand = (expanded) => {
  45266. const {
  45267. onRowExpand,
  45268. rowData,
  45269. rowIndex,
  45270. rowKey
  45271. } = props;
  45272. onRowExpand == null ? void 0 : onRowExpand({
  45273. expanded,
  45274. rowData,
  45275. rowIndex,
  45276. rowKey
  45277. });
  45278. };
  45279. vue.onMounted(() => {
  45280. if (vue.unref(measurable)) {
  45281. doMeasure(true);
  45282. }
  45283. });
  45284. return {
  45285. isScrolling,
  45286. measurable,
  45287. measured,
  45288. rowRef,
  45289. eventHandlers,
  45290. onExpand
  45291. };
  45292. };
  45293. const COMPONENT_NAME$6 = "ElTableV2TableRow";
  45294. const TableV2Row = vue.defineComponent({
  45295. name: COMPONENT_NAME$6,
  45296. props: tableV2RowProps,
  45297. setup(props, {
  45298. expose,
  45299. slots,
  45300. attrs
  45301. }) {
  45302. const {
  45303. eventHandlers,
  45304. isScrolling,
  45305. measurable,
  45306. measured,
  45307. rowRef,
  45308. onExpand
  45309. } = useTableRow(props);
  45310. expose({
  45311. onExpand
  45312. });
  45313. return () => {
  45314. const {
  45315. columns,
  45316. columnsStyles,
  45317. expandColumnKey,
  45318. depth,
  45319. rowData,
  45320. rowIndex,
  45321. style
  45322. } = props;
  45323. let ColumnCells = columns.map((column, columnIndex) => {
  45324. const expandable = isArray(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey;
  45325. return slots.cell({
  45326. column,
  45327. columns,
  45328. columnIndex,
  45329. depth,
  45330. style: columnsStyles[column.key],
  45331. rowData,
  45332. rowIndex,
  45333. isScrolling: vue.unref(isScrolling),
  45334. expandIconProps: expandable ? {
  45335. rowData,
  45336. rowIndex,
  45337. onExpand
  45338. } : void 0
  45339. });
  45340. });
  45341. if (slots.row) {
  45342. ColumnCells = slots.row({
  45343. cells: ColumnCells.map((node) => {
  45344. if (isArray(node) && node.length === 1) {
  45345. return node[0];
  45346. }
  45347. return node;
  45348. }),
  45349. style,
  45350. columns,
  45351. depth,
  45352. rowData,
  45353. rowIndex,
  45354. isScrolling: vue.unref(isScrolling)
  45355. });
  45356. }
  45357. if (vue.unref(measurable)) {
  45358. const {
  45359. height,
  45360. ...exceptHeightStyle
  45361. } = style || {};
  45362. const _measured = vue.unref(measured);
  45363. return vue.createVNode("div", vue.mergeProps({
  45364. "ref": rowRef,
  45365. "class": props.class,
  45366. "style": _measured ? style : exceptHeightStyle
  45367. }, attrs, vue.unref(eventHandlers)), [ColumnCells]);
  45368. }
  45369. return vue.createVNode("div", vue.mergeProps(attrs, {
  45370. "ref": rowRef,
  45371. "class": props.class,
  45372. "style": style
  45373. }, vue.unref(eventHandlers)), [ColumnCells]);
  45374. };
  45375. }
  45376. });
  45377. var Row = TableV2Row;
  45378. const SortIcon = (props) => {
  45379. const {
  45380. sortOrder
  45381. } = props;
  45382. return vue.createVNode(ElIcon, {
  45383. "size": 14,
  45384. "class": props.class
  45385. }, {
  45386. default: () => [sortOrder === SortOrder.ASC ? vue.createVNode(sort_up_default, null, null) : vue.createVNode(sort_down_default, null, null)]
  45387. });
  45388. };
  45389. var SortIcon$1 = SortIcon;
  45390. const ExpandIcon = (props) => {
  45391. const {
  45392. expanded,
  45393. expandable,
  45394. onExpand,
  45395. style,
  45396. size
  45397. } = props;
  45398. const expandIconProps = {
  45399. onClick: expandable ? () => onExpand(!expanded) : void 0,
  45400. class: props.class
  45401. };
  45402. return vue.createVNode(ElIcon, vue.mergeProps(expandIconProps, {
  45403. "size": size,
  45404. "style": style
  45405. }), {
  45406. default: () => [vue.createVNode(arrow_right_default, null, null)]
  45407. });
  45408. };
  45409. var ExpandIcon$1 = ExpandIcon;
  45410. const COMPONENT_NAME$5 = "ElTableV2Grid";
  45411. const useTableGrid = (props) => {
  45412. const headerRef = vue.ref();
  45413. const bodyRef = vue.ref();
  45414. const totalHeight = vue.computed(() => {
  45415. const {
  45416. data,
  45417. rowHeight,
  45418. estimatedRowHeight
  45419. } = props;
  45420. if (estimatedRowHeight) {
  45421. return;
  45422. }
  45423. return data.length * rowHeight;
  45424. });
  45425. const fixedRowHeight = vue.computed(() => {
  45426. const {
  45427. fixedData,
  45428. rowHeight
  45429. } = props;
  45430. return ((fixedData == null ? void 0 : fixedData.length) || 0) * rowHeight;
  45431. });
  45432. const headerHeight = vue.computed(() => sum(props.headerHeight));
  45433. const gridHeight = vue.computed(() => {
  45434. const {
  45435. height
  45436. } = props;
  45437. return Math.max(0, height - vue.unref(headerHeight) - vue.unref(fixedRowHeight));
  45438. });
  45439. const hasHeader = vue.computed(() => {
  45440. return vue.unref(headerHeight) + vue.unref(fixedRowHeight) > 0;
  45441. });
  45442. const itemKey = ({
  45443. data,
  45444. rowIndex
  45445. }) => data[rowIndex][props.rowKey];
  45446. function onItemRendered({
  45447. rowCacheStart,
  45448. rowCacheEnd,
  45449. rowVisibleStart,
  45450. rowVisibleEnd
  45451. }) {
  45452. var _a;
  45453. (_a = props.onRowsRendered) == null ? void 0 : _a.call(props, {
  45454. rowCacheStart,
  45455. rowCacheEnd,
  45456. rowVisibleStart,
  45457. rowVisibleEnd
  45458. });
  45459. }
  45460. function resetAfterRowIndex(index, forceUpdate2) {
  45461. var _a;
  45462. (_a = bodyRef.value) == null ? void 0 : _a.resetAfterRowIndex(index, forceUpdate2);
  45463. }
  45464. function scrollTo(leftOrOptions, top) {
  45465. const header$ = vue.unref(headerRef);
  45466. const body$ = vue.unref(bodyRef);
  45467. if (!header$ || !body$)
  45468. return;
  45469. if (isObject$1(leftOrOptions)) {
  45470. header$.scrollToLeft(leftOrOptions.scrollLeft);
  45471. body$.scrollTo(leftOrOptions);
  45472. } else {
  45473. header$.scrollToLeft(leftOrOptions);
  45474. body$.scrollTo({
  45475. scrollLeft: leftOrOptions,
  45476. scrollTop: top
  45477. });
  45478. }
  45479. }
  45480. function scrollToTop(scrollTop) {
  45481. var _a;
  45482. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollTo({
  45483. scrollTop
  45484. });
  45485. }
  45486. function scrollToRow(row, strategy) {
  45487. var _a;
  45488. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.scrollToItem(row, 1, strategy);
  45489. }
  45490. function forceUpdate() {
  45491. var _a, _b;
  45492. (_a = vue.unref(bodyRef)) == null ? void 0 : _a.$forceUpdate();
  45493. (_b = vue.unref(headerRef)) == null ? void 0 : _b.$forceUpdate();
  45494. }
  45495. return {
  45496. bodyRef,
  45497. forceUpdate,
  45498. fixedRowHeight,
  45499. gridHeight,
  45500. hasHeader,
  45501. headerHeight,
  45502. headerRef,
  45503. totalHeight,
  45504. itemKey,
  45505. onItemRendered,
  45506. resetAfterRowIndex,
  45507. scrollTo,
  45508. scrollToTop,
  45509. scrollToRow
  45510. };
  45511. };
  45512. const TableGrid = vue.defineComponent({
  45513. name: COMPONENT_NAME$5,
  45514. props: tableV2GridProps,
  45515. setup(props, {
  45516. slots,
  45517. expose
  45518. }) {
  45519. const {
  45520. ns
  45521. } = vue.inject(TableV2InjectionKey);
  45522. const {
  45523. bodyRef,
  45524. fixedRowHeight,
  45525. gridHeight,
  45526. hasHeader,
  45527. headerRef,
  45528. headerHeight,
  45529. totalHeight,
  45530. forceUpdate,
  45531. itemKey,
  45532. onItemRendered,
  45533. resetAfterRowIndex,
  45534. scrollTo,
  45535. scrollToTop,
  45536. scrollToRow
  45537. } = useTableGrid(props);
  45538. expose({
  45539. forceUpdate,
  45540. totalHeight,
  45541. scrollTo,
  45542. scrollToTop,
  45543. scrollToRow,
  45544. resetAfterRowIndex
  45545. });
  45546. const getColumnWidth = () => props.bodyWidth;
  45547. return () => {
  45548. const {
  45549. cache,
  45550. columns,
  45551. data,
  45552. fixedData,
  45553. useIsScrolling,
  45554. scrollbarAlwaysOn,
  45555. scrollbarEndGap,
  45556. scrollbarStartGap,
  45557. style,
  45558. rowHeight,
  45559. bodyWidth,
  45560. estimatedRowHeight,
  45561. headerWidth,
  45562. height,
  45563. width,
  45564. getRowHeight,
  45565. onScroll
  45566. } = props;
  45567. const isDynamicRowEnabled = isNumber(estimatedRowHeight);
  45568. const Grid = isDynamicRowEnabled ? DynamicSizeGrid$1 : FixedSizeGrid$1;
  45569. const _headerHeight = vue.unref(headerHeight);
  45570. return vue.createVNode("div", {
  45571. "role": "table",
  45572. "class": [ns.e("table"), props.class],
  45573. "style": style
  45574. }, [vue.createVNode(Grid, {
  45575. "ref": bodyRef,
  45576. "data": data,
  45577. "useIsScrolling": useIsScrolling,
  45578. "itemKey": itemKey,
  45579. "columnCache": 0,
  45580. "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth,
  45581. "totalColumn": 1,
  45582. "totalRow": data.length,
  45583. "rowCache": cache,
  45584. "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight,
  45585. "width": width,
  45586. "height": vue.unref(gridHeight),
  45587. "class": ns.e("body"),
  45588. "scrollbarStartGap": scrollbarStartGap,
  45589. "scrollbarEndGap": scrollbarEndGap,
  45590. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  45591. "onScroll": onScroll,
  45592. "onItemRendered": onItemRendered,
  45593. "perfMode": false
  45594. }, {
  45595. default: (params) => {
  45596. var _a;
  45597. const rowData = data[params.rowIndex];
  45598. return (_a = slots.row) == null ? void 0 : _a.call(slots, {
  45599. ...params,
  45600. columns,
  45601. rowData
  45602. });
  45603. }
  45604. }), vue.unref(hasHeader) && vue.createVNode(Header, {
  45605. "ref": headerRef,
  45606. "class": ns.e("header-wrapper"),
  45607. "columns": columns,
  45608. "headerData": data,
  45609. "headerHeight": props.headerHeight,
  45610. "fixedHeaderData": fixedData,
  45611. "rowWidth": headerWidth,
  45612. "rowHeight": rowHeight,
  45613. "width": width,
  45614. "height": Math.min(_headerHeight + vue.unref(fixedRowHeight), height)
  45615. }, {
  45616. dynamic: slots.header,
  45617. fixed: slots.row
  45618. })]);
  45619. };
  45620. }
  45621. });
  45622. function _isSlot$5(s) {
  45623. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  45624. }
  45625. const MainTable = (props, {
  45626. slots
  45627. }) => {
  45628. const {
  45629. mainTableRef,
  45630. ...rest
  45631. } = props;
  45632. return vue.createVNode(TableGrid, vue.mergeProps({
  45633. "ref": mainTableRef
  45634. }, rest), _isSlot$5(slots) ? slots : {
  45635. default: () => [slots]
  45636. });
  45637. };
  45638. function _isSlot$4(s) {
  45639. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  45640. }
  45641. const LeftTable$1 = (props, {
  45642. slots
  45643. }) => {
  45644. if (!props.columns.length)
  45645. return;
  45646. const {
  45647. leftTableRef,
  45648. ...rest
  45649. } = props;
  45650. return vue.createVNode(TableGrid, vue.mergeProps({
  45651. "ref": leftTableRef
  45652. }, rest), _isSlot$4(slots) ? slots : {
  45653. default: () => [slots]
  45654. });
  45655. };
  45656. function _isSlot$3(s) {
  45657. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  45658. }
  45659. const LeftTable = (props, {
  45660. slots
  45661. }) => {
  45662. if (!props.columns.length)
  45663. return;
  45664. const {
  45665. rightTableRef,
  45666. ...rest
  45667. } = props;
  45668. return vue.createVNode(TableGrid, vue.mergeProps({
  45669. "ref": rightTableRef
  45670. }, rest), _isSlot$3(slots) ? slots : {
  45671. default: () => [slots]
  45672. });
  45673. };
  45674. function _isSlot$2(s) {
  45675. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  45676. }
  45677. const RowRenderer = (props, {
  45678. slots
  45679. }) => {
  45680. const {
  45681. columns,
  45682. columnsStyles,
  45683. depthMap,
  45684. expandColumnKey,
  45685. expandedRowKeys,
  45686. estimatedRowHeight,
  45687. hasFixedColumns,
  45688. hoveringRowKey,
  45689. rowData,
  45690. rowIndex,
  45691. style,
  45692. isScrolling,
  45693. rowProps,
  45694. rowClass,
  45695. rowKey,
  45696. rowEventHandlers,
  45697. ns,
  45698. onRowHovered,
  45699. onRowExpanded
  45700. } = props;
  45701. const rowKls = tryCall(rowClass, {
  45702. columns,
  45703. rowData,
  45704. rowIndex
  45705. }, "");
  45706. const additionalProps = tryCall(rowProps, {
  45707. columns,
  45708. rowData,
  45709. rowIndex
  45710. });
  45711. const _rowKey = rowData[rowKey];
  45712. const depth = depthMap[_rowKey] || 0;
  45713. const canExpand = Boolean(expandColumnKey);
  45714. const isFixedRow = rowIndex < 0;
  45715. const kls = [ns.e("row"), rowKls, {
  45716. [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0,
  45717. [ns.is("expanded")]: canExpand && expandedRowKeys.includes(_rowKey),
  45718. [ns.is("hovered")]: !isScrolling && _rowKey === hoveringRowKey,
  45719. [ns.is("fixed")]: !depth && isFixedRow,
  45720. [ns.is("customized")]: Boolean(slots.row)
  45721. }];
  45722. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  45723. const _rowProps = {
  45724. ...additionalProps,
  45725. columns,
  45726. columnsStyles,
  45727. class: kls,
  45728. depth,
  45729. expandColumnKey,
  45730. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  45731. isScrolling,
  45732. rowIndex,
  45733. rowData,
  45734. rowKey: _rowKey,
  45735. rowEventHandlers,
  45736. style
  45737. };
  45738. return vue.createVNode(Row, vue.mergeProps(_rowProps, {
  45739. "onRowHover": onRowHover,
  45740. "onRowExpand": onRowExpanded
  45741. }), _isSlot$2(slots) ? slots : {
  45742. default: () => [slots]
  45743. });
  45744. };
  45745. const CellRenderer = ({
  45746. columns,
  45747. column,
  45748. columnIndex,
  45749. depth,
  45750. expandIconProps,
  45751. isScrolling,
  45752. rowData,
  45753. rowIndex,
  45754. style,
  45755. expandedRowKeys,
  45756. ns,
  45757. cellProps: _cellProps,
  45758. expandColumnKey,
  45759. indentSize,
  45760. iconSize,
  45761. rowKey
  45762. }, {
  45763. slots
  45764. }) => {
  45765. const cellStyle = enforceUnit(style);
  45766. if (column.placeholderSign === placeholderSign) {
  45767. return vue.createVNode("div", {
  45768. "class": ns.em("row-cell", "placeholder"),
  45769. "style": cellStyle
  45770. }, null);
  45771. }
  45772. const {
  45773. cellRenderer,
  45774. dataKey,
  45775. dataGetter
  45776. } = column;
  45777. const columnCellRenderer = componentToSlot(cellRenderer);
  45778. const CellComponent = columnCellRenderer || slots.default || ((props) => vue.createVNode(TableCell, props, null));
  45779. const cellData = isFunction(dataGetter) ? dataGetter({
  45780. columns,
  45781. column,
  45782. columnIndex,
  45783. rowData,
  45784. rowIndex
  45785. }) : get(rowData, dataKey != null ? dataKey : "");
  45786. const extraCellProps = tryCall(_cellProps, {
  45787. cellData,
  45788. columns,
  45789. column,
  45790. columnIndex,
  45791. rowIndex,
  45792. rowData
  45793. });
  45794. const cellProps = {
  45795. class: ns.e("cell-text"),
  45796. columns,
  45797. column,
  45798. columnIndex,
  45799. cellData,
  45800. isScrolling,
  45801. rowData,
  45802. rowIndex
  45803. };
  45804. const Cell = CellComponent(cellProps);
  45805. const kls = [ns.e("row-cell"), column.align === Alignment.CENTER && ns.is("align-center"), column.align === Alignment.RIGHT && ns.is("align-right")];
  45806. const expandable = rowIndex >= 0 && column.key === expandColumnKey;
  45807. const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]);
  45808. let IconOrPlaceholder;
  45809. const iconStyle = `margin-inline-start: ${depth * indentSize}px;`;
  45810. if (expandable) {
  45811. if (isObject$1(expandIconProps)) {
  45812. IconOrPlaceholder = vue.createVNode(ExpandIcon$1, vue.mergeProps(expandIconProps, {
  45813. "class": [ns.e("expand-icon"), ns.is("expanded", expanded)],
  45814. "size": iconSize,
  45815. "expanded": expanded,
  45816. "style": iconStyle,
  45817. "expandable": true
  45818. }), null);
  45819. } else {
  45820. IconOrPlaceholder = vue.createVNode("div", {
  45821. "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ")
  45822. }, null);
  45823. }
  45824. }
  45825. return vue.createVNode("div", vue.mergeProps({
  45826. "class": kls,
  45827. "style": cellStyle
  45828. }, extraCellProps), [IconOrPlaceholder, Cell]);
  45829. };
  45830. CellRenderer.inheritAttrs = false;
  45831. function _isSlot$1(s) {
  45832. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  45833. }
  45834. const HeaderRenderer = ({
  45835. columns,
  45836. columnsStyles,
  45837. headerIndex,
  45838. style,
  45839. headerClass,
  45840. headerProps,
  45841. ns
  45842. }, {
  45843. slots
  45844. }) => {
  45845. const param = {
  45846. columns,
  45847. headerIndex
  45848. };
  45849. const kls = [ns.e("header-row"), tryCall(headerClass, param, ""), {
  45850. [ns.is("customized")]: Boolean(slots.header)
  45851. }];
  45852. const extraProps = {
  45853. ...tryCall(headerProps, param),
  45854. columnsStyles,
  45855. class: kls,
  45856. columns,
  45857. headerIndex,
  45858. style
  45859. };
  45860. return vue.createVNode(HeaderRow, extraProps, _isSlot$1(slots) ? slots : {
  45861. default: () => [slots]
  45862. });
  45863. };
  45864. const HeaderCellRenderer = (props, {
  45865. slots
  45866. }) => {
  45867. const {
  45868. column,
  45869. ns,
  45870. style,
  45871. onColumnSorted
  45872. } = props;
  45873. const cellStyle = enforceUnit(style);
  45874. if (column.placeholderSign === placeholderSign) {
  45875. return vue.createVNode("div", {
  45876. "class": ns.em("header-row-cell", "placeholder"),
  45877. "style": cellStyle
  45878. }, null);
  45879. }
  45880. const {
  45881. headerCellRenderer,
  45882. headerClass,
  45883. sortable
  45884. } = column;
  45885. const cellProps = {
  45886. ...props,
  45887. class: ns.e("header-cell-text")
  45888. };
  45889. const cellRenderer = componentToSlot(headerCellRenderer) || slots.default || ((props2) => vue.createVNode(HeaderCell$1, props2, null));
  45890. const Cell = cellRenderer(cellProps);
  45891. const {
  45892. sortBy,
  45893. sortState,
  45894. headerCellProps
  45895. } = props;
  45896. let sorting, sortOrder;
  45897. if (sortState) {
  45898. const order = sortState[column.key];
  45899. sorting = Boolean(oppositeOrderMap[order]);
  45900. sortOrder = sorting ? order : SortOrder.ASC;
  45901. } else {
  45902. sorting = column.key === sortBy.key;
  45903. sortOrder = sorting ? sortBy.order : SortOrder.ASC;
  45904. }
  45905. 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")];
  45906. const cellWrapperProps = {
  45907. ...tryCall(headerCellProps, props),
  45908. onClick: column.sortable ? onColumnSorted : void 0,
  45909. class: cellKls,
  45910. style: cellStyle,
  45911. ["data-key"]: column.key
  45912. };
  45913. return vue.createVNode("div", cellWrapperProps, [Cell, sortable && vue.createVNode(SortIcon$1, {
  45914. "class": [ns.e("sort-icon"), sorting && ns.is("sorting")],
  45915. "sortOrder": sortOrder
  45916. }, null)]);
  45917. };
  45918. const Footer$1 = (props, {
  45919. slots
  45920. }) => {
  45921. var _a;
  45922. return vue.createVNode("div", {
  45923. "class": props.class,
  45924. "style": props.style
  45925. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  45926. };
  45927. Footer$1.displayName = "ElTableV2Footer";
  45928. const Footer = (props, {
  45929. slots
  45930. }) => {
  45931. return vue.createVNode("div", {
  45932. "class": props.class,
  45933. "style": props.style
  45934. }, [slots.default ? slots.default() : vue.createVNode(ElEmpty, null, null)]);
  45935. };
  45936. Footer.displayName = "ElTableV2Empty";
  45937. const Overlay = (props, {
  45938. slots
  45939. }) => {
  45940. var _a;
  45941. return vue.createVNode("div", {
  45942. "class": props.class,
  45943. "style": props.style
  45944. }, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
  45945. };
  45946. Overlay.displayName = "ElTableV2Overlay";
  45947. function _isSlot(s) {
  45948. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  45949. }
  45950. const COMPONENT_NAME$4 = "ElTableV2";
  45951. const TableV2 = vue.defineComponent({
  45952. name: COMPONENT_NAME$4,
  45953. props: tableV2Props,
  45954. setup(props, {
  45955. slots,
  45956. expose
  45957. }) {
  45958. const ns = useNamespace("table-v2");
  45959. const {
  45960. columnsStyles,
  45961. fixedColumnsOnLeft,
  45962. fixedColumnsOnRight,
  45963. mainColumns,
  45964. mainTableHeight,
  45965. fixedTableHeight,
  45966. leftTableWidth,
  45967. rightTableWidth,
  45968. data,
  45969. depthMap,
  45970. expandedRowKeys,
  45971. hasFixedColumns,
  45972. hoveringRowKey,
  45973. mainTableRef,
  45974. leftTableRef,
  45975. rightTableRef,
  45976. isDynamic,
  45977. isResetting,
  45978. isScrolling,
  45979. bodyWidth,
  45980. emptyStyle,
  45981. rootStyle,
  45982. headerWidth,
  45983. footerHeight,
  45984. showEmpty,
  45985. scrollTo,
  45986. scrollToLeft,
  45987. scrollToTop,
  45988. scrollToRow,
  45989. getRowHeight,
  45990. onColumnSorted,
  45991. onRowHeightChange,
  45992. onRowHovered,
  45993. onRowExpanded,
  45994. onRowsRendered,
  45995. onScroll,
  45996. onVerticalScroll
  45997. } = useTable(props);
  45998. expose({
  45999. scrollTo,
  46000. scrollToLeft,
  46001. scrollToTop,
  46002. scrollToRow
  46003. });
  46004. vue.provide(TableV2InjectionKey, {
  46005. ns,
  46006. isResetting,
  46007. hoveringRowKey,
  46008. isScrolling
  46009. });
  46010. return () => {
  46011. const {
  46012. cache,
  46013. cellProps,
  46014. estimatedRowHeight,
  46015. expandColumnKey,
  46016. fixedData,
  46017. headerHeight,
  46018. headerClass,
  46019. headerProps,
  46020. headerCellProps,
  46021. sortBy,
  46022. sortState,
  46023. rowHeight,
  46024. rowClass,
  46025. rowEventHandlers,
  46026. rowKey,
  46027. rowProps,
  46028. scrollbarAlwaysOn,
  46029. indentSize,
  46030. iconSize,
  46031. useIsScrolling,
  46032. vScrollbarSize,
  46033. width
  46034. } = props;
  46035. const _data = vue.unref(data);
  46036. const mainTableProps = {
  46037. cache,
  46038. class: ns.e("main"),
  46039. columns: vue.unref(mainColumns),
  46040. data: _data,
  46041. fixedData,
  46042. estimatedRowHeight,
  46043. bodyWidth: vue.unref(bodyWidth),
  46044. headerHeight,
  46045. headerWidth: vue.unref(headerWidth),
  46046. height: vue.unref(mainTableHeight),
  46047. mainTableRef,
  46048. rowKey,
  46049. rowHeight,
  46050. scrollbarAlwaysOn,
  46051. scrollbarStartGap: 2,
  46052. scrollbarEndGap: vScrollbarSize,
  46053. useIsScrolling,
  46054. width,
  46055. getRowHeight,
  46056. onRowsRendered,
  46057. onScroll
  46058. };
  46059. const leftColumnsWidth = vue.unref(leftTableWidth);
  46060. const _fixedTableHeight = vue.unref(fixedTableHeight);
  46061. const leftTableProps = {
  46062. cache,
  46063. class: ns.e("left"),
  46064. columns: vue.unref(fixedColumnsOnLeft),
  46065. data: _data,
  46066. estimatedRowHeight,
  46067. leftTableRef,
  46068. rowHeight,
  46069. bodyWidth: leftColumnsWidth,
  46070. headerWidth: leftColumnsWidth,
  46071. headerHeight,
  46072. height: _fixedTableHeight,
  46073. rowKey,
  46074. scrollbarAlwaysOn,
  46075. scrollbarStartGap: 2,
  46076. scrollbarEndGap: vScrollbarSize,
  46077. useIsScrolling,
  46078. width: leftColumnsWidth,
  46079. getRowHeight,
  46080. onScroll: onVerticalScroll
  46081. };
  46082. const rightColumnsWidth = vue.unref(rightTableWidth);
  46083. const rightColumnsWidthWithScrollbar = rightColumnsWidth + vScrollbarSize;
  46084. const rightTableProps = {
  46085. cache,
  46086. class: ns.e("right"),
  46087. columns: vue.unref(fixedColumnsOnRight),
  46088. data: _data,
  46089. estimatedRowHeight,
  46090. rightTableRef,
  46091. rowHeight,
  46092. bodyWidth: rightColumnsWidthWithScrollbar,
  46093. headerWidth: rightColumnsWidthWithScrollbar,
  46094. headerHeight,
  46095. height: _fixedTableHeight,
  46096. rowKey,
  46097. scrollbarAlwaysOn,
  46098. scrollbarStartGap: 2,
  46099. scrollbarEndGap: vScrollbarSize,
  46100. width: rightColumnsWidthWithScrollbar,
  46101. style: `--${vue.unref(ns.namespace)}-table-scrollbar-size: ${vScrollbarSize}px`,
  46102. useIsScrolling,
  46103. getRowHeight,
  46104. onScroll: onVerticalScroll
  46105. };
  46106. const _columnsStyles = vue.unref(columnsStyles);
  46107. const tableRowProps = {
  46108. ns,
  46109. depthMap: vue.unref(depthMap),
  46110. columnsStyles: _columnsStyles,
  46111. expandColumnKey,
  46112. expandedRowKeys: vue.unref(expandedRowKeys),
  46113. estimatedRowHeight,
  46114. hasFixedColumns: vue.unref(hasFixedColumns),
  46115. hoveringRowKey: vue.unref(hoveringRowKey),
  46116. rowProps,
  46117. rowClass,
  46118. rowKey,
  46119. rowEventHandlers,
  46120. onRowHovered,
  46121. onRowExpanded,
  46122. onRowHeightChange
  46123. };
  46124. const tableCellProps = {
  46125. cellProps,
  46126. expandColumnKey,
  46127. indentSize,
  46128. iconSize,
  46129. rowKey,
  46130. expandedRowKeys: vue.unref(expandedRowKeys),
  46131. ns
  46132. };
  46133. const tableHeaderProps = {
  46134. ns,
  46135. headerClass,
  46136. headerProps,
  46137. columnsStyles: _columnsStyles
  46138. };
  46139. const tableHeaderCellProps = {
  46140. ns,
  46141. sortBy,
  46142. sortState,
  46143. headerCellProps,
  46144. onColumnSorted
  46145. };
  46146. const tableSlots = {
  46147. row: (props2) => vue.createVNode(RowRenderer, vue.mergeProps(props2, tableRowProps), {
  46148. row: slots.row,
  46149. cell: (props3) => {
  46150. let _slot;
  46151. return slots.cell ? vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  46152. "style": _columnsStyles[props3.column.key]
  46153. }), _isSlot(_slot = slots.cell(props3)) ? _slot : {
  46154. default: () => [_slot]
  46155. }) : vue.createVNode(CellRenderer, vue.mergeProps(props3, tableCellProps, {
  46156. "style": _columnsStyles[props3.column.key]
  46157. }), null);
  46158. }
  46159. }),
  46160. header: (props2) => vue.createVNode(HeaderRenderer, vue.mergeProps(props2, tableHeaderProps), {
  46161. header: slots.header,
  46162. cell: (props3) => {
  46163. let _slot2;
  46164. return slots["header-cell"] ? vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  46165. "style": _columnsStyles[props3.column.key]
  46166. }), _isSlot(_slot2 = slots["header-cell"](props3)) ? _slot2 : {
  46167. default: () => [_slot2]
  46168. }) : vue.createVNode(HeaderCellRenderer, vue.mergeProps(props3, tableHeaderCellProps, {
  46169. "style": _columnsStyles[props3.column.key]
  46170. }), null);
  46171. }
  46172. })
  46173. };
  46174. const rootKls = [props.class, ns.b(), ns.e("root"), {
  46175. [ns.is("dynamic")]: vue.unref(isDynamic)
  46176. }];
  46177. const footerProps = {
  46178. class: ns.e("footer"),
  46179. style: vue.unref(footerHeight)
  46180. };
  46181. return vue.createVNode("div", {
  46182. "class": rootKls,
  46183. "style": vue.unref(rootStyle)
  46184. }, [vue.createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : {
  46185. default: () => [tableSlots]
  46186. }), vue.createVNode(LeftTable$1, leftTableProps, _isSlot(tableSlots) ? tableSlots : {
  46187. default: () => [tableSlots]
  46188. }), vue.createVNode(LeftTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : {
  46189. default: () => [tableSlots]
  46190. }), slots.footer && vue.createVNode(Footer$1, footerProps, {
  46191. default: slots.footer
  46192. }), vue.unref(showEmpty) && vue.createVNode(Footer, {
  46193. "class": ns.e("empty"),
  46194. "style": vue.unref(emptyStyle)
  46195. }, {
  46196. default: slots.empty
  46197. }), slots.overlay && vue.createVNode(Overlay, {
  46198. "class": ns.e("overlay")
  46199. }, {
  46200. default: slots.overlay
  46201. })]);
  46202. };
  46203. }
  46204. });
  46205. var TableV2$1 = TableV2;
  46206. const autoResizerProps = buildProps({
  46207. disableWidth: Boolean,
  46208. disableHeight: Boolean,
  46209. onResize: {
  46210. type: definePropType(Function)
  46211. }
  46212. });
  46213. const AutoResizer = vue.defineComponent({
  46214. name: "ElAutoResizer",
  46215. props: autoResizerProps,
  46216. setup(props, {
  46217. slots
  46218. }) {
  46219. const ns = useNamespace("auto-resizer");
  46220. const {
  46221. height,
  46222. width,
  46223. sizer
  46224. } = useAutoResize(props);
  46225. const style = {
  46226. width: "100%",
  46227. height: "100%"
  46228. };
  46229. return () => {
  46230. var _a;
  46231. return vue.createVNode("div", {
  46232. "ref": sizer,
  46233. "class": ns.b(),
  46234. "style": style
  46235. }, [(_a = slots.default) == null ? void 0 : _a.call(slots, {
  46236. height: height.value,
  46237. width: width.value
  46238. })]);
  46239. };
  46240. }
  46241. });
  46242. const ElTableV2 = withInstall(TableV2$1);
  46243. const ElAutoResizer = withInstall(AutoResizer);
  46244. const tabBarProps = buildProps({
  46245. tabs: {
  46246. type: definePropType(Array),
  46247. default: () => mutable([])
  46248. }
  46249. });
  46250. const COMPONENT_NAME$3 = "ElTabBar";
  46251. const __default__$j = vue.defineComponent({
  46252. name: COMPONENT_NAME$3
  46253. });
  46254. const _sfc_main$o = /* @__PURE__ */ vue.defineComponent({
  46255. ...__default__$j,
  46256. props: tabBarProps,
  46257. setup(__props, { expose }) {
  46258. const props = __props;
  46259. const instance = vue.getCurrentInstance();
  46260. const rootTabs = vue.inject(tabsRootContextKey);
  46261. if (!rootTabs)
  46262. throwError(COMPONENT_NAME$3, "<el-tabs><el-tab-bar /></el-tabs>");
  46263. const ns = useNamespace("tabs");
  46264. const barRef = vue.ref();
  46265. const barStyle = vue.ref();
  46266. const getBarStyle = () => {
  46267. let offset = 0;
  46268. let tabSize = 0;
  46269. const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
  46270. const sizeDir = sizeName === "width" ? "x" : "y";
  46271. props.tabs.every((tab) => {
  46272. var _a, _b, _c, _d;
  46273. const $el = (_b = (_a = instance.parent) == null ? void 0 : _a.refs) == null ? void 0 : _b[`tab-${tab.uid}`];
  46274. if (!$el)
  46275. return false;
  46276. if (!tab.active) {
  46277. return true;
  46278. }
  46279. tabSize = $el[`client${capitalize(sizeName)}`];
  46280. const position = sizeDir === "x" ? "left" : "top";
  46281. offset = $el[`offset${capitalize(position)}`] - ((_d = (_c = $el.parentElement) == null ? void 0 : _c[`offset${capitalize(position)}`]) != null ? _d : 0);
  46282. const scrollwrapEl = $el.closest(".is-scrollable");
  46283. if (scrollwrapEl) {
  46284. const scrollWrapStyle = window.getComputedStyle(scrollwrapEl);
  46285. offset += Number.parseFloat(scrollWrapStyle[`padding${capitalize(position)}`]);
  46286. }
  46287. const tabStyles = window.getComputedStyle($el);
  46288. if (sizeName === "width") {
  46289. if (props.tabs.length > 1) {
  46290. tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
  46291. }
  46292. offset += Number.parseFloat(tabStyles.paddingLeft);
  46293. }
  46294. return false;
  46295. });
  46296. return {
  46297. [sizeName]: `${tabSize}px`,
  46298. transform: `translate${capitalize(sizeDir)}(${offset}px)`
  46299. };
  46300. };
  46301. const update = () => barStyle.value = getBarStyle();
  46302. vue.watch(() => props.tabs, async () => {
  46303. await vue.nextTick();
  46304. update();
  46305. }, { immediate: true });
  46306. useResizeObserver(barRef, () => update());
  46307. expose({
  46308. ref: barRef,
  46309. update
  46310. });
  46311. return (_ctx, _cache) => {
  46312. return vue.openBlock(), vue.createElementBlock("div", {
  46313. ref_key: "barRef",
  46314. ref: barRef,
  46315. class: vue.normalizeClass([vue.unref(ns).e("active-bar"), vue.unref(ns).is(vue.unref(rootTabs).props.tabPosition)]),
  46316. style: vue.normalizeStyle(barStyle.value)
  46317. }, null, 6);
  46318. };
  46319. }
  46320. });
  46321. var TabBar = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["__file", "tab-bar.vue"]]);
  46322. const tabNavProps = buildProps({
  46323. panes: {
  46324. type: definePropType(Array),
  46325. default: () => mutable([])
  46326. },
  46327. currentName: {
  46328. type: [String, Number],
  46329. default: ""
  46330. },
  46331. editable: Boolean,
  46332. type: {
  46333. type: String,
  46334. values: ["card", "border-card", ""],
  46335. default: ""
  46336. },
  46337. stretch: Boolean
  46338. });
  46339. const tabNavEmits = {
  46340. tabClick: (tab, tabName, ev) => ev instanceof Event,
  46341. tabRemove: (tab, ev) => ev instanceof Event
  46342. };
  46343. const COMPONENT_NAME$2 = "ElTabNav";
  46344. const TabNav = vue.defineComponent({
  46345. name: COMPONENT_NAME$2,
  46346. props: tabNavProps,
  46347. emits: tabNavEmits,
  46348. setup(props, {
  46349. expose,
  46350. emit
  46351. }) {
  46352. const vm = vue.getCurrentInstance();
  46353. const rootTabs = vue.inject(tabsRootContextKey);
  46354. if (!rootTabs)
  46355. throwError(COMPONENT_NAME$2, `<el-tabs><tab-nav /></el-tabs>`);
  46356. const ns = useNamespace("tabs");
  46357. const visibility = useDocumentVisibility();
  46358. const focused = useWindowFocus();
  46359. const navScroll$ = vue.ref();
  46360. const nav$ = vue.ref();
  46361. const el$ = vue.ref();
  46362. const scrollable = vue.ref(false);
  46363. const navOffset = vue.ref(0);
  46364. const isFocus = vue.ref(false);
  46365. const focusable = vue.ref(true);
  46366. const sizeName = vue.computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height");
  46367. const navStyle = vue.computed(() => {
  46368. const dir = sizeName.value === "width" ? "X" : "Y";
  46369. return {
  46370. transform: `translate${dir}(-${navOffset.value}px)`
  46371. };
  46372. });
  46373. const scrollPrev = () => {
  46374. if (!navScroll$.value)
  46375. return;
  46376. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  46377. const currentOffset = navOffset.value;
  46378. if (!currentOffset)
  46379. return;
  46380. const newOffset = currentOffset > containerSize ? currentOffset - containerSize : 0;
  46381. navOffset.value = newOffset;
  46382. };
  46383. const scrollNext = () => {
  46384. if (!navScroll$.value || !nav$.value)
  46385. return;
  46386. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  46387. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  46388. const currentOffset = navOffset.value;
  46389. if (navSize - currentOffset <= containerSize)
  46390. return;
  46391. const newOffset = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
  46392. navOffset.value = newOffset;
  46393. };
  46394. const scrollToActiveTab = async () => {
  46395. const nav = nav$.value;
  46396. if (!scrollable.value || !el$.value || !navScroll$.value || !nav)
  46397. return;
  46398. await vue.nextTick();
  46399. const activeTab = el$.value.querySelector(".is-active");
  46400. if (!activeTab)
  46401. return;
  46402. const navScroll = navScroll$.value;
  46403. const isHorizontal = ["top", "bottom"].includes(rootTabs.props.tabPosition);
  46404. const activeTabBounding = activeTab.getBoundingClientRect();
  46405. const navScrollBounding = navScroll.getBoundingClientRect();
  46406. const maxOffset = isHorizontal ? nav.offsetWidth - navScrollBounding.width : nav.offsetHeight - navScrollBounding.height;
  46407. const currentOffset = navOffset.value;
  46408. let newOffset = currentOffset;
  46409. if (isHorizontal) {
  46410. if (activeTabBounding.left < navScrollBounding.left) {
  46411. newOffset = currentOffset - (navScrollBounding.left - activeTabBounding.left);
  46412. }
  46413. if (activeTabBounding.right > navScrollBounding.right) {
  46414. newOffset = currentOffset + activeTabBounding.right - navScrollBounding.right;
  46415. }
  46416. } else {
  46417. if (activeTabBounding.top < navScrollBounding.top) {
  46418. newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
  46419. }
  46420. if (activeTabBounding.bottom > navScrollBounding.bottom) {
  46421. newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
  46422. }
  46423. }
  46424. newOffset = Math.max(newOffset, 0);
  46425. navOffset.value = Math.min(newOffset, maxOffset);
  46426. };
  46427. const update = () => {
  46428. if (!nav$.value || !navScroll$.value)
  46429. return;
  46430. const navSize = nav$.value[`offset${capitalize(sizeName.value)}`];
  46431. const containerSize = navScroll$.value[`offset${capitalize(sizeName.value)}`];
  46432. const currentOffset = navOffset.value;
  46433. if (containerSize < navSize) {
  46434. const currentOffset2 = navOffset.value;
  46435. scrollable.value = scrollable.value || {};
  46436. scrollable.value.prev = currentOffset2;
  46437. scrollable.value.next = currentOffset2 + containerSize < navSize;
  46438. if (navSize - currentOffset2 < containerSize) {
  46439. navOffset.value = navSize - containerSize;
  46440. }
  46441. } else {
  46442. scrollable.value = false;
  46443. if (currentOffset > 0) {
  46444. navOffset.value = 0;
  46445. }
  46446. }
  46447. };
  46448. const changeTab = (e) => {
  46449. const code = e.code;
  46450. const {
  46451. up,
  46452. down,
  46453. left,
  46454. right
  46455. } = EVENT_CODE;
  46456. if (![up, down, left, right].includes(code))
  46457. return;
  46458. const tabList = Array.from(e.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
  46459. const currentIndex = tabList.indexOf(e.target);
  46460. let nextIndex;
  46461. if (code === left || code === up) {
  46462. if (currentIndex === 0) {
  46463. nextIndex = tabList.length - 1;
  46464. } else {
  46465. nextIndex = currentIndex - 1;
  46466. }
  46467. } else {
  46468. if (currentIndex < tabList.length - 1) {
  46469. nextIndex = currentIndex + 1;
  46470. } else {
  46471. nextIndex = 0;
  46472. }
  46473. }
  46474. tabList[nextIndex].focus({
  46475. preventScroll: true
  46476. });
  46477. tabList[nextIndex].click();
  46478. setFocus();
  46479. };
  46480. const setFocus = () => {
  46481. if (focusable.value)
  46482. isFocus.value = true;
  46483. };
  46484. const removeFocus = () => isFocus.value = false;
  46485. vue.watch(visibility, (visibility2) => {
  46486. if (visibility2 === "hidden") {
  46487. focusable.value = false;
  46488. } else if (visibility2 === "visible") {
  46489. setTimeout(() => focusable.value = true, 50);
  46490. }
  46491. });
  46492. vue.watch(focused, (focused2) => {
  46493. if (focused2) {
  46494. setTimeout(() => focusable.value = true, 50);
  46495. } else {
  46496. focusable.value = false;
  46497. }
  46498. });
  46499. useResizeObserver(el$, update);
  46500. vue.onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
  46501. vue.onUpdated(() => update());
  46502. expose({
  46503. scrollToActiveTab,
  46504. removeFocus
  46505. });
  46506. vue.watch(() => props.panes, () => vm.update(), {
  46507. flush: "post"
  46508. });
  46509. return () => {
  46510. const scrollBtn = scrollable.value ? [vue.createVNode("span", {
  46511. "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
  46512. "onClick": scrollPrev
  46513. }, [vue.createVNode(ElIcon, null, {
  46514. default: () => [vue.createVNode(arrow_left_default, null, null)]
  46515. })]), vue.createVNode("span", {
  46516. "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
  46517. "onClick": scrollNext
  46518. }, [vue.createVNode(ElIcon, null, {
  46519. default: () => [vue.createVNode(arrow_right_default, null, null)]
  46520. })])] : null;
  46521. const tabs = props.panes.map((pane, index) => {
  46522. var _a, _b, _c, _d;
  46523. const uid = pane.uid;
  46524. const disabled = pane.props.disabled;
  46525. const tabName = (_b = (_a = pane.props.name) != null ? _a : pane.index) != null ? _b : `${index}`;
  46526. const closable = !disabled && (pane.isClosable || props.editable);
  46527. pane.index = `${index}`;
  46528. const btnClose = closable ? vue.createVNode(ElIcon, {
  46529. "class": "is-icon-close",
  46530. "onClick": (ev) => emit("tabRemove", pane, ev)
  46531. }, {
  46532. default: () => [vue.createVNode(close_default, null, null)]
  46533. }) : null;
  46534. const tabLabelContent = ((_d = (_c = pane.slots).label) == null ? void 0 : _d.call(_c)) || pane.props.label;
  46535. const tabindex = !disabled && pane.active ? 0 : -1;
  46536. return vue.createVNode("div", {
  46537. "ref": `tab-${uid}`,
  46538. "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)],
  46539. "id": `tab-${tabName}`,
  46540. "key": `tab-${uid}`,
  46541. "aria-controls": `pane-${tabName}`,
  46542. "role": "tab",
  46543. "aria-selected": pane.active,
  46544. "tabindex": tabindex,
  46545. "onFocus": () => setFocus(),
  46546. "onBlur": () => removeFocus(),
  46547. "onClick": (ev) => {
  46548. removeFocus();
  46549. emit("tabClick", pane, tabName, ev);
  46550. },
  46551. "onKeydown": (ev) => {
  46552. if (closable && (ev.code === EVENT_CODE.delete || ev.code === EVENT_CODE.backspace)) {
  46553. emit("tabRemove", pane, ev);
  46554. }
  46555. }
  46556. }, [...[tabLabelContent, btnClose]]);
  46557. });
  46558. return vue.createVNode("div", {
  46559. "ref": el$,
  46560. "class": [ns.e("nav-wrap"), ns.is("scrollable", !!scrollable.value), ns.is(rootTabs.props.tabPosition)]
  46561. }, [scrollBtn, vue.createVNode("div", {
  46562. "class": ns.e("nav-scroll"),
  46563. "ref": navScroll$
  46564. }, [vue.createVNode("div", {
  46565. "class": [ns.e("nav"), ns.is(rootTabs.props.tabPosition), ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))],
  46566. "ref": nav$,
  46567. "style": navStyle.value,
  46568. "role": "tablist",
  46569. "onKeydown": changeTab
  46570. }, [...[!props.type ? vue.createVNode(TabBar, {
  46571. "tabs": [...props.panes]
  46572. }, null) : null, tabs]])])]);
  46573. };
  46574. }
  46575. });
  46576. const tabsProps = buildProps({
  46577. type: {
  46578. type: String,
  46579. values: ["card", "border-card", ""],
  46580. default: ""
  46581. },
  46582. activeName: {
  46583. type: [String, Number]
  46584. },
  46585. closable: Boolean,
  46586. addable: Boolean,
  46587. modelValue: {
  46588. type: [String, Number]
  46589. },
  46590. editable: Boolean,
  46591. tabPosition: {
  46592. type: String,
  46593. values: ["top", "right", "bottom", "left"],
  46594. default: "top"
  46595. },
  46596. beforeLeave: {
  46597. type: definePropType(Function),
  46598. default: () => true
  46599. },
  46600. stretch: Boolean
  46601. });
  46602. const isPaneName = (value) => isString(value) || isNumber(value);
  46603. const tabsEmits = {
  46604. [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
  46605. tabClick: (pane, ev) => ev instanceof Event,
  46606. tabChange: (name) => isPaneName(name),
  46607. edit: (paneName, action) => ["remove", "add"].includes(action),
  46608. tabRemove: (name) => isPaneName(name),
  46609. tabAdd: () => true
  46610. };
  46611. var Tabs = vue.defineComponent({
  46612. name: "ElTabs",
  46613. props: tabsProps,
  46614. emits: tabsEmits,
  46615. setup(props, {
  46616. emit,
  46617. slots,
  46618. expose
  46619. }) {
  46620. var _a, _b;
  46621. const ns = useNamespace("tabs");
  46622. const {
  46623. children: panes,
  46624. addChild: registerPane,
  46625. removeChild: unregisterPane
  46626. } = useOrderedChildren(vue.getCurrentInstance(), "ElTabPane");
  46627. const nav$ = vue.ref();
  46628. const currentName = vue.ref((_b = (_a = props.modelValue) != null ? _a : props.activeName) != null ? _b : "0");
  46629. const changeCurrentName = (value) => {
  46630. currentName.value = value;
  46631. emit(UPDATE_MODEL_EVENT, value);
  46632. emit("tabChange", value);
  46633. };
  46634. const setCurrentName = async (value) => {
  46635. var _a2, _b2, _c;
  46636. if (currentName.value === value || isUndefined(value))
  46637. return;
  46638. try {
  46639. const canLeave = await ((_a2 = props.beforeLeave) == null ? void 0 : _a2.call(props, value, currentName.value));
  46640. if (canLeave !== false) {
  46641. changeCurrentName(value);
  46642. (_c = (_b2 = nav$.value) == null ? void 0 : _b2.removeFocus) == null ? void 0 : _c.call(_b2);
  46643. }
  46644. } catch (e) {
  46645. }
  46646. };
  46647. const handleTabClick = (tab, tabName, event) => {
  46648. if (tab.props.disabled)
  46649. return;
  46650. setCurrentName(tabName);
  46651. emit("tabClick", tab, event);
  46652. };
  46653. const handleTabRemove = (pane, ev) => {
  46654. if (pane.props.disabled || isUndefined(pane.props.name))
  46655. return;
  46656. ev.stopPropagation();
  46657. emit("edit", pane.props.name, "remove");
  46658. emit("tabRemove", pane.props.name);
  46659. };
  46660. const handleTabAdd = () => {
  46661. emit("edit", void 0, "add");
  46662. emit("tabAdd");
  46663. };
  46664. useDeprecated({
  46665. from: '"activeName"',
  46666. replacement: '"model-value" or "v-model"',
  46667. scope: "ElTabs",
  46668. version: "2.3.0",
  46669. ref: "https://element-plus.org/en-US/component/tabs.html#attributes",
  46670. type: "Attribute"
  46671. }, vue.computed(() => !!props.activeName));
  46672. vue.watch(() => props.activeName, (modelValue) => setCurrentName(modelValue));
  46673. vue.watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
  46674. vue.watch(currentName, async () => {
  46675. var _a2;
  46676. await vue.nextTick();
  46677. (_a2 = nav$.value) == null ? void 0 : _a2.scrollToActiveTab();
  46678. });
  46679. vue.provide(tabsRootContextKey, {
  46680. props,
  46681. currentName,
  46682. registerPane,
  46683. unregisterPane
  46684. });
  46685. expose({
  46686. currentName
  46687. });
  46688. return () => {
  46689. const newButton = props.editable || props.addable ? vue.createVNode("span", {
  46690. "class": ns.e("new-tab"),
  46691. "tabindex": "0",
  46692. "onClick": handleTabAdd,
  46693. "onKeydown": (ev) => {
  46694. if (ev.code === EVENT_CODE.enter)
  46695. handleTabAdd();
  46696. }
  46697. }, [vue.createVNode(ElIcon, {
  46698. "class": ns.is("icon-plus")
  46699. }, {
  46700. default: () => [vue.createVNode(plus_default, null, null)]
  46701. })]) : null;
  46702. const header = vue.createVNode("div", {
  46703. "class": [ns.e("header"), ns.is(props.tabPosition)]
  46704. }, [newButton, vue.createVNode(TabNav, {
  46705. "ref": nav$,
  46706. "currentName": currentName.value,
  46707. "editable": props.editable,
  46708. "type": props.type,
  46709. "panes": panes.value,
  46710. "stretch": props.stretch,
  46711. "onTabClick": handleTabClick,
  46712. "onTabRemove": handleTabRemove
  46713. }, null)]);
  46714. const panels = vue.createVNode("div", {
  46715. "class": ns.e("content")
  46716. }, [vue.renderSlot(slots, "default")]);
  46717. return vue.createVNode("div", {
  46718. "class": [ns.b(), ns.m(props.tabPosition), {
  46719. [ns.m("card")]: props.type === "card",
  46720. [ns.m("border-card")]: props.type === "border-card"
  46721. }]
  46722. }, [...props.tabPosition !== "bottom" ? [header, panels] : [panels, header]]);
  46723. };
  46724. }
  46725. });
  46726. const tabPaneProps = buildProps({
  46727. label: {
  46728. type: String,
  46729. default: ""
  46730. },
  46731. name: {
  46732. type: [String, Number]
  46733. },
  46734. closable: Boolean,
  46735. disabled: Boolean,
  46736. lazy: Boolean
  46737. });
  46738. const _hoisted_1$a = ["id", "aria-hidden", "aria-labelledby"];
  46739. const COMPONENT_NAME$1 = "ElTabPane";
  46740. const __default__$i = vue.defineComponent({
  46741. name: COMPONENT_NAME$1
  46742. });
  46743. const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
  46744. ...__default__$i,
  46745. props: tabPaneProps,
  46746. setup(__props) {
  46747. const props = __props;
  46748. const instance = vue.getCurrentInstance();
  46749. const slots = vue.useSlots();
  46750. const tabsRoot = vue.inject(tabsRootContextKey);
  46751. if (!tabsRoot)
  46752. throwError(COMPONENT_NAME$1, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
  46753. const ns = useNamespace("tab-pane");
  46754. const index = vue.ref();
  46755. const isClosable = vue.computed(() => props.closable || tabsRoot.props.closable);
  46756. const active = computedEager(() => {
  46757. var _a;
  46758. return tabsRoot.currentName.value === ((_a = props.name) != null ? _a : index.value);
  46759. });
  46760. const loaded = vue.ref(active.value);
  46761. const paneName = vue.computed(() => {
  46762. var _a;
  46763. return (_a = props.name) != null ? _a : index.value;
  46764. });
  46765. const shouldBeRender = computedEager(() => !props.lazy || loaded.value || active.value);
  46766. vue.watch(active, (val) => {
  46767. if (val)
  46768. loaded.value = true;
  46769. });
  46770. const pane = vue.reactive({
  46771. uid: instance.uid,
  46772. slots,
  46773. props,
  46774. paneName,
  46775. active,
  46776. index,
  46777. isClosable
  46778. });
  46779. vue.onMounted(() => {
  46780. tabsRoot.registerPane(pane);
  46781. });
  46782. vue.onUnmounted(() => {
  46783. tabsRoot.unregisterPane(pane.uid);
  46784. });
  46785. return (_ctx, _cache) => {
  46786. return vue.unref(shouldBeRender) ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  46787. key: 0,
  46788. id: `pane-${vue.unref(paneName)}`,
  46789. class: vue.normalizeClass(vue.unref(ns).b()),
  46790. role: "tabpanel",
  46791. "aria-hidden": !vue.unref(active),
  46792. "aria-labelledby": `tab-${vue.unref(paneName)}`
  46793. }, [
  46794. vue.renderSlot(_ctx.$slots, "default")
  46795. ], 10, _hoisted_1$a)), [
  46796. [vue.vShow, vue.unref(active)]
  46797. ]) : vue.createCommentVNode("v-if", true);
  46798. };
  46799. }
  46800. });
  46801. var TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["__file", "tab-pane.vue"]]);
  46802. const ElTabs = withInstall(Tabs, {
  46803. TabPane
  46804. });
  46805. const ElTabPane = withNoopInstall(TabPane);
  46806. const timeSelectProps = buildProps({
  46807. format: {
  46808. type: String,
  46809. default: "HH:mm"
  46810. },
  46811. modelValue: String,
  46812. disabled: Boolean,
  46813. editable: {
  46814. type: Boolean,
  46815. default: true
  46816. },
  46817. effect: {
  46818. type: String,
  46819. default: "light"
  46820. },
  46821. clearable: {
  46822. type: Boolean,
  46823. default: true
  46824. },
  46825. size: useSizeProp,
  46826. placeholder: String,
  46827. start: {
  46828. type: String,
  46829. default: "09:00"
  46830. },
  46831. end: {
  46832. type: String,
  46833. default: "18:00"
  46834. },
  46835. step: {
  46836. type: String,
  46837. default: "00:30"
  46838. },
  46839. minTime: String,
  46840. maxTime: String,
  46841. name: String,
  46842. prefixIcon: {
  46843. type: definePropType([String, Object]),
  46844. default: () => clock_default
  46845. },
  46846. clearIcon: {
  46847. type: definePropType([String, Object]),
  46848. default: () => circle_close_default
  46849. }
  46850. });
  46851. const parseTime = (time) => {
  46852. const values = (time || "").split(":");
  46853. if (values.length >= 2) {
  46854. let hours = Number.parseInt(values[0], 10);
  46855. const minutes = Number.parseInt(values[1], 10);
  46856. const timeUpper = time.toUpperCase();
  46857. if (timeUpper.includes("AM") && hours === 12) {
  46858. hours = 0;
  46859. } else if (timeUpper.includes("PM") && hours !== 12) {
  46860. hours += 12;
  46861. }
  46862. return {
  46863. hours,
  46864. minutes
  46865. };
  46866. }
  46867. return null;
  46868. };
  46869. const compareTime = (time1, time2) => {
  46870. const value1 = parseTime(time1);
  46871. if (!value1)
  46872. return -1;
  46873. const value2 = parseTime(time2);
  46874. if (!value2)
  46875. return -1;
  46876. const minutes1 = value1.minutes + value1.hours * 60;
  46877. const minutes2 = value2.minutes + value2.hours * 60;
  46878. if (minutes1 === minutes2) {
  46879. return 0;
  46880. }
  46881. return minutes1 > minutes2 ? 1 : -1;
  46882. };
  46883. const padTime = (time) => {
  46884. return `${time}`.padStart(2, "0");
  46885. };
  46886. const formatTime = (time) => {
  46887. return `${padTime(time.hours)}:${padTime(time.minutes)}`;
  46888. };
  46889. const nextTime = (time, step) => {
  46890. const timeValue = parseTime(time);
  46891. if (!timeValue)
  46892. return "";
  46893. const stepValue = parseTime(step);
  46894. if (!stepValue)
  46895. return "";
  46896. const next = {
  46897. hours: timeValue.hours,
  46898. minutes: timeValue.minutes
  46899. };
  46900. next.minutes += stepValue.minutes;
  46901. next.hours += stepValue.hours;
  46902. next.hours += Math.floor(next.minutes / 60);
  46903. next.minutes = next.minutes % 60;
  46904. return formatTime(next);
  46905. };
  46906. const __default__$h = vue.defineComponent({
  46907. name: "ElTimeSelect"
  46908. });
  46909. const _sfc_main$m = /* @__PURE__ */ vue.defineComponent({
  46910. ...__default__$h,
  46911. props: timeSelectProps,
  46912. emits: ["change", "blur", "focus", "update:modelValue"],
  46913. setup(__props, { expose }) {
  46914. const props = __props;
  46915. dayjs.extend(customParseFormat);
  46916. const { Option: ElOption } = ElSelect;
  46917. const nsInput = useNamespace("input");
  46918. const select = vue.ref();
  46919. const _disabled = useDisabled();
  46920. const value = vue.computed(() => props.modelValue);
  46921. const start = vue.computed(() => {
  46922. const time = parseTime(props.start);
  46923. return time ? formatTime(time) : null;
  46924. });
  46925. const end = vue.computed(() => {
  46926. const time = parseTime(props.end);
  46927. return time ? formatTime(time) : null;
  46928. });
  46929. const step = vue.computed(() => {
  46930. const time = parseTime(props.step);
  46931. return time ? formatTime(time) : null;
  46932. });
  46933. const minTime = vue.computed(() => {
  46934. const time = parseTime(props.minTime || "");
  46935. return time ? formatTime(time) : null;
  46936. });
  46937. const maxTime = vue.computed(() => {
  46938. const time = parseTime(props.maxTime || "");
  46939. return time ? formatTime(time) : null;
  46940. });
  46941. const items = vue.computed(() => {
  46942. const result = [];
  46943. if (props.start && props.end && props.step) {
  46944. let current = start.value;
  46945. let currentTime;
  46946. while (current && end.value && compareTime(current, end.value) <= 0) {
  46947. currentTime = dayjs(current, "HH:mm").format(props.format);
  46948. result.push({
  46949. value: currentTime,
  46950. disabled: compareTime(current, minTime.value || "-1:-1") <= 0 || compareTime(current, maxTime.value || "100:100") >= 0
  46951. });
  46952. current = nextTime(current, step.value);
  46953. }
  46954. }
  46955. return result;
  46956. });
  46957. const blur = () => {
  46958. var _a, _b;
  46959. (_b = (_a = select.value) == null ? void 0 : _a.blur) == null ? void 0 : _b.call(_a);
  46960. };
  46961. const focus = () => {
  46962. var _a, _b;
  46963. (_b = (_a = select.value) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
  46964. };
  46965. expose({
  46966. blur,
  46967. focus
  46968. });
  46969. return (_ctx, _cache) => {
  46970. return vue.openBlock(), vue.createBlock(vue.unref(ElSelect), {
  46971. ref_key: "select",
  46972. ref: select,
  46973. "model-value": vue.unref(value),
  46974. disabled: vue.unref(_disabled),
  46975. clearable: _ctx.clearable,
  46976. "clear-icon": _ctx.clearIcon,
  46977. size: _ctx.size,
  46978. effect: _ctx.effect,
  46979. placeholder: _ctx.placeholder,
  46980. "default-first-option": "",
  46981. filterable: _ctx.editable,
  46982. "onUpdate:modelValue": _cache[0] || (_cache[0] = (event) => _ctx.$emit("update:modelValue", event)),
  46983. onChange: _cache[1] || (_cache[1] = (event) => _ctx.$emit("change", event)),
  46984. onBlur: _cache[2] || (_cache[2] = (event) => _ctx.$emit("blur", event)),
  46985. onFocus: _cache[3] || (_cache[3] = (event) => _ctx.$emit("focus", event))
  46986. }, {
  46987. prefix: vue.withCtx(() => [
  46988. _ctx.prefixIcon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  46989. key: 0,
  46990. class: vue.normalizeClass(vue.unref(nsInput).e("prefix-icon"))
  46991. }, {
  46992. default: vue.withCtx(() => [
  46993. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.prefixIcon)))
  46994. ]),
  46995. _: 1
  46996. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  46997. ]),
  46998. default: vue.withCtx(() => [
  46999. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(items), (item) => {
  47000. return vue.openBlock(), vue.createBlock(vue.unref(ElOption), {
  47001. key: item.value,
  47002. label: item.value,
  47003. value: item.value,
  47004. disabled: item.disabled
  47005. }, null, 8, ["label", "value", "disabled"]);
  47006. }), 128))
  47007. ]),
  47008. _: 1
  47009. }, 8, ["model-value", "disabled", "clearable", "clear-icon", "size", "effect", "placeholder", "filterable"]);
  47010. };
  47011. }
  47012. });
  47013. var TimeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["__file", "time-select.vue"]]);
  47014. TimeSelect.install = (app) => {
  47015. app.component(TimeSelect.name, TimeSelect);
  47016. };
  47017. const _TimeSelect = TimeSelect;
  47018. const ElTimeSelect = _TimeSelect;
  47019. const Timeline = vue.defineComponent({
  47020. name: "ElTimeline",
  47021. setup(_, { slots }) {
  47022. const ns = useNamespace("timeline");
  47023. vue.provide("timeline", slots);
  47024. return () => {
  47025. return vue.h("ul", { class: [ns.b()] }, [vue.renderSlot(slots, "default")]);
  47026. };
  47027. }
  47028. });
  47029. var Timeline$1 = Timeline;
  47030. const timelineItemProps = buildProps({
  47031. timestamp: {
  47032. type: String,
  47033. default: ""
  47034. },
  47035. hideTimestamp: {
  47036. type: Boolean,
  47037. default: false
  47038. },
  47039. center: {
  47040. type: Boolean,
  47041. default: false
  47042. },
  47043. placement: {
  47044. type: String,
  47045. values: ["top", "bottom"],
  47046. default: "bottom"
  47047. },
  47048. type: {
  47049. type: String,
  47050. values: ["primary", "success", "warning", "danger", "info"],
  47051. default: ""
  47052. },
  47053. color: {
  47054. type: String,
  47055. default: ""
  47056. },
  47057. size: {
  47058. type: String,
  47059. values: ["normal", "large"],
  47060. default: "normal"
  47061. },
  47062. icon: {
  47063. type: iconPropType
  47064. },
  47065. hollow: {
  47066. type: Boolean,
  47067. default: false
  47068. }
  47069. });
  47070. const __default__$g = vue.defineComponent({
  47071. name: "ElTimelineItem"
  47072. });
  47073. const _sfc_main$l = /* @__PURE__ */ vue.defineComponent({
  47074. ...__default__$g,
  47075. props: timelineItemProps,
  47076. setup(__props) {
  47077. const ns = useNamespace("timeline-item");
  47078. return (_ctx, _cache) => {
  47079. return vue.openBlock(), vue.createElementBlock("li", {
  47080. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).e("center")]: _ctx.center }])
  47081. }, [
  47082. vue.createElementVNode("div", {
  47083. class: vue.normalizeClass(vue.unref(ns).e("tail"))
  47084. }, null, 2),
  47085. !_ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  47086. key: 0,
  47087. class: vue.normalizeClass([
  47088. vue.unref(ns).e("node"),
  47089. vue.unref(ns).em("node", _ctx.size || ""),
  47090. vue.unref(ns).em("node", _ctx.type || ""),
  47091. vue.unref(ns).is("hollow", _ctx.hollow)
  47092. ]),
  47093. style: vue.normalizeStyle({
  47094. backgroundColor: _ctx.color
  47095. })
  47096. }, [
  47097. _ctx.icon ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  47098. key: 0,
  47099. class: vue.normalizeClass(vue.unref(ns).e("icon"))
  47100. }, {
  47101. default: vue.withCtx(() => [
  47102. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.icon)))
  47103. ]),
  47104. _: 1
  47105. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  47106. ], 6)) : vue.createCommentVNode("v-if", true),
  47107. _ctx.$slots.dot ? (vue.openBlock(), vue.createElementBlock("div", {
  47108. key: 1,
  47109. class: vue.normalizeClass(vue.unref(ns).e("dot"))
  47110. }, [
  47111. vue.renderSlot(_ctx.$slots, "dot")
  47112. ], 2)) : vue.createCommentVNode("v-if", true),
  47113. vue.createElementVNode("div", {
  47114. class: vue.normalizeClass(vue.unref(ns).e("wrapper"))
  47115. }, [
  47116. !_ctx.hideTimestamp && _ctx.placement === "top" ? (vue.openBlock(), vue.createElementBlock("div", {
  47117. key: 0,
  47118. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("top")])
  47119. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true),
  47120. vue.createElementVNode("div", {
  47121. class: vue.normalizeClass(vue.unref(ns).e("content"))
  47122. }, [
  47123. vue.renderSlot(_ctx.$slots, "default")
  47124. ], 2),
  47125. !_ctx.hideTimestamp && _ctx.placement === "bottom" ? (vue.openBlock(), vue.createElementBlock("div", {
  47126. key: 1,
  47127. class: vue.normalizeClass([vue.unref(ns).e("timestamp"), vue.unref(ns).is("bottom")])
  47128. }, vue.toDisplayString(_ctx.timestamp), 3)) : vue.createCommentVNode("v-if", true)
  47129. ], 2)
  47130. ], 2);
  47131. };
  47132. }
  47133. });
  47134. var TimelineItem = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["__file", "timeline-item.vue"]]);
  47135. const ElTimeline = withInstall(Timeline$1, {
  47136. TimelineItem
  47137. });
  47138. const ElTimelineItem = withNoopInstall(TimelineItem);
  47139. const tooltipV2CommonProps = buildProps({
  47140. nowrap: Boolean
  47141. });
  47142. var TooltipV2Sides = /* @__PURE__ */ ((TooltipV2Sides2) => {
  47143. TooltipV2Sides2["top"] = "top";
  47144. TooltipV2Sides2["bottom"] = "bottom";
  47145. TooltipV2Sides2["left"] = "left";
  47146. TooltipV2Sides2["right"] = "right";
  47147. return TooltipV2Sides2;
  47148. })(TooltipV2Sides || {});
  47149. const tooltipV2Sides = Object.values(TooltipV2Sides);
  47150. const tooltipV2ArrowProps = buildProps({
  47151. width: {
  47152. type: Number,
  47153. default: 10
  47154. },
  47155. height: {
  47156. type: Number,
  47157. default: 10
  47158. },
  47159. style: {
  47160. type: definePropType(Object),
  47161. default: null
  47162. }
  47163. });
  47164. const tooltipV2ArrowSpecialProps = buildProps({
  47165. side: {
  47166. type: definePropType(String),
  47167. values: tooltipV2Sides,
  47168. required: true
  47169. }
  47170. });
  47171. const tooltipV2Strategies = ["absolute", "fixed"];
  47172. const tooltipV2Placements = [
  47173. "top-start",
  47174. "top-end",
  47175. "top",
  47176. "bottom-start",
  47177. "bottom-end",
  47178. "bottom",
  47179. "left-start",
  47180. "left-end",
  47181. "left",
  47182. "right-start",
  47183. "right-end",
  47184. "right"
  47185. ];
  47186. const tooltipV2ContentProps = buildProps({
  47187. ariaLabel: String,
  47188. arrowPadding: {
  47189. type: definePropType(Number),
  47190. default: 5
  47191. },
  47192. effect: {
  47193. type: String,
  47194. default: ""
  47195. },
  47196. contentClass: String,
  47197. placement: {
  47198. type: definePropType(String),
  47199. values: tooltipV2Placements,
  47200. default: "bottom"
  47201. },
  47202. reference: {
  47203. type: definePropType(Object),
  47204. default: null
  47205. },
  47206. offset: {
  47207. type: Number,
  47208. default: 8
  47209. },
  47210. strategy: {
  47211. type: definePropType(String),
  47212. values: tooltipV2Strategies,
  47213. default: "absolute"
  47214. },
  47215. showArrow: {
  47216. type: Boolean,
  47217. default: false
  47218. }
  47219. });
  47220. const tooltipV2RootProps = buildProps({
  47221. delayDuration: {
  47222. type: Number,
  47223. default: 300
  47224. },
  47225. defaultOpen: Boolean,
  47226. open: {
  47227. type: Boolean,
  47228. default: void 0
  47229. },
  47230. onOpenChange: {
  47231. type: definePropType(Function)
  47232. },
  47233. "onUpdate:open": {
  47234. type: definePropType(Function)
  47235. }
  47236. });
  47237. const EventHandler = {
  47238. type: definePropType(Function)
  47239. };
  47240. const tooltipV2TriggerProps = buildProps({
  47241. onBlur: EventHandler,
  47242. onClick: EventHandler,
  47243. onFocus: EventHandler,
  47244. onMouseDown: EventHandler,
  47245. onMouseEnter: EventHandler,
  47246. onMouseLeave: EventHandler
  47247. });
  47248. const tooltipV2Props = buildProps({
  47249. ...tooltipV2RootProps,
  47250. ...tooltipV2ArrowProps,
  47251. ...tooltipV2TriggerProps,
  47252. ...tooltipV2ContentProps,
  47253. alwaysOn: Boolean,
  47254. fullTransition: Boolean,
  47255. transitionProps: {
  47256. type: definePropType(Object),
  47257. default: null
  47258. },
  47259. teleported: Boolean,
  47260. to: {
  47261. type: definePropType(String),
  47262. default: "body"
  47263. }
  47264. });
  47265. const __default__$f = vue.defineComponent({
  47266. name: "ElTooltipV2Root"
  47267. });
  47268. const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
  47269. ...__default__$f,
  47270. props: tooltipV2RootProps,
  47271. setup(__props, { expose }) {
  47272. const props = __props;
  47273. const _open = vue.ref(props.defaultOpen);
  47274. const triggerRef = vue.ref(null);
  47275. const open = vue.computed({
  47276. get: () => isPropAbsent(props.open) ? _open.value : props.open,
  47277. set: (open2) => {
  47278. var _a;
  47279. _open.value = open2;
  47280. (_a = props["onUpdate:open"]) == null ? void 0 : _a.call(props, open2);
  47281. }
  47282. });
  47283. const isOpenDelayed = vue.computed(() => isNumber(props.delayDuration) && props.delayDuration > 0);
  47284. const { start: onDelayedOpen, stop: clearTimer } = useTimeoutFn(() => {
  47285. open.value = true;
  47286. }, vue.computed(() => props.delayDuration), {
  47287. immediate: false
  47288. });
  47289. const ns = useNamespace("tooltip-v2");
  47290. const contentId = useId();
  47291. const onNormalOpen = () => {
  47292. clearTimer();
  47293. open.value = true;
  47294. };
  47295. const onDelayOpen = () => {
  47296. vue.unref(isOpenDelayed) ? onDelayedOpen() : onNormalOpen();
  47297. };
  47298. const onOpen = onNormalOpen;
  47299. const onClose = () => {
  47300. clearTimer();
  47301. open.value = false;
  47302. };
  47303. const onChange = (open2) => {
  47304. var _a;
  47305. if (open2) {
  47306. document.dispatchEvent(new CustomEvent(TOOLTIP_V2_OPEN));
  47307. onOpen();
  47308. }
  47309. (_a = props.onOpenChange) == null ? void 0 : _a.call(props, open2);
  47310. };
  47311. vue.watch(open, onChange);
  47312. vue.onMounted(() => {
  47313. document.addEventListener(TOOLTIP_V2_OPEN, onClose);
  47314. });
  47315. vue.onBeforeUnmount(() => {
  47316. clearTimer();
  47317. document.removeEventListener(TOOLTIP_V2_OPEN, onClose);
  47318. });
  47319. vue.provide(tooltipV2RootKey, {
  47320. contentId,
  47321. triggerRef,
  47322. ns,
  47323. onClose,
  47324. onDelayOpen,
  47325. onOpen
  47326. });
  47327. expose({
  47328. onOpen,
  47329. onClose
  47330. });
  47331. return (_ctx, _cache) => {
  47332. return vue.renderSlot(_ctx.$slots, "default", { open: vue.unref(open) });
  47333. };
  47334. }
  47335. });
  47336. var TooltipV2Root = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__file", "root.vue"]]);
  47337. const __default__$e = vue.defineComponent({
  47338. name: "ElTooltipV2Arrow"
  47339. });
  47340. const _sfc_main$j = /* @__PURE__ */ vue.defineComponent({
  47341. ...__default__$e,
  47342. props: {
  47343. ...tooltipV2ArrowProps,
  47344. ...tooltipV2ArrowSpecialProps
  47345. },
  47346. setup(__props) {
  47347. const props = __props;
  47348. const { ns } = vue.inject(tooltipV2RootKey);
  47349. const { arrowRef } = vue.inject(tooltipV2ContentKey);
  47350. const arrowStyle = vue.computed(() => {
  47351. const { style, width, height } = props;
  47352. const namespace = ns.namespace.value;
  47353. return {
  47354. [`--${namespace}-tooltip-v2-arrow-width`]: `${width}px`,
  47355. [`--${namespace}-tooltip-v2-arrow-height`]: `${height}px`,
  47356. [`--${namespace}-tooltip-v2-arrow-border-width`]: `${width / 2}px`,
  47357. [`--${namespace}-tooltip-v2-arrow-cover-width`]: width / 2 - 1,
  47358. ...style || {}
  47359. };
  47360. });
  47361. return (_ctx, _cache) => {
  47362. return vue.openBlock(), vue.createElementBlock("span", {
  47363. ref_key: "arrowRef",
  47364. ref: arrowRef,
  47365. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  47366. class: vue.normalizeClass(vue.unref(ns).e("arrow"))
  47367. }, null, 6);
  47368. };
  47369. }
  47370. });
  47371. var TooltipV2Arrow = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["__file", "arrow.vue"]]);
  47372. const visualHiddenProps = buildProps({
  47373. style: {
  47374. type: definePropType([String, Object, Array]),
  47375. default: () => ({})
  47376. }
  47377. });
  47378. const __default__$d = vue.defineComponent({
  47379. name: "ElVisuallyHidden"
  47380. });
  47381. const _sfc_main$i = /* @__PURE__ */ vue.defineComponent({
  47382. ...__default__$d,
  47383. props: visualHiddenProps,
  47384. setup(__props) {
  47385. const props = __props;
  47386. const computedStyle = vue.computed(() => {
  47387. return [
  47388. props.style,
  47389. {
  47390. position: "absolute",
  47391. border: 0,
  47392. width: 1,
  47393. height: 1,
  47394. padding: 0,
  47395. margin: -1,
  47396. overflow: "hidden",
  47397. clip: "rect(0, 0, 0, 0)",
  47398. whiteSpace: "nowrap",
  47399. wordWrap: "normal"
  47400. }
  47401. ];
  47402. });
  47403. return (_ctx, _cache) => {
  47404. return vue.openBlock(), vue.createElementBlock("span", vue.mergeProps(_ctx.$attrs, { style: vue.unref(computedStyle) }), [
  47405. vue.renderSlot(_ctx.$slots, "default")
  47406. ], 16);
  47407. };
  47408. }
  47409. });
  47410. var ElVisuallyHidden = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["__file", "visual-hidden.vue"]]);
  47411. const _hoisted_1$9 = ["data-side"];
  47412. const __default__$c = vue.defineComponent({
  47413. name: "ElTooltipV2Content"
  47414. });
  47415. const _sfc_main$h = /* @__PURE__ */ vue.defineComponent({
  47416. ...__default__$c,
  47417. props: { ...tooltipV2ContentProps, ...tooltipV2CommonProps },
  47418. setup(__props) {
  47419. const props = __props;
  47420. const { triggerRef, contentId } = vue.inject(tooltipV2RootKey);
  47421. const placement = vue.ref(props.placement);
  47422. const strategy = vue.ref(props.strategy);
  47423. const arrowRef = vue.ref(null);
  47424. const { referenceRef, contentRef, middlewareData, x, y, update } = useFloating({
  47425. placement,
  47426. strategy,
  47427. middleware: vue.computed(() => {
  47428. const middleware = [offset(props.offset)];
  47429. if (props.showArrow) {
  47430. middleware.push(arrowMiddleware({
  47431. arrowRef
  47432. }));
  47433. }
  47434. return middleware;
  47435. })
  47436. });
  47437. const zIndex = useZIndex().nextZIndex();
  47438. const ns = useNamespace("tooltip-v2");
  47439. const side = vue.computed(() => {
  47440. return placement.value.split("-")[0];
  47441. });
  47442. const contentStyle = vue.computed(() => {
  47443. return {
  47444. position: vue.unref(strategy),
  47445. top: `${vue.unref(y) || 0}px`,
  47446. left: `${vue.unref(x) || 0}px`,
  47447. zIndex
  47448. };
  47449. });
  47450. const arrowStyle = vue.computed(() => {
  47451. if (!props.showArrow)
  47452. return {};
  47453. const { arrow } = vue.unref(middlewareData);
  47454. return {
  47455. [`--${ns.namespace.value}-tooltip-v2-arrow-x`]: `${arrow == null ? void 0 : arrow.x}px` || "",
  47456. [`--${ns.namespace.value}-tooltip-v2-arrow-y`]: `${arrow == null ? void 0 : arrow.y}px` || ""
  47457. };
  47458. });
  47459. const contentClass = vue.computed(() => [
  47460. ns.e("content"),
  47461. ns.is("dark", props.effect === "dark"),
  47462. ns.is(vue.unref(strategy)),
  47463. props.contentClass
  47464. ]);
  47465. vue.watch(arrowRef, () => update());
  47466. vue.watch(() => props.placement, (val) => placement.value = val);
  47467. vue.onMounted(() => {
  47468. vue.watch(() => props.reference || triggerRef.value, (el) => {
  47469. referenceRef.value = el || void 0;
  47470. }, {
  47471. immediate: true
  47472. });
  47473. });
  47474. vue.provide(tooltipV2ContentKey, { arrowRef });
  47475. return (_ctx, _cache) => {
  47476. return vue.openBlock(), vue.createElementBlock("div", {
  47477. ref_key: "contentRef",
  47478. ref: contentRef,
  47479. style: vue.normalizeStyle(vue.unref(contentStyle)),
  47480. "data-tooltip-v2-root": ""
  47481. }, [
  47482. !_ctx.nowrap ? (vue.openBlock(), vue.createElementBlock("div", {
  47483. key: 0,
  47484. "data-side": vue.unref(side),
  47485. class: vue.normalizeClass(vue.unref(contentClass))
  47486. }, [
  47487. vue.renderSlot(_ctx.$slots, "default", {
  47488. contentStyle: vue.unref(contentStyle),
  47489. contentClass: vue.unref(contentClass)
  47490. }),
  47491. vue.createVNode(vue.unref(ElVisuallyHidden), {
  47492. id: vue.unref(contentId),
  47493. role: "tooltip"
  47494. }, {
  47495. default: vue.withCtx(() => [
  47496. _ctx.ariaLabel ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 0 }, [
  47497. vue.createTextVNode(vue.toDisplayString(_ctx.ariaLabel), 1)
  47498. ], 64)) : vue.renderSlot(_ctx.$slots, "default", { key: 1 })
  47499. ]),
  47500. _: 3
  47501. }, 8, ["id"]),
  47502. vue.renderSlot(_ctx.$slots, "arrow", {
  47503. style: vue.normalizeStyle(vue.unref(arrowStyle)),
  47504. side: vue.unref(side)
  47505. })
  47506. ], 10, _hoisted_1$9)) : vue.createCommentVNode("v-if", true)
  47507. ], 4);
  47508. };
  47509. }
  47510. });
  47511. var TooltipV2Content = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__file", "content.vue"]]);
  47512. const forwardRefProps = buildProps({
  47513. setRef: {
  47514. type: definePropType(Function),
  47515. required: true
  47516. },
  47517. onlyChild: Boolean
  47518. });
  47519. var ForwardRef = vue.defineComponent({
  47520. props: forwardRefProps,
  47521. setup(props, {
  47522. slots
  47523. }) {
  47524. const fragmentRef = vue.ref();
  47525. const setRef = composeRefs(fragmentRef, (el) => {
  47526. if (el) {
  47527. props.setRef(el.nextElementSibling);
  47528. } else {
  47529. props.setRef(null);
  47530. }
  47531. });
  47532. return () => {
  47533. var _a;
  47534. const [firstChild] = ((_a = slots.default) == null ? void 0 : _a.call(slots)) || [];
  47535. const child = props.onlyChild ? ensureOnlyChild(firstChild.children) : firstChild.children;
  47536. return vue.createVNode(vue.Fragment, {
  47537. "ref": setRef
  47538. }, [child]);
  47539. };
  47540. }
  47541. });
  47542. const __default__$b = vue.defineComponent({
  47543. name: "ElTooltipV2Trigger"
  47544. });
  47545. const _sfc_main$g = /* @__PURE__ */ vue.defineComponent({
  47546. ...__default__$b,
  47547. props: {
  47548. ...tooltipV2CommonProps,
  47549. ...tooltipV2TriggerProps
  47550. },
  47551. setup(__props) {
  47552. const props = __props;
  47553. const { onClose, onOpen, onDelayOpen, triggerRef, contentId } = vue.inject(tooltipV2RootKey);
  47554. let isMousedown = false;
  47555. const setTriggerRef = (el) => {
  47556. triggerRef.value = el;
  47557. };
  47558. const onMouseup = () => {
  47559. isMousedown = false;
  47560. };
  47561. const onMouseenter = composeEventHandlers(props.onMouseEnter, onDelayOpen);
  47562. const onMouseleave = composeEventHandlers(props.onMouseLeave, onClose);
  47563. const onMousedown = composeEventHandlers(props.onMouseDown, () => {
  47564. onClose();
  47565. isMousedown = true;
  47566. document.addEventListener("mouseup", onMouseup, { once: true });
  47567. });
  47568. const onFocus = composeEventHandlers(props.onFocus, () => {
  47569. if (!isMousedown)
  47570. onOpen();
  47571. });
  47572. const onBlur = composeEventHandlers(props.onBlur, onClose);
  47573. const onClick = composeEventHandlers(props.onClick, (e) => {
  47574. if (e.detail === 0)
  47575. onClose();
  47576. });
  47577. const events = {
  47578. blur: onBlur,
  47579. click: onClick,
  47580. focus: onFocus,
  47581. mousedown: onMousedown,
  47582. mouseenter: onMouseenter,
  47583. mouseleave: onMouseleave
  47584. };
  47585. const setEvents = (el, events2, type) => {
  47586. if (el) {
  47587. Object.entries(events2).forEach(([name, handler]) => {
  47588. el[type](name, handler);
  47589. });
  47590. }
  47591. };
  47592. vue.watch(triggerRef, (triggerEl, previousTriggerEl) => {
  47593. setEvents(triggerEl, events, "addEventListener");
  47594. setEvents(previousTriggerEl, events, "removeEventListener");
  47595. if (triggerEl) {
  47596. triggerEl.setAttribute("aria-describedby", contentId.value);
  47597. }
  47598. });
  47599. vue.onBeforeUnmount(() => {
  47600. setEvents(triggerRef.value, events, "removeEventListener");
  47601. document.removeEventListener("mouseup", onMouseup);
  47602. });
  47603. return (_ctx, _cache) => {
  47604. return _ctx.nowrap ? (vue.openBlock(), vue.createBlock(vue.unref(ForwardRef), {
  47605. key: 0,
  47606. "set-ref": setTriggerRef,
  47607. "only-child": ""
  47608. }, {
  47609. default: vue.withCtx(() => [
  47610. vue.renderSlot(_ctx.$slots, "default")
  47611. ]),
  47612. _: 3
  47613. })) : (vue.openBlock(), vue.createElementBlock("button", vue.mergeProps({
  47614. key: 1,
  47615. ref_key: "triggerRef",
  47616. ref: triggerRef
  47617. }, _ctx.$attrs), [
  47618. vue.renderSlot(_ctx.$slots, "default")
  47619. ], 16));
  47620. };
  47621. }
  47622. });
  47623. var TooltipV2Trigger = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["__file", "trigger.vue"]]);
  47624. const __default__$a = vue.defineComponent({
  47625. name: "ElTooltipV2"
  47626. });
  47627. const _sfc_main$f = /* @__PURE__ */ vue.defineComponent({
  47628. ...__default__$a,
  47629. props: tooltipV2Props,
  47630. setup(__props) {
  47631. const props = __props;
  47632. const refedProps = vue.toRefs(props);
  47633. const arrowProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ArrowProps)));
  47634. const contentProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2ContentProps)));
  47635. const rootProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2RootProps)));
  47636. const triggerProps = vue.reactive(pick(refedProps, Object.keys(tooltipV2TriggerProps)));
  47637. return (_ctx, _cache) => {
  47638. return vue.openBlock(), vue.createBlock(TooltipV2Root, vue.normalizeProps(vue.guardReactiveProps(rootProps)), {
  47639. default: vue.withCtx(({ open }) => [
  47640. vue.createVNode(TooltipV2Trigger, vue.mergeProps(triggerProps, { nowrap: "" }), {
  47641. default: vue.withCtx(() => [
  47642. vue.renderSlot(_ctx.$slots, "trigger")
  47643. ]),
  47644. _: 3
  47645. }, 16),
  47646. (vue.openBlock(), vue.createBlock(vue.Teleport, {
  47647. to: _ctx.to,
  47648. disabled: !_ctx.teleported
  47649. }, [
  47650. _ctx.fullTransition ? (vue.openBlock(), vue.createBlock(vue.Transition, vue.normalizeProps(vue.mergeProps({ key: 0 }, _ctx.transitionProps)), {
  47651. default: vue.withCtx(() => [
  47652. _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), {
  47653. arrow: vue.withCtx(({ style, side }) => [
  47654. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, {
  47655. style,
  47656. side
  47657. }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true)
  47658. ]),
  47659. default: vue.withCtx(() => [
  47660. vue.renderSlot(_ctx.$slots, "default")
  47661. ]),
  47662. _: 3
  47663. }, 16)) : vue.createCommentVNode("v-if", true)
  47664. ]),
  47665. _: 2
  47666. }, 1040)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  47667. _ctx.alwaysOn || open ? (vue.openBlock(), vue.createBlock(TooltipV2Content, vue.normalizeProps(vue.mergeProps({ key: 0 }, contentProps)), {
  47668. arrow: vue.withCtx(({ style, side }) => [
  47669. _ctx.showArrow ? (vue.openBlock(), vue.createBlock(TooltipV2Arrow, vue.mergeProps({ key: 0 }, arrowProps, {
  47670. style,
  47671. side
  47672. }), null, 16, ["style", "side"])) : vue.createCommentVNode("v-if", true)
  47673. ]),
  47674. default: vue.withCtx(() => [
  47675. vue.renderSlot(_ctx.$slots, "default")
  47676. ]),
  47677. _: 3
  47678. }, 16)) : vue.createCommentVNode("v-if", true)
  47679. ], 64))
  47680. ], 8, ["to", "disabled"]))
  47681. ]),
  47682. _: 3
  47683. }, 16);
  47684. };
  47685. }
  47686. });
  47687. var TooltipV2 = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["__file", "tooltip.vue"]]);
  47688. const ElTooltipV2 = withInstall(TooltipV2);
  47689. const LEFT_CHECK_CHANGE_EVENT = "left-check-change";
  47690. const RIGHT_CHECK_CHANGE_EVENT = "right-check-change";
  47691. const transferProps = buildProps({
  47692. data: {
  47693. type: definePropType(Array),
  47694. default: () => []
  47695. },
  47696. titles: {
  47697. type: definePropType(Array),
  47698. default: () => []
  47699. },
  47700. buttonTexts: {
  47701. type: definePropType(Array),
  47702. default: () => []
  47703. },
  47704. filterPlaceholder: String,
  47705. filterMethod: {
  47706. type: definePropType(Function)
  47707. },
  47708. leftDefaultChecked: {
  47709. type: definePropType(Array),
  47710. default: () => []
  47711. },
  47712. rightDefaultChecked: {
  47713. type: definePropType(Array),
  47714. default: () => []
  47715. },
  47716. renderContent: {
  47717. type: definePropType(Function)
  47718. },
  47719. modelValue: {
  47720. type: definePropType(Array),
  47721. default: () => []
  47722. },
  47723. format: {
  47724. type: definePropType(Object),
  47725. default: () => ({})
  47726. },
  47727. filterable: Boolean,
  47728. props: {
  47729. type: definePropType(Object),
  47730. default: () => mutable({
  47731. label: "label",
  47732. key: "key",
  47733. disabled: "disabled"
  47734. })
  47735. },
  47736. targetOrder: {
  47737. type: String,
  47738. values: ["original", "push", "unshift"],
  47739. default: "original"
  47740. },
  47741. validateEvent: {
  47742. type: Boolean,
  47743. default: true
  47744. }
  47745. });
  47746. const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray) || isArray(value) && isNil(movedKeys);
  47747. const transferEmits = {
  47748. [CHANGE_EVENT]: (value, direction, movedKeys) => [value, movedKeys].every(isArray) && ["left", "right"].includes(direction),
  47749. [UPDATE_MODEL_EVENT]: (value) => isArray(value),
  47750. [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,
  47751. [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn
  47752. };
  47753. const CHECKED_CHANGE_EVENT = "checked-change";
  47754. const transferPanelProps = buildProps({
  47755. data: transferProps.data,
  47756. optionRender: {
  47757. type: definePropType(Function)
  47758. },
  47759. placeholder: String,
  47760. title: String,
  47761. filterable: Boolean,
  47762. format: transferProps.format,
  47763. filterMethod: transferProps.filterMethod,
  47764. defaultChecked: transferProps.leftDefaultChecked,
  47765. props: transferProps.props
  47766. });
  47767. const transferPanelEmits = {
  47768. [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn
  47769. };
  47770. const usePropsAlias = (props) => {
  47771. const initProps = {
  47772. label: "label",
  47773. key: "key",
  47774. disabled: "disabled"
  47775. };
  47776. return vue.computed(() => ({
  47777. ...initProps,
  47778. ...props.props
  47779. }));
  47780. };
  47781. const useCheck$1 = (props, panelState, emit) => {
  47782. const propsAlias = usePropsAlias(props);
  47783. const filteredData = vue.computed(() => {
  47784. return props.data.filter((item) => {
  47785. if (isFunction(props.filterMethod)) {
  47786. return props.filterMethod(panelState.query, item);
  47787. } else {
  47788. const label = String(item[propsAlias.value.label] || item[propsAlias.value.key]);
  47789. return label.toLowerCase().includes(panelState.query.toLowerCase());
  47790. }
  47791. });
  47792. });
  47793. const checkableData = vue.computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled]));
  47794. const checkedSummary = vue.computed(() => {
  47795. const checkedLength = panelState.checked.length;
  47796. const dataLength = props.data.length;
  47797. const { noChecked, hasChecked } = props.format;
  47798. if (noChecked && hasChecked) {
  47799. return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString());
  47800. } else {
  47801. return `${checkedLength}/${dataLength}`;
  47802. }
  47803. });
  47804. const isIndeterminate = vue.computed(() => {
  47805. const checkedLength = panelState.checked.length;
  47806. return checkedLength > 0 && checkedLength < checkableData.value.length;
  47807. });
  47808. const updateAllChecked = () => {
  47809. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  47810. panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item));
  47811. };
  47812. const handleAllCheckedChange = (value) => {
  47813. panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : [];
  47814. };
  47815. vue.watch(() => panelState.checked, (val, oldVal) => {
  47816. updateAllChecked();
  47817. if (panelState.checkChangeByUser) {
  47818. const movedKeys = val.concat(oldVal).filter((v) => !val.includes(v) || !oldVal.includes(v));
  47819. emit(CHECKED_CHANGE_EVENT, val, movedKeys);
  47820. } else {
  47821. emit(CHECKED_CHANGE_EVENT, val);
  47822. panelState.checkChangeByUser = true;
  47823. }
  47824. });
  47825. vue.watch(checkableData, () => {
  47826. updateAllChecked();
  47827. });
  47828. vue.watch(() => props.data, () => {
  47829. const checked = [];
  47830. const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]);
  47831. panelState.checked.forEach((item) => {
  47832. if (filteredDataKeys.includes(item)) {
  47833. checked.push(item);
  47834. }
  47835. });
  47836. panelState.checkChangeByUser = false;
  47837. panelState.checked = checked;
  47838. });
  47839. vue.watch(() => props.defaultChecked, (val, oldVal) => {
  47840. if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item)))
  47841. return;
  47842. const checked = [];
  47843. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  47844. val.forEach((item) => {
  47845. if (checkableDataKeys.includes(item)) {
  47846. checked.push(item);
  47847. }
  47848. });
  47849. panelState.checkChangeByUser = false;
  47850. panelState.checked = checked;
  47851. }, {
  47852. immediate: true
  47853. });
  47854. return {
  47855. filteredData,
  47856. checkableData,
  47857. checkedSummary,
  47858. isIndeterminate,
  47859. updateAllChecked,
  47860. handleAllCheckedChange
  47861. };
  47862. };
  47863. const useCheckedChange = (checkedState, emit) => {
  47864. const onSourceCheckedChange = (val, movedKeys) => {
  47865. checkedState.leftChecked = val;
  47866. if (!movedKeys)
  47867. return;
  47868. emit(LEFT_CHECK_CHANGE_EVENT, val, movedKeys);
  47869. };
  47870. const onTargetCheckedChange = (val, movedKeys) => {
  47871. checkedState.rightChecked = val;
  47872. if (!movedKeys)
  47873. return;
  47874. emit(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys);
  47875. };
  47876. return {
  47877. onSourceCheckedChange,
  47878. onTargetCheckedChange
  47879. };
  47880. };
  47881. const useComputedData = (props) => {
  47882. const propsAlias = usePropsAlias(props);
  47883. const dataObj = vue.computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur) && o, {}));
  47884. const sourceData = vue.computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key])));
  47885. const targetData = vue.computed(() => {
  47886. if (props.targetOrder === "original") {
  47887. return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
  47888. } else {
  47889. return props.modelValue.reduce((arr, cur) => {
  47890. const val = dataObj.value[cur];
  47891. if (val) {
  47892. arr.push(val);
  47893. }
  47894. return arr;
  47895. }, []);
  47896. }
  47897. });
  47898. return {
  47899. sourceData,
  47900. targetData
  47901. };
  47902. };
  47903. const useMove = (props, checkedState, emit) => {
  47904. const propsAlias = usePropsAlias(props);
  47905. const _emit = (value, direction, movedKeys) => {
  47906. emit(UPDATE_MODEL_EVENT, value);
  47907. emit(CHANGE_EVENT, value, direction, movedKeys);
  47908. };
  47909. const addToLeft = () => {
  47910. const currentValue = props.modelValue.slice();
  47911. checkedState.rightChecked.forEach((item) => {
  47912. const index = currentValue.indexOf(item);
  47913. if (index > -1) {
  47914. currentValue.splice(index, 1);
  47915. }
  47916. });
  47917. _emit(currentValue, "left", checkedState.rightChecked);
  47918. };
  47919. const addToRight = () => {
  47920. let currentValue = props.modelValue.slice();
  47921. const itemsToBeMoved = props.data.filter((item) => {
  47922. const itemKey = item[propsAlias.value.key];
  47923. return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey);
  47924. }).map((item) => item[propsAlias.value.key]);
  47925. currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  47926. if (props.targetOrder === "original") {
  47927. currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]);
  47928. }
  47929. _emit(currentValue, "right", checkedState.leftChecked);
  47930. };
  47931. return {
  47932. addToLeft,
  47933. addToRight
  47934. };
  47935. };
  47936. const __default__$9 = vue.defineComponent({
  47937. name: "ElTransferPanel"
  47938. });
  47939. const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
  47940. ...__default__$9,
  47941. props: transferPanelProps,
  47942. emits: transferPanelEmits,
  47943. setup(__props, { expose, emit }) {
  47944. const props = __props;
  47945. const slots = vue.useSlots();
  47946. const OptionContent = ({ option }) => option;
  47947. const { t } = useLocale();
  47948. const ns = useNamespace("transfer");
  47949. const panelState = vue.reactive({
  47950. checked: [],
  47951. allChecked: false,
  47952. query: "",
  47953. inputHover: false,
  47954. checkChangeByUser: true
  47955. });
  47956. const propsAlias = usePropsAlias(props);
  47957. const {
  47958. filteredData,
  47959. checkedSummary,
  47960. isIndeterminate,
  47961. handleAllCheckedChange
  47962. } = useCheck$1(props, panelState, emit);
  47963. const hasNoMatch = vue.computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value));
  47964. const hasFooter = vue.computed(() => !isEmpty(slots.default()[0].children));
  47965. const { checked, allChecked, query, inputHover } = vue.toRefs(panelState);
  47966. expose({
  47967. query
  47968. });
  47969. return (_ctx, _cache) => {
  47970. return vue.openBlock(), vue.createElementBlock("div", {
  47971. class: vue.normalizeClass(vue.unref(ns).b("panel"))
  47972. }, [
  47973. vue.createElementVNode("p", {
  47974. class: vue.normalizeClass(vue.unref(ns).be("panel", "header"))
  47975. }, [
  47976. vue.createVNode(vue.unref(ElCheckbox), {
  47977. modelValue: vue.unref(allChecked),
  47978. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(allChecked) ? allChecked.value = $event : null),
  47979. indeterminate: vue.unref(isIndeterminate),
  47980. "validate-event": false,
  47981. onChange: vue.unref(handleAllCheckedChange)
  47982. }, {
  47983. default: vue.withCtx(() => [
  47984. vue.createTextVNode(vue.toDisplayString(_ctx.title) + " ", 1),
  47985. vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(checkedSummary)), 1)
  47986. ]),
  47987. _: 1
  47988. }, 8, ["modelValue", "indeterminate", "onChange"])
  47989. ], 2),
  47990. vue.createElementVNode("div", {
  47991. class: vue.normalizeClass([vue.unref(ns).be("panel", "body"), vue.unref(ns).is("with-footer", vue.unref(hasFooter))])
  47992. }, [
  47993. _ctx.filterable ? (vue.openBlock(), vue.createBlock(vue.unref(ElInput), {
  47994. key: 0,
  47995. modelValue: vue.unref(query),
  47996. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => vue.isRef(query) ? query.value = $event : null),
  47997. class: vue.normalizeClass(vue.unref(ns).be("panel", "filter")),
  47998. size: "default",
  47999. placeholder: _ctx.placeholder,
  48000. "prefix-icon": vue.unref(search_default),
  48001. clearable: "",
  48002. "validate-event": false,
  48003. onMouseenter: _cache[2] || (_cache[2] = ($event) => inputHover.value = true),
  48004. onMouseleave: _cache[3] || (_cache[3] = ($event) => inputHover.value = false)
  48005. }, null, 8, ["modelValue", "class", "placeholder", "prefix-icon"])) : vue.createCommentVNode("v-if", true),
  48006. vue.withDirectives(vue.createVNode(vue.unref(ElCheckboxGroup$1), {
  48007. modelValue: vue.unref(checked),
  48008. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => vue.isRef(checked) ? checked.value = $event : null),
  48009. "validate-event": false,
  48010. class: vue.normalizeClass([vue.unref(ns).is("filterable", _ctx.filterable), vue.unref(ns).be("panel", "list")])
  48011. }, {
  48012. default: vue.withCtx(() => [
  48013. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(filteredData), (item) => {
  48014. return vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  48015. key: item[vue.unref(propsAlias).key],
  48016. class: vue.normalizeClass(vue.unref(ns).be("panel", "item")),
  48017. label: item[vue.unref(propsAlias).key],
  48018. disabled: item[vue.unref(propsAlias).disabled],
  48019. "validate-event": false
  48020. }, {
  48021. default: vue.withCtx(() => {
  48022. var _a;
  48023. return [
  48024. vue.createVNode(OptionContent, {
  48025. option: (_a = _ctx.optionRender) == null ? void 0 : _a.call(_ctx, item)
  48026. }, null, 8, ["option"])
  48027. ];
  48028. }),
  48029. _: 2
  48030. }, 1032, ["class", "label", "disabled"]);
  48031. }), 128))
  48032. ]),
  48033. _: 1
  48034. }, 8, ["modelValue", "class"]), [
  48035. [vue.vShow, !vue.unref(hasNoMatch) && !vue.unref(isEmpty)(_ctx.data)]
  48036. ]),
  48037. vue.withDirectives(vue.createElementVNode("p", {
  48038. class: vue.normalizeClass(vue.unref(ns).be("panel", "empty"))
  48039. }, vue.toDisplayString(vue.unref(hasNoMatch) ? vue.unref(t)("el.transfer.noMatch") : vue.unref(t)("el.transfer.noData")), 3), [
  48040. [vue.vShow, vue.unref(hasNoMatch) || vue.unref(isEmpty)(_ctx.data)]
  48041. ])
  48042. ], 2),
  48043. vue.unref(hasFooter) ? (vue.openBlock(), vue.createElementBlock("p", {
  48044. key: 0,
  48045. class: vue.normalizeClass(vue.unref(ns).be("panel", "footer"))
  48046. }, [
  48047. vue.renderSlot(_ctx.$slots, "default")
  48048. ], 2)) : vue.createCommentVNode("v-if", true)
  48049. ], 2);
  48050. };
  48051. }
  48052. });
  48053. var TransferPanel = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["__file", "transfer-panel.vue"]]);
  48054. const _hoisted_1$8 = { key: 0 };
  48055. const _hoisted_2$6 = { key: 0 };
  48056. const __default__$8 = vue.defineComponent({
  48057. name: "ElTransfer"
  48058. });
  48059. const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
  48060. ...__default__$8,
  48061. props: transferProps,
  48062. emits: transferEmits,
  48063. setup(__props, { expose, emit }) {
  48064. const props = __props;
  48065. const slots = vue.useSlots();
  48066. const { t } = useLocale();
  48067. const ns = useNamespace("transfer");
  48068. const { formItem } = useFormItem();
  48069. const checkedState = vue.reactive({
  48070. leftChecked: [],
  48071. rightChecked: []
  48072. });
  48073. const propsAlias = usePropsAlias(props);
  48074. const { sourceData, targetData } = useComputedData(props);
  48075. const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit);
  48076. const { addToLeft, addToRight } = useMove(props, checkedState, emit);
  48077. const leftPanel = vue.ref();
  48078. const rightPanel = vue.ref();
  48079. const clearQuery = (which) => {
  48080. switch (which) {
  48081. case "left":
  48082. leftPanel.value.query = "";
  48083. break;
  48084. case "right":
  48085. rightPanel.value.query = "";
  48086. break;
  48087. }
  48088. };
  48089. const hasButtonTexts = vue.computed(() => props.buttonTexts.length === 2);
  48090. const leftPanelTitle = vue.computed(() => props.titles[0] || t("el.transfer.titles.0"));
  48091. const rightPanelTitle = vue.computed(() => props.titles[1] || t("el.transfer.titles.1"));
  48092. const panelFilterPlaceholder = vue.computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder"));
  48093. vue.watch(() => props.modelValue, () => {
  48094. var _a;
  48095. if (props.validateEvent) {
  48096. (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change").catch((err) => debugWarn());
  48097. }
  48098. });
  48099. const optionRender = vue.computed(() => (option) => {
  48100. if (props.renderContent)
  48101. return props.renderContent(vue.h, option);
  48102. if (slots.default)
  48103. return slots.default({ option });
  48104. return vue.h("span", option[propsAlias.value.label] || option[propsAlias.value.key]);
  48105. });
  48106. expose({
  48107. clearQuery,
  48108. leftPanel,
  48109. rightPanel
  48110. });
  48111. return (_ctx, _cache) => {
  48112. return vue.openBlock(), vue.createElementBlock("div", {
  48113. class: vue.normalizeClass(vue.unref(ns).b())
  48114. }, [
  48115. vue.createVNode(TransferPanel, {
  48116. ref_key: "leftPanel",
  48117. ref: leftPanel,
  48118. data: vue.unref(sourceData),
  48119. "option-render": vue.unref(optionRender),
  48120. placeholder: vue.unref(panelFilterPlaceholder),
  48121. title: vue.unref(leftPanelTitle),
  48122. filterable: _ctx.filterable,
  48123. format: _ctx.format,
  48124. "filter-method": _ctx.filterMethod,
  48125. "default-checked": _ctx.leftDefaultChecked,
  48126. props: props.props,
  48127. onCheckedChange: vue.unref(onSourceCheckedChange)
  48128. }, {
  48129. default: vue.withCtx(() => [
  48130. vue.renderSlot(_ctx.$slots, "left-footer")
  48131. ]),
  48132. _: 3
  48133. }, 8, ["data", "option-render", "placeholder", "title", "filterable", "format", "filter-method", "default-checked", "props", "onCheckedChange"]),
  48134. vue.createElementVNode("div", {
  48135. class: vue.normalizeClass(vue.unref(ns).e("buttons"))
  48136. }, [
  48137. vue.createVNode(vue.unref(ElButton), {
  48138. type: "primary",
  48139. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  48140. disabled: vue.unref(isEmpty)(checkedState.rightChecked),
  48141. onClick: vue.unref(addToLeft)
  48142. }, {
  48143. default: vue.withCtx(() => [
  48144. vue.createVNode(vue.unref(ElIcon), null, {
  48145. default: vue.withCtx(() => [
  48146. vue.createVNode(vue.unref(arrow_left_default))
  48147. ]),
  48148. _: 1
  48149. }),
  48150. !vue.unref(isUndefined)(_ctx.buttonTexts[0]) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_1$8, vue.toDisplayString(_ctx.buttonTexts[0]), 1)) : vue.createCommentVNode("v-if", true)
  48151. ]),
  48152. _: 1
  48153. }, 8, ["class", "disabled", "onClick"]),
  48154. vue.createVNode(vue.unref(ElButton), {
  48155. type: "primary",
  48156. class: vue.normalizeClass([vue.unref(ns).e("button"), vue.unref(ns).is("with-texts", vue.unref(hasButtonTexts))]),
  48157. disabled: vue.unref(isEmpty)(checkedState.leftChecked),
  48158. onClick: vue.unref(addToRight)
  48159. }, {
  48160. default: vue.withCtx(() => [
  48161. !vue.unref(isUndefined)(_ctx.buttonTexts[1]) ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_2$6, vue.toDisplayString(_ctx.buttonTexts[1]), 1)) : vue.createCommentVNode("v-if", true),
  48162. vue.createVNode(vue.unref(ElIcon), null, {
  48163. default: vue.withCtx(() => [
  48164. vue.createVNode(vue.unref(arrow_right_default))
  48165. ]),
  48166. _: 1
  48167. })
  48168. ]),
  48169. _: 1
  48170. }, 8, ["class", "disabled", "onClick"])
  48171. ], 2),
  48172. vue.createVNode(TransferPanel, {
  48173. ref_key: "rightPanel",
  48174. ref: rightPanel,
  48175. data: vue.unref(targetData),
  48176. "option-render": vue.unref(optionRender),
  48177. placeholder: vue.unref(panelFilterPlaceholder),
  48178. filterable: _ctx.filterable,
  48179. format: _ctx.format,
  48180. "filter-method": _ctx.filterMethod,
  48181. title: vue.unref(rightPanelTitle),
  48182. "default-checked": _ctx.rightDefaultChecked,
  48183. props: props.props,
  48184. onCheckedChange: vue.unref(onTargetCheckedChange)
  48185. }, {
  48186. default: vue.withCtx(() => [
  48187. vue.renderSlot(_ctx.$slots, "right-footer")
  48188. ]),
  48189. _: 3
  48190. }, 8, ["data", "option-render", "placeholder", "filterable", "format", "filter-method", "title", "default-checked", "props", "onCheckedChange"])
  48191. ], 2);
  48192. };
  48193. }
  48194. });
  48195. var Transfer = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["__file", "transfer.vue"]]);
  48196. const ElTransfer = withInstall(Transfer);
  48197. const NODE_KEY = "$treeNodeId";
  48198. const markNodeData = function(node, data) {
  48199. if (!data || data[NODE_KEY])
  48200. return;
  48201. Object.defineProperty(data, NODE_KEY, {
  48202. value: node.id,
  48203. enumerable: false,
  48204. configurable: false,
  48205. writable: false
  48206. });
  48207. };
  48208. const getNodeKey = function(key, data) {
  48209. if (!key)
  48210. return data[NODE_KEY];
  48211. return data[key];
  48212. };
  48213. const handleCurrentChange = (store, emit, setCurrent) => {
  48214. const preCurrentNode = store.value.currentNode;
  48215. setCurrent();
  48216. const currentNode = store.value.currentNode;
  48217. if (preCurrentNode === currentNode)
  48218. return;
  48219. emit("current-change", currentNode ? currentNode.data : null, currentNode);
  48220. };
  48221. const getChildState = (node) => {
  48222. let all = true;
  48223. let none = true;
  48224. let allWithoutDisable = true;
  48225. for (let i = 0, j = node.length; i < j; i++) {
  48226. const n = node[i];
  48227. if (n.checked !== true || n.indeterminate) {
  48228. all = false;
  48229. if (!n.disabled) {
  48230. allWithoutDisable = false;
  48231. }
  48232. }
  48233. if (n.checked !== false || n.indeterminate) {
  48234. none = false;
  48235. }
  48236. }
  48237. return { all, none, allWithoutDisable, half: !all && !none };
  48238. };
  48239. const reInitChecked = function(node) {
  48240. if (node.childNodes.length === 0 || node.loading)
  48241. return;
  48242. const { all, none, half } = getChildState(node.childNodes);
  48243. if (all) {
  48244. node.checked = true;
  48245. node.indeterminate = false;
  48246. } else if (half) {
  48247. node.checked = false;
  48248. node.indeterminate = true;
  48249. } else if (none) {
  48250. node.checked = false;
  48251. node.indeterminate = false;
  48252. }
  48253. const parent = node.parent;
  48254. if (!parent || parent.level === 0)
  48255. return;
  48256. if (!node.store.checkStrictly) {
  48257. reInitChecked(parent);
  48258. }
  48259. };
  48260. const getPropertyFromData = function(node, prop) {
  48261. const props = node.store.props;
  48262. const data = node.data || {};
  48263. const config = props[prop];
  48264. if (typeof config === "function") {
  48265. return config(data, node);
  48266. } else if (typeof config === "string") {
  48267. return data[config];
  48268. } else if (typeof config === "undefined") {
  48269. const dataProp = data[prop];
  48270. return dataProp === void 0 ? "" : dataProp;
  48271. }
  48272. };
  48273. let nodeIdSeed = 0;
  48274. class Node {
  48275. constructor(options) {
  48276. this.id = nodeIdSeed++;
  48277. this.text = null;
  48278. this.checked = false;
  48279. this.indeterminate = false;
  48280. this.data = null;
  48281. this.expanded = false;
  48282. this.parent = null;
  48283. this.visible = true;
  48284. this.isCurrent = false;
  48285. this.canFocus = false;
  48286. for (const name in options) {
  48287. if (hasOwn(options, name)) {
  48288. this[name] = options[name];
  48289. }
  48290. }
  48291. this.level = 0;
  48292. this.loaded = false;
  48293. this.childNodes = [];
  48294. this.loading = false;
  48295. if (this.parent) {
  48296. this.level = this.parent.level + 1;
  48297. }
  48298. }
  48299. initialize() {
  48300. const store = this.store;
  48301. if (!store) {
  48302. throw new Error("[Node]store is required!");
  48303. }
  48304. store.registerNode(this);
  48305. const props = store.props;
  48306. if (props && typeof props.isLeaf !== "undefined") {
  48307. const isLeaf = getPropertyFromData(this, "isLeaf");
  48308. if (typeof isLeaf === "boolean") {
  48309. this.isLeafByUser = isLeaf;
  48310. }
  48311. }
  48312. if (store.lazy !== true && this.data) {
  48313. this.setData(this.data);
  48314. if (store.defaultExpandAll) {
  48315. this.expanded = true;
  48316. this.canFocus = true;
  48317. }
  48318. } else if (this.level > 0 && store.lazy && store.defaultExpandAll) {
  48319. this.expand();
  48320. }
  48321. if (!Array.isArray(this.data)) {
  48322. markNodeData(this, this.data);
  48323. }
  48324. if (!this.data)
  48325. return;
  48326. const defaultExpandedKeys = store.defaultExpandedKeys;
  48327. const key = store.key;
  48328. if (key && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) {
  48329. this.expand(null, store.autoExpandParent);
  48330. }
  48331. if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
  48332. store.currentNode = this;
  48333. store.currentNode.isCurrent = true;
  48334. }
  48335. if (store.lazy) {
  48336. store._initDefaultCheckedNode(this);
  48337. }
  48338. this.updateLeafState();
  48339. if (this.parent && (this.level === 1 || this.parent.expanded === true))
  48340. this.canFocus = true;
  48341. }
  48342. setData(data) {
  48343. if (!Array.isArray(data)) {
  48344. markNodeData(this, data);
  48345. }
  48346. this.data = data;
  48347. this.childNodes = [];
  48348. let children;
  48349. if (this.level === 0 && Array.isArray(this.data)) {
  48350. children = this.data;
  48351. } else {
  48352. children = getPropertyFromData(this, "children") || [];
  48353. }
  48354. for (let i = 0, j = children.length; i < j; i++) {
  48355. this.insertChild({ data: children[i] });
  48356. }
  48357. }
  48358. get label() {
  48359. return getPropertyFromData(this, "label");
  48360. }
  48361. get key() {
  48362. const nodeKey = this.store.key;
  48363. if (this.data)
  48364. return this.data[nodeKey];
  48365. return null;
  48366. }
  48367. get disabled() {
  48368. return getPropertyFromData(this, "disabled");
  48369. }
  48370. get nextSibling() {
  48371. const parent = this.parent;
  48372. if (parent) {
  48373. const index = parent.childNodes.indexOf(this);
  48374. if (index > -1) {
  48375. return parent.childNodes[index + 1];
  48376. }
  48377. }
  48378. return null;
  48379. }
  48380. get previousSibling() {
  48381. const parent = this.parent;
  48382. if (parent) {
  48383. const index = parent.childNodes.indexOf(this);
  48384. if (index > -1) {
  48385. return index > 0 ? parent.childNodes[index - 1] : null;
  48386. }
  48387. }
  48388. return null;
  48389. }
  48390. contains(target, deep = true) {
  48391. return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
  48392. }
  48393. remove() {
  48394. const parent = this.parent;
  48395. if (parent) {
  48396. parent.removeChild(this);
  48397. }
  48398. }
  48399. insertChild(child, index, batch) {
  48400. if (!child)
  48401. throw new Error("InsertChild error: child is required.");
  48402. if (!(child instanceof Node)) {
  48403. if (!batch) {
  48404. const children = this.getChildren(true);
  48405. if (!children.includes(child.data)) {
  48406. if (typeof index === "undefined" || index < 0) {
  48407. children.push(child.data);
  48408. } else {
  48409. children.splice(index, 0, child.data);
  48410. }
  48411. }
  48412. }
  48413. Object.assign(child, {
  48414. parent: this,
  48415. store: this.store
  48416. });
  48417. child = vue.reactive(new Node(child));
  48418. if (child instanceof Node) {
  48419. child.initialize();
  48420. }
  48421. }
  48422. child.level = this.level + 1;
  48423. if (typeof index === "undefined" || index < 0) {
  48424. this.childNodes.push(child);
  48425. } else {
  48426. this.childNodes.splice(index, 0, child);
  48427. }
  48428. this.updateLeafState();
  48429. }
  48430. insertBefore(child, ref) {
  48431. let index;
  48432. if (ref) {
  48433. index = this.childNodes.indexOf(ref);
  48434. }
  48435. this.insertChild(child, index);
  48436. }
  48437. insertAfter(child, ref) {
  48438. let index;
  48439. if (ref) {
  48440. index = this.childNodes.indexOf(ref);
  48441. if (index !== -1)
  48442. index += 1;
  48443. }
  48444. this.insertChild(child, index);
  48445. }
  48446. removeChild(child) {
  48447. const children = this.getChildren() || [];
  48448. const dataIndex = children.indexOf(child.data);
  48449. if (dataIndex > -1) {
  48450. children.splice(dataIndex, 1);
  48451. }
  48452. const index = this.childNodes.indexOf(child);
  48453. if (index > -1) {
  48454. this.store && this.store.deregisterNode(child);
  48455. child.parent = null;
  48456. this.childNodes.splice(index, 1);
  48457. }
  48458. this.updateLeafState();
  48459. }
  48460. removeChildByData(data) {
  48461. let targetNode = null;
  48462. for (let i = 0; i < this.childNodes.length; i++) {
  48463. if (this.childNodes[i].data === data) {
  48464. targetNode = this.childNodes[i];
  48465. break;
  48466. }
  48467. }
  48468. if (targetNode) {
  48469. this.removeChild(targetNode);
  48470. }
  48471. }
  48472. expand(callback, expandParent) {
  48473. const done = () => {
  48474. if (expandParent) {
  48475. let parent = this.parent;
  48476. while (parent.level > 0) {
  48477. parent.expanded = true;
  48478. parent = parent.parent;
  48479. }
  48480. }
  48481. this.expanded = true;
  48482. if (callback)
  48483. callback();
  48484. this.childNodes.forEach((item) => {
  48485. item.canFocus = true;
  48486. });
  48487. };
  48488. if (this.shouldLoadData()) {
  48489. this.loadData((data) => {
  48490. if (Array.isArray(data)) {
  48491. if (this.checked) {
  48492. this.setChecked(true, true);
  48493. } else if (!this.store.checkStrictly) {
  48494. reInitChecked(this);
  48495. }
  48496. done();
  48497. }
  48498. });
  48499. } else {
  48500. done();
  48501. }
  48502. }
  48503. doCreateChildren(array, defaultProps = {}) {
  48504. array.forEach((item) => {
  48505. this.insertChild(Object.assign({ data: item }, defaultProps), void 0, true);
  48506. });
  48507. }
  48508. collapse() {
  48509. this.expanded = false;
  48510. this.childNodes.forEach((item) => {
  48511. item.canFocus = false;
  48512. });
  48513. }
  48514. shouldLoadData() {
  48515. return this.store.lazy === true && this.store.load && !this.loaded;
  48516. }
  48517. updateLeafState() {
  48518. if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
  48519. this.isLeaf = this.isLeafByUser;
  48520. return;
  48521. }
  48522. const childNodes = this.childNodes;
  48523. if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
  48524. this.isLeaf = !childNodes || childNodes.length === 0;
  48525. return;
  48526. }
  48527. this.isLeaf = false;
  48528. }
  48529. setChecked(value, deep, recursion, passValue) {
  48530. this.indeterminate = value === "half";
  48531. this.checked = value === true;
  48532. if (this.store.checkStrictly)
  48533. return;
  48534. if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
  48535. const { all, allWithoutDisable } = getChildState(this.childNodes);
  48536. if (!this.isLeaf && !all && allWithoutDisable) {
  48537. this.checked = false;
  48538. value = false;
  48539. }
  48540. const handleDescendants = () => {
  48541. if (deep) {
  48542. const childNodes = this.childNodes;
  48543. for (let i = 0, j = childNodes.length; i < j; i++) {
  48544. const child = childNodes[i];
  48545. passValue = passValue || value !== false;
  48546. const isCheck = child.disabled ? child.checked : passValue;
  48547. child.setChecked(isCheck, deep, true, passValue);
  48548. }
  48549. const { half, all: all2 } = getChildState(childNodes);
  48550. if (!all2) {
  48551. this.checked = all2;
  48552. this.indeterminate = half;
  48553. }
  48554. }
  48555. };
  48556. if (this.shouldLoadData()) {
  48557. this.loadData(() => {
  48558. handleDescendants();
  48559. reInitChecked(this);
  48560. }, {
  48561. checked: value !== false
  48562. });
  48563. return;
  48564. } else {
  48565. handleDescendants();
  48566. }
  48567. }
  48568. const parent = this.parent;
  48569. if (!parent || parent.level === 0)
  48570. return;
  48571. if (!recursion) {
  48572. reInitChecked(parent);
  48573. }
  48574. }
  48575. getChildren(forceInit = false) {
  48576. if (this.level === 0)
  48577. return this.data;
  48578. const data = this.data;
  48579. if (!data)
  48580. return null;
  48581. const props = this.store.props;
  48582. let children = "children";
  48583. if (props) {
  48584. children = props.children || "children";
  48585. }
  48586. if (data[children] === void 0) {
  48587. data[children] = null;
  48588. }
  48589. if (forceInit && !data[children]) {
  48590. data[children] = [];
  48591. }
  48592. return data[children];
  48593. }
  48594. updateChildren() {
  48595. const newData = this.getChildren() || [];
  48596. const oldData = this.childNodes.map((node) => node.data);
  48597. const newDataMap = {};
  48598. const newNodes = [];
  48599. newData.forEach((item, index) => {
  48600. const key = item[NODE_KEY];
  48601. const isNodeExists = !!key && oldData.findIndex((data) => data[NODE_KEY] === key) >= 0;
  48602. if (isNodeExists) {
  48603. newDataMap[key] = { index, data: item };
  48604. } else {
  48605. newNodes.push({ index, data: item });
  48606. }
  48607. });
  48608. if (!this.store.lazy) {
  48609. oldData.forEach((item) => {
  48610. if (!newDataMap[item[NODE_KEY]])
  48611. this.removeChildByData(item);
  48612. });
  48613. }
  48614. newNodes.forEach(({ index, data }) => {
  48615. this.insertChild({ data }, index);
  48616. });
  48617. this.updateLeafState();
  48618. }
  48619. loadData(callback, defaultProps = {}) {
  48620. if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
  48621. this.loading = true;
  48622. const resolve = (children) => {
  48623. this.childNodes = [];
  48624. this.doCreateChildren(children, defaultProps);
  48625. this.loaded = true;
  48626. this.loading = false;
  48627. this.updateLeafState();
  48628. if (callback) {
  48629. callback.call(this, children);
  48630. }
  48631. };
  48632. this.store.load(this, resolve);
  48633. } else {
  48634. if (callback) {
  48635. callback.call(this);
  48636. }
  48637. }
  48638. }
  48639. }
  48640. var Node$1 = Node;
  48641. class TreeStore {
  48642. constructor(options) {
  48643. this.currentNode = null;
  48644. this.currentNodeKey = null;
  48645. for (const option in options) {
  48646. if (hasOwn(options, option)) {
  48647. this[option] = options[option];
  48648. }
  48649. }
  48650. this.nodesMap = {};
  48651. }
  48652. initialize() {
  48653. this.root = new Node$1({
  48654. data: this.data,
  48655. store: this
  48656. });
  48657. this.root.initialize();
  48658. if (this.lazy && this.load) {
  48659. const loadFn = this.load;
  48660. loadFn(this.root, (data) => {
  48661. this.root.doCreateChildren(data);
  48662. this._initDefaultCheckedNodes();
  48663. });
  48664. } else {
  48665. this._initDefaultCheckedNodes();
  48666. }
  48667. }
  48668. filter(value) {
  48669. const filterNodeMethod = this.filterNodeMethod;
  48670. const lazy = this.lazy;
  48671. const traverse = function(node) {
  48672. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  48673. childNodes.forEach((child) => {
  48674. child.visible = filterNodeMethod.call(child, value, child.data, child);
  48675. traverse(child);
  48676. });
  48677. if (!node.visible && childNodes.length) {
  48678. let allHidden = true;
  48679. allHidden = !childNodes.some((child) => child.visible);
  48680. if (node.root) {
  48681. node.root.visible = allHidden === false;
  48682. } else {
  48683. node.visible = allHidden === false;
  48684. }
  48685. }
  48686. if (!value)
  48687. return;
  48688. if (node.visible && !node.isLeaf && !lazy)
  48689. node.expand();
  48690. };
  48691. traverse(this);
  48692. }
  48693. setData(newVal) {
  48694. const instanceChanged = newVal !== this.root.data;
  48695. if (instanceChanged) {
  48696. this.root.setData(newVal);
  48697. this._initDefaultCheckedNodes();
  48698. } else {
  48699. this.root.updateChildren();
  48700. }
  48701. }
  48702. getNode(data) {
  48703. if (data instanceof Node$1)
  48704. return data;
  48705. const key = isObject$1(data) ? getNodeKey(this.key, data) : data;
  48706. return this.nodesMap[key] || null;
  48707. }
  48708. insertBefore(data, refData) {
  48709. const refNode = this.getNode(refData);
  48710. refNode.parent.insertBefore({ data }, refNode);
  48711. }
  48712. insertAfter(data, refData) {
  48713. const refNode = this.getNode(refData);
  48714. refNode.parent.insertAfter({ data }, refNode);
  48715. }
  48716. remove(data) {
  48717. const node = this.getNode(data);
  48718. if (node && node.parent) {
  48719. if (node === this.currentNode) {
  48720. this.currentNode = null;
  48721. }
  48722. node.parent.removeChild(node);
  48723. }
  48724. }
  48725. append(data, parentData) {
  48726. const parentNode = parentData ? this.getNode(parentData) : this.root;
  48727. if (parentNode) {
  48728. parentNode.insertChild({ data });
  48729. }
  48730. }
  48731. _initDefaultCheckedNodes() {
  48732. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  48733. const nodesMap = this.nodesMap;
  48734. defaultCheckedKeys.forEach((checkedKey) => {
  48735. const node = nodesMap[checkedKey];
  48736. if (node) {
  48737. node.setChecked(true, !this.checkStrictly);
  48738. }
  48739. });
  48740. }
  48741. _initDefaultCheckedNode(node) {
  48742. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  48743. if (defaultCheckedKeys.includes(node.key)) {
  48744. node.setChecked(true, !this.checkStrictly);
  48745. }
  48746. }
  48747. setDefaultCheckedKey(newVal) {
  48748. if (newVal !== this.defaultCheckedKeys) {
  48749. this.defaultCheckedKeys = newVal;
  48750. this._initDefaultCheckedNodes();
  48751. }
  48752. }
  48753. registerNode(node) {
  48754. const key = this.key;
  48755. if (!node || !node.data)
  48756. return;
  48757. if (!key) {
  48758. this.nodesMap[node.id] = node;
  48759. } else {
  48760. const nodeKey = node.key;
  48761. if (nodeKey !== void 0)
  48762. this.nodesMap[node.key] = node;
  48763. }
  48764. }
  48765. deregisterNode(node) {
  48766. const key = this.key;
  48767. if (!key || !node || !node.data)
  48768. return;
  48769. node.childNodes.forEach((child) => {
  48770. this.deregisterNode(child);
  48771. });
  48772. delete this.nodesMap[node.key];
  48773. }
  48774. getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
  48775. const checkedNodes = [];
  48776. const traverse = function(node) {
  48777. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  48778. childNodes.forEach((child) => {
  48779. if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) {
  48780. checkedNodes.push(child.data);
  48781. }
  48782. traverse(child);
  48783. });
  48784. };
  48785. traverse(this);
  48786. return checkedNodes;
  48787. }
  48788. getCheckedKeys(leafOnly = false) {
  48789. return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
  48790. }
  48791. getHalfCheckedNodes() {
  48792. const nodes = [];
  48793. const traverse = function(node) {
  48794. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  48795. childNodes.forEach((child) => {
  48796. if (child.indeterminate) {
  48797. nodes.push(child.data);
  48798. }
  48799. traverse(child);
  48800. });
  48801. };
  48802. traverse(this);
  48803. return nodes;
  48804. }
  48805. getHalfCheckedKeys() {
  48806. return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
  48807. }
  48808. _getAllNodes() {
  48809. const allNodes = [];
  48810. const nodesMap = this.nodesMap;
  48811. for (const nodeKey in nodesMap) {
  48812. if (hasOwn(nodesMap, nodeKey)) {
  48813. allNodes.push(nodesMap[nodeKey]);
  48814. }
  48815. }
  48816. return allNodes;
  48817. }
  48818. updateChildren(key, data) {
  48819. const node = this.nodesMap[key];
  48820. if (!node)
  48821. return;
  48822. const childNodes = node.childNodes;
  48823. for (let i = childNodes.length - 1; i >= 0; i--) {
  48824. const child = childNodes[i];
  48825. this.remove(child.data);
  48826. }
  48827. for (let i = 0, j = data.length; i < j; i++) {
  48828. const child = data[i];
  48829. this.append(child, node.data);
  48830. }
  48831. }
  48832. _setCheckedKeys(key, leafOnly = false, checkedKeys) {
  48833. const allNodes = this._getAllNodes().sort((a, b) => b.level - a.level);
  48834. const cache = /* @__PURE__ */ Object.create(null);
  48835. const keys = Object.keys(checkedKeys);
  48836. allNodes.forEach((node) => node.setChecked(false, false));
  48837. for (let i = 0, j = allNodes.length; i < j; i++) {
  48838. const node = allNodes[i];
  48839. const nodeKey = node.data[key].toString();
  48840. const checked = keys.includes(nodeKey);
  48841. if (!checked) {
  48842. if (node.checked && !cache[nodeKey]) {
  48843. node.setChecked(false, false);
  48844. }
  48845. continue;
  48846. }
  48847. let parent = node.parent;
  48848. while (parent && parent.level > 0) {
  48849. cache[parent.data[key]] = true;
  48850. parent = parent.parent;
  48851. }
  48852. if (node.isLeaf || this.checkStrictly) {
  48853. node.setChecked(true, false);
  48854. continue;
  48855. }
  48856. node.setChecked(true, true);
  48857. if (leafOnly) {
  48858. node.setChecked(false, false);
  48859. const traverse = function(node2) {
  48860. const childNodes = node2.childNodes;
  48861. childNodes.forEach((child) => {
  48862. if (!child.isLeaf) {
  48863. child.setChecked(false, false);
  48864. }
  48865. traverse(child);
  48866. });
  48867. };
  48868. traverse(node);
  48869. }
  48870. }
  48871. }
  48872. setCheckedNodes(array, leafOnly = false) {
  48873. const key = this.key;
  48874. const checkedKeys = {};
  48875. array.forEach((item) => {
  48876. checkedKeys[(item || {})[key]] = true;
  48877. });
  48878. this._setCheckedKeys(key, leafOnly, checkedKeys);
  48879. }
  48880. setCheckedKeys(keys, leafOnly = false) {
  48881. this.defaultCheckedKeys = keys;
  48882. const key = this.key;
  48883. const checkedKeys = {};
  48884. keys.forEach((key2) => {
  48885. checkedKeys[key2] = true;
  48886. });
  48887. this._setCheckedKeys(key, leafOnly, checkedKeys);
  48888. }
  48889. setDefaultExpandedKeys(keys) {
  48890. keys = keys || [];
  48891. this.defaultExpandedKeys = keys;
  48892. keys.forEach((key) => {
  48893. const node = this.getNode(key);
  48894. if (node)
  48895. node.expand(null, this.autoExpandParent);
  48896. });
  48897. }
  48898. setChecked(data, checked, deep) {
  48899. const node = this.getNode(data);
  48900. if (node) {
  48901. node.setChecked(!!checked, deep);
  48902. }
  48903. }
  48904. getCurrentNode() {
  48905. return this.currentNode;
  48906. }
  48907. setCurrentNode(currentNode) {
  48908. const prevCurrentNode = this.currentNode;
  48909. if (prevCurrentNode) {
  48910. prevCurrentNode.isCurrent = false;
  48911. }
  48912. this.currentNode = currentNode;
  48913. this.currentNode.isCurrent = true;
  48914. }
  48915. setUserCurrentNode(node, shouldAutoExpandParent = true) {
  48916. const key = node[this.key];
  48917. const currNode = this.nodesMap[key];
  48918. this.setCurrentNode(currNode);
  48919. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  48920. this.currentNode.parent.expand(null, true);
  48921. }
  48922. }
  48923. setCurrentNodeKey(key, shouldAutoExpandParent = true) {
  48924. if (key === null || key === void 0) {
  48925. this.currentNode && (this.currentNode.isCurrent = false);
  48926. this.currentNode = null;
  48927. return;
  48928. }
  48929. const node = this.getNode(key);
  48930. if (node) {
  48931. this.setCurrentNode(node);
  48932. if (shouldAutoExpandParent && this.currentNode.level > 1) {
  48933. this.currentNode.parent.expand(null, true);
  48934. }
  48935. }
  48936. }
  48937. }
  48938. const _sfc_main$c = vue.defineComponent({
  48939. name: "ElTreeNodeContent",
  48940. props: {
  48941. node: {
  48942. type: Object,
  48943. required: true
  48944. },
  48945. renderContent: Function
  48946. },
  48947. setup(props) {
  48948. const ns = useNamespace("tree");
  48949. const nodeInstance = vue.inject("NodeInstance");
  48950. const tree = vue.inject("RootTree");
  48951. return () => {
  48952. const node = props.node;
  48953. const { data, store } = node;
  48954. return props.renderContent ? props.renderContent(vue.h, { _self: nodeInstance, node, data, store }) : vue.h("span", { class: ns.be("node", "label") }, [
  48955. tree.ctx.slots.default ? tree.ctx.slots.default({ node, data }) : node.label
  48956. ]);
  48957. };
  48958. }
  48959. });
  48960. var NodeContent = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["__file", "tree-node-content.vue"]]);
  48961. function useNodeExpandEventBroadcast(props) {
  48962. const parentNodeMap = vue.inject("TreeNodeMap", null);
  48963. const currentNodeMap = {
  48964. treeNodeExpand: (node) => {
  48965. if (props.node !== node) {
  48966. props.node.collapse();
  48967. }
  48968. },
  48969. children: []
  48970. };
  48971. if (parentNodeMap) {
  48972. parentNodeMap.children.push(currentNodeMap);
  48973. }
  48974. vue.provide("TreeNodeMap", currentNodeMap);
  48975. return {
  48976. broadcastExpanded: (node) => {
  48977. if (!props.accordion)
  48978. return;
  48979. for (const childNode of currentNodeMap.children) {
  48980. childNode.treeNodeExpand(node);
  48981. }
  48982. }
  48983. };
  48984. }
  48985. const dragEventsKey = Symbol("dragEvents");
  48986. function useDragNodeHandler({ props, ctx, el$, dropIndicator$, store }) {
  48987. const ns = useNamespace("tree");
  48988. const dragState = vue.ref({
  48989. showDropIndicator: false,
  48990. draggingNode: null,
  48991. dropNode: null,
  48992. allowDrop: true,
  48993. dropType: null
  48994. });
  48995. const treeNodeDragStart = ({ event, treeNode }) => {
  48996. if (typeof props.allowDrag === "function" && !props.allowDrag(treeNode.node)) {
  48997. event.preventDefault();
  48998. return false;
  48999. }
  49000. event.dataTransfer.effectAllowed = "move";
  49001. try {
  49002. event.dataTransfer.setData("text/plain", "");
  49003. } catch (e) {
  49004. }
  49005. dragState.value.draggingNode = treeNode;
  49006. ctx.emit("node-drag-start", treeNode.node, event);
  49007. };
  49008. const treeNodeDragOver = ({ event, treeNode }) => {
  49009. const dropNode = treeNode;
  49010. const oldDropNode = dragState.value.dropNode;
  49011. if (oldDropNode && oldDropNode !== dropNode) {
  49012. removeClass(oldDropNode.$el, ns.is("drop-inner"));
  49013. }
  49014. const draggingNode = dragState.value.draggingNode;
  49015. if (!draggingNode || !dropNode)
  49016. return;
  49017. let dropPrev = true;
  49018. let dropInner = true;
  49019. let dropNext = true;
  49020. let userAllowDropInner = true;
  49021. if (typeof props.allowDrop === "function") {
  49022. dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
  49023. userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
  49024. dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
  49025. }
  49026. event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
  49027. if ((dropPrev || dropInner || dropNext) && oldDropNode !== dropNode) {
  49028. if (oldDropNode) {
  49029. ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
  49030. }
  49031. ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
  49032. }
  49033. if (dropPrev || dropInner || dropNext) {
  49034. dragState.value.dropNode = dropNode;
  49035. }
  49036. if (dropNode.node.nextSibling === draggingNode.node) {
  49037. dropNext = false;
  49038. }
  49039. if (dropNode.node.previousSibling === draggingNode.node) {
  49040. dropPrev = false;
  49041. }
  49042. if (dropNode.node.contains(draggingNode.node, false)) {
  49043. dropInner = false;
  49044. }
  49045. if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
  49046. dropPrev = false;
  49047. dropInner = false;
  49048. dropNext = false;
  49049. }
  49050. const targetPosition = dropNode.$el.getBoundingClientRect();
  49051. const treePosition = el$.value.getBoundingClientRect();
  49052. let dropType;
  49053. const prevPercent = dropPrev ? dropInner ? 0.25 : dropNext ? 0.45 : 1 : -1;
  49054. const nextPercent = dropNext ? dropInner ? 0.75 : dropPrev ? 0.55 : 0 : 1;
  49055. let indicatorTop = -9999;
  49056. const distance = event.clientY - targetPosition.top;
  49057. if (distance < targetPosition.height * prevPercent) {
  49058. dropType = "before";
  49059. } else if (distance > targetPosition.height * nextPercent) {
  49060. dropType = "after";
  49061. } else if (dropInner) {
  49062. dropType = "inner";
  49063. } else {
  49064. dropType = "none";
  49065. }
  49066. const iconPosition = dropNode.$el.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
  49067. const dropIndicator = dropIndicator$.value;
  49068. if (dropType === "before") {
  49069. indicatorTop = iconPosition.top - treePosition.top;
  49070. } else if (dropType === "after") {
  49071. indicatorTop = iconPosition.bottom - treePosition.top;
  49072. }
  49073. dropIndicator.style.top = `${indicatorTop}px`;
  49074. dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
  49075. if (dropType === "inner") {
  49076. addClass(dropNode.$el, ns.is("drop-inner"));
  49077. } else {
  49078. removeClass(dropNode.$el, ns.is("drop-inner"));
  49079. }
  49080. dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
  49081. dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
  49082. dragState.value.dropType = dropType;
  49083. ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
  49084. };
  49085. const treeNodeDragEnd = (event) => {
  49086. const { draggingNode, dropType, dropNode } = dragState.value;
  49087. event.preventDefault();
  49088. event.dataTransfer.dropEffect = "move";
  49089. if (draggingNode && dropNode) {
  49090. const draggingNodeCopy = { data: draggingNode.node.data };
  49091. if (dropType !== "none") {
  49092. draggingNode.node.remove();
  49093. }
  49094. if (dropType === "before") {
  49095. dropNode.node.parent.insertBefore(draggingNodeCopy, dropNode.node);
  49096. } else if (dropType === "after") {
  49097. dropNode.node.parent.insertAfter(draggingNodeCopy, dropNode.node);
  49098. } else if (dropType === "inner") {
  49099. dropNode.node.insertChild(draggingNodeCopy);
  49100. }
  49101. if (dropType !== "none") {
  49102. store.value.registerNode(draggingNodeCopy);
  49103. }
  49104. removeClass(dropNode.$el, ns.is("drop-inner"));
  49105. ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
  49106. if (dropType !== "none") {
  49107. ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
  49108. }
  49109. }
  49110. if (draggingNode && !dropNode) {
  49111. ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
  49112. }
  49113. dragState.value.showDropIndicator = false;
  49114. dragState.value.draggingNode = null;
  49115. dragState.value.dropNode = null;
  49116. dragState.value.allowDrop = true;
  49117. };
  49118. vue.provide(dragEventsKey, {
  49119. treeNodeDragStart,
  49120. treeNodeDragOver,
  49121. treeNodeDragEnd
  49122. });
  49123. return {
  49124. dragState
  49125. };
  49126. }
  49127. const _sfc_main$b = vue.defineComponent({
  49128. name: "ElTreeNode",
  49129. components: {
  49130. ElCollapseTransition: _CollapseTransition,
  49131. ElCheckbox,
  49132. NodeContent,
  49133. ElIcon,
  49134. Loading: loading_default
  49135. },
  49136. props: {
  49137. node: {
  49138. type: Node$1,
  49139. default: () => ({})
  49140. },
  49141. props: {
  49142. type: Object,
  49143. default: () => ({})
  49144. },
  49145. accordion: Boolean,
  49146. renderContent: Function,
  49147. renderAfterExpand: Boolean,
  49148. showCheckbox: {
  49149. type: Boolean,
  49150. default: false
  49151. }
  49152. },
  49153. emits: ["node-expand"],
  49154. setup(props, ctx) {
  49155. const ns = useNamespace("tree");
  49156. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  49157. const tree = vue.inject("RootTree");
  49158. const expanded = vue.ref(false);
  49159. const childNodeRendered = vue.ref(false);
  49160. const oldChecked = vue.ref(null);
  49161. const oldIndeterminate = vue.ref(null);
  49162. const node$ = vue.ref(null);
  49163. const dragEvents = vue.inject(dragEventsKey);
  49164. const instance = vue.getCurrentInstance();
  49165. vue.provide("NodeInstance", instance);
  49166. if (props.node.expanded) {
  49167. expanded.value = true;
  49168. childNodeRendered.value = true;
  49169. }
  49170. const childrenKey = tree.props["children"] || "children";
  49171. vue.watch(() => {
  49172. const children = props.node.data[childrenKey];
  49173. return children && [...children];
  49174. }, () => {
  49175. props.node.updateChildren();
  49176. });
  49177. vue.watch(() => props.node.indeterminate, (val) => {
  49178. handleSelectChange(props.node.checked, val);
  49179. });
  49180. vue.watch(() => props.node.checked, (val) => {
  49181. handleSelectChange(val, props.node.indeterminate);
  49182. });
  49183. vue.watch(() => props.node.expanded, (val) => {
  49184. vue.nextTick(() => expanded.value = val);
  49185. if (val) {
  49186. childNodeRendered.value = true;
  49187. }
  49188. });
  49189. const getNodeKey$1 = (node) => {
  49190. return getNodeKey(tree.props.nodeKey, node.data);
  49191. };
  49192. const getNodeClass = (node) => {
  49193. const nodeClassFunc = props.props.class;
  49194. if (!nodeClassFunc) {
  49195. return {};
  49196. }
  49197. let className;
  49198. if (isFunction(nodeClassFunc)) {
  49199. const { data } = node;
  49200. className = nodeClassFunc(data, node);
  49201. } else {
  49202. className = nodeClassFunc;
  49203. }
  49204. if (isString(className)) {
  49205. return { [className]: true };
  49206. } else {
  49207. return className;
  49208. }
  49209. };
  49210. const handleSelectChange = (checked, indeterminate) => {
  49211. if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) {
  49212. tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
  49213. }
  49214. oldChecked.value = checked;
  49215. oldIndeterminate.value = indeterminate;
  49216. };
  49217. const handleClick = (e) => {
  49218. handleCurrentChange(tree.store, tree.ctx.emit, () => tree.store.value.setCurrentNode(props.node));
  49219. tree.currentNode.value = props.node;
  49220. if (tree.props.expandOnClickNode) {
  49221. handleExpandIconClick();
  49222. }
  49223. if (tree.props.checkOnClickNode && !props.node.disabled) {
  49224. handleCheckChange(null, {
  49225. target: { checked: !props.node.checked }
  49226. });
  49227. }
  49228. tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
  49229. };
  49230. const handleContextMenu = (event) => {
  49231. if (tree.instance.vnode.props["onNodeContextmenu"]) {
  49232. event.stopPropagation();
  49233. event.preventDefault();
  49234. }
  49235. tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
  49236. };
  49237. const handleExpandIconClick = () => {
  49238. if (props.node.isLeaf)
  49239. return;
  49240. if (expanded.value) {
  49241. tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
  49242. props.node.collapse();
  49243. } else {
  49244. props.node.expand();
  49245. ctx.emit("node-expand", props.node.data, props.node, instance);
  49246. }
  49247. };
  49248. const handleCheckChange = (value, ev) => {
  49249. props.node.setChecked(ev.target.checked, !tree.props.checkStrictly);
  49250. vue.nextTick(() => {
  49251. const store = tree.store.value;
  49252. tree.ctx.emit("check", props.node.data, {
  49253. checkedNodes: store.getCheckedNodes(),
  49254. checkedKeys: store.getCheckedKeys(),
  49255. halfCheckedNodes: store.getHalfCheckedNodes(),
  49256. halfCheckedKeys: store.getHalfCheckedKeys()
  49257. });
  49258. });
  49259. };
  49260. const handleChildNodeExpand = (nodeData, node, instance2) => {
  49261. broadcastExpanded(node);
  49262. tree.ctx.emit("node-expand", nodeData, node, instance2);
  49263. };
  49264. const handleDragStart = (event) => {
  49265. if (!tree.props.draggable)
  49266. return;
  49267. dragEvents.treeNodeDragStart({ event, treeNode: props });
  49268. };
  49269. const handleDragOver = (event) => {
  49270. event.preventDefault();
  49271. if (!tree.props.draggable)
  49272. return;
  49273. dragEvents.treeNodeDragOver({
  49274. event,
  49275. treeNode: { $el: node$.value, node: props.node }
  49276. });
  49277. };
  49278. const handleDrop = (event) => {
  49279. event.preventDefault();
  49280. };
  49281. const handleDragEnd = (event) => {
  49282. if (!tree.props.draggable)
  49283. return;
  49284. dragEvents.treeNodeDragEnd(event);
  49285. };
  49286. return {
  49287. ns,
  49288. node$,
  49289. tree,
  49290. expanded,
  49291. childNodeRendered,
  49292. oldChecked,
  49293. oldIndeterminate,
  49294. getNodeKey: getNodeKey$1,
  49295. getNodeClass,
  49296. handleSelectChange,
  49297. handleClick,
  49298. handleContextMenu,
  49299. handleExpandIconClick,
  49300. handleCheckChange,
  49301. handleChildNodeExpand,
  49302. handleDragStart,
  49303. handleDragOver,
  49304. handleDrop,
  49305. handleDragEnd,
  49306. CaretRight: caret_right_default
  49307. };
  49308. }
  49309. });
  49310. const _hoisted_1$7 = ["aria-expanded", "aria-disabled", "aria-checked", "draggable", "data-key"];
  49311. const _hoisted_2$5 = ["aria-expanded"];
  49312. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  49313. const _component_el_icon = vue.resolveComponent("el-icon");
  49314. const _component_el_checkbox = vue.resolveComponent("el-checkbox");
  49315. const _component_loading = vue.resolveComponent("loading");
  49316. const _component_node_content = vue.resolveComponent("node-content");
  49317. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  49318. const _component_el_collapse_transition = vue.resolveComponent("el-collapse-transition");
  49319. return vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  49320. ref: "node$",
  49321. class: vue.normalizeClass([
  49322. _ctx.ns.b("node"),
  49323. _ctx.ns.is("expanded", _ctx.expanded),
  49324. _ctx.ns.is("current", _ctx.node.isCurrent),
  49325. _ctx.ns.is("hidden", !_ctx.node.visible),
  49326. _ctx.ns.is("focusable", !_ctx.node.disabled),
  49327. _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
  49328. _ctx.getNodeClass(_ctx.node)
  49329. ]),
  49330. role: "treeitem",
  49331. tabindex: "-1",
  49332. "aria-expanded": _ctx.expanded,
  49333. "aria-disabled": _ctx.node.disabled,
  49334. "aria-checked": _ctx.node.checked,
  49335. draggable: _ctx.tree.props.draggable,
  49336. "data-key": _ctx.getNodeKey(_ctx.node),
  49337. onClick: _cache[1] || (_cache[1] = vue.withModifiers((...args) => _ctx.handleClick && _ctx.handleClick(...args), ["stop"])),
  49338. onContextmenu: _cache[2] || (_cache[2] = (...args) => _ctx.handleContextMenu && _ctx.handleContextMenu(...args)),
  49339. onDragstart: _cache[3] || (_cache[3] = vue.withModifiers((...args) => _ctx.handleDragStart && _ctx.handleDragStart(...args), ["stop"])),
  49340. onDragover: _cache[4] || (_cache[4] = vue.withModifiers((...args) => _ctx.handleDragOver && _ctx.handleDragOver(...args), ["stop"])),
  49341. onDragend: _cache[5] || (_cache[5] = vue.withModifiers((...args) => _ctx.handleDragEnd && _ctx.handleDragEnd(...args), ["stop"])),
  49342. onDrop: _cache[6] || (_cache[6] = vue.withModifiers((...args) => _ctx.handleDrop && _ctx.handleDrop(...args), ["stop"]))
  49343. }, [
  49344. vue.createElementVNode("div", {
  49345. class: vue.normalizeClass(_ctx.ns.be("node", "content")),
  49346. style: vue.normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
  49347. }, [
  49348. _ctx.tree.props.icon || _ctx.CaretRight ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  49349. key: 0,
  49350. class: vue.normalizeClass([
  49351. _ctx.ns.be("node", "expand-icon"),
  49352. _ctx.ns.is("leaf", _ctx.node.isLeaf),
  49353. {
  49354. expanded: !_ctx.node.isLeaf && _ctx.expanded
  49355. }
  49356. ]),
  49357. onClick: vue.withModifiers(_ctx.handleExpandIconClick, ["stop"])
  49358. }, {
  49359. default: vue.withCtx(() => [
  49360. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))
  49361. ]),
  49362. _: 1
  49363. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  49364. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(_component_el_checkbox, {
  49365. key: 1,
  49366. "model-value": _ctx.node.checked,
  49367. indeterminate: _ctx.node.indeterminate,
  49368. disabled: !!_ctx.node.disabled,
  49369. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  49370. }, ["stop"])),
  49371. onChange: _ctx.handleCheckChange
  49372. }, null, 8, ["model-value", "indeterminate", "disabled", "onChange"])) : vue.createCommentVNode("v-if", true),
  49373. _ctx.node.loading ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  49374. key: 2,
  49375. class: vue.normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
  49376. }, {
  49377. default: vue.withCtx(() => [
  49378. vue.createVNode(_component_loading)
  49379. ]),
  49380. _: 1
  49381. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  49382. vue.createVNode(_component_node_content, {
  49383. node: _ctx.node,
  49384. "render-content": _ctx.renderContent
  49385. }, null, 8, ["node", "render-content"])
  49386. ], 6),
  49387. vue.createVNode(_component_el_collapse_transition, null, {
  49388. default: vue.withCtx(() => [
  49389. !_ctx.renderAfterExpand || _ctx.childNodeRendered ? vue.withDirectives((vue.openBlock(), vue.createElementBlock("div", {
  49390. key: 0,
  49391. class: vue.normalizeClass(_ctx.ns.be("node", "children")),
  49392. role: "group",
  49393. "aria-expanded": _ctx.expanded
  49394. }, [
  49395. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.node.childNodes, (child) => {
  49396. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  49397. key: _ctx.getNodeKey(child),
  49398. "render-content": _ctx.renderContent,
  49399. "render-after-expand": _ctx.renderAfterExpand,
  49400. "show-checkbox": _ctx.showCheckbox,
  49401. node: child,
  49402. accordion: _ctx.accordion,
  49403. props: _ctx.props,
  49404. onNodeExpand: _ctx.handleChildNodeExpand
  49405. }, null, 8, ["render-content", "render-after-expand", "show-checkbox", "node", "accordion", "props", "onNodeExpand"]);
  49406. }), 128))
  49407. ], 10, _hoisted_2$5)), [
  49408. [vue.vShow, _ctx.expanded]
  49409. ]) : vue.createCommentVNode("v-if", true)
  49410. ]),
  49411. _: 1
  49412. })
  49413. ], 42, _hoisted_1$7)), [
  49414. [vue.vShow, _ctx.node.visible]
  49415. ]);
  49416. }
  49417. var ElTreeNode$1 = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$2], ["__file", "tree-node.vue"]]);
  49418. function useKeydown({ el$ }, store) {
  49419. const ns = useNamespace("tree");
  49420. const treeItems = vue.shallowRef([]);
  49421. const checkboxItems = vue.shallowRef([]);
  49422. vue.onMounted(() => {
  49423. initTabIndex();
  49424. });
  49425. vue.onUpdated(() => {
  49426. treeItems.value = Array.from(el$.value.querySelectorAll("[role=treeitem]"));
  49427. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  49428. });
  49429. vue.watch(checkboxItems, (val) => {
  49430. val.forEach((checkbox) => {
  49431. checkbox.setAttribute("tabindex", "-1");
  49432. });
  49433. });
  49434. const handleKeydown = (ev) => {
  49435. const currentItem = ev.target;
  49436. if (!currentItem.className.includes(ns.b("node")))
  49437. return;
  49438. const code = ev.code;
  49439. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  49440. const currentIndex = treeItems.value.indexOf(currentItem);
  49441. let nextIndex;
  49442. if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
  49443. ev.preventDefault();
  49444. if (code === EVENT_CODE.up) {
  49445. nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.value.length - 1;
  49446. const startIndex = nextIndex;
  49447. while (true) {
  49448. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  49449. break;
  49450. nextIndex--;
  49451. if (nextIndex === startIndex) {
  49452. nextIndex = -1;
  49453. break;
  49454. }
  49455. if (nextIndex < 0) {
  49456. nextIndex = treeItems.value.length - 1;
  49457. }
  49458. }
  49459. } else {
  49460. nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.value.length - 1 ? currentIndex + 1 : 0;
  49461. const startIndex = nextIndex;
  49462. while (true) {
  49463. if (store.value.getNode(treeItems.value[nextIndex].dataset.key).canFocus)
  49464. break;
  49465. nextIndex++;
  49466. if (nextIndex === startIndex) {
  49467. nextIndex = -1;
  49468. break;
  49469. }
  49470. if (nextIndex >= treeItems.value.length) {
  49471. nextIndex = 0;
  49472. }
  49473. }
  49474. }
  49475. nextIndex !== -1 && treeItems.value[nextIndex].focus();
  49476. }
  49477. if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
  49478. ev.preventDefault();
  49479. currentItem.click();
  49480. }
  49481. const hasInput = currentItem.querySelector('[type="checkbox"]');
  49482. if ([EVENT_CODE.enter, EVENT_CODE.space].includes(code) && hasInput) {
  49483. ev.preventDefault();
  49484. hasInput.click();
  49485. }
  49486. };
  49487. useEventListener(el$, "keydown", handleKeydown);
  49488. const initTabIndex = () => {
  49489. var _a;
  49490. treeItems.value = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  49491. checkboxItems.value = Array.from(el$.value.querySelectorAll("input[type=checkbox]"));
  49492. const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
  49493. if (checkedItem.length) {
  49494. checkedItem[0].setAttribute("tabindex", "0");
  49495. return;
  49496. }
  49497. (_a = treeItems.value[0]) == null ? void 0 : _a.setAttribute("tabindex", "0");
  49498. };
  49499. }
  49500. const _sfc_main$a = vue.defineComponent({
  49501. name: "ElTree",
  49502. components: { ElTreeNode: ElTreeNode$1 },
  49503. props: {
  49504. data: {
  49505. type: Array,
  49506. default: () => []
  49507. },
  49508. emptyText: {
  49509. type: String
  49510. },
  49511. renderAfterExpand: {
  49512. type: Boolean,
  49513. default: true
  49514. },
  49515. nodeKey: String,
  49516. checkStrictly: Boolean,
  49517. defaultExpandAll: Boolean,
  49518. expandOnClickNode: {
  49519. type: Boolean,
  49520. default: true
  49521. },
  49522. checkOnClickNode: Boolean,
  49523. checkDescendants: {
  49524. type: Boolean,
  49525. default: false
  49526. },
  49527. autoExpandParent: {
  49528. type: Boolean,
  49529. default: true
  49530. },
  49531. defaultCheckedKeys: Array,
  49532. defaultExpandedKeys: Array,
  49533. currentNodeKey: [String, Number],
  49534. renderContent: Function,
  49535. showCheckbox: {
  49536. type: Boolean,
  49537. default: false
  49538. },
  49539. draggable: {
  49540. type: Boolean,
  49541. default: false
  49542. },
  49543. allowDrag: Function,
  49544. allowDrop: Function,
  49545. props: {
  49546. type: Object,
  49547. default: () => ({
  49548. children: "children",
  49549. label: "label",
  49550. disabled: "disabled"
  49551. })
  49552. },
  49553. lazy: {
  49554. type: Boolean,
  49555. default: false
  49556. },
  49557. highlightCurrent: Boolean,
  49558. load: Function,
  49559. filterNodeMethod: Function,
  49560. accordion: Boolean,
  49561. indent: {
  49562. type: Number,
  49563. default: 18
  49564. },
  49565. icon: {
  49566. type: iconPropType
  49567. }
  49568. },
  49569. emits: [
  49570. "check-change",
  49571. "current-change",
  49572. "node-click",
  49573. "node-contextmenu",
  49574. "node-collapse",
  49575. "node-expand",
  49576. "check",
  49577. "node-drag-start",
  49578. "node-drag-end",
  49579. "node-drop",
  49580. "node-drag-leave",
  49581. "node-drag-enter",
  49582. "node-drag-over"
  49583. ],
  49584. setup(props, ctx) {
  49585. const { t } = useLocale();
  49586. const ns = useNamespace("tree");
  49587. const store = vue.ref(new TreeStore({
  49588. key: props.nodeKey,
  49589. data: props.data,
  49590. lazy: props.lazy,
  49591. props: props.props,
  49592. load: props.load,
  49593. currentNodeKey: props.currentNodeKey,
  49594. checkStrictly: props.checkStrictly,
  49595. checkDescendants: props.checkDescendants,
  49596. defaultCheckedKeys: props.defaultCheckedKeys,
  49597. defaultExpandedKeys: props.defaultExpandedKeys,
  49598. autoExpandParent: props.autoExpandParent,
  49599. defaultExpandAll: props.defaultExpandAll,
  49600. filterNodeMethod: props.filterNodeMethod
  49601. }));
  49602. store.value.initialize();
  49603. const root = vue.ref(store.value.root);
  49604. const currentNode = vue.ref(null);
  49605. const el$ = vue.ref(null);
  49606. const dropIndicator$ = vue.ref(null);
  49607. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  49608. const { dragState } = useDragNodeHandler({
  49609. props,
  49610. ctx,
  49611. el$,
  49612. dropIndicator$,
  49613. store
  49614. });
  49615. useKeydown({ el$ }, store);
  49616. const isEmpty = vue.computed(() => {
  49617. const { childNodes } = root.value;
  49618. return !childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible);
  49619. });
  49620. vue.watch(() => props.currentNodeKey, (newVal) => {
  49621. store.value.setCurrentNodeKey(newVal);
  49622. });
  49623. vue.watch(() => props.defaultCheckedKeys, (newVal) => {
  49624. store.value.setDefaultCheckedKey(newVal);
  49625. });
  49626. vue.watch(() => props.defaultExpandedKeys, (newVal) => {
  49627. store.value.setDefaultExpandedKeys(newVal);
  49628. });
  49629. vue.watch(() => props.data, (newVal) => {
  49630. store.value.setData(newVal);
  49631. }, { deep: true });
  49632. vue.watch(() => props.checkStrictly, (newVal) => {
  49633. store.value.checkStrictly = newVal;
  49634. });
  49635. const filter = (value) => {
  49636. if (!props.filterNodeMethod)
  49637. throw new Error("[Tree] filterNodeMethod is required when filter");
  49638. store.value.filter(value);
  49639. };
  49640. const getNodeKey$1 = (node) => {
  49641. return getNodeKey(props.nodeKey, node.data);
  49642. };
  49643. const getNodePath = (data) => {
  49644. if (!props.nodeKey)
  49645. throw new Error("[Tree] nodeKey is required in getNodePath");
  49646. const node = store.value.getNode(data);
  49647. if (!node)
  49648. return [];
  49649. const path = [node.data];
  49650. let parent = node.parent;
  49651. while (parent && parent !== root.value) {
  49652. path.push(parent.data);
  49653. parent = parent.parent;
  49654. }
  49655. return path.reverse();
  49656. };
  49657. const getCheckedNodes = (leafOnly, includeHalfChecked) => {
  49658. return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
  49659. };
  49660. const getCheckedKeys = (leafOnly) => {
  49661. return store.value.getCheckedKeys(leafOnly);
  49662. };
  49663. const getCurrentNode = () => {
  49664. const currentNode2 = store.value.getCurrentNode();
  49665. return currentNode2 ? currentNode2.data : null;
  49666. };
  49667. const getCurrentKey = () => {
  49668. if (!props.nodeKey)
  49669. throw new Error("[Tree] nodeKey is required in getCurrentKey");
  49670. const currentNode2 = getCurrentNode();
  49671. return currentNode2 ? currentNode2[props.nodeKey] : null;
  49672. };
  49673. const setCheckedNodes = (nodes, leafOnly) => {
  49674. if (!props.nodeKey)
  49675. throw new Error("[Tree] nodeKey is required in setCheckedNodes");
  49676. store.value.setCheckedNodes(nodes, leafOnly);
  49677. };
  49678. const setCheckedKeys = (keys, leafOnly) => {
  49679. if (!props.nodeKey)
  49680. throw new Error("[Tree] nodeKey is required in setCheckedKeys");
  49681. store.value.setCheckedKeys(keys, leafOnly);
  49682. };
  49683. const setChecked = (data, checked, deep) => {
  49684. store.value.setChecked(data, checked, deep);
  49685. };
  49686. const getHalfCheckedNodes = () => {
  49687. return store.value.getHalfCheckedNodes();
  49688. };
  49689. const getHalfCheckedKeys = () => {
  49690. return store.value.getHalfCheckedKeys();
  49691. };
  49692. const setCurrentNode = (node, shouldAutoExpandParent = true) => {
  49693. if (!props.nodeKey)
  49694. throw new Error("[Tree] nodeKey is required in setCurrentNode");
  49695. handleCurrentChange(store, ctx.emit, () => store.value.setUserCurrentNode(node, shouldAutoExpandParent));
  49696. };
  49697. const setCurrentKey = (key, shouldAutoExpandParent = true) => {
  49698. if (!props.nodeKey)
  49699. throw new Error("[Tree] nodeKey is required in setCurrentKey");
  49700. handleCurrentChange(store, ctx.emit, () => store.value.setCurrentNodeKey(key, shouldAutoExpandParent));
  49701. };
  49702. const getNode = (data) => {
  49703. return store.value.getNode(data);
  49704. };
  49705. const remove = (data) => {
  49706. store.value.remove(data);
  49707. };
  49708. const append = (data, parentNode) => {
  49709. store.value.append(data, parentNode);
  49710. };
  49711. const insertBefore = (data, refNode) => {
  49712. store.value.insertBefore(data, refNode);
  49713. };
  49714. const insertAfter = (data, refNode) => {
  49715. store.value.insertAfter(data, refNode);
  49716. };
  49717. const handleNodeExpand = (nodeData, node, instance) => {
  49718. broadcastExpanded(node);
  49719. ctx.emit("node-expand", nodeData, node, instance);
  49720. };
  49721. const updateKeyChildren = (key, data) => {
  49722. if (!props.nodeKey)
  49723. throw new Error("[Tree] nodeKey is required in updateKeyChild");
  49724. store.value.updateChildren(key, data);
  49725. };
  49726. vue.provide("RootTree", {
  49727. ctx,
  49728. props,
  49729. store,
  49730. root,
  49731. currentNode,
  49732. instance: vue.getCurrentInstance()
  49733. });
  49734. vue.provide(formItemContextKey, void 0);
  49735. return {
  49736. ns,
  49737. store,
  49738. root,
  49739. currentNode,
  49740. dragState,
  49741. el$,
  49742. dropIndicator$,
  49743. isEmpty,
  49744. filter,
  49745. getNodeKey: getNodeKey$1,
  49746. getNodePath,
  49747. getCheckedNodes,
  49748. getCheckedKeys,
  49749. getCurrentNode,
  49750. getCurrentKey,
  49751. setCheckedNodes,
  49752. setCheckedKeys,
  49753. setChecked,
  49754. getHalfCheckedNodes,
  49755. getHalfCheckedKeys,
  49756. setCurrentNode,
  49757. setCurrentKey,
  49758. t,
  49759. getNode,
  49760. remove,
  49761. append,
  49762. insertBefore,
  49763. insertAfter,
  49764. handleNodeExpand,
  49765. updateKeyChildren
  49766. };
  49767. }
  49768. });
  49769. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  49770. var _a;
  49771. const _component_el_tree_node = vue.resolveComponent("el-tree-node");
  49772. return vue.openBlock(), vue.createElementBlock("div", {
  49773. ref: "el$",
  49774. class: vue.normalizeClass([
  49775. _ctx.ns.b(),
  49776. _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
  49777. _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
  49778. _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
  49779. { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
  49780. ]),
  49781. role: "tree"
  49782. }, [
  49783. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.root.childNodes, (child) => {
  49784. return vue.openBlock(), vue.createBlock(_component_el_tree_node, {
  49785. key: _ctx.getNodeKey(child),
  49786. node: child,
  49787. props: _ctx.props,
  49788. accordion: _ctx.accordion,
  49789. "render-after-expand": _ctx.renderAfterExpand,
  49790. "show-checkbox": _ctx.showCheckbox,
  49791. "render-content": _ctx.renderContent,
  49792. onNodeExpand: _ctx.handleNodeExpand
  49793. }, null, 8, ["node", "props", "accordion", "render-after-expand", "show-checkbox", "render-content", "onNodeExpand"]);
  49794. }), 128)),
  49795. _ctx.isEmpty ? (vue.openBlock(), vue.createElementBlock("div", {
  49796. key: 0,
  49797. class: vue.normalizeClass(_ctx.ns.e("empty-block"))
  49798. }, [
  49799. vue.createElementVNode("span", {
  49800. class: vue.normalizeClass(_ctx.ns.e("empty-text"))
  49801. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : _ctx.t("el.tree.emptyText")), 3)
  49802. ], 2)) : vue.createCommentVNode("v-if", true),
  49803. vue.withDirectives(vue.createElementVNode("div", {
  49804. ref: "dropIndicator$",
  49805. class: vue.normalizeClass(_ctx.ns.e("drop-indicator"))
  49806. }, null, 2), [
  49807. [vue.vShow, _ctx.dragState.showDropIndicator]
  49808. ])
  49809. ], 2);
  49810. }
  49811. var Tree = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$1], ["__file", "tree.vue"]]);
  49812. Tree.install = (app) => {
  49813. app.component(Tree.name, Tree);
  49814. };
  49815. const _Tree = Tree;
  49816. const ElTree = _Tree;
  49817. const useSelect = (props, { attrs }, {
  49818. tree,
  49819. key
  49820. }) => {
  49821. const ns = useNamespace("tree-select");
  49822. const result = {
  49823. ...pick(vue.toRefs(props), Object.keys(ElSelect.props)),
  49824. ...attrs,
  49825. valueKey: key,
  49826. popperClass: vue.computed(() => {
  49827. const classes = [ns.e("popper")];
  49828. if (props.popperClass)
  49829. classes.push(props.popperClass);
  49830. return classes.join(" ");
  49831. }),
  49832. filterMethod: (keyword = "") => {
  49833. if (props.filterMethod)
  49834. props.filterMethod(keyword);
  49835. vue.nextTick(() => {
  49836. var _a;
  49837. (_a = tree.value) == null ? void 0 : _a.filter(keyword);
  49838. });
  49839. },
  49840. onVisibleChange: (visible) => {
  49841. var _a;
  49842. (_a = attrs.onVisibleChange) == null ? void 0 : _a.call(attrs, visible);
  49843. if (props.filterable && visible) {
  49844. result.filterMethod();
  49845. }
  49846. }
  49847. };
  49848. return result;
  49849. };
  49850. const component = vue.defineComponent({
  49851. extends: ElOption,
  49852. setup(props, ctx) {
  49853. const result = ElOption.setup(props, ctx);
  49854. delete result.selectOptionClick;
  49855. const vm = vue.getCurrentInstance().proxy;
  49856. vue.nextTick(() => {
  49857. if (!result.select.cachedOptions.get(vm.value)) {
  49858. result.select.onOptionCreate(vm);
  49859. }
  49860. });
  49861. return result;
  49862. },
  49863. methods: {
  49864. selectOptionClick() {
  49865. this.$el.parentElement.click();
  49866. }
  49867. }
  49868. });
  49869. var TreeSelectOption = component;
  49870. function isValidValue(val) {
  49871. return val || val === 0;
  49872. }
  49873. function isValidArray(val) {
  49874. return Array.isArray(val) && val.length;
  49875. }
  49876. function toValidArray(val) {
  49877. return Array.isArray(val) ? val : isValidValue(val) ? [val] : [];
  49878. }
  49879. function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
  49880. for (let i = 0; i < treeData.length; i++) {
  49881. const data = treeData[i];
  49882. if (findCallback(data, i, treeData, parent)) {
  49883. return resultCallback ? resultCallback(data, i, treeData, parent) : data;
  49884. } else {
  49885. const children = getChildren(data);
  49886. if (isValidArray(children)) {
  49887. const find = treeFind(children, findCallback, getChildren, resultCallback, data);
  49888. if (find)
  49889. return find;
  49890. }
  49891. }
  49892. }
  49893. }
  49894. const useTree$1 = (props, { attrs, slots, emit }, {
  49895. select,
  49896. tree,
  49897. key
  49898. }) => {
  49899. vue.watch(() => props.modelValue, () => {
  49900. if (props.showCheckbox) {
  49901. vue.nextTick(() => {
  49902. const treeInstance = tree.value;
  49903. if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) {
  49904. treeInstance.setCheckedKeys(toValidArray(props.modelValue));
  49905. }
  49906. });
  49907. }
  49908. }, {
  49909. immediate: true,
  49910. deep: true
  49911. });
  49912. const propsMap = vue.computed(() => ({
  49913. value: key.value,
  49914. ...props.props
  49915. }));
  49916. const getNodeValByProp = (prop, data) => {
  49917. var _a;
  49918. const propVal = propsMap.value[prop];
  49919. if (isFunction(propVal)) {
  49920. return propVal(data, (_a = tree.value) == null ? void 0 : _a.getNode(getNodeValByProp("value", data)));
  49921. } else {
  49922. return data[propVal];
  49923. }
  49924. };
  49925. const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
  49926. return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent));
  49927. }).filter((item) => isValidValue(item));
  49928. return {
  49929. ...pick(vue.toRefs(props), Object.keys(_Tree.props)),
  49930. ...attrs,
  49931. nodeKey: key,
  49932. expandOnClickNode: vue.computed(() => {
  49933. return !props.checkStrictly && props.expandOnClickNode;
  49934. }),
  49935. defaultExpandedKeys: vue.computed(() => {
  49936. return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
  49937. }),
  49938. renderContent: (h, { node, data, store }) => {
  49939. return h(TreeSelectOption, {
  49940. value: getNodeValByProp("value", data),
  49941. label: getNodeValByProp("label", data),
  49942. disabled: getNodeValByProp("disabled", data)
  49943. }, props.renderContent ? () => props.renderContent(h, { node, data, store }) : slots.default ? () => slots.default({ node, data, store }) : void 0);
  49944. },
  49945. filterNodeMethod: (value, data, node) => {
  49946. var _a;
  49947. if (props.filterNodeMethod)
  49948. return props.filterNodeMethod(value, data, node);
  49949. if (!value)
  49950. return true;
  49951. return (_a = getNodeValByProp("label", data)) == null ? void 0 : _a.includes(value);
  49952. },
  49953. onNodeClick: (data, node, e) => {
  49954. var _a, _b, _c;
  49955. (_a = attrs.onNodeClick) == null ? void 0 : _a.call(attrs, data, node, e);
  49956. if (props.showCheckbox && props.checkOnClickNode)
  49957. return;
  49958. if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
  49959. if (!getNodeValByProp("disabled", data)) {
  49960. const option = (_b = select.value) == null ? void 0 : _b.options.get(getNodeValByProp("value", data));
  49961. (_c = select.value) == null ? void 0 : _c.handleOptionSelect(option, true);
  49962. }
  49963. } else if (props.expandOnClickNode) {
  49964. e.proxy.handleExpandIconClick();
  49965. }
  49966. },
  49967. onCheck: (data, params) => {
  49968. var _a;
  49969. (_a = attrs.onCheck) == null ? void 0 : _a.call(attrs, data, params);
  49970. const dataValue = getNodeValByProp("value", data);
  49971. if (props.checkStrictly) {
  49972. emit(UPDATE_MODEL_EVENT, props.multiple ? params.checkedKeys : params.checkedKeys.includes(dataValue) ? dataValue : void 0);
  49973. } else {
  49974. if (props.multiple) {
  49975. emit(UPDATE_MODEL_EVENT, tree.value.getCheckedKeys(true));
  49976. } else {
  49977. const firstLeaf = treeFind([data], (data2) => !isValidArray(getNodeValByProp("children", data2)) && !getNodeValByProp("disabled", data2), (data2) => getNodeValByProp("children", data2));
  49978. const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
  49979. const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data2) => getNodeValByProp("value", data2) === props.modelValue, (data2) => getNodeValByProp("children", data2));
  49980. emit(UPDATE_MODEL_EVENT, firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
  49981. }
  49982. }
  49983. }
  49984. };
  49985. };
  49986. const _sfc_main$9 = vue.defineComponent({
  49987. name: "ElTreeSelect",
  49988. inheritAttrs: false,
  49989. props: {
  49990. ...ElSelect.props,
  49991. ..._Tree.props
  49992. },
  49993. setup(props, context) {
  49994. const { slots, expose } = context;
  49995. const select = vue.ref();
  49996. const tree = vue.ref();
  49997. const key = vue.computed(() => props.nodeKey || props.valueKey || "value");
  49998. const selectProps = useSelect(props, context, { select, tree, key });
  49999. const treeProps = useTree$1(props, context, { select, tree, key });
  50000. const methods = vue.reactive({});
  50001. expose(methods);
  50002. vue.onMounted(() => {
  50003. Object.assign(methods, {
  50004. ...pick(tree.value, [
  50005. "filter",
  50006. "updateKeyChildren",
  50007. "getCheckedNodes",
  50008. "setCheckedNodes",
  50009. "getCheckedKeys",
  50010. "setCheckedKeys",
  50011. "setChecked",
  50012. "getHalfCheckedNodes",
  50013. "getHalfCheckedKeys",
  50014. "getCurrentKey",
  50015. "getCurrentNode",
  50016. "setCurrentKey",
  50017. "setCurrentNode",
  50018. "getNode",
  50019. "remove",
  50020. "append",
  50021. "insertBefore",
  50022. "insertAfter"
  50023. ]),
  50024. ...pick(select.value, ["focus", "blur"])
  50025. });
  50026. });
  50027. return () => vue.h(ElSelect, vue.reactive({
  50028. ...selectProps,
  50029. ref: (ref2) => select.value = ref2
  50030. }), {
  50031. ...slots,
  50032. default: () => vue.h(_Tree, vue.reactive({
  50033. ...treeProps,
  50034. ref: (ref2) => tree.value = ref2
  50035. }))
  50036. });
  50037. }
  50038. });
  50039. var TreeSelect = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__file", "tree-select.vue"]]);
  50040. TreeSelect.install = (app) => {
  50041. app.component(TreeSelect.name, TreeSelect);
  50042. };
  50043. const _TreeSelect = TreeSelect;
  50044. const ElTreeSelect = _TreeSelect;
  50045. const ROOT_TREE_INJECTION_KEY = Symbol();
  50046. const EMPTY_NODE = {
  50047. key: -1,
  50048. level: -1,
  50049. data: {}
  50050. };
  50051. var TreeOptionsEnum = /* @__PURE__ */ ((TreeOptionsEnum2) => {
  50052. TreeOptionsEnum2["KEY"] = "id";
  50053. TreeOptionsEnum2["LABEL"] = "label";
  50054. TreeOptionsEnum2["CHILDREN"] = "children";
  50055. TreeOptionsEnum2["DISABLED"] = "disabled";
  50056. return TreeOptionsEnum2;
  50057. })(TreeOptionsEnum || {});
  50058. var SetOperationEnum = /* @__PURE__ */ ((SetOperationEnum2) => {
  50059. SetOperationEnum2["ADD"] = "add";
  50060. SetOperationEnum2["DELETE"] = "delete";
  50061. return SetOperationEnum2;
  50062. })(SetOperationEnum || {});
  50063. const treeProps = buildProps({
  50064. data: {
  50065. type: definePropType(Array),
  50066. default: () => mutable([])
  50067. },
  50068. emptyText: {
  50069. type: String
  50070. },
  50071. height: {
  50072. type: Number,
  50073. default: 200
  50074. },
  50075. props: {
  50076. type: definePropType(Object),
  50077. default: () => mutable({
  50078. children: "children" /* CHILDREN */,
  50079. label: "label" /* LABEL */,
  50080. disabled: "disabled" /* DISABLED */,
  50081. value: "id" /* KEY */
  50082. })
  50083. },
  50084. highlightCurrent: {
  50085. type: Boolean,
  50086. default: false
  50087. },
  50088. showCheckbox: {
  50089. type: Boolean,
  50090. default: false
  50091. },
  50092. defaultCheckedKeys: {
  50093. type: definePropType(Array),
  50094. default: () => mutable([])
  50095. },
  50096. checkStrictly: {
  50097. type: Boolean,
  50098. default: false
  50099. },
  50100. defaultExpandedKeys: {
  50101. type: definePropType(Array),
  50102. default: () => mutable([])
  50103. },
  50104. indent: {
  50105. type: Number,
  50106. default: 16
  50107. },
  50108. icon: {
  50109. type: iconPropType
  50110. },
  50111. expandOnClickNode: {
  50112. type: Boolean,
  50113. default: true
  50114. },
  50115. checkOnClickNode: {
  50116. type: Boolean,
  50117. default: false
  50118. },
  50119. currentNodeKey: {
  50120. type: definePropType([String, Number])
  50121. },
  50122. accordion: {
  50123. type: Boolean,
  50124. default: false
  50125. },
  50126. filterMethod: {
  50127. type: definePropType(Function)
  50128. },
  50129. perfMode: {
  50130. type: Boolean,
  50131. default: true
  50132. }
  50133. });
  50134. const treeNodeProps = buildProps({
  50135. node: {
  50136. type: definePropType(Object),
  50137. default: () => mutable(EMPTY_NODE)
  50138. },
  50139. expanded: {
  50140. type: Boolean,
  50141. default: false
  50142. },
  50143. checked: {
  50144. type: Boolean,
  50145. default: false
  50146. },
  50147. indeterminate: {
  50148. type: Boolean,
  50149. default: false
  50150. },
  50151. showCheckbox: {
  50152. type: Boolean,
  50153. default: false
  50154. },
  50155. disabled: {
  50156. type: Boolean,
  50157. default: false
  50158. },
  50159. current: {
  50160. type: Boolean,
  50161. default: false
  50162. },
  50163. hiddenExpandIcon: {
  50164. type: Boolean,
  50165. default: false
  50166. }
  50167. });
  50168. const treeNodeContentProps = buildProps({
  50169. node: {
  50170. type: definePropType(Object),
  50171. required: true
  50172. }
  50173. });
  50174. const NODE_CLICK = "node-click";
  50175. const NODE_EXPAND = "node-expand";
  50176. const NODE_COLLAPSE = "node-collapse";
  50177. const CURRENT_CHANGE = "current-change";
  50178. const NODE_CHECK = "check";
  50179. const NODE_CHECK_CHANGE = "check-change";
  50180. const NODE_CONTEXTMENU = "node-contextmenu";
  50181. const treeEmits = {
  50182. [NODE_CLICK]: (data, node, e) => data && node && e,
  50183. [NODE_EXPAND]: (data, node) => data && node,
  50184. [NODE_COLLAPSE]: (data, node) => data && node,
  50185. [CURRENT_CHANGE]: (data, node) => data && node,
  50186. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  50187. [NODE_CHECK_CHANGE]: (data, checked) => data && typeof checked === "boolean",
  50188. [NODE_CONTEXTMENU]: (event, data, node) => event && data && node
  50189. };
  50190. const treeNodeEmits = {
  50191. click: (node, e) => !!(node && e),
  50192. toggle: (node) => !!node,
  50193. check: (node, checked) => node && typeof checked === "boolean"
  50194. };
  50195. function useCheck(props, tree) {
  50196. const checkedKeys = vue.ref(/* @__PURE__ */ new Set());
  50197. const indeterminateKeys = vue.ref(/* @__PURE__ */ new Set());
  50198. const { emit } = vue.getCurrentInstance();
  50199. vue.watch([() => tree.value, () => props.defaultCheckedKeys], () => {
  50200. return vue.nextTick(() => {
  50201. _setCheckedKeys(props.defaultCheckedKeys);
  50202. });
  50203. }, {
  50204. immediate: true
  50205. });
  50206. const updateCheckedKeys = () => {
  50207. if (!tree.value || !props.showCheckbox || props.checkStrictly) {
  50208. return;
  50209. }
  50210. const { levelTreeNodeMap, maxLevel } = tree.value;
  50211. const checkedKeySet = checkedKeys.value;
  50212. const indeterminateKeySet = /* @__PURE__ */ new Set();
  50213. for (let level = maxLevel - 1; level >= 1; --level) {
  50214. const nodes = levelTreeNodeMap.get(level);
  50215. if (!nodes)
  50216. continue;
  50217. nodes.forEach((node) => {
  50218. const children = node.children;
  50219. if (children) {
  50220. let allChecked = true;
  50221. let hasChecked = false;
  50222. for (const childNode of children) {
  50223. const key = childNode.key;
  50224. if (checkedKeySet.has(key)) {
  50225. hasChecked = true;
  50226. } else if (indeterminateKeySet.has(key)) {
  50227. allChecked = false;
  50228. hasChecked = true;
  50229. break;
  50230. } else {
  50231. allChecked = false;
  50232. }
  50233. }
  50234. if (allChecked) {
  50235. checkedKeySet.add(node.key);
  50236. } else if (hasChecked) {
  50237. indeterminateKeySet.add(node.key);
  50238. checkedKeySet.delete(node.key);
  50239. } else {
  50240. checkedKeySet.delete(node.key);
  50241. indeterminateKeySet.delete(node.key);
  50242. }
  50243. }
  50244. });
  50245. }
  50246. indeterminateKeys.value = indeterminateKeySet;
  50247. };
  50248. const isChecked = (node) => checkedKeys.value.has(node.key);
  50249. const isIndeterminate = (node) => indeterminateKeys.value.has(node.key);
  50250. const toggleCheckbox = (node, isChecked2, nodeClick = true) => {
  50251. const checkedKeySet = checkedKeys.value;
  50252. const toggle = (node2, checked) => {
  50253. checkedKeySet[checked ? SetOperationEnum.ADD : SetOperationEnum.DELETE](node2.key);
  50254. const children = node2.children;
  50255. if (!props.checkStrictly && children) {
  50256. children.forEach((childNode) => {
  50257. if (!childNode.disabled) {
  50258. toggle(childNode, checked);
  50259. }
  50260. });
  50261. }
  50262. };
  50263. toggle(node, isChecked2);
  50264. updateCheckedKeys();
  50265. if (nodeClick) {
  50266. afterNodeCheck(node, isChecked2);
  50267. }
  50268. };
  50269. const afterNodeCheck = (node, checked) => {
  50270. const { checkedNodes, checkedKeys: checkedKeys2 } = getChecked();
  50271. const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked();
  50272. emit(NODE_CHECK, node.data, {
  50273. checkedKeys: checkedKeys2,
  50274. checkedNodes,
  50275. halfCheckedKeys,
  50276. halfCheckedNodes
  50277. });
  50278. emit(NODE_CHECK_CHANGE, node.data, checked);
  50279. };
  50280. function getCheckedKeys(leafOnly = false) {
  50281. return getChecked(leafOnly).checkedKeys;
  50282. }
  50283. function getCheckedNodes(leafOnly = false) {
  50284. return getChecked(leafOnly).checkedNodes;
  50285. }
  50286. function getHalfCheckedKeys() {
  50287. return getHalfChecked().halfCheckedKeys;
  50288. }
  50289. function getHalfCheckedNodes() {
  50290. return getHalfChecked().halfCheckedNodes;
  50291. }
  50292. function getChecked(leafOnly = false) {
  50293. const checkedNodes = [];
  50294. const keys = [];
  50295. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  50296. const { treeNodeMap } = tree.value;
  50297. checkedKeys.value.forEach((key) => {
  50298. const node = treeNodeMap.get(key);
  50299. if (node && (!leafOnly || leafOnly && node.isLeaf)) {
  50300. keys.push(key);
  50301. checkedNodes.push(node.data);
  50302. }
  50303. });
  50304. }
  50305. return {
  50306. checkedKeys: keys,
  50307. checkedNodes
  50308. };
  50309. }
  50310. function getHalfChecked() {
  50311. const halfCheckedNodes = [];
  50312. const halfCheckedKeys = [];
  50313. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  50314. const { treeNodeMap } = tree.value;
  50315. indeterminateKeys.value.forEach((key) => {
  50316. const node = treeNodeMap.get(key);
  50317. if (node) {
  50318. halfCheckedKeys.push(key);
  50319. halfCheckedNodes.push(node.data);
  50320. }
  50321. });
  50322. }
  50323. return {
  50324. halfCheckedNodes,
  50325. halfCheckedKeys
  50326. };
  50327. }
  50328. function setCheckedKeys(keys) {
  50329. checkedKeys.value.clear();
  50330. indeterminateKeys.value.clear();
  50331. _setCheckedKeys(keys);
  50332. }
  50333. function setChecked(key, isChecked2) {
  50334. if ((tree == null ? void 0 : tree.value) && props.showCheckbox) {
  50335. const node = tree.value.treeNodeMap.get(key);
  50336. if (node) {
  50337. toggleCheckbox(node, isChecked2, false);
  50338. }
  50339. }
  50340. }
  50341. function _setCheckedKeys(keys) {
  50342. if (tree == null ? void 0 : tree.value) {
  50343. const { treeNodeMap } = tree.value;
  50344. if (props.showCheckbox && treeNodeMap && keys) {
  50345. for (const key of keys) {
  50346. const node = treeNodeMap.get(key);
  50347. if (node && !isChecked(node)) {
  50348. toggleCheckbox(node, true, false);
  50349. }
  50350. }
  50351. }
  50352. }
  50353. }
  50354. return {
  50355. updateCheckedKeys,
  50356. toggleCheckbox,
  50357. isChecked,
  50358. isIndeterminate,
  50359. getCheckedKeys,
  50360. getCheckedNodes,
  50361. getHalfCheckedKeys,
  50362. getHalfCheckedNodes,
  50363. setChecked,
  50364. setCheckedKeys
  50365. };
  50366. }
  50367. function useFilter(props, tree) {
  50368. const hiddenNodeKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  50369. const hiddenExpandIconKeySet = vue.ref(/* @__PURE__ */ new Set([]));
  50370. const filterable = vue.computed(() => {
  50371. return isFunction(props.filterMethod);
  50372. });
  50373. function doFilter(query) {
  50374. var _a;
  50375. if (!filterable.value) {
  50376. return;
  50377. }
  50378. const expandKeySet = /* @__PURE__ */ new Set();
  50379. const hiddenExpandIconKeys = hiddenExpandIconKeySet.value;
  50380. const hiddenKeys = hiddenNodeKeySet.value;
  50381. const family = [];
  50382. const nodes = ((_a = tree.value) == null ? void 0 : _a.treeNodes) || [];
  50383. const filter = props.filterMethod;
  50384. hiddenKeys.clear();
  50385. function traverse(nodes2) {
  50386. nodes2.forEach((node) => {
  50387. family.push(node);
  50388. if (filter == null ? void 0 : filter(query, node.data)) {
  50389. family.forEach((member) => {
  50390. expandKeySet.add(member.key);
  50391. });
  50392. } else if (node.isLeaf) {
  50393. hiddenKeys.add(node.key);
  50394. }
  50395. const children = node.children;
  50396. if (children) {
  50397. traverse(children);
  50398. }
  50399. if (!node.isLeaf) {
  50400. if (!expandKeySet.has(node.key)) {
  50401. hiddenKeys.add(node.key);
  50402. } else if (children) {
  50403. let allHidden = true;
  50404. for (const childNode of children) {
  50405. if (!hiddenKeys.has(childNode.key)) {
  50406. allHidden = false;
  50407. break;
  50408. }
  50409. }
  50410. if (allHidden) {
  50411. hiddenExpandIconKeys.add(node.key);
  50412. } else {
  50413. hiddenExpandIconKeys.delete(node.key);
  50414. }
  50415. }
  50416. }
  50417. family.pop();
  50418. });
  50419. }
  50420. traverse(nodes);
  50421. return expandKeySet;
  50422. }
  50423. function isForceHiddenExpandIcon(node) {
  50424. return hiddenExpandIconKeySet.value.has(node.key);
  50425. }
  50426. return {
  50427. hiddenExpandIconKeySet,
  50428. hiddenNodeKeySet,
  50429. doFilter,
  50430. isForceHiddenExpandIcon
  50431. };
  50432. }
  50433. function useTree(props, emit) {
  50434. const expandedKeySet = vue.ref(new Set(props.defaultExpandedKeys));
  50435. const currentKey = vue.ref();
  50436. const tree = vue.shallowRef();
  50437. vue.watch(() => props.currentNodeKey, (key) => {
  50438. currentKey.value = key;
  50439. }, {
  50440. immediate: true
  50441. });
  50442. vue.watch(() => props.data, (data) => {
  50443. setData(data);
  50444. }, {
  50445. immediate: true
  50446. });
  50447. const {
  50448. isIndeterminate,
  50449. isChecked,
  50450. toggleCheckbox,
  50451. getCheckedKeys,
  50452. getCheckedNodes,
  50453. getHalfCheckedKeys,
  50454. getHalfCheckedNodes,
  50455. setChecked,
  50456. setCheckedKeys
  50457. } = useCheck(props, tree);
  50458. const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree);
  50459. const valueKey = vue.computed(() => {
  50460. var _a;
  50461. return ((_a = props.props) == null ? void 0 : _a.value) || TreeOptionsEnum.KEY;
  50462. });
  50463. const childrenKey = vue.computed(() => {
  50464. var _a;
  50465. return ((_a = props.props) == null ? void 0 : _a.children) || TreeOptionsEnum.CHILDREN;
  50466. });
  50467. const disabledKey = vue.computed(() => {
  50468. var _a;
  50469. return ((_a = props.props) == null ? void 0 : _a.disabled) || TreeOptionsEnum.DISABLED;
  50470. });
  50471. const labelKey = vue.computed(() => {
  50472. var _a;
  50473. return ((_a = props.props) == null ? void 0 : _a.label) || TreeOptionsEnum.LABEL;
  50474. });
  50475. const flattenTree = vue.computed(() => {
  50476. const expandedKeys = expandedKeySet.value;
  50477. const hiddenKeys = hiddenNodeKeySet.value;
  50478. const flattenNodes = [];
  50479. const nodes = tree.value && tree.value.treeNodes || [];
  50480. function traverse() {
  50481. const stack = [];
  50482. for (let i = nodes.length - 1; i >= 0; --i) {
  50483. stack.push(nodes[i]);
  50484. }
  50485. while (stack.length) {
  50486. const node = stack.pop();
  50487. if (!node)
  50488. continue;
  50489. if (!hiddenKeys.has(node.key)) {
  50490. flattenNodes.push(node);
  50491. }
  50492. if (expandedKeys.has(node.key)) {
  50493. const children = node.children;
  50494. if (children) {
  50495. const length = children.length;
  50496. for (let i = length - 1; i >= 0; --i) {
  50497. stack.push(children[i]);
  50498. }
  50499. }
  50500. }
  50501. }
  50502. }
  50503. traverse();
  50504. return flattenNodes;
  50505. });
  50506. const isNotEmpty = vue.computed(() => {
  50507. return flattenTree.value.length > 0;
  50508. });
  50509. function createTree(data) {
  50510. const treeNodeMap = /* @__PURE__ */ new Map();
  50511. const levelTreeNodeMap = /* @__PURE__ */ new Map();
  50512. let maxLevel = 1;
  50513. function traverse(nodes, level = 1, parent = void 0) {
  50514. var _a;
  50515. const siblings = [];
  50516. for (const rawNode of nodes) {
  50517. const value = getKey(rawNode);
  50518. const node = {
  50519. level,
  50520. key: value,
  50521. data: rawNode
  50522. };
  50523. node.label = getLabel(rawNode);
  50524. node.parent = parent;
  50525. const children = getChildren(rawNode);
  50526. node.disabled = getDisabled(rawNode);
  50527. node.isLeaf = !children || children.length === 0;
  50528. if (children && children.length) {
  50529. node.children = traverse(children, level + 1, node);
  50530. }
  50531. siblings.push(node);
  50532. treeNodeMap.set(value, node);
  50533. if (!levelTreeNodeMap.has(level)) {
  50534. levelTreeNodeMap.set(level, []);
  50535. }
  50536. (_a = levelTreeNodeMap.get(level)) == null ? void 0 : _a.push(node);
  50537. }
  50538. if (level > maxLevel) {
  50539. maxLevel = level;
  50540. }
  50541. return siblings;
  50542. }
  50543. const treeNodes = traverse(data);
  50544. return {
  50545. treeNodeMap,
  50546. levelTreeNodeMap,
  50547. maxLevel,
  50548. treeNodes
  50549. };
  50550. }
  50551. function filter(query) {
  50552. const keys = doFilter(query);
  50553. if (keys) {
  50554. expandedKeySet.value = keys;
  50555. }
  50556. }
  50557. function getChildren(node) {
  50558. return node[childrenKey.value];
  50559. }
  50560. function getKey(node) {
  50561. if (!node) {
  50562. return "";
  50563. }
  50564. return node[valueKey.value];
  50565. }
  50566. function getDisabled(node) {
  50567. return node[disabledKey.value];
  50568. }
  50569. function getLabel(node) {
  50570. return node[labelKey.value];
  50571. }
  50572. function toggleExpand(node) {
  50573. const expandedKeys = expandedKeySet.value;
  50574. if (expandedKeys.has(node.key)) {
  50575. collapseNode(node);
  50576. } else {
  50577. expandNode(node);
  50578. }
  50579. }
  50580. function setExpandedKeys(keys) {
  50581. expandedKeySet.value = new Set(keys);
  50582. }
  50583. function handleNodeClick(node, e) {
  50584. emit(NODE_CLICK, node.data, node, e);
  50585. handleCurrentChange(node);
  50586. if (props.expandOnClickNode) {
  50587. toggleExpand(node);
  50588. }
  50589. if (props.showCheckbox && props.checkOnClickNode && !node.disabled) {
  50590. toggleCheckbox(node, !isChecked(node), true);
  50591. }
  50592. }
  50593. function handleCurrentChange(node) {
  50594. if (!isCurrent(node)) {
  50595. currentKey.value = node.key;
  50596. emit(CURRENT_CHANGE, node.data, node);
  50597. }
  50598. }
  50599. function handleNodeCheck(node, checked) {
  50600. toggleCheckbox(node, checked);
  50601. }
  50602. function expandNode(node) {
  50603. const keySet = expandedKeySet.value;
  50604. if (tree.value && props.accordion) {
  50605. const { treeNodeMap } = tree.value;
  50606. keySet.forEach((key) => {
  50607. const treeNode = treeNodeMap.get(key);
  50608. if (node && node.level === (treeNode == null ? void 0 : treeNode.level)) {
  50609. keySet.delete(key);
  50610. }
  50611. });
  50612. }
  50613. keySet.add(node.key);
  50614. emit(NODE_EXPAND, node.data, node);
  50615. }
  50616. function collapseNode(node) {
  50617. expandedKeySet.value.delete(node.key);
  50618. emit(NODE_COLLAPSE, node.data, node);
  50619. }
  50620. function isExpanded(node) {
  50621. return expandedKeySet.value.has(node.key);
  50622. }
  50623. function isDisabled(node) {
  50624. return !!node.disabled;
  50625. }
  50626. function isCurrent(node) {
  50627. const current = currentKey.value;
  50628. return !!current && current === node.key;
  50629. }
  50630. function getCurrentNode() {
  50631. var _a, _b;
  50632. if (!currentKey.value)
  50633. return void 0;
  50634. return (_b = (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(currentKey.value)) == null ? void 0 : _b.data;
  50635. }
  50636. function getCurrentKey() {
  50637. return currentKey.value;
  50638. }
  50639. function setCurrentKey(key) {
  50640. currentKey.value = key;
  50641. }
  50642. function setData(data) {
  50643. vue.nextTick(() => tree.value = createTree(data));
  50644. }
  50645. function getNode(data) {
  50646. var _a;
  50647. const key = isObject$1(data) ? getKey(data) : data;
  50648. return (_a = tree.value) == null ? void 0 : _a.treeNodeMap.get(key);
  50649. }
  50650. return {
  50651. tree,
  50652. flattenTree,
  50653. isNotEmpty,
  50654. getKey,
  50655. getChildren,
  50656. toggleExpand,
  50657. toggleCheckbox,
  50658. isExpanded,
  50659. isChecked,
  50660. isIndeterminate,
  50661. isDisabled,
  50662. isCurrent,
  50663. isForceHiddenExpandIcon,
  50664. handleNodeClick,
  50665. handleNodeCheck,
  50666. getCurrentNode,
  50667. getCurrentKey,
  50668. setCurrentKey,
  50669. getCheckedKeys,
  50670. getCheckedNodes,
  50671. getHalfCheckedKeys,
  50672. getHalfCheckedNodes,
  50673. setChecked,
  50674. setCheckedKeys,
  50675. filter,
  50676. setData,
  50677. getNode,
  50678. expandNode,
  50679. collapseNode,
  50680. setExpandedKeys
  50681. };
  50682. }
  50683. var ElNodeContent = vue.defineComponent({
  50684. name: "ElTreeNodeContent",
  50685. props: treeNodeContentProps,
  50686. setup(props) {
  50687. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  50688. const ns = useNamespace("tree");
  50689. return () => {
  50690. const node = props.node;
  50691. const { data } = node;
  50692. return (tree == null ? void 0 : tree.ctx.slots.default) ? tree.ctx.slots.default({ node, data }) : vue.h("span", { class: ns.be("node", "label") }, [node == null ? void 0 : node.label]);
  50693. };
  50694. }
  50695. });
  50696. const _hoisted_1$6 = ["aria-expanded", "aria-disabled", "aria-checked", "data-key", "onClick"];
  50697. const __default__$7 = vue.defineComponent({
  50698. name: "ElTreeNode"
  50699. });
  50700. const _sfc_main$8 = /* @__PURE__ */ vue.defineComponent({
  50701. ...__default__$7,
  50702. props: treeNodeProps,
  50703. emits: treeNodeEmits,
  50704. setup(__props, { emit }) {
  50705. const props = __props;
  50706. const tree = vue.inject(ROOT_TREE_INJECTION_KEY);
  50707. const ns = useNamespace("tree");
  50708. const indent = vue.computed(() => {
  50709. var _a;
  50710. return (_a = tree == null ? void 0 : tree.props.indent) != null ? _a : 16;
  50711. });
  50712. const icon = vue.computed(() => {
  50713. var _a;
  50714. return (_a = tree == null ? void 0 : tree.props.icon) != null ? _a : caret_right_default;
  50715. });
  50716. const handleClick = (e) => {
  50717. emit("click", props.node, e);
  50718. };
  50719. const handleExpandIconClick = () => {
  50720. emit("toggle", props.node);
  50721. };
  50722. const handleCheckChange = (value) => {
  50723. emit("check", props.node, value);
  50724. };
  50725. const handleContextMenu = (event) => {
  50726. var _a, _b, _c, _d;
  50727. 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"]) {
  50728. event.stopPropagation();
  50729. event.preventDefault();
  50730. }
  50731. tree == null ? void 0 : tree.ctx.emit(NODE_CONTEXTMENU, event, (_d = props.node) == null ? void 0 : _d.data, props.node);
  50732. };
  50733. return (_ctx, _cache) => {
  50734. var _a, _b, _c;
  50735. return vue.openBlock(), vue.createElementBlock("div", {
  50736. ref: "node$",
  50737. class: vue.normalizeClass([
  50738. vue.unref(ns).b("node"),
  50739. vue.unref(ns).is("expanded", _ctx.expanded),
  50740. vue.unref(ns).is("current", _ctx.current),
  50741. vue.unref(ns).is("focusable", !_ctx.disabled),
  50742. vue.unref(ns).is("checked", !_ctx.disabled && _ctx.checked)
  50743. ]),
  50744. role: "treeitem",
  50745. tabindex: "-1",
  50746. "aria-expanded": _ctx.expanded,
  50747. "aria-disabled": _ctx.disabled,
  50748. "aria-checked": _ctx.checked,
  50749. "data-key": (_a = _ctx.node) == null ? void 0 : _a.key,
  50750. onClick: vue.withModifiers(handleClick, ["stop"]),
  50751. onContextmenu: handleContextMenu
  50752. }, [
  50753. vue.createElementVNode("div", {
  50754. class: vue.normalizeClass(vue.unref(ns).be("node", "content")),
  50755. style: vue.normalizeStyle({ paddingLeft: `${(_ctx.node.level - 1) * vue.unref(indent)}px` })
  50756. }, [
  50757. vue.unref(icon) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  50758. key: 0,
  50759. class: vue.normalizeClass([
  50760. vue.unref(ns).is("leaf", !!((_b = _ctx.node) == null ? void 0 : _b.isLeaf)),
  50761. vue.unref(ns).is("hidden", _ctx.hiddenExpandIcon),
  50762. {
  50763. expanded: !((_c = _ctx.node) == null ? void 0 : _c.isLeaf) && _ctx.expanded
  50764. },
  50765. vue.unref(ns).be("node", "expand-icon")
  50766. ]),
  50767. onClick: vue.withModifiers(handleExpandIconClick, ["stop"])
  50768. }, {
  50769. default: vue.withCtx(() => [
  50770. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(icon))))
  50771. ]),
  50772. _: 1
  50773. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  50774. _ctx.showCheckbox ? (vue.openBlock(), vue.createBlock(vue.unref(ElCheckbox), {
  50775. key: 1,
  50776. "model-value": _ctx.checked,
  50777. indeterminate: _ctx.indeterminate,
  50778. disabled: _ctx.disabled,
  50779. onChange: handleCheckChange,
  50780. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  50781. }, ["stop"]))
  50782. }, null, 8, ["model-value", "indeterminate", "disabled"])) : vue.createCommentVNode("v-if", true),
  50783. vue.createVNode(vue.unref(ElNodeContent), { node: _ctx.node }, null, 8, ["node"])
  50784. ], 6)
  50785. ], 42, _hoisted_1$6);
  50786. };
  50787. }
  50788. });
  50789. var ElTreeNode = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__file", "tree-node.vue"]]);
  50790. const itemSize = 26;
  50791. const __default__$6 = vue.defineComponent({
  50792. name: "ElTreeV2"
  50793. });
  50794. const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
  50795. ...__default__$6,
  50796. props: treeProps,
  50797. emits: treeEmits,
  50798. setup(__props, { expose, emit }) {
  50799. const props = __props;
  50800. const slots = vue.useSlots();
  50801. vue.provide(ROOT_TREE_INJECTION_KEY, {
  50802. ctx: {
  50803. emit,
  50804. slots
  50805. },
  50806. props,
  50807. instance: vue.getCurrentInstance()
  50808. });
  50809. vue.provide(formItemContextKey, void 0);
  50810. const { t } = useLocale();
  50811. const ns = useNamespace("tree");
  50812. const {
  50813. flattenTree,
  50814. isNotEmpty,
  50815. toggleExpand,
  50816. isExpanded,
  50817. isIndeterminate,
  50818. isChecked,
  50819. isDisabled,
  50820. isCurrent,
  50821. isForceHiddenExpandIcon,
  50822. handleNodeClick,
  50823. handleNodeCheck,
  50824. toggleCheckbox,
  50825. getCurrentNode,
  50826. getCurrentKey,
  50827. setCurrentKey,
  50828. getCheckedKeys,
  50829. getCheckedNodes,
  50830. getHalfCheckedKeys,
  50831. getHalfCheckedNodes,
  50832. setChecked,
  50833. setCheckedKeys,
  50834. filter,
  50835. setData,
  50836. getNode,
  50837. expandNode,
  50838. collapseNode,
  50839. setExpandedKeys
  50840. } = useTree(props, emit);
  50841. expose({
  50842. toggleCheckbox,
  50843. getCurrentNode,
  50844. getCurrentKey,
  50845. setCurrentKey,
  50846. getCheckedKeys,
  50847. getCheckedNodes,
  50848. getHalfCheckedKeys,
  50849. getHalfCheckedNodes,
  50850. setChecked,
  50851. setCheckedKeys,
  50852. filter,
  50853. setData,
  50854. getNode,
  50855. expandNode,
  50856. collapseNode,
  50857. setExpandedKeys
  50858. });
  50859. return (_ctx, _cache) => {
  50860. var _a;
  50861. return vue.openBlock(), vue.createElementBlock("div", {
  50862. class: vue.normalizeClass([vue.unref(ns).b(), { [vue.unref(ns).m("highlight-current")]: _ctx.highlightCurrent }]),
  50863. role: "tree"
  50864. }, [
  50865. vue.unref(isNotEmpty) ? (vue.openBlock(), vue.createBlock(vue.unref(FixedSizeList$1), {
  50866. key: 0,
  50867. "class-name": vue.unref(ns).b("virtual-list"),
  50868. data: vue.unref(flattenTree),
  50869. total: vue.unref(flattenTree).length,
  50870. height: _ctx.height,
  50871. "item-size": itemSize,
  50872. "perf-mode": _ctx.perfMode
  50873. }, {
  50874. default: vue.withCtx(({ data, index, style }) => [
  50875. (vue.openBlock(), vue.createBlock(ElTreeNode, {
  50876. key: data[index].key,
  50877. style: vue.normalizeStyle(style),
  50878. node: data[index],
  50879. expanded: vue.unref(isExpanded)(data[index]),
  50880. "show-checkbox": _ctx.showCheckbox,
  50881. checked: vue.unref(isChecked)(data[index]),
  50882. indeterminate: vue.unref(isIndeterminate)(data[index]),
  50883. disabled: vue.unref(isDisabled)(data[index]),
  50884. current: vue.unref(isCurrent)(data[index]),
  50885. "hidden-expand-icon": vue.unref(isForceHiddenExpandIcon)(data[index]),
  50886. onClick: vue.unref(handleNodeClick),
  50887. onToggle: vue.unref(toggleExpand),
  50888. onCheck: vue.unref(handleNodeCheck)
  50889. }, null, 8, ["style", "node", "expanded", "show-checkbox", "checked", "indeterminate", "disabled", "current", "hidden-expand-icon", "onClick", "onToggle", "onCheck"]))
  50890. ]),
  50891. _: 1
  50892. }, 8, ["class-name", "data", "total", "height", "perf-mode"])) : (vue.openBlock(), vue.createElementBlock("div", {
  50893. key: 1,
  50894. class: vue.normalizeClass(vue.unref(ns).e("empty-block"))
  50895. }, [
  50896. vue.createElementVNode("span", {
  50897. class: vue.normalizeClass(vue.unref(ns).e("empty-text"))
  50898. }, vue.toDisplayString((_a = _ctx.emptyText) != null ? _a : vue.unref(t)("el.tree.emptyText")), 3)
  50899. ], 2))
  50900. ], 2);
  50901. };
  50902. }
  50903. });
  50904. var TreeV2 = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["__file", "tree.vue"]]);
  50905. const ElTreeV2 = withInstall(TreeV2);
  50906. const SCOPE$2 = "ElUpload";
  50907. class UploadAjaxError extends Error {
  50908. constructor(message, status, method, url) {
  50909. super(message);
  50910. this.name = "UploadAjaxError";
  50911. this.status = status;
  50912. this.method = method;
  50913. this.url = url;
  50914. }
  50915. }
  50916. function getError(action, option, xhr) {
  50917. let msg;
  50918. if (xhr.response) {
  50919. msg = `${xhr.response.error || xhr.response}`;
  50920. } else if (xhr.responseText) {
  50921. msg = `${xhr.responseText}`;
  50922. } else {
  50923. msg = `fail to ${option.method} ${action} ${xhr.status}`;
  50924. }
  50925. return new UploadAjaxError(msg, xhr.status, option.method, action);
  50926. }
  50927. function getBody(xhr) {
  50928. const text = xhr.responseText || xhr.response;
  50929. if (!text) {
  50930. return text;
  50931. }
  50932. try {
  50933. return JSON.parse(text);
  50934. } catch (e) {
  50935. return text;
  50936. }
  50937. }
  50938. const ajaxUpload = (option) => {
  50939. if (typeof XMLHttpRequest === "undefined")
  50940. throwError(SCOPE$2, "XMLHttpRequest is undefined");
  50941. const xhr = new XMLHttpRequest();
  50942. const action = option.action;
  50943. if (xhr.upload) {
  50944. xhr.upload.addEventListener("progress", (evt) => {
  50945. const progressEvt = evt;
  50946. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  50947. option.onProgress(progressEvt);
  50948. });
  50949. }
  50950. const formData = new FormData();
  50951. if (option.data) {
  50952. for (const [key, value] of Object.entries(option.data)) {
  50953. if (Array.isArray(value))
  50954. formData.append(key, ...value);
  50955. else
  50956. formData.append(key, value);
  50957. }
  50958. }
  50959. formData.append(option.filename, option.file, option.file.name);
  50960. xhr.addEventListener("error", () => {
  50961. option.onError(getError(action, option, xhr));
  50962. });
  50963. xhr.addEventListener("load", () => {
  50964. if (xhr.status < 200 || xhr.status >= 300) {
  50965. return option.onError(getError(action, option, xhr));
  50966. }
  50967. option.onSuccess(getBody(xhr));
  50968. });
  50969. xhr.open(option.method, action, true);
  50970. if (option.withCredentials && "withCredentials" in xhr) {
  50971. xhr.withCredentials = true;
  50972. }
  50973. const headers = option.headers || {};
  50974. if (headers instanceof Headers) {
  50975. headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  50976. } else {
  50977. for (const [key, value] of Object.entries(headers)) {
  50978. if (isNil(value))
  50979. continue;
  50980. xhr.setRequestHeader(key, String(value));
  50981. }
  50982. }
  50983. xhr.send(formData);
  50984. return xhr;
  50985. };
  50986. const uploadListTypes = ["text", "picture", "picture-card"];
  50987. let fileId = 1;
  50988. const genFileId = () => Date.now() + fileId++;
  50989. const uploadBaseProps = buildProps({
  50990. action: {
  50991. type: String,
  50992. default: "#"
  50993. },
  50994. headers: {
  50995. type: definePropType(Object)
  50996. },
  50997. method: {
  50998. type: String,
  50999. default: "post"
  51000. },
  51001. data: {
  51002. type: Object,
  51003. default: () => mutable({})
  51004. },
  51005. multiple: {
  51006. type: Boolean,
  51007. default: false
  51008. },
  51009. name: {
  51010. type: String,
  51011. default: "file"
  51012. },
  51013. drag: {
  51014. type: Boolean,
  51015. default: false
  51016. },
  51017. withCredentials: Boolean,
  51018. showFileList: {
  51019. type: Boolean,
  51020. default: true
  51021. },
  51022. accept: {
  51023. type: String,
  51024. default: ""
  51025. },
  51026. type: {
  51027. type: String,
  51028. default: "select"
  51029. },
  51030. fileList: {
  51031. type: definePropType(Array),
  51032. default: () => mutable([])
  51033. },
  51034. autoUpload: {
  51035. type: Boolean,
  51036. default: true
  51037. },
  51038. listType: {
  51039. type: String,
  51040. values: uploadListTypes,
  51041. default: "text"
  51042. },
  51043. httpRequest: {
  51044. type: definePropType(Function),
  51045. default: ajaxUpload
  51046. },
  51047. disabled: Boolean,
  51048. limit: Number
  51049. });
  51050. const uploadProps = buildProps({
  51051. ...uploadBaseProps,
  51052. beforeUpload: {
  51053. type: definePropType(Function),
  51054. default: NOOP
  51055. },
  51056. beforeRemove: {
  51057. type: definePropType(Function)
  51058. },
  51059. onRemove: {
  51060. type: definePropType(Function),
  51061. default: NOOP
  51062. },
  51063. onChange: {
  51064. type: definePropType(Function),
  51065. default: NOOP
  51066. },
  51067. onPreview: {
  51068. type: definePropType(Function),
  51069. default: NOOP
  51070. },
  51071. onSuccess: {
  51072. type: definePropType(Function),
  51073. default: NOOP
  51074. },
  51075. onProgress: {
  51076. type: definePropType(Function),
  51077. default: NOOP
  51078. },
  51079. onError: {
  51080. type: definePropType(Function),
  51081. default: NOOP
  51082. },
  51083. onExceed: {
  51084. type: definePropType(Function),
  51085. default: NOOP
  51086. }
  51087. });
  51088. const uploadListProps = buildProps({
  51089. files: {
  51090. type: definePropType(Array),
  51091. default: () => mutable([])
  51092. },
  51093. disabled: {
  51094. type: Boolean,
  51095. default: false
  51096. },
  51097. handlePreview: {
  51098. type: definePropType(Function),
  51099. default: NOOP
  51100. },
  51101. listType: {
  51102. type: String,
  51103. values: uploadListTypes,
  51104. default: "text"
  51105. }
  51106. });
  51107. const uploadListEmits = {
  51108. remove: (file) => !!file
  51109. };
  51110. const _hoisted_1$5 = ["onKeydown"];
  51111. const _hoisted_2$4 = ["src"];
  51112. const _hoisted_3$2 = ["onClick"];
  51113. const _hoisted_4$1 = ["onClick"];
  51114. const _hoisted_5 = ["onClick"];
  51115. const __default__$5 = vue.defineComponent({
  51116. name: "ElUploadList"
  51117. });
  51118. const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
  51119. ...__default__$5,
  51120. props: uploadListProps,
  51121. emits: uploadListEmits,
  51122. setup(__props, { emit }) {
  51123. const { t } = useLocale();
  51124. const nsUpload = useNamespace("upload");
  51125. const nsIcon = useNamespace("icon");
  51126. const nsList = useNamespace("list");
  51127. const focusing = vue.ref(false);
  51128. const handleRemove = (file) => {
  51129. emit("remove", file);
  51130. };
  51131. return (_ctx, _cache) => {
  51132. return vue.openBlock(), vue.createBlock(vue.TransitionGroup, {
  51133. tag: "ul",
  51134. class: vue.normalizeClass([
  51135. vue.unref(nsUpload).b("list"),
  51136. vue.unref(nsUpload).bm("list", _ctx.listType),
  51137. vue.unref(nsUpload).is("disabled", _ctx.disabled)
  51138. ]),
  51139. name: vue.unref(nsList).b()
  51140. }, {
  51141. default: vue.withCtx(() => [
  51142. (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.files, (file) => {
  51143. return vue.openBlock(), vue.createElementBlock("li", {
  51144. key: file.uid || file.name,
  51145. class: vue.normalizeClass([
  51146. vue.unref(nsUpload).be("list", "item"),
  51147. vue.unref(nsUpload).is(file.status),
  51148. { focusing: focusing.value }
  51149. ]),
  51150. tabindex: "0",
  51151. onKeydown: vue.withKeys(($event) => !_ctx.disabled && handleRemove(file), ["delete"]),
  51152. onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
  51153. onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
  51154. onClick: _cache[2] || (_cache[2] = ($event) => focusing.value = false)
  51155. }, [
  51156. vue.renderSlot(_ctx.$slots, "default", { file }, () => [
  51157. _ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("img", {
  51158. key: 0,
  51159. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-thumbnail")),
  51160. src: file.url,
  51161. alt: ""
  51162. }, null, 10, _hoisted_2$4)) : vue.createCommentVNode("v-if", true),
  51163. file.status === "uploading" || _ctx.listType !== "picture-card" ? (vue.openBlock(), vue.createElementBlock("div", {
  51164. key: 1,
  51165. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-info"))
  51166. }, [
  51167. vue.createElementVNode("a", {
  51168. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-name")),
  51169. onClick: vue.withModifiers(($event) => _ctx.handlePreview(file), ["prevent"])
  51170. }, [
  51171. vue.createVNode(vue.unref(ElIcon), {
  51172. class: vue.normalizeClass(vue.unref(nsIcon).m("document"))
  51173. }, {
  51174. default: vue.withCtx(() => [
  51175. vue.createVNode(vue.unref(document_default))
  51176. ]),
  51177. _: 1
  51178. }, 8, ["class"]),
  51179. vue.createElementVNode("span", {
  51180. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-file-name"))
  51181. }, vue.toDisplayString(file.name), 3)
  51182. ], 10, _hoisted_3$2),
  51183. file.status === "uploading" ? (vue.openBlock(), vue.createBlock(vue.unref(ElProgress), {
  51184. key: 0,
  51185. type: _ctx.listType === "picture-card" ? "circle" : "line",
  51186. "stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
  51187. percentage: Number(file.percentage),
  51188. style: vue.normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  51189. }, null, 8, ["type", "stroke-width", "percentage", "style"])) : vue.createCommentVNode("v-if", true)
  51190. ], 2)) : vue.createCommentVNode("v-if", true),
  51191. vue.createElementVNode("label", {
  51192. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-status-label"))
  51193. }, [
  51194. _ctx.listType === "text" ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  51195. key: 0,
  51196. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("circle-check")])
  51197. }, {
  51198. default: vue.withCtx(() => [
  51199. vue.createVNode(vue.unref(circle_check_default))
  51200. ]),
  51201. _: 1
  51202. }, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  51203. key: 1,
  51204. class: vue.normalizeClass([vue.unref(nsIcon).m("upload-success"), vue.unref(nsIcon).m("check")])
  51205. }, {
  51206. default: vue.withCtx(() => [
  51207. vue.createVNode(vue.unref(check_default))
  51208. ]),
  51209. _: 1
  51210. }, 8, ["class"])) : vue.createCommentVNode("v-if", true)
  51211. ], 2),
  51212. !_ctx.disabled ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  51213. key: 2,
  51214. class: vue.normalizeClass(vue.unref(nsIcon).m("close")),
  51215. onClick: ($event) => handleRemove(file)
  51216. }, {
  51217. default: vue.withCtx(() => [
  51218. vue.createVNode(vue.unref(close_default))
  51219. ]),
  51220. _: 2
  51221. }, 1032, ["class", "onClick"])) : vue.createCommentVNode("v-if", true),
  51222. vue.createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
  51223. vue.createCommentVNode(" This is a bug which needs to be fixed "),
  51224. vue.createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
  51225. !_ctx.disabled ? (vue.openBlock(), vue.createElementBlock("i", {
  51226. key: 3,
  51227. class: vue.normalizeClass(vue.unref(nsIcon).m("close-tip"))
  51228. }, vue.toDisplayString(vue.unref(t)("el.upload.deleteTip")), 3)) : vue.createCommentVNode("v-if", true),
  51229. _ctx.listType === "picture-card" ? (vue.openBlock(), vue.createElementBlock("span", {
  51230. key: 4,
  51231. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-actions"))
  51232. }, [
  51233. vue.createElementVNode("span", {
  51234. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-preview")),
  51235. onClick: ($event) => _ctx.handlePreview(file)
  51236. }, [
  51237. vue.createVNode(vue.unref(ElIcon), {
  51238. class: vue.normalizeClass(vue.unref(nsIcon).m("zoom-in"))
  51239. }, {
  51240. default: vue.withCtx(() => [
  51241. vue.createVNode(vue.unref(zoom_in_default))
  51242. ]),
  51243. _: 1
  51244. }, 8, ["class"])
  51245. ], 10, _hoisted_4$1),
  51246. !_ctx.disabled ? (vue.openBlock(), vue.createElementBlock("span", {
  51247. key: 0,
  51248. class: vue.normalizeClass(vue.unref(nsUpload).be("list", "item-delete")),
  51249. onClick: ($event) => handleRemove(file)
  51250. }, [
  51251. vue.createVNode(vue.unref(ElIcon), {
  51252. class: vue.normalizeClass(vue.unref(nsIcon).m("delete"))
  51253. }, {
  51254. default: vue.withCtx(() => [
  51255. vue.createVNode(vue.unref(delete_default))
  51256. ]),
  51257. _: 1
  51258. }, 8, ["class"])
  51259. ], 10, _hoisted_5)) : vue.createCommentVNode("v-if", true)
  51260. ], 2)) : vue.createCommentVNode("v-if", true)
  51261. ])
  51262. ], 42, _hoisted_1$5);
  51263. }), 128)),
  51264. vue.renderSlot(_ctx.$slots, "append")
  51265. ]),
  51266. _: 3
  51267. }, 8, ["class", "name"]);
  51268. };
  51269. }
  51270. });
  51271. var UploadList = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__file", "upload-list.vue"]]);
  51272. const uploadDraggerProps = buildProps({
  51273. disabled: {
  51274. type: Boolean,
  51275. default: false
  51276. }
  51277. });
  51278. const uploadDraggerEmits = {
  51279. file: (file) => isArray(file)
  51280. };
  51281. const _hoisted_1$4 = ["onDrop", "onDragover"];
  51282. const COMPONENT_NAME = "ElUploadDrag";
  51283. const __default__$4 = vue.defineComponent({
  51284. name: COMPONENT_NAME
  51285. });
  51286. const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
  51287. ...__default__$4,
  51288. props: uploadDraggerProps,
  51289. emits: uploadDraggerEmits,
  51290. setup(__props, { emit }) {
  51291. const props = __props;
  51292. const uploaderContext = vue.inject(uploadContextKey);
  51293. if (!uploaderContext) {
  51294. throwError(COMPONENT_NAME, "usage: <el-upload><el-upload-dragger /></el-upload>");
  51295. }
  51296. const ns = useNamespace("upload");
  51297. const dragover = vue.ref(false);
  51298. const onDrop = (e) => {
  51299. if (props.disabled)
  51300. return;
  51301. dragover.value = false;
  51302. const files = Array.from(e.dataTransfer.files);
  51303. const accept = uploaderContext.accept.value;
  51304. if (!accept) {
  51305. emit("file", files);
  51306. return;
  51307. }
  51308. const filesFiltered = files.filter((file) => {
  51309. const { type, name } = file;
  51310. const extension = name.includes(".") ? `.${name.split(".").pop()}` : "";
  51311. const baseType = type.replace(/\/.*$/, "");
  51312. return accept.split(",").map((type2) => type2.trim()).filter((type2) => type2).some((acceptedType) => {
  51313. if (acceptedType.startsWith(".")) {
  51314. return extension === acceptedType;
  51315. }
  51316. if (/\/\*$/.test(acceptedType)) {
  51317. return baseType === acceptedType.replace(/\/\*$/, "");
  51318. }
  51319. if (/^[^/]+\/[^/]+$/.test(acceptedType)) {
  51320. return type === acceptedType;
  51321. }
  51322. return false;
  51323. });
  51324. });
  51325. emit("file", filesFiltered);
  51326. };
  51327. const onDragover = () => {
  51328. if (!props.disabled)
  51329. dragover.value = true;
  51330. };
  51331. return (_ctx, _cache) => {
  51332. return vue.openBlock(), vue.createElementBlock("div", {
  51333. class: vue.normalizeClass([vue.unref(ns).b("dragger"), vue.unref(ns).is("dragover", dragover.value)]),
  51334. onDrop: vue.withModifiers(onDrop, ["prevent"]),
  51335. onDragover: vue.withModifiers(onDragover, ["prevent"]),
  51336. onDragleave: _cache[0] || (_cache[0] = vue.withModifiers(($event) => dragover.value = false, ["prevent"]))
  51337. }, [
  51338. vue.renderSlot(_ctx.$slots, "default")
  51339. ], 42, _hoisted_1$4);
  51340. };
  51341. }
  51342. });
  51343. var UploadDragger = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "upload-dragger.vue"]]);
  51344. const uploadContentProps = buildProps({
  51345. ...uploadBaseProps,
  51346. beforeUpload: {
  51347. type: definePropType(Function),
  51348. default: NOOP
  51349. },
  51350. onRemove: {
  51351. type: definePropType(Function),
  51352. default: NOOP
  51353. },
  51354. onStart: {
  51355. type: definePropType(Function),
  51356. default: NOOP
  51357. },
  51358. onSuccess: {
  51359. type: definePropType(Function),
  51360. default: NOOP
  51361. },
  51362. onProgress: {
  51363. type: definePropType(Function),
  51364. default: NOOP
  51365. },
  51366. onError: {
  51367. type: definePropType(Function),
  51368. default: NOOP
  51369. },
  51370. onExceed: {
  51371. type: definePropType(Function),
  51372. default: NOOP
  51373. }
  51374. });
  51375. const _hoisted_1$3 = ["onKeydown"];
  51376. const _hoisted_2$3 = ["name", "multiple", "accept"];
  51377. const __default__$3 = vue.defineComponent({
  51378. name: "ElUploadContent",
  51379. inheritAttrs: false
  51380. });
  51381. const _sfc_main$4 = /* @__PURE__ */ vue.defineComponent({
  51382. ...__default__$3,
  51383. props: uploadContentProps,
  51384. setup(__props, { expose }) {
  51385. const props = __props;
  51386. const ns = useNamespace("upload");
  51387. const requests = vue.shallowRef({});
  51388. const inputRef = vue.shallowRef();
  51389. const uploadFiles = (files) => {
  51390. if (files.length === 0)
  51391. return;
  51392. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  51393. if (limit && fileList.length + files.length > limit) {
  51394. onExceed(files, fileList);
  51395. return;
  51396. }
  51397. if (!multiple) {
  51398. files = files.slice(0, 1);
  51399. }
  51400. for (const file of files) {
  51401. const rawFile = file;
  51402. rawFile.uid = genFileId();
  51403. onStart(rawFile);
  51404. if (autoUpload)
  51405. upload(rawFile);
  51406. }
  51407. };
  51408. const upload = async (rawFile) => {
  51409. inputRef.value.value = "";
  51410. if (!props.beforeUpload) {
  51411. return doUpload(rawFile);
  51412. }
  51413. let hookResult;
  51414. try {
  51415. hookResult = await props.beforeUpload(rawFile);
  51416. } catch (e) {
  51417. hookResult = false;
  51418. }
  51419. if (hookResult === false) {
  51420. props.onRemove(rawFile);
  51421. return;
  51422. }
  51423. let file = rawFile;
  51424. if (hookResult instanceof Blob) {
  51425. if (hookResult instanceof File) {
  51426. file = hookResult;
  51427. } else {
  51428. file = new File([hookResult], rawFile.name, {
  51429. type: rawFile.type
  51430. });
  51431. }
  51432. }
  51433. doUpload(Object.assign(file, {
  51434. uid: rawFile.uid
  51435. }));
  51436. };
  51437. const doUpload = (rawFile) => {
  51438. const {
  51439. headers,
  51440. data,
  51441. method,
  51442. withCredentials,
  51443. name: filename,
  51444. action,
  51445. onProgress,
  51446. onSuccess,
  51447. onError,
  51448. httpRequest
  51449. } = props;
  51450. const { uid } = rawFile;
  51451. const options = {
  51452. headers: headers || {},
  51453. withCredentials,
  51454. file: rawFile,
  51455. data,
  51456. method,
  51457. filename,
  51458. action,
  51459. onProgress: (evt) => {
  51460. onProgress(evt, rawFile);
  51461. },
  51462. onSuccess: (res) => {
  51463. onSuccess(res, rawFile);
  51464. delete requests.value[uid];
  51465. },
  51466. onError: (err) => {
  51467. onError(err, rawFile);
  51468. delete requests.value[uid];
  51469. }
  51470. };
  51471. const request = httpRequest(options);
  51472. requests.value[uid] = request;
  51473. if (request instanceof Promise) {
  51474. request.then(options.onSuccess, options.onError);
  51475. }
  51476. };
  51477. const handleChange = (e) => {
  51478. const files = e.target.files;
  51479. if (!files)
  51480. return;
  51481. uploadFiles(Array.from(files));
  51482. };
  51483. const handleClick = () => {
  51484. if (!props.disabled) {
  51485. inputRef.value.value = "";
  51486. inputRef.value.click();
  51487. }
  51488. };
  51489. const handleKeydown = () => {
  51490. handleClick();
  51491. };
  51492. const abort = (file) => {
  51493. const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
  51494. _reqs.forEach(([uid, req]) => {
  51495. if (req instanceof XMLHttpRequest)
  51496. req.abort();
  51497. delete requests.value[uid];
  51498. });
  51499. };
  51500. expose({
  51501. abort,
  51502. upload
  51503. });
  51504. return (_ctx, _cache) => {
  51505. return vue.openBlock(), vue.createElementBlock("div", {
  51506. class: vue.normalizeClass([vue.unref(ns).b(), vue.unref(ns).m(_ctx.listType), vue.unref(ns).is("drag", _ctx.drag)]),
  51507. tabindex: "0",
  51508. onClick: handleClick,
  51509. onKeydown: vue.withKeys(vue.withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  51510. }, [
  51511. _ctx.drag ? (vue.openBlock(), vue.createBlock(UploadDragger, {
  51512. key: 0,
  51513. disabled: _ctx.disabled,
  51514. onFile: uploadFiles
  51515. }, {
  51516. default: vue.withCtx(() => [
  51517. vue.renderSlot(_ctx.$slots, "default")
  51518. ]),
  51519. _: 3
  51520. }, 8, ["disabled"])) : vue.renderSlot(_ctx.$slots, "default", { key: 1 }),
  51521. vue.createElementVNode("input", {
  51522. ref_key: "inputRef",
  51523. ref: inputRef,
  51524. class: vue.normalizeClass(vue.unref(ns).e("input")),
  51525. name: _ctx.name,
  51526. multiple: _ctx.multiple,
  51527. accept: _ctx.accept,
  51528. type: "file",
  51529. onChange: handleChange,
  51530. onClick: _cache[0] || (_cache[0] = vue.withModifiers(() => {
  51531. }, ["stop"]))
  51532. }, null, 42, _hoisted_2$3)
  51533. ], 42, _hoisted_1$3);
  51534. };
  51535. }
  51536. });
  51537. var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "upload-content.vue"]]);
  51538. const SCOPE$1 = "ElUpload";
  51539. const revokeObjectURL = (file) => {
  51540. var _a;
  51541. if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) {
  51542. URL.revokeObjectURL(file.url);
  51543. }
  51544. };
  51545. const useHandlers = (props, uploadRef) => {
  51546. const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
  51547. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  51548. function abort(file) {
  51549. var _a;
  51550. (_a = uploadRef.value) == null ? void 0 : _a.abort(file);
  51551. }
  51552. function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
  51553. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  51554. }
  51555. const handleError = (err, rawFile) => {
  51556. const file = getFile(rawFile);
  51557. if (!file)
  51558. return;
  51559. console.error(err);
  51560. file.status = "fail";
  51561. uploadFiles.value.splice(uploadFiles.value.indexOf(file), 1);
  51562. props.onError(err, file, uploadFiles.value);
  51563. props.onChange(file, uploadFiles.value);
  51564. };
  51565. const handleProgress = (evt, rawFile) => {
  51566. const file = getFile(rawFile);
  51567. if (!file)
  51568. return;
  51569. props.onProgress(evt, file, uploadFiles.value);
  51570. file.status = "uploading";
  51571. file.percentage = Math.round(evt.percent);
  51572. };
  51573. const handleSuccess = (response, rawFile) => {
  51574. const file = getFile(rawFile);
  51575. if (!file)
  51576. return;
  51577. file.status = "success";
  51578. file.response = response;
  51579. props.onSuccess(response, file, uploadFiles.value);
  51580. props.onChange(file, uploadFiles.value);
  51581. };
  51582. const handleStart = (file) => {
  51583. if (isNil(file.uid))
  51584. file.uid = genFileId();
  51585. const uploadFile = {
  51586. name: file.name,
  51587. percentage: 0,
  51588. status: "ready",
  51589. size: file.size,
  51590. raw: file,
  51591. uid: file.uid
  51592. };
  51593. if (props.listType === "picture-card" || props.listType === "picture") {
  51594. try {
  51595. uploadFile.url = URL.createObjectURL(file);
  51596. } catch (err) {
  51597. debugWarn(SCOPE$1, err.message);
  51598. props.onError(err, uploadFile, uploadFiles.value);
  51599. }
  51600. }
  51601. uploadFiles.value = [...uploadFiles.value, uploadFile];
  51602. props.onChange(uploadFile, uploadFiles.value);
  51603. };
  51604. const handleRemove = async (file) => {
  51605. const uploadFile = file instanceof File ? getFile(file) : file;
  51606. if (!uploadFile)
  51607. throwError(SCOPE$1, "file to be removed not found");
  51608. const doRemove = (file2) => {
  51609. abort(file2);
  51610. const fileList = uploadFiles.value;
  51611. fileList.splice(fileList.indexOf(file2), 1);
  51612. props.onRemove(file2, fileList);
  51613. revokeObjectURL(file2);
  51614. };
  51615. if (props.beforeRemove) {
  51616. const before = await props.beforeRemove(uploadFile, uploadFiles.value);
  51617. if (before !== false)
  51618. doRemove(uploadFile);
  51619. } else {
  51620. doRemove(uploadFile);
  51621. }
  51622. };
  51623. function submit() {
  51624. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
  51625. var _a;
  51626. return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw));
  51627. });
  51628. }
  51629. vue.watch(() => props.listType, (val) => {
  51630. if (val !== "picture-card" && val !== "picture") {
  51631. return;
  51632. }
  51633. uploadFiles.value = uploadFiles.value.map((file) => {
  51634. const { raw, url } = file;
  51635. if (!url && raw) {
  51636. try {
  51637. file.url = URL.createObjectURL(raw);
  51638. } catch (err) {
  51639. props.onError(err, file, uploadFiles.value);
  51640. }
  51641. }
  51642. return file;
  51643. });
  51644. });
  51645. vue.watch(uploadFiles, (files) => {
  51646. for (const file of files) {
  51647. file.uid || (file.uid = genFileId());
  51648. file.status || (file.status = "success");
  51649. }
  51650. }, { immediate: true, deep: true });
  51651. return {
  51652. uploadFiles,
  51653. abort,
  51654. clearFiles,
  51655. handleError,
  51656. handleProgress,
  51657. handleStart,
  51658. handleSuccess,
  51659. handleRemove,
  51660. submit
  51661. };
  51662. };
  51663. const __default__$2 = vue.defineComponent({
  51664. name: "ElUpload"
  51665. });
  51666. const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
  51667. ...__default__$2,
  51668. props: uploadProps,
  51669. setup(__props, { expose }) {
  51670. const props = __props;
  51671. const slots = vue.useSlots();
  51672. const disabled = useDisabled();
  51673. const uploadRef = vue.shallowRef();
  51674. const {
  51675. abort,
  51676. submit,
  51677. clearFiles,
  51678. uploadFiles,
  51679. handleStart,
  51680. handleError,
  51681. handleRemove,
  51682. handleSuccess,
  51683. handleProgress
  51684. } = useHandlers(props, uploadRef);
  51685. const isPictureCard = vue.computed(() => props.listType === "picture-card");
  51686. const uploadContentProps = vue.computed(() => ({
  51687. ...props,
  51688. fileList: uploadFiles.value,
  51689. onStart: handleStart,
  51690. onProgress: handleProgress,
  51691. onSuccess: handleSuccess,
  51692. onError: handleError,
  51693. onRemove: handleRemove
  51694. }));
  51695. vue.onBeforeUnmount(() => {
  51696. uploadFiles.value.forEach(({ url }) => {
  51697. if (url == null ? void 0 : url.startsWith("blob:"))
  51698. URL.revokeObjectURL(url);
  51699. });
  51700. });
  51701. vue.provide(uploadContextKey, {
  51702. accept: vue.toRef(props, "accept")
  51703. });
  51704. expose({
  51705. abort,
  51706. submit,
  51707. clearFiles,
  51708. handleStart,
  51709. handleRemove
  51710. });
  51711. return (_ctx, _cache) => {
  51712. return vue.openBlock(), vue.createElementBlock("div", null, [
  51713. vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  51714. key: 0,
  51715. disabled: vue.unref(disabled),
  51716. "list-type": _ctx.listType,
  51717. files: vue.unref(uploadFiles),
  51718. "handle-preview": _ctx.onPreview,
  51719. onRemove: vue.unref(handleRemove)
  51720. }, vue.createSlots({
  51721. append: vue.withCtx(() => [
  51722. vue.createVNode(UploadContent, vue.mergeProps({
  51723. ref_key: "uploadRef",
  51724. ref: uploadRef
  51725. }, vue.unref(uploadContentProps)), {
  51726. default: vue.withCtx(() => [
  51727. vue.unref(slots).trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  51728. !vue.unref(slots).trigger && vue.unref(slots).default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  51729. ]),
  51730. _: 3
  51731. }, 16)
  51732. ]),
  51733. _: 2
  51734. }, [
  51735. _ctx.$slots.file ? {
  51736. name: "default",
  51737. fn: vue.withCtx(({ file }) => [
  51738. vue.renderSlot(_ctx.$slots, "file", { file })
  51739. ])
  51740. } : void 0
  51741. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true),
  51742. !vue.unref(isPictureCard) || vue.unref(isPictureCard) && !_ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadContent, vue.mergeProps({
  51743. key: 1,
  51744. ref_key: "uploadRef",
  51745. ref: uploadRef
  51746. }, vue.unref(uploadContentProps)), {
  51747. default: vue.withCtx(() => [
  51748. vue.unref(slots).trigger ? vue.renderSlot(_ctx.$slots, "trigger", { key: 0 }) : vue.createCommentVNode("v-if", true),
  51749. !vue.unref(slots).trigger && vue.unref(slots).default ? vue.renderSlot(_ctx.$slots, "default", { key: 1 }) : vue.createCommentVNode("v-if", true)
  51750. ]),
  51751. _: 3
  51752. }, 16)) : vue.createCommentVNode("v-if", true),
  51753. _ctx.$slots.trigger ? vue.renderSlot(_ctx.$slots, "default", { key: 2 }) : vue.createCommentVNode("v-if", true),
  51754. vue.renderSlot(_ctx.$slots, "tip"),
  51755. !vue.unref(isPictureCard) && _ctx.showFileList ? (vue.openBlock(), vue.createBlock(UploadList, {
  51756. key: 3,
  51757. disabled: vue.unref(disabled),
  51758. "list-type": _ctx.listType,
  51759. files: vue.unref(uploadFiles),
  51760. "handle-preview": _ctx.onPreview,
  51761. onRemove: vue.unref(handleRemove)
  51762. }, vue.createSlots({ _: 2 }, [
  51763. _ctx.$slots.file ? {
  51764. name: "default",
  51765. fn: vue.withCtx(({ file }) => [
  51766. vue.renderSlot(_ctx.$slots, "file", { file })
  51767. ])
  51768. } : void 0
  51769. ]), 1032, ["disabled", "list-type", "files", "handle-preview", "onRemove"])) : vue.createCommentVNode("v-if", true)
  51770. ]);
  51771. };
  51772. }
  51773. });
  51774. var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "upload.vue"]]);
  51775. const ElUpload = withInstall(Upload);
  51776. var Components = [
  51777. ElAffix,
  51778. ElAlert,
  51779. ElAutocomplete,
  51780. ElAutoResizer,
  51781. ElAvatar,
  51782. ElBacktop,
  51783. ElBadge,
  51784. ElBreadcrumb,
  51785. ElBreadcrumbItem,
  51786. ElButton,
  51787. ElButtonGroup$1,
  51788. ElCalendar,
  51789. ElCard,
  51790. ElCarousel,
  51791. ElCarouselItem,
  51792. ElCascader,
  51793. ElCascaderPanel,
  51794. ElCheckTag,
  51795. ElCheckbox,
  51796. ElCheckboxButton,
  51797. ElCheckboxGroup$1,
  51798. ElCol,
  51799. ElCollapse,
  51800. ElCollapseItem,
  51801. ElCollapseTransition,
  51802. ElColorPicker,
  51803. ElConfigProvider,
  51804. ElContainer,
  51805. ElAside,
  51806. ElFooter,
  51807. ElHeader,
  51808. ElMain,
  51809. ElDatePicker,
  51810. ElDescriptions,
  51811. ElDescriptionsItem,
  51812. ElDialog,
  51813. ElDivider,
  51814. ElDrawer,
  51815. ElDropdown,
  51816. ElDropdownItem,
  51817. ElDropdownMenu,
  51818. ElEmpty,
  51819. ElForm,
  51820. ElFormItem,
  51821. ElIcon,
  51822. ElImage,
  51823. ElImageViewer,
  51824. ElInput,
  51825. ElInputNumber,
  51826. ElLink,
  51827. ElMenu,
  51828. ElMenuItem,
  51829. ElMenuItemGroup,
  51830. ElPageHeader,
  51831. ElPagination,
  51832. ElPopconfirm,
  51833. ElPopover,
  51834. ElPopper,
  51835. ElProgress,
  51836. ElRadio,
  51837. ElRadioButton,
  51838. ElRadioGroup,
  51839. ElRate,
  51840. ElResult,
  51841. ElRow,
  51842. ElScrollbar,
  51843. ElSelect,
  51844. ElOption,
  51845. ElOptionGroup,
  51846. ElSelectV2,
  51847. ElSkeleton,
  51848. ElSkeletonItem,
  51849. ElSlider,
  51850. ElSpace,
  51851. ElSteps,
  51852. ElStep,
  51853. ElSwitch,
  51854. ElTable,
  51855. ElTableColumn,
  51856. ElTableV2,
  51857. ElTabs,
  51858. ElTabPane,
  51859. ElTag,
  51860. ElTimePicker,
  51861. ElTimeSelect,
  51862. ElTimeline,
  51863. ElTimelineItem,
  51864. ElTooltip,
  51865. ElTooltipV2,
  51866. ElTransfer,
  51867. ElTree,
  51868. ElTreeSelect,
  51869. ElTreeV2,
  51870. ElUpload
  51871. ];
  51872. const SCOPE = "ElInfiniteScroll";
  51873. const CHECK_INTERVAL = 50;
  51874. const DEFAULT_DELAY = 200;
  51875. const DEFAULT_DISTANCE = 0;
  51876. const attributes = {
  51877. delay: {
  51878. type: Number,
  51879. default: DEFAULT_DELAY
  51880. },
  51881. distance: {
  51882. type: Number,
  51883. default: DEFAULT_DISTANCE
  51884. },
  51885. disabled: {
  51886. type: Boolean,
  51887. default: false
  51888. },
  51889. immediate: {
  51890. type: Boolean,
  51891. default: true
  51892. }
  51893. };
  51894. const getScrollOptions = (el, instance) => {
  51895. return Object.entries(attributes).reduce((acm, [name, option]) => {
  51896. var _a, _b;
  51897. const { type, default: defaultValue } = option;
  51898. const attrVal = el.getAttribute(`infinite-scroll-${name}`);
  51899. let value = (_b = (_a = instance[attrVal]) != null ? _a : attrVal) != null ? _b : defaultValue;
  51900. value = value === "false" ? false : value;
  51901. value = type(value);
  51902. acm[name] = Number.isNaN(value) ? defaultValue : value;
  51903. return acm;
  51904. }, {});
  51905. };
  51906. const destroyObserver = (el) => {
  51907. const { observer } = el[SCOPE];
  51908. if (observer) {
  51909. observer.disconnect();
  51910. delete el[SCOPE].observer;
  51911. }
  51912. };
  51913. const handleScroll = (el, cb) => {
  51914. const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE];
  51915. const { disabled, distance } = getScrollOptions(el, instance);
  51916. const { clientHeight, scrollHeight, scrollTop } = containerEl;
  51917. const delta = scrollTop - lastScrollTop;
  51918. el[SCOPE].lastScrollTop = scrollTop;
  51919. if (observer || disabled || delta < 0)
  51920. return;
  51921. let shouldTrigger = false;
  51922. if (container === el) {
  51923. shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance;
  51924. } else {
  51925. const { clientTop, scrollHeight: height } = el;
  51926. const offsetTop = getOffsetTopDistance(el, containerEl);
  51927. shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance;
  51928. }
  51929. if (shouldTrigger) {
  51930. cb.call(instance);
  51931. }
  51932. };
  51933. function checkFull(el, cb) {
  51934. const { containerEl, instance } = el[SCOPE];
  51935. const { disabled } = getScrollOptions(el, instance);
  51936. if (disabled || containerEl.clientHeight === 0)
  51937. return;
  51938. if (containerEl.scrollHeight <= containerEl.clientHeight) {
  51939. cb.call(instance);
  51940. } else {
  51941. destroyObserver(el);
  51942. }
  51943. }
  51944. const InfiniteScroll = {
  51945. async mounted(el, binding) {
  51946. const { instance, value: cb } = binding;
  51947. if (!isFunction(cb)) {
  51948. throwError(SCOPE, "'v-infinite-scroll' binding value must be a function");
  51949. }
  51950. await vue.nextTick();
  51951. const { delay, immediate } = getScrollOptions(el, instance);
  51952. const container = getScrollContainer(el, true);
  51953. const containerEl = container === window ? document.documentElement : container;
  51954. const onScroll = throttle(handleScroll.bind(null, el, cb), delay);
  51955. if (!container)
  51956. return;
  51957. el[SCOPE] = {
  51958. instance,
  51959. container,
  51960. containerEl,
  51961. delay,
  51962. cb,
  51963. onScroll,
  51964. lastScrollTop: containerEl.scrollTop
  51965. };
  51966. if (immediate) {
  51967. const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), CHECK_INTERVAL));
  51968. el[SCOPE].observer = observer;
  51969. observer.observe(el, { childList: true, subtree: true });
  51970. checkFull(el, cb);
  51971. }
  51972. container.addEventListener("scroll", onScroll);
  51973. },
  51974. unmounted(el) {
  51975. const { container, onScroll } = el[SCOPE];
  51976. container == null ? void 0 : container.removeEventListener("scroll", onScroll);
  51977. destroyObserver(el);
  51978. },
  51979. async updated(el) {
  51980. if (!el[SCOPE]) {
  51981. await vue.nextTick();
  51982. }
  51983. const { containerEl, cb, observer } = el[SCOPE];
  51984. if (containerEl.clientHeight && observer) {
  51985. checkFull(el, cb);
  51986. }
  51987. }
  51988. };
  51989. var InfiniteScroll$1 = InfiniteScroll;
  51990. const _InfiniteScroll = InfiniteScroll$1;
  51991. _InfiniteScroll.install = (app) => {
  51992. app.directive("InfiniteScroll", _InfiniteScroll);
  51993. };
  51994. const ElInfiniteScroll = _InfiniteScroll;
  51995. function createLoadingComponent(options) {
  51996. let afterLeaveTimer;
  51997. const ns = useNamespace("loading");
  51998. const afterLeaveFlag = vue.ref(false);
  51999. const data = vue.reactive({
  52000. ...options,
  52001. originalPosition: "",
  52002. originalOverflow: "",
  52003. visible: false
  52004. });
  52005. function setText(text) {
  52006. data.text = text;
  52007. }
  52008. function destroySelf() {
  52009. const target = data.parent;
  52010. if (!target.vLoadingAddClassList) {
  52011. let loadingNumber = target.getAttribute("loading-number");
  52012. loadingNumber = Number.parseInt(loadingNumber) - 1;
  52013. if (!loadingNumber) {
  52014. removeClass(target, ns.bm("parent", "relative"));
  52015. target.removeAttribute("loading-number");
  52016. } else {
  52017. target.setAttribute("loading-number", loadingNumber.toString());
  52018. }
  52019. removeClass(target, ns.bm("parent", "hidden"));
  52020. }
  52021. removeElLoadingChild();
  52022. loadingInstance.unmount();
  52023. }
  52024. function removeElLoadingChild() {
  52025. var _a, _b;
  52026. (_b = (_a = vm.$el) == null ? void 0 : _a.parentNode) == null ? void 0 : _b.removeChild(vm.$el);
  52027. }
  52028. function close() {
  52029. var _a;
  52030. if (options.beforeClose && !options.beforeClose())
  52031. return;
  52032. afterLeaveFlag.value = true;
  52033. clearTimeout(afterLeaveTimer);
  52034. afterLeaveTimer = window.setTimeout(handleAfterLeave, 400);
  52035. data.visible = false;
  52036. (_a = options.closed) == null ? void 0 : _a.call(options);
  52037. }
  52038. function handleAfterLeave() {
  52039. if (!afterLeaveFlag.value)
  52040. return;
  52041. const target = data.parent;
  52042. afterLeaveFlag.value = false;
  52043. target.vLoadingAddClassList = void 0;
  52044. destroySelf();
  52045. }
  52046. const elLoadingComponent = {
  52047. name: "ElLoading",
  52048. setup() {
  52049. return () => {
  52050. const svg = data.spinner || data.svg;
  52051. const spinner = vue.h("svg", {
  52052. class: "circular",
  52053. viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
  52054. ...svg ? { innerHTML: svg } : {}
  52055. }, [
  52056. vue.h("circle", {
  52057. class: "path",
  52058. cx: "25",
  52059. cy: "25",
  52060. r: "20",
  52061. fill: "none"
  52062. })
  52063. ]);
  52064. const spinnerText = data.text ? vue.h("p", { class: ns.b("text") }, [data.text]) : void 0;
  52065. return vue.h(vue.Transition, {
  52066. name: ns.b("fade"),
  52067. onAfterLeave: handleAfterLeave
  52068. }, {
  52069. default: vue.withCtx(() => [
  52070. vue.withDirectives(vue.createVNode("div", {
  52071. style: {
  52072. backgroundColor: data.background || ""
  52073. },
  52074. class: [
  52075. ns.b("mask"),
  52076. data.customClass,
  52077. data.fullscreen ? "is-fullscreen" : ""
  52078. ]
  52079. }, [
  52080. vue.h("div", {
  52081. class: ns.b("spinner")
  52082. }, [spinner, spinnerText])
  52083. ]), [[vue.vShow, data.visible]])
  52084. ])
  52085. });
  52086. };
  52087. }
  52088. };
  52089. const loadingInstance = vue.createApp(elLoadingComponent);
  52090. const vm = loadingInstance.mount(document.createElement("div"));
  52091. return {
  52092. ...vue.toRefs(data),
  52093. setText,
  52094. removeElLoadingChild,
  52095. close,
  52096. handleAfterLeave,
  52097. vm,
  52098. get $el() {
  52099. return vm.$el;
  52100. }
  52101. };
  52102. }
  52103. let fullscreenInstance = void 0;
  52104. const Loading = function(options = {}) {
  52105. if (!isClient)
  52106. return void 0;
  52107. const resolved = resolveOptions(options);
  52108. if (resolved.fullscreen && fullscreenInstance) {
  52109. return fullscreenInstance;
  52110. }
  52111. const instance = createLoadingComponent({
  52112. ...resolved,
  52113. closed: () => {
  52114. var _a;
  52115. (_a = resolved.closed) == null ? void 0 : _a.call(resolved);
  52116. if (resolved.fullscreen)
  52117. fullscreenInstance = void 0;
  52118. }
  52119. });
  52120. addStyle(resolved, resolved.parent, instance);
  52121. addClassList(resolved, resolved.parent, instance);
  52122. resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
  52123. let loadingNumber = resolved.parent.getAttribute("loading-number");
  52124. if (!loadingNumber) {
  52125. loadingNumber = "1";
  52126. } else {
  52127. loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
  52128. }
  52129. resolved.parent.setAttribute("loading-number", loadingNumber);
  52130. resolved.parent.appendChild(instance.$el);
  52131. vue.nextTick(() => instance.visible.value = resolved.visible);
  52132. if (resolved.fullscreen) {
  52133. fullscreenInstance = instance;
  52134. }
  52135. return instance;
  52136. };
  52137. const resolveOptions = (options) => {
  52138. var _a, _b, _c, _d;
  52139. let target;
  52140. if (isString(options.target)) {
  52141. target = (_a = document.querySelector(options.target)) != null ? _a : document.body;
  52142. } else {
  52143. target = options.target || document.body;
  52144. }
  52145. return {
  52146. parent: target === document.body || options.body ? document.body : target,
  52147. background: options.background || "",
  52148. svg: options.svg || "",
  52149. svgViewBox: options.svgViewBox || "",
  52150. spinner: options.spinner || false,
  52151. text: options.text || "",
  52152. fullscreen: target === document.body && ((_b = options.fullscreen) != null ? _b : true),
  52153. lock: (_c = options.lock) != null ? _c : false,
  52154. customClass: options.customClass || "",
  52155. visible: (_d = options.visible) != null ? _d : true,
  52156. target
  52157. };
  52158. };
  52159. const addStyle = async (options, parent, instance) => {
  52160. const { nextZIndex } = useZIndex();
  52161. const maskStyle = {};
  52162. if (options.fullscreen) {
  52163. instance.originalPosition.value = getStyle(document.body, "position");
  52164. instance.originalOverflow.value = getStyle(document.body, "overflow");
  52165. maskStyle.zIndex = nextZIndex();
  52166. } else if (options.parent === document.body) {
  52167. instance.originalPosition.value = getStyle(document.body, "position");
  52168. await vue.nextTick();
  52169. for (const property of ["top", "left"]) {
  52170. const scroll = property === "top" ? "scrollTop" : "scrollLeft";
  52171. maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`;
  52172. }
  52173. for (const property of ["height", "width"]) {
  52174. maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`;
  52175. }
  52176. } else {
  52177. instance.originalPosition.value = getStyle(parent, "position");
  52178. }
  52179. for (const [key, value] of Object.entries(maskStyle)) {
  52180. instance.$el.style[key] = value;
  52181. }
  52182. };
  52183. const addClassList = (options, parent, instance) => {
  52184. const ns = useNamespace("loading");
  52185. if (!["absolute", "fixed", "sticky"].includes(instance.originalPosition.value)) {
  52186. addClass(parent, ns.bm("parent", "relative"));
  52187. } else {
  52188. removeClass(parent, ns.bm("parent", "relative"));
  52189. }
  52190. if (options.fullscreen && options.lock) {
  52191. addClass(parent, ns.bm("parent", "hidden"));
  52192. } else {
  52193. removeClass(parent, ns.bm("parent", "hidden"));
  52194. }
  52195. };
  52196. const INSTANCE_KEY = Symbol("ElLoading");
  52197. const createInstance = (el, binding) => {
  52198. var _a, _b, _c, _d;
  52199. const vm = binding.instance;
  52200. const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0;
  52201. const resolveExpression = (key) => {
  52202. const data = isString(key) && (vm == null ? void 0 : vm[key]) || key;
  52203. if (data)
  52204. return vue.ref(data);
  52205. else
  52206. return data;
  52207. };
  52208. const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(`element-loading-${hyphenate(name)}`));
  52209. const fullscreen = (_a = getBindingProp("fullscreen")) != null ? _a : binding.modifiers.fullscreen;
  52210. const options = {
  52211. text: getProp("text"),
  52212. svg: getProp("svg"),
  52213. svgViewBox: getProp("svgViewBox"),
  52214. spinner: getProp("spinner"),
  52215. background: getProp("background"),
  52216. customClass: getProp("customClass"),
  52217. fullscreen,
  52218. target: (_b = getBindingProp("target")) != null ? _b : fullscreen ? void 0 : el,
  52219. body: (_c = getBindingProp("body")) != null ? _c : binding.modifiers.body,
  52220. lock: (_d = getBindingProp("lock")) != null ? _d : binding.modifiers.lock
  52221. };
  52222. el[INSTANCE_KEY] = {
  52223. options,
  52224. instance: Loading(options)
  52225. };
  52226. };
  52227. const updateOptions = (newOptions, originalOptions) => {
  52228. for (const key of Object.keys(originalOptions)) {
  52229. if (vue.isRef(originalOptions[key]))
  52230. originalOptions[key].value = newOptions[key];
  52231. }
  52232. };
  52233. const vLoading = {
  52234. mounted(el, binding) {
  52235. if (binding.value) {
  52236. createInstance(el, binding);
  52237. }
  52238. },
  52239. updated(el, binding) {
  52240. const instance = el[INSTANCE_KEY];
  52241. if (binding.oldValue !== binding.value) {
  52242. if (binding.value && !binding.oldValue) {
  52243. createInstance(el, binding);
  52244. } else if (binding.value && binding.oldValue) {
  52245. if (isObject$1(binding.value))
  52246. updateOptions(binding.value, instance.options);
  52247. } else {
  52248. instance == null ? void 0 : instance.instance.close();
  52249. }
  52250. }
  52251. },
  52252. unmounted(el) {
  52253. var _a;
  52254. (_a = el[INSTANCE_KEY]) == null ? void 0 : _a.instance.close();
  52255. }
  52256. };
  52257. const ElLoading = {
  52258. install(app) {
  52259. app.directive("loading", vLoading);
  52260. app.config.globalProperties.$loading = Loading;
  52261. },
  52262. directive: vLoading,
  52263. service: Loading
  52264. };
  52265. const messageTypes = ["success", "info", "warning", "error"];
  52266. const messageDefaults = mutable({
  52267. customClass: "",
  52268. center: false,
  52269. dangerouslyUseHTMLString: false,
  52270. duration: 3e3,
  52271. icon: void 0,
  52272. id: "",
  52273. message: "",
  52274. onClose: void 0,
  52275. showClose: false,
  52276. type: "info",
  52277. offset: 16,
  52278. zIndex: 0,
  52279. grouping: false,
  52280. repeatNum: 1,
  52281. appendTo: isClient ? document.body : void 0
  52282. });
  52283. const messageProps = buildProps({
  52284. customClass: {
  52285. type: String,
  52286. default: messageDefaults.customClass
  52287. },
  52288. center: {
  52289. type: Boolean,
  52290. default: messageDefaults.center
  52291. },
  52292. dangerouslyUseHTMLString: {
  52293. type: Boolean,
  52294. default: messageDefaults.dangerouslyUseHTMLString
  52295. },
  52296. duration: {
  52297. type: Number,
  52298. default: messageDefaults.duration
  52299. },
  52300. icon: {
  52301. type: iconPropType,
  52302. default: messageDefaults.icon
  52303. },
  52304. id: {
  52305. type: String,
  52306. default: messageDefaults.id
  52307. },
  52308. message: {
  52309. type: definePropType([
  52310. String,
  52311. Object,
  52312. Function
  52313. ]),
  52314. default: messageDefaults.message
  52315. },
  52316. onClose: {
  52317. type: definePropType(Function),
  52318. required: false
  52319. },
  52320. showClose: {
  52321. type: Boolean,
  52322. default: messageDefaults.showClose
  52323. },
  52324. type: {
  52325. type: String,
  52326. values: messageTypes,
  52327. default: messageDefaults.type
  52328. },
  52329. offset: {
  52330. type: Number,
  52331. default: messageDefaults.offset
  52332. },
  52333. zIndex: {
  52334. type: Number,
  52335. default: messageDefaults.zIndex
  52336. },
  52337. grouping: {
  52338. type: Boolean,
  52339. default: messageDefaults.grouping
  52340. },
  52341. repeatNum: {
  52342. type: Number,
  52343. default: messageDefaults.repeatNum
  52344. }
  52345. });
  52346. const messageEmits = {
  52347. destroy: () => true
  52348. };
  52349. const instances = vue.shallowReactive([]);
  52350. const getInstance = (id) => {
  52351. const idx = instances.findIndex((instance) => instance.id === id);
  52352. const current = instances[idx];
  52353. let prev;
  52354. if (idx > 0) {
  52355. prev = instances[idx - 1];
  52356. }
  52357. return { current, prev };
  52358. };
  52359. const getLastOffset = (id) => {
  52360. const { prev } = getInstance(id);
  52361. if (!prev)
  52362. return 0;
  52363. return prev.vm.exposed.bottom.value;
  52364. };
  52365. const _hoisted_1$2 = ["id"];
  52366. const _hoisted_2$2 = ["innerHTML"];
  52367. const __default__$1 = vue.defineComponent({
  52368. name: "ElMessage"
  52369. });
  52370. const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
  52371. ...__default__$1,
  52372. props: messageProps,
  52373. emits: messageEmits,
  52374. setup(__props, { expose }) {
  52375. const props = __props;
  52376. const { Close } = TypeComponents;
  52377. const ns = useNamespace("message");
  52378. const messageRef = vue.ref();
  52379. const visible = vue.ref(false);
  52380. const height = vue.ref(0);
  52381. let stopTimer = void 0;
  52382. const badgeType = vue.computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  52383. const typeClass = vue.computed(() => {
  52384. const type = props.type;
  52385. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  52386. });
  52387. const iconComponent = vue.computed(() => props.icon || TypeComponentsMap[props.type] || "");
  52388. const lastOffset = vue.computed(() => getLastOffset(props.id));
  52389. const offset = vue.computed(() => props.offset + lastOffset.value);
  52390. const bottom = vue.computed(() => height.value + offset.value);
  52391. const customStyle = vue.computed(() => ({
  52392. top: `${offset.value}px`,
  52393. zIndex: props.zIndex
  52394. }));
  52395. function startTimer() {
  52396. if (props.duration === 0)
  52397. return;
  52398. ({ stop: stopTimer } = useTimeoutFn(() => {
  52399. close();
  52400. }, props.duration));
  52401. }
  52402. function clearTimer() {
  52403. stopTimer == null ? void 0 : stopTimer();
  52404. }
  52405. function close() {
  52406. visible.value = false;
  52407. }
  52408. function keydown({ code }) {
  52409. if (code === EVENT_CODE.esc) {
  52410. close();
  52411. }
  52412. }
  52413. vue.onMounted(() => {
  52414. startTimer();
  52415. visible.value = true;
  52416. });
  52417. vue.watch(() => props.repeatNum, () => {
  52418. clearTimer();
  52419. startTimer();
  52420. });
  52421. useEventListener(document, "keydown", keydown);
  52422. useResizeObserver(messageRef, () => {
  52423. height.value = messageRef.value.getBoundingClientRect().height;
  52424. });
  52425. expose({
  52426. visible,
  52427. bottom,
  52428. close
  52429. });
  52430. return (_ctx, _cache) => {
  52431. return vue.openBlock(), vue.createBlock(vue.Transition, {
  52432. name: vue.unref(ns).b("fade"),
  52433. onBeforeLeave: _ctx.onClose,
  52434. onAfterLeave: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("destroy")),
  52435. persisted: ""
  52436. }, {
  52437. default: vue.withCtx(() => [
  52438. vue.withDirectives(vue.createElementVNode("div", {
  52439. id: _ctx.id,
  52440. ref_key: "messageRef",
  52441. ref: messageRef,
  52442. class: vue.normalizeClass([
  52443. vue.unref(ns).b(),
  52444. { [vue.unref(ns).m(_ctx.type)]: _ctx.type && !_ctx.icon },
  52445. vue.unref(ns).is("center", _ctx.center),
  52446. vue.unref(ns).is("closable", _ctx.showClose),
  52447. _ctx.customClass
  52448. ]),
  52449. style: vue.normalizeStyle(vue.unref(customStyle)),
  52450. role: "alert",
  52451. onMouseenter: clearTimer,
  52452. onMouseleave: startTimer
  52453. }, [
  52454. _ctx.repeatNum > 1 ? (vue.openBlock(), vue.createBlock(vue.unref(ElBadge), {
  52455. key: 0,
  52456. value: _ctx.repeatNum,
  52457. type: vue.unref(badgeType),
  52458. class: vue.normalizeClass(vue.unref(ns).e("badge"))
  52459. }, null, 8, ["value", "type", "class"])) : vue.createCommentVNode("v-if", true),
  52460. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  52461. key: 1,
  52462. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  52463. }, {
  52464. default: vue.withCtx(() => [
  52465. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  52466. ]),
  52467. _: 1
  52468. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  52469. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  52470. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", {
  52471. key: 0,
  52472. class: vue.normalizeClass(vue.unref(ns).e("content"))
  52473. }, vue.toDisplayString(_ctx.message), 3)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  52474. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  52475. vue.createElementVNode("p", {
  52476. class: vue.normalizeClass(vue.unref(ns).e("content")),
  52477. innerHTML: _ctx.message
  52478. }, null, 10, _hoisted_2$2)
  52479. ], 2112))
  52480. ]),
  52481. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  52482. key: 2,
  52483. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  52484. onClick: vue.withModifiers(close, ["stop"])
  52485. }, {
  52486. default: vue.withCtx(() => [
  52487. vue.createVNode(vue.unref(Close))
  52488. ]),
  52489. _: 1
  52490. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  52491. ], 46, _hoisted_1$2), [
  52492. [vue.vShow, visible.value]
  52493. ])
  52494. ]),
  52495. _: 3
  52496. }, 8, ["name", "onBeforeLeave"]);
  52497. };
  52498. }
  52499. });
  52500. var MessageConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "message.vue"]]);
  52501. let seed$1 = 1;
  52502. const normalizeOptions = (params) => {
  52503. const options = !params || isString(params) || vue.isVNode(params) || isFunction(params) ? { message: params } : params;
  52504. const normalized = {
  52505. ...messageDefaults,
  52506. ...options
  52507. };
  52508. if (!normalized.appendTo) {
  52509. normalized.appendTo = document.body;
  52510. } else if (isString(normalized.appendTo)) {
  52511. let appendTo = document.querySelector(normalized.appendTo);
  52512. if (!isElement$1(appendTo)) {
  52513. appendTo = document.body;
  52514. }
  52515. normalized.appendTo = appendTo;
  52516. }
  52517. return normalized;
  52518. };
  52519. const closeMessage = (instance) => {
  52520. const idx = instances.indexOf(instance);
  52521. if (idx === -1)
  52522. return;
  52523. instances.splice(idx, 1);
  52524. const { handler } = instance;
  52525. handler.close();
  52526. };
  52527. const createMessage = ({ appendTo, ...options }, context) => {
  52528. const { nextZIndex } = useZIndex();
  52529. const id = `message_${seed$1++}`;
  52530. const userOnClose = options.onClose;
  52531. const container = document.createElement("div");
  52532. const props = {
  52533. ...options,
  52534. zIndex: nextZIndex() + options.zIndex,
  52535. id,
  52536. onClose: () => {
  52537. userOnClose == null ? void 0 : userOnClose();
  52538. closeMessage(instance);
  52539. },
  52540. onDestroy: () => {
  52541. vue.render(null, container);
  52542. }
  52543. };
  52544. const vnode = vue.createVNode(MessageConstructor, props, isFunction(props.message) || vue.isVNode(props.message) ? {
  52545. default: isFunction(props.message) ? props.message : () => props.message
  52546. } : null);
  52547. vnode.appContext = context || message._context;
  52548. vue.render(vnode, container);
  52549. appendTo.appendChild(container.firstElementChild);
  52550. const vm = vnode.component;
  52551. const handler = {
  52552. close: () => {
  52553. vm.exposed.visible.value = false;
  52554. }
  52555. };
  52556. const instance = {
  52557. id,
  52558. vnode,
  52559. vm,
  52560. handler,
  52561. props: vnode.component.props
  52562. };
  52563. return instance;
  52564. };
  52565. const message = (options = {}, context) => {
  52566. if (!isClient)
  52567. return { close: () => void 0 };
  52568. if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) {
  52569. return { close: () => void 0 };
  52570. }
  52571. const normalized = normalizeOptions(options);
  52572. if (normalized.grouping && instances.length) {
  52573. const instance2 = instances.find(({ vnode: vm }) => {
  52574. var _a;
  52575. return ((_a = vm.props) == null ? void 0 : _a.message) === normalized.message;
  52576. });
  52577. if (instance2) {
  52578. instance2.props.repeatNum += 1;
  52579. instance2.props.type = normalized.type;
  52580. return instance2.handler;
  52581. }
  52582. }
  52583. const instance = createMessage(normalized, context);
  52584. instances.push(instance);
  52585. return instance.handler;
  52586. };
  52587. messageTypes.forEach((type) => {
  52588. message[type] = (options = {}, appContext) => {
  52589. const normalized = normalizeOptions(options);
  52590. return message({ ...normalized, type }, appContext);
  52591. };
  52592. });
  52593. function closeAll$1(type) {
  52594. for (const instance of instances) {
  52595. if (!type || type === instance.props.type) {
  52596. instance.handler.close();
  52597. }
  52598. }
  52599. }
  52600. message.closeAll = closeAll$1;
  52601. message._context = null;
  52602. var Message = message;
  52603. const ElMessage = withInstallFunction(Message, "$message");
  52604. const _sfc_main$1 = vue.defineComponent({
  52605. name: "ElMessageBox",
  52606. directives: {
  52607. TrapFocus
  52608. },
  52609. components: {
  52610. ElButton,
  52611. ElFocusTrap,
  52612. ElInput,
  52613. ElOverlay,
  52614. ElIcon,
  52615. ...TypeComponents
  52616. },
  52617. inheritAttrs: false,
  52618. props: {
  52619. buttonSize: {
  52620. type: String,
  52621. validator: isValidComponentSize
  52622. },
  52623. modal: {
  52624. type: Boolean,
  52625. default: true
  52626. },
  52627. lockScroll: {
  52628. type: Boolean,
  52629. default: true
  52630. },
  52631. showClose: {
  52632. type: Boolean,
  52633. default: true
  52634. },
  52635. closeOnClickModal: {
  52636. type: Boolean,
  52637. default: true
  52638. },
  52639. closeOnPressEscape: {
  52640. type: Boolean,
  52641. default: true
  52642. },
  52643. closeOnHashChange: {
  52644. type: Boolean,
  52645. default: true
  52646. },
  52647. center: Boolean,
  52648. draggable: Boolean,
  52649. roundButton: {
  52650. default: false,
  52651. type: Boolean
  52652. },
  52653. container: {
  52654. type: String,
  52655. default: "body"
  52656. },
  52657. boxType: {
  52658. type: String,
  52659. default: ""
  52660. }
  52661. },
  52662. emits: ["vanish", "action"],
  52663. setup(props, { emit }) {
  52664. const { t } = useLocale();
  52665. const ns = useNamespace("message-box");
  52666. const visible = vue.ref(false);
  52667. const { nextZIndex } = useZIndex();
  52668. const state = vue.reactive({
  52669. autofocus: true,
  52670. beforeClose: null,
  52671. callback: null,
  52672. cancelButtonText: "",
  52673. cancelButtonClass: "",
  52674. confirmButtonText: "",
  52675. confirmButtonClass: "",
  52676. customClass: "",
  52677. customStyle: {},
  52678. dangerouslyUseHTMLString: false,
  52679. distinguishCancelAndClose: false,
  52680. icon: "",
  52681. inputPattern: null,
  52682. inputPlaceholder: "",
  52683. inputType: "text",
  52684. inputValue: null,
  52685. inputValidator: null,
  52686. inputErrorMessage: "",
  52687. message: null,
  52688. modalFade: true,
  52689. modalClass: "",
  52690. showCancelButton: false,
  52691. showConfirmButton: true,
  52692. type: "",
  52693. title: void 0,
  52694. showInput: false,
  52695. action: "",
  52696. confirmButtonLoading: false,
  52697. cancelButtonLoading: false,
  52698. confirmButtonDisabled: false,
  52699. editorErrorMessage: "",
  52700. validateError: false,
  52701. zIndex: nextZIndex()
  52702. });
  52703. const typeClass = vue.computed(() => {
  52704. const type = state.type;
  52705. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  52706. });
  52707. const contentId = useId();
  52708. const inputId = useId();
  52709. const btnSize = useSize(vue.computed(() => props.buttonSize), { prop: true, form: true, formItem: true });
  52710. const iconComponent = vue.computed(() => state.icon || TypeComponentsMap[state.type] || "");
  52711. const hasMessage = vue.computed(() => !!state.message);
  52712. const rootRef = vue.ref();
  52713. const headerRef = vue.ref();
  52714. const focusStartRef = vue.ref();
  52715. const inputRef = vue.ref();
  52716. const confirmRef = vue.ref();
  52717. const confirmButtonClasses = vue.computed(() => state.confirmButtonClass);
  52718. vue.watch(() => state.inputValue, async (val) => {
  52719. await vue.nextTick();
  52720. if (props.boxType === "prompt" && val !== null) {
  52721. validate();
  52722. }
  52723. }, { immediate: true });
  52724. vue.watch(() => visible.value, (val) => {
  52725. var _a, _b;
  52726. if (val) {
  52727. if (props.boxType !== "prompt") {
  52728. if (state.autofocus) {
  52729. focusStartRef.value = (_b = (_a = confirmRef.value) == null ? void 0 : _a.$el) != null ? _b : rootRef.value;
  52730. } else {
  52731. focusStartRef.value = rootRef.value;
  52732. }
  52733. }
  52734. state.zIndex = nextZIndex();
  52735. }
  52736. if (props.boxType !== "prompt")
  52737. return;
  52738. if (val) {
  52739. vue.nextTick().then(() => {
  52740. var _a2;
  52741. if (inputRef.value && inputRef.value.$el) {
  52742. if (state.autofocus) {
  52743. focusStartRef.value = (_a2 = getInputElement()) != null ? _a2 : rootRef.value;
  52744. } else {
  52745. focusStartRef.value = rootRef.value;
  52746. }
  52747. }
  52748. });
  52749. } else {
  52750. state.editorErrorMessage = "";
  52751. state.validateError = false;
  52752. }
  52753. });
  52754. const draggable = vue.computed(() => props.draggable);
  52755. useDraggable(rootRef, headerRef, draggable);
  52756. vue.onMounted(async () => {
  52757. await vue.nextTick();
  52758. if (props.closeOnHashChange) {
  52759. window.addEventListener("hashchange", doClose);
  52760. }
  52761. });
  52762. vue.onBeforeUnmount(() => {
  52763. if (props.closeOnHashChange) {
  52764. window.removeEventListener("hashchange", doClose);
  52765. }
  52766. });
  52767. function doClose() {
  52768. if (!visible.value)
  52769. return;
  52770. visible.value = false;
  52771. vue.nextTick(() => {
  52772. if (state.action)
  52773. emit("action", state.action);
  52774. });
  52775. }
  52776. const handleWrapperClick = () => {
  52777. if (props.closeOnClickModal) {
  52778. handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
  52779. }
  52780. };
  52781. const overlayEvent = useSameTarget(handleWrapperClick);
  52782. const handleInputEnter = (e) => {
  52783. if (state.inputType !== "textarea") {
  52784. e.preventDefault();
  52785. return handleAction("confirm");
  52786. }
  52787. };
  52788. const handleAction = (action) => {
  52789. var _a;
  52790. if (props.boxType === "prompt" && action === "confirm" && !validate()) {
  52791. return;
  52792. }
  52793. state.action = action;
  52794. if (state.beforeClose) {
  52795. (_a = state.beforeClose) == null ? void 0 : _a.call(state, action, state, doClose);
  52796. } else {
  52797. doClose();
  52798. }
  52799. };
  52800. const validate = () => {
  52801. if (props.boxType === "prompt") {
  52802. const inputPattern = state.inputPattern;
  52803. if (inputPattern && !inputPattern.test(state.inputValue || "")) {
  52804. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  52805. state.validateError = true;
  52806. return false;
  52807. }
  52808. const inputValidator = state.inputValidator;
  52809. if (typeof inputValidator === "function") {
  52810. const validateResult = inputValidator(state.inputValue);
  52811. if (validateResult === false) {
  52812. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  52813. state.validateError = true;
  52814. return false;
  52815. }
  52816. if (typeof validateResult === "string") {
  52817. state.editorErrorMessage = validateResult;
  52818. state.validateError = true;
  52819. return false;
  52820. }
  52821. }
  52822. }
  52823. state.editorErrorMessage = "";
  52824. state.validateError = false;
  52825. return true;
  52826. };
  52827. const getInputElement = () => {
  52828. const inputRefs = inputRef.value.$refs;
  52829. return inputRefs.input || inputRefs.textarea;
  52830. };
  52831. const handleClose = () => {
  52832. handleAction("close");
  52833. };
  52834. const onCloseRequested = () => {
  52835. if (props.closeOnPressEscape) {
  52836. handleClose();
  52837. }
  52838. };
  52839. if (props.lockScroll) {
  52840. useLockscreen(visible);
  52841. }
  52842. useRestoreActive(visible);
  52843. return {
  52844. ...vue.toRefs(state),
  52845. ns,
  52846. overlayEvent,
  52847. visible,
  52848. hasMessage,
  52849. typeClass,
  52850. contentId,
  52851. inputId,
  52852. btnSize,
  52853. iconComponent,
  52854. confirmButtonClasses,
  52855. rootRef,
  52856. focusStartRef,
  52857. headerRef,
  52858. inputRef,
  52859. confirmRef,
  52860. doClose,
  52861. handleClose,
  52862. onCloseRequested,
  52863. handleWrapperClick,
  52864. handleInputEnter,
  52865. handleAction,
  52866. t
  52867. };
  52868. }
  52869. });
  52870. const _hoisted_1$1 = ["aria-label", "aria-describedby"];
  52871. const _hoisted_2$1 = ["aria-label"];
  52872. const _hoisted_3$1 = ["id"];
  52873. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  52874. const _component_el_icon = vue.resolveComponent("el-icon");
  52875. const _component_close = vue.resolveComponent("close");
  52876. const _component_el_input = vue.resolveComponent("el-input");
  52877. const _component_el_button = vue.resolveComponent("el-button");
  52878. const _component_el_focus_trap = vue.resolveComponent("el-focus-trap");
  52879. const _component_el_overlay = vue.resolveComponent("el-overlay");
  52880. return vue.openBlock(), vue.createBlock(vue.Transition, {
  52881. name: "fade-in-linear",
  52882. onAfterLeave: _cache[11] || (_cache[11] = ($event) => _ctx.$emit("vanish")),
  52883. persisted: ""
  52884. }, {
  52885. default: vue.withCtx(() => [
  52886. vue.withDirectives(vue.createVNode(_component_el_overlay, {
  52887. "z-index": _ctx.zIndex,
  52888. "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
  52889. mask: _ctx.modal
  52890. }, {
  52891. default: vue.withCtx(() => [
  52892. vue.createElementVNode("div", {
  52893. role: "dialog",
  52894. "aria-label": _ctx.title,
  52895. "aria-modal": "true",
  52896. "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
  52897. class: vue.normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
  52898. onClick: _cache[8] || (_cache[8] = (...args) => _ctx.overlayEvent.onClick && _ctx.overlayEvent.onClick(...args)),
  52899. onMousedown: _cache[9] || (_cache[9] = (...args) => _ctx.overlayEvent.onMousedown && _ctx.overlayEvent.onMousedown(...args)),
  52900. onMouseup: _cache[10] || (_cache[10] = (...args) => _ctx.overlayEvent.onMouseup && _ctx.overlayEvent.onMouseup(...args))
  52901. }, [
  52902. vue.createVNode(_component_el_focus_trap, {
  52903. loop: "",
  52904. trapped: _ctx.visible,
  52905. "focus-trap-el": _ctx.rootRef,
  52906. "focus-start-el": _ctx.focusStartRef,
  52907. onReleaseRequested: _ctx.onCloseRequested
  52908. }, {
  52909. default: vue.withCtx(() => [
  52910. vue.createElementVNode("div", {
  52911. ref: "rootRef",
  52912. class: vue.normalizeClass([
  52913. _ctx.ns.b(),
  52914. _ctx.customClass,
  52915. _ctx.ns.is("draggable", _ctx.draggable),
  52916. { [_ctx.ns.m("center")]: _ctx.center }
  52917. ]),
  52918. style: vue.normalizeStyle(_ctx.customStyle),
  52919. tabindex: "-1",
  52920. onClick: _cache[7] || (_cache[7] = vue.withModifiers(() => {
  52921. }, ["stop"]))
  52922. }, [
  52923. _ctx.title !== null && _ctx.title !== void 0 ? (vue.openBlock(), vue.createElementBlock("div", {
  52924. key: 0,
  52925. ref: "headerRef",
  52926. class: vue.normalizeClass(_ctx.ns.e("header"))
  52927. }, [
  52928. vue.createElementVNode("div", {
  52929. class: vue.normalizeClass(_ctx.ns.e("title"))
  52930. }, [
  52931. _ctx.iconComponent && _ctx.center ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  52932. key: 0,
  52933. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  52934. }, {
  52935. default: vue.withCtx(() => [
  52936. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  52937. ]),
  52938. _: 1
  52939. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  52940. vue.createElementVNode("span", null, vue.toDisplayString(_ctx.title), 1)
  52941. ], 2),
  52942. _ctx.showClose ? (vue.openBlock(), vue.createElementBlock("button", {
  52943. key: 0,
  52944. type: "button",
  52945. class: vue.normalizeClass(_ctx.ns.e("headerbtn")),
  52946. "aria-label": _ctx.t("el.messagebox.close"),
  52947. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel")),
  52948. onKeydown: _cache[1] || (_cache[1] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"]))
  52949. }, [
  52950. vue.createVNode(_component_el_icon, {
  52951. class: vue.normalizeClass(_ctx.ns.e("close"))
  52952. }, {
  52953. default: vue.withCtx(() => [
  52954. vue.createVNode(_component_close)
  52955. ]),
  52956. _: 1
  52957. }, 8, ["class"])
  52958. ], 42, _hoisted_2$1)) : vue.createCommentVNode("v-if", true)
  52959. ], 2)) : vue.createCommentVNode("v-if", true),
  52960. vue.createElementVNode("div", {
  52961. id: _ctx.contentId,
  52962. class: vue.normalizeClass(_ctx.ns.e("content"))
  52963. }, [
  52964. vue.createElementVNode("div", {
  52965. class: vue.normalizeClass(_ctx.ns.e("container"))
  52966. }, [
  52967. _ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (vue.openBlock(), vue.createBlock(_component_el_icon, {
  52968. key: 0,
  52969. class: vue.normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  52970. }, {
  52971. default: vue.withCtx(() => [
  52972. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.iconComponent)))
  52973. ]),
  52974. _: 1
  52975. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  52976. _ctx.hasMessage ? (vue.openBlock(), vue.createElementBlock("div", {
  52977. key: 1,
  52978. class: vue.normalizeClass(_ctx.ns.e("message"))
  52979. }, [
  52980. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  52981. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  52982. key: 0,
  52983. for: _ctx.showInput ? _ctx.inputId : void 0
  52984. }, {
  52985. default: vue.withCtx(() => [
  52986. vue.createTextVNode(vue.toDisplayString(!_ctx.dangerouslyUseHTMLString ? _ctx.message : ""), 1)
  52987. ]),
  52988. _: 1
  52989. }, 8, ["for"])) : (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  52990. key: 1,
  52991. for: _ctx.showInput ? _ctx.inputId : void 0,
  52992. innerHTML: _ctx.message
  52993. }, null, 8, ["for", "innerHTML"]))
  52994. ])
  52995. ], 2)) : vue.createCommentVNode("v-if", true)
  52996. ], 2),
  52997. vue.withDirectives(vue.createElementVNode("div", {
  52998. class: vue.normalizeClass(_ctx.ns.e("input"))
  52999. }, [
  53000. vue.createVNode(_component_el_input, {
  53001. id: _ctx.inputId,
  53002. ref: "inputRef",
  53003. modelValue: _ctx.inputValue,
  53004. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.inputValue = $event),
  53005. type: _ctx.inputType,
  53006. placeholder: _ctx.inputPlaceholder,
  53007. "aria-invalid": _ctx.validateError,
  53008. class: vue.normalizeClass({ invalid: _ctx.validateError }),
  53009. onKeydown: vue.withKeys(_ctx.handleInputEnter, ["enter"])
  53010. }, null, 8, ["id", "modelValue", "type", "placeholder", "aria-invalid", "class", "onKeydown"]),
  53011. vue.createElementVNode("div", {
  53012. class: vue.normalizeClass(_ctx.ns.e("errormsg")),
  53013. style: vue.normalizeStyle({
  53014. visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden"
  53015. })
  53016. }, vue.toDisplayString(_ctx.editorErrorMessage), 7)
  53017. ], 2), [
  53018. [vue.vShow, _ctx.showInput]
  53019. ])
  53020. ], 10, _hoisted_3$1),
  53021. vue.createElementVNode("div", {
  53022. class: vue.normalizeClass(_ctx.ns.e("btns"))
  53023. }, [
  53024. _ctx.showCancelButton ? (vue.openBlock(), vue.createBlock(_component_el_button, {
  53025. key: 0,
  53026. loading: _ctx.cancelButtonLoading,
  53027. class: vue.normalizeClass([_ctx.cancelButtonClass]),
  53028. round: _ctx.roundButton,
  53029. size: _ctx.btnSize,
  53030. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleAction("cancel")),
  53031. onKeydown: _cache[4] || (_cache[4] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"]))
  53032. }, {
  53033. default: vue.withCtx(() => [
  53034. vue.createTextVNode(vue.toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)
  53035. ]),
  53036. _: 1
  53037. }, 8, ["loading", "class", "round", "size"])) : vue.createCommentVNode("v-if", true),
  53038. vue.withDirectives(vue.createVNode(_component_el_button, {
  53039. ref: "confirmRef",
  53040. type: "primary",
  53041. loading: _ctx.confirmButtonLoading,
  53042. class: vue.normalizeClass([_ctx.confirmButtonClasses]),
  53043. round: _ctx.roundButton,
  53044. disabled: _ctx.confirmButtonDisabled,
  53045. size: _ctx.btnSize,
  53046. onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleAction("confirm")),
  53047. onKeydown: _cache[6] || (_cache[6] = vue.withKeys(vue.withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"]))
  53048. }, {
  53049. default: vue.withCtx(() => [
  53050. vue.createTextVNode(vue.toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)
  53051. ]),
  53052. _: 1
  53053. }, 8, ["loading", "class", "round", "disabled", "size"]), [
  53054. [vue.vShow, _ctx.showConfirmButton]
  53055. ])
  53056. ], 2)
  53057. ], 6)
  53058. ]),
  53059. _: 3
  53060. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onReleaseRequested"])
  53061. ], 42, _hoisted_1$1)
  53062. ]),
  53063. _: 3
  53064. }, 8, ["z-index", "overlay-class", "mask"]), [
  53065. [vue.vShow, _ctx.visible]
  53066. ])
  53067. ]),
  53068. _: 3
  53069. });
  53070. }
  53071. var MessageBoxConstructor = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render], ["__file", "index.vue"]]);
  53072. const messageInstance = /* @__PURE__ */ new Map();
  53073. const getAppendToElement = (props) => {
  53074. let appendTo = document.body;
  53075. if (props.appendTo) {
  53076. if (isString(props.appendTo)) {
  53077. appendTo = document.querySelector(props.appendTo);
  53078. }
  53079. if (isElement$1(props.appendTo)) {
  53080. appendTo = props.appendTo;
  53081. }
  53082. if (!isElement$1(appendTo)) {
  53083. appendTo = document.body;
  53084. }
  53085. }
  53086. return appendTo;
  53087. };
  53088. const initInstance = (props, container, appContext = null) => {
  53089. const vnode = vue.createVNode(MessageBoxConstructor, props, isFunction(props.message) || vue.isVNode(props.message) ? {
  53090. default: isFunction(props.message) ? props.message : () => props.message
  53091. } : null);
  53092. vnode.appContext = appContext;
  53093. vue.render(vnode, container);
  53094. getAppendToElement(props).appendChild(container.firstElementChild);
  53095. return vnode.component;
  53096. };
  53097. const genContainer = () => {
  53098. return document.createElement("div");
  53099. };
  53100. const showMessage = (options, appContext) => {
  53101. const container = genContainer();
  53102. options.onVanish = () => {
  53103. vue.render(null, container);
  53104. messageInstance.delete(vm);
  53105. };
  53106. options.onAction = (action) => {
  53107. const currentMsg = messageInstance.get(vm);
  53108. let resolve;
  53109. if (options.showInput) {
  53110. resolve = { value: vm.inputValue, action };
  53111. } else {
  53112. resolve = action;
  53113. }
  53114. if (options.callback) {
  53115. options.callback(resolve, instance.proxy);
  53116. } else {
  53117. if (action === "cancel" || action === "close") {
  53118. if (options.distinguishCancelAndClose && action !== "cancel") {
  53119. currentMsg.reject("close");
  53120. } else {
  53121. currentMsg.reject("cancel");
  53122. }
  53123. } else {
  53124. currentMsg.resolve(resolve);
  53125. }
  53126. }
  53127. };
  53128. const instance = initInstance(options, container, appContext);
  53129. const vm = instance.proxy;
  53130. for (const prop in options) {
  53131. if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) {
  53132. vm[prop] = options[prop];
  53133. }
  53134. }
  53135. vm.visible = true;
  53136. return vm;
  53137. };
  53138. function MessageBox(options, appContext = null) {
  53139. if (!isClient)
  53140. return Promise.reject();
  53141. let callback;
  53142. if (isString(options) || vue.isVNode(options)) {
  53143. options = {
  53144. message: options
  53145. };
  53146. } else {
  53147. callback = options.callback;
  53148. }
  53149. return new Promise((resolve, reject) => {
  53150. const vm = showMessage(options, appContext != null ? appContext : MessageBox._context);
  53151. messageInstance.set(vm, {
  53152. options,
  53153. callback,
  53154. resolve,
  53155. reject
  53156. });
  53157. });
  53158. }
  53159. const MESSAGE_BOX_VARIANTS = ["alert", "confirm", "prompt"];
  53160. const MESSAGE_BOX_DEFAULT_OPTS = {
  53161. alert: { closeOnPressEscape: false, closeOnClickModal: false },
  53162. confirm: { showCancelButton: true },
  53163. prompt: { showCancelButton: true, showInput: true }
  53164. };
  53165. MESSAGE_BOX_VARIANTS.forEach((boxType) => {
  53166. MessageBox[boxType] = messageBoxFactory(boxType);
  53167. });
  53168. function messageBoxFactory(boxType) {
  53169. return (message, title, options, appContext) => {
  53170. let titleOrOpts = "";
  53171. if (isObject$1(title)) {
  53172. options = title;
  53173. titleOrOpts = "";
  53174. } else if (isUndefined(title)) {
  53175. titleOrOpts = "";
  53176. } else {
  53177. titleOrOpts = title;
  53178. }
  53179. return MessageBox(Object.assign({
  53180. title: titleOrOpts,
  53181. message,
  53182. type: "",
  53183. ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
  53184. }, options, {
  53185. boxType
  53186. }), appContext);
  53187. };
  53188. }
  53189. MessageBox.close = () => {
  53190. messageInstance.forEach((_, vm) => {
  53191. vm.doClose();
  53192. });
  53193. messageInstance.clear();
  53194. };
  53195. MessageBox._context = null;
  53196. const _MessageBox = MessageBox;
  53197. _MessageBox.install = (app) => {
  53198. _MessageBox._context = app._context;
  53199. app.config.globalProperties.$msgbox = _MessageBox;
  53200. app.config.globalProperties.$messageBox = _MessageBox;
  53201. app.config.globalProperties.$alert = _MessageBox.alert;
  53202. app.config.globalProperties.$confirm = _MessageBox.confirm;
  53203. app.config.globalProperties.$prompt = _MessageBox.prompt;
  53204. };
  53205. const ElMessageBox = _MessageBox;
  53206. const notificationTypes = [
  53207. "success",
  53208. "info",
  53209. "warning",
  53210. "error"
  53211. ];
  53212. const notificationProps = buildProps({
  53213. customClass: {
  53214. type: String,
  53215. default: ""
  53216. },
  53217. dangerouslyUseHTMLString: {
  53218. type: Boolean,
  53219. default: false
  53220. },
  53221. duration: {
  53222. type: Number,
  53223. default: 4500
  53224. },
  53225. icon: {
  53226. type: iconPropType
  53227. },
  53228. id: {
  53229. type: String,
  53230. default: ""
  53231. },
  53232. message: {
  53233. type: definePropType([String, Object]),
  53234. default: ""
  53235. },
  53236. offset: {
  53237. type: Number,
  53238. default: 0
  53239. },
  53240. onClick: {
  53241. type: definePropType(Function),
  53242. default: () => void 0
  53243. },
  53244. onClose: {
  53245. type: definePropType(Function),
  53246. required: true
  53247. },
  53248. position: {
  53249. type: String,
  53250. values: ["top-right", "top-left", "bottom-right", "bottom-left"],
  53251. default: "top-right"
  53252. },
  53253. showClose: {
  53254. type: Boolean,
  53255. default: true
  53256. },
  53257. title: {
  53258. type: String,
  53259. default: ""
  53260. },
  53261. type: {
  53262. type: String,
  53263. values: [...notificationTypes, ""],
  53264. default: ""
  53265. },
  53266. zIndex: {
  53267. type: Number,
  53268. default: 0
  53269. }
  53270. });
  53271. const notificationEmits = {
  53272. destroy: () => true
  53273. };
  53274. const _hoisted_1 = ["id"];
  53275. const _hoisted_2 = ["textContent"];
  53276. const _hoisted_3 = { key: 0 };
  53277. const _hoisted_4 = ["innerHTML"];
  53278. const __default__ = vue.defineComponent({
  53279. name: "ElNotification"
  53280. });
  53281. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  53282. ...__default__,
  53283. props: notificationProps,
  53284. emits: notificationEmits,
  53285. setup(__props, { expose }) {
  53286. const props = __props;
  53287. const ns = useNamespace("notification");
  53288. const { Close } = CloseComponents;
  53289. const visible = vue.ref(false);
  53290. let timer = void 0;
  53291. const typeClass = vue.computed(() => {
  53292. const type = props.type;
  53293. return type && TypeComponentsMap[props.type] ? ns.m(type) : "";
  53294. });
  53295. const iconComponent = vue.computed(() => {
  53296. if (!props.type)
  53297. return props.icon;
  53298. return TypeComponentsMap[props.type] || props.icon;
  53299. });
  53300. const horizontalClass = vue.computed(() => props.position.endsWith("right") ? "right" : "left");
  53301. const verticalProperty = vue.computed(() => props.position.startsWith("top") ? "top" : "bottom");
  53302. const positionStyle = vue.computed(() => {
  53303. return {
  53304. [verticalProperty.value]: `${props.offset}px`,
  53305. zIndex: props.zIndex
  53306. };
  53307. });
  53308. function startTimer() {
  53309. if (props.duration > 0) {
  53310. ({ stop: timer } = useTimeoutFn(() => {
  53311. if (visible.value)
  53312. close();
  53313. }, props.duration));
  53314. }
  53315. }
  53316. function clearTimer() {
  53317. timer == null ? void 0 : timer();
  53318. }
  53319. function close() {
  53320. visible.value = false;
  53321. }
  53322. function onKeydown({ code }) {
  53323. if (code === EVENT_CODE.delete || code === EVENT_CODE.backspace) {
  53324. clearTimer();
  53325. } else if (code === EVENT_CODE.esc) {
  53326. if (visible.value) {
  53327. close();
  53328. }
  53329. } else {
  53330. startTimer();
  53331. }
  53332. }
  53333. vue.onMounted(() => {
  53334. startTimer();
  53335. visible.value = true;
  53336. });
  53337. useEventListener(document, "keydown", onKeydown);
  53338. expose({
  53339. visible,
  53340. close
  53341. });
  53342. return (_ctx, _cache) => {
  53343. return vue.openBlock(), vue.createBlock(vue.Transition, {
  53344. name: vue.unref(ns).b("fade"),
  53345. onBeforeLeave: _ctx.onClose,
  53346. onAfterLeave: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("destroy")),
  53347. persisted: ""
  53348. }, {
  53349. default: vue.withCtx(() => [
  53350. vue.withDirectives(vue.createElementVNode("div", {
  53351. id: _ctx.id,
  53352. class: vue.normalizeClass([vue.unref(ns).b(), _ctx.customClass, vue.unref(horizontalClass)]),
  53353. style: vue.normalizeStyle(vue.unref(positionStyle)),
  53354. role: "alert",
  53355. onMouseenter: clearTimer,
  53356. onMouseleave: startTimer,
  53357. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
  53358. }, [
  53359. vue.unref(iconComponent) ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  53360. key: 0,
  53361. class: vue.normalizeClass([vue.unref(ns).e("icon"), vue.unref(typeClass)])
  53362. }, {
  53363. default: vue.withCtx(() => [
  53364. (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(iconComponent))))
  53365. ]),
  53366. _: 1
  53367. }, 8, ["class"])) : vue.createCommentVNode("v-if", true),
  53368. vue.createElementVNode("div", {
  53369. class: vue.normalizeClass(vue.unref(ns).e("group"))
  53370. }, [
  53371. vue.createElementVNode("h2", {
  53372. class: vue.normalizeClass(vue.unref(ns).e("title")),
  53373. textContent: vue.toDisplayString(_ctx.title)
  53374. }, null, 10, _hoisted_2),
  53375. vue.withDirectives(vue.createElementVNode("div", {
  53376. class: vue.normalizeClass(vue.unref(ns).e("content")),
  53377. style: vue.normalizeStyle(!!_ctx.title ? void 0 : { margin: 0 })
  53378. }, [
  53379. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  53380. !_ctx.dangerouslyUseHTMLString ? (vue.openBlock(), vue.createElementBlock("p", _hoisted_3, vue.toDisplayString(_ctx.message), 1)) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 1 }, [
  53381. vue.createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "),
  53382. vue.createElementVNode("p", { innerHTML: _ctx.message }, null, 8, _hoisted_4)
  53383. ], 2112))
  53384. ])
  53385. ], 6), [
  53386. [vue.vShow, _ctx.message]
  53387. ]),
  53388. _ctx.showClose ? (vue.openBlock(), vue.createBlock(vue.unref(ElIcon), {
  53389. key: 0,
  53390. class: vue.normalizeClass(vue.unref(ns).e("closeBtn")),
  53391. onClick: vue.withModifiers(close, ["stop"])
  53392. }, {
  53393. default: vue.withCtx(() => [
  53394. vue.createVNode(vue.unref(Close))
  53395. ]),
  53396. _: 1
  53397. }, 8, ["class", "onClick"])) : vue.createCommentVNode("v-if", true)
  53398. ], 2)
  53399. ], 46, _hoisted_1), [
  53400. [vue.vShow, visible.value]
  53401. ])
  53402. ]),
  53403. _: 3
  53404. }, 8, ["name", "onBeforeLeave"]);
  53405. };
  53406. }
  53407. });
  53408. var NotificationConstructor = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "notification.vue"]]);
  53409. const notifications = {
  53410. "top-left": [],
  53411. "top-right": [],
  53412. "bottom-left": [],
  53413. "bottom-right": []
  53414. };
  53415. const GAP_SIZE = 16;
  53416. let seed = 1;
  53417. const notify = function(options = {}, context = null) {
  53418. if (!isClient)
  53419. return { close: () => void 0 };
  53420. if (typeof options === "string" || vue.isVNode(options)) {
  53421. options = { message: options };
  53422. }
  53423. const position = options.position || "top-right";
  53424. let verticalOffset = options.offset || 0;
  53425. notifications[position].forEach(({ vm: vm2 }) => {
  53426. var _a;
  53427. verticalOffset += (((_a = vm2.el) == null ? void 0 : _a.offsetHeight) || 0) + GAP_SIZE;
  53428. });
  53429. verticalOffset += GAP_SIZE;
  53430. const { nextZIndex } = useZIndex();
  53431. const id = `notification_${seed++}`;
  53432. const userOnClose = options.onClose;
  53433. const props = {
  53434. ...options,
  53435. zIndex: nextZIndex(),
  53436. offset: verticalOffset,
  53437. id,
  53438. onClose: () => {
  53439. close(id, position, userOnClose);
  53440. }
  53441. };
  53442. let appendTo = document.body;
  53443. if (isElement$1(options.appendTo)) {
  53444. appendTo = options.appendTo;
  53445. } else if (isString(options.appendTo)) {
  53446. appendTo = document.querySelector(options.appendTo);
  53447. }
  53448. if (!isElement$1(appendTo)) {
  53449. appendTo = document.body;
  53450. }
  53451. const container = document.createElement("div");
  53452. const vm = vue.createVNode(NotificationConstructor, props, vue.isVNode(props.message) ? {
  53453. default: () => props.message
  53454. } : null);
  53455. vm.appContext = context != null ? context : notify._context;
  53456. vm.props.onDestroy = () => {
  53457. vue.render(null, container);
  53458. };
  53459. vue.render(vm, container);
  53460. notifications[position].push({ vm });
  53461. appendTo.appendChild(container.firstElementChild);
  53462. return {
  53463. close: () => {
  53464. vm.component.exposed.visible.value = false;
  53465. }
  53466. };
  53467. };
  53468. notificationTypes.forEach((type) => {
  53469. notify[type] = (options = {}) => {
  53470. if (typeof options === "string" || vue.isVNode(options)) {
  53471. options = {
  53472. message: options
  53473. };
  53474. }
  53475. return notify({
  53476. ...options,
  53477. type
  53478. });
  53479. };
  53480. });
  53481. function close(id, position, userOnClose) {
  53482. const orientedNotifications = notifications[position];
  53483. const idx = orientedNotifications.findIndex(({ vm: vm2 }) => {
  53484. var _a;
  53485. return ((_a = vm2.component) == null ? void 0 : _a.props.id) === id;
  53486. });
  53487. if (idx === -1)
  53488. return;
  53489. const { vm } = orientedNotifications[idx];
  53490. if (!vm)
  53491. return;
  53492. userOnClose == null ? void 0 : userOnClose(vm);
  53493. const removedHeight = vm.el.offsetHeight;
  53494. const verticalPos = position.split("-")[0];
  53495. orientedNotifications.splice(idx, 1);
  53496. const len = orientedNotifications.length;
  53497. if (len < 1)
  53498. return;
  53499. for (let i = idx; i < len; i++) {
  53500. const { el, component } = orientedNotifications[i].vm;
  53501. const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
  53502. component.props.offset = pos;
  53503. }
  53504. }
  53505. function closeAll() {
  53506. for (const orientedNotifications of Object.values(notifications)) {
  53507. orientedNotifications.forEach(({ vm }) => {
  53508. vm.component.exposed.visible.value = false;
  53509. });
  53510. }
  53511. }
  53512. notify.closeAll = closeAll;
  53513. notify._context = null;
  53514. var Notify = notify;
  53515. const ElNotification = withInstallFunction(Notify, "$notify");
  53516. var Plugins = [
  53517. ElInfiniteScroll,
  53518. ElLoading,
  53519. ElMessage,
  53520. ElMessageBox,
  53521. ElNotification,
  53522. ElPopoverDirective
  53523. ];
  53524. var installer = makeInstaller([...Components, ...Plugins]);
  53525. const install = installer.install;
  53526. const version = installer.version;
  53527. exports.BAR_MAP = BAR_MAP;
  53528. exports.CASCADER_PANEL_INJECTION_KEY = CASCADER_PANEL_INJECTION_KEY;
  53529. exports.CHANGE_EVENT = CHANGE_EVENT;
  53530. exports.ClickOutside = ClickOutside;
  53531. exports.CommonPicker = CommonPicker;
  53532. exports.CommonProps = CommonProps;
  53533. exports.DEFAULT_FORMATS_DATE = DEFAULT_FORMATS_DATE;
  53534. exports.DEFAULT_FORMATS_DATEPICKER = DEFAULT_FORMATS_DATEPICKER;
  53535. exports.DEFAULT_FORMATS_TIME = DEFAULT_FORMATS_TIME;
  53536. exports.DROPDOWN_COLLECTION_INJECTION_KEY = COLLECTION_INJECTION_KEY;
  53537. exports.DROPDOWN_COLLECTION_ITEM_INJECTION_KEY = COLLECTION_ITEM_INJECTION_KEY;
  53538. exports.DROPDOWN_INJECTION_KEY = DROPDOWN_INJECTION_KEY;
  53539. exports.DefaultProps = DefaultProps;
  53540. exports.DynamicSizeGrid = DynamicSizeGrid$1;
  53541. exports.DynamicSizeList = DynamicSizeList$1;
  53542. exports.EVENT_CODE = EVENT_CODE;
  53543. exports.Effect = Effect;
  53544. exports.ElAffix = ElAffix;
  53545. exports.ElAlert = ElAlert;
  53546. exports.ElAside = ElAside;
  53547. exports.ElAutoResizer = ElAutoResizer;
  53548. exports.ElAutocomplete = ElAutocomplete;
  53549. exports.ElAvatar = ElAvatar;
  53550. exports.ElBacktop = ElBacktop;
  53551. exports.ElBadge = ElBadge;
  53552. exports.ElBreadcrumb = ElBreadcrumb;
  53553. exports.ElBreadcrumbItem = ElBreadcrumbItem;
  53554. exports.ElButton = ElButton;
  53555. exports.ElButtonGroup = ElButtonGroup$1;
  53556. exports.ElCalendar = ElCalendar;
  53557. exports.ElCard = ElCard;
  53558. exports.ElCarousel = ElCarousel;
  53559. exports.ElCarouselItem = ElCarouselItem;
  53560. exports.ElCascader = ElCascader;
  53561. exports.ElCascaderPanel = ElCascaderPanel;
  53562. exports.ElCheckTag = ElCheckTag;
  53563. exports.ElCheckbox = ElCheckbox;
  53564. exports.ElCheckboxButton = ElCheckboxButton;
  53565. exports.ElCheckboxGroup = ElCheckboxGroup$1;
  53566. exports.ElCol = ElCol;
  53567. exports.ElCollapse = ElCollapse;
  53568. exports.ElCollapseItem = ElCollapseItem;
  53569. exports.ElCollapseTransition = ElCollapseTransition;
  53570. exports.ElCollection = ElCollection;
  53571. exports.ElCollectionItem = ElCollectionItem;
  53572. exports.ElColorPicker = ElColorPicker;
  53573. exports.ElConfigProvider = ElConfigProvider;
  53574. exports.ElContainer = ElContainer;
  53575. exports.ElDatePicker = ElDatePicker;
  53576. exports.ElDescriptions = ElDescriptions;
  53577. exports.ElDescriptionsItem = ElDescriptionsItem;
  53578. exports.ElDialog = ElDialog;
  53579. exports.ElDivider = ElDivider;
  53580. exports.ElDrawer = ElDrawer;
  53581. exports.ElDropdown = ElDropdown;
  53582. exports.ElDropdownItem = ElDropdownItem;
  53583. exports.ElDropdownMenu = ElDropdownMenu;
  53584. exports.ElEmpty = ElEmpty;
  53585. exports.ElFooter = ElFooter;
  53586. exports.ElForm = ElForm;
  53587. exports.ElFormItem = ElFormItem;
  53588. exports.ElHeader = ElHeader;
  53589. exports.ElIcon = ElIcon;
  53590. exports.ElImage = ElImage;
  53591. exports.ElImageViewer = ElImageViewer;
  53592. exports.ElInfiniteScroll = ElInfiniteScroll;
  53593. exports.ElInput = ElInput;
  53594. exports.ElInputNumber = ElInputNumber;
  53595. exports.ElLink = ElLink;
  53596. exports.ElLoading = ElLoading;
  53597. exports.ElLoadingDirective = vLoading;
  53598. exports.ElLoadingService = Loading;
  53599. exports.ElMain = ElMain;
  53600. exports.ElMenu = ElMenu;
  53601. exports.ElMenuItem = ElMenuItem;
  53602. exports.ElMenuItemGroup = ElMenuItemGroup;
  53603. exports.ElMessage = ElMessage;
  53604. exports.ElMessageBox = ElMessageBox;
  53605. exports.ElNotification = ElNotification;
  53606. exports.ElOption = ElOption;
  53607. exports.ElOptionGroup = ElOptionGroup;
  53608. exports.ElOverlay = ElOverlay;
  53609. exports.ElPageHeader = ElPageHeader;
  53610. exports.ElPagination = ElPagination;
  53611. exports.ElPopconfirm = ElPopconfirm;
  53612. exports.ElPopover = ElPopover;
  53613. exports.ElPopoverDirective = ElPopoverDirective;
  53614. exports.ElPopper = ElPopper;
  53615. exports.ElPopperArrow = ElPopperArrow;
  53616. exports.ElPopperContent = ElPopperContent;
  53617. exports.ElPopperTrigger = ElPopperTrigger;
  53618. exports.ElProgress = ElProgress;
  53619. exports.ElRadio = ElRadio;
  53620. exports.ElRadioButton = ElRadioButton;
  53621. exports.ElRadioGroup = ElRadioGroup;
  53622. exports.ElRate = ElRate;
  53623. exports.ElResult = ElResult;
  53624. exports.ElRow = ElRow;
  53625. exports.ElScrollbar = ElScrollbar;
  53626. exports.ElSelect = ElSelect;
  53627. exports.ElSelectV2 = ElSelectV2;
  53628. exports.ElSkeleton = ElSkeleton;
  53629. exports.ElSkeletonItem = ElSkeletonItem;
  53630. exports.ElSlider = ElSlider;
  53631. exports.ElSpace = ElSpace;
  53632. exports.ElStep = ElStep;
  53633. exports.ElSteps = ElSteps;
  53634. exports.ElSubMenu = ElSubMenu;
  53635. exports.ElSwitch = ElSwitch;
  53636. exports.ElTabPane = ElTabPane;
  53637. exports.ElTable = ElTable;
  53638. exports.ElTableColumn = ElTableColumn;
  53639. exports.ElTableV2 = ElTableV2;
  53640. exports.ElTabs = ElTabs;
  53641. exports.ElTag = ElTag;
  53642. exports.ElTimePicker = ElTimePicker;
  53643. exports.ElTimeSelect = ElTimeSelect;
  53644. exports.ElTimeline = ElTimeline;
  53645. exports.ElTimelineItem = ElTimelineItem;
  53646. exports.ElTooltip = ElTooltip;
  53647. exports.ElTransfer = ElTransfer;
  53648. exports.ElTree = ElTree;
  53649. exports.ElTreeSelect = ElTreeSelect;
  53650. exports.ElTreeV2 = ElTreeV2;
  53651. exports.ElUpload = ElUpload;
  53652. exports.FIRST_KEYS = FIRST_KEYS;
  53653. exports.FIRST_LAST_KEYS = FIRST_LAST_KEYS;
  53654. exports.FORWARD_REF_INJECTION_KEY = FORWARD_REF_INJECTION_KEY;
  53655. exports.FixedSizeGrid = FixedSizeGrid$1;
  53656. exports.FixedSizeList = FixedSizeList$1;
  53657. exports.GAP = GAP;
  53658. exports.ID_INJECTION_KEY = ID_INJECTION_KEY;
  53659. exports.INPUT_EVENT = INPUT_EVENT;
  53660. exports.INSTALLED_KEY = INSTALLED_KEY;
  53661. exports.IconComponentMap = IconComponentMap;
  53662. exports.IconMap = IconMap;
  53663. exports.LAST_KEYS = LAST_KEYS;
  53664. exports.LEFT_CHECK_CHANGE_EVENT = LEFT_CHECK_CHANGE_EVENT;
  53665. exports.Mousewheel = Mousewheel;
  53666. exports.POPPER_CONTAINER_ID = POPPER_CONTAINER_ID;
  53667. exports.POPPER_CONTAINER_SELECTOR = POPPER_CONTAINER_SELECTOR;
  53668. exports.POPPER_CONTENT_INJECTION_KEY = POPPER_CONTENT_INJECTION_KEY;
  53669. exports.POPPER_INJECTION_KEY = POPPER_INJECTION_KEY;
  53670. exports.RIGHT_CHECK_CHANGE_EVENT = RIGHT_CHECK_CHANGE_EVENT;
  53671. exports.ROOT_PICKER_INJECTION_KEY = ROOT_PICKER_INJECTION_KEY;
  53672. exports.RowAlign = RowAlign;
  53673. exports.RowJustify = RowJustify;
  53674. exports.TOOLTIP_INJECTION_KEY = TOOLTIP_INJECTION_KEY;
  53675. exports.TOOLTIP_V2_OPEN = TOOLTIP_V2_OPEN;
  53676. exports.TableV2 = TableV2$1;
  53677. exports.TableV2Alignment = Alignment;
  53678. exports.TableV2FixedDir = FixedDir;
  53679. exports.TableV2Placeholder = placeholderSign;
  53680. exports.TableV2SortOrder = SortOrder;
  53681. exports.TimePickPanel = TimePickPanel;
  53682. exports.TrapFocus = TrapFocus;
  53683. exports.UPDATE_MODEL_EVENT = UPDATE_MODEL_EVENT;
  53684. exports.WEEK_DAYS = WEEK_DAYS;
  53685. exports.affixEmits = affixEmits;
  53686. exports.affixProps = affixProps;
  53687. exports.alertEffects = alertEffects;
  53688. exports.alertEmits = alertEmits;
  53689. exports.alertProps = alertProps;
  53690. exports.arrowMiddleware = arrowMiddleware;
  53691. exports.autoResizerProps = autoResizerProps;
  53692. exports.autocompleteEmits = autocompleteEmits;
  53693. exports.autocompleteProps = autocompleteProps;
  53694. exports.avatarEmits = avatarEmits;
  53695. exports.avatarProps = avatarProps;
  53696. exports.backtopEmits = backtopEmits;
  53697. exports.backtopProps = backtopProps;
  53698. exports.badgeProps = badgeProps;
  53699. exports.breadcrumbItemProps = breadcrumbItemProps;
  53700. exports.breadcrumbKey = breadcrumbKey;
  53701. exports.breadcrumbProps = breadcrumbProps;
  53702. exports.buildLocaleContext = buildLocaleContext;
  53703. exports.buildTimeList = buildTimeList;
  53704. exports.buildTranslator = buildTranslator;
  53705. exports.buttonEmits = buttonEmits;
  53706. exports.buttonGroupContextKey = buttonGroupContextKey;
  53707. exports.buttonNativeTypes = buttonNativeTypes;
  53708. exports.buttonProps = buttonProps;
  53709. exports.buttonTypes = buttonTypes;
  53710. exports.calendarEmits = calendarEmits;
  53711. exports.calendarProps = calendarProps;
  53712. exports.cardProps = cardProps;
  53713. exports.carouselContextKey = carouselContextKey;
  53714. exports.carouselEmits = carouselEmits;
  53715. exports.carouselItemProps = carouselItemProps;
  53716. exports.carouselProps = carouselProps;
  53717. exports.checkTagEmits = checkTagEmits;
  53718. exports.checkTagProps = checkTagProps;
  53719. exports.checkboxEmits = checkboxEmits;
  53720. exports.checkboxGroupContextKey = checkboxGroupContextKey;
  53721. exports.checkboxGroupEmits = checkboxGroupEmits;
  53722. exports.checkboxGroupProps = checkboxGroupProps;
  53723. exports.checkboxProps = checkboxProps;
  53724. exports.colProps = colProps;
  53725. exports.collapseContextKey = collapseContextKey;
  53726. exports.collapseEmits = collapseEmits;
  53727. exports.collapseItemProps = collapseItemProps;
  53728. exports.collapseProps = collapseProps;
  53729. exports.colorPickerContextKey = colorPickerContextKey;
  53730. exports.colorPickerEmits = colorPickerEmits;
  53731. exports.colorPickerProps = colorPickerProps;
  53732. exports.componentSizeMap = componentSizeMap;
  53733. exports.componentSizes = componentSizes;
  53734. exports.configProviderContextKey = configProviderContextKey;
  53735. exports.configProviderProps = configProviderProps;
  53736. exports.createModelToggleComposable = createModelToggleComposable;
  53737. exports.dateEquals = dateEquals;
  53738. exports.datePickTypes = datePickTypes;
  53739. exports.dayjs = dayjs;
  53740. exports["default"] = installer;
  53741. exports.defaultNamespace = defaultNamespace;
  53742. exports.descriptionProps = descriptionProps;
  53743. exports.dialogEmits = dialogEmits;
  53744. exports.dialogInjectionKey = dialogInjectionKey;
  53745. exports.dialogProps = dialogProps;
  53746. exports.dividerProps = dividerProps;
  53747. exports.drawerEmits = drawerEmits;
  53748. exports.drawerProps = drawerProps;
  53749. exports.dropdownItemProps = dropdownItemProps;
  53750. exports.dropdownMenuProps = dropdownMenuProps;
  53751. exports.dropdownProps = dropdownProps;
  53752. exports.elPaginationKey = elPaginationKey;
  53753. exports.emitChangeFn = emitChangeFn;
  53754. exports.emptyProps = emptyProps;
  53755. exports.extractDateFormat = extractDateFormat;
  53756. exports.extractTimeFormat = extractTimeFormat;
  53757. exports.formContextKey = formContextKey;
  53758. exports.formEmits = formEmits;
  53759. exports.formItemContextKey = formItemContextKey;
  53760. exports.formItemProps = formItemProps;
  53761. exports.formItemValidateStates = formItemValidateStates;
  53762. exports.formProps = formProps;
  53763. exports.formatter = formatter;
  53764. exports.genFileId = genFileId;
  53765. exports.getPositionDataWithUnit = getPositionDataWithUnit;
  53766. exports.iconProps = iconProps;
  53767. exports.imageEmits = imageEmits;
  53768. exports.imageProps = imageProps;
  53769. exports.imageViewerEmits = imageViewerEmits;
  53770. exports.imageViewerProps = imageViewerProps;
  53771. exports.inputEmits = inputEmits;
  53772. exports.inputNumberEmits = inputNumberEmits;
  53773. exports.inputNumberProps = inputNumberProps;
  53774. exports.inputProps = inputProps;
  53775. exports.install = install;
  53776. exports.linkEmits = linkEmits;
  53777. exports.linkProps = linkProps;
  53778. exports.makeInstaller = makeInstaller;
  53779. exports.makeList = makeList;
  53780. exports.menuEmits = menuEmits;
  53781. exports.menuItemEmits = menuItemEmits;
  53782. exports.menuItemGroupProps = menuItemGroupProps;
  53783. exports.menuItemProps = menuItemProps;
  53784. exports.menuProps = menuProps;
  53785. exports.messageConfig = messageConfig;
  53786. exports.messageDefaults = messageDefaults;
  53787. exports.messageEmits = messageEmits;
  53788. exports.messageProps = messageProps;
  53789. exports.messageTypes = messageTypes;
  53790. exports.notificationEmits = notificationEmits;
  53791. exports.notificationProps = notificationProps;
  53792. exports.notificationTypes = notificationTypes;
  53793. exports.overlayEmits = overlayEmits;
  53794. exports.overlayProps = overlayProps;
  53795. exports.pageHeaderEmits = pageHeaderEmits;
  53796. exports.pageHeaderProps = pageHeaderProps;
  53797. exports.paginationEmits = paginationEmits;
  53798. exports.paginationProps = paginationProps;
  53799. exports.parseDate = parseDate;
  53800. exports.popconfirmProps = popconfirmProps;
  53801. exports.popoverEmits = popoverEmits;
  53802. exports.popoverProps = popoverProps;
  53803. exports.popperArrowProps = popperArrowProps;
  53804. exports.popperContentEmits = popperContentEmits;
  53805. exports.popperContentProps = popperContentProps;
  53806. exports.popperCoreConfigProps = popperCoreConfigProps;
  53807. exports.popperProps = popperProps;
  53808. exports.popperTriggerProps = popperTriggerProps;
  53809. exports.progressProps = progressProps;
  53810. exports.provideGlobalConfig = provideGlobalConfig;
  53811. exports.radioButtonProps = radioButtonProps;
  53812. exports.radioEmits = radioEmits;
  53813. exports.radioGroupEmits = radioGroupEmits;
  53814. exports.radioGroupKey = radioGroupKey;
  53815. exports.radioGroupProps = radioGroupProps;
  53816. exports.radioProps = radioProps;
  53817. exports.radioPropsBase = radioPropsBase;
  53818. exports.rangeArr = rangeArr;
  53819. exports.rateEmits = rateEmits;
  53820. exports.rateProps = rateProps;
  53821. exports.renderThumbStyle = renderThumbStyle$1;
  53822. exports.resultProps = resultProps;
  53823. exports.roleTypes = roleTypes;
  53824. exports.rowContextKey = rowContextKey;
  53825. exports.rowProps = rowProps;
  53826. exports.scrollbarContextKey = scrollbarContextKey;
  53827. exports.scrollbarEmits = scrollbarEmits;
  53828. exports.scrollbarProps = scrollbarProps;
  53829. exports.selectGroupKey = selectGroupKey;
  53830. exports.selectKey = selectKey;
  53831. exports.selectV2InjectionKey = selectV2InjectionKey;
  53832. exports.skeletonItemProps = skeletonItemProps;
  53833. exports.skeletonProps = skeletonProps;
  53834. exports.sliderContextKey = sliderContextKey;
  53835. exports.sliderEmits = sliderEmits;
  53836. exports.sliderProps = sliderProps;
  53837. exports.spaceProps = spaceProps;
  53838. exports.stepProps = stepProps;
  53839. exports.stepsEmits = stepsEmits;
  53840. exports.stepsProps = stepsProps;
  53841. exports.subMenuProps = subMenuProps;
  53842. exports.switchEmits = switchEmits;
  53843. exports.switchProps = switchProps;
  53844. exports.tabBarProps = tabBarProps;
  53845. exports.tabNavEmits = tabNavEmits;
  53846. exports.tabNavProps = tabNavProps;
  53847. exports.tabPaneProps = tabPaneProps;
  53848. exports.tableV2Props = tableV2Props;
  53849. exports.tableV2RowProps = tableV2RowProps;
  53850. exports.tabsEmits = tabsEmits;
  53851. exports.tabsProps = tabsProps;
  53852. exports.tabsRootContextKey = tabsRootContextKey;
  53853. exports.tagEmits = tagEmits;
  53854. exports.tagProps = tagProps;
  53855. exports.thumbProps = thumbProps;
  53856. exports.timePickerDefaultProps = timePickerDefaultProps;
  53857. exports.timeUnits = timeUnits;
  53858. exports.timelineItemProps = timelineItemProps;
  53859. exports.tooltipEmits = tooltipEmits;
  53860. exports.tooltipV2ContentKey = tooltipV2ContentKey;
  53861. exports.tooltipV2RootKey = tooltipV2RootKey;
  53862. exports.transferCheckedChangeFn = transferCheckedChangeFn;
  53863. exports.transferEmits = transferEmits;
  53864. exports.transferProps = transferProps;
  53865. exports.translate = translate;
  53866. exports.uploadBaseProps = uploadBaseProps;
  53867. exports.uploadContentProps = uploadContentProps;
  53868. exports.uploadContextKey = uploadContextKey;
  53869. exports.uploadDraggerEmits = uploadDraggerEmits;
  53870. exports.uploadDraggerProps = uploadDraggerProps;
  53871. exports.uploadListEmits = uploadListEmits;
  53872. exports.uploadListProps = uploadListProps;
  53873. exports.uploadListTypes = uploadListTypes;
  53874. exports.uploadProps = uploadProps;
  53875. exports.useAttrs = useAttrs;
  53876. exports.useCascaderConfig = useCascaderConfig;
  53877. exports.useCursor = useCursor;
  53878. exports.useDelayedRender = useDelayedRender;
  53879. exports.useDelayedToggle = useDelayedToggle;
  53880. exports.useDelayedToggleProps = useDelayedToggleProps;
  53881. exports.useDeprecated = useDeprecated;
  53882. exports.useDialog = useDialog;
  53883. exports.useDisabled = useDisabled;
  53884. exports.useDraggable = useDraggable;
  53885. exports.useEscapeKeydown = useEscapeKeydown;
  53886. exports.useFloating = useFloating;
  53887. exports.useFloatingProps = useFloatingProps;
  53888. exports.useFocus = useFocus;
  53889. exports.useFormItem = useFormItem;
  53890. exports.useFormItemInputId = useFormItemInputId;
  53891. exports.useForwardRef = useForwardRef;
  53892. exports.useForwardRefDirective = useForwardRefDirective;
  53893. exports.useGlobalConfig = useGlobalConfig;
  53894. exports.useId = useId;
  53895. exports.useLocale = useLocale;
  53896. exports.useLockscreen = useLockscreen;
  53897. exports.useModal = useModal;
  53898. exports.useModelToggle = useModelToggle;
  53899. exports.useModelToggleEmits = useModelToggleEmits;
  53900. exports.useModelToggleProps = useModelToggleProps;
  53901. exports.useNamespace = useNamespace;
  53902. exports.useOrderedChildren = useOrderedChildren;
  53903. exports.usePopperArrowProps = usePopperArrowProps;
  53904. exports.usePopperContainer = usePopperContainer;
  53905. exports.usePopperContentEmits = usePopperContentEmits;
  53906. exports.usePopperContentProps = usePopperContentProps;
  53907. exports.usePopperCoreConfigProps = usePopperCoreConfigProps;
  53908. exports.usePopperProps = usePopperProps;
  53909. exports.usePopperTriggerProps = usePopperTriggerProps;
  53910. exports.usePreventGlobal = usePreventGlobal;
  53911. exports.useProp = useProp;
  53912. exports.useRestoreActive = useRestoreActive;
  53913. exports.useSameTarget = useSameTarget;
  53914. exports.useSize = useSize;
  53915. exports.useSizeProp = useSizeProp;
  53916. exports.useSpace = useSpace;
  53917. exports.useTeleport = useTeleport;
  53918. exports.useThrottleRender = useThrottleRender;
  53919. exports.useTimeout = useTimeout;
  53920. exports.useTooltipContentProps = useTooltipContentProps;
  53921. exports.useTooltipModelToggle = useTooltipModelToggle;
  53922. exports.useTooltipModelToggleEmits = useTooltipModelToggleEmits;
  53923. exports.useTooltipModelToggleProps = useTooltipModelToggleProps;
  53924. exports.useTooltipProps = useTooltipProps;
  53925. exports.useTooltipTriggerProps = useTooltipTriggerProps;
  53926. exports.useTransitionFallthrough = useTransitionFallthrough;
  53927. exports.useTransitionFallthroughEmits = useTransitionFallthroughEmits;
  53928. exports.useZIndex = useZIndex;
  53929. exports.vLoading = vLoading;
  53930. exports.vRepeatClick = vRepeatClick;
  53931. exports.valueEquals = valueEquals;
  53932. exports.version = version;
  53933. exports.virtualizedGridProps = virtualizedGridProps;
  53934. exports.virtualizedListProps = virtualizedListProps;
  53935. exports.virtualizedProps = virtualizedProps;
  53936. exports.virtualizedScrollbarProps = virtualizedScrollbarProps;
  53937. Object.defineProperty(exports, '__esModule', { value: true });
  53938. }));