智慧水务管理系统 - 精河县供水工程综合管理平台

index.full.mjs 1.8MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493
  1. /*! Element Plus v2.14.2 */
  2. import { Comment, Fragment, Teleport, Text, Transition, TransitionGroup, cloneVNode, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, effectScope, getCurrentInstance, getCurrentScope, guardReactiveProps, h, hasInjectionContext, inject, isRef, isVNode, markRaw, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onMounted, onScopeDispose, onUnmounted, onUpdated, openBlock, provide, reactive, readonly, ref, render, renderList, renderSlot, resolveComponent, resolveDirective, resolveDynamicComponent, shallowReactive, shallowReadonly, shallowRef, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toValue, triggerRef, unref, useAttrs as useAttrs$1, useSlots, vModelCheckbox, vModelRadio, vModelText, vShow, warn, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
  3. //#region \0rolldown/runtime.js
  4. var __create = Object.create;
  5. var __defProp = Object.defineProperty;
  6. var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  7. var __getOwnPropNames = Object.getOwnPropertyNames;
  8. var __getProtoOf = Object.getPrototypeOf;
  9. var __hasOwnProp = Object.prototype.hasOwnProperty;
  10. var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
  11. var __copyProps = (to, from, except, desc) => {
  12. if (from && typeof from === "object" || typeof from === "function") {
  13. for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
  14. key = keys[i];
  15. if (!__hasOwnProp.call(to, key) && key !== except) {
  16. __defProp(to, key, {
  17. get: ((k) => from[k]).bind(null, key),
  18. enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
  19. });
  20. }
  21. }
  22. }
  23. return to;
  24. };
  25. var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
  26. value: mod,
  27. enumerable: true
  28. }) : target, mod));
  29. //#endregion
  30. //#region ../../packages/utils/dom/aria.ts
  31. 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])`;
  32. const isShadowRoot$1 = (e) => {
  33. if (typeof ShadowRoot === "undefined") return false;
  34. return e instanceof ShadowRoot;
  35. };
  36. const isHTMLElement$1 = (e) => {
  37. if (typeof Element === "undefined") return false;
  38. return e instanceof Element;
  39. };
  40. const isVisible = (element) => {
  41. return getComputedStyle(element).position === "fixed" ? false : element.offsetParent !== null;
  42. };
  43. const obtainAllFocusableElements$1 = (element) => {
  44. return Array.from(element.querySelectorAll(FOCUSABLE_ELEMENT_SELECTORS)).filter((item) => isFocusable(item) && isVisible(item));
  45. };
  46. const isFocusable = (element) => {
  47. if (element.tabIndex > 0 || element.tabIndex === 0 && element.getAttribute("tabIndex") !== null) return true;
  48. if (element.tabIndex < 0 || element.hasAttribute("disabled") || element.getAttribute("aria-disabled") === "true") return false;
  49. switch (element.nodeName) {
  50. case "A": return !!element.href && element.rel !== "ignore";
  51. case "INPUT": return !(element.type === "hidden" || element.type === "file");
  52. case "BUTTON":
  53. case "SELECT":
  54. case "TEXTAREA": return true;
  55. default: return false;
  56. }
  57. };
  58. const triggerEvent = function(elm, name, ...opts) {
  59. let eventName;
  60. if (name.includes("mouse") || name.includes("click")) eventName = "MouseEvents";
  61. else if (name.includes("key")) eventName = "KeyboardEvent";
  62. else eventName = "HTMLEvents";
  63. const evt = document.createEvent(eventName);
  64. evt.initEvent(name, ...opts);
  65. elm.dispatchEvent(evt);
  66. return elm;
  67. };
  68. const isLeaf = (el) => !el.getAttribute("aria-owns");
  69. const getSibling = (el, distance, elClass) => {
  70. const { parentNode } = el;
  71. if (!parentNode) return null;
  72. const siblings = parentNode.querySelectorAll(elClass);
  73. return siblings[Array.prototype.indexOf.call(siblings, el) + distance] || null;
  74. };
  75. const focusElement = (el, options) => {
  76. if (!el || !el.focus) return;
  77. let cleanup = false;
  78. if (isHTMLElement$1(el) && !isFocusable(el) && !el.getAttribute("tabindex")) {
  79. el.setAttribute("tabindex", "-1");
  80. cleanup = true;
  81. }
  82. el.focus(options);
  83. if (isHTMLElement$1(el) && cleanup) el.removeAttribute("tabindex");
  84. };
  85. const focusNode = (el) => {
  86. if (!el) return;
  87. focusElement(el);
  88. !isLeaf(el) && el.click();
  89. };
  90. //#endregion
  91. //#region ../../packages/constants/aria.ts
  92. const EVENT_CODE = {
  93. tab: "Tab",
  94. enter: "Enter",
  95. space: "Space",
  96. left: "ArrowLeft",
  97. up: "ArrowUp",
  98. right: "ArrowRight",
  99. down: "ArrowDown",
  100. esc: "Escape",
  101. delete: "Delete",
  102. backspace: "Backspace",
  103. numpadEnter: "NumpadEnter",
  104. pageUp: "PageUp",
  105. pageDown: "PageDown",
  106. home: "Home",
  107. end: "End"
  108. };
  109. //#endregion
  110. //#region ../../packages/constants/date.ts
  111. const datePickTypes = [
  112. "year",
  113. "years",
  114. "month",
  115. "months",
  116. "date",
  117. "dates",
  118. "week",
  119. "datetime",
  120. "datetimerange",
  121. "daterange",
  122. "monthrange",
  123. "yearrange"
  124. ];
  125. const WEEK_DAYS = [
  126. "sun",
  127. "mon",
  128. "tue",
  129. "wed",
  130. "thu",
  131. "fri",
  132. "sat"
  133. ];
  134. //#endregion
  135. //#region ../../packages/constants/event.ts
  136. const UPDATE_MODEL_EVENT = "update:modelValue";
  137. const CHANGE_EVENT = "change";
  138. const INPUT_EVENT = "input";
  139. //#endregion
  140. //#region ../../packages/constants/key.ts
  141. const INSTALLED_KEY = Symbol("INSTALLED_KEY");
  142. //#endregion
  143. //#region ../../packages/constants/size.ts
  144. const componentSizes = [
  145. "",
  146. "default",
  147. "small",
  148. "large"
  149. ];
  150. const componentSizeMap = {
  151. large: 40,
  152. default: 32,
  153. small: 24
  154. };
  155. //#endregion
  156. //#region ../../packages/constants/column-alignment.ts
  157. const columnAlignment = [
  158. "left",
  159. "center",
  160. "right"
  161. ];
  162. //#endregion
  163. //#region ../../packages/constants/form.ts
  164. const MINIMUM_INPUT_WIDTH = 11;
  165. const BORDER_HORIZONTAL_WIDTH = 2;
  166. //#endregion
  167. //#region ../../node_modules/.pnpm/@vueuse+shared@14.3.0_vue@3.5.25/node_modules/@vueuse/shared/dist/index.js
  168. function computedEager(fn, options) {
  169. var _options$flush;
  170. const result = shallowRef();
  171. watchEffect(() => {
  172. result.value = fn();
  173. }, {
  174. ...options,
  175. flush: (_options$flush = options === null || options === void 0 ? void 0 : options.flush) !== null && _options$flush !== void 0 ? _options$flush : "sync"
  176. });
  177. return readonly(result);
  178. }
  179. function tryOnScopeDispose(fn, failSilently) {
  180. if (getCurrentScope()) {
  181. onScopeDispose(fn, failSilently);
  182. return true;
  183. }
  184. return false;
  185. }
  186. const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
  187. const injectLocal = (...args) => {
  188. var _getCurrentInstance;
  189. const key = args[0];
  190. const instance = (_getCurrentInstance = getCurrentInstance()) === null || _getCurrentInstance === void 0 ? void 0 : _getCurrentInstance.proxy;
  191. const owner = instance !== null && instance !== void 0 ? instance : getCurrentScope();
  192. if (owner == null && !hasInjectionContext()) throw new Error("injectLocal must be called in setup");
  193. if (owner && localProvidedStateMap.has(owner) && key in localProvidedStateMap.get(owner)) return localProvidedStateMap.get(owner)[key];
  194. return inject(...args);
  195. };
  196. const isClient = typeof window !== "undefined" && typeof document !== "undefined";
  197. const isWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
  198. const isDef = (val) => typeof val !== "undefined";
  199. const notNullish = (val) => val != null;
  200. const toString$1 = Object.prototype.toString;
  201. const isObject$2 = (val) => toString$1.call(val) === "[object Object]";
  202. const clamp$2 = (n, min, max) => Math.min(max, Math.max(min, n));
  203. const noop$1 = () => {};
  204. const isIOS = /* @__PURE__ */ getIsIOS();
  205. function getIsIOS() {
  206. var _window, _window2, _window3;
  207. return isClient && !!((_window = window) === null || _window === void 0 || (_window = _window.navigator) === null || _window === void 0 ? void 0 : _window.userAgent) && (/iP(?:ad|hone|od)/.test(window.navigator.userAgent) || ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.navigator) === null || _window2 === void 0 ? void 0 : _window2.maxTouchPoints) > 2 && /iPad|Macintosh/.test((_window3 = window) === null || _window3 === void 0 ? void 0 : _window3.navigator.userAgent));
  208. }
  209. function createFilterWrapper(filter, fn) {
  210. function wrapper(...args) {
  211. return new Promise((resolve, reject) => {
  212. Promise.resolve(filter(() => fn.apply(this, args), {
  213. fn,
  214. thisArg: this,
  215. args
  216. })).then(resolve).catch(reject);
  217. });
  218. }
  219. return wrapper;
  220. }
  221. function debounceFilter(ms, options = {}) {
  222. let timer;
  223. let maxTimer;
  224. let lastRejector = noop$1;
  225. const _clearTimeout = (timer) => {
  226. clearTimeout(timer);
  227. lastRejector();
  228. lastRejector = noop$1;
  229. };
  230. let lastInvoker;
  231. const filter = (invoke) => {
  232. const duration = toValue(ms);
  233. const maxDuration = toValue(options.maxWait);
  234. if (timer) _clearTimeout(timer);
  235. if (duration <= 0 || maxDuration !== void 0 && maxDuration <= 0) {
  236. if (maxTimer) {
  237. _clearTimeout(maxTimer);
  238. maxTimer = void 0;
  239. }
  240. return Promise.resolve(invoke());
  241. }
  242. return new Promise((resolve, reject) => {
  243. lastRejector = options.rejectOnCancel ? reject : resolve;
  244. lastInvoker = invoke;
  245. if (maxDuration && !maxTimer) maxTimer = setTimeout(() => {
  246. if (timer) _clearTimeout(timer);
  247. maxTimer = void 0;
  248. resolve(lastInvoker());
  249. }, maxDuration);
  250. timer = setTimeout(() => {
  251. if (maxTimer) _clearTimeout(maxTimer);
  252. maxTimer = void 0;
  253. resolve(invoke());
  254. }, duration);
  255. });
  256. };
  257. return filter;
  258. }
  259. function throttleFilter(...args) {
  260. let lastExec = 0;
  261. let timer;
  262. let isLeading = true;
  263. let lastRejector = noop$1;
  264. let lastValue;
  265. let ms;
  266. let trailing;
  267. let leading;
  268. let rejectOnCancel;
  269. if (!isRef(args[0]) && typeof args[0] === "object") ({delay: ms, trailing = true, leading = true, rejectOnCancel = false} = args[0]);
  270. else [ms, trailing = true, leading = true, rejectOnCancel = false] = args;
  271. const clear = () => {
  272. if (timer) {
  273. clearTimeout(timer);
  274. timer = void 0;
  275. lastRejector();
  276. lastRejector = noop$1;
  277. }
  278. };
  279. const filter = (_invoke) => {
  280. const duration = toValue(ms);
  281. const elapsed = Date.now() - lastExec;
  282. const invoke = () => {
  283. return lastValue = _invoke();
  284. };
  285. clear();
  286. if (duration <= 0) {
  287. lastExec = Date.now();
  288. return invoke();
  289. }
  290. if (elapsed > duration) {
  291. lastExec = Date.now();
  292. if (leading || !isLeading) invoke();
  293. } else if (trailing) lastValue = new Promise((resolve, reject) => {
  294. lastRejector = rejectOnCancel ? reject : resolve;
  295. timer = setTimeout(() => {
  296. lastExec = Date.now();
  297. isLeading = true;
  298. resolve(invoke());
  299. clear();
  300. }, Math.max(0, duration - elapsed));
  301. });
  302. if (!leading && !timer) timer = setTimeout(() => isLeading = true, duration);
  303. isLeading = false;
  304. return lastValue;
  305. };
  306. return filter;
  307. }
  308. function pxValue(px) {
  309. return px.endsWith("rem") ? Number.parseFloat(px) * 16 : Number.parseFloat(px);
  310. }
  311. function toArray(value) {
  312. return Array.isArray(value) ? value : [value];
  313. }
  314. function cacheStringFunction$1(fn) {
  315. const cache = Object.create(null);
  316. return ((str) => {
  317. return cache[str] || (cache[str] = fn(str));
  318. });
  319. }
  320. const hyphenateRE$1 = /\B([A-Z])/g;
  321. const hyphenate$1 = cacheStringFunction$1((str) => str.replace(hyphenateRE$1, "-$1").toLowerCase());
  322. const camelizeRE$1 = /-(\w)/g;
  323. const camelize$1 = cacheStringFunction$1((str) => {
  324. return str.replace(camelizeRE$1, (_, c) => c ? c.toUpperCase() : "");
  325. });
  326. function getLifeCycleTarget(target) {
  327. return target || getCurrentInstance();
  328. }
  329. function toReactive(objectRef) {
  330. if (!isRef(objectRef)) return reactive(objectRef);
  331. return reactive(new Proxy({}, {
  332. get(_, p, receiver) {
  333. return unref(Reflect.get(objectRef.value, p, receiver));
  334. },
  335. set(_, p, value) {
  336. if (isRef(objectRef.value[p]) && !isRef(value)) objectRef.value[p].value = value;
  337. else objectRef.value[p] = value;
  338. return true;
  339. },
  340. deleteProperty(_, p) {
  341. return Reflect.deleteProperty(objectRef.value, p);
  342. },
  343. has(_, p) {
  344. return Reflect.has(objectRef.value, p);
  345. },
  346. ownKeys() {
  347. return Object.keys(objectRef.value);
  348. },
  349. getOwnPropertyDescriptor() {
  350. return {
  351. enumerable: true,
  352. configurable: true
  353. };
  354. }
  355. }));
  356. }
  357. function reactiveComputed(fn) {
  358. return toReactive(computed(fn));
  359. }
  360. function useDebounceFn(fn, ms = 200, options = {}) {
  361. return createFilterWrapper(debounceFilter(ms, options), fn);
  362. }
  363. function refDebounced(value, ms = 200, options = {}) {
  364. const debounced = ref(toValue(value));
  365. const updater = useDebounceFn(() => {
  366. debounced.value = value.value;
  367. }, ms, options);
  368. watch(value, () => updater());
  369. return shallowReadonly(debounced);
  370. }
  371. function useThrottleFn(fn, ms = 200, trailing = false, leading = true, rejectOnCancel = false) {
  372. return createFilterWrapper(throttleFilter(ms, trailing, leading, rejectOnCancel), fn);
  373. }
  374. function tryOnMounted(fn, sync = true, target) {
  375. if (getLifeCycleTarget(target)) onMounted(fn, target);
  376. else if (sync) fn();
  377. else nextTick(fn);
  378. }
  379. function useTimeoutFn(cb, interval, options = {}) {
  380. const { immediate = true, immediateCallback = false } = options;
  381. const isPending = shallowRef(false);
  382. let timer;
  383. function clear() {
  384. if (timer) {
  385. clearTimeout(timer);
  386. timer = void 0;
  387. }
  388. }
  389. function stop() {
  390. isPending.value = false;
  391. clear();
  392. }
  393. function start(...args) {
  394. if (immediateCallback) cb();
  395. clear();
  396. isPending.value = true;
  397. timer = setTimeout(() => {
  398. isPending.value = false;
  399. timer = void 0;
  400. cb(...args);
  401. }, toValue(interval));
  402. }
  403. if (immediate) {
  404. isPending.value = true;
  405. if (isClient) start();
  406. }
  407. tryOnScopeDispose(stop);
  408. return {
  409. isPending: shallowReadonly(isPending),
  410. start,
  411. stop
  412. };
  413. }
  414. function watchImmediate(source, cb, options) {
  415. return watch(source, cb, {
  416. ...options,
  417. immediate: true
  418. });
  419. }
  420. //#endregion
  421. //#region ../../node_modules/.pnpm/@vueuse+core@14.3.0_vue@3.5.25/node_modules/@vueuse/core/dist/index.js
  422. const defaultWindow = isClient ? window : void 0;
  423. const defaultDocument = isClient ? window.document : void 0;
  424. const defaultNavigator = isClient ? window.navigator : void 0;
  425. const defaultLocation = isClient ? window.location : void 0;
  426. function unrefElement(elRef) {
  427. var _$el;
  428. const plain = toValue(elRef);
  429. return (_$el = plain === null || plain === void 0 ? void 0 : plain.$el) !== null && _$el !== void 0 ? _$el : plain;
  430. }
  431. function useEventListener(...args) {
  432. const register = (el, event, listener, options) => {
  433. el.addEventListener(event, listener, options);
  434. return () => el.removeEventListener(event, listener, options);
  435. };
  436. const firstParamTargets = computed(() => {
  437. const test = toArray(toValue(args[0])).filter((e) => e != null);
  438. return test.every((e) => typeof e !== "string") ? test : void 0;
  439. });
  440. return watchImmediate(() => {
  441. var _firstParamTargets$va, _firstParamTargets$va2;
  442. return [
  443. (_firstParamTargets$va = (_firstParamTargets$va2 = firstParamTargets.value) === null || _firstParamTargets$va2 === void 0 ? void 0 : _firstParamTargets$va2.map((e) => unrefElement(e))) !== null && _firstParamTargets$va !== void 0 ? _firstParamTargets$va : [defaultWindow].filter((e) => e != null),
  444. toArray(toValue(firstParamTargets.value ? args[1] : args[0])),
  445. toArray(unref(firstParamTargets.value ? args[2] : args[1])),
  446. toValue(firstParamTargets.value ? args[3] : args[2])
  447. ];
  448. }, ([raw_targets, raw_events, raw_listeners, raw_options], _, onCleanup) => {
  449. if (!(raw_targets === null || raw_targets === void 0 ? void 0 : raw_targets.length) || !(raw_events === null || raw_events === void 0 ? void 0 : raw_events.length) || !(raw_listeners === null || raw_listeners === void 0 ? void 0 : raw_listeners.length)) return;
  450. const optionsClone = isObject$2(raw_options) ? { ...raw_options } : raw_options;
  451. const cleanups = raw_targets.flatMap((el) => raw_events.flatMap((event) => raw_listeners.map((listener) => register(el, event, listener, optionsClone))));
  452. onCleanup(() => {
  453. cleanups.forEach((fn) => fn());
  454. });
  455. }, { flush: "post" });
  456. }
  457. let _iOSWorkaround = false;
  458. function onClickOutside(target, handler, options = {}) {
  459. const { window = defaultWindow, ignore = [], capture = true, detectIframe = false, controls = false } = options;
  460. if (!window) return controls ? {
  461. stop: noop$1,
  462. cancel: noop$1,
  463. trigger: noop$1
  464. } : noop$1;
  465. if (isIOS && !_iOSWorkaround) {
  466. _iOSWorkaround = true;
  467. const listenerOptions = { passive: true };
  468. Array.from(window.document.body.children).forEach((el) => el.addEventListener("click", noop$1, listenerOptions));
  469. window.document.documentElement.addEventListener("click", noop$1, listenerOptions);
  470. }
  471. let shouldListen = true;
  472. const shouldIgnore = (event) => {
  473. return toValue(ignore).some((target) => {
  474. if (typeof target === "string") return Array.from(window.document.querySelectorAll(target)).some((el) => el === event.target || event.composedPath().includes(el));
  475. else {
  476. const el = unrefElement(target);
  477. return el && (event.target === el || event.composedPath().includes(el));
  478. }
  479. });
  480. };
  481. function hasMultipleRoots(target) {
  482. const vm = toValue(target);
  483. return vm && vm.$.subTree.shapeFlag === 16;
  484. }
  485. function checkMultipleRoots(target, event) {
  486. const vm = toValue(target);
  487. const children = vm.$.subTree && vm.$.subTree.children;
  488. if (children == null || !Array.isArray(children)) return false;
  489. return children.some((child) => child.el === event.target || event.composedPath().includes(child.el));
  490. }
  491. const listener = (event) => {
  492. const el = unrefElement(target);
  493. if (event.target == null) return;
  494. if (!(el instanceof Element) && hasMultipleRoots(target) && checkMultipleRoots(target, event)) return;
  495. if (!el || el === event.target || event.composedPath().includes(el)) return;
  496. if ("detail" in event && event.detail === 0) shouldListen = !shouldIgnore(event);
  497. if (!shouldListen) {
  498. shouldListen = true;
  499. return;
  500. }
  501. handler(event);
  502. };
  503. let isProcessingClick = false;
  504. const cleanup = [
  505. useEventListener(window, "click", (event) => {
  506. if (!isProcessingClick) {
  507. isProcessingClick = true;
  508. setTimeout(() => {
  509. isProcessingClick = false;
  510. }, 0);
  511. listener(event);
  512. }
  513. }, {
  514. passive: true,
  515. capture
  516. }),
  517. useEventListener(window, "pointerdown", (e) => {
  518. const el = unrefElement(target);
  519. shouldListen = !shouldIgnore(e) && !!(el && !e.composedPath().includes(el));
  520. }, { passive: true }),
  521. detectIframe && useEventListener(window, "blur", (event) => {
  522. setTimeout(() => {
  523. const el = unrefElement(target);
  524. let activeEl = window.document.activeElement;
  525. while (activeEl === null || activeEl === void 0 ? void 0 : activeEl.shadowRoot) activeEl = activeEl.shadowRoot.activeElement;
  526. if ((activeEl === null || activeEl === void 0 ? void 0 : activeEl.tagName) === "IFRAME" && !(el === null || el === void 0 ? void 0 : el.contains(window.document.activeElement))) handler(event);
  527. }, 0);
  528. }, { passive: true })
  529. ].filter(Boolean);
  530. const stop = () => cleanup.forEach((fn) => fn());
  531. if (controls) return {
  532. stop,
  533. cancel: () => {
  534. shouldListen = false;
  535. },
  536. trigger: (event) => {
  537. shouldListen = true;
  538. listener(event);
  539. shouldListen = false;
  540. }
  541. };
  542. return stop;
  543. }
  544. function useMounted() {
  545. const isMounted = shallowRef(false);
  546. const instance = getCurrentInstance();
  547. if (instance) onMounted(() => {
  548. isMounted.value = true;
  549. }, instance);
  550. return isMounted;
  551. }
  552. /* @__NO_SIDE_EFFECTS__ */
  553. function useSupported(callback) {
  554. const isMounted = useMounted();
  555. return computed(() => {
  556. isMounted.value;
  557. return Boolean(callback());
  558. });
  559. }
  560. function useMutationObserver(target, callback, options = {}) {
  561. const { window = defaultWindow, ...mutationOptions } = options;
  562. let observer;
  563. const isSupported = /* @__PURE__ */ useSupported(() => window && "MutationObserver" in window);
  564. const cleanup = () => {
  565. if (observer) {
  566. observer.disconnect();
  567. observer = void 0;
  568. }
  569. };
  570. const stopWatch = watch(computed(() => {
  571. const items = toArray(toValue(target)).map(unrefElement).filter(notNullish);
  572. return new Set(items);
  573. }), (newTargets) => {
  574. cleanup();
  575. if (isSupported.value && newTargets.size) {
  576. observer = new MutationObserver(callback);
  577. newTargets.forEach((el) => observer.observe(el, mutationOptions));
  578. }
  579. }, {
  580. immediate: true,
  581. flush: "post"
  582. });
  583. const takeRecords = () => {
  584. return observer === null || observer === void 0 ? void 0 : observer.takeRecords();
  585. };
  586. const stop = () => {
  587. stopWatch();
  588. cleanup();
  589. };
  590. tryOnScopeDispose(stop);
  591. return {
  592. isSupported,
  593. stop,
  594. takeRecords
  595. };
  596. }
  597. function onElementRemoval(target, callback, options = {}) {
  598. const { window = defaultWindow, document = window === null || window === void 0 ? void 0 : window.document, flush = "sync" } = options;
  599. if (!window || !document) return noop$1;
  600. let stopFn;
  601. const cleanupAndUpdate = (fn) => {
  602. stopFn === null || stopFn === void 0 || stopFn();
  603. stopFn = fn;
  604. };
  605. const stopWatch = watchEffect(() => {
  606. const el = unrefElement(target);
  607. if (el) {
  608. const { stop } = useMutationObserver(document, (mutationsList) => {
  609. if (mutationsList.map((mutation) => [...mutation.removedNodes]).flat().some((node) => node === el || node.contains(el))) callback(mutationsList);
  610. }, {
  611. window,
  612. childList: true,
  613. subtree: true
  614. });
  615. cleanupAndUpdate(stop);
  616. }
  617. }, { flush });
  618. const stopHandle = () => {
  619. stopWatch();
  620. cleanupAndUpdate();
  621. };
  622. tryOnScopeDispose(stopHandle);
  623. return stopHandle;
  624. }
  625. function useActiveElement(options = {}) {
  626. var _options$document;
  627. const { window = defaultWindow, deep = true, triggerOnRemoval = false } = options;
  628. const document = (_options$document = options.document) !== null && _options$document !== void 0 ? _options$document : window === null || window === void 0 ? void 0 : window.document;
  629. const getDeepActiveElement = () => {
  630. let element = document === null || document === void 0 ? void 0 : document.activeElement;
  631. if (deep) {
  632. var _element$shadowRoot;
  633. while (element === null || element === void 0 ? void 0 : element.shadowRoot) element = element === null || element === void 0 || (_element$shadowRoot = element.shadowRoot) === null || _element$shadowRoot === void 0 ? void 0 : _element$shadowRoot.activeElement;
  634. }
  635. return element;
  636. };
  637. const activeElement = shallowRef();
  638. const trigger = () => {
  639. activeElement.value = getDeepActiveElement();
  640. };
  641. if (window) {
  642. const listenerOptions = {
  643. capture: true,
  644. passive: true
  645. };
  646. useEventListener(window, "blur", (event) => {
  647. if (event.relatedTarget !== null) return;
  648. trigger();
  649. }, listenerOptions);
  650. useEventListener(window, "focus", trigger, listenerOptions);
  651. }
  652. if (triggerOnRemoval) onElementRemoval(activeElement, trigger, { document });
  653. trigger();
  654. return activeElement;
  655. }
  656. const ssrWidthSymbol = Symbol("vueuse-ssr-width");
  657. /* @__NO_SIDE_EFFECTS__ */
  658. function useSSRWidth() {
  659. const ssrWidth = hasInjectionContext() ? injectLocal(ssrWidthSymbol, null) : null;
  660. return typeof ssrWidth === "number" ? ssrWidth : void 0;
  661. }
  662. function useMediaQuery(query, options = {}) {
  663. const { window = defaultWindow, ssrWidth = /* @__PURE__ */ useSSRWidth() } = options;
  664. const isSupported = /* @__PURE__ */ useSupported(() => window && "matchMedia" in window && typeof window.matchMedia === "function");
  665. const ssrSupport = shallowRef(typeof ssrWidth === "number");
  666. const mediaQuery = shallowRef();
  667. const matches = shallowRef(false);
  668. const handler = (event) => {
  669. matches.value = event.matches;
  670. };
  671. watchEffect(() => {
  672. if (ssrSupport.value) {
  673. ssrSupport.value = !isSupported.value;
  674. matches.value = toValue(query).split(",").some((queryString) => {
  675. const not = queryString.includes("not all");
  676. const minWidth = queryString.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
  677. const maxWidth = queryString.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
  678. let res = Boolean(minWidth || maxWidth);
  679. if (minWidth && res) res = ssrWidth >= pxValue(minWidth[1]);
  680. if (maxWidth && res) res = ssrWidth <= pxValue(maxWidth[1]);
  681. return not ? !res : res;
  682. });
  683. return;
  684. }
  685. if (!isSupported.value) return;
  686. mediaQuery.value = window.matchMedia(toValue(query));
  687. matches.value = mediaQuery.value.matches;
  688. });
  689. useEventListener(mediaQuery, "change", handler, { passive: true });
  690. return computed(() => matches.value);
  691. }
  692. function cloneFnJSON(source) {
  693. return JSON.parse(JSON.stringify(source));
  694. }
  695. function useCssVar(prop, target, options = {}) {
  696. const { window = defaultWindow, initialValue, observe = false } = options;
  697. const variable = shallowRef(initialValue);
  698. const elRef = computed(() => {
  699. var _window$document;
  700. return unrefElement(target) || (window === null || window === void 0 || (_window$document = window.document) === null || _window$document === void 0 ? void 0 : _window$document.documentElement);
  701. });
  702. function updateCssVar() {
  703. const key = toValue(prop);
  704. const el = toValue(elRef);
  705. if (el && window && key) {
  706. var _window$getComputedSt;
  707. variable.value = ((_window$getComputedSt = window.getComputedStyle(el).getPropertyValue(key)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.trim()) || variable.value || initialValue;
  708. }
  709. }
  710. if (observe) useMutationObserver(elRef, updateCssVar, {
  711. attributeFilter: ["style", "class"],
  712. window
  713. });
  714. watch([elRef, () => toValue(prop)], (_, old) => {
  715. if (old[0] && old[1]) old[0].style.removeProperty(old[1]);
  716. updateCssVar();
  717. }, { immediate: true });
  718. watch([variable, elRef], ([val, el]) => {
  719. const raw_prop = toValue(prop);
  720. if ((el === null || el === void 0 ? void 0 : el.style) && raw_prop) if (val == null) el.style.removeProperty(raw_prop);
  721. else el.style.setProperty(raw_prop, val);
  722. }, { immediate: true });
  723. return variable;
  724. }
  725. function useDocumentVisibility(options = {}) {
  726. const { document = defaultDocument } = options;
  727. if (!document) return shallowRef("visible");
  728. const visibility = shallowRef(document.visibilityState);
  729. useEventListener(document, "visibilitychange", () => {
  730. visibility.value = document.visibilityState;
  731. }, { passive: true });
  732. return visibility;
  733. }
  734. function useResizeObserver(target, callback, options = {}) {
  735. const { window = defaultWindow, ...observerOptions } = options;
  736. let observer;
  737. const isSupported = /* @__PURE__ */ useSupported(() => window && "ResizeObserver" in window);
  738. const cleanup = () => {
  739. if (observer) {
  740. observer.disconnect();
  741. observer = void 0;
  742. }
  743. };
  744. const stopWatch = watch(computed(() => {
  745. const _targets = toValue(target);
  746. return Array.isArray(_targets) ? _targets.map((el) => unrefElement(el)) : [unrefElement(_targets)];
  747. }), (els) => {
  748. cleanup();
  749. if (isSupported.value && window) {
  750. observer = new ResizeObserver(callback);
  751. for (const _el of els) if (_el) observer.observe(_el, observerOptions);
  752. }
  753. }, {
  754. immediate: true,
  755. flush: "post"
  756. });
  757. const stop = () => {
  758. cleanup();
  759. stopWatch();
  760. };
  761. tryOnScopeDispose(stop);
  762. return {
  763. isSupported,
  764. stop
  765. };
  766. }
  767. function useElementBounding(target, options = {}) {
  768. const { reset = true, windowResize = true, windowScroll = true, immediate = true, updateTiming = "sync" } = options;
  769. const height = shallowRef(0);
  770. const bottom = shallowRef(0);
  771. const left = shallowRef(0);
  772. const right = shallowRef(0);
  773. const top = shallowRef(0);
  774. const width = shallowRef(0);
  775. const x = shallowRef(0);
  776. const y = shallowRef(0);
  777. function recalculate() {
  778. const el = unrefElement(target);
  779. if (!el) {
  780. if (reset) {
  781. height.value = 0;
  782. bottom.value = 0;
  783. left.value = 0;
  784. right.value = 0;
  785. top.value = 0;
  786. width.value = 0;
  787. x.value = 0;
  788. y.value = 0;
  789. }
  790. return;
  791. }
  792. const rect = el.getBoundingClientRect();
  793. height.value = rect.height;
  794. bottom.value = rect.bottom;
  795. left.value = rect.left;
  796. right.value = rect.right;
  797. top.value = rect.top;
  798. width.value = rect.width;
  799. x.value = rect.x;
  800. y.value = rect.y;
  801. }
  802. function update() {
  803. if (updateTiming === "sync") recalculate();
  804. else if (updateTiming === "next-frame") requestAnimationFrame(() => recalculate());
  805. }
  806. useResizeObserver(target, update);
  807. watch(() => unrefElement(target), (ele) => !ele && update());
  808. useMutationObserver(target, update, { attributeFilter: ["style", "class"] });
  809. if (windowScroll) useEventListener("scroll", update, {
  810. capture: true,
  811. passive: true
  812. });
  813. if (windowResize) useEventListener("resize", update, { passive: true });
  814. tryOnMounted(() => {
  815. if (immediate) update();
  816. });
  817. return {
  818. height,
  819. bottom,
  820. left,
  821. right,
  822. top,
  823. width,
  824. x,
  825. y,
  826. update
  827. };
  828. }
  829. function useElementSize(target, initialSize = {
  830. width: 0,
  831. height: 0
  832. }, options = {}) {
  833. const { window = defaultWindow, box = "content-box" } = options;
  834. const isSVG = computed(() => {
  835. var _unrefElement;
  836. return (_unrefElement = unrefElement(target)) === null || _unrefElement === void 0 || (_unrefElement = _unrefElement.namespaceURI) === null || _unrefElement === void 0 ? void 0 : _unrefElement.includes("svg");
  837. });
  838. const width = shallowRef(initialSize.width);
  839. const height = shallowRef(initialSize.height);
  840. const { stop: stop1 } = useResizeObserver(target, ([entry]) => {
  841. const boxSize = box === "border-box" ? entry.borderBoxSize : box === "content-box" ? entry.contentBoxSize : entry.devicePixelContentBoxSize;
  842. if (window && isSVG.value) {
  843. const $elem = unrefElement(target);
  844. if ($elem) {
  845. const rect = $elem.getBoundingClientRect();
  846. width.value = rect.width;
  847. height.value = rect.height;
  848. }
  849. } else if (boxSize) {
  850. const formatBoxSize = toArray(boxSize);
  851. width.value = formatBoxSize.reduce((acc, { inlineSize }) => acc + inlineSize, 0);
  852. height.value = formatBoxSize.reduce((acc, { blockSize }) => acc + blockSize, 0);
  853. } else {
  854. width.value = entry.contentRect.width;
  855. height.value = entry.contentRect.height;
  856. }
  857. }, options);
  858. tryOnMounted(() => {
  859. const ele = unrefElement(target);
  860. if (ele) {
  861. width.value = "offsetWidth" in ele ? ele.offsetWidth : initialSize.width;
  862. height.value = "offsetHeight" in ele ? ele.offsetHeight : initialSize.height;
  863. }
  864. });
  865. const stop2 = watch(() => unrefElement(target), (ele) => {
  866. width.value = ele ? initialSize.width : 0;
  867. height.value = ele ? initialSize.height : 0;
  868. });
  869. function stop() {
  870. stop1();
  871. stop2();
  872. }
  873. return {
  874. width,
  875. height,
  876. stop
  877. };
  878. }
  879. function useIntersectionObserver(target, callback, options = {}) {
  880. const { root, rootMargin, threshold = 0, window = defaultWindow, immediate = true } = options;
  881. const isSupported = /* @__PURE__ */ useSupported(() => window && "IntersectionObserver" in window);
  882. const targets = computed(() => {
  883. return toArray(toValue(target)).map(unrefElement).filter(notNullish);
  884. });
  885. let cleanup = noop$1;
  886. const isActive = shallowRef(immediate);
  887. const stopWatch = isSupported.value ? watch(() => [
  888. targets.value,
  889. unrefElement(root),
  890. toValue(rootMargin),
  891. isActive.value
  892. ], ([targets, root, rootMargin]) => {
  893. cleanup();
  894. if (!isActive.value) return;
  895. if (!targets.length) return;
  896. const observer = new IntersectionObserver(callback, {
  897. root: unrefElement(root),
  898. rootMargin,
  899. threshold
  900. });
  901. targets.forEach((el) => el && observer.observe(el));
  902. cleanup = () => {
  903. observer.disconnect();
  904. cleanup = noop$1;
  905. };
  906. }, {
  907. immediate,
  908. flush: "post"
  909. }) : noop$1;
  910. const stop = () => {
  911. cleanup();
  912. stopWatch();
  913. isActive.value = false;
  914. };
  915. tryOnScopeDispose(stop);
  916. return {
  917. isSupported,
  918. isActive,
  919. pause() {
  920. cleanup();
  921. isActive.value = false;
  922. },
  923. resume() {
  924. isActive.value = true;
  925. },
  926. stop
  927. };
  928. }
  929. const DEFAULT_UNITS = [
  930. {
  931. max: 6e4,
  932. value: 1e3,
  933. name: "second"
  934. },
  935. {
  936. max: 276e4,
  937. value: 6e4,
  938. name: "minute"
  939. },
  940. {
  941. max: 72e6,
  942. value: 36e5,
  943. name: "hour"
  944. },
  945. {
  946. max: 5184e5,
  947. value: 864e5,
  948. name: "day"
  949. },
  950. {
  951. max: 24192e5,
  952. value: 6048e5,
  953. name: "week"
  954. },
  955. {
  956. max: 28512e6,
  957. value: 2592e6,
  958. name: "month"
  959. },
  960. {
  961. max: Number.POSITIVE_INFINITY,
  962. value: 31536e6,
  963. name: "year"
  964. }
  965. ];
  966. function useVModel(props, key, emit, options = {}) {
  967. var _vm$$emit, _vm$proxy;
  968. const { clone = false, passive = false, eventName, deep = false, defaultValue, shouldEmit } = options;
  969. const vm = getCurrentInstance();
  970. const _emit = emit || (vm === null || vm === void 0 ? void 0 : vm.emit) || (vm === null || vm === void 0 || (_vm$$emit = vm.$emit) === null || _vm$$emit === void 0 ? void 0 : _vm$$emit.bind(vm)) || (vm === null || vm === void 0 || (_vm$proxy = vm.proxy) === null || _vm$proxy === void 0 || (_vm$proxy = _vm$proxy.$emit) === null || _vm$proxy === void 0 ? void 0 : _vm$proxy.bind(vm === null || vm === void 0 ? void 0 : vm.proxy));
  971. let event = eventName;
  972. if (!key) key = "modelValue";
  973. event = event || `update:${key.toString()}`;
  974. const cloneFn = (val) => !clone ? val : typeof clone === "function" ? clone(val) : cloneFnJSON(val);
  975. const getValue = () => isDef(props[key]) ? cloneFn(props[key]) : defaultValue;
  976. const triggerEmit = (value) => {
  977. if (shouldEmit) {
  978. if (shouldEmit(value)) _emit(event, value);
  979. } else _emit(event, value);
  980. };
  981. if (passive) {
  982. const proxy = ref(getValue());
  983. let isUpdating = false;
  984. watch(() => props[key], (v) => {
  985. if (!isUpdating) {
  986. isUpdating = true;
  987. proxy.value = cloneFn(v);
  988. nextTick(() => isUpdating = false);
  989. }
  990. });
  991. watch(proxy, (v) => {
  992. if (!isUpdating && (v !== props[key] || deep)) triggerEmit(v);
  993. }, { deep });
  994. return proxy;
  995. } else return computed({
  996. get() {
  997. return getValue();
  998. },
  999. set(value) {
  1000. triggerEmit(value);
  1001. }
  1002. });
  1003. }
  1004. function useWindowFocus(options = {}) {
  1005. const { window = defaultWindow } = options;
  1006. if (!window) return shallowRef(false);
  1007. const focused = shallowRef(window.document.hasFocus());
  1008. const listenerOptions = { passive: true };
  1009. useEventListener(window, "blur", () => {
  1010. focused.value = false;
  1011. }, listenerOptions);
  1012. useEventListener(window, "focus", () => {
  1013. focused.value = true;
  1014. }, listenerOptions);
  1015. return focused;
  1016. }
  1017. function useWindowSize(options = {}) {
  1018. const { window = defaultWindow, initialWidth = Number.POSITIVE_INFINITY, initialHeight = Number.POSITIVE_INFINITY, listenOrientation = true, includeScrollbar = true, type = "inner" } = options;
  1019. const width = shallowRef(initialWidth);
  1020. const height = shallowRef(initialHeight);
  1021. const update = () => {
  1022. if (window) if (type === "outer") {
  1023. width.value = window.outerWidth;
  1024. height.value = window.outerHeight;
  1025. } else if (type === "visual" && window.visualViewport) {
  1026. const { width: visualViewportWidth, height: visualViewportHeight, scale } = window.visualViewport;
  1027. width.value = Math.round(visualViewportWidth * scale);
  1028. height.value = Math.round(visualViewportHeight * scale);
  1029. } else if (includeScrollbar) {
  1030. width.value = window.innerWidth;
  1031. height.value = window.innerHeight;
  1032. } else {
  1033. width.value = window.document.documentElement.clientWidth;
  1034. height.value = window.document.documentElement.clientHeight;
  1035. }
  1036. };
  1037. update();
  1038. tryOnMounted(update);
  1039. const listenerOptions = { passive: true };
  1040. useEventListener("resize", update, listenerOptions);
  1041. if (window && type === "visual" && window.visualViewport) useEventListener(window.visualViewport, "resize", update, listenerOptions);
  1042. if (listenOrientation) watch(useMediaQuery("(orientation: portrait)"), () => update());
  1043. return {
  1044. width,
  1045. height
  1046. };
  1047. }
  1048. //#endregion
  1049. //#region ../../packages/utils/browser.ts
  1050. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  1051. const isAndroid = () => isClient && /android/i.test(window.navigator.userAgent);
  1052. //#endregion
  1053. //#region ../../packages/utils/dom/event.ts
  1054. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  1055. const handleEvent = (event) => {
  1056. const shouldPrevent = theirsHandler?.(event);
  1057. if (checkForDefaultPrevented === false || !shouldPrevent) return oursHandler?.(event);
  1058. };
  1059. return handleEvent;
  1060. };
  1061. const whenMouse = (handler) => {
  1062. return (e) => e.pointerType === "mouse" ? handler(e) : void 0;
  1063. };
  1064. const getEventCode = (event) => {
  1065. if (event.code && event.code !== "Unidentified") return event.code;
  1066. const key = getEventKey(event);
  1067. if (key) {
  1068. if (Object.values(EVENT_CODE).includes(key)) return key;
  1069. switch (key) {
  1070. case " ": return EVENT_CODE.space;
  1071. default: return "";
  1072. }
  1073. }
  1074. return "";
  1075. };
  1076. const getEventKey = (event) => {
  1077. let key = event.key && event.key !== "Unidentified" ? event.key : "";
  1078. if (!key && event.type === "keyup" && isAndroid()) {
  1079. const target = event.target;
  1080. key = target.value.charAt(target.selectionStart - 1);
  1081. }
  1082. return key;
  1083. };
  1084. //#endregion
  1085. //#region ../../packages/utils/dom/position.ts
  1086. const getOffsetTop = (el) => {
  1087. let offset = 0;
  1088. let parent = el;
  1089. while (parent) {
  1090. offset += parent.offsetTop;
  1091. parent = parent.offsetParent;
  1092. }
  1093. return offset;
  1094. };
  1095. const getOffsetTopDistance = (el, containerEl) => {
  1096. return Math.abs(getOffsetTop(el) - getOffsetTop(containerEl));
  1097. };
  1098. const getClientXY = (event) => {
  1099. let clientX;
  1100. let clientY;
  1101. if (event.type === "touchend") {
  1102. clientY = event.changedTouches[0].clientY;
  1103. clientX = event.changedTouches[0].clientX;
  1104. } else if (event.type.startsWith("touch")) {
  1105. clientY = event.touches[0].clientY;
  1106. clientX = event.touches[0].clientX;
  1107. } else {
  1108. clientY = event.clientY;
  1109. clientX = event.clientX;
  1110. }
  1111. return {
  1112. clientX,
  1113. clientY
  1114. };
  1115. };
  1116. //#endregion
  1117. //#region ../../packages/utils/easings.ts
  1118. function easeInOutCubic(t, b, c, d) {
  1119. const cc = c - b;
  1120. t /= d / 2;
  1121. if (t < 1) return cc / 2 * t * t * t + b;
  1122. return cc / 2 * ((t -= 2) * t * t + 2) + b;
  1123. }
  1124. //#endregion
  1125. //#region ../../node_modules/.pnpm/@vue+shared@3.5.25/node_modules/@vue/shared/dist/shared.esm-bundler.js
  1126. /**
  1127. * @vue/shared v3.5.25
  1128. * (c) 2018-present Yuxi (Evan) You and Vue contributors
  1129. * @license MIT
  1130. **/
  1131. /* @__NO_SIDE_EFFECTS__ */
  1132. function makeMap(str) {
  1133. const map = /* @__PURE__ */ Object.create(null);
  1134. for (const key of str.split(",")) map[key] = 1;
  1135. return (val) => val in map;
  1136. }
  1137. const NOOP = () => {};
  1138. const hasOwnProperty$14 = Object.prototype.hasOwnProperty;
  1139. const hasOwn = (val, key) => hasOwnProperty$14.call(val, key);
  1140. const isArray$1 = Array.isArray;
  1141. const isDate = (val) => toTypeString(val) === "[object Date]";
  1142. const isFunction$1 = (val) => typeof val === "function";
  1143. const isString = (val) => typeof val === "string";
  1144. const isObject$1 = (val) => val !== null && typeof val === "object";
  1145. const isPromise = (val) => {
  1146. return (isObject$1(val) || isFunction$1(val)) && isFunction$1(val.then) && isFunction$1(val.catch);
  1147. };
  1148. const objectToString$1 = Object.prototype.toString;
  1149. const toTypeString = (value) => objectToString$1.call(value);
  1150. const isPlainObject$1 = (val) => toTypeString(val) === "[object Object]";
  1151. const cacheStringFunction = (fn) => {
  1152. const cache = /* @__PURE__ */ Object.create(null);
  1153. return ((str) => {
  1154. return cache[str] || (cache[str] = fn(str));
  1155. });
  1156. };
  1157. const camelizeRE = /-\w/g;
  1158. const camelize = cacheStringFunction((str) => {
  1159. return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
  1160. });
  1161. const hyphenateRE = /\B([A-Z])/g;
  1162. const hyphenate = cacheStringFunction((str) => str.replace(hyphenateRE, "-$1").toLowerCase());
  1163. const capitalize$1 = cacheStringFunction((str) => {
  1164. return str.charAt(0).toUpperCase() + str.slice(1);
  1165. });
  1166. const toHandlerKey$1 = cacheStringFunction((str) => {
  1167. return str ? `on${capitalize$1(str)}` : ``;
  1168. });
  1169. const specialBooleanAttrs = `itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,readonly`;
  1170. const isBooleanAttr = /* @__PURE__ */ makeMap(specialBooleanAttrs + `,async,autofocus,autoplay,controls,default,defer,disabled,hidden,inert,loop,open,required,reversed,scoped,seamless,checked,muted,multiple,selected`);
  1171. //#endregion
  1172. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js
  1173. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  1174. //#endregion
  1175. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_root.js
  1176. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  1177. var root = freeGlobal || freeSelf || Function("return this")();
  1178. //#endregion
  1179. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Symbol.js
  1180. var Symbol$1 = root.Symbol;
  1181. //#endregion
  1182. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getRawTag.js
  1183. var objectProto$4 = Object.prototype;
  1184. var hasOwnProperty$13 = objectProto$4.hasOwnProperty;
  1185. var nativeObjectToString$1 = objectProto$4.toString;
  1186. var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : void 0;
  1187. function getRawTag(value) {
  1188. var isOwn = hasOwnProperty$13.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  1189. try {
  1190. value[symToStringTag$1] = void 0;
  1191. var unmasked = true;
  1192. } catch (e) {}
  1193. var result = nativeObjectToString$1.call(value);
  1194. if (unmasked) if (isOwn) value[symToStringTag$1] = tag;
  1195. else delete value[symToStringTag$1];
  1196. return result;
  1197. }
  1198. //#endregion
  1199. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_objectToString.js
  1200. var nativeObjectToString = Object.prototype.toString;
  1201. function objectToString(value) {
  1202. return nativeObjectToString.call(value);
  1203. }
  1204. //#endregion
  1205. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetTag.js
  1206. var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
  1207. var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : void 0;
  1208. function baseGetTag(value) {
  1209. if (value == null) return value === void 0 ? undefinedTag : nullTag;
  1210. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
  1211. }
  1212. //#endregion
  1213. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObjectLike.js
  1214. function isObjectLike(value) {
  1215. return value != null && typeof value == "object";
  1216. }
  1217. //#endregion
  1218. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSymbol.js
  1219. var symbolTag$3 = "[object Symbol]";
  1220. function isSymbol(value) {
  1221. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$3;
  1222. }
  1223. //#endregion
  1224. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayMap.js
  1225. function arrayMap(array, iteratee) {
  1226. var index = -1, length = array == null ? 0 : array.length, result = Array(length);
  1227. while (++index < length) result[index] = iteratee(array[index], index, array);
  1228. return result;
  1229. }
  1230. //#endregion
  1231. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArray.js
  1232. var isArray = Array.isArray;
  1233. //#endregion
  1234. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseToString.js
  1235. var INFINITY$3 = Infinity;
  1236. var symbolProto$2 = Symbol$1 ? Symbol$1.prototype : void 0, symbolToString = symbolProto$2 ? symbolProto$2.toString : void 0;
  1237. function baseToString(value) {
  1238. if (typeof value == "string") return value;
  1239. if (isArray(value)) return arrayMap(value, baseToString) + "";
  1240. if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : "";
  1241. var result = value + "";
  1242. return result == "0" && 1 / value == -INFINITY$3 ? "-0" : result;
  1243. }
  1244. //#endregion
  1245. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js
  1246. var reWhitespace = /\s/;
  1247. function trimmedEndIndex(string) {
  1248. var index = string.length;
  1249. while (index-- && reWhitespace.test(string.charAt(index)));
  1250. return index;
  1251. }
  1252. //#endregion
  1253. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js
  1254. var reTrimStart = /^\s+/;
  1255. function baseTrim(string) {
  1256. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
  1257. }
  1258. //#endregion
  1259. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObject.js
  1260. function isObject(value) {
  1261. var type = typeof value;
  1262. return value != null && (type == "object" || type == "function");
  1263. }
  1264. //#endregion
  1265. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js
  1266. var NAN = NaN;
  1267. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  1268. var reIsBinary = /^0b[01]+$/i;
  1269. var reIsOctal = /^0o[0-7]+$/i;
  1270. var freeParseInt = parseInt;
  1271. function toNumber(value) {
  1272. if (typeof value == "number") return value;
  1273. if (isSymbol(value)) return NAN;
  1274. if (isObject(value)) {
  1275. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  1276. value = isObject(other) ? other + "" : other;
  1277. }
  1278. if (typeof value != "string") return value === 0 ? value : +value;
  1279. value = baseTrim(value);
  1280. var isBinary = reIsBinary.test(value);
  1281. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
  1282. }
  1283. //#endregion
  1284. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toFinite.js
  1285. var INFINITY$2 = Infinity, MAX_INTEGER = 17976931348623157e292;
  1286. function toFinite(value) {
  1287. if (!value) return value === 0 ? value : 0;
  1288. value = toNumber(value);
  1289. if (value === INFINITY$2 || value === -INFINITY$2) return (value < 0 ? -1 : 1) * MAX_INTEGER;
  1290. return value === value ? value : 0;
  1291. }
  1292. //#endregion
  1293. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toInteger.js
  1294. function toInteger(value) {
  1295. var result = toFinite(value), remainder = result % 1;
  1296. return result === result ? remainder ? result - remainder : result : 0;
  1297. }
  1298. //#endregion
  1299. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/identity.js
  1300. function identity(value) {
  1301. return value;
  1302. }
  1303. //#endregion
  1304. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isFunction.js
  1305. var asyncTag = "[object AsyncFunction]", funcTag$2 = "[object Function]", genTag$1 = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
  1306. function isFunction(value) {
  1307. if (!isObject(value)) return false;
  1308. var tag = baseGetTag(value);
  1309. return tag == funcTag$2 || tag == genTag$1 || tag == asyncTag || tag == proxyTag;
  1310. }
  1311. //#endregion
  1312. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_coreJsData.js
  1313. var coreJsData = root["__core-js_shared__"];
  1314. //#endregion
  1315. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isMasked.js
  1316. var maskSrcKey = function() {
  1317. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
  1318. return uid ? "Symbol(src)_1." + uid : "";
  1319. }();
  1320. function isMasked(func) {
  1321. return !!maskSrcKey && maskSrcKey in func;
  1322. }
  1323. //#endregion
  1324. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_toSource.js
  1325. var funcToString$2 = Function.prototype.toString;
  1326. function toSource(func) {
  1327. if (func != null) {
  1328. try {
  1329. return funcToString$2.call(func);
  1330. } catch (e) {}
  1331. try {
  1332. return func + "";
  1333. } catch (e) {}
  1334. }
  1335. return "";
  1336. }
  1337. //#endregion
  1338. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNative.js
  1339. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  1340. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  1341. var funcProto$1 = Function.prototype, objectProto$3 = Object.prototype;
  1342. var funcToString$1 = funcProto$1.toString;
  1343. var hasOwnProperty$12 = objectProto$3.hasOwnProperty;
  1344. var reIsNative = RegExp("^" + funcToString$1.call(hasOwnProperty$12).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
  1345. function baseIsNative(value) {
  1346. if (!isObject(value) || isMasked(value)) return false;
  1347. return (isFunction(value) ? reIsNative : reIsHostCtor).test(toSource(value));
  1348. }
  1349. //#endregion
  1350. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getValue.js
  1351. function getValue$1(object, key) {
  1352. return object == null ? void 0 : object[key];
  1353. }
  1354. //#endregion
  1355. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getNative.js
  1356. function getNative(object, key) {
  1357. var value = getValue$1(object, key);
  1358. return baseIsNative(value) ? value : void 0;
  1359. }
  1360. //#endregion
  1361. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_WeakMap.js
  1362. var WeakMap$1 = getNative(root, "WeakMap");
  1363. //#endregion
  1364. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseCreate.js
  1365. var objectCreate = Object.create;
  1366. var baseCreate = function() {
  1367. function object() {}
  1368. return function(proto) {
  1369. if (!isObject(proto)) return {};
  1370. if (objectCreate) return objectCreate(proto);
  1371. object.prototype = proto;
  1372. var result = new object();
  1373. object.prototype = void 0;
  1374. return result;
  1375. };
  1376. }();
  1377. //#endregion
  1378. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_apply.js
  1379. function apply(func, thisArg, args) {
  1380. switch (args.length) {
  1381. case 0: return func.call(thisArg);
  1382. case 1: return func.call(thisArg, args[0]);
  1383. case 2: return func.call(thisArg, args[0], args[1]);
  1384. case 3: return func.call(thisArg, args[0], args[1], args[2]);
  1385. }
  1386. return func.apply(thisArg, args);
  1387. }
  1388. //#endregion
  1389. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/noop.js
  1390. function noop() {}
  1391. //#endregion
  1392. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copyArray.js
  1393. function copyArray(source, array) {
  1394. var index = -1, length = source.length;
  1395. array || (array = Array(length));
  1396. while (++index < length) array[index] = source[index];
  1397. return array;
  1398. }
  1399. //#endregion
  1400. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_shortOut.js
  1401. var HOT_COUNT = 800, HOT_SPAN = 16;
  1402. var nativeNow = Date.now;
  1403. function shortOut(func) {
  1404. var count = 0, lastCalled = 0;
  1405. return function() {
  1406. var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled);
  1407. lastCalled = stamp;
  1408. if (remaining > 0) {
  1409. if (++count >= HOT_COUNT) return arguments[0];
  1410. } else count = 0;
  1411. return func.apply(void 0, arguments);
  1412. };
  1413. }
  1414. //#endregion
  1415. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/constant.js
  1416. function constant(value) {
  1417. return function() {
  1418. return value;
  1419. };
  1420. }
  1421. //#endregion
  1422. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_defineProperty.js
  1423. var defineProperty = function() {
  1424. try {
  1425. var func = getNative(Object, "defineProperty");
  1426. func({}, "", {});
  1427. return func;
  1428. } catch (e) {}
  1429. }();
  1430. //#endregion
  1431. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseSetToString.js
  1432. var baseSetToString = !defineProperty ? identity : function(func, string) {
  1433. return defineProperty(func, "toString", {
  1434. "configurable": true,
  1435. "enumerable": false,
  1436. "value": constant(string),
  1437. "writable": true
  1438. });
  1439. };
  1440. //#endregion
  1441. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setToString.js
  1442. var setToString = shortOut(baseSetToString);
  1443. //#endregion
  1444. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayEach.js
  1445. function arrayEach(array, iteratee) {
  1446. var index = -1, length = array == null ? 0 : array.length;
  1447. while (++index < length) if (iteratee(array[index], index, array) === false) break;
  1448. return array;
  1449. }
  1450. //#endregion
  1451. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseFindIndex.js
  1452. function baseFindIndex(array, predicate, fromIndex, fromRight) {
  1453. var length = array.length, index = fromIndex + (fromRight ? 1 : -1);
  1454. while (fromRight ? index-- : ++index < length) if (predicate(array[index], index, array)) return index;
  1455. return -1;
  1456. }
  1457. //#endregion
  1458. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsNaN.js
  1459. function baseIsNaN(value) {
  1460. return value !== value;
  1461. }
  1462. //#endregion
  1463. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_strictIndexOf.js
  1464. function strictIndexOf(array, value, fromIndex) {
  1465. var index = fromIndex - 1, length = array.length;
  1466. while (++index < length) if (array[index] === value) return index;
  1467. return -1;
  1468. }
  1469. //#endregion
  1470. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIndexOf.js
  1471. function baseIndexOf(array, value, fromIndex) {
  1472. return value === value ? strictIndexOf(array, value, fromIndex) : baseFindIndex(array, baseIsNaN, fromIndex);
  1473. }
  1474. //#endregion
  1475. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayIncludes.js
  1476. function arrayIncludes(array, value) {
  1477. return !!(array == null ? 0 : array.length) && baseIndexOf(array, value, 0) > -1;
  1478. }
  1479. //#endregion
  1480. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isIndex.js
  1481. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  1482. var reIsUint = /^(?:0|[1-9]\d*)$/;
  1483. function isIndex(value, length) {
  1484. var type = typeof value;
  1485. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  1486. return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
  1487. }
  1488. //#endregion
  1489. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignValue.js
  1490. function baseAssignValue(object, key, value) {
  1491. if (key == "__proto__" && defineProperty) defineProperty(object, key, {
  1492. "configurable": true,
  1493. "enumerable": true,
  1494. "value": value,
  1495. "writable": true
  1496. });
  1497. else object[key] = value;
  1498. }
  1499. //#endregion
  1500. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/eq.js
  1501. function eq(value, other) {
  1502. return value === other || value !== value && other !== other;
  1503. }
  1504. //#endregion
  1505. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assignValue.js
  1506. var hasOwnProperty$11 = Object.prototype.hasOwnProperty;
  1507. function assignValue(object, key, value) {
  1508. var objValue = object[key];
  1509. if (!(hasOwnProperty$11.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) baseAssignValue(object, key, value);
  1510. }
  1511. //#endregion
  1512. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copyObject.js
  1513. function copyObject(source, props, object, customizer) {
  1514. var isNew = !object;
  1515. object || (object = {});
  1516. var index = -1, length = props.length;
  1517. while (++index < length) {
  1518. var key = props[index];
  1519. var newValue = customizer ? customizer(object[key], source[key], key, object, source) : void 0;
  1520. if (newValue === void 0) newValue = source[key];
  1521. if (isNew) baseAssignValue(object, key, newValue);
  1522. else assignValue(object, key, newValue);
  1523. }
  1524. return object;
  1525. }
  1526. //#endregion
  1527. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_overRest.js
  1528. var nativeMax$2 = Math.max;
  1529. function overRest(func, start, transform) {
  1530. start = nativeMax$2(start === void 0 ? func.length - 1 : start, 0);
  1531. return function() {
  1532. var args = arguments, index = -1, length = nativeMax$2(args.length - start, 0), array = Array(length);
  1533. while (++index < length) array[index] = args[start + index];
  1534. index = -1;
  1535. var otherArgs = Array(start + 1);
  1536. while (++index < start) otherArgs[index] = args[index];
  1537. otherArgs[start] = transform(array);
  1538. return apply(func, this, otherArgs);
  1539. };
  1540. }
  1541. //#endregion
  1542. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseRest.js
  1543. function baseRest(func, start) {
  1544. return setToString(overRest(func, start, identity), func + "");
  1545. }
  1546. //#endregion
  1547. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isLength.js
  1548. var MAX_SAFE_INTEGER = 9007199254740991;
  1549. function isLength(value) {
  1550. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  1551. }
  1552. //#endregion
  1553. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArrayLike.js
  1554. function isArrayLike(value) {
  1555. return value != null && isLength(value.length) && !isFunction(value);
  1556. }
  1557. //#endregion
  1558. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isIterateeCall.js
  1559. function isIterateeCall(value, index, object) {
  1560. if (!isObject(object)) return false;
  1561. var type = typeof index;
  1562. if (type == "number" ? isArrayLike(object) && isIndex(index, object.length) : type == "string" && index in object) return eq(object[index], value);
  1563. return false;
  1564. }
  1565. //#endregion
  1566. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createAssigner.js
  1567. function createAssigner(assigner) {
  1568. return baseRest(function(object, sources) {
  1569. var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
  1570. customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
  1571. if (guard && isIterateeCall(sources[0], sources[1], guard)) {
  1572. customizer = length < 3 ? void 0 : customizer;
  1573. length = 1;
  1574. }
  1575. object = Object(object);
  1576. while (++index < length) {
  1577. var source = sources[index];
  1578. if (source) assigner(object, source, index, customizer);
  1579. }
  1580. return object;
  1581. });
  1582. }
  1583. //#endregion
  1584. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isPrototype.js
  1585. var objectProto$2 = Object.prototype;
  1586. function isPrototype(value) {
  1587. var Ctor = value && value.constructor;
  1588. return value === (typeof Ctor == "function" && Ctor.prototype || objectProto$2);
  1589. }
  1590. //#endregion
  1591. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseTimes.js
  1592. function baseTimes(n, iteratee) {
  1593. var index = -1, result = Array(n);
  1594. while (++index < n) result[index] = iteratee(index);
  1595. return result;
  1596. }
  1597. //#endregion
  1598. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsArguments.js
  1599. var argsTag$3 = "[object Arguments]";
  1600. function baseIsArguments(value) {
  1601. return isObjectLike(value) && baseGetTag(value) == argsTag$3;
  1602. }
  1603. //#endregion
  1604. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArguments.js
  1605. var objectProto$1 = Object.prototype;
  1606. var hasOwnProperty$10 = objectProto$1.hasOwnProperty;
  1607. var propertyIsEnumerable$1 = objectProto$1.propertyIsEnumerable;
  1608. var isArguments = baseIsArguments(function() {
  1609. return arguments;
  1610. }()) ? baseIsArguments : function(value) {
  1611. return isObjectLike(value) && hasOwnProperty$10.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  1612. };
  1613. //#endregion
  1614. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/stubFalse.js
  1615. function stubFalse() {
  1616. return false;
  1617. }
  1618. //#endregion
  1619. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isBuffer.js
  1620. var freeExports$2 = typeof exports == "object" && exports && !exports.nodeType && exports;
  1621. var freeModule$2 = freeExports$2 && typeof module == "object" && module && !module.nodeType && module;
  1622. var Buffer$2 = freeModule$2 && freeModule$2.exports === freeExports$2 ? root.Buffer : void 0;
  1623. var isBuffer = (Buffer$2 ? Buffer$2.isBuffer : void 0) || stubFalse;
  1624. //#endregion
  1625. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsTypedArray.js
  1626. var argsTag$2 = "[object Arguments]", arrayTag$2 = "[object Array]", boolTag$3 = "[object Boolean]", dateTag$3 = "[object Date]", errorTag$2 = "[object Error]", funcTag$1 = "[object Function]", mapTag$5 = "[object Map]", numberTag$3 = "[object Number]", objectTag$4 = "[object Object]", regexpTag$3 = "[object RegExp]", setTag$5 = "[object Set]", stringTag$3 = "[object String]", weakMapTag$2 = "[object WeakMap]";
  1627. var arrayBufferTag$3 = "[object ArrayBuffer]", dataViewTag$4 = "[object DataView]", float32Tag$2 = "[object Float32Array]", float64Tag$2 = "[object Float64Array]", int8Tag$2 = "[object Int8Array]", int16Tag$2 = "[object Int16Array]", int32Tag$2 = "[object Int32Array]", uint8Tag$2 = "[object Uint8Array]", uint8ClampedTag$2 = "[object Uint8ClampedArray]", uint16Tag$2 = "[object Uint16Array]", uint32Tag$2 = "[object Uint32Array]";
  1628. var typedArrayTags = {};
  1629. 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;
  1630. typedArrayTags[argsTag$2] = typedArrayTags[arrayTag$2] = typedArrayTags[arrayBufferTag$3] = typedArrayTags[boolTag$3] = typedArrayTags[dataViewTag$4] = typedArrayTags[dateTag$3] = typedArrayTags[errorTag$2] = typedArrayTags[funcTag$1] = typedArrayTags[mapTag$5] = typedArrayTags[numberTag$3] = typedArrayTags[objectTag$4] = typedArrayTags[regexpTag$3] = typedArrayTags[setTag$5] = typedArrayTags[stringTag$3] = typedArrayTags[weakMapTag$2] = false;
  1631. function baseIsTypedArray(value) {
  1632. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  1633. }
  1634. //#endregion
  1635. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseUnary.js
  1636. function baseUnary(func) {
  1637. return function(value) {
  1638. return func(value);
  1639. };
  1640. }
  1641. //#endregion
  1642. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nodeUtil.js
  1643. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  1644. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  1645. var freeProcess = freeModule$1 && freeModule$1.exports === freeExports$1 && freeGlobal.process;
  1646. var nodeUtil = function() {
  1647. try {
  1648. var types = freeModule$1 && freeModule$1.require && freeModule$1.require("util").types;
  1649. if (types) return types;
  1650. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  1651. } catch (e) {}
  1652. }();
  1653. //#endregion
  1654. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isTypedArray.js
  1655. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  1656. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  1657. //#endregion
  1658. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayLikeKeys.js
  1659. var hasOwnProperty$9 = Object.prototype.hasOwnProperty;
  1660. function arrayLikeKeys(value, inherited) {
  1661. var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
  1662. for (var key in value) if ((inherited || hasOwnProperty$9.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) result.push(key);
  1663. return result;
  1664. }
  1665. //#endregion
  1666. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_overArg.js
  1667. function overArg(func, transform) {
  1668. return function(arg) {
  1669. return func(transform(arg));
  1670. };
  1671. }
  1672. //#endregion
  1673. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeys.js
  1674. var nativeKeys = overArg(Object.keys, Object);
  1675. //#endregion
  1676. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseKeys.js
  1677. var hasOwnProperty$8 = Object.prototype.hasOwnProperty;
  1678. function baseKeys(object) {
  1679. if (!isPrototype(object)) return nativeKeys(object);
  1680. var result = [];
  1681. for (var key in Object(object)) if (hasOwnProperty$8.call(object, key) && key != "constructor") result.push(key);
  1682. return result;
  1683. }
  1684. //#endregion
  1685. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/keys.js
  1686. function keys(object) {
  1687. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  1688. }
  1689. //#endregion
  1690. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeKeysIn.js
  1691. function nativeKeysIn(object) {
  1692. var result = [];
  1693. if (object != null) for (var key in Object(object)) result.push(key);
  1694. return result;
  1695. }
  1696. //#endregion
  1697. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseKeysIn.js
  1698. var hasOwnProperty$7 = Object.prototype.hasOwnProperty;
  1699. function baseKeysIn(object) {
  1700. if (!isObject(object)) return nativeKeysIn(object);
  1701. var isProto = isPrototype(object), result = [];
  1702. for (var key in object) if (!(key == "constructor" && (isProto || !hasOwnProperty$7.call(object, key)))) result.push(key);
  1703. return result;
  1704. }
  1705. //#endregion
  1706. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/keysIn.js
  1707. function keysIn(object) {
  1708. return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);
  1709. }
  1710. //#endregion
  1711. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isKey.js
  1712. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
  1713. function isKey(value, object) {
  1714. if (isArray(value)) return false;
  1715. var type = typeof value;
  1716. if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) return true;
  1717. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  1718. }
  1719. //#endregion
  1720. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_nativeCreate.js
  1721. var nativeCreate = getNative(Object, "create");
  1722. //#endregion
  1723. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashClear.js
  1724. function hashClear() {
  1725. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  1726. this.size = 0;
  1727. }
  1728. //#endregion
  1729. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashDelete.js
  1730. function hashDelete(key) {
  1731. var result = this.has(key) && delete this.__data__[key];
  1732. this.size -= result ? 1 : 0;
  1733. return result;
  1734. }
  1735. //#endregion
  1736. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashGet.js
  1737. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  1738. var hasOwnProperty$6 = Object.prototype.hasOwnProperty;
  1739. function hashGet(key) {
  1740. var data = this.__data__;
  1741. if (nativeCreate) {
  1742. var result = data[key];
  1743. return result === HASH_UNDEFINED$2 ? void 0 : result;
  1744. }
  1745. return hasOwnProperty$6.call(data, key) ? data[key] : void 0;
  1746. }
  1747. //#endregion
  1748. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashHas.js
  1749. var hasOwnProperty$5 = Object.prototype.hasOwnProperty;
  1750. function hashHas(key) {
  1751. var data = this.__data__;
  1752. return nativeCreate ? data[key] !== void 0 : hasOwnProperty$5.call(data, key);
  1753. }
  1754. //#endregion
  1755. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hashSet.js
  1756. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  1757. function hashSet(key, value) {
  1758. var data = this.__data__;
  1759. this.size += this.has(key) ? 0 : 1;
  1760. data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED$1 : value;
  1761. return this;
  1762. }
  1763. //#endregion
  1764. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Hash.js
  1765. function Hash(entries) {
  1766. var index = -1, length = entries == null ? 0 : entries.length;
  1767. this.clear();
  1768. while (++index < length) {
  1769. var entry = entries[index];
  1770. this.set(entry[0], entry[1]);
  1771. }
  1772. }
  1773. Hash.prototype.clear = hashClear;
  1774. Hash.prototype["delete"] = hashDelete;
  1775. Hash.prototype.get = hashGet;
  1776. Hash.prototype.has = hashHas;
  1777. Hash.prototype.set = hashSet;
  1778. //#endregion
  1779. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheClear.js
  1780. function listCacheClear() {
  1781. this.__data__ = [];
  1782. this.size = 0;
  1783. }
  1784. //#endregion
  1785. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assocIndexOf.js
  1786. function assocIndexOf(array, key) {
  1787. var length = array.length;
  1788. while (length--) if (eq(array[length][0], key)) return length;
  1789. return -1;
  1790. }
  1791. //#endregion
  1792. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheDelete.js
  1793. var splice = Array.prototype.splice;
  1794. function listCacheDelete(key) {
  1795. var data = this.__data__, index = assocIndexOf(data, key);
  1796. if (index < 0) return false;
  1797. if (index == data.length - 1) data.pop();
  1798. else splice.call(data, index, 1);
  1799. --this.size;
  1800. return true;
  1801. }
  1802. //#endregion
  1803. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheGet.js
  1804. function listCacheGet(key) {
  1805. var data = this.__data__, index = assocIndexOf(data, key);
  1806. return index < 0 ? void 0 : data[index][1];
  1807. }
  1808. //#endregion
  1809. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheHas.js
  1810. function listCacheHas(key) {
  1811. return assocIndexOf(this.__data__, key) > -1;
  1812. }
  1813. //#endregion
  1814. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_listCacheSet.js
  1815. function listCacheSet(key, value) {
  1816. var data = this.__data__, index = assocIndexOf(data, key);
  1817. if (index < 0) {
  1818. ++this.size;
  1819. data.push([key, value]);
  1820. } else data[index][1] = value;
  1821. return this;
  1822. }
  1823. //#endregion
  1824. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_ListCache.js
  1825. function ListCache(entries) {
  1826. var index = -1, length = entries == null ? 0 : entries.length;
  1827. this.clear();
  1828. while (++index < length) {
  1829. var entry = entries[index];
  1830. this.set(entry[0], entry[1]);
  1831. }
  1832. }
  1833. ListCache.prototype.clear = listCacheClear;
  1834. ListCache.prototype["delete"] = listCacheDelete;
  1835. ListCache.prototype.get = listCacheGet;
  1836. ListCache.prototype.has = listCacheHas;
  1837. ListCache.prototype.set = listCacheSet;
  1838. //#endregion
  1839. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Map.js
  1840. var Map$1 = getNative(root, "Map");
  1841. //#endregion
  1842. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheClear.js
  1843. function mapCacheClear() {
  1844. this.size = 0;
  1845. this.__data__ = {
  1846. "hash": new Hash(),
  1847. "map": new (Map$1 || ListCache)(),
  1848. "string": new Hash()
  1849. };
  1850. }
  1851. //#endregion
  1852. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isKeyable.js
  1853. function isKeyable(value) {
  1854. var type = typeof value;
  1855. return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
  1856. }
  1857. //#endregion
  1858. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getMapData.js
  1859. function getMapData(map, key) {
  1860. var data = map.__data__;
  1861. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  1862. }
  1863. //#endregion
  1864. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheDelete.js
  1865. function mapCacheDelete(key) {
  1866. var result = getMapData(this, key)["delete"](key);
  1867. this.size -= result ? 1 : 0;
  1868. return result;
  1869. }
  1870. //#endregion
  1871. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheGet.js
  1872. function mapCacheGet(key) {
  1873. return getMapData(this, key).get(key);
  1874. }
  1875. //#endregion
  1876. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheHas.js
  1877. function mapCacheHas(key) {
  1878. return getMapData(this, key).has(key);
  1879. }
  1880. //#endregion
  1881. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapCacheSet.js
  1882. function mapCacheSet(key, value) {
  1883. var data = getMapData(this, key), size = data.size;
  1884. data.set(key, value);
  1885. this.size += data.size == size ? 0 : 1;
  1886. return this;
  1887. }
  1888. //#endregion
  1889. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_MapCache.js
  1890. function MapCache(entries) {
  1891. var index = -1, length = entries == null ? 0 : entries.length;
  1892. this.clear();
  1893. while (++index < length) {
  1894. var entry = entries[index];
  1895. this.set(entry[0], entry[1]);
  1896. }
  1897. }
  1898. MapCache.prototype.clear = mapCacheClear;
  1899. MapCache.prototype["delete"] = mapCacheDelete;
  1900. MapCache.prototype.get = mapCacheGet;
  1901. MapCache.prototype.has = mapCacheHas;
  1902. MapCache.prototype.set = mapCacheSet;
  1903. //#endregion
  1904. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/memoize.js
  1905. var FUNC_ERROR_TEXT$2 = "Expected a function";
  1906. function memoize(func, resolver) {
  1907. if (typeof func != "function" || resolver != null && typeof resolver != "function") throw new TypeError(FUNC_ERROR_TEXT$2);
  1908. var memoized = function() {
  1909. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  1910. if (cache.has(key)) return cache.get(key);
  1911. var result = func.apply(this, args);
  1912. memoized.cache = cache.set(key, result) || cache;
  1913. return result;
  1914. };
  1915. memoized.cache = new (memoize.Cache || MapCache)();
  1916. return memoized;
  1917. }
  1918. memoize.Cache = MapCache;
  1919. //#endregion
  1920. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_memoizeCapped.js
  1921. var MAX_MEMOIZE_SIZE = 500;
  1922. function memoizeCapped(func) {
  1923. var result = memoize(func, function(key) {
  1924. if (cache.size === MAX_MEMOIZE_SIZE) cache.clear();
  1925. return key;
  1926. });
  1927. var cache = result.cache;
  1928. return result;
  1929. }
  1930. //#endregion
  1931. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stringToPath.js
  1932. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  1933. var reEscapeChar = /\\(\\)?/g;
  1934. var stringToPath = memoizeCapped(function(string) {
  1935. var result = [];
  1936. if (string.charCodeAt(0) === 46) result.push("");
  1937. string.replace(rePropName, function(match, number, quote, subString) {
  1938. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  1939. });
  1940. return result;
  1941. });
  1942. //#endregion
  1943. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toString.js
  1944. function toString(value) {
  1945. return value == null ? "" : baseToString(value);
  1946. }
  1947. //#endregion
  1948. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_castPath.js
  1949. function castPath(value, object) {
  1950. if (isArray(value)) return value;
  1951. return isKey(value, object) ? [value] : stringToPath(toString(value));
  1952. }
  1953. //#endregion
  1954. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_toKey.js
  1955. var INFINITY$1 = Infinity;
  1956. function toKey(value) {
  1957. if (typeof value == "string" || isSymbol(value)) return value;
  1958. var result = value + "";
  1959. return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
  1960. }
  1961. //#endregion
  1962. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGet.js
  1963. function baseGet(object, path) {
  1964. path = castPath(path, object);
  1965. var index = 0, length = path.length;
  1966. while (object != null && index < length) object = object[toKey(path[index++])];
  1967. return index && index == length ? object : void 0;
  1968. }
  1969. //#endregion
  1970. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/get.js
  1971. function get(object, path, defaultValue) {
  1972. var result = object == null ? void 0 : baseGet(object, path);
  1973. return result === void 0 ? defaultValue : result;
  1974. }
  1975. //#endregion
  1976. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayPush.js
  1977. function arrayPush(array, values) {
  1978. var index = -1, length = values.length, offset = array.length;
  1979. while (++index < length) array[offset + index] = values[index];
  1980. return array;
  1981. }
  1982. //#endregion
  1983. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isFlattenable.js
  1984. var spreadableSymbol = Symbol$1 ? Symbol$1.isConcatSpreadable : void 0;
  1985. function isFlattenable(value) {
  1986. return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]);
  1987. }
  1988. //#endregion
  1989. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseFlatten.js
  1990. function baseFlatten(array, depth, predicate, isStrict, result) {
  1991. var index = -1, length = array.length;
  1992. predicate || (predicate = isFlattenable);
  1993. result || (result = []);
  1994. while (++index < length) {
  1995. var value = array[index];
  1996. if (depth > 0 && predicate(value)) if (depth > 1) baseFlatten(value, depth - 1, predicate, isStrict, result);
  1997. else arrayPush(result, value);
  1998. else if (!isStrict) result[result.length] = value;
  1999. }
  2000. return result;
  2001. }
  2002. //#endregion
  2003. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/flatten.js
  2004. function flatten(array) {
  2005. return (array == null ? 0 : array.length) ? baseFlatten(array, 1) : [];
  2006. }
  2007. //#endregion
  2008. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_flatRest.js
  2009. function flatRest(func) {
  2010. return setToString(overRest(func, void 0, flatten), func + "");
  2011. }
  2012. //#endregion
  2013. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getPrototype.js
  2014. var getPrototype = overArg(Object.getPrototypeOf, Object);
  2015. //#endregion
  2016. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isPlainObject.js
  2017. var objectTag$3 = "[object Object]";
  2018. var funcProto = Function.prototype, objectProto = Object.prototype;
  2019. var funcToString = funcProto.toString;
  2020. var hasOwnProperty$4 = objectProto.hasOwnProperty;
  2021. var objectCtorString = funcToString.call(Object);
  2022. function isPlainObject(value) {
  2023. if (!isObjectLike(value) || baseGetTag(value) != objectTag$3) return false;
  2024. var proto = getPrototype(value);
  2025. if (proto === null) return true;
  2026. var Ctor = hasOwnProperty$4.call(proto, "constructor") && proto.constructor;
  2027. return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString;
  2028. }
  2029. //#endregion
  2030. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseSlice.js
  2031. function baseSlice(array, start, end) {
  2032. var index = -1, length = array.length;
  2033. if (start < 0) start = -start > length ? 0 : length + start;
  2034. end = end > length ? length : end;
  2035. if (end < 0) end += length;
  2036. length = start > end ? 0 : end - start >>> 0;
  2037. start >>>= 0;
  2038. var result = Array(length);
  2039. while (++index < length) result[index] = array[index + start];
  2040. return result;
  2041. }
  2042. //#endregion
  2043. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/castArray.js
  2044. function castArray$1() {
  2045. if (!arguments.length) return [];
  2046. var value = arguments[0];
  2047. return isArray(value) ? value : [value];
  2048. }
  2049. //#endregion
  2050. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseClamp.js
  2051. function baseClamp(number, lower, upper) {
  2052. if (number === number) {
  2053. if (upper !== void 0) number = number <= upper ? number : upper;
  2054. if (lower !== void 0) number = number >= lower ? number : lower;
  2055. }
  2056. return number;
  2057. }
  2058. //#endregion
  2059. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/clamp.js
  2060. function clamp$1(number, lower, upper) {
  2061. if (upper === void 0) {
  2062. upper = lower;
  2063. lower = void 0;
  2064. }
  2065. if (upper !== void 0) {
  2066. upper = toNumber(upper);
  2067. upper = upper === upper ? upper : 0;
  2068. }
  2069. if (lower !== void 0) {
  2070. lower = toNumber(lower);
  2071. lower = lower === lower ? lower : 0;
  2072. }
  2073. return baseClamp(toNumber(number), lower, upper);
  2074. }
  2075. //#endregion
  2076. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackClear.js
  2077. function stackClear() {
  2078. this.__data__ = new ListCache();
  2079. this.size = 0;
  2080. }
  2081. //#endregion
  2082. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackDelete.js
  2083. function stackDelete(key) {
  2084. var data = this.__data__, result = data["delete"](key);
  2085. this.size = data.size;
  2086. return result;
  2087. }
  2088. //#endregion
  2089. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackGet.js
  2090. function stackGet(key) {
  2091. return this.__data__.get(key);
  2092. }
  2093. //#endregion
  2094. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackHas.js
  2095. function stackHas(key) {
  2096. return this.__data__.has(key);
  2097. }
  2098. //#endregion
  2099. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_stackSet.js
  2100. var LARGE_ARRAY_SIZE$1 = 200;
  2101. function stackSet(key, value) {
  2102. var data = this.__data__;
  2103. if (data instanceof ListCache) {
  2104. var pairs = data.__data__;
  2105. if (!Map$1 || pairs.length < LARGE_ARRAY_SIZE$1 - 1) {
  2106. pairs.push([key, value]);
  2107. this.size = ++data.size;
  2108. return this;
  2109. }
  2110. data = this.__data__ = new MapCache(pairs);
  2111. }
  2112. data.set(key, value);
  2113. this.size = data.size;
  2114. return this;
  2115. }
  2116. //#endregion
  2117. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Stack.js
  2118. function Stack(entries) {
  2119. var data = this.__data__ = new ListCache(entries);
  2120. this.size = data.size;
  2121. }
  2122. Stack.prototype.clear = stackClear;
  2123. Stack.prototype["delete"] = stackDelete;
  2124. Stack.prototype.get = stackGet;
  2125. Stack.prototype.has = stackHas;
  2126. Stack.prototype.set = stackSet;
  2127. //#endregion
  2128. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssign.js
  2129. function baseAssign(object, source) {
  2130. return object && copyObject(source, keys(source), object);
  2131. }
  2132. //#endregion
  2133. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseAssignIn.js
  2134. function baseAssignIn(object, source) {
  2135. return object && copyObject(source, keysIn(source), object);
  2136. }
  2137. //#endregion
  2138. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneBuffer.js
  2139. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  2140. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  2141. var Buffer$1 = freeModule && freeModule.exports === freeExports ? root.Buffer : void 0, allocUnsafe = Buffer$1 ? Buffer$1.allocUnsafe : void 0;
  2142. function cloneBuffer(buffer, isDeep) {
  2143. if (isDeep) return buffer.slice();
  2144. var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
  2145. buffer.copy(result);
  2146. return result;
  2147. }
  2148. //#endregion
  2149. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayFilter.js
  2150. function arrayFilter(array, predicate) {
  2151. var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  2152. while (++index < length) {
  2153. var value = array[index];
  2154. if (predicate(value, index, array)) result[resIndex++] = value;
  2155. }
  2156. return result;
  2157. }
  2158. //#endregion
  2159. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/stubArray.js
  2160. function stubArray() {
  2161. return [];
  2162. }
  2163. //#endregion
  2164. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getSymbols.js
  2165. var propertyIsEnumerable = Object.prototype.propertyIsEnumerable;
  2166. var nativeGetSymbols = Object.getOwnPropertySymbols;
  2167. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  2168. if (object == null) return [];
  2169. object = Object(object);
  2170. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  2171. return propertyIsEnumerable.call(object, symbol);
  2172. });
  2173. };
  2174. //#endregion
  2175. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbols.js
  2176. function copySymbols(source, object) {
  2177. return copyObject(source, getSymbols(source), object);
  2178. }
  2179. //#endregion
  2180. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getSymbolsIn.js
  2181. var getSymbolsIn = !Object.getOwnPropertySymbols ? stubArray : function(object) {
  2182. var result = [];
  2183. while (object) {
  2184. arrayPush(result, getSymbols(object));
  2185. object = getPrototype(object);
  2186. }
  2187. return result;
  2188. };
  2189. //#endregion
  2190. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_copySymbolsIn.js
  2191. function copySymbolsIn(source, object) {
  2192. return copyObject(source, getSymbolsIn(source), object);
  2193. }
  2194. //#endregion
  2195. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseGetAllKeys.js
  2196. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  2197. var result = keysFunc(object);
  2198. return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
  2199. }
  2200. //#endregion
  2201. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeys.js
  2202. function getAllKeys(object) {
  2203. return baseGetAllKeys(object, keys, getSymbols);
  2204. }
  2205. //#endregion
  2206. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getAllKeysIn.js
  2207. function getAllKeysIn(object) {
  2208. return baseGetAllKeys(object, keysIn, getSymbolsIn);
  2209. }
  2210. //#endregion
  2211. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_DataView.js
  2212. var DataView = getNative(root, "DataView");
  2213. //#endregion
  2214. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Promise.js
  2215. var Promise$1 = getNative(root, "Promise");
  2216. //#endregion
  2217. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Set.js
  2218. var Set$1 = getNative(root, "Set");
  2219. //#endregion
  2220. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getTag.js
  2221. var mapTag$4 = "[object Map]", objectTag$2 = "[object Object]", promiseTag = "[object Promise]", setTag$4 = "[object Set]", weakMapTag$1 = "[object WeakMap]";
  2222. var dataViewTag$3 = "[object DataView]";
  2223. var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map$1), promiseCtorString = toSource(Promise$1), setCtorString = toSource(Set$1), weakMapCtorString = toSource(WeakMap$1);
  2224. var getTag = baseGetTag;
  2225. if (DataView && getTag(new DataView(/* @__PURE__ */ new ArrayBuffer(1))) != dataViewTag$3 || Map$1 && getTag(new Map$1()) != mapTag$4 || Promise$1 && getTag(Promise$1.resolve()) != promiseTag || Set$1 && getTag(new Set$1()) != setTag$4 || WeakMap$1 && getTag(new WeakMap$1()) != weakMapTag$1) getTag = function(value) {
  2226. var result = baseGetTag(value), Ctor = result == objectTag$2 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  2227. if (ctorString) switch (ctorString) {
  2228. case dataViewCtorString: return dataViewTag$3;
  2229. case mapCtorString: return mapTag$4;
  2230. case promiseCtorString: return promiseTag;
  2231. case setCtorString: return setTag$4;
  2232. case weakMapCtorString: return weakMapTag$1;
  2233. }
  2234. return result;
  2235. };
  2236. var _getTag_default = getTag;
  2237. //#endregion
  2238. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneArray.js
  2239. var hasOwnProperty$3 = Object.prototype.hasOwnProperty;
  2240. function initCloneArray(array) {
  2241. var length = array.length, result = new array.constructor(length);
  2242. if (length && typeof array[0] == "string" && hasOwnProperty$3.call(array, "index")) {
  2243. result.index = array.index;
  2244. result.input = array.input;
  2245. }
  2246. return result;
  2247. }
  2248. //#endregion
  2249. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_Uint8Array.js
  2250. var Uint8Array$1 = root.Uint8Array;
  2251. //#endregion
  2252. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneArrayBuffer.js
  2253. function cloneArrayBuffer(arrayBuffer) {
  2254. var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
  2255. new Uint8Array$1(result).set(new Uint8Array$1(arrayBuffer));
  2256. return result;
  2257. }
  2258. //#endregion
  2259. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneDataView.js
  2260. function cloneDataView(dataView, isDeep) {
  2261. var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;
  2262. return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);
  2263. }
  2264. //#endregion
  2265. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneRegExp.js
  2266. var reFlags = /\w*$/;
  2267. function cloneRegExp(regexp) {
  2268. var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
  2269. result.lastIndex = regexp.lastIndex;
  2270. return result;
  2271. }
  2272. //#endregion
  2273. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneSymbol.js
  2274. var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf$1 = symbolProto$1 ? symbolProto$1.valueOf : void 0;
  2275. function cloneSymbol(symbol) {
  2276. return symbolValueOf$1 ? Object(symbolValueOf$1.call(symbol)) : {};
  2277. }
  2278. //#endregion
  2279. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cloneTypedArray.js
  2280. function cloneTypedArray(typedArray, isDeep) {
  2281. var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
  2282. return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
  2283. }
  2284. //#endregion
  2285. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneByTag.js
  2286. var boolTag$2 = "[object Boolean]", dateTag$2 = "[object Date]", mapTag$3 = "[object Map]", numberTag$2 = "[object Number]", regexpTag$2 = "[object RegExp]", setTag$3 = "[object Set]", stringTag$2 = "[object String]", symbolTag$2 = "[object Symbol]";
  2287. var arrayBufferTag$2 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag$1 = "[object Float32Array]", float64Tag$1 = "[object Float64Array]", int8Tag$1 = "[object Int8Array]", int16Tag$1 = "[object Int16Array]", int32Tag$1 = "[object Int32Array]", uint8Tag$1 = "[object Uint8Array]", uint8ClampedTag$1 = "[object Uint8ClampedArray]", uint16Tag$1 = "[object Uint16Array]", uint32Tag$1 = "[object Uint32Array]";
  2288. function initCloneByTag(object, tag, isDeep) {
  2289. var Ctor = object.constructor;
  2290. switch (tag) {
  2291. case arrayBufferTag$2: return cloneArrayBuffer(object);
  2292. case boolTag$2:
  2293. case dateTag$2: return new Ctor(+object);
  2294. case dataViewTag$2: return cloneDataView(object, isDeep);
  2295. case float32Tag$1:
  2296. case float64Tag$1:
  2297. case int8Tag$1:
  2298. case int16Tag$1:
  2299. case int32Tag$1:
  2300. case uint8Tag$1:
  2301. case uint8ClampedTag$1:
  2302. case uint16Tag$1:
  2303. case uint32Tag$1: return cloneTypedArray(object, isDeep);
  2304. case mapTag$3: return new Ctor();
  2305. case numberTag$2:
  2306. case stringTag$2: return new Ctor(object);
  2307. case regexpTag$2: return cloneRegExp(object);
  2308. case setTag$3: return new Ctor();
  2309. case symbolTag$2: return cloneSymbol(object);
  2310. }
  2311. }
  2312. //#endregion
  2313. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_initCloneObject.js
  2314. function initCloneObject(object) {
  2315. return typeof object.constructor == "function" && !isPrototype(object) ? baseCreate(getPrototype(object)) : {};
  2316. }
  2317. //#endregion
  2318. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMap.js
  2319. var mapTag$2 = "[object Map]";
  2320. function baseIsMap(value) {
  2321. return isObjectLike(value) && _getTag_default(value) == mapTag$2;
  2322. }
  2323. //#endregion
  2324. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isMap.js
  2325. var nodeIsMap = nodeUtil && nodeUtil.isMap;
  2326. var isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;
  2327. //#endregion
  2328. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsSet.js
  2329. var setTag$2 = "[object Set]";
  2330. function baseIsSet(value) {
  2331. return isObjectLike(value) && _getTag_default(value) == setTag$2;
  2332. }
  2333. //#endregion
  2334. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isSet.js
  2335. var nodeIsSet = nodeUtil && nodeUtil.isSet;
  2336. var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
  2337. //#endregion
  2338. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseClone.js
  2339. var CLONE_DEEP_FLAG$2 = 1, CLONE_FLAT_FLAG$1 = 2, CLONE_SYMBOLS_FLAG$2 = 4;
  2340. var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", genTag = "[object GeneratorFunction]", mapTag$1 = "[object Map]", numberTag$1 = "[object Number]", objectTag$1 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$1 = "[object Set]", stringTag$1 = "[object String]", symbolTag$1 = "[object Symbol]", weakMapTag = "[object WeakMap]";
  2341. var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$1 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
  2342. var cloneableTags = {};
  2343. cloneableTags[argsTag$1] = cloneableTags[arrayTag$1] = cloneableTags[arrayBufferTag$1] = cloneableTags[dataViewTag$1] = cloneableTags[boolTag$1] = cloneableTags[dateTag$1] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag$1] = cloneableTags[numberTag$1] = cloneableTags[objectTag$1] = cloneableTags[regexpTag$1] = cloneableTags[setTag$1] = cloneableTags[stringTag$1] = cloneableTags[symbolTag$1] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;
  2344. cloneableTags[errorTag$1] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false;
  2345. function baseClone(value, bitmask, customizer, key, object, stack) {
  2346. var result, isDeep = bitmask & CLONE_DEEP_FLAG$2, isFlat = bitmask & CLONE_FLAT_FLAG$1, isFull = bitmask & CLONE_SYMBOLS_FLAG$2;
  2347. if (customizer) result = object ? customizer(value, key, object, stack) : customizer(value);
  2348. if (result !== void 0) return result;
  2349. if (!isObject(value)) return value;
  2350. var isArr = isArray(value);
  2351. if (isArr) {
  2352. result = initCloneArray(value);
  2353. if (!isDeep) return copyArray(value, result);
  2354. } else {
  2355. var tag = _getTag_default(value), isFunc = tag == funcTag || tag == genTag;
  2356. if (isBuffer(value)) return cloneBuffer(value, isDeep);
  2357. if (tag == objectTag$1 || tag == argsTag$1 || isFunc && !object) {
  2358. result = isFlat || isFunc ? {} : initCloneObject(value);
  2359. if (!isDeep) return isFlat ? copySymbolsIn(value, baseAssignIn(result, value)) : copySymbols(value, baseAssign(result, value));
  2360. } else {
  2361. if (!cloneableTags[tag]) return object ? value : {};
  2362. result = initCloneByTag(value, tag, isDeep);
  2363. }
  2364. }
  2365. stack || (stack = new Stack());
  2366. var stacked = stack.get(value);
  2367. if (stacked) return stacked;
  2368. stack.set(value, result);
  2369. if (isSet(value)) value.forEach(function(subValue) {
  2370. result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));
  2371. });
  2372. else if (isMap(value)) value.forEach(function(subValue, key) {
  2373. result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));
  2374. });
  2375. var props = isArr ? void 0 : (isFull ? isFlat ? getAllKeysIn : getAllKeys : isFlat ? keysIn : keys)(value);
  2376. arrayEach(props || value, function(subValue, key) {
  2377. if (props) {
  2378. key = subValue;
  2379. subValue = value[key];
  2380. }
  2381. assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));
  2382. });
  2383. return result;
  2384. }
  2385. //#endregion
  2386. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/cloneDeep.js
  2387. var CLONE_DEEP_FLAG$1 = 1, CLONE_SYMBOLS_FLAG$1 = 4;
  2388. function cloneDeep(value) {
  2389. return baseClone(value, CLONE_DEEP_FLAG$1 | CLONE_SYMBOLS_FLAG$1);
  2390. }
  2391. //#endregion
  2392. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setCacheAdd.js
  2393. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  2394. function setCacheAdd(value) {
  2395. this.__data__.set(value, HASH_UNDEFINED);
  2396. return this;
  2397. }
  2398. //#endregion
  2399. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setCacheHas.js
  2400. function setCacheHas(value) {
  2401. return this.__data__.has(value);
  2402. }
  2403. //#endregion
  2404. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_SetCache.js
  2405. function SetCache(values) {
  2406. var index = -1, length = values == null ? 0 : values.length;
  2407. this.__data__ = new MapCache();
  2408. while (++index < length) this.add(values[index]);
  2409. }
  2410. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  2411. SetCache.prototype.has = setCacheHas;
  2412. //#endregion
  2413. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arraySome.js
  2414. function arraySome(array, predicate) {
  2415. var index = -1, length = array == null ? 0 : array.length;
  2416. while (++index < length) if (predicate(array[index], index, array)) return true;
  2417. return false;
  2418. }
  2419. //#endregion
  2420. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_cacheHas.js
  2421. function cacheHas(cache, key) {
  2422. return cache.has(key);
  2423. }
  2424. //#endregion
  2425. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalArrays.js
  2426. var COMPARE_PARTIAL_FLAG$5 = 1, COMPARE_UNORDERED_FLAG$3 = 2;
  2427. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  2428. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5, arrLength = array.length, othLength = other.length;
  2429. if (arrLength != othLength && !(isPartial && othLength > arrLength)) return false;
  2430. var arrStacked = stack.get(array);
  2431. var othStacked = stack.get(other);
  2432. if (arrStacked && othStacked) return arrStacked == other && othStacked == array;
  2433. var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$3 ? new SetCache() : void 0;
  2434. stack.set(array, other);
  2435. stack.set(other, array);
  2436. while (++index < arrLength) {
  2437. var arrValue = array[index], othValue = other[index];
  2438. if (customizer) var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
  2439. if (compared !== void 0) {
  2440. if (compared) continue;
  2441. result = false;
  2442. break;
  2443. }
  2444. if (seen) {
  2445. if (!arraySome(other, function(othValue, othIndex) {
  2446. if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) return seen.push(othIndex);
  2447. })) {
  2448. result = false;
  2449. break;
  2450. }
  2451. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  2452. result = false;
  2453. break;
  2454. }
  2455. }
  2456. stack["delete"](array);
  2457. stack["delete"](other);
  2458. return result;
  2459. }
  2460. //#endregion
  2461. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_mapToArray.js
  2462. function mapToArray(map) {
  2463. var index = -1, result = Array(map.size);
  2464. map.forEach(function(value, key) {
  2465. result[++index] = [key, value];
  2466. });
  2467. return result;
  2468. }
  2469. //#endregion
  2470. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_setToArray.js
  2471. function setToArray(set) {
  2472. var index = -1, result = Array(set.size);
  2473. set.forEach(function(value) {
  2474. result[++index] = value;
  2475. });
  2476. return result;
  2477. }
  2478. //#endregion
  2479. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalByTag.js
  2480. var COMPARE_PARTIAL_FLAG$4 = 1, COMPARE_UNORDERED_FLAG$2 = 2;
  2481. var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
  2482. var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
  2483. var symbolProto = Symbol$1 ? Symbol$1.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  2484. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  2485. switch (tag) {
  2486. case dataViewTag:
  2487. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) return false;
  2488. object = object.buffer;
  2489. other = other.buffer;
  2490. case arrayBufferTag:
  2491. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$1(object), new Uint8Array$1(other))) return false;
  2492. return true;
  2493. case boolTag:
  2494. case dateTag:
  2495. case numberTag: return eq(+object, +other);
  2496. case errorTag: return object.name == other.name && object.message == other.message;
  2497. case regexpTag:
  2498. case stringTag: return object == other + "";
  2499. case mapTag: var convert = mapToArray;
  2500. case setTag:
  2501. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
  2502. convert || (convert = setToArray);
  2503. if (object.size != other.size && !isPartial) return false;
  2504. var stacked = stack.get(object);
  2505. if (stacked) return stacked == other;
  2506. bitmask |= COMPARE_UNORDERED_FLAG$2;
  2507. stack.set(object, other);
  2508. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  2509. stack["delete"](object);
  2510. return result;
  2511. case symbolTag: if (symbolValueOf) return symbolValueOf.call(object) == symbolValueOf.call(other);
  2512. }
  2513. return false;
  2514. }
  2515. //#endregion
  2516. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_equalObjects.js
  2517. var COMPARE_PARTIAL_FLAG$3 = 1;
  2518. var hasOwnProperty$2 = Object.prototype.hasOwnProperty;
  2519. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  2520. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, objProps = getAllKeys(object), objLength = objProps.length;
  2521. if (objLength != getAllKeys(other).length && !isPartial) return false;
  2522. var index = objLength;
  2523. while (index--) {
  2524. var key = objProps[index];
  2525. if (!(isPartial ? key in other : hasOwnProperty$2.call(other, key))) return false;
  2526. }
  2527. var objStacked = stack.get(object);
  2528. var othStacked = stack.get(other);
  2529. if (objStacked && othStacked) return objStacked == other && othStacked == object;
  2530. var result = true;
  2531. stack.set(object, other);
  2532. stack.set(other, object);
  2533. var skipCtor = isPartial;
  2534. while (++index < objLength) {
  2535. key = objProps[index];
  2536. var objValue = object[key], othValue = other[key];
  2537. if (customizer) var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  2538. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  2539. result = false;
  2540. break;
  2541. }
  2542. skipCtor || (skipCtor = key == "constructor");
  2543. }
  2544. if (result && !skipCtor) {
  2545. var objCtor = object.constructor, othCtor = other.constructor;
  2546. if (objCtor != othCtor && "constructor" in object && "constructor" in other && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) result = false;
  2547. }
  2548. stack["delete"](object);
  2549. stack["delete"](other);
  2550. return result;
  2551. }
  2552. //#endregion
  2553. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqualDeep.js
  2554. var COMPARE_PARTIAL_FLAG$2 = 1;
  2555. var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
  2556. var hasOwnProperty$1 = Object.prototype.hasOwnProperty;
  2557. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  2558. var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : _getTag_default(object), othTag = othIsArr ? arrayTag : _getTag_default(other);
  2559. objTag = objTag == argsTag ? objectTag : objTag;
  2560. othTag = othTag == argsTag ? objectTag : othTag;
  2561. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  2562. if (isSameTag && isBuffer(object)) {
  2563. if (!isBuffer(other)) return false;
  2564. objIsArr = true;
  2565. objIsObj = false;
  2566. }
  2567. if (isSameTag && !objIsObj) {
  2568. stack || (stack = new Stack());
  2569. return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  2570. }
  2571. if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
  2572. var objIsWrapped = objIsObj && hasOwnProperty$1.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$1.call(other, "__wrapped__");
  2573. if (objIsWrapped || othIsWrapped) {
  2574. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  2575. stack || (stack = new Stack());
  2576. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  2577. }
  2578. }
  2579. if (!isSameTag) return false;
  2580. stack || (stack = new Stack());
  2581. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  2582. }
  2583. //#endregion
  2584. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsEqual.js
  2585. function baseIsEqual(value, other, bitmask, customizer, stack) {
  2586. if (value === other) return true;
  2587. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) return value !== value && other !== other;
  2588. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  2589. }
  2590. //#endregion
  2591. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIsMatch.js
  2592. var COMPARE_PARTIAL_FLAG$1 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
  2593. function baseIsMatch(object, source, matchData, customizer) {
  2594. var index = matchData.length, length = index, noCustomizer = !customizer;
  2595. if (object == null) return !length;
  2596. object = Object(object);
  2597. while (index--) {
  2598. var data = matchData[index];
  2599. if (noCustomizer && data[2] ? data[1] !== object[data[0]] : !(data[0] in object)) return false;
  2600. }
  2601. while (++index < length) {
  2602. data = matchData[index];
  2603. var key = data[0], objValue = object[key], srcValue = data[1];
  2604. if (noCustomizer && data[2]) {
  2605. if (objValue === void 0 && !(key in object)) return false;
  2606. } else {
  2607. var stack = new Stack();
  2608. if (customizer) var result = customizer(objValue, srcValue, key, object, source, stack);
  2609. if (!(result === void 0 ? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack) : result)) return false;
  2610. }
  2611. }
  2612. return true;
  2613. }
  2614. //#endregion
  2615. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_isStrictComparable.js
  2616. function isStrictComparable(value) {
  2617. return value === value && !isObject(value);
  2618. }
  2619. //#endregion
  2620. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_getMatchData.js
  2621. function getMatchData(object) {
  2622. var result = keys(object), length = result.length;
  2623. while (length--) {
  2624. var key = result[length], value = object[key];
  2625. result[length] = [
  2626. key,
  2627. value,
  2628. isStrictComparable(value)
  2629. ];
  2630. }
  2631. return result;
  2632. }
  2633. //#endregion
  2634. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_matchesStrictComparable.js
  2635. function matchesStrictComparable(key, srcValue) {
  2636. return function(object) {
  2637. if (object == null) return false;
  2638. return object[key] === srcValue && (srcValue !== void 0 || key in Object(object));
  2639. };
  2640. }
  2641. //#endregion
  2642. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMatches.js
  2643. function baseMatches(source) {
  2644. var matchData = getMatchData(source);
  2645. if (matchData.length == 1 && matchData[0][2]) return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  2646. return function(object) {
  2647. return object === source || baseIsMatch(object, source, matchData);
  2648. };
  2649. }
  2650. //#endregion
  2651. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseHasIn.js
  2652. function baseHasIn(object, key) {
  2653. return object != null && key in Object(object);
  2654. }
  2655. //#endregion
  2656. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_hasPath.js
  2657. function hasPath(object, path, hasFunc) {
  2658. path = castPath(path, object);
  2659. var index = -1, length = path.length, result = false;
  2660. while (++index < length) {
  2661. var key = toKey(path[index]);
  2662. if (!(result = object != null && hasFunc(object, key))) break;
  2663. object = object[key];
  2664. }
  2665. if (result || ++index != length) return result;
  2666. length = object == null ? 0 : object.length;
  2667. return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
  2668. }
  2669. //#endregion
  2670. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/hasIn.js
  2671. function hasIn(object, path) {
  2672. return object != null && hasPath(object, path, baseHasIn);
  2673. }
  2674. //#endregion
  2675. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMatchesProperty.js
  2676. var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2;
  2677. function baseMatchesProperty(path, srcValue) {
  2678. if (isKey(path) && isStrictComparable(srcValue)) return matchesStrictComparable(toKey(path), srcValue);
  2679. return function(object) {
  2680. var objValue = get(object, path);
  2681. return objValue === void 0 && objValue === srcValue ? hasIn(object, path) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
  2682. };
  2683. }
  2684. //#endregion
  2685. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseProperty.js
  2686. function baseProperty(key) {
  2687. return function(object) {
  2688. return object == null ? void 0 : object[key];
  2689. };
  2690. }
  2691. //#endregion
  2692. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_basePropertyDeep.js
  2693. function basePropertyDeep(path) {
  2694. return function(object) {
  2695. return baseGet(object, path);
  2696. };
  2697. }
  2698. //#endregion
  2699. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/property.js
  2700. function property(path) {
  2701. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  2702. }
  2703. //#endregion
  2704. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseIteratee.js
  2705. function baseIteratee(value) {
  2706. if (typeof value == "function") return value;
  2707. if (value == null) return identity;
  2708. if (typeof value == "object") return isArray(value) ? baseMatchesProperty(value[0], value[1]) : baseMatches(value);
  2709. return property(value);
  2710. }
  2711. //#endregion
  2712. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createBaseFor.js
  2713. function createBaseFor(fromRight) {
  2714. return function(object, iteratee, keysFunc) {
  2715. var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length;
  2716. while (length--) {
  2717. var key = props[fromRight ? length : ++index];
  2718. if (iteratee(iterable[key], key, iterable) === false) break;
  2719. }
  2720. return object;
  2721. };
  2722. }
  2723. //#endregion
  2724. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseFor.js
  2725. var baseFor = createBaseFor();
  2726. //#endregion
  2727. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseForOwn.js
  2728. function baseForOwn(object, iteratee) {
  2729. return object && baseFor(object, iteratee, keys);
  2730. }
  2731. //#endregion
  2732. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createBaseEach.js
  2733. function createBaseEach(eachFunc, fromRight) {
  2734. return function(collection, iteratee) {
  2735. if (collection == null) return collection;
  2736. if (!isArrayLike(collection)) return eachFunc(collection, iteratee);
  2737. var length = collection.length, index = fromRight ? length : -1, iterable = Object(collection);
  2738. while (fromRight ? index-- : ++index < length) if (iteratee(iterable[index], index, iterable) === false) break;
  2739. return collection;
  2740. };
  2741. }
  2742. //#endregion
  2743. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseEach.js
  2744. var baseEach = createBaseEach(baseForOwn);
  2745. //#endregion
  2746. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/now.js
  2747. var now = function() {
  2748. return root.Date.now();
  2749. };
  2750. //#endregion
  2751. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/debounce.js
  2752. var FUNC_ERROR_TEXT$1 = "Expected a function";
  2753. var nativeMax$1 = Math.max, nativeMin$1 = Math.min;
  2754. function debounce(func, wait, options) {
  2755. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  2756. if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT$1);
  2757. wait = toNumber(wait) || 0;
  2758. if (isObject(options)) {
  2759. leading = !!options.leading;
  2760. maxing = "maxWait" in options;
  2761. maxWait = maxing ? nativeMax$1(toNumber(options.maxWait) || 0, wait) : maxWait;
  2762. trailing = "trailing" in options ? !!options.trailing : trailing;
  2763. }
  2764. function invokeFunc(time) {
  2765. var args = lastArgs, thisArg = lastThis;
  2766. lastArgs = lastThis = void 0;
  2767. lastInvokeTime = time;
  2768. result = func.apply(thisArg, args);
  2769. return result;
  2770. }
  2771. function leadingEdge(time) {
  2772. lastInvokeTime = time;
  2773. timerId = setTimeout(timerExpired, wait);
  2774. return leading ? invokeFunc(time) : result;
  2775. }
  2776. function remainingWait(time) {
  2777. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  2778. return maxing ? nativeMin$1(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  2779. }
  2780. function shouldInvoke(time) {
  2781. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  2782. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  2783. }
  2784. function timerExpired() {
  2785. var time = now();
  2786. if (shouldInvoke(time)) return trailingEdge(time);
  2787. timerId = setTimeout(timerExpired, remainingWait(time));
  2788. }
  2789. function trailingEdge(time) {
  2790. timerId = void 0;
  2791. if (trailing && lastArgs) return invokeFunc(time);
  2792. lastArgs = lastThis = void 0;
  2793. return result;
  2794. }
  2795. function cancel() {
  2796. if (timerId !== void 0) clearTimeout(timerId);
  2797. lastInvokeTime = 0;
  2798. lastArgs = lastCallTime = lastThis = timerId = void 0;
  2799. }
  2800. function flush() {
  2801. return timerId === void 0 ? result : trailingEdge(now());
  2802. }
  2803. function debounced() {
  2804. var time = now(), isInvoking = shouldInvoke(time);
  2805. lastArgs = arguments;
  2806. lastThis = this;
  2807. lastCallTime = time;
  2808. if (isInvoking) {
  2809. if (timerId === void 0) return leadingEdge(lastCallTime);
  2810. if (maxing) {
  2811. clearTimeout(timerId);
  2812. timerId = setTimeout(timerExpired, wait);
  2813. return invokeFunc(lastCallTime);
  2814. }
  2815. }
  2816. if (timerId === void 0) timerId = setTimeout(timerExpired, wait);
  2817. return result;
  2818. }
  2819. debounced.cancel = cancel;
  2820. debounced.flush = flush;
  2821. return debounced;
  2822. }
  2823. //#endregion
  2824. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_assignMergeValue.js
  2825. function assignMergeValue(object, key, value) {
  2826. if (value !== void 0 && !eq(object[key], value) || value === void 0 && !(key in object)) baseAssignValue(object, key, value);
  2827. }
  2828. //#endregion
  2829. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isArrayLikeObject.js
  2830. function isArrayLikeObject(value) {
  2831. return isObjectLike(value) && isArrayLike(value);
  2832. }
  2833. //#endregion
  2834. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_safeGet.js
  2835. function safeGet(object, key) {
  2836. if (key === "constructor" && typeof object[key] === "function") return;
  2837. if (key == "__proto__") return;
  2838. return object[key];
  2839. }
  2840. //#endregion
  2841. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toPlainObject.js
  2842. function toPlainObject(value) {
  2843. return copyObject(value, keysIn(value));
  2844. }
  2845. //#endregion
  2846. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMergeDeep.js
  2847. function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
  2848. var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
  2849. if (stacked) {
  2850. assignMergeValue(object, key, stacked);
  2851. return;
  2852. }
  2853. var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
  2854. var isCommon = newValue === void 0;
  2855. if (isCommon) {
  2856. var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue);
  2857. newValue = srcValue;
  2858. if (isArr || isBuff || isTyped) if (isArray(objValue)) newValue = objValue;
  2859. else if (isArrayLikeObject(objValue)) newValue = copyArray(objValue);
  2860. else if (isBuff) {
  2861. isCommon = false;
  2862. newValue = cloneBuffer(srcValue, true);
  2863. } else if (isTyped) {
  2864. isCommon = false;
  2865. newValue = cloneTypedArray(srcValue, true);
  2866. } else newValue = [];
  2867. else if (isPlainObject(srcValue) || isArguments(srcValue)) {
  2868. newValue = objValue;
  2869. if (isArguments(objValue)) newValue = toPlainObject(objValue);
  2870. else if (!isObject(objValue) || isFunction(objValue)) newValue = initCloneObject(srcValue);
  2871. } else isCommon = false;
  2872. }
  2873. if (isCommon) {
  2874. stack.set(srcValue, newValue);
  2875. mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
  2876. stack["delete"](srcValue);
  2877. }
  2878. assignMergeValue(object, key, newValue);
  2879. }
  2880. //#endregion
  2881. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMerge.js
  2882. function baseMerge(object, source, srcIndex, customizer, stack) {
  2883. if (object === source) return;
  2884. baseFor(source, function(srcValue, key) {
  2885. stack || (stack = new Stack());
  2886. if (isObject(srcValue)) baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
  2887. else {
  2888. var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
  2889. if (newValue === void 0) newValue = srcValue;
  2890. assignMergeValue(object, key, newValue);
  2891. }
  2892. }, keysIn);
  2893. }
  2894. //#endregion
  2895. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_arrayIncludesWith.js
  2896. function arrayIncludesWith(array, value, comparator) {
  2897. var index = -1, length = array == null ? 0 : array.length;
  2898. while (++index < length) if (comparator(value, array[index])) return true;
  2899. return false;
  2900. }
  2901. //#endregion
  2902. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/last.js
  2903. function last(array) {
  2904. var length = array == null ? 0 : array.length;
  2905. return length ? array[length - 1] : void 0;
  2906. }
  2907. //#endregion
  2908. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/findLastIndex.js
  2909. var nativeMax = Math.max, nativeMin = Math.min;
  2910. function findLastIndex(array, predicate, fromIndex) {
  2911. var length = array == null ? 0 : array.length;
  2912. if (!length) return -1;
  2913. var index = length - 1;
  2914. if (fromIndex !== void 0) {
  2915. index = toInteger(fromIndex);
  2916. index = fromIndex < 0 ? nativeMax(length + index, 0) : nativeMin(index, length - 1);
  2917. }
  2918. return baseFindIndex(array, baseIteratee(predicate, 3), index, true);
  2919. }
  2920. //#endregion
  2921. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseMap.js
  2922. function baseMap(collection, iteratee) {
  2923. var index = -1, result = isArrayLike(collection) ? Array(collection.length) : [];
  2924. baseEach(collection, function(value, key, collection) {
  2925. result[++index] = iteratee(value, key, collection);
  2926. });
  2927. return result;
  2928. }
  2929. //#endregion
  2930. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/map.js
  2931. function map(collection, iteratee) {
  2932. return (isArray(collection) ? arrayMap : baseMap)(collection, baseIteratee(iteratee, 3));
  2933. }
  2934. //#endregion
  2935. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/flatMap.js
  2936. function flatMap(collection, iteratee) {
  2937. return baseFlatten(map(collection, iteratee), 1);
  2938. }
  2939. //#endregion
  2940. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/flattenDeep.js
  2941. var INFINITY = Infinity;
  2942. function flattenDeep(array) {
  2943. return (array == null ? 0 : array.length) ? baseFlatten(array, INFINITY) : [];
  2944. }
  2945. //#endregion
  2946. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/fromPairs.js
  2947. function fromPairs(pairs) {
  2948. var index = -1, length = pairs == null ? 0 : pairs.length, result = {};
  2949. while (++index < length) {
  2950. var pair = pairs[index];
  2951. baseAssignValue(result, pair[0], pair[1]);
  2952. }
  2953. return result;
  2954. }
  2955. //#endregion
  2956. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_parent.js
  2957. function parent(object, path) {
  2958. return path.length < 2 ? object : baseGet(object, baseSlice(path, 0, -1));
  2959. }
  2960. //#endregion
  2961. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isEqual.js
  2962. function isEqual$1(value, other) {
  2963. return baseIsEqual(value, other);
  2964. }
  2965. //#endregion
  2966. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isNil.js
  2967. function isNil(value) {
  2968. return value == null;
  2969. }
  2970. //#endregion
  2971. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isNull.js
  2972. function isNull(value) {
  2973. return value === null;
  2974. }
  2975. //#endregion
  2976. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isUndefined.js
  2977. function isUndefined$1(value) {
  2978. return value === void 0;
  2979. }
  2980. //#endregion
  2981. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/merge.js
  2982. var merge = createAssigner(function(object, source, srcIndex) {
  2983. baseMerge(object, source, srcIndex);
  2984. });
  2985. //#endregion
  2986. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseUnset.js
  2987. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2988. function baseUnset(object, path) {
  2989. path = castPath(path, object);
  2990. var index = -1, length = path.length;
  2991. if (!length) return true;
  2992. while (++index < length) {
  2993. var key = toKey(path[index]);
  2994. if (key === "__proto__" && !hasOwnProperty.call(object, "__proto__")) return false;
  2995. if ((key === "constructor" || key === "prototype") && index < length - 1) return false;
  2996. }
  2997. var obj = parent(object, path);
  2998. return obj == null || delete obj[toKey(last(path))];
  2999. }
  3000. //#endregion
  3001. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_customOmitClone.js
  3002. function customOmitClone(value) {
  3003. return isPlainObject(value) ? void 0 : value;
  3004. }
  3005. //#endregion
  3006. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/omit.js
  3007. var CLONE_DEEP_FLAG = 1, CLONE_FLAT_FLAG = 2, CLONE_SYMBOLS_FLAG = 4;
  3008. var omit = flatRest(function(object, paths) {
  3009. var result = {};
  3010. if (object == null) return result;
  3011. var isDeep = false;
  3012. paths = arrayMap(paths, function(path) {
  3013. path = castPath(path, object);
  3014. isDeep || (isDeep = path.length > 1);
  3015. return path;
  3016. });
  3017. copyObject(object, getAllKeysIn(object), result);
  3018. if (isDeep) result = baseClone(result, CLONE_DEEP_FLAG | CLONE_FLAT_FLAG | CLONE_SYMBOLS_FLAG, customOmitClone);
  3019. var length = paths.length;
  3020. while (length--) baseUnset(result, paths[length]);
  3021. return result;
  3022. });
  3023. //#endregion
  3024. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseSet.js
  3025. function baseSet(object, path, value, customizer) {
  3026. if (!isObject(object)) return object;
  3027. path = castPath(path, object);
  3028. var index = -1, length = path.length, lastIndex = length - 1, nested = object;
  3029. while (nested != null && ++index < length) {
  3030. var key = toKey(path[index]), newValue = value;
  3031. if (key === "__proto__" || key === "constructor" || key === "prototype") return object;
  3032. if (index != lastIndex) {
  3033. var objValue = nested[key];
  3034. newValue = customizer ? customizer(objValue, key, nested) : void 0;
  3035. if (newValue === void 0) newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
  3036. }
  3037. assignValue(nested, key, newValue);
  3038. nested = nested[key];
  3039. }
  3040. return object;
  3041. }
  3042. //#endregion
  3043. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_basePickBy.js
  3044. function basePickBy(object, paths, predicate) {
  3045. var index = -1, length = paths.length, result = {};
  3046. while (++index < length) {
  3047. var path = paths[index], value = baseGet(object, path);
  3048. if (predicate(value, path)) baseSet(result, castPath(path, object), value);
  3049. }
  3050. return result;
  3051. }
  3052. //#endregion
  3053. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_basePick.js
  3054. function basePick(object, paths) {
  3055. return basePickBy(object, paths, function(value, path) {
  3056. return hasIn(object, path);
  3057. });
  3058. }
  3059. //#endregion
  3060. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/pick.js
  3061. var pick = flatRest(function(object, paths) {
  3062. return object == null ? {} : basePick(object, paths);
  3063. });
  3064. //#endregion
  3065. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/set.js
  3066. function set(object, path, value) {
  3067. return object == null ? object : baseSet(object, path, value);
  3068. }
  3069. //#endregion
  3070. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/throttle.js
  3071. var FUNC_ERROR_TEXT = "Expected a function";
  3072. function throttle(func, wait, options) {
  3073. var leading = true, trailing = true;
  3074. if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
  3075. if (isObject(options)) {
  3076. leading = "leading" in options ? !!options.leading : leading;
  3077. trailing = "trailing" in options ? !!options.trailing : trailing;
  3078. }
  3079. return debounce(func, wait, {
  3080. "leading": leading,
  3081. "maxWait": wait,
  3082. "trailing": trailing
  3083. });
  3084. }
  3085. //#endregion
  3086. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_createSet.js
  3087. var createSet = !(Set$1 && 1 / setToArray(new Set$1([, -0]))[1] == Infinity) ? noop : function(values) {
  3088. return new Set$1(values);
  3089. };
  3090. //#endregion
  3091. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseUniq.js
  3092. var LARGE_ARRAY_SIZE = 200;
  3093. function baseUniq(array, iteratee, comparator) {
  3094. var index = -1, includes = arrayIncludes, length = array.length, isCommon = true, result = [], seen = result;
  3095. if (comparator) {
  3096. isCommon = false;
  3097. includes = arrayIncludesWith;
  3098. } else if (length >= LARGE_ARRAY_SIZE) {
  3099. var set = iteratee ? null : createSet(array);
  3100. if (set) return setToArray(set);
  3101. isCommon = false;
  3102. includes = cacheHas;
  3103. seen = new SetCache();
  3104. } else seen = iteratee ? [] : result;
  3105. outer: while (++index < length) {
  3106. var value = array[index], computed = iteratee ? iteratee(value) : value;
  3107. value = comparator || value !== 0 ? value : 0;
  3108. if (isCommon && computed === computed) {
  3109. var seenIndex = seen.length;
  3110. while (seenIndex--) if (seen[seenIndex] === computed) continue outer;
  3111. if (iteratee) seen.push(computed);
  3112. result.push(value);
  3113. } else if (!includes(seen, computed, comparator)) {
  3114. if (seen !== result) seen.push(computed);
  3115. result.push(value);
  3116. }
  3117. }
  3118. return result;
  3119. }
  3120. //#endregion
  3121. //#region ../../node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/union.js
  3122. var union = baseRest(function(arrays) {
  3123. return baseUniq(baseFlatten(arrays, 1, isArrayLikeObject, true));
  3124. });
  3125. //#endregion
  3126. //#region ../../packages/utils/types.ts
  3127. const isUndefined = (val) => val === void 0;
  3128. const isBoolean = (val) => typeof val === "boolean";
  3129. const isNumber = (val) => typeof val === "number";
  3130. const isEmpty = (val) => !val && val !== 0 || isArray$1(val) && val.length === 0 || isObject$1(val) && !Object.keys(val).length;
  3131. const isElement$1 = (e) => {
  3132. if (typeof Element === "undefined") return false;
  3133. return e instanceof Element;
  3134. };
  3135. const isPropAbsent = (prop) => isNil(prop);
  3136. const isStringNumber = (val) => {
  3137. if (!isString(val)) return false;
  3138. return !Number.isNaN(Number(val));
  3139. };
  3140. const isWindow = (val) => val === window;
  3141. //#endregion
  3142. //#region ../../packages/utils/raf.ts
  3143. const rAF = (fn) => isClient ? window.requestAnimationFrame(fn) : setTimeout(fn, 16);
  3144. const cAF = (handle) => isClient ? window.cancelAnimationFrame(handle) : clearTimeout(handle);
  3145. //#endregion
  3146. //#region ../../packages/utils/strings.ts
  3147. const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  3148. const capitalize = (str) => capitalize$1(str);
  3149. //#endregion
  3150. //#region ../../packages/utils/objects.ts
  3151. const keysOf = (arr) => Object.keys(arr);
  3152. const entriesOf = (arr) => Object.entries(arr);
  3153. const getProp = (obj, path, defaultValue) => {
  3154. return {
  3155. get value() {
  3156. return get(obj, path, defaultValue);
  3157. },
  3158. set value(val) {
  3159. set(obj, path, val);
  3160. }
  3161. };
  3162. };
  3163. //#endregion
  3164. //#region ../../packages/utils/error.ts
  3165. var ElementPlusError = class extends Error {
  3166. constructor(m) {
  3167. super(m);
  3168. this.name = "ElementPlusError";
  3169. }
  3170. };
  3171. function throwError(scope, m) {
  3172. throw new ElementPlusError(`[${scope}] ${m}`);
  3173. }
  3174. function debugWarn(scope, message) {}
  3175. //#endregion
  3176. //#region ../../packages/utils/dom/style.ts
  3177. const SCOPE$9 = "utils/dom/style";
  3178. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  3179. const hasClass = (el, cls) => {
  3180. if (!el || !cls) return false;
  3181. if (cls.includes(" ")) throw new Error("className should not contain space.");
  3182. return el.classList.contains(cls);
  3183. };
  3184. const addClass = (el, cls) => {
  3185. if (!el || !cls.trim()) return;
  3186. el.classList.add(...classNameToArray(cls));
  3187. };
  3188. const removeClass = (el, cls) => {
  3189. if (!el || !cls.trim()) return;
  3190. el.classList.remove(...classNameToArray(cls));
  3191. };
  3192. const getStyle = (element, styleName) => {
  3193. if (!isClient || !element || !styleName || isShadowRoot$1(element)) return "";
  3194. let key = camelize(styleName);
  3195. if (key === "float") key = "cssFloat";
  3196. try {
  3197. const style = element.style[key];
  3198. if (style) return style;
  3199. const computed = document.defaultView?.getComputedStyle(element, "");
  3200. return computed ? computed[key] : "";
  3201. } catch {
  3202. return element.style[key];
  3203. }
  3204. };
  3205. const setStyle = (element, styleName, value) => {
  3206. if (!element || !styleName) return;
  3207. if (isObject$1(styleName)) entriesOf(styleName).forEach(([prop, value]) => setStyle(element, prop, value));
  3208. else {
  3209. const key = camelize(styleName);
  3210. element.style[key] = value;
  3211. }
  3212. };
  3213. function addUnit(value, defaultUnit = "px") {
  3214. if (!value && value !== 0) return "";
  3215. if (isNumber(value) || isStringNumber(value)) return `${value}${defaultUnit}`;
  3216. else if (isString(value)) return value;
  3217. /* @__PURE__ */ debugWarn(SCOPE$9, "binding value must be a string or number");
  3218. }
  3219. //#endregion
  3220. //#region ../../packages/utils/dom/scroll.ts
  3221. const isScroll = (el, isVertical) => {
  3222. if (!isClient) return false;
  3223. const key = {
  3224. undefined: "overflow",
  3225. true: "overflow-y",
  3226. false: "overflow-x"
  3227. }[String(isVertical)];
  3228. const overflow = getStyle(el, key);
  3229. return [
  3230. "scroll",
  3231. "auto",
  3232. "overlay"
  3233. ].some((s) => overflow.includes(s));
  3234. };
  3235. const getScrollContainer = (el, isVertical) => {
  3236. if (!isClient) return;
  3237. let parent = el;
  3238. while (parent) {
  3239. if ([
  3240. window,
  3241. document,
  3242. document.documentElement
  3243. ].includes(parent)) return window;
  3244. if (isScroll(parent, isVertical)) return parent;
  3245. if (isShadowRoot$1(parent)) parent = parent.host;
  3246. else parent = parent.parentNode;
  3247. }
  3248. return parent;
  3249. };
  3250. let scrollBarWidth;
  3251. const getScrollBarWidth = (namespace) => {
  3252. if (!isClient) return 0;
  3253. if (scrollBarWidth !== void 0) return scrollBarWidth;
  3254. const outer = document.createElement("div");
  3255. outer.className = `${namespace}-scrollbar__wrap`;
  3256. outer.style.visibility = "hidden";
  3257. outer.style.width = "100px";
  3258. outer.style.position = "absolute";
  3259. outer.style.top = "-9999px";
  3260. document.body.appendChild(outer);
  3261. const widthNoScroll = outer.offsetWidth;
  3262. outer.style.overflow = "scroll";
  3263. const inner = document.createElement("div");
  3264. inner.style.width = "100%";
  3265. outer.appendChild(inner);
  3266. const widthWithScroll = inner.offsetWidth;
  3267. outer.parentNode?.removeChild(outer);
  3268. scrollBarWidth = widthNoScroll - widthWithScroll;
  3269. return scrollBarWidth;
  3270. };
  3271. function scrollIntoView(container, selected) {
  3272. if (!isClient) return;
  3273. if (!selected) {
  3274. container.scrollTop = 0;
  3275. return;
  3276. }
  3277. const offsetParents = [];
  3278. let pointer = selected.offsetParent;
  3279. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  3280. offsetParents.push(pointer);
  3281. pointer = pointer.offsetParent;
  3282. }
  3283. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  3284. const bottom = top + selected.offsetHeight;
  3285. const viewRectTop = container.scrollTop;
  3286. const viewRectBottom = viewRectTop + container.clientHeight;
  3287. if (top < viewRectTop) container.scrollTop = top;
  3288. else if (bottom > viewRectBottom) container.scrollTop = bottom - container.clientHeight;
  3289. }
  3290. function animateScrollTo(container, from, to, duration, callback) {
  3291. const startTime = Date.now();
  3292. let handle;
  3293. const scroll = () => {
  3294. const time = Date.now() - startTime;
  3295. const nextScrollTop = easeInOutCubic(time > duration ? duration : time, from, to, duration);
  3296. if (isWindow(container)) container.scrollTo(window.pageXOffset, nextScrollTop);
  3297. else container.scrollTop = nextScrollTop;
  3298. if (time < duration) handle = rAF(scroll);
  3299. else if (isFunction$1(callback)) callback();
  3300. };
  3301. scroll();
  3302. return () => {
  3303. handle && cAF(handle);
  3304. };
  3305. }
  3306. const getScrollElement = (target, container) => {
  3307. if (isWindow(container)) return target.ownerDocument.documentElement;
  3308. return container;
  3309. };
  3310. const getScrollTop = (container) => {
  3311. if (isWindow(container)) return window.scrollY;
  3312. return container.scrollTop;
  3313. };
  3314. //#endregion
  3315. //#region ../../packages/utils/dom/element.ts
  3316. const getElement = ((target) => {
  3317. if (!isClient || target === "") return null;
  3318. if (isString(target)) try {
  3319. return document.querySelector(target);
  3320. } catch {
  3321. return null;
  3322. }
  3323. return target;
  3324. });
  3325. //#endregion
  3326. //#region ../../packages/utils/vue/global-node.ts
  3327. const globalNodes = [];
  3328. let target = !isClient ? void 0 : document.body;
  3329. function createGlobalNode(id) {
  3330. const el = document.createElement("div");
  3331. if (id !== void 0) el.setAttribute("id", id);
  3332. if (target) {
  3333. target.appendChild(el);
  3334. globalNodes.push(el);
  3335. }
  3336. return el;
  3337. }
  3338. function removeGlobalNode(el) {
  3339. globalNodes.splice(globalNodes.indexOf(el), 1);
  3340. el.remove();
  3341. }
  3342. //#endregion
  3343. //#region ../../node_modules/.pnpm/@element-plus+icons-vue@2.3.2_vue@3.5.25/node_modules/@element-plus/icons-vue/dist/index.js
  3344. /*! Element Plus Icons Vue v2.3.2 */
  3345. var arrow_down_default = /* @__PURE__ */ defineComponent({
  3346. name: "ArrowDown",
  3347. __name: "arrow-down",
  3348. setup(__props) {
  3349. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3350. xmlns: "http://www.w3.org/2000/svg",
  3351. viewBox: "0 0 1024 1024"
  3352. }, [createElementVNode("path", {
  3353. fill: "currentColor",
  3354. d: "M831.872 340.864 512 652.672 192.128 340.864a30.59 30.59 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.59 30.59 0 0 0-42.752 0z"
  3355. })]));
  3356. }
  3357. });
  3358. var arrow_left_default = /* @__PURE__ */ defineComponent({
  3359. name: "ArrowLeft",
  3360. __name: "arrow-left",
  3361. setup(__props) {
  3362. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3363. xmlns: "http://www.w3.org/2000/svg",
  3364. viewBox: "0 0 1024 1024"
  3365. }, [createElementVNode("path", {
  3366. fill: "currentColor",
  3367. d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.59 30.59 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.59 30.59 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0"
  3368. })]));
  3369. }
  3370. });
  3371. var arrow_right_default = /* @__PURE__ */ defineComponent({
  3372. name: "ArrowRight",
  3373. __name: "arrow-right",
  3374. setup(__props) {
  3375. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3376. xmlns: "http://www.w3.org/2000/svg",
  3377. viewBox: "0 0 1024 1024"
  3378. }, [createElementVNode("path", {
  3379. fill: "currentColor",
  3380. d: "M340.864 149.312a30.59 30.59 0 0 0 0 42.752L652.736 512 340.864 831.872a30.59 30.59 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
  3381. })]));
  3382. }
  3383. });
  3384. var arrow_up_default = /* @__PURE__ */ defineComponent({
  3385. name: "ArrowUp",
  3386. __name: "arrow-up",
  3387. setup(__props) {
  3388. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3389. xmlns: "http://www.w3.org/2000/svg",
  3390. viewBox: "0 0 1024 1024"
  3391. }, [createElementVNode("path", {
  3392. fill: "currentColor",
  3393. d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0"
  3394. })]));
  3395. }
  3396. });
  3397. var back_default = /* @__PURE__ */ defineComponent({
  3398. name: "Back",
  3399. __name: "back",
  3400. setup(__props) {
  3401. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3402. xmlns: "http://www.w3.org/2000/svg",
  3403. viewBox: "0 0 1024 1024"
  3404. }, [createElementVNode("path", {
  3405. fill: "currentColor",
  3406. d: "M224 480h640a32 32 0 1 1 0 64H224a32 32 0 0 1 0-64"
  3407. }), createElementVNode("path", {
  3408. fill: "currentColor",
  3409. d: "m237.248 512 265.408 265.344a32 32 0 0 1-45.312 45.312l-288-288a32 32 0 0 1 0-45.312l288-288a32 32 0 1 1 45.312 45.312z"
  3410. })]));
  3411. }
  3412. });
  3413. var calendar_default$1 = /* @__PURE__ */ defineComponent({
  3414. name: "Calendar",
  3415. __name: "calendar",
  3416. setup(__props) {
  3417. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3418. xmlns: "http://www.w3.org/2000/svg",
  3419. viewBox: "0 0 1024 1024"
  3420. }, [createElementVNode("path", {
  3421. fill: "currentColor",
  3422. d: "M128 384v512h768V192H768v32a32 32 0 1 1-64 0v-32H320v32a32 32 0 0 1-64 0v-32H128v128h768v64zm192-256h384V96a32 32 0 1 1 64 0v32h160a32 32 0 0 1 32 32v768a32 32 0 0 1-32 32H96a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h160V96a32 32 0 0 1 64 0zm-32 384h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m192-192h64a32 32 0 0 1 0 64h-64a32 32 0 0 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m192-192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64m0 192h64a32 32 0 1 1 0 64h-64a32 32 0 1 1 0-64"
  3423. })]));
  3424. }
  3425. });
  3426. var caret_right_default = /* @__PURE__ */ defineComponent({
  3427. name: "CaretRight",
  3428. __name: "caret-right",
  3429. setup(__props) {
  3430. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3431. xmlns: "http://www.w3.org/2000/svg",
  3432. viewBox: "0 0 1024 1024"
  3433. }, [createElementVNode("path", {
  3434. fill: "currentColor",
  3435. d: "M384 192v640l384-320.064z"
  3436. })]));
  3437. }
  3438. });
  3439. var caret_top_default = /* @__PURE__ */ defineComponent({
  3440. name: "CaretTop",
  3441. __name: "caret-top",
  3442. setup(__props) {
  3443. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3444. xmlns: "http://www.w3.org/2000/svg",
  3445. viewBox: "0 0 1024 1024"
  3446. }, [createElementVNode("path", {
  3447. fill: "currentColor",
  3448. d: "M512 320 192 704h639.936z"
  3449. })]));
  3450. }
  3451. });
  3452. var check_default = /* @__PURE__ */ defineComponent({
  3453. name: "Check",
  3454. __name: "check",
  3455. setup(__props) {
  3456. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3457. xmlns: "http://www.w3.org/2000/svg",
  3458. viewBox: "0 0 1024 1024"
  3459. }, [createElementVNode("path", {
  3460. fill: "currentColor",
  3461. 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"
  3462. })]));
  3463. }
  3464. });
  3465. var circle_check_filled_default = /* @__PURE__ */ defineComponent({
  3466. name: "CircleCheckFilled",
  3467. __name: "circle-check-filled",
  3468. setup(__props) {
  3469. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3470. xmlns: "http://www.w3.org/2000/svg",
  3471. viewBox: "0 0 1024 1024"
  3472. }, [createElementVNode("path", {
  3473. fill: "currentColor",
  3474. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  3475. })]));
  3476. }
  3477. });
  3478. var circle_check_default = /* @__PURE__ */ defineComponent({
  3479. name: "CircleCheck",
  3480. __name: "circle-check",
  3481. setup(__props) {
  3482. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3483. xmlns: "http://www.w3.org/2000/svg",
  3484. viewBox: "0 0 1024 1024"
  3485. }, [createElementVNode("path", {
  3486. fill: "currentColor",
  3487. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  3488. }), createElementVNode("path", {
  3489. fill: "currentColor",
  3490. d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752z"
  3491. })]));
  3492. }
  3493. });
  3494. var circle_close_filled_default = /* @__PURE__ */ defineComponent({
  3495. name: "CircleCloseFilled",
  3496. __name: "circle-close-filled",
  3497. setup(__props) {
  3498. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3499. xmlns: "http://www.w3.org/2000/svg",
  3500. viewBox: "0 0 1024 1024"
  3501. }, [createElementVNode("path", {
  3502. fill: "currentColor",
  3503. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 393.664L407.936 353.6a38.4 38.4 0 1 0-54.336 54.336L457.664 512 353.6 616.064a38.4 38.4 0 1 0 54.336 54.336L512 566.336 616.064 670.4a38.4 38.4 0 1 0 54.336-54.336L566.336 512 670.4 407.936a38.4 38.4 0 1 0-54.336-54.336z"
  3504. })]));
  3505. }
  3506. });
  3507. var circle_close_default = /* @__PURE__ */ defineComponent({
  3508. name: "CircleClose",
  3509. __name: "circle-close",
  3510. setup(__props) {
  3511. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3512. xmlns: "http://www.w3.org/2000/svg",
  3513. viewBox: "0 0 1024 1024"
  3514. }, [createElementVNode("path", {
  3515. fill: "currentColor",
  3516. d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248z"
  3517. }), createElementVNode("path", {
  3518. fill: "currentColor",
  3519. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  3520. })]));
  3521. }
  3522. });
  3523. var clock_default = /* @__PURE__ */ defineComponent({
  3524. name: "Clock",
  3525. __name: "clock",
  3526. setup(__props) {
  3527. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3528. xmlns: "http://www.w3.org/2000/svg",
  3529. viewBox: "0 0 1024 1024"
  3530. }, [
  3531. createElementVNode("path", {
  3532. fill: "currentColor",
  3533. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768m0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896"
  3534. }),
  3535. createElementVNode("path", {
  3536. fill: "currentColor",
  3537. d: "M480 256a32 32 0 0 1 32 32v256a32 32 0 0 1-64 0V288a32 32 0 0 1 32-32"
  3538. }),
  3539. createElementVNode("path", {
  3540. fill: "currentColor",
  3541. d: "M480 512h256q32 0 32 32t-32 32H480q-32 0-32-32t32-32"
  3542. })
  3543. ]));
  3544. }
  3545. });
  3546. var close_default = /* @__PURE__ */ defineComponent({
  3547. name: "Close",
  3548. __name: "close",
  3549. setup(__props) {
  3550. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3551. xmlns: "http://www.w3.org/2000/svg",
  3552. viewBox: "0 0 1024 1024"
  3553. }, [createElementVNode("path", {
  3554. fill: "currentColor",
  3555. 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"
  3556. })]));
  3557. }
  3558. });
  3559. var d_arrow_left_default = /* @__PURE__ */ defineComponent({
  3560. name: "DArrowLeft",
  3561. __name: "d-arrow-left",
  3562. setup(__props) {
  3563. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3564. xmlns: "http://www.w3.org/2000/svg",
  3565. viewBox: "0 0 1024 1024"
  3566. }, [createElementVNode("path", {
  3567. fill: "currentColor",
  3568. d: "M529.408 149.376a29.12 29.12 0 0 1 41.728 0 30.59 30.59 0 0 1 0 42.688L259.264 511.936l311.872 319.936a30.59 30.59 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L197.76 534.272a32 32 0 0 1 0-44.672zm256 0a29.12 29.12 0 0 1 41.728 0 30.59 30.59 0 0 1 0 42.688L515.264 511.936l311.872 319.936a30.59 30.59 0 0 1-.512 43.264 29.12 29.12 0 0 1-41.216-.512L453.76 534.272a32 32 0 0 1 0-44.672z"
  3569. })]));
  3570. }
  3571. });
  3572. var d_arrow_right_default = /* @__PURE__ */ defineComponent({
  3573. name: "DArrowRight",
  3574. __name: "d-arrow-right",
  3575. setup(__props) {
  3576. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3577. xmlns: "http://www.w3.org/2000/svg",
  3578. viewBox: "0 0 1024 1024"
  3579. }, [createElementVNode("path", {
  3580. fill: "currentColor",
  3581. d: "M452.864 149.312a29.12 29.12 0 0 1 41.728.064L826.24 489.664a32 32 0 0 1 0 44.672L494.592 874.624a29.12 29.12 0 0 1-41.728 0 30.59 30.59 0 0 1 0-42.752L764.736 512 452.864 192a30.59 30.59 0 0 1 0-42.688m-256 0a29.12 29.12 0 0 1 41.728.064L570.24 489.664a32 32 0 0 1 0 44.672L238.592 874.624a29.12 29.12 0 0 1-41.728 0 30.59 30.59 0 0 1 0-42.752L508.736 512 196.864 192a30.59 30.59 0 0 1 0-42.688"
  3582. })]));
  3583. }
  3584. });
  3585. var delete_default = /* @__PURE__ */ defineComponent({
  3586. name: "Delete",
  3587. __name: "delete",
  3588. setup(__props) {
  3589. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3590. xmlns: "http://www.w3.org/2000/svg",
  3591. viewBox: "0 0 1024 1024"
  3592. }, [createElementVNode("path", {
  3593. fill: "currentColor",
  3594. d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32zm448-64v-64H416v64zM224 896h576V256H224zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32m192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32"
  3595. })]));
  3596. }
  3597. });
  3598. var document_default = /* @__PURE__ */ defineComponent({
  3599. name: "Document",
  3600. __name: "document",
  3601. setup(__props) {
  3602. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3603. xmlns: "http://www.w3.org/2000/svg",
  3604. viewBox: "0 0 1024 1024"
  3605. }, [createElementVNode("path", {
  3606. fill: "currentColor",
  3607. d: "M832 384H576V128H192v768h640zm-26.496-64L640 154.496V320zM160 64h480l256 256v608a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V96a32 32 0 0 1 32-32m160 448h384v64H320zm0-192h160v64H320zm0 384h384v64H320z"
  3608. })]));
  3609. }
  3610. });
  3611. var full_screen_default = /* @__PURE__ */ defineComponent({
  3612. name: "FullScreen",
  3613. __name: "full-screen",
  3614. setup(__props) {
  3615. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3616. xmlns: "http://www.w3.org/2000/svg",
  3617. viewBox: "0 0 1024 1024"
  3618. }, [createElementVNode("path", {
  3619. fill: "currentColor",
  3620. d: "m160 96.064 192 .192a32 32 0 0 1 0 64l-192-.192V352a32 32 0 0 1-64 0V96h64zm0 831.872V928H96V672a32 32 0 1 1 64 0v191.936l192-.192a32 32 0 1 1 0 64zM864 96.064V96h64v256a32 32 0 1 1-64 0V160.064l-192 .192a32 32 0 1 1 0-64zm0 831.872-192-.192a32 32 0 0 1 0-64l192 .192V672a32 32 0 1 1 64 0v256h-64z"
  3621. })]));
  3622. }
  3623. });
  3624. var hide_default = /* @__PURE__ */ defineComponent({
  3625. name: "Hide",
  3626. __name: "hide",
  3627. setup(__props) {
  3628. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3629. xmlns: "http://www.w3.org/2000/svg",
  3630. viewBox: "0 0 1024 1024"
  3631. }, [createElementVNode("path", {
  3632. fill: "currentColor",
  3633. d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4s-12.8-9.6-22.4-9.6-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176S0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4s3.2 16 9.6 22.4 12.8 9.6 22.4 9.6 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4m-646.4 528Q115.2 579.2 76.8 512q43.2-72 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4m140.8-96Q352 555.2 352 512c0-44.8 16-83.2 48-112s67.2-48 112-48c28.8 0 54.4 6.4 73.6 19.2zM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6q-43.2 72-153.6 172.8c-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176S1024 528 1024 512s-48.001-73.6-134.401-176"
  3634. }), createElementVNode("path", {
  3635. fill: "currentColor",
  3636. d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112s-67.2 48-112 48"
  3637. })]));
  3638. }
  3639. });
  3640. var info_filled_default = /* @__PURE__ */ defineComponent({
  3641. name: "InfoFilled",
  3642. __name: "info-filled",
  3643. setup(__props) {
  3644. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3645. xmlns: "http://www.w3.org/2000/svg",
  3646. viewBox: "0 0 1024 1024"
  3647. }, [createElementVNode("path", {
  3648. fill: "currentColor",
  3649. d: "M512 64a448 448 0 1 1 0 896.064A448 448 0 0 1 512 64m67.2 275.072c33.28 0 60.288-23.104 60.288-57.344s-27.072-57.344-60.288-57.344c-33.28 0-60.16 23.104-60.16 57.344s26.88 57.344 60.16 57.344M590.912 699.2c0-6.848 2.368-24.64 1.024-34.752l-52.608 60.544c-10.88 11.456-24.512 19.392-30.912 17.28a12.99 12.99 0 0 1-8.256-14.72l87.68-276.992c7.168-35.136-12.544-67.2-54.336-71.296-44.096 0-108.992 44.736-148.48 101.504 0 6.784-1.28 23.68.064 33.792l52.544-60.608c10.88-11.328 23.552-19.328 29.952-17.152a12.8 12.8 0 0 1 7.808 16.128L388.48 728.576c-10.048 32.256 8.96 63.872 55.04 71.04 67.84 0 107.904-43.648 147.456-100.416z"
  3650. })]));
  3651. }
  3652. });
  3653. var loading_default = /* @__PURE__ */ defineComponent({
  3654. name: "Loading",
  3655. __name: "loading",
  3656. setup(__props) {
  3657. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3658. xmlns: "http://www.w3.org/2000/svg",
  3659. viewBox: "0 0 1024 1024"
  3660. }, [createElementVNode("path", {
  3661. fill: "currentColor",
  3662. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32m0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32m448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32m-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32M195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248m452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248M828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0m-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0"
  3663. })]));
  3664. }
  3665. });
  3666. var minus_default = /* @__PURE__ */ defineComponent({
  3667. name: "Minus",
  3668. __name: "minus",
  3669. setup(__props) {
  3670. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3671. xmlns: "http://www.w3.org/2000/svg",
  3672. viewBox: "0 0 1024 1024"
  3673. }, [createElementVNode("path", {
  3674. fill: "currentColor",
  3675. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64"
  3676. })]));
  3677. }
  3678. });
  3679. var more_filled_default = /* @__PURE__ */ defineComponent({
  3680. name: "MoreFilled",
  3681. __name: "more-filled",
  3682. setup(__props) {
  3683. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3684. xmlns: "http://www.w3.org/2000/svg",
  3685. viewBox: "0 0 1024 1024"
  3686. }, [createElementVNode("path", {
  3687. fill: "currentColor",
  3688. d: "M176 416a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224m336 0a112 112 0 1 1 0 224 112 112 0 0 1 0-224"
  3689. })]));
  3690. }
  3691. });
  3692. var more_default = /* @__PURE__ */ defineComponent({
  3693. name: "More",
  3694. __name: "more",
  3695. setup(__props) {
  3696. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3697. xmlns: "http://www.w3.org/2000/svg",
  3698. viewBox: "0 0 1024 1024"
  3699. }, [createElementVNode("path", {
  3700. fill: "currentColor",
  3701. d: "M176 416a112 112 0 1 0 0 224 112 112 0 0 0 0-224m0 64a48 48 0 1 1 0 96 48 48 0 0 1 0-96m336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224m0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96m336-64a112 112 0 1 1 0 224 112 112 0 0 1 0-224m0 64a48 48 0 1 0 0 96 48 48 0 0 0 0-96"
  3702. })]));
  3703. }
  3704. });
  3705. var picture_filled_default = /* @__PURE__ */ defineComponent({
  3706. name: "PictureFilled",
  3707. __name: "picture-filled",
  3708. setup(__props) {
  3709. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3710. xmlns: "http://www.w3.org/2000/svg",
  3711. viewBox: "0 0 1024 1024"
  3712. }, [createElementVNode("path", {
  3713. fill: "currentColor",
  3714. d: "M96 896a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h832a32 32 0 0 1 32 32v704a32 32 0 0 1-32 32zm315.52-228.48-68.928-68.928a32 32 0 0 0-45.248 0L128 768.064h778.688l-242.112-290.56a32 32 0 0 0-49.216 0L458.752 665.408a32 32 0 0 1-47.232 2.112M256 384a96 96 0 1 0 192.064-.064A96 96 0 0 0 256 384"
  3715. })]));
  3716. }
  3717. });
  3718. var plus_default = /* @__PURE__ */ defineComponent({
  3719. name: "Plus",
  3720. __name: "plus",
  3721. setup(__props) {
  3722. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3723. xmlns: "http://www.w3.org/2000/svg",
  3724. viewBox: "0 0 1024 1024"
  3725. }, [createElementVNode("path", {
  3726. fill: "currentColor",
  3727. d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64z"
  3728. })]));
  3729. }
  3730. });
  3731. var question_filled_default = /* @__PURE__ */ defineComponent({
  3732. name: "QuestionFilled",
  3733. __name: "question-filled",
  3734. setup(__props) {
  3735. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3736. xmlns: "http://www.w3.org/2000/svg",
  3737. viewBox: "0 0 1024 1024"
  3738. }, [createElementVNode("path", {
  3739. fill: "currentColor",
  3740. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m23.744 191.488c-52.096 0-92.928 14.784-123.2 44.352-30.976 29.568-45.76 70.4-45.76 122.496h80.256c0-29.568 5.632-52.8 17.6-68.992 13.376-19.712 35.2-28.864 66.176-28.864 23.936 0 42.944 6.336 56.32 19.712 12.672 13.376 19.712 31.68 19.712 54.912 0 17.6-6.336 34.496-19.008 49.984l-8.448 9.856c-45.76 40.832-73.216 70.4-82.368 89.408-9.856 19.008-14.08 42.24-14.08 68.992v9.856h80.96v-9.856c0-16.896 3.52-31.68 10.56-45.76 6.336-12.672 15.488-24.64 28.16-35.2 33.792-29.568 54.208-48.576 60.544-55.616 16.896-22.528 26.048-51.392 26.048-86.592q0-64.416-42.24-101.376c-28.16-25.344-65.472-37.312-111.232-37.312m-12.672 406.208a54.27 54.27 0 0 0-38.72 14.784 49.4 49.4 0 0 0-15.488 38.016c0 15.488 4.928 28.16 15.488 38.016A54.85 54.85 0 0 0 523.072 768c15.488 0 28.16-4.928 38.72-14.784a51.52 51.52 0 0 0 16.192-38.72 51.97 51.97 0 0 0-15.488-38.016 55.94 55.94 0 0 0-39.424-14.784"
  3741. })]));
  3742. }
  3743. });
  3744. var refresh_left_default = /* @__PURE__ */ defineComponent({
  3745. name: "RefreshLeft",
  3746. __name: "refresh-left",
  3747. setup(__props) {
  3748. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3749. xmlns: "http://www.w3.org/2000/svg",
  3750. viewBox: "0 0 1024 1024"
  3751. }, [createElementVNode("path", {
  3752. fill: "currentColor",
  3753. 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"
  3754. })]));
  3755. }
  3756. });
  3757. var refresh_right_default = /* @__PURE__ */ defineComponent({
  3758. name: "RefreshRight",
  3759. __name: "refresh-right",
  3760. setup(__props) {
  3761. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3762. xmlns: "http://www.w3.org/2000/svg",
  3763. viewBox: "0 0 1024 1024"
  3764. }, [createElementVNode("path", {
  3765. fill: "currentColor",
  3766. d: "M784.512 230.272v-50.56a32 32 0 1 1 64 0v149.056a32 32 0 0 1-32 32H667.52a32 32 0 1 1 0-64h92.992A320 320 0 1 0 524.8 833.152a320 320 0 0 0 320-320h64a384 384 0 0 1-384 384 384 384 0 0 1-384-384 384 384 0 0 1 643.712-282.88"
  3767. })]));
  3768. }
  3769. });
  3770. var scale_to_original_default = /* @__PURE__ */ defineComponent({
  3771. name: "ScaleToOriginal",
  3772. __name: "scale-to-original",
  3773. setup(__props) {
  3774. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3775. xmlns: "http://www.w3.org/2000/svg",
  3776. viewBox: "0 0 1024 1024"
  3777. }, [createElementVNode("path", {
  3778. fill: "currentColor",
  3779. d: "M813.176 180.706a60.235 60.235 0 0 1 60.236 60.235v481.883a60.235 60.235 0 0 1-60.236 60.235H210.824a60.235 60.235 0 0 1-60.236-60.235V240.94a60.235 60.235 0 0 1 60.236-60.235h602.352zm0-60.235H210.824A120.47 120.47 0 0 0 90.353 240.94v481.883a120.47 120.47 0 0 0 120.47 120.47h602.353a120.47 120.47 0 0 0 120.471-120.47V240.94a120.47 120.47 0 0 0-120.47-120.47zm-120.47 180.705a30.12 30.12 0 0 0-30.118 30.118v301.177a30.118 30.118 0 0 0 60.236 0V331.294a30.12 30.12 0 0 0-30.118-30.118m-361.412 0a30.12 30.12 0 0 0-30.118 30.118v301.177a30.118 30.118 0 1 0 60.236 0V331.294a30.12 30.12 0 0 0-30.118-30.118M512 361.412a30.12 30.12 0 0 0-30.118 30.117v30.118a30.118 30.118 0 0 0 60.236 0V391.53A30.12 30.12 0 0 0 512 361.412M512 512a30.12 30.12 0 0 0-30.118 30.118v30.117a30.118 30.118 0 0 0 60.236 0v-30.117A30.12 30.12 0 0 0 512 512"
  3780. })]));
  3781. }
  3782. });
  3783. var search_default = /* @__PURE__ */ defineComponent({
  3784. name: "Search",
  3785. __name: "search",
  3786. setup(__props) {
  3787. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3788. xmlns: "http://www.w3.org/2000/svg",
  3789. viewBox: "0 0 1024 1024"
  3790. }, [createElementVNode("path", {
  3791. fill: "currentColor",
  3792. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704"
  3793. })]));
  3794. }
  3795. });
  3796. var sort_down_default = /* @__PURE__ */ defineComponent({
  3797. name: "SortDown",
  3798. __name: "sort-down",
  3799. setup(__props) {
  3800. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3801. xmlns: "http://www.w3.org/2000/svg",
  3802. viewBox: "0 0 1024 1024"
  3803. }, [createElementVNode("path", {
  3804. fill: "currentColor",
  3805. d: "M576 96v709.568L333.312 562.816A32 32 0 1 0 288 608l297.408 297.344A32 32 0 0 0 640 882.688V96a32 32 0 0 0-64 0"
  3806. })]));
  3807. }
  3808. });
  3809. var sort_up_default = /* @__PURE__ */ defineComponent({
  3810. name: "SortUp",
  3811. __name: "sort-up",
  3812. setup(__props) {
  3813. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3814. xmlns: "http://www.w3.org/2000/svg",
  3815. viewBox: "0 0 1024 1024"
  3816. }, [createElementVNode("path", {
  3817. fill: "currentColor",
  3818. d: "M384 141.248V928a32 32 0 1 0 64 0V218.56l242.688 242.688A32 32 0 1 0 736 416L438.592 118.656A32 32 0 0 0 384 141.248"
  3819. })]));
  3820. }
  3821. });
  3822. var star_filled_default = /* @__PURE__ */ defineComponent({
  3823. name: "StarFilled",
  3824. __name: "star-filled",
  3825. setup(__props) {
  3826. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3827. xmlns: "http://www.w3.org/2000/svg",
  3828. viewBox: "0 0 1024 1024"
  3829. }, [createElementVNode("path", {
  3830. fill: "currentColor",
  3831. d: "M313.6 924.48a70.4 70.4 0 0 1-74.152-5.365 70.4 70.4 0 0 1-27.992-68.875l37.888-220.928L88.96 472.96a70.4 70.4 0 0 1 3.788-104.225A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 100.246-28.595 70.4 70.4 0 0 1 25.962 28.595l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"
  3832. })]));
  3833. }
  3834. });
  3835. var star_default = /* @__PURE__ */ defineComponent({
  3836. name: "Star",
  3837. __name: "star",
  3838. setup(__props) {
  3839. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3840. xmlns: "http://www.w3.org/2000/svg",
  3841. viewBox: "0 0 1024 1024"
  3842. }, [createElementVNode("path", {
  3843. fill: "currentColor",
  3844. d: "m512 747.84 228.16 119.936a6.4 6.4 0 0 0 9.28-6.72l-43.52-254.08 184.512-179.904a6.4 6.4 0 0 0-3.52-10.88l-255.104-37.12L517.76 147.904a6.4 6.4 0 0 0-11.52 0L392.192 379.072l-255.104 37.12a6.4 6.4 0 0 0-3.52 10.88L318.08 606.976l-43.584 254.08a6.4 6.4 0 0 0 9.28 6.72zM313.6 924.48a70.4 70.4 0 0 1-102.144-74.24l37.888-220.928L88.96 472.96A70.4 70.4 0 0 1 128 352.896l221.76-32.256 99.2-200.96a70.4 70.4 0 0 1 126.208 0l99.2 200.96 221.824 32.256a70.4 70.4 0 0 1 39.04 120.064L774.72 629.376l37.888 220.928a70.4 70.4 0 0 1-102.144 74.24L512 820.096l-198.4 104.32z"
  3845. })]));
  3846. }
  3847. });
  3848. var success_filled_default = /* @__PURE__ */ defineComponent({
  3849. name: "SuccessFilled",
  3850. __name: "success-filled",
  3851. setup(__props) {
  3852. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3853. xmlns: "http://www.w3.org/2000/svg",
  3854. viewBox: "0 0 1024 1024"
  3855. }, [createElementVNode("path", {
  3856. fill: "currentColor",
  3857. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m-55.808 536.384-99.52-99.584a38.4 38.4 0 1 0-54.336 54.336l126.72 126.72a38.27 38.27 0 0 0 54.336 0l262.4-262.464a38.4 38.4 0 1 0-54.272-54.336z"
  3858. })]));
  3859. }
  3860. });
  3861. var view_default = /* @__PURE__ */ defineComponent({
  3862. name: "View",
  3863. __name: "view",
  3864. setup(__props) {
  3865. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3866. xmlns: "http://www.w3.org/2000/svg",
  3867. viewBox: "0 0 1024 1024"
  3868. }, [createElementVNode("path", {
  3869. fill: "currentColor",
  3870. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352m0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288m0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448m0 64a160.19 160.19 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160"
  3871. })]));
  3872. }
  3873. });
  3874. var warning_filled_default = /* @__PURE__ */ defineComponent({
  3875. name: "WarningFilled",
  3876. __name: "warning-filled",
  3877. setup(__props) {
  3878. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3879. xmlns: "http://www.w3.org/2000/svg",
  3880. viewBox: "0 0 1024 1024"
  3881. }, [createElementVNode("path", {
  3882. fill: "currentColor",
  3883. d: "M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896m0 192a58.43 58.43 0 0 0-58.24 63.744l23.36 256.384a35.072 35.072 0 0 0 69.76 0l23.296-256.384A58.43 58.43 0 0 0 512 256m0 512a51.2 51.2 0 1 0 0-102.4 51.2 51.2 0 0 0 0 102.4"
  3884. })]));
  3885. }
  3886. });
  3887. var zoom_in_default = /* @__PURE__ */ defineComponent({
  3888. name: "ZoomIn",
  3889. __name: "zoom-in",
  3890. setup(__props) {
  3891. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3892. xmlns: "http://www.w3.org/2000/svg",
  3893. viewBox: "0 0 1024 1024"
  3894. }, [createElementVNode("path", {
  3895. fill: "currentColor",
  3896. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704m-32-384v-96a32 32 0 0 1 64 0v96h96a32 32 0 0 1 0 64h-96v96a32 32 0 0 1-64 0v-96h-96a32 32 0 0 1 0-64z"
  3897. })]));
  3898. }
  3899. });
  3900. var zoom_out_default = /* @__PURE__ */ defineComponent({
  3901. name: "ZoomOut",
  3902. __name: "zoom-out",
  3903. setup(__props) {
  3904. return (_ctx, _cache) => (openBlock(), createElementBlock("svg", {
  3905. xmlns: "http://www.w3.org/2000/svg",
  3906. viewBox: "0 0 1024 1024"
  3907. }, [createElementVNode("path", {
  3908. fill: "currentColor",
  3909. d: "m795.904 750.72 124.992 124.928a32 32 0 0 1-45.248 45.248L750.656 795.904a416 416 0 1 1 45.248-45.248zM480 832a352 352 0 1 0 0-704 352 352 0 0 0 0 704M352 448h256a32 32 0 0 1 0 64H352a32 32 0 0 1 0-64"
  3910. })]));
  3911. }
  3912. });
  3913. //#endregion
  3914. //#region ../../packages/utils/vue/props/runtime.ts
  3915. const epPropKey = "__epPropKey";
  3916. const definePropType = (val) => val;
  3917. const isEpProp = (val) => isObject$1(val) && !!val["__epPropKey"];
  3918. const buildProp = (prop, key) => {
  3919. if (!isObject$1(prop) || isEpProp(prop)) return prop;
  3920. const { values, required, default: defaultValue, type, validator } = prop;
  3921. const epProp = {
  3922. type,
  3923. required: !!required,
  3924. validator: values || validator ? (val) => {
  3925. let valid = false;
  3926. let allowedValues = [];
  3927. if (values) {
  3928. allowedValues = Array.from(values);
  3929. if (hasOwn(prop, "default")) allowedValues.push(defaultValue);
  3930. valid ||= allowedValues.includes(val);
  3931. }
  3932. if (validator) valid ||= validator(val);
  3933. if (!valid && allowedValues.length > 0) {
  3934. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  3935. warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  3936. }
  3937. return valid;
  3938. } : void 0,
  3939. [epPropKey]: true
  3940. };
  3941. if (hasOwn(prop, "default")) epProp.default = defaultValue;
  3942. return epProp;
  3943. };
  3944. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [key, buildProp(option, key)]));
  3945. //#endregion
  3946. //#region ../../packages/utils/vue/icon.ts
  3947. const iconPropType = definePropType([
  3948. String,
  3949. Object,
  3950. Function
  3951. ]);
  3952. const CloseComponents = { Close: close_default };
  3953. const TypeComponents = {
  3954. Close: close_default,
  3955. SuccessFilled: success_filled_default,
  3956. InfoFilled: info_filled_default,
  3957. WarningFilled: warning_filled_default,
  3958. CircleCloseFilled: circle_close_filled_default
  3959. };
  3960. const TypeComponentsMap = {
  3961. primary: info_filled_default,
  3962. success: success_filled_default,
  3963. warning: warning_filled_default,
  3964. error: circle_close_filled_default,
  3965. info: info_filled_default
  3966. };
  3967. const ValidateComponentsMap = {
  3968. validating: loading_default,
  3969. success: circle_check_default,
  3970. error: circle_close_default
  3971. };
  3972. //#endregion
  3973. //#region ../../packages/utils/vue/install.ts
  3974. const withPropsDefaultsSetter = (target) => {
  3975. const _p = target.props;
  3976. const props = isArray$1(_p) ? fromPairs(_p.map((key) => [key, {}])) : _p;
  3977. target.setPropsDefaults = (defaults) => {
  3978. if (!props) return;
  3979. for (const [key, value] of Object.entries(defaults)) {
  3980. const prop = props[key];
  3981. if (!hasOwn(props, key)) continue;
  3982. if (isPlainObject(prop)) {
  3983. props[key] = {
  3984. ...prop,
  3985. default: value
  3986. };
  3987. continue;
  3988. }
  3989. props[key] = {
  3990. type: prop,
  3991. default: value
  3992. };
  3993. }
  3994. target.props = props;
  3995. };
  3996. };
  3997. const withInstall = (main, extra) => {
  3998. main.install = (app) => {
  3999. for (const comp of [main, ...Object.values(extra ?? {})]) app.component(comp.name, comp);
  4000. };
  4001. if (extra) for (const [key, comp] of Object.entries(extra)) main[key] = comp;
  4002. withPropsDefaultsSetter(main);
  4003. return main;
  4004. };
  4005. const withInstallFunction = (fn, name) => {
  4006. fn.install = (app) => {
  4007. fn._context = app._context;
  4008. app.config.globalProperties[name] = fn;
  4009. };
  4010. return fn;
  4011. };
  4012. const withInstallDirective = (directive, name) => {
  4013. directive.install = (app) => {
  4014. app.directive(name, directive);
  4015. };
  4016. return directive;
  4017. };
  4018. const withNoopInstall = (component) => {
  4019. component.install = NOOP;
  4020. withPropsDefaultsSetter(component);
  4021. return component;
  4022. };
  4023. //#endregion
  4024. //#region ../../packages/utils/vue/refs.ts
  4025. const composeRefs = (...refs) => {
  4026. return (el) => {
  4027. refs.forEach((ref) => {
  4028. ref.value = el;
  4029. });
  4030. };
  4031. };
  4032. //#endregion
  4033. //#region ../../packages/utils/vue/validator.ts
  4034. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  4035. //#endregion
  4036. //#region ../../packages/utils/vue/vnode.ts
  4037. const SCOPE$8 = "utils/vue/vnode";
  4038. function isFragment(node) {
  4039. return isVNode(node) && node.type === Fragment;
  4040. }
  4041. function isComment(node) {
  4042. return isVNode(node) && node.type === Comment;
  4043. }
  4044. function isValidElementNode(node) {
  4045. return isVNode(node) && !isFragment(node) && !isComment(node);
  4046. }
  4047. const getNormalizedProps = (node) => {
  4048. if (!isVNode(node)) {
  4049. /* @__PURE__ */ debugWarn(SCOPE$8, "[getNormalizedProps] must be a VNode");
  4050. return {};
  4051. }
  4052. const raw = node.props || {};
  4053. const type = (isVNode(node.type) ? node.type.props : void 0) || {};
  4054. const props = {};
  4055. Object.keys(type).forEach((key) => {
  4056. if (hasOwn(type[key], "default")) props[key] = type[key].default;
  4057. });
  4058. Object.keys(raw).forEach((key) => {
  4059. props[camelize(key)] = raw[key];
  4060. });
  4061. return props;
  4062. };
  4063. const flattedChildren = (children) => {
  4064. const vNodes = isArray$1(children) ? children : [children];
  4065. const result = [];
  4066. vNodes.forEach((child) => {
  4067. if (isArray$1(child)) result.push(...flattedChildren(child));
  4068. else if (isVNode(child) && child.component?.subTree) result.push(child, ...flattedChildren(child.component.subTree));
  4069. else if (isVNode(child) && isArray$1(child.children)) result.push(...flattedChildren(child.children));
  4070. else if (isVNode(child) && child.shapeFlag === 2) result.push(...flattedChildren(child.type()));
  4071. else result.push(child);
  4072. });
  4073. return result;
  4074. };
  4075. //#endregion
  4076. //#region ../../packages/utils/arrays.ts
  4077. const unique = (arr) => [...new Set(arr)];
  4078. const extractFirst = (arr) => {
  4079. return isArray$1(arr) ? arr[0] : arr;
  4080. };
  4081. const castArray = (arr) => {
  4082. if (!arr && arr !== 0) return [];
  4083. return isArray$1(arr) ? arr : [arr];
  4084. };
  4085. //#endregion
  4086. //#region ../../packages/utils/typescript.ts
  4087. const mutable = (val) => val;
  4088. //#endregion
  4089. //#region ../../packages/utils/throttleByRaf.ts
  4090. function throttleByRaf(cb) {
  4091. let timer = 0;
  4092. const throttle = (...args) => {
  4093. if (timer) cAF(timer);
  4094. timer = rAF(() => {
  4095. cb(...args);
  4096. timer = 0;
  4097. });
  4098. };
  4099. throttle.cancel = () => {
  4100. cAF(timer);
  4101. timer = 0;
  4102. };
  4103. return throttle;
  4104. }
  4105. //#endregion
  4106. //#region ../../packages/utils/numbers.ts
  4107. function isGreaterThan(a, b, epsilon = .03) {
  4108. return a - b > epsilon;
  4109. }
  4110. //#endregion
  4111. //#region ../../packages/hooks/use-attrs/index.ts
  4112. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  4113. const LISTENER_PREFIX = /^on[A-Z]/;
  4114. const useAttrs = (params = {}) => {
  4115. const { excludeListeners = false, excludeKeys } = params;
  4116. const allExcludeKeys = computed(() => {
  4117. return (excludeKeys?.value || []).concat(DEFAULT_EXCLUDE_KEYS);
  4118. });
  4119. const instance = getCurrentInstance();
  4120. if (!instance) {
  4121. /* @__PURE__ */ debugWarn("use-attrs", "getCurrentInstance() returned null. useAttrs() must be called at the top of a setup function");
  4122. return computed(() => ({}));
  4123. }
  4124. return computed(() => fromPairs(Object.entries(instance.proxy?.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key)))));
  4125. };
  4126. //#endregion
  4127. //#region ../../packages/hooks/use-calc-input-width/index.ts
  4128. function useCalcInputWidth() {
  4129. const calculatorRef = shallowRef();
  4130. const calculatorWidth = ref(0);
  4131. const inputStyle = computed(() => ({ minWidth: `${Math.max(calculatorWidth.value, 11)}px` }));
  4132. const resetCalculatorWidth = () => {
  4133. calculatorWidth.value = calculatorRef.value?.getBoundingClientRect().width ?? 0;
  4134. };
  4135. useResizeObserver(calculatorRef, resetCalculatorWidth);
  4136. return {
  4137. calculatorRef,
  4138. calculatorWidth,
  4139. inputStyle
  4140. };
  4141. }
  4142. //#endregion
  4143. //#region ../../packages/hooks/use-deprecated/index.ts
  4144. const useDeprecated = ({ from, replacement, scope, version, ref, type = "API" }, condition) => {
  4145. watch(() => unref(condition), (val) => {
  4146. if (val) /* @__PURE__ */ debugWarn(scope, `[${type}] ${from} is about to be deprecated in version ${version}, please use ${replacement} instead.
  4147. For more detail, please visit: ${ref}
  4148. `);
  4149. }, { immediate: true });
  4150. };
  4151. //#endregion
  4152. //#region ../../packages/hooks/use-draggable/index.ts
  4153. const useDraggable = (targetRef, dragRef, draggable, overflow) => {
  4154. const transform = {
  4155. offsetX: 0,
  4156. offsetY: 0
  4157. };
  4158. const isDragging = ref(false);
  4159. const adjustPosition = (moveX, moveY) => {
  4160. if (targetRef.value) {
  4161. const { offsetX, offsetY } = transform;
  4162. const targetRect = targetRef.value.getBoundingClientRect();
  4163. const targetLeft = Math.max(targetRect.left, 0);
  4164. const targetTop = Math.max(targetRect.top, 0);
  4165. const targetWidth = targetRect.width;
  4166. const targetHeight = targetRect.height;
  4167. const clientWidth = document.documentElement.clientWidth;
  4168. const clientHeight = document.documentElement.clientHeight;
  4169. const minLeft = -targetLeft + offsetX;
  4170. const minTop = -targetTop + offsetY;
  4171. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  4172. const maxTop = clientHeight - targetTop - (targetHeight < clientHeight ? targetHeight : 0) + offsetY;
  4173. if (!overflow?.value) {
  4174. moveX = clamp$1(moveX, minLeft, maxLeft);
  4175. moveY = clamp$1(moveY, minTop, maxTop);
  4176. }
  4177. transform.offsetX = moveX;
  4178. transform.offsetY = moveY;
  4179. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  4180. }
  4181. };
  4182. const onMousedown = (e) => {
  4183. const downX = e.clientX;
  4184. const downY = e.clientY;
  4185. const { offsetX, offsetY } = transform;
  4186. const onMousemove = (e) => {
  4187. if (!isDragging.value) isDragging.value = true;
  4188. adjustPosition(offsetX + e.clientX - downX, offsetY + e.clientY - downY);
  4189. };
  4190. const onMouseup = () => {
  4191. isDragging.value = false;
  4192. document.removeEventListener("mousemove", onMousemove);
  4193. document.removeEventListener("mouseup", onMouseup);
  4194. };
  4195. document.addEventListener("mousemove", onMousemove);
  4196. document.addEventListener("mouseup", onMouseup);
  4197. };
  4198. const onDraggable = () => {
  4199. if (dragRef.value && targetRef.value) {
  4200. dragRef.value.addEventListener("mousedown", onMousedown);
  4201. window.addEventListener("resize", updatePosition);
  4202. }
  4203. };
  4204. const offDraggable = () => {
  4205. if (dragRef.value && targetRef.value) {
  4206. dragRef.value.removeEventListener("mousedown", onMousedown);
  4207. window.removeEventListener("resize", updatePosition);
  4208. }
  4209. };
  4210. const resetPosition = () => {
  4211. transform.offsetX = 0;
  4212. transform.offsetY = 0;
  4213. if (targetRef.value) targetRef.value.style.transform = "";
  4214. };
  4215. const updatePosition = () => {
  4216. const { offsetX, offsetY } = transform;
  4217. adjustPosition(offsetX, offsetY);
  4218. };
  4219. onMounted(() => {
  4220. watchEffect(() => {
  4221. if (draggable.value) onDraggable();
  4222. else offDraggable();
  4223. });
  4224. });
  4225. onBeforeUnmount(() => {
  4226. offDraggable();
  4227. });
  4228. return {
  4229. isDragging,
  4230. resetPosition,
  4231. updatePosition
  4232. };
  4233. };
  4234. //#endregion
  4235. //#region ../../packages/hooks/use-focus/index.ts
  4236. const useFocus = (el) => {
  4237. return { focus: () => {
  4238. el.value?.focus?.();
  4239. } };
  4240. };
  4241. //#endregion
  4242. //#region ../../packages/locale/lang/en.ts
  4243. var en_default = {
  4244. name: "en",
  4245. el: {
  4246. breadcrumb: { label: "Breadcrumb" },
  4247. colorpicker: {
  4248. confirm: "OK",
  4249. clear: "Clear",
  4250. defaultLabel: "color picker",
  4251. description: "current color is {color}. press enter to select a new color.",
  4252. alphaLabel: "pick alpha value",
  4253. alphaDescription: "alpha {alpha}, current color is {color}",
  4254. hueLabel: "pick hue value",
  4255. hueDescription: "hue {hue}, current color is {color}",
  4256. svLabel: "pick saturation and brightness value",
  4257. svDescription: "saturation {saturation}, brightness {brightness}, current color is {color}",
  4258. predefineDescription: "select {value} as the color"
  4259. },
  4260. datepicker: {
  4261. now: "Now",
  4262. today: "Today",
  4263. cancel: "Cancel",
  4264. clear: "Clear",
  4265. confirm: "OK",
  4266. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  4267. monthTablePrompt: "Use the arrow keys and enter to select the month",
  4268. yearTablePrompt: "Use the arrow keys and enter to select the year",
  4269. selectedDate: "Selected date",
  4270. selectDate: "Select date",
  4271. selectTime: "Select time",
  4272. startDate: "Start Date",
  4273. startTime: "Start Time",
  4274. endDate: "End Date",
  4275. endTime: "End Time",
  4276. prevYear: "Previous Year",
  4277. nextYear: "Next Year",
  4278. prevMonth: "Previous Month",
  4279. nextMonth: "Next Month",
  4280. year: "",
  4281. month1: "January",
  4282. month2: "February",
  4283. month3: "March",
  4284. month4: "April",
  4285. month5: "May",
  4286. month6: "June",
  4287. month7: "July",
  4288. month8: "August",
  4289. month9: "September",
  4290. month10: "October",
  4291. month11: "November",
  4292. month12: "December",
  4293. weeks: {
  4294. sun: "Sun",
  4295. mon: "Mon",
  4296. tue: "Tue",
  4297. wed: "Wed",
  4298. thu: "Thu",
  4299. fri: "Fri",
  4300. sat: "Sat"
  4301. },
  4302. weeksFull: {
  4303. sun: "Sunday",
  4304. mon: "Monday",
  4305. tue: "Tuesday",
  4306. wed: "Wednesday",
  4307. thu: "Thursday",
  4308. fri: "Friday",
  4309. sat: "Saturday"
  4310. },
  4311. months: {
  4312. jan: "Jan",
  4313. feb: "Feb",
  4314. mar: "Mar",
  4315. apr: "Apr",
  4316. may: "May",
  4317. jun: "Jun",
  4318. jul: "Jul",
  4319. aug: "Aug",
  4320. sep: "Sep",
  4321. oct: "Oct",
  4322. nov: "Nov",
  4323. dec: "Dec"
  4324. }
  4325. },
  4326. inputNumber: {
  4327. decrease: "decrease number",
  4328. increase: "increase number"
  4329. },
  4330. select: {
  4331. loading: "Loading",
  4332. noMatch: "No matching data",
  4333. noData: "No data",
  4334. placeholder: "Select"
  4335. },
  4336. mention: { loading: "Loading" },
  4337. dropdown: { toggleDropdown: "Toggle Dropdown" },
  4338. cascader: {
  4339. noMatch: "No matching data",
  4340. loading: "Loading",
  4341. placeholder: "Select",
  4342. noData: "No data"
  4343. },
  4344. pagination: {
  4345. goto: "Go to",
  4346. pagesize: "/page",
  4347. total: "Total {total}",
  4348. pageClassifier: "",
  4349. page: "Page",
  4350. prev: "Go to previous page",
  4351. next: "Go to next page",
  4352. currentPage: "page {pager}",
  4353. prevPages: "Previous {pager} pages",
  4354. nextPages: "Next {pager} pages",
  4355. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  4356. },
  4357. dialog: { close: "Close this dialog" },
  4358. drawer: { close: "Close this dialog" },
  4359. messagebox: {
  4360. title: "Message",
  4361. confirm: "OK",
  4362. cancel: "Cancel",
  4363. error: "Illegal input",
  4364. close: "Close this dialog"
  4365. },
  4366. upload: {
  4367. deleteTip: "press delete to remove",
  4368. delete: "Delete",
  4369. preview: "Preview",
  4370. continue: "Continue"
  4371. },
  4372. slider: {
  4373. defaultLabel: "slider between {min} and {max}",
  4374. defaultRangeStartLabel: "pick start value",
  4375. defaultRangeEndLabel: "pick end value"
  4376. },
  4377. table: {
  4378. emptyText: "No Data",
  4379. confirmFilter: "Confirm",
  4380. resetFilter: "Reset",
  4381. clearFilter: "All",
  4382. sumText: "Sum",
  4383. selectAllLabel: "Select all rows",
  4384. selectRowLabel: "Select this row",
  4385. expandRowLabel: "Expand this row",
  4386. collapseRowLabel: "Collapse this row",
  4387. sortLabel: "Sort by {column}",
  4388. filterLabel: "Filter by {column}"
  4389. },
  4390. tag: { close: "Close this tag" },
  4391. tour: {
  4392. next: "Next",
  4393. previous: "Previous",
  4394. finish: "Finish",
  4395. close: "Close this dialog"
  4396. },
  4397. tree: { emptyText: "No Data" },
  4398. transfer: {
  4399. noMatch: "No matching data",
  4400. noData: "No data",
  4401. titles: ["List 1", "List 2"],
  4402. filterPlaceholder: "Enter keyword",
  4403. noCheckedFormat: "{total} items",
  4404. hasCheckedFormat: "{checked}/{total} checked"
  4405. },
  4406. image: { error: "FAILED" },
  4407. pageHeader: { title: "Back" },
  4408. popconfirm: {
  4409. confirmButtonText: "Yes",
  4410. cancelButtonText: "No"
  4411. },
  4412. carousel: {
  4413. leftArrow: "Carousel arrow left",
  4414. rightArrow: "Carousel arrow right",
  4415. indicator: "Carousel switch to index {index}"
  4416. },
  4417. inputOTP: {
  4418. groupLabel: "OTP Input",
  4419. defaultLabel: "Please enter OTP character {index}"
  4420. }
  4421. }
  4422. };
  4423. //#endregion
  4424. //#region ../../packages/hooks/use-locale/index.ts
  4425. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  4426. const translate = (path, option, locale) => get(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => `${option?.[key] ?? `{${key}}`}`);
  4427. const buildLocaleContext = (locale) => {
  4428. return {
  4429. lang: computed(() => unref(locale).name),
  4430. locale: isRef(locale) ? locale : ref(locale),
  4431. t: buildTranslator(locale)
  4432. };
  4433. };
  4434. const localeContextKey = Symbol("localeContextKey");
  4435. const useLocale = (localeOverrides) => {
  4436. const locale = localeOverrides || inject(localeContextKey, ref());
  4437. return buildLocaleContext(computed(() => locale.value || en_default));
  4438. };
  4439. //#endregion
  4440. //#region ../../packages/hooks/use-namespace/index.ts
  4441. const defaultNamespace = "el";
  4442. const statePrefix = "is-";
  4443. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  4444. let cls = `${namespace}-${block}`;
  4445. if (blockSuffix) cls += `-${blockSuffix}`;
  4446. if (element) cls += `__${element}`;
  4447. if (modifier) cls += `--${modifier}`;
  4448. return cls;
  4449. };
  4450. const namespaceContextKey = Symbol("namespaceContextKey");
  4451. const useGetDerivedNamespace = (namespaceOverrides) => {
  4452. const derivedNamespace = namespaceOverrides || (getCurrentInstance() ? inject(namespaceContextKey, ref("el")) : ref("el"));
  4453. return computed(() => {
  4454. return unref(derivedNamespace) || "el";
  4455. });
  4456. };
  4457. const useNamespace = (block, namespaceOverrides) => {
  4458. const namespace = useGetDerivedNamespace(namespaceOverrides);
  4459. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  4460. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  4461. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  4462. const be = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  4463. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  4464. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  4465. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  4466. const is = (name, ...args) => {
  4467. const state = args.length >= 1 ? args[0] : true;
  4468. return name && state ? `${statePrefix}${name}` : "";
  4469. };
  4470. const cssVar = (object) => {
  4471. const styles = {};
  4472. for (const key in object) if (object[key]) styles[`--${namespace.value}-${key}`] = object[key];
  4473. return styles;
  4474. };
  4475. const cssVarBlock = (object) => {
  4476. const styles = {};
  4477. for (const key in object) if (object[key]) styles[`--${namespace.value}-${block}-${key}`] = object[key];
  4478. return styles;
  4479. };
  4480. const cssVarName = (name) => `--${namespace.value}-${name}`;
  4481. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  4482. return {
  4483. namespace,
  4484. b,
  4485. e,
  4486. m,
  4487. be,
  4488. em,
  4489. bm,
  4490. bem,
  4491. is,
  4492. cssVar,
  4493. cssVarName,
  4494. cssVarBlock,
  4495. cssVarBlockName
  4496. };
  4497. };
  4498. //#endregion
  4499. //#region ../../packages/hooks/use-lockscreen/index.ts
  4500. const useLockscreen = (trigger, options = {}) => {
  4501. if (!isRef(trigger)) throwError("[useLockscreen]", "You need to pass a ref param to this function");
  4502. const ns = options.ns || useNamespace("popup");
  4503. const hiddenCls = computed(() => ns.bm("parent", "hidden"));
  4504. let scrollBarWidth = 0;
  4505. let withoutHiddenClass = false;
  4506. let bodyWidth = "0";
  4507. let cleaned = false;
  4508. const cleanup = () => {
  4509. if (cleaned) return;
  4510. cleaned = true;
  4511. setTimeout(() => {
  4512. if (typeof document === "undefined") return;
  4513. if (withoutHiddenClass && document) {
  4514. document.body.style.width = bodyWidth;
  4515. removeClass(document.body, hiddenCls.value);
  4516. }
  4517. }, 200);
  4518. };
  4519. watch(trigger, (val) => {
  4520. if (!val) {
  4521. cleanup();
  4522. return;
  4523. }
  4524. cleaned = false;
  4525. withoutHiddenClass = !hasClass(document.body, hiddenCls.value);
  4526. if (withoutHiddenClass) {
  4527. bodyWidth = document.body.style.width;
  4528. addClass(document.body, hiddenCls.value);
  4529. }
  4530. scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  4531. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  4532. const bodyOverflowY = getStyle(document.body, "overflowY");
  4533. if (scrollBarWidth > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) document.body.style.width = `calc(100% - ${scrollBarWidth}px)`;
  4534. });
  4535. onScopeDispose(() => cleanup());
  4536. };
  4537. //#endregion
  4538. //#region ../../packages/hooks/use-modal/index.ts
  4539. const modalStack = [];
  4540. const closeModal = (e) => {
  4541. if (modalStack.length === 0) return;
  4542. if (getEventCode(e) === EVENT_CODE.esc) {
  4543. e.stopPropagation();
  4544. modalStack[modalStack.length - 1].handleClose();
  4545. }
  4546. };
  4547. const useModal = (instance, visibleRef) => {
  4548. watch(visibleRef, (val) => {
  4549. if (val) modalStack.push(instance);
  4550. else modalStack.splice(modalStack.indexOf(instance), 1);
  4551. });
  4552. };
  4553. if (isClient) useEventListener(document, "keydown", closeModal);
  4554. //#endregion
  4555. //#region ../../packages/hooks/use-model-toggle/index.ts
  4556. const _prop = buildProp({
  4557. type: definePropType(Boolean),
  4558. default: null
  4559. });
  4560. const _event = buildProp({ type: definePropType(Function) });
  4561. const createModelToggleComposable = (name) => {
  4562. const updateEventKey = `update:${name}`;
  4563. const updateEventKeyRaw = `onUpdate:${name}`;
  4564. const useModelToggleEmits = [updateEventKey];
  4565. const useModelToggleProps = {
  4566. [name]: _prop,
  4567. [updateEventKeyRaw]: _event
  4568. };
  4569. const useModelToggle = ({ indicator, toggleReason, shouldHideWhenRouteChanges, shouldProceed, onShow, onHide }) => {
  4570. const instance = getCurrentInstance();
  4571. const { emit } = instance;
  4572. const props = instance.props;
  4573. const hasUpdateHandler = computed(() => isFunction$1(props[updateEventKeyRaw]));
  4574. const isModelBindingAbsent = computed(() => props[name] === null);
  4575. const doShow = (event) => {
  4576. if (indicator.value === true) return;
  4577. indicator.value = true;
  4578. if (toggleReason) toggleReason.value = event;
  4579. if (isFunction$1(onShow)) onShow(event);
  4580. };
  4581. const doHide = (event) => {
  4582. if (indicator.value === false) return;
  4583. indicator.value = false;
  4584. if (toggleReason) toggleReason.value = event;
  4585. if (isFunction$1(onHide)) onHide(event);
  4586. };
  4587. const show = (event) => {
  4588. if (props.disabled === true || isFunction$1(shouldProceed) && !shouldProceed()) return;
  4589. const shouldEmit = hasUpdateHandler.value && isClient;
  4590. if (shouldEmit) emit(updateEventKey, true);
  4591. if (isModelBindingAbsent.value || !shouldEmit) doShow(event);
  4592. };
  4593. const hide = (event) => {
  4594. if (props.disabled === true || !isClient) return;
  4595. const shouldEmit = hasUpdateHandler.value && isClient;
  4596. if (shouldEmit) emit(updateEventKey, false);
  4597. if (isModelBindingAbsent.value || !shouldEmit) doHide(event);
  4598. };
  4599. const onChange = (val) => {
  4600. if (!isBoolean(val)) return;
  4601. if (props.disabled && val) {
  4602. if (hasUpdateHandler.value) emit(updateEventKey, false);
  4603. } else if (indicator.value !== val) if (val) doShow();
  4604. else doHide();
  4605. };
  4606. const toggle = () => {
  4607. if (indicator.value) hide();
  4608. else show();
  4609. };
  4610. watch(() => props[name], onChange);
  4611. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) watch(() => ({ ...instance.proxy.$route }), () => {
  4612. if (shouldHideWhenRouteChanges.value && indicator.value) hide();
  4613. });
  4614. onMounted(() => {
  4615. onChange(props[name]);
  4616. });
  4617. return {
  4618. hide,
  4619. show,
  4620. toggle,
  4621. hasUpdateHandler
  4622. };
  4623. };
  4624. return {
  4625. useModelToggle,
  4626. useModelToggleProps,
  4627. useModelToggleEmits
  4628. };
  4629. };
  4630. const { useModelToggle, useModelToggleProps, useModelToggleEmits } = createModelToggleComposable("modelValue");
  4631. //#endregion
  4632. //#region ../../packages/hooks/use-prevent-global/index.ts
  4633. const usePreventGlobal = (indicator, evt, cb) => {
  4634. const prevent = (e) => {
  4635. if (cb(e)) e.stopImmediatePropagation();
  4636. };
  4637. let stop = void 0;
  4638. watch(() => indicator.value, (val) => {
  4639. if (val) stop = useEventListener(document, evt, prevent, true);
  4640. else stop?.();
  4641. }, { immediate: true });
  4642. };
  4643. //#endregion
  4644. //#region ../../packages/hooks/use-prop/index.ts
  4645. const useProp = (name) => {
  4646. const vm = getCurrentInstance();
  4647. return computed(() => (vm?.proxy?.$props)?.[name]);
  4648. };
  4649. //#endregion
  4650. //#region ../../node_modules/.pnpm/@sxzz+popperjs-es@2.11.8/node_modules/@sxzz/popperjs-es/dist/index.mjs
  4651. var L = "top", W = "bottom", T$1 = "right", P$1 = "left", me = "auto", Q = [
  4652. "top",
  4653. W,
  4654. T$1,
  4655. P$1
  4656. ], Y$1 = "start", Z = "end", Ye = "clippingParents", je = "viewport", ee = "popper", Ge = "reference", De = Q.reduce(function(e, t) {
  4657. return e.concat([t + "-" + Y$1, t + "-" + "end"]);
  4658. }, []), Ee = [].concat(Q, [me]).reduce(function(e, t) {
  4659. return e.concat([
  4660. t,
  4661. t + "-" + Y$1,
  4662. t + "-" + "end"
  4663. ]);
  4664. }, []), Je = "beforeRead", Ke = "read", Qe = "afterRead", Ze = "beforeMain", et = "main", tt = "afterMain", nt = "beforeWrite", rt = "write", ot = "afterWrite", it = [
  4665. Je,
  4666. Ke,
  4667. Qe,
  4668. Ze,
  4669. et,
  4670. tt,
  4671. nt,
  4672. rt,
  4673. ot
  4674. ];
  4675. function V(e) {
  4676. return e ? (e.nodeName || "").toLowerCase() : null;
  4677. }
  4678. function B(e) {
  4679. if (e == null) return window;
  4680. if (e.toString() !== "[object Window]") {
  4681. var t = e.ownerDocument;
  4682. return t && t.defaultView || window;
  4683. }
  4684. return e;
  4685. }
  4686. function G(e) {
  4687. return e instanceof B(e).Element || e instanceof Element;
  4688. }
  4689. function R(e) {
  4690. return e instanceof B(e).HTMLElement || e instanceof HTMLElement;
  4691. }
  4692. function Ae(e) {
  4693. if (typeof ShadowRoot == "undefined") return !1;
  4694. return e instanceof B(e).ShadowRoot || e instanceof ShadowRoot;
  4695. }
  4696. function Tt(e) {
  4697. var t = e.state;
  4698. Object.keys(t.elements).forEach(function(n) {
  4699. var r = t.styles[n] || {}, o = t.attributes[n] || {}, a = t.elements[n];
  4700. !R(a) || !V(a) || (Object.assign(a.style, r), Object.keys(o).forEach(function(c) {
  4701. var s = o[c];
  4702. s === !1 ? a.removeAttribute(c) : a.setAttribute(c, s === !0 ? "" : s);
  4703. }));
  4704. });
  4705. }
  4706. function Bt(e) {
  4707. var t = e.state, n = {
  4708. popper: {
  4709. position: t.options.strategy,
  4710. left: "0",
  4711. top: "0",
  4712. margin: "0"
  4713. },
  4714. arrow: { position: "absolute" },
  4715. reference: {}
  4716. };
  4717. return Object.assign(t.elements.popper.style, n.popper), t.styles = n, t.elements.arrow && Object.assign(t.elements.arrow.style, n.arrow), function() {
  4718. Object.keys(t.elements).forEach(function(r) {
  4719. var o = t.elements[r], a = t.attributes[r] || {}, s = Object.keys(t.styles.hasOwnProperty(r) ? t.styles[r] : n[r]).reduce(function(i, f) {
  4720. return i[f] = "", i;
  4721. }, {});
  4722. !R(o) || !V(o) || (Object.assign(o.style, s), Object.keys(a).forEach(function(i) {
  4723. o.removeAttribute(i);
  4724. }));
  4725. });
  4726. };
  4727. }
  4728. var ke = {
  4729. name: "applyStyles",
  4730. enabled: !0,
  4731. phase: "write",
  4732. fn: Tt,
  4733. effect: Bt,
  4734. requires: ["computeStyles"]
  4735. };
  4736. function C(e) {
  4737. return e.split("-")[0];
  4738. }
  4739. var J = Math.max, ve = Math.min, te = Math.round;
  4740. function Le() {
  4741. var e = navigator.userAgentData;
  4742. return e != null && e.brands && Array.isArray(e.brands) ? e.brands.map(function(t) {
  4743. return t.brand + "/" + t.version;
  4744. }).join(" ") : navigator.userAgent;
  4745. }
  4746. function at() {
  4747. return !/^((?!chrome|android).)*safari/i.test(Le());
  4748. }
  4749. function ne(e, t, n) {
  4750. t === void 0 && (t = !1), n === void 0 && (n = !1);
  4751. var r = e.getBoundingClientRect(), o = 1, a = 1;
  4752. t && R(e) && (o = e.offsetWidth > 0 && te(r.width) / e.offsetWidth || 1, a = e.offsetHeight > 0 && te(r.height) / e.offsetHeight || 1);
  4753. var s = (G(e) ? B(e) : window).visualViewport, i = !at() && n, f = (r.left + (i && s ? s.offsetLeft : 0)) / o, u = (r.top + (i && s ? s.offsetTop : 0)) / a, m = r.width / o, h = r.height / a;
  4754. return {
  4755. width: m,
  4756. height: h,
  4757. top: u,
  4758. right: f + m,
  4759. bottom: u + h,
  4760. left: f,
  4761. x: f,
  4762. y: u
  4763. };
  4764. }
  4765. function Pe(e) {
  4766. var t = ne(e), n = e.offsetWidth, r = e.offsetHeight;
  4767. return Math.abs(t.width - n) <= 1 && (n = t.width), Math.abs(t.height - r) <= 1 && (r = t.height), {
  4768. x: e.offsetLeft,
  4769. y: e.offsetTop,
  4770. width: n,
  4771. height: r
  4772. };
  4773. }
  4774. function st(e, t) {
  4775. var n = t.getRootNode && t.getRootNode();
  4776. if (e.contains(t)) return !0;
  4777. if (n && Ae(n)) {
  4778. var r = t;
  4779. do {
  4780. if (r && e.isSameNode(r)) return !0;
  4781. r = r.parentNode || r.host;
  4782. } while (r);
  4783. }
  4784. return !1;
  4785. }
  4786. function I$1(e) {
  4787. return B(e).getComputedStyle(e);
  4788. }
  4789. function Rt(e) {
  4790. return [
  4791. "table",
  4792. "td",
  4793. "th"
  4794. ].indexOf(V(e)) >= 0;
  4795. }
  4796. function N$1(e) {
  4797. return ((G(e) ? e.ownerDocument : e.document) || window.document).documentElement;
  4798. }
  4799. function ye(e) {
  4800. return V(e) === "html" ? e : e.assignedSlot || e.parentNode || (Ae(e) ? e.host : null) || N$1(e);
  4801. }
  4802. function ft(e) {
  4803. return !R(e) || I$1(e).position === "fixed" ? null : e.offsetParent;
  4804. }
  4805. function Ht(e) {
  4806. var t = /firefox/i.test(Le());
  4807. if (/Trident/i.test(Le()) && R(e)) {
  4808. if (I$1(e).position === "fixed") return null;
  4809. }
  4810. var o = ye(e);
  4811. for (Ae(o) && (o = o.host); R(o) && ["html", "body"].indexOf(V(o)) < 0;) {
  4812. var a = I$1(o);
  4813. if (a.transform !== "none" || a.perspective !== "none" || a.contain === "paint" || ["transform", "perspective"].indexOf(a.willChange) !== -1 || t && a.willChange === "filter" || t && a.filter && a.filter !== "none") return o;
  4814. o = o.parentNode;
  4815. }
  4816. return null;
  4817. }
  4818. function se(e) {
  4819. for (var t = B(e), n = ft(e); n && Rt(n) && I$1(n).position === "static";) n = ft(n);
  4820. return n && (V(n) === "html" || V(n) === "body" && I$1(n).position === "static") ? t : n || Ht(e) || t;
  4821. }
  4822. function Me(e) {
  4823. return ["top", "bottom"].indexOf(e) >= 0 ? "x" : "y";
  4824. }
  4825. function fe(e, t, n) {
  4826. return J(e, ve(t, n));
  4827. }
  4828. function St(e, t, n) {
  4829. var r = fe(e, t, n);
  4830. return r > n ? n : r;
  4831. }
  4832. function ct() {
  4833. return {
  4834. top: 0,
  4835. right: 0,
  4836. bottom: 0,
  4837. left: 0
  4838. };
  4839. }
  4840. function ut(e) {
  4841. return Object.assign({}, ct(), e);
  4842. }
  4843. function pt(e, t) {
  4844. return t.reduce(function(n, r) {
  4845. return n[r] = e, n;
  4846. }, {});
  4847. }
  4848. var Vt = function(e, t) {
  4849. return e = typeof e == "function" ? e(Object.assign({}, t.rects, { placement: t.placement })) : e, ut(typeof e != "number" ? e : pt(e, Q));
  4850. };
  4851. function Ct(e) {
  4852. var t, n = e.state, r = e.name, o = e.options, a = n.elements.arrow, c = n.modifiersData.popperOffsets, s = C(n.placement), i = Me(s), u = ["left", "right"].indexOf(s) >= 0 ? "height" : "width";
  4853. if (!(!a || !c)) {
  4854. var m = Vt(o.padding, n), h = Pe(a), l = i === "y" ? "top" : P$1, g = i === "y" ? W : T$1, p = n.rects.reference[u] + n.rects.reference[i] - c[i] - n.rects.popper[u], y = c[i] - n.rects.reference[i], b = se(a), x = b ? i === "y" ? b.clientHeight || 0 : b.clientWidth || 0 : 0, O = p / 2 - y / 2, d = m[l], v = x - h[u] - m[g], w = x / 2 - h[u] / 2 + O, $ = fe(d, w, v), j = i;
  4855. n.modifiersData[r] = (t = {}, t[j] = $, t.centerOffset = $ - w, t);
  4856. }
  4857. }
  4858. function qt(e) {
  4859. var t = e.state, r = e.options.element, o = r === void 0 ? "[data-popper-arrow]" : r;
  4860. o != null && (typeof o == "string" && (o = t.elements.popper.querySelector(o), !o) || st(t.elements.popper, o) && (t.elements.arrow = o));
  4861. }
  4862. var lt = {
  4863. name: "arrow",
  4864. enabled: !0,
  4865. phase: "main",
  4866. fn: Ct,
  4867. effect: qt,
  4868. requires: ["popperOffsets"],
  4869. requiresIfExists: ["preventOverflow"]
  4870. };
  4871. function re(e) {
  4872. return e.split("-")[1];
  4873. }
  4874. var It = {
  4875. top: "auto",
  4876. right: "auto",
  4877. bottom: "auto",
  4878. left: "auto"
  4879. };
  4880. function Nt(e, t) {
  4881. var n = e.x, r = e.y, o = t.devicePixelRatio || 1;
  4882. return {
  4883. x: te(n * o) / o || 0,
  4884. y: te(r * o) / o || 0
  4885. };
  4886. }
  4887. function dt(e) {
  4888. var t, n = e.popper, r = e.popperRect, o = e.placement, a = e.variation, c = e.offsets, s = e.position, i = e.gpuAcceleration, f = e.adaptive, u = e.roundOffsets, m = e.isFixed, h = c.x, l = h === void 0 ? 0 : h, g = c.y, p = g === void 0 ? 0 : g, y = typeof u == "function" ? u({
  4889. x: l,
  4890. y: p
  4891. }) : {
  4892. x: l,
  4893. y: p
  4894. };
  4895. l = y.x, p = y.y;
  4896. var b = c.hasOwnProperty("x"), x = c.hasOwnProperty("y"), O = P$1, d = "top", v = window;
  4897. if (f) {
  4898. var w = se(n), $ = "clientHeight", j = "clientWidth";
  4899. if (w === B(n) && (w = N$1(n), I$1(w).position !== "static" && s === "absolute" && ($ = "scrollHeight", j = "scrollWidth")), w = w, o === "top" || (o === "left" || o === "right") && a === "end") {
  4900. d = W;
  4901. var D = m && w === v && v.visualViewport ? v.visualViewport.height : w[$];
  4902. p -= D - r.height, p *= i ? 1 : -1;
  4903. }
  4904. if (o === "left" || (o === "top" || o === "bottom") && a === "end") {
  4905. O = T$1;
  4906. var E = m && w === v && v.visualViewport ? v.visualViewport.width : w[j];
  4907. l -= E - r.width, l *= i ? 1 : -1;
  4908. }
  4909. }
  4910. var A = Object.assign({ position: s }, f && It), H = u === !0 ? Nt({
  4911. x: l,
  4912. y: p
  4913. }, B(n)) : {
  4914. x: l,
  4915. y: p
  4916. };
  4917. if (l = H.x, p = H.y, i) {
  4918. var k;
  4919. return Object.assign({}, A, (k = {}, k[d] = x ? "0" : "", k[O] = b ? "0" : "", k.transform = (v.devicePixelRatio || 1) <= 1 ? "translate(" + l + "px, " + p + "px)" : "translate3d(" + l + "px, " + p + "px, 0)", k));
  4920. }
  4921. return Object.assign({}, A, (t = {}, t[d] = x ? p + "px" : "", t[O] = b ? l + "px" : "", t.transform = "", t));
  4922. }
  4923. function Ft(e) {
  4924. var t = e.state, n = e.options, r = n.gpuAcceleration, o = r === void 0 ? !0 : r, a = n.adaptive, c = a === void 0 ? !0 : a, s = n.roundOffsets, i = s === void 0 ? !0 : s, f = {
  4925. placement: C(t.placement),
  4926. variation: re(t.placement),
  4927. popper: t.elements.popper,
  4928. popperRect: t.rects.popper,
  4929. gpuAcceleration: o,
  4930. isFixed: t.options.strategy === "fixed"
  4931. };
  4932. t.modifiersData.popperOffsets != null && (t.styles.popper = Object.assign({}, t.styles.popper, dt(Object.assign({}, f, {
  4933. offsets: t.modifiersData.popperOffsets,
  4934. position: t.options.strategy,
  4935. adaptive: c,
  4936. roundOffsets: i
  4937. })))), t.modifiersData.arrow != null && (t.styles.arrow = Object.assign({}, t.styles.arrow, dt(Object.assign({}, f, {
  4938. offsets: t.modifiersData.arrow,
  4939. position: "absolute",
  4940. adaptive: !1,
  4941. roundOffsets: i
  4942. })))), t.attributes.popper = Object.assign({}, t.attributes.popper, { "data-popper-placement": t.placement });
  4943. }
  4944. var We = {
  4945. name: "computeStyles",
  4946. enabled: !0,
  4947. phase: "beforeWrite",
  4948. fn: Ft,
  4949. data: {}
  4950. }, ge = { passive: !0 };
  4951. function Ut(e) {
  4952. var t = e.state, n = e.instance, r = e.options, o = r.scroll, a = o === void 0 ? !0 : o, c = r.resize, s = c === void 0 ? !0 : c, i = B(t.elements.popper), f = [].concat(t.scrollParents.reference, t.scrollParents.popper);
  4953. return a && f.forEach(function(u) {
  4954. u.addEventListener("scroll", n.update, ge);
  4955. }), s && i.addEventListener("resize", n.update, ge), function() {
  4956. a && f.forEach(function(u) {
  4957. u.removeEventListener("scroll", n.update, ge);
  4958. }), s && i.removeEventListener("resize", n.update, ge);
  4959. };
  4960. }
  4961. var Te = {
  4962. name: "eventListeners",
  4963. enabled: !0,
  4964. phase: "write",
  4965. fn: function() {},
  4966. effect: Ut,
  4967. data: {}
  4968. }, _t = {
  4969. left: "right",
  4970. right: "left",
  4971. bottom: "top",
  4972. top: "bottom"
  4973. };
  4974. function be(e) {
  4975. return e.replace(/left|right|bottom|top/g, function(t) {
  4976. return _t[t];
  4977. });
  4978. }
  4979. var zt = {
  4980. start: "end",
  4981. end: "start"
  4982. };
  4983. function ht(e) {
  4984. return e.replace(/start|end/g, function(t) {
  4985. return zt[t];
  4986. });
  4987. }
  4988. function Be(e) {
  4989. var t = B(e);
  4990. return {
  4991. scrollLeft: t.pageXOffset,
  4992. scrollTop: t.pageYOffset
  4993. };
  4994. }
  4995. function Re(e) {
  4996. return ne(N$1(e)).left + Be(e).scrollLeft;
  4997. }
  4998. function Xt(e, t) {
  4999. var n = B(e), r = N$1(e), o = n.visualViewport, a = r.clientWidth, c = r.clientHeight, s = 0, i = 0;
  5000. if (o) {
  5001. a = o.width, c = o.height;
  5002. var f = at();
  5003. (f || !f && t === "fixed") && (s = o.offsetLeft, i = o.offsetTop);
  5004. }
  5005. return {
  5006. width: a,
  5007. height: c,
  5008. x: s + Re(e),
  5009. y: i
  5010. };
  5011. }
  5012. function Yt(e) {
  5013. var t, n = N$1(e), r = Be(e), o = (t = e.ownerDocument) == null ? void 0 : t.body, a = J(n.scrollWidth, n.clientWidth, o ? o.scrollWidth : 0, o ? o.clientWidth : 0), c = J(n.scrollHeight, n.clientHeight, o ? o.scrollHeight : 0, o ? o.clientHeight : 0), s = -r.scrollLeft + Re(e), i = -r.scrollTop;
  5014. return I$1(o || n).direction === "rtl" && (s += J(n.clientWidth, o ? o.clientWidth : 0) - a), {
  5015. width: a,
  5016. height: c,
  5017. x: s,
  5018. y: i
  5019. };
  5020. }
  5021. function He(e) {
  5022. var t = I$1(e), n = t.overflow, r = t.overflowX, o = t.overflowY;
  5023. return /auto|scroll|overlay|hidden/.test(n + o + r);
  5024. }
  5025. function mt(e) {
  5026. return [
  5027. "html",
  5028. "body",
  5029. "#document"
  5030. ].indexOf(V(e)) >= 0 ? e.ownerDocument.body : R(e) && He(e) ? e : mt(ye(e));
  5031. }
  5032. function ce(e, t) {
  5033. var n;
  5034. t === void 0 && (t = []);
  5035. var r = mt(e), o = r === ((n = e.ownerDocument) == null ? void 0 : n.body), a = B(r), c = o ? [a].concat(a.visualViewport || [], He(r) ? r : []) : r, s = t.concat(c);
  5036. return o ? s : s.concat(ce(ye(c)));
  5037. }
  5038. function Se(e) {
  5039. return Object.assign({}, e, {
  5040. left: e.x,
  5041. top: e.y,
  5042. right: e.x + e.width,
  5043. bottom: e.y + e.height
  5044. });
  5045. }
  5046. function Gt(e, t) {
  5047. var n = ne(e, !1, t === "fixed");
  5048. return n.top = n.top + e.clientTop, n.left = n.left + e.clientLeft, n.bottom = n.top + e.clientHeight, n.right = n.left + e.clientWidth, n.width = e.clientWidth, n.height = e.clientHeight, n.x = n.left, n.y = n.top, n;
  5049. }
  5050. function vt(e, t, n) {
  5051. return t === "viewport" ? Se(Xt(e, n)) : G(t) ? Gt(t, n) : Se(Yt(N$1(e)));
  5052. }
  5053. function Jt(e) {
  5054. var t = ce(ye(e)), r = ["absolute", "fixed"].indexOf(I$1(e).position) >= 0 && R(e) ? se(e) : e;
  5055. return G(r) ? t.filter(function(o) {
  5056. return G(o) && st(o, r) && V(o) !== "body";
  5057. }) : [];
  5058. }
  5059. function Kt(e, t, n, r) {
  5060. var o = t === "clippingParents" ? Jt(e) : [].concat(t), a = [].concat(o, [n]), c = a[0], s = a.reduce(function(i, f) {
  5061. var u = vt(e, f, r);
  5062. return i.top = J(u.top, i.top), i.right = ve(u.right, i.right), i.bottom = ve(u.bottom, i.bottom), i.left = J(u.left, i.left), i;
  5063. }, vt(e, c, r));
  5064. return s.width = s.right - s.left, s.height = s.bottom - s.top, s.x = s.left, s.y = s.top, s;
  5065. }
  5066. function yt(e) {
  5067. var t = e.reference, n = e.element, r = e.placement, o = r ? C(r) : null, a = r ? re(r) : null, c = t.x + t.width / 2 - n.width / 2, s = t.y + t.height / 2 - n.height / 2, i;
  5068. switch (o) {
  5069. case "top":
  5070. i = {
  5071. x: c,
  5072. y: t.y - n.height
  5073. };
  5074. break;
  5075. case W:
  5076. i = {
  5077. x: c,
  5078. y: t.y + t.height
  5079. };
  5080. break;
  5081. case T$1:
  5082. i = {
  5083. x: t.x + t.width,
  5084. y: s
  5085. };
  5086. break;
  5087. case P$1:
  5088. i = {
  5089. x: t.x - n.width,
  5090. y: s
  5091. };
  5092. break;
  5093. default: i = {
  5094. x: t.x,
  5095. y: t.y
  5096. };
  5097. }
  5098. var f = o ? Me(o) : null;
  5099. if (f != null) {
  5100. var u = f === "y" ? "height" : "width";
  5101. switch (a) {
  5102. case Y$1:
  5103. i[f] = i[f] - (t[u] / 2 - n[u] / 2);
  5104. break;
  5105. case "end":
  5106. i[f] = i[f] + (t[u] / 2 - n[u] / 2);
  5107. break;
  5108. }
  5109. }
  5110. return i;
  5111. }
  5112. function oe(e, t) {
  5113. t === void 0 && (t = {});
  5114. var n = t, r = n.placement, o = r === void 0 ? e.placement : r, a = n.strategy, c = a === void 0 ? e.strategy : a, s = n.boundary, i = s === void 0 ? Ye : s, f = n.rootBoundary, u = f === void 0 ? je : f, m = n.elementContext, h = m === void 0 ? ee : m, l = n.altBoundary, g = l === void 0 ? !1 : l, p = n.padding, y = p === void 0 ? 0 : p, b = ut(typeof y != "number" ? y : pt(y, Q)), x = h === "popper" ? Ge : ee, O = e.rects.popper, d = e.elements[g ? x : h], v = Kt(G(d) ? d : d.contextElement || N$1(e.elements.popper), i, u, c), w = ne(e.elements.reference), $ = yt({
  5115. reference: w,
  5116. element: O,
  5117. placement: o
  5118. }), j = Se(Object.assign({}, O, $)), D = h === "popper" ? j : w, E = {
  5119. top: v.top - D.top + b.top,
  5120. bottom: D.bottom - v.bottom + b.bottom,
  5121. left: v.left - D.left + b.left,
  5122. right: D.right - v.right + b.right
  5123. }, A = e.modifiersData.offset;
  5124. if (h === "popper" && A) {
  5125. var H = A[o];
  5126. Object.keys(E).forEach(function(k) {
  5127. var F = ["right", "bottom"].indexOf(k) >= 0 ? 1 : -1, U = ["top", "bottom"].indexOf(k) >= 0 ? "y" : "x";
  5128. E[k] += H[U] * F;
  5129. });
  5130. }
  5131. return E;
  5132. }
  5133. function Qt(e, t) {
  5134. t === void 0 && (t = {});
  5135. var n = t, r = n.placement, o = n.boundary, a = n.rootBoundary, c = n.padding, s = n.flipVariations, i = n.allowedAutoPlacements, f = i === void 0 ? Ee : i, u = re(r), m = u ? s ? De : De.filter(function(g) {
  5136. return re(g) === u;
  5137. }) : Q, h = m.filter(function(g) {
  5138. return f.indexOf(g) >= 0;
  5139. });
  5140. h.length === 0 && (h = m);
  5141. var l = h.reduce(function(g, p) {
  5142. return g[p] = oe(e, {
  5143. placement: p,
  5144. boundary: o,
  5145. rootBoundary: a,
  5146. padding: c
  5147. })[C(p)], g;
  5148. }, {});
  5149. return Object.keys(l).sort(function(g, p) {
  5150. return l[g] - l[p];
  5151. });
  5152. }
  5153. function Zt(e) {
  5154. if (C(e) === "auto") return [];
  5155. var t = be(e);
  5156. return [
  5157. ht(e),
  5158. t,
  5159. ht(t)
  5160. ];
  5161. }
  5162. function en(e) {
  5163. var t = e.state, n = e.options, r = e.name;
  5164. if (!t.modifiersData[r]._skip) {
  5165. for (var o = n.mainAxis, a = o === void 0 ? !0 : o, c = n.altAxis, s = c === void 0 ? !0 : c, i = n.fallbackPlacements, f = n.padding, u = n.boundary, m = n.rootBoundary, h = n.altBoundary, l = n.flipVariations, g = l === void 0 ? !0 : l, p = n.allowedAutoPlacements, y = t.options.placement, x = C(y) === y, O = i || (x || !g ? [be(y)] : Zt(y)), d = [y].concat(O).reduce(function(z, q) {
  5166. return z.concat(C(q) === "auto" ? Qt(t, {
  5167. placement: q,
  5168. boundary: u,
  5169. rootBoundary: m,
  5170. padding: f,
  5171. flipVariations: g,
  5172. allowedAutoPlacements: p
  5173. }) : q);
  5174. }, []), v = t.rects.reference, w = t.rects.popper, $ = /* @__PURE__ */ new Map(), j = !0, D = d[0], E = 0; E < d.length; E++) {
  5175. var A = d[E], H = C(A), k = re(A) === Y$1, F = ["top", W].indexOf(H) >= 0, U = F ? "width" : "height", M = oe(t, {
  5176. placement: A,
  5177. boundary: u,
  5178. rootBoundary: m,
  5179. altBoundary: h,
  5180. padding: f
  5181. }), S = F ? k ? T$1 : P$1 : k ? W : "top";
  5182. v[U] > w[U] && (S = be(S));
  5183. var ue = be(S), _ = [];
  5184. if (a && _.push(M[H] <= 0), s && _.push(M[S] <= 0, M[ue] <= 0), _.every(function(z) {
  5185. return z;
  5186. })) {
  5187. D = A, j = !1;
  5188. break;
  5189. }
  5190. $.set(A, _);
  5191. }
  5192. if (j) {
  5193. for (var pe = g ? 3 : 1, xe = function(z) {
  5194. var q = d.find(function(de) {
  5195. var ae = $.get(de);
  5196. if (ae) return ae.slice(0, z).every(function(K) {
  5197. return K;
  5198. });
  5199. });
  5200. if (q) return D = q, "break";
  5201. }, ie = pe; ie > 0; ie--) if (xe(ie) === "break") break;
  5202. }
  5203. t.placement !== D && (t.modifiersData[r]._skip = !0, t.placement = D, t.reset = !0);
  5204. }
  5205. }
  5206. var gt = {
  5207. name: "flip",
  5208. enabled: !0,
  5209. phase: "main",
  5210. fn: en,
  5211. requiresIfExists: ["offset"],
  5212. data: { _skip: !1 }
  5213. };
  5214. function bt(e, t, n) {
  5215. return n === void 0 && (n = {
  5216. x: 0,
  5217. y: 0
  5218. }), {
  5219. top: e.top - t.height - n.y,
  5220. right: e.right - t.width + n.x,
  5221. bottom: e.bottom - t.height + n.y,
  5222. left: e.left - t.width - n.x
  5223. };
  5224. }
  5225. function wt(e) {
  5226. return [
  5227. "top",
  5228. T$1,
  5229. W,
  5230. P$1
  5231. ].some(function(t) {
  5232. return e[t] >= 0;
  5233. });
  5234. }
  5235. function tn(e) {
  5236. var t = e.state, n = e.name, r = t.rects.reference, o = t.rects.popper, a = t.modifiersData.preventOverflow, c = oe(t, { elementContext: "reference" }), s = oe(t, { altBoundary: !0 }), i = bt(c, r), f = bt(s, o, a), u = wt(i), m = wt(f);
  5237. t.modifiersData[n] = {
  5238. referenceClippingOffsets: i,
  5239. popperEscapeOffsets: f,
  5240. isReferenceHidden: u,
  5241. hasPopperEscaped: m
  5242. }, t.attributes.popper = Object.assign({}, t.attributes.popper, {
  5243. "data-popper-reference-hidden": u,
  5244. "data-popper-escaped": m
  5245. });
  5246. }
  5247. var xt = {
  5248. name: "hide",
  5249. enabled: !0,
  5250. phase: "main",
  5251. requiresIfExists: ["preventOverflow"],
  5252. fn: tn
  5253. };
  5254. function nn(e, t, n) {
  5255. var r = C(e), o = ["left", "top"].indexOf(r) >= 0 ? -1 : 1, a = typeof n == "function" ? n(Object.assign({}, t, { placement: e })) : n, c = a[0], s = a[1];
  5256. return c = c || 0, s = (s || 0) * o, ["left", "right"].indexOf(r) >= 0 ? {
  5257. x: s,
  5258. y: c
  5259. } : {
  5260. x: c,
  5261. y: s
  5262. };
  5263. }
  5264. function rn(e) {
  5265. var t = e.state, n = e.options, r = e.name, o = n.offset, a = o === void 0 ? [0, 0] : o, c = Ee.reduce(function(u, m) {
  5266. return u[m] = nn(m, t.rects, a), u;
  5267. }, {}), s = c[t.placement], i = s.x, f = s.y;
  5268. t.modifiersData.popperOffsets != null && (t.modifiersData.popperOffsets.x += i, t.modifiersData.popperOffsets.y += f), t.modifiersData[r] = c;
  5269. }
  5270. var Ot = {
  5271. name: "offset",
  5272. enabled: !0,
  5273. phase: "main",
  5274. requires: ["popperOffsets"],
  5275. fn: rn
  5276. };
  5277. function on(e) {
  5278. var t = e.state, n = e.name;
  5279. t.modifiersData[n] = yt({
  5280. reference: t.rects.reference,
  5281. element: t.rects.popper,
  5282. placement: t.placement
  5283. });
  5284. }
  5285. var Ve = {
  5286. name: "popperOffsets",
  5287. enabled: !0,
  5288. phase: "read",
  5289. fn: on,
  5290. data: {}
  5291. };
  5292. function an(e) {
  5293. return e === "x" ? "y" : "x";
  5294. }
  5295. function sn(e) {
  5296. var t = e.state, n = e.options, r = e.name, o = n.mainAxis, a = o === void 0 ? !0 : o, c = n.altAxis, s = c === void 0 ? !1 : c, i = n.boundary, f = n.rootBoundary, u = n.altBoundary, m = n.padding, h = n.tether, l = h === void 0 ? !0 : h, g = n.tetherOffset, p = g === void 0 ? 0 : g, y = oe(t, {
  5297. boundary: i,
  5298. rootBoundary: f,
  5299. padding: m,
  5300. altBoundary: u
  5301. }), b = C(t.placement), x = re(t.placement), O = !x, d = Me(b), v = an(d), w = t.modifiersData.popperOffsets, $ = t.rects.reference, j = t.rects.popper, D = typeof p == "function" ? p(Object.assign({}, t.rects, { placement: t.placement })) : p, E = typeof D == "number" ? {
  5302. mainAxis: D,
  5303. altAxis: D
  5304. } : Object.assign({
  5305. mainAxis: 0,
  5306. altAxis: 0
  5307. }, D), A = t.modifiersData.offset ? t.modifiersData.offset[t.placement] : null, H = {
  5308. x: 0,
  5309. y: 0
  5310. };
  5311. if (w) {
  5312. if (a) {
  5313. var k, F = d === "y" ? "top" : P$1, U = d === "y" ? W : T$1, M = d === "y" ? "height" : "width", S = w[d], ue = S + y[F], _ = S - y[U], pe = l ? -j[M] / 2 : 0, xe = x === "start" ? $[M] : j[M], ie = x === "start" ? -j[M] : -$[M], le = t.elements.arrow, z = l && le ? Pe(le) : {
  5314. width: 0,
  5315. height: 0
  5316. }, q = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : ct(), de = q[F], ae = q[U], K = fe(0, $[M], z[M]), Et = O ? $[M] / 2 - pe - K - de - E.mainAxis : xe - K - de - E.mainAxis, At = O ? -$[M] / 2 + pe + K + ae + E.mainAxis : ie + K + ae + E.mainAxis, Oe = t.elements.arrow && se(t.elements.arrow), kt = Oe ? d === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, Ce = (k = A == null ? void 0 : A[d]) != null ? k : 0, Lt = S + Et - Ce - kt, Pt = S + At - Ce, qe = fe(l ? ve(ue, Lt) : ue, S, l ? J(_, Pt) : _);
  5317. w[d] = qe, H[d] = qe - S;
  5318. }
  5319. if (s) {
  5320. var Ie, Mt = d === "x" ? "top" : P$1, Wt = d === "x" ? W : T$1, X = w[v], he = v === "y" ? "height" : "width", Ne = X + y[Mt], Fe = X - y[Wt], $e = ["top", P$1].indexOf(b) !== -1, Ue = (Ie = A == null ? void 0 : A[v]) != null ? Ie : 0, _e = $e ? Ne : X - $[he] - j[he] - Ue + E.altAxis, ze = $e ? X + $[he] + j[he] - Ue - E.altAxis : Fe, Xe = l && $e ? St(_e, X, ze) : fe(l ? _e : Ne, X, l ? ze : Fe);
  5321. w[v] = Xe, H[v] = Xe - X;
  5322. }
  5323. t.modifiersData[r] = H;
  5324. }
  5325. }
  5326. var $t = {
  5327. name: "preventOverflow",
  5328. enabled: !0,
  5329. phase: "main",
  5330. fn: sn,
  5331. requiresIfExists: ["offset"]
  5332. };
  5333. function fn(e) {
  5334. return {
  5335. scrollLeft: e.scrollLeft,
  5336. scrollTop: e.scrollTop
  5337. };
  5338. }
  5339. function cn(e) {
  5340. return e === B(e) || !R(e) ? Be(e) : fn(e);
  5341. }
  5342. function un(e) {
  5343. var t = e.getBoundingClientRect(), n = te(t.width) / e.offsetWidth || 1, r = te(t.height) / e.offsetHeight || 1;
  5344. return n !== 1 || r !== 1;
  5345. }
  5346. function pn(e, t, n) {
  5347. n === void 0 && (n = !1);
  5348. var r = R(t), o = R(t) && un(t), a = N$1(t), c = ne(e, o, n), s = {
  5349. scrollLeft: 0,
  5350. scrollTop: 0
  5351. }, i = {
  5352. x: 0,
  5353. y: 0
  5354. };
  5355. return (r || !r && !n) && ((V(t) !== "body" || He(a)) && (s = cn(t)), R(t) ? (i = ne(t, !0), i.x += t.clientLeft, i.y += t.clientTop) : a && (i.x = Re(a))), {
  5356. x: c.left + s.scrollLeft - i.x,
  5357. y: c.top + s.scrollTop - i.y,
  5358. width: c.width,
  5359. height: c.height
  5360. };
  5361. }
  5362. function ln(e) {
  5363. var t = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r = [];
  5364. e.forEach(function(a) {
  5365. t.set(a.name, a);
  5366. });
  5367. function o(a) {
  5368. n.add(a.name);
  5369. [].concat(a.requires || [], a.requiresIfExists || []).forEach(function(s) {
  5370. if (!n.has(s)) {
  5371. var i = t.get(s);
  5372. i && o(i);
  5373. }
  5374. }), r.push(a);
  5375. }
  5376. return e.forEach(function(a) {
  5377. n.has(a.name) || o(a);
  5378. }), r;
  5379. }
  5380. function dn(e) {
  5381. var t = ln(e);
  5382. return it.reduce(function(n, r) {
  5383. return n.concat(t.filter(function(o) {
  5384. return o.phase === r;
  5385. }));
  5386. }, []);
  5387. }
  5388. function hn(e) {
  5389. var t;
  5390. return function() {
  5391. return t || (t = new Promise(function(n) {
  5392. Promise.resolve().then(function() {
  5393. t = void 0, n(e());
  5394. });
  5395. })), t;
  5396. };
  5397. }
  5398. function mn(e) {
  5399. var t = e.reduce(function(n, r) {
  5400. var o = n[r.name];
  5401. return n[r.name] = o ? Object.assign({}, o, r, {
  5402. options: Object.assign({}, o.options, r.options),
  5403. data: Object.assign({}, o.data, r.data)
  5404. }) : r, n;
  5405. }, {});
  5406. return Object.keys(t).map(function(n) {
  5407. return t[n];
  5408. });
  5409. }
  5410. var jt = {
  5411. placement: "bottom",
  5412. modifiers: [],
  5413. strategy: "absolute"
  5414. };
  5415. function Dt() {
  5416. for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];
  5417. return !t.some(function(r) {
  5418. return !(r && typeof r.getBoundingClientRect == "function");
  5419. });
  5420. }
  5421. function we(e) {
  5422. e === void 0 && (e = {});
  5423. var t = e, n = t.defaultModifiers, r = n === void 0 ? [] : n, o = t.defaultOptions, a = o === void 0 ? jt : o;
  5424. return function(c, s, i) {
  5425. i === void 0 && (i = a);
  5426. var f = {
  5427. placement: "bottom",
  5428. orderedModifiers: [],
  5429. options: Object.assign({}, jt, a),
  5430. modifiersData: {},
  5431. elements: {
  5432. reference: c,
  5433. popper: s
  5434. },
  5435. attributes: {},
  5436. styles: {}
  5437. }, u = [], m = !1, h = {
  5438. state: f,
  5439. setOptions: function(p) {
  5440. var y = typeof p == "function" ? p(f.options) : p;
  5441. g(), f.options = Object.assign({}, a, f.options, y), f.scrollParents = {
  5442. reference: G(c) ? ce(c) : c.contextElement ? ce(c.contextElement) : [],
  5443. popper: ce(s)
  5444. };
  5445. var b = dn(mn([].concat(r, f.options.modifiers)));
  5446. return f.orderedModifiers = b.filter(function(x) {
  5447. return x.enabled;
  5448. }), l(), h.update();
  5449. },
  5450. forceUpdate: function() {
  5451. if (!m) {
  5452. var p = f.elements, y = p.reference, b = p.popper;
  5453. if (Dt(y, b)) {
  5454. f.rects = {
  5455. reference: pn(y, se(b), f.options.strategy === "fixed"),
  5456. popper: Pe(b)
  5457. }, f.reset = !1, f.placement = f.options.placement, f.orderedModifiers.forEach(function(j) {
  5458. return f.modifiersData[j.name] = Object.assign({}, j.data);
  5459. });
  5460. for (var x = 0; x < f.orderedModifiers.length; x++) {
  5461. if (f.reset === !0) {
  5462. f.reset = !1, x = -1;
  5463. continue;
  5464. }
  5465. var O = f.orderedModifiers[x], d = O.fn, v = O.options, w = v === void 0 ? {} : v, $ = O.name;
  5466. typeof d == "function" && (f = d({
  5467. state: f,
  5468. options: w,
  5469. name: $,
  5470. instance: h
  5471. }) || f);
  5472. }
  5473. }
  5474. }
  5475. },
  5476. update: hn(function() {
  5477. return new Promise(function(p) {
  5478. h.forceUpdate(), p(f);
  5479. });
  5480. }),
  5481. destroy: function() {
  5482. g(), m = !0;
  5483. }
  5484. };
  5485. if (!Dt(c, s)) return h;
  5486. h.setOptions(i).then(function(p) {
  5487. !m && i.onFirstUpdate && i.onFirstUpdate(p);
  5488. });
  5489. function l() {
  5490. f.orderedModifiers.forEach(function(p) {
  5491. var y = p.name, b = p.options, x = b === void 0 ? {} : b, O = p.effect;
  5492. if (typeof O == "function") {
  5493. var d = O({
  5494. state: f,
  5495. name: y,
  5496. instance: h,
  5497. options: x
  5498. }), v = function() {};
  5499. u.push(d || v);
  5500. }
  5501. });
  5502. }
  5503. function g() {
  5504. u.forEach(function(p) {
  5505. return p();
  5506. }), u = [];
  5507. }
  5508. return h;
  5509. };
  5510. }
  5511. var vn = we(), gn = we({ defaultModifiers: [
  5512. Te,
  5513. Ve,
  5514. We,
  5515. ke
  5516. ] }), wn = we({ defaultModifiers: [
  5517. Te,
  5518. Ve,
  5519. We,
  5520. ke,
  5521. Ot,
  5522. gt,
  5523. $t,
  5524. lt,
  5525. xt
  5526. ] });
  5527. //#endregion
  5528. //#region ../../packages/hooks/use-popper/index.ts
  5529. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  5530. const stateUpdater = {
  5531. name: "updateState",
  5532. enabled: true,
  5533. phase: "write",
  5534. fn: ({ state }) => {
  5535. const derivedState = deriveState(state);
  5536. Object.assign(states.value, derivedState);
  5537. },
  5538. requires: ["computeStyles"]
  5539. };
  5540. const options = computed(() => {
  5541. const { onFirstUpdate, placement, strategy, modifiers } = unref(opts);
  5542. return {
  5543. onFirstUpdate,
  5544. placement: placement || "bottom",
  5545. strategy: strategy || "absolute",
  5546. modifiers: [
  5547. ...modifiers || [],
  5548. stateUpdater,
  5549. {
  5550. name: "applyStyles",
  5551. enabled: false
  5552. }
  5553. ]
  5554. };
  5555. });
  5556. const instanceRef = shallowRef();
  5557. const states = ref({
  5558. styles: {
  5559. popper: {
  5560. position: unref(options).strategy,
  5561. left: "0",
  5562. top: "0"
  5563. },
  5564. arrow: { position: "absolute" }
  5565. },
  5566. attributes: {}
  5567. });
  5568. const destroy = () => {
  5569. if (!instanceRef.value) return;
  5570. instanceRef.value.destroy();
  5571. instanceRef.value = void 0;
  5572. };
  5573. watch(options, (newOptions) => {
  5574. const instance = unref(instanceRef);
  5575. if (instance) instance.setOptions(newOptions);
  5576. }, { deep: true });
  5577. watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  5578. destroy();
  5579. if (!referenceElement || !popperElement) return;
  5580. instanceRef.value = wn(referenceElement, popperElement, unref(options));
  5581. });
  5582. onBeforeUnmount(() => {
  5583. destroy();
  5584. });
  5585. return {
  5586. state: computed(() => ({ ...unref(instanceRef)?.state || {} })),
  5587. styles: computed(() => unref(states).styles),
  5588. attributes: computed(() => unref(states).attributes),
  5589. update: () => unref(instanceRef)?.update(),
  5590. forceUpdate: () => unref(instanceRef)?.forceUpdate(),
  5591. instanceRef: computed(() => unref(instanceRef))
  5592. };
  5593. };
  5594. function deriveState(state) {
  5595. const elements = Object.keys(state.elements);
  5596. return {
  5597. styles: fromPairs(elements.map((element) => [element, state.styles[element] || {}])),
  5598. attributes: fromPairs(elements.map((element) => [element, state.attributes[element]]))
  5599. };
  5600. }
  5601. //#endregion
  5602. //#region ../../packages/hooks/use-same-target/index.ts
  5603. const useSameTarget = (handleClick) => {
  5604. if (!handleClick) return {
  5605. onClick: NOOP,
  5606. onMousedown: NOOP,
  5607. onMouseup: NOOP
  5608. };
  5609. let mousedownTarget = false;
  5610. let mouseupTarget = false;
  5611. const onClick = (e) => {
  5612. if (mousedownTarget && mouseupTarget) handleClick(e);
  5613. mousedownTarget = mouseupTarget = false;
  5614. };
  5615. const onMousedown = (e) => {
  5616. mousedownTarget = e.target === e.currentTarget;
  5617. };
  5618. const onMouseup = (e) => {
  5619. mouseupTarget = e.target === e.currentTarget;
  5620. };
  5621. return {
  5622. onClick,
  5623. onMousedown,
  5624. onMouseup
  5625. };
  5626. };
  5627. //#endregion
  5628. //#region ../../packages/hooks/use-teleport/index.ts
  5629. const useTeleport = (contentRenderer, appendToBody) => {
  5630. const isTeleportVisible = ref(false);
  5631. if (!isClient) return {
  5632. isTeleportVisible,
  5633. showTeleport: NOOP,
  5634. hideTeleport: NOOP,
  5635. renderTeleport: NOOP
  5636. };
  5637. let $el = null;
  5638. const showTeleport = () => {
  5639. isTeleportVisible.value = true;
  5640. if ($el !== null) return;
  5641. $el = createGlobalNode();
  5642. };
  5643. const hideTeleport = () => {
  5644. isTeleportVisible.value = false;
  5645. if ($el !== null) {
  5646. removeGlobalNode($el);
  5647. $el = null;
  5648. }
  5649. };
  5650. const renderTeleport = () => {
  5651. return appendToBody.value !== true ? contentRenderer() : isTeleportVisible.value ? [h(Teleport, { to: $el }, contentRenderer())] : void 0;
  5652. };
  5653. onUnmounted(hideTeleport);
  5654. return {
  5655. isTeleportVisible,
  5656. showTeleport,
  5657. hideTeleport,
  5658. renderTeleport
  5659. };
  5660. };
  5661. //#endregion
  5662. //#region ../../packages/hooks/use-throttle-render/index.ts
  5663. const useThrottleRender = (loading, throttle = 0) => {
  5664. if (throttle === 0) return loading;
  5665. const throttled = ref(isObject$1(throttle) && Boolean(throttle.initVal));
  5666. let timeoutHandle = null;
  5667. const dispatchThrottling = (timer) => {
  5668. if (isUndefined(timer)) {
  5669. throttled.value = loading.value;
  5670. return;
  5671. }
  5672. if (timeoutHandle) clearTimeout(timeoutHandle);
  5673. timeoutHandle = setTimeout(() => {
  5674. throttled.value = loading.value;
  5675. }, timer);
  5676. };
  5677. const dispatcher = (type) => {
  5678. if (type === "leading") if (isNumber(throttle)) dispatchThrottling(throttle);
  5679. else dispatchThrottling(throttle.leading);
  5680. else if (isObject$1(throttle)) dispatchThrottling(throttle.trailing);
  5681. else throttled.value = false;
  5682. };
  5683. onMounted(() => dispatcher("leading"));
  5684. watch(() => loading.value, (val) => {
  5685. dispatcher(val ? "leading" : "trailing");
  5686. });
  5687. return throttled;
  5688. };
  5689. //#endregion
  5690. //#region ../../packages/hooks/use-timeout/index.ts
  5691. function useTimeout() {
  5692. let timeoutHandle;
  5693. const registerTimeout = (fn, delay) => {
  5694. cancelTimeout();
  5695. timeoutHandle = globalThis.setTimeout(fn, delay);
  5696. };
  5697. const cancelTimeout = () => {
  5698. if (timeoutHandle === void 0) return;
  5699. globalThis.clearTimeout(timeoutHandle);
  5700. timeoutHandle = void 0;
  5701. };
  5702. tryOnScopeDispose(() => cancelTimeout());
  5703. return {
  5704. registerTimeout,
  5705. cancelTimeout
  5706. };
  5707. }
  5708. //#endregion
  5709. //#region ../../packages/hooks/use-transition-fallthrough/index.ts
  5710. /* istanbul ignore file */
  5711. const AFTER_APPEAR = "after-appear";
  5712. const AFTER_ENTER = "after-enter";
  5713. const AFTER_LEAVE = "after-leave";
  5714. const APPEAR = "appear";
  5715. const APPEAR_CANCELLED = "appear-cancelled";
  5716. const BEFORE_ENTER = "before-enter";
  5717. const BEFORE_LEAVE = "before-leave";
  5718. const ENTER = "enter";
  5719. const ENTER_CANCELLED = "enter-cancelled";
  5720. const LEAVE = "leave";
  5721. const LEAVE_CANCELLED = "leave-cancelled";
  5722. const useTransitionFallthroughEmits = [
  5723. AFTER_APPEAR,
  5724. AFTER_ENTER,
  5725. AFTER_LEAVE,
  5726. APPEAR,
  5727. APPEAR_CANCELLED,
  5728. BEFORE_ENTER,
  5729. BEFORE_LEAVE,
  5730. ENTER,
  5731. ENTER_CANCELLED,
  5732. LEAVE,
  5733. LEAVE_CANCELLED
  5734. ];
  5735. const useTransitionFallthrough = () => {
  5736. const { emit } = getCurrentInstance();
  5737. return {
  5738. onAfterAppear: () => {
  5739. emit(AFTER_APPEAR);
  5740. },
  5741. onAfterEnter: () => {
  5742. emit(AFTER_ENTER);
  5743. },
  5744. onAfterLeave: () => {
  5745. emit(AFTER_LEAVE);
  5746. },
  5747. onAppearCancelled: () => {
  5748. emit(APPEAR_CANCELLED);
  5749. },
  5750. onBeforeEnter: () => {
  5751. emit(BEFORE_ENTER);
  5752. },
  5753. onBeforeLeave: () => {
  5754. emit(BEFORE_LEAVE);
  5755. },
  5756. onEnter: () => {
  5757. emit(ENTER);
  5758. },
  5759. onEnterCancelled: () => {
  5760. emit(ENTER_CANCELLED);
  5761. },
  5762. onLeave: () => {
  5763. emit(LEAVE);
  5764. },
  5765. onLeaveCancelled: () => {
  5766. emit(LEAVE_CANCELLED);
  5767. }
  5768. };
  5769. };
  5770. //#endregion
  5771. //#region ../../packages/hooks/use-id/index.ts
  5772. const defaultIdInjection = {
  5773. prefix: Math.floor(Math.random() * 1e4),
  5774. current: 0
  5775. };
  5776. const ID_INJECTION_KEY = Symbol("elIdInjection");
  5777. const useIdInjection = () => {
  5778. return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  5779. };
  5780. const useId = (deterministicId) => {
  5781. const idInjection = useIdInjection();
  5782. if (!isClient && idInjection === defaultIdInjection) /* @__PURE__ */ debugWarn("IdInjection", `Looks like you are using server rendering, you must provide a id provider to ensure the hydration process to be succeed
  5783. usage: app.provide(ID_INJECTION_KEY, {
  5784. prefix: number,
  5785. current: number,
  5786. })`);
  5787. const namespace = useGetDerivedNamespace();
  5788. return computedEager(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  5789. };
  5790. //#endregion
  5791. //#region ../../packages/hooks/use-escape-keydown/index.ts
  5792. let registeredEscapeHandlers = [];
  5793. const cachedHandler = (event) => {
  5794. if (getEventCode(event) === EVENT_CODE.esc) registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event));
  5795. };
  5796. const useEscapeKeydown = (handler) => {
  5797. onMounted(() => {
  5798. if (registeredEscapeHandlers.length === 0) document.addEventListener("keydown", cachedHandler);
  5799. if (isClient) registeredEscapeHandlers.push(handler);
  5800. });
  5801. onBeforeUnmount(() => {
  5802. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  5803. if (registeredEscapeHandlers.length === 0) {
  5804. if (isClient) document.removeEventListener("keydown", cachedHandler);
  5805. }
  5806. });
  5807. };
  5808. //#endregion
  5809. //#region ../../packages/hooks/use-popper-container/index.ts
  5810. const usePopperContainerId = () => {
  5811. const namespace = useGetDerivedNamespace();
  5812. const idInjection = useIdInjection();
  5813. const id = computed(() => {
  5814. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  5815. });
  5816. return {
  5817. id,
  5818. selector: computed(() => `#${id.value}`)
  5819. };
  5820. };
  5821. const createContainer = (id) => {
  5822. const container = document.createElement("div");
  5823. container.id = id;
  5824. document.body.appendChild(container);
  5825. return container;
  5826. };
  5827. const usePopperContainer = () => {
  5828. const { id, selector } = usePopperContainerId();
  5829. onBeforeMount(() => {
  5830. if (!isClient) return;
  5831. if (!document.body.querySelector(selector.value)) createContainer(id.value);
  5832. });
  5833. return {
  5834. id,
  5835. selector
  5836. };
  5837. };
  5838. //#endregion
  5839. //#region ../../packages/hooks/use-intermediate-render/index.ts
  5840. const useDelayedRender = ({ indicator, intermediateIndicator, shouldSetIntermediate = () => true, beforeShow, afterShow, afterHide, beforeHide }) => {
  5841. watch(() => unref(indicator), (val) => {
  5842. if (val) {
  5843. beforeShow?.();
  5844. nextTick(() => {
  5845. if (!unref(indicator)) return;
  5846. if (shouldSetIntermediate("show")) intermediateIndicator.value = true;
  5847. });
  5848. } else {
  5849. beforeHide?.();
  5850. nextTick(() => {
  5851. if (unref(indicator)) return;
  5852. if (shouldSetIntermediate("hide")) intermediateIndicator.value = false;
  5853. });
  5854. }
  5855. });
  5856. watch(() => intermediateIndicator.value, (val) => {
  5857. if (val) afterShow?.();
  5858. else afterHide?.();
  5859. });
  5860. };
  5861. //#endregion
  5862. //#region ../../packages/hooks/use-delayed-toggle/index.ts
  5863. const useDelayedToggleProps = buildProps({
  5864. showAfter: {
  5865. type: Number,
  5866. default: 0
  5867. },
  5868. hideAfter: {
  5869. type: Number,
  5870. default: 200
  5871. },
  5872. autoClose: {
  5873. type: Number,
  5874. default: 0
  5875. }
  5876. });
  5877. const useDelayedTogglePropsDefaults = {
  5878. showAfter: 0,
  5879. hideAfter: 200,
  5880. autoClose: 0
  5881. };
  5882. const useDelayedToggle = ({ showAfter, hideAfter, autoClose, open, close }) => {
  5883. const { registerTimeout } = useTimeout();
  5884. const { registerTimeout: registerTimeoutForAutoClose, cancelTimeout: cancelTimeoutForAutoClose } = useTimeout();
  5885. const onOpen = (event, delay = unref(showAfter)) => {
  5886. registerTimeout(() => {
  5887. open(event);
  5888. const _autoClose = unref(autoClose);
  5889. if (isNumber(_autoClose) && _autoClose > 0) registerTimeoutForAutoClose(() => {
  5890. close(event);
  5891. }, _autoClose);
  5892. }, delay);
  5893. };
  5894. const onClose = (event, delay = unref(hideAfter)) => {
  5895. cancelTimeoutForAutoClose();
  5896. registerTimeout(() => {
  5897. close(event);
  5898. }, delay);
  5899. };
  5900. return {
  5901. onOpen,
  5902. onClose
  5903. };
  5904. };
  5905. //#endregion
  5906. //#region ../../packages/hooks/use-forward-ref/index.ts
  5907. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  5908. const useForwardRef = (forwardRef) => {
  5909. const setForwardRef = ((el) => {
  5910. forwardRef.value = el;
  5911. });
  5912. provide(FORWARD_REF_INJECTION_KEY, { setForwardRef });
  5913. };
  5914. const useForwardRefDirective = (setForwardRef) => {
  5915. return {
  5916. mounted(el) {
  5917. setForwardRef(el);
  5918. },
  5919. updated(el) {
  5920. setForwardRef(el);
  5921. },
  5922. unmounted() {
  5923. setForwardRef(null);
  5924. }
  5925. };
  5926. };
  5927. //#endregion
  5928. //#region ../../packages/hooks/use-z-index/index.ts
  5929. const initial = { current: 0 };
  5930. const zIndex = ref(0);
  5931. const defaultInitialZIndex = 2e3;
  5932. const ZINDEX_INJECTION_KEY = Symbol("elZIndexContextKey");
  5933. const zIndexContextKey = Symbol("zIndexContextKey");
  5934. const useZIndex = (zIndexOverrides) => {
  5935. const increasingInjection = getCurrentInstance() ? inject(ZINDEX_INJECTION_KEY, initial) : initial;
  5936. const zIndexInjection = zIndexOverrides || (getCurrentInstance() ? inject(zIndexContextKey, void 0) : void 0);
  5937. const initialZIndex = computed(() => {
  5938. const zIndexFromInjection = unref(zIndexInjection);
  5939. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  5940. });
  5941. const currentZIndex = computed(() => initialZIndex.value + zIndex.value);
  5942. const nextZIndex = () => {
  5943. increasingInjection.current++;
  5944. zIndex.value = increasingInjection.current;
  5945. return currentZIndex.value;
  5946. };
  5947. if (!isClient && !inject(ZINDEX_INJECTION_KEY)) /* @__PURE__ */ debugWarn("ZIndexInjection", `Looks like you are using server rendering, you must provide a z-index provider to ensure the hydration process to be succeed
  5948. usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`);
  5949. return {
  5950. initialZIndex,
  5951. currentZIndex,
  5952. nextZIndex
  5953. };
  5954. };
  5955. //#endregion
  5956. //#region ../../node_modules/.pnpm/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs
  5957. const min$1 = Math.min;
  5958. const max$1 = Math.max;
  5959. const round = Math.round;
  5960. const floor$1 = Math.floor;
  5961. const createCoords = (v) => ({
  5962. x: v,
  5963. y: v
  5964. });
  5965. const oppositeSideMap = {
  5966. left: "right",
  5967. right: "left",
  5968. bottom: "top",
  5969. top: "bottom"
  5970. };
  5971. function clamp(start, value, end) {
  5972. return max$1(start, min$1(value, end));
  5973. }
  5974. function evaluate(value, param) {
  5975. return typeof value === "function" ? value(param) : value;
  5976. }
  5977. function getSide(placement) {
  5978. return placement.split("-")[0];
  5979. }
  5980. function getAlignment(placement) {
  5981. return placement.split("-")[1];
  5982. }
  5983. function getOppositeAxis(axis) {
  5984. return axis === "x" ? "y" : "x";
  5985. }
  5986. function getAxisLength(axis) {
  5987. return axis === "y" ? "height" : "width";
  5988. }
  5989. function getSideAxis(placement) {
  5990. const firstChar = placement[0];
  5991. return firstChar === "t" || firstChar === "b" ? "y" : "x";
  5992. }
  5993. function getAlignmentAxis(placement) {
  5994. return getOppositeAxis(getSideAxis(placement));
  5995. }
  5996. function getAlignmentSides(placement, rects, rtl) {
  5997. if (rtl === void 0) rtl = false;
  5998. const alignment = getAlignment(placement);
  5999. const alignmentAxis = getAlignmentAxis(placement);
  6000. const length = getAxisLength(alignmentAxis);
  6001. let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top";
  6002. if (rects.reference[length] > rects.floating[length]) mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
  6003. return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
  6004. }
  6005. function getExpandedPlacements(placement) {
  6006. const oppositePlacement = getOppositePlacement(placement);
  6007. return [
  6008. getOppositeAlignmentPlacement(placement),
  6009. oppositePlacement,
  6010. getOppositeAlignmentPlacement(oppositePlacement)
  6011. ];
  6012. }
  6013. function getOppositeAlignmentPlacement(placement) {
  6014. return placement.includes("start") ? placement.replace("start", "end") : placement.replace("end", "start");
  6015. }
  6016. const lrPlacement = ["left", "right"];
  6017. const rlPlacement = ["right", "left"];
  6018. const tbPlacement = ["top", "bottom"];
  6019. const btPlacement = ["bottom", "top"];
  6020. function getSideList(side, isStart, rtl) {
  6021. switch (side) {
  6022. case "top":
  6023. case "bottom":
  6024. if (rtl) return isStart ? rlPlacement : lrPlacement;
  6025. return isStart ? lrPlacement : rlPlacement;
  6026. case "left":
  6027. case "right": return isStart ? tbPlacement : btPlacement;
  6028. default: return [];
  6029. }
  6030. }
  6031. function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
  6032. const alignment = getAlignment(placement);
  6033. let list = getSideList(getSide(placement), direction === "start", rtl);
  6034. if (alignment) {
  6035. list = list.map((side) => side + "-" + alignment);
  6036. if (flipAlignment) list = list.concat(list.map(getOppositeAlignmentPlacement));
  6037. }
  6038. return list;
  6039. }
  6040. function getOppositePlacement(placement) {
  6041. const side = getSide(placement);
  6042. return oppositeSideMap[side] + placement.slice(side.length);
  6043. }
  6044. function expandPaddingObject(padding) {
  6045. return {
  6046. top: 0,
  6047. right: 0,
  6048. bottom: 0,
  6049. left: 0,
  6050. ...padding
  6051. };
  6052. }
  6053. function getPaddingObject(padding) {
  6054. return typeof padding !== "number" ? expandPaddingObject(padding) : {
  6055. top: padding,
  6056. right: padding,
  6057. bottom: padding,
  6058. left: padding
  6059. };
  6060. }
  6061. function rectToClientRect(rect) {
  6062. const { x, y, width, height } = rect;
  6063. return {
  6064. width,
  6065. height,
  6066. top: y,
  6067. left: x,
  6068. right: x + width,
  6069. bottom: y + height,
  6070. x,
  6071. y
  6072. };
  6073. }
  6074. //#endregion
  6075. //#region ../../node_modules/.pnpm/@floating-ui+core@1.7.5/node_modules/@floating-ui/core/dist/floating-ui.core.mjs
  6076. function computeCoordsFromPlacement(_ref, placement, rtl) {
  6077. let { reference, floating } = _ref;
  6078. const sideAxis = getSideAxis(placement);
  6079. const alignmentAxis = getAlignmentAxis(placement);
  6080. const alignLength = getAxisLength(alignmentAxis);
  6081. const side = getSide(placement);
  6082. const isVertical = sideAxis === "y";
  6083. const commonX = reference.x + reference.width / 2 - floating.width / 2;
  6084. const commonY = reference.y + reference.height / 2 - floating.height / 2;
  6085. const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
  6086. let coords;
  6087. switch (side) {
  6088. case "top":
  6089. coords = {
  6090. x: commonX,
  6091. y: reference.y - floating.height
  6092. };
  6093. break;
  6094. case "bottom":
  6095. coords = {
  6096. x: commonX,
  6097. y: reference.y + reference.height
  6098. };
  6099. break;
  6100. case "right":
  6101. coords = {
  6102. x: reference.x + reference.width,
  6103. y: commonY
  6104. };
  6105. break;
  6106. case "left":
  6107. coords = {
  6108. x: reference.x - floating.width,
  6109. y: commonY
  6110. };
  6111. break;
  6112. default: coords = {
  6113. x: reference.x,
  6114. y: reference.y
  6115. };
  6116. }
  6117. switch (getAlignment(placement)) {
  6118. case "start":
  6119. coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
  6120. break;
  6121. case "end":
  6122. coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
  6123. break;
  6124. }
  6125. return coords;
  6126. }
  6127. async function detectOverflow$1(state, options) {
  6128. var _await$platform$isEle;
  6129. if (options === void 0) options = {};
  6130. const { x, y, platform, rects, elements, strategy } = state;
  6131. const { boundary = "clippingAncestors", rootBoundary = "viewport", elementContext = "floating", altBoundary = false, padding = 0 } = evaluate(options, state);
  6132. const paddingObject = getPaddingObject(padding);
  6133. const element = elements[altBoundary ? elementContext === "floating" ? "reference" : "floating" : elementContext];
  6134. const clippingClientRect = rectToClientRect(await platform.getClippingRect({
  6135. element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating)),
  6136. boundary,
  6137. rootBoundary,
  6138. strategy
  6139. }));
  6140. const rect = elementContext === "floating" ? {
  6141. x,
  6142. y,
  6143. width: rects.floating.width,
  6144. height: rects.floating.height
  6145. } : rects.reference;
  6146. const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
  6147. const offsetScale = await (platform.isElement == null ? void 0 : platform.isElement(offsetParent)) ? await (platform.getScale == null ? void 0 : platform.getScale(offsetParent)) || {
  6148. x: 1,
  6149. y: 1
  6150. } : {
  6151. x: 1,
  6152. y: 1
  6153. };
  6154. const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
  6155. elements,
  6156. rect,
  6157. offsetParent,
  6158. strategy
  6159. }) : rect);
  6160. return {
  6161. top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
  6162. bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
  6163. left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
  6164. right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
  6165. };
  6166. }
  6167. const MAX_RESET_COUNT = 50;
  6168. const computePosition$1 = async (reference, floating, config) => {
  6169. const { placement = "bottom", strategy = "absolute", middleware = [], platform } = config;
  6170. const platformWithDetectOverflow = platform.detectOverflow ? platform : {
  6171. ...platform,
  6172. detectOverflow: detectOverflow$1
  6173. };
  6174. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
  6175. let rects = await platform.getElementRects({
  6176. reference,
  6177. floating,
  6178. strategy
  6179. });
  6180. let { x, y } = computeCoordsFromPlacement(rects, placement, rtl);
  6181. let statefulPlacement = placement;
  6182. let resetCount = 0;
  6183. const middlewareData = {};
  6184. for (let i = 0; i < middleware.length; i++) {
  6185. const currentMiddleware = middleware[i];
  6186. if (!currentMiddleware) continue;
  6187. const { name, fn } = currentMiddleware;
  6188. const { x: nextX, y: nextY, data, reset } = await fn({
  6189. x,
  6190. y,
  6191. initialPlacement: placement,
  6192. placement: statefulPlacement,
  6193. strategy,
  6194. middlewareData,
  6195. rects,
  6196. platform: platformWithDetectOverflow,
  6197. elements: {
  6198. reference,
  6199. floating
  6200. }
  6201. });
  6202. x = nextX != null ? nextX : x;
  6203. y = nextY != null ? nextY : y;
  6204. middlewareData[name] = {
  6205. ...middlewareData[name],
  6206. ...data
  6207. };
  6208. if (reset && resetCount < MAX_RESET_COUNT) {
  6209. resetCount++;
  6210. if (typeof reset === "object") {
  6211. if (reset.placement) statefulPlacement = reset.placement;
  6212. if (reset.rects) rects = reset.rects === true ? await platform.getElementRects({
  6213. reference,
  6214. floating,
  6215. strategy
  6216. }) : reset.rects;
  6217. ({x, y} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
  6218. }
  6219. i = -1;
  6220. }
  6221. }
  6222. return {
  6223. x,
  6224. y,
  6225. placement: statefulPlacement,
  6226. strategy,
  6227. middlewareData
  6228. };
  6229. };
  6230. const arrow$1 = (options) => ({
  6231. name: "arrow",
  6232. options,
  6233. async fn(state) {
  6234. const { x, y, placement, rects, platform, elements, middlewareData } = state;
  6235. const { element, padding = 0 } = evaluate(options, state) || {};
  6236. if (element == null) return {};
  6237. const paddingObject = getPaddingObject(padding);
  6238. const coords = {
  6239. x,
  6240. y
  6241. };
  6242. const axis = getAlignmentAxis(placement);
  6243. const length = getAxisLength(axis);
  6244. const arrowDimensions = await platform.getDimensions(element);
  6245. const isYAxis = axis === "y";
  6246. const minProp = isYAxis ? "top" : "left";
  6247. const maxProp = isYAxis ? "bottom" : "right";
  6248. const clientProp = isYAxis ? "clientHeight" : "clientWidth";
  6249. const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length];
  6250. const startDiff = coords[axis] - rects.reference[axis];
  6251. const arrowOffsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(element));
  6252. let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0;
  6253. if (!clientSize || !await (platform.isElement == null ? void 0 : platform.isElement(arrowOffsetParent))) clientSize = elements.floating[clientProp] || rects.floating[length];
  6254. const centerToReference = endDiff / 2 - startDiff / 2;
  6255. const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1;
  6256. const minPadding = min$1(paddingObject[minProp], largestPossiblePadding);
  6257. const maxPadding = min$1(paddingObject[maxProp], largestPossiblePadding);
  6258. const min$1$1 = minPadding;
  6259. const max = clientSize - arrowDimensions[length] - maxPadding;
  6260. const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference;
  6261. const offset = clamp(min$1$1, center, max);
  6262. const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset && rects.reference[length] / 2 - (center < min$1$1 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0;
  6263. const alignmentOffset = shouldAddOffset ? center < min$1$1 ? center - min$1$1 : center - max : 0;
  6264. return {
  6265. [axis]: coords[axis] + alignmentOffset,
  6266. data: {
  6267. [axis]: offset,
  6268. centerOffset: center - offset - alignmentOffset,
  6269. ...shouldAddOffset && { alignmentOffset }
  6270. },
  6271. reset: shouldAddOffset
  6272. };
  6273. }
  6274. });
  6275. const flip$1 = function(options) {
  6276. if (options === void 0) options = {};
  6277. return {
  6278. name: "flip",
  6279. options,
  6280. async fn(state) {
  6281. var _middlewareData$arrow, _middlewareData$flip;
  6282. const { placement, middlewareData, rects, initialPlacement, platform, elements } = state;
  6283. const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = true, fallbackPlacements: specifiedFallbackPlacements, fallbackStrategy = "bestFit", fallbackAxisSideDirection = "none", flipAlignment = true, ...detectOverflowOptions } = evaluate(options, state);
  6284. if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
  6285. const side = getSide(placement);
  6286. const initialSideAxis = getSideAxis(initialPlacement);
  6287. const isBasePlacement = getSide(initialPlacement) === initialPlacement;
  6288. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  6289. const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
  6290. const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== "none";
  6291. if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
  6292. const placements = [initialPlacement, ...fallbackPlacements];
  6293. const overflow = await platform.detectOverflow(state, detectOverflowOptions);
  6294. const overflows = [];
  6295. let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
  6296. if (checkMainAxis) overflows.push(overflow[side]);
  6297. if (checkCrossAxis) {
  6298. const sides = getAlignmentSides(placement, rects, rtl);
  6299. overflows.push(overflow[sides[0]], overflow[sides[1]]);
  6300. }
  6301. overflowsData = [...overflowsData, {
  6302. placement,
  6303. overflows
  6304. }];
  6305. if (!overflows.every((side) => side <= 0)) {
  6306. var _middlewareData$flip2, _overflowsData$filter;
  6307. const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
  6308. const nextPlacement = placements[nextIndex];
  6309. if (nextPlacement) {
  6310. if (!(checkCrossAxis === "alignment" ? initialSideAxis !== getSideAxis(nextPlacement) : false) || overflowsData.every((d) => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) return {
  6311. data: {
  6312. index: nextIndex,
  6313. overflows: overflowsData
  6314. },
  6315. reset: { placement: nextPlacement }
  6316. };
  6317. }
  6318. let resetPlacement = (_overflowsData$filter = overflowsData.filter((d) => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
  6319. if (!resetPlacement) switch (fallbackStrategy) {
  6320. case "bestFit": {
  6321. var _overflowsData$filter2;
  6322. const placement = (_overflowsData$filter2 = overflowsData.filter((d) => {
  6323. if (hasFallbackAxisSideDirection) {
  6324. const currentSideAxis = getSideAxis(d.placement);
  6325. return currentSideAxis === initialSideAxis || currentSideAxis === "y";
  6326. }
  6327. return true;
  6328. }).map((d) => [d.placement, d.overflows.filter((overflow) => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
  6329. if (placement) resetPlacement = placement;
  6330. break;
  6331. }
  6332. case "initialPlacement":
  6333. resetPlacement = initialPlacement;
  6334. break;
  6335. }
  6336. if (placement !== resetPlacement) return { reset: { placement: resetPlacement } };
  6337. }
  6338. return {};
  6339. }
  6340. };
  6341. };
  6342. const originSides = /* @__PURE__ */ new Set(["left", "top"]);
  6343. async function convertValueToCoords(state, options) {
  6344. const { placement, platform, elements } = state;
  6345. const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
  6346. const side = getSide(placement);
  6347. const alignment = getAlignment(placement);
  6348. const isVertical = getSideAxis(placement) === "y";
  6349. const mainAxisMulti = originSides.has(side) ? -1 : 1;
  6350. const crossAxisMulti = rtl && isVertical ? -1 : 1;
  6351. const rawValue = evaluate(options, state);
  6352. let { mainAxis, crossAxis, alignmentAxis } = typeof rawValue === "number" ? {
  6353. mainAxis: rawValue,
  6354. crossAxis: 0,
  6355. alignmentAxis: null
  6356. } : {
  6357. mainAxis: rawValue.mainAxis || 0,
  6358. crossAxis: rawValue.crossAxis || 0,
  6359. alignmentAxis: rawValue.alignmentAxis
  6360. };
  6361. if (alignment && typeof alignmentAxis === "number") crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis;
  6362. return isVertical ? {
  6363. x: crossAxis * crossAxisMulti,
  6364. y: mainAxis * mainAxisMulti
  6365. } : {
  6366. x: mainAxis * mainAxisMulti,
  6367. y: crossAxis * crossAxisMulti
  6368. };
  6369. }
  6370. const offset$1 = function(options) {
  6371. if (options === void 0) options = 0;
  6372. return {
  6373. name: "offset",
  6374. options,
  6375. async fn(state) {
  6376. var _middlewareData$offse, _middlewareData$arrow;
  6377. const { x, y, placement, middlewareData } = state;
  6378. const diffCoords = await convertValueToCoords(state, options);
  6379. if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) return {};
  6380. return {
  6381. x: x + diffCoords.x,
  6382. y: y + diffCoords.y,
  6383. data: {
  6384. ...diffCoords,
  6385. placement
  6386. }
  6387. };
  6388. }
  6389. };
  6390. };
  6391. const shift$1 = function(options) {
  6392. if (options === void 0) options = {};
  6393. return {
  6394. name: "shift",
  6395. options,
  6396. async fn(state) {
  6397. const { x, y, placement, platform } = state;
  6398. const { mainAxis: checkMainAxis = true, crossAxis: checkCrossAxis = false, limiter = { fn: (_ref) => {
  6399. let { x, y } = _ref;
  6400. return {
  6401. x,
  6402. y
  6403. };
  6404. } }, ...detectOverflowOptions } = evaluate(options, state);
  6405. const coords = {
  6406. x,
  6407. y
  6408. };
  6409. const overflow = await platform.detectOverflow(state, detectOverflowOptions);
  6410. const crossAxis = getSideAxis(getSide(placement));
  6411. const mainAxis = getOppositeAxis(crossAxis);
  6412. let mainAxisCoord = coords[mainAxis];
  6413. let crossAxisCoord = coords[crossAxis];
  6414. if (checkMainAxis) {
  6415. const minSide = mainAxis === "y" ? "top" : "left";
  6416. const maxSide = mainAxis === "y" ? "bottom" : "right";
  6417. const min = mainAxisCoord + overflow[minSide];
  6418. const max = mainAxisCoord - overflow[maxSide];
  6419. mainAxisCoord = clamp(min, mainAxisCoord, max);
  6420. }
  6421. if (checkCrossAxis) {
  6422. const minSide = crossAxis === "y" ? "top" : "left";
  6423. const maxSide = crossAxis === "y" ? "bottom" : "right";
  6424. const min = crossAxisCoord + overflow[minSide];
  6425. const max = crossAxisCoord - overflow[maxSide];
  6426. crossAxisCoord = clamp(min, crossAxisCoord, max);
  6427. }
  6428. const limitedCoords = limiter.fn({
  6429. ...state,
  6430. [mainAxis]: mainAxisCoord,
  6431. [crossAxis]: crossAxisCoord
  6432. });
  6433. return {
  6434. ...limitedCoords,
  6435. data: {
  6436. x: limitedCoords.x - x,
  6437. y: limitedCoords.y - y,
  6438. enabled: {
  6439. [mainAxis]: checkMainAxis,
  6440. [crossAxis]: checkCrossAxis
  6441. }
  6442. }
  6443. };
  6444. }
  6445. };
  6446. };
  6447. //#endregion
  6448. //#region ../../node_modules/.pnpm/@floating-ui+utils@0.2.11/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs
  6449. function hasWindow() {
  6450. return typeof window !== "undefined";
  6451. }
  6452. function getNodeName(node) {
  6453. if (isNode(node)) return (node.nodeName || "").toLowerCase();
  6454. return "#document";
  6455. }
  6456. function getWindow(node) {
  6457. var _node$ownerDocument;
  6458. return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
  6459. }
  6460. function getDocumentElement(node) {
  6461. var _ref;
  6462. return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
  6463. }
  6464. function isNode(value) {
  6465. if (!hasWindow()) return false;
  6466. return value instanceof Node || value instanceof getWindow(value).Node;
  6467. }
  6468. function isElement(value) {
  6469. if (!hasWindow()) return false;
  6470. return value instanceof Element || value instanceof getWindow(value).Element;
  6471. }
  6472. function isHTMLElement(value) {
  6473. if (!hasWindow()) return false;
  6474. return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
  6475. }
  6476. function isShadowRoot(value) {
  6477. if (!hasWindow() || typeof ShadowRoot === "undefined") return false;
  6478. return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
  6479. }
  6480. function isOverflowElement(element) {
  6481. const { overflow, overflowX, overflowY, display } = getComputedStyle$1(element);
  6482. return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== "inline" && display !== "contents";
  6483. }
  6484. function isTableElement(element) {
  6485. return /^(table|td|th)$/.test(getNodeName(element));
  6486. }
  6487. function isTopLayer(element) {
  6488. try {
  6489. if (element.matches(":popover-open")) return true;
  6490. } catch (_e) {}
  6491. try {
  6492. return element.matches(":modal");
  6493. } catch (_e) {
  6494. return false;
  6495. }
  6496. }
  6497. const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
  6498. const containRe = /paint|layout|strict|content/;
  6499. const isNotNone = (value) => !!value && value !== "none";
  6500. let isWebKitValue;
  6501. function isContainingBlock(elementOrCss) {
  6502. const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
  6503. return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || "") || containRe.test(css.contain || "");
  6504. }
  6505. function getContainingBlock(element) {
  6506. let currentNode = getParentNode(element);
  6507. while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
  6508. if (isContainingBlock(currentNode)) return currentNode;
  6509. else if (isTopLayer(currentNode)) return null;
  6510. currentNode = getParentNode(currentNode);
  6511. }
  6512. return null;
  6513. }
  6514. function isWebKit() {
  6515. if (isWebKitValue == null) isWebKitValue = typeof CSS !== "undefined" && CSS.supports && CSS.supports("-webkit-backdrop-filter", "none");
  6516. return isWebKitValue;
  6517. }
  6518. function isLastTraversableNode(node) {
  6519. return /^(html|body|#document)$/.test(getNodeName(node));
  6520. }
  6521. function getComputedStyle$1(element) {
  6522. return getWindow(element).getComputedStyle(element);
  6523. }
  6524. function getNodeScroll(element) {
  6525. if (isElement(element)) return {
  6526. scrollLeft: element.scrollLeft,
  6527. scrollTop: element.scrollTop
  6528. };
  6529. return {
  6530. scrollLeft: element.scrollX,
  6531. scrollTop: element.scrollY
  6532. };
  6533. }
  6534. function getParentNode(node) {
  6535. if (getNodeName(node) === "html") return node;
  6536. const result = node.assignedSlot || node.parentNode || isShadowRoot(node) && node.host || getDocumentElement(node);
  6537. return isShadowRoot(result) ? result.host : result;
  6538. }
  6539. function getNearestOverflowAncestor(node) {
  6540. const parentNode = getParentNode(node);
  6541. if (isLastTraversableNode(parentNode)) return node.ownerDocument ? node.ownerDocument.body : node.body;
  6542. if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) return parentNode;
  6543. return getNearestOverflowAncestor(parentNode);
  6544. }
  6545. function getOverflowAncestors(node, list, traverseIframes) {
  6546. var _node$ownerDocument2;
  6547. if (list === void 0) list = [];
  6548. if (traverseIframes === void 0) traverseIframes = true;
  6549. const scrollableAncestor = getNearestOverflowAncestor(node);
  6550. const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
  6551. const win = getWindow(scrollableAncestor);
  6552. if (isBody) {
  6553. const frameElement = getFrameElement(win);
  6554. return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
  6555. } else return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
  6556. }
  6557. function getFrameElement(win) {
  6558. return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
  6559. }
  6560. //#endregion
  6561. //#region ../../node_modules/.pnpm/@floating-ui+dom@1.7.6/node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs
  6562. function getCssDimensions(element) {
  6563. const css = getComputedStyle$1(element);
  6564. let width = parseFloat(css.width) || 0;
  6565. let height = parseFloat(css.height) || 0;
  6566. const hasOffset = isHTMLElement(element);
  6567. const offsetWidth = hasOffset ? element.offsetWidth : width;
  6568. const offsetHeight = hasOffset ? element.offsetHeight : height;
  6569. const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
  6570. if (shouldFallback) {
  6571. width = offsetWidth;
  6572. height = offsetHeight;
  6573. }
  6574. return {
  6575. width,
  6576. height,
  6577. $: shouldFallback
  6578. };
  6579. }
  6580. function unwrapElement(element) {
  6581. return !isElement(element) ? element.contextElement : element;
  6582. }
  6583. function getScale(element) {
  6584. const domElement = unwrapElement(element);
  6585. if (!isHTMLElement(domElement)) return createCoords(1);
  6586. const rect = domElement.getBoundingClientRect();
  6587. const { width, height, $ } = getCssDimensions(domElement);
  6588. let x = ($ ? round(rect.width) : rect.width) / width;
  6589. let y = ($ ? round(rect.height) : rect.height) / height;
  6590. if (!x || !Number.isFinite(x)) x = 1;
  6591. if (!y || !Number.isFinite(y)) y = 1;
  6592. return {
  6593. x,
  6594. y
  6595. };
  6596. }
  6597. const noOffsets = /* @__PURE__ */ createCoords(0);
  6598. function getVisualOffsets(element) {
  6599. const win = getWindow(element);
  6600. if (!isWebKit() || !win.visualViewport) return noOffsets;
  6601. return {
  6602. x: win.visualViewport.offsetLeft,
  6603. y: win.visualViewport.offsetTop
  6604. };
  6605. }
  6606. function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
  6607. if (isFixed === void 0) isFixed = false;
  6608. if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) return false;
  6609. return isFixed;
  6610. }
  6611. function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
  6612. if (includeScale === void 0) includeScale = false;
  6613. if (isFixedStrategy === void 0) isFixedStrategy = false;
  6614. const clientRect = element.getBoundingClientRect();
  6615. const domElement = unwrapElement(element);
  6616. let scale = createCoords(1);
  6617. if (includeScale) if (offsetParent) {
  6618. if (isElement(offsetParent)) scale = getScale(offsetParent);
  6619. } else scale = getScale(element);
  6620. const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
  6621. let x = (clientRect.left + visualOffsets.x) / scale.x;
  6622. let y = (clientRect.top + visualOffsets.y) / scale.y;
  6623. let width = clientRect.width / scale.x;
  6624. let height = clientRect.height / scale.y;
  6625. if (domElement) {
  6626. const win = getWindow(domElement);
  6627. const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
  6628. let currentWin = win;
  6629. let currentIFrame = getFrameElement(currentWin);
  6630. while (currentIFrame && offsetParent && offsetWin !== currentWin) {
  6631. const iframeScale = getScale(currentIFrame);
  6632. const iframeRect = currentIFrame.getBoundingClientRect();
  6633. const css = getComputedStyle$1(currentIFrame);
  6634. const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
  6635. const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
  6636. x *= iframeScale.x;
  6637. y *= iframeScale.y;
  6638. width *= iframeScale.x;
  6639. height *= iframeScale.y;
  6640. x += left;
  6641. y += top;
  6642. currentWin = getWindow(currentIFrame);
  6643. currentIFrame = getFrameElement(currentWin);
  6644. }
  6645. }
  6646. return rectToClientRect({
  6647. width,
  6648. height,
  6649. x,
  6650. y
  6651. });
  6652. }
  6653. function getWindowScrollBarX(element, rect) {
  6654. const leftScroll = getNodeScroll(element).scrollLeft;
  6655. if (!rect) return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
  6656. return rect.left + leftScroll;
  6657. }
  6658. function getHTMLOffset(documentElement, scroll) {
  6659. const htmlRect = documentElement.getBoundingClientRect();
  6660. return {
  6661. x: htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect),
  6662. y: htmlRect.top + scroll.scrollTop
  6663. };
  6664. }
  6665. function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
  6666. let { elements, rect, offsetParent, strategy } = _ref;
  6667. const isFixed = strategy === "fixed";
  6668. const documentElement = getDocumentElement(offsetParent);
  6669. const topLayer = elements ? isTopLayer(elements.floating) : false;
  6670. if (offsetParent === documentElement || topLayer && isFixed) return rect;
  6671. let scroll = {
  6672. scrollLeft: 0,
  6673. scrollTop: 0
  6674. };
  6675. let scale = createCoords(1);
  6676. const offsets = createCoords(0);
  6677. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  6678. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  6679. if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
  6680. if (isOffsetParentAnElement) {
  6681. const offsetRect = getBoundingClientRect(offsetParent);
  6682. scale = getScale(offsetParent);
  6683. offsets.x = offsetRect.x + offsetParent.clientLeft;
  6684. offsets.y = offsetRect.y + offsetParent.clientTop;
  6685. }
  6686. }
  6687. const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
  6688. return {
  6689. width: rect.width * scale.x,
  6690. height: rect.height * scale.y,
  6691. x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
  6692. y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
  6693. };
  6694. }
  6695. function getClientRects(element) {
  6696. return Array.from(element.getClientRects());
  6697. }
  6698. function getDocumentRect(element) {
  6699. const html = getDocumentElement(element);
  6700. const scroll = getNodeScroll(element);
  6701. const body = element.ownerDocument.body;
  6702. const width = max$1(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
  6703. const height = max$1(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
  6704. let x = -scroll.scrollLeft + getWindowScrollBarX(element);
  6705. const y = -scroll.scrollTop;
  6706. if (getComputedStyle$1(body).direction === "rtl") x += max$1(html.clientWidth, body.clientWidth) - width;
  6707. return {
  6708. width,
  6709. height,
  6710. x,
  6711. y
  6712. };
  6713. }
  6714. const SCROLLBAR_MAX = 25;
  6715. function getViewportRect(element, strategy) {
  6716. const win = getWindow(element);
  6717. const html = getDocumentElement(element);
  6718. const visualViewport = win.visualViewport;
  6719. let width = html.clientWidth;
  6720. let height = html.clientHeight;
  6721. let x = 0;
  6722. let y = 0;
  6723. if (visualViewport) {
  6724. width = visualViewport.width;
  6725. height = visualViewport.height;
  6726. const visualViewportBased = isWebKit();
  6727. if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
  6728. x = visualViewport.offsetLeft;
  6729. y = visualViewport.offsetTop;
  6730. }
  6731. }
  6732. const windowScrollbarX = getWindowScrollBarX(html);
  6733. if (windowScrollbarX <= 0) {
  6734. const doc = html.ownerDocument;
  6735. const body = doc.body;
  6736. const bodyStyles = getComputedStyle(body);
  6737. const bodyMarginInline = doc.compatMode === "CSS1Compat" ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
  6738. const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
  6739. if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) width -= clippingStableScrollbarWidth;
  6740. } else if (windowScrollbarX <= SCROLLBAR_MAX) width += windowScrollbarX;
  6741. return {
  6742. width,
  6743. height,
  6744. x,
  6745. y
  6746. };
  6747. }
  6748. function getInnerBoundingClientRect(element, strategy) {
  6749. const clientRect = getBoundingClientRect(element, true, strategy === "fixed");
  6750. const top = clientRect.top + element.clientTop;
  6751. const left = clientRect.left + element.clientLeft;
  6752. const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
  6753. return {
  6754. width: element.clientWidth * scale.x,
  6755. height: element.clientHeight * scale.y,
  6756. x: left * scale.x,
  6757. y: top * scale.y
  6758. };
  6759. }
  6760. function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
  6761. let rect;
  6762. if (clippingAncestor === "viewport") rect = getViewportRect(element, strategy);
  6763. else if (clippingAncestor === "document") rect = getDocumentRect(getDocumentElement(element));
  6764. else if (isElement(clippingAncestor)) rect = getInnerBoundingClientRect(clippingAncestor, strategy);
  6765. else {
  6766. const visualOffsets = getVisualOffsets(element);
  6767. rect = {
  6768. x: clippingAncestor.x - visualOffsets.x,
  6769. y: clippingAncestor.y - visualOffsets.y,
  6770. width: clippingAncestor.width,
  6771. height: clippingAncestor.height
  6772. };
  6773. }
  6774. return rectToClientRect(rect);
  6775. }
  6776. function hasFixedPositionAncestor(element, stopNode) {
  6777. const parentNode = getParentNode(element);
  6778. if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) return false;
  6779. return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode);
  6780. }
  6781. function getClippingElementAncestors(element, cache) {
  6782. const cachedResult = cache.get(element);
  6783. if (cachedResult) return cachedResult;
  6784. let result = getOverflowAncestors(element, [], false).filter((el) => isElement(el) && getNodeName(el) !== "body");
  6785. let currentContainingBlockComputedStyle = null;
  6786. const elementIsFixed = getComputedStyle$1(element).position === "fixed";
  6787. let currentNode = elementIsFixed ? getParentNode(element) : element;
  6788. while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
  6789. const computedStyle = getComputedStyle$1(currentNode);
  6790. const currentNodeIsContaining = isContainingBlock(currentNode);
  6791. if (!currentNodeIsContaining && computedStyle.position === "fixed") currentContainingBlockComputedStyle = null;
  6792. if (elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === "absolute" || currentContainingBlockComputedStyle.position === "fixed") || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode)) result = result.filter((ancestor) => ancestor !== currentNode);
  6793. else currentContainingBlockComputedStyle = computedStyle;
  6794. currentNode = getParentNode(currentNode);
  6795. }
  6796. cache.set(element, result);
  6797. return result;
  6798. }
  6799. function getClippingRect(_ref) {
  6800. let { element, boundary, rootBoundary, strategy } = _ref;
  6801. const clippingAncestors = [...boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary), rootBoundary];
  6802. const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
  6803. let top = firstRect.top;
  6804. let right = firstRect.right;
  6805. let bottom = firstRect.bottom;
  6806. let left = firstRect.left;
  6807. for (let i = 1; i < clippingAncestors.length; i++) {
  6808. const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
  6809. top = max$1(rect.top, top);
  6810. right = min$1(rect.right, right);
  6811. bottom = min$1(rect.bottom, bottom);
  6812. left = max$1(rect.left, left);
  6813. }
  6814. return {
  6815. width: right - left,
  6816. height: bottom - top,
  6817. x: left,
  6818. y: top
  6819. };
  6820. }
  6821. function getDimensions(element) {
  6822. const { width, height } = getCssDimensions(element);
  6823. return {
  6824. width,
  6825. height
  6826. };
  6827. }
  6828. function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
  6829. const isOffsetParentAnElement = isHTMLElement(offsetParent);
  6830. const documentElement = getDocumentElement(offsetParent);
  6831. const isFixed = strategy === "fixed";
  6832. const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
  6833. let scroll = {
  6834. scrollLeft: 0,
  6835. scrollTop: 0
  6836. };
  6837. const offsets = createCoords(0);
  6838. function setLeftRTLScrollbarOffset() {
  6839. offsets.x = getWindowScrollBarX(documentElement);
  6840. }
  6841. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  6842. if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) scroll = getNodeScroll(offsetParent);
  6843. if (isOffsetParentAnElement) {
  6844. const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
  6845. offsets.x = offsetRect.x + offsetParent.clientLeft;
  6846. offsets.y = offsetRect.y + offsetParent.clientTop;
  6847. } else if (documentElement) setLeftRTLScrollbarOffset();
  6848. }
  6849. if (isFixed && !isOffsetParentAnElement && documentElement) setLeftRTLScrollbarOffset();
  6850. const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
  6851. return {
  6852. x: rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x,
  6853. y: rect.top + scroll.scrollTop - offsets.y - htmlOffset.y,
  6854. width: rect.width,
  6855. height: rect.height
  6856. };
  6857. }
  6858. function isStaticPositioned(element) {
  6859. return getComputedStyle$1(element).position === "static";
  6860. }
  6861. function getTrueOffsetParent(element, polyfill) {
  6862. if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") return null;
  6863. if (polyfill) return polyfill(element);
  6864. let rawOffsetParent = element.offsetParent;
  6865. if (getDocumentElement(element) === rawOffsetParent) rawOffsetParent = rawOffsetParent.ownerDocument.body;
  6866. return rawOffsetParent;
  6867. }
  6868. function getOffsetParent(element, polyfill) {
  6869. const win = getWindow(element);
  6870. if (isTopLayer(element)) return win;
  6871. if (!isHTMLElement(element)) {
  6872. let svgOffsetParent = getParentNode(element);
  6873. while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
  6874. if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) return svgOffsetParent;
  6875. svgOffsetParent = getParentNode(svgOffsetParent);
  6876. }
  6877. return win;
  6878. }
  6879. let offsetParent = getTrueOffsetParent(element, polyfill);
  6880. while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) offsetParent = getTrueOffsetParent(offsetParent, polyfill);
  6881. if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) return win;
  6882. return offsetParent || getContainingBlock(element) || win;
  6883. }
  6884. const getElementRects = async function(data) {
  6885. const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
  6886. const getDimensionsFn = this.getDimensions;
  6887. const floatingDimensions = await getDimensionsFn(data.floating);
  6888. return {
  6889. reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
  6890. floating: {
  6891. x: 0,
  6892. y: 0,
  6893. width: floatingDimensions.width,
  6894. height: floatingDimensions.height
  6895. }
  6896. };
  6897. };
  6898. function isRTL$1(element) {
  6899. return getComputedStyle$1(element).direction === "rtl";
  6900. }
  6901. const platform = {
  6902. convertOffsetParentRelativeRectToViewportRelativeRect,
  6903. getDocumentElement,
  6904. getClippingRect,
  6905. getOffsetParent,
  6906. getElementRects,
  6907. getClientRects,
  6908. getDimensions,
  6909. getScale,
  6910. isElement,
  6911. isRTL: isRTL$1
  6912. };
  6913. function rectsAreEqual(a, b) {
  6914. return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
  6915. }
  6916. function observeMove(element, onMove) {
  6917. let io = null;
  6918. let timeoutId;
  6919. const root = getDocumentElement(element);
  6920. function cleanup() {
  6921. var _io;
  6922. clearTimeout(timeoutId);
  6923. (_io = io) == null || _io.disconnect();
  6924. io = null;
  6925. }
  6926. function refresh(skip, threshold) {
  6927. if (skip === void 0) skip = false;
  6928. if (threshold === void 0) threshold = 1;
  6929. cleanup();
  6930. const elementRectForRootMargin = element.getBoundingClientRect();
  6931. const { left, top, width, height } = elementRectForRootMargin;
  6932. if (!skip) onMove();
  6933. if (!width || !height) return;
  6934. const insetTop = floor$1(top);
  6935. const insetRight = floor$1(root.clientWidth - (left + width));
  6936. const insetBottom = floor$1(root.clientHeight - (top + height));
  6937. const insetLeft = floor$1(left);
  6938. const options = {
  6939. rootMargin: -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px",
  6940. threshold: max$1(0, min$1(1, threshold)) || 1
  6941. };
  6942. let isFirstUpdate = true;
  6943. function handleObserve(entries) {
  6944. const ratio = entries[0].intersectionRatio;
  6945. if (ratio !== threshold) {
  6946. if (!isFirstUpdate) return refresh();
  6947. if (!ratio) timeoutId = setTimeout(() => {
  6948. refresh(false, 1e-7);
  6949. }, 1e3);
  6950. else refresh(false, ratio);
  6951. }
  6952. if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) refresh();
  6953. isFirstUpdate = false;
  6954. }
  6955. try {
  6956. io = new IntersectionObserver(handleObserve, {
  6957. ...options,
  6958. root: root.ownerDocument
  6959. });
  6960. } catch (_e) {
  6961. io = new IntersectionObserver(handleObserve, options);
  6962. }
  6963. io.observe(element);
  6964. }
  6965. refresh(true);
  6966. return cleanup;
  6967. }
  6968. function autoUpdate(reference, floating, update, options) {
  6969. if (options === void 0) options = {};
  6970. const { ancestorScroll = true, ancestorResize = true, elementResize = typeof ResizeObserver === "function", layoutShift = typeof IntersectionObserver === "function", animationFrame = false } = options;
  6971. const referenceEl = unwrapElement(reference);
  6972. const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...floating ? getOverflowAncestors(floating) : []] : [];
  6973. ancestors.forEach((ancestor) => {
  6974. ancestorScroll && ancestor.addEventListener("scroll", update, { passive: true });
  6975. ancestorResize && ancestor.addEventListener("resize", update);
  6976. });
  6977. const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
  6978. let reobserveFrame = -1;
  6979. let resizeObserver = null;
  6980. if (elementResize) {
  6981. resizeObserver = new ResizeObserver((_ref) => {
  6982. let [firstEntry] = _ref;
  6983. if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
  6984. resizeObserver.unobserve(floating);
  6985. cancelAnimationFrame(reobserveFrame);
  6986. reobserveFrame = requestAnimationFrame(() => {
  6987. var _resizeObserver;
  6988. (_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
  6989. });
  6990. }
  6991. update();
  6992. });
  6993. if (referenceEl && !animationFrame) resizeObserver.observe(referenceEl);
  6994. if (floating) resizeObserver.observe(floating);
  6995. }
  6996. let frameId;
  6997. let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
  6998. if (animationFrame) frameLoop();
  6999. function frameLoop() {
  7000. const nextRefRect = getBoundingClientRect(reference);
  7001. if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) update();
  7002. prevRefRect = nextRefRect;
  7003. frameId = requestAnimationFrame(frameLoop);
  7004. }
  7005. update();
  7006. return () => {
  7007. var _resizeObserver2;
  7008. ancestors.forEach((ancestor) => {
  7009. ancestorScroll && ancestor.removeEventListener("scroll", update);
  7010. ancestorResize && ancestor.removeEventListener("resize", update);
  7011. });
  7012. cleanupIo?.();
  7013. (_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
  7014. resizeObserver = null;
  7015. if (animationFrame) cancelAnimationFrame(frameId);
  7016. };
  7017. }
  7018. const detectOverflow = detectOverflow$1;
  7019. const offset = offset$1;
  7020. const shift = shift$1;
  7021. const flip = flip$1;
  7022. const arrow = arrow$1;
  7023. const computePosition = (reference, floating, options) => {
  7024. const cache = /* @__PURE__ */ new Map();
  7025. const mergedOptions = {
  7026. platform,
  7027. ...options
  7028. };
  7029. const platformWithCache = {
  7030. ...mergedOptions.platform,
  7031. _c: cache
  7032. };
  7033. return computePosition$1(reference, floating, {
  7034. ...mergedOptions,
  7035. platform: platformWithCache
  7036. });
  7037. };
  7038. //#endregion
  7039. //#region ../../packages/hooks/use-floating/index.ts
  7040. const useFloatingProps = buildProps({});
  7041. const unrefReference = (elRef) => {
  7042. if (!isClient) return;
  7043. if (!elRef) return elRef;
  7044. const unrefEl = unrefElement(elRef);
  7045. if (unrefEl) return unrefEl;
  7046. return isRef(elRef) ? unrefEl : elRef;
  7047. };
  7048. const getPositionDataWithUnit = (record, key) => {
  7049. const value = record?.[key];
  7050. return isNil(value) ? "" : `${value}px`;
  7051. };
  7052. const useFloating = ({ middleware, placement, strategy }) => {
  7053. const referenceRef = ref();
  7054. const contentRef = ref();
  7055. const states = {
  7056. x: ref(),
  7057. y: ref(),
  7058. placement,
  7059. strategy,
  7060. middlewareData: ref({})
  7061. };
  7062. const update = async () => {
  7063. if (!isClient) return;
  7064. const referenceEl = unrefReference(referenceRef);
  7065. const contentEl = unrefElement(contentRef);
  7066. if (!referenceEl || !contentEl) return;
  7067. const data = await computePosition(referenceEl, contentEl, {
  7068. placement: unref(placement),
  7069. strategy: unref(strategy),
  7070. middleware: unref(middleware)
  7071. });
  7072. keysOf(states).forEach((key) => {
  7073. states[key].value = data[key];
  7074. });
  7075. };
  7076. onMounted(() => {
  7077. watchEffect(() => {
  7078. update();
  7079. });
  7080. });
  7081. return {
  7082. ...states,
  7083. update,
  7084. referenceRef,
  7085. contentRef
  7086. };
  7087. };
  7088. const arrowMiddleware = ({ arrowRef, padding }) => {
  7089. return {
  7090. name: "arrow",
  7091. options: {
  7092. element: arrowRef,
  7093. padding
  7094. },
  7095. fn(args) {
  7096. const arrowEl = unref(arrowRef);
  7097. if (!arrowEl) return {};
  7098. return arrow({
  7099. element: arrowEl,
  7100. padding
  7101. }).fn(args);
  7102. }
  7103. };
  7104. };
  7105. //#endregion
  7106. //#region ../../packages/hooks/use-cursor/index.ts
  7107. function useCursor(input) {
  7108. let selectionInfo;
  7109. function recordCursor() {
  7110. if (input.value == void 0) return;
  7111. const { selectionStart, selectionEnd, value } = input.value;
  7112. if (selectionStart == null || selectionEnd == null) return;
  7113. selectionInfo = {
  7114. selectionStart,
  7115. selectionEnd,
  7116. value,
  7117. beforeTxt: value.slice(0, Math.max(0, selectionStart)),
  7118. afterTxt: value.slice(Math.max(0, selectionEnd))
  7119. };
  7120. }
  7121. function setCursor() {
  7122. if (input.value == void 0 || selectionInfo == void 0) return;
  7123. const { value } = input.value;
  7124. const { beforeTxt, afterTxt, selectionStart } = selectionInfo;
  7125. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0) return;
  7126. let startPos = value.length;
  7127. if (value.endsWith(afterTxt)) startPos = value.length - afterTxt.length;
  7128. else if (value.startsWith(beforeTxt)) startPos = beforeTxt.length;
  7129. else {
  7130. const beforeLastChar = beforeTxt[selectionStart - 1];
  7131. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  7132. if (newIndex !== -1) startPos = newIndex + 1;
  7133. }
  7134. input.value.setSelectionRange(startPos, startPos);
  7135. }
  7136. return [recordCursor, setCursor];
  7137. }
  7138. //#endregion
  7139. //#region ../../packages/hooks/use-ordered-children/index.ts
  7140. const getOrderedChildren = (vm, childComponentName, children) => {
  7141. return flattedChildren(vm.subTree).filter((n) => isVNode(n) && n.type?.name === childComponentName && !!n.component).map((n) => n.component.uid).map((uid) => children[uid]).filter((p) => !!p);
  7142. };
  7143. const useOrderedChildren = (vm, childComponentName) => {
  7144. const children = shallowRef({});
  7145. const orderedChildren = shallowRef([]);
  7146. const nodesMap = /* @__PURE__ */ new WeakMap();
  7147. const addChild = (child) => {
  7148. children.value[child.uid] = child;
  7149. triggerRef(children);
  7150. onMounted(() => {
  7151. const childNode = child.getVnode().el;
  7152. const parentNode = childNode.parentNode;
  7153. if (!nodesMap.has(parentNode)) {
  7154. nodesMap.set(parentNode, []);
  7155. const originalFn = parentNode.insertBefore.bind(parentNode);
  7156. parentNode.insertBefore = (node, anchor) => {
  7157. if (nodesMap.get(parentNode).some((el) => node === el || anchor === el)) triggerRef(children);
  7158. return originalFn(node, anchor);
  7159. };
  7160. }
  7161. nodesMap.get(parentNode).push(childNode);
  7162. });
  7163. };
  7164. const removeChild = (child) => {
  7165. delete children.value[child.uid];
  7166. triggerRef(children);
  7167. const childNode = child.getVnode().el;
  7168. const parentNode = childNode.parentNode;
  7169. const childNodes = nodesMap.get(parentNode);
  7170. const index = childNodes.indexOf(childNode);
  7171. childNodes.splice(index, 1);
  7172. };
  7173. const sortChildren = () => {
  7174. orderedChildren.value = getOrderedChildren(vm, childComponentName, children.value);
  7175. };
  7176. const IsolatedRenderer = (props) => {
  7177. return props.render();
  7178. };
  7179. return {
  7180. children: orderedChildren,
  7181. addChild,
  7182. removeChild,
  7183. ChildrenSorter: defineComponent({ setup(_, { slots }) {
  7184. return () => {
  7185. sortChildren();
  7186. return slots.default ? h(IsolatedRenderer, { render: slots.default }) : null;
  7187. };
  7188. } })
  7189. };
  7190. };
  7191. //#endregion
  7192. //#region ../../packages/hooks/use-size/index.ts
  7193. const useSizeProp = buildProp({
  7194. type: String,
  7195. values: componentSizes,
  7196. required: false
  7197. });
  7198. const useSizeProps = { size: useSizeProp };
  7199. const SIZE_INJECTION_KEY = Symbol("size");
  7200. const useGlobalSize = () => {
  7201. const injectedSize = inject(SIZE_INJECTION_KEY, {});
  7202. return computed(() => {
  7203. return unref(injectedSize.size) || "";
  7204. });
  7205. };
  7206. //#endregion
  7207. //#region ../../packages/hooks/use-focus-controller/index.ts
  7208. function useFocusController(target, { disabled, beforeFocus, afterFocus, beforeBlur, afterBlur } = {}) {
  7209. const { emit } = getCurrentInstance();
  7210. const wrapperRef = shallowRef();
  7211. const isFocused = ref(false);
  7212. const handleFocus = (event) => {
  7213. const cancelFocus = isFunction$1(beforeFocus) ? beforeFocus(event) : false;
  7214. if (unref(disabled) || isFocused.value || cancelFocus) return;
  7215. isFocused.value = true;
  7216. emit("focus", event);
  7217. afterFocus?.();
  7218. };
  7219. const handleBlur = (event) => {
  7220. const cancelBlur = isFunction$1(beforeBlur) ? beforeBlur(event) : false;
  7221. if (unref(disabled) || event.relatedTarget && wrapperRef.value?.contains(event.relatedTarget) || cancelBlur) return;
  7222. isFocused.value = false;
  7223. emit("blur", event);
  7224. afterBlur?.();
  7225. };
  7226. const handleClick = (event) => {
  7227. if (unref(disabled) || isFocusable(event.target) || wrapperRef.value?.contains(document.activeElement) && wrapperRef.value !== document.activeElement) return;
  7228. target.value?.focus();
  7229. };
  7230. watch([wrapperRef, () => unref(disabled)], ([el, disabled]) => {
  7231. if (!el) return;
  7232. if (disabled) el.removeAttribute("tabindex");
  7233. else el.setAttribute("tabindex", "-1");
  7234. });
  7235. useEventListener(wrapperRef, "focus", handleFocus, true);
  7236. useEventListener(wrapperRef, "blur", handleBlur, true);
  7237. useEventListener(wrapperRef, "click", handleClick, true);
  7238. return {
  7239. isFocused,
  7240. wrapperRef,
  7241. handleFocus,
  7242. handleBlur
  7243. };
  7244. }
  7245. //#endregion
  7246. //#region ../../packages/hooks/use-composition/index.ts
  7247. function useComposition({ afterComposition, emit }) {
  7248. const isComposing = ref(false);
  7249. const handleCompositionStart = (event) => {
  7250. emit?.("compositionstart", event);
  7251. isComposing.value = true;
  7252. };
  7253. const handleCompositionUpdate = (event) => {
  7254. emit?.("compositionupdate", event);
  7255. isComposing.value = true;
  7256. };
  7257. const handleCompositionEnd = (event) => {
  7258. emit?.("compositionend", event);
  7259. if (isComposing.value) {
  7260. isComposing.value = false;
  7261. nextTick(() => afterComposition(event));
  7262. }
  7263. };
  7264. const handleComposition = (event) => {
  7265. event.type === "compositionend" ? handleCompositionEnd(event) : handleCompositionUpdate(event);
  7266. };
  7267. return {
  7268. isComposing,
  7269. handleComposition,
  7270. handleCompositionStart,
  7271. handleCompositionUpdate,
  7272. handleCompositionEnd
  7273. };
  7274. }
  7275. //#endregion
  7276. //#region ../../packages/hooks/use-empty-values/index.ts
  7277. const emptyValuesContextKey = Symbol("emptyValuesContextKey");
  7278. const SCOPE = "use-empty-values";
  7279. const DEFAULT_EMPTY_VALUES = [
  7280. "",
  7281. void 0,
  7282. null
  7283. ];
  7284. const DEFAULT_VALUE_ON_CLEAR = void 0;
  7285. const useEmptyValuesProps = buildProps({
  7286. emptyValues: Array,
  7287. valueOnClear: {
  7288. type: definePropType([
  7289. String,
  7290. Number,
  7291. Boolean,
  7292. Function
  7293. ]),
  7294. default: void 0,
  7295. validator: (val) => {
  7296. val = isFunction$1(val) ? val() : val;
  7297. if (isArray$1(val)) return val.every((item) => !item);
  7298. return !val;
  7299. }
  7300. }
  7301. });
  7302. const useEmptyValues = (props, defaultValue) => {
  7303. const config = getCurrentInstance() ? inject(emptyValuesContextKey, ref({})) : ref({});
  7304. const emptyValues = computed(() => props.emptyValues || config.value.emptyValues || DEFAULT_EMPTY_VALUES);
  7305. const valueOnClear = computed(() => {
  7306. if (isFunction$1(props.valueOnClear)) return props.valueOnClear();
  7307. else if (props.valueOnClear !== void 0) return props.valueOnClear;
  7308. else if (isFunction$1(config.value.valueOnClear)) return config.value.valueOnClear();
  7309. else if (config.value.valueOnClear !== void 0) return config.value.valueOnClear;
  7310. return defaultValue !== void 0 ? defaultValue : void 0;
  7311. });
  7312. const isEmptyValue = (value) => {
  7313. let result = true;
  7314. if (isArray$1(value)) result = emptyValues.value.some((emptyValue) => {
  7315. return isEqual$1(value, emptyValue);
  7316. });
  7317. else result = emptyValues.value.includes(value);
  7318. return result;
  7319. };
  7320. if (!isEmptyValue(valueOnClear.value)) /* @__PURE__ */ debugWarn(SCOPE, "value-on-clear should be a value of empty-values");
  7321. return {
  7322. emptyValues,
  7323. valueOnClear,
  7324. isEmptyValue
  7325. };
  7326. };
  7327. //#endregion
  7328. //#region ../../packages/hooks/use-aria/index.ts
  7329. const ariaProps = buildProps({
  7330. ariaLabel: String,
  7331. ariaOrientation: {
  7332. type: String,
  7333. values: [
  7334. "horizontal",
  7335. "vertical",
  7336. "undefined"
  7337. ]
  7338. },
  7339. ariaControls: String
  7340. });
  7341. const useAriaProps = (arias) => {
  7342. return pick(ariaProps, arias);
  7343. };
  7344. //#endregion
  7345. //#region ../../packages/components/config-provider/src/constants.ts
  7346. const configProviderContextKey = Symbol();
  7347. //#endregion
  7348. //#region ../../packages/components/config-provider/src/hooks/use-global-config.ts
  7349. const globalConfig = ref();
  7350. function useGlobalConfig(key, defaultValue = void 0) {
  7351. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  7352. if (key) return computed(() => config.value?.[key] ?? defaultValue);
  7353. else return config;
  7354. }
  7355. function useGlobalComponentSettings(block, sizeFallback) {
  7356. const config = useGlobalConfig();
  7357. const ns = useNamespace(block, computed(() => config.value?.namespace || "el"));
  7358. const locale = useLocale(computed(() => config.value?.locale));
  7359. const zIndex = useZIndex(computed(() => {
  7360. const zIndex = config.value?.zIndex;
  7361. return isNil(zIndex) || Number.isNaN(zIndex) ? defaultInitialZIndex : zIndex;
  7362. }));
  7363. const size = computed(() => unref(sizeFallback) || config.value?.size || "");
  7364. provideGlobalConfig(computed(() => unref(config) || {}));
  7365. return {
  7366. ns,
  7367. locale,
  7368. zIndex,
  7369. size
  7370. };
  7371. }
  7372. const provideGlobalConfig = (config, app, global = false) => {
  7373. const inSetup = !!getCurrentInstance();
  7374. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  7375. const provideFn = app?.provide ?? (inSetup ? provide : void 0);
  7376. if (!provideFn) {
  7377. /* @__PURE__ */ debugWarn("provideGlobalConfig", "provideGlobalConfig() can only be used inside setup().");
  7378. return;
  7379. }
  7380. const context = computed(() => {
  7381. const cfg = unref(config);
  7382. if (!oldConfig?.value) return cfg;
  7383. return mergeConfig(oldConfig.value, cfg);
  7384. });
  7385. provideFn(configProviderContextKey, context);
  7386. provideFn(localeContextKey, computed(() => context.value.locale));
  7387. provideFn(namespaceContextKey, computed(() => context.value.namespace));
  7388. provideFn(zIndexContextKey, computed(() => context.value.zIndex));
  7389. provideFn(SIZE_INJECTION_KEY, { size: computed(() => context.value.size || "") });
  7390. provideFn(emptyValuesContextKey, computed(() => ({
  7391. emptyValues: context.value.emptyValues,
  7392. valueOnClear: context.value.valueOnClear
  7393. })));
  7394. if (global || !globalConfig.value) globalConfig.value = context.value;
  7395. return context;
  7396. };
  7397. const mergeConfig = (a, b) => {
  7398. const keys = [...new Set([...keysOf(a), ...keysOf(b)])];
  7399. const obj = {};
  7400. for (const key of keys) obj[key] = b[key] !== void 0 ? b[key] : a[key];
  7401. return obj;
  7402. };
  7403. //#endregion
  7404. //#region ../../packages/components/config-provider/src/config-provider-props.ts
  7405. const configProviderProps = buildProps({
  7406. a11y: {
  7407. type: Boolean,
  7408. default: true
  7409. },
  7410. locale: { type: definePropType(Object) },
  7411. size: useSizeProp,
  7412. button: { type: definePropType(Object) },
  7413. card: { type: definePropType(Object) },
  7414. dialog: { type: definePropType(Object) },
  7415. link: { type: definePropType(Object) },
  7416. experimentalFeatures: { type: definePropType(Object) },
  7417. keyboardNavigation: {
  7418. type: Boolean,
  7419. default: true
  7420. },
  7421. message: { type: definePropType(Object) },
  7422. zIndex: Number,
  7423. namespace: {
  7424. type: String,
  7425. default: "el"
  7426. },
  7427. table: { type: definePropType(Object) },
  7428. ...useEmptyValuesProps
  7429. });
  7430. //#endregion
  7431. //#region ../../packages/components/config-provider/src/config-provider.ts
  7432. const messageConfig = { placement: "top" };
  7433. const ConfigProvider = defineComponent({
  7434. name: "ElConfigProvider",
  7435. props: configProviderProps,
  7436. setup(props, { slots }) {
  7437. const config = provideGlobalConfig(props);
  7438. watch(() => props.message, (val) => {
  7439. Object.assign(messageConfig, config?.value?.message ?? {}, val ?? {});
  7440. }, {
  7441. immediate: true,
  7442. deep: true
  7443. });
  7444. return () => renderSlot(slots, "default", { config: config?.value });
  7445. }
  7446. });
  7447. //#endregion
  7448. //#region ../../packages/components/config-provider/index.ts
  7449. const ElConfigProvider = withInstall(ConfigProvider);
  7450. //#endregion
  7451. //#region ../../packages/element-plus/version.ts
  7452. const version$1 = "2.14.2";
  7453. //#endregion
  7454. //#region ../../packages/element-plus/make-installer.ts
  7455. const makeInstaller = (components = []) => {
  7456. const install = (app, options) => {
  7457. if (app[INSTALLED_KEY]) return;
  7458. app[INSTALLED_KEY] = true;
  7459. components.forEach((c) => app.use(c));
  7460. if (options) provideGlobalConfig(options, app, true);
  7461. };
  7462. return {
  7463. version: version$1,
  7464. install
  7465. };
  7466. };
  7467. //#endregion
  7468. //#region ../../packages/components/affix/src/affix.ts
  7469. const affixProps = buildProps({
  7470. zIndex: {
  7471. type: definePropType([Number, String]),
  7472. default: 100
  7473. },
  7474. target: {
  7475. type: String,
  7476. default: ""
  7477. },
  7478. offset: {
  7479. type: Number,
  7480. default: 0
  7481. },
  7482. position: {
  7483. type: String,
  7484. values: ["top", "bottom"],
  7485. default: "top"
  7486. },
  7487. teleported: Boolean,
  7488. appendTo: {
  7489. type: definePropType([String, Object]),
  7490. default: "body"
  7491. }
  7492. });
  7493. const affixEmits = {
  7494. scroll: ({ scrollTop, fixed }) => isNumber(scrollTop) && isBoolean(fixed),
  7495. [CHANGE_EVENT]: (fixed) => isBoolean(fixed)
  7496. };
  7497. //#endregion
  7498. //#region ../../packages/components/affix/src/affix.vue?vue&type=script&setup=true&lang.ts
  7499. const COMPONENT_NAME$22 = "ElAffix";
  7500. var affix_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7501. name: COMPONENT_NAME$22,
  7502. __name: "affix",
  7503. props: affixProps,
  7504. emits: affixEmits,
  7505. setup(__props, { expose: __expose, emit: __emit }) {
  7506. const props = __props;
  7507. const emit = __emit;
  7508. const ns = useNamespace("affix");
  7509. const target = shallowRef();
  7510. const root = shallowRef();
  7511. const scrollContainer = shallowRef();
  7512. const { height: windowHeight } = useWindowSize();
  7513. const { height: rootHeight, width: rootWidth, top: rootTop, bottom: rootBottom, left: rootLeft, update: updateRoot } = useElementBounding(root, { windowScroll: false });
  7514. const targetRect = useElementBounding(target);
  7515. const fixed = ref(false);
  7516. const scrollTop = ref(0);
  7517. const transform = ref(0);
  7518. const teleportDisabled = computed(() => {
  7519. return !props.teleported || !fixed.value;
  7520. });
  7521. const rootStyle = computed(() => {
  7522. return {
  7523. display: "flow-root",
  7524. height: fixed.value ? `${rootHeight.value}px` : "",
  7525. width: fixed.value ? `${rootWidth.value}px` : ""
  7526. };
  7527. });
  7528. const affixStyle = computed(() => {
  7529. if (!fixed.value) return {};
  7530. const offset = addUnit(props.offset);
  7531. return {
  7532. height: `${rootHeight.value}px`,
  7533. width: `${rootWidth.value}px`,
  7534. top: props.position === "top" ? offset : "",
  7535. bottom: props.position === "bottom" ? offset : "",
  7536. left: props.teleported ? `${rootLeft.value}px` : "",
  7537. transform: transform.value ? `translateY(${transform.value}px)` : "",
  7538. zIndex: props.zIndex
  7539. };
  7540. });
  7541. const update = () => {
  7542. if (!scrollContainer.value) return;
  7543. scrollTop.value = scrollContainer.value instanceof Window ? document.documentElement.scrollTop : scrollContainer.value.scrollTop || 0;
  7544. const { position, target, offset } = props;
  7545. const rootHeightOffset = offset + rootHeight.value;
  7546. if (position === "top") if (target) {
  7547. const difference = targetRect.bottom.value - rootHeightOffset;
  7548. fixed.value = offset > rootTop.value && targetRect.bottom.value > 0;
  7549. transform.value = difference < 0 ? difference : 0;
  7550. } else fixed.value = offset > rootTop.value;
  7551. else if (target) {
  7552. const difference = windowHeight.value - targetRect.top.value - rootHeightOffset;
  7553. fixed.value = windowHeight.value - offset < rootBottom.value && windowHeight.value > targetRect.top.value;
  7554. transform.value = difference < 0 ? -difference : 0;
  7555. } else fixed.value = windowHeight.value - offset < rootBottom.value;
  7556. };
  7557. const updateRootRect = async () => {
  7558. if (!fixed.value) {
  7559. updateRoot();
  7560. return;
  7561. }
  7562. fixed.value = false;
  7563. await nextTick();
  7564. updateRoot();
  7565. fixed.value = true;
  7566. };
  7567. const handleScroll = async () => {
  7568. updateRoot();
  7569. await nextTick();
  7570. emit("scroll", {
  7571. scrollTop: scrollTop.value,
  7572. fixed: fixed.value
  7573. });
  7574. };
  7575. watch(fixed, (val) => emit(CHANGE_EVENT, val));
  7576. onMounted(() => {
  7577. if (props.target) {
  7578. target.value = document.querySelector(props.target) ?? void 0;
  7579. if (!target.value) throwError(COMPONENT_NAME$22, `Target does not exist: ${props.target}`);
  7580. } else target.value = document.documentElement;
  7581. scrollContainer.value = getScrollContainer(root.value, true);
  7582. updateRoot();
  7583. });
  7584. onActivated(() => {
  7585. nextTick(updateRootRect);
  7586. });
  7587. onDeactivated(() => {
  7588. fixed.value = false;
  7589. });
  7590. useEventListener(scrollContainer, "scroll", handleScroll);
  7591. watchEffect(update);
  7592. __expose({
  7593. update,
  7594. updateRoot: updateRootRect
  7595. });
  7596. return (_ctx, _cache) => {
  7597. return openBlock(), createElementBlock("div", {
  7598. ref_key: "root",
  7599. ref: root,
  7600. class: normalizeClass(unref(ns).b()),
  7601. style: normalizeStyle(rootStyle.value)
  7602. }, [(openBlock(), createBlock(Teleport, {
  7603. disabled: teleportDisabled.value,
  7604. to: __props.appendTo
  7605. }, [createElementVNode("div", {
  7606. class: normalizeClass({ [unref(ns).m("fixed")]: fixed.value }),
  7607. style: normalizeStyle(affixStyle.value)
  7608. }, [renderSlot(_ctx.$slots, "default")], 6)], 8, ["disabled", "to"]))], 6);
  7609. };
  7610. }
  7611. });
  7612. //#endregion
  7613. //#region ../../packages/components/affix/src/affix.vue
  7614. var affix_default = affix_vue_vue_type_script_setup_true_lang_default;
  7615. //#endregion
  7616. //#region ../../packages/components/affix/index.ts
  7617. const ElAffix = withInstall(affix_default);
  7618. //#endregion
  7619. //#region ../../packages/components/alert/src/alert.ts
  7620. const alertEffects = ["light", "dark"];
  7621. const alertProps = buildProps({
  7622. title: {
  7623. type: String,
  7624. default: ""
  7625. },
  7626. description: {
  7627. type: String,
  7628. default: ""
  7629. },
  7630. type: {
  7631. type: String,
  7632. values: keysOf(TypeComponentsMap),
  7633. default: "info"
  7634. },
  7635. closable: {
  7636. type: Boolean,
  7637. default: true
  7638. },
  7639. closeText: {
  7640. type: String,
  7641. default: ""
  7642. },
  7643. showIcon: Boolean,
  7644. center: Boolean,
  7645. effect: {
  7646. type: String,
  7647. values: alertEffects,
  7648. default: "light"
  7649. }
  7650. });
  7651. const alertEmits = { close: (evt) => evt instanceof MouseEvent };
  7652. //#endregion
  7653. //#region ../../packages/components/icon/src/icon.ts
  7654. const iconProps = buildProps({
  7655. size: { type: definePropType([Number, String]) },
  7656. color: { type: String }
  7657. });
  7658. //#endregion
  7659. //#region ../../packages/components/icon/src/icon.vue?vue&type=script&setup=true&lang.ts
  7660. var icon_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7661. name: "ElIcon",
  7662. inheritAttrs: false,
  7663. __name: "icon",
  7664. props: iconProps,
  7665. setup(__props) {
  7666. const props = __props;
  7667. const ns = useNamespace("icon");
  7668. const style = computed(() => {
  7669. const { size, color } = props;
  7670. const fontSize = addUnit(size);
  7671. if (!fontSize && !color) return {};
  7672. return {
  7673. fontSize,
  7674. "--color": color
  7675. };
  7676. });
  7677. return (_ctx, _cache) => {
  7678. return openBlock(), createElementBlock("i", mergeProps({
  7679. class: unref(ns).b(),
  7680. style: style.value
  7681. }, _ctx.$attrs), [renderSlot(_ctx.$slots, "default")], 16);
  7682. };
  7683. }
  7684. });
  7685. //#endregion
  7686. //#region ../../packages/components/icon/src/icon.vue
  7687. var icon_default = icon_vue_vue_type_script_setup_true_lang_default;
  7688. //#endregion
  7689. //#region ../../packages/components/icon/index.ts
  7690. const ElIcon = withInstall(icon_default);
  7691. //#endregion
  7692. //#region ../../packages/components/alert/src/alert.vue?vue&type=script&setup=true&lang.ts
  7693. var alert_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7694. name: "ElAlert",
  7695. __name: "alert",
  7696. props: alertProps,
  7697. emits: alertEmits,
  7698. setup(__props, { emit: __emit }) {
  7699. const { Close } = TypeComponents;
  7700. const props = __props;
  7701. const emit = __emit;
  7702. const slots = useSlots();
  7703. const ns = useNamespace("alert");
  7704. const visible = ref(true);
  7705. const iconComponent = computed(() => TypeComponentsMap[props.type]);
  7706. const hasDesc = computed(() => {
  7707. if (props.description) return true;
  7708. const slotContent = slots.default?.();
  7709. if (!slotContent) return false;
  7710. return flattedChildren(slotContent).some((child) => !isComment(child));
  7711. });
  7712. const close = (evt) => {
  7713. visible.value = false;
  7714. emit("close", evt);
  7715. };
  7716. return (_ctx, _cache) => {
  7717. return openBlock(), createBlock(Transition, {
  7718. name: unref(ns).b("fade"),
  7719. persisted: ""
  7720. }, {
  7721. default: withCtx(() => [withDirectives(createElementVNode("div", {
  7722. class: normalizeClass([
  7723. unref(ns).b(),
  7724. unref(ns).m(__props.type),
  7725. unref(ns).is("center", __props.center),
  7726. unref(ns).is(__props.effect)
  7727. ]),
  7728. role: "alert"
  7729. }, [__props.showIcon && (_ctx.$slots.icon || iconComponent.value) ? (openBlock(), createBlock(unref(ElIcon), {
  7730. key: 0,
  7731. class: normalizeClass([unref(ns).e("icon"), unref(ns).is("big", hasDesc.value)])
  7732. }, {
  7733. default: withCtx(() => [renderSlot(_ctx.$slots, "icon", {}, () => [(openBlock(), createBlock(resolveDynamicComponent(iconComponent.value)))])]),
  7734. _: 3
  7735. }, 8, ["class"])) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("content")) }, [
  7736. __props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("span", {
  7737. key: 0,
  7738. class: normalizeClass([unref(ns).e("title"), { "with-description": hasDesc.value }])
  7739. }, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 2)) : createCommentVNode("v-if", true),
  7740. hasDesc.value ? (openBlock(), createElementBlock("p", {
  7741. key: 1,
  7742. class: normalizeClass(unref(ns).e("description"))
  7743. }, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.description), 1)])], 2)) : createCommentVNode("v-if", true),
  7744. __props.closable ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [__props.closeText ? (openBlock(), createElementBlock("div", {
  7745. key: 0,
  7746. class: normalizeClass([unref(ns).e("close-btn"), unref(ns).is("customed")]),
  7747. onClick: close
  7748. }, toDisplayString(__props.closeText), 3)) : (openBlock(), createBlock(unref(ElIcon), {
  7749. key: 1,
  7750. class: normalizeClass(unref(ns).e("close-btn")),
  7751. onClick: close
  7752. }, {
  7753. default: withCtx(() => [createVNode(unref(Close))]),
  7754. _: 1
  7755. }, 8, ["class"]))], 64)) : createCommentVNode("v-if", true)
  7756. ], 2)], 2), [[vShow, visible.value]])]),
  7757. _: 3
  7758. }, 8, ["name"]);
  7759. };
  7760. }
  7761. });
  7762. //#endregion
  7763. //#region ../../packages/components/alert/src/alert.vue
  7764. var alert_default = alert_vue_vue_type_script_setup_true_lang_default;
  7765. //#endregion
  7766. //#region ../../packages/components/alert/index.ts
  7767. const ElAlert = withInstall(alert_default);
  7768. //#endregion
  7769. //#region ../../packages/components/popper/src/popper.ts
  7770. const Effect = {
  7771. LIGHT: "light",
  7772. DARK: "dark"
  7773. };
  7774. const roleTypes = [
  7775. "dialog",
  7776. "grid",
  7777. "group",
  7778. "listbox",
  7779. "menu",
  7780. "navigation",
  7781. "tooltip",
  7782. "tree"
  7783. ];
  7784. const popperProps = buildProps({ role: {
  7785. type: String,
  7786. values: roleTypes,
  7787. default: "tooltip"
  7788. } });
  7789. const usePopperProps = popperProps;
  7790. //#endregion
  7791. //#region ../../packages/components/popper/src/constants.ts
  7792. const POPPER_INJECTION_KEY = Symbol("popper");
  7793. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  7794. //#endregion
  7795. //#region ../../packages/components/popper/src/popper.vue?vue&type=script&setup=true&lang.ts
  7796. var popper_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7797. name: "ElPopper",
  7798. inheritAttrs: false,
  7799. __name: "popper",
  7800. props: popperProps,
  7801. setup(__props, { expose: __expose }) {
  7802. const props = __props;
  7803. const popperProvides = {
  7804. triggerRef: ref(),
  7805. popperInstanceRef: ref(),
  7806. contentRef: ref(),
  7807. referenceRef: ref(),
  7808. role: computed(() => props.role)
  7809. };
  7810. __expose(popperProvides);
  7811. provide(POPPER_INJECTION_KEY, popperProvides);
  7812. return (_ctx, _cache) => {
  7813. return renderSlot(_ctx.$slots, "default");
  7814. };
  7815. }
  7816. });
  7817. //#endregion
  7818. //#region ../../packages/components/popper/src/popper.vue
  7819. var popper_default = popper_vue_vue_type_script_setup_true_lang_default;
  7820. //#endregion
  7821. //#region ../../packages/components/popper/src/arrow.vue?vue&type=script&setup=true&lang.ts
  7822. var arrow_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  7823. name: "ElPopperArrow",
  7824. inheritAttrs: false,
  7825. __name: "arrow",
  7826. setup(__props, { expose: __expose }) {
  7827. const ns = useNamespace("popper");
  7828. const { arrowRef, arrowStyle } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  7829. onBeforeUnmount(() => {
  7830. arrowRef.value = void 0;
  7831. });
  7832. __expose({ arrowRef });
  7833. return (_ctx, _cache) => {
  7834. return openBlock(), createElementBlock("span", {
  7835. ref_key: "arrowRef",
  7836. ref: arrowRef,
  7837. class: normalizeClass(unref(ns).e("arrow")),
  7838. style: normalizeStyle(unref(arrowStyle)),
  7839. "data-popper-arrow": ""
  7840. }, null, 6);
  7841. };
  7842. }
  7843. });
  7844. //#endregion
  7845. //#region ../../packages/components/popper/src/arrow.vue
  7846. var arrow_default = arrow_vue_vue_type_script_setup_true_lang_default;
  7847. //#endregion
  7848. //#region ../../packages/components/popper/src/trigger.ts
  7849. const popperTriggerProps = buildProps({
  7850. virtualRef: { type: definePropType(Object) },
  7851. virtualTriggering: Boolean,
  7852. onMouseenter: { type: definePropType(Function) },
  7853. onMouseleave: { type: definePropType(Function) },
  7854. onClick: { type: definePropType(Function) },
  7855. onKeydown: { type: definePropType(Function) },
  7856. onFocus: { type: definePropType(Function) },
  7857. onBlur: { type: definePropType(Function) },
  7858. onContextmenu: { type: definePropType(Function) },
  7859. id: String,
  7860. open: Boolean
  7861. });
  7862. const usePopperTriggerProps = popperTriggerProps;
  7863. //#endregion
  7864. //#region ../../packages/components/slot/src/only-child.tsx
  7865. const NAME = "ElOnlyChild";
  7866. const OnlyChild = /* @__PURE__ */ defineComponent({
  7867. name: NAME,
  7868. setup(_, { slots, attrs }) {
  7869. const forwardRefDirective = useForwardRefDirective(inject(FORWARD_REF_INJECTION_KEY)?.setForwardRef ?? NOOP);
  7870. return () => {
  7871. const defaultSlot = slots.default?.(attrs);
  7872. if (!defaultSlot) return null;
  7873. const [firstLegitNode, length] = findFirstLegitChild(defaultSlot);
  7874. if (!firstLegitNode) {
  7875. /* @__PURE__ */ debugWarn(NAME, "no valid child node found");
  7876. return null;
  7877. }
  7878. if (length > 1) /* @__PURE__ */ debugWarn(NAME, "requires exact only one valid child.");
  7879. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  7880. };
  7881. }
  7882. });
  7883. function findFirstLegitChild(node) {
  7884. if (!node) return [null, 0];
  7885. const children = node;
  7886. const len = children.filter((c) => c.type !== Comment).length;
  7887. for (const child of children) {
  7888. if (isObject$1(child)) switch (child.type) {
  7889. case Comment: continue;
  7890. case Text:
  7891. case "svg": return [wrapTextContent(child), len];
  7892. case Fragment: return findFirstLegitChild(child.children);
  7893. default: return [child, len];
  7894. }
  7895. return [wrapTextContent(child), len];
  7896. }
  7897. return [null, 0];
  7898. }
  7899. function wrapTextContent(s) {
  7900. return createVNode("span", { "class": useNamespace("only-child").e("content") }, [s]);
  7901. }
  7902. //#endregion
  7903. //#region ../../packages/components/popper/src/trigger.vue?vue&type=script&setup=true&lang.ts
  7904. var trigger_vue_vue_type_script_setup_true_lang_default$1 = /* @__PURE__ */ defineComponent({
  7905. name: "ElPopperTrigger",
  7906. inheritAttrs: false,
  7907. __name: "trigger",
  7908. props: popperTriggerProps,
  7909. setup(__props, { expose: __expose }) {
  7910. const props = __props;
  7911. const { role, triggerRef } = inject(POPPER_INJECTION_KEY, void 0);
  7912. useForwardRef(triggerRef);
  7913. const ariaControls = computed(() => {
  7914. return ariaHaspopup.value ? props.id : void 0;
  7915. });
  7916. const ariaDescribedby = computed(() => {
  7917. if (role && role.value === "tooltip") return props.open && props.id ? props.id : void 0;
  7918. });
  7919. const ariaHaspopup = computed(() => {
  7920. if (role && role.value !== "tooltip") return role.value;
  7921. });
  7922. const ariaExpanded = computed(() => {
  7923. return ariaHaspopup.value ? `${props.open}` : void 0;
  7924. });
  7925. let virtualTriggerAriaStopWatch = void 0;
  7926. const TRIGGER_ELE_EVENTS = [
  7927. "onMouseenter",
  7928. "onMouseleave",
  7929. "onClick",
  7930. "onKeydown",
  7931. "onFocus",
  7932. "onBlur",
  7933. "onContextmenu"
  7934. ];
  7935. onMounted(() => {
  7936. watch(() => props.virtualRef, (virtualEl) => {
  7937. if (virtualEl) triggerRef.value = unrefElement(virtualEl);
  7938. }, { immediate: true });
  7939. watch(triggerRef, (el, prevEl) => {
  7940. virtualTriggerAriaStopWatch?.();
  7941. virtualTriggerAriaStopWatch = void 0;
  7942. if (isElement$1(prevEl)) TRIGGER_ELE_EVENTS.forEach((eventName) => {
  7943. const handler = props[eventName];
  7944. if (handler) prevEl.removeEventListener(eventName.slice(2).toLowerCase(), handler, ["onFocus", "onBlur"].includes(eventName));
  7945. });
  7946. if (isElement$1(el)) {
  7947. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  7948. const handler = props[eventName];
  7949. if (handler) el.addEventListener(eventName.slice(2).toLowerCase(), handler, ["onFocus", "onBlur"].includes(eventName));
  7950. });
  7951. if (isFocusable(el)) virtualTriggerAriaStopWatch = watch([
  7952. ariaControls,
  7953. ariaDescribedby,
  7954. ariaHaspopup,
  7955. ariaExpanded
  7956. ], (watches) => {
  7957. [
  7958. "aria-controls",
  7959. "aria-describedby",
  7960. "aria-haspopup",
  7961. "aria-expanded"
  7962. ].forEach((key, idx) => {
  7963. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  7964. });
  7965. }, { immediate: true });
  7966. }
  7967. if (isElement$1(prevEl) && isFocusable(prevEl)) [
  7968. "aria-controls",
  7969. "aria-describedby",
  7970. "aria-haspopup",
  7971. "aria-expanded"
  7972. ].forEach((key) => prevEl.removeAttribute(key));
  7973. }, { immediate: true });
  7974. });
  7975. onBeforeUnmount(() => {
  7976. virtualTriggerAriaStopWatch?.();
  7977. virtualTriggerAriaStopWatch = void 0;
  7978. if (triggerRef.value && isElement$1(triggerRef.value)) {
  7979. const el = triggerRef.value;
  7980. TRIGGER_ELE_EVENTS.forEach((eventName) => {
  7981. const handler = props[eventName];
  7982. if (handler) el.removeEventListener(eventName.slice(2).toLowerCase(), handler, ["onFocus", "onBlur"].includes(eventName));
  7983. });
  7984. triggerRef.value = void 0;
  7985. }
  7986. });
  7987. __expose({ triggerRef });
  7988. return (_ctx, _cache) => {
  7989. return !__props.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  7990. "aria-controls": ariaControls.value,
  7991. "aria-describedby": ariaDescribedby.value,
  7992. "aria-expanded": ariaExpanded.value,
  7993. "aria-haspopup": ariaHaspopup.value
  7994. }), {
  7995. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  7996. _: 3
  7997. }, 16, [
  7998. "aria-controls",
  7999. "aria-describedby",
  8000. "aria-expanded",
  8001. "aria-haspopup"
  8002. ])) : createCommentVNode("v-if", true);
  8003. };
  8004. }
  8005. });
  8006. //#endregion
  8007. //#region ../../packages/components/popper/src/trigger.vue
  8008. var trigger_default = trigger_vue_vue_type_script_setup_true_lang_default$1;
  8009. //#endregion
  8010. //#region ../../packages/components/popper/src/arrow.ts
  8011. const popperArrowProps = buildProps({ arrowOffset: {
  8012. type: Number,
  8013. default: 5
  8014. } });
  8015. const popperArrowPropsDefaults = { arrowOffset: 5 };
  8016. const usePopperArrowProps = popperArrowProps;
  8017. //#endregion
  8018. //#region ../../packages/components/popper/src/content.ts
  8019. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  8020. const popperCoreConfigProps = buildProps({
  8021. boundariesPadding: {
  8022. type: Number,
  8023. default: 0
  8024. },
  8025. fallbackPlacements: {
  8026. type: definePropType(Array),
  8027. default: void 0
  8028. },
  8029. gpuAcceleration: {
  8030. type: Boolean,
  8031. default: true
  8032. },
  8033. offset: {
  8034. type: Number,
  8035. default: 12
  8036. },
  8037. placement: {
  8038. type: String,
  8039. values: Ee,
  8040. default: "bottom"
  8041. },
  8042. popperOptions: {
  8043. type: definePropType(Object),
  8044. default: () => ({})
  8045. },
  8046. strategy: {
  8047. type: String,
  8048. values: POSITIONING_STRATEGIES,
  8049. default: "absolute"
  8050. }
  8051. });
  8052. const popperContentProps = buildProps({
  8053. ...popperCoreConfigProps,
  8054. ...popperArrowProps,
  8055. id: String,
  8056. style: {
  8057. type: definePropType([
  8058. String,
  8059. Array,
  8060. Object,
  8061. Boolean
  8062. ]),
  8063. default: void 0
  8064. },
  8065. className: { type: definePropType([
  8066. String,
  8067. Array,
  8068. Object
  8069. ]) },
  8070. effect: {
  8071. type: definePropType(String),
  8072. default: "dark"
  8073. },
  8074. visible: Boolean,
  8075. enterable: {
  8076. type: Boolean,
  8077. default: true
  8078. },
  8079. pure: Boolean,
  8080. focusOnShow: Boolean,
  8081. trapping: Boolean,
  8082. popperClass: { type: definePropType([
  8083. String,
  8084. Array,
  8085. Object
  8086. ]) },
  8087. popperStyle: {
  8088. type: definePropType([
  8089. String,
  8090. Array,
  8091. Object,
  8092. Boolean
  8093. ]),
  8094. default: void 0
  8095. },
  8096. referenceEl: { type: definePropType(Object) },
  8097. triggerTargetEl: { type: definePropType(Object) },
  8098. stopPopperMouseEvent: {
  8099. type: Boolean,
  8100. default: true
  8101. },
  8102. virtualTriggering: Boolean,
  8103. zIndex: Number,
  8104. ...useAriaProps(["ariaLabel"]),
  8105. loop: Boolean
  8106. });
  8107. const popperCoreConfigPropsDefaults = {
  8108. boundariesPadding: 0,
  8109. gpuAcceleration: true,
  8110. offset: 12,
  8111. placement: "bottom",
  8112. popperOptions: () => ({}),
  8113. strategy: "absolute"
  8114. };
  8115. const popperContentPropsDefaults = {
  8116. ...popperCoreConfigPropsDefaults,
  8117. ...popperArrowPropsDefaults,
  8118. effect: "dark",
  8119. enterable: true,
  8120. stopPopperMouseEvent: true,
  8121. visible: false,
  8122. pure: false,
  8123. focusOnShow: false,
  8124. trapping: false,
  8125. virtualTriggering: false,
  8126. loop: false,
  8127. style: void 0,
  8128. popperStyle: void 0
  8129. };
  8130. const popperContentEmits = {
  8131. mouseenter: (evt) => evt instanceof MouseEvent,
  8132. mouseleave: (evt) => evt instanceof MouseEvent,
  8133. focus: () => true,
  8134. blur: () => true,
  8135. close: () => true
  8136. };
  8137. const usePopperCoreConfigProps = popperCoreConfigProps;
  8138. const usePopperContentProps = popperContentProps;
  8139. const usePopperContentEmits = popperContentEmits;
  8140. //#endregion
  8141. //#region ../../packages/components/focus-trap/src/tokens.ts
  8142. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  8143. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  8144. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  8145. const FOCUS_AFTER_TRAPPED_OPTS = {
  8146. cancelable: true,
  8147. bubbles: false
  8148. };
  8149. const FOCUSOUT_PREVENTED_OPTS = {
  8150. cancelable: true,
  8151. bubbles: false
  8152. };
  8153. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  8154. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  8155. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  8156. //#endregion
  8157. //#region ../../packages/components/focus-trap/src/utils.ts
  8158. const focusReason = ref();
  8159. const lastUserFocusTimestamp = ref(0);
  8160. const lastAutomatedFocusTimestamp = ref(0);
  8161. let focusReasonUserCount = 0;
  8162. const obtainAllFocusableElements = (element) => {
  8163. const nodes = [];
  8164. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, { acceptNode: (node) => {
  8165. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  8166. if (node.disabled || node.hidden || isHiddenInput) return NodeFilter.FILTER_SKIP;
  8167. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  8168. } });
  8169. while (walker.nextNode()) nodes.push(walker.currentNode);
  8170. return nodes;
  8171. };
  8172. const getVisibleElement = (elements, container) => {
  8173. for (const element of elements) if (!isHidden(element, container)) return element;
  8174. };
  8175. const isHidden = (element, container) => {
  8176. if (getComputedStyle(element).visibility === "hidden") return true;
  8177. while (element) {
  8178. if (container && element === container) return false;
  8179. if (getComputedStyle(element).display === "none") return true;
  8180. element = element.parentElement;
  8181. }
  8182. return false;
  8183. };
  8184. const getEdges = (container) => {
  8185. const focusable = obtainAllFocusableElements(container);
  8186. return [getVisibleElement(focusable, container), getVisibleElement(focusable.reverse(), container)];
  8187. };
  8188. const isSelectable = (element) => {
  8189. return element instanceof HTMLInputElement && "select" in element;
  8190. };
  8191. const tryFocus = (element, shouldSelect) => {
  8192. if (element) {
  8193. const prevFocusedElement = document.activeElement;
  8194. focusElement(element, { preventScroll: true });
  8195. lastAutomatedFocusTimestamp.value = window.performance.now();
  8196. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) element.select();
  8197. }
  8198. };
  8199. function removeFromStack(list, item) {
  8200. const copy = [...list];
  8201. const idx = list.indexOf(item);
  8202. if (idx !== -1) copy.splice(idx, 1);
  8203. return copy;
  8204. }
  8205. const createFocusableStack = () => {
  8206. let stack = [];
  8207. const push = (layer) => {
  8208. const currentLayer = stack[0];
  8209. if (currentLayer && layer !== currentLayer) currentLayer.pause();
  8210. stack = removeFromStack(stack, layer);
  8211. stack.unshift(layer);
  8212. };
  8213. const remove = (layer) => {
  8214. stack = removeFromStack(stack, layer);
  8215. stack[0]?.resume?.();
  8216. };
  8217. return {
  8218. push,
  8219. remove
  8220. };
  8221. };
  8222. const focusFirstDescendant = (elements, shouldSelect = false) => {
  8223. const prevFocusedElement = document.activeElement;
  8224. for (const element of elements) {
  8225. tryFocus(element, shouldSelect);
  8226. if (document.activeElement !== prevFocusedElement) return;
  8227. }
  8228. };
  8229. const focusableStack = createFocusableStack();
  8230. const isFocusCausedByUserEvent = () => {
  8231. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  8232. };
  8233. const notifyFocusReasonPointer = () => {
  8234. focusReason.value = "pointer";
  8235. lastUserFocusTimestamp.value = window.performance.now();
  8236. };
  8237. const notifyFocusReasonKeydown = () => {
  8238. focusReason.value = "keyboard";
  8239. lastUserFocusTimestamp.value = window.performance.now();
  8240. };
  8241. const useFocusReason = () => {
  8242. onMounted(() => {
  8243. if (focusReasonUserCount === 0) {
  8244. document.addEventListener("mousedown", notifyFocusReasonPointer);
  8245. document.addEventListener("touchstart", notifyFocusReasonPointer);
  8246. document.addEventListener("keydown", notifyFocusReasonKeydown);
  8247. }
  8248. focusReasonUserCount++;
  8249. });
  8250. onBeforeUnmount(() => {
  8251. focusReasonUserCount--;
  8252. if (focusReasonUserCount <= 0) {
  8253. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  8254. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  8255. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  8256. }
  8257. });
  8258. return {
  8259. focusReason,
  8260. lastUserFocusTimestamp,
  8261. lastAutomatedFocusTimestamp
  8262. };
  8263. };
  8264. const createFocusOutPreventedEvent = (detail) => {
  8265. return new CustomEvent(FOCUSOUT_PREVENTED, {
  8266. ...FOCUSOUT_PREVENTED_OPTS,
  8267. detail
  8268. });
  8269. };
  8270. //#endregion
  8271. //#region ../../packages/components/focus-trap/src/focus-trap.vue?vue&type=script&lang.ts
  8272. var focus_trap_vue_vue_type_script_lang_default = defineComponent({
  8273. name: "ElFocusTrap",
  8274. inheritAttrs: false,
  8275. props: {
  8276. loop: Boolean,
  8277. trapped: Boolean,
  8278. focusTrapEl: Object,
  8279. focusStartEl: {
  8280. type: [Object, String],
  8281. default: "first"
  8282. }
  8283. },
  8284. emits: [
  8285. ON_TRAP_FOCUS_EVT,
  8286. ON_RELEASE_FOCUS_EVT,
  8287. "focusin",
  8288. "focusout",
  8289. "focusout-prevented",
  8290. "release-requested"
  8291. ],
  8292. setup(props, { emit }) {
  8293. const forwardRef = ref();
  8294. let lastFocusBeforeTrapped;
  8295. let lastFocusAfterTrapped;
  8296. const { focusReason } = useFocusReason();
  8297. useEscapeKeydown((event) => {
  8298. if (props.trapped && !focusLayer.paused) emit("release-requested", event);
  8299. });
  8300. const focusLayer = {
  8301. paused: false,
  8302. pause() {
  8303. this.paused = true;
  8304. },
  8305. resume() {
  8306. this.paused = false;
  8307. }
  8308. };
  8309. const onKeydown = (e) => {
  8310. if (!props.loop && !props.trapped) return;
  8311. if (focusLayer.paused) return;
  8312. const { altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  8313. const { loop } = props;
  8314. const isTabbing = getEventCode(e) === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  8315. const currentFocusingEl = document.activeElement;
  8316. if (isTabbing && currentFocusingEl) {
  8317. const container = currentTarget;
  8318. const [first, last] = getEdges(container);
  8319. if (!(first && last)) {
  8320. if (currentFocusingEl === container) {
  8321. const focusoutPreventedEvent = createFocusOutPreventedEvent({ focusReason: focusReason.value });
  8322. emit("focusout-prevented", focusoutPreventedEvent);
  8323. if (!focusoutPreventedEvent.defaultPrevented) e.preventDefault();
  8324. }
  8325. } else if (!shiftKey && currentFocusingEl === last) {
  8326. const focusoutPreventedEvent = createFocusOutPreventedEvent({ focusReason: focusReason.value });
  8327. emit("focusout-prevented", focusoutPreventedEvent);
  8328. if (!focusoutPreventedEvent.defaultPrevented) {
  8329. e.preventDefault();
  8330. if (loop) tryFocus(first, true);
  8331. }
  8332. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  8333. const focusoutPreventedEvent = createFocusOutPreventedEvent({ focusReason: focusReason.value });
  8334. emit("focusout-prevented", focusoutPreventedEvent);
  8335. if (!focusoutPreventedEvent.defaultPrevented) {
  8336. e.preventDefault();
  8337. if (loop) tryFocus(last, true);
  8338. }
  8339. }
  8340. }
  8341. };
  8342. provide(FOCUS_TRAP_INJECTION_KEY, {
  8343. focusTrapRef: forwardRef,
  8344. onKeydown
  8345. });
  8346. watch(() => props.focusTrapEl, (focusTrapEl) => {
  8347. if (focusTrapEl) forwardRef.value = focusTrapEl;
  8348. }, { immediate: true });
  8349. watch([forwardRef], ([forwardRef], [oldForwardRef]) => {
  8350. if (forwardRef) {
  8351. forwardRef.addEventListener("keydown", onKeydown);
  8352. forwardRef.addEventListener("focusin", onFocusIn);
  8353. forwardRef.addEventListener("focusout", onFocusOut);
  8354. }
  8355. if (oldForwardRef) {
  8356. oldForwardRef.removeEventListener("keydown", onKeydown);
  8357. oldForwardRef.removeEventListener("focusin", onFocusIn);
  8358. oldForwardRef.removeEventListener("focusout", onFocusOut);
  8359. }
  8360. });
  8361. const trapOnFocus = (e) => {
  8362. emit(ON_TRAP_FOCUS_EVT, e);
  8363. };
  8364. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  8365. const onFocusIn = (e) => {
  8366. const trapContainer = unref(forwardRef);
  8367. if (!trapContainer) return;
  8368. const target = e.target;
  8369. const relatedTarget = e.relatedTarget;
  8370. const isFocusedInTrap = target && trapContainer.contains(target);
  8371. if (!props.trapped) {
  8372. if (!(relatedTarget && trapContainer.contains(relatedTarget))) lastFocusBeforeTrapped = relatedTarget;
  8373. }
  8374. if (isFocusedInTrap) emit("focusin", e);
  8375. if (focusLayer.paused) return;
  8376. if (props.trapped) if (isFocusedInTrap) lastFocusAfterTrapped = target;
  8377. else tryFocus(lastFocusAfterTrapped, true);
  8378. };
  8379. const onFocusOut = (e) => {
  8380. const trapContainer = unref(forwardRef);
  8381. if (focusLayer.paused || !trapContainer) return;
  8382. if (props.trapped) {
  8383. const relatedTarget = e.relatedTarget;
  8384. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) setTimeout(() => {
  8385. if (!focusLayer.paused && props.trapped) {
  8386. const focusoutPreventedEvent = createFocusOutPreventedEvent({ focusReason: focusReason.value });
  8387. emit("focusout-prevented", focusoutPreventedEvent);
  8388. if (!focusoutPreventedEvent.defaultPrevented) tryFocus(lastFocusAfterTrapped, true);
  8389. }
  8390. }, 0);
  8391. } else {
  8392. const target = e.target;
  8393. if (!(target && trapContainer.contains(target))) emit("focusout", e);
  8394. }
  8395. };
  8396. async function startTrap() {
  8397. await nextTick();
  8398. const trapContainer = unref(forwardRef);
  8399. if (trapContainer) {
  8400. focusableStack.push(focusLayer);
  8401. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  8402. lastFocusBeforeTrapped = prevFocusedElement;
  8403. if (!trapContainer.contains(prevFocusedElement)) {
  8404. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  8405. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  8406. trapContainer.dispatchEvent(focusEvent);
  8407. if (!focusEvent.defaultPrevented) nextTick(() => {
  8408. let focusStartEl = props.focusStartEl;
  8409. if (!isString(focusStartEl)) {
  8410. tryFocus(focusStartEl);
  8411. if (document.activeElement !== focusStartEl) focusStartEl = "first";
  8412. }
  8413. if (focusStartEl === "first") focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  8414. if (document.activeElement === prevFocusedElement || focusStartEl === "container") tryFocus(trapContainer);
  8415. });
  8416. }
  8417. }
  8418. }
  8419. function stopTrap() {
  8420. const trapContainer = unref(forwardRef);
  8421. if (trapContainer) {
  8422. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  8423. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  8424. ...FOCUS_AFTER_TRAPPED_OPTS,
  8425. detail: { focusReason: focusReason.value }
  8426. });
  8427. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  8428. trapContainer.dispatchEvent(releasedEvent);
  8429. if (!releasedEvent.defaultPrevented && (focusReason.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) tryFocus(lastFocusBeforeTrapped ?? document.body);
  8430. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  8431. focusableStack.remove(focusLayer);
  8432. lastFocusBeforeTrapped = null;
  8433. lastFocusAfterTrapped = null;
  8434. }
  8435. }
  8436. onMounted(() => {
  8437. if (props.trapped) startTrap();
  8438. watch(() => props.trapped, (trapped) => {
  8439. if (trapped) startTrap();
  8440. else stopTrap();
  8441. });
  8442. });
  8443. onBeforeUnmount(() => {
  8444. if (props.trapped) stopTrap();
  8445. if (forwardRef.value) {
  8446. forwardRef.value.removeEventListener("keydown", onKeydown);
  8447. forwardRef.value.removeEventListener("focusin", onFocusIn);
  8448. forwardRef.value.removeEventListener("focusout", onFocusOut);
  8449. forwardRef.value = void 0;
  8450. }
  8451. lastFocusBeforeTrapped = null;
  8452. lastFocusAfterTrapped = null;
  8453. });
  8454. return { onKeydown };
  8455. }
  8456. });
  8457. //#endregion
  8458. //#region \0plugin-vue:export-helper
  8459. var _plugin_vue_export_helper_default = (sfc, props) => {
  8460. const target = sfc.__vccOpts || sfc;
  8461. for (const [key, val] of props) target[key] = val;
  8462. return target;
  8463. };
  8464. //#endregion
  8465. //#region ../../packages/components/focus-trap/src/focus-trap.vue
  8466. function _sfc_render$20(_ctx, _cache, $props, $setup, $data, $options) {
  8467. return renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  8468. }
  8469. var focus_trap_default$1 = /* @__PURE__ */ _plugin_vue_export_helper_default(focus_trap_vue_vue_type_script_lang_default, [["render", _sfc_render$20]]);
  8470. //#endregion
  8471. //#region ../../packages/components/focus-trap/index.ts
  8472. var focus_trap_default = focus_trap_default$1;
  8473. //#endregion
  8474. //#region ../../packages/components/form/src/form.ts
  8475. const formMetaProps = buildProps({
  8476. size: {
  8477. type: String,
  8478. values: componentSizes
  8479. },
  8480. disabled: Boolean
  8481. });
  8482. const formProps = buildProps({
  8483. ...formMetaProps,
  8484. model: Object,
  8485. rules: { type: definePropType(Object) },
  8486. labelPosition: {
  8487. type: String,
  8488. values: [
  8489. "left",
  8490. "right",
  8491. "top"
  8492. ],
  8493. default: "right"
  8494. },
  8495. requireAsteriskPosition: {
  8496. type: String,
  8497. values: ["left", "right"],
  8498. default: "left"
  8499. },
  8500. labelWidth: {
  8501. type: [String, Number],
  8502. default: ""
  8503. },
  8504. labelSuffix: {
  8505. type: String,
  8506. default: ""
  8507. },
  8508. inline: Boolean,
  8509. inlineMessage: Boolean,
  8510. statusIcon: Boolean,
  8511. showMessage: {
  8512. type: Boolean,
  8513. default: true
  8514. },
  8515. validateOnRuleChange: {
  8516. type: Boolean,
  8517. default: true
  8518. },
  8519. hideRequiredAsterisk: Boolean,
  8520. scrollToError: Boolean,
  8521. scrollIntoViewOptions: {
  8522. type: definePropType([Object, Boolean]),
  8523. default: true
  8524. }
  8525. });
  8526. const formEmits = { validate: (prop, isValid, message) => (isArray$1(prop) || isString(prop)) && isBoolean(isValid) && isString(message) };
  8527. //#endregion
  8528. //#region ../../packages/components/form/src/constants.ts
  8529. const formContextKey = Symbol("formContextKey");
  8530. const formItemContextKey = Symbol("formItemContextKey");
  8531. //#endregion
  8532. //#region ../../packages/components/form/src/hooks/use-form-common-props.ts
  8533. const useFormSize = (fallback, ignore = {}) => {
  8534. const emptyRef = ref(void 0);
  8535. const size = ignore.prop ? emptyRef : useProp("size");
  8536. const globalConfig = ignore.global ? emptyRef : useGlobalSize();
  8537. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  8538. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  8539. return computed(() => size.value || unref(fallback) || formItem?.size || form?.size || globalConfig.value || "");
  8540. };
  8541. const useFormDisabled = (fallback) => {
  8542. const disabled = useProp("disabled");
  8543. const form = inject(formContextKey, void 0);
  8544. return computed(() => {
  8545. return disabled.value ?? unref(fallback) ?? form?.disabled ?? false;
  8546. });
  8547. };
  8548. const useSize = useFormSize;
  8549. const useDisabled = useFormDisabled;
  8550. //#endregion
  8551. //#region ../../packages/components/form/src/hooks/use-form-item.ts
  8552. const useFormItem = () => {
  8553. return {
  8554. form: inject(formContextKey, void 0),
  8555. formItem: inject(formItemContextKey, void 0)
  8556. };
  8557. };
  8558. const useFormItemInputId = (props, { formItemContext, disableIdGeneration, disableIdManagement }) => {
  8559. if (!disableIdGeneration) disableIdGeneration = ref(false);
  8560. if (!disableIdManagement) disableIdManagement = ref(false);
  8561. const instance = getCurrentInstance();
  8562. const inLabel = () => {
  8563. let parent = instance?.parent;
  8564. while (parent) {
  8565. if (parent.type.name === "ElFormItem") return false;
  8566. if (parent.type.name === "ElLabelWrap") return true;
  8567. parent = parent.parent;
  8568. }
  8569. return false;
  8570. };
  8571. const inputId = ref();
  8572. let idUnwatch = void 0;
  8573. const isLabeledByFormItem = computed(() => {
  8574. return !!(!(props.label || props.ariaLabel) && formItemContext && formItemContext.inputIds && formItemContext.inputIds?.length <= 1);
  8575. });
  8576. onMounted(() => {
  8577. idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration]) => {
  8578. const newId = id ?? (!disableIdGeneration ? useId().value : void 0);
  8579. if (newId !== inputId.value) {
  8580. if (formItemContext?.removeInputId && !inLabel()) {
  8581. inputId.value && formItemContext.removeInputId(inputId.value);
  8582. if (!disableIdManagement?.value && !disableIdGeneration && newId) formItemContext.addInputId(newId);
  8583. }
  8584. inputId.value = newId;
  8585. }
  8586. }, { immediate: true });
  8587. });
  8588. onUnmounted(() => {
  8589. idUnwatch && idUnwatch();
  8590. if (formItemContext?.removeInputId) inputId.value && formItemContext.removeInputId(inputId.value);
  8591. });
  8592. return {
  8593. isLabeledByFormItem,
  8594. inputId
  8595. };
  8596. };
  8597. //#endregion
  8598. //#region ../../packages/components/form/src/utils.ts
  8599. const SCOPE$7 = "ElForm";
  8600. function useFormLabelWidth() {
  8601. const potentialLabelWidthArr = ref([]);
  8602. const autoLabelWidth = computed(() => {
  8603. if (!potentialLabelWidthArr.value.length) return "0";
  8604. const max = Math.max(...potentialLabelWidthArr.value);
  8605. return max ? `${max}px` : "";
  8606. });
  8607. function getLabelWidthIndex(width) {
  8608. const index = potentialLabelWidthArr.value.indexOf(width);
  8609. if (index === -1 && autoLabelWidth.value === "0") /* @__PURE__ */ debugWarn(SCOPE$7, `unexpected width ${width}`);
  8610. return index;
  8611. }
  8612. function registerLabelWidth(val, oldVal) {
  8613. if (val && oldVal) {
  8614. const index = getLabelWidthIndex(oldVal);
  8615. potentialLabelWidthArr.value.splice(index, 1, val);
  8616. } else if (val) potentialLabelWidthArr.value.push(val);
  8617. }
  8618. function deregisterLabelWidth(val) {
  8619. const index = getLabelWidthIndex(val);
  8620. if (index > -1) potentialLabelWidthArr.value.splice(index, 1);
  8621. }
  8622. return {
  8623. autoLabelWidth,
  8624. registerLabelWidth,
  8625. deregisterLabelWidth
  8626. };
  8627. }
  8628. const filterFields = (fields, props) => {
  8629. const normalized = castArray$1(props).map((prop) => isArray$1(prop) ? prop.join(".") : prop);
  8630. return normalized.length > 0 ? fields.filter((field) => field.propString && normalized.includes(field.propString)) : fields;
  8631. };
  8632. //#endregion
  8633. //#region ../../packages/components/form/src/form.vue?vue&type=script&setup=true&lang.ts
  8634. const COMPONENT_NAME$21 = "ElForm";
  8635. var form_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  8636. name: COMPONENT_NAME$21,
  8637. __name: "form",
  8638. props: formProps,
  8639. emits: formEmits,
  8640. setup(__props, { expose: __expose, emit: __emit }) {
  8641. const props = __props;
  8642. const emit = __emit;
  8643. const formRef = ref();
  8644. const fields = reactive([]);
  8645. const initialValues = /* @__PURE__ */ new Map();
  8646. const formSize = useFormSize();
  8647. const ns = useNamespace("form");
  8648. const formClasses = computed(() => {
  8649. const { labelPosition, inline } = props;
  8650. return [
  8651. ns.b(),
  8652. ns.m(formSize.value || "default"),
  8653. {
  8654. [ns.m(`label-${labelPosition}`)]: labelPosition,
  8655. [ns.m("inline")]: inline
  8656. }
  8657. ];
  8658. });
  8659. const getField = (prop) => {
  8660. return filterFields(fields, [prop])[0];
  8661. };
  8662. const addField = (field) => {
  8663. if (!fields.includes(field)) fields.push(field);
  8664. if (field.propString) if (initialValues.has(field.propString)) field.setInitialValue(initialValues.get(field.propString));
  8665. else initialValues.set(field.propString, cloneDeep(field.fieldValue));
  8666. };
  8667. const removeField = (field, oldPropString) => {
  8668. if (oldPropString) {
  8669. initialValues.delete(oldPropString);
  8670. return;
  8671. }
  8672. const idx = fields.indexOf(field);
  8673. if (idx > -1) {
  8674. fields.splice(idx, 1);
  8675. if (field.propString) initialValues.set(field.propString, cloneDeep(field.getInitialValue()));
  8676. }
  8677. };
  8678. const setInitialValues = (initModel) => {
  8679. if (!props.model) {
  8680. /* @__PURE__ */ debugWarn(COMPONENT_NAME$21, "model is required for setInitialValues to work.");
  8681. return;
  8682. }
  8683. if (!initModel) {
  8684. /* @__PURE__ */ debugWarn(COMPONENT_NAME$21, "initModel is required for setInitialValues to work.");
  8685. return;
  8686. }
  8687. for (const key of initialValues.keys()) initialValues.set(key, cloneDeep(getProp(initModel, key).value));
  8688. fields.forEach((field) => {
  8689. if (field.prop) field.setInitialValue(getProp(initModel, field.prop).value);
  8690. });
  8691. };
  8692. const resetFields = (properties = []) => {
  8693. if (!props.model) {
  8694. /* @__PURE__ */ debugWarn(COMPONENT_NAME$21, "model is required for resetFields to work.");
  8695. return;
  8696. }
  8697. filterFields(fields, properties).forEach((field) => field.resetField());
  8698. const activePropStrings = new Set(fields.map((f) => f.propString).filter(Boolean));
  8699. const propsToCheck = properties.length > 0 ? castArray$1(properties).map((p) => isArray$1(p) ? p.join(".") : p) : [...initialValues.keys()];
  8700. for (const propString of propsToCheck) if (!activePropStrings.has(propString) && initialValues.has(propString)) getProp(props.model, propString).value = cloneDeep(initialValues.get(propString));
  8701. };
  8702. const clearValidate = (props = []) => {
  8703. filterFields(fields, props).forEach((field) => field.clearValidate());
  8704. };
  8705. const isValidatable = computed(() => {
  8706. const hasModel = !!props.model;
  8707. if (!hasModel) /* @__PURE__ */ debugWarn(COMPONENT_NAME$21, "model is required for validate to work.");
  8708. return hasModel;
  8709. });
  8710. const obtainValidateFields = (props) => {
  8711. if (fields.length === 0) return [];
  8712. const filteredFields = filterFields(fields, props);
  8713. if (!filteredFields.length) {
  8714. /* @__PURE__ */ debugWarn(COMPONENT_NAME$21, "please pass correct props!");
  8715. return [];
  8716. }
  8717. return filteredFields;
  8718. };
  8719. const validate = async (callback) => validateField(void 0, callback);
  8720. const doValidateField = async (props = []) => {
  8721. if (!isValidatable.value) return false;
  8722. const fields = obtainValidateFields(props);
  8723. if (fields.length === 0) return true;
  8724. let validationErrors = {};
  8725. for (const field of fields) try {
  8726. await field.validate("");
  8727. if (field.validateState === "error" && !field.error) field.resetField();
  8728. } catch (fields) {
  8729. validationErrors = {
  8730. ...validationErrors,
  8731. ...fields
  8732. };
  8733. }
  8734. if (Object.keys(validationErrors).length === 0) return true;
  8735. return Promise.reject(validationErrors);
  8736. };
  8737. const validateField = async (modelProps = [], callback) => {
  8738. let result = false;
  8739. const shouldThrow = !isFunction$1(callback);
  8740. try {
  8741. result = await doValidateField(modelProps);
  8742. if (result === true) await callback?.(result);
  8743. return result;
  8744. } catch (e) {
  8745. if (e instanceof Error) throw e;
  8746. const invalidFields = e;
  8747. if (props.scrollToError) {
  8748. if (formRef.value) formRef.value.querySelector(`.${ns.b()}-item.is-error`)?.scrollIntoView(props.scrollIntoViewOptions);
  8749. }
  8750. !result && await callback?.(false, invalidFields);
  8751. return shouldThrow && Promise.reject(invalidFields);
  8752. }
  8753. };
  8754. const scrollToField = (prop) => {
  8755. const field = getField(prop);
  8756. if (field) field.$el?.scrollIntoView(props.scrollIntoViewOptions);
  8757. };
  8758. watch(() => props.rules, () => {
  8759. if (props.validateOnRuleChange) validate().catch(NOOP);
  8760. }, {
  8761. deep: true,
  8762. flush: "post"
  8763. });
  8764. provide(formContextKey, reactive({
  8765. ...toRefs(props),
  8766. emit,
  8767. resetFields,
  8768. clearValidate,
  8769. validateField,
  8770. getField,
  8771. addField,
  8772. removeField,
  8773. setInitialValues,
  8774. ...useFormLabelWidth()
  8775. }));
  8776. __expose({
  8777. validate,
  8778. validateField,
  8779. resetFields,
  8780. clearValidate,
  8781. scrollToField,
  8782. getField,
  8783. fields,
  8784. setInitialValues
  8785. });
  8786. return (_ctx, _cache) => {
  8787. return openBlock(), createElementBlock("form", {
  8788. ref_key: "formRef",
  8789. ref: formRef,
  8790. class: normalizeClass(formClasses.value)
  8791. }, [renderSlot(_ctx.$slots, "default")], 2);
  8792. };
  8793. }
  8794. });
  8795. //#endregion
  8796. //#region ../../packages/components/form/src/form.vue
  8797. var form_default = form_vue_vue_type_script_setup_true_lang_default;
  8798. //#endregion
  8799. //#region ../../packages/components/form/src/form-item.ts
  8800. const formItemValidateStates = [
  8801. "",
  8802. "error",
  8803. "validating",
  8804. "success"
  8805. ];
  8806. const formItemProps = buildProps({
  8807. label: String,
  8808. labelWidth: { type: [String, Number] },
  8809. labelPosition: {
  8810. type: String,
  8811. values: [
  8812. "left",
  8813. "right",
  8814. "top",
  8815. ""
  8816. ],
  8817. default: ""
  8818. },
  8819. prop: { type: definePropType([String, Array]) },
  8820. required: {
  8821. type: Boolean,
  8822. default: void 0
  8823. },
  8824. rules: { type: definePropType([Object, Array]) },
  8825. error: String,
  8826. validateStatus: {
  8827. type: String,
  8828. values: formItemValidateStates
  8829. },
  8830. for: String,
  8831. inlineMessage: {
  8832. type: Boolean,
  8833. default: void 0
  8834. },
  8835. showMessage: {
  8836. type: Boolean,
  8837. default: true
  8838. },
  8839. size: {
  8840. type: String,
  8841. values: componentSizes
  8842. }
  8843. });
  8844. //#endregion
  8845. //#region ../../node_modules/.pnpm/async-validator@4.2.5_patch_hash=cc6d77b35ed2a1683012935ca9ed998d418912785fcf78c6497d3268ac596d23/node_modules/async-validator/dist-web/index.js
  8846. function _extends() {
  8847. _extends = Object.assign ? Object.assign.bind() : function(target) {
  8848. for (var i = 1; i < arguments.length; i++) {
  8849. var source = arguments[i];
  8850. for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
  8851. }
  8852. return target;
  8853. };
  8854. return _extends.apply(this, arguments);
  8855. }
  8856. function _inheritsLoose(subClass, superClass) {
  8857. subClass.prototype = Object.create(superClass.prototype);
  8858. subClass.prototype.constructor = subClass;
  8859. _setPrototypeOf(subClass, superClass);
  8860. }
  8861. function _getPrototypeOf(o) {
  8862. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
  8863. return o.__proto__ || Object.getPrototypeOf(o);
  8864. };
  8865. return _getPrototypeOf(o);
  8866. }
  8867. function _setPrototypeOf(o, p) {
  8868. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
  8869. o.__proto__ = p;
  8870. return o;
  8871. };
  8872. return _setPrototypeOf(o, p);
  8873. }
  8874. function _isNativeReflectConstruct() {
  8875. if (typeof Reflect === "undefined" || !Reflect.construct) return false;
  8876. if (Reflect.construct.sham) return false;
  8877. if (typeof Proxy === "function") return true;
  8878. try {
  8879. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
  8880. return true;
  8881. } catch (e) {
  8882. return false;
  8883. }
  8884. }
  8885. function _construct(Parent, args, Class) {
  8886. if (_isNativeReflectConstruct()) _construct = Reflect.construct.bind();
  8887. else _construct = function _construct(Parent, args, Class) {
  8888. var a = [null];
  8889. a.push.apply(a, args);
  8890. var instance = new (Function.bind.apply(Parent, a))();
  8891. if (Class) _setPrototypeOf(instance, Class.prototype);
  8892. return instance;
  8893. };
  8894. return _construct.apply(null, arguments);
  8895. }
  8896. function _isNativeFunction(fn) {
  8897. return Function.toString.call(fn).indexOf("[native code]") !== -1;
  8898. }
  8899. function _wrapNativeSuper(Class) {
  8900. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  8901. _wrapNativeSuper = function _wrapNativeSuper(Class) {
  8902. if (Class === null || !_isNativeFunction(Class)) return Class;
  8903. if (typeof Class !== "function") throw new TypeError("Super expression must either be null or a function");
  8904. if (typeof _cache !== "undefined") {
  8905. if (_cache.has(Class)) return _cache.get(Class);
  8906. _cache.set(Class, Wrapper);
  8907. }
  8908. function Wrapper() {
  8909. return _construct(Class, arguments, _getPrototypeOf(this).constructor);
  8910. }
  8911. Wrapper.prototype = Object.create(Class.prototype, { constructor: {
  8912. value: Wrapper,
  8913. enumerable: false,
  8914. writable: true,
  8915. configurable: true
  8916. } });
  8917. return _setPrototypeOf(Wrapper, Class);
  8918. };
  8919. return _wrapNativeSuper(Class);
  8920. }
  8921. var formatRegExp = /%[sdj%]/g;
  8922. var warning = function warning() {};
  8923. if (typeof process !== "undefined" && process.env && false);
  8924. function convertFieldsError(errors) {
  8925. if (!errors || !errors.length) return null;
  8926. var fields = {};
  8927. errors.forEach(function(error) {
  8928. var field = error.field;
  8929. fields[field] = fields[field] || [];
  8930. fields[field].push(error);
  8931. });
  8932. return fields;
  8933. }
  8934. function format(template) {
  8935. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) args[_key - 1] = arguments[_key];
  8936. var i = 0;
  8937. var len = args.length;
  8938. if (typeof template === "function") return template.apply(null, args);
  8939. if (typeof template === "string") return template.replace(formatRegExp, function(x) {
  8940. if (x === "%%") return "%";
  8941. if (i >= len) return x;
  8942. switch (x) {
  8943. case "%s": return String(args[i++]);
  8944. case "%d": return Number(args[i++]);
  8945. case "%j":
  8946. try {
  8947. return JSON.stringify(args[i++]);
  8948. } catch (_) {
  8949. return "[Circular]";
  8950. }
  8951. break;
  8952. default: return x;
  8953. }
  8954. });
  8955. return template;
  8956. }
  8957. function isNativeStringType(type) {
  8958. return type === "string" || type === "url" || type === "hex" || type === "email" || type === "date" || type === "pattern";
  8959. }
  8960. function isEmptyValue(value, type) {
  8961. if (value === void 0 || value === null) return true;
  8962. if (type === "array" && Array.isArray(value) && !value.length) return true;
  8963. if (isNativeStringType(type) && typeof value === "string" && !value) return true;
  8964. return false;
  8965. }
  8966. function asyncParallelArray(arr, func, callback) {
  8967. var results = [];
  8968. var total = 0;
  8969. var arrLength = arr.length;
  8970. function count(errors) {
  8971. results.push.apply(results, errors || []);
  8972. total++;
  8973. if (total === arrLength) callback(results);
  8974. }
  8975. arr.forEach(function(a) {
  8976. func(a, count);
  8977. });
  8978. }
  8979. function asyncSerialArray(arr, func, callback) {
  8980. var index = 0;
  8981. var arrLength = arr.length;
  8982. function next(errors) {
  8983. if (errors && errors.length) {
  8984. callback(errors);
  8985. return;
  8986. }
  8987. var original = index;
  8988. index = index + 1;
  8989. if (original < arrLength) func(arr[original], next);
  8990. else callback([]);
  8991. }
  8992. next([]);
  8993. }
  8994. function flattenObjArr(objArr) {
  8995. var ret = [];
  8996. Object.keys(objArr).forEach(function(k) {
  8997. ret.push.apply(ret, objArr[k] || []);
  8998. });
  8999. return ret;
  9000. }
  9001. var AsyncValidationError = /* @__PURE__ */ function(_Error) {
  9002. _inheritsLoose(AsyncValidationError, _Error);
  9003. function AsyncValidationError(errors, fields) {
  9004. var _this = _Error.call(this, "Async Validation Error") || this;
  9005. _this.errors = errors;
  9006. _this.fields = fields;
  9007. return _this;
  9008. }
  9009. return AsyncValidationError;
  9010. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  9011. function asyncMap(objArr, option, func, callback, source) {
  9012. if (option.first) {
  9013. var _pending = new Promise(function(resolve, reject) {
  9014. asyncSerialArray(flattenObjArr(objArr), func, function next(errors) {
  9015. callback(errors);
  9016. return errors.length ? reject(new AsyncValidationError(errors, convertFieldsError(errors))) : resolve(source);
  9017. });
  9018. });
  9019. _pending["catch"](function(e) {
  9020. return e;
  9021. });
  9022. return _pending;
  9023. }
  9024. var firstFields = option.firstFields === true ? Object.keys(objArr) : option.firstFields || [];
  9025. var objArrKeys = Object.keys(objArr);
  9026. var objArrLength = objArrKeys.length;
  9027. var total = 0;
  9028. var results = [];
  9029. var pending = new Promise(function(resolve, reject) {
  9030. var next = function next(errors) {
  9031. results.push.apply(results, errors);
  9032. total++;
  9033. if (total === objArrLength) {
  9034. callback(results);
  9035. return results.length ? reject(new AsyncValidationError(results, convertFieldsError(results))) : resolve(source);
  9036. }
  9037. };
  9038. if (!objArrKeys.length) {
  9039. callback(results);
  9040. resolve(source);
  9041. }
  9042. objArrKeys.forEach(function(key) {
  9043. var arr = objArr[key];
  9044. if (firstFields.indexOf(key) !== -1) asyncSerialArray(arr, func, next);
  9045. else asyncParallelArray(arr, func, next);
  9046. });
  9047. });
  9048. pending["catch"](function(e) {
  9049. return e;
  9050. });
  9051. return pending;
  9052. }
  9053. function isErrorObj(obj) {
  9054. return !!(obj && obj.message !== void 0);
  9055. }
  9056. function getValue(value, path) {
  9057. var v = value;
  9058. for (var i = 0; i < path.length; i++) {
  9059. if (v == void 0) return v;
  9060. v = v[path[i]];
  9061. }
  9062. return v;
  9063. }
  9064. function complementError(rule, source) {
  9065. return function(oe) {
  9066. var fieldValue;
  9067. if (rule.fullFields) fieldValue = getValue(source, rule.fullFields);
  9068. else fieldValue = source[oe.field || rule.fullField];
  9069. if (isErrorObj(oe)) {
  9070. oe.field = oe.field || rule.fullField;
  9071. oe.fieldValue = fieldValue;
  9072. return oe;
  9073. }
  9074. return {
  9075. message: typeof oe === "function" ? oe() : oe,
  9076. fieldValue,
  9077. field: oe.field || rule.fullField
  9078. };
  9079. };
  9080. }
  9081. function deepMerge(target, source) {
  9082. if (source) {
  9083. for (var s in source) if (source.hasOwnProperty(s)) {
  9084. var value = source[s];
  9085. if (typeof value === "object" && typeof target[s] === "object") target[s] = _extends({}, target[s], value);
  9086. else target[s] = value;
  9087. }
  9088. }
  9089. return target;
  9090. }
  9091. var required$1 = function required(rule, value, source, errors, options, type) {
  9092. if (rule.required && (!source.hasOwnProperty(rule.field) || isEmptyValue(value, type || rule.type))) errors.push(format(options.messages.required, rule.fullField));
  9093. };
  9094. var whitespace = function whitespace(rule, value, source, errors, options) {
  9095. if (/^\s+$/.test(value) || value === "") errors.push(format(options.messages.whitespace, rule.fullField));
  9096. };
  9097. var urlReg;
  9098. var getUrlRegex = (function() {
  9099. if (urlReg) return urlReg;
  9100. var word = "[a-fA-F\\d:]";
  9101. var b = function b(options) {
  9102. return options && options.includeBoundaries ? "(?:(?<=\\s|^)(?=" + word + ")|(?<=" + word + ")(?=\\s|$))" : "";
  9103. };
  9104. 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}";
  9105. var v6seg = "[a-fA-F\\d]{1,4}";
  9106. 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();
  9107. var v46Exact = new RegExp("(?:^" + v4 + "$)|(?:^" + v6 + "$)");
  9108. var v4exact = new RegExp("^" + v4 + "$");
  9109. var v6exact = new RegExp("^" + v6 + "$");
  9110. var ip = function ip(options) {
  9111. return options && options.exact ? v46Exact : new RegExp("(?:" + b(options) + v4 + b(options) + ")|(?:" + b(options) + v6 + b(options) + ")", "g");
  9112. };
  9113. ip.v4 = function(options) {
  9114. return options && options.exact ? v4exact : new RegExp("" + b(options) + v4 + b(options), "g");
  9115. };
  9116. ip.v6 = function(options) {
  9117. return options && options.exact ? v6exact : new RegExp("" + b(options) + v6 + b(options), "g");
  9118. };
  9119. var protocol = "(?:(?:[a-z]+:)?//)";
  9120. var auth = "(?:\\S+(?::\\S*)?@)?";
  9121. var ipv4 = ip.v4().source;
  9122. var ipv6 = ip.v6().source;
  9123. var regex = "(?:" + protocol + "|www\\.)" + auth + "(?:localhost|" + ipv4 + "|" + ipv6 + "|(?:(?:[a-z\\u00a1-\\uffff0-9][-_]*)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))(?::\\d{2,5})?(?:[/?#][^\\s\"]*)?";
  9124. urlReg = new RegExp("(?:^" + regex + "$)", "i");
  9125. return urlReg;
  9126. });
  9127. var pattern$2 = {
  9128. 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,}))$/,
  9129. hex: /^#?([a-f0-9]{6}|[a-f0-9]{3})$/i
  9130. };
  9131. var types = {
  9132. integer: function integer(value) {
  9133. return types.number(value) && parseInt(value, 10) === value;
  9134. },
  9135. "float": function float(value) {
  9136. return types.number(value) && !types.integer(value);
  9137. },
  9138. array: function array(value) {
  9139. return Array.isArray(value);
  9140. },
  9141. regexp: function regexp(value) {
  9142. if (value instanceof RegExp) return true;
  9143. try {
  9144. return !!new RegExp(value);
  9145. } catch (e) {
  9146. return false;
  9147. }
  9148. },
  9149. date: function date(value) {
  9150. return typeof value.getTime === "function" && typeof value.getMonth === "function" && typeof value.getYear === "function" && !isNaN(value.getTime());
  9151. },
  9152. number: function number(value) {
  9153. if (isNaN(value)) return false;
  9154. return typeof value === "number";
  9155. },
  9156. object: function object(value) {
  9157. return typeof value === "object" && !types.array(value);
  9158. },
  9159. method: function method(value) {
  9160. return typeof value === "function";
  9161. },
  9162. email: function email(value) {
  9163. return typeof value === "string" && value.length <= 320 && !!value.match(pattern$2.email);
  9164. },
  9165. url: function url(value) {
  9166. return typeof value === "string" && value.length <= 2048 && !!value.match(getUrlRegex());
  9167. },
  9168. hex: function hex(value) {
  9169. return typeof value === "string" && !!value.match(pattern$2.hex);
  9170. }
  9171. };
  9172. var type$1 = function type(rule, value, source, errors, options) {
  9173. if (rule.required && value === void 0) {
  9174. required$1(rule, value, source, errors, options);
  9175. return;
  9176. }
  9177. var custom = [
  9178. "integer",
  9179. "float",
  9180. "array",
  9181. "regexp",
  9182. "object",
  9183. "method",
  9184. "email",
  9185. "number",
  9186. "date",
  9187. "url",
  9188. "hex"
  9189. ];
  9190. var ruleType = rule.type;
  9191. if (custom.indexOf(ruleType) > -1) {
  9192. if (!types[ruleType](value)) errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  9193. } else if (ruleType && typeof value !== rule.type) errors.push(format(options.messages.types[ruleType], rule.fullField, rule.type));
  9194. };
  9195. var range = function range(rule, value, source, errors, options) {
  9196. var len = typeof rule.len === "number";
  9197. var min = typeof rule.min === "number";
  9198. var max = typeof rule.max === "number";
  9199. var val = value;
  9200. var key = null;
  9201. var num = typeof value === "number";
  9202. var str = typeof value === "string";
  9203. var arr = Array.isArray(value);
  9204. if (num) key = "number";
  9205. else if (str) key = "string";
  9206. else if (arr) key = "array";
  9207. if (!key) return false;
  9208. if (arr) val = value.length;
  9209. if (str) val = value.length;
  9210. if (len) {
  9211. if (val !== rule.len) errors.push(format(options.messages[key].len, rule.fullField, rule.len));
  9212. } else if (min && !max && val < rule.min) errors.push(format(options.messages[key].min, rule.fullField, rule.min));
  9213. else if (max && !min && val > rule.max) errors.push(format(options.messages[key].max, rule.fullField, rule.max));
  9214. else if (min && max && (val < rule.min || val > rule.max)) errors.push(format(options.messages[key].range, rule.fullField, rule.min, rule.max));
  9215. };
  9216. var ENUM$1 = "enum";
  9217. var rules = {
  9218. required: required$1,
  9219. whitespace,
  9220. type: type$1,
  9221. range,
  9222. "enum": function enumerable(rule, value, source, errors, options) {
  9223. rule[ENUM$1] = Array.isArray(rule[ENUM$1]) ? rule[ENUM$1] : [];
  9224. if (rule[ENUM$1].indexOf(value) === -1) errors.push(format(options.messages[ENUM$1], rule.fullField, rule[ENUM$1].join(", ")));
  9225. },
  9226. pattern: function pattern(rule, value, source, errors, options) {
  9227. if (rule.pattern) {
  9228. if (rule.pattern instanceof RegExp) {
  9229. rule.pattern.lastIndex = 0;
  9230. if (!rule.pattern.test(value)) errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  9231. } else if (typeof rule.pattern === "string") {
  9232. if (!new RegExp(rule.pattern).test(value)) errors.push(format(options.messages.pattern.mismatch, rule.fullField, value, rule.pattern));
  9233. }
  9234. }
  9235. }
  9236. };
  9237. var string = function string(rule, value, callback, source, options) {
  9238. var errors = [];
  9239. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  9240. if (isEmptyValue(value, "string") && !rule.required) return callback();
  9241. rules.required(rule, value, source, errors, options, "string");
  9242. if (!isEmptyValue(value, "string")) {
  9243. rules.type(rule, value, source, errors, options);
  9244. rules.range(rule, value, source, errors, options);
  9245. rules.pattern(rule, value, source, errors, options);
  9246. if (rule.whitespace === true) rules.whitespace(rule, value, source, errors, options);
  9247. }
  9248. }
  9249. callback(errors);
  9250. };
  9251. var method = function method(rule, value, callback, source, options) {
  9252. var errors = [];
  9253. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  9254. if (isEmptyValue(value) && !rule.required) return callback();
  9255. rules.required(rule, value, source, errors, options);
  9256. if (value !== void 0) rules.type(rule, value, source, errors, options);
  9257. }
  9258. callback(errors);
  9259. };
  9260. var number = function number(rule, value, callback, source, options) {
  9261. var errors = [];
  9262. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  9263. if (value === "") value = void 0;
  9264. if (isEmptyValue(value) && !rule.required) return callback();
  9265. rules.required(rule, value, source, errors, options);
  9266. if (value !== void 0) {
  9267. rules.type(rule, value, source, errors, options);
  9268. rules.range(rule, value, source, errors, options);
  9269. }
  9270. }
  9271. callback(errors);
  9272. };
  9273. var _boolean = function _boolean(rule, value, callback, source, options) {
  9274. var errors = [];
  9275. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  9276. if (isEmptyValue(value) && !rule.required) return callback();
  9277. rules.required(rule, value, source, errors, options);
  9278. if (value !== void 0) rules.type(rule, value, source, errors, options);
  9279. }
  9280. callback(errors);
  9281. };
  9282. var regexp = function regexp(rule, value, callback, source, options) {
  9283. var errors = [];
  9284. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  9285. if (isEmptyValue(value) && !rule.required) return callback();
  9286. rules.required(rule, value, source, errors, options);
  9287. if (!isEmptyValue(value)) rules.type(rule, value, source, errors, options);
  9288. }
  9289. callback(errors);
  9290. };
  9291. var integer = function integer(rule, value, callback, source, options) {
  9292. var errors = [];
  9293. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  9294. if (isEmptyValue(value) && !rule.required) return callback();
  9295. rules.required(rule, value, source, errors, options);
  9296. if (value !== void 0) {
  9297. rules.type(rule, value, source, errors, options);
  9298. rules.range(rule, value, source, errors, options);
  9299. }
  9300. }
  9301. callback(errors);
  9302. };
  9303. var floatFn = function floatFn(rule, value, callback, source, options) {
  9304. var errors = [];
  9305. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  9306. if (isEmptyValue(value) && !rule.required) return callback();
  9307. rules.required(rule, value, source, errors, options);
  9308. if (value !== void 0) {
  9309. rules.type(rule, value, source, errors, options);
  9310. rules.range(rule, value, source, errors, options);
  9311. }
  9312. }
  9313. callback(errors);
  9314. };
  9315. var array = function array(rule, value, callback, source, options) {
  9316. var errors = [];
  9317. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  9318. if ((value === void 0 || value === null) && !rule.required) return callback();
  9319. rules.required(rule, value, source, errors, options, "array");
  9320. if (value !== void 0 && value !== null) {
  9321. rules.type(rule, value, source, errors, options);
  9322. rules.range(rule, value, source, errors, options);
  9323. }
  9324. }
  9325. callback(errors);
  9326. };
  9327. var object = function object(rule, value, callback, source, options) {
  9328. var errors = [];
  9329. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  9330. if (isEmptyValue(value) && !rule.required) return callback();
  9331. rules.required(rule, value, source, errors, options);
  9332. if (value !== void 0) rules.type(rule, value, source, errors, options);
  9333. }
  9334. callback(errors);
  9335. };
  9336. var ENUM = "enum";
  9337. var enumerable = function enumerable(rule, value, callback, source, options) {
  9338. var errors = [];
  9339. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  9340. if (isEmptyValue(value) && !rule.required) return callback();
  9341. rules.required(rule, value, source, errors, options);
  9342. if (value !== void 0) rules[ENUM](rule, value, source, errors, options);
  9343. }
  9344. callback(errors);
  9345. };
  9346. var pattern = function pattern(rule, value, callback, source, options) {
  9347. var errors = [];
  9348. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  9349. if (isEmptyValue(value, "string") && !rule.required) return callback();
  9350. rules.required(rule, value, source, errors, options);
  9351. if (!isEmptyValue(value, "string")) rules.pattern(rule, value, source, errors, options);
  9352. }
  9353. callback(errors);
  9354. };
  9355. var date = function date(rule, value, callback, source, options) {
  9356. var errors = [];
  9357. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  9358. if (isEmptyValue(value, "date") && !rule.required) return callback();
  9359. rules.required(rule, value, source, errors, options);
  9360. if (!isEmptyValue(value, "date")) {
  9361. var dateObject;
  9362. if (value instanceof Date) dateObject = value;
  9363. else dateObject = new Date(value);
  9364. rules.type(rule, dateObject, source, errors, options);
  9365. if (dateObject) rules.range(rule, dateObject.getTime(), source, errors, options);
  9366. }
  9367. }
  9368. callback(errors);
  9369. };
  9370. var required = function required(rule, value, callback, source, options) {
  9371. var errors = [];
  9372. var type = Array.isArray(value) ? "array" : typeof value;
  9373. rules.required(rule, value, source, errors, options, type);
  9374. callback(errors);
  9375. };
  9376. var type = function type(rule, value, callback, source, options) {
  9377. var ruleType = rule.type;
  9378. var errors = [];
  9379. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  9380. if (isEmptyValue(value, ruleType) && !rule.required) return callback();
  9381. rules.required(rule, value, source, errors, options, ruleType);
  9382. if (!isEmptyValue(value, ruleType)) rules.type(rule, value, source, errors, options);
  9383. }
  9384. callback(errors);
  9385. };
  9386. var validators = {
  9387. string,
  9388. method,
  9389. number,
  9390. "boolean": _boolean,
  9391. regexp,
  9392. integer,
  9393. "float": floatFn,
  9394. array,
  9395. object,
  9396. "enum": enumerable,
  9397. pattern,
  9398. date,
  9399. url: type,
  9400. hex: type,
  9401. email: type,
  9402. required,
  9403. any: function any(rule, value, callback, source, options) {
  9404. var errors = [];
  9405. if (rule.required || !rule.required && source.hasOwnProperty(rule.field)) {
  9406. if (isEmptyValue(value) && !rule.required) return callback();
  9407. rules.required(rule, value, source, errors, options);
  9408. }
  9409. callback(errors);
  9410. }
  9411. };
  9412. function newMessages() {
  9413. return {
  9414. "default": "Validation error on field %s",
  9415. required: "%s is required",
  9416. "enum": "%s must be one of %s",
  9417. whitespace: "%s cannot be empty",
  9418. date: {
  9419. format: "%s date %s is invalid for format %s",
  9420. parse: "%s date could not be parsed, %s is invalid ",
  9421. invalid: "%s date %s is invalid"
  9422. },
  9423. types: {
  9424. string: "%s is not a %s",
  9425. method: "%s is not a %s (function)",
  9426. array: "%s is not an %s",
  9427. object: "%s is not an %s",
  9428. number: "%s is not a %s",
  9429. date: "%s is not a %s",
  9430. "boolean": "%s is not a %s",
  9431. integer: "%s is not an %s",
  9432. "float": "%s is not a %s",
  9433. regexp: "%s is not a valid %s",
  9434. email: "%s is not a valid %s",
  9435. url: "%s is not a valid %s",
  9436. hex: "%s is not a valid %s"
  9437. },
  9438. string: {
  9439. len: "%s must be exactly %s characters",
  9440. min: "%s must be at least %s characters",
  9441. max: "%s cannot be longer than %s characters",
  9442. range: "%s must be between %s and %s characters"
  9443. },
  9444. number: {
  9445. len: "%s must equal %s",
  9446. min: "%s cannot be less than %s",
  9447. max: "%s cannot be greater than %s",
  9448. range: "%s must be between %s and %s"
  9449. },
  9450. array: {
  9451. len: "%s must be exactly %s in length",
  9452. min: "%s cannot be less than %s in length",
  9453. max: "%s cannot be greater than %s in length",
  9454. range: "%s must be between %s and %s in length"
  9455. },
  9456. pattern: { mismatch: "%s value %s does not match pattern %s" },
  9457. clone: function clone() {
  9458. var cloned = JSON.parse(JSON.stringify(this));
  9459. cloned.clone = this.clone;
  9460. return cloned;
  9461. }
  9462. };
  9463. }
  9464. var messages = newMessages();
  9465. var Schema = /* @__PURE__ */ function() {
  9466. function Schema(descriptor) {
  9467. this.rules = null;
  9468. this._messages = messages;
  9469. this.define(descriptor);
  9470. }
  9471. var _proto = Schema.prototype;
  9472. _proto.define = function define(rules) {
  9473. var _this = this;
  9474. if (!rules) throw new Error("Cannot configure a schema with no rules");
  9475. if (typeof rules !== "object" || Array.isArray(rules)) throw new Error("Rules must be an object");
  9476. this.rules = {};
  9477. Object.keys(rules).forEach(function(name) {
  9478. var item = rules[name];
  9479. _this.rules[name] = Array.isArray(item) ? item : [item];
  9480. });
  9481. };
  9482. _proto.messages = function messages(_messages) {
  9483. if (_messages) this._messages = deepMerge(newMessages(), _messages);
  9484. return this._messages;
  9485. };
  9486. _proto.validate = function validate(source_, o, oc) {
  9487. var _this2 = this;
  9488. if (o === void 0) o = {};
  9489. if (oc === void 0) oc = function oc() {};
  9490. var source = source_;
  9491. var options = o;
  9492. var callback = oc;
  9493. if (typeof options === "function") {
  9494. callback = options;
  9495. options = {};
  9496. }
  9497. if (!this.rules || Object.keys(this.rules).length === 0) {
  9498. if (callback) callback(null, source);
  9499. return Promise.resolve(source);
  9500. }
  9501. function complete(results) {
  9502. var errors = [];
  9503. var fields = {};
  9504. function add(e) {
  9505. if (Array.isArray(e)) {
  9506. var _errors;
  9507. errors = (_errors = errors).concat.apply(_errors, e);
  9508. } else errors.push(e);
  9509. }
  9510. for (var i = 0; i < results.length; i++) add(results[i]);
  9511. if (!errors.length) callback(null, source);
  9512. else {
  9513. fields = convertFieldsError(errors);
  9514. callback(errors, fields);
  9515. }
  9516. }
  9517. if (options.messages) {
  9518. var messages$1 = this.messages();
  9519. if (messages$1 === messages) messages$1 = newMessages();
  9520. deepMerge(messages$1, options.messages);
  9521. options.messages = messages$1;
  9522. } else options.messages = this.messages();
  9523. var series = {};
  9524. (options.keys || Object.keys(this.rules)).forEach(function(z) {
  9525. var arr = _this2.rules[z];
  9526. var value = source[z];
  9527. arr.forEach(function(r) {
  9528. var rule = r;
  9529. if (typeof rule.transform === "function") {
  9530. if (source === source_) source = _extends({}, source);
  9531. value = source[z] = rule.transform(value);
  9532. }
  9533. if (typeof rule === "function") rule = { validator: rule };
  9534. else rule = _extends({}, rule);
  9535. rule.validator = _this2.getValidationMethod(rule);
  9536. if (!rule.validator) return;
  9537. rule.field = z;
  9538. rule.fullField = rule.fullField || z;
  9539. rule.type = _this2.getType(rule);
  9540. series[z] = series[z] || [];
  9541. series[z].push({
  9542. rule,
  9543. value,
  9544. source,
  9545. field: z
  9546. });
  9547. });
  9548. });
  9549. var errorFields = {};
  9550. return asyncMap(series, options, function(data, doIt) {
  9551. var rule = data.rule;
  9552. var deep = (rule.type === "object" || rule.type === "array") && (typeof rule.fields === "object" || typeof rule.defaultField === "object");
  9553. deep = deep && (rule.required || !rule.required && data.value);
  9554. rule.field = data.field;
  9555. function addFullField(key, schema) {
  9556. return _extends({}, schema, {
  9557. fullField: rule.fullField + "." + key,
  9558. fullFields: rule.fullFields ? [].concat(rule.fullFields, [key]) : [key]
  9559. });
  9560. }
  9561. function cb(e) {
  9562. if (e === void 0) e = [];
  9563. var errorList = Array.isArray(e) ? e : [e];
  9564. if (!options.suppressWarning && errorList.length) Schema.warning("async-validator:", errorList);
  9565. if (errorList.length && rule.message !== void 0) errorList = [].concat(rule.message);
  9566. var filledErrors = errorList.map(complementError(rule, source));
  9567. if (options.first && filledErrors.length) {
  9568. errorFields[rule.field] = 1;
  9569. return doIt(filledErrors);
  9570. }
  9571. if (!deep) doIt(filledErrors);
  9572. else {
  9573. if (rule.required && !data.value) {
  9574. if (rule.message !== void 0) filledErrors = [].concat(rule.message).map(complementError(rule, source));
  9575. else if (options.error) filledErrors = [options.error(rule, format(options.messages.required, rule.field))];
  9576. return doIt(filledErrors);
  9577. }
  9578. var fieldsSchema = {};
  9579. if (rule.defaultField) Object.keys(data.value).map(function(key) {
  9580. fieldsSchema[key] = rule.defaultField;
  9581. });
  9582. fieldsSchema = _extends({}, fieldsSchema, data.rule.fields);
  9583. var paredFieldsSchema = {};
  9584. Object.keys(fieldsSchema).forEach(function(field) {
  9585. var fieldSchema = fieldsSchema[field];
  9586. paredFieldsSchema[field] = (Array.isArray(fieldSchema) ? fieldSchema : [fieldSchema]).map(addFullField.bind(null, field));
  9587. });
  9588. var schema = new Schema(paredFieldsSchema);
  9589. schema.messages(options.messages);
  9590. if (data.rule.options) {
  9591. data.rule.options.messages = options.messages;
  9592. data.rule.options.error = options.error;
  9593. }
  9594. schema.validate(data.value, data.rule.options || options, function(errs) {
  9595. var finalErrors = [];
  9596. if (filledErrors && filledErrors.length) finalErrors.push.apply(finalErrors, filledErrors);
  9597. if (errs && errs.length) finalErrors.push.apply(finalErrors, errs);
  9598. doIt(finalErrors.length ? finalErrors : null);
  9599. });
  9600. }
  9601. }
  9602. var res;
  9603. if (rule.asyncValidator) res = rule.asyncValidator(rule, data.value, cb, data.source, options);
  9604. else if (rule.validator) {
  9605. try {
  9606. res = rule.validator(rule, data.value, cb, data.source, options);
  9607. } catch (error) {
  9608. console.error == null || console.error(error);
  9609. if (!options.suppressValidatorError) setTimeout(function() {
  9610. throw error;
  9611. }, 0);
  9612. cb(error.message);
  9613. }
  9614. if (res === true) cb();
  9615. else if (res === false) cb(typeof rule.message === "function" ? rule.message(rule.fullField || rule.field) : rule.message || (rule.fullField || rule.field) + " fails");
  9616. else if (res instanceof Array) cb(res);
  9617. else if (res instanceof Error) cb(res.message);
  9618. }
  9619. if (res && res.then) res.then(function() {
  9620. return cb();
  9621. }, function(e) {
  9622. return cb(e);
  9623. });
  9624. }, function(results) {
  9625. complete(results);
  9626. }, source);
  9627. };
  9628. _proto.getType = function getType(rule) {
  9629. if (rule.type === void 0 && rule.pattern instanceof RegExp) rule.type = "pattern";
  9630. if (typeof rule.validator !== "function" && rule.type && !validators.hasOwnProperty(rule.type)) throw new Error(format("Unknown rule type %s", rule.type));
  9631. return rule.type || "string";
  9632. };
  9633. _proto.getValidationMethod = function getValidationMethod(rule) {
  9634. if (typeof rule.validator === "function") return rule.validator;
  9635. var keys = Object.keys(rule);
  9636. var messageIndex = keys.indexOf("message");
  9637. if (messageIndex !== -1) keys.splice(messageIndex, 1);
  9638. if (keys.length === 1 && keys[0] === "required") return validators.required;
  9639. return validators[this.getType(rule)] || void 0;
  9640. };
  9641. return Schema;
  9642. }();
  9643. Schema.register = function register(type, validator) {
  9644. if (typeof validator !== "function") throw new Error("Cannot register a validator by type, validator is not a function");
  9645. validators[type] = validator;
  9646. };
  9647. Schema.warning = warning;
  9648. Schema.messages = messages;
  9649. Schema.validators = validators;
  9650. //#endregion
  9651. //#region ../../packages/components/form/src/form-label-wrap.tsx
  9652. const COMPONENT_NAME$20 = "ElLabelWrap";
  9653. var form_label_wrap_default = /* @__PURE__ */ defineComponent({
  9654. name: COMPONENT_NAME$20,
  9655. props: {
  9656. isAutoWidth: Boolean,
  9657. updateAll: Boolean
  9658. },
  9659. setup(props, { slots }) {
  9660. const formContext = inject(formContextKey, void 0);
  9661. const formItemContext = inject(formItemContextKey);
  9662. if (!formItemContext) throwError(COMPONENT_NAME$20, "usage: <el-form-item><label-wrap /></el-form-item>");
  9663. const ns = useNamespace("form");
  9664. const el = ref();
  9665. const computedWidth = ref(0);
  9666. const getLabelWidth = () => {
  9667. if (el.value?.firstElementChild) {
  9668. const width = window.getComputedStyle(el.value.firstElementChild).width;
  9669. return Math.ceil(Number.parseFloat(width));
  9670. } else return 0;
  9671. };
  9672. const updateLabelWidth = (action = "update") => {
  9673. nextTick(() => {
  9674. if (slots.default && props.isAutoWidth) {
  9675. if (action === "update") computedWidth.value = getLabelWidth();
  9676. else if (action === "remove") formContext?.deregisterLabelWidth(computedWidth.value);
  9677. }
  9678. });
  9679. };
  9680. const updateLabelWidthFn = () => updateLabelWidth("update");
  9681. onMounted(() => {
  9682. updateLabelWidthFn();
  9683. });
  9684. onBeforeUnmount(() => {
  9685. updateLabelWidth("remove");
  9686. });
  9687. onUpdated(() => updateLabelWidthFn());
  9688. watch(computedWidth, (val, oldVal) => {
  9689. if (props.updateAll) formContext?.registerLabelWidth(val, oldVal);
  9690. });
  9691. useResizeObserver(computed(() => el.value?.firstElementChild ?? null), updateLabelWidthFn);
  9692. return () => {
  9693. if (!slots) return null;
  9694. const { isAutoWidth } = props;
  9695. if (isAutoWidth) {
  9696. const autoLabelWidth = formContext?.autoLabelWidth;
  9697. const hasLabel = formItemContext?.hasLabel;
  9698. const style = {};
  9699. if (hasLabel && autoLabelWidth && autoLabelWidth !== "auto") {
  9700. const marginWidth = Math.max(0, Number.parseInt(autoLabelWidth, 10) - computedWidth.value);
  9701. const marginPosition = (formItemContext.labelPosition || formContext.labelPosition) === "left" ? "marginRight" : "marginLeft";
  9702. if (marginWidth) style[marginPosition] = `${marginWidth}px`;
  9703. }
  9704. return createVNode("div", {
  9705. "ref": el,
  9706. "class": [ns.be("item", "label-wrap")],
  9707. "style": style
  9708. }, [slots.default?.()]);
  9709. } else return createVNode(Fragment, { "ref": el }, [slots.default?.()]);
  9710. };
  9711. }
  9712. });
  9713. //#endregion
  9714. //#region ../../packages/components/form/src/form-item.vue?vue&type=script&setup=true&lang.ts
  9715. const _hoisted_1$79 = ["role", "aria-labelledby"];
  9716. var form_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  9717. name: "ElFormItem",
  9718. __name: "form-item",
  9719. props: formItemProps,
  9720. setup(__props, { expose: __expose }) {
  9721. const props = __props;
  9722. const slots = useSlots();
  9723. const formContext = inject(formContextKey, void 0);
  9724. const parentFormItemContext = inject(formItemContextKey, void 0);
  9725. const _size = useFormSize(void 0, { formItem: false });
  9726. const ns = useNamespace("form-item");
  9727. const labelId = useId().value;
  9728. const inputIds = ref([]);
  9729. const validateState = ref("");
  9730. const validateStateDebounced = refDebounced(validateState, 100);
  9731. const validateMessage = ref("");
  9732. const formItemRef = ref();
  9733. let initialValue = void 0;
  9734. let isResettingField = false;
  9735. const labelPosition = computed(() => props.labelPosition || formContext?.labelPosition);
  9736. const labelStyle = computed(() => {
  9737. if (labelPosition.value === "top") return {};
  9738. return { width: addUnit(props.labelWidth ?? formContext?.labelWidth) };
  9739. });
  9740. const contentStyle = computed(() => {
  9741. if (labelPosition.value === "top" || formContext?.inline) return {};
  9742. if (!props.label && !props.labelWidth && isNested) return {};
  9743. const labelWidth = addUnit(props.labelWidth ?? formContext?.labelWidth);
  9744. if (!props.label && !slots.label) return { marginLeft: labelWidth };
  9745. return {};
  9746. });
  9747. const formItemClasses = computed(() => [
  9748. ns.b(),
  9749. ns.m(_size.value),
  9750. ns.is("error", validateState.value === "error"),
  9751. ns.is("validating", validateState.value === "validating"),
  9752. ns.is("success", validateState.value === "success"),
  9753. ns.is("required", isRequired.value || props.required),
  9754. ns.is("no-asterisk", formContext?.hideRequiredAsterisk),
  9755. formContext?.requireAsteriskPosition === "right" ? "asterisk-right" : "asterisk-left",
  9756. {
  9757. [ns.m("feedback")]: formContext?.statusIcon,
  9758. [ns.m(`label-${labelPosition.value}`)]: labelPosition.value
  9759. }
  9760. ]);
  9761. const _inlineMessage = computed(() => isBoolean(props.inlineMessage) ? props.inlineMessage : formContext?.inlineMessage || false);
  9762. const validateClasses = computed(() => [ns.e("error"), { [ns.em("error", "inline")]: _inlineMessage.value }]);
  9763. const propString = computed(() => {
  9764. if (!props.prop) return "";
  9765. return isArray$1(props.prop) ? props.prop.join(".") : props.prop;
  9766. });
  9767. const hasLabel = computed(() => {
  9768. return !!(props.label || slots.label);
  9769. });
  9770. const labelFor = computed(() => {
  9771. return props.for ?? (inputIds.value.length === 1 ? inputIds.value[0] : void 0);
  9772. });
  9773. const isGroup = computed(() => {
  9774. return !labelFor.value && hasLabel.value;
  9775. });
  9776. const isNested = !!parentFormItemContext;
  9777. const fieldValue = computed(() => {
  9778. const model = formContext?.model;
  9779. if (!model || !props.prop) return;
  9780. return getProp(model, props.prop).value;
  9781. });
  9782. const normalizedRules = computed(() => {
  9783. const { required } = props;
  9784. const rules = [];
  9785. if (props.rules) rules.push(...castArray$1(props.rules));
  9786. const formRules = formContext?.rules;
  9787. if (formRules && props.prop) {
  9788. const _rules = getProp(formRules, props.prop).value;
  9789. if (_rules) rules.push(...castArray$1(_rules));
  9790. }
  9791. if (required !== void 0) {
  9792. const requiredRules = rules.map((rule, i) => [rule, i]).filter(([rule]) => "required" in rule);
  9793. if (requiredRules.length > 0) for (const [rule, i] of requiredRules) {
  9794. if (rule.required === required) continue;
  9795. rules[i] = {
  9796. ...rule,
  9797. required
  9798. };
  9799. }
  9800. else rules.push({ required });
  9801. }
  9802. return rules;
  9803. });
  9804. const validateEnabled = computed(() => normalizedRules.value.length > 0);
  9805. const getFilteredRule = (trigger) => {
  9806. return normalizedRules.value.filter((rule) => {
  9807. if (!rule.trigger || !trigger) return true;
  9808. if (isArray$1(rule.trigger)) return rule.trigger.includes(trigger);
  9809. else return rule.trigger === trigger;
  9810. }).map(({ trigger, ...rule }) => rule);
  9811. };
  9812. const isRequired = computed(() => normalizedRules.value.some((rule) => rule.required));
  9813. const shouldShowError = computed(() => validateStateDebounced.value === "error" && props.showMessage && (formContext?.showMessage ?? true));
  9814. const currentLabel = computed(() => `${props.label || ""}${formContext?.labelSuffix || ""}`);
  9815. const setValidationState = (state) => {
  9816. validateState.value = state;
  9817. };
  9818. const onValidationFailed = (error) => {
  9819. const { errors, fields } = error;
  9820. if (!errors || !fields) console.error(error);
  9821. setValidationState("error");
  9822. validateMessage.value = errors ? errors?.[0]?.message ?? `${props.prop} is required` : "";
  9823. formContext?.emit("validate", props.prop, false, validateMessage.value);
  9824. };
  9825. const onValidationSucceeded = () => {
  9826. setValidationState("success");
  9827. formContext?.emit("validate", props.prop, true, "");
  9828. };
  9829. const doValidate = async (rules) => {
  9830. const modelName = propString.value;
  9831. return new Schema({ [modelName]: rules }).validate({ [modelName]: fieldValue.value }, { firstFields: true }).then(() => {
  9832. onValidationSucceeded();
  9833. return true;
  9834. }).catch((err) => {
  9835. onValidationFailed(err);
  9836. return Promise.reject(err);
  9837. });
  9838. };
  9839. const validate = async (trigger, callback) => {
  9840. if (isResettingField || !props.prop) return false;
  9841. const hasCallback = isFunction$1(callback);
  9842. if (!validateEnabled.value) {
  9843. callback?.(false);
  9844. return false;
  9845. }
  9846. const rules = getFilteredRule(trigger);
  9847. if (rules.length === 0) {
  9848. callback?.(true);
  9849. return true;
  9850. }
  9851. setValidationState("validating");
  9852. return doValidate(rules).then(() => {
  9853. callback?.(true);
  9854. return true;
  9855. }).catch((err) => {
  9856. const { fields } = err;
  9857. callback?.(false, fields);
  9858. return hasCallback ? false : Promise.reject(fields);
  9859. });
  9860. };
  9861. const clearValidate = () => {
  9862. setValidationState("");
  9863. validateMessage.value = "";
  9864. isResettingField = false;
  9865. };
  9866. const resetField = async () => {
  9867. const model = formContext?.model;
  9868. if (!model || !props.prop) return;
  9869. const computedValue = getProp(model, props.prop);
  9870. isResettingField = true;
  9871. computedValue.value = cloneDeep(initialValue);
  9872. await nextTick();
  9873. clearValidate();
  9874. isResettingField = false;
  9875. };
  9876. const addInputId = (id) => {
  9877. if (!inputIds.value.includes(id)) inputIds.value.push(id);
  9878. };
  9879. const removeInputId = (id) => {
  9880. inputIds.value = inputIds.value.filter((listId) => listId !== id);
  9881. };
  9882. const setInitialValue = (value) => {
  9883. initialValue = cloneDeep(value);
  9884. };
  9885. const getInitialValue = () => initialValue;
  9886. watch(() => props.error, (val) => {
  9887. validateMessage.value = val || "";
  9888. setValidationState(val ? "error" : "");
  9889. }, { immediate: true });
  9890. watch(() => props.validateStatus, (val) => setValidationState(val || ""));
  9891. const context = reactive({
  9892. ...toRefs(props),
  9893. $el: formItemRef,
  9894. size: _size,
  9895. validateMessage,
  9896. validateState,
  9897. labelId,
  9898. inputIds,
  9899. isGroup,
  9900. hasLabel,
  9901. fieldValue,
  9902. addInputId,
  9903. removeInputId,
  9904. resetField,
  9905. clearValidate,
  9906. validate,
  9907. propString,
  9908. setInitialValue,
  9909. getInitialValue
  9910. });
  9911. provide(formItemContextKey, context);
  9912. watch(propString, (newPropString, oldPropString) => {
  9913. if (!formContext || !oldPropString) return;
  9914. formContext.removeField(context, oldPropString);
  9915. if (newPropString) {
  9916. setInitialValue(fieldValue.value);
  9917. formContext.addField(context);
  9918. }
  9919. });
  9920. onMounted(() => {
  9921. if (props.prop) {
  9922. setInitialValue(fieldValue.value);
  9923. formContext?.addField(context);
  9924. }
  9925. });
  9926. onBeforeUnmount(() => {
  9927. formContext?.removeField(context);
  9928. });
  9929. __expose({
  9930. size: _size,
  9931. validateMessage,
  9932. validateState,
  9933. validate,
  9934. clearValidate,
  9935. resetField,
  9936. setInitialValue
  9937. });
  9938. return (_ctx, _cache) => {
  9939. return openBlock(), createElementBlock("div", {
  9940. ref_key: "formItemRef",
  9941. ref: formItemRef,
  9942. class: normalizeClass(formItemClasses.value),
  9943. role: isGroup.value ? "group" : void 0,
  9944. "aria-labelledby": isGroup.value ? unref(labelId) : void 0
  9945. }, [createVNode(unref(form_label_wrap_default), {
  9946. "is-auto-width": labelStyle.value.width === "auto",
  9947. "update-all": unref(formContext)?.labelWidth === "auto"
  9948. }, {
  9949. default: withCtx(() => [!!(__props.label || _ctx.$slots.label) ? (openBlock(), createBlock(resolveDynamicComponent(labelFor.value ? "label" : "div"), {
  9950. key: 0,
  9951. id: unref(labelId),
  9952. for: labelFor.value,
  9953. class: normalizeClass(unref(ns).e("label")),
  9954. style: normalizeStyle(labelStyle.value)
  9955. }, {
  9956. default: withCtx(() => [renderSlot(_ctx.$slots, "label", { label: currentLabel.value }, () => [createTextVNode(toDisplayString(currentLabel.value), 1)])]),
  9957. _: 3
  9958. }, 8, [
  9959. "id",
  9960. "for",
  9961. "class",
  9962. "style"
  9963. ])) : createCommentVNode("v-if", true)]),
  9964. _: 3
  9965. }, 8, ["is-auto-width", "update-all"]), createElementVNode("div", {
  9966. class: normalizeClass(unref(ns).e("content")),
  9967. style: normalizeStyle(contentStyle.value)
  9968. }, [renderSlot(_ctx.$slots, "default"), createVNode(TransitionGroup, { name: `${unref(ns).namespace.value}-zoom-in-top` }, {
  9969. default: withCtx(() => [shouldShowError.value ? renderSlot(_ctx.$slots, "error", {
  9970. key: 0,
  9971. error: validateMessage.value
  9972. }, () => [createElementVNode("div", { class: normalizeClass(validateClasses.value) }, toDisplayString(validateMessage.value), 3)]) : createCommentVNode("v-if", true)]),
  9973. _: 3
  9974. }, 8, ["name"])], 6)], 10, _hoisted_1$79);
  9975. };
  9976. }
  9977. });
  9978. //#endregion
  9979. //#region ../../packages/components/form/src/form-item.vue
  9980. var form_item_default = form_item_vue_vue_type_script_setup_true_lang_default;
  9981. //#endregion
  9982. //#region ../../packages/components/form/index.ts
  9983. const ElForm = withInstall(form_default, { FormItem: form_item_default });
  9984. const ElFormItem = withNoopInstall(form_item_default);
  9985. //#endregion
  9986. //#region ../../packages/components/popper/src/utils.ts
  9987. const buildPopperOptions = (props, modifiers = []) => {
  9988. const { placement, strategy, popperOptions } = props;
  9989. const options = {
  9990. placement,
  9991. strategy,
  9992. ...popperOptions,
  9993. modifiers: [...genModifiers(props), ...modifiers]
  9994. };
  9995. deriveExtraModifiers(options, popperOptions?.modifiers);
  9996. return options;
  9997. };
  9998. const unwrapMeasurableEl = ($el) => {
  9999. if (!isClient) return;
  10000. return unrefElement($el);
  10001. };
  10002. function genModifiers(options) {
  10003. const { offset, gpuAcceleration, fallbackPlacements } = options;
  10004. return [
  10005. {
  10006. name: "offset",
  10007. options: { offset: [0, offset ?? 12] }
  10008. },
  10009. {
  10010. name: "preventOverflow",
  10011. options: { padding: {
  10012. top: 0,
  10013. bottom: 0,
  10014. left: 0,
  10015. right: 0
  10016. } }
  10017. },
  10018. {
  10019. name: "flip",
  10020. options: {
  10021. padding: 5,
  10022. fallbackPlacements
  10023. }
  10024. },
  10025. {
  10026. name: "computeStyles",
  10027. options: { gpuAcceleration }
  10028. }
  10029. ];
  10030. }
  10031. function deriveExtraModifiers(options, modifiers) {
  10032. if (modifiers) options.modifiers = [...options.modifiers, ...modifiers ?? []];
  10033. }
  10034. //#endregion
  10035. //#region ../../packages/components/popper/src/composables/use-content.ts
  10036. const DEFAULT_ARROW_OFFSET = 0;
  10037. const usePopperContent = (props) => {
  10038. const { popperInstanceRef, contentRef, triggerRef, role } = inject(POPPER_INJECTION_KEY, void 0);
  10039. const arrowRef = ref();
  10040. const arrowOffset = computed(() => props.arrowOffset);
  10041. const eventListenerModifier = computed(() => {
  10042. return {
  10043. name: "eventListeners",
  10044. enabled: !!props.visible
  10045. };
  10046. });
  10047. const arrowModifier = computed(() => {
  10048. const arrowEl = unref(arrowRef);
  10049. const offset = unref(arrowOffset) ?? DEFAULT_ARROW_OFFSET;
  10050. return {
  10051. name: "arrow",
  10052. enabled: !isUndefined$1(arrowEl),
  10053. options: {
  10054. element: arrowEl,
  10055. padding: offset
  10056. }
  10057. };
  10058. });
  10059. const options = computed(() => {
  10060. return {
  10061. onFirstUpdate: () => {
  10062. update();
  10063. },
  10064. ...buildPopperOptions(props, [unref(arrowModifier), unref(eventListenerModifier)])
  10065. };
  10066. });
  10067. const computedReference = computed(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef));
  10068. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options);
  10069. watch(instanceRef, (instance) => popperInstanceRef.value = instance, { flush: "sync" });
  10070. onMounted(() => {
  10071. watch(() => unref(computedReference)?.getBoundingClientRect?.(), () => {
  10072. update();
  10073. });
  10074. });
  10075. let stopResizeObserver;
  10076. watch(() => props.visible, (visible) => {
  10077. stopResizeObserver?.();
  10078. stopResizeObserver = void 0;
  10079. if (visible) stopResizeObserver = useResizeObserver(contentRef, update).stop;
  10080. });
  10081. onBeforeUnmount(() => {
  10082. popperInstanceRef.value = void 0;
  10083. stopResizeObserver?.();
  10084. stopResizeObserver = void 0;
  10085. });
  10086. return {
  10087. attributes,
  10088. arrowRef,
  10089. contentRef,
  10090. instanceRef,
  10091. state,
  10092. styles,
  10093. role,
  10094. forceUpdate,
  10095. update
  10096. };
  10097. };
  10098. //#endregion
  10099. //#region ../../packages/components/popper/src/composables/use-content-dom.ts
  10100. const usePopperContentDOM = (props, { attributes, styles, role }) => {
  10101. const { nextZIndex } = useZIndex();
  10102. const ns = useNamespace("popper");
  10103. const contentAttrs = computed(() => unref(attributes).popper);
  10104. const contentZIndex = ref(isNumber(props.zIndex) ? props.zIndex : nextZIndex());
  10105. const contentClass = computed(() => [
  10106. ns.b(),
  10107. ns.is("pure", props.pure),
  10108. ns.is(props.effect),
  10109. props.popperClass
  10110. ]);
  10111. const contentStyle = computed(() => {
  10112. return [
  10113. { zIndex: unref(contentZIndex) },
  10114. unref(styles).popper,
  10115. props.popperStyle || {}
  10116. ];
  10117. });
  10118. const ariaModal = computed(() => role.value === "dialog" ? "false" : void 0);
  10119. const arrowStyle = computed(() => unref(styles).arrow || {});
  10120. const updateZIndex = () => {
  10121. contentZIndex.value = isNumber(props.zIndex) ? props.zIndex : nextZIndex();
  10122. };
  10123. return {
  10124. ariaModal,
  10125. arrowStyle,
  10126. contentAttrs,
  10127. contentClass,
  10128. contentStyle,
  10129. contentZIndex,
  10130. updateZIndex
  10131. };
  10132. };
  10133. //#endregion
  10134. //#region ../../packages/components/popper/src/composables/use-focus-trap.ts
  10135. const usePopperContentFocusTrap = (props, emit) => {
  10136. const trapped = ref(false);
  10137. const focusStartRef = ref();
  10138. const onFocusAfterTrapped = () => {
  10139. emit("focus");
  10140. };
  10141. const onFocusAfterReleased = (event) => {
  10142. if (event.detail?.focusReason !== "pointer") {
  10143. focusStartRef.value = "first";
  10144. emit("blur");
  10145. }
  10146. };
  10147. const onFocusInTrap = (event) => {
  10148. if (props.visible && !trapped.value) {
  10149. if (event.target) focusStartRef.value = event.target;
  10150. trapped.value = true;
  10151. }
  10152. };
  10153. const onFocusoutPrevented = (event) => {
  10154. if (!props.trapping) {
  10155. if (event.detail.focusReason === "pointer") event.preventDefault();
  10156. trapped.value = false;
  10157. }
  10158. };
  10159. const onReleaseRequested = () => {
  10160. trapped.value = false;
  10161. emit("close");
  10162. };
  10163. onBeforeUnmount(() => {
  10164. focusStartRef.value = void 0;
  10165. });
  10166. return {
  10167. focusStartRef,
  10168. trapped,
  10169. onFocusAfterReleased,
  10170. onFocusAfterTrapped,
  10171. onFocusInTrap,
  10172. onFocusoutPrevented,
  10173. onReleaseRequested
  10174. };
  10175. };
  10176. //#endregion
  10177. //#region ../../packages/components/popper/src/content.vue?vue&type=script&setup=true&lang.ts
  10178. var content_vue_vue_type_script_setup_true_lang_default$2 = /* @__PURE__ */ defineComponent({
  10179. name: "ElPopperContent",
  10180. __name: "content",
  10181. props: popperContentProps,
  10182. emits: popperContentEmits,
  10183. setup(__props, { expose: __expose, emit: __emit }) {
  10184. const emit = __emit;
  10185. const props = __props;
  10186. const { focusStartRef, trapped, onFocusAfterReleased, onFocusAfterTrapped, onFocusInTrap, onFocusoutPrevented, onReleaseRequested } = usePopperContentFocusTrap(props, emit);
  10187. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  10188. const { ariaModal, arrowStyle, contentAttrs, contentClass, contentStyle, updateZIndex } = usePopperContentDOM(props, {
  10189. styles,
  10190. attributes,
  10191. role
  10192. });
  10193. const formItemContext = inject(formItemContextKey, void 0);
  10194. provide(POPPER_CONTENT_INJECTION_KEY, {
  10195. arrowStyle,
  10196. arrowRef
  10197. });
  10198. if (formItemContext) provide(formItemContextKey, {
  10199. ...formItemContext,
  10200. addInputId: NOOP,
  10201. removeInputId: NOOP
  10202. });
  10203. let triggerTargetAriaStopWatch = void 0;
  10204. const updatePopper = (shouldUpdateZIndex = true) => {
  10205. update();
  10206. shouldUpdateZIndex && updateZIndex();
  10207. };
  10208. const togglePopperAlive = () => {
  10209. updatePopper(false);
  10210. if (props.visible && props.focusOnShow) trapped.value = true;
  10211. else if (props.visible === false) trapped.value = false;
  10212. };
  10213. onMounted(() => {
  10214. watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  10215. triggerTargetAriaStopWatch?.();
  10216. triggerTargetAriaStopWatch = void 0;
  10217. const el = unref(triggerTargetEl || contentRef.value);
  10218. const prevEl = unref(prevTriggerTargetEl || contentRef.value);
  10219. if (isElement$1(el)) triggerTargetAriaStopWatch = watch([
  10220. role,
  10221. () => props.ariaLabel,
  10222. ariaModal,
  10223. () => props.id
  10224. ], (watches) => {
  10225. [
  10226. "role",
  10227. "aria-label",
  10228. "aria-modal",
  10229. "id"
  10230. ].forEach((key, idx) => {
  10231. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  10232. });
  10233. }, { immediate: true });
  10234. if (prevEl !== el && isElement$1(prevEl)) [
  10235. "role",
  10236. "aria-label",
  10237. "aria-modal",
  10238. "id"
  10239. ].forEach((key) => {
  10240. prevEl.removeAttribute(key);
  10241. });
  10242. }, { immediate: true });
  10243. watch(() => props.visible, togglePopperAlive, { immediate: true });
  10244. });
  10245. onBeforeUnmount(() => {
  10246. triggerTargetAriaStopWatch?.();
  10247. triggerTargetAriaStopWatch = void 0;
  10248. contentRef.value = void 0;
  10249. });
  10250. __expose({
  10251. popperContentRef: contentRef,
  10252. popperInstanceRef: instanceRef,
  10253. updatePopper,
  10254. contentStyle
  10255. });
  10256. return (_ctx, _cache) => {
  10257. return openBlock(), createElementBlock("div", mergeProps({
  10258. ref_key: "contentRef",
  10259. ref: contentRef
  10260. }, unref(contentAttrs), {
  10261. style: unref(contentStyle),
  10262. class: unref(contentClass),
  10263. tabindex: "-1",
  10264. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  10265. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  10266. }), [createVNode(unref(focus_trap_default), {
  10267. loop: __props.loop,
  10268. trapped: unref(trapped),
  10269. "trap-on-focus-in": true,
  10270. "focus-trap-el": unref(contentRef),
  10271. "focus-start-el": unref(focusStartRef),
  10272. onFocusAfterTrapped: unref(onFocusAfterTrapped),
  10273. onFocusAfterReleased: unref(onFocusAfterReleased),
  10274. onFocusin: unref(onFocusInTrap),
  10275. onFocusoutPrevented: unref(onFocusoutPrevented),
  10276. onReleaseRequested: unref(onReleaseRequested)
  10277. }, {
  10278. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  10279. _: 3
  10280. }, 8, [
  10281. "loop",
  10282. "trapped",
  10283. "focus-trap-el",
  10284. "focus-start-el",
  10285. "onFocusAfterTrapped",
  10286. "onFocusAfterReleased",
  10287. "onFocusin",
  10288. "onFocusoutPrevented",
  10289. "onReleaseRequested"
  10290. ])], 16);
  10291. };
  10292. }
  10293. });
  10294. //#endregion
  10295. //#region ../../packages/components/popper/src/content.vue
  10296. var content_default = content_vue_vue_type_script_setup_true_lang_default$2;
  10297. //#endregion
  10298. //#region ../../packages/components/popper/index.ts
  10299. const ElPopper = withInstall(popper_default);
  10300. //#endregion
  10301. //#region ../../packages/components/tooltip/src/content.ts
  10302. const useTooltipContentPropsDefaults = {
  10303. ...useDelayedTogglePropsDefaults,
  10304. ...popperContentPropsDefaults,
  10305. content: "",
  10306. visible: null,
  10307. teleported: true
  10308. };
  10309. const useTooltipContentProps = buildProps({
  10310. ...useDelayedToggleProps,
  10311. ...popperContentProps,
  10312. appendTo: { type: definePropType([String, Object]) },
  10313. content: {
  10314. type: String,
  10315. default: ""
  10316. },
  10317. rawContent: Boolean,
  10318. persistent: Boolean,
  10319. visible: {
  10320. type: definePropType(Boolean),
  10321. default: null
  10322. },
  10323. transition: String,
  10324. teleported: {
  10325. type: Boolean,
  10326. default: true
  10327. },
  10328. disabled: Boolean,
  10329. ...useAriaProps(["ariaLabel"])
  10330. });
  10331. //#endregion
  10332. //#region ../../packages/components/tooltip/src/trigger.ts
  10333. const useTooltipTriggerPropsDefaults = {
  10334. trigger: "hover",
  10335. triggerKeys: () => [
  10336. EVENT_CODE.enter,
  10337. EVENT_CODE.numpadEnter,
  10338. EVENT_CODE.space
  10339. ]
  10340. };
  10341. const useTooltipTriggerProps = buildProps({
  10342. ...popperTriggerProps,
  10343. disabled: Boolean,
  10344. trigger: {
  10345. type: definePropType([String, Array]),
  10346. default: "hover"
  10347. },
  10348. triggerKeys: {
  10349. type: definePropType(Array),
  10350. default: () => [
  10351. EVENT_CODE.enter,
  10352. EVENT_CODE.numpadEnter,
  10353. EVENT_CODE.space
  10354. ]
  10355. },
  10356. focusOnTarget: Boolean
  10357. });
  10358. //#endregion
  10359. //#region ../../packages/components/tooltip/src/tooltip.ts
  10360. const { useModelToggleProps: useTooltipModelToggleProps, useModelToggleEmits: useTooltipModelToggleEmits, useModelToggle: useTooltipModelToggle } = createModelToggleComposable("visible");
  10361. const useTooltipProps = buildProps({
  10362. ...popperProps,
  10363. ...useTooltipModelToggleProps,
  10364. ...useTooltipContentProps,
  10365. ...useTooltipTriggerProps,
  10366. ...popperArrowProps,
  10367. showArrow: {
  10368. type: Boolean,
  10369. default: true
  10370. }
  10371. });
  10372. const tooltipEmits = [
  10373. ...useTooltipModelToggleEmits,
  10374. "before-show",
  10375. "before-hide",
  10376. "show",
  10377. "hide",
  10378. "open",
  10379. "close"
  10380. ];
  10381. //#endregion
  10382. //#region ../../packages/components/tooltip/src/constants.ts
  10383. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  10384. //#endregion
  10385. //#region ../../packages/components/tooltip/src/utils.ts
  10386. const isTriggerType = (trigger, type) => {
  10387. if (isArray$1(trigger)) return trigger.includes(type);
  10388. return trigger === type;
  10389. };
  10390. const whenTrigger = (trigger, type, handler) => {
  10391. return (e) => {
  10392. isTriggerType(unref(trigger), type) && handler(e);
  10393. };
  10394. };
  10395. //#endregion
  10396. //#region ../../packages/components/tooltip/src/trigger.vue?vue&type=script&setup=true&lang.ts
  10397. var trigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  10398. name: "ElTooltipTrigger",
  10399. __name: "trigger",
  10400. props: useTooltipTriggerProps,
  10401. setup(__props, { expose: __expose }) {
  10402. const props = __props;
  10403. const ns = useNamespace("tooltip");
  10404. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  10405. const triggerRef = ref(null);
  10406. const stopWhenControlledOrDisabled = () => {
  10407. if (unref(controlled) || props.disabled) return true;
  10408. };
  10409. const trigger = toRef(props, "trigger");
  10410. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", (e) => {
  10411. onOpen(e);
  10412. if (props.focusOnTarget && e.target) nextTick(() => {
  10413. focusElement(e.target, { preventScroll: true });
  10414. });
  10415. }));
  10416. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "hover", onClose));
  10417. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "click", (e) => {
  10418. if (e.button === 0) onToggle(e);
  10419. }));
  10420. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onOpen));
  10421. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "focus", onClose));
  10422. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger, "contextmenu", (e) => {
  10423. e.preventDefault();
  10424. onToggle(e);
  10425. }));
  10426. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  10427. const code = getEventCode(e);
  10428. if (props.triggerKeys.includes(code)) {
  10429. e.preventDefault();
  10430. onToggle(e);
  10431. }
  10432. });
  10433. __expose({ triggerRef });
  10434. return (_ctx, _cache) => {
  10435. return openBlock(), createBlock(unref(trigger_default), {
  10436. id: unref(id),
  10437. "virtual-ref": __props.virtualRef,
  10438. open: unref(open),
  10439. "virtual-triggering": __props.virtualTriggering,
  10440. class: normalizeClass(unref(ns).e("trigger")),
  10441. onBlur: unref(onBlur),
  10442. onClick: unref(onClick),
  10443. onContextmenu: unref(onContextMenu),
  10444. onFocus: unref(onFocus),
  10445. onMouseenter: unref(onMouseenter),
  10446. onMouseleave: unref(onMouseleave),
  10447. onKeydown: unref(onKeydown)
  10448. }, {
  10449. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  10450. _: 3
  10451. }, 8, [
  10452. "id",
  10453. "virtual-ref",
  10454. "open",
  10455. "virtual-triggering",
  10456. "class",
  10457. "onBlur",
  10458. "onClick",
  10459. "onContextmenu",
  10460. "onFocus",
  10461. "onMouseenter",
  10462. "onMouseleave",
  10463. "onKeydown"
  10464. ]);
  10465. };
  10466. }
  10467. });
  10468. //#endregion
  10469. //#region ../../packages/components/tooltip/src/trigger.vue
  10470. var trigger_default$1 = trigger_vue_vue_type_script_setup_true_lang_default;
  10471. //#endregion
  10472. //#region ../../packages/components/tooltip/src/content.vue?vue&type=script&setup=true&lang.ts
  10473. var content_vue_vue_type_script_setup_true_lang_default$1 = /* @__PURE__ */ defineComponent({
  10474. name: "ElTooltipContent",
  10475. inheritAttrs: false,
  10476. __name: "content",
  10477. props: useTooltipContentProps,
  10478. setup(__props, { expose: __expose }) {
  10479. const props = __props;
  10480. const { selector } = usePopperContainerId();
  10481. const ns = useNamespace("tooltip");
  10482. const contentRef = ref();
  10483. const popperContentRef = computedEager(() => contentRef.value?.popperContentRef);
  10484. let stopHandle;
  10485. const { controlled, id, open, trigger, onClose, onOpen, onShow, onHide, onBeforeShow, onBeforeHide } = inject(TOOLTIP_INJECTION_KEY, void 0);
  10486. const transitionClass = computed(() => {
  10487. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  10488. });
  10489. const persistentRef = computed(() => {
  10490. return props.persistent;
  10491. });
  10492. onBeforeUnmount(() => {
  10493. stopHandle?.();
  10494. });
  10495. const shouldRender = computed(() => {
  10496. return unref(persistentRef) ? true : unref(open);
  10497. });
  10498. const shouldShow = computed(() => {
  10499. return props.disabled ? false : unref(open);
  10500. });
  10501. const appendTo = computed(() => {
  10502. return props.appendTo || selector.value;
  10503. });
  10504. const contentStyle = computed(() => props.style ?? {});
  10505. const ariaHidden = ref(true);
  10506. const onTransitionLeave = () => {
  10507. onHide();
  10508. isFocusInsideContent() && focusElement(document.body, { preventScroll: true });
  10509. ariaHidden.value = true;
  10510. };
  10511. const stopWhenControlled = () => {
  10512. if (unref(controlled)) return true;
  10513. };
  10514. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  10515. if (props.enterable && isTriggerType(unref(trigger), "hover")) onOpen();
  10516. });
  10517. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  10518. if (isTriggerType(unref(trigger), "hover")) onClose();
  10519. });
  10520. const onBeforeEnter = () => {
  10521. contentRef.value?.updatePopper?.();
  10522. onBeforeShow?.();
  10523. };
  10524. const onBeforeLeave = () => {
  10525. onBeforeHide?.();
  10526. };
  10527. const onAfterShow = () => {
  10528. onShow();
  10529. };
  10530. const onBlur = () => {
  10531. if (!props.virtualTriggering) onClose();
  10532. };
  10533. const isFocusInsideContent = (event) => {
  10534. const popperContent = contentRef.value?.popperContentRef;
  10535. const activeElement = event?.relatedTarget || document.activeElement;
  10536. return popperContent?.contains(activeElement);
  10537. };
  10538. watch(() => unref(open), (val) => {
  10539. if (!val) stopHandle?.();
  10540. else {
  10541. ariaHidden.value = false;
  10542. stopHandle = onClickOutside(popperContentRef, () => {
  10543. if (unref(controlled)) return;
  10544. if (castArray(unref(trigger)).every((item) => {
  10545. return item !== "hover" && item !== "focus";
  10546. })) onClose();
  10547. }, { detectIframe: true });
  10548. }
  10549. }, { flush: "post" });
  10550. __expose({
  10551. contentRef,
  10552. isFocusInsideContent
  10553. });
  10554. return (_ctx, _cache) => {
  10555. return openBlock(), createBlock(Teleport, {
  10556. disabled: !__props.teleported,
  10557. to: appendTo.value
  10558. }, [shouldRender.value || !ariaHidden.value ? (openBlock(), createBlock(Transition, {
  10559. key: 0,
  10560. name: transitionClass.value,
  10561. appear: !persistentRef.value,
  10562. onAfterLeave: onTransitionLeave,
  10563. onBeforeEnter,
  10564. onAfterEnter: onAfterShow,
  10565. onBeforeLeave,
  10566. persisted: ""
  10567. }, {
  10568. default: withCtx(() => [withDirectives(createVNode(unref(content_default), mergeProps({
  10569. id: unref(id),
  10570. ref_key: "contentRef",
  10571. ref: contentRef
  10572. }, _ctx.$attrs, {
  10573. "aria-label": __props.ariaLabel,
  10574. "aria-hidden": ariaHidden.value,
  10575. "boundaries-padding": __props.boundariesPadding,
  10576. "fallback-placements": __props.fallbackPlacements,
  10577. "gpu-acceleration": __props.gpuAcceleration,
  10578. offset: __props.offset,
  10579. placement: __props.placement,
  10580. "popper-options": __props.popperOptions,
  10581. "arrow-offset": __props.arrowOffset,
  10582. strategy: __props.strategy,
  10583. effect: __props.effect,
  10584. enterable: __props.enterable,
  10585. pure: __props.pure,
  10586. "popper-class": __props.popperClass,
  10587. "popper-style": [__props.popperStyle, contentStyle.value],
  10588. "reference-el": __props.referenceEl,
  10589. "trigger-target-el": __props.triggerTargetEl,
  10590. visible: shouldShow.value,
  10591. "z-index": __props.zIndex,
  10592. loop: __props.loop,
  10593. onMouseenter: unref(onContentEnter),
  10594. onMouseleave: unref(onContentLeave),
  10595. onBlur,
  10596. onClose: unref(onClose)
  10597. }), {
  10598. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  10599. _: 3
  10600. }, 16, [
  10601. "id",
  10602. "aria-label",
  10603. "aria-hidden",
  10604. "boundaries-padding",
  10605. "fallback-placements",
  10606. "gpu-acceleration",
  10607. "offset",
  10608. "placement",
  10609. "popper-options",
  10610. "arrow-offset",
  10611. "strategy",
  10612. "effect",
  10613. "enterable",
  10614. "pure",
  10615. "popper-class",
  10616. "popper-style",
  10617. "reference-el",
  10618. "trigger-target-el",
  10619. "visible",
  10620. "z-index",
  10621. "loop",
  10622. "onMouseenter",
  10623. "onMouseleave",
  10624. "onClose"
  10625. ]), [[vShow, shouldShow.value]])]),
  10626. _: 3
  10627. }, 8, ["name", "appear"])) : createCommentVNode("v-if", true)], 8, ["disabled", "to"]);
  10628. };
  10629. }
  10630. });
  10631. //#endregion
  10632. //#region ../../packages/components/tooltip/src/content.vue
  10633. var content_default$2 = content_vue_vue_type_script_setup_true_lang_default$1;
  10634. //#endregion
  10635. //#region ../../packages/components/tooltip/src/tooltip.vue?vue&type=script&setup=true&lang.ts
  10636. const _hoisted_1$78 = ["innerHTML"];
  10637. const _hoisted_2$44 = { key: 1 };
  10638. var tooltip_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  10639. name: "ElTooltip",
  10640. __name: "tooltip",
  10641. props: useTooltipProps,
  10642. emits: tooltipEmits,
  10643. setup(__props, { expose: __expose, emit: __emit }) {
  10644. const props = __props;
  10645. const emit = __emit;
  10646. usePopperContainer();
  10647. const ns = useNamespace("tooltip");
  10648. const id = useId();
  10649. const popperRef = ref();
  10650. const contentRef = ref();
  10651. const updatePopper = () => {
  10652. const popperComponent = unref(popperRef);
  10653. if (popperComponent) popperComponent.popperInstanceRef?.update();
  10654. };
  10655. const open = ref(false);
  10656. const toggleReason = ref();
  10657. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  10658. indicator: open,
  10659. toggleReason
  10660. });
  10661. const { onOpen, onClose } = useDelayedToggle({
  10662. showAfter: toRef(props, "showAfter"),
  10663. hideAfter: toRef(props, "hideAfter"),
  10664. autoClose: toRef(props, "autoClose"),
  10665. open: show,
  10666. close: hide
  10667. });
  10668. const controlled = computed(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  10669. const kls = computed(() => {
  10670. return [ns.b(), props.popperClass];
  10671. });
  10672. provide(TOOLTIP_INJECTION_KEY, {
  10673. controlled,
  10674. id,
  10675. open: readonly(open),
  10676. trigger: toRef(props, "trigger"),
  10677. onOpen,
  10678. onClose,
  10679. onToggle: (event) => {
  10680. if (unref(open)) onClose(event);
  10681. else onOpen(event);
  10682. },
  10683. onShow: () => {
  10684. emit("show", toggleReason.value);
  10685. },
  10686. onHide: () => {
  10687. emit("hide", toggleReason.value);
  10688. },
  10689. onBeforeShow: () => {
  10690. emit("before-show", toggleReason.value);
  10691. },
  10692. onBeforeHide: () => {
  10693. emit("before-hide", toggleReason.value);
  10694. },
  10695. updatePopper
  10696. });
  10697. watch(() => props.disabled, (disabled) => {
  10698. if (disabled && open.value) open.value = false;
  10699. if (!disabled && isBoolean(props.visible)) open.value = props.visible;
  10700. });
  10701. const isFocusInsideContent = (event) => {
  10702. return contentRef.value?.isFocusInsideContent(event);
  10703. };
  10704. onDeactivated(() => open.value && hide());
  10705. onBeforeUnmount(() => {
  10706. toggleReason.value = void 0;
  10707. });
  10708. __expose({
  10709. popperRef,
  10710. contentRef,
  10711. isFocusInsideContent,
  10712. updatePopper,
  10713. onOpen,
  10714. onClose,
  10715. hide
  10716. });
  10717. return (_ctx, _cache) => {
  10718. return openBlock(), createBlock(unref(ElPopper), {
  10719. ref_key: "popperRef",
  10720. ref: popperRef,
  10721. role: __props.role
  10722. }, {
  10723. default: withCtx(() => [createVNode(trigger_default$1, {
  10724. disabled: __props.disabled,
  10725. trigger: __props.trigger,
  10726. "trigger-keys": __props.triggerKeys,
  10727. "virtual-ref": __props.virtualRef,
  10728. "virtual-triggering": __props.virtualTriggering,
  10729. "focus-on-target": __props.focusOnTarget
  10730. }, {
  10731. default: withCtx(() => [_ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)]),
  10732. _: 3
  10733. }, 8, [
  10734. "disabled",
  10735. "trigger",
  10736. "trigger-keys",
  10737. "virtual-ref",
  10738. "virtual-triggering",
  10739. "focus-on-target"
  10740. ]), createVNode(content_default$2, {
  10741. ref_key: "contentRef",
  10742. ref: contentRef,
  10743. "aria-label": __props.ariaLabel,
  10744. "boundaries-padding": __props.boundariesPadding,
  10745. content: __props.content,
  10746. disabled: __props.disabled,
  10747. effect: __props.effect,
  10748. enterable: __props.enterable,
  10749. "fallback-placements": __props.fallbackPlacements,
  10750. "hide-after": __props.hideAfter,
  10751. "gpu-acceleration": __props.gpuAcceleration,
  10752. offset: __props.offset,
  10753. persistent: __props.persistent,
  10754. "popper-class": kls.value,
  10755. "popper-style": __props.popperStyle,
  10756. placement: __props.placement,
  10757. "popper-options": __props.popperOptions,
  10758. "arrow-offset": __props.arrowOffset,
  10759. pure: __props.pure,
  10760. "raw-content": __props.rawContent,
  10761. "reference-el": __props.referenceEl,
  10762. "trigger-target-el": __props.triggerTargetEl,
  10763. "show-after": __props.showAfter,
  10764. strategy: __props.strategy,
  10765. teleported: __props.teleported,
  10766. transition: __props.transition,
  10767. "virtual-triggering": __props.virtualTriggering,
  10768. "z-index": __props.zIndex,
  10769. "append-to": __props.appendTo,
  10770. loop: __props.loop
  10771. }, {
  10772. default: withCtx(() => [renderSlot(_ctx.$slots, "content", {}, () => [__props.rawContent ? (openBlock(), createElementBlock("span", {
  10773. key: 0,
  10774. innerHTML: __props.content
  10775. }, null, 8, _hoisted_1$78)) : (openBlock(), createElementBlock("span", _hoisted_2$44, toDisplayString(__props.content), 1))]), __props.showArrow ? (openBlock(), createBlock(unref(arrow_default), { key: 0 })) : createCommentVNode("v-if", true)]),
  10776. _: 3
  10777. }, 8, [
  10778. "aria-label",
  10779. "boundaries-padding",
  10780. "content",
  10781. "disabled",
  10782. "effect",
  10783. "enterable",
  10784. "fallback-placements",
  10785. "hide-after",
  10786. "gpu-acceleration",
  10787. "offset",
  10788. "persistent",
  10789. "popper-class",
  10790. "popper-style",
  10791. "placement",
  10792. "popper-options",
  10793. "arrow-offset",
  10794. "pure",
  10795. "raw-content",
  10796. "reference-el",
  10797. "trigger-target-el",
  10798. "show-after",
  10799. "strategy",
  10800. "teleported",
  10801. "transition",
  10802. "virtual-triggering",
  10803. "z-index",
  10804. "append-to",
  10805. "loop"
  10806. ])]),
  10807. _: 3
  10808. }, 8, ["role"]);
  10809. };
  10810. }
  10811. });
  10812. //#endregion
  10813. //#region ../../packages/components/tooltip/src/tooltip.vue
  10814. var tooltip_default = tooltip_vue_vue_type_script_setup_true_lang_default;
  10815. //#endregion
  10816. //#region ../../packages/components/tooltip/index.ts
  10817. const ElTooltip = withInstall(tooltip_default);
  10818. //#endregion
  10819. //#region ../../packages/components/input/src/input.ts
  10820. const inputProps = buildProps({
  10821. id: {
  10822. type: String,
  10823. default: void 0
  10824. },
  10825. size: useSizeProp,
  10826. disabled: {
  10827. type: Boolean,
  10828. default: void 0
  10829. },
  10830. modelValue: {
  10831. type: definePropType([
  10832. String,
  10833. Number,
  10834. Object
  10835. ]),
  10836. default: ""
  10837. },
  10838. modelModifiers: {
  10839. type: definePropType(Object),
  10840. default: () => ({})
  10841. },
  10842. maxlength: { type: [String, Number] },
  10843. minlength: { type: [String, Number] },
  10844. type: {
  10845. type: definePropType(String),
  10846. default: "text"
  10847. },
  10848. resize: {
  10849. type: String,
  10850. values: [
  10851. "none",
  10852. "both",
  10853. "horizontal",
  10854. "vertical"
  10855. ]
  10856. },
  10857. autosize: {
  10858. type: definePropType([Boolean, Object]),
  10859. default: false
  10860. },
  10861. autocomplete: {
  10862. type: definePropType(String),
  10863. default: "off"
  10864. },
  10865. formatter: { type: Function },
  10866. parser: { type: Function },
  10867. placeholder: { type: String },
  10868. form: { type: String },
  10869. readonly: Boolean,
  10870. clearable: Boolean,
  10871. clearIcon: {
  10872. type: iconPropType,
  10873. default: circle_close_default
  10874. },
  10875. showPassword: Boolean,
  10876. showWordLimit: Boolean,
  10877. wordLimitPosition: {
  10878. type: String,
  10879. values: ["inside", "outside"],
  10880. default: "inside"
  10881. },
  10882. suffixIcon: { type: iconPropType },
  10883. prefixIcon: { type: iconPropType },
  10884. containerRole: {
  10885. type: String,
  10886. default: void 0
  10887. },
  10888. tabindex: {
  10889. type: [String, Number],
  10890. default: 0
  10891. },
  10892. validateEvent: {
  10893. type: Boolean,
  10894. default: true
  10895. },
  10896. inputStyle: {
  10897. type: definePropType([
  10898. Object,
  10899. Array,
  10900. String,
  10901. Boolean
  10902. ]),
  10903. default: () => mutable({})
  10904. },
  10905. countGraphemes: { type: definePropType(Function) },
  10906. autofocus: Boolean,
  10907. rows: {
  10908. type: Number,
  10909. default: 2
  10910. },
  10911. ...useAriaProps(["ariaLabel"]),
  10912. inputmode: {
  10913. type: definePropType(String),
  10914. default: void 0
  10915. },
  10916. name: String
  10917. });
  10918. const inputEmits = {
  10919. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  10920. input: (value) => isString(value),
  10921. change: (value, evt) => isString(value) && (evt instanceof Event || evt === void 0),
  10922. focus: (evt) => evt instanceof FocusEvent,
  10923. blur: (evt) => evt instanceof FocusEvent,
  10924. clear: (evt) => evt === void 0 || evt instanceof MouseEvent,
  10925. mouseleave: (evt) => evt instanceof MouseEvent,
  10926. mouseenter: (evt) => evt instanceof MouseEvent,
  10927. keydown: (evt) => evt instanceof Event,
  10928. compositionstart: (evt) => evt instanceof CompositionEvent,
  10929. compositionupdate: (evt) => evt instanceof CompositionEvent,
  10930. compositionend: (evt) => evt instanceof CompositionEvent
  10931. };
  10932. const inputPropsDefaults = {
  10933. disabled: void 0,
  10934. modelValue: "",
  10935. modelModifiers: () => ({}),
  10936. type: "text",
  10937. autocomplete: "off",
  10938. clearIcon: markRaw(circle_close_default),
  10939. wordLimitPosition: "inside",
  10940. tabindex: 0,
  10941. validateEvent: true,
  10942. inputStyle: () => ({}),
  10943. rows: 2
  10944. };
  10945. //#endregion
  10946. //#region ../../packages/components/input/src/utils.ts
  10947. let hiddenTextarea = void 0;
  10948. const HIDDEN_STYLE = {
  10949. height: "0",
  10950. visibility: "hidden",
  10951. overflow: isFirefox() ? "" : "hidden",
  10952. position: "absolute",
  10953. "z-index": "-1000",
  10954. top: "0",
  10955. right: "0"
  10956. };
  10957. const CONTEXT_STYLE = [
  10958. "letter-spacing",
  10959. "line-height",
  10960. "padding-top",
  10961. "padding-bottom",
  10962. "font-family",
  10963. "font-weight",
  10964. "font-size",
  10965. "text-rendering",
  10966. "text-transform",
  10967. "width",
  10968. "text-indent",
  10969. "padding-left",
  10970. "padding-right",
  10971. "border-width",
  10972. "box-sizing",
  10973. "word-break"
  10974. ];
  10975. const looseToNumber = (val) => {
  10976. const n = Number.parseFloat(val);
  10977. return Number.isNaN(n) ? val : n;
  10978. };
  10979. function calculateNodeStyling(targetElement) {
  10980. const style = window.getComputedStyle(targetElement);
  10981. const boxSizing = style.getPropertyValue("box-sizing");
  10982. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  10983. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  10984. return {
  10985. contextStyle: CONTEXT_STYLE.map((name) => [name, style.getPropertyValue(name)]),
  10986. paddingSize,
  10987. borderSize,
  10988. boxSizing
  10989. };
  10990. }
  10991. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  10992. if (!hiddenTextarea) {
  10993. hiddenTextarea = document.createElement("textarea");
  10994. let hostNode = document.body;
  10995. if (!isFirefox() && targetElement.parentNode) hostNode = targetElement.parentNode;
  10996. hostNode.appendChild(hiddenTextarea);
  10997. }
  10998. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  10999. contextStyle.forEach(([key, value]) => hiddenTextarea?.style.setProperty(key, value));
  11000. Object.entries(HIDDEN_STYLE).forEach(([key, value]) => hiddenTextarea?.style.setProperty(key, value, "important"));
  11001. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  11002. let height = hiddenTextarea.scrollHeight;
  11003. const result = {};
  11004. if (boxSizing === "border-box") height = height + borderSize;
  11005. else if (boxSizing === "content-box") height = height - paddingSize;
  11006. hiddenTextarea.value = "";
  11007. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  11008. if (isNumber(minRows)) {
  11009. let minHeight = singleRowHeight * minRows;
  11010. if (boxSizing === "border-box") minHeight = minHeight + paddingSize + borderSize;
  11011. height = Math.max(minHeight, height);
  11012. result.minHeight = `${minHeight}px`;
  11013. }
  11014. if (isNumber(maxRows)) {
  11015. let maxHeight = singleRowHeight * maxRows;
  11016. if (boxSizing === "border-box") maxHeight = maxHeight + paddingSize + borderSize;
  11017. height = Math.min(maxHeight, height);
  11018. }
  11019. result.height = `${height}px`;
  11020. hiddenTextarea.parentNode?.removeChild(hiddenTextarea);
  11021. hiddenTextarea = void 0;
  11022. return result;
  11023. }
  11024. //#endregion
  11025. //#region ../../packages/components/input/src/input.vue?vue&type=script&setup=true&lang.ts
  11026. const _hoisted_1$77 = [
  11027. "id",
  11028. "name",
  11029. "minlength",
  11030. "maxlength",
  11031. "type",
  11032. "disabled",
  11033. "readonly",
  11034. "autocomplete",
  11035. "tabindex",
  11036. "aria-label",
  11037. "placeholder",
  11038. "form",
  11039. "autofocus",
  11040. "role",
  11041. "inputmode"
  11042. ];
  11043. const _hoisted_2$43 = [
  11044. "id",
  11045. "name",
  11046. "minlength",
  11047. "maxlength",
  11048. "tabindex",
  11049. "disabled",
  11050. "readonly",
  11051. "autocomplete",
  11052. "aria-label",
  11053. "placeholder",
  11054. "form",
  11055. "autofocus",
  11056. "rows",
  11057. "role",
  11058. "inputmode"
  11059. ];
  11060. const COMPONENT_NAME$19 = "ElInput";
  11061. var input_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11062. name: COMPONENT_NAME$19,
  11063. inheritAttrs: false,
  11064. __name: "input",
  11065. props: inputProps,
  11066. emits: inputEmits,
  11067. setup(__props, { expose: __expose, emit: __emit }) {
  11068. const props = __props;
  11069. const emit = __emit;
  11070. const rawAttrs = useAttrs$1();
  11071. const slots = useSlots();
  11072. const containerKls = computed(() => [
  11073. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  11074. nsInput.m(inputSize.value),
  11075. nsInput.is("disabled", inputDisabled.value),
  11076. nsInput.is("exceed", inputExceed.value),
  11077. {
  11078. [nsInput.b("group")]: slots.prepend || slots.append,
  11079. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  11080. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  11081. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value,
  11082. [nsInput.b("hidden")]: props.type === "hidden"
  11083. },
  11084. rawAttrs.class
  11085. ]);
  11086. const wrapperKls = computed(() => [nsInput.e("wrapper"), nsInput.is("focus", isFocused.value)]);
  11087. const attrs = useAttrs();
  11088. const maxlength = computed(() => props.maxlength?.toString());
  11089. const { form: elForm, formItem: elFormItem } = useFormItem();
  11090. const { inputId } = useFormItemInputId(props, { formItemContext: elFormItem });
  11091. const inputSize = useFormSize();
  11092. const inputDisabled = useFormDisabled();
  11093. const nsInput = useNamespace("input");
  11094. const nsTextarea = useNamespace("textarea");
  11095. const input = shallowRef();
  11096. const textarea = shallowRef();
  11097. const hovering = ref(false);
  11098. const passwordVisible = ref(false);
  11099. const countStyle = ref();
  11100. const clearIconStyle = ref();
  11101. const textareaCalcStyle = shallowRef(props.inputStyle);
  11102. const saveValue = ref("");
  11103. const textareaHeight = ref();
  11104. const _ref = computed(() => input.value || textarea.value);
  11105. const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(_ref, {
  11106. disabled: inputDisabled,
  11107. afterBlur() {
  11108. if (props.validateEvent) elFormItem?.validate?.("blur").catch(NOOP);
  11109. }
  11110. });
  11111. const needStatusIcon = computed(() => elForm?.statusIcon ?? false);
  11112. const validateState = computed(() => elFormItem?.validateState || "");
  11113. const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  11114. const passwordIcon = computed(() => passwordVisible.value ? view_default : hide_default);
  11115. const containerStyle = computed(() => [rawAttrs.style]);
  11116. const textareaStyle = computed(() => [
  11117. props.inputStyle,
  11118. textareaCalcStyle.value,
  11119. { resize: props.resize },
  11120. textareaHeight.value ? { height: textareaHeight.value } : void 0
  11121. ]);
  11122. const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  11123. const renderClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly);
  11124. const showClear = computed(() => renderClear.value && !!nativeInputValue.value && (isFocused.value || hovering.value));
  11125. const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !!nativeInputValue.value);
  11126. const isWordLimitVisible = computed(() => props.showWordLimit && !!maxlength.value && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  11127. const textLength = computed(() => {
  11128. if (props.countGraphemes && props.showWordLimit) return props.countGraphemes(nativeInputValue.value);
  11129. return nativeInputValue.value.length;
  11130. });
  11131. const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(maxlength.value));
  11132. const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || props.clearable || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  11133. const hasModelModifiers = computed(() => !!Object.keys(props.modelModifiers).length);
  11134. const [recordCursor, setCursor] = useCursor(input);
  11135. let rAFId;
  11136. useResizeObserver(textarea, (entries) => {
  11137. onceInitSizeTextarea();
  11138. if (!isWordLimitVisible.value && !renderClear.value || props.resize !== "both" && props.resize !== "horizontal") return;
  11139. const { width } = entries[0].target.getBoundingClientRect();
  11140. const updateStyle = () => {
  11141. rAFId = void 0;
  11142. countStyle.value = { right: `calc(100% - ${width - 10}px)` };
  11143. clearIconStyle.value = { right: `calc(100% - ${width - 11}px)` };
  11144. };
  11145. rAFId && cAF(rAFId);
  11146. rAFId = rAF(updateStyle);
  11147. });
  11148. const resizeTextarea = () => {
  11149. const { type, autosize } = props;
  11150. if (!isClient || type !== "textarea" || !textarea.value) return;
  11151. if (autosize) {
  11152. const minRows = isObject$1(autosize) ? autosize.minRows : void 0;
  11153. const maxRows = isObject$1(autosize) ? autosize.maxRows : void 0;
  11154. const textareaStyle = calcTextareaHeight(textarea.value, minRows, maxRows);
  11155. textareaCalcStyle.value = {
  11156. overflowY: "hidden",
  11157. ...textareaStyle
  11158. };
  11159. nextTick(() => {
  11160. textarea.value.offsetHeight;
  11161. textareaCalcStyle.value = textareaStyle;
  11162. });
  11163. } else textareaCalcStyle.value = { minHeight: calcTextareaHeight(textarea.value).minHeight };
  11164. };
  11165. const createOnceInitResize = (resizeTextarea) => {
  11166. let isInit = false;
  11167. return () => {
  11168. if (isInit || !props.autosize) {
  11169. if (props.resize !== "none") setTimeout(() => {
  11170. textareaHeight.value = textarea.value?.style.height;
  11171. });
  11172. return;
  11173. }
  11174. if (!(textarea.value?.offsetParent === null)) {
  11175. setTimeout(resizeTextarea);
  11176. isInit = true;
  11177. }
  11178. };
  11179. };
  11180. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  11181. const setNativeInputValue = () => {
  11182. const input = _ref.value;
  11183. const formatterValue = props.formatter ? props.formatter(nativeInputValue.value) : nativeInputValue.value;
  11184. if (!input || input.value === formatterValue || props.type === "file") return;
  11185. input.value = formatterValue;
  11186. };
  11187. const formatValue = (value) => {
  11188. const { trim, number } = props.modelModifiers;
  11189. if (trim) value = value.trim();
  11190. if (number) value = `${looseToNumber(value)}`;
  11191. if (props.formatter && props.parser) value = props.parser(value);
  11192. return value;
  11193. };
  11194. const handleInput = async (event) => {
  11195. if (isComposing.value) return;
  11196. const { lazy } = props.modelModifiers;
  11197. let { value } = event.target;
  11198. let shouldForceNativeUpdate = false;
  11199. if (lazy) {
  11200. emit(INPUT_EVENT, value);
  11201. return;
  11202. }
  11203. value = formatValue(value);
  11204. if (props.countGraphemes && maxlength.value != null) {
  11205. const limit = Number(maxlength.value);
  11206. const graphemes = props.countGraphemes(value);
  11207. const saveGraphemes = props.countGraphemes(saveValue.value);
  11208. if (graphemes > limit && graphemes > saveGraphemes) if (saveGraphemes > limit) {
  11209. value = saveValue.value;
  11210. shouldForceNativeUpdate = true;
  11211. } else {
  11212. const prevValue = saveValue.value;
  11213. const nextValue = value;
  11214. let prefixLen = 0;
  11215. while (prefixLen < prevValue.length && prefixLen < nextValue.length && prevValue[prefixLen] === nextValue[prefixLen]) prefixLen++;
  11216. let prevSuffixIndex = prevValue.length;
  11217. let nextSuffixIndex = nextValue.length;
  11218. while (prevSuffixIndex > prefixLen && nextSuffixIndex > prefixLen && prevValue[prevSuffixIndex - 1] === nextValue[nextSuffixIndex - 1]) {
  11219. prevSuffixIndex--;
  11220. nextSuffixIndex--;
  11221. }
  11222. const before = nextValue.slice(0, prefixLen);
  11223. const removed = prevValue.slice(prefixLen, prevSuffixIndex);
  11224. const inserted = nextValue.slice(prefixLen, nextSuffixIndex);
  11225. const after = nextValue.slice(nextSuffixIndex);
  11226. const baseCount = saveGraphemes - props.countGraphemes(removed);
  11227. const availableInserted = Math.max(0, limit - baseCount);
  11228. let acceptedInserted = "";
  11229. if (availableInserted > 0) if (typeof Intl !== "undefined" && "Segmenter" in Intl) {
  11230. const segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
  11231. for (const { segment } of segmenter.segment(inserted)) {
  11232. const candidate = acceptedInserted + segment;
  11233. if (props.countGraphemes(candidate) > availableInserted) break;
  11234. acceptedInserted = candidate;
  11235. }
  11236. } else for (const char of Array.from(inserted)) {
  11237. const candidate = acceptedInserted + char;
  11238. if (props.countGraphemes(candidate) > availableInserted) break;
  11239. acceptedInserted = candidate;
  11240. }
  11241. value = before + acceptedInserted + after;
  11242. shouldForceNativeUpdate = true;
  11243. }
  11244. }
  11245. if (String(value) === nativeInputValue.value) {
  11246. if (props.formatter || shouldForceNativeUpdate) {
  11247. const target = event.target;
  11248. const blockedValue = target.value;
  11249. const selectionStart = target.selectionStart;
  11250. const selectionEnd = target.selectionEnd;
  11251. setNativeInputValue();
  11252. if (shouldForceNativeUpdate && _ref.value && selectionStart != null && selectionEnd != null) {
  11253. const restoredValue = _ref.value.value;
  11254. const afterTxt = blockedValue.slice(Math.max(0, selectionEnd));
  11255. let caretPos = Math.min(selectionStart, restoredValue.length);
  11256. if (afterTxt && restoredValue.endsWith(afterTxt)) caretPos = restoredValue.length - afterTxt.length;
  11257. _ref.value.setSelectionRange(caretPos, caretPos);
  11258. }
  11259. }
  11260. return;
  11261. }
  11262. saveValue.value = value;
  11263. recordCursor();
  11264. emit(UPDATE_MODEL_EVENT, value);
  11265. emit(INPUT_EVENT, value);
  11266. await nextTick();
  11267. if (props.formatter && props.parser || !hasModelModifiers.value) setNativeInputValue();
  11268. setCursor();
  11269. };
  11270. const handleChange = async (event) => {
  11271. let { value } = event.target;
  11272. value = formatValue(value);
  11273. if (props.modelModifiers.lazy) emit(UPDATE_MODEL_EVENT, value);
  11274. emit(CHANGE_EVENT, value, event);
  11275. await nextTick();
  11276. setNativeInputValue();
  11277. };
  11278. const { isComposing, handleCompositionStart, handleCompositionUpdate, handleCompositionEnd } = useComposition({
  11279. emit,
  11280. afterComposition: handleInput
  11281. });
  11282. const handlePasswordVisible = () => {
  11283. passwordVisible.value = !passwordVisible.value;
  11284. };
  11285. const focus = () => _ref.value?.focus();
  11286. const blur = () => _ref.value?.blur();
  11287. const handleMouseLeave = (evt) => {
  11288. hovering.value = false;
  11289. emit("mouseleave", evt);
  11290. };
  11291. const handleMouseEnter = (evt) => {
  11292. hovering.value = true;
  11293. emit("mouseenter", evt);
  11294. };
  11295. const handleKeydown = (evt) => {
  11296. emit("keydown", evt);
  11297. };
  11298. const select = () => {
  11299. _ref.value?.select();
  11300. };
  11301. const clear = (evt) => {
  11302. emit(UPDATE_MODEL_EVENT, "");
  11303. emit(CHANGE_EVENT, "");
  11304. emit("clear", evt);
  11305. emit(INPUT_EVENT, "");
  11306. };
  11307. watch(() => props.modelValue, () => {
  11308. nextTick(() => {
  11309. resizeTextarea();
  11310. if (props.autosize) textareaHeight.value = void 0;
  11311. });
  11312. if (props.validateEvent) elFormItem?.validate?.("change").catch(NOOP);
  11313. });
  11314. watch(() => nativeInputValue.value, (val) => {
  11315. saveValue.value = val;
  11316. }, { immediate: true });
  11317. watch(nativeInputValue, (newValue) => {
  11318. if (!_ref.value) return;
  11319. const { trim, number } = props.modelModifiers;
  11320. const elValue = _ref.value.value;
  11321. const displayValue = (number || props.type === "number") && !/^0\d/.test(elValue) ? `${looseToNumber(elValue)}` : elValue;
  11322. if (displayValue === newValue) return;
  11323. if (document.activeElement === _ref.value && _ref.value.type !== "range") {
  11324. if (trim && displayValue.trim() === newValue) return;
  11325. }
  11326. setNativeInputValue();
  11327. });
  11328. watch(() => props.type, async () => {
  11329. await nextTick();
  11330. setNativeInputValue();
  11331. resizeTextarea();
  11332. });
  11333. onMounted(() => {
  11334. if (!props.formatter && props.parser) /* @__PURE__ */ debugWarn(COMPONENT_NAME$19, "If you set the parser, you also need to set the formatter.");
  11335. setNativeInputValue();
  11336. nextTick(resizeTextarea);
  11337. });
  11338. onBeforeUnmount(() => {
  11339. rAFId && cAF(rAFId);
  11340. });
  11341. __expose({
  11342. input,
  11343. textarea,
  11344. ref: _ref,
  11345. textareaStyle,
  11346. autosize: toRef(props, "autosize"),
  11347. isComposing,
  11348. passwordVisible,
  11349. focus,
  11350. blur,
  11351. select,
  11352. clear,
  11353. resizeTextarea
  11354. });
  11355. return (_ctx, _cache) => {
  11356. return openBlock(), createElementBlock("div", {
  11357. class: normalizeClass([containerKls.value, {
  11358. [unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
  11359. [unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend
  11360. }]),
  11361. style: normalizeStyle(containerStyle.value),
  11362. onMouseenter: handleMouseEnter,
  11363. onMouseleave: handleMouseLeave
  11364. }, [createCommentVNode(" input "), __props.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  11365. createCommentVNode(" prepend slot "),
  11366. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  11367. key: 0,
  11368. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  11369. }, [renderSlot(_ctx.$slots, "prepend")], 2)) : createCommentVNode("v-if", true),
  11370. createElementVNode("div", {
  11371. ref_key: "wrapperRef",
  11372. ref: wrapperRef,
  11373. class: normalizeClass(wrapperKls.value)
  11374. }, [
  11375. createCommentVNode(" prefix slot "),
  11376. _ctx.$slots.prefix || __props.prefixIcon ? (openBlock(), createElementBlock("span", {
  11377. key: 0,
  11378. class: normalizeClass(unref(nsInput).e("prefix"))
  11379. }, [createElementVNode("span", { class: normalizeClass(unref(nsInput).e("prefix-inner")) }, [renderSlot(_ctx.$slots, "prefix"), __props.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  11380. key: 0,
  11381. class: normalizeClass(unref(nsInput).e("icon"))
  11382. }, {
  11383. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.prefixIcon)))]),
  11384. _: 1
  11385. }, 8, ["class"])) : createCommentVNode("v-if", true)], 2)], 2)) : createCommentVNode("v-if", true),
  11386. createElementVNode("input", mergeProps({
  11387. id: unref(inputId),
  11388. ref_key: "input",
  11389. ref: input,
  11390. class: unref(nsInput).e("inner")
  11391. }, unref(attrs), {
  11392. name: __props.name,
  11393. minlength: __props.countGraphemes ? void 0 : __props.minlength,
  11394. maxlength: __props.countGraphemes ? void 0 : maxlength.value,
  11395. type: __props.showPassword ? passwordVisible.value ? "text" : "password" : __props.type,
  11396. disabled: unref(inputDisabled),
  11397. readonly: __props.readonly,
  11398. autocomplete: __props.autocomplete,
  11399. tabindex: __props.tabindex,
  11400. "aria-label": __props.ariaLabel,
  11401. placeholder: __props.placeholder,
  11402. style: __props.inputStyle,
  11403. form: __props.form,
  11404. autofocus: __props.autofocus,
  11405. role: __props.containerRole,
  11406. inputmode: __props.inputmode,
  11407. onCompositionstart: _cache[0] || (_cache[0] = (...args) => unref(handleCompositionStart) && unref(handleCompositionStart)(...args)),
  11408. onCompositionupdate: _cache[1] || (_cache[1] = (...args) => unref(handleCompositionUpdate) && unref(handleCompositionUpdate)(...args)),
  11409. onCompositionend: _cache[2] || (_cache[2] = (...args) => unref(handleCompositionEnd) && unref(handleCompositionEnd)(...args)),
  11410. onInput: handleInput,
  11411. onChange: handleChange,
  11412. onKeydown: handleKeydown
  11413. }), null, 16, _hoisted_1$77),
  11414. createCommentVNode(" suffix slot "),
  11415. suffixVisible.value ? (openBlock(), createElementBlock("span", {
  11416. key: 1,
  11417. class: normalizeClass(unref(nsInput).e("suffix"))
  11418. }, [createElementVNode("span", { class: normalizeClass(unref(nsInput).e("suffix-inner")) }, [
  11419. renderClear.value ? (openBlock(), createBlock(unref(ElIcon), {
  11420. key: 0,
  11421. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  11422. style: normalizeStyle({ visibility: showClear.value ? "visible" : "hidden" }),
  11423. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  11424. onClick: clear
  11425. }, {
  11426. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.clearIcon)))]),
  11427. _: 1
  11428. }, 8, [
  11429. "class",
  11430. "style",
  11431. "onMousedown"
  11432. ])) : createCommentVNode("v-if", true),
  11433. !showClear.value || !showPwdVisible.value || !isWordLimitVisible.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [renderSlot(_ctx.$slots, "suffix"), __props.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  11434. key: 0,
  11435. class: normalizeClass(unref(nsInput).e("icon"))
  11436. }, {
  11437. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.suffixIcon)))]),
  11438. _: 1
  11439. }, 8, ["class"])) : createCommentVNode("v-if", true)], 64)) : createCommentVNode("v-if", true),
  11440. showPwdVisible.value ? (openBlock(), createBlock(unref(ElIcon), {
  11441. key: 2,
  11442. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  11443. onClick: handlePasswordVisible,
  11444. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  11445. onMouseup: withModifiers(unref(NOOP), ["prevent"])
  11446. }, {
  11447. default: withCtx(() => [renderSlot(_ctx.$slots, "password-icon", { visible: passwordVisible.value }, () => [(openBlock(), createBlock(resolveDynamicComponent(passwordIcon.value)))])]),
  11448. _: 3
  11449. }, 8, [
  11450. "class",
  11451. "onMousedown",
  11452. "onMouseup"
  11453. ])) : createCommentVNode("v-if", true),
  11454. isWordLimitVisible.value ? (openBlock(), createElementBlock("span", {
  11455. key: 3,
  11456. class: normalizeClass([unref(nsInput).e("count"), unref(nsInput).is("outside", __props.wordLimitPosition === "outside")])
  11457. }, [createElementVNode("span", { class: normalizeClass(unref(nsInput).e("count-inner")) }, toDisplayString(textLength.value) + " / " + toDisplayString(maxlength.value), 3)], 2)) : createCommentVNode("v-if", true),
  11458. validateState.value && validateIcon.value && needStatusIcon.value ? (openBlock(), createBlock(unref(ElIcon), {
  11459. key: 4,
  11460. class: normalizeClass([
  11461. unref(nsInput).e("icon"),
  11462. unref(nsInput).e("validateIcon"),
  11463. unref(nsInput).is("loading", validateState.value === "validating")
  11464. ])
  11465. }, {
  11466. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(validateIcon.value)))]),
  11467. _: 1
  11468. }, 8, ["class"])) : createCommentVNode("v-if", true)
  11469. ], 2)], 2)) : createCommentVNode("v-if", true)
  11470. ], 2),
  11471. createCommentVNode(" append slot "),
  11472. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  11473. key: 1,
  11474. class: normalizeClass(unref(nsInput).be("group", "append"))
  11475. }, [renderSlot(_ctx.$slots, "append")], 2)) : createCommentVNode("v-if", true)
  11476. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  11477. createCommentVNode(" textarea "),
  11478. createElementVNode("textarea", mergeProps({
  11479. id: unref(inputId),
  11480. ref_key: "textarea",
  11481. ref: textarea,
  11482. class: [
  11483. unref(nsTextarea).e("inner"),
  11484. unref(nsInput).is("focus", unref(isFocused)),
  11485. unref(nsTextarea).is("clearable", __props.clearable)
  11486. ]
  11487. }, unref(attrs), {
  11488. name: __props.name,
  11489. minlength: __props.countGraphemes ? void 0 : __props.minlength,
  11490. maxlength: __props.countGraphemes ? void 0 : maxlength.value,
  11491. tabindex: __props.tabindex,
  11492. disabled: unref(inputDisabled),
  11493. readonly: __props.readonly,
  11494. autocomplete: __props.autocomplete,
  11495. style: textareaStyle.value,
  11496. "aria-label": __props.ariaLabel,
  11497. placeholder: __props.placeholder,
  11498. form: __props.form,
  11499. autofocus: __props.autofocus,
  11500. rows: __props.rows,
  11501. role: __props.containerRole,
  11502. inputmode: __props.inputmode,
  11503. onCompositionstart: _cache[3] || (_cache[3] = (...args) => unref(handleCompositionStart) && unref(handleCompositionStart)(...args)),
  11504. onCompositionupdate: _cache[4] || (_cache[4] = (...args) => unref(handleCompositionUpdate) && unref(handleCompositionUpdate)(...args)),
  11505. onCompositionend: _cache[5] || (_cache[5] = (...args) => unref(handleCompositionEnd) && unref(handleCompositionEnd)(...args)),
  11506. onInput: handleInput,
  11507. onFocus: _cache[6] || (_cache[6] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
  11508. onBlur: _cache[7] || (_cache[7] = (...args) => unref(handleBlur) && unref(handleBlur)(...args)),
  11509. onChange: handleChange,
  11510. onKeydown: handleKeydown
  11511. }), null, 16, _hoisted_2$43),
  11512. showClear.value ? (openBlock(), createBlock(unref(ElIcon), {
  11513. key: 0,
  11514. class: normalizeClass([unref(nsTextarea).e("icon"), unref(nsTextarea).e("clear")]),
  11515. style: normalizeStyle(clearIconStyle.value),
  11516. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  11517. onClick: clear
  11518. }, {
  11519. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.clearIcon)))]),
  11520. _: 1
  11521. }, 8, [
  11522. "class",
  11523. "style",
  11524. "onMousedown"
  11525. ])) : createCommentVNode("v-if", true),
  11526. isWordLimitVisible.value ? (openBlock(), createElementBlock("span", {
  11527. key: 1,
  11528. style: normalizeStyle(countStyle.value),
  11529. class: normalizeClass([unref(nsInput).e("count"), unref(nsInput).is("outside", __props.wordLimitPosition === "outside")])
  11530. }, toDisplayString(textLength.value) + " / " + toDisplayString(maxlength.value), 7)) : createCommentVNode("v-if", true)
  11531. ], 64))], 38);
  11532. };
  11533. }
  11534. });
  11535. //#endregion
  11536. //#region ../../packages/components/input/src/input.vue
  11537. var input_default = input_vue_vue_type_script_setup_true_lang_default;
  11538. //#endregion
  11539. //#region ../../packages/components/input/index.ts
  11540. const ElInput = withInstall(input_default);
  11541. //#endregion
  11542. //#region ../../packages/components/autocomplete/src/autocomplete.ts
  11543. const autocompleteProps = buildProps({
  11544. ...inputProps,
  11545. valueKey: {
  11546. type: String,
  11547. default: "value"
  11548. },
  11549. modelValue: {
  11550. type: [String, Number],
  11551. default: ""
  11552. },
  11553. debounce: {
  11554. type: Number,
  11555. default: 300
  11556. },
  11557. placement: {
  11558. type: definePropType(String),
  11559. values: [
  11560. "top",
  11561. "top-start",
  11562. "top-end",
  11563. "bottom",
  11564. "bottom-start",
  11565. "bottom-end"
  11566. ],
  11567. default: "bottom-start"
  11568. },
  11569. fetchSuggestions: {
  11570. type: definePropType([Function, Array]),
  11571. default: NOOP
  11572. },
  11573. popperClass: useTooltipContentProps.popperClass,
  11574. popperStyle: useTooltipContentProps.popperStyle,
  11575. popperOptions: useTooltipContentProps.popperOptions,
  11576. showArrow: {
  11577. type: Boolean,
  11578. default: true
  11579. },
  11580. triggerOnFocus: {
  11581. type: Boolean,
  11582. default: true
  11583. },
  11584. selectWhenUnmatched: Boolean,
  11585. hideLoading: Boolean,
  11586. teleported: useTooltipContentProps.teleported,
  11587. appendTo: useTooltipContentProps.appendTo,
  11588. highlightFirstItem: Boolean,
  11589. fitInputWidth: Boolean,
  11590. loopNavigation: {
  11591. type: Boolean,
  11592. default: true
  11593. }
  11594. });
  11595. const autocompleteEmits = {
  11596. [UPDATE_MODEL_EVENT]: (value) => isString(value) || isNumber(value),
  11597. [INPUT_EVENT]: (value) => isString(value) || isNumber(value),
  11598. [CHANGE_EVENT]: (value) => isString(value) || isNumber(value),
  11599. focus: (evt) => evt instanceof FocusEvent,
  11600. blur: (evt) => evt instanceof FocusEvent,
  11601. clear: () => true,
  11602. select: (item) => isObject$1(item)
  11603. };
  11604. //#endregion
  11605. //#region ../../packages/components/scrollbar/src/scrollbar.ts
  11606. const scrollbarProps = buildProps({
  11607. distance: {
  11608. type: Number,
  11609. default: 0
  11610. },
  11611. height: {
  11612. type: [String, Number],
  11613. default: ""
  11614. },
  11615. maxHeight: {
  11616. type: [String, Number],
  11617. default: ""
  11618. },
  11619. native: Boolean,
  11620. wrapStyle: {
  11621. type: definePropType([
  11622. String,
  11623. Object,
  11624. Array,
  11625. Boolean
  11626. ]),
  11627. default: ""
  11628. },
  11629. wrapClass: {
  11630. type: [String, Array],
  11631. default: ""
  11632. },
  11633. viewClass: {
  11634. type: [String, Array],
  11635. default: ""
  11636. },
  11637. viewStyle: {
  11638. type: definePropType([
  11639. String,
  11640. Object,
  11641. Array,
  11642. Boolean
  11643. ]),
  11644. default: ""
  11645. },
  11646. noresize: Boolean,
  11647. tag: {
  11648. type: String,
  11649. default: "div"
  11650. },
  11651. always: Boolean,
  11652. minSize: {
  11653. type: Number,
  11654. default: 20
  11655. },
  11656. tabindex: {
  11657. type: [String, Number],
  11658. default: void 0
  11659. },
  11660. id: String,
  11661. role: String,
  11662. ...useAriaProps(["ariaLabel", "ariaOrientation"])
  11663. });
  11664. const scrollbarEmits = {
  11665. "end-reached": (direction) => [
  11666. "left",
  11667. "right",
  11668. "top",
  11669. "bottom"
  11670. ].includes(direction),
  11671. scroll: ({ scrollTop, scrollLeft }) => [scrollTop, scrollLeft].every(isNumber)
  11672. };
  11673. //#endregion
  11674. //#region ../../packages/components/scrollbar/src/bar.ts
  11675. const barProps = buildProps({
  11676. always: {
  11677. type: Boolean,
  11678. default: true
  11679. },
  11680. minSize: {
  11681. type: Number,
  11682. required: true
  11683. }
  11684. });
  11685. //#endregion
  11686. //#region ../../packages/components/scrollbar/src/util.ts
  11687. const GAP = 4;
  11688. const BAR_MAP = {
  11689. vertical: {
  11690. offset: "offsetHeight",
  11691. scroll: "scrollTop",
  11692. scrollSize: "scrollHeight",
  11693. size: "height",
  11694. key: "vertical",
  11695. axis: "Y",
  11696. client: "clientY",
  11697. direction: "top"
  11698. },
  11699. horizontal: {
  11700. offset: "offsetWidth",
  11701. scroll: "scrollLeft",
  11702. scrollSize: "scrollWidth",
  11703. size: "width",
  11704. key: "horizontal",
  11705. axis: "X",
  11706. client: "clientX",
  11707. direction: "left"
  11708. }
  11709. };
  11710. const renderThumbStyle = ({ move, size, bar }) => ({
  11711. [bar.size]: size,
  11712. transform: `translate${bar.axis}(${move}%)`
  11713. });
  11714. //#endregion
  11715. //#region ../../packages/components/scrollbar/src/thumb.ts
  11716. const thumbProps = buildProps({
  11717. vertical: Boolean,
  11718. size: String,
  11719. move: Number,
  11720. ratio: {
  11721. type: Number,
  11722. required: true
  11723. },
  11724. always: Boolean
  11725. });
  11726. //#endregion
  11727. //#region ../../packages/components/scrollbar/src/constants.ts
  11728. const scrollbarContextKey = Symbol("scrollbarContextKey");
  11729. //#endregion
  11730. //#region ../../packages/components/scrollbar/src/thumb.vue?vue&type=script&setup=true&lang.ts
  11731. const COMPONENT_NAME$18 = "Thumb";
  11732. var thumb_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11733. __name: "thumb",
  11734. props: thumbProps,
  11735. setup(__props) {
  11736. const props = __props;
  11737. const scrollbar = inject(scrollbarContextKey);
  11738. const ns = useNamespace("scrollbar");
  11739. if (!scrollbar) throwError(COMPONENT_NAME$18, "can not inject scrollbar context");
  11740. const instance = ref();
  11741. const thumb = ref();
  11742. const thumbState = ref({});
  11743. const visible = ref(false);
  11744. let cursorDown = false;
  11745. let cursorLeave = false;
  11746. let baseScrollHeight = 0;
  11747. let baseScrollWidth = 0;
  11748. let originalOnSelectStart = isClient ? document.onselectstart : null;
  11749. const bar = computed(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  11750. const thumbStyle = computed(() => renderThumbStyle({
  11751. size: props.size,
  11752. move: props.move,
  11753. bar: bar.value
  11754. }));
  11755. const offsetRatio = computed(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  11756. const clickThumbHandler = (e) => {
  11757. e.stopPropagation();
  11758. if (e.ctrlKey || [1, 2].includes(e.button)) return;
  11759. window.getSelection()?.removeAllRanges();
  11760. startDrag(e);
  11761. const el = e.currentTarget;
  11762. if (!el) return;
  11763. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  11764. };
  11765. const clickTrackHandler = (e) => {
  11766. if (!thumb.value || !instance.value || !scrollbar.wrapElement) return;
  11767. const thumbPositionPercentage = (Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) - thumb.value[bar.value.offset] / 2) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  11768. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  11769. };
  11770. const startDrag = (e) => {
  11771. e.stopImmediatePropagation();
  11772. cursorDown = true;
  11773. baseScrollHeight = scrollbar.wrapElement.scrollHeight;
  11774. baseScrollWidth = scrollbar.wrapElement.scrollWidth;
  11775. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  11776. document.addEventListener("mouseup", mouseUpDocumentHandler);
  11777. originalOnSelectStart = document.onselectstart;
  11778. document.onselectstart = () => false;
  11779. };
  11780. const mouseMoveDocumentHandler = (e) => {
  11781. if (!instance.value || !thumb.value) return;
  11782. if (cursorDown === false) return;
  11783. const prevPage = thumbState.value[bar.value.axis];
  11784. if (!prevPage) return;
  11785. const thumbPositionPercentage = ((instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1 - (thumb.value[bar.value.offset] - prevPage)) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  11786. if (bar.value.scroll === "scrollLeft") scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * baseScrollWidth / 100;
  11787. else scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * baseScrollHeight / 100;
  11788. };
  11789. const mouseUpDocumentHandler = () => {
  11790. cursorDown = false;
  11791. thumbState.value[bar.value.axis] = 0;
  11792. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  11793. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  11794. restoreOnselectstart();
  11795. if (cursorLeave) visible.value = false;
  11796. };
  11797. const mouseMoveScrollbarHandler = () => {
  11798. cursorLeave = false;
  11799. visible.value = !!props.size;
  11800. };
  11801. const mouseLeaveScrollbarHandler = () => {
  11802. cursorLeave = true;
  11803. visible.value = cursorDown;
  11804. };
  11805. onBeforeUnmount(() => {
  11806. restoreOnselectstart();
  11807. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  11808. });
  11809. const restoreOnselectstart = () => {
  11810. if (document.onselectstart !== originalOnSelectStart) document.onselectstart = originalOnSelectStart;
  11811. };
  11812. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  11813. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  11814. return (_ctx, _cache) => {
  11815. return openBlock(), createBlock(Transition, {
  11816. name: unref(ns).b("fade"),
  11817. persisted: ""
  11818. }, {
  11819. default: withCtx(() => [withDirectives(createElementVNode("div", {
  11820. ref_key: "instance",
  11821. ref: instance,
  11822. class: normalizeClass([unref(ns).e("bar"), unref(ns).is(bar.value.key)]),
  11823. onMousedown: clickTrackHandler,
  11824. onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
  11825. }, [createElementVNode("div", {
  11826. ref_key: "thumb",
  11827. ref: thumb,
  11828. class: normalizeClass(unref(ns).e("thumb")),
  11829. style: normalizeStyle(thumbStyle.value),
  11830. onMousedown: clickThumbHandler
  11831. }, null, 38)], 34), [[vShow, __props.always || visible.value]])]),
  11832. _: 1
  11833. }, 8, ["name"]);
  11834. };
  11835. }
  11836. });
  11837. //#endregion
  11838. //#region ../../packages/components/scrollbar/src/thumb.vue
  11839. var thumb_default = thumb_vue_vue_type_script_setup_true_lang_default;
  11840. //#endregion
  11841. //#region ../../packages/components/scrollbar/src/bar.vue?vue&type=script&setup=true&lang.ts
  11842. var bar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11843. __name: "bar",
  11844. props: barProps,
  11845. setup(__props, { expose: __expose }) {
  11846. const props = __props;
  11847. const scrollbar = inject(scrollbarContextKey);
  11848. const moveX = ref(0);
  11849. const moveY = ref(0);
  11850. const sizeWidth = ref("");
  11851. const sizeHeight = ref("");
  11852. const ratioY = ref(1);
  11853. const ratioX = ref(1);
  11854. const handleScroll = (wrap) => {
  11855. if (wrap) {
  11856. const offsetHeight = wrap.offsetHeight - 4;
  11857. const offsetWidth = wrap.offsetWidth - 4;
  11858. moveY.value = wrap.scrollTop * 100 / offsetHeight * ratioY.value;
  11859. moveX.value = wrap.scrollLeft * 100 / offsetWidth * ratioX.value;
  11860. }
  11861. };
  11862. const update = () => {
  11863. const wrap = scrollbar?.wrapElement;
  11864. if (!wrap) return;
  11865. const offsetHeight = wrap.offsetHeight - 4;
  11866. const offsetWidth = wrap.offsetWidth - 4;
  11867. const originalHeight = offsetHeight ** 2 / wrap.scrollHeight;
  11868. const originalWidth = offsetWidth ** 2 / wrap.scrollWidth;
  11869. const height = Math.max(originalHeight, props.minSize);
  11870. const width = Math.max(originalWidth, props.minSize);
  11871. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height / (offsetHeight - height));
  11872. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width / (offsetWidth - width));
  11873. sizeHeight.value = height + 4 < offsetHeight ? `${height}px` : "";
  11874. sizeWidth.value = width + 4 < offsetWidth ? `${width}px` : "";
  11875. };
  11876. __expose({
  11877. handleScroll,
  11878. update
  11879. });
  11880. return (_ctx, _cache) => {
  11881. return openBlock(), createElementBlock(Fragment, null, [createVNode(thumb_default, {
  11882. move: moveX.value,
  11883. ratio: ratioX.value,
  11884. size: sizeWidth.value,
  11885. always: __props.always
  11886. }, null, 8, [
  11887. "move",
  11888. "ratio",
  11889. "size",
  11890. "always"
  11891. ]), createVNode(thumb_default, {
  11892. move: moveY.value,
  11893. ratio: ratioY.value,
  11894. size: sizeHeight.value,
  11895. vertical: "",
  11896. always: __props.always
  11897. }, null, 8, [
  11898. "move",
  11899. "ratio",
  11900. "size",
  11901. "always"
  11902. ])], 64);
  11903. };
  11904. }
  11905. });
  11906. //#endregion
  11907. //#region ../../packages/components/scrollbar/src/bar.vue
  11908. var bar_default = bar_vue_vue_type_script_setup_true_lang_default;
  11909. //#endregion
  11910. //#region ../../packages/components/scrollbar/src/scrollbar.vue?vue&type=script&setup=true&lang.ts
  11911. const _hoisted_1$76 = ["tabindex"];
  11912. const COMPONENT_NAME$17 = "ElScrollbar";
  11913. var scrollbar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  11914. name: COMPONENT_NAME$17,
  11915. __name: "scrollbar",
  11916. props: scrollbarProps,
  11917. emits: scrollbarEmits,
  11918. setup(__props, { expose: __expose, emit: __emit }) {
  11919. const props = __props;
  11920. const emit = __emit;
  11921. const ns = useNamespace("scrollbar");
  11922. let stopResizeObserver = void 0;
  11923. let stopWrapResizeObserver = void 0;
  11924. let stopResizeListener = void 0;
  11925. let wrapScrollTop = 0;
  11926. let wrapScrollLeft = 0;
  11927. let direction = "";
  11928. const distanceScrollState = {
  11929. bottom: false,
  11930. top: false,
  11931. right: false,
  11932. left: false
  11933. };
  11934. const scrollbarRef = ref();
  11935. const wrapRef = ref();
  11936. const resizeRef = ref();
  11937. const barRef = ref();
  11938. const wrapStyle = computed(() => {
  11939. const style = {};
  11940. const height = addUnit(props.height);
  11941. const maxHeight = addUnit(props.maxHeight);
  11942. if (height) style.height = height;
  11943. if (maxHeight) style.maxHeight = maxHeight;
  11944. return [props.wrapStyle, style];
  11945. });
  11946. const wrapKls = computed(() => {
  11947. return [
  11948. props.wrapClass,
  11949. ns.e("wrap"),
  11950. { [ns.em("wrap", "hidden-default")]: !props.native }
  11951. ];
  11952. });
  11953. const resizeKls = computed(() => {
  11954. return [ns.e("view"), props.viewClass];
  11955. });
  11956. const shouldSkipDirection = (direction) => {
  11957. return distanceScrollState[direction] ?? false;
  11958. };
  11959. const DIRECTION_PAIRS = {
  11960. top: "bottom",
  11961. bottom: "top",
  11962. left: "right",
  11963. right: "left"
  11964. };
  11965. const updateTriggerStatus = (arrivedStates) => {
  11966. const oppositeDirection = DIRECTION_PAIRS[direction];
  11967. if (!oppositeDirection) return;
  11968. const arrived = arrivedStates[direction];
  11969. const oppositeArrived = arrivedStates[oppositeDirection];
  11970. if (arrived && !distanceScrollState[direction]) distanceScrollState[direction] = true;
  11971. if (!oppositeArrived && distanceScrollState[oppositeDirection]) distanceScrollState[oppositeDirection] = false;
  11972. };
  11973. const handleScroll = () => {
  11974. if (wrapRef.value) {
  11975. barRef.value?.handleScroll(wrapRef.value);
  11976. const prevTop = wrapScrollTop;
  11977. const prevLeft = wrapScrollLeft;
  11978. wrapScrollTop = wrapRef.value.scrollTop;
  11979. wrapScrollLeft = wrapRef.value.scrollLeft;
  11980. const arrivedStates = {
  11981. bottom: !isGreaterThan(wrapRef.value.scrollHeight - props.distance, wrapRef.value.clientHeight + wrapScrollTop),
  11982. top: wrapScrollTop <= props.distance && prevTop !== 0,
  11983. right: !isGreaterThan(wrapRef.value.scrollWidth - props.distance, wrapRef.value.clientWidth + wrapScrollLeft) && prevLeft !== wrapScrollLeft,
  11984. left: wrapScrollLeft <= props.distance && prevLeft !== 0
  11985. };
  11986. emit("scroll", {
  11987. scrollTop: wrapScrollTop,
  11988. scrollLeft: wrapScrollLeft
  11989. });
  11990. if (prevTop !== wrapScrollTop) direction = wrapScrollTop > prevTop ? "bottom" : "top";
  11991. if (prevLeft !== wrapScrollLeft) direction = wrapScrollLeft > prevLeft ? "right" : "left";
  11992. if (props.distance > 0) {
  11993. if (shouldSkipDirection(direction)) return;
  11994. updateTriggerStatus(arrivedStates);
  11995. }
  11996. if (arrivedStates[direction]) emit("end-reached", direction);
  11997. }
  11998. };
  11999. function scrollTo(arg1, arg2) {
  12000. if (isObject$1(arg1)) wrapRef.value.scrollTo(arg1);
  12001. else if (isNumber(arg1) && isNumber(arg2)) wrapRef.value.scrollTo(arg1, arg2);
  12002. }
  12003. const setScrollTop = (value) => {
  12004. if (!isNumber(value)) {
  12005. /* @__PURE__ */ debugWarn(COMPONENT_NAME$17, "value must be a number");
  12006. return;
  12007. }
  12008. wrapRef.value.scrollTop = value;
  12009. };
  12010. const setScrollLeft = (value) => {
  12011. if (!isNumber(value)) {
  12012. /* @__PURE__ */ debugWarn(COMPONENT_NAME$17, "value must be a number");
  12013. return;
  12014. }
  12015. wrapRef.value.scrollLeft = value;
  12016. };
  12017. const update = () => {
  12018. barRef.value?.update();
  12019. distanceScrollState[direction] = false;
  12020. if (wrapRef.value) barRef.value?.handleScroll(wrapRef.value);
  12021. };
  12022. watch(() => props.noresize, (noresize) => {
  12023. if (noresize) {
  12024. stopResizeObserver?.();
  12025. stopWrapResizeObserver?.();
  12026. stopResizeListener?.();
  12027. } else {
  12028. ({stop: stopResizeObserver} = useResizeObserver(resizeRef, update));
  12029. ({stop: stopWrapResizeObserver} = useResizeObserver(wrapRef, update));
  12030. stopResizeListener = useEventListener("resize", update);
  12031. }
  12032. }, { immediate: true });
  12033. watch(() => [props.maxHeight, props.height], () => {
  12034. if (!props.native) nextTick(() => {
  12035. update();
  12036. });
  12037. });
  12038. provide(scrollbarContextKey, reactive({
  12039. scrollbarElement: scrollbarRef,
  12040. wrapElement: wrapRef
  12041. }));
  12042. onActivated(() => {
  12043. if (wrapRef.value) {
  12044. wrapRef.value.scrollTop = wrapScrollTop;
  12045. wrapRef.value.scrollLeft = wrapScrollLeft;
  12046. }
  12047. });
  12048. onMounted(() => {
  12049. if (!props.native) nextTick(() => {
  12050. update();
  12051. });
  12052. });
  12053. onUpdated(() => update());
  12054. __expose({
  12055. wrapRef,
  12056. update,
  12057. scrollTo,
  12058. setScrollTop,
  12059. setScrollLeft,
  12060. handleScroll
  12061. });
  12062. return (_ctx, _cache) => {
  12063. return openBlock(), createElementBlock("div", {
  12064. ref_key: "scrollbarRef",
  12065. ref: scrollbarRef,
  12066. class: normalizeClass(unref(ns).b())
  12067. }, [createElementVNode("div", {
  12068. ref_key: "wrapRef",
  12069. ref: wrapRef,
  12070. class: normalizeClass(wrapKls.value),
  12071. style: normalizeStyle(wrapStyle.value),
  12072. tabindex: __props.tabindex,
  12073. onScroll: handleScroll
  12074. }, [(openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
  12075. id: __props.id,
  12076. ref_key: "resizeRef",
  12077. ref: resizeRef,
  12078. class: normalizeClass(resizeKls.value),
  12079. style: normalizeStyle(__props.viewStyle),
  12080. role: __props.role,
  12081. "aria-label": __props.ariaLabel,
  12082. "aria-orientation": __props.ariaOrientation
  12083. }, {
  12084. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  12085. _: 3
  12086. }, 8, [
  12087. "id",
  12088. "class",
  12089. "style",
  12090. "role",
  12091. "aria-label",
  12092. "aria-orientation"
  12093. ]))], 46, _hoisted_1$76), !__props.native ? (openBlock(), createBlock(bar_default, {
  12094. key: 0,
  12095. ref_key: "barRef",
  12096. ref: barRef,
  12097. always: __props.always,
  12098. "min-size": __props.minSize
  12099. }, null, 8, ["always", "min-size"])) : createCommentVNode("v-if", true)], 2);
  12100. };
  12101. }
  12102. });
  12103. //#endregion
  12104. //#region ../../packages/components/scrollbar/src/scrollbar.vue
  12105. var scrollbar_default = scrollbar_vue_vue_type_script_setup_true_lang_default;
  12106. //#endregion
  12107. //#region ../../packages/components/scrollbar/index.ts
  12108. const ElScrollbar = withInstall(scrollbar_default);
  12109. //#endregion
  12110. //#region ../../packages/components/autocomplete/src/autocomplete.vue?vue&type=script&setup=true&lang.ts
  12111. const _hoisted_1$75 = ["aria-expanded", "aria-owns"];
  12112. const _hoisted_2$42 = { key: 0 };
  12113. const _hoisted_3$19 = [
  12114. "id",
  12115. "aria-selected",
  12116. "onClick"
  12117. ];
  12118. const COMPONENT_NAME$16 = "ElAutocomplete";
  12119. var autocomplete_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12120. name: COMPONENT_NAME$16,
  12121. inheritAttrs: false,
  12122. __name: "autocomplete",
  12123. props: autocompleteProps,
  12124. emits: autocompleteEmits,
  12125. setup(__props, { expose: __expose, emit: __emit }) {
  12126. const props = __props;
  12127. const emit = __emit;
  12128. const passInputProps = computed(() => {
  12129. const inputProps = ElInput.props ?? [];
  12130. return pick(props, isArray$1(inputProps) ? inputProps : Object.keys(inputProps));
  12131. });
  12132. const rawAttrs = useAttrs$1();
  12133. const disabled = useFormDisabled();
  12134. const ns = useNamespace("autocomplete");
  12135. const inputRef = ref();
  12136. const regionRef = ref();
  12137. const popperRef = ref();
  12138. const listboxRef = ref();
  12139. let readonly = false;
  12140. let ignoreFocusEvent = false;
  12141. const suggestions = ref([]);
  12142. const highlightedIndex = ref(-1);
  12143. const dropdownWidth = ref("");
  12144. const activated = ref(false);
  12145. const suggestionDisabled = ref(false);
  12146. const loading = ref(false);
  12147. const listboxId = useId();
  12148. const styles = computed(() => rawAttrs.style);
  12149. const suggestionVisible = computed(() => {
  12150. return (suggestions.value.length > 0 || loading.value) && activated.value;
  12151. });
  12152. const suggestionLoading = computed(() => !props.hideLoading && loading.value);
  12153. const refInput = computed(() => {
  12154. if (inputRef.value) return Array.from(inputRef.value.$el.querySelectorAll("input"));
  12155. return [];
  12156. });
  12157. const onSuggestionShow = () => {
  12158. if (suggestionVisible.value) dropdownWidth.value = `${inputRef.value.$el.offsetWidth}px`;
  12159. };
  12160. const onHide = () => {
  12161. highlightedIndex.value = -1;
  12162. };
  12163. const getData = async (queryString) => {
  12164. if (suggestionDisabled.value) return;
  12165. const cb = (suggestionList) => {
  12166. loading.value = false;
  12167. if (suggestionDisabled.value) return;
  12168. if (isArray$1(suggestionList)) {
  12169. suggestions.value = suggestionList;
  12170. highlightedIndex.value = props.highlightFirstItem ? 0 : -1;
  12171. } else throwError(COMPONENT_NAME$16, "autocomplete suggestions must be an array");
  12172. };
  12173. loading.value = true;
  12174. if (isArray$1(props.fetchSuggestions)) cb(props.fetchSuggestions);
  12175. else {
  12176. const result = await props.fetchSuggestions(queryString, cb);
  12177. if (isArray$1(result)) cb(result);
  12178. }
  12179. };
  12180. const debouncedGetData = useDebounceFn(getData, computed(() => props.debounce));
  12181. const handleInput = (value) => {
  12182. const valuePresented = !!value;
  12183. emit(INPUT_EVENT, value);
  12184. emit(UPDATE_MODEL_EVENT, value);
  12185. suggestionDisabled.value = false;
  12186. activated.value ||= valuePresented;
  12187. if (!props.triggerOnFocus && !value) {
  12188. suggestionDisabled.value = true;
  12189. suggestions.value = [];
  12190. return;
  12191. }
  12192. debouncedGetData(value);
  12193. };
  12194. const handleMouseDown = (event) => {
  12195. if (disabled.value) return;
  12196. if (event.target?.tagName !== "INPUT" || refInput.value.includes(document.activeElement)) activated.value = true;
  12197. };
  12198. const handleChange = (value) => {
  12199. emit(CHANGE_EVENT, value);
  12200. };
  12201. const handleFocus = (evt) => {
  12202. if (!ignoreFocusEvent) {
  12203. activated.value = true;
  12204. emit("focus", evt);
  12205. const queryString = props.modelValue ?? "";
  12206. if (props.triggerOnFocus && !readonly) debouncedGetData(String(queryString));
  12207. } else ignoreFocusEvent = false;
  12208. };
  12209. const handleBlur = (evt) => {
  12210. setTimeout(() => {
  12211. if (popperRef.value?.isFocusInsideContent()) {
  12212. ignoreFocusEvent = true;
  12213. return;
  12214. }
  12215. activated.value && close();
  12216. emit("blur", evt);
  12217. });
  12218. };
  12219. const handleClear = () => {
  12220. activated.value = false;
  12221. emit(UPDATE_MODEL_EVENT, "");
  12222. emit("clear");
  12223. };
  12224. const handleKeyEnter = async () => {
  12225. if (inputRef.value?.isComposing) return;
  12226. if (suggestionVisible.value && highlightedIndex.value >= 0 && highlightedIndex.value < suggestions.value.length) handleSelect(suggestions.value[highlightedIndex.value]);
  12227. else {
  12228. if (props.selectWhenUnmatched) {
  12229. emit("select", { value: props.modelValue });
  12230. suggestions.value = [];
  12231. highlightedIndex.value = -1;
  12232. }
  12233. activated.value = true;
  12234. debouncedGetData(String(props.modelValue));
  12235. }
  12236. };
  12237. const handleKeyEscape = (evt) => {
  12238. if (suggestionVisible.value) {
  12239. evt.preventDefault();
  12240. evt.stopPropagation();
  12241. close();
  12242. }
  12243. };
  12244. const close = () => {
  12245. activated.value = false;
  12246. };
  12247. const focus = () => {
  12248. inputRef.value?.focus();
  12249. };
  12250. const blur = () => {
  12251. inputRef.value?.blur();
  12252. };
  12253. const handleSelect = async (item) => {
  12254. emit(INPUT_EVENT, item[props.valueKey]);
  12255. emit(UPDATE_MODEL_EVENT, item[props.valueKey]);
  12256. emit("select", item);
  12257. suggestions.value = [];
  12258. highlightedIndex.value = -1;
  12259. };
  12260. const highlight = (index) => {
  12261. if (!suggestionVisible.value || loading.value) return;
  12262. if (index < 0) {
  12263. if (!props.loopNavigation) {
  12264. highlightedIndex.value = -1;
  12265. return;
  12266. }
  12267. index = suggestions.value.length - 1;
  12268. }
  12269. if (index >= suggestions.value.length) index = props.loopNavigation ? 0 : suggestions.value.length - 1;
  12270. const [suggestion, suggestionList] = getSuggestionContext();
  12271. const highlightItem = suggestionList[index];
  12272. const scrollTop = suggestion.scrollTop;
  12273. const { offsetTop, scrollHeight } = highlightItem;
  12274. if (offsetTop + scrollHeight > scrollTop + suggestion.clientHeight) suggestion.scrollTop = offsetTop + scrollHeight - suggestion.clientHeight;
  12275. if (offsetTop < scrollTop) suggestion.scrollTop = offsetTop;
  12276. highlightedIndex.value = index;
  12277. inputRef.value?.ref?.setAttribute("aria-activedescendant", `${listboxId.value}-item-${highlightedIndex.value}`);
  12278. };
  12279. const getSuggestionContext = () => {
  12280. const suggestion = regionRef.value.querySelector(`.${ns.be("suggestion", "wrap")}`);
  12281. return [suggestion, suggestion.querySelectorAll(`.${ns.be("suggestion", "list")} li`)];
  12282. };
  12283. const stopHandle = onClickOutside(listboxRef, (event) => {
  12284. if (popperRef.value?.isFocusInsideContent()) return;
  12285. const hadIgnoredFocus = ignoreFocusEvent;
  12286. ignoreFocusEvent = false;
  12287. if (!suggestionVisible.value) return;
  12288. if (hadIgnoredFocus) handleBlur(new FocusEvent("blur", event));
  12289. else close();
  12290. });
  12291. const handleKeydown = (e) => {
  12292. switch (getEventCode(e)) {
  12293. case EVENT_CODE.up:
  12294. e.preventDefault();
  12295. highlight(highlightedIndex.value - 1);
  12296. break;
  12297. case EVENT_CODE.down:
  12298. e.preventDefault();
  12299. highlight(highlightedIndex.value + 1);
  12300. break;
  12301. case EVENT_CODE.enter:
  12302. case EVENT_CODE.numpadEnter:
  12303. e.preventDefault();
  12304. handleKeyEnter();
  12305. break;
  12306. case EVENT_CODE.tab:
  12307. close();
  12308. break;
  12309. case EVENT_CODE.esc:
  12310. handleKeyEscape(e);
  12311. break;
  12312. case EVENT_CODE.home:
  12313. e.preventDefault();
  12314. highlight(0);
  12315. break;
  12316. case EVENT_CODE.end:
  12317. e.preventDefault();
  12318. highlight(suggestions.value.length - 1);
  12319. break;
  12320. case EVENT_CODE.pageUp:
  12321. e.preventDefault();
  12322. highlight(Math.max(0, highlightedIndex.value - 10));
  12323. break;
  12324. case EVENT_CODE.pageDown:
  12325. e.preventDefault();
  12326. highlight(Math.min(suggestions.value.length - 1, highlightedIndex.value + 10));
  12327. break;
  12328. }
  12329. };
  12330. onBeforeUnmount(() => {
  12331. stopHandle?.();
  12332. });
  12333. onMounted(() => {
  12334. const inputElement = inputRef.value?.ref;
  12335. if (!inputElement) return;
  12336. [
  12337. {
  12338. key: "role",
  12339. value: "textbox"
  12340. },
  12341. {
  12342. key: "aria-autocomplete",
  12343. value: "list"
  12344. },
  12345. {
  12346. key: "aria-controls",
  12347. value: listboxId.value
  12348. },
  12349. {
  12350. key: "aria-activedescendant",
  12351. value: `${listboxId.value}-item-${highlightedIndex.value}`
  12352. }
  12353. ].forEach(({ key, value }) => inputElement.setAttribute(key, value));
  12354. readonly = inputElement.hasAttribute("readonly");
  12355. });
  12356. __expose({
  12357. highlightedIndex,
  12358. activated,
  12359. loading,
  12360. inputRef,
  12361. popperRef,
  12362. suggestions,
  12363. handleSelect,
  12364. handleKeyEnter,
  12365. focus,
  12366. blur,
  12367. close,
  12368. highlight,
  12369. getData
  12370. });
  12371. return (_ctx, _cache) => {
  12372. return openBlock(), createBlock(unref(ElTooltip), {
  12373. ref_key: "popperRef",
  12374. ref: popperRef,
  12375. visible: suggestionVisible.value,
  12376. placement: __props.placement,
  12377. "fallback-placements": ["bottom-start", "top-start"],
  12378. "popper-class": [unref(ns).e("popper"), __props.popperClass],
  12379. "popper-style": __props.popperStyle,
  12380. "popper-options": __props.popperOptions,
  12381. "show-arrow": __props.showArrow,
  12382. teleported: __props.teleported,
  12383. "append-to": __props.appendTo,
  12384. "gpu-acceleration": false,
  12385. pure: "",
  12386. "manual-mode": "",
  12387. effect: "light",
  12388. trigger: "click",
  12389. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  12390. persistent: "",
  12391. role: "listbox",
  12392. onBeforeShow: onSuggestionShow,
  12393. onHide
  12394. }, {
  12395. content: withCtx(() => [createElementVNode("div", {
  12396. ref_key: "regionRef",
  12397. ref: regionRef,
  12398. class: normalizeClass([unref(ns).b("suggestion"), unref(ns).is("loading", suggestionLoading.value)]),
  12399. style: normalizeStyle({
  12400. [__props.fitInputWidth ? "width" : "minWidth"]: dropdownWidth.value,
  12401. outline: "none"
  12402. }),
  12403. role: "region"
  12404. }, [
  12405. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  12406. key: 0,
  12407. class: normalizeClass(unref(ns).be("suggestion", "header")),
  12408. onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
  12409. }, [renderSlot(_ctx.$slots, "header")], 2)) : createCommentVNode("v-if", true),
  12410. createVNode(unref(ElScrollbar), {
  12411. id: unref(listboxId),
  12412. tag: "ul",
  12413. "wrap-class": unref(ns).be("suggestion", "wrap"),
  12414. "view-class": unref(ns).be("suggestion", "list"),
  12415. role: "listbox"
  12416. }, {
  12417. default: withCtx(() => [suggestionLoading.value ? (openBlock(), createElementBlock("li", _hoisted_2$42, [renderSlot(_ctx.$slots, "loading", {}, () => [createVNode(unref(ElIcon), { class: normalizeClass(unref(ns).is("loading")) }, {
  12418. default: withCtx(() => [createVNode(unref(loading_default))]),
  12419. _: 1
  12420. }, 8, ["class"])])])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(suggestions.value, (item, index) => {
  12421. return openBlock(), createElementBlock("li", {
  12422. id: `${unref(listboxId)}-item-${index}`,
  12423. key: index,
  12424. class: normalizeClass({ highlighted: highlightedIndex.value === index }),
  12425. role: "option",
  12426. "aria-selected": highlightedIndex.value === index,
  12427. onClick: ($event) => handleSelect(item)
  12428. }, [renderSlot(_ctx.$slots, "default", { item }, () => [createTextVNode(toDisplayString(item[__props.valueKey]), 1)])], 10, _hoisted_3$19);
  12429. }), 128))]),
  12430. _: 3
  12431. }, 8, [
  12432. "id",
  12433. "wrap-class",
  12434. "view-class"
  12435. ]),
  12436. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  12437. key: 1,
  12438. class: normalizeClass(unref(ns).be("suggestion", "footer")),
  12439. onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
  12440. }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true)
  12441. ], 6)]),
  12442. default: withCtx(() => [createElementVNode("div", {
  12443. ref_key: "listboxRef",
  12444. ref: listboxRef,
  12445. class: normalizeClass([unref(ns).b(), _ctx.$attrs.class]),
  12446. style: normalizeStyle(styles.value),
  12447. role: "combobox",
  12448. "aria-haspopup": "listbox",
  12449. "aria-expanded": suggestionVisible.value,
  12450. "aria-owns": unref(listboxId)
  12451. }, [createVNode(unref(ElInput), mergeProps({
  12452. ref_key: "inputRef",
  12453. ref: inputRef
  12454. }, mergeProps(passInputProps.value, _ctx.$attrs), {
  12455. "model-value": __props.modelValue,
  12456. disabled: unref(disabled),
  12457. onInput: handleInput,
  12458. onChange: handleChange,
  12459. onFocus: handleFocus,
  12460. onBlur: handleBlur,
  12461. onClear: handleClear,
  12462. onKeydown: handleKeydown,
  12463. onMousedown: handleMouseDown
  12464. }), createSlots({ _: 2 }, [
  12465. _ctx.$slots.prepend ? {
  12466. name: "prepend",
  12467. fn: withCtx(() => [renderSlot(_ctx.$slots, "prepend")]),
  12468. key: "0"
  12469. } : void 0,
  12470. _ctx.$slots.append ? {
  12471. name: "append",
  12472. fn: withCtx(() => [renderSlot(_ctx.$slots, "append")]),
  12473. key: "1"
  12474. } : void 0,
  12475. _ctx.$slots.prefix ? {
  12476. name: "prefix",
  12477. fn: withCtx(() => [renderSlot(_ctx.$slots, "prefix")]),
  12478. key: "2"
  12479. } : void 0,
  12480. _ctx.$slots.suffix ? {
  12481. name: "suffix",
  12482. fn: withCtx(() => [renderSlot(_ctx.$slots, "suffix")]),
  12483. key: "3"
  12484. } : void 0
  12485. ]), 1040, ["model-value", "disabled"])], 14, _hoisted_1$75)]),
  12486. _: 3
  12487. }, 8, [
  12488. "visible",
  12489. "placement",
  12490. "popper-class",
  12491. "popper-style",
  12492. "popper-options",
  12493. "show-arrow",
  12494. "teleported",
  12495. "append-to",
  12496. "transition"
  12497. ]);
  12498. };
  12499. }
  12500. });
  12501. //#endregion
  12502. //#region ../../packages/components/autocomplete/src/autocomplete.vue
  12503. var autocomplete_default = autocomplete_vue_vue_type_script_setup_true_lang_default;
  12504. //#endregion
  12505. //#region ../../packages/components/autocomplete/index.ts
  12506. const ElAutocomplete = withInstall(autocomplete_default);
  12507. //#endregion
  12508. //#region ../../packages/components/avatar/src/avatar.ts
  12509. const avatarProps = buildProps({
  12510. size: {
  12511. type: [Number, String],
  12512. values: componentSizes,
  12513. validator: (val) => isNumber(val)
  12514. },
  12515. shape: {
  12516. type: String,
  12517. values: ["circle", "square"]
  12518. },
  12519. icon: { type: iconPropType },
  12520. src: {
  12521. type: String,
  12522. default: ""
  12523. },
  12524. alt: String,
  12525. srcSet: String,
  12526. fit: {
  12527. type: definePropType(String),
  12528. default: "cover"
  12529. }
  12530. });
  12531. const avatarEmits = { error: (evt) => evt instanceof Event };
  12532. //#endregion
  12533. //#region ../../packages/components/avatar/src/constants.ts
  12534. const avatarGroupContextKey = Symbol("avatarGroupContextKey");
  12535. //#endregion
  12536. //#region ../../packages/components/avatar/src/avatar.vue?vue&type=script&setup=true&lang.ts
  12537. const _hoisted_1$74 = [
  12538. "src",
  12539. "alt",
  12540. "srcset"
  12541. ];
  12542. var avatar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12543. name: "ElAvatar",
  12544. __name: "avatar",
  12545. props: avatarProps,
  12546. emits: avatarEmits,
  12547. setup(__props, { emit: __emit }) {
  12548. const props = __props;
  12549. const emit = __emit;
  12550. const avatarGroupContext = inject(avatarGroupContextKey, void 0);
  12551. const ns = useNamespace("avatar");
  12552. const hasLoadError = ref(false);
  12553. const size = computed(() => props.size ?? avatarGroupContext?.size);
  12554. const shape = computed(() => props.shape ?? avatarGroupContext?.shape ?? "circle");
  12555. const avatarClass = computed(() => {
  12556. const { icon } = props;
  12557. const classList = [ns.b()];
  12558. if (isString(size.value)) classList.push(ns.m(size.value));
  12559. if (icon) classList.push(ns.m("icon"));
  12560. if (shape.value) classList.push(ns.m(shape.value));
  12561. return classList;
  12562. });
  12563. const sizeStyle = computed(() => {
  12564. return isNumber(size.value) ? ns.cssVarBlock({ size: addUnit(size.value) }) : void 0;
  12565. });
  12566. const fitStyle = computed(() => ({ objectFit: props.fit }));
  12567. watch(() => [props.src, props.srcSet], () => hasLoadError.value = false);
  12568. function handleError(e) {
  12569. hasLoadError.value = true;
  12570. emit("error", e);
  12571. }
  12572. return (_ctx, _cache) => {
  12573. return openBlock(), createElementBlock("span", {
  12574. class: normalizeClass(avatarClass.value),
  12575. style: normalizeStyle(sizeStyle.value)
  12576. }, [(__props.src || __props.srcSet) && !hasLoadError.value ? (openBlock(), createElementBlock("img", {
  12577. key: 0,
  12578. src: __props.src,
  12579. alt: __props.alt,
  12580. srcset: __props.srcSet,
  12581. style: normalizeStyle(fitStyle.value),
  12582. onError: handleError
  12583. }, null, 44, _hoisted_1$74)) : __props.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  12584. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
  12585. _: 1
  12586. })) : renderSlot(_ctx.$slots, "default", { key: 2 })], 6);
  12587. };
  12588. }
  12589. });
  12590. //#endregion
  12591. //#region ../../packages/components/avatar/src/avatar.vue
  12592. var avatar_default = avatar_vue_vue_type_script_setup_true_lang_default;
  12593. //#endregion
  12594. //#region ../../packages/components/avatar/src/avatar-group-props.ts
  12595. const avatarGroupProps = {
  12596. size: {
  12597. type: definePropType([Number, String]),
  12598. values: componentSizes,
  12599. validator: (val) => isNumber(val)
  12600. },
  12601. shape: {
  12602. type: definePropType(String),
  12603. values: ["circle", "square"]
  12604. },
  12605. collapseAvatars: Boolean,
  12606. collapseAvatarsTooltip: Boolean,
  12607. maxCollapseAvatars: {
  12608. type: Number,
  12609. default: 1
  12610. },
  12611. effect: {
  12612. type: definePropType(String),
  12613. default: "light"
  12614. },
  12615. placement: {
  12616. type: definePropType(String),
  12617. values: Ee,
  12618. default: "top"
  12619. },
  12620. popperClass: useTooltipContentProps.popperClass,
  12621. popperStyle: useTooltipContentProps.popperStyle,
  12622. collapseClass: String,
  12623. collapseStyle: {
  12624. type: definePropType([
  12625. String,
  12626. Array,
  12627. Object,
  12628. Boolean
  12629. ]),
  12630. default: void 0
  12631. }
  12632. };
  12633. //#endregion
  12634. //#region ../../packages/components/avatar/src/avatar-group.tsx
  12635. var avatar_group_default = /* @__PURE__ */ defineComponent({
  12636. name: "ElAvatarGroup",
  12637. props: avatarGroupProps,
  12638. setup(props, { slots }) {
  12639. const ns = useNamespace("avatar-group");
  12640. provide(avatarGroupContextKey, reactive({
  12641. size: toRef(props, "size"),
  12642. shape: toRef(props, "shape")
  12643. }));
  12644. return () => {
  12645. const avatars = flattedChildren(slots.default?.() ?? []);
  12646. let visibleAvatars = avatars;
  12647. if (props.collapseAvatars && avatars.length > props.maxCollapseAvatars) {
  12648. visibleAvatars = avatars.slice(0, props.maxCollapseAvatars);
  12649. const hiddenAvatars = avatars.slice(props.maxCollapseAvatars);
  12650. visibleAvatars.push(createVNode(ElTooltip, {
  12651. "popperClass": props.popperClass,
  12652. "popperStyle": props.popperStyle,
  12653. "placement": props.placement,
  12654. "effect": props.effect,
  12655. "disabled": !props.collapseAvatarsTooltip
  12656. }, {
  12657. default: () => createVNode(avatar_default, {
  12658. "size": props.size,
  12659. "shape": props.shape,
  12660. "class": props.collapseClass,
  12661. "style": props.collapseStyle
  12662. }, { default: () => [createTextVNode("+ "), hiddenAvatars.length] }),
  12663. content: () => createVNode("div", { "class": ns.e("collapse-avatars") }, [hiddenAvatars.map((node, idx) => isVNode(node) ? cloneVNode(node, { key: node.key ?? idx }) : node)])
  12664. }));
  12665. }
  12666. return createVNode("div", { "class": ns.b() }, [visibleAvatars]);
  12667. };
  12668. }
  12669. });
  12670. //#endregion
  12671. //#region ../../packages/components/avatar/index.ts
  12672. const ElAvatar = withInstall(avatar_default, { AvatarGroup: avatar_group_default });
  12673. const ElAvatarGroup = withNoopInstall(avatar_group_default);
  12674. //#endregion
  12675. //#region ../../packages/components/backtop/src/backtop.ts
  12676. const backtopProps = {
  12677. visibilityHeight: {
  12678. type: Number,
  12679. default: 200
  12680. },
  12681. target: {
  12682. type: String,
  12683. default: ""
  12684. },
  12685. right: {
  12686. type: Number,
  12687. default: 40
  12688. },
  12689. bottom: {
  12690. type: Number,
  12691. default: 40
  12692. }
  12693. };
  12694. const backtopEmits = { click: (evt) => evt instanceof MouseEvent };
  12695. //#endregion
  12696. //#region ../../packages/components/backtop/src/use-backtop.ts
  12697. const useBackTop = (props, emit, componentName) => {
  12698. const el = shallowRef();
  12699. const container = shallowRef();
  12700. const visible = ref(false);
  12701. const handleScroll = () => {
  12702. if (el.value) visible.value = el.value.scrollTop >= props.visibilityHeight;
  12703. };
  12704. const handleClick = (event) => {
  12705. el.value?.scrollTo({
  12706. top: 0,
  12707. behavior: "smooth"
  12708. });
  12709. emit("click", event);
  12710. };
  12711. useEventListener(container, "scroll", useThrottleFn(handleScroll, 300, true));
  12712. onMounted(() => {
  12713. container.value = document;
  12714. el.value = document.documentElement;
  12715. if (props.target) {
  12716. el.value = document.querySelector(props.target) ?? void 0;
  12717. if (!el.value) throwError(componentName, `target does not exist: ${props.target}`);
  12718. container.value = el.value;
  12719. }
  12720. handleScroll();
  12721. });
  12722. return {
  12723. visible,
  12724. handleClick
  12725. };
  12726. };
  12727. //#endregion
  12728. //#region ../../packages/components/backtop/src/backtop.vue?vue&type=script&setup=true&lang.ts
  12729. const COMPONENT_NAME$15 = "ElBacktop";
  12730. var backtop_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12731. name: COMPONENT_NAME$15,
  12732. __name: "backtop",
  12733. props: backtopProps,
  12734. emits: backtopEmits,
  12735. setup(__props, { emit: __emit }) {
  12736. const props = __props;
  12737. const emit = __emit;
  12738. const ns = useNamespace("backtop");
  12739. const { handleClick, visible } = useBackTop(props, emit, COMPONENT_NAME$15);
  12740. const backTopStyle = computed(() => ({
  12741. right: `${props.right}px`,
  12742. bottom: `${props.bottom}px`
  12743. }));
  12744. return (_ctx, _cache) => {
  12745. return openBlock(), createBlock(Transition, { name: `${unref(ns).namespace.value}-fade-in` }, {
  12746. default: withCtx(() => [unref(visible) ? (openBlock(), createElementBlock("div", {
  12747. key: 0,
  12748. style: normalizeStyle(backTopStyle.value),
  12749. class: normalizeClass(unref(ns).b()),
  12750. onClick: _cache[0] || (_cache[0] = withModifiers((...args) => unref(handleClick) && unref(handleClick)(...args), ["stop"]))
  12751. }, [renderSlot(_ctx.$slots, "default", {}, () => [createVNode(unref(ElIcon), { class: normalizeClass(unref(ns).e("icon")) }, {
  12752. default: withCtx(() => [createVNode(unref(caret_top_default))]),
  12753. _: 1
  12754. }, 8, ["class"])])], 6)) : createCommentVNode("v-if", true)]),
  12755. _: 3
  12756. }, 8, ["name"]);
  12757. };
  12758. }
  12759. });
  12760. //#endregion
  12761. //#region ../../packages/components/backtop/src/backtop.vue
  12762. var backtop_default = backtop_vue_vue_type_script_setup_true_lang_default;
  12763. //#endregion
  12764. //#region ../../packages/components/backtop/index.ts
  12765. const ElBacktop = withInstall(backtop_default);
  12766. //#endregion
  12767. //#region ../../packages/components/badge/src/badge.ts
  12768. const badgeProps = buildProps({
  12769. value: {
  12770. type: [String, Number],
  12771. default: ""
  12772. },
  12773. max: {
  12774. type: Number,
  12775. default: 99
  12776. },
  12777. isDot: Boolean,
  12778. hidden: Boolean,
  12779. type: {
  12780. type: String,
  12781. values: [
  12782. "primary",
  12783. "success",
  12784. "warning",
  12785. "info",
  12786. "danger"
  12787. ],
  12788. default: "danger"
  12789. },
  12790. showZero: {
  12791. type: Boolean,
  12792. default: true
  12793. },
  12794. color: String,
  12795. badgeStyle: {
  12796. type: definePropType([
  12797. String,
  12798. Object,
  12799. Array,
  12800. Boolean
  12801. ]),
  12802. default: void 0
  12803. },
  12804. offset: {
  12805. type: definePropType(Array),
  12806. default: () => [0, 0]
  12807. },
  12808. badgeClass: { type: String }
  12809. });
  12810. //#endregion
  12811. //#region ../../packages/components/badge/src/badge.vue?vue&type=script&setup=true&lang.ts
  12812. var badge_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12813. name: "ElBadge",
  12814. __name: "badge",
  12815. props: badgeProps,
  12816. setup(__props, { expose: __expose }) {
  12817. const props = __props;
  12818. const ns = useNamespace("badge");
  12819. const content = computed(() => {
  12820. if (props.isDot) return "";
  12821. if (isNumber(props.value) && isNumber(props.max)) return props.max < props.value ? `${props.max}+` : `${props.value}`;
  12822. return `${props.value}`;
  12823. });
  12824. const style = computed(() => {
  12825. return [{
  12826. backgroundColor: props.color,
  12827. marginRight: addUnit(-props.offset[0]),
  12828. marginTop: addUnit(props.offset[1])
  12829. }, props.badgeStyle ?? {}];
  12830. });
  12831. __expose({ content });
  12832. return (_ctx, _cache) => {
  12833. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b()) }, [renderSlot(_ctx.$slots, "default"), createVNode(Transition, { name: `${unref(ns).namespace.value}-zoom-in-center` }, {
  12834. default: withCtx(() => [!__props.hidden && (content.value || __props.isDot || _ctx.$slots.content) ? (openBlock(), createElementBlock("sup", {
  12835. key: 0,
  12836. class: normalizeClass([
  12837. unref(ns).e("content"),
  12838. unref(ns).em("content", __props.type),
  12839. unref(ns).is("fixed", !!_ctx.$slots.default),
  12840. unref(ns).is("dot", __props.isDot),
  12841. unref(ns).is("hide-zero", !__props.showZero && __props.value === 0),
  12842. __props.badgeClass
  12843. ]),
  12844. style: normalizeStyle(style.value)
  12845. }, [renderSlot(_ctx.$slots, "content", { value: content.value }, () => [createTextVNode(toDisplayString(content.value), 1)])], 6)) : createCommentVNode("v-if", true)]),
  12846. _: 3
  12847. }, 8, ["name"])], 2);
  12848. };
  12849. }
  12850. });
  12851. //#endregion
  12852. //#region ../../packages/components/badge/src/badge.vue
  12853. var badge_default = badge_vue_vue_type_script_setup_true_lang_default;
  12854. //#endregion
  12855. //#region ../../packages/components/badge/index.ts
  12856. const ElBadge = withInstall(badge_default);
  12857. //#endregion
  12858. //#region ../../packages/components/breadcrumb/src/breadcrumb.ts
  12859. const breadcrumbProps = buildProps({
  12860. separator: {
  12861. type: String,
  12862. default: "/"
  12863. },
  12864. separatorIcon: { type: iconPropType }
  12865. });
  12866. //#endregion
  12867. //#region ../../packages/components/breadcrumb/src/constants.ts
  12868. const breadcrumbKey = Symbol("breadcrumbKey");
  12869. //#endregion
  12870. //#region ../../packages/components/breadcrumb/src/breadcrumb.vue?vue&type=script&setup=true&lang.ts
  12871. const _hoisted_1$73 = ["aria-label"];
  12872. var breadcrumb_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12873. name: "ElBreadcrumb",
  12874. __name: "breadcrumb",
  12875. props: breadcrumbProps,
  12876. setup(__props) {
  12877. const { t } = useLocale();
  12878. const props = __props;
  12879. const ns = useNamespace("breadcrumb");
  12880. const breadcrumb = ref();
  12881. provide(breadcrumbKey, props);
  12882. onMounted(() => {
  12883. const items = breadcrumb.value.querySelectorAll(`.${ns.e("item")}`);
  12884. if (items.length) items[items.length - 1].setAttribute("aria-current", "page");
  12885. });
  12886. return (_ctx, _cache) => {
  12887. return openBlock(), createElementBlock("div", {
  12888. ref_key: "breadcrumb",
  12889. ref: breadcrumb,
  12890. class: normalizeClass(unref(ns).b()),
  12891. "aria-label": unref(t)("el.breadcrumb.label"),
  12892. role: "navigation"
  12893. }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$73);
  12894. };
  12895. }
  12896. });
  12897. //#endregion
  12898. //#region ../../packages/components/breadcrumb/src/breadcrumb.vue
  12899. var breadcrumb_default = breadcrumb_vue_vue_type_script_setup_true_lang_default;
  12900. //#endregion
  12901. //#region ../../packages/components/breadcrumb/src/breadcrumb-item.ts
  12902. const breadcrumbItemProps = buildProps({
  12903. to: {
  12904. type: definePropType([String, Object]),
  12905. default: ""
  12906. },
  12907. replace: Boolean
  12908. });
  12909. //#endregion
  12910. //#region ../../packages/components/breadcrumb/src/breadcrumb-item.vue?vue&type=script&setup=true&lang.ts
  12911. var breadcrumb_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  12912. name: "ElBreadcrumbItem",
  12913. __name: "breadcrumb-item",
  12914. props: breadcrumbItemProps,
  12915. setup(__props) {
  12916. const props = __props;
  12917. const instance = getCurrentInstance();
  12918. const breadcrumbContext = inject(breadcrumbKey, void 0);
  12919. const ns = useNamespace("breadcrumb");
  12920. const router = instance.appContext.config.globalProperties.$router;
  12921. const onClick = () => {
  12922. if (!props.to || !router) return;
  12923. props.replace ? router.replace(props.to) : router.push(props.to);
  12924. };
  12925. return (_ctx, _cache) => {
  12926. return openBlock(), createElementBlock("span", { class: normalizeClass(unref(ns).e("item")) }, [createElementVNode("span", {
  12927. class: normalizeClass([unref(ns).e("inner"), unref(ns).is("link", !!__props.to)]),
  12928. role: "link",
  12929. onClick
  12930. }, [renderSlot(_ctx.$slots, "default")], 2), unref(breadcrumbContext)?.separatorIcon ? (openBlock(), createBlock(unref(ElIcon), {
  12931. key: 0,
  12932. class: normalizeClass(unref(ns).e("separator"))
  12933. }, {
  12934. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(unref(breadcrumbContext).separatorIcon)))]),
  12935. _: 1
  12936. }, 8, ["class"])) : (openBlock(), createElementBlock("span", {
  12937. key: 1,
  12938. class: normalizeClass(unref(ns).e("separator")),
  12939. role: "presentation"
  12940. }, toDisplayString(unref(breadcrumbContext)?.separator), 3))], 2);
  12941. };
  12942. }
  12943. });
  12944. //#endregion
  12945. //#region ../../packages/components/breadcrumb/src/breadcrumb-item.vue
  12946. var breadcrumb_item_default = breadcrumb_item_vue_vue_type_script_setup_true_lang_default;
  12947. //#endregion
  12948. //#region ../../packages/components/breadcrumb/index.ts
  12949. const ElBreadcrumb = withInstall(breadcrumb_default, { BreadcrumbItem: breadcrumb_item_default });
  12950. const ElBreadcrumbItem = withNoopInstall(breadcrumb_item_default);
  12951. //#endregion
  12952. //#region ../../packages/components/button/src/button.ts
  12953. const buttonTypes = [
  12954. "default",
  12955. "primary",
  12956. "success",
  12957. "warning",
  12958. "info",
  12959. "danger",
  12960. "text",
  12961. ""
  12962. ];
  12963. const buttonNativeTypes = [
  12964. "button",
  12965. "submit",
  12966. "reset"
  12967. ];
  12968. const buttonProps = buildProps({
  12969. size: useSizeProp,
  12970. disabled: {
  12971. type: Boolean,
  12972. default: void 0
  12973. },
  12974. type: {
  12975. type: String,
  12976. values: buttonTypes,
  12977. default: ""
  12978. },
  12979. icon: { type: iconPropType },
  12980. nativeType: {
  12981. type: String,
  12982. values: buttonNativeTypes,
  12983. default: "button"
  12984. },
  12985. loading: Boolean,
  12986. loadingIcon: {
  12987. type: iconPropType,
  12988. default: () => loading_default
  12989. },
  12990. plain: {
  12991. type: Boolean,
  12992. default: void 0
  12993. },
  12994. text: {
  12995. type: Boolean,
  12996. default: void 0
  12997. },
  12998. link: Boolean,
  12999. bg: Boolean,
  13000. autofocus: Boolean,
  13001. round: {
  13002. type: Boolean,
  13003. default: void 0
  13004. },
  13005. circle: Boolean,
  13006. dashed: {
  13007. type: Boolean,
  13008. default: void 0
  13009. },
  13010. color: String,
  13011. dark: Boolean,
  13012. autoInsertSpace: {
  13013. type: Boolean,
  13014. default: void 0
  13015. },
  13016. tag: {
  13017. type: definePropType([String, Object]),
  13018. default: "button"
  13019. }
  13020. });
  13021. const buttonEmits = { click: (evt) => evt instanceof MouseEvent };
  13022. //#endregion
  13023. //#region ../../packages/components/button/src/constants.ts
  13024. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  13025. //#endregion
  13026. //#region ../../packages/components/button/src/use-button.ts
  13027. const useButton = (props, emit) => {
  13028. useDeprecated({
  13029. from: "type.text",
  13030. replacement: "link",
  13031. version: "3.0.0",
  13032. scope: "props",
  13033. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  13034. }, computed(() => props.type === "text"));
  13035. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  13036. const globalConfig = useGlobalConfig("button");
  13037. const { form } = useFormItem();
  13038. const _size = useFormSize(computed(() => buttonGroupContext?.size));
  13039. const _disabled = useFormDisabled();
  13040. const _ref = ref();
  13041. const slots = useSlots();
  13042. const _type = computed(() => props.type || buttonGroupContext?.type || globalConfig.value?.type || "");
  13043. const autoInsertSpace = computed(() => props.autoInsertSpace ?? globalConfig.value?.autoInsertSpace ?? false);
  13044. const _plain = computed(() => props.plain ?? globalConfig.value?.plain ?? false);
  13045. const _round = computed(() => props.round ?? globalConfig.value?.round ?? false);
  13046. const _text = computed(() => props.text ?? globalConfig.value?.text ?? false);
  13047. const _dashed = computed(() => props.dashed ?? globalConfig.value?.dashed ?? false);
  13048. const _props = computed(() => {
  13049. if (props.tag === "button") return {
  13050. ariaDisabled: _disabled.value || props.loading,
  13051. disabled: _disabled.value || props.loading,
  13052. autofocus: props.autofocus,
  13053. type: props.nativeType
  13054. };
  13055. return {};
  13056. });
  13057. const shouldAddSpace = computed(() => {
  13058. const defaultSlot = slots.default?.();
  13059. if (autoInsertSpace.value && defaultSlot?.length === 1) {
  13060. const slot = defaultSlot[0];
  13061. if (slot?.type === Text) {
  13062. const text = slot.children;
  13063. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  13064. }
  13065. }
  13066. return false;
  13067. });
  13068. const handleClick = (evt) => {
  13069. if (_disabled.value || props.loading) {
  13070. evt.stopPropagation();
  13071. return;
  13072. }
  13073. if (props.nativeType === "reset") form?.resetFields();
  13074. emit("click", evt);
  13075. };
  13076. return {
  13077. _disabled,
  13078. _size,
  13079. _type,
  13080. _ref,
  13081. _props,
  13082. _plain,
  13083. _round,
  13084. _text,
  13085. _dashed,
  13086. shouldAddSpace,
  13087. handleClick
  13088. };
  13089. };
  13090. //#endregion
  13091. //#region ../../node_modules/.pnpm/@ctrl+tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/util.js
  13092. function bound01(n, max) {
  13093. if (isOnePointZero(n)) n = "100%";
  13094. const isPercent = isPercentage(n);
  13095. n = max === 360 ? n : Math.min(max, Math.max(0, parseFloat(n)));
  13096. if (isPercent) n = parseInt(String(n * max), 10) / 100;
  13097. if (Math.abs(n - max) < 1e-6) return 1;
  13098. if (max === 360) n = (n < 0 ? n % max + max : n % max) / parseFloat(String(max));
  13099. else n = n % max / parseFloat(String(max));
  13100. return n;
  13101. }
  13102. function clamp01(val) {
  13103. return Math.min(1, Math.max(0, val));
  13104. }
  13105. function isOnePointZero(n) {
  13106. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  13107. }
  13108. function isPercentage(n) {
  13109. return typeof n === "string" && n.indexOf("%") !== -1;
  13110. }
  13111. function boundAlpha(a) {
  13112. a = parseFloat(a);
  13113. if (isNaN(a) || a < 0 || a > 1) a = 1;
  13114. return a;
  13115. }
  13116. function convertToPercentage(n) {
  13117. if (Number(n) <= 1) return `${Number(n) * 100}%`;
  13118. return n;
  13119. }
  13120. function pad2(c) {
  13121. return c.length === 1 ? "0" + c : String(c);
  13122. }
  13123. //#endregion
  13124. //#region ../../node_modules/.pnpm/@ctrl+tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/conversion.js
  13125. function rgbToRgb(r, g, b) {
  13126. return {
  13127. r: bound01(r, 255) * 255,
  13128. g: bound01(g, 255) * 255,
  13129. b: bound01(b, 255) * 255
  13130. };
  13131. }
  13132. function rgbToHsl(r, g, b) {
  13133. r = bound01(r, 255);
  13134. g = bound01(g, 255);
  13135. b = bound01(b, 255);
  13136. const max = Math.max(r, g, b);
  13137. const min = Math.min(r, g, b);
  13138. let h = 0;
  13139. let s = 0;
  13140. const l = (max + min) / 2;
  13141. if (max === min) {
  13142. s = 0;
  13143. h = 0;
  13144. } else {
  13145. const d = max - min;
  13146. s = l > .5 ? d / (2 - max - min) : d / (max + min);
  13147. switch (max) {
  13148. case r:
  13149. h = (g - b) / d + (g < b ? 6 : 0);
  13150. break;
  13151. case g:
  13152. h = (b - r) / d + 2;
  13153. break;
  13154. case b:
  13155. h = (r - g) / d + 4;
  13156. break;
  13157. default: break;
  13158. }
  13159. h /= 6;
  13160. }
  13161. return {
  13162. h,
  13163. s,
  13164. l
  13165. };
  13166. }
  13167. function hue2rgb(p, q, t) {
  13168. if (t < 0) t += 1;
  13169. if (t > 1) t -= 1;
  13170. if (t < 1 / 6) return p + (q - p) * (6 * t);
  13171. if (t < 1 / 2) return q;
  13172. if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
  13173. return p;
  13174. }
  13175. function hslToRgb(h, s, l) {
  13176. let r;
  13177. let g;
  13178. let b;
  13179. h = bound01(h, 360);
  13180. s = bound01(s, 100);
  13181. l = bound01(l, 100);
  13182. if (s === 0) {
  13183. g = l;
  13184. b = l;
  13185. r = l;
  13186. } else {
  13187. const q = l < .5 ? l * (1 + s) : l + s - l * s;
  13188. const p = 2 * l - q;
  13189. r = hue2rgb(p, q, h + 1 / 3);
  13190. g = hue2rgb(p, q, h);
  13191. b = hue2rgb(p, q, h - 1 / 3);
  13192. }
  13193. return {
  13194. r: r * 255,
  13195. g: g * 255,
  13196. b: b * 255
  13197. };
  13198. }
  13199. function rgbToHsv(r, g, b) {
  13200. r = bound01(r, 255);
  13201. g = bound01(g, 255);
  13202. b = bound01(b, 255);
  13203. const max = Math.max(r, g, b);
  13204. const min = Math.min(r, g, b);
  13205. let h = 0;
  13206. const v = max;
  13207. const d = max - min;
  13208. const s = max === 0 ? 0 : d / max;
  13209. if (max === min) h = 0;
  13210. else {
  13211. switch (max) {
  13212. case r:
  13213. h = (g - b) / d + (g < b ? 6 : 0);
  13214. break;
  13215. case g:
  13216. h = (b - r) / d + 2;
  13217. break;
  13218. case b:
  13219. h = (r - g) / d + 4;
  13220. break;
  13221. default: break;
  13222. }
  13223. h /= 6;
  13224. }
  13225. return {
  13226. h,
  13227. s,
  13228. v
  13229. };
  13230. }
  13231. function hsvToRgb(h, s, v) {
  13232. h = bound01(h, 360) * 6;
  13233. s = bound01(s, 100);
  13234. v = bound01(v, 100);
  13235. const i = Math.floor(h);
  13236. const f = h - i;
  13237. const p = v * (1 - s);
  13238. const q = v * (1 - f * s);
  13239. const t = v * (1 - (1 - f) * s);
  13240. const mod = i % 6;
  13241. const r = [
  13242. v,
  13243. q,
  13244. p,
  13245. p,
  13246. t,
  13247. v
  13248. ][mod];
  13249. const g = [
  13250. t,
  13251. v,
  13252. v,
  13253. q,
  13254. p,
  13255. p
  13256. ][mod];
  13257. const b = [
  13258. p,
  13259. p,
  13260. t,
  13261. v,
  13262. v,
  13263. q
  13264. ][mod];
  13265. return {
  13266. r: r * 255,
  13267. g: g * 255,
  13268. b: b * 255
  13269. };
  13270. }
  13271. function rgbToHex(r, g, b, allow3Char) {
  13272. const hex = [
  13273. pad2(Math.round(r).toString(16)),
  13274. pad2(Math.round(g).toString(16)),
  13275. pad2(Math.round(b).toString(16))
  13276. ];
  13277. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  13278. return hex.join("");
  13279. }
  13280. function rgbaToHex(r, g, b, a, allow4Char) {
  13281. const hex = [
  13282. pad2(Math.round(r).toString(16)),
  13283. pad2(Math.round(g).toString(16)),
  13284. pad2(Math.round(b).toString(16)),
  13285. pad2(convertDecimalToHex(a))
  13286. ];
  13287. 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))) return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  13288. return hex.join("");
  13289. }
  13290. function cmykToRgb(c, m, y, k) {
  13291. const cConv = c / 100;
  13292. const mConv = m / 100;
  13293. const yConv = y / 100;
  13294. const kConv = k / 100;
  13295. return {
  13296. r: 255 * (1 - cConv) * (1 - kConv),
  13297. g: 255 * (1 - mConv) * (1 - kConv),
  13298. b: 255 * (1 - yConv) * (1 - kConv)
  13299. };
  13300. }
  13301. function rgbToCmyk(r, g, b) {
  13302. let c = 1 - r / 255;
  13303. let m = 1 - g / 255;
  13304. let y = 1 - b / 255;
  13305. let k = Math.min(c, m, y);
  13306. if (k === 1) {
  13307. c = 0;
  13308. m = 0;
  13309. y = 0;
  13310. } else {
  13311. c = (c - k) / (1 - k) * 100;
  13312. m = (m - k) / (1 - k) * 100;
  13313. y = (y - k) / (1 - k) * 100;
  13314. }
  13315. k *= 100;
  13316. return {
  13317. c: Math.round(c),
  13318. m: Math.round(m),
  13319. y: Math.round(y),
  13320. k: Math.round(k)
  13321. };
  13322. }
  13323. function convertDecimalToHex(d) {
  13324. return Math.round(parseFloat(d) * 255).toString(16);
  13325. }
  13326. function convertHexToDecimal(h) {
  13327. return parseIntFromHex(h) / 255;
  13328. }
  13329. function parseIntFromHex(val) {
  13330. return parseInt(val, 16);
  13331. }
  13332. function numberInputToObject(color) {
  13333. return {
  13334. r: color >> 16,
  13335. g: (color & 65280) >> 8,
  13336. b: color & 255
  13337. };
  13338. }
  13339. //#endregion
  13340. //#region ../../node_modules/.pnpm/@ctrl+tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/css-color-names.js
  13341. const names = {
  13342. aliceblue: "#f0f8ff",
  13343. antiquewhite: "#faebd7",
  13344. aqua: "#00ffff",
  13345. aquamarine: "#7fffd4",
  13346. azure: "#f0ffff",
  13347. beige: "#f5f5dc",
  13348. bisque: "#ffe4c4",
  13349. black: "#000000",
  13350. blanchedalmond: "#ffebcd",
  13351. blue: "#0000ff",
  13352. blueviolet: "#8a2be2",
  13353. brown: "#a52a2a",
  13354. burlywood: "#deb887",
  13355. cadetblue: "#5f9ea0",
  13356. chartreuse: "#7fff00",
  13357. chocolate: "#d2691e",
  13358. coral: "#ff7f50",
  13359. cornflowerblue: "#6495ed",
  13360. cornsilk: "#fff8dc",
  13361. crimson: "#dc143c",
  13362. cyan: "#00ffff",
  13363. darkblue: "#00008b",
  13364. darkcyan: "#008b8b",
  13365. darkgoldenrod: "#b8860b",
  13366. darkgray: "#a9a9a9",
  13367. darkgreen: "#006400",
  13368. darkgrey: "#a9a9a9",
  13369. darkkhaki: "#bdb76b",
  13370. darkmagenta: "#8b008b",
  13371. darkolivegreen: "#556b2f",
  13372. darkorange: "#ff8c00",
  13373. darkorchid: "#9932cc",
  13374. darkred: "#8b0000",
  13375. darksalmon: "#e9967a",
  13376. darkseagreen: "#8fbc8f",
  13377. darkslateblue: "#483d8b",
  13378. darkslategray: "#2f4f4f",
  13379. darkslategrey: "#2f4f4f",
  13380. darkturquoise: "#00ced1",
  13381. darkviolet: "#9400d3",
  13382. deeppink: "#ff1493",
  13383. deepskyblue: "#00bfff",
  13384. dimgray: "#696969",
  13385. dimgrey: "#696969",
  13386. dodgerblue: "#1e90ff",
  13387. firebrick: "#b22222",
  13388. floralwhite: "#fffaf0",
  13389. forestgreen: "#228b22",
  13390. fuchsia: "#ff00ff",
  13391. gainsboro: "#dcdcdc",
  13392. ghostwhite: "#f8f8ff",
  13393. goldenrod: "#daa520",
  13394. gold: "#ffd700",
  13395. gray: "#808080",
  13396. green: "#008000",
  13397. greenyellow: "#adff2f",
  13398. grey: "#808080",
  13399. honeydew: "#f0fff0",
  13400. hotpink: "#ff69b4",
  13401. indianred: "#cd5c5c",
  13402. indigo: "#4b0082",
  13403. ivory: "#fffff0",
  13404. khaki: "#f0e68c",
  13405. lavenderblush: "#fff0f5",
  13406. lavender: "#e6e6fa",
  13407. lawngreen: "#7cfc00",
  13408. lemonchiffon: "#fffacd",
  13409. lightblue: "#add8e6",
  13410. lightcoral: "#f08080",
  13411. lightcyan: "#e0ffff",
  13412. lightgoldenrodyellow: "#fafad2",
  13413. lightgray: "#d3d3d3",
  13414. lightgreen: "#90ee90",
  13415. lightgrey: "#d3d3d3",
  13416. lightpink: "#ffb6c1",
  13417. lightsalmon: "#ffa07a",
  13418. lightseagreen: "#20b2aa",
  13419. lightskyblue: "#87cefa",
  13420. lightslategray: "#778899",
  13421. lightslategrey: "#778899",
  13422. lightsteelblue: "#b0c4de",
  13423. lightyellow: "#ffffe0",
  13424. lime: "#00ff00",
  13425. limegreen: "#32cd32",
  13426. linen: "#faf0e6",
  13427. magenta: "#ff00ff",
  13428. maroon: "#800000",
  13429. mediumaquamarine: "#66cdaa",
  13430. mediumblue: "#0000cd",
  13431. mediumorchid: "#ba55d3",
  13432. mediumpurple: "#9370db",
  13433. mediumseagreen: "#3cb371",
  13434. mediumslateblue: "#7b68ee",
  13435. mediumspringgreen: "#00fa9a",
  13436. mediumturquoise: "#48d1cc",
  13437. mediumvioletred: "#c71585",
  13438. midnightblue: "#191970",
  13439. mintcream: "#f5fffa",
  13440. mistyrose: "#ffe4e1",
  13441. moccasin: "#ffe4b5",
  13442. navajowhite: "#ffdead",
  13443. navy: "#000080",
  13444. oldlace: "#fdf5e6",
  13445. olive: "#808000",
  13446. olivedrab: "#6b8e23",
  13447. orange: "#ffa500",
  13448. orangered: "#ff4500",
  13449. orchid: "#da70d6",
  13450. palegoldenrod: "#eee8aa",
  13451. palegreen: "#98fb98",
  13452. paleturquoise: "#afeeee",
  13453. palevioletred: "#db7093",
  13454. papayawhip: "#ffefd5",
  13455. peachpuff: "#ffdab9",
  13456. peru: "#cd853f",
  13457. pink: "#ffc0cb",
  13458. plum: "#dda0dd",
  13459. powderblue: "#b0e0e6",
  13460. purple: "#800080",
  13461. rebeccapurple: "#663399",
  13462. red: "#ff0000",
  13463. rosybrown: "#bc8f8f",
  13464. royalblue: "#4169e1",
  13465. saddlebrown: "#8b4513",
  13466. salmon: "#fa8072",
  13467. sandybrown: "#f4a460",
  13468. seagreen: "#2e8b57",
  13469. seashell: "#fff5ee",
  13470. sienna: "#a0522d",
  13471. silver: "#c0c0c0",
  13472. skyblue: "#87ceeb",
  13473. slateblue: "#6a5acd",
  13474. slategray: "#708090",
  13475. slategrey: "#708090",
  13476. snow: "#fffafa",
  13477. springgreen: "#00ff7f",
  13478. steelblue: "#4682b4",
  13479. tan: "#d2b48c",
  13480. teal: "#008080",
  13481. thistle: "#d8bfd8",
  13482. tomato: "#ff6347",
  13483. turquoise: "#40e0d0",
  13484. violet: "#ee82ee",
  13485. wheat: "#f5deb3",
  13486. white: "#ffffff",
  13487. whitesmoke: "#f5f5f5",
  13488. yellow: "#ffff00",
  13489. yellowgreen: "#9acd32"
  13490. };
  13491. //#endregion
  13492. //#region ../../node_modules/.pnpm/@ctrl+tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/format-input.js
  13493. function inputToRGB(color) {
  13494. let rgb = {
  13495. r: 0,
  13496. g: 0,
  13497. b: 0
  13498. };
  13499. let a = 1;
  13500. let s = null;
  13501. let v = null;
  13502. let l = null;
  13503. let ok = false;
  13504. let format = false;
  13505. if (typeof color === "string") color = stringInputToObject(color);
  13506. if (typeof color === "object") {
  13507. if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
  13508. rgb = rgbToRgb(color.r, color.g, color.b);
  13509. ok = true;
  13510. format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
  13511. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
  13512. s = convertToPercentage(color.s);
  13513. v = convertToPercentage(color.v);
  13514. rgb = hsvToRgb(color.h, s, v);
  13515. ok = true;
  13516. format = "hsv";
  13517. } else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
  13518. s = convertToPercentage(color.s);
  13519. l = convertToPercentage(color.l);
  13520. rgb = hslToRgb(color.h, s, l);
  13521. ok = true;
  13522. format = "hsl";
  13523. } else if (isValidCSSUnit(color.c) && isValidCSSUnit(color.m) && isValidCSSUnit(color.y) && isValidCSSUnit(color.k)) {
  13524. rgb = cmykToRgb(color.c, color.m, color.y, color.k);
  13525. ok = true;
  13526. format = "cmyk";
  13527. }
  13528. if (Object.prototype.hasOwnProperty.call(color, "a")) a = color.a;
  13529. }
  13530. a = boundAlpha(a);
  13531. return {
  13532. ok,
  13533. format: color.format || format,
  13534. r: Math.min(255, Math.max(rgb.r, 0)),
  13535. g: Math.min(255, Math.max(rgb.g, 0)),
  13536. b: Math.min(255, Math.max(rgb.b, 0)),
  13537. a
  13538. };
  13539. }
  13540. const CSS_UNIT = "(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)";
  13541. const PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))\\s*\\)?";
  13542. const PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))[,|\\s]+((?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?))\\s*\\)?";
  13543. const matchers = {
  13544. CSS_UNIT: new RegExp(CSS_UNIT),
  13545. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  13546. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  13547. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  13548. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  13549. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  13550. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  13551. cmyk: new RegExp("cmyk" + PERMISSIVE_MATCH4),
  13552. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  13553. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  13554. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  13555. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  13556. };
  13557. function stringInputToObject(color) {
  13558. color = color.trim().toLowerCase();
  13559. if (color.length === 0) return false;
  13560. let named = false;
  13561. if (names[color]) {
  13562. color = names[color];
  13563. named = true;
  13564. } else if (color === "transparent") return {
  13565. r: 0,
  13566. g: 0,
  13567. b: 0,
  13568. a: 0,
  13569. format: "name"
  13570. };
  13571. let match = matchers.rgb.exec(color);
  13572. if (match) return {
  13573. r: match[1],
  13574. g: match[2],
  13575. b: match[3]
  13576. };
  13577. match = matchers.rgba.exec(color);
  13578. if (match) return {
  13579. r: match[1],
  13580. g: match[2],
  13581. b: match[3],
  13582. a: match[4]
  13583. };
  13584. match = matchers.hsl.exec(color);
  13585. if (match) return {
  13586. h: match[1],
  13587. s: match[2],
  13588. l: match[3]
  13589. };
  13590. match = matchers.hsla.exec(color);
  13591. if (match) return {
  13592. h: match[1],
  13593. s: match[2],
  13594. l: match[3],
  13595. a: match[4]
  13596. };
  13597. match = matchers.hsv.exec(color);
  13598. if (match) return {
  13599. h: match[1],
  13600. s: match[2],
  13601. v: match[3]
  13602. };
  13603. match = matchers.hsva.exec(color);
  13604. if (match) return {
  13605. h: match[1],
  13606. s: match[2],
  13607. v: match[3],
  13608. a: match[4]
  13609. };
  13610. match = matchers.cmyk.exec(color);
  13611. if (match) return {
  13612. c: match[1],
  13613. m: match[2],
  13614. y: match[3],
  13615. k: match[4]
  13616. };
  13617. match = matchers.hex8.exec(color);
  13618. if (match) return {
  13619. r: parseIntFromHex(match[1]),
  13620. g: parseIntFromHex(match[2]),
  13621. b: parseIntFromHex(match[3]),
  13622. a: convertHexToDecimal(match[4]),
  13623. format: named ? "name" : "hex8"
  13624. };
  13625. match = matchers.hex6.exec(color);
  13626. if (match) return {
  13627. r: parseIntFromHex(match[1]),
  13628. g: parseIntFromHex(match[2]),
  13629. b: parseIntFromHex(match[3]),
  13630. format: named ? "name" : "hex"
  13631. };
  13632. match = matchers.hex4.exec(color);
  13633. if (match) return {
  13634. r: parseIntFromHex(match[1] + match[1]),
  13635. g: parseIntFromHex(match[2] + match[2]),
  13636. b: parseIntFromHex(match[3] + match[3]),
  13637. a: convertHexToDecimal(match[4] + match[4]),
  13638. format: named ? "name" : "hex8"
  13639. };
  13640. match = matchers.hex3.exec(color);
  13641. if (match) return {
  13642. r: parseIntFromHex(match[1] + match[1]),
  13643. g: parseIntFromHex(match[2] + match[2]),
  13644. b: parseIntFromHex(match[3] + match[3]),
  13645. format: named ? "name" : "hex"
  13646. };
  13647. return false;
  13648. }
  13649. function isValidCSSUnit(color) {
  13650. if (typeof color === "number") return !Number.isNaN(color);
  13651. return matchers.CSS_UNIT.test(color);
  13652. }
  13653. //#endregion
  13654. //#region ../../node_modules/.pnpm/@ctrl+tinycolor@4.2.0/node_modules/@ctrl/tinycolor/dist/module/index.js
  13655. var TinyColor = class TinyColor {
  13656. constructor(color = "", opts = {}) {
  13657. if (color instanceof TinyColor) return color;
  13658. if (typeof color === "number") color = numberInputToObject(color);
  13659. this.originalInput = color;
  13660. const rgb = inputToRGB(color);
  13661. this.originalInput = color;
  13662. this.r = rgb.r;
  13663. this.g = rgb.g;
  13664. this.b = rgb.b;
  13665. this.a = rgb.a;
  13666. this.roundA = Math.round(100 * this.a) / 100;
  13667. this.format = opts.format ?? rgb.format;
  13668. this.gradientType = opts.gradientType;
  13669. if (this.r < 1) this.r = Math.round(this.r);
  13670. if (this.g < 1) this.g = Math.round(this.g);
  13671. if (this.b < 1) this.b = Math.round(this.b);
  13672. this.isValid = rgb.ok;
  13673. }
  13674. isDark() {
  13675. return this.getBrightness() < 128;
  13676. }
  13677. isLight() {
  13678. return !this.isDark();
  13679. }
  13680. getBrightness() {
  13681. const rgb = this.toRgb();
  13682. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  13683. }
  13684. getLuminance() {
  13685. const rgb = this.toRgb();
  13686. let R;
  13687. let G;
  13688. let B;
  13689. const RsRGB = rgb.r / 255;
  13690. const GsRGB = rgb.g / 255;
  13691. const BsRGB = rgb.b / 255;
  13692. if (RsRGB <= .03928) R = RsRGB / 12.92;
  13693. else R = Math.pow((RsRGB + .055) / 1.055, 2.4);
  13694. if (GsRGB <= .03928) G = GsRGB / 12.92;
  13695. else G = Math.pow((GsRGB + .055) / 1.055, 2.4);
  13696. if (BsRGB <= .03928) B = BsRGB / 12.92;
  13697. else B = Math.pow((BsRGB + .055) / 1.055, 2.4);
  13698. return .2126 * R + .7152 * G + .0722 * B;
  13699. }
  13700. getAlpha() {
  13701. return this.a;
  13702. }
  13703. setAlpha(alpha) {
  13704. this.a = boundAlpha(alpha);
  13705. this.roundA = Math.round(100 * this.a) / 100;
  13706. return this;
  13707. }
  13708. isMonochrome() {
  13709. const { s } = this.toHsl();
  13710. return s === 0;
  13711. }
  13712. toHsv() {
  13713. const hsv = rgbToHsv(this.r, this.g, this.b);
  13714. return {
  13715. h: hsv.h * 360,
  13716. s: hsv.s,
  13717. v: hsv.v,
  13718. a: this.a
  13719. };
  13720. }
  13721. toHsvString() {
  13722. const hsv = rgbToHsv(this.r, this.g, this.b);
  13723. const h = Math.round(hsv.h * 360);
  13724. const s = Math.round(hsv.s * 100);
  13725. const v = Math.round(hsv.v * 100);
  13726. return this.a === 1 ? `hsv(${h}, ${s}%, ${v}%)` : `hsva(${h}, ${s}%, ${v}%, ${this.roundA})`;
  13727. }
  13728. toHsl() {
  13729. const hsl = rgbToHsl(this.r, this.g, this.b);
  13730. return {
  13731. h: hsl.h * 360,
  13732. s: hsl.s,
  13733. l: hsl.l,
  13734. a: this.a
  13735. };
  13736. }
  13737. toHslString() {
  13738. const hsl = rgbToHsl(this.r, this.g, this.b);
  13739. const h = Math.round(hsl.h * 360);
  13740. const s = Math.round(hsl.s * 100);
  13741. const l = Math.round(hsl.l * 100);
  13742. return this.a === 1 ? `hsl(${h}, ${s}%, ${l}%)` : `hsla(${h}, ${s}%, ${l}%, ${this.roundA})`;
  13743. }
  13744. toHex(allow3Char = false) {
  13745. return rgbToHex(this.r, this.g, this.b, allow3Char);
  13746. }
  13747. toHexString(allow3Char = false) {
  13748. return "#" + this.toHex(allow3Char);
  13749. }
  13750. toHex8(allow4Char = false) {
  13751. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  13752. }
  13753. toHex8String(allow4Char = false) {
  13754. return "#" + this.toHex8(allow4Char);
  13755. }
  13756. toHexShortString(allowShortChar = false) {
  13757. return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
  13758. }
  13759. toRgb() {
  13760. return {
  13761. r: Math.round(this.r),
  13762. g: Math.round(this.g),
  13763. b: Math.round(this.b),
  13764. a: this.a
  13765. };
  13766. }
  13767. toRgbString() {
  13768. const r = Math.round(this.r);
  13769. const g = Math.round(this.g);
  13770. const b = Math.round(this.b);
  13771. return this.a === 1 ? `rgb(${r}, ${g}, ${b})` : `rgba(${r}, ${g}, ${b}, ${this.roundA})`;
  13772. }
  13773. toPercentageRgb() {
  13774. const fmt = (x) => `${Math.round(bound01(x, 255) * 100)}%`;
  13775. return {
  13776. r: fmt(this.r),
  13777. g: fmt(this.g),
  13778. b: fmt(this.b),
  13779. a: this.a
  13780. };
  13781. }
  13782. toPercentageRgbString() {
  13783. const rnd = (x) => Math.round(bound01(x, 255) * 100);
  13784. return this.a === 1 ? `rgb(${rnd(this.r)}%, ${rnd(this.g)}%, ${rnd(this.b)}%)` : `rgba(${rnd(this.r)}%, ${rnd(this.g)}%, ${rnd(this.b)}%, ${this.roundA})`;
  13785. }
  13786. toCmyk() {
  13787. return { ...rgbToCmyk(this.r, this.g, this.b) };
  13788. }
  13789. toCmykString() {
  13790. const { c, m, y, k } = rgbToCmyk(this.r, this.g, this.b);
  13791. return `cmyk(${c}, ${m}, ${y}, ${k})`;
  13792. }
  13793. toName() {
  13794. if (this.a === 0) return "transparent";
  13795. if (this.a < 1) return false;
  13796. const hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  13797. for (const [key, value] of Object.entries(names)) if (hex === value) return key;
  13798. return false;
  13799. }
  13800. toString(format) {
  13801. const formatSet = Boolean(format);
  13802. format = format ?? this.format;
  13803. let formattedString = false;
  13804. const hasAlpha = this.a < 1 && this.a >= 0;
  13805. if (!formatSet && hasAlpha && (format.startsWith("hex") || format === "name")) {
  13806. if (format === "name" && this.a === 0) return this.toName();
  13807. return this.toRgbString();
  13808. }
  13809. if (format === "rgb") formattedString = this.toRgbString();
  13810. if (format === "prgb") formattedString = this.toPercentageRgbString();
  13811. if (format === "hex" || format === "hex6") formattedString = this.toHexString();
  13812. if (format === "hex3") formattedString = this.toHexString(true);
  13813. if (format === "hex4") formattedString = this.toHex8String(true);
  13814. if (format === "hex8") formattedString = this.toHex8String();
  13815. if (format === "name") formattedString = this.toName();
  13816. if (format === "hsl") formattedString = this.toHslString();
  13817. if (format === "hsv") formattedString = this.toHsvString();
  13818. if (format === "cmyk") formattedString = this.toCmykString();
  13819. return formattedString || this.toHexString();
  13820. }
  13821. toNumber() {
  13822. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  13823. }
  13824. clone() {
  13825. return new TinyColor(this.toString());
  13826. }
  13827. lighten(amount = 10) {
  13828. const hsl = this.toHsl();
  13829. hsl.l += amount / 100;
  13830. hsl.l = clamp01(hsl.l);
  13831. return new TinyColor(hsl);
  13832. }
  13833. brighten(amount = 10) {
  13834. const rgb = this.toRgb();
  13835. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  13836. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  13837. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  13838. return new TinyColor(rgb);
  13839. }
  13840. darken(amount = 10) {
  13841. const hsl = this.toHsl();
  13842. hsl.l -= amount / 100;
  13843. hsl.l = clamp01(hsl.l);
  13844. return new TinyColor(hsl);
  13845. }
  13846. tint(amount = 10) {
  13847. return this.mix("white", amount);
  13848. }
  13849. shade(amount = 10) {
  13850. return this.mix("black", amount);
  13851. }
  13852. desaturate(amount = 10) {
  13853. const hsl = this.toHsl();
  13854. hsl.s -= amount / 100;
  13855. hsl.s = clamp01(hsl.s);
  13856. return new TinyColor(hsl);
  13857. }
  13858. saturate(amount = 10) {
  13859. const hsl = this.toHsl();
  13860. hsl.s += amount / 100;
  13861. hsl.s = clamp01(hsl.s);
  13862. return new TinyColor(hsl);
  13863. }
  13864. greyscale() {
  13865. return this.desaturate(100);
  13866. }
  13867. spin(amount) {
  13868. const hsl = this.toHsl();
  13869. const hue = (hsl.h + amount) % 360;
  13870. hsl.h = hue < 0 ? 360 + hue : hue;
  13871. return new TinyColor(hsl);
  13872. }
  13873. mix(color, amount = 50) {
  13874. const rgb1 = this.toRgb();
  13875. const rgb2 = new TinyColor(color).toRgb();
  13876. const p = amount / 100;
  13877. return new TinyColor({
  13878. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  13879. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  13880. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  13881. a: (rgb2.a - rgb1.a) * p + rgb1.a
  13882. });
  13883. }
  13884. analogous(results = 6, slices = 30) {
  13885. const hsl = this.toHsl();
  13886. const part = 360 / slices;
  13887. const ret = [this];
  13888. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
  13889. hsl.h = (hsl.h + part) % 360;
  13890. ret.push(new TinyColor(hsl));
  13891. }
  13892. return ret;
  13893. }
  13894. complement() {
  13895. const hsl = this.toHsl();
  13896. hsl.h = (hsl.h + 180) % 360;
  13897. return new TinyColor(hsl);
  13898. }
  13899. monochromatic(results = 6) {
  13900. const hsv = this.toHsv();
  13901. const { h } = hsv;
  13902. const { s } = hsv;
  13903. let { v } = hsv;
  13904. const res = [];
  13905. const modification = 1 / results;
  13906. while (results--) {
  13907. res.push(new TinyColor({
  13908. h,
  13909. s,
  13910. v
  13911. }));
  13912. v = (v + modification) % 1;
  13913. }
  13914. return res;
  13915. }
  13916. splitcomplement() {
  13917. const hsl = this.toHsl();
  13918. const { h } = hsl;
  13919. return [
  13920. this,
  13921. new TinyColor({
  13922. h: (h + 72) % 360,
  13923. s: hsl.s,
  13924. l: hsl.l
  13925. }),
  13926. new TinyColor({
  13927. h: (h + 216) % 360,
  13928. s: hsl.s,
  13929. l: hsl.l
  13930. })
  13931. ];
  13932. }
  13933. onBackground(background) {
  13934. const fg = this.toRgb();
  13935. const bg = new TinyColor(background).toRgb();
  13936. const alpha = fg.a + bg.a * (1 - fg.a);
  13937. return new TinyColor({
  13938. r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
  13939. g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
  13940. b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
  13941. a: alpha
  13942. });
  13943. }
  13944. triad() {
  13945. return this.polyad(3);
  13946. }
  13947. tetrad() {
  13948. return this.polyad(4);
  13949. }
  13950. polyad(n) {
  13951. const hsl = this.toHsl();
  13952. const { h } = hsl;
  13953. const result = [this];
  13954. const increment = 360 / n;
  13955. for (let i = 1; i < n; i++) result.push(new TinyColor({
  13956. h: (h + i * increment) % 360,
  13957. s: hsl.s,
  13958. l: hsl.l
  13959. }));
  13960. return result;
  13961. }
  13962. equals(color) {
  13963. const comparedColor = new TinyColor(color);
  13964. if (this.format === "cmyk" || comparedColor.format === "cmyk") return this.toCmykString() === comparedColor.toCmykString();
  13965. return this.toRgbString() === comparedColor.toRgbString();
  13966. }
  13967. };
  13968. //#endregion
  13969. //#region ../../packages/components/button/src/button-custom.ts
  13970. function darken(color, amount = 20) {
  13971. return color.mix("#141414", amount).toString();
  13972. }
  13973. function useButtonCustomStyle(props) {
  13974. const _disabled = useFormDisabled();
  13975. const ns = useNamespace("button");
  13976. return computed(() => {
  13977. let styles = {};
  13978. let buttonColor = props.color;
  13979. if (buttonColor) {
  13980. const match = buttonColor.match(/var\((.*?)\)/);
  13981. if (match) buttonColor = window.getComputedStyle(window.document.documentElement).getPropertyValue(match[1]);
  13982. const color = new TinyColor(buttonColor);
  13983. const activeBgColor = props.dark ? color.tint(20).toString() : darken(color, 20);
  13984. if (props.plain) {
  13985. styles = ns.cssVarBlock({
  13986. "bg-color": props.dark ? darken(color, 90) : color.tint(90).toString(),
  13987. "text-color": buttonColor,
  13988. "border-color": props.dark ? darken(color, 50) : color.tint(50).toString(),
  13989. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  13990. "hover-bg-color": buttonColor,
  13991. "hover-border-color": buttonColor,
  13992. "active-bg-color": activeBgColor,
  13993. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  13994. "active-border-color": activeBgColor
  13995. });
  13996. if (_disabled.value) {
  13997. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color, 90) : color.tint(90).toString();
  13998. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color, 50) : color.tint(50).toString();
  13999. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color, 80) : color.tint(80).toString();
  14000. }
  14001. } else if (props.link || props.text) {
  14002. const hoverColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  14003. styles = ns.cssVarBlock({
  14004. "text-color": buttonColor,
  14005. "hover-text-color": hoverColor,
  14006. "active-text-color": activeBgColor
  14007. });
  14008. if (props.link) {
  14009. styles[ns.cssVarBlockName("hover-link-text-color")] = hoverColor;
  14010. styles[ns.cssVarBlockName("active-color")] = activeBgColor;
  14011. }
  14012. if (_disabled.value) {
  14013. const disabledColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  14014. styles[ns.cssVarBlockName("disabled-bg-color")] = "transparent";
  14015. styles[ns.cssVarBlockName("disabled-text-color")] = disabledColor;
  14016. styles[ns.cssVarBlockName("disabled-border-color")] = "transparent";
  14017. }
  14018. } else {
  14019. const hoverBgColor = props.dark ? darken(color, 30) : color.tint(30).toString();
  14020. const textColor = color.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  14021. styles = ns.cssVarBlock({
  14022. "bg-color": buttonColor,
  14023. "text-color": textColor,
  14024. "border-color": buttonColor,
  14025. "hover-bg-color": hoverBgColor,
  14026. "hover-text-color": textColor,
  14027. "hover-border-color": hoverBgColor,
  14028. "active-bg-color": activeBgColor,
  14029. "active-border-color": activeBgColor
  14030. });
  14031. if (_disabled.value) {
  14032. const disabledButtonColor = props.dark ? darken(color, 50) : color.tint(50).toString();
  14033. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  14034. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  14035. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  14036. }
  14037. }
  14038. }
  14039. return styles;
  14040. });
  14041. }
  14042. //#endregion
  14043. //#region ../../packages/components/button/src/button.vue?vue&type=script&setup=true&lang.ts
  14044. var button_vue_vue_type_script_setup_true_lang_default$1 = /* @__PURE__ */ defineComponent({
  14045. name: "ElButton",
  14046. __name: "button",
  14047. props: buttonProps,
  14048. emits: buttonEmits,
  14049. setup(__props, { expose: __expose, emit: __emit }) {
  14050. const props = __props;
  14051. const emit = __emit;
  14052. const buttonStyle = useButtonCustomStyle(props);
  14053. const ns = useNamespace("button");
  14054. const { _ref, _size, _type, _disabled, _props, _plain, _round, _text, _dashed, shouldAddSpace, handleClick } = useButton(props, emit);
  14055. const buttonKls = computed(() => [
  14056. ns.b(),
  14057. ns.m(_type.value),
  14058. ns.m(_size.value),
  14059. ns.is("disabled", _disabled.value),
  14060. ns.is("loading", props.loading),
  14061. ns.is("plain", _plain.value),
  14062. ns.is("round", _round.value),
  14063. ns.is("circle", props.circle),
  14064. ns.is("text", _text.value),
  14065. ns.is("dashed", _dashed.value),
  14066. ns.is("link", props.link),
  14067. ns.is("has-bg", props.bg)
  14068. ]);
  14069. __expose({
  14070. ref: _ref,
  14071. size: _size,
  14072. type: _type,
  14073. disabled: _disabled,
  14074. shouldAddSpace
  14075. });
  14076. return (_ctx, _cache) => {
  14077. return openBlock(), createBlock(resolveDynamicComponent(__props.tag), mergeProps({
  14078. ref_key: "_ref",
  14079. ref: _ref
  14080. }, unref(_props), {
  14081. class: buttonKls.value,
  14082. style: unref(buttonStyle),
  14083. onClick: unref(handleClick)
  14084. }), {
  14085. default: withCtx(() => [__props.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  14086. key: 1,
  14087. class: normalizeClass(unref(ns).is("loading"))
  14088. }, {
  14089. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.loadingIcon)))]),
  14090. _: 1
  14091. }, 8, ["class"]))], 64)) : __props.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  14092. default: withCtx(() => [__props.icon ? (openBlock(), createBlock(resolveDynamicComponent(__props.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })]),
  14093. _: 3
  14094. })) : createCommentVNode("v-if", true), _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  14095. key: 2,
  14096. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  14097. }, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("v-if", true)]),
  14098. _: 3
  14099. }, 16, [
  14100. "class",
  14101. "style",
  14102. "onClick"
  14103. ]);
  14104. };
  14105. }
  14106. });
  14107. //#endregion
  14108. //#region ../../packages/components/button/src/button.vue
  14109. var button_default$1 = button_vue_vue_type_script_setup_true_lang_default$1;
  14110. //#endregion
  14111. //#region ../../packages/components/button/src/button-group.ts
  14112. const buttonGroupProps = {
  14113. size: buttonProps.size,
  14114. type: buttonProps.type,
  14115. direction: {
  14116. type: definePropType(String),
  14117. values: ["horizontal", "vertical"],
  14118. default: "horizontal"
  14119. }
  14120. };
  14121. //#endregion
  14122. //#region ../../packages/components/button/src/button-group.vue?vue&type=script&setup=true&lang.ts
  14123. var button_group_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  14124. name: "ElButtonGroup",
  14125. __name: "button-group",
  14126. props: buttonGroupProps,
  14127. setup(__props) {
  14128. const props = __props;
  14129. provide(buttonGroupContextKey, reactive({
  14130. size: toRef(props, "size"),
  14131. type: toRef(props, "type")
  14132. }));
  14133. const ns = useNamespace("button");
  14134. return (_ctx, _cache) => {
  14135. return openBlock(), createElementBlock("div", { class: normalizeClass([unref(ns).b("group"), unref(ns).bm("group", props.direction)]) }, [renderSlot(_ctx.$slots, "default")], 2);
  14136. };
  14137. }
  14138. });
  14139. //#endregion
  14140. //#region ../../packages/components/button/src/button-group.vue
  14141. var button_group_default = button_group_vue_vue_type_script_setup_true_lang_default;
  14142. //#endregion
  14143. //#region ../../packages/components/button/index.ts
  14144. const ElButton = withInstall(button_default$1, { ButtonGroup: button_group_default });
  14145. const ElButtonGroup = withNoopInstall(button_group_default);
  14146. //#endregion
  14147. //#region ../../packages/components/calendar/src/calendar.ts
  14148. const isValidRange$1 = (range) => isArray$1(range) && range.length === 2 && range.every((item) => isDate(item));
  14149. const calendarProps = buildProps({
  14150. modelValue: { type: Date },
  14151. range: {
  14152. type: definePropType(Array),
  14153. validator: isValidRange$1
  14154. },
  14155. controllerType: {
  14156. type: String,
  14157. values: ["button", "select"],
  14158. default: "button"
  14159. },
  14160. formatter: { type: definePropType(Function) }
  14161. });
  14162. const calendarEmits = {
  14163. [UPDATE_MODEL_EVENT]: (value) => isDate(value),
  14164. [INPUT_EVENT]: (value) => isDate(value)
  14165. };
  14166. //#endregion
  14167. //#region ../../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/dayjs.min.js
  14168. var require_dayjs_min = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  14169. (function(t, e) {
  14170. "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).dayjs = e();
  14171. })(exports, (function() {
  14172. "use strict";
  14173. var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = {
  14174. name: "en",
  14175. weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),
  14176. months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"),
  14177. ordinal: function(t) {
  14178. var e = [
  14179. "th",
  14180. "st",
  14181. "nd",
  14182. "rd"
  14183. ], n = t % 100;
  14184. return "[" + t + (e[(n - 20) % 10] || e[n] || e[0]) + "]";
  14185. }
  14186. }, m = function(t, e, n) {
  14187. var r = String(t);
  14188. return !r || r.length >= e ? t : "" + Array(e + 1 - r.length).join(n) + t;
  14189. }, v = {
  14190. s: m,
  14191. z: function(t) {
  14192. var e = -t.utcOffset(), n = Math.abs(e), r = Math.floor(n / 60), i = n % 60;
  14193. return (e <= 0 ? "+" : "-") + m(r, 2, "0") + ":" + m(i, 2, "0");
  14194. },
  14195. m: function t(e, n) {
  14196. if (e.date() < n.date()) return -t(n, e);
  14197. var r = 12 * (n.year() - e.year()) + (n.month() - e.month()), i = e.clone().add(r, c), s = n - i < 0, u = e.clone().add(r + (s ? -1 : 1), c);
  14198. return +(-(r + (n - i) / (s ? i - u : u - i)) || 0);
  14199. },
  14200. a: function(t) {
  14201. return t < 0 ? Math.ceil(t) || 0 : Math.floor(t);
  14202. },
  14203. p: function(t) {
  14204. return {
  14205. M: c,
  14206. y: h,
  14207. w: o,
  14208. d: a,
  14209. D: d,
  14210. h: u,
  14211. m: s,
  14212. s: i,
  14213. ms: r,
  14214. Q: f
  14215. }[t] || String(t || "").toLowerCase().replace(/s$/, "");
  14216. },
  14217. u: function(t) {
  14218. return void 0 === t;
  14219. }
  14220. }, g = "en", D = {};
  14221. D[g] = M;
  14222. var p = "$isDayjsObject", S = function(t) {
  14223. return t instanceof _ || !(!t || !t[p]);
  14224. }, w = function t(e, n, r) {
  14225. var i;
  14226. if (!e) return g;
  14227. if ("string" == typeof e) {
  14228. var s = e.toLowerCase();
  14229. D[s] && (i = s), n && (D[s] = n, i = s);
  14230. var u = e.split("-");
  14231. if (!i && u.length > 1) return t(u[0]);
  14232. } else {
  14233. var a = e.name;
  14234. D[a] = e, i = a;
  14235. }
  14236. return !r && i && (g = i), i || !r && g;
  14237. }, O = function(t, e) {
  14238. if (S(t)) return t.clone();
  14239. var n = "object" == typeof e ? e : {};
  14240. return n.date = t, n.args = arguments, new _(n);
  14241. }, b = v;
  14242. b.l = w, b.i = S, b.w = function(t, e) {
  14243. return O(t, {
  14244. locale: e.$L,
  14245. utc: e.$u,
  14246. x: e.$x,
  14247. $offset: e.$offset
  14248. });
  14249. };
  14250. var _ = function() {
  14251. function M(t) {
  14252. this.$L = w(t.locale, null, !0), this.parse(t), this.$x = this.$x || t.x || {}, this[p] = !0;
  14253. }
  14254. var m = M.prototype;
  14255. return m.parse = function(t) {
  14256. this.$d = function(t) {
  14257. var e = t.date, n = t.utc;
  14258. if (null === e) return /* @__PURE__ */ new Date(NaN);
  14259. if (b.u(e)) return /* @__PURE__ */ new Date();
  14260. if (e instanceof Date) return new Date(e);
  14261. if ("string" == typeof e && !/Z$/i.test(e)) {
  14262. var r = e.match($);
  14263. if (r) {
  14264. var i = r[2] - 1 || 0, s = (r[7] || "0").substring(0, 3);
  14265. return n ? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s)) : new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s);
  14266. }
  14267. }
  14268. return new Date(e);
  14269. }(t), this.init();
  14270. }, m.init = function() {
  14271. var t = this.$d;
  14272. this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds();
  14273. }, m.$utils = function() {
  14274. return b;
  14275. }, m.isValid = function() {
  14276. return !(this.$d.toString() === l);
  14277. }, m.isSame = function(t, e) {
  14278. var n = O(t);
  14279. return this.startOf(e) <= n && n <= this.endOf(e);
  14280. }, m.isAfter = function(t, e) {
  14281. return O(t) < this.startOf(e);
  14282. }, m.isBefore = function(t, e) {
  14283. return this.endOf(e) < O(t);
  14284. }, m.$g = function(t, e, n) {
  14285. return b.u(t) ? this[e] : this.set(n, t);
  14286. }, m.unix = function() {
  14287. return Math.floor(this.valueOf() / 1e3);
  14288. }, m.valueOf = function() {
  14289. return this.$d.getTime();
  14290. }, m.startOf = function(t, e) {
  14291. var n = this, r = !!b.u(e) || e, f = b.p(t), l = function(t, e) {
  14292. var i = b.w(n.$u ? Date.UTC(n.$y, e, t) : new Date(n.$y, e, t), n);
  14293. return r ? i : i.endOf(a);
  14294. }, $ = function(t, e) {
  14295. return b.w(n.toDate()[t].apply(n.toDate("s"), (r ? [
  14296. 0,
  14297. 0,
  14298. 0,
  14299. 0
  14300. ] : [
  14301. 23,
  14302. 59,
  14303. 59,
  14304. 999
  14305. ]).slice(e)), n);
  14306. }, y = this.$W, M = this.$M, m = this.$D, v = "set" + (this.$u ? "UTC" : "");
  14307. switch (f) {
  14308. case h: return r ? l(1, 0) : l(31, 11);
  14309. case c: return r ? l(1, M) : l(0, M + 1);
  14310. case o:
  14311. var g = this.$locale().weekStart || 0, D = (y < g ? y + 7 : y) - g;
  14312. return l(r ? m - D : m + (6 - D), M);
  14313. case a:
  14314. case d: return $(v + "Hours", 0);
  14315. case u: return $(v + "Minutes", 1);
  14316. case s: return $(v + "Seconds", 2);
  14317. case i: return $(v + "Milliseconds", 3);
  14318. default: return this.clone();
  14319. }
  14320. }, m.endOf = function(t) {
  14321. return this.startOf(t, !1);
  14322. }, m.$set = function(t, e) {
  14323. var n, o = b.p(t), f = "set" + (this.$u ? "UTC" : ""), l = (n = {}, n[a] = f + "Date", n[d] = f + "Date", n[c] = f + "Month", n[h] = f + "FullYear", n[u] = f + "Hours", n[s] = f + "Minutes", n[i] = f + "Seconds", n[r] = f + "Milliseconds", n)[o], $ = o === a ? this.$D + (e - this.$W) : e;
  14324. if (o === c || o === h) {
  14325. var y = this.clone().set(d, 1);
  14326. y.$d[l]($), y.init(), this.$d = y.set(d, Math.min(this.$D, y.daysInMonth())).$d;
  14327. } else l && this.$d[l]($);
  14328. return this.init(), this;
  14329. }, m.set = function(t, e) {
  14330. return this.clone().$set(t, e);
  14331. }, m.get = function(t) {
  14332. return this[b.p(t)]();
  14333. }, m.add = function(r, f) {
  14334. var d, l = this;
  14335. r = Number(r);
  14336. var $ = b.p(f), y = function(t) {
  14337. var e = O(l);
  14338. return b.w(e.date(e.date() + Math.round(t * r)), l);
  14339. };
  14340. if ($ === c) return this.set(c, this.$M + r);
  14341. if ($ === h) return this.set(h, this.$y + r);
  14342. if ($ === a) return y(1);
  14343. if ($ === o) return y(7);
  14344. var M = (d = {}, d[s] = e, d[u] = n, d[i] = t, d)[$] || 1, m = this.$d.getTime() + r * M;
  14345. return b.w(m, this);
  14346. }, m.subtract = function(t, e) {
  14347. return this.add(-1 * t, e);
  14348. }, m.format = function(t) {
  14349. var e = this, n = this.$locale();
  14350. if (!this.isValid()) return n.invalidDate || l;
  14351. var r = t || "YYYY-MM-DDTHH:mm:ssZ", i = b.z(this), s = this.$H, u = this.$m, a = this.$M, o = n.weekdays, c = n.months, f = n.meridiem, h = function(t, n, i, s) {
  14352. return t && (t[n] || t(e, r)) || i[n].slice(0, s);
  14353. }, d = function(t) {
  14354. return b.s(s % 12 || 12, t, "0");
  14355. }, $ = f || function(t, e, n) {
  14356. var r = t < 12 ? "AM" : "PM";
  14357. return n ? r.toLowerCase() : r;
  14358. };
  14359. return r.replace(y, (function(t, r) {
  14360. return r || function(t) {
  14361. switch (t) {
  14362. case "YY": return String(e.$y).slice(-2);
  14363. case "YYYY": return b.s(e.$y, 4, "0");
  14364. case "M": return a + 1;
  14365. case "MM": return b.s(a + 1, 2, "0");
  14366. case "MMM": return h(n.monthsShort, a, c, 3);
  14367. case "MMMM": return h(c, a);
  14368. case "D": return e.$D;
  14369. case "DD": return b.s(e.$D, 2, "0");
  14370. case "d": return String(e.$W);
  14371. case "dd": return h(n.weekdaysMin, e.$W, o, 2);
  14372. case "ddd": return h(n.weekdaysShort, e.$W, o, 3);
  14373. case "dddd": return o[e.$W];
  14374. case "H": return String(s);
  14375. case "HH": return b.s(s, 2, "0");
  14376. case "h": return d(1);
  14377. case "hh": return d(2);
  14378. case "a": return $(s, u, !0);
  14379. case "A": return $(s, u, !1);
  14380. case "m": return String(u);
  14381. case "mm": return b.s(u, 2, "0");
  14382. case "s": return String(e.$s);
  14383. case "ss": return b.s(e.$s, 2, "0");
  14384. case "SSS": return b.s(e.$ms, 3, "0");
  14385. case "Z": return i;
  14386. }
  14387. return null;
  14388. }(t) || i.replace(":", "");
  14389. }));
  14390. }, m.utcOffset = function() {
  14391. return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
  14392. }, m.diff = function(r, d, l) {
  14393. var $, y = this, M = b.p(d), m = O(r), v = (m.utcOffset() - this.utcOffset()) * e, g = this - m, D = function() {
  14394. return b.m(y, m);
  14395. };
  14396. switch (M) {
  14397. case h:
  14398. $ = D() / 12;
  14399. break;
  14400. case c:
  14401. $ = D();
  14402. break;
  14403. case f:
  14404. $ = D() / 3;
  14405. break;
  14406. case o:
  14407. $ = (g - v) / 6048e5;
  14408. break;
  14409. case a:
  14410. $ = (g - v) / 864e5;
  14411. break;
  14412. case u:
  14413. $ = g / n;
  14414. break;
  14415. case s:
  14416. $ = g / e;
  14417. break;
  14418. case i:
  14419. $ = g / t;
  14420. break;
  14421. default: $ = g;
  14422. }
  14423. return l ? $ : b.a($);
  14424. }, m.daysInMonth = function() {
  14425. return this.endOf(c).$D;
  14426. }, m.$locale = function() {
  14427. return D[this.$L];
  14428. }, m.locale = function(t, e) {
  14429. if (!t) return this.$L;
  14430. var n = this.clone(), r = w(t, e, !0);
  14431. return r && (n.$L = r), n;
  14432. }, m.clone = function() {
  14433. return b.w(this.$d, this);
  14434. }, m.toDate = function() {
  14435. return new Date(this.valueOf());
  14436. }, m.toJSON = function() {
  14437. return this.isValid() ? this.toISOString() : null;
  14438. }, m.toISOString = function() {
  14439. return this.$d.toISOString();
  14440. }, m.toString = function() {
  14441. return this.$d.toUTCString();
  14442. }, M;
  14443. }(), k = _.prototype;
  14444. return O.prototype = k, [
  14445. ["$ms", r],
  14446. ["$s", i],
  14447. ["$m", s],
  14448. ["$H", u],
  14449. ["$W", a],
  14450. ["$M", c],
  14451. ["$y", h],
  14452. ["$D", d]
  14453. ].forEach((function(t) {
  14454. k[t[1]] = function(e) {
  14455. return this.$g(e, t[0], t[1]);
  14456. };
  14457. })), O.extend = function(t, e) {
  14458. return t.$i || (t(e, _, O), t.$i = !0), O;
  14459. }, O.locale = w, O.isDayjs = S, O.unix = function(t) {
  14460. return O(1e3 * t);
  14461. }, O.en = D[g], O.Ls = D, O.p = {}, O;
  14462. }));
  14463. }));
  14464. //#endregion
  14465. //#region ../../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/plugin/customParseFormat.js
  14466. var require_customParseFormat = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  14467. (function(e, t) {
  14468. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_customParseFormat = t();
  14469. })(exports, (function() {
  14470. "use strict";
  14471. var e = {
  14472. LTS: "h:mm:ss A",
  14473. LT: "h:mm A",
  14474. L: "MM/DD/YYYY",
  14475. LL: "MMMM D, YYYY",
  14476. LLL: "MMMM D, YYYY h:mm A",
  14477. LLLL: "dddd, MMMM D, YYYY h:mm A"
  14478. }, t = /(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g, n = /\d/, r = /\d\d/, i = /\d\d?/, o = /\d*[^-_:/,()\s\d]+/, s = {}, a = function(e) {
  14479. return (e = +e) + (e > 68 ? 1900 : 2e3);
  14480. };
  14481. var f = function(e) {
  14482. return function(t) {
  14483. this[e] = +t;
  14484. };
  14485. }, h = [/[+-]\d\d:?(\d\d)?|Z/, function(e) {
  14486. (this.zone || (this.zone = {})).offset = function(e) {
  14487. if (!e) return 0;
  14488. if ("Z" === e) return 0;
  14489. var t = e.match(/([+-]|\d\d)/g), n = 60 * t[1] + (+t[2] || 0);
  14490. return 0 === n ? 0 : "+" === t[0] ? -n : n;
  14491. }(e);
  14492. }], u = function(e) {
  14493. var t = s[e];
  14494. return t && (t.indexOf ? t : t.s.concat(t.f));
  14495. }, d = function(e, t) {
  14496. var n, r = s.meridiem;
  14497. if (r) {
  14498. for (var i = 1; i <= 24; i += 1) if (e.indexOf(r(i, 0, t)) > -1) {
  14499. n = i > 12;
  14500. break;
  14501. }
  14502. } else n = e === (t ? "pm" : "PM");
  14503. return n;
  14504. }, c = {
  14505. A: [o, function(e) {
  14506. this.afternoon = d(e, !1);
  14507. }],
  14508. a: [o, function(e) {
  14509. this.afternoon = d(e, !0);
  14510. }],
  14511. Q: [n, function(e) {
  14512. this.month = 3 * (e - 1) + 1;
  14513. }],
  14514. S: [n, function(e) {
  14515. this.milliseconds = 100 * +e;
  14516. }],
  14517. SS: [r, function(e) {
  14518. this.milliseconds = 10 * +e;
  14519. }],
  14520. SSS: [/\d{3}/, function(e) {
  14521. this.milliseconds = +e;
  14522. }],
  14523. s: [i, f("seconds")],
  14524. ss: [i, f("seconds")],
  14525. m: [i, f("minutes")],
  14526. mm: [i, f("minutes")],
  14527. H: [i, f("hours")],
  14528. h: [i, f("hours")],
  14529. HH: [i, f("hours")],
  14530. hh: [i, f("hours")],
  14531. D: [i, f("day")],
  14532. DD: [r, f("day")],
  14533. Do: [o, function(e) {
  14534. var t = s.ordinal, n = e.match(/\d+/);
  14535. if (this.day = n[0], t) for (var r = 1; r <= 31; r += 1) t(r).replace(/\[|\]/g, "") === e && (this.day = r);
  14536. }],
  14537. w: [i, f("week")],
  14538. ww: [r, f("week")],
  14539. M: [i, f("month")],
  14540. MM: [r, f("month")],
  14541. MMM: [o, function(e) {
  14542. var t = u("months"), n = (u("monthsShort") || t.map((function(e) {
  14543. return e.slice(0, 3);
  14544. }))).indexOf(e) + 1;
  14545. if (n < 1) throw new Error();
  14546. this.month = n % 12 || n;
  14547. }],
  14548. MMMM: [o, function(e) {
  14549. var t = u("months").indexOf(e) + 1;
  14550. if (t < 1) throw new Error();
  14551. this.month = t % 12 || t;
  14552. }],
  14553. Y: [/[+-]?\d+/, f("year")],
  14554. YY: [r, function(e) {
  14555. this.year = a(e);
  14556. }],
  14557. YYYY: [/\d{4}/, f("year")],
  14558. Z: h,
  14559. ZZ: h
  14560. };
  14561. function l(n) {
  14562. var r = n, i = s && s.formats;
  14563. for (var o = (n = r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g, (function(t, n, r) {
  14564. var o = r && r.toUpperCase();
  14565. return n || i[r] || e[r] || i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(e, t, n) {
  14566. return t || n.slice(1);
  14567. }));
  14568. }))).match(t), a = o.length, f = 0; f < a; f += 1) {
  14569. var h = o[f], u = c[h], d = u && u[0], l = u && u[1];
  14570. o[f] = l ? {
  14571. regex: d,
  14572. parser: l
  14573. } : h.replace(/^\[|\]$/g, "");
  14574. }
  14575. return function(e) {
  14576. for (var t = {}, n = 0, r = 0; n < a; n += 1) {
  14577. var i = o[n];
  14578. if ("string" == typeof i) r += i.length;
  14579. else {
  14580. var s = i.regex, f = i.parser, h = e.slice(r), u = s.exec(h)[0];
  14581. f.call(t, u), e = e.replace(u, "");
  14582. }
  14583. }
  14584. return function(e) {
  14585. var t = e.afternoon;
  14586. if (void 0 !== t) {
  14587. var n = e.hours;
  14588. t ? n < 12 && (e.hours += 12) : 12 === n && (e.hours = 0), delete e.afternoon;
  14589. }
  14590. }(t), t;
  14591. };
  14592. }
  14593. return function(e, t, n) {
  14594. n.p.customParseFormat = !0, e && e.parseTwoDigitYear && (a = e.parseTwoDigitYear);
  14595. var r = t.prototype, i = r.parse;
  14596. r.parse = function(e) {
  14597. var t = e.date, r = e.utc, o = e.args;
  14598. this.$u = r;
  14599. var a = o[1];
  14600. if ("string" == typeof a) {
  14601. var f = !0 === o[2], h = !0 === o[3], u = f || h, d = o[2];
  14602. h && (d = o[2]), s = this.$locale(), !f && d && (s = n.Ls[d]), this.$d = function(e, t, n, r) {
  14603. try {
  14604. if (["x", "X"].indexOf(t) > -1) return /* @__PURE__ */ new Date(("X" === t ? 1e3 : 1) * e);
  14605. var i = l(t)(e), o = i.year, s = i.month, a = i.day, f = i.hours, h = i.minutes, u = i.seconds, d = i.milliseconds, c = i.zone, m = i.week, M = /* @__PURE__ */ new Date(), Y = a || (o || s ? 1 : M.getDate()), p = o || M.getFullYear(), v = 0;
  14606. o && !s || (v = s > 0 ? s - 1 : M.getMonth());
  14607. var D, w = f || 0, g = h || 0, y = u || 0, L = d || 0;
  14608. return c ? new Date(Date.UTC(p, v, Y, w, g, y, L + 60 * c.offset * 1e3)) : n ? new Date(Date.UTC(p, v, Y, w, g, y, L)) : (D = new Date(p, v, Y, w, g, y, L), m && (D = r(D).week(m).toDate()), D);
  14609. } catch (e) {
  14610. return /* @__PURE__ */ new Date("");
  14611. }
  14612. }(t, a, r, n), this.init(), d && !0 !== d && (this.$L = this.locale(d).$L), u && t != this.format(a) && (this.$d = /* @__PURE__ */ new Date("")), s = {};
  14613. } else if (a instanceof Array) for (var c = a.length, m = 1; m <= c; m += 1) {
  14614. o[1] = a[m - 1];
  14615. var M = n.apply(this, o);
  14616. if (M.isValid()) {
  14617. this.$d = M.$d, this.$L = M.$L, this.init();
  14618. break;
  14619. }
  14620. m === c && (this.$d = /* @__PURE__ */ new Date(""));
  14621. }
  14622. else i.call(this, e);
  14623. };
  14624. };
  14625. }));
  14626. }));
  14627. //#endregion
  14628. //#region ../../packages/components/time-picker/src/constants.ts
  14629. var import_dayjs_min = /* @__PURE__ */ __toESM(require_dayjs_min());
  14630. var import_customParseFormat = /* @__PURE__ */ __toESM(require_customParseFormat());
  14631. const timeUnits = [
  14632. "hours",
  14633. "minutes",
  14634. "seconds"
  14635. ];
  14636. const PICKER_BASE_INJECTION_KEY = "EP_PICKER_BASE";
  14637. const PICKER_POPPER_OPTIONS_INJECTION_KEY = "ElPopperOptions";
  14638. const ROOT_COMMON_PICKER_INJECTION_KEY = Symbol("commonPickerContextKey");
  14639. const DEFAULT_FORMATS_TIME = "HH:mm:ss";
  14640. const DEFAULT_FORMATS_DATE = "YYYY-MM-DD";
  14641. const DEFAULT_FORMATS_DATEPICKER = {
  14642. date: DEFAULT_FORMATS_DATE,
  14643. dates: DEFAULT_FORMATS_DATE,
  14644. week: "gggg[w]ww",
  14645. year: "YYYY",
  14646. years: "YYYY",
  14647. month: "YYYY-MM",
  14648. months: "YYYY-MM",
  14649. datetime: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`,
  14650. monthrange: "YYYY-MM",
  14651. yearrange: "YYYY",
  14652. daterange: DEFAULT_FORMATS_DATE,
  14653. datetimerange: `${DEFAULT_FORMATS_DATE} ${DEFAULT_FORMATS_TIME}`
  14654. };
  14655. //#endregion
  14656. //#region ../../packages/components/time-picker/src/utils.ts
  14657. const buildTimeList = (value, bound) => {
  14658. return [
  14659. value > 0 ? value - 1 : void 0,
  14660. value,
  14661. value < bound ? value + 1 : void 0
  14662. ];
  14663. };
  14664. const rangeArr = (n) => Array.from(Array.from({ length: n }).keys());
  14665. const extractDateFormat = (format) => {
  14666. return format.replace(/\W?m{1,2}|\W?ZZ/g, "").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi, "").trim();
  14667. };
  14668. const extractTimeFormat = (format) => {
  14669. return format.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?Y{2,4}/g, "").trim();
  14670. };
  14671. const dateEquals = function(a, b) {
  14672. const aIsDate = isDate(a);
  14673. const bIsDate = isDate(b);
  14674. if (aIsDate && bIsDate) return a.getTime() === b.getTime();
  14675. if (!aIsDate && !bIsDate) return a === b;
  14676. return false;
  14677. };
  14678. const valueEquals = function(a, b) {
  14679. const aIsArray = isArray$1(a);
  14680. const bIsArray = isArray$1(b);
  14681. if (aIsArray && bIsArray) {
  14682. if (a.length !== b.length) return false;
  14683. return a.every((item, index) => dateEquals(item, b[index]));
  14684. }
  14685. if (!aIsArray && !bIsArray) return dateEquals(a, b);
  14686. return false;
  14687. };
  14688. const parseDate = function(date, format, lang) {
  14689. const day = isEmpty(format) || format === "x" ? (0, import_dayjs_min.default)(date).locale(lang) : (0, import_dayjs_min.default)(date, format).locale(lang);
  14690. return day.isValid() ? day : void 0;
  14691. };
  14692. const formatter = function(date, format, lang) {
  14693. if (isEmpty(format)) return date;
  14694. if (format === "x") return +date;
  14695. return (0, import_dayjs_min.default)(date).locale(lang).format(format);
  14696. };
  14697. const makeList = (total, method) => {
  14698. const arr = [];
  14699. const disabledArr = method?.();
  14700. for (let i = 0; i < total; i++) arr.push(disabledArr?.includes(i) ?? false);
  14701. return arr;
  14702. };
  14703. const dayOrDaysToDate = (dayOrDays) => {
  14704. return isArray$1(dayOrDays) ? dayOrDays.map((d) => d.toDate()) : dayOrDays.toDate();
  14705. };
  14706. //#endregion
  14707. //#region ../../packages/components/time-picker/src/composables/use-common-picker.ts
  14708. const useCommonPicker = (props, emit) => {
  14709. const { lang } = useLocale();
  14710. const pickerVisible = ref(false);
  14711. const pickerActualVisible = ref(false);
  14712. const userInput = ref(null);
  14713. const valueIsEmpty = computed(() => {
  14714. const { modelValue } = props;
  14715. return !modelValue || isArray$1(modelValue) && !modelValue.filter(Boolean).length;
  14716. });
  14717. const emitInput = (input) => {
  14718. if (!valueEquals(props.modelValue, input)) {
  14719. let formatted;
  14720. if (isArray$1(input)) formatted = input.map((item) => formatter(item, props.valueFormat, lang.value));
  14721. else if (input) formatted = formatter(input, props.valueFormat, lang.value);
  14722. emit(UPDATE_MODEL_EVENT, input ? formatted : input, lang.value);
  14723. }
  14724. };
  14725. const parsedValue = computed(() => {
  14726. let dayOrDays;
  14727. if (valueIsEmpty.value) {
  14728. if (pickerOptions.value.getDefaultValue) dayOrDays = pickerOptions.value.getDefaultValue();
  14729. } else if (isArray$1(props.modelValue)) dayOrDays = props.modelValue.map((d) => parseDate(d, props.valueFormat, lang.value));
  14730. else dayOrDays = parseDate(props.modelValue ?? "", props.valueFormat, lang.value);
  14731. if (pickerOptions.value.getRangeAvailableTime) {
  14732. const availableResult = pickerOptions.value.getRangeAvailableTime(dayOrDays);
  14733. if (!isEqual$1(availableResult, dayOrDays)) {
  14734. dayOrDays = availableResult;
  14735. if (!valueIsEmpty.value) emitInput(dayOrDaysToDate(dayOrDays));
  14736. }
  14737. }
  14738. if (isArray$1(dayOrDays) && dayOrDays.some((day) => !day)) dayOrDays = [];
  14739. return dayOrDays;
  14740. });
  14741. const pickerOptions = ref({});
  14742. const onSetPickerOption = (e) => {
  14743. pickerOptions.value[e[0]] = e[1];
  14744. pickerOptions.value.panelReady = true;
  14745. };
  14746. const onCalendarChange = (e) => {
  14747. emit("calendar-change", e);
  14748. };
  14749. const onPanelChange = (value, mode, view) => {
  14750. emit("panel-change", value, mode, view);
  14751. };
  14752. const onPick = (date = "", visible = false) => {
  14753. pickerVisible.value = visible;
  14754. let result;
  14755. if (isArray$1(date)) result = date.map((_) => _.toDate());
  14756. else result = date ? date.toDate() : date;
  14757. userInput.value = null;
  14758. emitInput(result);
  14759. };
  14760. return {
  14761. parsedValue,
  14762. pickerActualVisible,
  14763. pickerOptions,
  14764. pickerVisible,
  14765. userInput,
  14766. valueIsEmpty,
  14767. emitInput,
  14768. onCalendarChange,
  14769. onPanelChange,
  14770. onPick,
  14771. onSetPickerOption
  14772. };
  14773. };
  14774. //#endregion
  14775. //#region ../../packages/components/time-picker/src/props/shared.ts
  14776. const disabledTimeListsProps = buildProps({
  14777. disabledHours: { type: definePropType(Function) },
  14778. disabledMinutes: { type: definePropType(Function) },
  14779. disabledSeconds: { type: definePropType(Function) }
  14780. });
  14781. const timePanelSharedProps = buildProps({
  14782. visible: Boolean,
  14783. actualVisible: {
  14784. type: Boolean,
  14785. default: void 0
  14786. },
  14787. format: {
  14788. type: String,
  14789. default: ""
  14790. }
  14791. });
  14792. //#endregion
  14793. //#region ../../packages/components/time-picker/src/common/props.ts
  14794. const timePickerDefaultProps = buildProps({
  14795. automaticDropdown: {
  14796. type: Boolean,
  14797. default: true
  14798. },
  14799. id: { type: definePropType([Array, String]) },
  14800. name: { type: definePropType([Array, String]) },
  14801. popperClass: useTooltipContentProps.popperClass,
  14802. popperStyle: useTooltipContentProps.popperStyle,
  14803. format: String,
  14804. valueFormat: String,
  14805. dateFormat: String,
  14806. timeFormat: String,
  14807. type: {
  14808. type: String,
  14809. default: ""
  14810. },
  14811. clearable: {
  14812. type: Boolean,
  14813. default: true
  14814. },
  14815. clearIcon: {
  14816. type: definePropType([String, Object]),
  14817. default: circle_close_default
  14818. },
  14819. editable: {
  14820. type: Boolean,
  14821. default: true
  14822. },
  14823. saveOnBlur: {
  14824. type: Boolean,
  14825. default: true
  14826. },
  14827. prefixIcon: {
  14828. type: definePropType([String, Object]),
  14829. default: ""
  14830. },
  14831. size: useSizeProp,
  14832. readonly: Boolean,
  14833. disabled: {
  14834. type: Boolean,
  14835. default: void 0
  14836. },
  14837. placeholder: {
  14838. type: String,
  14839. default: ""
  14840. },
  14841. popperOptions: {
  14842. type: definePropType(Object),
  14843. default: () => ({})
  14844. },
  14845. modelValue: {
  14846. type: definePropType([
  14847. Date,
  14848. Array,
  14849. String,
  14850. Number
  14851. ]),
  14852. default: ""
  14853. },
  14854. rangeSeparator: {
  14855. type: String,
  14856. default: "-"
  14857. },
  14858. startPlaceholder: String,
  14859. endPlaceholder: String,
  14860. defaultValue: { type: definePropType([Date, Array]) },
  14861. defaultTime: { type: definePropType([Date, Array]) },
  14862. isRange: Boolean,
  14863. ...disabledTimeListsProps,
  14864. disabledDate: { type: Function },
  14865. cellClassName: { type: Function },
  14866. shortcuts: {
  14867. type: Array,
  14868. default: () => []
  14869. },
  14870. arrowControl: Boolean,
  14871. tabindex: {
  14872. type: definePropType([String, Number]),
  14873. default: 0
  14874. },
  14875. validateEvent: {
  14876. type: Boolean,
  14877. default: true
  14878. },
  14879. unlinkPanels: Boolean,
  14880. singlePanel: Boolean,
  14881. placement: {
  14882. type: definePropType(String),
  14883. values: Ee,
  14884. default: "bottom"
  14885. },
  14886. fallbackPlacements: {
  14887. type: definePropType(Array),
  14888. default: [
  14889. "bottom",
  14890. "top",
  14891. "right",
  14892. "left"
  14893. ]
  14894. },
  14895. ...useEmptyValuesProps,
  14896. ...useAriaProps(["ariaLabel"]),
  14897. showNow: {
  14898. type: Boolean,
  14899. default: true
  14900. },
  14901. showConfirm: {
  14902. type: Boolean,
  14903. default: true
  14904. },
  14905. showFooter: {
  14906. type: Boolean,
  14907. default: true
  14908. },
  14909. showWeekNumber: Boolean
  14910. });
  14911. const timePickerRangeTriggerProps = buildProps({
  14912. id: { type: definePropType(Array) },
  14913. name: { type: definePropType(Array) },
  14914. modelValue: { type: definePropType([Array, String]) },
  14915. startPlaceholder: String,
  14916. endPlaceholder: String,
  14917. disabled: Boolean
  14918. });
  14919. const timePickerRngeTriggerProps = timePickerRangeTriggerProps;
  14920. //#endregion
  14921. //#region ../../packages/components/time-picker/src/common/picker-range-trigger.vue?vue&type=script&setup=true&lang.ts
  14922. const _hoisted_1$72 = [
  14923. "id",
  14924. "name",
  14925. "placeholder",
  14926. "value",
  14927. "disabled"
  14928. ];
  14929. const _hoisted_2$41 = [
  14930. "id",
  14931. "name",
  14932. "placeholder",
  14933. "value",
  14934. "disabled"
  14935. ];
  14936. var picker_range_trigger_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  14937. name: "PickerRangeTrigger",
  14938. inheritAttrs: false,
  14939. __name: "picker-range-trigger",
  14940. props: timePickerRangeTriggerProps,
  14941. emits: [
  14942. "mouseenter",
  14943. "mouseleave",
  14944. "click",
  14945. "touchstart",
  14946. "focus",
  14947. "blur",
  14948. "startInput",
  14949. "endInput",
  14950. "startChange",
  14951. "endChange"
  14952. ],
  14953. setup(__props, { expose: __expose, emit: __emit }) {
  14954. const props = __props;
  14955. const emit = __emit;
  14956. const { formItem } = useFormItem();
  14957. const { inputId } = useFormItemInputId(reactive({ id: computed(() => props.id?.[0]) }), { formItemContext: formItem });
  14958. const attrs = useAttrs();
  14959. const nsDate = useNamespace("date");
  14960. const nsRange = useNamespace("range");
  14961. const inputRef = ref();
  14962. const endInputRef = ref();
  14963. const { wrapperRef, isFocused } = useFocusController(inputRef, { disabled: computed(() => props.disabled) });
  14964. const handleClick = (evt) => {
  14965. emit("click", evt);
  14966. };
  14967. const handleMouseEnter = (evt) => {
  14968. emit("mouseenter", evt);
  14969. };
  14970. const handleMouseLeave = (evt) => {
  14971. emit("mouseleave", evt);
  14972. };
  14973. const handleTouchStart = (evt) => {
  14974. emit("touchstart", evt);
  14975. };
  14976. const handleStartInput = (evt) => {
  14977. emit("startInput", evt);
  14978. };
  14979. const handleEndInput = (evt) => {
  14980. emit("endInput", evt);
  14981. };
  14982. const handleStartChange = (evt) => {
  14983. emit("startChange", evt);
  14984. };
  14985. const handleEndChange = (evt) => {
  14986. emit("endChange", evt);
  14987. };
  14988. const focus = () => {
  14989. inputRef.value?.focus();
  14990. };
  14991. const blur = () => {
  14992. inputRef.value?.blur();
  14993. endInputRef.value?.blur();
  14994. };
  14995. __expose({
  14996. focus,
  14997. blur
  14998. });
  14999. return (_ctx, _cache) => {
  15000. return openBlock(), createElementBlock("div", {
  15001. ref_key: "wrapperRef",
  15002. ref: wrapperRef,
  15003. class: normalizeClass([unref(nsDate).is("active", unref(isFocused)), _ctx.$attrs.class]),
  15004. style: normalizeStyle(_ctx.$attrs.style),
  15005. onClick: handleClick,
  15006. onMouseenter: handleMouseEnter,
  15007. onMouseleave: handleMouseLeave,
  15008. onTouchstartPassive: handleTouchStart
  15009. }, [
  15010. renderSlot(_ctx.$slots, "prefix"),
  15011. createElementVNode("input", mergeProps(unref(attrs), {
  15012. id: unref(inputId),
  15013. ref_key: "inputRef",
  15014. ref: inputRef,
  15015. name: _ctx.name && _ctx.name[0],
  15016. placeholder: _ctx.startPlaceholder,
  15017. value: _ctx.modelValue && _ctx.modelValue[0],
  15018. class: unref(nsRange).b("input"),
  15019. disabled: _ctx.disabled,
  15020. onInput: handleStartInput,
  15021. onChange: handleStartChange
  15022. }), null, 16, _hoisted_1$72),
  15023. renderSlot(_ctx.$slots, "range-separator"),
  15024. createElementVNode("input", mergeProps(unref(attrs), {
  15025. id: _ctx.id && _ctx.id[1],
  15026. ref_key: "endInputRef",
  15027. ref: endInputRef,
  15028. name: _ctx.name && _ctx.name[1],
  15029. placeholder: _ctx.endPlaceholder,
  15030. value: _ctx.modelValue && _ctx.modelValue[1],
  15031. class: unref(nsRange).b("input"),
  15032. disabled: _ctx.disabled,
  15033. onInput: handleEndInput,
  15034. onChange: handleEndChange
  15035. }), null, 16, _hoisted_2$41),
  15036. renderSlot(_ctx.$slots, "suffix")
  15037. ], 38);
  15038. };
  15039. }
  15040. });
  15041. //#endregion
  15042. //#region ../../packages/components/time-picker/src/common/picker-range-trigger.vue
  15043. var picker_range_trigger_default = picker_range_trigger_vue_vue_type_script_setup_true_lang_default;
  15044. //#endregion
  15045. //#region ../../packages/components/time-picker/src/common/picker.vue?vue&type=script&setup=true&lang.ts
  15046. var picker_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  15047. name: "Picker",
  15048. __name: "picker",
  15049. props: timePickerDefaultProps,
  15050. emits: [
  15051. UPDATE_MODEL_EVENT,
  15052. CHANGE_EVENT,
  15053. "focus",
  15054. "blur",
  15055. "clear",
  15056. "calendar-change",
  15057. "panel-change",
  15058. "visible-change",
  15059. "keydown"
  15060. ],
  15061. setup(__props, { expose: __expose, emit: __emit }) {
  15062. const props = __props;
  15063. const emit = __emit;
  15064. const attrs = useAttrs$1();
  15065. const nsDate = useNamespace("date");
  15066. const nsInput = useNamespace("input");
  15067. const nsRange = useNamespace("range");
  15068. const { formItem } = useFormItem();
  15069. const elPopperOptions = inject(PICKER_POPPER_OPTIONS_INJECTION_KEY, {});
  15070. const emptyValues = useEmptyValues(props, null);
  15071. const refPopper = ref();
  15072. const inputRef = ref();
  15073. const valueOnOpen = ref(null);
  15074. let hasJustTabExitedInput = false;
  15075. const pickerDisabled = useFormDisabled();
  15076. const commonPicker = useCommonPicker(props, emit);
  15077. const { parsedValue, pickerActualVisible, userInput, pickerVisible, pickerOptions, valueIsEmpty, emitInput, onPick, onSetPickerOption, onCalendarChange, onPanelChange } = commonPicker;
  15078. const { isFocused, handleFocus, handleBlur } = useFocusController(inputRef, {
  15079. disabled: pickerDisabled,
  15080. beforeFocus() {
  15081. return props.readonly;
  15082. },
  15083. afterFocus() {
  15084. if (!props.automaticDropdown) return;
  15085. pickerVisible.value = true;
  15086. },
  15087. beforeBlur(event) {
  15088. return !hasJustTabExitedInput && refPopper.value?.isFocusInsideContent(event);
  15089. },
  15090. afterBlur() {
  15091. if (isTimePicker.value && !props.saveOnBlur) {
  15092. if (!valueIsEmpty.value) pickerOptions.value.handleCancel?.();
  15093. } else handleChange();
  15094. pickerVisible.value = false;
  15095. hasJustTabExitedInput = false;
  15096. props.validateEvent && formItem?.validate("blur").catch(NOOP);
  15097. }
  15098. });
  15099. const hovering = ref(false);
  15100. const rangeInputKls = computed(() => [
  15101. nsDate.b("editor"),
  15102. nsDate.bm("editor", props.type),
  15103. nsInput.e("wrapper"),
  15104. nsDate.is("disabled", pickerDisabled.value),
  15105. nsDate.is("active", pickerVisible.value),
  15106. nsRange.b("editor"),
  15107. pickerSize ? nsRange.bm("editor", pickerSize.value) : "",
  15108. attrs.class
  15109. ]);
  15110. const clearIconKls = computed(() => [
  15111. nsInput.e("icon"),
  15112. nsRange.e("close-icon"),
  15113. !showClearBtn.value ? nsRange.em("close-icon", "hidden") : ""
  15114. ]);
  15115. watch(pickerVisible, (val) => {
  15116. if (!val) {
  15117. userInput.value = null;
  15118. nextTick(() => {
  15119. emitChange(props.modelValue);
  15120. });
  15121. } else nextTick(() => {
  15122. if (val) valueOnOpen.value = props.modelValue;
  15123. });
  15124. });
  15125. const emitChange = (val, isClear) => {
  15126. if (isClear || !valueEquals(val, valueOnOpen.value)) {
  15127. emit(CHANGE_EVENT, val);
  15128. isClear && (valueOnOpen.value = val);
  15129. props.validateEvent && formItem?.validate("change").catch(NOOP);
  15130. }
  15131. };
  15132. const emitKeydown = (e) => {
  15133. emit("keydown", e);
  15134. };
  15135. const refInput = computed(() => {
  15136. if (inputRef.value) return Array.from(inputRef.value.$el.querySelectorAll("input"));
  15137. return [];
  15138. });
  15139. const setSelectionRange = (start, end, pos) => {
  15140. const _inputs = refInput.value;
  15141. if (!_inputs.length) return;
  15142. if (!pos || pos === "min") {
  15143. _inputs[0].setSelectionRange(start, end);
  15144. _inputs[0].focus();
  15145. } else if (pos === "max") {
  15146. _inputs[1].setSelectionRange(start, end);
  15147. _inputs[1].focus();
  15148. }
  15149. };
  15150. const onBeforeShow = () => {
  15151. pickerActualVisible.value = true;
  15152. };
  15153. const onShow = () => {
  15154. emit("visible-change", true);
  15155. };
  15156. const onHide = () => {
  15157. pickerActualVisible.value = false;
  15158. pickerVisible.value = false;
  15159. emit("visible-change", false);
  15160. };
  15161. const handleOpen = () => {
  15162. pickerVisible.value = true;
  15163. };
  15164. const handleClose = () => {
  15165. pickerVisible.value = false;
  15166. };
  15167. const displayValue = computed(() => {
  15168. const formattedValue = formatToString(parsedValue.value);
  15169. if (isArray$1(userInput.value)) return [userInput.value[0] ?? (formattedValue && formattedValue[0]) ?? "", userInput.value[1] ?? (formattedValue && formattedValue[1]) ?? ""];
  15170. else if (userInput.value !== null) return userInput.value;
  15171. if (isTimePicker.value && valueIsEmpty.value && !props.saveOnBlur) return "";
  15172. if (!isTimePicker.value && valueIsEmpty.value) return "";
  15173. if (!pickerVisible.value && valueIsEmpty.value) return "";
  15174. if (formattedValue) return isDatesPicker.value || isMonthsPicker.value || isYearsPicker.value ? formattedValue.join(", ") : formattedValue;
  15175. return "";
  15176. });
  15177. const isTimeLikePicker = computed(() => props.type.includes("time"));
  15178. const isTimePicker = computed(() => props.type.startsWith("time"));
  15179. const isDatesPicker = computed(() => props.type === "dates");
  15180. const isMonthsPicker = computed(() => props.type === "months");
  15181. const isYearsPicker = computed(() => props.type === "years");
  15182. const triggerIcon = computed(() => props.prefixIcon || (isTimeLikePicker.value ? clock_default : calendar_default$1));
  15183. const showClearBtn = computed(() => props.clearable && !pickerDisabled.value && !props.readonly && !valueIsEmpty.value && (hovering.value || isFocused.value));
  15184. const onClear = (event) => {
  15185. if (props.readonly || pickerDisabled.value) return;
  15186. if (showClearBtn.value) {
  15187. event?.stopPropagation();
  15188. if (pickerOptions.value.handleClear) pickerOptions.value.handleClear();
  15189. else emitInput(emptyValues.valueOnClear.value);
  15190. emitChange(emptyValues.valueOnClear.value, true);
  15191. onHide();
  15192. }
  15193. emit("clear");
  15194. };
  15195. const onMouseDownInput = async (event) => {
  15196. if (props.readonly || pickerDisabled.value) return;
  15197. if (event.target?.tagName !== "INPUT" || isFocused.value || !props.automaticDropdown) pickerVisible.value = true;
  15198. };
  15199. const onMouseEnter = () => {
  15200. if (props.readonly || pickerDisabled.value) return;
  15201. if (!valueIsEmpty.value && props.clearable) hovering.value = true;
  15202. };
  15203. const onMouseLeave = () => {
  15204. hovering.value = false;
  15205. };
  15206. const onTouchStartInput = (event) => {
  15207. if (props.readonly || pickerDisabled.value) return;
  15208. if (event.touches[0].target?.tagName !== "INPUT" || isFocused.value || !props.automaticDropdown) pickerVisible.value = true;
  15209. };
  15210. const isRangeInput = computed(() => {
  15211. return props.type.includes("range");
  15212. });
  15213. const pickerSize = useFormSize();
  15214. const popperEl = computed(() => unref(refPopper)?.popperRef?.contentRef);
  15215. const stophandle = onClickOutside(inputRef, (e) => {
  15216. const unrefedPopperEl = unref(popperEl);
  15217. const inputEl = unrefElement(inputRef);
  15218. if (unrefedPopperEl && (e.target === unrefedPopperEl || e.composedPath().includes(unrefedPopperEl)) || e.target === inputEl || inputEl && e.composedPath().includes(inputEl)) return;
  15219. pickerVisible.value = false;
  15220. });
  15221. onBeforeUnmount(() => {
  15222. stophandle?.();
  15223. });
  15224. const handleChange = () => {
  15225. if (isTimePicker.value && !props.saveOnBlur) return;
  15226. const isRangeEmpty = isArray$1(userInput.value) && userInput.value.every((v) => v === "");
  15227. if (userInput.value && !isRangeEmpty) {
  15228. const value = parseUserInputToDayjs(displayValue.value);
  15229. if (value) {
  15230. if (isValidValue(value)) emitInput(dayOrDaysToDate(value));
  15231. userInput.value = null;
  15232. }
  15233. }
  15234. if (userInput.value === "" || isRangeEmpty) {
  15235. emitInput(emptyValues.valueOnClear.value);
  15236. emitChange(emptyValues.valueOnClear.value, true);
  15237. userInput.value = null;
  15238. }
  15239. };
  15240. const parseUserInputToDayjs = (value) => {
  15241. if (!value) return null;
  15242. return pickerOptions.value.parseUserInput(value);
  15243. };
  15244. const formatToString = (value) => {
  15245. if (!value) return null;
  15246. return isArray$1(value) ? value.map((_) => _.format(props.format)) : value.format(props.format);
  15247. };
  15248. const isValidValue = (value) => {
  15249. return pickerOptions.value.isValidValue(value);
  15250. };
  15251. const handleKeydownInput = async (event) => {
  15252. if (props.readonly || pickerDisabled.value) return;
  15253. const code = getEventCode(event);
  15254. emitKeydown(event);
  15255. if (code === EVENT_CODE.esc) {
  15256. if (pickerVisible.value === true) {
  15257. pickerVisible.value = false;
  15258. event.preventDefault();
  15259. event.stopPropagation();
  15260. }
  15261. return;
  15262. }
  15263. if (code === EVENT_CODE.down) {
  15264. if (pickerOptions.value.handleFocusPicker) {
  15265. event.preventDefault();
  15266. event.stopPropagation();
  15267. }
  15268. if (pickerVisible.value === false) {
  15269. pickerVisible.value = true;
  15270. await nextTick();
  15271. }
  15272. if (pickerOptions.value.handleFocusPicker) {
  15273. pickerOptions.value.handleFocusPicker();
  15274. return;
  15275. }
  15276. }
  15277. if (code === EVENT_CODE.tab) {
  15278. hasJustTabExitedInput = true;
  15279. return;
  15280. }
  15281. if (code === EVENT_CODE.enter || code === EVENT_CODE.numpadEnter) {
  15282. if (!pickerVisible.value) pickerVisible.value = true;
  15283. else if (userInput.value === null || userInput.value === "" || isValidValue(parseUserInputToDayjs(displayValue.value))) {
  15284. handleChange();
  15285. pickerVisible.value = false;
  15286. }
  15287. event.preventDefault();
  15288. event.stopPropagation();
  15289. return;
  15290. }
  15291. if (userInput.value) {
  15292. event.stopPropagation();
  15293. return;
  15294. }
  15295. if (pickerOptions.value.handleKeydownInput) pickerOptions.value.handleKeydownInput(event);
  15296. };
  15297. const onUserInput = (e) => {
  15298. userInput.value = e;
  15299. if (!pickerVisible.value) pickerVisible.value = true;
  15300. };
  15301. const handleStartInput = (event) => {
  15302. const target = event.target;
  15303. if (userInput.value) userInput.value = [target.value, userInput.value[1]];
  15304. else userInput.value = [target.value, null];
  15305. };
  15306. const handleEndInput = (event) => {
  15307. const target = event.target;
  15308. if (userInput.value) userInput.value = [userInput.value[0], target.value];
  15309. else userInput.value = [null, target.value];
  15310. };
  15311. const handleStartChange = () => {
  15312. const values = userInput.value;
  15313. const value = parseUserInputToDayjs(values && values[0]);
  15314. const parsedVal = unref(parsedValue);
  15315. if (value && value.isValid()) {
  15316. userInput.value = [formatToString(value), displayValue.value?.[1] || null];
  15317. const newValue = [value, parsedVal && (parsedVal[1] || null)];
  15318. if (isValidValue(newValue)) {
  15319. emitInput(dayOrDaysToDate(newValue));
  15320. userInput.value = null;
  15321. }
  15322. }
  15323. };
  15324. const handleEndChange = () => {
  15325. const values = unref(userInput);
  15326. const value = parseUserInputToDayjs(values && values[1]);
  15327. const parsedVal = unref(parsedValue);
  15328. if (value && value.isValid()) {
  15329. userInput.value = [unref(displayValue)?.[0] || null, formatToString(value)];
  15330. const newValue = [parsedVal && parsedVal[0], value];
  15331. if (isValidValue(newValue)) {
  15332. emitInput(dayOrDaysToDate(newValue));
  15333. userInput.value = null;
  15334. }
  15335. }
  15336. };
  15337. const focus = () => {
  15338. inputRef.value?.focus();
  15339. };
  15340. const blur = () => {
  15341. inputRef.value?.blur();
  15342. };
  15343. provide(PICKER_BASE_INJECTION_KEY, {
  15344. props,
  15345. emptyValues
  15346. });
  15347. provide(ROOT_COMMON_PICKER_INJECTION_KEY, commonPicker);
  15348. __expose({
  15349. focus,
  15350. blur,
  15351. handleOpen,
  15352. handleClose,
  15353. onPick
  15354. });
  15355. return (_ctx, _cache) => {
  15356. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  15357. ref_key: "refPopper",
  15358. ref: refPopper,
  15359. visible: unref(pickerVisible),
  15360. effect: "light",
  15361. pure: "",
  15362. trigger: "click"
  15363. }, _ctx.$attrs, {
  15364. role: "dialog",
  15365. teleported: "",
  15366. transition: `${unref(nsDate).namespace.value}-zoom-in-top`,
  15367. "popper-class": [`${unref(nsDate).namespace.value}-picker__popper`, _ctx.popperClass],
  15368. "popper-style": _ctx.popperStyle,
  15369. "popper-options": unref(elPopperOptions),
  15370. "fallback-placements": _ctx.fallbackPlacements,
  15371. "gpu-acceleration": false,
  15372. placement: _ctx.placement,
  15373. "stop-popper-mouse-event": false,
  15374. "hide-after": 0,
  15375. persistent: "",
  15376. onBeforeShow,
  15377. onShow,
  15378. onHide
  15379. }), {
  15380. default: withCtx(() => [!isRangeInput.value ? (openBlock(), createBlock(unref(ElInput), {
  15381. key: 0,
  15382. id: _ctx.id,
  15383. ref_key: "inputRef",
  15384. ref: inputRef,
  15385. "container-role": "combobox",
  15386. "model-value": displayValue.value,
  15387. name: _ctx.name,
  15388. size: unref(pickerSize),
  15389. disabled: unref(pickerDisabled),
  15390. placeholder: _ctx.placeholder,
  15391. class: normalizeClass([
  15392. unref(nsDate).b("editor"),
  15393. unref(nsDate).bm("editor", _ctx.type),
  15394. unref(nsDate).is("focus", unref(pickerVisible)),
  15395. _ctx.$attrs.class
  15396. ]),
  15397. style: normalizeStyle(_ctx.$attrs.style),
  15398. readonly: !_ctx.editable || _ctx.readonly || isDatesPicker.value || isMonthsPicker.value || isYearsPicker.value || _ctx.type === "week",
  15399. "aria-label": _ctx.ariaLabel,
  15400. tabindex: _ctx.tabindex,
  15401. "validate-event": false,
  15402. onInput: onUserInput,
  15403. onFocus: unref(handleFocus),
  15404. onBlur: unref(handleBlur),
  15405. onKeydown: handleKeydownInput,
  15406. onChange: handleChange,
  15407. onMousedown: onMouseDownInput,
  15408. onMouseenter: onMouseEnter,
  15409. onMouseleave: onMouseLeave,
  15410. onTouchstartPassive: onTouchStartInput,
  15411. onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
  15412. }, {
  15413. prefix: withCtx(() => [triggerIcon.value ? (openBlock(), createBlock(unref(ElIcon), {
  15414. key: 0,
  15415. class: normalizeClass(unref(nsInput).e("icon")),
  15416. onMousedown: withModifiers(onMouseDownInput, ["prevent"]),
  15417. onTouchstartPassive: onTouchStartInput
  15418. }, {
  15419. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(triggerIcon.value)))]),
  15420. _: 1
  15421. }, 8, ["class"])) : createCommentVNode("v-if", true)]),
  15422. suffix: withCtx(() => [showClearBtn.value && _ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
  15423. key: 0,
  15424. class: normalizeClass(`${unref(nsInput).e("icon")} clear-icon`),
  15425. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  15426. onClick: onClear
  15427. }, {
  15428. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))]),
  15429. _: 1
  15430. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)]),
  15431. _: 1
  15432. }, 8, [
  15433. "id",
  15434. "model-value",
  15435. "name",
  15436. "size",
  15437. "disabled",
  15438. "placeholder",
  15439. "class",
  15440. "style",
  15441. "readonly",
  15442. "aria-label",
  15443. "tabindex",
  15444. "onFocus",
  15445. "onBlur"
  15446. ])) : (openBlock(), createBlock(picker_range_trigger_default, {
  15447. key: 1,
  15448. id: _ctx.id,
  15449. ref_key: "inputRef",
  15450. ref: inputRef,
  15451. "model-value": displayValue.value,
  15452. name: _ctx.name,
  15453. disabled: unref(pickerDisabled),
  15454. readonly: !_ctx.editable || _ctx.readonly,
  15455. "start-placeholder": _ctx.startPlaceholder,
  15456. "end-placeholder": _ctx.endPlaceholder,
  15457. class: normalizeClass(rangeInputKls.value),
  15458. style: normalizeStyle(_ctx.$attrs.style),
  15459. "aria-label": _ctx.ariaLabel,
  15460. tabindex: _ctx.tabindex,
  15461. autocomplete: "off",
  15462. role: "combobox",
  15463. onClick: onMouseDownInput,
  15464. onFocus: unref(handleFocus),
  15465. onBlur: unref(handleBlur),
  15466. onStartInput: handleStartInput,
  15467. onStartChange: handleStartChange,
  15468. onEndInput: handleEndInput,
  15469. onEndChange: handleEndChange,
  15470. onMousedown: onMouseDownInput,
  15471. onMouseenter: onMouseEnter,
  15472. onMouseleave: onMouseLeave,
  15473. onTouchstartPassive: onTouchStartInput,
  15474. onKeydown: handleKeydownInput
  15475. }, {
  15476. prefix: withCtx(() => [triggerIcon.value ? (openBlock(), createBlock(unref(ElIcon), {
  15477. key: 0,
  15478. class: normalizeClass([unref(nsInput).e("icon"), unref(nsRange).e("icon")])
  15479. }, {
  15480. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(triggerIcon.value)))]),
  15481. _: 1
  15482. }, 8, ["class"])) : createCommentVNode("v-if", true)]),
  15483. "range-separator": withCtx(() => [renderSlot(_ctx.$slots, "range-separator", {}, () => [createElementVNode("span", { class: normalizeClass(unref(nsRange).b("separator")) }, toDisplayString(_ctx.rangeSeparator), 3)])]),
  15484. suffix: withCtx(() => [_ctx.clearIcon ? (openBlock(), createBlock(unref(ElIcon), {
  15485. key: 0,
  15486. class: normalizeClass(clearIconKls.value),
  15487. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  15488. onClick: onClear
  15489. }, {
  15490. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))]),
  15491. _: 1
  15492. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true)]),
  15493. _: 3
  15494. }, 8, [
  15495. "id",
  15496. "model-value",
  15497. "name",
  15498. "disabled",
  15499. "readonly",
  15500. "start-placeholder",
  15501. "end-placeholder",
  15502. "class",
  15503. "style",
  15504. "aria-label",
  15505. "tabindex",
  15506. "onFocus",
  15507. "onBlur"
  15508. ]))]),
  15509. content: withCtx(() => [renderSlot(_ctx.$slots, "default", {
  15510. visible: unref(pickerVisible),
  15511. actualVisible: unref(pickerActualVisible),
  15512. parsedValue: unref(parsedValue),
  15513. format: _ctx.format,
  15514. dateFormat: _ctx.dateFormat,
  15515. timeFormat: _ctx.timeFormat,
  15516. unlinkPanels: _ctx.unlinkPanels,
  15517. type: _ctx.type,
  15518. defaultValue: _ctx.defaultValue,
  15519. showNow: _ctx.showNow,
  15520. showConfirm: _ctx.showConfirm,
  15521. showFooter: _ctx.showFooter,
  15522. showWeekNumber: _ctx.showWeekNumber,
  15523. singlePanel: _ctx.singlePanel,
  15524. onPick: _cache[1] || (_cache[1] = (...args) => unref(onPick) && unref(onPick)(...args)),
  15525. onSelectRange: setSelectionRange,
  15526. onSetPickerOption: _cache[2] || (_cache[2] = (...args) => unref(onSetPickerOption) && unref(onSetPickerOption)(...args)),
  15527. onCalendarChange: _cache[3] || (_cache[3] = (...args) => unref(onCalendarChange) && unref(onCalendarChange)(...args)),
  15528. onClear,
  15529. onPanelChange: _cache[4] || (_cache[4] = (...args) => unref(onPanelChange) && unref(onPanelChange)(...args)),
  15530. onMousedown: _cache[5] || (_cache[5] = withModifiers(() => {}, ["stop"]))
  15531. })]),
  15532. _: 3
  15533. }, 16, [
  15534. "visible",
  15535. "transition",
  15536. "popper-class",
  15537. "popper-style",
  15538. "popper-options",
  15539. "fallback-placements",
  15540. "placement"
  15541. ]);
  15542. };
  15543. }
  15544. });
  15545. //#endregion
  15546. //#region ../../packages/components/time-picker/src/common/picker.vue
  15547. var picker_default = picker_vue_vue_type_script_setup_true_lang_default;
  15548. //#endregion
  15549. //#region ../../packages/components/time-picker/src/props/panel-time-picker.ts
  15550. const panelTimePickerProps = buildProps({
  15551. ...timePanelSharedProps,
  15552. datetimeRole: String,
  15553. parsedValue: { type: definePropType(Object) }
  15554. });
  15555. //#endregion
  15556. //#region ../../packages/components/time-picker/src/composables/use-time-panel.ts
  15557. const useTimePanel = ({ getAvailableHours, getAvailableMinutes, getAvailableSeconds }) => {
  15558. const getAvailableTime = (date, role, first, compareDate) => {
  15559. const availableTimeGetters = {
  15560. hour: getAvailableHours,
  15561. minute: getAvailableMinutes,
  15562. second: getAvailableSeconds
  15563. };
  15564. let result = date;
  15565. [
  15566. "hour",
  15567. "minute",
  15568. "second"
  15569. ].forEach((type) => {
  15570. if (availableTimeGetters[type]) {
  15571. let availableTimeSlots;
  15572. const method = availableTimeGetters[type];
  15573. switch (type) {
  15574. case "minute":
  15575. availableTimeSlots = method(result.hour(), role, compareDate);
  15576. break;
  15577. case "second":
  15578. availableTimeSlots = method(result.hour(), result.minute(), role, compareDate);
  15579. break;
  15580. default:
  15581. availableTimeSlots = method(role, compareDate);
  15582. break;
  15583. }
  15584. if (availableTimeSlots?.length && !availableTimeSlots.includes(result[type]())) {
  15585. const pos = first ? 0 : availableTimeSlots.length - 1;
  15586. result = result[type](availableTimeSlots[pos]);
  15587. }
  15588. }
  15589. });
  15590. return result;
  15591. };
  15592. const timePickerOptions = {};
  15593. const onSetOption = ([key, val]) => {
  15594. timePickerOptions[key] = val;
  15595. };
  15596. return {
  15597. timePickerOptions,
  15598. getAvailableTime,
  15599. onSetOption
  15600. };
  15601. };
  15602. //#endregion
  15603. //#region ../../packages/components/time-picker/src/composables/use-time-picker.ts
  15604. const makeAvailableArr = (disabledList) => {
  15605. const trueOrNumber = (isDisabled, index) => isDisabled || index;
  15606. const getNumber = (predicate) => predicate !== true;
  15607. return disabledList.map(trueOrNumber).filter(getNumber);
  15608. };
  15609. const getTimeLists = (disabledHours, disabledMinutes, disabledSeconds) => {
  15610. const getHoursList = (role, compare) => {
  15611. return makeList(24, disabledHours && (() => disabledHours?.(role, compare)));
  15612. };
  15613. const getMinutesList = (hour, role, compare) => {
  15614. return makeList(60, disabledMinutes && (() => disabledMinutes?.(hour, role, compare)));
  15615. };
  15616. const getSecondsList = (hour, minute, role, compare) => {
  15617. return makeList(60, disabledSeconds && (() => disabledSeconds?.(hour, minute, role, compare)));
  15618. };
  15619. return {
  15620. getHoursList,
  15621. getMinutesList,
  15622. getSecondsList
  15623. };
  15624. };
  15625. const buildAvailableTimeSlotGetter = (disabledHours, disabledMinutes, disabledSeconds) => {
  15626. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(disabledHours, disabledMinutes, disabledSeconds);
  15627. const getAvailableHours = (role, compare) => {
  15628. return makeAvailableArr(getHoursList(role, compare));
  15629. };
  15630. const getAvailableMinutes = (hour, role, compare) => {
  15631. return makeAvailableArr(getMinutesList(hour, role, compare));
  15632. };
  15633. const getAvailableSeconds = (hour, minute, role, compare) => {
  15634. return makeAvailableArr(getSecondsList(hour, minute, role, compare));
  15635. };
  15636. return {
  15637. getAvailableHours,
  15638. getAvailableMinutes,
  15639. getAvailableSeconds
  15640. };
  15641. };
  15642. const useOldValue = (props, options) => {
  15643. const oldValue = ref(props.parsedValue);
  15644. watch(() => props.visible, (val) => {
  15645. const modelValue = toValue(options.modelValue);
  15646. const valueOnClear = toValue(options.valueOnClear);
  15647. if (val && modelValue === valueOnClear) {
  15648. oldValue.value = valueOnClear;
  15649. return;
  15650. }
  15651. if (!val) oldValue.value = props.parsedValue;
  15652. });
  15653. return oldValue;
  15654. };
  15655. //#endregion
  15656. //#region ../../packages/directives/click-outside/index.ts
  15657. const nodeList = /* @__PURE__ */ new Map();
  15658. if (isClient) {
  15659. let startClick;
  15660. document.addEventListener("mousedown", (e) => startClick = e);
  15661. document.addEventListener("mouseup", (e) => {
  15662. if (startClick) {
  15663. for (const handlers of nodeList.values()) for (const { documentHandler } of handlers) documentHandler(e, startClick);
  15664. startClick = void 0;
  15665. }
  15666. });
  15667. }
  15668. function createDocumentHandler(el, binding) {
  15669. let excludes = [];
  15670. if (isArray$1(binding.arg)) excludes = binding.arg;
  15671. else if (isElement$1(binding.arg)) excludes.push(binding.arg);
  15672. return function(mouseup, mousedown) {
  15673. const popperRef = binding.instance.popperRef;
  15674. const mouseUpTarget = mouseup.target;
  15675. const mouseDownTarget = mousedown?.target;
  15676. const isBound = !binding || !binding.instance;
  15677. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  15678. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  15679. const isSelf = el === mouseUpTarget;
  15680. const isTargetExcluded = excludes.length && excludes.some((item) => item?.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  15681. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  15682. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) return;
  15683. binding.value(mouseup, mousedown);
  15684. };
  15685. }
  15686. const ClickOutside = {
  15687. beforeMount(el, binding) {
  15688. if (!nodeList.has(el)) nodeList.set(el, []);
  15689. nodeList.get(el).push({
  15690. documentHandler: createDocumentHandler(el, binding),
  15691. bindingFn: binding.value
  15692. });
  15693. },
  15694. updated(el, binding) {
  15695. if (!nodeList.has(el)) nodeList.set(el, []);
  15696. const handlers = nodeList.get(el);
  15697. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  15698. const newHandler = {
  15699. documentHandler: createDocumentHandler(el, binding),
  15700. bindingFn: binding.value
  15701. };
  15702. if (oldHandlerIndex >= 0) handlers.splice(oldHandlerIndex, 1, newHandler);
  15703. else handlers.push(newHandler);
  15704. },
  15705. unmounted(el) {
  15706. nodeList.delete(el);
  15707. }
  15708. };
  15709. //#endregion
  15710. //#region ../../packages/directives/repeat-click/index.ts
  15711. const REPEAT_INTERVAL = 100;
  15712. const REPEAT_DELAY = 600;
  15713. const SCOPE$6 = "_RepeatClick";
  15714. const vRepeatClick = {
  15715. beforeMount(el, binding) {
  15716. const value = binding.value;
  15717. const { interval = 100, delay = 600 } = isFunction$1(value) ? {} : value;
  15718. let intervalId;
  15719. let delayId;
  15720. const handler = () => isFunction$1(value) ? value() : value.handler();
  15721. const clear = () => {
  15722. if (delayId) {
  15723. clearTimeout(delayId);
  15724. delayId = void 0;
  15725. }
  15726. if (intervalId) {
  15727. clearInterval(intervalId);
  15728. intervalId = void 0;
  15729. }
  15730. };
  15731. const start = (evt) => {
  15732. if (evt.button !== 0) return;
  15733. clear();
  15734. handler();
  15735. document.addEventListener("mouseup", clear, { once: true });
  15736. delayId = setTimeout(() => {
  15737. intervalId = setInterval(() => {
  15738. handler();
  15739. }, interval);
  15740. }, delay);
  15741. };
  15742. el[SCOPE$6] = {
  15743. start,
  15744. clear
  15745. };
  15746. el.addEventListener("mousedown", start);
  15747. },
  15748. unmounted(el) {
  15749. if (!el[SCOPE$6]) return;
  15750. const { start, clear } = el[SCOPE$6];
  15751. if (start) el.removeEventListener("mousedown", start);
  15752. if (clear) {
  15753. clear();
  15754. document.removeEventListener("mouseup", clear);
  15755. }
  15756. el[SCOPE$6] = null;
  15757. }
  15758. };
  15759. //#endregion
  15760. //#region ../../packages/directives/trap-focus/index.ts
  15761. const FOCUSABLE_CHILDREN = "_trap-focus-children";
  15762. const FOCUS_STACK = [];
  15763. const FOCUS_HANDLER = (e) => {
  15764. if (FOCUS_STACK.length === 0) return;
  15765. const code = getEventCode(e);
  15766. const focusableElement = FOCUS_STACK[FOCUS_STACK.length - 1][FOCUSABLE_CHILDREN];
  15767. if (focusableElement.length > 0 && code === EVENT_CODE.tab) {
  15768. if (focusableElement.length === 1) {
  15769. e.preventDefault();
  15770. if (document.activeElement !== focusableElement[0]) focusableElement[0].focus();
  15771. return;
  15772. }
  15773. const goingBackward = e.shiftKey;
  15774. const isFirst = e.target === focusableElement[0];
  15775. const isLast = e.target === focusableElement[focusableElement.length - 1];
  15776. if (isFirst && goingBackward) {
  15777. e.preventDefault();
  15778. focusableElement[focusableElement.length - 1].focus();
  15779. }
  15780. if (isLast && !goingBackward) {
  15781. e.preventDefault();
  15782. focusableElement[0].focus();
  15783. }
  15784. }
  15785. };
  15786. const TrapFocus = {
  15787. beforeMount(el) {
  15788. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  15789. FOCUS_STACK.push(el);
  15790. if (FOCUS_STACK.length <= 1) document.addEventListener("keydown", FOCUS_HANDLER);
  15791. },
  15792. updated(el) {
  15793. nextTick(() => {
  15794. el[FOCUSABLE_CHILDREN] = obtainAllFocusableElements$1(el);
  15795. });
  15796. },
  15797. unmounted() {
  15798. FOCUS_STACK.shift();
  15799. if (FOCUS_STACK.length === 0) document.removeEventListener("keydown", FOCUS_HANDLER);
  15800. }
  15801. };
  15802. //#endregion
  15803. //#region ../../node_modules/.pnpm/normalize-wheel-es@1.2.0/node_modules/normalize-wheel-es/dist/index.mjs
  15804. var v = !1, o, f, s, u, d, N, l, p, m, w, D, x, E, M, F;
  15805. function a() {
  15806. if (!v) {
  15807. v = !0;
  15808. 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);
  15809. 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) {
  15810. o = n[1] ? parseFloat(n[1]) : n[5] ? parseFloat(n[5]) : NaN, o && document && document.documentMode && (o = document.documentMode);
  15811. var r = /(?:Trident\/(\d+.\d+))/.exec(e);
  15812. 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;
  15813. } else o = f = s = d = u = NaN;
  15814. if (i) {
  15815. if (i[1]) {
  15816. var t = /(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(e);
  15817. l = t ? parseFloat(t[1].replace("_", ".")) : !0;
  15818. } else l = !1;
  15819. p = !!i[2], m = !!i[3];
  15820. } else l = p = m = !1;
  15821. }
  15822. }
  15823. var _ = {
  15824. ie: function() {
  15825. return a() || o;
  15826. },
  15827. ieCompatibilityMode: function() {
  15828. return a() || N > o;
  15829. },
  15830. ie64: function() {
  15831. return _.ie() && D;
  15832. },
  15833. firefox: function() {
  15834. return a() || f;
  15835. },
  15836. opera: function() {
  15837. return a() || s;
  15838. },
  15839. webkit: function() {
  15840. return a() || u;
  15841. },
  15842. safari: function() {
  15843. return _.webkit();
  15844. },
  15845. chrome: function() {
  15846. return a() || d;
  15847. },
  15848. windows: function() {
  15849. return a() || p;
  15850. },
  15851. osx: function() {
  15852. return a() || l;
  15853. },
  15854. linux: function() {
  15855. return a() || m;
  15856. },
  15857. iphone: function() {
  15858. return a() || x;
  15859. },
  15860. mobile: function() {
  15861. return a() || x || E || w || F;
  15862. },
  15863. nativeApp: function() {
  15864. return a() || M;
  15865. },
  15866. android: function() {
  15867. return a() || w;
  15868. },
  15869. ipad: function() {
  15870. return a() || E;
  15871. }
  15872. }, A = _;
  15873. var c = !!(typeof window < "u" && window.document && window.document.createElement), h$1 = {
  15874. canUseDOM: c,
  15875. canUseWorkers: typeof Worker < "u",
  15876. canUseEventListeners: c && !!(window.addEventListener || window.attachEvent),
  15877. canUseViewport: c && !!window.screen,
  15878. isInWorker: !c
  15879. };
  15880. var X;
  15881. h$1.canUseDOM && (X = document.implementation && document.implementation.hasFeature && document.implementation.hasFeature("", "") !== !0);
  15882. function S(e, n) {
  15883. if (!h$1.canUseDOM || n && !("addEventListener" in document)) return !1;
  15884. var i = "on" + e, r = i in document;
  15885. if (!r) {
  15886. var t = document.createElement("div");
  15887. t.setAttribute(i, "return;"), r = typeof t[i] == "function";
  15888. }
  15889. return !r && X && e === "wheel" && (r = document.implementation.hasFeature("Events.wheel", "3.0")), r;
  15890. }
  15891. var b = S;
  15892. var O = 10, I = 40, P = 800;
  15893. function T(e) {
  15894. var n = 0, i = 0, r = 0, t = 0;
  15895. 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), {
  15896. spinX: n,
  15897. spinY: i,
  15898. pixelX: r,
  15899. pixelY: t
  15900. };
  15901. }
  15902. T.getEventType = function() {
  15903. return A.firefox() ? "DOMMouseScroll" : b("wheel") ? "wheel" : "mousewheel";
  15904. };
  15905. var Y = T;
  15906. /**
  15907. * Checks if an event is supported in the current execution environment.
  15908. *
  15909. * NOTE: This will not work correctly for non-generic events such as `change`,
  15910. * `reset`, `load`, `error`, and `select`.
  15911. *
  15912. * Borrows from Modernizr.
  15913. *
  15914. * @param {string} eventNameSuffix Event name, e.g. "click".
  15915. * @param {?boolean} capture Check if the capture phase is supported.
  15916. * @return {boolean} True if the event is supported.
  15917. * @internal
  15918. * @license Modernizr 3.0.0pre (Custom Build) | MIT
  15919. */
  15920. //#endregion
  15921. //#region ../../packages/directives/mousewheel/index.ts
  15922. const SCOPE$5 = "_Mousewheel";
  15923. const mousewheel = function(element, callback) {
  15924. if (element && element.addEventListener) {
  15925. removeWheelHandler(element);
  15926. const fn = function(event) {
  15927. const normalized = Y(event);
  15928. callback && Reflect.apply(callback, this, [event, normalized]);
  15929. };
  15930. element[SCOPE$5] = { wheelHandler: fn };
  15931. element.addEventListener("wheel", fn, { passive: true });
  15932. }
  15933. };
  15934. const removeWheelHandler = (element) => {
  15935. if (element["_Mousewheel"]?.wheelHandler) {
  15936. element.removeEventListener("wheel", element[SCOPE$5].wheelHandler);
  15937. element[SCOPE$5] = null;
  15938. }
  15939. };
  15940. const Mousewheel = {
  15941. beforeMount(el, binding) {
  15942. mousewheel(el, binding.value);
  15943. },
  15944. unmounted(el) {
  15945. removeWheelHandler(el);
  15946. },
  15947. updated(el, binding) {
  15948. if (binding.value !== binding.oldValue) mousewheel(el, binding.value);
  15949. }
  15950. };
  15951. //#endregion
  15952. //#region ../../packages/components/time-picker/src/props/basic-time-spinner.ts
  15953. const basicTimeSpinnerProps = buildProps({
  15954. role: {
  15955. type: String,
  15956. required: true
  15957. },
  15958. spinnerDate: {
  15959. type: definePropType(Object),
  15960. required: true
  15961. },
  15962. showSeconds: {
  15963. type: Boolean,
  15964. default: true
  15965. },
  15966. arrowControl: Boolean,
  15967. amPmMode: {
  15968. type: definePropType(String),
  15969. default: ""
  15970. },
  15971. ...disabledTimeListsProps
  15972. });
  15973. //#endregion
  15974. //#region ../../packages/components/time-picker/src/time-picker-com/basic-time-spinner.vue?vue&type=script&setup=true&lang.ts
  15975. const _hoisted_1$71 = ["onClick"];
  15976. const _hoisted_2$40 = ["onMouseenter"];
  15977. var basic_time_spinner_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  15978. __name: "basic-time-spinner",
  15979. props: basicTimeSpinnerProps,
  15980. emits: [
  15981. CHANGE_EVENT,
  15982. "select-range",
  15983. "set-option"
  15984. ],
  15985. setup(__props, { emit: __emit }) {
  15986. const props = __props;
  15987. const { isRange, format, saveOnBlur } = inject(PICKER_BASE_INJECTION_KEY).props;
  15988. const emit = __emit;
  15989. const ns = useNamespace("time");
  15990. const { getHoursList, getMinutesList, getSecondsList } = getTimeLists(props.disabledHours, props.disabledMinutes, props.disabledSeconds);
  15991. let isScrolling = false;
  15992. const ignoreScroll = {
  15993. hours: false,
  15994. minutes: false,
  15995. seconds: false
  15996. };
  15997. const currentScrollbar = ref();
  15998. const listRefsMap = {
  15999. hours: ref(),
  16000. minutes: ref(),
  16001. seconds: ref()
  16002. };
  16003. const spinnerItems = computed(() => {
  16004. return props.showSeconds ? timeUnits : timeUnits.slice(0, 2);
  16005. });
  16006. const timePartials = computed(() => {
  16007. const { spinnerDate } = props;
  16008. return {
  16009. hours: spinnerDate.hour(),
  16010. minutes: spinnerDate.minute(),
  16011. seconds: spinnerDate.second()
  16012. };
  16013. });
  16014. const timeList = computed(() => {
  16015. const { hours, minutes } = unref(timePartials);
  16016. const { role, spinnerDate } = props;
  16017. const compare = !isRange ? spinnerDate : void 0;
  16018. return {
  16019. hours: getHoursList(role, compare),
  16020. minutes: getMinutesList(hours, role, compare),
  16021. seconds: getSecondsList(hours, minutes, role, compare)
  16022. };
  16023. });
  16024. const arrowControlTimeList = computed(() => {
  16025. const { hours, minutes, seconds } = unref(timePartials);
  16026. return {
  16027. hours: buildTimeList(hours, 23),
  16028. minutes: buildTimeList(minutes, 59),
  16029. seconds: buildTimeList(seconds, 59)
  16030. };
  16031. });
  16032. const debouncedResetScroll = debounce((type) => {
  16033. isScrolling = false;
  16034. adjustCurrentSpinner(type);
  16035. }, 200);
  16036. const getAmPmFlag = (hour) => {
  16037. if (!!!props.amPmMode) return "";
  16038. const isCapital = props.amPmMode === "A";
  16039. let content = hour < 12 ? " am" : " pm";
  16040. if (isCapital) content = content.toUpperCase();
  16041. return content;
  16042. };
  16043. const emitSelectRange = (type) => {
  16044. let range = [0, 0];
  16045. const actualFormat = format || "HH:mm:ss";
  16046. const hourIndex = actualFormat.indexOf("HH");
  16047. const minuteIndex = actualFormat.indexOf("mm");
  16048. const secondIndex = actualFormat.indexOf("ss");
  16049. switch (type) {
  16050. case "hours":
  16051. if (hourIndex !== -1) range = [hourIndex, hourIndex + 2];
  16052. break;
  16053. case "minutes":
  16054. if (minuteIndex !== -1) range = [minuteIndex, minuteIndex + 2];
  16055. break;
  16056. case "seconds":
  16057. if (secondIndex !== -1) range = [secondIndex, secondIndex + 2];
  16058. break;
  16059. }
  16060. const [left, right] = range;
  16061. emit("select-range", left, right);
  16062. currentScrollbar.value = type;
  16063. };
  16064. const adjustCurrentSpinner = (type) => {
  16065. adjustSpinner(type, unref(timePartials)[type]);
  16066. };
  16067. const adjustSpinners = () => {
  16068. adjustCurrentSpinner("hours");
  16069. adjustCurrentSpinner("minutes");
  16070. adjustCurrentSpinner("seconds");
  16071. };
  16072. const getScrollbarElement = (el) => el.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  16073. const adjustSpinner = (type, value) => {
  16074. if (props.arrowControl) return;
  16075. const scrollbar = unref(listRefsMap[type]);
  16076. if (scrollbar && scrollbar.$el) {
  16077. if (!saveOnBlur) {
  16078. ignoreScroll[type] = true;
  16079. rAF(() => {
  16080. ignoreScroll[type] = false;
  16081. });
  16082. }
  16083. getScrollbarElement(scrollbar.$el).scrollTop = Math.max(0, value * typeItemHeight(type));
  16084. }
  16085. };
  16086. const typeItemHeight = (type) => {
  16087. const listItem = unref(listRefsMap[type])?.$el.querySelector("li");
  16088. if (listItem) return Number.parseFloat(getStyle(listItem, "height")) || 0;
  16089. return 0;
  16090. };
  16091. const onIncrement = () => {
  16092. scrollDown(1);
  16093. };
  16094. const onDecrement = () => {
  16095. scrollDown(-1);
  16096. };
  16097. const scrollDown = (step) => {
  16098. if (!currentScrollbar.value) emitSelectRange("hours");
  16099. const label = currentScrollbar.value;
  16100. const now = unref(timePartials)[label];
  16101. const next = findNextUnDisabled(label, now, step, currentScrollbar.value === "hours" ? 24 : 60);
  16102. modifyDateField(label, next);
  16103. adjustSpinner(label, next);
  16104. nextTick(() => emitSelectRange(label));
  16105. };
  16106. const findNextUnDisabled = (type, now, step, total) => {
  16107. let next = (now + step + total) % total;
  16108. const list = unref(timeList)[type];
  16109. while (list[next] && next !== now) next = (next + step + total) % total;
  16110. return next;
  16111. };
  16112. const modifyDateField = (type, value) => {
  16113. if (unref(timeList)[type][value]) return;
  16114. const { hours, minutes, seconds } = unref(timePartials);
  16115. let changeTo;
  16116. switch (type) {
  16117. case "hours":
  16118. changeTo = props.spinnerDate.hour(value).minute(minutes).second(seconds);
  16119. break;
  16120. case "minutes":
  16121. changeTo = props.spinnerDate.hour(hours).minute(value).second(seconds);
  16122. break;
  16123. case "seconds":
  16124. changeTo = props.spinnerDate.hour(hours).minute(minutes).second(value);
  16125. break;
  16126. }
  16127. emit(CHANGE_EVENT, changeTo);
  16128. };
  16129. const handleClick = (type, { value, disabled }) => {
  16130. if (!disabled) {
  16131. modifyDateField(type, value);
  16132. emitSelectRange(type);
  16133. adjustSpinner(type, value);
  16134. }
  16135. };
  16136. const handleScroll = (type) => {
  16137. if (!saveOnBlur && ignoreScroll[type]) return;
  16138. const scrollbar = unref(listRefsMap[type]);
  16139. if (!scrollbar) return;
  16140. isScrolling = true;
  16141. debouncedResetScroll(type);
  16142. modifyDateField(type, Math.min(Math.round((getScrollbarElement(scrollbar.$el).scrollTop - (scrollBarHeight(type) * .5 - 10) / typeItemHeight(type) + 3) / typeItemHeight(type)), type === "hours" ? 23 : 59));
  16143. };
  16144. const scrollBarHeight = (type) => {
  16145. return unref(listRefsMap[type]).$el.offsetHeight;
  16146. };
  16147. const bindScrollEvent = () => {
  16148. const bindFunction = (type) => {
  16149. const scrollbar = unref(listRefsMap[type]);
  16150. if (scrollbar && scrollbar.$el) getScrollbarElement(scrollbar.$el).onscroll = () => {
  16151. handleScroll(type);
  16152. };
  16153. };
  16154. bindFunction("hours");
  16155. bindFunction("minutes");
  16156. bindFunction("seconds");
  16157. };
  16158. onMounted(() => {
  16159. nextTick(() => {
  16160. !props.arrowControl && bindScrollEvent();
  16161. adjustSpinners();
  16162. if (props.role === "start") emitSelectRange("hours");
  16163. });
  16164. });
  16165. const setRef = (scrollbar, type) => {
  16166. listRefsMap[type].value = scrollbar ?? void 0;
  16167. };
  16168. emit("set-option", [`${props.role}_scrollDown`, scrollDown]);
  16169. emit("set-option", [`${props.role}_emitSelectRange`, emitSelectRange]);
  16170. watch(() => props.spinnerDate, () => {
  16171. if (isScrolling) return;
  16172. adjustSpinners();
  16173. });
  16174. return (_ctx, _cache) => {
  16175. return openBlock(), createElementBlock("div", { class: normalizeClass([unref(ns).b("spinner"), { "has-seconds": _ctx.showSeconds }]) }, [!_ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(spinnerItems.value, (item) => {
  16176. return openBlock(), createBlock(unref(ElScrollbar), {
  16177. key: item,
  16178. ref_for: true,
  16179. ref: (scrollbar) => setRef(scrollbar, item),
  16180. class: normalizeClass(unref(ns).be("spinner", "wrapper")),
  16181. "wrap-style": "max-height: inherit;",
  16182. "view-class": unref(ns).be("spinner", "list"),
  16183. noresize: "",
  16184. tag: "ul",
  16185. onMouseenter: ($event) => emitSelectRange(item),
  16186. onMousemove: ($event) => adjustCurrentSpinner(item)
  16187. }, {
  16188. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(timeList.value[item], (disabled, key) => {
  16189. return openBlock(), createElementBlock("li", {
  16190. key,
  16191. class: normalizeClass([
  16192. unref(ns).be("spinner", "item"),
  16193. unref(ns).is("active", key === timePartials.value[item]),
  16194. unref(ns).is("disabled", disabled)
  16195. ]),
  16196. onClick: ($event) => handleClick(item, {
  16197. value: key,
  16198. disabled
  16199. })
  16200. }, [item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? key % 12 || 12 : key)).slice(-2)) + toDisplayString(getAmPmFlag(key)), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(("0" + key).slice(-2)), 1)], 64))], 10, _hoisted_1$71);
  16201. }), 128))]),
  16202. _: 2
  16203. }, 1032, [
  16204. "class",
  16205. "view-class",
  16206. "onMouseenter",
  16207. "onMousemove"
  16208. ]);
  16209. }), 128)) : createCommentVNode("v-if", true), _ctx.arrowControl ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(spinnerItems.value, (item) => {
  16210. return openBlock(), createElementBlock("div", {
  16211. key: item,
  16212. class: normalizeClass([unref(ns).be("spinner", "wrapper"), unref(ns).is("arrow")]),
  16213. onMouseenter: ($event) => emitSelectRange(item)
  16214. }, [
  16215. withDirectives((openBlock(), createBlock(unref(ElIcon), { class: normalizeClass(["arrow-up", unref(ns).be("spinner", "arrow")]) }, {
  16216. default: withCtx(() => [createVNode(unref(arrow_up_default))]),
  16217. _: 1
  16218. }, 8, ["class"])), [[unref(vRepeatClick), onDecrement]]),
  16219. withDirectives((openBlock(), createBlock(unref(ElIcon), { class: normalizeClass(["arrow-down", unref(ns).be("spinner", "arrow")]) }, {
  16220. default: withCtx(() => [createVNode(unref(arrow_down_default))]),
  16221. _: 1
  16222. }, 8, ["class"])), [[unref(vRepeatClick), onIncrement]]),
  16223. createElementVNode("ul", { class: normalizeClass(unref(ns).be("spinner", "list")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(arrowControlTimeList.value[item], (time, key) => {
  16224. return openBlock(), createElementBlock("li", {
  16225. key,
  16226. class: normalizeClass([
  16227. unref(ns).be("spinner", "item"),
  16228. unref(ns).is("active", time === timePartials.value[item]),
  16229. unref(ns).is("disabled", timeList.value[item][time])
  16230. ])
  16231. }, [unref(isNumber)(time) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [item === "hours" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(("0" + (_ctx.amPmMode ? time % 12 || 12 : time)).slice(-2)) + toDisplayString(getAmPmFlag(time)), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(("0" + time).slice(-2)), 1)], 64))], 64)) : createCommentVNode("v-if", true)], 2);
  16232. }), 128))], 2)
  16233. ], 42, _hoisted_2$40);
  16234. }), 128)) : createCommentVNode("v-if", true)], 2);
  16235. };
  16236. }
  16237. });
  16238. //#endregion
  16239. //#region ../../packages/components/time-picker/src/time-picker-com/basic-time-spinner.vue
  16240. var basic_time_spinner_default = basic_time_spinner_vue_vue_type_script_setup_true_lang_default;
  16241. //#endregion
  16242. //#region ../../packages/components/time-picker/src/time-picker-com/panel-time-pick.vue?vue&type=script&setup=true&lang.ts
  16243. var panel_time_pick_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  16244. __name: "panel-time-pick",
  16245. props: panelTimePickerProps,
  16246. emits: [
  16247. "pick",
  16248. "select-range",
  16249. "set-picker-option"
  16250. ],
  16251. setup(__props, { emit: __emit }) {
  16252. const props = __props;
  16253. const emit = __emit;
  16254. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  16255. const { arrowControl, disabledHours, disabledMinutes, disabledSeconds, defaultValue } = pickerBase.props;
  16256. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours, disabledMinutes, disabledSeconds);
  16257. const ns = useNamespace("time");
  16258. const { t, lang } = useLocale();
  16259. const selectionRange = ref([0, 2]);
  16260. const oldValue = useOldValue(props, {
  16261. modelValue: computed(() => pickerBase.props.modelValue),
  16262. valueOnClear: computed(() => pickerBase?.emptyValues ? pickerBase.emptyValues.valueOnClear.value : null)
  16263. });
  16264. const transitionName = computed(() => {
  16265. return isUndefined(props.actualVisible) ? `${ns.namespace.value}-zoom-in-top` : "";
  16266. });
  16267. const showSeconds = computed(() => {
  16268. return props.format.includes("ss");
  16269. });
  16270. const amPmMode = computed(() => {
  16271. if (props.format.includes("A")) return "A";
  16272. if (props.format.includes("a")) return "a";
  16273. return "";
  16274. });
  16275. const isValidValue = (_date) => {
  16276. const parsedDate = (0, import_dayjs_min.default)(_date).locale(lang.value);
  16277. const result = getRangeAvailableTime(parsedDate);
  16278. return parsedDate.isSame(result);
  16279. };
  16280. const handleCancel = () => {
  16281. const old = oldValue.value;
  16282. emit("pick", old, false);
  16283. nextTick(() => {
  16284. oldValue.value = old;
  16285. });
  16286. };
  16287. const handleConfirm = (visible = false, first = false) => {
  16288. if (first) return;
  16289. emit("pick", props.parsedValue, visible);
  16290. };
  16291. const handleChange = (_date) => {
  16292. if (!props.visible) return;
  16293. emit("pick", getRangeAvailableTime(_date).millisecond(0), true);
  16294. };
  16295. const setSelectionRange = (start, end) => {
  16296. emit("select-range", start, end);
  16297. selectionRange.value = [start, end];
  16298. };
  16299. const changeSelectionRange = (step) => {
  16300. const actualFormat = props.format;
  16301. const hourIndex = actualFormat.indexOf("HH");
  16302. const minuteIndex = actualFormat.indexOf("mm");
  16303. const secondIndex = actualFormat.indexOf("ss");
  16304. const list = [];
  16305. const mapping = [];
  16306. if (hourIndex !== -1) {
  16307. list.push(hourIndex);
  16308. mapping.push("hours");
  16309. }
  16310. if (minuteIndex !== -1) {
  16311. list.push(minuteIndex);
  16312. mapping.push("minutes");
  16313. }
  16314. if (secondIndex !== -1 && showSeconds.value) {
  16315. list.push(secondIndex);
  16316. mapping.push("seconds");
  16317. }
  16318. const next = (list.indexOf(selectionRange.value[0]) + step + list.length) % list.length;
  16319. timePickerOptions["start_emitSelectRange"](mapping[next]);
  16320. };
  16321. const handleKeydown = (event) => {
  16322. const code = getEventCode(event);
  16323. const { left, right, up, down } = EVENT_CODE;
  16324. if ([left, right].includes(code)) {
  16325. changeSelectionRange(code === left ? -1 : 1);
  16326. event.preventDefault();
  16327. return;
  16328. }
  16329. if ([up, down].includes(code)) {
  16330. const step = code === up ? -1 : 1;
  16331. timePickerOptions["start_scrollDown"](step);
  16332. event.preventDefault();
  16333. return;
  16334. }
  16335. };
  16336. const { timePickerOptions, onSetOption, getAvailableTime } = useTimePanel({
  16337. getAvailableHours,
  16338. getAvailableMinutes,
  16339. getAvailableSeconds
  16340. });
  16341. const getRangeAvailableTime = (date) => {
  16342. return getAvailableTime(date, props.datetimeRole || "", true);
  16343. };
  16344. const parseUserInput = (value) => {
  16345. if (!value) return null;
  16346. return (0, import_dayjs_min.default)(value, props.format).locale(lang.value);
  16347. };
  16348. const getDefaultValue = () => {
  16349. return (0, import_dayjs_min.default)(defaultValue).locale(lang.value);
  16350. };
  16351. emit("set-picker-option", ["isValidValue", isValidValue]);
  16352. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  16353. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  16354. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  16355. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  16356. emit("set-picker-option", ["handleCancel", handleCancel]);
  16357. return (_ctx, _cache) => {
  16358. return openBlock(), createBlock(Transition, { name: transitionName.value }, {
  16359. default: withCtx(() => [_ctx.actualVisible || _ctx.visible ? (openBlock(), createElementBlock("div", {
  16360. key: 0,
  16361. class: normalizeClass(unref(ns).b("panel"))
  16362. }, [createElementVNode("div", { class: normalizeClass([unref(ns).be("panel", "content"), { "has-seconds": showSeconds.value }]) }, [createVNode(basic_time_spinner_default, {
  16363. ref: "spinner",
  16364. role: _ctx.datetimeRole || "start",
  16365. "arrow-control": unref(arrowControl),
  16366. "show-seconds": showSeconds.value,
  16367. "am-pm-mode": amPmMode.value,
  16368. "spinner-date": _ctx.parsedValue,
  16369. "disabled-hours": unref(disabledHours),
  16370. "disabled-minutes": unref(disabledMinutes),
  16371. "disabled-seconds": unref(disabledSeconds),
  16372. onChange: handleChange,
  16373. onSetOption: unref(onSetOption),
  16374. onSelectRange: setSelectionRange
  16375. }, null, 8, [
  16376. "role",
  16377. "arrow-control",
  16378. "show-seconds",
  16379. "am-pm-mode",
  16380. "spinner-date",
  16381. "disabled-hours",
  16382. "disabled-minutes",
  16383. "disabled-seconds",
  16384. "onSetOption"
  16385. ])], 2), createElementVNode("div", { class: normalizeClass(unref(ns).be("panel", "footer")) }, [createElementVNode("button", {
  16386. type: "button",
  16387. class: normalizeClass([unref(ns).be("panel", "btn"), "cancel"]),
  16388. onClick: handleCancel
  16389. }, toDisplayString(unref(t)("el.datepicker.cancel")), 3), createElementVNode("button", {
  16390. type: "button",
  16391. class: normalizeClass([unref(ns).be("panel", "btn"), "confirm"]),
  16392. onClick: _cache[0] || (_cache[0] = ($event) => handleConfirm())
  16393. }, toDisplayString(unref(t)("el.datepicker.confirm")), 3)], 2)], 2)) : createCommentVNode("v-if", true)]),
  16394. _: 1
  16395. }, 8, ["name"]);
  16396. };
  16397. }
  16398. });
  16399. //#endregion
  16400. //#region ../../packages/components/time-picker/src/time-picker-com/panel-time-pick.vue
  16401. var panel_time_pick_default = panel_time_pick_vue_vue_type_script_setup_true_lang_default;
  16402. //#endregion
  16403. //#region ../../packages/components/time-picker/src/props/panel-time-range.ts
  16404. const panelTimeRangeProps = buildProps({
  16405. ...timePanelSharedProps,
  16406. parsedValue: { type: definePropType(Array) }
  16407. });
  16408. //#endregion
  16409. //#region ../../packages/components/time-picker/src/time-picker-com/panel-time-range.vue?vue&type=script&setup=true&lang.ts
  16410. const _hoisted_1$70 = ["disabled"];
  16411. var panel_time_range_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  16412. __name: "panel-time-range",
  16413. props: panelTimeRangeProps,
  16414. emits: [
  16415. "pick",
  16416. "select-range",
  16417. "set-picker-option"
  16418. ],
  16419. setup(__props, { emit: __emit }) {
  16420. const props = __props;
  16421. const emit = __emit;
  16422. const makeSelectRange = (start, end) => {
  16423. const result = [];
  16424. for (let i = start; i <= end; i++) result.push(i);
  16425. return result;
  16426. };
  16427. const { t, lang } = useLocale();
  16428. const nsTime = useNamespace("time");
  16429. const nsPicker = useNamespace("picker");
  16430. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  16431. const { arrowControl, disabledHours, disabledMinutes, disabledSeconds, defaultValue } = pickerBase.props;
  16432. const startContainerKls = computed(() => [
  16433. nsTime.be("range-picker", "body"),
  16434. nsTime.be("panel", "content"),
  16435. nsTime.is("arrow", arrowControl),
  16436. showSeconds.value ? "has-seconds" : ""
  16437. ]);
  16438. const endContainerKls = computed(() => [
  16439. nsTime.be("range-picker", "body"),
  16440. nsTime.be("panel", "content"),
  16441. nsTime.is("arrow", arrowControl),
  16442. showSeconds.value ? "has-seconds" : ""
  16443. ]);
  16444. const startTime = computed(() => props.parsedValue[0]);
  16445. const endTime = computed(() => props.parsedValue[1]);
  16446. const oldValue = useOldValue(props, {
  16447. modelValue: computed(() => pickerBase.props.modelValue),
  16448. valueOnClear: computed(() => pickerBase?.emptyValues ? pickerBase.emptyValues.valueOnClear.value : null)
  16449. });
  16450. const handleCancel = () => {
  16451. const old = oldValue.value;
  16452. emit("pick", old, false);
  16453. nextTick(() => {
  16454. oldValue.value = old;
  16455. });
  16456. };
  16457. const showSeconds = computed(() => {
  16458. return props.format.includes("ss");
  16459. });
  16460. const amPmMode = computed(() => {
  16461. if (props.format.includes("A")) return "A";
  16462. if (props.format.includes("a")) return "a";
  16463. return "";
  16464. });
  16465. const handleConfirm = (visible = false) => {
  16466. emit("pick", [startTime.value, endTime.value], visible);
  16467. };
  16468. const handleMinChange = (date) => {
  16469. handleChange(date.millisecond(0), endTime.value);
  16470. };
  16471. const handleMaxChange = (date) => {
  16472. handleChange(startTime.value, date.millisecond(0));
  16473. };
  16474. const isValidValue = (_date) => {
  16475. const parsedDate = _date.map((_) => (0, import_dayjs_min.default)(_).locale(lang.value));
  16476. const result = getRangeAvailableTime(parsedDate);
  16477. return parsedDate[0].isSame(result[0]) && parsedDate[1].isSame(result[1]);
  16478. };
  16479. const handleChange = (start, end) => {
  16480. if (!props.visible) return;
  16481. emit("pick", [start, end], true);
  16482. };
  16483. const btnConfirmDisabled = computed(() => {
  16484. return startTime.value > endTime.value;
  16485. });
  16486. const selectionRange = ref([0, 2]);
  16487. const setMinSelectionRange = (start, end) => {
  16488. emit("select-range", start, end, "min");
  16489. selectionRange.value = [start, end];
  16490. };
  16491. const offset = computed(() => showSeconds.value ? 11 : 8);
  16492. const setMaxSelectionRange = (start, end) => {
  16493. emit("select-range", start, end, "max");
  16494. const _offset = unref(offset);
  16495. selectionRange.value = [start + _offset, end + _offset];
  16496. };
  16497. const changeSelectionRange = (step) => {
  16498. const list = showSeconds.value ? [
  16499. 0,
  16500. 3,
  16501. 6,
  16502. 11,
  16503. 14,
  16504. 17
  16505. ] : [
  16506. 0,
  16507. 3,
  16508. 8,
  16509. 11
  16510. ];
  16511. const mapping = ["hours", "minutes"].concat(showSeconds.value ? ["seconds"] : []);
  16512. const next = (list.indexOf(selectionRange.value[0]) + step + list.length) % list.length;
  16513. const half = list.length / 2;
  16514. if (next < half) timePickerOptions["start_emitSelectRange"](mapping[next]);
  16515. else timePickerOptions["end_emitSelectRange"](mapping[next - half]);
  16516. };
  16517. const handleKeydown = (event) => {
  16518. const code = getEventCode(event);
  16519. const { left, right, up, down } = EVENT_CODE;
  16520. if ([left, right].includes(code)) {
  16521. changeSelectionRange(code === left ? -1 : 1);
  16522. event.preventDefault();
  16523. return;
  16524. }
  16525. if ([up, down].includes(code)) {
  16526. const step = code === up ? -1 : 1;
  16527. timePickerOptions[`${selectionRange.value[0] < offset.value ? "start" : "end"}_scrollDown`](step);
  16528. event.preventDefault();
  16529. return;
  16530. }
  16531. };
  16532. const disabledHours_ = (role, compare) => {
  16533. const defaultDisable = disabledHours ? disabledHours(role) : [];
  16534. const isStart = role === "start";
  16535. const compareHour = (compare || (isStart ? endTime.value : startTime.value)).hour();
  16536. return union(defaultDisable, isStart ? makeSelectRange(compareHour + 1, 23) : makeSelectRange(0, compareHour - 1));
  16537. };
  16538. const disabledMinutes_ = (hour, role, compare) => {
  16539. const defaultDisable = disabledMinutes ? disabledMinutes(hour, role) : [];
  16540. const isStart = role === "start";
  16541. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  16542. if (hour !== compareDate.hour()) return defaultDisable;
  16543. const compareMinute = compareDate.minute();
  16544. return union(defaultDisable, isStart ? makeSelectRange(compareMinute + 1, 59) : makeSelectRange(0, compareMinute - 1));
  16545. };
  16546. const disabledSeconds_ = (hour, minute, role, compare) => {
  16547. const defaultDisable = disabledSeconds ? disabledSeconds(hour, minute, role) : [];
  16548. const isStart = role === "start";
  16549. const compareDate = compare || (isStart ? endTime.value : startTime.value);
  16550. const compareHour = compareDate.hour();
  16551. const compareMinute = compareDate.minute();
  16552. if (hour !== compareHour || minute !== compareMinute) return defaultDisable;
  16553. const compareSecond = compareDate.second();
  16554. return union(defaultDisable, isStart ? makeSelectRange(compareSecond + 1, 59) : makeSelectRange(0, compareSecond - 1));
  16555. };
  16556. const getRangeAvailableTime = ([start, end]) => {
  16557. return [getAvailableTime(start, "start", true, end), getAvailableTime(end, "end", false, start)];
  16558. };
  16559. const { getAvailableHours, getAvailableMinutes, getAvailableSeconds } = buildAvailableTimeSlotGetter(disabledHours_, disabledMinutes_, disabledSeconds_);
  16560. const { timePickerOptions, getAvailableTime, onSetOption } = useTimePanel({
  16561. getAvailableHours,
  16562. getAvailableMinutes,
  16563. getAvailableSeconds
  16564. });
  16565. const parseUserInput = (days) => {
  16566. if (!days) return null;
  16567. if (isArray$1(days)) return days.map((d) => (0, import_dayjs_min.default)(d, props.format).locale(lang.value));
  16568. return (0, import_dayjs_min.default)(days, props.format).locale(lang.value);
  16569. };
  16570. const getDefaultValue = () => {
  16571. if (isArray$1(defaultValue)) return defaultValue.map((d) => (0, import_dayjs_min.default)(d).locale(lang.value));
  16572. const defaultDay = (0, import_dayjs_min.default)(defaultValue).locale(lang.value);
  16573. return [defaultDay, defaultDay.add(60, "m")];
  16574. };
  16575. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  16576. emit("set-picker-option", ["isValidValue", isValidValue]);
  16577. emit("set-picker-option", ["handleKeydownInput", handleKeydown]);
  16578. emit("set-picker-option", ["getDefaultValue", getDefaultValue]);
  16579. emit("set-picker-option", ["getRangeAvailableTime", getRangeAvailableTime]);
  16580. emit("set-picker-option", ["handleCancel", handleCancel]);
  16581. return (_ctx, _cache) => {
  16582. return _ctx.actualVisible ? (openBlock(), createElementBlock("div", {
  16583. key: 0,
  16584. class: normalizeClass([unref(nsTime).b("range-picker"), unref(nsPicker).b("panel")])
  16585. }, [createElementVNode("div", { class: normalizeClass(unref(nsTime).be("range-picker", "content")) }, [createElementVNode("div", { class: normalizeClass(unref(nsTime).be("range-picker", "cell")) }, [createElementVNode("div", { class: normalizeClass(unref(nsTime).be("range-picker", "header")) }, toDisplayString(unref(t)("el.datepicker.startTime")), 3), createElementVNode("div", { class: normalizeClass(startContainerKls.value) }, [createVNode(basic_time_spinner_default, {
  16586. ref: "minSpinner",
  16587. role: "start",
  16588. "show-seconds": showSeconds.value,
  16589. "am-pm-mode": amPmMode.value,
  16590. "arrow-control": unref(arrowControl),
  16591. "spinner-date": startTime.value,
  16592. "disabled-hours": disabledHours_,
  16593. "disabled-minutes": disabledMinutes_,
  16594. "disabled-seconds": disabledSeconds_,
  16595. onChange: handleMinChange,
  16596. onSetOption: unref(onSetOption),
  16597. onSelectRange: setMinSelectionRange
  16598. }, null, 8, [
  16599. "show-seconds",
  16600. "am-pm-mode",
  16601. "arrow-control",
  16602. "spinner-date",
  16603. "onSetOption"
  16604. ])], 2)], 2), createElementVNode("div", { class: normalizeClass(unref(nsTime).be("range-picker", "cell")) }, [createElementVNode("div", { class: normalizeClass(unref(nsTime).be("range-picker", "header")) }, toDisplayString(unref(t)("el.datepicker.endTime")), 3), createElementVNode("div", { class: normalizeClass(endContainerKls.value) }, [createVNode(basic_time_spinner_default, {
  16605. ref: "maxSpinner",
  16606. role: "end",
  16607. "show-seconds": showSeconds.value,
  16608. "am-pm-mode": amPmMode.value,
  16609. "arrow-control": unref(arrowControl),
  16610. "spinner-date": endTime.value,
  16611. "disabled-hours": disabledHours_,
  16612. "disabled-minutes": disabledMinutes_,
  16613. "disabled-seconds": disabledSeconds_,
  16614. onChange: handleMaxChange,
  16615. onSetOption: unref(onSetOption),
  16616. onSelectRange: setMaxSelectionRange
  16617. }, null, 8, [
  16618. "show-seconds",
  16619. "am-pm-mode",
  16620. "arrow-control",
  16621. "spinner-date",
  16622. "onSetOption"
  16623. ])], 2)], 2)], 2), createElementVNode("div", { class: normalizeClass(unref(nsTime).be("panel", "footer")) }, [createElementVNode("button", {
  16624. type: "button",
  16625. class: normalizeClass([unref(nsTime).be("panel", "btn"), "cancel"]),
  16626. onClick: _cache[0] || (_cache[0] = ($event) => handleCancel())
  16627. }, toDisplayString(unref(t)("el.datepicker.cancel")), 3), createElementVNode("button", {
  16628. type: "button",
  16629. class: normalizeClass([unref(nsTime).be("panel", "btn"), "confirm"]),
  16630. disabled: btnConfirmDisabled.value,
  16631. onClick: _cache[1] || (_cache[1] = ($event) => handleConfirm())
  16632. }, toDisplayString(unref(t)("el.datepicker.confirm")), 11, _hoisted_1$70)], 2)], 2)) : createCommentVNode("v-if", true);
  16633. };
  16634. }
  16635. });
  16636. //#endregion
  16637. //#region ../../packages/components/time-picker/src/time-picker-com/panel-time-range.vue
  16638. var panel_time_range_default = panel_time_range_vue_vue_type_script_setup_true_lang_default;
  16639. //#endregion
  16640. //#region ../../packages/components/time-picker/src/time-picker.tsx
  16641. import_dayjs_min.default.extend(import_customParseFormat.default);
  16642. var time_picker_default = /* @__PURE__ */ defineComponent({
  16643. name: "ElTimePicker",
  16644. install: null,
  16645. props: {
  16646. ...timePickerDefaultProps,
  16647. isRange: Boolean
  16648. },
  16649. emits: [UPDATE_MODEL_EVENT],
  16650. setup(props, ctx) {
  16651. const commonPicker = ref();
  16652. const [type, Panel] = props.isRange ? ["timerange", panel_time_range_default] : ["time", panel_time_pick_default];
  16653. const modelUpdater = (value) => ctx.emit(UPDATE_MODEL_EVENT, value);
  16654. provide(PICKER_POPPER_OPTIONS_INJECTION_KEY, props.popperOptions);
  16655. ctx.expose({
  16656. focus: () => {
  16657. commonPicker.value?.focus();
  16658. },
  16659. blur: () => {
  16660. commonPicker.value?.blur();
  16661. },
  16662. handleOpen: () => {
  16663. commonPicker.value?.handleOpen();
  16664. },
  16665. handleClose: () => {
  16666. commonPicker.value?.handleClose();
  16667. }
  16668. });
  16669. return () => {
  16670. return createVNode(picker_default, mergeProps(props, {
  16671. "ref": commonPicker,
  16672. "type": type,
  16673. "format": props.format ?? "HH:mm:ss",
  16674. "onUpdate:modelValue": modelUpdater
  16675. }), { default: (props) => createVNode(Panel, props, null) });
  16676. };
  16677. }
  16678. });
  16679. //#endregion
  16680. //#region ../../packages/components/time-picker/index.ts
  16681. const ElTimePicker = withInstall(time_picker_default);
  16682. //#endregion
  16683. //#region ../../packages/components/calendar/src/date-table.ts
  16684. const getPrevMonthLastDays = (date, count) => {
  16685. const lastDay = date.subtract(1, "month").endOf("month").date();
  16686. return rangeArr(count).map((_, index) => lastDay - (count - index - 1));
  16687. };
  16688. const getMonthDays = (date) => {
  16689. return rangeArr(date.daysInMonth()).map((_, index) => index + 1);
  16690. };
  16691. const toNestedArr = (days) => rangeArr(days.length / 7).map((index) => {
  16692. const start = index * 7;
  16693. return days.slice(start, start + 7);
  16694. });
  16695. const dateTableProps = buildProps({
  16696. selectedDay: { type: definePropType(Object) },
  16697. range: { type: definePropType(Array) },
  16698. date: {
  16699. type: definePropType(Object),
  16700. required: true
  16701. },
  16702. hideHeader: { type: Boolean }
  16703. });
  16704. const dateTableEmits = { pick: (value) => isObject$1(value) };
  16705. //#endregion
  16706. //#region ../../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/plugin/localeData.js
  16707. var require_localeData = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  16708. (function(n, e) {
  16709. "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : (n = "undefined" != typeof globalThis ? globalThis : n || self).dayjs_plugin_localeData = e();
  16710. })(exports, (function() {
  16711. "use strict";
  16712. return function(n, e, t) {
  16713. var r = e.prototype, o = function(n) {
  16714. return n && (n.indexOf ? n : n.s);
  16715. }, u = function(n, e, t, r, u) {
  16716. var i = n.name ? n : n.$locale(), a = o(i[e]), s = o(i[t]), f = a || s.map((function(n) {
  16717. return n.slice(0, r);
  16718. }));
  16719. if (!u) return f;
  16720. var d = i.weekStart;
  16721. return f.map((function(n, e) {
  16722. return f[(e + (d || 0)) % 7];
  16723. }));
  16724. }, i = function() {
  16725. return t.Ls[t.locale()];
  16726. }, a = function(n, e) {
  16727. return n.formats[e] || function(n) {
  16728. return n.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g, (function(n, e, t) {
  16729. return e || t.slice(1);
  16730. }));
  16731. }(n.formats[e.toUpperCase()]);
  16732. }, s = function() {
  16733. var n = this;
  16734. return {
  16735. months: function(e) {
  16736. return e ? e.format("MMMM") : u(n, "months");
  16737. },
  16738. monthsShort: function(e) {
  16739. return e ? e.format("MMM") : u(n, "monthsShort", "months", 3);
  16740. },
  16741. firstDayOfWeek: function() {
  16742. return n.$locale().weekStart || 0;
  16743. },
  16744. weekdays: function(e) {
  16745. return e ? e.format("dddd") : u(n, "weekdays");
  16746. },
  16747. weekdaysMin: function(e) {
  16748. return e ? e.format("dd") : u(n, "weekdaysMin", "weekdays", 2);
  16749. },
  16750. weekdaysShort: function(e) {
  16751. return e ? e.format("ddd") : u(n, "weekdaysShort", "weekdays", 3);
  16752. },
  16753. longDateFormat: function(e) {
  16754. return a(n.$locale(), e);
  16755. },
  16756. meridiem: this.$locale().meridiem,
  16757. ordinal: this.$locale().ordinal
  16758. };
  16759. };
  16760. r.localeData = function() {
  16761. return s.bind(this)();
  16762. }, t.localeData = function() {
  16763. var n = i();
  16764. return {
  16765. firstDayOfWeek: function() {
  16766. return n.weekStart || 0;
  16767. },
  16768. weekdays: function() {
  16769. return t.weekdays();
  16770. },
  16771. weekdaysShort: function() {
  16772. return t.weekdaysShort();
  16773. },
  16774. weekdaysMin: function() {
  16775. return t.weekdaysMin();
  16776. },
  16777. months: function() {
  16778. return t.months();
  16779. },
  16780. monthsShort: function() {
  16781. return t.monthsShort();
  16782. },
  16783. longDateFormat: function(e) {
  16784. return a(n, e);
  16785. },
  16786. meridiem: n.meridiem,
  16787. ordinal: n.ordinal
  16788. };
  16789. }, t.months = function() {
  16790. return u(i(), "months");
  16791. }, t.monthsShort = function() {
  16792. return u(i(), "monthsShort", "months", 3);
  16793. }, t.weekdays = function(n) {
  16794. return u(i(), "weekdays", null, null, n);
  16795. }, t.weekdaysShort = function(n) {
  16796. return u(i(), "weekdaysShort", "weekdays", 3, n);
  16797. }, t.weekdaysMin = function(n) {
  16798. return u(i(), "weekdaysMin", "weekdays", 2, n);
  16799. };
  16800. };
  16801. }));
  16802. }));
  16803. //#endregion
  16804. //#region ../../packages/components/calendar/src/use-date-table.ts
  16805. var import_localeData = /* @__PURE__ */ __toESM(require_localeData());
  16806. const useDateTable = (props, emit) => {
  16807. import_dayjs_min.default.extend(import_localeData.default);
  16808. const firstDayOfWeek = import_dayjs_min.default.localeData().firstDayOfWeek();
  16809. const { t, lang } = useLocale();
  16810. const now = (0, import_dayjs_min.default)().locale(lang.value);
  16811. const isInRange = computed(() => !!props.range && !!props.range.length);
  16812. const rows = computed(() => {
  16813. let days = [];
  16814. if (isInRange.value) {
  16815. const [start, end] = props.range;
  16816. const currentMonthRange = rangeArr(end.date() - start.date() + 1).map((index) => ({
  16817. text: start.date() + index,
  16818. type: "current"
  16819. }));
  16820. let remaining = currentMonthRange.length % 7;
  16821. remaining = remaining === 0 ? 0 : 7 - remaining;
  16822. const nextMonthRange = rangeArr(remaining).map((_, index) => ({
  16823. text: index + 1,
  16824. type: "next"
  16825. }));
  16826. days = currentMonthRange.concat(nextMonthRange);
  16827. } else {
  16828. const firstDay = props.date.startOf("month").day();
  16829. const prevMonthDays = getPrevMonthLastDays(props.date, (firstDay - firstDayOfWeek + 7) % 7).map((day) => ({
  16830. text: day,
  16831. type: "prev"
  16832. }));
  16833. const currentMonthDays = getMonthDays(props.date).map((day) => ({
  16834. text: day,
  16835. type: "current"
  16836. }));
  16837. days = [...prevMonthDays, ...currentMonthDays];
  16838. const nextMonthDays = rangeArr(7 - (days.length % 7 || 7)).map((_, index) => ({
  16839. text: index + 1,
  16840. type: "next"
  16841. }));
  16842. days = days.concat(nextMonthDays);
  16843. }
  16844. return toNestedArr(days);
  16845. });
  16846. const weekDays = computed(() => {
  16847. const start = firstDayOfWeek;
  16848. if (start === 0) return WEEK_DAYS.map((_) => t(`el.datepicker.weeks.${_}`));
  16849. else return WEEK_DAYS.slice(start).concat(WEEK_DAYS.slice(0, start)).map((_) => t(`el.datepicker.weeks.${_}`));
  16850. });
  16851. const getFormattedDate = (day, type) => {
  16852. switch (type) {
  16853. case "prev": return props.date.startOf("month").subtract(1, "month").date(day);
  16854. case "next": return props.date.startOf("month").add(1, "month").date(day);
  16855. case "current": return props.date.date(day);
  16856. }
  16857. };
  16858. const handlePickDay = ({ text, type }) => {
  16859. emit("pick", getFormattedDate(text, type));
  16860. };
  16861. const getSlotData = ({ text, type }) => {
  16862. const day = getFormattedDate(text, type);
  16863. return {
  16864. isSelected: day.isSame(props.selectedDay),
  16865. type: `${type}-month`,
  16866. day: day.format(DEFAULT_FORMATS_DATE),
  16867. date: day.toDate()
  16868. };
  16869. };
  16870. return {
  16871. now,
  16872. isInRange,
  16873. rows,
  16874. weekDays,
  16875. getFormattedDate,
  16876. handlePickDay,
  16877. getSlotData
  16878. };
  16879. };
  16880. //#endregion
  16881. //#region ../../packages/components/calendar/src/date-table.vue?vue&type=script&setup=true&lang.ts
  16882. const _hoisted_1$69 = { key: 0 };
  16883. const _hoisted_2$39 = ["onClick"];
  16884. var date_table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  16885. name: "DateTable",
  16886. __name: "date-table",
  16887. props: dateTableProps,
  16888. emits: dateTableEmits,
  16889. setup(__props, { expose: __expose, emit: __emit }) {
  16890. const props = __props;
  16891. const { isInRange, now, rows, weekDays, getFormattedDate, handlePickDay, getSlotData } = useDateTable(props, __emit);
  16892. const nsTable = useNamespace("calendar-table");
  16893. const nsDay = useNamespace("calendar-day");
  16894. const getCellClass = ({ text, type }) => {
  16895. const classes = [type];
  16896. if (type === "current") {
  16897. const date = getFormattedDate(text, type);
  16898. if (date.isSame(props.selectedDay, "day")) classes.push(nsDay.is("selected"));
  16899. if (date.isSame(now, "day")) classes.push(nsDay.is("today"));
  16900. }
  16901. return classes;
  16902. };
  16903. __expose({ getFormattedDate });
  16904. return (_ctx, _cache) => {
  16905. return openBlock(), createElementBlock("table", {
  16906. class: normalizeClass([unref(nsTable).b(), unref(nsTable).is("range", unref(isInRange))]),
  16907. cellspacing: "0",
  16908. cellpadding: "0"
  16909. }, [!__props.hideHeader ? (openBlock(), createElementBlock("thead", _hoisted_1$69, [createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(weekDays), (day) => {
  16910. return openBlock(), createElementBlock("th", {
  16911. key: day,
  16912. scope: "col"
  16913. }, toDisplayString(day), 1);
  16914. }), 128))])])) : createCommentVNode("v-if", true), createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, index) => {
  16915. return openBlock(), createElementBlock("tr", {
  16916. key: index,
  16917. class: normalizeClass({
  16918. [unref(nsTable).e("row")]: true,
  16919. [unref(nsTable).em("row", "hide-border")]: index === 0 && __props.hideHeader
  16920. })
  16921. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key) => {
  16922. return openBlock(), createElementBlock("td", {
  16923. key,
  16924. class: normalizeClass(getCellClass(cell)),
  16925. onClick: ($event) => unref(handlePickDay)(cell)
  16926. }, [createElementVNode("div", { class: normalizeClass(unref(nsDay).b()) }, [renderSlot(_ctx.$slots, "date-cell", { data: unref(getSlotData)(cell) }, () => [createElementVNode("span", null, toDisplayString(cell.text), 1)])], 2)], 10, _hoisted_2$39);
  16927. }), 128))], 2);
  16928. }), 128))])], 2);
  16929. };
  16930. }
  16931. });
  16932. //#endregion
  16933. //#region ../../packages/components/calendar/src/date-table.vue
  16934. var date_table_default = date_table_vue_vue_type_script_setup_true_lang_default;
  16935. //#endregion
  16936. //#region ../../packages/components/calendar/src/use-calendar.ts
  16937. const adjacentMonth = (start, end) => {
  16938. const firstMonthLastDay = start.endOf("month");
  16939. const lastMonthFirstDay = end.startOf("month");
  16940. const lastMonthStartDay = firstMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  16941. return [[start, firstMonthLastDay], [lastMonthStartDay.startOf("week"), end]];
  16942. };
  16943. const threeConsecutiveMonth = (start, end) => {
  16944. const firstMonthLastDay = start.endOf("month");
  16945. const secondMonthFirstDay = start.add(1, "month").startOf("month");
  16946. const secondMonthStartDay = firstMonthLastDay.isSame(secondMonthFirstDay, "week") ? secondMonthFirstDay.add(1, "week") : secondMonthFirstDay;
  16947. const secondMonthLastDay = secondMonthStartDay.endOf("month");
  16948. const lastMonthFirstDay = end.startOf("month");
  16949. const lastMonthStartDay = secondMonthLastDay.isSame(lastMonthFirstDay, "week") ? lastMonthFirstDay.add(1, "week") : lastMonthFirstDay;
  16950. return [
  16951. [start, firstMonthLastDay],
  16952. [secondMonthStartDay.startOf("week"), secondMonthLastDay],
  16953. [lastMonthStartDay.startOf("week"), end]
  16954. ];
  16955. };
  16956. const useCalendar = (props, emit, componentName) => {
  16957. const { lang } = useLocale();
  16958. const selectedDay = ref();
  16959. const now = (0, import_dayjs_min.default)().locale(lang.value);
  16960. const realSelectedDay = computed({
  16961. get() {
  16962. if (!props.modelValue) return selectedDay.value;
  16963. return date.value;
  16964. },
  16965. set(val) {
  16966. if (!val) return;
  16967. selectedDay.value = val;
  16968. const result = val.toDate();
  16969. emit(INPUT_EVENT, result);
  16970. emit(UPDATE_MODEL_EVENT, result);
  16971. }
  16972. });
  16973. const validatedRange = computed(() => {
  16974. if (!props.range || !isArray$1(props.range) || props.range.length !== 2 || props.range.some((item) => !isDate(item))) return [];
  16975. const [startDayjs, endDayjs] = props.range.map((_) => (0, import_dayjs_min.default)(_).locale(lang.value));
  16976. if (startDayjs.isAfter(endDayjs)) {
  16977. /* @__PURE__ */ debugWarn(componentName, "end time should be greater than start time");
  16978. return [];
  16979. }
  16980. if (startDayjs.isSame(endDayjs, "month")) return calculateValidatedDateRange(startDayjs, endDayjs);
  16981. else {
  16982. if (!startDayjs.add(1, "month").isSame(endDayjs, "month")) {
  16983. /* @__PURE__ */ debugWarn(componentName, "start time and end time interval must not exceed two months");
  16984. return [];
  16985. }
  16986. return calculateValidatedDateRange(startDayjs, endDayjs);
  16987. }
  16988. });
  16989. const date = computed(() => {
  16990. if (!props.modelValue) return realSelectedDay.value || (validatedRange.value.length ? validatedRange.value[0][0] : now);
  16991. else return (0, import_dayjs_min.default)(props.modelValue).locale(lang.value);
  16992. });
  16993. const prevMonthDayjs = computed(() => date.value.subtract(1, "month").date(1));
  16994. const nextMonthDayjs = computed(() => date.value.add(1, "month").date(1));
  16995. const prevYearDayjs = computed(() => date.value.subtract(1, "year").date(1));
  16996. const nextYearDayjs = computed(() => date.value.add(1, "year").date(1));
  16997. const calculateValidatedDateRange = (startDayjs, endDayjs) => {
  16998. const firstDay = startDayjs.startOf("week");
  16999. const lastDay = endDayjs.endOf("week");
  17000. const firstMonth = firstDay.get("month");
  17001. const lastMonth = lastDay.get("month");
  17002. if (firstMonth === lastMonth) return [[firstDay, lastDay]];
  17003. else if ((firstMonth + 1) % 12 === lastMonth) return adjacentMonth(firstDay, lastDay);
  17004. else if (firstMonth + 2 === lastMonth || (firstMonth + 1) % 11 === lastMonth) return threeConsecutiveMonth(firstDay, lastDay);
  17005. else {
  17006. /* @__PURE__ */ debugWarn(componentName, "start time and end time interval must not exceed two months");
  17007. return [];
  17008. }
  17009. };
  17010. const pickDay = (day) => {
  17011. realSelectedDay.value = day;
  17012. };
  17013. const selectDate = (type) => {
  17014. const day = {
  17015. "prev-month": prevMonthDayjs.value,
  17016. "next-month": nextMonthDayjs.value,
  17017. "prev-year": prevYearDayjs.value,
  17018. "next-year": nextYearDayjs.value,
  17019. today: now
  17020. }[type];
  17021. if (!day.isSame(date.value, "day")) pickDay(day);
  17022. };
  17023. const handleDateChange = (date) => {
  17024. if (date === "today") selectDate("today");
  17025. else pickDay(date);
  17026. };
  17027. return {
  17028. calculateValidatedDateRange,
  17029. date,
  17030. realSelectedDay,
  17031. pickDay,
  17032. selectDate,
  17033. validatedRange,
  17034. handleDateChange
  17035. };
  17036. };
  17037. //#endregion
  17038. //#region ../../packages/components/calendar/src/select-controller.ts
  17039. const selectControllerProps = buildProps({
  17040. date: {
  17041. type: definePropType(Object),
  17042. required: true
  17043. },
  17044. formatter: { type: definePropType(Function) }
  17045. });
  17046. const selectControllerEmits = { "date-change": (date) => isObject$1(date) || isString(date) };
  17047. //#endregion
  17048. //#region ../../packages/components/tag/src/tag.ts
  17049. const tagProps = buildProps({
  17050. type: {
  17051. type: String,
  17052. values: [
  17053. "primary",
  17054. "success",
  17055. "info",
  17056. "warning",
  17057. "danger"
  17058. ],
  17059. default: "primary"
  17060. },
  17061. closable: Boolean,
  17062. disableTransitions: Boolean,
  17063. hit: Boolean,
  17064. color: String,
  17065. size: {
  17066. type: String,
  17067. values: componentSizes
  17068. },
  17069. effect: {
  17070. type: String,
  17071. values: [
  17072. "dark",
  17073. "light",
  17074. "plain"
  17075. ],
  17076. default: "light"
  17077. },
  17078. round: Boolean
  17079. });
  17080. const tagEmits = {
  17081. close: (evt) => evt instanceof MouseEvent,
  17082. click: (evt) => evt instanceof MouseEvent
  17083. };
  17084. //#endregion
  17085. //#region ../../packages/components/tag/src/tag.vue?vue&type=script&setup=true&lang.ts
  17086. const _hoisted_1$68 = ["aria-label"];
  17087. const _hoisted_2$38 = ["aria-label"];
  17088. var tag_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  17089. name: "ElTag",
  17090. __name: "tag",
  17091. props: tagProps,
  17092. emits: tagEmits,
  17093. setup(__props, { emit: __emit }) {
  17094. const props = __props;
  17095. const emit = __emit;
  17096. const tagSize = useFormSize();
  17097. const { t } = useLocale();
  17098. const ns = useNamespace("tag");
  17099. const containerKls = computed(() => {
  17100. const { type, hit, effect, closable, round } = props;
  17101. return [
  17102. ns.b(),
  17103. ns.is("closable", closable),
  17104. ns.m(type || "primary"),
  17105. ns.m(tagSize.value),
  17106. ns.m(effect),
  17107. ns.is("hit", hit),
  17108. ns.is("round", round)
  17109. ];
  17110. });
  17111. const handleClose = (event) => {
  17112. emit("close", event);
  17113. };
  17114. const handleClick = (event) => {
  17115. emit("click", event);
  17116. };
  17117. const handleVNodeMounted = (vnode) => {
  17118. if (vnode?.component?.subTree?.component?.bum) vnode.component.subTree.component.bum = null;
  17119. };
  17120. return (_ctx, _cache) => {
  17121. return __props.disableTransitions ? (openBlock(), createElementBlock("span", {
  17122. key: 0,
  17123. class: normalizeClass(containerKls.value),
  17124. style: normalizeStyle({ backgroundColor: __props.color }),
  17125. onClick: handleClick
  17126. }, [createElementVNode("span", { class: normalizeClass(unref(ns).e("content")) }, [renderSlot(_ctx.$slots, "default")], 2), __props.closable ? (openBlock(), createElementBlock("button", {
  17127. key: 0,
  17128. "aria-label": unref(t)("el.tag.close"),
  17129. class: normalizeClass(unref(ns).e("close")),
  17130. type: "button",
  17131. onClick: withModifiers(handleClose, ["stop"])
  17132. }, [createVNode(unref(ElIcon), null, {
  17133. default: withCtx(() => [createVNode(unref(close_default))]),
  17134. _: 1
  17135. })], 10, _hoisted_1$68)) : createCommentVNode("v-if", true)], 6)) : (openBlock(), createBlock(Transition, {
  17136. key: 1,
  17137. name: `${unref(ns).namespace.value}-zoom-in-center`,
  17138. appear: "",
  17139. onVnodeMounted: handleVNodeMounted
  17140. }, {
  17141. default: withCtx(() => [createElementVNode("span", {
  17142. class: normalizeClass(containerKls.value),
  17143. style: normalizeStyle({ backgroundColor: __props.color }),
  17144. onClick: handleClick
  17145. }, [createElementVNode("span", { class: normalizeClass(unref(ns).e("content")) }, [renderSlot(_ctx.$slots, "default")], 2), __props.closable ? (openBlock(), createElementBlock("button", {
  17146. key: 0,
  17147. "aria-label": unref(t)("el.tag.close"),
  17148. class: normalizeClass(unref(ns).e("close")),
  17149. type: "button",
  17150. onClick: withModifiers(handleClose, ["stop"])
  17151. }, [createVNode(unref(ElIcon), null, {
  17152. default: withCtx(() => [createVNode(unref(close_default))]),
  17153. _: 1
  17154. })], 10, _hoisted_2$38)) : createCommentVNode("v-if", true)], 6)]),
  17155. _: 3
  17156. }, 8, ["name"]));
  17157. };
  17158. }
  17159. });
  17160. //#endregion
  17161. //#region ../../packages/components/tag/src/tag.vue
  17162. var tag_default = tag_vue_vue_type_script_setup_true_lang_default;
  17163. //#endregion
  17164. //#region ../../packages/components/tag/index.ts
  17165. const ElTag = withInstall(tag_default);
  17166. //#endregion
  17167. //#region ../../packages/components/select-v2/src/useProps.ts
  17168. const defaultProps$2 = {
  17169. label: "label",
  17170. value: "value",
  17171. disabled: "disabled",
  17172. options: "options"
  17173. };
  17174. function useProps(props) {
  17175. const aliasProps = ref({
  17176. ...defaultProps$2,
  17177. ...props.props
  17178. });
  17179. let cache = { ...props.props };
  17180. watch(() => props.props, (val) => {
  17181. if (!isEqual$1(val, cache)) {
  17182. aliasProps.value = {
  17183. ...defaultProps$2,
  17184. ...val
  17185. };
  17186. cache = { ...val };
  17187. }
  17188. }, { deep: true });
  17189. const getLabel = (option) => get(option, aliasProps.value.label);
  17190. const getValue = (option) => get(option, aliasProps.value.value);
  17191. const getDisabled = (option) => get(option, aliasProps.value.disabled);
  17192. const getOptions = (option) => get(option, aliasProps.value.options);
  17193. return {
  17194. aliasProps,
  17195. getLabel,
  17196. getValue,
  17197. getDisabled,
  17198. getOptions
  17199. };
  17200. }
  17201. //#endregion
  17202. //#region ../../packages/components/select/src/token.ts
  17203. const selectGroupKey = Symbol("ElSelectGroup");
  17204. const selectKey = Symbol("ElSelect");
  17205. //#endregion
  17206. //#region ../../packages/components/select/src/option.ts
  17207. const COMPONENT_NAME$14 = "ElOption";
  17208. const optionProps = buildProps({
  17209. value: {
  17210. type: [
  17211. String,
  17212. Number,
  17213. Boolean,
  17214. Object
  17215. ],
  17216. required: true
  17217. },
  17218. label: { type: [String, Number] },
  17219. created: Boolean,
  17220. disabled: Boolean
  17221. });
  17222. //#endregion
  17223. //#region ../../packages/components/select/src/useOption.ts
  17224. function useOption$1(props, states) {
  17225. const select = inject(selectKey);
  17226. if (!select) throwError(COMPONENT_NAME$14, "usage: <el-select><el-option /></el-select/>");
  17227. const selectGroup = inject(selectGroupKey, { disabled: false });
  17228. const itemSelected = computed(() => {
  17229. return contains(castArray$1(select.props.modelValue), props.value);
  17230. });
  17231. const limitReached = computed(() => {
  17232. if (select.props.multiple) {
  17233. const modelValue = castArray$1(select.props.modelValue ?? []);
  17234. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  17235. } else return false;
  17236. });
  17237. const currentLabel = computed(() => {
  17238. return props.label ?? (isObject$1(props.value) ? "" : props.value);
  17239. });
  17240. const currentValue = computed(() => {
  17241. return props.value || props.label || "";
  17242. });
  17243. const isDisabled = computed(() => {
  17244. return props.disabled || states.groupDisabled || limitReached.value;
  17245. });
  17246. const instance = getCurrentInstance();
  17247. const contains = (arr = [], target) => {
  17248. if (!isObject$1(props.value)) return arr && arr.includes(target);
  17249. else {
  17250. const valueKey = select.props.valueKey;
  17251. return arr && arr.some((item) => {
  17252. return toRaw(get(item, valueKey)) === get(target, valueKey);
  17253. });
  17254. }
  17255. };
  17256. const hoverItem = () => {
  17257. if (!isDisabled.value) select.states.hoveringIndex = select.optionsArray.indexOf(instance.proxy);
  17258. };
  17259. const updateOption = (query) => {
  17260. states.visible = new RegExp(escapeStringRegexp(query), "i").test(String(currentLabel.value)) || props.created;
  17261. };
  17262. watch(() => currentLabel.value, () => {
  17263. if (!props.created && !select.props.remote) select.setSelected();
  17264. });
  17265. watch(() => props.value, (val, oldVal) => {
  17266. const { remote, valueKey } = select.props;
  17267. if (remote ? val !== oldVal : !isEqual$1(val, oldVal)) {
  17268. select.onOptionDestroy(oldVal, instance.proxy);
  17269. select.onOptionCreate(instance.proxy);
  17270. }
  17271. if (!props.created && !remote) {
  17272. if (valueKey && isObject$1(val) && isObject$1(oldVal) && val[valueKey] === oldVal[valueKey]) return;
  17273. select.setSelected();
  17274. }
  17275. });
  17276. watch(() => selectGroup.disabled, () => {
  17277. states.groupDisabled = selectGroup.disabled;
  17278. }, { immediate: true });
  17279. return {
  17280. select,
  17281. currentLabel,
  17282. currentValue,
  17283. itemSelected,
  17284. isDisabled,
  17285. hoverItem,
  17286. updateOption
  17287. };
  17288. }
  17289. //#endregion
  17290. //#region ../../packages/components/select/src/option.vue?vue&type=script&lang.ts
  17291. var option_vue_vue_type_script_lang_default = defineComponent({
  17292. name: COMPONENT_NAME$14,
  17293. componentName: COMPONENT_NAME$14,
  17294. props: optionProps,
  17295. setup(props) {
  17296. const ns = useNamespace("select");
  17297. const id = useId();
  17298. const containerKls = computed(() => [
  17299. ns.be("dropdown", "item"),
  17300. ns.is("disabled", unref(isDisabled)),
  17301. ns.is("selected", unref(itemSelected)),
  17302. ns.is("hovering", unref(hover))
  17303. ]);
  17304. const states = reactive({
  17305. index: -1,
  17306. groupDisabled: false,
  17307. visible: true,
  17308. hover: false
  17309. });
  17310. const mouseMoveEventName = isIOS ? null : "mousemove";
  17311. const { currentLabel, itemSelected, isDisabled, select, hoverItem, updateOption } = useOption$1(props, states);
  17312. const { visible, hover } = toRefs(states);
  17313. const vm = getCurrentInstance().proxy;
  17314. select.onOptionCreate(vm);
  17315. onBeforeUnmount(() => {
  17316. const key = vm.value;
  17317. nextTick(() => {
  17318. const { selected: selectedOptions } = select.states;
  17319. const doesSelected = selectedOptions.some((item) => {
  17320. return item.value === vm.value;
  17321. });
  17322. if (select.states.cachedOptions.get(key) === vm && !doesSelected) select.states.cachedOptions.delete(key);
  17323. });
  17324. select.onOptionDestroy(key, vm);
  17325. });
  17326. function selectOptionClick() {
  17327. if (!isDisabled.value) select.handleOptionSelect(vm);
  17328. }
  17329. const handleMousedown = (event) => {
  17330. let target = event.target;
  17331. const currentTarget = event.currentTarget;
  17332. while (target && target !== currentTarget) {
  17333. if (isFocusable(target)) return;
  17334. target = target.parentElement;
  17335. }
  17336. event.preventDefault();
  17337. };
  17338. return {
  17339. ns,
  17340. id,
  17341. containerKls,
  17342. currentLabel,
  17343. itemSelected,
  17344. isDisabled,
  17345. select,
  17346. visible,
  17347. hover,
  17348. states,
  17349. mouseMoveEventName,
  17350. hoverItem,
  17351. handleMousedown,
  17352. updateOption,
  17353. selectOptionClick
  17354. };
  17355. }
  17356. });
  17357. //#endregion
  17358. //#region ../../packages/components/select/src/option.vue
  17359. const _hoisted_1$67 = [
  17360. "id",
  17361. "aria-disabled",
  17362. "aria-selected"
  17363. ];
  17364. function _sfc_render$19(_ctx, _cache, $props, $setup, $data, $options) {
  17365. return withDirectives((openBlock(), createElementBlock("li", mergeProps({
  17366. id: _ctx.id,
  17367. class: _ctx.containerKls,
  17368. role: "option",
  17369. "aria-disabled": _ctx.isDisabled || void 0,
  17370. "aria-selected": _ctx.itemSelected
  17371. }, { [toHandlerKey(_ctx.mouseMoveEventName)]: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)) }, {
  17372. onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.handleMousedown && _ctx.handleMousedown(...args)),
  17373. onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  17374. }), [renderSlot(_ctx.$slots, "default", {}, () => [createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)])], 16, _hoisted_1$67)), [[vShow, _ctx.visible]]);
  17375. }
  17376. var option_default = /* @__PURE__ */ _plugin_vue_export_helper_default(option_vue_vue_type_script_lang_default, [["render", _sfc_render$19]]);
  17377. //#endregion
  17378. //#region ../../packages/components/select/src/select-dropdown.vue?vue&type=script&lang.ts
  17379. var select_dropdown_vue_vue_type_script_lang_default = defineComponent({
  17380. name: "ElSelectDropdown",
  17381. componentName: "ElSelectDropdown",
  17382. setup() {
  17383. const select = inject(selectKey);
  17384. const ns = useNamespace("select");
  17385. const popperClass = computed(() => select.props.popperClass);
  17386. const isMultiple = computed(() => select.props.multiple);
  17387. const isFitInputWidth = computed(() => select.props.fitInputWidth);
  17388. const minWidth = ref("");
  17389. function updateMinWidth() {
  17390. const offsetWidth = select.selectRef?.offsetWidth;
  17391. if (offsetWidth) minWidth.value = `${offsetWidth - 2}px`;
  17392. else minWidth.value = "";
  17393. }
  17394. onMounted(() => {
  17395. updateMinWidth();
  17396. useResizeObserver(select.selectRef, updateMinWidth);
  17397. });
  17398. return {
  17399. ns,
  17400. minWidth,
  17401. popperClass,
  17402. isMultiple,
  17403. isFitInputWidth
  17404. };
  17405. }
  17406. });
  17407. //#endregion
  17408. //#region ../../packages/components/select/src/select-dropdown.vue
  17409. function _sfc_render$18(_ctx, _cache, $props, $setup, $data, $options) {
  17410. return openBlock(), createElementBlock("div", {
  17411. class: normalizeClass([
  17412. _ctx.ns.b("dropdown"),
  17413. _ctx.ns.is("multiple", _ctx.isMultiple),
  17414. _ctx.popperClass
  17415. ]),
  17416. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  17417. }, [
  17418. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  17419. key: 0,
  17420. class: normalizeClass(_ctx.ns.be("dropdown", "header"))
  17421. }, [renderSlot(_ctx.$slots, "header")], 2)) : createCommentVNode("v-if", true),
  17422. renderSlot(_ctx.$slots, "default"),
  17423. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  17424. key: 1,
  17425. class: normalizeClass(_ctx.ns.be("dropdown", "footer"))
  17426. }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true)
  17427. ], 6);
  17428. }
  17429. var select_dropdown_default$1 = /* @__PURE__ */ _plugin_vue_export_helper_default(select_dropdown_vue_vue_type_script_lang_default, [["render", _sfc_render$18]]);
  17430. //#endregion
  17431. //#region ../../packages/components/select/src/useSelect.ts
  17432. const useSelect$2 = (props, emit) => {
  17433. const { t } = useLocale();
  17434. const slots = useSlots();
  17435. const contentId = useId();
  17436. const nsSelect = useNamespace("select");
  17437. const nsInput = useNamespace("input");
  17438. const states = reactive({
  17439. inputValue: "",
  17440. options: /* @__PURE__ */ new Map(),
  17441. cachedOptions: /* @__PURE__ */ new Map(),
  17442. optionValues: [],
  17443. selected: [],
  17444. selectionWidth: 0,
  17445. collapseItemWidth: 0,
  17446. selectedLabel: "",
  17447. hoveringIndex: -1,
  17448. previousQuery: null,
  17449. inputHovering: false,
  17450. menuVisibleOnFocus: false,
  17451. isBeforeHide: false
  17452. });
  17453. const selectRef = ref();
  17454. const selectionRef = ref();
  17455. const tooltipRef = ref();
  17456. const tagTooltipRef = ref();
  17457. const inputRef = ref();
  17458. const prefixRef = ref();
  17459. const suffixRef = ref();
  17460. const menuRef = ref();
  17461. const tagMenuRef = ref();
  17462. const collapseItemRef = ref();
  17463. const scrollbarRef = ref();
  17464. const expanded = ref(false);
  17465. const hoverOption = ref();
  17466. const debouncing = ref(false);
  17467. const { form, formItem } = useFormItem();
  17468. const { inputId } = useFormItemInputId(props, { formItemContext: formItem });
  17469. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  17470. const { isComposing, handleCompositionStart, handleCompositionUpdate, handleCompositionEnd } = useComposition({ afterComposition: (e) => onInput(e) });
  17471. const selectDisabled = useFormDisabled();
  17472. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  17473. disabled: selectDisabled,
  17474. afterFocus() {
  17475. if (props.automaticDropdown && !expanded.value) {
  17476. expanded.value = true;
  17477. states.menuVisibleOnFocus = true;
  17478. }
  17479. },
  17480. beforeBlur(event) {
  17481. return tooltipRef.value?.isFocusInsideContent(event) || tagTooltipRef.value?.isFocusInsideContent(event);
  17482. },
  17483. afterBlur() {
  17484. expanded.value = false;
  17485. states.menuVisibleOnFocus = false;
  17486. if (props.validateEvent) formItem?.validate?.("blur").catch(NOOP);
  17487. }
  17488. });
  17489. const hasModelValue = computed(() => {
  17490. return isArray$1(props.modelValue) ? props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  17491. });
  17492. const needStatusIcon = computed(() => form?.statusIcon ?? false);
  17493. const showClearBtn = computed(() => {
  17494. return props.clearable && !selectDisabled.value && hasModelValue.value && (isFocused.value || states.inputHovering);
  17495. });
  17496. const iconComponent = computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  17497. const iconReverse = computed(() => nsSelect.is("reverse", !!(iconComponent.value && expanded.value)));
  17498. const validateState = computed(() => formItem?.validateState || "");
  17499. const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
  17500. const debounce = computed(() => props.remote ? props.debounce : 0);
  17501. const isRemoteSearchEmpty = computed(() => props.remote && !states.inputValue && states.options.size === 0);
  17502. const emptyText = computed(() => {
  17503. if (props.loading) return props.loadingText || t("el.select.loading");
  17504. else {
  17505. if (props.filterable && states.inputValue && states.options.size > 0 && filteredOptionsCount.value === 0) return props.noMatchText || t("el.select.noMatch");
  17506. if (states.options.size === 0) return props.noDataText || t("el.select.noData");
  17507. }
  17508. return null;
  17509. });
  17510. const filteredOptionsCount = computed(() => optionsArray.value.filter((option) => option.visible).length);
  17511. const optionsArray = computed(() => {
  17512. const list = Array.from(states.options.values());
  17513. const newList = [];
  17514. states.optionValues.forEach((item) => {
  17515. const index = list.findIndex((i) => i.value === item);
  17516. if (index > -1) newList.push(list[index]);
  17517. });
  17518. return newList.length >= list.length ? newList : list;
  17519. });
  17520. const cachedOptionsArray = computed(() => Array.from(states.cachedOptions.values()));
  17521. const showNewOption = computed(() => {
  17522. const hasExistingOption = optionsArray.value.filter((option) => {
  17523. return !option.created;
  17524. }).some((option) => {
  17525. return option.currentLabel === states.inputValue;
  17526. });
  17527. return props.filterable && props.allowCreate && states.inputValue !== "" && !hasExistingOption;
  17528. });
  17529. const updateOptions = () => {
  17530. if (props.filterable && isFunction$1(props.filterMethod)) return;
  17531. if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) return;
  17532. optionsArray.value.forEach((option) => {
  17533. option.updateOption?.(states.inputValue);
  17534. });
  17535. };
  17536. const selectSize = useFormSize();
  17537. const collapseTagSize = computed(() => ["small"].includes(selectSize.value) ? "small" : "default");
  17538. const dropdownMenuVisible = computed({
  17539. get() {
  17540. return expanded.value && (props.loading || !isRemoteSearchEmpty.value || props.remote && !!slots.empty) && (!debouncing.value || !isEmpty(states.previousQuery) || states.options.size > 0);
  17541. },
  17542. set(val) {
  17543. expanded.value = val;
  17544. }
  17545. });
  17546. const shouldShowPlaceholder = computed(() => {
  17547. if (props.multiple && !isUndefined(props.modelValue)) return castArray$1(props.modelValue).length === 0 && !states.inputValue;
  17548. const value = isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue;
  17549. return props.filterable || isUndefined(value) ? !states.inputValue : true;
  17550. });
  17551. const currentPlaceholder = computed(() => {
  17552. const _placeholder = props.placeholder ?? t("el.select.placeholder");
  17553. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  17554. });
  17555. const mouseEnterEventName = isIOS ? null : "mouseenter";
  17556. watch(() => props.modelValue, (val, oldVal) => {
  17557. if (props.multiple) {
  17558. if (props.filterable && !props.reserveKeyword) {
  17559. states.inputValue = "";
  17560. handleQueryChange("");
  17561. }
  17562. }
  17563. setSelected();
  17564. if (!isEqual$1(val, oldVal) && props.validateEvent) formItem?.validate("change").catch(NOOP);
  17565. }, {
  17566. flush: "post",
  17567. deep: true
  17568. });
  17569. watch(() => expanded.value, (val) => {
  17570. if (val) handleQueryChange(states.inputValue);
  17571. else {
  17572. states.inputValue = "";
  17573. states.previousQuery = null;
  17574. states.isBeforeHide = true;
  17575. states.menuVisibleOnFocus = false;
  17576. }
  17577. });
  17578. watch(() => states.options.entries(), () => {
  17579. if (!isClient) return;
  17580. setSelected();
  17581. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) checkDefaultFirstOption();
  17582. }, { flush: "post" });
  17583. watch([() => states.hoveringIndex, optionsArray], ([val]) => {
  17584. if (isNumber(val) && val > -1) hoverOption.value = optionsArray.value[val] || {};
  17585. else hoverOption.value = {};
  17586. optionsArray.value.forEach((option) => {
  17587. option.hover = hoverOption.value === option;
  17588. });
  17589. });
  17590. watchEffect(() => {
  17591. if (states.isBeforeHide) return;
  17592. updateOptions();
  17593. });
  17594. const handleQueryChange = (val) => {
  17595. if (states.previousQuery === val || isComposing.value) return;
  17596. states.previousQuery = val;
  17597. if (props.filterable && isFunction$1(props.filterMethod)) props.filterMethod(val);
  17598. else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) props.remoteMethod(val);
  17599. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptionsCount.value) nextTick(checkDefaultFirstOption);
  17600. else nextTick(updateHoveringIndex);
  17601. };
  17602. const checkDefaultFirstOption = () => {
  17603. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  17604. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  17605. const firstOriginOption = optionsInDropdown[0];
  17606. states.hoveringIndex = getValueIndex(optionsArray.value.map((item) => item.value), userCreatedOption || firstOriginOption);
  17607. };
  17608. const setSelected = () => {
  17609. if (!props.multiple) {
  17610. const option = getOption(isArray$1(props.modelValue) ? props.modelValue[0] : props.modelValue);
  17611. states.selectedLabel = option.currentLabel;
  17612. states.selected = [option];
  17613. return;
  17614. } else states.selectedLabel = "";
  17615. const result = [];
  17616. if (!isUndefined(props.modelValue)) castArray$1(props.modelValue).forEach((value) => {
  17617. result.push(getOption(value));
  17618. });
  17619. states.selected = result;
  17620. };
  17621. const getOption = (value) => {
  17622. let option;
  17623. const isObjectValue = isPlainObject$1(value);
  17624. for (let i = states.cachedOptions.size - 1; i >= 0; i--) {
  17625. const cachedOption = cachedOptionsArray.value[i];
  17626. if (isObjectValue ? get(cachedOption.value, props.valueKey) === get(value, props.valueKey) : cachedOption.value === value) {
  17627. option = {
  17628. index: optionsArray.value.filter((opt) => !opt.created).indexOf(cachedOption),
  17629. value,
  17630. currentLabel: cachedOption.currentLabel,
  17631. get isDisabled() {
  17632. return cachedOption.isDisabled;
  17633. }
  17634. };
  17635. break;
  17636. }
  17637. }
  17638. if (option) return option;
  17639. const existingSelected = states.selected.find((item) => isObjectValue ? get(item.value, props.valueKey) === get(value, props.valueKey) : item.value === value);
  17640. return {
  17641. index: -1,
  17642. value,
  17643. currentLabel: isObjectValue ? value.label : existingSelected ? existingSelected.currentLabel : value ?? ""
  17644. };
  17645. };
  17646. const updateHoveringIndex = () => {
  17647. const length = states.selected.length;
  17648. if (length > 0) {
  17649. const lastOption = states.selected[length - 1];
  17650. states.hoveringIndex = optionsArray.value.findIndex((item) => getValueKey(lastOption) === getValueKey(item));
  17651. } else states.hoveringIndex = -1;
  17652. };
  17653. const resetSelectionWidth = () => {
  17654. states.selectionWidth = Number.parseFloat(window.getComputedStyle(selectionRef.value).width);
  17655. };
  17656. const resetCollapseItemWidth = () => {
  17657. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  17658. };
  17659. const updateTooltip = () => {
  17660. tooltipRef.value?.updatePopper?.();
  17661. };
  17662. const updateTagTooltip = () => {
  17663. tagTooltipRef.value?.updatePopper?.();
  17664. };
  17665. const onInputChange = () => {
  17666. if (states.inputValue.length > 0 && !expanded.value) expanded.value = true;
  17667. handleQueryChange(states.inputValue);
  17668. };
  17669. const onInput = (event) => {
  17670. states.inputValue = event.target.value;
  17671. if (props.remote) {
  17672. debouncing.value = true;
  17673. debouncedOnInputChange();
  17674. } else return onInputChange();
  17675. };
  17676. const debouncedOnInputChange = useDebounceFn(() => {
  17677. onInputChange();
  17678. debouncing.value = false;
  17679. }, debounce);
  17680. const emitChange = (val) => {
  17681. if (!isEqual$1(props.modelValue, val)) emit(CHANGE_EVENT, val);
  17682. };
  17683. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => {
  17684. const option = states.cachedOptions.get(it);
  17685. return !option?.disabled && !option?.states.groupDisabled;
  17686. });
  17687. const deletePrevTag = (e) => {
  17688. const code = getEventCode(e);
  17689. if (!props.multiple) return;
  17690. if (code === EVENT_CODE.delete) return;
  17691. if (e.target.value.length <= 0) {
  17692. const value = castArray$1(props.modelValue).slice();
  17693. const lastNotDisabledIndex = getLastNotDisabledIndex(value);
  17694. if (lastNotDisabledIndex < 0) return;
  17695. const removeTagValue = value[lastNotDisabledIndex];
  17696. value.splice(lastNotDisabledIndex, 1);
  17697. emit(UPDATE_MODEL_EVENT, value);
  17698. emitChange(value);
  17699. emit("remove-tag", removeTagValue);
  17700. }
  17701. };
  17702. const deleteTag = (event, tag) => {
  17703. const index = states.selected.indexOf(tag);
  17704. if (index > -1 && !selectDisabled.value) {
  17705. const value = castArray$1(props.modelValue).slice();
  17706. value.splice(index, 1);
  17707. emit(UPDATE_MODEL_EVENT, value);
  17708. emitChange(value);
  17709. emit("remove-tag", tag.value);
  17710. }
  17711. event.stopPropagation();
  17712. focus();
  17713. };
  17714. const deleteSelected = (event) => {
  17715. event.stopPropagation();
  17716. const value = props.multiple ? [] : valueOnClear.value;
  17717. if (props.multiple) {
  17718. for (const item of states.selected) if (item.isDisabled) value.push(item.value);
  17719. }
  17720. emit(UPDATE_MODEL_EVENT, value);
  17721. emitChange(value);
  17722. states.hoveringIndex = -1;
  17723. expanded.value = false;
  17724. emit("clear");
  17725. focus();
  17726. };
  17727. const handleOptionSelect = (option) => {
  17728. if (props.multiple) {
  17729. const value = castArray$1(props.modelValue ?? []).slice();
  17730. const optionIndex = getValueIndex(value, option);
  17731. if (optionIndex > -1) value.splice(optionIndex, 1);
  17732. else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) value.push(option.value);
  17733. emit(UPDATE_MODEL_EVENT, value);
  17734. emitChange(value);
  17735. if (option.created) handleQueryChange("");
  17736. if (props.filterable && (option.created || !props.reserveKeyword)) states.inputValue = "";
  17737. } else {
  17738. !isEqual$1(props.modelValue, option.value) && emit("update:modelValue", option.value);
  17739. emitChange(option.value);
  17740. expanded.value = false;
  17741. }
  17742. focus();
  17743. if (expanded.value) return;
  17744. nextTick(() => {
  17745. scrollToOption(option);
  17746. });
  17747. };
  17748. const getValueIndex = (arr, option) => {
  17749. if (isUndefined(option)) return -1;
  17750. if (!isObject$1(option.value)) return arr.indexOf(option.value);
  17751. return arr.findIndex((item) => {
  17752. return isEqual$1(get(item, props.valueKey), getValueKey(option));
  17753. });
  17754. };
  17755. const scrollToOption = (option) => {
  17756. const targetOption = isArray$1(option) ? option[option.length - 1] : option;
  17757. let target = null;
  17758. if (!isNil(targetOption?.value)) {
  17759. const options = optionsArray.value.filter((item) => item.value === targetOption.value);
  17760. if (options.length > 0) target = options[0].$el;
  17761. }
  17762. if (tooltipRef.value && target) {
  17763. const menu = tooltipRef.value?.popperRef?.contentRef?.querySelector?.(`.${nsSelect.be("dropdown", "wrap")}`);
  17764. if (menu) scrollIntoView(menu, target);
  17765. }
  17766. scrollbarRef.value?.handleScroll();
  17767. };
  17768. const onOptionCreate = (vm) => {
  17769. states.options.set(vm.value, vm);
  17770. states.cachedOptions.set(vm.value, vm);
  17771. };
  17772. const onOptionDestroy = (key, vm) => {
  17773. if (states.options.get(key) === vm) states.options.delete(key);
  17774. };
  17775. const popperRef = computed(() => {
  17776. return tooltipRef.value?.popperRef?.contentRef;
  17777. });
  17778. const handleMenuEnter = () => {
  17779. states.isBeforeHide = false;
  17780. nextTick(() => {
  17781. scrollbarRef.value?.update();
  17782. scrollToOption(states.selected);
  17783. });
  17784. };
  17785. const focus = () => {
  17786. inputRef.value?.focus();
  17787. };
  17788. const blur = () => {
  17789. if (expanded.value) {
  17790. expanded.value = false;
  17791. nextTick(() => inputRef.value?.blur());
  17792. return;
  17793. }
  17794. inputRef.value?.blur();
  17795. };
  17796. const handleClearClick = (event) => {
  17797. deleteSelected(event);
  17798. };
  17799. const handleClickOutside = (event) => {
  17800. expanded.value = false;
  17801. if (isFocused.value) {
  17802. const _event = new FocusEvent("blur", event);
  17803. nextTick(() => handleBlur(_event));
  17804. }
  17805. };
  17806. const handleEsc = () => {
  17807. if (states.inputValue.length > 0) states.inputValue = "";
  17808. else expanded.value = false;
  17809. };
  17810. const toggleMenu = (event) => {
  17811. if (selectDisabled.value || props.filterable && expanded.value && event && !suffixRef.value?.contains(event.target)) return;
  17812. if (isIOS) states.inputHovering = true;
  17813. if (states.menuVisibleOnFocus) states.menuVisibleOnFocus = false;
  17814. else expanded.value = !expanded.value;
  17815. };
  17816. const selectOption = () => {
  17817. if (!expanded.value) toggleMenu();
  17818. else {
  17819. const option = optionsArray.value[states.hoveringIndex];
  17820. if (option && !option.isDisabled) handleOptionSelect(option);
  17821. }
  17822. };
  17823. const getValueKey = (item) => {
  17824. return isObject$1(item.value) ? get(item.value, props.valueKey) : item.value;
  17825. };
  17826. const optionsAllDisabled = computed(() => optionsArray.value.filter((option) => option.visible).every((option) => option.isDisabled));
  17827. const showTagList = computed(() => {
  17828. if (!props.multiple) return [];
  17829. return props.collapseTags ? states.selected.slice(0, props.maxCollapseTags) : states.selected;
  17830. });
  17831. const collapseTagList = computed(() => {
  17832. if (!props.multiple) return [];
  17833. return props.collapseTags ? states.selected.slice(props.maxCollapseTags) : [];
  17834. });
  17835. const navigateOptions = (direction) => {
  17836. if (!expanded.value) {
  17837. expanded.value = true;
  17838. return;
  17839. }
  17840. if (states.options.size === 0 || filteredOptionsCount.value === 0 || isComposing.value) return;
  17841. if (!optionsAllDisabled.value) {
  17842. if (direction === "next") {
  17843. states.hoveringIndex++;
  17844. if (states.hoveringIndex === states.options.size) states.hoveringIndex = 0;
  17845. } else if (direction === "prev") {
  17846. states.hoveringIndex--;
  17847. if (states.hoveringIndex < 0) states.hoveringIndex = states.options.size - 1;
  17848. }
  17849. const option = optionsArray.value[states.hoveringIndex];
  17850. if (option.isDisabled || !option.visible) navigateOptions(direction);
  17851. nextTick(() => scrollToOption(hoverOption.value));
  17852. }
  17853. };
  17854. const findFocusableIndex = (arr, start, step, len) => {
  17855. for (let i = start; i >= 0 && i < len; i += step) {
  17856. const obj = arr[i];
  17857. if (!obj?.isDisabled && obj?.visible) return i;
  17858. }
  17859. return null;
  17860. };
  17861. const focusOption = (targetIndex, mode) => {
  17862. const len = states.options.size;
  17863. if (len === 0) return;
  17864. const start = clamp$1(targetIndex, 0, len - 1);
  17865. const options = optionsArray.value;
  17866. const direction = mode === "up" ? -1 : 1;
  17867. const newIndex = findFocusableIndex(options, start, direction, len) ?? findFocusableIndex(options, start - direction, -direction, len);
  17868. if (newIndex != null) {
  17869. states.hoveringIndex = newIndex;
  17870. nextTick(() => scrollToOption(hoverOption.value));
  17871. }
  17872. };
  17873. const handleKeydown = (e) => {
  17874. const code = getEventCode(e);
  17875. let isPreventDefault = true;
  17876. switch (code) {
  17877. case EVENT_CODE.up:
  17878. navigateOptions("prev");
  17879. break;
  17880. case EVENT_CODE.down:
  17881. navigateOptions("next");
  17882. break;
  17883. case EVENT_CODE.enter:
  17884. case EVENT_CODE.numpadEnter:
  17885. if (!isComposing.value) selectOption();
  17886. break;
  17887. case EVENT_CODE.esc:
  17888. handleEsc();
  17889. break;
  17890. case EVENT_CODE.backspace:
  17891. isPreventDefault = false;
  17892. deletePrevTag(e);
  17893. return;
  17894. case EVENT_CODE.home:
  17895. if (!expanded.value) return;
  17896. focusOption(0, "down");
  17897. break;
  17898. case EVENT_CODE.end:
  17899. if (!expanded.value) return;
  17900. focusOption(states.options.size - 1, "up");
  17901. break;
  17902. case EVENT_CODE.pageUp:
  17903. if (!expanded.value) return;
  17904. focusOption(states.hoveringIndex - 10, "up");
  17905. break;
  17906. case EVENT_CODE.pageDown:
  17907. if (!expanded.value) return;
  17908. focusOption(states.hoveringIndex + 10, "down");
  17909. break;
  17910. default:
  17911. isPreventDefault = false;
  17912. break;
  17913. }
  17914. if (isPreventDefault) {
  17915. e.preventDefault();
  17916. e.stopPropagation();
  17917. }
  17918. };
  17919. const getGapWidth = () => {
  17920. if (!selectionRef.value) return 0;
  17921. const style = window.getComputedStyle(selectionRef.value);
  17922. return Number.parseFloat(style.gap || "6px");
  17923. };
  17924. const tagStyle = computed(() => {
  17925. const gapWidth = getGapWidth();
  17926. const inputSlotWidth = props.filterable ? gapWidth + 11 : 0;
  17927. return { maxWidth: `${collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth - inputSlotWidth : states.selectionWidth - inputSlotWidth}px` };
  17928. });
  17929. const collapseTagStyle = computed(() => {
  17930. return { maxWidth: `${states.selectionWidth}px` };
  17931. });
  17932. const popupScroll = (data) => {
  17933. emit("popup-scroll", data);
  17934. };
  17935. const endReached = (direction) => {
  17936. emit("end-reached", direction);
  17937. };
  17938. useResizeObserver(selectionRef, resetSelectionWidth);
  17939. useResizeObserver(wrapperRef, updateTooltip);
  17940. useResizeObserver(tagMenuRef, updateTagTooltip);
  17941. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  17942. let stop;
  17943. watch(() => dropdownMenuVisible.value, (newVal) => {
  17944. if (newVal) stop = useResizeObserver(menuRef, updateTooltip).stop;
  17945. else {
  17946. stop?.();
  17947. stop = void 0;
  17948. }
  17949. emit("visible-change", newVal);
  17950. });
  17951. onMounted(() => {
  17952. setSelected();
  17953. });
  17954. return {
  17955. inputId,
  17956. contentId,
  17957. nsSelect,
  17958. nsInput,
  17959. states,
  17960. isFocused,
  17961. expanded,
  17962. optionsArray,
  17963. hoverOption,
  17964. selectSize,
  17965. filteredOptionsCount,
  17966. updateTooltip,
  17967. updateTagTooltip,
  17968. debouncedOnInputChange,
  17969. onInput,
  17970. deletePrevTag,
  17971. deleteTag,
  17972. deleteSelected,
  17973. handleOptionSelect,
  17974. scrollToOption,
  17975. hasModelValue,
  17976. shouldShowPlaceholder,
  17977. currentPlaceholder,
  17978. mouseEnterEventName,
  17979. needStatusIcon,
  17980. showClearBtn,
  17981. iconComponent,
  17982. iconReverse,
  17983. validateState,
  17984. validateIcon,
  17985. showNewOption,
  17986. updateOptions,
  17987. collapseTagSize,
  17988. setSelected,
  17989. selectDisabled,
  17990. emptyText,
  17991. handleCompositionStart,
  17992. handleCompositionUpdate,
  17993. handleCompositionEnd,
  17994. handleKeydown,
  17995. onOptionCreate,
  17996. onOptionDestroy,
  17997. handleMenuEnter,
  17998. focus,
  17999. blur,
  18000. handleClearClick,
  18001. handleClickOutside,
  18002. handleEsc,
  18003. toggleMenu,
  18004. selectOption,
  18005. getValueKey,
  18006. navigateOptions,
  18007. dropdownMenuVisible,
  18008. showTagList,
  18009. collapseTagList,
  18010. popupScroll,
  18011. getOption,
  18012. endReached,
  18013. tagStyle,
  18014. collapseTagStyle,
  18015. popperRef,
  18016. inputRef,
  18017. tooltipRef,
  18018. tagTooltipRef,
  18019. prefixRef,
  18020. suffixRef,
  18021. selectRef,
  18022. wrapperRef,
  18023. selectionRef,
  18024. scrollbarRef,
  18025. menuRef,
  18026. tagMenuRef,
  18027. collapseItemRef
  18028. };
  18029. };
  18030. //#endregion
  18031. //#region ../../packages/components/select/src/options.ts
  18032. var options_default = defineComponent({
  18033. name: "ElOptions",
  18034. setup(_, { slots }) {
  18035. const select = inject(selectKey);
  18036. let cachedValueList = [];
  18037. return () => {
  18038. const children = slots.default?.();
  18039. const valueList = [];
  18040. function filterOptions(children) {
  18041. if (!isArray$1(children)) return;
  18042. children.forEach((item) => {
  18043. const name = (item?.type || {})?.name;
  18044. if (name === "ElOptionGroup") filterOptions(!isString(item.children) && !isArray$1(item.children) && isFunction$1(item.children?.default) ? item.children?.default() : item.children);
  18045. else if (name === "ElOption") valueList.push(item.props?.value);
  18046. else if (isArray$1(item.children)) filterOptions(item.children);
  18047. });
  18048. }
  18049. if (children.length) filterOptions(children[0]?.children);
  18050. if (!isEqual$1(valueList, cachedValueList)) {
  18051. cachedValueList = valueList;
  18052. if (select) select.states.optionValues = valueList;
  18053. }
  18054. return children;
  18055. };
  18056. }
  18057. });
  18058. //#endregion
  18059. //#region ../../packages/components/select/src/select.ts
  18060. const selectProps = buildProps({
  18061. name: String,
  18062. id: String,
  18063. modelValue: {
  18064. type: definePropType([
  18065. Array,
  18066. String,
  18067. Number,
  18068. Boolean,
  18069. Object
  18070. ]),
  18071. default: void 0
  18072. },
  18073. autocomplete: {
  18074. type: String,
  18075. default: "off"
  18076. },
  18077. automaticDropdown: Boolean,
  18078. size: useSizeProp,
  18079. effect: {
  18080. type: definePropType(String),
  18081. default: "light"
  18082. },
  18083. disabled: {
  18084. type: Boolean,
  18085. default: void 0
  18086. },
  18087. clearable: Boolean,
  18088. filterable: Boolean,
  18089. allowCreate: Boolean,
  18090. loading: Boolean,
  18091. popperClass: {
  18092. type: String,
  18093. default: ""
  18094. },
  18095. popperStyle: { type: definePropType([String, Object]) },
  18096. popperOptions: {
  18097. type: definePropType(Object),
  18098. default: () => ({})
  18099. },
  18100. remote: Boolean,
  18101. debounce: {
  18102. type: Number,
  18103. default: 300
  18104. },
  18105. loadingText: String,
  18106. noMatchText: String,
  18107. noDataText: String,
  18108. remoteMethod: { type: definePropType(Function) },
  18109. filterMethod: { type: definePropType(Function) },
  18110. multiple: Boolean,
  18111. multipleLimit: {
  18112. type: Number,
  18113. default: 0
  18114. },
  18115. placeholder: { type: String },
  18116. defaultFirstOption: Boolean,
  18117. reserveKeyword: {
  18118. type: Boolean,
  18119. default: true
  18120. },
  18121. valueKey: {
  18122. type: String,
  18123. default: "value"
  18124. },
  18125. collapseTags: Boolean,
  18126. collapseTagsTooltip: Boolean,
  18127. tagTooltip: {
  18128. type: definePropType(Object),
  18129. default: () => ({})
  18130. },
  18131. maxCollapseTags: {
  18132. type: Number,
  18133. default: 1
  18134. },
  18135. teleported: useTooltipContentProps.teleported,
  18136. persistent: {
  18137. type: Boolean,
  18138. default: true
  18139. },
  18140. clearIcon: {
  18141. type: iconPropType,
  18142. default: circle_close_default
  18143. },
  18144. fitInputWidth: Boolean,
  18145. suffixIcon: {
  18146. type: iconPropType,
  18147. default: arrow_down_default
  18148. },
  18149. tagType: {
  18150. ...tagProps.type,
  18151. default: "info"
  18152. },
  18153. tagEffect: {
  18154. ...tagProps.effect,
  18155. default: "light"
  18156. },
  18157. validateEvent: {
  18158. type: Boolean,
  18159. default: true
  18160. },
  18161. remoteShowSuffix: Boolean,
  18162. showArrow: {
  18163. type: Boolean,
  18164. default: true
  18165. },
  18166. offset: {
  18167. type: Number,
  18168. default: 12
  18169. },
  18170. placement: {
  18171. type: definePropType(String),
  18172. values: Ee,
  18173. default: "bottom-start"
  18174. },
  18175. fallbackPlacements: {
  18176. type: definePropType(Array),
  18177. default: [
  18178. "bottom-start",
  18179. "top-start",
  18180. "right",
  18181. "left"
  18182. ]
  18183. },
  18184. tabindex: {
  18185. type: [String, Number],
  18186. default: 0
  18187. },
  18188. appendTo: useTooltipContentProps.appendTo,
  18189. options: { type: definePropType(Array) },
  18190. props: {
  18191. type: definePropType(Object),
  18192. default: () => defaultProps$2
  18193. },
  18194. ...useEmptyValuesProps,
  18195. ...useAriaProps(["ariaLabel"])
  18196. });
  18197. const selectEmits = {
  18198. [UPDATE_MODEL_EVENT]: (val) => true,
  18199. [CHANGE_EVENT]: (val) => true,
  18200. "popup-scroll": scrollbarEmits.scroll,
  18201. "end-reached": scrollbarEmits["end-reached"],
  18202. "remove-tag": (val) => true,
  18203. "visible-change": (visible) => true,
  18204. focus: (evt) => evt instanceof FocusEvent,
  18205. blur: (evt) => evt instanceof FocusEvent,
  18206. clear: () => true
  18207. };
  18208. //#endregion
  18209. //#region ../../packages/components/select/src/option-group.vue?vue&type=script&lang.ts
  18210. var option_group_vue_vue_type_script_lang_default = defineComponent({
  18211. name: "ElOptionGroup",
  18212. componentName: "ElOptionGroup",
  18213. props: {
  18214. label: String,
  18215. disabled: Boolean
  18216. },
  18217. setup(props) {
  18218. const ns = useNamespace("select");
  18219. const groupRef = ref();
  18220. const instance = getCurrentInstance();
  18221. const children = ref([]);
  18222. provide(selectGroupKey, reactive({ ...toRefs(props) }));
  18223. const visible = computed(() => children.value.some((option) => option.visible === true));
  18224. const isOption = (node) => node.type.name === "ElOption" && !!node.component?.proxy;
  18225. const flattedChildren = (node) => {
  18226. const nodes = castArray$1(node);
  18227. const children = [];
  18228. nodes.forEach((child) => {
  18229. if (!isVNode(child)) return;
  18230. if (isOption(child)) children.push(child.component.proxy);
  18231. else if (isArray$1(child.children) && child.children.length) children.push(...flattedChildren(child.children));
  18232. else if (child.component?.subTree) children.push(...flattedChildren(child.component.subTree));
  18233. });
  18234. return children;
  18235. };
  18236. const updateChildren = () => {
  18237. children.value = flattedChildren(instance.subTree);
  18238. };
  18239. onMounted(() => {
  18240. updateChildren();
  18241. });
  18242. useMutationObserver(groupRef, updateChildren, {
  18243. attributes: true,
  18244. subtree: true,
  18245. childList: true
  18246. });
  18247. return {
  18248. groupRef,
  18249. visible,
  18250. ns
  18251. };
  18252. }
  18253. });
  18254. //#endregion
  18255. //#region ../../packages/components/select/src/option-group.vue
  18256. function _sfc_render$17(_ctx, _cache, $props, $setup, $data, $options) {
  18257. return withDirectives((openBlock(), createElementBlock("ul", {
  18258. ref: "groupRef",
  18259. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  18260. }, [createElementVNode("li", { class: normalizeClass(_ctx.ns.be("group", "title")) }, toDisplayString(_ctx.label), 3), createElementVNode("li", null, [createElementVNode("ul", { class: normalizeClass(_ctx.ns.b("group")) }, [renderSlot(_ctx.$slots, "default")], 2)])], 2)), [[vShow, _ctx.visible]]);
  18261. }
  18262. var option_group_default = /* @__PURE__ */ _plugin_vue_export_helper_default(option_group_vue_vue_type_script_lang_default, [["render", _sfc_render$17]]);
  18263. //#endregion
  18264. //#region ../../packages/components/select/src/select.vue?vue&type=script&lang.ts
  18265. const COMPONENT_NAME$13 = "ElSelect";
  18266. const warnHandlerMap = /* @__PURE__ */ new WeakMap();
  18267. const createSelectWarnHandler = (appContext) => {
  18268. return (...args) => {
  18269. const message = args[0];
  18270. if (!message || message.includes("Slot \"default\" invoked outside of the render function") && args[2]?.includes("ElTreeSelect")) return;
  18271. const original = warnHandlerMap.get(appContext)?.originalWarnHandler;
  18272. if (original) {
  18273. original(...args);
  18274. return;
  18275. }
  18276. console.warn(...args);
  18277. };
  18278. };
  18279. const getWarnHandlerRecord = (appContext) => {
  18280. let record = warnHandlerMap.get(appContext);
  18281. if (!record) {
  18282. record = {
  18283. originalWarnHandler: appContext.config.warnHandler,
  18284. handler: createSelectWarnHandler(appContext),
  18285. count: 0
  18286. };
  18287. warnHandlerMap.set(appContext, record);
  18288. }
  18289. return record;
  18290. };
  18291. var select_vue_vue_type_script_lang_default$1 = defineComponent({
  18292. name: COMPONENT_NAME$13,
  18293. componentName: COMPONENT_NAME$13,
  18294. components: {
  18295. ElSelectMenu: select_dropdown_default$1,
  18296. ElOption: option_default,
  18297. ElOptions: options_default,
  18298. ElOptionGroup: option_group_default,
  18299. ElTag,
  18300. ElScrollbar,
  18301. ElTooltip,
  18302. ElIcon
  18303. },
  18304. directives: { ClickOutside },
  18305. props: selectProps,
  18306. emits: selectEmits,
  18307. setup(props, { emit, slots }) {
  18308. const instance = getCurrentInstance();
  18309. const warnRecord = getWarnHandlerRecord(instance.appContext);
  18310. warnRecord.count += 1;
  18311. instance.appContext.config.warnHandler = warnRecord.handler;
  18312. const modelValue = computed(() => {
  18313. const { modelValue: rawModelValue, multiple } = props;
  18314. const fallback = multiple ? [] : void 0;
  18315. if (isArray$1(rawModelValue)) return multiple ? rawModelValue : fallback;
  18316. return multiple ? fallback : rawModelValue;
  18317. });
  18318. const _props = reactive({
  18319. ...toRefs(props),
  18320. modelValue
  18321. });
  18322. const API = useSelect$2(_props, emit);
  18323. const { calculatorRef, inputStyle } = useCalcInputWidth();
  18324. const { getLabel, getValue, getOptions, getDisabled } = useProps(props);
  18325. const getOptionProps = (option) => ({
  18326. label: getLabel(option),
  18327. value: getValue(option),
  18328. disabled: getDisabled(option)
  18329. });
  18330. const flatTreeSelectData = (data) => {
  18331. return data.reduce((acc, item) => {
  18332. acc.push(item);
  18333. if (item.children && item.children.length > 0) acc.push(...flatTreeSelectData(item.children));
  18334. return acc;
  18335. }, []);
  18336. };
  18337. const manuallyRenderSlots = (vnodes) => {
  18338. flattedChildren(vnodes || []).forEach((item) => {
  18339. if (isObject$1(item) && (item.type.name === "ElOption" || item.type.name === "ElTree")) {
  18340. const _name = item.type.name;
  18341. if (_name === "ElTree") flatTreeSelectData(item.props?.data || []).forEach((treeItem) => {
  18342. treeItem.currentLabel = treeItem.label ?? (isObject$1(treeItem.value) ? "" : treeItem.value);
  18343. API.onOptionCreate(treeItem);
  18344. });
  18345. else if (_name === "ElOption") {
  18346. const obj = { ...item.props };
  18347. obj.currentLabel = obj.label ?? (isObject$1(obj.value) ? "" : obj.value);
  18348. API.onOptionCreate(obj);
  18349. }
  18350. }
  18351. });
  18352. };
  18353. watch(() => [props.persistent || API.expanded.value || !slots.default ? void 0 : slots.default?.(), modelValue.value], () => {
  18354. if (props.persistent || API.expanded.value) return;
  18355. if (!slots.default) return;
  18356. API.states.options.clear();
  18357. manuallyRenderSlots(slots.default?.());
  18358. }, { immediate: true });
  18359. provide(selectKey, reactive({
  18360. props: _props,
  18361. states: API.states,
  18362. selectRef: API.selectRef,
  18363. optionsArray: API.optionsArray,
  18364. setSelected: API.setSelected,
  18365. handleOptionSelect: API.handleOptionSelect,
  18366. onOptionCreate: API.onOptionCreate,
  18367. onOptionDestroy: API.onOptionDestroy
  18368. }));
  18369. const selectedLabel = computed(() => {
  18370. if (!props.multiple) return API.states.selectedLabel;
  18371. return API.states.selected.map((i) => i.currentLabel);
  18372. });
  18373. onBeforeUnmount(() => {
  18374. const record = warnHandlerMap.get(instance.appContext);
  18375. if (!record) return;
  18376. record.count -= 1;
  18377. if (record.count <= 0) {
  18378. instance.appContext.config.warnHandler = record.originalWarnHandler;
  18379. warnHandlerMap.delete(instance.appContext);
  18380. }
  18381. });
  18382. return {
  18383. ...API,
  18384. modelValue,
  18385. selectedLabel,
  18386. calculatorRef,
  18387. inputStyle,
  18388. getLabel,
  18389. getValue,
  18390. getOptions,
  18391. getDisabled,
  18392. getOptionProps
  18393. };
  18394. }
  18395. });
  18396. //#endregion
  18397. //#region ../../packages/components/select/src/select.vue
  18398. const _hoisted_1$66 = [
  18399. "id",
  18400. "value",
  18401. "name",
  18402. "disabled",
  18403. "autocomplete",
  18404. "tabindex",
  18405. "readonly",
  18406. "aria-activedescendant",
  18407. "aria-controls",
  18408. "aria-expanded",
  18409. "aria-label"
  18410. ];
  18411. const _hoisted_2$37 = ["textContent"];
  18412. const _hoisted_3$18 = { key: 1 };
  18413. function _sfc_render$16(_ctx, _cache, $props, $setup, $data, $options) {
  18414. const _component_el_tag = resolveComponent("el-tag");
  18415. const _component_el_tooltip = resolveComponent("el-tooltip");
  18416. const _component_el_icon = resolveComponent("el-icon");
  18417. const _component_el_option = resolveComponent("el-option");
  18418. const _component_el_option_group = resolveComponent("el-option-group");
  18419. const _component_el_options = resolveComponent("el-options");
  18420. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  18421. const _component_el_select_menu = resolveComponent("el-select-menu");
  18422. const _directive_click_outside = resolveDirective("click-outside");
  18423. return withDirectives((openBlock(), createElementBlock("div", mergeProps({
  18424. ref: "selectRef",
  18425. class: [_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]
  18426. }, { [toHandlerKey(_ctx.mouseEnterEventName)]: _cache[11] || (_cache[11] = ($event) => _ctx.states.inputHovering = true) }, { onMouseleave: _cache[12] || (_cache[12] = ($event) => _ctx.states.inputHovering = false) }), [createVNode(_component_el_tooltip, {
  18427. ref: "tooltipRef",
  18428. visible: _ctx.dropdownMenuVisible,
  18429. placement: _ctx.placement,
  18430. teleported: _ctx.teleported,
  18431. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  18432. "popper-style": _ctx.popperStyle,
  18433. "popper-options": _ctx.popperOptions,
  18434. "fallback-placements": _ctx.fallbackPlacements,
  18435. effect: _ctx.effect,
  18436. pure: "",
  18437. trigger: "click",
  18438. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  18439. "stop-popper-mouse-event": false,
  18440. "gpu-acceleration": false,
  18441. persistent: _ctx.persistent,
  18442. "append-to": _ctx.appendTo,
  18443. "show-arrow": _ctx.showArrow,
  18444. offset: _ctx.offset,
  18445. onBeforeShow: _ctx.handleMenuEnter,
  18446. onHide: _cache[10] || (_cache[10] = ($event) => _ctx.states.isBeforeHide = false)
  18447. }, {
  18448. default: withCtx(() => [createElementVNode("div", {
  18449. ref: "wrapperRef",
  18450. class: normalizeClass([
  18451. _ctx.nsSelect.e("wrapper"),
  18452. _ctx.nsSelect.is("focused", _ctx.isFocused),
  18453. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  18454. _ctx.nsSelect.is("filterable", _ctx.filterable),
  18455. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  18456. ]),
  18457. onClick: _cache[7] || (_cache[7] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["prevent"]))
  18458. }, [
  18459. _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
  18460. key: 0,
  18461. ref: "prefixRef",
  18462. class: normalizeClass(_ctx.nsSelect.e("prefix"))
  18463. }, [renderSlot(_ctx.$slots, "prefix")], 2)) : createCommentVNode("v-if", true),
  18464. createElementVNode("div", {
  18465. ref: "selectionRef",
  18466. class: normalizeClass([_ctx.nsSelect.e("selection"), _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.states.selected.length)])
  18467. }, [
  18468. _ctx.multiple ? renderSlot(_ctx.$slots, "tag", {
  18469. key: 0,
  18470. data: _ctx.states.selected,
  18471. deleteTag: _ctx.deleteTag,
  18472. selectDisabled: _ctx.selectDisabled
  18473. }, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  18474. return openBlock(), createElementBlock("div", {
  18475. key: _ctx.getValueKey(item),
  18476. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  18477. }, [createVNode(_component_el_tag, {
  18478. closable: !_ctx.selectDisabled && !item.isDisabled,
  18479. size: _ctx.collapseTagSize,
  18480. type: _ctx.tagType,
  18481. effect: _ctx.tagEffect,
  18482. "disable-transitions": "",
  18483. style: normalizeStyle(_ctx.tagStyle),
  18484. onClose: ($event) => _ctx.deleteTag($event, item)
  18485. }, {
  18486. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, [renderSlot(_ctx.$slots, "label", {
  18487. index: item.index,
  18488. label: item.currentLabel,
  18489. value: item.value
  18490. }, () => [createTextVNode(toDisplayString(item.currentLabel), 1)])], 2)]),
  18491. _: 2
  18492. }, 1032, [
  18493. "closable",
  18494. "size",
  18495. "type",
  18496. "effect",
  18497. "style",
  18498. "onClose"
  18499. ])], 2);
  18500. }), 128)), _ctx.collapseTags && _ctx.states.selected.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tooltip, {
  18501. key: 0,
  18502. ref: "tagTooltipRef",
  18503. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  18504. "fallback-placements": _ctx.tagTooltip?.fallbackPlacements ?? [
  18505. "bottom",
  18506. "top",
  18507. "right",
  18508. "left"
  18509. ],
  18510. effect: _ctx.tagTooltip?.effect ?? _ctx.effect,
  18511. placement: _ctx.tagTooltip?.placement ?? "bottom",
  18512. "popper-class": _ctx.tagTooltip?.popperClass ?? _ctx.popperClass,
  18513. "popper-style": _ctx.tagTooltip?.popperStyle ?? _ctx.popperStyle,
  18514. teleported: _ctx.tagTooltip?.teleported ?? _ctx.teleported,
  18515. "append-to": _ctx.tagTooltip?.appendTo ?? _ctx.appendTo,
  18516. "popper-options": _ctx.tagTooltip?.popperOptions ?? _ctx.popperOptions,
  18517. transition: _ctx.tagTooltip?.transition,
  18518. "show-after": _ctx.tagTooltip?.showAfter,
  18519. "hide-after": _ctx.tagTooltip?.hideAfter,
  18520. "auto-close": _ctx.tagTooltip?.autoClose,
  18521. offset: _ctx.tagTooltip?.offset
  18522. }, {
  18523. default: withCtx(() => [createElementVNode("div", {
  18524. ref: "collapseItemRef",
  18525. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  18526. }, [createVNode(_component_el_tag, {
  18527. closable: false,
  18528. size: _ctx.collapseTagSize,
  18529. type: _ctx.tagType,
  18530. effect: _ctx.tagEffect,
  18531. "disable-transitions": "",
  18532. style: normalizeStyle(_ctx.collapseTagStyle)
  18533. }, {
  18534. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, " + " + toDisplayString(_ctx.states.selected.length - _ctx.maxCollapseTags), 3)]),
  18535. _: 1
  18536. }, 8, [
  18537. "size",
  18538. "type",
  18539. "effect",
  18540. "style"
  18541. ])], 2)]),
  18542. content: withCtx(() => [createElementVNode("div", {
  18543. ref: "tagMenuRef",
  18544. class: normalizeClass(_ctx.nsSelect.e("selection"))
  18545. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (item) => {
  18546. return openBlock(), createElementBlock("div", {
  18547. key: _ctx.getValueKey(item),
  18548. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  18549. }, [createVNode(_component_el_tag, {
  18550. class: "in-tooltip",
  18551. closable: !_ctx.selectDisabled && !item.isDisabled,
  18552. size: _ctx.collapseTagSize,
  18553. type: _ctx.tagType,
  18554. effect: _ctx.tagEffect,
  18555. "disable-transitions": "",
  18556. onClose: ($event) => _ctx.deleteTag($event, item)
  18557. }, {
  18558. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, [renderSlot(_ctx.$slots, "label", {
  18559. index: item.index,
  18560. label: item.currentLabel,
  18561. value: item.value
  18562. }, () => [createTextVNode(toDisplayString(item.currentLabel), 1)])], 2)]),
  18563. _: 2
  18564. }, 1032, [
  18565. "closable",
  18566. "size",
  18567. "type",
  18568. "effect",
  18569. "onClose"
  18570. ])], 2);
  18571. }), 128))], 2)]),
  18572. _: 3
  18573. }, 8, [
  18574. "disabled",
  18575. "fallback-placements",
  18576. "effect",
  18577. "placement",
  18578. "popper-class",
  18579. "popper-style",
  18580. "teleported",
  18581. "append-to",
  18582. "popper-options",
  18583. "transition",
  18584. "show-after",
  18585. "hide-after",
  18586. "auto-close",
  18587. "offset"
  18588. ])) : createCommentVNode("v-if", true)]) : createCommentVNode("v-if", true),
  18589. createElementVNode("div", { class: normalizeClass([
  18590. _ctx.nsSelect.e("selected-item"),
  18591. _ctx.nsSelect.e("input-wrapper"),
  18592. _ctx.nsSelect.is("hidden", !_ctx.filterable || _ctx.selectDisabled || _ctx.multiple && !_ctx.states.inputValue && !_ctx.isFocused)
  18593. ]) }, [createElementVNode("input", {
  18594. id: _ctx.inputId,
  18595. ref: "inputRef",
  18596. value: _ctx.states.inputValue,
  18597. type: "text",
  18598. name: _ctx.name,
  18599. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  18600. disabled: _ctx.selectDisabled,
  18601. autocomplete: _ctx.autocomplete,
  18602. style: normalizeStyle(_ctx.inputStyle),
  18603. tabindex: _ctx.tabindex,
  18604. role: "combobox",
  18605. readonly: !_ctx.filterable,
  18606. spellcheck: "false",
  18607. "aria-activedescendant": _ctx.hoverOption?.id || "",
  18608. "aria-controls": _ctx.contentId,
  18609. "aria-expanded": _ctx.dropdownMenuVisible,
  18610. "aria-label": _ctx.ariaLabel,
  18611. "aria-autocomplete": "none",
  18612. "aria-haspopup": "listbox",
  18613. onKeydown: _cache[0] || (_cache[0] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args)),
  18614. onCompositionstart: _cache[1] || (_cache[1] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  18615. onCompositionupdate: _cache[2] || (_cache[2] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  18616. onCompositionend: _cache[3] || (_cache[3] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  18617. onInput: _cache[4] || (_cache[4] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  18618. onChange: _cache[5] || (_cache[5] = withModifiers(() => {}, ["stop"])),
  18619. onClick: _cache[6] || (_cache[6] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  18620. }, null, 46, _hoisted_1$66), _ctx.filterable ? (openBlock(), createElementBlock("span", {
  18621. key: 0,
  18622. ref: "calculatorRef",
  18623. "aria-hidden": "true",
  18624. class: normalizeClass(_ctx.nsSelect.e("input-calculator")),
  18625. textContent: toDisplayString(_ctx.states.inputValue)
  18626. }, null, 10, _hoisted_2$37)) : createCommentVNode("v-if", true)], 2),
  18627. _ctx.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", {
  18628. key: 1,
  18629. class: normalizeClass([
  18630. _ctx.nsSelect.e("selected-item"),
  18631. _ctx.nsSelect.e("placeholder"),
  18632. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  18633. ])
  18634. }, [_ctx.hasModelValue ? renderSlot(_ctx.$slots, "label", {
  18635. key: 0,
  18636. index: _ctx.getOption(_ctx.modelValue).index,
  18637. label: _ctx.currentPlaceholder,
  18638. value: _ctx.modelValue
  18639. }, () => [createElementVNode("span", null, toDisplayString(_ctx.currentPlaceholder), 1)]) : (openBlock(), createElementBlock("span", _hoisted_3$18, toDisplayString(_ctx.currentPlaceholder), 1))], 2)) : createCommentVNode("v-if", true)
  18640. ], 2),
  18641. createElementVNode("div", {
  18642. ref: "suffixRef",
  18643. class: normalizeClass(_ctx.nsSelect.e("suffix"))
  18644. }, [
  18645. _ctx.iconComponent && !_ctx.showClearBtn ? (openBlock(), createBlock(_component_el_icon, {
  18646. key: 0,
  18647. class: normalizeClass([
  18648. _ctx.nsSelect.e("caret"),
  18649. _ctx.nsSelect.e("icon"),
  18650. _ctx.iconReverse
  18651. ])
  18652. }, {
  18653. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))]),
  18654. _: 1
  18655. }, 8, ["class"])) : createCommentVNode("v-if", true),
  18656. _ctx.showClearBtn && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  18657. key: 1,
  18658. class: normalizeClass([
  18659. _ctx.nsSelect.e("caret"),
  18660. _ctx.nsSelect.e("icon"),
  18661. _ctx.nsSelect.e("clear")
  18662. ]),
  18663. onClick: _ctx.handleClearClick
  18664. }, {
  18665. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))]),
  18666. _: 1
  18667. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  18668. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (openBlock(), createBlock(_component_el_icon, {
  18669. key: 2,
  18670. class: normalizeClass([
  18671. _ctx.nsInput.e("icon"),
  18672. _ctx.nsInput.e("validateIcon"),
  18673. _ctx.nsInput.is("loading", _ctx.validateState === "validating")
  18674. ])
  18675. }, {
  18676. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.validateIcon)))]),
  18677. _: 1
  18678. }, 8, ["class"])) : createCommentVNode("v-if", true)
  18679. ], 2)
  18680. ], 2)]),
  18681. content: withCtx(() => [createVNode(_component_el_select_menu, { ref: "menuRef" }, {
  18682. default: withCtx(() => [
  18683. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  18684. key: 0,
  18685. class: normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
  18686. onClick: _cache[8] || (_cache[8] = withModifiers(() => {}, ["stop"]))
  18687. }, [renderSlot(_ctx.$slots, "header")], 2)) : createCommentVNode("v-if", true),
  18688. withDirectives(createVNode(_component_el_scrollbar, {
  18689. id: _ctx.contentId,
  18690. ref: "scrollbarRef",
  18691. tag: "ul",
  18692. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  18693. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  18694. class: normalizeClass([_ctx.nsSelect.is("empty", _ctx.filteredOptionsCount === 0)]),
  18695. role: "listbox",
  18696. "aria-label": _ctx.ariaLabel,
  18697. "aria-orientation": "vertical",
  18698. onScroll: _ctx.popupScroll,
  18699. onEndReached: _ctx.endReached
  18700. }, {
  18701. default: withCtx(() => [_ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  18702. key: 0,
  18703. value: _ctx.states.inputValue,
  18704. created: true
  18705. }, null, 8, ["value"])) : createCommentVNode("v-if", true), createVNode(_component_el_options, null, {
  18706. default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
  18707. return openBlock(), createElementBlock(Fragment, { key: index }, [_ctx.getOptions(option)?.length ? (openBlock(), createBlock(_component_el_option_group, {
  18708. key: 0,
  18709. label: _ctx.getLabel(option),
  18710. disabled: _ctx.getDisabled(option)
  18711. }, {
  18712. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.getOptions(option), (item) => {
  18713. return openBlock(), createBlock(_component_el_option, mergeProps({ key: _ctx.getValue(item) }, { ref_for: true }, _ctx.getOptionProps(item)), null, 16);
  18714. }), 128))]),
  18715. _: 2
  18716. }, 1032, ["label", "disabled"])) : (openBlock(), createBlock(_component_el_option, mergeProps({
  18717. key: 1,
  18718. ref_for: true
  18719. }, _ctx.getOptionProps(option)), null, 16))], 64);
  18720. }), 128))])]),
  18721. _: 3
  18722. })]),
  18723. _: 3
  18724. }, 8, [
  18725. "id",
  18726. "wrap-class",
  18727. "view-class",
  18728. "class",
  18729. "aria-label",
  18730. "onScroll",
  18731. "onEndReached"
  18732. ]), [[vShow, _ctx.states.options.size > 0 && !_ctx.loading]]),
  18733. _ctx.$slots.loading && _ctx.loading ? (openBlock(), createElementBlock("div", {
  18734. key: 1,
  18735. class: normalizeClass(_ctx.nsSelect.be("dropdown", "loading"))
  18736. }, [renderSlot(_ctx.$slots, "loading")], 2)) : _ctx.loading || _ctx.filteredOptionsCount === 0 ? (openBlock(), createElementBlock("div", {
  18737. key: 2,
  18738. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  18739. }, [renderSlot(_ctx.$slots, "empty", {}, () => [createElementVNode("span", null, toDisplayString(_ctx.emptyText), 1)])], 2)) : createCommentVNode("v-if", true),
  18740. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  18741. key: 3,
  18742. class: normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
  18743. onClick: _cache[9] || (_cache[9] = withModifiers(() => {}, ["stop"]))
  18744. }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true)
  18745. ]),
  18746. _: 3
  18747. }, 512)]),
  18748. _: 3
  18749. }, 8, [
  18750. "visible",
  18751. "placement",
  18752. "teleported",
  18753. "popper-class",
  18754. "popper-style",
  18755. "popper-options",
  18756. "fallback-placements",
  18757. "effect",
  18758. "transition",
  18759. "persistent",
  18760. "append-to",
  18761. "show-arrow",
  18762. "offset",
  18763. "onBeforeShow"
  18764. ])], 16)), [[
  18765. _directive_click_outside,
  18766. _ctx.handleClickOutside,
  18767. _ctx.popperRef
  18768. ]]);
  18769. }
  18770. var select_default$1 = /* @__PURE__ */ _plugin_vue_export_helper_default(select_vue_vue_type_script_lang_default$1, [["render", _sfc_render$16]]);
  18771. //#endregion
  18772. //#region ../../packages/components/select/index.ts
  18773. const ElSelect = withInstall(select_default$1, {
  18774. Option: option_default,
  18775. OptionGroup: option_group_default
  18776. });
  18777. const ElOption = withNoopInstall(option_default);
  18778. const ElOptionGroup = withNoopInstall(option_group_default);
  18779. //#endregion
  18780. //#region ../../packages/components/calendar/src/select-controller.vue?vue&type=script&setup=true&lang.ts
  18781. var select_controller_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  18782. name: "SelectController",
  18783. __name: "select-controller",
  18784. props: selectControllerProps,
  18785. emits: selectControllerEmits,
  18786. setup(__props, { emit: __emit }) {
  18787. const props = __props;
  18788. const emit = __emit;
  18789. const nsSelect = useNamespace("calendar-select");
  18790. const { t, lang } = useLocale();
  18791. const monthOptions = Array.from({ length: 12 }, (_, index) => {
  18792. const actualMonth = index + 1;
  18793. return {
  18794. value: actualMonth,
  18795. label: isFunction$1(props.formatter) ? props.formatter(actualMonth, "month") : actualMonth
  18796. };
  18797. });
  18798. const yearValue = computed(() => props.date.year());
  18799. const monthValue = computed(() => props.date.month() + 1);
  18800. const yearOptions = computed(() => {
  18801. const years = [];
  18802. for (let i = -10; i < 10; i++) {
  18803. const year = yearValue.value + i;
  18804. if (year > 0) {
  18805. const label = isFunction$1(props.formatter) ? props.formatter(year, "year") : year;
  18806. years.push({
  18807. value: year,
  18808. label
  18809. });
  18810. }
  18811. }
  18812. return years;
  18813. });
  18814. const handleYearChange = (year) => {
  18815. emit("date-change", (0, import_dayjs_min.default)(new Date(year, monthValue.value - 1, 1)).locale(lang.value));
  18816. };
  18817. const handleMonthChange = (month) => {
  18818. emit("date-change", (0, import_dayjs_min.default)(new Date(yearValue.value, month - 1, 1)).locale(lang.value));
  18819. };
  18820. const selectToday = () => {
  18821. emit("date-change", "today");
  18822. };
  18823. return (_ctx, _cache) => {
  18824. return openBlock(), createElementBlock(Fragment, null, [
  18825. createVNode(unref(ElSelect), {
  18826. "model-value": yearValue.value,
  18827. size: "small",
  18828. class: normalizeClass(unref(nsSelect).e("year")),
  18829. "validate-event": false,
  18830. options: yearOptions.value,
  18831. onChange: handleYearChange
  18832. }, null, 8, [
  18833. "model-value",
  18834. "class",
  18835. "options"
  18836. ]),
  18837. createVNode(unref(ElSelect), {
  18838. "model-value": monthValue.value,
  18839. size: "small",
  18840. class: normalizeClass(unref(nsSelect).e("month")),
  18841. "validate-event": false,
  18842. options: unref(monthOptions),
  18843. onChange: handleMonthChange
  18844. }, null, 8, [
  18845. "model-value",
  18846. "class",
  18847. "options"
  18848. ]),
  18849. createVNode(unref(ElButton), {
  18850. size: "small",
  18851. onClick: selectToday
  18852. }, {
  18853. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.today")), 1)]),
  18854. _: 1
  18855. })
  18856. ], 64);
  18857. };
  18858. }
  18859. });
  18860. //#endregion
  18861. //#region ../../packages/components/calendar/src/select-controller.vue
  18862. var select_controller_default = select_controller_vue_vue_type_script_setup_true_lang_default;
  18863. //#endregion
  18864. //#region ../../packages/components/calendar/src/calendar.vue?vue&type=script&setup=true&lang.ts
  18865. const COMPONENT_NAME$12 = "ElCalendar";
  18866. var calendar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  18867. name: COMPONENT_NAME$12,
  18868. __name: "calendar",
  18869. props: calendarProps,
  18870. emits: calendarEmits,
  18871. setup(__props, { expose: __expose, emit: __emit }) {
  18872. const ns = useNamespace("calendar");
  18873. const { calculateValidatedDateRange, date, pickDay, realSelectedDay, selectDate, validatedRange, handleDateChange } = useCalendar(__props, __emit, COMPONENT_NAME$12);
  18874. const { t } = useLocale();
  18875. const i18nDate = computed(() => {
  18876. const pickedMonth = `el.datepicker.month${date.value.format("M")}`;
  18877. return `${date.value.year()} ${t("el.datepicker.year")} ${t(pickedMonth)}`;
  18878. });
  18879. __expose({
  18880. selectedDay: realSelectedDay,
  18881. pickDay,
  18882. selectDate,
  18883. calculateValidatedDateRange
  18884. });
  18885. return (_ctx, _cache) => {
  18886. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b()) }, [createElementVNode("div", { class: normalizeClass(unref(ns).e("header")) }, [renderSlot(_ctx.$slots, "header", { date: i18nDate.value }, () => [createElementVNode("div", { class: normalizeClass(unref(ns).e("title")) }, toDisplayString(i18nDate.value), 3), unref(validatedRange).length === 0 && __props.controllerType === "button" ? (openBlock(), createElementBlock("div", {
  18887. key: 0,
  18888. class: normalizeClass(unref(ns).e("button-group"))
  18889. }, [createVNode(unref(ElButtonGroup), null, {
  18890. default: withCtx(() => [
  18891. createVNode(unref(ElButton), {
  18892. size: "small",
  18893. onClick: _cache[0] || (_cache[0] = ($event) => unref(selectDate)("prev-month"))
  18894. }, {
  18895. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.prevMonth")), 1)]),
  18896. _: 1
  18897. }),
  18898. createVNode(unref(ElButton), {
  18899. size: "small",
  18900. onClick: _cache[1] || (_cache[1] = ($event) => unref(selectDate)("today"))
  18901. }, {
  18902. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.today")), 1)]),
  18903. _: 1
  18904. }),
  18905. createVNode(unref(ElButton), {
  18906. size: "small",
  18907. onClick: _cache[2] || (_cache[2] = ($event) => unref(selectDate)("next-month"))
  18908. }, {
  18909. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.nextMonth")), 1)]),
  18910. _: 1
  18911. })
  18912. ]),
  18913. _: 1
  18914. })], 2)) : unref(validatedRange).length === 0 && __props.controllerType === "select" ? (openBlock(), createElementBlock("div", {
  18915. key: 1,
  18916. class: normalizeClass(unref(ns).e("select-controller"))
  18917. }, [createVNode(select_controller_default, {
  18918. date: unref(date),
  18919. formatter: __props.formatter,
  18920. onDateChange: unref(handleDateChange)
  18921. }, null, 8, [
  18922. "date",
  18923. "formatter",
  18924. "onDateChange"
  18925. ])], 2)) : createCommentVNode("v-if", true)])], 2), unref(validatedRange).length === 0 ? (openBlock(), createElementBlock("div", {
  18926. key: 0,
  18927. class: normalizeClass(unref(ns).e("body"))
  18928. }, [createVNode(date_table_default, {
  18929. date: unref(date),
  18930. "selected-day": unref(realSelectedDay),
  18931. onPick: unref(pickDay)
  18932. }, createSlots({ _: 2 }, [_ctx.$slots["date-cell"] ? {
  18933. name: "date-cell",
  18934. fn: withCtx((data) => [renderSlot(_ctx.$slots, "date-cell", normalizeProps(guardReactiveProps(data)))]),
  18935. key: "0"
  18936. } : void 0]), 1032, [
  18937. "date",
  18938. "selected-day",
  18939. "onPick"
  18940. ])], 2)) : (openBlock(), createElementBlock("div", {
  18941. key: 1,
  18942. class: normalizeClass(unref(ns).e("body"))
  18943. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(validatedRange), (range_, index) => {
  18944. return openBlock(), createBlock(date_table_default, {
  18945. key: index,
  18946. date: range_[0],
  18947. "selected-day": unref(realSelectedDay),
  18948. range: range_,
  18949. "hide-header": index !== 0,
  18950. onPick: unref(pickDay)
  18951. }, createSlots({ _: 2 }, [_ctx.$slots["date-cell"] ? {
  18952. name: "date-cell",
  18953. fn: withCtx((data) => [renderSlot(_ctx.$slots, "date-cell", mergeProps({ ref_for: true }, data))]),
  18954. key: "0"
  18955. } : void 0]), 1032, [
  18956. "date",
  18957. "selected-day",
  18958. "range",
  18959. "hide-header",
  18960. "onPick"
  18961. ]);
  18962. }), 128))], 2))], 2);
  18963. };
  18964. }
  18965. });
  18966. //#endregion
  18967. //#region ../../packages/components/calendar/src/calendar.vue
  18968. var calendar_default = calendar_vue_vue_type_script_setup_true_lang_default;
  18969. //#endregion
  18970. //#region ../../packages/components/calendar/index.ts
  18971. const ElCalendar = withInstall(calendar_default);
  18972. //#endregion
  18973. //#region ../../packages/components/card/src/card.ts
  18974. const cardProps = buildProps({
  18975. header: {
  18976. type: String,
  18977. default: ""
  18978. },
  18979. footer: {
  18980. type: String,
  18981. default: ""
  18982. },
  18983. bodyStyle: {
  18984. type: definePropType([
  18985. String,
  18986. Object,
  18987. Array,
  18988. Boolean
  18989. ]),
  18990. default: ""
  18991. },
  18992. headerClass: String,
  18993. bodyClass: String,
  18994. footerClass: String,
  18995. shadow: {
  18996. type: String,
  18997. values: [
  18998. "always",
  18999. "hover",
  19000. "never"
  19001. ],
  19002. default: void 0
  19003. }
  19004. });
  19005. const cardContextKey = Symbol("cardContextKey");
  19006. //#endregion
  19007. //#region ../../packages/components/card/src/card.vue?vue&type=script&setup=true&lang.ts
  19008. var card_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  19009. name: "ElCard",
  19010. __name: "card",
  19011. props: cardProps,
  19012. setup(__props) {
  19013. const globalConfig = useGlobalConfig("card");
  19014. const ns = useNamespace("card");
  19015. return (_ctx, _cache) => {
  19016. return openBlock(), createElementBlock("div", { class: normalizeClass([unref(ns).b(), unref(ns).is(`${__props.shadow || unref(globalConfig)?.shadow || "always"}-shadow`)]) }, [
  19017. _ctx.$slots.header || __props.header ? (openBlock(), createElementBlock("div", {
  19018. key: 0,
  19019. class: normalizeClass([unref(ns).e("header"), __props.headerClass])
  19020. }, [renderSlot(_ctx.$slots, "header", {}, () => [createTextVNode(toDisplayString(__props.header), 1)])], 2)) : createCommentVNode("v-if", true),
  19021. createElementVNode("div", {
  19022. class: normalizeClass([unref(ns).e("body"), __props.bodyClass]),
  19023. style: normalizeStyle(__props.bodyStyle)
  19024. }, [renderSlot(_ctx.$slots, "default")], 6),
  19025. _ctx.$slots.footer || __props.footer ? (openBlock(), createElementBlock("div", {
  19026. key: 1,
  19027. class: normalizeClass([unref(ns).e("footer"), __props.footerClass])
  19028. }, [renderSlot(_ctx.$slots, "footer", {}, () => [createTextVNode(toDisplayString(__props.footer), 1)])], 2)) : createCommentVNode("v-if", true)
  19029. ], 2);
  19030. };
  19031. }
  19032. });
  19033. //#endregion
  19034. //#region ../../packages/components/card/src/card.vue
  19035. var card_default = card_vue_vue_type_script_setup_true_lang_default;
  19036. //#endregion
  19037. //#region ../../packages/components/card/index.ts
  19038. const ElCard = withInstall(card_default);
  19039. //#endregion
  19040. //#region ../../packages/components/carousel/src/carousel.ts
  19041. const carouselProps = buildProps({
  19042. initialIndex: {
  19043. type: Number,
  19044. default: 0
  19045. },
  19046. height: {
  19047. type: String,
  19048. default: ""
  19049. },
  19050. trigger: {
  19051. type: String,
  19052. values: ["hover", "click"],
  19053. default: "hover"
  19054. },
  19055. autoplay: {
  19056. type: Boolean,
  19057. default: true
  19058. },
  19059. interval: {
  19060. type: Number,
  19061. default: 3e3
  19062. },
  19063. indicatorPosition: {
  19064. type: String,
  19065. values: [
  19066. "",
  19067. "none",
  19068. "outside"
  19069. ],
  19070. default: ""
  19071. },
  19072. arrow: {
  19073. type: String,
  19074. values: [
  19075. "always",
  19076. "hover",
  19077. "never"
  19078. ],
  19079. default: "hover"
  19080. },
  19081. type: {
  19082. type: String,
  19083. values: ["", "card"],
  19084. default: ""
  19085. },
  19086. cardScale: {
  19087. type: Number,
  19088. default: .83
  19089. },
  19090. loop: {
  19091. type: Boolean,
  19092. default: true
  19093. },
  19094. direction: {
  19095. type: String,
  19096. values: ["horizontal", "vertical"],
  19097. default: "horizontal"
  19098. },
  19099. pauseOnHover: {
  19100. type: Boolean,
  19101. default: true
  19102. },
  19103. motionBlur: Boolean
  19104. });
  19105. const carouselEmits = { change: (current, prev) => [current, prev].every(isNumber) };
  19106. //#endregion
  19107. //#region ../../packages/components/carousel/src/constants.ts
  19108. const carouselContextKey = Symbol("carouselContextKey");
  19109. const CAROUSEL_ITEM_NAME = "ElCarouselItem";
  19110. //#endregion
  19111. //#region ../../packages/components/carousel/src/use-carousel.ts
  19112. const THROTTLE_TIME = 300;
  19113. const useCarousel = (props, emit, componentName) => {
  19114. const { children: items, addChild: addItem, removeChild: removeItem, ChildrenSorter: ItemsSorter } = useOrderedChildren(getCurrentInstance(), CAROUSEL_ITEM_NAME);
  19115. const slots = useSlots();
  19116. const activeIndex = ref(-1);
  19117. const timer = ref(null);
  19118. const hover = ref(false);
  19119. const root = ref();
  19120. const containerHeight = ref(0);
  19121. const isItemsTwoLength = ref(true);
  19122. const arrowDisplay = computed(() => props.arrow !== "never" && !unref(isVertical));
  19123. const hasLabel = computed(() => {
  19124. return items.value.some((item) => item.props.label.toString().length > 0);
  19125. });
  19126. const isCardType = computed(() => props.type === "card");
  19127. const isVertical = computed(() => props.direction === "vertical");
  19128. const containerStyle = computed(() => {
  19129. if (props.height !== "auto") return { height: props.height };
  19130. return {
  19131. height: `${containerHeight.value}px`,
  19132. overflow: "hidden"
  19133. };
  19134. });
  19135. const throttledArrowClick = throttle((index) => {
  19136. setActiveItem(index);
  19137. }, THROTTLE_TIME, { trailing: true });
  19138. const throttledIndicatorHover = throttle((index) => {
  19139. handleIndicatorHover(index);
  19140. }, THROTTLE_TIME);
  19141. const isTwoLengthShow = (index) => {
  19142. if (!isItemsTwoLength.value) return true;
  19143. return activeIndex.value <= 1 ? index <= 1 : index > 1;
  19144. };
  19145. function pauseTimer() {
  19146. if (timer.value) {
  19147. clearInterval(timer.value);
  19148. timer.value = null;
  19149. }
  19150. }
  19151. function startTimer() {
  19152. if (props.interval <= 0 || !props.autoplay || timer.value) return;
  19153. timer.value = setInterval(() => playSlides(), props.interval);
  19154. }
  19155. const playSlides = () => {
  19156. if (activeIndex.value < items.value.length - 1) activeIndex.value = activeIndex.value + 1;
  19157. else if (props.loop) activeIndex.value = 0;
  19158. };
  19159. function setActiveItem(index) {
  19160. if (isString(index)) {
  19161. const filteredItems = items.value.filter((item) => item.props.name === index);
  19162. if (filteredItems.length > 0) index = items.value.indexOf(filteredItems[0]);
  19163. }
  19164. index = Number(index);
  19165. if (Number.isNaN(index) || index !== Math.floor(index)) {
  19166. /* @__PURE__ */ debugWarn(componentName, "index must be integer.");
  19167. return;
  19168. }
  19169. const itemCount = items.value.length;
  19170. const oldIndex = activeIndex.value;
  19171. if (index < 0) activeIndex.value = props.loop ? itemCount - 1 : 0;
  19172. else if (index >= itemCount) activeIndex.value = props.loop ? 0 : itemCount - 1;
  19173. else activeIndex.value = index;
  19174. if (oldIndex === activeIndex.value) resetItemPosition(oldIndex);
  19175. resetTimer();
  19176. }
  19177. function resetItemPosition(oldIndex) {
  19178. items.value.forEach((item, index) => {
  19179. item.translateItem(index, activeIndex.value, oldIndex);
  19180. });
  19181. }
  19182. function itemInStage(item, index) {
  19183. const _items = unref(items);
  19184. const itemCount = _items.length;
  19185. if (itemCount === 0 || !item.states.inStage) return false;
  19186. const nextItemIndex = index + 1;
  19187. const prevItemIndex = index - 1;
  19188. const lastItemIndex = itemCount - 1;
  19189. const isLastItemActive = _items[lastItemIndex].states.active;
  19190. const isFirstItemActive = _items[0].states.active;
  19191. const isNextItemActive = _items[nextItemIndex]?.states?.active;
  19192. const isPrevItemActive = _items[prevItemIndex]?.states?.active;
  19193. if (index === lastItemIndex && isFirstItemActive || isNextItemActive) return "left";
  19194. else if (index === 0 && isLastItemActive || isPrevItemActive) return "right";
  19195. return false;
  19196. }
  19197. function handleMouseEnter() {
  19198. hover.value = true;
  19199. if (props.pauseOnHover) pauseTimer();
  19200. }
  19201. function handleMouseLeave() {
  19202. hover.value = false;
  19203. startTimer();
  19204. }
  19205. function handleButtonEnter(arrow) {
  19206. if (unref(isVertical)) return;
  19207. items.value.forEach((item, index) => {
  19208. if (arrow === itemInStage(item, index)) item.states.hover = true;
  19209. });
  19210. }
  19211. function handleButtonLeave() {
  19212. if (unref(isVertical)) return;
  19213. items.value.forEach((item) => {
  19214. item.states.hover = false;
  19215. });
  19216. }
  19217. function handleIndicatorClick(index) {
  19218. activeIndex.value = index;
  19219. }
  19220. function handleIndicatorHover(index) {
  19221. if (props.trigger === "hover" && index !== activeIndex.value) activeIndex.value = index;
  19222. }
  19223. function prev() {
  19224. setActiveItem(activeIndex.value - 1);
  19225. }
  19226. function next() {
  19227. setActiveItem(activeIndex.value + 1);
  19228. }
  19229. function resetTimer() {
  19230. pauseTimer();
  19231. if (!props.pauseOnHover || !hover.value) startTimer();
  19232. }
  19233. function setContainerHeight(height) {
  19234. if (props.height !== "auto") return;
  19235. containerHeight.value = height;
  19236. }
  19237. function PlaceholderItem() {
  19238. const defaultSlots = slots.default?.();
  19239. if (!defaultSlots) return null;
  19240. const normalizeSlots = flattedChildren(defaultSlots).filter((slot) => {
  19241. return isVNode(slot) && slot.type.name === "ElCarouselItem";
  19242. });
  19243. if (normalizeSlots?.length === 2 && props.loop && !isCardType.value) {
  19244. isItemsTwoLength.value = true;
  19245. return normalizeSlots;
  19246. }
  19247. isItemsTwoLength.value = false;
  19248. return null;
  19249. }
  19250. watch(() => activeIndex.value, (current, prev) => {
  19251. resetItemPosition(prev);
  19252. if (isItemsTwoLength.value) {
  19253. current = current % 2;
  19254. prev = prev % 2;
  19255. }
  19256. if (prev > -1) emit(CHANGE_EVENT, current, prev);
  19257. });
  19258. const exposeActiveIndex = computed({
  19259. get: () => {
  19260. return isItemsTwoLength.value ? activeIndex.value % 2 : activeIndex.value;
  19261. },
  19262. set: (value) => activeIndex.value = value
  19263. });
  19264. watch(() => props.autoplay, (autoplay) => {
  19265. autoplay ? startTimer() : pauseTimer();
  19266. });
  19267. watch(() => props.loop, () => {
  19268. setActiveItem(activeIndex.value);
  19269. });
  19270. watch(() => props.interval, () => {
  19271. resetTimer();
  19272. });
  19273. const resizeObserver = shallowRef();
  19274. onMounted(() => {
  19275. watch(() => items.value, () => {
  19276. if (items.value.length > 0) setActiveItem(props.initialIndex);
  19277. }, { immediate: true });
  19278. resizeObserver.value = useResizeObserver(root.value, () => {
  19279. resetItemPosition();
  19280. });
  19281. startTimer();
  19282. });
  19283. onBeforeUnmount(() => {
  19284. pauseTimer();
  19285. if (root.value && resizeObserver.value) resizeObserver.value.stop();
  19286. });
  19287. provide(carouselContextKey, {
  19288. root,
  19289. isCardType,
  19290. isVertical,
  19291. items,
  19292. loop: props.loop,
  19293. cardScale: props.cardScale,
  19294. addItem,
  19295. removeItem,
  19296. setActiveItem,
  19297. setContainerHeight
  19298. });
  19299. return {
  19300. root,
  19301. activeIndex,
  19302. exposeActiveIndex,
  19303. arrowDisplay,
  19304. hasLabel,
  19305. hover,
  19306. isCardType,
  19307. items,
  19308. isVertical,
  19309. containerStyle,
  19310. isItemsTwoLength,
  19311. handleButtonEnter,
  19312. handleButtonLeave,
  19313. handleIndicatorClick,
  19314. handleMouseEnter,
  19315. handleMouseLeave,
  19316. setActiveItem,
  19317. prev,
  19318. next,
  19319. PlaceholderItem,
  19320. isTwoLengthShow,
  19321. ItemsSorter,
  19322. throttledArrowClick,
  19323. throttledIndicatorHover
  19324. };
  19325. };
  19326. //#endregion
  19327. //#region ../../packages/components/carousel/src/carousel.vue?vue&type=script&setup=true&lang.ts
  19328. const _hoisted_1$65 = ["aria-label"];
  19329. const _hoisted_2$36 = ["aria-label"];
  19330. const _hoisted_3$17 = ["onMouseenter", "onClick"];
  19331. const _hoisted_4$12 = ["aria-label"];
  19332. const _hoisted_5$9 = { key: 0 };
  19333. const _hoisted_6$4 = {
  19334. key: 2,
  19335. xmlns: "http://www.w3.org/2000/svg",
  19336. version: "1.1",
  19337. style: { "display": "none" }
  19338. };
  19339. const COMPONENT_NAME$11 = "ElCarousel";
  19340. var carousel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  19341. name: COMPONENT_NAME$11,
  19342. __name: "carousel",
  19343. props: carouselProps,
  19344. emits: carouselEmits,
  19345. setup(__props, { expose: __expose, emit: __emit }) {
  19346. const props = __props;
  19347. const { root, activeIndex, exposeActiveIndex, arrowDisplay, hasLabel, hover, isCardType, items, isVertical, containerStyle, handleButtonEnter, handleButtonLeave, handleIndicatorClick, handleMouseEnter, handleMouseLeave, setActiveItem, prev, next, PlaceholderItem, isTwoLengthShow, ItemsSorter, throttledArrowClick, throttledIndicatorHover } = useCarousel(props, __emit, COMPONENT_NAME$11);
  19348. const ns = useNamespace("carousel");
  19349. const { t } = useLocale();
  19350. const carouselClasses = computed(() => {
  19351. const classes = [ns.b(), ns.m(props.direction)];
  19352. if (unref(isCardType)) classes.push(ns.m("card"));
  19353. classes.push(ns.is("vertical-outside", unref(isVertical) && props.indicatorPosition === "outside"));
  19354. return classes;
  19355. });
  19356. const indicatorsClasses = computed(() => {
  19357. const classes = [ns.e("indicators"), ns.em("indicators", props.direction)];
  19358. if (unref(hasLabel)) classes.push(ns.em("indicators", "labels"));
  19359. if (props.indicatorPosition === "outside") classes.push(ns.em("indicators", "outside"));
  19360. if (unref(isVertical)) classes.push(ns.em("indicators", "right"));
  19361. return classes;
  19362. });
  19363. function handleTransitionStart(e) {
  19364. if (!props.motionBlur) return;
  19365. const kls = unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`;
  19366. e.currentTarget.classList.add(kls);
  19367. }
  19368. function handleTransitionEnd(e) {
  19369. if (!props.motionBlur) return;
  19370. const kls = unref(isVertical) ? `${ns.namespace.value}-transitioning-vertical` : `${ns.namespace.value}-transitioning`;
  19371. e.currentTarget.classList.remove(kls);
  19372. }
  19373. __expose({
  19374. activeIndex: exposeActiveIndex,
  19375. setActiveItem,
  19376. prev,
  19377. next
  19378. });
  19379. return (_ctx, _cache) => {
  19380. return openBlock(), createElementBlock("div", {
  19381. ref_key: "root",
  19382. ref: root,
  19383. class: normalizeClass(carouselClasses.value),
  19384. onMouseenter: _cache[6] || (_cache[6] = withModifiers((...args) => unref(handleMouseEnter) && unref(handleMouseEnter)(...args), ["stop"])),
  19385. onMouseleave: _cache[7] || (_cache[7] = withModifiers((...args) => unref(handleMouseLeave) && unref(handleMouseLeave)(...args), ["stop"]))
  19386. }, [
  19387. unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
  19388. key: 0,
  19389. name: "carousel-arrow-left",
  19390. persisted: ""
  19391. }, {
  19392. default: withCtx(() => [withDirectives(createElementVNode("button", {
  19393. type: "button",
  19394. class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "left")]),
  19395. "aria-label": unref(t)("el.carousel.leftArrow"),
  19396. onMouseenter: _cache[0] || (_cache[0] = ($event) => unref(handleButtonEnter)("left")),
  19397. onMouseleave: _cache[1] || (_cache[1] = (...args) => unref(handleButtonLeave) && unref(handleButtonLeave)(...args)),
  19398. onClick: _cache[2] || (_cache[2] = withModifiers(($event) => unref(throttledArrowClick)(unref(activeIndex) - 1), ["stop"]))
  19399. }, [createVNode(unref(ElIcon), null, {
  19400. default: withCtx(() => [createVNode(unref(arrow_left_default))]),
  19401. _: 1
  19402. })], 42, _hoisted_1$65), [[vShow, (__props.arrow === "always" || unref(hover)) && (__props.loop || unref(activeIndex) > 0)]])]),
  19403. _: 1
  19404. })) : createCommentVNode("v-if", true),
  19405. unref(arrowDisplay) ? (openBlock(), createBlock(Transition, {
  19406. key: 1,
  19407. name: "carousel-arrow-right",
  19408. persisted: ""
  19409. }, {
  19410. default: withCtx(() => [withDirectives(createElementVNode("button", {
  19411. type: "button",
  19412. class: normalizeClass([unref(ns).e("arrow"), unref(ns).em("arrow", "right")]),
  19413. "aria-label": unref(t)("el.carousel.rightArrow"),
  19414. onMouseenter: _cache[3] || (_cache[3] = ($event) => unref(handleButtonEnter)("right")),
  19415. onMouseleave: _cache[4] || (_cache[4] = (...args) => unref(handleButtonLeave) && unref(handleButtonLeave)(...args)),
  19416. onClick: _cache[5] || (_cache[5] = withModifiers(($event) => unref(throttledArrowClick)(unref(activeIndex) + 1), ["stop"]))
  19417. }, [createVNode(unref(ElIcon), null, {
  19418. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  19419. _: 1
  19420. })], 42, _hoisted_2$36), [[vShow, (__props.arrow === "always" || unref(hover)) && (__props.loop || unref(activeIndex) < unref(items).length - 1)]])]),
  19421. _: 1
  19422. })) : createCommentVNode("v-if", true),
  19423. createElementVNode("div", {
  19424. class: normalizeClass(unref(ns).e("container")),
  19425. style: normalizeStyle(unref(containerStyle)),
  19426. onTransitionstart: handleTransitionStart,
  19427. onTransitionend: handleTransitionEnd
  19428. }, [createVNode(unref(PlaceholderItem)), renderSlot(_ctx.$slots, "default")], 38),
  19429. createVNode(unref(ItemsSorter), null, {
  19430. default: withCtx(() => [__props.indicatorPosition !== "none" ? (openBlock(), createElementBlock("ul", {
  19431. key: 0,
  19432. class: normalizeClass(indicatorsClasses.value)
  19433. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(items), (item, index) => {
  19434. return withDirectives((openBlock(), createElementBlock("li", {
  19435. key: index,
  19436. class: normalizeClass([
  19437. unref(ns).e("indicator"),
  19438. unref(ns).em("indicator", __props.direction),
  19439. unref(ns).is("active", index === unref(activeIndex))
  19440. ]),
  19441. onMouseenter: ($event) => unref(throttledIndicatorHover)(index),
  19442. onClick: withModifiers(($event) => unref(handleIndicatorClick)(index), ["stop"])
  19443. }, [createElementVNode("button", {
  19444. class: normalizeClass(unref(ns).e("button")),
  19445. "aria-label": unref(t)("el.carousel.indicator", { index: index + 1 })
  19446. }, [unref(hasLabel) ? (openBlock(), createElementBlock("span", _hoisted_5$9, toDisplayString(item.props.label), 1)) : createCommentVNode("v-if", true)], 10, _hoisted_4$12)], 42, _hoisted_3$17)), [[vShow, unref(isTwoLengthShow)(index)]]);
  19447. }), 128))], 2)) : createCommentVNode("v-if", true)]),
  19448. _: 1
  19449. }),
  19450. __props.motionBlur ? (openBlock(), createElementBlock("svg", _hoisted_6$4, [..._cache[8] || (_cache[8] = [createElementVNode("defs", null, [createElementVNode("filter", { id: "elCarouselHorizontal" }, [createElementVNode("feGaussianBlur", {
  19451. in: "SourceGraphic",
  19452. stdDeviation: "12,0"
  19453. })]), createElementVNode("filter", { id: "elCarouselVertical" }, [createElementVNode("feGaussianBlur", {
  19454. in: "SourceGraphic",
  19455. stdDeviation: "0,10"
  19456. })])], -1)])])) : createCommentVNode("v-if", true)
  19457. ], 34);
  19458. };
  19459. }
  19460. });
  19461. //#endregion
  19462. //#region ../../packages/components/carousel/src/carousel.vue
  19463. var carousel_default = carousel_vue_vue_type_script_setup_true_lang_default;
  19464. //#endregion
  19465. //#region ../../packages/components/carousel/src/carousel-item.ts
  19466. const carouselItemProps = buildProps({
  19467. name: {
  19468. type: String,
  19469. default: ""
  19470. },
  19471. label: {
  19472. type: [String, Number],
  19473. default: ""
  19474. }
  19475. });
  19476. //#endregion
  19477. //#region ../../packages/components/carousel/src/use-carousel-item.ts
  19478. const useCarouselItem = (props) => {
  19479. const carouselContext = inject(carouselContextKey);
  19480. const instance = getCurrentInstance();
  19481. if (!carouselContext) /* @__PURE__ */ debugWarn(CAROUSEL_ITEM_NAME, "usage: <el-carousel></el-carousel-item></el-carousel>");
  19482. if (!instance) /* @__PURE__ */ debugWarn(CAROUSEL_ITEM_NAME, "compositional hook can only be invoked inside setups");
  19483. const carouselItemRef = ref();
  19484. const hover = ref(false);
  19485. const translate = ref(0);
  19486. const scale = ref(1);
  19487. const active = ref(false);
  19488. const ready = ref(false);
  19489. const inStage = ref(false);
  19490. const animating = ref(false);
  19491. const { isCardType, isVertical, cardScale } = carouselContext;
  19492. function processIndex(index, activeIndex, length) {
  19493. const lastItemIndex = length - 1;
  19494. const prevItemIndex = activeIndex - 1;
  19495. const nextItemIndex = activeIndex + 1;
  19496. const halfItemIndex = length / 2;
  19497. if (activeIndex === 0 && index === lastItemIndex) return -1;
  19498. else if (activeIndex === lastItemIndex && index === 0) return length;
  19499. else if (index < prevItemIndex && activeIndex - index >= halfItemIndex) return length + 1;
  19500. else if (index > nextItemIndex && index - activeIndex >= halfItemIndex) return -2;
  19501. return index;
  19502. }
  19503. function calcCardTranslate(index, activeIndex) {
  19504. const parentWidth = unref(isVertical) ? carouselContext.root.value?.offsetHeight || 0 : carouselContext.root.value?.offsetWidth || 0;
  19505. if (inStage.value) return parentWidth * ((2 - cardScale) * (index - activeIndex) + 1) / 4;
  19506. else if (index < activeIndex) return -(1 + cardScale) * parentWidth / 4;
  19507. else return (3 + cardScale) * parentWidth / 4;
  19508. }
  19509. function calcTranslate(index, activeIndex, isVertical) {
  19510. const rootEl = carouselContext.root.value;
  19511. if (!rootEl) return 0;
  19512. return ((isVertical ? rootEl.offsetHeight : rootEl.offsetWidth) || 0) * (index - activeIndex);
  19513. }
  19514. const translateItem = (index, activeIndex, oldIndex) => {
  19515. const _isCardType = unref(isCardType);
  19516. const carouselItemLength = carouselContext.items.value.length ?? NaN;
  19517. const isActive = index === activeIndex;
  19518. if (!_isCardType && !isUndefined(oldIndex)) animating.value = isActive || index === oldIndex;
  19519. if (!isActive && carouselItemLength > 2 && carouselContext.loop) index = processIndex(index, activeIndex, carouselItemLength);
  19520. const _isVertical = unref(isVertical);
  19521. active.value = isActive;
  19522. if (_isCardType) {
  19523. inStage.value = Math.round(Math.abs(index - activeIndex)) <= 1;
  19524. translate.value = calcCardTranslate(index, activeIndex);
  19525. scale.value = unref(active) ? 1 : cardScale;
  19526. } else translate.value = calcTranslate(index, activeIndex, _isVertical);
  19527. ready.value = true;
  19528. if (isActive && carouselItemRef.value) carouselContext.setContainerHeight(carouselItemRef.value.offsetHeight);
  19529. };
  19530. function handleItemClick() {
  19531. if (carouselContext && unref(isCardType)) {
  19532. const index = carouselContext.items.value.findIndex(({ uid }) => uid === instance.uid);
  19533. carouselContext.setActiveItem(index);
  19534. }
  19535. }
  19536. const carouselItemContext = {
  19537. props,
  19538. states: reactive({
  19539. hover,
  19540. translate,
  19541. scale,
  19542. active,
  19543. ready,
  19544. inStage,
  19545. animating
  19546. }),
  19547. uid: instance.uid,
  19548. getVnode: () => instance.vnode,
  19549. translateItem
  19550. };
  19551. carouselContext.addItem(carouselItemContext);
  19552. onBeforeUnmount(() => {
  19553. carouselContext.removeItem(carouselItemContext);
  19554. });
  19555. return {
  19556. carouselItemRef,
  19557. active,
  19558. animating,
  19559. hover,
  19560. inStage,
  19561. isVertical,
  19562. translate,
  19563. isCardType,
  19564. scale,
  19565. ready,
  19566. handleItemClick
  19567. };
  19568. };
  19569. //#endregion
  19570. //#region ../../packages/components/carousel/src/carousel-item.vue?vue&type=script&setup=true&lang.ts
  19571. var carousel_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  19572. name: CAROUSEL_ITEM_NAME,
  19573. __name: "carousel-item",
  19574. props: carouselItemProps,
  19575. setup(__props) {
  19576. const props = __props;
  19577. const ns = useNamespace("carousel");
  19578. const { carouselItemRef, active, animating, hover, inStage, isVertical, translate, isCardType, scale, ready, handleItemClick } = useCarouselItem(props);
  19579. const itemKls = computed(() => [
  19580. ns.e("item"),
  19581. ns.is("active", active.value),
  19582. ns.is("in-stage", inStage.value),
  19583. ns.is("hover", hover.value),
  19584. ns.is("animating", animating.value),
  19585. {
  19586. [ns.em("item", "card")]: isCardType.value,
  19587. [ns.em("item", "card-vertical")]: isCardType.value && isVertical.value
  19588. }
  19589. ]);
  19590. const itemStyle = computed(() => {
  19591. return { transform: [`${`translate${unref(isVertical) ? "Y" : "X"}`}(${unref(translate)}px)`, `scale(${unref(scale)})`].join(" ") };
  19592. });
  19593. return (_ctx, _cache) => {
  19594. return withDirectives((openBlock(), createElementBlock("div", {
  19595. ref_key: "carouselItemRef",
  19596. ref: carouselItemRef,
  19597. class: normalizeClass(itemKls.value),
  19598. style: normalizeStyle(itemStyle.value),
  19599. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleItemClick) && unref(handleItemClick)(...args))
  19600. }, [unref(isCardType) ? withDirectives((openBlock(), createElementBlock("div", {
  19601. key: 0,
  19602. class: normalizeClass(unref(ns).e("mask"))
  19603. }, null, 2)), [[vShow, !unref(active)]]) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default")], 6)), [[vShow, unref(ready)]]);
  19604. };
  19605. }
  19606. });
  19607. //#endregion
  19608. //#region ../../packages/components/carousel/src/carousel-item.vue
  19609. var carousel_item_default = carousel_item_vue_vue_type_script_setup_true_lang_default;
  19610. //#endregion
  19611. //#region ../../packages/components/carousel/index.ts
  19612. const ElCarousel = withInstall(carousel_default, { CarouselItem: carousel_item_default });
  19613. const ElCarouselItem = withNoopInstall(carousel_item_default);
  19614. //#endregion
  19615. //#region ../../packages/components/cascader-panel/src/config.ts
  19616. const CASCADER_PANEL_ITEM_SIZE = 34;
  19617. const CASCADER_PANEL_HEIGHT = 204;
  19618. const CommonProps = buildProps({
  19619. modelValue: { type: definePropType([
  19620. Number,
  19621. String,
  19622. Array,
  19623. Object
  19624. ]) },
  19625. options: {
  19626. type: definePropType(Array),
  19627. default: () => []
  19628. },
  19629. props: {
  19630. type: definePropType(Object),
  19631. default: () => ({})
  19632. },
  19633. virtualScroll: Boolean,
  19634. itemSize: {
  19635. type: Number,
  19636. default: 34
  19637. },
  19638. height: {
  19639. type: Number,
  19640. default: 204
  19641. }
  19642. });
  19643. const DefaultProps = {
  19644. expandTrigger: "click",
  19645. multiple: false,
  19646. checkStrictly: false,
  19647. emitPath: true,
  19648. lazy: false,
  19649. lazyLoad: NOOP,
  19650. value: "value",
  19651. label: "label",
  19652. children: "children",
  19653. leaf: "leaf",
  19654. disabled: "disabled",
  19655. hoverThreshold: 500,
  19656. checkOnClickNode: false,
  19657. checkOnClickLeaf: true,
  19658. showPrefix: true
  19659. };
  19660. const cascaderPanelProps = buildProps({
  19661. ...CommonProps,
  19662. border: {
  19663. type: Boolean,
  19664. default: true
  19665. },
  19666. renderLabel: { type: Function }
  19667. });
  19668. const emitChangeFn$2 = (value) => true;
  19669. const cascaderPanelEmits = {
  19670. [UPDATE_MODEL_EVENT]: emitChangeFn$2,
  19671. [CHANGE_EVENT]: emitChangeFn$2,
  19672. close: () => true,
  19673. "expand-change": (value) => value
  19674. };
  19675. const useCascaderConfig = (props) => {
  19676. return computed(() => ({
  19677. ...DefaultProps,
  19678. ...props.props
  19679. }));
  19680. };
  19681. //#endregion
  19682. //#region ../../node_modules/.pnpm/memoize-one@6.0.0/node_modules/memoize-one/dist/memoize-one.esm.js
  19683. var safeIsNaN = Number.isNaN || function ponyfill(value) {
  19684. return typeof value === "number" && value !== value;
  19685. };
  19686. function isEqual(first, second) {
  19687. if (first === second) return true;
  19688. if (safeIsNaN(first) && safeIsNaN(second)) return true;
  19689. return false;
  19690. }
  19691. function areInputsEqual(newInputs, lastInputs) {
  19692. if (newInputs.length !== lastInputs.length) return false;
  19693. for (var i = 0; i < newInputs.length; i++) if (!isEqual(newInputs[i], lastInputs[i])) return false;
  19694. return true;
  19695. }
  19696. function memoizeOne(resultFn, isEqual) {
  19697. if (isEqual === void 0) isEqual = areInputsEqual;
  19698. var cache = null;
  19699. function memoized() {
  19700. var newArgs = [];
  19701. for (var _i = 0; _i < arguments.length; _i++) newArgs[_i] = arguments[_i];
  19702. if (cache && cache.lastThis === this && isEqual(newArgs, cache.lastArgs)) return cache.lastResult;
  19703. var lastResult = resultFn.apply(this, newArgs);
  19704. cache = {
  19705. lastResult,
  19706. lastArgs: newArgs,
  19707. lastThis: this
  19708. };
  19709. return lastResult;
  19710. }
  19711. memoized.clear = function clear() {
  19712. cache = null;
  19713. };
  19714. return memoized;
  19715. }
  19716. //#endregion
  19717. //#region ../../packages/components/virtual-list/src/hooks/use-cache.ts
  19718. const useCache = () => {
  19719. const props = getCurrentInstance().proxy.$props;
  19720. return computed(() => {
  19721. const _getItemStyleCache = (_, __, ___) => ({});
  19722. return props.perfMode ? memoize(_getItemStyleCache) : memoizeOne(_getItemStyleCache);
  19723. });
  19724. };
  19725. //#endregion
  19726. //#region ../../packages/components/virtual-list/src/defaults.ts
  19727. const ITEM_RENDER_EVT = "itemRendered";
  19728. const SCROLL_EVT = "scroll";
  19729. const END_REACHED_EVT = "end-reached";
  19730. const FORWARD = "forward";
  19731. const BACKWARD = "backward";
  19732. const AUTO_ALIGNMENT = "auto";
  19733. const SMART_ALIGNMENT = "smart";
  19734. const START_ALIGNMENT = "start";
  19735. const CENTERED_ALIGNMENT = "center";
  19736. const HORIZONTAL = "horizontal";
  19737. const VERTICAL = "vertical";
  19738. const RTL_OFFSET_NAG = "negative";
  19739. const RTL_OFFSET_POS_ASC = "positive-ascending";
  19740. const RTL_OFFSET_POS_DESC = "positive-descending";
  19741. const ScrollbarDirKey = {
  19742. [HORIZONTAL]: "left",
  19743. [VERTICAL]: "top"
  19744. };
  19745. //#endregion
  19746. //#region ../../packages/components/virtual-list/src/hooks/use-wheel.ts
  19747. const useWheel = ({ atEndEdge, atStartEdge, layout }, onWheelDelta) => {
  19748. let frameHandle;
  19749. let offset = 0;
  19750. const hasReachedEdge = (offset) => {
  19751. return offset < 0 && atStartEdge.value || offset > 0 && atEndEdge.value;
  19752. };
  19753. const onWheel = (e) => {
  19754. cAF(frameHandle);
  19755. let { deltaX, deltaY } = e;
  19756. if (e.shiftKey && deltaY !== 0) {
  19757. deltaX = deltaY;
  19758. deltaY = 0;
  19759. }
  19760. const newOffset = layout.value === "horizontal" ? deltaX : deltaY;
  19761. if (hasReachedEdge(newOffset)) return;
  19762. offset += newOffset;
  19763. if (!isFirefox() && newOffset !== 0) e.preventDefault();
  19764. frameHandle = rAF(() => {
  19765. onWheelDelta(offset);
  19766. offset = 0;
  19767. });
  19768. };
  19769. return {
  19770. hasReachedEdge,
  19771. onWheel
  19772. };
  19773. };
  19774. //#endregion
  19775. //#region ../../packages/components/virtual-list/src/props.ts
  19776. const itemSize$1 = buildProp({
  19777. type: definePropType([Number, Function]),
  19778. required: true
  19779. });
  19780. const estimatedItemSize = buildProp({ type: Number });
  19781. const cache = buildProp({
  19782. type: Number,
  19783. default: 2
  19784. });
  19785. const direction = buildProp({
  19786. type: String,
  19787. values: ["ltr", "rtl"],
  19788. default: "ltr"
  19789. });
  19790. const initScrollOffset = buildProp({
  19791. type: Number,
  19792. default: 0
  19793. });
  19794. const total = buildProp({
  19795. type: Number,
  19796. required: true
  19797. });
  19798. const layout = buildProp({
  19799. type: String,
  19800. values: ["horizontal", "vertical"],
  19801. default: VERTICAL
  19802. });
  19803. const virtualizedProps = buildProps({
  19804. className: {
  19805. type: String,
  19806. default: ""
  19807. },
  19808. containerElement: {
  19809. type: definePropType([String, Object]),
  19810. default: "div"
  19811. },
  19812. data: {
  19813. type: definePropType(Array),
  19814. default: () => mutable([])
  19815. },
  19816. direction,
  19817. height: {
  19818. type: [String, Number],
  19819. required: true
  19820. },
  19821. innerElement: {
  19822. type: [String, Object],
  19823. default: "div"
  19824. },
  19825. innerProps: {
  19826. type: definePropType(Object),
  19827. default: () => ({})
  19828. },
  19829. style: {
  19830. type: definePropType([
  19831. Object,
  19832. String,
  19833. Array,
  19834. Boolean
  19835. ]),
  19836. default: void 0
  19837. },
  19838. useIsScrolling: Boolean,
  19839. width: {
  19840. type: [Number, String],
  19841. required: false
  19842. },
  19843. innerWidth: {
  19844. type: [Number, String],
  19845. required: false
  19846. },
  19847. perfMode: {
  19848. type: Boolean,
  19849. default: true
  19850. },
  19851. scrollbarAlwaysOn: Boolean
  19852. });
  19853. const virtualizedListProps = buildProps({
  19854. cache,
  19855. estimatedItemSize,
  19856. layout,
  19857. initScrollOffset,
  19858. total,
  19859. itemSize: itemSize$1,
  19860. ...virtualizedProps
  19861. });
  19862. const scrollbarSize = {
  19863. type: Number,
  19864. default: 6
  19865. };
  19866. const startGap = {
  19867. type: Number,
  19868. default: 0
  19869. };
  19870. const endGap = {
  19871. type: Number,
  19872. default: 2
  19873. };
  19874. const virtualizedGridProps = buildProps({
  19875. columnCache: cache,
  19876. columnWidth: itemSize$1,
  19877. estimatedColumnWidth: estimatedItemSize,
  19878. estimatedRowHeight: estimatedItemSize,
  19879. initScrollLeft: initScrollOffset,
  19880. initScrollTop: initScrollOffset,
  19881. itemKey: {
  19882. type: definePropType(Function),
  19883. default: ({ columnIndex, rowIndex }) => `${rowIndex}:${columnIndex}`
  19884. },
  19885. rowCache: cache,
  19886. rowHeight: itemSize$1,
  19887. totalColumn: total,
  19888. totalRow: total,
  19889. hScrollbarSize: scrollbarSize,
  19890. vScrollbarSize: scrollbarSize,
  19891. scrollbarStartGap: startGap,
  19892. scrollbarEndGap: endGap,
  19893. role: String,
  19894. ...virtualizedProps
  19895. });
  19896. const virtualizedScrollbarProps = buildProps({
  19897. alwaysOn: Boolean,
  19898. class: String,
  19899. layout,
  19900. total,
  19901. ratio: {
  19902. type: Number,
  19903. required: true
  19904. },
  19905. clientSize: {
  19906. type: Number,
  19907. required: true
  19908. },
  19909. scrollFrom: {
  19910. type: Number,
  19911. required: true
  19912. },
  19913. scrollbarSize,
  19914. startGap,
  19915. endGap,
  19916. visible: Boolean
  19917. });
  19918. //#endregion
  19919. //#region ../../packages/components/virtual-list/src/utils.ts
  19920. const getScrollDir = (prev, cur) => prev < cur ? FORWARD : BACKWARD;
  19921. const isHorizontal = (dir) => dir === "ltr" || dir === "rtl" || dir === "horizontal";
  19922. const isRTL = (dir) => dir === "rtl";
  19923. let cachedRTLResult = null;
  19924. function getRTLOffsetType(recalculate = false) {
  19925. if (cachedRTLResult === null || recalculate) {
  19926. const outerDiv = document.createElement("div");
  19927. const outerStyle = outerDiv.style;
  19928. outerStyle.width = "50px";
  19929. outerStyle.height = "50px";
  19930. outerStyle.overflow = "scroll";
  19931. outerStyle.direction = "rtl";
  19932. const innerDiv = document.createElement("div");
  19933. const innerStyle = innerDiv.style;
  19934. innerStyle.width = "100px";
  19935. innerStyle.height = "100px";
  19936. outerDiv.appendChild(innerDiv);
  19937. document.body.appendChild(outerDiv);
  19938. if (outerDiv.scrollLeft > 0) cachedRTLResult = RTL_OFFSET_POS_DESC;
  19939. else {
  19940. outerDiv.scrollLeft = 1;
  19941. if (outerDiv.scrollLeft === 0) cachedRTLResult = RTL_OFFSET_NAG;
  19942. else cachedRTLResult = RTL_OFFSET_POS_ASC;
  19943. }
  19944. document.body.removeChild(outerDiv);
  19945. return cachedRTLResult;
  19946. }
  19947. return cachedRTLResult;
  19948. }
  19949. function renderThumbStyle$1({ move, size, bar }, layout) {
  19950. const style = {};
  19951. const translate = `translate${bar.axis}(${move}px)`;
  19952. style[bar.size] = size;
  19953. style.transform = translate;
  19954. if (layout === "horizontal") style.height = "100%";
  19955. else style.width = "100%";
  19956. return style;
  19957. }
  19958. //#endregion
  19959. //#region ../../packages/components/virtual-list/src/components/scrollbar.ts
  19960. const ScrollBar = defineComponent({
  19961. name: "ElVirtualScrollBar",
  19962. props: virtualizedScrollbarProps,
  19963. emits: [
  19964. "scroll",
  19965. "start-move",
  19966. "stop-move"
  19967. ],
  19968. setup(props, { emit }) {
  19969. const GAP = computed(() => props.startGap + props.endGap);
  19970. const nsVirtualScrollbar = useNamespace("virtual-scrollbar");
  19971. const nsScrollbar = useNamespace("scrollbar");
  19972. const trackRef = ref();
  19973. const thumbRef = ref();
  19974. let frameHandle = null;
  19975. let onselectstartStore = null;
  19976. const state = reactive({
  19977. isDragging: false,
  19978. traveled: 0
  19979. });
  19980. const bar = computed(() => BAR_MAP[props.layout]);
  19981. const trackSize = computed(() => props.clientSize - unref(GAP));
  19982. const trackStyle = computed(() => ({
  19983. position: "absolute",
  19984. width: `${"horizontal" === props.layout ? trackSize.value : props.scrollbarSize}px`,
  19985. height: `${"horizontal" === props.layout ? props.scrollbarSize : trackSize.value}px`,
  19986. [ScrollbarDirKey[props.layout]]: "2px",
  19987. right: "2px",
  19988. bottom: "2px",
  19989. borderRadius: "4px"
  19990. }));
  19991. const thumbSize = computed(() => {
  19992. const ratio = props.ratio;
  19993. if (ratio >= 100) return Number.POSITIVE_INFINITY;
  19994. if (ratio >= 50) return ratio * trackSize.value / 100;
  19995. const SCROLLBAR_MAX_SIZE = trackSize.value / 3;
  19996. return Math.floor(Math.min(Math.max(ratio * trackSize.value / 100, 20), SCROLLBAR_MAX_SIZE));
  19997. });
  19998. const thumbStyle = computed(() => {
  19999. if (!Number.isFinite(thumbSize.value)) return { display: "none" };
  20000. const thumb = `${thumbSize.value}px`;
  20001. return renderThumbStyle$1({
  20002. bar: bar.value,
  20003. size: thumb,
  20004. move: state.traveled
  20005. }, props.layout);
  20006. });
  20007. const totalSteps = computed(() => Math.ceil(props.clientSize - thumbSize.value - unref(GAP)));
  20008. const attachEvents = () => {
  20009. window.addEventListener("mousemove", onMouseMove);
  20010. window.addEventListener("mouseup", onMouseUp);
  20011. const thumbEl = unref(thumbRef);
  20012. if (!thumbEl) return;
  20013. onselectstartStore = document.onselectstart;
  20014. document.onselectstart = () => false;
  20015. thumbEl.addEventListener("touchmove", onMouseMove, { passive: true });
  20016. thumbEl.addEventListener("touchend", onMouseUp);
  20017. };
  20018. const detachEvents = () => {
  20019. window.removeEventListener("mousemove", onMouseMove);
  20020. window.removeEventListener("mouseup", onMouseUp);
  20021. document.onselectstart = onselectstartStore;
  20022. onselectstartStore = null;
  20023. const thumbEl = unref(thumbRef);
  20024. if (!thumbEl) return;
  20025. thumbEl.removeEventListener("touchmove", onMouseMove);
  20026. thumbEl.removeEventListener("touchend", onMouseUp);
  20027. };
  20028. const onThumbMouseDown = (e) => {
  20029. e.stopImmediatePropagation();
  20030. if (e.ctrlKey || [1, 2].includes(e.button)) return;
  20031. state.isDragging = true;
  20032. state[bar.value.axis] = e.currentTarget[bar.value.offset] - (e[bar.value.client] - e.currentTarget.getBoundingClientRect()[bar.value.direction]);
  20033. emit("start-move");
  20034. attachEvents();
  20035. };
  20036. const onMouseUp = () => {
  20037. state.isDragging = false;
  20038. state[bar.value.axis] = 0;
  20039. emit("stop-move");
  20040. detachEvents();
  20041. };
  20042. const onMouseMove = (e) => {
  20043. const { isDragging } = state;
  20044. if (!isDragging) return;
  20045. if (!thumbRef.value || !trackRef.value) return;
  20046. const prevPage = state[bar.value.axis];
  20047. if (!prevPage) return;
  20048. cAF(frameHandle);
  20049. const distance = (trackRef.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1 - (thumbRef.value[bar.value.offset] - prevPage);
  20050. frameHandle = rAF(() => {
  20051. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  20052. emit("scroll", distance, totalSteps.value);
  20053. });
  20054. };
  20055. const clickTrackHandler = (e) => {
  20056. const distance = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) - thumbRef.value[bar.value.offset] / 2;
  20057. state.traveled = Math.max(0, Math.min(distance, totalSteps.value));
  20058. emit("scroll", distance, totalSteps.value);
  20059. };
  20060. watch(() => props.scrollFrom, (v) => {
  20061. if (state.isDragging) return;
  20062. state.traveled = Math.ceil(v * totalSteps.value);
  20063. });
  20064. onBeforeUnmount(() => {
  20065. detachEvents();
  20066. });
  20067. return () => {
  20068. return h("div", {
  20069. role: "presentation",
  20070. ref: trackRef,
  20071. class: [
  20072. nsVirtualScrollbar.b(),
  20073. props.class,
  20074. (props.alwaysOn || state.isDragging) && "always-on"
  20075. ],
  20076. style: trackStyle.value,
  20077. onMousedown: withModifiers(clickTrackHandler, ["stop", "prevent"]),
  20078. onTouchstartPrevent: onThumbMouseDown
  20079. }, h("div", {
  20080. ref: thumbRef,
  20081. class: nsScrollbar.e("thumb"),
  20082. style: thumbStyle.value,
  20083. onMousedown: onThumbMouseDown
  20084. }, []));
  20085. };
  20086. }
  20087. });
  20088. //#endregion
  20089. //#region ../../packages/components/virtual-list/src/builders/build-list.ts
  20090. const createList = ({ name, getOffset, getItemSize, getItemOffset, getEstimatedTotalSize, getStartIndexForOffset, getStopIndexForStartIndex, initCache, clearCache, validateProps }) => {
  20091. return defineComponent({
  20092. name: name ?? "ElVirtualList",
  20093. props: virtualizedListProps,
  20094. emits: [
  20095. ITEM_RENDER_EVT,
  20096. SCROLL_EVT,
  20097. END_REACHED_EVT
  20098. ],
  20099. setup(props, { emit, expose }) {
  20100. validateProps(props);
  20101. const instance = getCurrentInstance();
  20102. const ns = useNamespace("vl");
  20103. const dynamicSizeCache = ref(initCache(props, instance));
  20104. const getItemStyleCache = useCache();
  20105. const windowRef = ref();
  20106. const innerRef = ref();
  20107. const scrollbarRef = ref();
  20108. const states = ref({
  20109. isScrolling: false,
  20110. scrollDir: FORWARD,
  20111. scrollOffset: isNumber(props.initScrollOffset) ? props.initScrollOffset : 0,
  20112. updateRequested: false,
  20113. isScrollbarDragging: false
  20114. });
  20115. const itemsToRender = computed(() => {
  20116. const { total, cache } = props;
  20117. const { isScrolling, scrollDir, scrollOffset } = unref(states);
  20118. if (total === 0) return [
  20119. 0,
  20120. 0,
  20121. 0,
  20122. 0
  20123. ];
  20124. const startIndex = getStartIndexForOffset(props, scrollOffset, unref(dynamicSizeCache));
  20125. const stopIndex = getStopIndexForStartIndex(props, startIndex, scrollOffset, unref(dynamicSizeCache));
  20126. const cacheBackward = !isScrolling || scrollDir === "backward" ? Math.max(1, cache) : 1;
  20127. const cacheForward = !isScrolling || scrollDir === "forward" ? Math.max(1, cache) : 1;
  20128. return [
  20129. Math.max(0, startIndex - cacheBackward),
  20130. Math.max(0, Math.min(total - 1, stopIndex + cacheForward)),
  20131. startIndex,
  20132. stopIndex
  20133. ];
  20134. });
  20135. const estimatedTotalSize = computed(() => getEstimatedTotalSize(props, unref(dynamicSizeCache)));
  20136. const _isHorizontal = computed(() => isHorizontal(props.layout));
  20137. const windowStyle = computed(() => [
  20138. {
  20139. position: "relative",
  20140. [`overflow-${_isHorizontal.value ? "x" : "y"}`]: "scroll",
  20141. WebkitOverflowScrolling: "touch",
  20142. willChange: "transform"
  20143. },
  20144. {
  20145. direction: props.direction,
  20146. height: isNumber(props.height) ? `${props.height}px` : props.height,
  20147. width: isNumber(props.width) ? `${props.width}px` : props.width
  20148. },
  20149. props.style
  20150. ]);
  20151. const innerStyle = computed(() => {
  20152. const size = unref(estimatedTotalSize);
  20153. const horizontal = unref(_isHorizontal);
  20154. const innerWidth = props.innerWidth;
  20155. return {
  20156. height: horizontal ? "100%" : `${size}px`,
  20157. pointerEvents: unref(states).isScrolling ? "none" : void 0,
  20158. width: horizontal ? `${size}px` : innerWidth !== void 0 ? isNumber(innerWidth) ? `${innerWidth}px` : innerWidth : "100%",
  20159. margin: 0,
  20160. boxSizing: "border-box"
  20161. };
  20162. });
  20163. const clientSize = computed(() => _isHorizontal.value ? props.width : props.height);
  20164. const maxOffset = computed(() => Math.max(0, estimatedTotalSize.value - clientSize.value));
  20165. const normalizeOffset = (offset) => clamp$2(offset, 0, maxOffset.value);
  20166. const EDGE_TOLERANCE = 1;
  20167. const getEdgeState = (normalizedOffset) => ({
  20168. start: !isGreaterThan(normalizedOffset, 0, EDGE_TOLERANCE),
  20169. end: !isGreaterThan(maxOffset.value, normalizedOffset, EDGE_TOLERANCE)
  20170. });
  20171. const normalizedScrollOffset = computed(() => normalizeOffset(states.value.scrollOffset));
  20172. const currentEdgeState = computed(() => getEdgeState(normalizedScrollOffset.value));
  20173. let edgeState = currentEdgeState.value;
  20174. const { onWheel } = useWheel({
  20175. atStartEdge: computed(() => currentEdgeState.value.start),
  20176. atEndEdge: computed(() => currentEdgeState.value.end),
  20177. layout: computed(() => props.layout)
  20178. }, (offset) => {
  20179. scrollbarRef.value.onMouseUp?.();
  20180. scrollTo(Math.min(states.value.scrollOffset + offset, maxOffset.value));
  20181. });
  20182. useEventListener(windowRef, "wheel", onWheel, { passive: false });
  20183. const emitEvents = () => {
  20184. const { total } = props;
  20185. if (total > 0) {
  20186. const [cacheStart, cacheEnd, visibleStart, visibleEnd] = unref(itemsToRender);
  20187. emit(ITEM_RENDER_EVT, cacheStart, cacheEnd, visibleStart, visibleEnd);
  20188. }
  20189. const { scrollDir, scrollOffset, updateRequested } = unref(states);
  20190. emit(SCROLL_EVT, scrollDir, scrollOffset, updateRequested);
  20191. };
  20192. const emitEndReached = (direction, offset) => {
  20193. const nextEdgeState = getEdgeState(offset);
  20194. const horizontalEnd = props.direction === "rtl" ? "left" : "right";
  20195. const horizontalStart = props.direction === "rtl" ? "right" : "left";
  20196. if (direction === "forward" && nextEdgeState.end && !edgeState.end) emit(END_REACHED_EVT, _isHorizontal.value ? horizontalEnd : "bottom");
  20197. if (direction === "backward" && nextEdgeState.start && !edgeState.start) emit(END_REACHED_EVT, _isHorizontal.value ? horizontalStart : "top");
  20198. edgeState = nextEdgeState;
  20199. };
  20200. const updateScrollOffset = (offset, { isScrolling, updateRequested }) => {
  20201. const currentState = unref(states);
  20202. const nextOffset = Math.max(offset, 0);
  20203. if (nextOffset === currentState.scrollOffset) return;
  20204. const scrollDir = getScrollDir(currentState.scrollOffset, nextOffset);
  20205. states.value = {
  20206. ...currentState,
  20207. isScrolling,
  20208. scrollDir,
  20209. scrollOffset: nextOffset,
  20210. updateRequested
  20211. };
  20212. emitEndReached(scrollDir, normalizeOffset(nextOffset));
  20213. nextTick(resetIsScrolling);
  20214. };
  20215. const scrollVertically = (e) => {
  20216. const { clientHeight, scrollHeight, scrollTop } = e.currentTarget;
  20217. if (unref(states).scrollOffset === scrollTop) return;
  20218. updateScrollOffset(Math.min(scrollTop, scrollHeight - clientHeight), {
  20219. isScrolling: true,
  20220. updateRequested: false
  20221. });
  20222. };
  20223. const scrollHorizontally = (e) => {
  20224. const { clientWidth, scrollLeft, scrollWidth } = e.currentTarget;
  20225. if (unref(states).scrollOffset === scrollLeft) return;
  20226. const { direction } = props;
  20227. let scrollOffset = scrollLeft;
  20228. if (direction === "rtl") switch (getRTLOffsetType()) {
  20229. case RTL_OFFSET_NAG:
  20230. scrollOffset = -scrollLeft;
  20231. break;
  20232. case RTL_OFFSET_POS_DESC:
  20233. scrollOffset = scrollWidth - clientWidth - scrollLeft;
  20234. break;
  20235. }
  20236. updateScrollOffset(Math.min(scrollOffset, scrollWidth - clientWidth), {
  20237. isScrolling: true,
  20238. updateRequested: false
  20239. });
  20240. };
  20241. const onScroll = (e) => {
  20242. unref(_isHorizontal) ? scrollHorizontally(e) : scrollVertically(e);
  20243. emitEvents();
  20244. };
  20245. const onScrollbarScroll = (distanceToGo, totalSteps) => {
  20246. const offset = maxOffset.value / totalSteps * distanceToGo;
  20247. scrollTo(Math.min(maxOffset.value, offset));
  20248. };
  20249. const scrollTo = (offset) => {
  20250. updateScrollOffset(offset, {
  20251. isScrolling: unref(states).isScrolling,
  20252. updateRequested: true
  20253. });
  20254. };
  20255. const scrollToItem = (idx, alignment = AUTO_ALIGNMENT) => {
  20256. const { scrollOffset } = unref(states);
  20257. idx = Math.max(0, Math.min(idx, props.total - 1));
  20258. scrollTo(getOffset(props, idx, alignment, scrollOffset, unref(dynamicSizeCache)));
  20259. };
  20260. const getItemStyle = (idx) => {
  20261. const { direction, itemSize, layout } = props;
  20262. const itemStyleCache = getItemStyleCache.value(clearCache && itemSize, clearCache && layout, clearCache && direction);
  20263. let style;
  20264. if (hasOwn(itemStyleCache, String(idx))) style = itemStyleCache[idx];
  20265. else {
  20266. const offset = getItemOffset(props, idx, unref(dynamicSizeCache));
  20267. const size = getItemSize(props, idx, unref(dynamicSizeCache));
  20268. const horizontal = unref(_isHorizontal);
  20269. const isRtl = direction === "rtl";
  20270. const offsetHorizontal = horizontal ? offset : 0;
  20271. itemStyleCache[idx] = style = {
  20272. position: "absolute",
  20273. left: isRtl ? void 0 : `${offsetHorizontal}px`,
  20274. right: isRtl ? `${offsetHorizontal}px` : void 0,
  20275. top: !horizontal ? `${offset}px` : 0,
  20276. height: !horizontal ? `${size}px` : "100%",
  20277. width: horizontal ? `${size}px` : "100%"
  20278. };
  20279. }
  20280. return style;
  20281. };
  20282. const resetIsScrolling = () => {
  20283. states.value.isScrolling = false;
  20284. nextTick(() => {
  20285. getItemStyleCache.value(-1, null, null);
  20286. });
  20287. };
  20288. const resetScrollTop = () => {
  20289. const window = windowRef.value;
  20290. if (window) window.scrollTop = 0;
  20291. };
  20292. onMounted(() => {
  20293. if (!isClient) return;
  20294. const { initScrollOffset } = props;
  20295. const windowElement = unref(windowRef);
  20296. if (isNumber(initScrollOffset) && windowElement) if (unref(_isHorizontal)) windowElement.scrollLeft = initScrollOffset;
  20297. else windowElement.scrollTop = initScrollOffset;
  20298. emitEvents();
  20299. });
  20300. onUpdated(() => {
  20301. const { direction, layout } = props;
  20302. const { scrollOffset, updateRequested } = unref(states);
  20303. const windowElement = unref(windowRef);
  20304. if (updateRequested && windowElement) if (layout === "horizontal") if (direction === "rtl") switch (getRTLOffsetType()) {
  20305. case RTL_OFFSET_NAG:
  20306. windowElement.scrollLeft = -scrollOffset;
  20307. break;
  20308. case RTL_OFFSET_POS_ASC:
  20309. windowElement.scrollLeft = scrollOffset;
  20310. break;
  20311. default: {
  20312. const { clientWidth, scrollWidth } = windowElement;
  20313. windowElement.scrollLeft = scrollWidth - clientWidth - scrollOffset;
  20314. break;
  20315. }
  20316. }
  20317. else windowElement.scrollLeft = scrollOffset;
  20318. else windowElement.scrollTop = scrollOffset;
  20319. });
  20320. onActivated(() => {
  20321. unref(windowRef).scrollTop = unref(states).scrollOffset;
  20322. });
  20323. watch(maxOffset, () => {
  20324. edgeState = currentEdgeState.value;
  20325. });
  20326. const api = {
  20327. ns,
  20328. clientSize,
  20329. estimatedTotalSize,
  20330. windowStyle,
  20331. windowRef,
  20332. innerRef,
  20333. innerStyle,
  20334. itemsToRender,
  20335. scrollbarRef,
  20336. states,
  20337. getItemStyle,
  20338. onScroll,
  20339. onScrollbarScroll,
  20340. onWheel,
  20341. scrollTo,
  20342. scrollToItem,
  20343. resetScrollTop
  20344. };
  20345. expose({
  20346. windowRef,
  20347. innerRef,
  20348. getItemStyleCache,
  20349. scrollTo,
  20350. scrollToItem,
  20351. resetScrollTop,
  20352. states
  20353. });
  20354. return api;
  20355. },
  20356. render(ctx) {
  20357. const { $slots, className, clientSize, containerElement, data, getItemStyle, innerElement, itemsToRender, innerStyle, layout, scrollbarAlwaysOn, total, onScroll, onScrollbarScroll, states, useIsScrolling, windowStyle, ns } = ctx;
  20358. const [start, end] = itemsToRender;
  20359. const Container = resolveDynamicComponent(containerElement);
  20360. const Inner = resolveDynamicComponent(innerElement);
  20361. const children = [];
  20362. if (total > 0) for (let i = start; i <= end; i++) children.push(h(Fragment, { key: i }, $slots.default?.({
  20363. data,
  20364. index: i,
  20365. isScrolling: useIsScrolling ? states.isScrolling : void 0,
  20366. style: getItemStyle(i)
  20367. })));
  20368. const InnerNode = [h(Inner, mergeProps(ctx.innerProps, {
  20369. style: innerStyle,
  20370. ref: "innerRef"
  20371. }), !isString(Inner) ? { default: () => children } : children)];
  20372. const scrollbar = h(ScrollBar, {
  20373. ref: "scrollbarRef",
  20374. clientSize,
  20375. layout,
  20376. onScroll: onScrollbarScroll,
  20377. ratio: clientSize * 100 / this.estimatedTotalSize,
  20378. scrollFrom: states.scrollOffset / (this.estimatedTotalSize - clientSize),
  20379. total,
  20380. alwaysOn: scrollbarAlwaysOn
  20381. });
  20382. const listContainer = h(Container, {
  20383. class: [ns.e("window"), className],
  20384. style: windowStyle,
  20385. onScroll,
  20386. ref: "windowRef",
  20387. key: 0
  20388. }, !isString(Container) ? { default: () => [InnerNode] } : [InnerNode]);
  20389. return h("div", {
  20390. key: 0,
  20391. class: [ns.e("wrapper"), scrollbarAlwaysOn ? "always-on" : ""]
  20392. }, [listContainer, scrollbar]);
  20393. }
  20394. });
  20395. };
  20396. //#endregion
  20397. //#region ../../packages/components/virtual-list/src/components/fixed-size-list.ts
  20398. const FixedSizeList = createList({
  20399. name: "ElFixedSizeList",
  20400. getItemOffset: ({ itemSize }, index) => index * itemSize,
  20401. getItemSize: ({ itemSize }) => itemSize,
  20402. getEstimatedTotalSize: ({ total, itemSize }) => itemSize * total,
  20403. getOffset: ({ height, total, itemSize, layout, width }, index, alignment, scrollOffset) => {
  20404. const size = isHorizontal(layout) ? width : height;
  20405. const lastItemOffset = Math.max(0, total * itemSize - size);
  20406. const maxOffset = Math.min(lastItemOffset, index * itemSize);
  20407. const minOffset = Math.max(0, (index + 1) * itemSize - size);
  20408. if (alignment === "smart") if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) alignment = AUTO_ALIGNMENT;
  20409. else alignment = CENTERED_ALIGNMENT;
  20410. switch (alignment) {
  20411. case START_ALIGNMENT: return maxOffset;
  20412. case "end": return minOffset;
  20413. case CENTERED_ALIGNMENT: {
  20414. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  20415. if (middleOffset < Math.ceil(size / 2)) return 0;
  20416. else if (middleOffset > lastItemOffset + Math.floor(size / 2)) return lastItemOffset;
  20417. else return middleOffset;
  20418. }
  20419. case AUTO_ALIGNMENT:
  20420. default: if (scrollOffset >= minOffset && scrollOffset <= maxOffset) return scrollOffset;
  20421. else if (scrollOffset < minOffset) return minOffset;
  20422. else return maxOffset;
  20423. }
  20424. },
  20425. getStartIndexForOffset: ({ total, itemSize }, offset) => Math.max(0, Math.min(total - 1, Math.floor(offset / itemSize))),
  20426. getStopIndexForStartIndex: ({ height, total, itemSize, layout, width }, startIndex, scrollOffset) => {
  20427. const offset = startIndex * itemSize;
  20428. const size = isHorizontal(layout) ? width : height;
  20429. const numVisibleItems = Math.ceil((size + scrollOffset - offset) / itemSize);
  20430. return Math.max(0, Math.min(total - 1, startIndex + numVisibleItems - 1));
  20431. },
  20432. initCache() {},
  20433. clearCache: true,
  20434. validateProps() {}
  20435. });
  20436. //#endregion
  20437. //#region ../../packages/components/virtual-list/src/components/dynamic-size-list.ts
  20438. const getItemFromCache$1 = (props, index, listCache) => {
  20439. const { itemSize } = props;
  20440. const { items, lastVisitedIndex } = listCache;
  20441. if (index > lastVisitedIndex) {
  20442. let offset = 0;
  20443. if (lastVisitedIndex >= 0) {
  20444. const item = items[lastVisitedIndex];
  20445. offset = item.offset + item.size;
  20446. }
  20447. for (let i = lastVisitedIndex + 1; i <= index; i++) {
  20448. const size = itemSize(i);
  20449. items[i] = {
  20450. offset,
  20451. size
  20452. };
  20453. offset += size;
  20454. }
  20455. listCache.lastVisitedIndex = index;
  20456. }
  20457. return items[index];
  20458. };
  20459. const findItem$1 = (props, listCache, offset) => {
  20460. const { items, lastVisitedIndex } = listCache;
  20461. if ((lastVisitedIndex > 0 ? items[lastVisitedIndex].offset : 0) >= offset) return bs$1(props, listCache, 0, lastVisitedIndex, offset);
  20462. return es$1(props, listCache, Math.max(0, lastVisitedIndex), offset);
  20463. };
  20464. const bs$1 = (props, listCache, low, high, offset) => {
  20465. while (low <= high) {
  20466. const mid = low + Math.floor((high - low) / 2);
  20467. const currentOffset = getItemFromCache$1(props, mid, listCache).offset;
  20468. if (currentOffset === offset) return mid;
  20469. else if (currentOffset < offset) low = mid + 1;
  20470. else if (currentOffset > offset) high = mid - 1;
  20471. }
  20472. return Math.max(0, low - 1);
  20473. };
  20474. const es$1 = (props, listCache, index, offset) => {
  20475. const { total } = props;
  20476. let exponent = 1;
  20477. while (index < total && getItemFromCache$1(props, index, listCache).offset < offset) {
  20478. index += exponent;
  20479. exponent *= 2;
  20480. }
  20481. return bs$1(props, listCache, Math.floor(index / 2), Math.min(index, total - 1), offset);
  20482. };
  20483. const getEstimatedTotalSize = ({ total }, { items, estimatedItemSize, lastVisitedIndex }) => {
  20484. let totalSizeOfMeasuredItems = 0;
  20485. if (lastVisitedIndex >= total) lastVisitedIndex = total - 1;
  20486. if (lastVisitedIndex >= 0) {
  20487. const item = items[lastVisitedIndex];
  20488. totalSizeOfMeasuredItems = item.offset + item.size;
  20489. }
  20490. const totalSizeOfUnmeasuredItems = (total - lastVisitedIndex - 1) * estimatedItemSize;
  20491. return totalSizeOfMeasuredItems + totalSizeOfUnmeasuredItems;
  20492. };
  20493. const DynamicSizeList = createList({
  20494. name: "ElDynamicSizeList",
  20495. getItemOffset: (props, index, listCache) => getItemFromCache$1(props, index, listCache).offset,
  20496. getItemSize: (_, index, { items }) => items[index].size,
  20497. getEstimatedTotalSize,
  20498. getOffset: (props, index, alignment, scrollOffset, listCache) => {
  20499. const { height, layout, width } = props;
  20500. const size = isHorizontal(layout) ? width : height;
  20501. const item = getItemFromCache$1(props, index, listCache);
  20502. const estimatedTotalSize = getEstimatedTotalSize(props, listCache);
  20503. const maxOffset = Math.max(0, Math.min(estimatedTotalSize - size, item.offset));
  20504. const minOffset = Math.max(0, item.offset - size + item.size);
  20505. if (alignment === "smart") if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) alignment = AUTO_ALIGNMENT;
  20506. else alignment = CENTERED_ALIGNMENT;
  20507. switch (alignment) {
  20508. case START_ALIGNMENT: return maxOffset;
  20509. case "end": return minOffset;
  20510. case CENTERED_ALIGNMENT: return Math.round(minOffset + (maxOffset - minOffset) / 2);
  20511. case AUTO_ALIGNMENT:
  20512. default: if (scrollOffset >= minOffset && scrollOffset <= maxOffset) return scrollOffset;
  20513. else if (scrollOffset < minOffset) return minOffset;
  20514. else return maxOffset;
  20515. }
  20516. },
  20517. getStartIndexForOffset: (props, offset, listCache) => findItem$1(props, listCache, offset),
  20518. getStopIndexForStartIndex: (props, startIndex, scrollOffset, listCache) => {
  20519. const { height, total, layout, width } = props;
  20520. const size = isHorizontal(layout) ? width : height;
  20521. const item = getItemFromCache$1(props, startIndex, listCache);
  20522. const maxOffset = scrollOffset + size;
  20523. let offset = item.offset + item.size;
  20524. let stopIndex = startIndex;
  20525. while (stopIndex < total - 1 && offset < maxOffset) {
  20526. stopIndex++;
  20527. offset += getItemFromCache$1(props, stopIndex, listCache).size;
  20528. }
  20529. return stopIndex;
  20530. },
  20531. initCache({ estimatedItemSize = 50 }, instance) {
  20532. const cache = {
  20533. items: {},
  20534. estimatedItemSize,
  20535. lastVisitedIndex: -1
  20536. };
  20537. cache.clearCacheAfterIndex = (index, forceUpdate = true) => {
  20538. cache.lastVisitedIndex = Math.min(cache.lastVisitedIndex, index - 1);
  20539. instance.exposed?.getItemStyleCache(-1);
  20540. if (forceUpdate) instance.proxy?.$forceUpdate();
  20541. };
  20542. return cache;
  20543. },
  20544. clearCache: false,
  20545. validateProps: ({ itemSize }) => {}
  20546. });
  20547. //#endregion
  20548. //#region ../../packages/components/virtual-list/src/hooks/use-grid-wheel.ts
  20549. const useGridWheel = ({ atXEndEdge, atXStartEdge, atYEndEdge, atYStartEdge }, onWheelDelta) => {
  20550. let frameHandle = null;
  20551. let xOffset = 0;
  20552. let yOffset = 0;
  20553. const hasReachedEdge = (x, y) => {
  20554. const xEdgeReached = x < 0 && atXStartEdge.value || x > 0 && atXEndEdge.value;
  20555. const yEdgeReached = y < 0 && atYStartEdge.value || y > 0 && atYEndEdge.value;
  20556. return xEdgeReached || yEdgeReached;
  20557. };
  20558. const onWheel = (e) => {
  20559. cAF(frameHandle);
  20560. let x = e.deltaX;
  20561. let y = e.deltaY;
  20562. if (Math.abs(x) > Math.abs(y)) y = 0;
  20563. else x = 0;
  20564. if (e.shiftKey && y !== 0) {
  20565. x = y;
  20566. y = 0;
  20567. }
  20568. if (hasReachedEdge(x, y)) {
  20569. if (e.deltaX !== 0 && x === 0) e.preventDefault();
  20570. return;
  20571. }
  20572. xOffset += x;
  20573. yOffset += y;
  20574. e.preventDefault();
  20575. frameHandle = rAF(() => {
  20576. onWheelDelta(xOffset, yOffset);
  20577. xOffset = 0;
  20578. yOffset = 0;
  20579. });
  20580. };
  20581. return {
  20582. hasReachedEdge,
  20583. onWheel
  20584. };
  20585. };
  20586. //#endregion
  20587. //#region ../../packages/components/virtual-list/src/hooks/use-grid-touch.ts
  20588. const useGridTouch = (windowRef, states, scrollTo, estimatedTotalWidth, estimatedTotalHeight, parsedWidth, parsedHeight) => {
  20589. const touchStartX = ref(0);
  20590. const touchStartY = ref(0);
  20591. let frameHandle;
  20592. let deltaX = 0;
  20593. let deltaY = 0;
  20594. const handleTouchStart = (event) => {
  20595. cAF(frameHandle);
  20596. touchStartX.value = event.touches[0].clientX;
  20597. touchStartY.value = event.touches[0].clientY;
  20598. deltaX = 0;
  20599. deltaY = 0;
  20600. };
  20601. const handleTouchMove = (event) => {
  20602. event.preventDefault();
  20603. cAF(frameHandle);
  20604. deltaX += touchStartX.value - event.touches[0].clientX;
  20605. deltaY += touchStartY.value - event.touches[0].clientY;
  20606. touchStartX.value = event.touches[0].clientX;
  20607. touchStartY.value = event.touches[0].clientY;
  20608. frameHandle = rAF(() => {
  20609. const maxScrollLeft = estimatedTotalWidth.value - unref(parsedWidth);
  20610. const maxScrollTop = estimatedTotalHeight.value - unref(parsedHeight);
  20611. scrollTo({
  20612. scrollLeft: Math.min(states.value.scrollLeft + deltaX, maxScrollLeft),
  20613. scrollTop: Math.min(states.value.scrollTop + deltaY, maxScrollTop)
  20614. });
  20615. deltaX = 0;
  20616. deltaY = 0;
  20617. });
  20618. };
  20619. useEventListener(windowRef, "touchstart", handleTouchStart, { passive: true });
  20620. useEventListener(windowRef, "touchmove", handleTouchMove, { passive: false });
  20621. return {
  20622. touchStartX,
  20623. touchStartY,
  20624. handleTouchStart,
  20625. handleTouchMove
  20626. };
  20627. };
  20628. //#endregion
  20629. //#region ../../packages/components/virtual-list/src/builders/build-grid.ts
  20630. const createGrid = ({ name, clearCache, getColumnPosition, getColumnStartIndexForOffset, getColumnStopIndexForStartIndex, getEstimatedTotalHeight, getEstimatedTotalWidth, getColumnOffset, getRowOffset, getRowPosition, getRowStartIndexForOffset, getRowStopIndexForStartIndex, initCache, injectToInstance, validateProps }) => {
  20631. return defineComponent({
  20632. name: name ?? "ElVirtualList",
  20633. props: virtualizedGridProps,
  20634. emits: [ITEM_RENDER_EVT, SCROLL_EVT],
  20635. setup(props, { emit, expose, slots }) {
  20636. const ns = useNamespace("vl");
  20637. validateProps(props);
  20638. const instance = getCurrentInstance();
  20639. const cache = ref(initCache(props, instance));
  20640. injectToInstance?.(instance, cache);
  20641. const windowRef = ref();
  20642. const hScrollbar = ref();
  20643. const vScrollbar = ref();
  20644. const innerRef = ref();
  20645. const states = ref({
  20646. isScrolling: false,
  20647. scrollLeft: isNumber(props.initScrollLeft) ? props.initScrollLeft : 0,
  20648. scrollTop: isNumber(props.initScrollTop) ? props.initScrollTop : 0,
  20649. updateRequested: false,
  20650. xAxisScrollDir: FORWARD,
  20651. yAxisScrollDir: FORWARD
  20652. });
  20653. const getItemStyleCache = useCache();
  20654. const parsedHeight = computed(() => Number.parseInt(`${props.height}`, 10));
  20655. const parsedWidth = computed(() => Number.parseInt(`${props.width}`, 10));
  20656. const columnsToRender = computed(() => {
  20657. const { totalColumn, totalRow, columnCache } = props;
  20658. const { isScrolling, xAxisScrollDir, scrollLeft } = unref(states);
  20659. if (totalColumn === 0 || totalRow === 0) return [
  20660. 0,
  20661. 0,
  20662. 0,
  20663. 0
  20664. ];
  20665. const startIndex = getColumnStartIndexForOffset(props, scrollLeft, unref(cache));
  20666. const stopIndex = getColumnStopIndexForStartIndex(props, startIndex, scrollLeft, unref(cache));
  20667. const cacheBackward = !isScrolling || xAxisScrollDir === "backward" ? Math.max(1, columnCache) : 1;
  20668. const cacheForward = !isScrolling || xAxisScrollDir === "forward" ? Math.max(1, columnCache) : 1;
  20669. return [
  20670. Math.max(0, startIndex - cacheBackward),
  20671. Math.max(0, Math.min(totalColumn - 1, stopIndex + cacheForward)),
  20672. startIndex,
  20673. stopIndex
  20674. ];
  20675. });
  20676. const rowsToRender = computed(() => {
  20677. const { totalColumn, totalRow, rowCache } = props;
  20678. const { isScrolling, yAxisScrollDir, scrollTop } = unref(states);
  20679. if (totalColumn === 0 || totalRow === 0) return [
  20680. 0,
  20681. 0,
  20682. 0,
  20683. 0
  20684. ];
  20685. const startIndex = getRowStartIndexForOffset(props, scrollTop, unref(cache));
  20686. const stopIndex = getRowStopIndexForStartIndex(props, startIndex, scrollTop, unref(cache));
  20687. const cacheBackward = !isScrolling || yAxisScrollDir === "backward" ? Math.max(1, rowCache) : 1;
  20688. const cacheForward = !isScrolling || yAxisScrollDir === "forward" ? Math.max(1, rowCache) : 1;
  20689. return [
  20690. Math.max(0, startIndex - cacheBackward),
  20691. Math.max(0, Math.min(totalRow - 1, stopIndex + cacheForward)),
  20692. startIndex,
  20693. stopIndex
  20694. ];
  20695. });
  20696. const estimatedTotalHeight = computed(() => getEstimatedTotalHeight(props, unref(cache)));
  20697. const estimatedTotalWidth = computed(() => getEstimatedTotalWidth(props, unref(cache)));
  20698. const windowStyle = computed(() => [
  20699. {
  20700. position: "relative",
  20701. overflow: "hidden",
  20702. WebkitOverflowScrolling: "touch",
  20703. willChange: "transform"
  20704. },
  20705. {
  20706. direction: props.direction,
  20707. height: isNumber(props.height) ? `${props.height}px` : props.height,
  20708. width: isNumber(props.width) ? `${props.width}px` : props.width
  20709. },
  20710. props.style ?? {}
  20711. ]);
  20712. const innerStyle = computed(() => {
  20713. const width = `${unref(estimatedTotalWidth)}px`;
  20714. return {
  20715. height: `${unref(estimatedTotalHeight)}px`,
  20716. pointerEvents: unref(states).isScrolling ? "none" : void 0,
  20717. width,
  20718. margin: 0,
  20719. boxSizing: "border-box"
  20720. };
  20721. });
  20722. const emitEvents = () => {
  20723. const { totalColumn, totalRow } = props;
  20724. if (totalColumn > 0 && totalRow > 0) {
  20725. const [columnCacheStart, columnCacheEnd, columnVisibleStart, columnVisibleEnd] = unref(columnsToRender);
  20726. const [rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd] = unref(rowsToRender);
  20727. emit(ITEM_RENDER_EVT, {
  20728. columnCacheStart,
  20729. columnCacheEnd,
  20730. rowCacheStart,
  20731. rowCacheEnd,
  20732. columnVisibleStart,
  20733. columnVisibleEnd,
  20734. rowVisibleStart,
  20735. rowVisibleEnd
  20736. });
  20737. }
  20738. const { scrollLeft, scrollTop, updateRequested, xAxisScrollDir, yAxisScrollDir } = unref(states);
  20739. emit(SCROLL_EVT, {
  20740. xAxisScrollDir,
  20741. scrollLeft,
  20742. yAxisScrollDir,
  20743. scrollTop,
  20744. updateRequested
  20745. });
  20746. };
  20747. const onScroll = (e) => {
  20748. const { clientHeight, clientWidth, scrollHeight, scrollLeft, scrollTop, scrollWidth } = e.currentTarget;
  20749. const _states = unref(states);
  20750. if (_states.scrollTop === scrollTop && _states.scrollLeft === scrollLeft) return;
  20751. let _scrollLeft = scrollLeft;
  20752. if (isRTL(props.direction)) switch (getRTLOffsetType()) {
  20753. case RTL_OFFSET_NAG:
  20754. _scrollLeft = -scrollLeft;
  20755. break;
  20756. case RTL_OFFSET_POS_DESC:
  20757. _scrollLeft = scrollWidth - clientWidth - scrollLeft;
  20758. break;
  20759. }
  20760. states.value = {
  20761. ..._states,
  20762. isScrolling: true,
  20763. scrollLeft: _scrollLeft,
  20764. scrollTop: Math.max(0, Math.min(scrollTop, scrollHeight - clientHeight)),
  20765. updateRequested: true,
  20766. xAxisScrollDir: getScrollDir(_states.scrollLeft, _scrollLeft),
  20767. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop)
  20768. };
  20769. nextTick(() => resetIsScrolling());
  20770. onUpdated();
  20771. emitEvents();
  20772. };
  20773. const onVerticalScroll = (distance, totalSteps) => {
  20774. const height = unref(parsedHeight);
  20775. const offset = (estimatedTotalHeight.value - height) / totalSteps * distance;
  20776. scrollTo({ scrollTop: Math.min(estimatedTotalHeight.value - height, offset) });
  20777. };
  20778. const onHorizontalScroll = (distance, totalSteps) => {
  20779. const width = unref(parsedWidth);
  20780. const offset = (estimatedTotalWidth.value - width) / totalSteps * distance;
  20781. scrollTo({ scrollLeft: Math.min(estimatedTotalWidth.value - width, offset) });
  20782. };
  20783. const { onWheel } = useGridWheel({
  20784. atXStartEdge: computed(() => states.value.scrollLeft <= 0),
  20785. atXEndEdge: computed(() => states.value.scrollLeft >= estimatedTotalWidth.value - unref(parsedWidth)),
  20786. atYStartEdge: computed(() => states.value.scrollTop <= 0),
  20787. atYEndEdge: computed(() => states.value.scrollTop >= estimatedTotalHeight.value - unref(parsedHeight))
  20788. }, (x, y) => {
  20789. hScrollbar.value?.onMouseUp?.();
  20790. vScrollbar.value?.onMouseUp?.();
  20791. const width = unref(parsedWidth);
  20792. const height = unref(parsedHeight);
  20793. scrollTo({
  20794. scrollLeft: Math.min(states.value.scrollLeft + x, estimatedTotalWidth.value - width),
  20795. scrollTop: Math.min(states.value.scrollTop + y, estimatedTotalHeight.value - height)
  20796. });
  20797. });
  20798. useEventListener(windowRef, "wheel", onWheel, { passive: false });
  20799. const scrollTo = ({ scrollLeft = states.value.scrollLeft, scrollTop = states.value.scrollTop }) => {
  20800. scrollLeft = Math.max(scrollLeft, 0);
  20801. scrollTop = Math.max(scrollTop, 0);
  20802. const _states = unref(states);
  20803. if (scrollTop === _states.scrollTop && scrollLeft === _states.scrollLeft) return;
  20804. states.value = {
  20805. ..._states,
  20806. xAxisScrollDir: getScrollDir(_states.scrollLeft, scrollLeft),
  20807. yAxisScrollDir: getScrollDir(_states.scrollTop, scrollTop),
  20808. scrollLeft,
  20809. scrollTop,
  20810. updateRequested: true
  20811. };
  20812. nextTick(() => resetIsScrolling());
  20813. onUpdated();
  20814. emitEvents();
  20815. };
  20816. const { touchStartX, touchStartY, handleTouchStart, handleTouchMove } = useGridTouch(windowRef, states, scrollTo, estimatedTotalWidth, estimatedTotalHeight, parsedWidth, parsedHeight);
  20817. const scrollToItem = (rowIndex = 0, columnIdx = 0, alignment = AUTO_ALIGNMENT) => {
  20818. const _states = unref(states);
  20819. columnIdx = Math.max(0, Math.min(columnIdx, props.totalColumn - 1));
  20820. rowIndex = Math.max(0, Math.min(rowIndex, props.totalRow - 1));
  20821. const scrollBarWidth = getScrollBarWidth(ns.namespace.value);
  20822. const _cache = unref(cache);
  20823. const estimatedHeight = getEstimatedTotalHeight(props, _cache);
  20824. const estimatedWidth = getEstimatedTotalWidth(props, _cache);
  20825. scrollTo({
  20826. scrollLeft: getColumnOffset(props, columnIdx, alignment, _states.scrollLeft, _cache, estimatedWidth > props.width ? scrollBarWidth : 0),
  20827. scrollTop: getRowOffset(props, rowIndex, alignment, _states.scrollTop, _cache, estimatedHeight > props.height ? scrollBarWidth : 0)
  20828. });
  20829. };
  20830. const getItemStyle = (rowIndex, columnIndex) => {
  20831. const { columnWidth, direction, rowHeight } = props;
  20832. const itemStyleCache = getItemStyleCache.value(clearCache && columnWidth, clearCache && rowHeight, clearCache && direction);
  20833. const key = `${rowIndex},${columnIndex}`;
  20834. if (hasOwn(itemStyleCache, key)) return itemStyleCache[key];
  20835. else {
  20836. const [, left] = getColumnPosition(props, columnIndex, unref(cache));
  20837. const _cache = unref(cache);
  20838. const rtl = isRTL(direction);
  20839. const [height, top] = getRowPosition(props, rowIndex, _cache);
  20840. const [width] = getColumnPosition(props, columnIndex, _cache);
  20841. itemStyleCache[key] = {
  20842. position: "absolute",
  20843. left: rtl ? void 0 : `${left}px`,
  20844. right: rtl ? `${left}px` : void 0,
  20845. top: `${top}px`,
  20846. height: `${height}px`,
  20847. width: `${width}px`
  20848. };
  20849. return itemStyleCache[key];
  20850. }
  20851. };
  20852. const resetIsScrolling = () => {
  20853. states.value.isScrolling = false;
  20854. nextTick(() => {
  20855. getItemStyleCache.value(-1, null, null);
  20856. });
  20857. };
  20858. onMounted(() => {
  20859. if (!isClient) return;
  20860. const { initScrollLeft, initScrollTop } = props;
  20861. const windowElement = unref(windowRef);
  20862. if (windowElement) {
  20863. if (isNumber(initScrollLeft)) windowElement.scrollLeft = initScrollLeft;
  20864. if (isNumber(initScrollTop)) windowElement.scrollTop = initScrollTop;
  20865. }
  20866. emitEvents();
  20867. });
  20868. const onUpdated = () => {
  20869. const { direction } = props;
  20870. const { scrollLeft, scrollTop, updateRequested } = unref(states);
  20871. const windowElement = unref(windowRef);
  20872. if (updateRequested && windowElement) {
  20873. if (direction === "rtl") switch (getRTLOffsetType()) {
  20874. case RTL_OFFSET_NAG:
  20875. windowElement.scrollLeft = -scrollLeft;
  20876. break;
  20877. case RTL_OFFSET_POS_ASC:
  20878. windowElement.scrollLeft = scrollLeft;
  20879. break;
  20880. default: {
  20881. const { clientWidth, scrollWidth } = windowElement;
  20882. windowElement.scrollLeft = scrollWidth - clientWidth - scrollLeft;
  20883. break;
  20884. }
  20885. }
  20886. else windowElement.scrollLeft = Math.max(0, scrollLeft);
  20887. windowElement.scrollTop = Math.max(0, scrollTop);
  20888. }
  20889. };
  20890. const { resetAfterColumnIndex, resetAfterRowIndex, resetAfter } = instance.proxy;
  20891. expose({
  20892. windowRef,
  20893. innerRef,
  20894. getItemStyleCache,
  20895. touchStartX,
  20896. touchStartY,
  20897. handleTouchStart,
  20898. handleTouchMove,
  20899. scrollTo,
  20900. scrollToItem,
  20901. states,
  20902. resetAfterColumnIndex,
  20903. resetAfterRowIndex,
  20904. resetAfter
  20905. });
  20906. const renderScrollbars = () => {
  20907. const { scrollbarAlwaysOn, scrollbarStartGap, scrollbarEndGap, totalColumn, totalRow } = props;
  20908. const width = unref(parsedWidth);
  20909. const height = unref(parsedHeight);
  20910. const estimatedWidth = unref(estimatedTotalWidth);
  20911. const estimatedHeight = unref(estimatedTotalHeight);
  20912. const { scrollLeft, scrollTop } = unref(states);
  20913. return {
  20914. horizontalScrollbar: h(ScrollBar, {
  20915. ref: hScrollbar,
  20916. alwaysOn: scrollbarAlwaysOn,
  20917. startGap: scrollbarStartGap,
  20918. endGap: scrollbarEndGap,
  20919. class: ns.e("horizontal"),
  20920. clientSize: width,
  20921. layout: "horizontal",
  20922. onScroll: onHorizontalScroll,
  20923. ratio: width * 100 / estimatedWidth,
  20924. scrollFrom: scrollLeft / (estimatedWidth - width),
  20925. total: totalRow,
  20926. visible: true
  20927. }),
  20928. verticalScrollbar: h(ScrollBar, {
  20929. ref: vScrollbar,
  20930. alwaysOn: scrollbarAlwaysOn,
  20931. startGap: scrollbarStartGap,
  20932. endGap: scrollbarEndGap,
  20933. class: ns.e("vertical"),
  20934. clientSize: height,
  20935. layout: "vertical",
  20936. onScroll: onVerticalScroll,
  20937. ratio: height * 100 / estimatedHeight,
  20938. scrollFrom: scrollTop / (estimatedHeight - height),
  20939. total: totalColumn,
  20940. visible: true
  20941. })
  20942. };
  20943. };
  20944. const renderItems = () => {
  20945. const [columnStart, columnEnd] = unref(columnsToRender);
  20946. const [rowStart, rowEnd] = unref(rowsToRender);
  20947. const { data, totalColumn, totalRow, useIsScrolling, itemKey } = props;
  20948. const children = [];
  20949. if (totalRow > 0 && totalColumn > 0) for (let row = rowStart; row <= rowEnd; row++) for (let column = columnStart; column <= columnEnd; column++) {
  20950. const key = itemKey({
  20951. columnIndex: column,
  20952. data,
  20953. rowIndex: row
  20954. });
  20955. children.push(h(Fragment, { key }, slots.default?.({
  20956. columnIndex: column,
  20957. data,
  20958. isScrolling: useIsScrolling ? unref(states).isScrolling : void 0,
  20959. style: getItemStyle(row, column),
  20960. rowIndex: row
  20961. })));
  20962. }
  20963. return children;
  20964. };
  20965. const renderInner = () => {
  20966. const Inner = resolveDynamicComponent(props.innerElement);
  20967. const children = renderItems();
  20968. return [h(Inner, mergeProps(props.innerProps, {
  20969. style: unref(innerStyle),
  20970. ref: innerRef
  20971. }), !isString(Inner) ? { default: () => children } : children)];
  20972. };
  20973. const renderWindow = () => {
  20974. const Container = resolveDynamicComponent(props.containerElement);
  20975. const { horizontalScrollbar, verticalScrollbar } = renderScrollbars();
  20976. const Inner = renderInner();
  20977. return h("div", {
  20978. key: 0,
  20979. class: ns.e("wrapper"),
  20980. role: props.role
  20981. }, [
  20982. h(Container, {
  20983. class: props.className,
  20984. style: unref(windowStyle),
  20985. onScroll,
  20986. ref: windowRef
  20987. }, !isString(Container) ? { default: () => Inner } : Inner),
  20988. horizontalScrollbar,
  20989. verticalScrollbar
  20990. ]);
  20991. };
  20992. return renderWindow;
  20993. }
  20994. });
  20995. };
  20996. //#endregion
  20997. //#region ../../packages/components/virtual-list/src/components/fixed-size-grid.ts
  20998. const FixedSizeGrid = createGrid({
  20999. name: "ElFixedSizeGrid",
  21000. getColumnPosition: ({ columnWidth }, index) => [columnWidth, index * columnWidth],
  21001. getRowPosition: ({ rowHeight }, index) => [rowHeight, index * rowHeight],
  21002. getEstimatedTotalHeight: ({ totalRow, rowHeight }) => rowHeight * totalRow,
  21003. getEstimatedTotalWidth: ({ totalColumn, columnWidth }) => columnWidth * totalColumn,
  21004. getColumnOffset: ({ totalColumn, columnWidth, width }, columnIndex, alignment, scrollLeft, _, scrollBarWidth) => {
  21005. width = Number(width);
  21006. const lastColumnOffset = Math.max(0, totalColumn * columnWidth - width);
  21007. const maxOffset = Math.min(lastColumnOffset, columnIndex * columnWidth);
  21008. const minOffset = Math.max(0, columnIndex * columnWidth - width + scrollBarWidth + columnWidth);
  21009. if (alignment === "smart") if (scrollLeft >= minOffset - width && scrollLeft <= maxOffset + width) alignment = AUTO_ALIGNMENT;
  21010. else alignment = CENTERED_ALIGNMENT;
  21011. switch (alignment) {
  21012. case START_ALIGNMENT: return maxOffset;
  21013. case "end": return minOffset;
  21014. case CENTERED_ALIGNMENT: {
  21015. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  21016. if (middleOffset < Math.ceil(width / 2)) return 0;
  21017. else if (middleOffset > lastColumnOffset + Math.floor(width / 2)) return lastColumnOffset;
  21018. else return middleOffset;
  21019. }
  21020. case AUTO_ALIGNMENT:
  21021. default: if (scrollLeft >= minOffset && scrollLeft <= maxOffset) return scrollLeft;
  21022. else if (minOffset > maxOffset) return minOffset;
  21023. else if (scrollLeft < minOffset) return minOffset;
  21024. else return maxOffset;
  21025. }
  21026. },
  21027. getRowOffset: ({ rowHeight, height, totalRow }, rowIndex, align, scrollTop, _, scrollBarWidth) => {
  21028. height = Number(height);
  21029. const lastRowOffset = Math.max(0, totalRow * rowHeight - height);
  21030. const maxOffset = Math.min(lastRowOffset, rowIndex * rowHeight);
  21031. const minOffset = Math.max(0, rowIndex * rowHeight - height + scrollBarWidth + rowHeight);
  21032. if (align === "smart") if (scrollTop >= minOffset - height && scrollTop <= maxOffset + height) align = AUTO_ALIGNMENT;
  21033. else align = CENTERED_ALIGNMENT;
  21034. switch (align) {
  21035. case START_ALIGNMENT: return maxOffset;
  21036. case "end": return minOffset;
  21037. case CENTERED_ALIGNMENT: {
  21038. const middleOffset = Math.round(minOffset + (maxOffset - minOffset) / 2);
  21039. if (middleOffset < Math.ceil(height / 2)) return 0;
  21040. else if (middleOffset > lastRowOffset + Math.floor(height / 2)) return lastRowOffset;
  21041. else return middleOffset;
  21042. }
  21043. case AUTO_ALIGNMENT:
  21044. default: if (scrollTop >= minOffset && scrollTop <= maxOffset) return scrollTop;
  21045. else if (minOffset > maxOffset) return minOffset;
  21046. else if (scrollTop < minOffset) return minOffset;
  21047. else return maxOffset;
  21048. }
  21049. },
  21050. getColumnStartIndexForOffset: ({ columnWidth, totalColumn }, scrollLeft) => Math.max(0, Math.min(totalColumn - 1, Math.floor(scrollLeft / columnWidth))),
  21051. getColumnStopIndexForStartIndex: ({ columnWidth, totalColumn, width }, startIndex, scrollLeft) => {
  21052. const left = startIndex * columnWidth;
  21053. const visibleColumnsCount = Math.ceil((width + scrollLeft - left) / columnWidth);
  21054. return Math.max(0, Math.min(totalColumn - 1, startIndex + visibleColumnsCount - 1));
  21055. },
  21056. getRowStartIndexForOffset: ({ rowHeight, totalRow }, scrollTop) => Math.max(0, Math.min(totalRow - 1, Math.floor(scrollTop / rowHeight))),
  21057. getRowStopIndexForStartIndex: ({ rowHeight, totalRow, height }, startIndex, scrollTop) => {
  21058. const top = startIndex * rowHeight;
  21059. const numVisibleRows = Math.ceil((height + scrollTop - top) / rowHeight);
  21060. return Math.max(0, Math.min(totalRow - 1, startIndex + numVisibleRows - 1));
  21061. },
  21062. initCache: () => void 0,
  21063. clearCache: true,
  21064. validateProps: ({ columnWidth, rowHeight }) => {}
  21065. });
  21066. //#endregion
  21067. //#region ../../packages/components/virtual-list/src/components/dynamic-size-grid.ts
  21068. const { max, min, floor } = Math;
  21069. const ACCESS_SIZER_KEY_MAP = {
  21070. column: "columnWidth",
  21071. row: "rowHeight"
  21072. };
  21073. const ACCESS_LAST_VISITED_KEY_MAP = {
  21074. column: "lastVisitedColumnIndex",
  21075. row: "lastVisitedRowIndex"
  21076. };
  21077. const getItemFromCache = (props, index, gridCache, type) => {
  21078. const [cachedItems, sizer, lastVisited] = [
  21079. gridCache[type],
  21080. props[ACCESS_SIZER_KEY_MAP[type]],
  21081. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]
  21082. ];
  21083. if (index > lastVisited) {
  21084. let offset = 0;
  21085. if (lastVisited >= 0) {
  21086. const item = cachedItems[lastVisited];
  21087. offset = item.offset + item.size;
  21088. }
  21089. for (let i = lastVisited + 1; i <= index; i++) {
  21090. const size = sizer(i);
  21091. cachedItems[i] = {
  21092. offset,
  21093. size
  21094. };
  21095. offset += size;
  21096. }
  21097. gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]] = index;
  21098. }
  21099. return cachedItems[index];
  21100. };
  21101. const bs = (props, gridCache, low, high, offset, type) => {
  21102. while (low <= high) {
  21103. const mid = low + floor((high - low) / 2);
  21104. const currentOffset = getItemFromCache(props, mid, gridCache, type).offset;
  21105. if (currentOffset === offset) return mid;
  21106. else if (currentOffset < offset) low = mid + 1;
  21107. else high = mid - 1;
  21108. }
  21109. return max(0, low - 1);
  21110. };
  21111. const es = (props, gridCache, idx, offset, type) => {
  21112. const total = type === "column" ? props.totalColumn : props.totalRow;
  21113. let exponent = 1;
  21114. while (idx < total && getItemFromCache(props, idx, gridCache, type).offset < offset) {
  21115. idx += exponent;
  21116. exponent *= 2;
  21117. }
  21118. return bs(props, gridCache, floor(idx / 2), min(idx, total - 1), offset, type);
  21119. };
  21120. const findItem = (props, gridCache, offset, type) => {
  21121. const [cache, lastVisitedIndex] = [gridCache[type], gridCache[ACCESS_LAST_VISITED_KEY_MAP[type]]];
  21122. if ((lastVisitedIndex > 0 ? cache[lastVisitedIndex].offset : 0) >= offset) return bs(props, gridCache, 0, lastVisitedIndex, offset, type);
  21123. return es(props, gridCache, max(0, lastVisitedIndex), offset, type);
  21124. };
  21125. const getEstimatedTotalHeight = ({ totalRow }, { estimatedRowHeight, lastVisitedRowIndex, row }) => {
  21126. let sizeOfVisitedRows = 0;
  21127. if (lastVisitedRowIndex >= totalRow) lastVisitedRowIndex = totalRow - 1;
  21128. if (lastVisitedRowIndex >= 0) {
  21129. const item = row[lastVisitedRowIndex];
  21130. sizeOfVisitedRows = item.offset + item.size;
  21131. }
  21132. const sizeOfUnvisitedItems = (totalRow - lastVisitedRowIndex - 1) * estimatedRowHeight;
  21133. return sizeOfVisitedRows + sizeOfUnvisitedItems;
  21134. };
  21135. const getEstimatedTotalWidth = ({ totalColumn }, { column, estimatedColumnWidth, lastVisitedColumnIndex }) => {
  21136. let sizeOfVisitedColumns = 0;
  21137. if (lastVisitedColumnIndex > totalColumn) lastVisitedColumnIndex = totalColumn - 1;
  21138. if (lastVisitedColumnIndex >= 0) {
  21139. const item = column[lastVisitedColumnIndex];
  21140. sizeOfVisitedColumns = item.offset + item.size;
  21141. }
  21142. const sizeOfUnvisitedItems = (totalColumn - lastVisitedColumnIndex - 1) * estimatedColumnWidth;
  21143. return sizeOfVisitedColumns + sizeOfUnvisitedItems;
  21144. };
  21145. const ACCESS_ESTIMATED_SIZE_KEY_MAP = {
  21146. column: getEstimatedTotalWidth,
  21147. row: getEstimatedTotalHeight
  21148. };
  21149. const getOffset$1 = (props, index, alignment, scrollOffset, cache, type, scrollBarWidth) => {
  21150. const [size, estimatedSizeAssociates] = [type === "row" ? props.height : props.width, ACCESS_ESTIMATED_SIZE_KEY_MAP[type]];
  21151. const item = getItemFromCache(props, index, cache, type);
  21152. const maxOffset = max(0, min(estimatedSizeAssociates(props, cache) - size, item.offset));
  21153. const minOffset = max(0, item.offset - size + scrollBarWidth + item.size);
  21154. if (alignment === "smart") if (scrollOffset >= minOffset - size && scrollOffset <= maxOffset + size) alignment = AUTO_ALIGNMENT;
  21155. else alignment = CENTERED_ALIGNMENT;
  21156. switch (alignment) {
  21157. case START_ALIGNMENT: return maxOffset;
  21158. case "end": return minOffset;
  21159. case CENTERED_ALIGNMENT: return Math.round(minOffset + (maxOffset - minOffset) / 2);
  21160. case AUTO_ALIGNMENT:
  21161. default: if (scrollOffset >= minOffset && scrollOffset <= maxOffset) return scrollOffset;
  21162. else if (minOffset > maxOffset) return minOffset;
  21163. else if (scrollOffset < minOffset) return minOffset;
  21164. else return maxOffset;
  21165. }
  21166. };
  21167. const DynamicSizeGrid = createGrid({
  21168. name: "ElDynamicSizeGrid",
  21169. getColumnPosition: (props, idx, cache) => {
  21170. const item = getItemFromCache(props, idx, cache, "column");
  21171. return [item.size, item.offset];
  21172. },
  21173. getRowPosition: (props, idx, cache) => {
  21174. const item = getItemFromCache(props, idx, cache, "row");
  21175. return [item.size, item.offset];
  21176. },
  21177. getColumnOffset: (props, columnIndex, alignment, scrollLeft, cache, scrollBarWidth) => getOffset$1(props, columnIndex, alignment, scrollLeft, cache, "column", scrollBarWidth),
  21178. getRowOffset: (props, rowIndex, alignment, scrollTop, cache, scrollBarWidth) => getOffset$1(props, rowIndex, alignment, scrollTop, cache, "row", scrollBarWidth),
  21179. getColumnStartIndexForOffset: (props, scrollLeft, cache) => findItem(props, cache, scrollLeft, "column"),
  21180. getColumnStopIndexForStartIndex: (props, startIndex, scrollLeft, cache) => {
  21181. const item = getItemFromCache(props, startIndex, cache, "column");
  21182. const maxOffset = scrollLeft + props.width;
  21183. let offset = item.offset + item.size;
  21184. let stopIndex = startIndex;
  21185. while (stopIndex < props.totalColumn - 1 && offset < maxOffset) {
  21186. stopIndex++;
  21187. offset += getItemFromCache(props, startIndex, cache, "column").size;
  21188. }
  21189. return stopIndex;
  21190. },
  21191. getEstimatedTotalHeight,
  21192. getEstimatedTotalWidth,
  21193. getRowStartIndexForOffset: (props, scrollTop, cache) => findItem(props, cache, scrollTop, "row"),
  21194. getRowStopIndexForStartIndex: (props, startIndex, scrollTop, cache) => {
  21195. const { totalRow, height } = props;
  21196. const item = getItemFromCache(props, startIndex, cache, "row");
  21197. const maxOffset = scrollTop + height;
  21198. let offset = item.size + item.offset;
  21199. let stopIndex = startIndex;
  21200. while (stopIndex < totalRow - 1 && offset < maxOffset) {
  21201. stopIndex++;
  21202. offset += getItemFromCache(props, stopIndex, cache, "row").size;
  21203. }
  21204. return stopIndex;
  21205. },
  21206. injectToInstance: (instance, cache) => {
  21207. const resetAfter = ({ columnIndex, rowIndex }, forceUpdate) => {
  21208. forceUpdate = isUndefined(forceUpdate) ? true : forceUpdate;
  21209. if (isNumber(columnIndex)) cache.value.lastVisitedColumnIndex = Math.min(cache.value.lastVisitedColumnIndex, columnIndex - 1);
  21210. if (isNumber(rowIndex)) cache.value.lastVisitedRowIndex = Math.min(cache.value.lastVisitedRowIndex, rowIndex - 1);
  21211. instance.exposed?.getItemStyleCache.value(-1, null, null);
  21212. if (forceUpdate) instance.proxy?.$forceUpdate();
  21213. };
  21214. const resetAfterColumnIndex = (columnIndex, forceUpdate) => {
  21215. resetAfter({ columnIndex }, forceUpdate);
  21216. };
  21217. const resetAfterRowIndex = (rowIndex, forceUpdate) => {
  21218. resetAfter({ rowIndex }, forceUpdate);
  21219. };
  21220. Object.assign(instance.proxy, {
  21221. resetAfterColumnIndex,
  21222. resetAfterRowIndex,
  21223. resetAfter
  21224. });
  21225. },
  21226. initCache: ({ estimatedColumnWidth = 50, estimatedRowHeight = 50 }) => {
  21227. return {
  21228. column: {},
  21229. estimatedColumnWidth,
  21230. estimatedRowHeight,
  21231. lastVisitedColumnIndex: -1,
  21232. lastVisitedRowIndex: -1,
  21233. row: {}
  21234. };
  21235. },
  21236. clearCache: false,
  21237. validateProps: ({ columnWidth, rowHeight }) => {}
  21238. });
  21239. //#endregion
  21240. //#region ../../packages/components/checkbox/src/checkbox.ts
  21241. const checkboxProps = {
  21242. modelValue: {
  21243. type: [
  21244. Number,
  21245. String,
  21246. Boolean
  21247. ],
  21248. default: void 0
  21249. },
  21250. label: {
  21251. type: [
  21252. String,
  21253. Boolean,
  21254. Number,
  21255. Object
  21256. ],
  21257. default: void 0
  21258. },
  21259. value: {
  21260. type: [
  21261. String,
  21262. Boolean,
  21263. Number,
  21264. Object
  21265. ],
  21266. default: void 0
  21267. },
  21268. indeterminate: Boolean,
  21269. disabled: {
  21270. type: Boolean,
  21271. default: void 0
  21272. },
  21273. checked: Boolean,
  21274. name: {
  21275. type: String,
  21276. default: void 0
  21277. },
  21278. trueValue: {
  21279. type: [String, Number],
  21280. default: void 0
  21281. },
  21282. falseValue: {
  21283. type: [String, Number],
  21284. default: void 0
  21285. },
  21286. trueLabel: {
  21287. type: [String, Number],
  21288. default: void 0
  21289. },
  21290. falseLabel: {
  21291. type: [String, Number],
  21292. default: void 0
  21293. },
  21294. id: {
  21295. type: String,
  21296. default: void 0
  21297. },
  21298. border: Boolean,
  21299. size: useSizeProp,
  21300. tabindex: [String, Number],
  21301. validateEvent: {
  21302. type: Boolean,
  21303. default: true
  21304. },
  21305. ariaLabel: String,
  21306. ...useAriaProps(["ariaControls"])
  21307. };
  21308. const checkboxEmits = {
  21309. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  21310. change: (val) => isString(val) || isNumber(val) || isBoolean(val)
  21311. };
  21312. const checkboxPropsDefaults = {
  21313. modelValue: void 0,
  21314. label: void 0,
  21315. value: void 0,
  21316. disabled: void 0,
  21317. name: void 0,
  21318. trueValue: void 0,
  21319. falseValue: void 0,
  21320. trueLabel: void 0,
  21321. falseLabel: void 0,
  21322. id: void 0,
  21323. validateEvent: true
  21324. };
  21325. //#endregion
  21326. //#region ../../packages/components/checkbox/src/constants.ts
  21327. const checkboxGroupContextKey = Symbol("checkboxGroupContextKey");
  21328. //#endregion
  21329. //#region ../../packages/components/checkbox/src/composables/use-checkbox-disabled.ts
  21330. const useCheckboxDisabled = ({ model, isChecked }) => {
  21331. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21332. const formContext = inject(formContextKey, void 0);
  21333. const isLimitDisabled = computed(() => {
  21334. const max = checkboxGroup?.max?.value;
  21335. const min = checkboxGroup?.min?.value;
  21336. return !isUndefined(max) && model.value.length >= max && !isChecked.value || !isUndefined(min) && model.value.length <= min && isChecked.value;
  21337. });
  21338. return {
  21339. isDisabled: useFormDisabled(computed(() => {
  21340. if (checkboxGroup === void 0) return formContext?.disabled ?? isLimitDisabled.value;
  21341. else return checkboxGroup.disabled?.value || isLimitDisabled.value;
  21342. })),
  21343. isLimitDisabled
  21344. };
  21345. };
  21346. //#endregion
  21347. //#region ../../packages/components/checkbox/src/composables/use-checkbox-event.ts
  21348. const useCheckboxEvent = (props, { model, isLimitExceeded, hasOwnLabel, isDisabled, isLabeledByFormItem }) => {
  21349. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21350. const { formItem } = useFormItem();
  21351. const { emit } = getCurrentInstance();
  21352. function getLabeledValue(value) {
  21353. return [
  21354. true,
  21355. props.trueValue,
  21356. props.trueLabel
  21357. ].includes(value) ? props.trueValue ?? props.trueLabel ?? true : props.falseValue ?? props.falseLabel ?? false;
  21358. }
  21359. function emitChangeEvent(checked, e) {
  21360. emit(CHANGE_EVENT, getLabeledValue(checked), e);
  21361. }
  21362. function handleChange(e) {
  21363. if (isLimitExceeded.value) return;
  21364. const target = e.target;
  21365. emit(CHANGE_EVENT, getLabeledValue(target.checked), e);
  21366. }
  21367. async function onClickRoot(e) {
  21368. if (isLimitExceeded.value) return;
  21369. if (!hasOwnLabel.value && !isDisabled.value && isLabeledByFormItem.value) {
  21370. if (!e.composedPath().some((item) => item.tagName === "LABEL")) {
  21371. model.value = getLabeledValue([
  21372. false,
  21373. props.falseValue,
  21374. props.falseLabel
  21375. ].includes(model.value));
  21376. await nextTick();
  21377. emitChangeEvent(model.value, e);
  21378. }
  21379. }
  21380. }
  21381. const validateEvent = computed(() => checkboxGroup?.validateEvent || props.validateEvent);
  21382. watch(() => props.modelValue, () => {
  21383. if (validateEvent.value) formItem?.validate("change").catch(NOOP);
  21384. });
  21385. return {
  21386. handleChange,
  21387. onClickRoot
  21388. };
  21389. };
  21390. //#endregion
  21391. //#region ../../packages/components/checkbox/src/composables/use-checkbox-model.ts
  21392. const useCheckboxModel = (props) => {
  21393. const selfModel = ref(false);
  21394. const { emit, vnode } = getCurrentInstance();
  21395. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21396. const isGroup = computed(() => isUndefined(checkboxGroup) === false);
  21397. const isLimitExceeded = ref(false);
  21398. const isControlled = computed(() => {
  21399. const rawProps = vnode.props ?? {};
  21400. return "modelValue" in rawProps || "model-value" in rawProps;
  21401. });
  21402. const model = computed({
  21403. get() {
  21404. return isGroup.value ? checkboxGroup?.modelValue?.value : !isControlled.value ? selfModel.value : props.modelValue;
  21405. },
  21406. set(val) {
  21407. if (isGroup.value && isArray$1(val)) {
  21408. isLimitExceeded.value = checkboxGroup?.max?.value !== void 0 && val.length > checkboxGroup?.max.value && val.length > model.value.length;
  21409. isLimitExceeded.value === false && checkboxGroup?.changeEvent?.(val);
  21410. } else {
  21411. emit(UPDATE_MODEL_EVENT, val);
  21412. selfModel.value = val;
  21413. }
  21414. }
  21415. });
  21416. return {
  21417. model,
  21418. isGroup,
  21419. isLimitExceeded
  21420. };
  21421. };
  21422. //#endregion
  21423. //#region ../../packages/components/checkbox/src/composables/use-checkbox-status.ts
  21424. const useCheckboxStatus = (props, slots, { model }) => {
  21425. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21426. const isFocused = ref(false);
  21427. const actualValue = computed(() => {
  21428. if (!isPropAbsent(props.value)) return props.value;
  21429. return props.label;
  21430. });
  21431. const isChecked = computed(() => {
  21432. const value = model.value;
  21433. if (isBoolean(value)) return value;
  21434. else if (isArray$1(value)) if (isObject$1(actualValue.value)) return value.map(toRaw).some((o) => isEqual$1(o, actualValue.value));
  21435. else return value.map(toRaw).includes(actualValue.value);
  21436. else if (value !== null && value !== void 0) return value === props.trueValue || value === props.trueLabel;
  21437. else return !!value;
  21438. });
  21439. return {
  21440. checkboxButtonSize: useFormSize(computed(() => checkboxGroup?.size?.value), { prop: true }),
  21441. isChecked,
  21442. isFocused,
  21443. checkboxSize: useFormSize(computed(() => checkboxGroup?.size?.value)),
  21444. hasOwnLabel: computed(() => {
  21445. return !!slots.default || !isPropAbsent(actualValue.value);
  21446. }),
  21447. actualValue
  21448. };
  21449. };
  21450. //#endregion
  21451. //#region ../../packages/components/checkbox/src/composables/use-checkbox.ts
  21452. const useCheckbox = (props, slots) => {
  21453. const { formItem: elFormItem } = useFormItem();
  21454. const { model, isGroup, isLimitExceeded } = useCheckboxModel(props);
  21455. const { isFocused, isChecked, checkboxButtonSize, checkboxSize, hasOwnLabel, actualValue } = useCheckboxStatus(props, slots, { model });
  21456. const { isDisabled } = useCheckboxDisabled({
  21457. model,
  21458. isChecked
  21459. });
  21460. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, {
  21461. formItemContext: elFormItem,
  21462. disableIdGeneration: hasOwnLabel,
  21463. disableIdManagement: isGroup
  21464. });
  21465. const { handleChange, onClickRoot } = useCheckboxEvent(props, {
  21466. model,
  21467. isLimitExceeded,
  21468. hasOwnLabel,
  21469. isDisabled,
  21470. isLabeledByFormItem
  21471. });
  21472. const setStoreValue = () => {
  21473. function addToStore() {
  21474. if (isArray$1(model.value) && !model.value.includes(actualValue.value)) model.value.push(actualValue.value);
  21475. else model.value = props.trueValue ?? props.trueLabel ?? true;
  21476. }
  21477. props.checked && addToStore();
  21478. };
  21479. setStoreValue();
  21480. useDeprecated({
  21481. from: "label act as value",
  21482. replacement: "value",
  21483. version: "3.0.0",
  21484. scope: "el-checkbox",
  21485. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21486. }, computed(() => isGroup.value && isPropAbsent(props.value)));
  21487. useDeprecated({
  21488. from: "true-label",
  21489. replacement: "true-value",
  21490. version: "3.0.0",
  21491. scope: "el-checkbox",
  21492. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21493. }, computed(() => !!props.trueLabel));
  21494. useDeprecated({
  21495. from: "false-label",
  21496. replacement: "false-value",
  21497. version: "3.0.0",
  21498. scope: "el-checkbox",
  21499. ref: "https://element-plus.org/en-US/component/checkbox.html"
  21500. }, computed(() => !!props.falseLabel));
  21501. return {
  21502. inputId,
  21503. isLabeledByFormItem,
  21504. isChecked,
  21505. isDisabled,
  21506. isFocused,
  21507. checkboxButtonSize,
  21508. checkboxSize,
  21509. hasOwnLabel,
  21510. model,
  21511. actualValue,
  21512. handleChange,
  21513. onClickRoot
  21514. };
  21515. };
  21516. //#endregion
  21517. //#region ../../packages/components/checkbox/src/checkbox.vue?vue&type=script&setup=true&lang.ts
  21518. const _hoisted_1$64 = [
  21519. "id",
  21520. "indeterminate",
  21521. "name",
  21522. "tabindex",
  21523. "disabled"
  21524. ];
  21525. var checkbox_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  21526. name: "ElCheckbox",
  21527. __name: "checkbox",
  21528. props: checkboxProps,
  21529. emits: checkboxEmits,
  21530. setup(__props) {
  21531. const props = __props;
  21532. const { inputId, isLabeledByFormItem, isChecked, isDisabled, isFocused, checkboxSize, hasOwnLabel, model, actualValue, handleChange, onClickRoot } = useCheckbox(props, useSlots());
  21533. const inputBindings = computed(() => {
  21534. if (props.trueValue || props.falseValue || props.trueLabel || props.falseLabel) return {
  21535. "true-value": props.trueValue ?? props.trueLabel ?? true,
  21536. "false-value": props.falseValue ?? props.falseLabel ?? false
  21537. };
  21538. return { value: actualValue.value };
  21539. });
  21540. const ns = useNamespace("checkbox");
  21541. const compKls = computed(() => {
  21542. return [
  21543. ns.b(),
  21544. ns.m(checkboxSize.value),
  21545. ns.is("disabled", isDisabled.value),
  21546. ns.is("bordered", props.border),
  21547. ns.is("checked", isChecked.value)
  21548. ];
  21549. });
  21550. const spanKls = computed(() => {
  21551. return [
  21552. ns.e("input"),
  21553. ns.is("disabled", isDisabled.value),
  21554. ns.is("checked", isChecked.value),
  21555. ns.is("indeterminate", props.indeterminate),
  21556. ns.is("focus", isFocused.value)
  21557. ];
  21558. });
  21559. return (_ctx, _cache) => {
  21560. return openBlock(), createBlock(resolveDynamicComponent(!unref(hasOwnLabel) && unref(isLabeledByFormItem) ? "span" : "label"), {
  21561. for: !unref(hasOwnLabel) && unref(isLabeledByFormItem) ? null : unref(inputId),
  21562. class: normalizeClass(compKls.value),
  21563. "aria-controls": __props.indeterminate ? __props.ariaControls : null,
  21564. "aria-checked": __props.indeterminate ? "mixed" : void 0,
  21565. "aria-label": __props.ariaLabel,
  21566. onClick: unref(onClickRoot)
  21567. }, {
  21568. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(spanKls.value) }, [withDirectives(createElementVNode("input", mergeProps({
  21569. id: unref(inputId),
  21570. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
  21571. class: unref(ns).e("original"),
  21572. type: "checkbox",
  21573. indeterminate: __props.indeterminate,
  21574. name: __props.name,
  21575. tabindex: __props.tabindex,
  21576. disabled: unref(isDisabled)
  21577. }, inputBindings.value, {
  21578. onChange: _cache[1] || (_cache[1] = (...args) => unref(handleChange) && unref(handleChange)(...args)),
  21579. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  21580. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
  21581. onClick: _cache[4] || (_cache[4] = withModifiers(() => {}, ["stop"]))
  21582. }), null, 16, _hoisted_1$64), [[vModelCheckbox, unref(model)]]), createElementVNode("span", { class: normalizeClass(unref(ns).e("inner")) }, null, 2)], 2), unref(hasOwnLabel) ? (openBlock(), createElementBlock("span", {
  21583. key: 0,
  21584. class: normalizeClass(unref(ns).e("label"))
  21585. }, [renderSlot(_ctx.$slots, "default"), !_ctx.$slots.default ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(__props.label), 1)], 64)) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true)]),
  21586. _: 3
  21587. }, 8, [
  21588. "for",
  21589. "class",
  21590. "aria-controls",
  21591. "aria-checked",
  21592. "aria-label",
  21593. "onClick"
  21594. ]);
  21595. };
  21596. }
  21597. });
  21598. //#endregion
  21599. //#region ../../packages/components/checkbox/src/checkbox.vue
  21600. var checkbox_default = checkbox_vue_vue_type_script_setup_true_lang_default;
  21601. //#endregion
  21602. //#region ../../packages/components/checkbox/src/checkbox-button.vue?vue&type=script&setup=true&lang.ts
  21603. const _hoisted_1$63 = [
  21604. "name",
  21605. "tabindex",
  21606. "disabled"
  21607. ];
  21608. var checkbox_button_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  21609. name: "ElCheckboxButton",
  21610. __name: "checkbox-button",
  21611. props: checkboxProps,
  21612. emits: checkboxEmits,
  21613. setup(__props) {
  21614. const props = __props;
  21615. const { isFocused, isChecked, isDisabled, checkboxButtonSize, model, actualValue, handleChange } = useCheckbox(props, useSlots());
  21616. const inputBindings = computed(() => {
  21617. if (props.trueValue || props.falseValue || props.trueLabel || props.falseLabel) return {
  21618. "true-value": props.trueValue ?? props.trueLabel ?? true,
  21619. "false-value": props.falseValue ?? props.falseLabel ?? false
  21620. };
  21621. return { value: actualValue.value };
  21622. });
  21623. const checkboxGroup = inject(checkboxGroupContextKey, void 0);
  21624. const ns = useNamespace("checkbox");
  21625. const activeStyle = computed(() => {
  21626. const fillValue = checkboxGroup?.fill?.value ?? "";
  21627. return {
  21628. backgroundColor: fillValue,
  21629. borderColor: fillValue,
  21630. color: checkboxGroup?.textColor?.value ?? "",
  21631. boxShadow: fillValue ? `-1px 0 0 0 ${fillValue}` : void 0
  21632. };
  21633. });
  21634. const labelKls = computed(() => {
  21635. return [
  21636. ns.b("button"),
  21637. ns.bm("button", checkboxButtonSize.value),
  21638. ns.is("disabled", isDisabled.value),
  21639. ns.is("checked", isChecked.value),
  21640. ns.is("focus", isFocused.value)
  21641. ];
  21642. });
  21643. return (_ctx, _cache) => {
  21644. return openBlock(), createElementBlock("label", { class: normalizeClass(labelKls.value) }, [withDirectives(createElementVNode("input", mergeProps({
  21645. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(model) ? model.value = $event : null),
  21646. class: unref(ns).be("button", "original"),
  21647. type: "checkbox",
  21648. name: __props.name,
  21649. tabindex: __props.tabindex,
  21650. disabled: unref(isDisabled)
  21651. }, inputBindings.value, {
  21652. onChange: _cache[1] || (_cache[1] = (...args) => unref(handleChange) && unref(handleChange)(...args)),
  21653. onFocus: _cache[2] || (_cache[2] = ($event) => isFocused.value = true),
  21654. onBlur: _cache[3] || (_cache[3] = ($event) => isFocused.value = false),
  21655. onClick: _cache[4] || (_cache[4] = withModifiers(() => {}, ["stop"]))
  21656. }), null, 16, _hoisted_1$63), [[vModelCheckbox, unref(model)]]), _ctx.$slots.default || __props.label ? (openBlock(), createElementBlock("span", {
  21657. key: 0,
  21658. class: normalizeClass(unref(ns).be("button", "inner")),
  21659. style: normalizeStyle(unref(isChecked) ? activeStyle.value : void 0)
  21660. }, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])], 6)) : createCommentVNode("v-if", true)], 2);
  21661. };
  21662. }
  21663. });
  21664. //#endregion
  21665. //#region ../../packages/components/checkbox/src/checkbox-button.vue
  21666. var checkbox_button_default = checkbox_button_vue_vue_type_script_setup_true_lang_default;
  21667. //#endregion
  21668. //#region ../../packages/components/checkbox/src/checkbox-group.ts
  21669. const checkboxGroupProps = buildProps({
  21670. modelValue: {
  21671. type: definePropType(Array),
  21672. default: () => []
  21673. },
  21674. disabled: {
  21675. type: Boolean,
  21676. default: void 0
  21677. },
  21678. min: Number,
  21679. max: Number,
  21680. size: useSizeProp,
  21681. fill: String,
  21682. textColor: String,
  21683. tag: {
  21684. type: String,
  21685. default: "div"
  21686. },
  21687. validateEvent: {
  21688. type: Boolean,
  21689. default: true
  21690. },
  21691. options: { type: definePropType(Array) },
  21692. props: {
  21693. type: definePropType(Object),
  21694. default: () => checkboxDefaultProps
  21695. },
  21696. type: {
  21697. type: String,
  21698. values: ["checkbox", "button"],
  21699. default: "checkbox"
  21700. },
  21701. ...useAriaProps(["ariaLabel"])
  21702. });
  21703. const checkboxGroupEmits = {
  21704. [UPDATE_MODEL_EVENT]: (val) => isArray$1(val),
  21705. change: (val) => isArray$1(val)
  21706. };
  21707. const checkboxDefaultProps = {
  21708. label: "label",
  21709. value: "value",
  21710. disabled: "disabled"
  21711. };
  21712. //#endregion
  21713. //#region ../../packages/components/checkbox/src/checkbox-group.vue?vue&type=script&setup=true&lang.ts
  21714. var checkbox_group_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  21715. name: "ElCheckboxGroup",
  21716. __name: "checkbox-group",
  21717. props: checkboxGroupProps,
  21718. emits: checkboxGroupEmits,
  21719. setup(__props, { emit: __emit }) {
  21720. const props = __props;
  21721. const emit = __emit;
  21722. const ns = useNamespace("checkbox");
  21723. const checkboxDisabled = useFormDisabled();
  21724. const { formItem } = useFormItem();
  21725. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, { formItemContext: formItem });
  21726. const changeEvent = async (value) => {
  21727. emit(UPDATE_MODEL_EVENT, value);
  21728. await nextTick();
  21729. emit(CHANGE_EVENT, value);
  21730. };
  21731. const modelValue = computed({
  21732. get() {
  21733. return props.modelValue;
  21734. },
  21735. set(val) {
  21736. changeEvent(val);
  21737. }
  21738. });
  21739. const aliasProps = computed(() => ({
  21740. ...checkboxDefaultProps,
  21741. ...props.props
  21742. }));
  21743. const getOptionProps = (option) => {
  21744. const { label, value, disabled } = aliasProps.value;
  21745. const base = {
  21746. label: option[label],
  21747. value: option[value],
  21748. disabled: option[disabled]
  21749. };
  21750. return {
  21751. ...omit(option, [
  21752. label,
  21753. value,
  21754. disabled
  21755. ]),
  21756. ...base
  21757. };
  21758. };
  21759. const optionComponent = computed(() => props.type === "button" ? checkbox_button_default : checkbox_default);
  21760. provide(checkboxGroupContextKey, {
  21761. ...pick(toRefs(props), [
  21762. "size",
  21763. "min",
  21764. "max",
  21765. "validateEvent",
  21766. "fill",
  21767. "textColor"
  21768. ]),
  21769. disabled: checkboxDisabled,
  21770. modelValue,
  21771. changeEvent
  21772. });
  21773. watch(() => props.modelValue, (newVal, oldValue) => {
  21774. if (props.validateEvent && !isEqual$1(newVal, oldValue)) formItem?.validate("change").catch(NOOP);
  21775. });
  21776. return (_ctx, _cache) => {
  21777. return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
  21778. id: unref(groupId),
  21779. class: normalizeClass(unref(ns).b("group")),
  21780. role: "group",
  21781. "aria-label": !unref(isLabeledByFormItem) ? __props.ariaLabel || "checkbox-group" : void 0,
  21782. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem)?.labelId : void 0
  21783. }, {
  21784. default: withCtx(() => [renderSlot(_ctx.$slots, "default", {}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item, index) => {
  21785. return openBlock(), createBlock(resolveDynamicComponent(optionComponent.value), mergeProps({ key: index }, { ref_for: true }, getOptionProps(item)), null, 16);
  21786. }), 128))])]),
  21787. _: 3
  21788. }, 8, [
  21789. "id",
  21790. "class",
  21791. "aria-label",
  21792. "aria-labelledby"
  21793. ]);
  21794. };
  21795. }
  21796. });
  21797. //#endregion
  21798. //#region ../../packages/components/checkbox/src/checkbox-group.vue
  21799. var checkbox_group_default = checkbox_group_vue_vue_type_script_setup_true_lang_default;
  21800. //#endregion
  21801. //#region ../../packages/components/checkbox/index.ts
  21802. const ElCheckbox = withInstall(checkbox_default, {
  21803. CheckboxButton: checkbox_button_default,
  21804. CheckboxGroup: checkbox_group_default
  21805. });
  21806. const ElCheckboxButton = withNoopInstall(checkbox_button_default);
  21807. const ElCheckboxGroup = withNoopInstall(checkbox_group_default);
  21808. //#endregion
  21809. //#region ../../packages/components/radio/src/radio.ts
  21810. const radioPropsBase = buildProps({
  21811. modelValue: {
  21812. type: [
  21813. String,
  21814. Number,
  21815. Boolean
  21816. ],
  21817. default: void 0
  21818. },
  21819. size: useSizeProp,
  21820. disabled: {
  21821. type: Boolean,
  21822. default: void 0
  21823. },
  21824. label: {
  21825. type: [
  21826. String,
  21827. Number,
  21828. Boolean
  21829. ],
  21830. default: void 0
  21831. },
  21832. value: {
  21833. type: [
  21834. String,
  21835. Number,
  21836. Boolean
  21837. ],
  21838. default: void 0
  21839. },
  21840. name: {
  21841. type: String,
  21842. default: void 0
  21843. }
  21844. });
  21845. const radioProps = buildProps({
  21846. ...radioPropsBase,
  21847. border: Boolean
  21848. });
  21849. const radioEmits = {
  21850. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  21851. [CHANGE_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val)
  21852. };
  21853. const radioPropsDefaults = {
  21854. modelValue: void 0,
  21855. disabled: void 0,
  21856. label: void 0,
  21857. value: void 0,
  21858. name: void 0,
  21859. border: false
  21860. };
  21861. //#endregion
  21862. //#region ../../packages/components/radio/src/constants.ts
  21863. const radioGroupKey = Symbol("radioGroupKey");
  21864. //#endregion
  21865. //#region ../../packages/components/radio/src/use-radio.ts
  21866. const useRadio = (props, emit) => {
  21867. const radioRef = ref();
  21868. const radioGroup = inject(radioGroupKey, void 0);
  21869. const isGroup = computed(() => !!radioGroup);
  21870. const actualValue = computed(() => {
  21871. if (!isPropAbsent(props.value)) return props.value;
  21872. return props.label;
  21873. });
  21874. const modelValue = computed({
  21875. get() {
  21876. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  21877. },
  21878. set(val) {
  21879. if (isGroup.value) radioGroup.changeEvent(val);
  21880. else emit && emit("update:modelValue", val);
  21881. radioRef.value.checked = props.modelValue === actualValue.value;
  21882. }
  21883. });
  21884. const size = useFormSize(computed(() => radioGroup?.size));
  21885. const disabled = useFormDisabled(computed(() => radioGroup?.disabled));
  21886. const focus = ref(false);
  21887. const tabIndex = computed(() => {
  21888. return disabled.value || isGroup.value && modelValue.value !== actualValue.value ? -1 : 0;
  21889. });
  21890. useDeprecated({
  21891. from: "label act as value",
  21892. replacement: "value",
  21893. version: "3.0.0",
  21894. scope: "el-radio",
  21895. ref: "https://element-plus.org/en-US/component/radio.html"
  21896. }, computed(() => isGroup.value && isPropAbsent(props.value)));
  21897. return {
  21898. radioRef,
  21899. isGroup,
  21900. radioGroup,
  21901. focus,
  21902. size,
  21903. disabled,
  21904. tabIndex,
  21905. modelValue,
  21906. actualValue
  21907. };
  21908. };
  21909. //#endregion
  21910. //#region ../../packages/components/radio/src/radio.vue?vue&type=script&setup=true&lang.ts
  21911. const _hoisted_1$62 = [
  21912. "value",
  21913. "name",
  21914. "disabled",
  21915. "checked"
  21916. ];
  21917. var radio_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  21918. name: "ElRadio",
  21919. __name: "radio",
  21920. props: radioProps,
  21921. emits: radioEmits,
  21922. setup(__props, { emit: __emit }) {
  21923. const props = __props;
  21924. const emit = __emit;
  21925. const ns = useNamespace("radio");
  21926. const { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } = useRadio(props, emit);
  21927. function handleChange() {
  21928. nextTick(() => emit(CHANGE_EVENT, modelValue.value));
  21929. }
  21930. return (_ctx, _cache) => {
  21931. return openBlock(), createElementBlock("label", { class: normalizeClass([
  21932. unref(ns).b(),
  21933. unref(ns).is("disabled", unref(disabled)),
  21934. unref(ns).is("focus", unref(focus)),
  21935. unref(ns).is("bordered", __props.border),
  21936. unref(ns).is("checked", unref(modelValue) === unref(actualValue)),
  21937. unref(ns).m(unref(size))
  21938. ]) }, [createElementVNode("span", { class: normalizeClass([
  21939. unref(ns).e("input"),
  21940. unref(ns).is("disabled", unref(disabled)),
  21941. unref(ns).is("checked", unref(modelValue) === unref(actualValue))
  21942. ]) }, [withDirectives(createElementVNode("input", {
  21943. ref_key: "radioRef",
  21944. ref: radioRef,
  21945. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
  21946. class: normalizeClass(unref(ns).e("original")),
  21947. value: unref(actualValue),
  21948. name: __props.name || unref(radioGroup)?.name,
  21949. disabled: unref(disabled),
  21950. checked: unref(modelValue) === unref(actualValue),
  21951. type: "radio",
  21952. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  21953. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
  21954. onChange: handleChange,
  21955. onClick: _cache[3] || (_cache[3] = withModifiers(() => {}, ["stop"]))
  21956. }, null, 42, _hoisted_1$62), [[vModelRadio, unref(modelValue)]]), createElementVNode("span", { class: normalizeClass(unref(ns).e("inner")) }, null, 2)], 2), createElementVNode("span", {
  21957. class: normalizeClass(unref(ns).e("label")),
  21958. onKeydown: _cache[4] || (_cache[4] = withModifiers(() => {}, ["stop"]))
  21959. }, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])], 34)], 2);
  21960. };
  21961. }
  21962. });
  21963. //#endregion
  21964. //#region ../../packages/components/radio/src/radio.vue
  21965. var radio_default = radio_vue_vue_type_script_setup_true_lang_default;
  21966. //#endregion
  21967. //#region ../../packages/components/radio/src/radio-button.ts
  21968. const radioButtonProps = buildProps({ ...radioPropsBase });
  21969. const radioButtonPropsDefaults = {
  21970. modelValue: void 0,
  21971. disabled: void 0,
  21972. label: void 0,
  21973. value: void 0,
  21974. name: void 0
  21975. };
  21976. //#endregion
  21977. //#region ../../packages/components/radio/src/radio-button.vue?vue&type=script&setup=true&lang.ts
  21978. const _hoisted_1$61 = [
  21979. "value",
  21980. "name",
  21981. "disabled"
  21982. ];
  21983. var radio_button_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  21984. name: "ElRadioButton",
  21985. __name: "radio-button",
  21986. props: radioButtonProps,
  21987. setup(__props) {
  21988. const props = __props;
  21989. const ns = useNamespace("radio");
  21990. const { radioRef, focus, size, disabled, modelValue, radioGroup, actualValue } = useRadio(props);
  21991. const activeStyle = computed(() => {
  21992. return {
  21993. backgroundColor: radioGroup?.fill || "",
  21994. borderColor: radioGroup?.fill || "",
  21995. boxShadow: radioGroup?.fill ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  21996. color: radioGroup?.textColor || ""
  21997. };
  21998. });
  21999. return (_ctx, _cache) => {
  22000. return openBlock(), createElementBlock("label", { class: normalizeClass([
  22001. unref(ns).b("button"),
  22002. unref(ns).is("active", unref(modelValue) === unref(actualValue)),
  22003. unref(ns).is("disabled", unref(disabled)),
  22004. unref(ns).is("focus", unref(focus)),
  22005. unref(ns).bm("button", unref(size))
  22006. ]) }, [withDirectives(createElementVNode("input", {
  22007. ref_key: "radioRef",
  22008. ref: radioRef,
  22009. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
  22010. class: normalizeClass(unref(ns).be("button", "original-radio")),
  22011. value: unref(actualValue),
  22012. type: "radio",
  22013. name: __props.name || unref(radioGroup)?.name,
  22014. disabled: unref(disabled),
  22015. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  22016. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
  22017. onClick: _cache[3] || (_cache[3] = withModifiers(() => {}, ["stop"]))
  22018. }, null, 42, _hoisted_1$61), [[vModelRadio, unref(modelValue)]]), createElementVNode("span", {
  22019. class: normalizeClass(unref(ns).be("button", "inner")),
  22020. style: normalizeStyle(unref(modelValue) === unref(actualValue) ? activeStyle.value : {}),
  22021. onKeydown: _cache[4] || (_cache[4] = withModifiers(() => {}, ["stop"]))
  22022. }, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.label), 1)])], 38)], 2);
  22023. };
  22024. }
  22025. });
  22026. //#endregion
  22027. //#region ../../packages/components/radio/src/radio-button.vue
  22028. var radio_button_default = radio_button_vue_vue_type_script_setup_true_lang_default;
  22029. //#endregion
  22030. //#region ../../packages/components/radio/src/radio-group.ts
  22031. const radioDefaultProps = {
  22032. label: "label",
  22033. value: "value",
  22034. disabled: "disabled"
  22035. };
  22036. const radioGroupProps = buildProps({
  22037. id: {
  22038. type: String,
  22039. default: void 0
  22040. },
  22041. size: useSizeProp,
  22042. disabled: {
  22043. type: Boolean,
  22044. default: void 0
  22045. },
  22046. modelValue: {
  22047. type: [
  22048. String,
  22049. Number,
  22050. Boolean
  22051. ],
  22052. default: void 0
  22053. },
  22054. fill: {
  22055. type: String,
  22056. default: ""
  22057. },
  22058. textColor: {
  22059. type: String,
  22060. default: ""
  22061. },
  22062. name: {
  22063. type: String,
  22064. default: void 0
  22065. },
  22066. validateEvent: {
  22067. type: Boolean,
  22068. default: true
  22069. },
  22070. options: { type: definePropType(Array) },
  22071. props: {
  22072. type: definePropType(Object),
  22073. default: () => radioDefaultProps
  22074. },
  22075. type: {
  22076. type: String,
  22077. values: ["radio", "button"],
  22078. default: "radio"
  22079. },
  22080. ...useAriaProps(["ariaLabel"])
  22081. });
  22082. const radioGroupEmits = radioEmits;
  22083. const radioGroupPropsDefaults = {
  22084. id: void 0,
  22085. disabled: void 0,
  22086. modelValue: void 0,
  22087. fill: "",
  22088. textColor: "",
  22089. name: void 0,
  22090. validateEvent: true,
  22091. props: () => radioDefaultProps,
  22092. type: "radio"
  22093. };
  22094. //#endregion
  22095. //#region ../../packages/components/radio/src/radio-group.vue?vue&type=script&setup=true&lang.ts
  22096. const _hoisted_1$60 = [
  22097. "id",
  22098. "aria-label",
  22099. "aria-labelledby"
  22100. ];
  22101. var radio_group_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  22102. name: "ElRadioGroup",
  22103. __name: "radio-group",
  22104. props: radioGroupProps,
  22105. emits: radioGroupEmits,
  22106. setup(__props, { emit: __emit }) {
  22107. const props = __props;
  22108. const emit = __emit;
  22109. const ns = useNamespace("radio");
  22110. const radioId = useId();
  22111. const radioGroupRef = ref();
  22112. const { formItem } = useFormItem();
  22113. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, { formItemContext: formItem });
  22114. const changeEvent = (value) => {
  22115. emit(UPDATE_MODEL_EVENT, value);
  22116. nextTick(() => emit(CHANGE_EVENT, value));
  22117. };
  22118. onMounted(() => {
  22119. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  22120. const firstLabel = radios[0];
  22121. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) firstLabel.tabIndex = 0;
  22122. });
  22123. const name = computed(() => {
  22124. return props.name || radioId.value;
  22125. });
  22126. const aliasProps = computed(() => ({
  22127. ...radioDefaultProps,
  22128. ...props.props
  22129. }));
  22130. const getOptionProps = (option) => {
  22131. const { label, value, disabled } = aliasProps.value;
  22132. const base = {
  22133. label: option[label],
  22134. value: option[value],
  22135. disabled: option[disabled]
  22136. };
  22137. return {
  22138. ...omit(option, [
  22139. label,
  22140. value,
  22141. disabled
  22142. ]),
  22143. ...base
  22144. };
  22145. };
  22146. const optionComponent = computed(() => props.type === "button" ? radio_button_default : radio_default);
  22147. provide(radioGroupKey, reactive({
  22148. ...toRefs(props),
  22149. changeEvent,
  22150. name
  22151. }));
  22152. watch(() => props.modelValue, (newVal, oldValue) => {
  22153. if (props.validateEvent && !isEqual$1(newVal, oldValue)) formItem?.validate("change").catch(NOOP);
  22154. });
  22155. return (_ctx, _cache) => {
  22156. return openBlock(), createElementBlock("div", {
  22157. id: unref(groupId),
  22158. ref_key: "radioGroupRef",
  22159. ref: radioGroupRef,
  22160. class: normalizeClass(unref(ns).b("group")),
  22161. role: "radiogroup",
  22162. "aria-label": !unref(isLabeledByFormItem) ? __props.ariaLabel || "radio-group" : void 0,
  22163. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
  22164. }, [renderSlot(_ctx.$slots, "default", {}, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item, index) => {
  22165. return openBlock(), createBlock(resolveDynamicComponent(optionComponent.value), mergeProps({ key: index }, { ref_for: true }, getOptionProps(item)), null, 16);
  22166. }), 128))])], 10, _hoisted_1$60);
  22167. };
  22168. }
  22169. });
  22170. //#endregion
  22171. //#region ../../packages/components/radio/src/radio-group.vue
  22172. var radio_group_default = radio_group_vue_vue_type_script_setup_true_lang_default;
  22173. //#endregion
  22174. //#region ../../packages/components/radio/index.ts
  22175. const ElRadio = withInstall(radio_default, {
  22176. RadioButton: radio_button_default,
  22177. RadioGroup: radio_group_default
  22178. });
  22179. const ElRadioGroup = withNoopInstall(radio_group_default);
  22180. const ElRadioButton = withNoopInstall(radio_button_default);
  22181. //#endregion
  22182. //#region ../../packages/components/cascader-panel/src/types.ts
  22183. const CASCADER_PANEL_INJECTION_KEY = Symbol();
  22184. //#endregion
  22185. //#region ../../packages/components/cascader-panel/src/node-content.tsx
  22186. function isVNodeEmpty(vnodes) {
  22187. return !!(isArray$1(vnodes) ? vnodes.every(({ type }) => type === Comment) : vnodes?.type === Comment);
  22188. }
  22189. var node_content_default = /* @__PURE__ */ defineComponent({
  22190. name: "NodeContent",
  22191. props: { node: {
  22192. type: Object,
  22193. required: true
  22194. } },
  22195. setup(props) {
  22196. const ns = useNamespace("cascader-node");
  22197. const { renderLabelFn } = inject(CASCADER_PANEL_INJECTION_KEY);
  22198. const { node } = props;
  22199. const { data, label: nodeLabel } = node;
  22200. const label = () => {
  22201. const renderLabel = renderLabelFn?.({
  22202. node,
  22203. data
  22204. });
  22205. return isVNodeEmpty(renderLabel) ? nodeLabel : renderLabel ?? nodeLabel;
  22206. };
  22207. return () => createVNode("span", { "class": ns.e("label") }, [label()]);
  22208. }
  22209. });
  22210. //#endregion
  22211. //#region ../../packages/components/cascader-panel/src/node.vue?vue&type=script&setup=true&lang.ts
  22212. const _hoisted_1$59 = [
  22213. "id",
  22214. "aria-haspopup",
  22215. "aria-owns",
  22216. "aria-expanded",
  22217. "tabindex"
  22218. ];
  22219. var node_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  22220. name: "ElCascaderNode",
  22221. __name: "node",
  22222. props: {
  22223. node: {
  22224. type: Object,
  22225. required: true
  22226. },
  22227. menuId: {
  22228. type: String,
  22229. required: false
  22230. }
  22231. },
  22232. emits: ["expand"],
  22233. setup(__props, { emit: __emit }) {
  22234. const props = __props;
  22235. const emit = __emit;
  22236. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  22237. const ns = useNamespace("cascader-node");
  22238. const isHoverMenu = computed(() => panel.isHoverMenu);
  22239. const multiple = computed(() => panel.config.multiple);
  22240. const checkStrictly = computed(() => panel.config.checkStrictly);
  22241. const showPrefix = computed(() => panel.config.showPrefix);
  22242. const checkedNodeId = computed(() => panel.checkedNodes[0]?.uid);
  22243. const isDisabled = computed(() => props.node.isDisabled);
  22244. const isLeaf = computed(() => props.node.isLeaf);
  22245. const expandable = computed(() => checkStrictly.value && !isLeaf.value || !isDisabled.value);
  22246. const inExpandingPath = computed(() => isInPath(panel.expandingNode));
  22247. const inCheckedPath = computed(() => checkStrictly.value && panel.checkedNodes.some(isInPath));
  22248. const isInPath = (node) => {
  22249. const { level, uid } = props.node;
  22250. return node?.pathNodes[level - 1]?.uid === uid;
  22251. };
  22252. const doExpand = () => {
  22253. if (inExpandingPath.value) return;
  22254. panel.expandNode(props.node);
  22255. };
  22256. const doCheck = (checked) => {
  22257. const { node } = props;
  22258. if (checked === node.checked) return;
  22259. panel.handleCheckChange(node, checked);
  22260. };
  22261. const doLoad = () => {
  22262. panel.lazyLoad(props.node, () => {
  22263. if (!isLeaf.value) doExpand();
  22264. });
  22265. };
  22266. const handleHoverExpand = (e) => {
  22267. if (!isHoverMenu.value) return;
  22268. handleExpand();
  22269. !isLeaf.value && emit("expand", e);
  22270. };
  22271. const handleExpand = () => {
  22272. const { node } = props;
  22273. if (!expandable.value || node.loading) return;
  22274. node.loaded ? doExpand() : doLoad();
  22275. };
  22276. const handleClick = () => {
  22277. if (isLeaf.value && !isDisabled.value && !checkStrictly.value && !multiple.value) handleCheck(true);
  22278. else if ((panel.config.checkOnClickNode && (multiple.value || checkStrictly.value) || isLeaf.value && panel.config.checkOnClickLeaf) && !isDisabled.value) handleSelectCheck(!props.node.checked);
  22279. else if (!isHoverMenu.value) handleExpand();
  22280. };
  22281. const handleSelectCheck = (checked) => {
  22282. if (checkStrictly.value) {
  22283. doCheck(checked);
  22284. if (props.node.loaded) doExpand();
  22285. } else handleCheck(checked);
  22286. };
  22287. const handleCheck = (checked) => {
  22288. if (!props.node.loaded) doLoad();
  22289. else {
  22290. doCheck(checked);
  22291. !checkStrictly.value && doExpand();
  22292. }
  22293. };
  22294. return (_ctx, _cache) => {
  22295. return openBlock(), createElementBlock("li", {
  22296. id: `${__props.menuId}-${__props.node.uid}`,
  22297. role: "menuitem",
  22298. "aria-haspopup": !isLeaf.value,
  22299. "aria-owns": isLeaf.value ? void 0 : __props.menuId,
  22300. "aria-expanded": inExpandingPath.value,
  22301. tabindex: expandable.value ? -1 : void 0,
  22302. class: normalizeClass([
  22303. unref(ns).b(),
  22304. unref(ns).is("selectable", checkStrictly.value),
  22305. unref(ns).is("active", __props.node.checked),
  22306. unref(ns).is("disabled", !expandable.value),
  22307. inExpandingPath.value && "in-active-path",
  22308. inCheckedPath.value && "in-checked-path"
  22309. ]),
  22310. onMouseenter: handleHoverExpand,
  22311. onFocus: handleHoverExpand,
  22312. onClick: handleClick
  22313. }, [
  22314. createCommentVNode(" prefix "),
  22315. multiple.value && showPrefix.value ? (openBlock(), createBlock(unref(ElCheckbox), {
  22316. key: 0,
  22317. "model-value": __props.node.checked,
  22318. indeterminate: __props.node.indeterminate,
  22319. disabled: isDisabled.value,
  22320. onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"])),
  22321. "onUpdate:modelValue": handleSelectCheck
  22322. }, null, 8, [
  22323. "model-value",
  22324. "indeterminate",
  22325. "disabled"
  22326. ])) : checkStrictly.value && showPrefix.value ? (openBlock(), createBlock(unref(ElRadio), {
  22327. key: 1,
  22328. "model-value": checkedNodeId.value,
  22329. label: __props.node.uid,
  22330. disabled: isDisabled.value,
  22331. "onUpdate:modelValue": handleSelectCheck,
  22332. onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
  22333. }, {
  22334. default: withCtx(() => [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 "), _cache[2] || (_cache[2] = createElementVNode("span", null, null, -1))]),
  22335. _: 1
  22336. }, 8, [
  22337. "model-value",
  22338. "label",
  22339. "disabled"
  22340. ])) : isLeaf.value && __props.node.checked ? (openBlock(), createBlock(unref(ElIcon), {
  22341. key: 2,
  22342. class: normalizeClass(unref(ns).e("prefix"))
  22343. }, {
  22344. default: withCtx(() => [createVNode(unref(check_default))]),
  22345. _: 1
  22346. }, 8, ["class"])) : createCommentVNode("v-if", true),
  22347. createCommentVNode(" content "),
  22348. createVNode(unref(node_content_default), { node: __props.node }, null, 8, ["node"]),
  22349. createCommentVNode(" postfix "),
  22350. !isLeaf.value ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [__props.node.loading ? (openBlock(), createBlock(unref(ElIcon), {
  22351. key: 0,
  22352. class: normalizeClass([unref(ns).is("loading"), unref(ns).e("postfix")])
  22353. }, {
  22354. default: withCtx(() => [createVNode(unref(loading_default))]),
  22355. _: 1
  22356. }, 8, ["class"])) : (openBlock(), createBlock(unref(ElIcon), {
  22357. key: 1,
  22358. class: normalizeClass(["arrow-right", unref(ns).e("postfix")])
  22359. }, {
  22360. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  22361. _: 1
  22362. }, 8, ["class"]))], 64)) : createCommentVNode("v-if", true)
  22363. ], 42, _hoisted_1$59);
  22364. };
  22365. }
  22366. });
  22367. //#endregion
  22368. //#region ../../packages/components/cascader-panel/src/node.vue
  22369. var node_default = node_vue_vue_type_script_setup_true_lang_default;
  22370. //#endregion
  22371. //#region ../../packages/components/cascader-panel/src/menu.vue?vue&type=script&setup=true&lang.ts
  22372. var menu_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  22373. name: "ElCascaderMenu",
  22374. __name: "menu",
  22375. props: {
  22376. nodes: {
  22377. type: Array,
  22378. required: true
  22379. },
  22380. index: {
  22381. type: Number,
  22382. required: true
  22383. },
  22384. virtualScroll: {
  22385. type: Boolean,
  22386. required: false,
  22387. default: false
  22388. },
  22389. itemSize: {
  22390. type: Number,
  22391. required: false,
  22392. default: 34
  22393. },
  22394. height: {
  22395. type: Number,
  22396. required: false,
  22397. default: 204
  22398. }
  22399. },
  22400. setup(__props, { expose: __expose }) {
  22401. const props = __props;
  22402. const instance = getCurrentInstance();
  22403. const ns = useNamespace("cascader-menu");
  22404. const { t } = useLocale();
  22405. const id = useId();
  22406. let activeNode;
  22407. let hoverTimer;
  22408. const panel = inject(CASCADER_PANEL_INJECTION_KEY);
  22409. const hoverZone = ref();
  22410. const virtualListRef = ref();
  22411. const isEmpty = computed(() => !props.nodes.length);
  22412. const isLoading = computed(() => !panel.initialLoaded);
  22413. const menuId = computed(() => `${id.value}-${props.index}`);
  22414. const getActiveNodeIndex = () => {
  22415. let activeNodeId;
  22416. if (panel.expandingNode) {
  22417. const { level, pathNodes } = panel.expandingNode;
  22418. if (props.index < level) activeNodeId = pathNodes[props.index]?.uid;
  22419. else if (props.index === level && panel.checkedNodes.length > 0) activeNodeId = panel.checkedNodes[0]?.pathNodes[props.index]?.uid;
  22420. } else if (panel.checkedNodes.length > 0 && props.index < panel.checkedNodes[0].pathNodes.length) activeNodeId = panel.checkedNodes[0].pathNodes[props.index]?.uid;
  22421. return activeNodeId !== void 0 ? props.nodes.findIndex((node) => node.uid === activeNodeId) : -1;
  22422. };
  22423. const getNodeIndexById = (nodeId) => {
  22424. if (!nodeId) return -1;
  22425. return props.nodes.findIndex((node) => `${menuId.value}-${node.uid}` === nodeId);
  22426. };
  22427. const scrollToItem = (index) => {
  22428. const targetIndex = clamp$1(index, 0, props.nodes.length - 1);
  22429. virtualListRef.value?.scrollToItem(targetIndex);
  22430. };
  22431. const focusNodeAt = (index) => {
  22432. if (!props.nodes.length) return;
  22433. const targetIndex = clamp$1(index, 0, props.nodes.length - 1);
  22434. scrollToItem(targetIndex);
  22435. nextTick(() => {
  22436. const node = instance.vnode.el?.querySelector(`#${menuId.value}-${props.nodes[targetIndex].uid}`);
  22437. if (node) focusNode(node);
  22438. });
  22439. };
  22440. const handleExpand = (e) => {
  22441. activeNode = e.target;
  22442. };
  22443. const handleMouseMove = (e) => {
  22444. if (!panel.isHoverMenu || !activeNode || !hoverZone.value) return;
  22445. if (activeNode.contains(e.target)) {
  22446. clearHoverTimer();
  22447. const el = instance.vnode.el;
  22448. const { left } = el.getBoundingClientRect();
  22449. const { offsetWidth, offsetHeight } = el;
  22450. const startX = e.clientX - left;
  22451. const top = activeNode.offsetTop;
  22452. const bottom = top + activeNode.offsetHeight;
  22453. const scrollTop = props.virtualScroll ? virtualListRef.value?.states?.scrollOffset || 0 : el.querySelector(`.${ns.e("wrap")}`)?.scrollTop || 0;
  22454. hoverZone.value.innerHTML = `
  22455. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${top} L${offsetWidth} ${scrollTop} V${top} Z" />
  22456. <path style="pointer-events: auto;" fill="transparent" d="M${startX} ${bottom} L${offsetWidth} ${offsetHeight + scrollTop} V${bottom} Z" />
  22457. `;
  22458. } else if (!hoverTimer) hoverTimer = window.setTimeout(clearHoverZone, panel.config.hoverThreshold);
  22459. };
  22460. const clearHoverTimer = () => {
  22461. if (!hoverTimer) return;
  22462. clearTimeout(hoverTimer);
  22463. hoverTimer = void 0;
  22464. };
  22465. const clearHoverZone = () => {
  22466. if (!hoverZone.value) return;
  22467. hoverZone.value.innerHTML = "";
  22468. clearHoverTimer();
  22469. };
  22470. __expose({
  22471. getActiveNodeIndex,
  22472. getNodeIndexById,
  22473. scrollToItem,
  22474. focusNodeAt,
  22475. virtualListRef,
  22476. get $el() {
  22477. return instance.vnode.el;
  22478. }
  22479. });
  22480. return (_ctx, _cache) => {
  22481. return __props.virtualScroll ? (openBlock(), createElementBlock("div", {
  22482. key: menuId.value,
  22483. class: normalizeClass(unref(ns).b()),
  22484. onMousemove: handleMouseMove,
  22485. onMouseleave: clearHoverZone
  22486. }, [
  22487. createVNode(unref(FixedSizeList), {
  22488. ref_key: "virtualListRef",
  22489. ref: virtualListRef,
  22490. height: __props.height,
  22491. "item-size": __props.itemSize,
  22492. data: __props.nodes,
  22493. total: __props.nodes.length,
  22494. "class-name": unref(ns).e("list"),
  22495. "inner-element": "ul",
  22496. "inner-props": {
  22497. role: "menu",
  22498. class: unref(ns).is("empty", isEmpty.value)
  22499. }
  22500. }, {
  22501. default: withCtx(({ data, index: nodeIndex, style }) => [(openBlock(), createBlock(node_default, {
  22502. key: data[nodeIndex].uid,
  22503. node: data[nodeIndex],
  22504. "menu-id": menuId.value,
  22505. style: normalizeStyle(style),
  22506. onExpand: handleExpand
  22507. }, null, 8, [
  22508. "node",
  22509. "menu-id",
  22510. "style"
  22511. ]))]),
  22512. _: 1
  22513. }, 8, [
  22514. "height",
  22515. "item-size",
  22516. "data",
  22517. "total",
  22518. "class-name",
  22519. "inner-props"
  22520. ]),
  22521. isLoading.value ? (openBlock(), createElementBlock("div", {
  22522. key: 0,
  22523. class: normalizeClass(unref(ns).e("empty-text"))
  22524. }, [createVNode(unref(ElIcon), {
  22525. size: 14,
  22526. class: normalizeClass(unref(ns).is("loading"))
  22527. }, {
  22528. default: withCtx(() => [createVNode(unref(loading_default))]),
  22529. _: 1
  22530. }, 8, ["class"]), createTextVNode(" " + toDisplayString(unref(t)("el.cascader.loading")), 1)], 2)) : isEmpty.value ? (openBlock(), createElementBlock("div", {
  22531. key: 1,
  22532. class: normalizeClass(unref(ns).e("empty-text"))
  22533. }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(unref(t)("el.cascader.noData")), 1)])], 2)) : unref(panel)?.isHoverMenu ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [createCommentVNode(" eslint-disable vue/html-self-closing "), (openBlock(), createElementBlock("svg", {
  22534. ref_key: "hoverZone",
  22535. ref: hoverZone,
  22536. class: normalizeClass(unref(ns).e("hover-zone"))
  22537. }, null, 2))], 2112)) : createCommentVNode("v-if", true),
  22538. createCommentVNode(" eslint-enable vue/html-self-closing ")
  22539. ], 34)) : (openBlock(), createBlock(unref(ElScrollbar), {
  22540. key: menuId.value,
  22541. tag: "ul",
  22542. role: "menu",
  22543. class: normalizeClass(unref(ns).b()),
  22544. "wrap-class": unref(ns).e("wrap"),
  22545. "view-class": [unref(ns).e("list"), unref(ns).is("empty", isEmpty.value)],
  22546. onMousemove: handleMouseMove,
  22547. onMouseleave: clearHoverZone
  22548. }, {
  22549. default: withCtx(() => [
  22550. (openBlock(true), createElementBlock(Fragment, null, renderList(__props.nodes, (node) => {
  22551. return openBlock(), createBlock(node_default, {
  22552. key: node.uid,
  22553. node,
  22554. "menu-id": menuId.value,
  22555. onExpand: handleExpand
  22556. }, null, 8, ["node", "menu-id"]);
  22557. }), 128)),
  22558. isLoading.value ? (openBlock(), createElementBlock("div", {
  22559. key: 0,
  22560. class: normalizeClass(unref(ns).e("empty-text"))
  22561. }, [createVNode(unref(ElIcon), {
  22562. size: 14,
  22563. class: normalizeClass(unref(ns).is("loading"))
  22564. }, {
  22565. default: withCtx(() => [createVNode(unref(loading_default))]),
  22566. _: 1
  22567. }, 8, ["class"]), createTextVNode(" " + toDisplayString(unref(t)("el.cascader.loading")), 1)], 2)) : isEmpty.value ? (openBlock(), createElementBlock("div", {
  22568. key: 1,
  22569. class: normalizeClass(unref(ns).e("empty-text"))
  22570. }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(unref(t)("el.cascader.noData")), 1)])], 2)) : unref(panel)?.isHoverMenu ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [createCommentVNode(" eslint-disable vue/html-self-closing "), (openBlock(), createElementBlock("svg", {
  22571. ref_key: "hoverZone",
  22572. ref: hoverZone,
  22573. class: normalizeClass(unref(ns).e("hover-zone"))
  22574. }, null, 2))], 2112)) : createCommentVNode("v-if", true),
  22575. createCommentVNode(" eslint-enable vue/html-self-closing ")
  22576. ]),
  22577. _: 3
  22578. }, 8, [
  22579. "class",
  22580. "wrap-class",
  22581. "view-class"
  22582. ]));
  22583. };
  22584. }
  22585. });
  22586. //#endregion
  22587. //#region ../../packages/components/cascader-panel/src/menu.vue
  22588. var menu_default$1 = menu_vue_vue_type_script_setup_true_lang_default;
  22589. //#endregion
  22590. //#region ../../packages/components/cascader-panel/src/node.ts
  22591. let uid = 0;
  22592. const calculatePathNodes = (node) => {
  22593. const nodes = [node];
  22594. let { parent } = node;
  22595. while (parent) {
  22596. nodes.unshift(parent);
  22597. parent = parent.parent;
  22598. }
  22599. return nodes;
  22600. };
  22601. var Node$2 = class Node$2 {
  22602. constructor(data, config, parent, root = false) {
  22603. this.data = data;
  22604. this.config = config;
  22605. this.parent = parent;
  22606. this.root = root;
  22607. this.uid = uid++;
  22608. this.checked = false;
  22609. this.indeterminate = false;
  22610. this.loading = false;
  22611. const { value: valueKey, label: labelKey, children: childrenKey } = config;
  22612. const childrenData = data[childrenKey];
  22613. const pathNodes = calculatePathNodes(this);
  22614. this.level = root ? 0 : parent ? parent.level + 1 : 1;
  22615. this.value = data[valueKey];
  22616. this.label = data[labelKey];
  22617. this.pathNodes = pathNodes;
  22618. this.pathValues = pathNodes.map((node) => node.value);
  22619. this.pathLabels = pathNodes.map((node) => node.label);
  22620. this.childrenData = childrenData;
  22621. this.children = (childrenData || []).map((child) => new Node$2(child, config, this));
  22622. this.loaded = !config.lazy || this.isLeaf || !isEmpty(childrenData);
  22623. this.text = "";
  22624. }
  22625. get isDisabled() {
  22626. const { data, parent, config } = this;
  22627. const { disabled, checkStrictly } = config;
  22628. return (isFunction$1(disabled) ? disabled(data, this) : !!data[disabled]) || !checkStrictly && !!parent?.isDisabled;
  22629. }
  22630. get isLeaf() {
  22631. const { data, config, childrenData, loaded } = this;
  22632. const { lazy, leaf } = config;
  22633. const isLeaf = isFunction$1(leaf) ? leaf(data, this) : data[leaf];
  22634. return isUndefined(isLeaf) ? lazy && !loaded ? false : !(isArray$1(childrenData) && childrenData.length) : !!isLeaf;
  22635. }
  22636. get valueByOption() {
  22637. return this.config.emitPath ? this.pathValues : this.value;
  22638. }
  22639. appendChild(childData) {
  22640. const { childrenData, children } = this;
  22641. const node = new Node$2(childData, this.config, this);
  22642. if (isArray$1(childrenData)) childrenData.push(childData);
  22643. else this.childrenData = [childData];
  22644. children.push(node);
  22645. return node;
  22646. }
  22647. calcText(allLevels, separator) {
  22648. const text = allLevels ? this.pathLabels.join(separator) : this.label;
  22649. this.text = text;
  22650. return text;
  22651. }
  22652. broadcast(checked) {
  22653. this.children.forEach((child) => {
  22654. if (child) {
  22655. child.broadcast(checked);
  22656. child.onParentCheck?.(checked);
  22657. }
  22658. });
  22659. }
  22660. emit() {
  22661. const { parent } = this;
  22662. if (parent) {
  22663. parent.onChildCheck?.();
  22664. parent.emit();
  22665. }
  22666. }
  22667. onParentCheck(checked) {
  22668. if (!this.isDisabled) this.setCheckState(checked);
  22669. }
  22670. onChildCheck() {
  22671. const { children } = this;
  22672. const validChildren = children.filter((child) => !child.isDisabled);
  22673. const checked = validChildren.length ? validChildren.every((child) => child.checked) : false;
  22674. this.setCheckState(checked);
  22675. }
  22676. setCheckState(checked) {
  22677. const totalNum = this.children.length;
  22678. const checkedNum = this.children.reduce((c, p) => {
  22679. return c + (p.checked ? 1 : p.indeterminate ? .5 : 0);
  22680. }, 0);
  22681. this.checked = this.loaded && this.children.filter((child) => !child.isDisabled).every((child) => child.loaded && child.checked) && checked;
  22682. this.indeterminate = this.loaded && checkedNum !== totalNum && checkedNum > 0;
  22683. }
  22684. doCheck(checked) {
  22685. if (this.checked === checked) return;
  22686. const { checkStrictly, multiple } = this.config;
  22687. if (checkStrictly || !multiple) this.checked = checked;
  22688. else {
  22689. this.broadcast(checked);
  22690. this.setCheckState(checked);
  22691. this.emit();
  22692. }
  22693. }
  22694. };
  22695. //#endregion
  22696. //#region ../../packages/components/cascader-panel/src/store.ts
  22697. const flatNodes = (nodes, leafOnly) => {
  22698. return nodes.reduce((res, node) => {
  22699. if (node.isLeaf) res.push(node);
  22700. else {
  22701. !leafOnly && res.push(node);
  22702. res = res.concat(flatNodes(node.children, leafOnly));
  22703. }
  22704. return res;
  22705. }, []);
  22706. };
  22707. var Store = class {
  22708. constructor(data, config) {
  22709. this.config = config;
  22710. const nodes = (data || []).map((nodeData) => new Node$2(nodeData, this.config));
  22711. this.nodes = nodes;
  22712. this.allNodes = flatNodes(nodes, false);
  22713. this.leafNodes = flatNodes(nodes, true);
  22714. }
  22715. getNodes() {
  22716. return this.nodes;
  22717. }
  22718. getFlattedNodes(leafOnly) {
  22719. return leafOnly ? this.leafNodes : this.allNodes;
  22720. }
  22721. appendNode(nodeData, parentNode) {
  22722. const node = parentNode ? parentNode.appendChild(nodeData) : new Node$2(nodeData, this.config);
  22723. if (!parentNode) this.nodes.push(node);
  22724. this.appendAllNodesAndLeafNodes(node);
  22725. }
  22726. appendNodes(nodeDataList, parentNode) {
  22727. if (nodeDataList.length > 0) nodeDataList.forEach((nodeData) => this.appendNode(nodeData, parentNode));
  22728. else parentNode && parentNode.isLeaf && this.leafNodes.push(parentNode);
  22729. }
  22730. appendAllNodesAndLeafNodes(node) {
  22731. this.allNodes.push(node);
  22732. node.isLeaf && this.leafNodes.push(node);
  22733. if (node.children) node.children.forEach((subNode) => {
  22734. this.appendAllNodesAndLeafNodes(subNode);
  22735. });
  22736. }
  22737. getNodeByValue(value, leafOnly = false) {
  22738. if (isPropAbsent(value)) return null;
  22739. return this.getFlattedNodes(leafOnly).find((node) => isEqual$1(node.value, value) || isEqual$1(node.pathValues, value)) || null;
  22740. }
  22741. getSameNode(node) {
  22742. if (!node) return null;
  22743. return this.getFlattedNodes(false).find(({ value, level }) => isEqual$1(node.value, value) && node.level === level) || null;
  22744. }
  22745. };
  22746. //#endregion
  22747. //#region ../../packages/components/cascader-panel/src/utils.ts
  22748. const getMenuIndex = (el) => {
  22749. if (!el) return 0;
  22750. const pieces = el.id.split("-");
  22751. return Number(pieces[pieces.length - 2]);
  22752. };
  22753. const checkNode = (el) => {
  22754. if (!el) return;
  22755. const input = el.querySelector("input");
  22756. if (input) input.click();
  22757. else if (isLeaf(el)) el.click();
  22758. };
  22759. const sortByOriginalOrder = (oldNodes, newNodes) => {
  22760. const newNodesCopy = newNodes.slice(0);
  22761. const newIds = newNodesCopy.map((node) => node.uid);
  22762. const res = oldNodes.reduce((acc, item) => {
  22763. const index = newIds.indexOf(item.uid);
  22764. if (index > -1) {
  22765. acc.push(item);
  22766. newNodesCopy.splice(index, 1);
  22767. newIds.splice(index, 1);
  22768. }
  22769. return acc;
  22770. }, []);
  22771. res.push(...newNodesCopy);
  22772. return res;
  22773. };
  22774. //#endregion
  22775. //#region ../../packages/components/cascader-panel/src/index.vue?vue&type=script&setup=true&lang.ts
  22776. var index_vue_vue_type_script_setup_true_lang_default$1 = /* @__PURE__ */ defineComponent({
  22777. name: "ElCascaderPanel",
  22778. __name: "index",
  22779. props: cascaderPanelProps,
  22780. emits: cascaderPanelEmits,
  22781. setup(__props, { expose: __expose, emit: __emit }) {
  22782. const props = __props;
  22783. const emit = __emit;
  22784. let manualChecked = false;
  22785. const ns = useNamespace("cascader");
  22786. const config = useCascaderConfig(props);
  22787. const slots = useSlots();
  22788. let store;
  22789. const initialLoaded = ref(true);
  22790. const initialLoadedOnce = ref(false);
  22791. const menuList = ref([]);
  22792. const checkedValue = ref();
  22793. const menus = ref([]);
  22794. const expandingNode = ref();
  22795. const checkedNodes = ref([]);
  22796. const isHoverMenu = computed(() => config.value.expandTrigger === "hover");
  22797. const renderLabelFn = computed(() => props.renderLabel || slots.default);
  22798. const virtualScroll = computed(() => props.virtualScroll);
  22799. const itemSize = computed(() => props.itemSize);
  22800. const height = computed(() => props.height);
  22801. const initStore = () => {
  22802. const { options } = props;
  22803. const cfg = config.value;
  22804. manualChecked = false;
  22805. store = new Store(options, cfg);
  22806. menus.value = [store.getNodes()];
  22807. if (cfg.lazy && isEmpty(props.options)) {
  22808. initialLoaded.value = false;
  22809. lazyLoad(void 0, (list) => {
  22810. if (list) {
  22811. store = new Store(list, cfg);
  22812. menus.value = [store.getNodes()];
  22813. }
  22814. initialLoaded.value = true;
  22815. syncCheckedValue(false, true);
  22816. });
  22817. } else syncCheckedValue(false, true);
  22818. };
  22819. const lazyLoad = (node, cb) => {
  22820. const cfg = config.value;
  22821. node = node || new Node$2({}, cfg, void 0, true);
  22822. node.loading = true;
  22823. const resolve = (dataList) => {
  22824. const _node = node;
  22825. const parent = _node.root ? null : _node;
  22826. _node.loading = false;
  22827. _node.loaded = true;
  22828. _node.childrenData = _node.childrenData || [];
  22829. dataList && store?.appendNodes(dataList, parent);
  22830. dataList && cb?.(dataList);
  22831. if (node.level === 0) initialLoadedOnce.value = true;
  22832. };
  22833. const reject = () => {
  22834. node.loading = false;
  22835. node.loaded = false;
  22836. if (node.level === 0) initialLoaded.value = true;
  22837. };
  22838. cfg.lazyLoad(node, resolve, reject);
  22839. };
  22840. const expandNode = (node, silent) => {
  22841. const { level } = node;
  22842. const newMenus = menus.value.slice(0, level);
  22843. let newExpandingNode;
  22844. if (node.isLeaf) newExpandingNode = node.pathNodes[level - 2];
  22845. else {
  22846. newExpandingNode = node;
  22847. newMenus.push(node.children);
  22848. }
  22849. if (expandingNode.value?.uid !== newExpandingNode?.uid) {
  22850. expandingNode.value = node;
  22851. menus.value = newMenus;
  22852. !silent && emit("expand-change", node?.pathValues || []);
  22853. }
  22854. };
  22855. const handleCheckChange = (node, checked, emitClose = true) => {
  22856. const { checkStrictly, multiple } = config.value;
  22857. const oldNode = checkedNodes.value[0];
  22858. manualChecked = true;
  22859. !multiple && oldNode?.doCheck(false);
  22860. node.doCheck(checked);
  22861. calculateCheckedValue();
  22862. emitClose && !multiple && !checkStrictly && emit("close");
  22863. !emitClose && !multiple && expandParentNode(node);
  22864. };
  22865. const expandParentNode = (node) => {
  22866. if (!node) return;
  22867. node = node.parent;
  22868. expandParentNode(node);
  22869. node && expandNode(node);
  22870. };
  22871. const getFlattedNodes = (leafOnly) => store?.getFlattedNodes(leafOnly);
  22872. const getCheckedNodes = (leafOnly) => {
  22873. return getFlattedNodes(leafOnly)?.filter(({ checked }) => checked !== false);
  22874. };
  22875. const clearCheckedNodes = () => {
  22876. checkedNodes.value.forEach((node) => node.doCheck(false));
  22877. calculateCheckedValue();
  22878. menus.value = menus.value.slice(0, 1);
  22879. expandingNode.value = void 0;
  22880. emit("expand-change", []);
  22881. };
  22882. const calculateCheckedValue = () => {
  22883. const { checkStrictly, multiple } = config.value;
  22884. const oldNodes = checkedNodes.value;
  22885. const nodes = sortByOriginalOrder(oldNodes, getCheckedNodes(!checkStrictly));
  22886. const values = nodes.map((node) => node.valueByOption);
  22887. checkedNodes.value = nodes;
  22888. checkedValue.value = multiple ? values : values[0] ?? null;
  22889. };
  22890. const syncCheckedValue = (loaded = false, forced = false) => {
  22891. const { modelValue } = props;
  22892. const { lazy, multiple, checkStrictly } = config.value;
  22893. const leafOnly = !checkStrictly;
  22894. if (!initialLoaded.value || manualChecked || !forced && isEqual$1(modelValue, checkedValue.value)) return;
  22895. if (lazy && !loaded) {
  22896. const nodes = unique(flattenDeep(castArray(modelValue))).map((val) => store?.getNodeByValue(val)).filter((node) => !!node && !node.loaded && !node.loading);
  22897. if (nodes.length) nodes.forEach((node) => {
  22898. lazyLoad(node, () => syncCheckedValue(false, forced));
  22899. });
  22900. else syncCheckedValue(true, forced);
  22901. } else {
  22902. syncMenuState(unique((multiple ? castArray(modelValue) : [modelValue]).map((val) => store?.getNodeByValue(val, leafOnly))), forced);
  22903. checkedValue.value = cloneDeep(modelValue ?? void 0);
  22904. }
  22905. };
  22906. const syncMenuState = (newCheckedNodes, reserveExpandingState = true) => {
  22907. const { checkStrictly } = config.value;
  22908. const oldNodes = checkedNodes.value;
  22909. const newNodes = newCheckedNodes.filter((node) => !!node && (checkStrictly || node.isLeaf));
  22910. const oldExpandingNode = store?.getSameNode(expandingNode.value);
  22911. const newExpandingNode = reserveExpandingState && oldExpandingNode || newNodes[0];
  22912. if (newExpandingNode) newExpandingNode.pathNodes.forEach((node) => expandNode(node, true));
  22913. else expandingNode.value = void 0;
  22914. oldNodes.forEach((node) => node.doCheck(false));
  22915. reactive(newNodes).forEach((node) => node.doCheck(true));
  22916. checkedNodes.value = newNodes;
  22917. nextTick(scrollToExpandingNode);
  22918. };
  22919. const scrollToExpandingNode = () => {
  22920. if (!isClient) return;
  22921. menuList.value.forEach((menu) => {
  22922. const menuElement = menu?.$el;
  22923. if (menuElement) if (virtualScroll.value) {
  22924. const activeIndex = menu?.getActiveNodeIndex?.();
  22925. if (activeIndex !== void 0 && activeIndex >= 0) menu?.scrollToItem?.(activeIndex);
  22926. } else {
  22927. const container = menuElement.querySelector(`.${ns.namespace.value}-scrollbar__wrap`);
  22928. let activeNode = menuElement.querySelector(`.${ns.b("node")}.in-active-path`);
  22929. if (!activeNode) {
  22930. const activeElements = menuElement.querySelectorAll(`.${ns.b("node")}.${ns.is("active")}`);
  22931. activeNode = activeElements[activeElements.length - 1];
  22932. }
  22933. scrollIntoView(container, activeNode);
  22934. }
  22935. });
  22936. };
  22937. const handleKeyDown = (e) => {
  22938. const target = e.target;
  22939. const code = getEventCode(e);
  22940. switch (code) {
  22941. case EVENT_CODE.up:
  22942. case EVENT_CODE.down: {
  22943. e.preventDefault();
  22944. const distance = code === EVENT_CODE.up ? -1 : 1;
  22945. if (virtualScroll.value) {
  22946. const menuIndex = getMenuIndex(target);
  22947. const menu = menuList.value[menuIndex];
  22948. if (menu) {
  22949. const currentIndex = menu.getNodeIndexById(target.id);
  22950. if (currentIndex >= 0) {
  22951. const nodesInMenu = menus.value[menuIndex] ?? [];
  22952. const nodesCount = nodesInMenu.length;
  22953. let targetIndex = currentIndex + distance;
  22954. while (targetIndex >= 0 && targetIndex < nodesCount) {
  22955. if (!nodesInMenu[targetIndex].isDisabled) {
  22956. menu.focusNodeAt(targetIndex);
  22957. return;
  22958. }
  22959. targetIndex += distance;
  22960. }
  22961. }
  22962. }
  22963. }
  22964. focusNode(getSibling(target, distance, `.${ns.b("node")}[tabindex="-1"]`));
  22965. break;
  22966. }
  22967. case EVENT_CODE.left: {
  22968. e.preventDefault();
  22969. const expandedNode = menuList.value[getMenuIndex(target) - 1]?.$el.querySelector(`.${ns.b("node")}[aria-expanded="true"]`);
  22970. focusNode(expandedNode);
  22971. break;
  22972. }
  22973. case EVENT_CODE.right: {
  22974. e.preventDefault();
  22975. const firstNode = menuList.value[getMenuIndex(target) + 1]?.$el.querySelector(`.${ns.b("node")}[tabindex="-1"]`);
  22976. focusNode(firstNode);
  22977. break;
  22978. }
  22979. case EVENT_CODE.enter:
  22980. case EVENT_CODE.numpadEnter:
  22981. checkNode(target);
  22982. break;
  22983. }
  22984. };
  22985. provide(CASCADER_PANEL_INJECTION_KEY, reactive({
  22986. config,
  22987. expandingNode,
  22988. checkedNodes,
  22989. isHoverMenu,
  22990. initialLoaded,
  22991. renderLabelFn,
  22992. virtualScroll,
  22993. itemSize,
  22994. height,
  22995. lazyLoad,
  22996. expandNode,
  22997. handleCheckChange
  22998. }));
  22999. watch(config, (newVal, oldVal) => {
  23000. if (isEqual$1(newVal, oldVal)) return;
  23001. initStore();
  23002. }, { immediate: true });
  23003. watch(() => props.options, initStore, { deep: true });
  23004. watch(() => props.modelValue, () => {
  23005. manualChecked = false;
  23006. syncCheckedValue();
  23007. }, { deep: true });
  23008. watch(() => checkedValue.value, (val) => {
  23009. if (!isEqual$1(val, props.modelValue)) {
  23010. emit(UPDATE_MODEL_EVENT, val);
  23011. emit(CHANGE_EVENT, val);
  23012. }
  23013. });
  23014. const loadLazyRootNodes = () => {
  23015. if (initialLoadedOnce.value || !initialLoaded.value) return;
  23016. initStore();
  23017. };
  23018. onBeforeUpdate(() => menuList.value = []);
  23019. onMounted(() => !isEmpty(props.modelValue) && syncCheckedValue());
  23020. __expose({
  23021. menuList,
  23022. menus,
  23023. checkedNodes,
  23024. handleKeyDown,
  23025. handleCheckChange,
  23026. getFlattedNodes,
  23027. getCheckedNodes,
  23028. clearCheckedNodes,
  23029. calculateCheckedValue,
  23030. scrollToExpandingNode,
  23031. loadLazyRootNodes
  23032. });
  23033. return (_ctx, _cache) => {
  23034. return openBlock(), createElementBlock("div", {
  23035. class: normalizeClass([unref(ns).b("panel"), unref(ns).is("bordered", __props.border)]),
  23036. onKeydown: handleKeyDown
  23037. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(menus.value, (menu, index) => {
  23038. return openBlock(), createBlock(menu_default$1, {
  23039. key: index,
  23040. ref_for: true,
  23041. ref: (item) => menuList.value[index] = item,
  23042. index,
  23043. nodes: [...menu],
  23044. "virtual-scroll": virtualScroll.value,
  23045. "item-size": itemSize.value,
  23046. height: height.value
  23047. }, {
  23048. empty: withCtx(() => [renderSlot(_ctx.$slots, "empty")]),
  23049. _: 3
  23050. }, 8, [
  23051. "index",
  23052. "nodes",
  23053. "virtual-scroll",
  23054. "item-size",
  23055. "height"
  23056. ]);
  23057. }), 128))], 34);
  23058. };
  23059. }
  23060. });
  23061. //#endregion
  23062. //#region ../../packages/components/cascader-panel/src/index.vue
  23063. var src_default$1 = index_vue_vue_type_script_setup_true_lang_default$1;
  23064. //#endregion
  23065. //#region ../../packages/components/cascader-panel/index.ts
  23066. const ElCascaderPanel = withInstall(src_default$1);
  23067. //#endregion
  23068. //#region ../../packages/components/cascader/src/cascader.ts
  23069. const cascaderProps = buildProps({
  23070. ...CommonProps,
  23071. size: useSizeProp,
  23072. placeholder: String,
  23073. disabled: {
  23074. type: Boolean,
  23075. default: void 0
  23076. },
  23077. clearable: Boolean,
  23078. clearIcon: {
  23079. type: iconPropType,
  23080. default: circle_close_default
  23081. },
  23082. filterable: Boolean,
  23083. filterMethod: {
  23084. type: definePropType(Function),
  23085. default: (node, keyword) => node.text.includes(keyword)
  23086. },
  23087. separator: {
  23088. type: String,
  23089. default: " / "
  23090. },
  23091. showAllLevels: {
  23092. type: Boolean,
  23093. default: true
  23094. },
  23095. collapseTags: Boolean,
  23096. maxCollapseTags: {
  23097. type: Number,
  23098. default: 1
  23099. },
  23100. collapseTagsTooltip: Boolean,
  23101. maxCollapseTagsTooltipHeight: { type: [String, Number] },
  23102. debounce: {
  23103. type: Number,
  23104. default: 300
  23105. },
  23106. beforeFilter: {
  23107. type: definePropType(Function),
  23108. default: () => true
  23109. },
  23110. placement: {
  23111. type: definePropType(String),
  23112. values: Ee,
  23113. default: "bottom-start"
  23114. },
  23115. fallbackPlacements: {
  23116. type: definePropType(Array),
  23117. default: [
  23118. "bottom-start",
  23119. "bottom",
  23120. "top-start",
  23121. "top",
  23122. "right",
  23123. "left"
  23124. ]
  23125. },
  23126. popperClass: useTooltipContentProps.popperClass,
  23127. popperStyle: useTooltipContentProps.popperStyle,
  23128. teleported: useTooltipContentProps.teleported,
  23129. effect: {
  23130. type: definePropType(String),
  23131. default: "light"
  23132. },
  23133. tagType: {
  23134. ...tagProps.type,
  23135. default: "info"
  23136. },
  23137. tagEffect: {
  23138. ...tagProps.effect,
  23139. default: "light"
  23140. },
  23141. validateEvent: {
  23142. type: Boolean,
  23143. default: true
  23144. },
  23145. persistent: {
  23146. type: Boolean,
  23147. default: true
  23148. },
  23149. showCheckedStrategy: {
  23150. type: String,
  23151. values: ["parent", "child"],
  23152. default: "child"
  23153. },
  23154. checkOnClickNode: Boolean,
  23155. showPrefix: {
  23156. type: Boolean,
  23157. default: true
  23158. },
  23159. fitInputWidth: {
  23160. type: [Boolean, Number],
  23161. default: false
  23162. },
  23163. ...useEmptyValuesProps
  23164. });
  23165. const emitChangeFn$1 = (value) => true;
  23166. const cascaderEmits = {
  23167. [UPDATE_MODEL_EVENT]: emitChangeFn$1,
  23168. [CHANGE_EVENT]: emitChangeFn$1,
  23169. focus: (evt) => evt instanceof FocusEvent,
  23170. blur: (evt) => evt instanceof FocusEvent,
  23171. clear: () => true,
  23172. visibleChange: (val) => isBoolean(val),
  23173. expandChange: (val) => !!val,
  23174. removeTag: (val) => !!val
  23175. };
  23176. //#endregion
  23177. //#region ../../packages/components/cascader/src/cascader.vue?vue&type=script&setup=true&lang.ts
  23178. const _hoisted_1$58 = ["placeholder"];
  23179. const _hoisted_2$35 = ["onClick"];
  23180. const _hoisted_3$16 = [
  23181. "id",
  23182. "data-suggestion-index",
  23183. "onClick"
  23184. ];
  23185. const SUGGESTION_ITEM_EXTRA_WIDTH = 34;
  23186. var cascader_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  23187. name: "ElCascader",
  23188. __name: "cascader",
  23189. props: cascaderProps,
  23190. emits: cascaderEmits,
  23191. setup(__props, { expose: __expose, emit: __emit }) {
  23192. const popperOptions = { modifiers: [{
  23193. name: "arrowPosition",
  23194. enabled: true,
  23195. phase: "main",
  23196. fn: ({ state }) => {
  23197. const { modifiersData, placement } = state;
  23198. if ([
  23199. "right",
  23200. "left",
  23201. "bottom",
  23202. "top"
  23203. ].includes(placement)) return;
  23204. if (modifiersData.arrow) modifiersData.arrow.x = 35;
  23205. },
  23206. requires: ["arrow"]
  23207. }] };
  23208. const props = __props;
  23209. const emit = __emit;
  23210. const attrs = useAttrs$1();
  23211. const slots = useSlots();
  23212. let inputInitialHeight = 0;
  23213. let pressDeleteCount = 0;
  23214. const nsCascader = useNamespace("cascader");
  23215. const nsInput = useNamespace("input");
  23216. const sizeMapPadding = {
  23217. small: 7,
  23218. default: 11,
  23219. large: 15
  23220. };
  23221. const { t } = useLocale();
  23222. const { formItem } = useFormItem();
  23223. const isDisabled = useFormDisabled();
  23224. const { valueOnClear } = useEmptyValues(props);
  23225. const { isComposing, handleComposition } = useComposition({ afterComposition(event) {
  23226. const text = event.target?.value;
  23227. handleInput(text);
  23228. } });
  23229. const tooltipRef = ref();
  23230. const tagTooltipRef = ref();
  23231. const inputRef = ref();
  23232. const tagWrapper = ref();
  23233. const cascaderPanelRef = ref();
  23234. const suggestionPanel = ref();
  23235. const suggestionVirtualListRef = ref();
  23236. const popperVisible = ref(false);
  23237. const inputHover = ref(false);
  23238. const filtering = ref(false);
  23239. const inputValue = ref("");
  23240. const searchInputValue = ref("");
  23241. const tags = ref([]);
  23242. const suggestions = ref([]);
  23243. const suggestionListWidth = ref("100%");
  23244. const hasCustomSuggestionItemSlot = computed(() => !!slots["suggestion-item"]);
  23245. const clampedSuggestionListHeight = computed(() => clamp$1(suggestions.value.length * props.itemSize, props.itemSize, props.height));
  23246. const showTagList = computed(() => {
  23247. if (!props.props.multiple) return [];
  23248. return props.collapseTags ? tags.value.slice(0, props.maxCollapseTags) : tags.value;
  23249. });
  23250. const collapseTagList = computed(() => {
  23251. if (!props.props.multiple) return [];
  23252. return props.collapseTags ? tags.value.slice(props.maxCollapseTags) : [];
  23253. });
  23254. const cascaderStyle = computed(() => {
  23255. return attrs.style;
  23256. });
  23257. const inputPlaceholder = computed(() => props.placeholder ?? t("el.cascader.placeholder"));
  23258. const currentPlaceholder = computed(() => searchInputValue.value || tags.value.length > 0 || isComposing.value ? "" : inputPlaceholder.value);
  23259. const realSize = useFormSize();
  23260. const tagSize = computed(() => realSize.value === "small" ? "small" : "default");
  23261. const multiple = computed(() => !!props.props.multiple);
  23262. const readonly = computed(() => !props.filterable || multiple.value);
  23263. const searchKeyword = computed(() => multiple.value ? searchInputValue.value : inputValue.value);
  23264. const checkedNodes = computed(() => cascaderPanelRef.value?.checkedNodes || []);
  23265. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  23266. disabled: isDisabled,
  23267. beforeBlur(event) {
  23268. return tooltipRef.value?.isFocusInsideContent(event) || tagTooltipRef.value?.isFocusInsideContent(event);
  23269. },
  23270. afterBlur() {
  23271. if (props.validateEvent) formItem?.validate?.("blur").catch(NOOP);
  23272. }
  23273. });
  23274. const clearBtnVisible = computed(() => {
  23275. if (!props.clearable || isDisabled.value || filtering.value || !inputHover.value && !isFocused.value) return false;
  23276. return !!checkedNodes.value.length;
  23277. });
  23278. const presentText = computed(() => {
  23279. const { showAllLevels, separator } = props;
  23280. const nodes = checkedNodes.value;
  23281. return nodes.length ? multiple.value ? "" : nodes[0].calcText(showAllLevels, separator) : "";
  23282. });
  23283. const validateState = computed(() => formItem?.validateState || "");
  23284. const checkedValue = computed({
  23285. get() {
  23286. return cloneDeep(props.modelValue);
  23287. },
  23288. set(val) {
  23289. const value = val ?? valueOnClear.value;
  23290. emit(UPDATE_MODEL_EVENT, value);
  23291. emit(CHANGE_EVENT, value);
  23292. if (props.validateEvent) formItem?.validate("change").catch(NOOP);
  23293. }
  23294. });
  23295. const cascaderKls = computed(() => {
  23296. return [
  23297. nsCascader.b(),
  23298. nsCascader.m(realSize.value),
  23299. nsCascader.is("disabled", isDisabled.value),
  23300. attrs.class
  23301. ];
  23302. });
  23303. const cascaderIconKls = computed(() => {
  23304. return [
  23305. nsInput.e("icon"),
  23306. "icon-arrow-down",
  23307. nsCascader.is("reverse", popperVisible.value)
  23308. ];
  23309. });
  23310. const inputClass = computed(() => nsCascader.is("focus", isFocused.value));
  23311. const contentRef = computed(() => {
  23312. return tooltipRef.value?.popperRef?.contentRef;
  23313. });
  23314. const handleClickOutside = (event) => {
  23315. if (isFocused.value) handleBlur(new FocusEvent("blur", event));
  23316. togglePopperVisible(false);
  23317. };
  23318. const togglePopperVisible = (visible) => {
  23319. if (isDisabled.value) return;
  23320. visible = visible ?? !popperVisible.value;
  23321. if (visible !== popperVisible.value) {
  23322. popperVisible.value = visible;
  23323. inputRef.value?.input?.setAttribute("aria-expanded", `${visible}`);
  23324. if (visible) {
  23325. updatePopperPosition();
  23326. cascaderPanelRef.value && nextTick(cascaderPanelRef.value.scrollToExpandingNode);
  23327. } else if (props.filterable) syncPresentTextValue();
  23328. emit("visibleChange", visible);
  23329. }
  23330. };
  23331. const updatePopperPosition = () => {
  23332. nextTick(() => {
  23333. tooltipRef.value?.updatePopper();
  23334. });
  23335. };
  23336. const hideSuggestionPanel = () => {
  23337. filtering.value = false;
  23338. };
  23339. const genTag = (node) => {
  23340. const { showAllLevels, separator } = props;
  23341. return {
  23342. node,
  23343. key: node.uid,
  23344. text: node.calcText(showAllLevels, separator),
  23345. hitState: false,
  23346. closable: !isDisabled.value && !node.isDisabled
  23347. };
  23348. };
  23349. const deleteTag = (tag) => {
  23350. const node = tag.node;
  23351. node.doCheck(false);
  23352. cascaderPanelRef.value?.calculateCheckedValue();
  23353. emit("removeTag", node.valueByOption);
  23354. };
  23355. const getStrategyCheckedNodes = () => {
  23356. switch (props.showCheckedStrategy) {
  23357. case "child": return checkedNodes.value;
  23358. case "parent": {
  23359. const clickedNodes = getCheckedNodes(false);
  23360. const clickedNodesValue = clickedNodes.map((o) => o.value);
  23361. return clickedNodes.filter((o) => !o.parent || !clickedNodesValue.includes(o.parent.value));
  23362. }
  23363. default: return [];
  23364. }
  23365. };
  23366. const calculatePresentTags = () => {
  23367. if (!multiple.value) return;
  23368. const nodes = getStrategyCheckedNodes();
  23369. const allTags = [];
  23370. nodes.forEach((node) => allTags.push(genTag(node)));
  23371. tags.value = allTags;
  23372. };
  23373. const calculateSuggestions = () => {
  23374. const { filterMethod, showAllLevels, separator } = props;
  23375. const res = cascaderPanelRef.value?.getFlattedNodes(!props.props.checkStrictly)?.filter((node) => {
  23376. if (node.isDisabled) return false;
  23377. node.calcText(showAllLevels, separator);
  23378. return filterMethod(node, searchKeyword.value);
  23379. });
  23380. if (multiple.value) tags.value.forEach((tag) => {
  23381. tag.hitState = false;
  23382. });
  23383. filtering.value = true;
  23384. suggestions.value = res;
  23385. nextTick(() => {
  23386. if (props.virtualScroll && suggestions.value.length > 0) suggestionVirtualListRef.value?.scrollToItem(0);
  23387. updateStyle();
  23388. });
  23389. updatePopperPosition();
  23390. };
  23391. const getSuggestionPanelEl = (selector) => {
  23392. const el = suggestionPanel.value;
  23393. return selector ? el?.querySelector(selector) ?? void 0 : el;
  23394. };
  23395. const focusFirstNode = () => {
  23396. let firstNode;
  23397. if (filtering.value && suggestionPanel.value) firstNode = getSuggestionPanelEl(`.${nsCascader.e("suggestion-item")}`);
  23398. else firstNode = cascaderPanelRef.value?.$el.querySelector(`.${nsCascader.b("node")}[tabindex="-1"]`);
  23399. if (firstNode) {
  23400. firstNode.focus();
  23401. if (!filtering.value && firstNode.getAttribute("aria-haspopup") === "true") firstNode.click();
  23402. }
  23403. };
  23404. const updateSuggestionPanelWidth = (inputWidth) => {
  23405. const suggestionPanelEl = getSuggestionPanelEl();
  23406. if (!suggestionPanelEl) return;
  23407. const panelWidth = isNumber(props.fitInputWidth) ? `${props.fitInputWidth}px` : `${inputWidth}px`;
  23408. const setPanelStyle = (el) => {
  23409. if (props.fitInputWidth !== false) {
  23410. el.style.width = panelWidth;
  23411. el.style.minWidth = "";
  23412. } else {
  23413. el.style.width = "";
  23414. el.style.minWidth = panelWidth;
  23415. }
  23416. };
  23417. setPanelStyle(suggestionPanelEl);
  23418. if (props.virtualScroll) {
  23419. suggestionListWidth.value = props.fitInputWidth !== false ? panelWidth : hasCustomSuggestionItemSlot.value ? `${inputWidth}px` : `${Math.max(inputWidth, calculateSuggestionMaxWidth())}px`;
  23420. return;
  23421. }
  23422. const suggestionList = getSuggestionPanelEl(`.${nsCascader.e("suggestion-list")}`);
  23423. if (suggestionList) setPanelStyle(suggestionList);
  23424. };
  23425. const getTagWrapperLeft = () => {
  23426. if (!slots.prefix) return 0;
  23427. const prefix = inputRef.value?.$el.querySelector(`.${nsInput.e("prefix")}`);
  23428. if (!prefix) return 0;
  23429. const prefixWidth = prefix.getBoundingClientRect().width;
  23430. if (prefixWidth <= 0) return 0;
  23431. return prefixWidth + sizeMapPadding[realSize.value || "default"];
  23432. };
  23433. const updateStyle = () => {
  23434. const inputInner = inputRef.value?.input;
  23435. const inputWrapper = inputRef.value?.$el;
  23436. if (!isClient || !inputInner || !inputWrapper) return;
  23437. if (suggestionPanel.value) updateSuggestionPanelWidth(inputWrapper.getBoundingClientRect().width);
  23438. const tagWrapperEl = tagWrapper.value;
  23439. if (tagWrapperEl) {
  23440. const height = tags.value.length > 0 ? `${Math.max(tagWrapperEl.offsetHeight, inputInitialHeight) - 2}px` : `${inputInitialHeight}px`;
  23441. inputInner.style.height = height;
  23442. tagWrapperEl.style.left = `${getTagWrapperLeft()}px`;
  23443. updatePopperPosition();
  23444. }
  23445. };
  23446. const calculateSuggestionMaxWidth = () => {
  23447. if (hasCustomSuggestionItemSlot.value) return 0;
  23448. if (!suggestions.value.length) return 0;
  23449. const ctx = document.createElement("canvas").getContext("2d");
  23450. if (!ctx) return 0;
  23451. const renderedSuggestion = getSuggestionPanelEl(`.${nsCascader.e("suggestion-item")}`);
  23452. if (!renderedSuggestion || !isClient) return 0;
  23453. const style = getComputedStyle(renderedSuggestion);
  23454. const padding = Number.parseFloat(style.paddingLeft) + Number.parseFloat(style.paddingRight);
  23455. ctx.font = `bold ${style.fontSize} ${style.fontFamily}`;
  23456. let maxWidth = 0;
  23457. let hasChecked = false;
  23458. for (const suggestion of suggestions.value) {
  23459. const text = suggestion.text || "";
  23460. const metrics = ctx.measureText(text);
  23461. maxWidth = Math.max(maxWidth, metrics.width);
  23462. if (suggestion.checked && !hasChecked) hasChecked = true;
  23463. }
  23464. return maxWidth + padding + (hasChecked ? SUGGESTION_ITEM_EXTRA_WIDTH : 0);
  23465. };
  23466. const getCheckedNodes = (leafOnly) => {
  23467. return cascaderPanelRef.value?.getCheckedNodes(leafOnly);
  23468. };
  23469. const handleExpandChange = (value) => {
  23470. updatePopperPosition();
  23471. emit("expandChange", value);
  23472. };
  23473. const handleKeyDown = (e) => {
  23474. if (isComposing.value) return;
  23475. switch (getEventCode(e)) {
  23476. case EVENT_CODE.enter:
  23477. case EVENT_CODE.numpadEnter:
  23478. togglePopperVisible();
  23479. break;
  23480. case EVENT_CODE.down:
  23481. togglePopperVisible(true);
  23482. nextTick(focusFirstNode);
  23483. e.preventDefault();
  23484. break;
  23485. case EVENT_CODE.esc:
  23486. if (popperVisible.value === true) {
  23487. e.preventDefault();
  23488. e.stopPropagation();
  23489. togglePopperVisible(false);
  23490. }
  23491. break;
  23492. case EVENT_CODE.tab:
  23493. togglePopperVisible(false);
  23494. break;
  23495. }
  23496. };
  23497. const handleClear = () => {
  23498. cascaderPanelRef.value?.clearCheckedNodes();
  23499. if (!popperVisible.value && props.filterable) syncPresentTextValue();
  23500. togglePopperVisible(false);
  23501. emit("clear");
  23502. };
  23503. const syncPresentTextValue = () => {
  23504. const { value } = presentText;
  23505. inputValue.value = value;
  23506. searchInputValue.value = value;
  23507. };
  23508. const handleSuggestionClick = (node) => {
  23509. const { checked } = node;
  23510. if (multiple.value) cascaderPanelRef.value?.handleCheckChange(node, !checked, false);
  23511. else {
  23512. !checked && cascaderPanelRef.value?.handleCheckChange(node, true, false);
  23513. togglePopperVisible(false);
  23514. }
  23515. };
  23516. const getSuggestionIndexFromTarget = (target) => {
  23517. const indexStr = target.closest("[data-suggestion-index]")?.dataset.suggestionIndex;
  23518. if (!indexStr) return -1;
  23519. const index = Number.parseInt(indexStr, 10);
  23520. if (Number.isNaN(index) || index < 0 || index >= suggestions.value.length) return -1;
  23521. return index;
  23522. };
  23523. const handleSuggestionKeyDown = (e) => {
  23524. const target = e.target;
  23525. const code = getEventCode(e);
  23526. switch (code) {
  23527. case EVENT_CODE.up:
  23528. case EVENT_CODE.down: {
  23529. e.preventDefault();
  23530. const distance = code === EVENT_CODE.up ? -1 : 1;
  23531. if (props.virtualScroll && suggestionVirtualListRef.value) {
  23532. const currentIndex = getSuggestionIndexFromTarget(target);
  23533. if (currentIndex >= 0) {
  23534. const length = suggestions.value.length;
  23535. const targetIndex = (currentIndex + distance + length) % length;
  23536. suggestionVirtualListRef.value.scrollToItem(targetIndex);
  23537. nextTick(() => {
  23538. const targetItem = getSuggestionPanelEl(`#suggestion-${suggestions.value[targetIndex].uid}`);
  23539. targetItem && focusNode(targetItem);
  23540. });
  23541. return;
  23542. }
  23543. }
  23544. focusNode(getSibling(target, distance, `.${nsCascader.e("suggestion-item")}[tabindex="-1"]`));
  23545. break;
  23546. }
  23547. case EVENT_CODE.enter:
  23548. case EVENT_CODE.numpadEnter:
  23549. target.click();
  23550. break;
  23551. }
  23552. };
  23553. const handleDelete = () => {
  23554. const lastTag = tags.value[tags.value.length - 1];
  23555. pressDeleteCount = searchInputValue.value ? 0 : pressDeleteCount + 1;
  23556. if (!lastTag || !pressDeleteCount || props.collapseTags && tags.value.length > 1) return;
  23557. if (lastTag.hitState) deleteTag(lastTag);
  23558. else lastTag.hitState = true;
  23559. };
  23560. const handleFilter = useDebounceFn(() => {
  23561. const { value } = searchKeyword;
  23562. if (!value) return;
  23563. const passed = props.beforeFilter(value);
  23564. if (isPromise(passed)) passed.then(calculateSuggestions).catch(() => {});
  23565. else if (passed !== false) calculateSuggestions();
  23566. else hideSuggestionPanel();
  23567. }, computed(() => props.debounce));
  23568. const handleInput = (val, e) => {
  23569. !popperVisible.value && togglePopperVisible(true);
  23570. if (e?.isComposing) return;
  23571. if (val) handleFilter();
  23572. else {
  23573. const passed = props.beforeFilter("");
  23574. if (isPromise(passed)) passed.catch(() => {});
  23575. hideSuggestionPanel();
  23576. }
  23577. };
  23578. const getInputInnerHeight = (inputInner) => Number.parseFloat(useCssVar(nsInput.cssVarName("input-height"), inputInner).value) - 2;
  23579. const focus = () => {
  23580. inputRef.value?.focus();
  23581. };
  23582. const blur = () => {
  23583. inputRef.value?.blur();
  23584. };
  23585. watch(filtering, updatePopperPosition);
  23586. watch([
  23587. checkedNodes,
  23588. isDisabled,
  23589. () => props.collapseTags,
  23590. () => props.maxCollapseTags
  23591. ], calculatePresentTags);
  23592. watch(tags, () => {
  23593. nextTick(() => updateStyle());
  23594. });
  23595. watch(realSize, async () => {
  23596. await nextTick();
  23597. const inputInner = inputRef.value.input;
  23598. inputInitialHeight = getInputInnerHeight(inputInner) || inputInitialHeight;
  23599. updateStyle();
  23600. });
  23601. watch(presentText, syncPresentTextValue, { immediate: true });
  23602. watch(() => popperVisible.value, (val) => {
  23603. if (val && props.props.lazy && props.props.lazyLoad) cascaderPanelRef.value?.loadLazyRootNodes();
  23604. });
  23605. onMounted(() => {
  23606. const inputInner = inputRef.value.input;
  23607. const inputWrapper = inputRef.value.$el;
  23608. const inputInnerHeight = getInputInnerHeight(inputInner);
  23609. inputInitialHeight = inputInner.offsetHeight || inputInnerHeight;
  23610. useResizeObserver(inputWrapper, updateStyle);
  23611. });
  23612. __expose({
  23613. getCheckedNodes,
  23614. cascaderPanelRef,
  23615. togglePopperVisible,
  23616. contentRef,
  23617. presentText,
  23618. focus,
  23619. blur
  23620. });
  23621. return (_ctx, _cache) => {
  23622. return openBlock(), createBlock(unref(ElTooltip), {
  23623. ref_key: "tooltipRef",
  23624. ref: tooltipRef,
  23625. visible: popperVisible.value,
  23626. teleported: __props.teleported,
  23627. "popper-class": [unref(nsCascader).e("dropdown"), __props.popperClass],
  23628. "popper-style": __props.popperStyle,
  23629. "popper-options": popperOptions,
  23630. "fallback-placements": __props.fallbackPlacements,
  23631. "stop-popper-mouse-event": false,
  23632. "gpu-acceleration": false,
  23633. placement: __props.placement,
  23634. transition: `${unref(nsCascader).namespace.value}-zoom-in-top`,
  23635. effect: __props.effect,
  23636. pure: "",
  23637. persistent: __props.persistent,
  23638. onHide: hideSuggestionPanel
  23639. }, {
  23640. default: withCtx(() => [withDirectives((openBlock(), createElementBlock("div", {
  23641. ref_key: "wrapperRef",
  23642. ref: wrapperRef,
  23643. class: normalizeClass(cascaderKls.value),
  23644. style: normalizeStyle(cascaderStyle.value),
  23645. onClick: _cache[8] || (_cache[8] = () => togglePopperVisible(readonly.value ? void 0 : true)),
  23646. onKeydown: handleKeyDown,
  23647. onMouseenter: _cache[9] || (_cache[9] = ($event) => inputHover.value = true),
  23648. onMouseleave: _cache[10] || (_cache[10] = ($event) => inputHover.value = false)
  23649. }, [createVNode(unref(ElInput), {
  23650. ref_key: "inputRef",
  23651. ref: inputRef,
  23652. modelValue: inputValue.value,
  23653. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => inputValue.value = $event),
  23654. placeholder: currentPlaceholder.value,
  23655. readonly: readonly.value,
  23656. disabled: unref(isDisabled),
  23657. "validate-event": false,
  23658. size: unref(realSize),
  23659. class: normalizeClass(inputClass.value),
  23660. tabindex: multiple.value && __props.filterable && !unref(isDisabled) ? -1 : void 0,
  23661. onCompositionstart: unref(handleComposition),
  23662. onCompositionupdate: unref(handleComposition),
  23663. onCompositionend: unref(handleComposition),
  23664. onInput: handleInput
  23665. }, createSlots({
  23666. suffix: withCtx(() => [clearBtnVisible.value ? (openBlock(), createBlock(unref(ElIcon), {
  23667. key: "clear",
  23668. class: normalizeClass([unref(nsInput).e("icon"), "icon-circle-close"]),
  23669. onClick: withModifiers(handleClear, ["stop"])
  23670. }, {
  23671. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.clearIcon)))]),
  23672. _: 1
  23673. }, 8, ["class"])) : (openBlock(), createBlock(unref(ElIcon), {
  23674. key: "arrow-down",
  23675. class: normalizeClass(cascaderIconKls.value),
  23676. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => togglePopperVisible(), ["stop"]))
  23677. }, {
  23678. default: withCtx(() => [createVNode(unref(arrow_down_default))]),
  23679. _: 1
  23680. }, 8, ["class"]))]),
  23681. _: 2
  23682. }, [_ctx.$slots.prefix ? {
  23683. name: "prefix",
  23684. fn: withCtx(() => [renderSlot(_ctx.$slots, "prefix")]),
  23685. key: "0"
  23686. } : void 0]), 1032, [
  23687. "modelValue",
  23688. "placeholder",
  23689. "readonly",
  23690. "disabled",
  23691. "size",
  23692. "class",
  23693. "tabindex",
  23694. "onCompositionstart",
  23695. "onCompositionupdate",
  23696. "onCompositionend"
  23697. ]), multiple.value ? (openBlock(), createElementBlock("div", {
  23698. key: 0,
  23699. ref_key: "tagWrapper",
  23700. ref: tagWrapper,
  23701. class: normalizeClass([unref(nsCascader).e("tags"), unref(nsCascader).is("validate", Boolean(validateState.value))])
  23702. }, [
  23703. renderSlot(_ctx.$slots, "tag", {
  23704. data: tags.value,
  23705. deleteTag
  23706. }, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(showTagList.value, (tag) => {
  23707. return openBlock(), createBlock(unref(ElTag), {
  23708. key: tag.key,
  23709. type: __props.tagType,
  23710. size: tagSize.value,
  23711. effect: __props.tagEffect,
  23712. hit: tag.hitState,
  23713. closable: tag.closable,
  23714. "disable-transitions": "",
  23715. onClose: ($event) => deleteTag(tag)
  23716. }, {
  23717. default: withCtx(() => [createElementVNode("span", null, toDisplayString(tag.text), 1)]),
  23718. _: 2
  23719. }, 1032, [
  23720. "type",
  23721. "size",
  23722. "effect",
  23723. "hit",
  23724. "closable",
  23725. "onClose"
  23726. ]);
  23727. }), 128))]),
  23728. __props.collapseTags && tags.value.length > __props.maxCollapseTags ? (openBlock(), createBlock(unref(ElTooltip), {
  23729. key: 0,
  23730. ref_key: "tagTooltipRef",
  23731. ref: tagTooltipRef,
  23732. disabled: popperVisible.value || !__props.collapseTagsTooltip,
  23733. "fallback-placements": [
  23734. "bottom",
  23735. "top",
  23736. "right",
  23737. "left"
  23738. ],
  23739. placement: "bottom",
  23740. "popper-class": __props.popperClass,
  23741. "popper-style": __props.popperStyle,
  23742. effect: __props.effect,
  23743. persistent: __props.persistent
  23744. }, {
  23745. default: withCtx(() => [createVNode(unref(ElTag), {
  23746. closable: false,
  23747. size: tagSize.value,
  23748. type: __props.tagType,
  23749. effect: __props.tagEffect,
  23750. "disable-transitions": ""
  23751. }, {
  23752. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(unref(nsCascader).e("tags-text")) }, " + " + toDisplayString(tags.value.length - __props.maxCollapseTags), 3)]),
  23753. _: 1
  23754. }, 8, [
  23755. "size",
  23756. "type",
  23757. "effect"
  23758. ])]),
  23759. content: withCtx(() => [createVNode(unref(ElScrollbar), { "max-height": __props.maxCollapseTagsTooltipHeight }, {
  23760. default: withCtx(() => [createElementVNode("div", { class: normalizeClass(unref(nsCascader).e("collapse-tags")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(collapseTagList.value, (tag, idx) => {
  23761. return openBlock(), createElementBlock("div", {
  23762. key: idx,
  23763. class: normalizeClass(unref(nsCascader).e("collapse-tag"))
  23764. }, [(openBlock(), createBlock(unref(ElTag), {
  23765. key: tag.key,
  23766. class: "in-tooltip",
  23767. type: __props.tagType,
  23768. size: tagSize.value,
  23769. effect: __props.tagEffect,
  23770. hit: tag.hitState,
  23771. closable: tag.closable,
  23772. "disable-transitions": "",
  23773. onClose: ($event) => deleteTag(tag)
  23774. }, {
  23775. default: withCtx(() => [createElementVNode("span", null, toDisplayString(tag.text), 1)]),
  23776. _: 2
  23777. }, 1032, [
  23778. "type",
  23779. "size",
  23780. "effect",
  23781. "hit",
  23782. "closable",
  23783. "onClose"
  23784. ]))], 2);
  23785. }), 128))], 2)]),
  23786. _: 1
  23787. }, 8, ["max-height"])]),
  23788. _: 1
  23789. }, 8, [
  23790. "disabled",
  23791. "popper-class",
  23792. "popper-style",
  23793. "effect",
  23794. "persistent"
  23795. ])) : createCommentVNode("v-if", true),
  23796. __props.filterable && !unref(isDisabled) ? withDirectives((openBlock(), createElementBlock("input", {
  23797. key: 1,
  23798. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => searchInputValue.value = $event),
  23799. type: "text",
  23800. class: normalizeClass(unref(nsCascader).e("search-input")),
  23801. placeholder: presentText.value ? "" : inputPlaceholder.value,
  23802. onInput: _cache[3] || (_cache[3] = (e) => handleInput(searchInputValue.value, e)),
  23803. onClick: _cache[4] || (_cache[4] = withModifiers(($event) => togglePopperVisible(true), ["stop"])),
  23804. onKeydown: withKeys(handleDelete, ["delete"]),
  23805. onCompositionstart: _cache[5] || (_cache[5] = (...args) => unref(handleComposition) && unref(handleComposition)(...args)),
  23806. onCompositionupdate: _cache[6] || (_cache[6] = (...args) => unref(handleComposition) && unref(handleComposition)(...args)),
  23807. onCompositionend: _cache[7] || (_cache[7] = (...args) => unref(handleComposition) && unref(handleComposition)(...args))
  23808. }, null, 42, _hoisted_1$58)), [[vModelText, searchInputValue.value]]) : createCommentVNode("v-if", true)
  23809. ], 2)) : createCommentVNode("v-if", true)], 38)), [[
  23810. unref(ClickOutside),
  23811. handleClickOutside,
  23812. contentRef.value
  23813. ]])]),
  23814. content: withCtx(() => [
  23815. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  23816. key: 0,
  23817. class: normalizeClass(unref(nsCascader).e("header")),
  23818. onClick: _cache[11] || (_cache[11] = withModifiers(() => {}, ["stop"]))
  23819. }, [renderSlot(_ctx.$slots, "header")], 2)) : createCommentVNode("v-if", true),
  23820. withDirectives(createVNode(unref(ElCascaderPanel), {
  23821. ref_key: "cascaderPanelRef",
  23822. ref: cascaderPanelRef,
  23823. modelValue: checkedValue.value,
  23824. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => checkedValue.value = $event),
  23825. options: __props.options,
  23826. props: props.props,
  23827. border: false,
  23828. "render-label": _ctx.$slots.default,
  23829. "virtual-scroll": __props.virtualScroll,
  23830. "item-size": __props.itemSize,
  23831. height: __props.height,
  23832. onExpandChange: handleExpandChange,
  23833. onClose: _cache[13] || (_cache[13] = ($event) => _ctx.$nextTick(() => togglePopperVisible(false)))
  23834. }, {
  23835. empty: withCtx(() => [renderSlot(_ctx.$slots, "empty")]),
  23836. _: 3
  23837. }, 8, [
  23838. "modelValue",
  23839. "options",
  23840. "props",
  23841. "render-label",
  23842. "virtual-scroll",
  23843. "item-size",
  23844. "height"
  23845. ]), [[vShow, !filtering.value]]),
  23846. __props.filterable ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [!__props.virtualScroll ? withDirectives((openBlock(), createBlock(unref(ElScrollbar), {
  23847. key: 0,
  23848. ref: (ref) => suggestionPanel.value = ref?.$el,
  23849. tag: "ul",
  23850. class: normalizeClass(unref(nsCascader).e("suggestion-panel")),
  23851. "wrap-class": unref(nsCascader).e("suggestion-wrap"),
  23852. "view-class": unref(nsCascader).e("suggestion-list"),
  23853. onKeydown: handleSuggestionKeyDown
  23854. }, {
  23855. default: withCtx(() => [suggestions.value.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(suggestions.value, (item) => {
  23856. return openBlock(), createElementBlock("li", {
  23857. key: item.uid,
  23858. class: normalizeClass([unref(nsCascader).e("suggestion-item"), unref(nsCascader).is("checked", item.checked)]),
  23859. tabindex: -1,
  23860. onClick: ($event) => handleSuggestionClick(item)
  23861. }, [renderSlot(_ctx.$slots, "suggestion-item", { item }, () => [createElementVNode("span", null, toDisplayString(item.text), 1), item.checked ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  23862. default: withCtx(() => [createVNode(unref(check_default))]),
  23863. _: 1
  23864. })) : createCommentVNode("v-if", true)])], 10, _hoisted_2$35);
  23865. }), 128)) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [createElementVNode("li", { class: normalizeClass(unref(nsCascader).e("empty-text")) }, toDisplayString(unref(t)("el.cascader.noMatch")), 3)])]),
  23866. _: 3
  23867. }, 8, [
  23868. "class",
  23869. "wrap-class",
  23870. "view-class"
  23871. ])), [[vShow, filtering.value]]) : withDirectives((openBlock(), createElementBlock("div", {
  23872. key: 1,
  23873. ref_key: "suggestionPanel",
  23874. ref: suggestionPanel,
  23875. class: normalizeClass(unref(nsCascader).e("suggestion-panel")),
  23876. onKeydown: handleSuggestionKeyDown
  23877. }, [withDirectives(createVNode(unref(FixedSizeList), {
  23878. ref_key: "suggestionVirtualListRef",
  23879. ref: suggestionVirtualListRef,
  23880. height: clampedSuggestionListHeight.value,
  23881. "item-size": __props.itemSize,
  23882. data: suggestions.value,
  23883. total: suggestions.value.length,
  23884. "class-name": unref(nsCascader).e("suggestion-list"),
  23885. "inner-element": "ul",
  23886. "inner-width": suggestionListWidth.value
  23887. }, {
  23888. default: withCtx(({ data, index, style }) => [(openBlock(), createElementBlock("li", {
  23889. id: `suggestion-${data[index].uid}`,
  23890. key: data[index].uid,
  23891. "data-suggestion-index": index,
  23892. class: normalizeClass([unref(nsCascader).e("suggestion-item"), unref(nsCascader).is("checked", data[index].checked)]),
  23893. tabindex: -1,
  23894. style: normalizeStyle(style),
  23895. onClick: ($event) => handleSuggestionClick(data[index])
  23896. }, [renderSlot(_ctx.$slots, "suggestion-item", { item: data[index] }, () => [createElementVNode("span", null, toDisplayString(data[index].text), 1), data[index].checked ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  23897. default: withCtx(() => [createVNode(unref(check_default))]),
  23898. _: 1
  23899. })) : createCommentVNode("v-if", true)])], 14, _hoisted_3$16))]),
  23900. _: 3
  23901. }, 8, [
  23902. "height",
  23903. "item-size",
  23904. "data",
  23905. "total",
  23906. "class-name",
  23907. "inner-width"
  23908. ]), [[vShow, suggestions.value.length]]), !suggestions.value.length ? renderSlot(_ctx.$slots, "empty", { key: 0 }, () => [createElementVNode("ul", { class: normalizeClass(unref(nsCascader).e("suggestion-list")) }, [createElementVNode("li", { class: normalizeClass(unref(nsCascader).e("empty-text")) }, toDisplayString(unref(t)("el.cascader.noMatch")), 3)], 2)]) : createCommentVNode("v-if", true)], 34)), [[vShow, filtering.value]])], 64)) : createCommentVNode("v-if", true),
  23909. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  23910. key: 2,
  23911. class: normalizeClass(unref(nsCascader).e("footer")),
  23912. onClick: _cache[14] || (_cache[14] = withModifiers(() => {}, ["stop"]))
  23913. }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true)
  23914. ]),
  23915. _: 3
  23916. }, 8, [
  23917. "visible",
  23918. "teleported",
  23919. "popper-class",
  23920. "popper-style",
  23921. "fallback-placements",
  23922. "placement",
  23923. "transition",
  23924. "effect",
  23925. "persistent"
  23926. ]);
  23927. };
  23928. }
  23929. });
  23930. //#endregion
  23931. //#region ../../packages/components/cascader/src/cascader.vue
  23932. var cascader_default = cascader_vue_vue_type_script_setup_true_lang_default;
  23933. //#endregion
  23934. //#region ../../packages/components/cascader/index.ts
  23935. const ElCascader = withInstall(cascader_default);
  23936. //#endregion
  23937. //#region ../../packages/components/check-tag/src/check-tag.ts
  23938. const checkTagProps = buildProps({
  23939. checked: Boolean,
  23940. disabled: Boolean,
  23941. type: {
  23942. type: String,
  23943. values: [
  23944. "primary",
  23945. "success",
  23946. "info",
  23947. "warning",
  23948. "danger"
  23949. ],
  23950. default: "primary"
  23951. }
  23952. });
  23953. const checkTagEmits = {
  23954. "update:checked": (value) => isBoolean(value),
  23955. [CHANGE_EVENT]: (value) => isBoolean(value)
  23956. };
  23957. //#endregion
  23958. //#region ../../packages/components/check-tag/src/check-tag.vue?vue&type=script&setup=true&lang.ts
  23959. var check_tag_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  23960. name: "ElCheckTag",
  23961. __name: "check-tag",
  23962. props: checkTagProps,
  23963. emits: checkTagEmits,
  23964. setup(__props, { emit: __emit }) {
  23965. const props = __props;
  23966. const emit = __emit;
  23967. const ns = useNamespace("check-tag");
  23968. const containerKls = computed(() => [
  23969. ns.b(),
  23970. ns.is("checked", props.checked),
  23971. ns.is("disabled", props.disabled),
  23972. ns.m(props.type || "primary")
  23973. ]);
  23974. const handleChange = () => {
  23975. if (props.disabled) return;
  23976. const checked = !props.checked;
  23977. emit(CHANGE_EVENT, checked);
  23978. emit("update:checked", checked);
  23979. };
  23980. return (_ctx, _cache) => {
  23981. return openBlock(), createElementBlock("span", {
  23982. class: normalizeClass(containerKls.value),
  23983. onClick: handleChange
  23984. }, [renderSlot(_ctx.$slots, "default")], 2);
  23985. };
  23986. }
  23987. });
  23988. //#endregion
  23989. //#region ../../packages/components/check-tag/src/check-tag.vue
  23990. var check_tag_default = check_tag_vue_vue_type_script_setup_true_lang_default;
  23991. //#endregion
  23992. //#region ../../packages/components/check-tag/index.ts
  23993. const ElCheckTag = withInstall(check_tag_default);
  23994. //#endregion
  23995. //#region ../../packages/components/col/src/col.ts
  23996. const colProps = buildProps({
  23997. tag: {
  23998. type: String,
  23999. default: "div"
  24000. },
  24001. span: {
  24002. type: Number,
  24003. default: 24
  24004. },
  24005. offset: {
  24006. type: Number,
  24007. default: 0
  24008. },
  24009. pull: {
  24010. type: Number,
  24011. default: 0
  24012. },
  24013. push: {
  24014. type: Number,
  24015. default: 0
  24016. },
  24017. xs: {
  24018. type: definePropType([Number, Object]),
  24019. default: () => mutable({})
  24020. },
  24021. sm: {
  24022. type: definePropType([Number, Object]),
  24023. default: () => mutable({})
  24024. },
  24025. md: {
  24026. type: definePropType([Number, Object]),
  24027. default: () => mutable({})
  24028. },
  24029. lg: {
  24030. type: definePropType([Number, Object]),
  24031. default: () => mutable({})
  24032. },
  24033. xl: {
  24034. type: definePropType([Number, Object]),
  24035. default: () => mutable({})
  24036. }
  24037. });
  24038. //#endregion
  24039. //#region ../../packages/components/row/src/row.ts
  24040. const RowJustify = [
  24041. "start",
  24042. "center",
  24043. "end",
  24044. "space-around",
  24045. "space-between",
  24046. "space-evenly"
  24047. ];
  24048. const RowAlign = [
  24049. "top",
  24050. "middle",
  24051. "bottom"
  24052. ];
  24053. const rowProps = buildProps({
  24054. tag: {
  24055. type: String,
  24056. default: "div"
  24057. },
  24058. gutter: {
  24059. type: Number,
  24060. default: 0
  24061. },
  24062. justify: {
  24063. type: String,
  24064. values: RowJustify,
  24065. default: "start"
  24066. },
  24067. align: {
  24068. type: String,
  24069. values: RowAlign
  24070. }
  24071. });
  24072. //#endregion
  24073. //#region ../../packages/components/row/src/constants.ts
  24074. const rowContextKey = Symbol("rowContextKey");
  24075. //#endregion
  24076. //#region ../../packages/components/row/src/row.vue?vue&type=script&setup=true&lang.ts
  24077. var row_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  24078. name: "ElRow",
  24079. __name: "row",
  24080. props: rowProps,
  24081. setup(__props) {
  24082. const props = __props;
  24083. const ns = useNamespace("row");
  24084. provide(rowContextKey, { gutter: computed(() => props.gutter) });
  24085. const style = computed(() => {
  24086. const styles = {};
  24087. if (!props.gutter) return styles;
  24088. styles.marginRight = styles.marginLeft = `-${props.gutter / 2}px`;
  24089. return styles;
  24090. });
  24091. const rowKls = computed(() => [
  24092. ns.b(),
  24093. ns.is(`justify-${props.justify}`, props.justify !== "start"),
  24094. ns.is(`align-${props.align}`, !!props.align)
  24095. ]);
  24096. return (_ctx, _cache) => {
  24097. return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
  24098. class: normalizeClass(rowKls.value),
  24099. style: normalizeStyle(style.value)
  24100. }, {
  24101. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  24102. _: 3
  24103. }, 8, ["class", "style"]);
  24104. };
  24105. }
  24106. });
  24107. //#endregion
  24108. //#region ../../packages/components/row/src/row.vue
  24109. var row_default = row_vue_vue_type_script_setup_true_lang_default;
  24110. //#endregion
  24111. //#region ../../packages/components/row/index.ts
  24112. const ElRow = withInstall(row_default);
  24113. //#endregion
  24114. //#region ../../packages/components/col/src/col.vue?vue&type=script&setup=true&lang.ts
  24115. var col_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  24116. name: "ElCol",
  24117. __name: "col",
  24118. props: colProps,
  24119. setup(__props) {
  24120. const props = __props;
  24121. const { gutter } = inject(rowContextKey, { gutter: computed(() => 0) });
  24122. const ns = useNamespace("col");
  24123. const style = computed(() => {
  24124. const styles = {};
  24125. if (gutter.value) styles.paddingLeft = styles.paddingRight = `${gutter.value / 2}px`;
  24126. return styles;
  24127. });
  24128. const colKls = computed(() => {
  24129. const classes = [];
  24130. [
  24131. "span",
  24132. "offset",
  24133. "pull",
  24134. "push"
  24135. ].forEach((prop) => {
  24136. const size = props[prop];
  24137. if (isNumber(size)) {
  24138. if (prop === "span") classes.push(ns.b(`${props[prop]}`));
  24139. else if (size > 0) classes.push(ns.b(`${prop}-${props[prop]}`));
  24140. }
  24141. });
  24142. [
  24143. "xs",
  24144. "sm",
  24145. "md",
  24146. "lg",
  24147. "xl"
  24148. ].forEach((size) => {
  24149. if (isNumber(props[size])) classes.push(ns.b(`${size}-${props[size]}`));
  24150. else if (isObject$1(props[size])) Object.entries(props[size]).forEach(([prop, sizeProp]) => {
  24151. classes.push(prop !== "span" ? ns.b(`${size}-${prop}-${sizeProp}`) : ns.b(`${size}-${sizeProp}`));
  24152. });
  24153. });
  24154. if (gutter.value) classes.push(ns.is("guttered"));
  24155. return [ns.b(), classes];
  24156. });
  24157. return (_ctx, _cache) => {
  24158. return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
  24159. class: normalizeClass(colKls.value),
  24160. style: normalizeStyle(style.value)
  24161. }, {
  24162. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  24163. _: 3
  24164. }, 8, ["class", "style"]);
  24165. };
  24166. }
  24167. });
  24168. //#endregion
  24169. //#region ../../packages/components/col/src/col.vue
  24170. var col_default = col_vue_vue_type_script_setup_true_lang_default;
  24171. //#endregion
  24172. //#region ../../packages/components/col/index.ts
  24173. const ElCol = withInstall(col_default);
  24174. //#endregion
  24175. //#region ../../packages/components/collapse/src/collapse.ts
  24176. const emitChangeFn = (value) => isNumber(value) || isString(value) || isArray$1(value);
  24177. const collapseProps = buildProps({
  24178. accordion: Boolean,
  24179. modelValue: {
  24180. type: definePropType([
  24181. Array,
  24182. String,
  24183. Number
  24184. ]),
  24185. default: () => mutable([])
  24186. },
  24187. expandIconPosition: {
  24188. type: definePropType([String]),
  24189. default: "right"
  24190. },
  24191. beforeCollapse: { type: definePropType(Function) }
  24192. });
  24193. const collapseEmits = {
  24194. [UPDATE_MODEL_EVENT]: emitChangeFn,
  24195. [CHANGE_EVENT]: emitChangeFn
  24196. };
  24197. //#endregion
  24198. //#region ../../packages/components/collapse/src/constants.ts
  24199. const collapseContextKey = Symbol("collapseContextKey");
  24200. //#endregion
  24201. //#region ../../packages/components/collapse/src/use-collapse.ts
  24202. const SCOPE$4 = "ElCollapse";
  24203. const useCollapse = (props, emit) => {
  24204. const activeNames = ref(castArray$1(props.modelValue));
  24205. const setActiveNames = (_activeNames) => {
  24206. activeNames.value = _activeNames;
  24207. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  24208. emit(UPDATE_MODEL_EVENT, value);
  24209. emit(CHANGE_EVENT, value);
  24210. };
  24211. const handleChange = (name) => {
  24212. if (props.accordion) setActiveNames([activeNames.value[0] === name ? "" : name]);
  24213. else {
  24214. const _activeNames = [...activeNames.value];
  24215. const index = _activeNames.indexOf(name);
  24216. if (index > -1) _activeNames.splice(index, 1);
  24217. else _activeNames.push(name);
  24218. setActiveNames(_activeNames);
  24219. }
  24220. };
  24221. const handleItemClick = async (name) => {
  24222. const { beforeCollapse } = props;
  24223. if (!beforeCollapse) {
  24224. handleChange(name);
  24225. return;
  24226. }
  24227. const shouldChange = beforeCollapse(name);
  24228. if (![isPromise(shouldChange), isBoolean(shouldChange)].includes(true)) throwError(SCOPE$4, "beforeCollapse must return type `Promise<boolean>` or `boolean`");
  24229. if (isPromise(shouldChange)) shouldChange.then((result) => {
  24230. if (result !== false) handleChange(name);
  24231. }).catch((e) => {
  24232. /* @__PURE__ */ debugWarn(SCOPE$4, `some error occurred: ${e}`);
  24233. });
  24234. else if (shouldChange) handleChange(name);
  24235. };
  24236. watch(() => props.modelValue, () => activeNames.value = castArray$1(props.modelValue), { deep: true });
  24237. provide(collapseContextKey, {
  24238. activeNames,
  24239. handleItemClick
  24240. });
  24241. return {
  24242. activeNames,
  24243. setActiveNames
  24244. };
  24245. };
  24246. const useCollapseDOM = (props) => {
  24247. const ns = useNamespace("collapse");
  24248. return { rootKls: computed(() => [ns.b(), ns.b(`icon-position-${props.expandIconPosition}`)]) };
  24249. };
  24250. //#endregion
  24251. //#region ../../packages/components/collapse/src/collapse.vue?vue&type=script&setup=true&lang.ts
  24252. var collapse_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  24253. name: "ElCollapse",
  24254. __name: "collapse",
  24255. props: collapseProps,
  24256. emits: collapseEmits,
  24257. setup(__props, { expose: __expose, emit: __emit }) {
  24258. const props = __props;
  24259. const { activeNames, setActiveNames } = useCollapse(props, __emit);
  24260. const { rootKls } = useCollapseDOM(props);
  24261. __expose({
  24262. activeNames,
  24263. setActiveNames
  24264. });
  24265. return (_ctx, _cache) => {
  24266. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(rootKls)) }, [renderSlot(_ctx.$slots, "default")], 2);
  24267. };
  24268. }
  24269. });
  24270. //#endregion
  24271. //#region ../../packages/components/collapse/src/collapse.vue
  24272. var collapse_default = collapse_vue_vue_type_script_setup_true_lang_default;
  24273. //#endregion
  24274. //#region ../../packages/components/collapse/src/collapse-item.ts
  24275. const collapseItemProps = buildProps({
  24276. title: {
  24277. type: String,
  24278. default: ""
  24279. },
  24280. name: {
  24281. type: definePropType([String, Number]),
  24282. default: void 0
  24283. },
  24284. icon: {
  24285. type: iconPropType,
  24286. default: arrow_right_default
  24287. },
  24288. disabled: Boolean
  24289. });
  24290. //#endregion
  24291. //#region ../../packages/components/collapse-transition/src/collapse-transition.vue?vue&type=script&setup=true&lang.ts
  24292. var collapse_transition_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  24293. name: "ElCollapseTransition",
  24294. __name: "collapse-transition",
  24295. setup(__props) {
  24296. const ns = useNamespace("collapse-transition");
  24297. const reset = (el) => {
  24298. el.style.maxHeight = "";
  24299. el.style.overflow = el.dataset.oldOverflow;
  24300. el.style.paddingTop = el.dataset.oldPaddingTop;
  24301. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  24302. };
  24303. const on = {
  24304. beforeEnter(el) {
  24305. if (!el.dataset) el.dataset = {};
  24306. el.dataset.oldPaddingTop = el.style.paddingTop;
  24307. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  24308. if (el.style.height) el.dataset.elExistsHeight = el.style.height;
  24309. el.style.maxHeight = 0;
  24310. el.style.paddingTop = 0;
  24311. el.style.paddingBottom = 0;
  24312. },
  24313. enter(el) {
  24314. requestAnimationFrame(() => {
  24315. el.dataset.oldOverflow = el.style.overflow;
  24316. if (el.dataset.elExistsHeight) el.style.maxHeight = el.dataset.elExistsHeight;
  24317. else if (el.scrollHeight !== 0) el.style.maxHeight = `${el.scrollHeight}px`;
  24318. else el.style.maxHeight = 0;
  24319. el.style.paddingTop = el.dataset.oldPaddingTop;
  24320. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  24321. el.style.overflow = "hidden";
  24322. });
  24323. },
  24324. afterEnter(el) {
  24325. el.style.maxHeight = "";
  24326. el.style.overflow = el.dataset.oldOverflow;
  24327. },
  24328. enterCancelled(el) {
  24329. reset(el);
  24330. },
  24331. beforeLeave(el) {
  24332. if (!el.dataset) el.dataset = {};
  24333. el.dataset.oldPaddingTop = el.style.paddingTop;
  24334. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  24335. el.dataset.oldOverflow = el.style.overflow;
  24336. el.style.maxHeight = `${el.scrollHeight}px`;
  24337. el.style.overflow = "hidden";
  24338. },
  24339. leave(el) {
  24340. if (el.scrollHeight !== 0) {
  24341. el.style.maxHeight = 0;
  24342. el.style.paddingTop = 0;
  24343. el.style.paddingBottom = 0;
  24344. }
  24345. },
  24346. afterLeave(el) {
  24347. reset(el);
  24348. },
  24349. leaveCancelled(el) {
  24350. reset(el);
  24351. }
  24352. };
  24353. return (_ctx, _cache) => {
  24354. return openBlock(), createBlock(Transition, mergeProps({ name: unref(ns).b() }, toHandlers(on)), {
  24355. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  24356. _: 3
  24357. }, 16, ["name"]);
  24358. };
  24359. }
  24360. });
  24361. //#endregion
  24362. //#region ../../packages/components/collapse-transition/src/collapse-transition.vue
  24363. var collapse_transition_default = collapse_transition_vue_vue_type_script_setup_true_lang_default;
  24364. //#endregion
  24365. //#region ../../packages/components/collapse-transition/index.ts
  24366. const ElCollapseTransition = withInstall(collapse_transition_default);
  24367. //#endregion
  24368. //#region ../../packages/components/collapse/src/use-collapse-item.ts
  24369. const useCollapseItem = (props) => {
  24370. const collapse = inject(collapseContextKey);
  24371. const { namespace } = useNamespace("collapse");
  24372. const focusing = ref(false);
  24373. const isClick = ref(false);
  24374. const idInjection = useIdInjection();
  24375. const id = computed(() => idInjection.current++);
  24376. const name = computed(() => {
  24377. return props.name ?? `${namespace.value}-id-${idInjection.prefix}-${unref(id)}`;
  24378. });
  24379. const isActive = computed(() => collapse?.activeNames.value.includes(unref(name)));
  24380. const handleFocus = () => {
  24381. setTimeout(() => {
  24382. if (!isClick.value) focusing.value = true;
  24383. else isClick.value = false;
  24384. }, 50);
  24385. };
  24386. const handleHeaderClick = (e) => {
  24387. if (props.disabled) return;
  24388. if (e.target?.closest("input, textarea, select")) return;
  24389. collapse?.handleItemClick(unref(name));
  24390. focusing.value = false;
  24391. isClick.value = true;
  24392. };
  24393. const handleEnterClick = (e) => {
  24394. if (e.target?.closest("input, textarea, select")) return;
  24395. e.preventDefault();
  24396. collapse?.handleItemClick(unref(name));
  24397. };
  24398. return {
  24399. focusing,
  24400. id,
  24401. isActive,
  24402. handleFocus,
  24403. handleHeaderClick,
  24404. handleEnterClick
  24405. };
  24406. };
  24407. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  24408. const ns = useNamespace("collapse");
  24409. const rootKls = computed(() => [
  24410. ns.b("item"),
  24411. ns.is("active", unref(isActive)),
  24412. ns.is("disabled", props.disabled)
  24413. ]);
  24414. const headKls = computed(() => [
  24415. ns.be("item", "header"),
  24416. ns.is("active", unref(isActive)),
  24417. { focusing: unref(focusing) && !props.disabled }
  24418. ]);
  24419. const arrowKls = computed(() => [ns.be("item", "arrow"), ns.is("active", unref(isActive))]);
  24420. return {
  24421. itemTitleKls: computed(() => [ns.be("item", "title")]),
  24422. arrowKls,
  24423. headKls,
  24424. rootKls,
  24425. itemWrapperKls: computed(() => ns.be("item", "wrap")),
  24426. itemContentKls: computed(() => ns.be("item", "content")),
  24427. scopedContentId: computed(() => ns.b(`content-${unref(id)}`)),
  24428. scopedHeadId: computed(() => ns.b(`head-${unref(id)}`))
  24429. };
  24430. };
  24431. //#endregion
  24432. //#region ../../packages/components/collapse/src/collapse-item.vue?vue&type=script&setup=true&lang.ts
  24433. const _hoisted_1$57 = [
  24434. "id",
  24435. "aria-expanded",
  24436. "aria-controls",
  24437. "aria-describedby",
  24438. "tabindex",
  24439. "aria-disabled"
  24440. ];
  24441. const _hoisted_2$34 = [
  24442. "id",
  24443. "aria-hidden",
  24444. "aria-labelledby"
  24445. ];
  24446. var collapse_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  24447. name: "ElCollapseItem",
  24448. __name: "collapse-item",
  24449. props: collapseItemProps,
  24450. setup(__props, { expose: __expose }) {
  24451. const props = __props;
  24452. const { focusing, id, isActive, handleFocus, handleHeaderClick, handleEnterClick } = useCollapseItem(props);
  24453. const { arrowKls, headKls, rootKls, itemTitleKls, itemWrapperKls, itemContentKls, scopedContentId, scopedHeadId } = useCollapseItemDOM(props, {
  24454. focusing,
  24455. isActive,
  24456. id
  24457. });
  24458. __expose({ isActive });
  24459. return (_ctx, _cache) => {
  24460. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(rootKls)) }, [createElementVNode("div", {
  24461. id: unref(scopedHeadId),
  24462. class: normalizeClass(unref(headKls)),
  24463. "aria-expanded": unref(isActive),
  24464. "aria-controls": unref(scopedContentId),
  24465. "aria-describedby": unref(scopedContentId),
  24466. tabindex: __props.disabled ? void 0 : 0,
  24467. "aria-disabled": __props.disabled,
  24468. role: "button",
  24469. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleHeaderClick) && unref(handleHeaderClick)(...args)),
  24470. onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers((...args) => unref(handleEnterClick) && unref(handleEnterClick)(...args), ["stop"]), ["space", "enter"])),
  24471. onFocus: _cache[2] || (_cache[2] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
  24472. onBlur: _cache[3] || (_cache[3] = ($event) => focusing.value = false)
  24473. }, [createElementVNode("span", { class: normalizeClass(unref(itemTitleKls)) }, [renderSlot(_ctx.$slots, "title", { isActive: unref(isActive) }, () => [createTextVNode(toDisplayString(__props.title), 1)])], 2), renderSlot(_ctx.$slots, "icon", { isActive: unref(isActive) }, () => [createVNode(unref(ElIcon), { class: normalizeClass(unref(arrowKls)) }, {
  24474. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
  24475. _: 1
  24476. }, 8, ["class"])])], 42, _hoisted_1$57), createVNode(unref(ElCollapseTransition), null, {
  24477. default: withCtx(() => [withDirectives(createElementVNode("div", {
  24478. id: unref(scopedContentId),
  24479. role: "region",
  24480. class: normalizeClass(unref(itemWrapperKls)),
  24481. "aria-hidden": !unref(isActive),
  24482. "aria-labelledby": unref(scopedHeadId)
  24483. }, [createElementVNode("div", { class: normalizeClass(unref(itemContentKls)) }, [renderSlot(_ctx.$slots, "default")], 2)], 10, _hoisted_2$34), [[vShow, unref(isActive)]])]),
  24484. _: 3
  24485. })], 2);
  24486. };
  24487. }
  24488. });
  24489. //#endregion
  24490. //#region ../../packages/components/collapse/src/collapse-item.vue
  24491. var collapse_item_default = collapse_item_vue_vue_type_script_setup_true_lang_default;
  24492. //#endregion
  24493. //#region ../../packages/components/collapse/index.ts
  24494. const ElCollapse = withInstall(collapse_default, { CollapseItem: collapse_item_default });
  24495. const ElCollapseItem = withNoopInstall(collapse_item_default);
  24496. //#endregion
  24497. //#region ../../packages/components/color-picker-panel/src/color-picker-panel.ts
  24498. const colorPickerPanelProps = buildProps({
  24499. modelValue: {
  24500. type: definePropType(String),
  24501. default: void 0
  24502. },
  24503. border: {
  24504. type: Boolean,
  24505. default: true
  24506. },
  24507. showAlpha: Boolean,
  24508. colorFormat: { type: definePropType(String) },
  24509. disabled: Boolean,
  24510. predefine: { type: definePropType(Array) },
  24511. validateEvent: {
  24512. type: Boolean,
  24513. default: true
  24514. },
  24515. hueSliderClass: { type: definePropType([
  24516. String,
  24517. Array,
  24518. Object
  24519. ]) },
  24520. hueSliderStyle: {
  24521. type: definePropType([
  24522. String,
  24523. Array,
  24524. Object,
  24525. Boolean
  24526. ]),
  24527. default: void 0
  24528. }
  24529. });
  24530. const colorPickerPanelEmits = { [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNil(val) };
  24531. const ROOT_COMMON_COLOR_INJECTION_KEY = Symbol("colorCommonPickerKey");
  24532. const colorPickerPanelContextKey = Symbol("colorPickerPanelContextKey");
  24533. //#endregion
  24534. //#region ../../packages/components/color-picker-panel/src/props/slider.ts
  24535. const alphaSliderProps = buildProps({
  24536. color: {
  24537. type: definePropType(Object),
  24538. required: true
  24539. },
  24540. vertical: Boolean,
  24541. disabled: Boolean
  24542. });
  24543. const hueSliderProps = alphaSliderProps;
  24544. //#endregion
  24545. //#region ../../packages/components/color-picker-panel/src/utils/draggable.ts
  24546. let isDragging = false;
  24547. function draggable(element, options) {
  24548. if (!isClient) return;
  24549. const moveFn = function(event) {
  24550. options.drag?.(event);
  24551. };
  24552. const upFn = function(event) {
  24553. document.removeEventListener("mousemove", moveFn);
  24554. document.removeEventListener("mouseup", upFn);
  24555. document.removeEventListener("touchmove", moveFn);
  24556. document.removeEventListener("touchend", upFn);
  24557. document.onselectstart = null;
  24558. document.ondragstart = null;
  24559. isDragging = false;
  24560. options.end?.(event);
  24561. };
  24562. const downFn = function(event) {
  24563. if (isDragging) return;
  24564. document.onselectstart = () => false;
  24565. document.ondragstart = () => false;
  24566. document.addEventListener("mousemove", moveFn);
  24567. document.addEventListener("mouseup", upFn);
  24568. document.addEventListener("touchmove", moveFn);
  24569. document.addEventListener("touchend", upFn);
  24570. isDragging = true;
  24571. options.start?.(event);
  24572. };
  24573. element.addEventListener("mousedown", downFn);
  24574. element.addEventListener("touchstart", downFn, { passive: false });
  24575. }
  24576. //#endregion
  24577. //#region ../../packages/components/color-picker-panel/src/composables/use-slider.ts
  24578. const useSlider = (props, { key, minValue, maxValue }) => {
  24579. const instance = getCurrentInstance();
  24580. const thumb = shallowRef();
  24581. const bar = shallowRef();
  24582. const currentValue = computed(() => props.color.get(key));
  24583. function handleClick(event) {
  24584. if (props.disabled) return;
  24585. if (event.target !== thumb.value) handleDrag(event);
  24586. thumb.value?.focus();
  24587. }
  24588. function handleDrag(event) {
  24589. if (!bar.value || !thumb.value || props.disabled) return;
  24590. const rect = instance.vnode.el.getBoundingClientRect();
  24591. const { clientX, clientY } = getClientXY(event);
  24592. let value;
  24593. if (!props.vertical) {
  24594. let left = clientX - rect.left;
  24595. left = Math.max(thumb.value.offsetWidth / 2, left);
  24596. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  24597. value = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * maxValue);
  24598. } else {
  24599. let top = clientY - rect.top;
  24600. top = Math.max(thumb.value.offsetHeight / 2, top);
  24601. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  24602. value = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * maxValue);
  24603. }
  24604. props.color.set(key, value);
  24605. }
  24606. function handleKeydown(event) {
  24607. if (props.disabled) return;
  24608. const { shiftKey } = event;
  24609. const code = getEventCode(event);
  24610. const step = shiftKey ? 10 : 1;
  24611. const reverse = key === "hue" ? -1 : 1;
  24612. let isPreventDefault = true;
  24613. switch (code) {
  24614. case EVENT_CODE.left:
  24615. case EVENT_CODE.down:
  24616. incrementPosition(-step * reverse);
  24617. break;
  24618. case EVENT_CODE.right:
  24619. case EVENT_CODE.up:
  24620. incrementPosition(step * reverse);
  24621. break;
  24622. case EVENT_CODE.home:
  24623. props.color.set(key, key === "hue" ? maxValue : minValue);
  24624. break;
  24625. case EVENT_CODE.end:
  24626. props.color.set(key, key === "hue" ? minValue : maxValue);
  24627. break;
  24628. case EVENT_CODE.pageDown:
  24629. incrementPosition(-4 * reverse);
  24630. break;
  24631. case EVENT_CODE.pageUp:
  24632. incrementPosition(4 * reverse);
  24633. break;
  24634. default:
  24635. isPreventDefault = false;
  24636. break;
  24637. }
  24638. isPreventDefault && event.preventDefault();
  24639. }
  24640. function incrementPosition(step) {
  24641. let next = currentValue.value + step;
  24642. next = next < minValue ? minValue : next > maxValue ? maxValue : next;
  24643. props.color.set(key, next);
  24644. }
  24645. return {
  24646. thumb,
  24647. bar,
  24648. currentValue,
  24649. handleDrag,
  24650. handleClick,
  24651. handleKeydown
  24652. };
  24653. };
  24654. const useSliderDOM = (props, { namespace, maxValue, bar, thumb, currentValue, handleDrag, getBackground }) => {
  24655. const instance = getCurrentInstance();
  24656. const ns = useNamespace(namespace);
  24657. const thumbLeft = ref(0);
  24658. const thumbTop = ref(0);
  24659. const background = ref();
  24660. function getThumbLeft() {
  24661. if (!thumb.value) return 0;
  24662. if (props.vertical) return 0;
  24663. const el = instance.vnode.el;
  24664. const value = currentValue.value;
  24665. if (!el) return 0;
  24666. return Math.round(value * (el.offsetWidth - thumb.value.offsetWidth / 2) / maxValue);
  24667. }
  24668. function getThumbTop() {
  24669. if (!thumb.value) return 0;
  24670. const el = instance.vnode.el;
  24671. if (!props.vertical) return 0;
  24672. const value = currentValue.value;
  24673. if (!el) return 0;
  24674. return Math.round(value * (el.offsetHeight - thumb.value.offsetHeight / 2) / maxValue);
  24675. }
  24676. function update() {
  24677. thumbLeft.value = getThumbLeft();
  24678. thumbTop.value = getThumbTop();
  24679. background.value = getBackground?.();
  24680. }
  24681. onMounted(() => {
  24682. if (!bar.value || !thumb.value) return;
  24683. const dragConfig = {
  24684. drag: (event) => {
  24685. handleDrag(event);
  24686. },
  24687. end: (event) => {
  24688. handleDrag(event);
  24689. }
  24690. };
  24691. draggable(bar.value, dragConfig);
  24692. draggable(thumb.value, dragConfig);
  24693. update();
  24694. });
  24695. watch(currentValue, () => update());
  24696. watch(() => props.color.value, () => update());
  24697. const rootKls = computed(() => [
  24698. ns.b(),
  24699. ns.is("vertical", props.vertical),
  24700. ns.is("disabled", props.disabled)
  24701. ]);
  24702. const barKls = computed(() => ns.e("bar"));
  24703. const thumbKls = computed(() => ns.e("thumb"));
  24704. return {
  24705. rootKls,
  24706. barKls,
  24707. barStyle: computed(() => ({ background: background.value })),
  24708. thumbKls,
  24709. thumbStyle: computed(() => ({
  24710. left: addUnit(thumbLeft.value),
  24711. top: addUnit(thumbTop.value)
  24712. })),
  24713. thumbLeft,
  24714. thumbTop,
  24715. update
  24716. };
  24717. };
  24718. //#endregion
  24719. //#region ../../packages/components/color-picker-panel/src/components/alpha-slider.vue?vue&type=script&setup=true&lang.ts
  24720. const _hoisted_1$56 = [
  24721. "aria-label",
  24722. "aria-valuenow",
  24723. "aria-valuetext",
  24724. "aria-orientation",
  24725. "tabindex",
  24726. "aria-disabled"
  24727. ];
  24728. const minValue$1 = 0;
  24729. const maxValue$1 = 100;
  24730. var alpha_slider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  24731. name: "ElColorAlphaSlider",
  24732. __name: "alpha-slider",
  24733. props: alphaSliderProps,
  24734. setup(__props, { expose: __expose }) {
  24735. const props = __props;
  24736. const { currentValue, bar, thumb, handleDrag, handleClick, handleKeydown } = useSlider(props, {
  24737. key: "alpha",
  24738. minValue: minValue$1,
  24739. maxValue: maxValue$1
  24740. });
  24741. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useSliderDOM(props, {
  24742. namespace: "color-alpha-slider",
  24743. maxValue: maxValue$1,
  24744. currentValue,
  24745. bar,
  24746. thumb,
  24747. handleDrag,
  24748. getBackground
  24749. });
  24750. const { t } = useLocale();
  24751. const ariaLabel = computed(() => t("el.colorpicker.alphaLabel"));
  24752. const ariaValuetext = computed(() => {
  24753. return t("el.colorpicker.alphaDescription", {
  24754. alpha: currentValue.value,
  24755. color: props.color.value
  24756. });
  24757. });
  24758. function getBackground() {
  24759. if (props.color && props.color.value) {
  24760. const { r, g, b } = props.color.toRgb();
  24761. return `linear-gradient(to right, rgba(${r}, ${g}, ${b}, 0) 0%, rgba(${r}, ${g}, ${b}, 1) 100%)`;
  24762. }
  24763. return "";
  24764. }
  24765. __expose({
  24766. update,
  24767. bar,
  24768. thumb
  24769. });
  24770. return (_ctx, _cache) => {
  24771. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(rootKls)) }, [createElementVNode("div", {
  24772. ref_key: "bar",
  24773. ref: bar,
  24774. class: normalizeClass(unref(barKls)),
  24775. style: normalizeStyle(unref(barStyle)),
  24776. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args))
  24777. }, null, 6), createElementVNode("div", {
  24778. ref_key: "thumb",
  24779. ref: thumb,
  24780. class: normalizeClass(unref(thumbKls)),
  24781. style: normalizeStyle(unref(thumbStyle)),
  24782. "aria-label": ariaLabel.value,
  24783. "aria-valuenow": unref(currentValue),
  24784. "aria-valuetext": ariaValuetext.value,
  24785. "aria-orientation": __props.vertical ? "vertical" : "horizontal",
  24786. "aria-valuemin": minValue$1,
  24787. "aria-valuemax": maxValue$1,
  24788. role: "slider",
  24789. tabindex: __props.disabled ? void 0 : 0,
  24790. "aria-disabled": __props.disabled,
  24791. onKeydown: _cache[1] || (_cache[1] = (...args) => unref(handleKeydown) && unref(handleKeydown)(...args))
  24792. }, null, 46, _hoisted_1$56)], 2);
  24793. };
  24794. }
  24795. });
  24796. //#endregion
  24797. //#region ../../packages/components/color-picker-panel/src/components/alpha-slider.vue
  24798. var alpha_slider_default = alpha_slider_vue_vue_type_script_setup_true_lang_default;
  24799. //#endregion
  24800. //#region ../../packages/components/color-picker-panel/src/components/hue-slider.vue?vue&type=script&setup=true&lang.ts
  24801. const _hoisted_1$55 = [
  24802. "aria-label",
  24803. "aria-valuenow",
  24804. "aria-valuetext",
  24805. "aria-orientation",
  24806. "tabindex",
  24807. "aria-disabled"
  24808. ];
  24809. const minValue = 0;
  24810. const maxValue = 360;
  24811. var hue_slider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  24812. name: "ElColorHueSlider",
  24813. __name: "hue-slider",
  24814. props: hueSliderProps,
  24815. setup(__props, { expose: __expose }) {
  24816. const props = __props;
  24817. const { currentValue, bar, thumb, handleDrag, handleClick, handleKeydown } = useSlider(props, {
  24818. key: "hue",
  24819. minValue,
  24820. maxValue
  24821. });
  24822. const { rootKls, barKls, thumbKls, thumbStyle, thumbTop, update } = useSliderDOM(props, {
  24823. namespace: "color-hue-slider",
  24824. maxValue,
  24825. currentValue,
  24826. bar,
  24827. thumb,
  24828. handleDrag
  24829. });
  24830. const { t } = useLocale();
  24831. const ariaLabel = computed(() => t("el.colorpicker.hueLabel"));
  24832. const ariaValuetext = computed(() => {
  24833. return t("el.colorpicker.hueDescription", {
  24834. hue: currentValue.value,
  24835. color: props.color.value
  24836. });
  24837. });
  24838. __expose({
  24839. bar,
  24840. thumb,
  24841. thumbTop,
  24842. update
  24843. });
  24844. return (_ctx, _cache) => {
  24845. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(rootKls)) }, [createElementVNode("div", {
  24846. ref_key: "bar",
  24847. ref: bar,
  24848. class: normalizeClass(unref(barKls)),
  24849. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args))
  24850. }, null, 2), createElementVNode("div", {
  24851. ref_key: "thumb",
  24852. ref: thumb,
  24853. class: normalizeClass(unref(thumbKls)),
  24854. style: normalizeStyle(unref(thumbStyle)),
  24855. "aria-label": ariaLabel.value,
  24856. "aria-valuenow": unref(currentValue),
  24857. "aria-valuetext": ariaValuetext.value,
  24858. "aria-orientation": __props.vertical ? "vertical" : "horizontal",
  24859. "aria-valuemin": minValue,
  24860. "aria-valuemax": maxValue,
  24861. role: "slider",
  24862. tabindex: __props.disabled ? void 0 : 0,
  24863. "aria-disabled": __props.disabled,
  24864. onKeydown: _cache[1] || (_cache[1] = (...args) => unref(handleKeydown) && unref(handleKeydown)(...args))
  24865. }, null, 46, _hoisted_1$55)], 2);
  24866. };
  24867. }
  24868. });
  24869. //#endregion
  24870. //#region ../../packages/components/color-picker-panel/src/components/hue-slider.vue
  24871. var hue_slider_default = hue_slider_vue_vue_type_script_setup_true_lang_default;
  24872. //#endregion
  24873. //#region ../../packages/components/color-picker-panel/src/props/predefine.ts
  24874. const predefineProps = buildProps({
  24875. colors: {
  24876. type: definePropType(Array),
  24877. required: true
  24878. },
  24879. color: {
  24880. type: definePropType(Object),
  24881. required: true
  24882. },
  24883. enableAlpha: {
  24884. type: Boolean,
  24885. required: true
  24886. },
  24887. disabled: Boolean
  24888. });
  24889. //#endregion
  24890. //#region ../../packages/components/color-picker-panel/src/utils/color.ts
  24891. var Color = class {
  24892. constructor(options = {}) {
  24893. this._hue = 0;
  24894. this._saturation = 100;
  24895. this._value = 100;
  24896. this._alpha = 100;
  24897. this._tiny = new TinyColor();
  24898. this._isValid = false;
  24899. this.enableAlpha = false;
  24900. this.format = "";
  24901. this.value = "";
  24902. for (const option in options) if (hasOwn(options, option)) this[option] = options[option];
  24903. if (options.value) this.fromString(options.value);
  24904. else this.doOnChange();
  24905. }
  24906. set(prop, value) {
  24907. if (arguments.length === 1 && typeof prop === "object") {
  24908. for (const p in prop) if (hasOwn(prop, p)) this.set(p, prop[p]);
  24909. return;
  24910. }
  24911. this[`_${prop}`] = value;
  24912. this._isValid = true;
  24913. this.doOnChange();
  24914. }
  24915. get(prop) {
  24916. if ([
  24917. "hue",
  24918. "saturation",
  24919. "value",
  24920. "alpha"
  24921. ].includes(prop)) return Math.round(this[`_${prop}`]);
  24922. return this[`_${prop}`];
  24923. }
  24924. toRgb() {
  24925. return this._isValid ? this._tiny.toRgb() : {
  24926. r: 255,
  24927. g: 255,
  24928. b: 255,
  24929. a: 0
  24930. };
  24931. }
  24932. fromString(value) {
  24933. const color = new TinyColor(value);
  24934. this._isValid = color.isValid;
  24935. if (color.isValid) {
  24936. const { h, s, v, a } = color.toHsv();
  24937. this._hue = h;
  24938. this._saturation = s * 100;
  24939. this._value = v * 100;
  24940. this._alpha = a * 100;
  24941. } else {
  24942. this._hue = 0;
  24943. this._saturation = 100;
  24944. this._value = 100;
  24945. this._alpha = 100;
  24946. }
  24947. this.doOnChange();
  24948. }
  24949. clear() {
  24950. this._isValid = false;
  24951. this.value = "";
  24952. this._hue = 0;
  24953. this._saturation = 100;
  24954. this._value = 100;
  24955. this._alpha = 100;
  24956. }
  24957. compare(color) {
  24958. const compareColor = new TinyColor({
  24959. h: color._hue,
  24960. s: color._saturation / 100,
  24961. v: color._value / 100,
  24962. a: color._alpha / 100
  24963. });
  24964. return this._tiny.equals(compareColor);
  24965. }
  24966. doOnChange() {
  24967. const { _hue, _saturation, _value, _alpha, format, enableAlpha } = this;
  24968. let _format = format || (enableAlpha ? "rgb" : "hex");
  24969. if (format === "hex" && enableAlpha) _format = "hex8";
  24970. this._tiny = new TinyColor({
  24971. h: _hue,
  24972. s: _saturation / 100,
  24973. v: _value / 100,
  24974. a: _alpha / 100
  24975. });
  24976. this.value = this._isValid ? this._tiny.toString(_format) : "";
  24977. }
  24978. };
  24979. //#endregion
  24980. //#region ../../packages/components/color-picker-panel/src/composables/use-predefine.ts
  24981. const usePredefine = (props) => {
  24982. const { currentColor } = inject(colorPickerPanelContextKey);
  24983. const rgbaColors = ref(parseColors(props.colors, props.color));
  24984. watch(() => currentColor.value, (val) => {
  24985. const color = new Color({
  24986. value: val,
  24987. enableAlpha: props.enableAlpha
  24988. });
  24989. rgbaColors.value.forEach((item) => {
  24990. item.selected = color.compare(item);
  24991. });
  24992. });
  24993. watchEffect(() => {
  24994. rgbaColors.value = parseColors(props.colors, props.color);
  24995. });
  24996. function handleSelect(index) {
  24997. props.color.fromString(props.colors[index]);
  24998. }
  24999. function parseColors(colors, color) {
  25000. return colors.map((value) => {
  25001. const c = new Color({
  25002. value,
  25003. enableAlpha: props.enableAlpha
  25004. });
  25005. c.selected = c.compare(color);
  25006. return c;
  25007. });
  25008. }
  25009. return {
  25010. rgbaColors,
  25011. handleSelect
  25012. };
  25013. };
  25014. const usePredefineDOM = (props) => {
  25015. const ns = useNamespace("color-predefine");
  25016. const rootKls = computed(() => [ns.b(), ns.is("disabled", props.disabled)]);
  25017. const colorsKls = computed(() => ns.e("colors"));
  25018. function colorSelectorKls(item) {
  25019. return [
  25020. ns.e("color-selector"),
  25021. ns.is("alpha", item.get("alpha") < 100),
  25022. { selected: item.selected }
  25023. ];
  25024. }
  25025. return {
  25026. rootKls,
  25027. colorsKls,
  25028. colorSelectorKls
  25029. };
  25030. };
  25031. //#endregion
  25032. //#region ../../packages/components/color-picker-panel/src/components/predefine.vue?vue&type=script&setup=true&lang.ts
  25033. const _hoisted_1$54 = [
  25034. "disabled",
  25035. "aria-label",
  25036. "onClick"
  25037. ];
  25038. var predefine_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25039. name: "ElColorPredefine",
  25040. __name: "predefine",
  25041. props: predefineProps,
  25042. setup(__props) {
  25043. const props = __props;
  25044. const { rgbaColors, handleSelect } = usePredefine(props);
  25045. const { rootKls, colorsKls, colorSelectorKls } = usePredefineDOM(props);
  25046. const { t } = useLocale();
  25047. const ariaLabel = (value) => {
  25048. return t("el.colorpicker.predefineDescription", { value });
  25049. };
  25050. return (_ctx, _cache) => {
  25051. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(rootKls)) }, [createElementVNode("div", { class: normalizeClass(unref(colorsKls)) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(rgbaColors), (item, index) => {
  25052. return openBlock(), createElementBlock("button", {
  25053. key: __props.colors[index],
  25054. type: "button",
  25055. disabled: __props.disabled,
  25056. "aria-label": ariaLabel(item.value),
  25057. class: normalizeClass(unref(colorSelectorKls)(item)),
  25058. onClick: ($event) => unref(handleSelect)(index)
  25059. }, [createElementVNode("div", { style: normalizeStyle({ backgroundColor: item.value }) }, null, 4)], 10, _hoisted_1$54);
  25060. }), 128))], 2)], 2);
  25061. };
  25062. }
  25063. });
  25064. //#endregion
  25065. //#region ../../packages/components/color-picker-panel/src/components/predefine.vue
  25066. var predefine_default = predefine_vue_vue_type_script_setup_true_lang_default;
  25067. //#endregion
  25068. //#region ../../packages/components/color-picker-panel/src/props/sv-panel.ts
  25069. const svPanelProps = buildProps({
  25070. color: {
  25071. type: definePropType(Object),
  25072. required: true
  25073. },
  25074. disabled: Boolean
  25075. });
  25076. //#endregion
  25077. //#region ../../packages/components/color-picker-panel/src/composables/use-sv-panel.ts
  25078. const useSvPanel = (props) => {
  25079. const instance = getCurrentInstance();
  25080. const cursorRef = ref();
  25081. const cursorTop = ref(0);
  25082. const cursorLeft = ref(0);
  25083. const background = ref("hsl(0, 100%, 50%)");
  25084. const saturation = computed(() => props.color.get("saturation"));
  25085. const brightness = computed(() => props.color.get("value"));
  25086. const hue = computed(() => props.color.get("hue"));
  25087. function handleClick(event) {
  25088. if (props.disabled) return;
  25089. if (event.target !== cursorRef.value) handleDrag(event);
  25090. cursorRef.value?.focus({ preventScroll: true });
  25091. }
  25092. function handleDrag(event) {
  25093. if (props.disabled) return;
  25094. const rect = instance.vnode.el.getBoundingClientRect();
  25095. const { clientX, clientY } = getClientXY(event);
  25096. let left = clientX - rect.left;
  25097. let top = clientY - rect.top;
  25098. left = Math.max(0, left);
  25099. left = Math.min(left, rect.width);
  25100. top = Math.max(0, top);
  25101. top = Math.min(top, rect.height);
  25102. cursorLeft.value = left;
  25103. cursorTop.value = top;
  25104. props.color.set({
  25105. saturation: left / rect.width * 100,
  25106. value: 100 - top / rect.height * 100
  25107. });
  25108. }
  25109. function handleKeydown(event) {
  25110. if (props.disabled) return;
  25111. const { shiftKey } = event;
  25112. const code = getEventCode(event);
  25113. const step = shiftKey ? 10 : 1;
  25114. let isPreventDefault = true;
  25115. switch (code) {
  25116. case EVENT_CODE.left:
  25117. incrementSaturation(-step);
  25118. break;
  25119. case EVENT_CODE.right:
  25120. incrementSaturation(step);
  25121. break;
  25122. case EVENT_CODE.up:
  25123. incrementBrightness(step);
  25124. break;
  25125. case EVENT_CODE.down:
  25126. incrementBrightness(-step);
  25127. break;
  25128. default:
  25129. isPreventDefault = false;
  25130. break;
  25131. }
  25132. isPreventDefault && event.preventDefault();
  25133. }
  25134. function incrementSaturation(step) {
  25135. let next = saturation.value + step;
  25136. next = next < 0 ? 0 : next > 100 ? 100 : next;
  25137. props.color.set("saturation", next);
  25138. }
  25139. function incrementBrightness(step) {
  25140. let next = brightness.value + step;
  25141. next = next < 0 ? 0 : next > 100 ? 100 : next;
  25142. props.color.set("value", next);
  25143. }
  25144. return {
  25145. cursorRef,
  25146. cursorTop,
  25147. cursorLeft,
  25148. background,
  25149. saturation,
  25150. brightness,
  25151. hue,
  25152. handleClick,
  25153. handleDrag,
  25154. handleKeydown
  25155. };
  25156. };
  25157. const useSvPanelDOM = (props, { cursorTop, cursorLeft, background, handleDrag }) => {
  25158. const instance = getCurrentInstance();
  25159. const ns = useNamespace("color-svpanel");
  25160. function update() {
  25161. const saturation = props.color.get("saturation");
  25162. const brightness = props.color.get("value");
  25163. const { clientWidth: width, clientHeight: height } = instance.vnode.el;
  25164. cursorLeft.value = saturation * width / 100;
  25165. cursorTop.value = (100 - brightness) * height / 100;
  25166. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  25167. }
  25168. onMounted(() => {
  25169. draggable(instance.vnode.el, {
  25170. drag: (event) => {
  25171. handleDrag(event);
  25172. },
  25173. end: (event) => {
  25174. handleDrag(event);
  25175. }
  25176. });
  25177. update();
  25178. });
  25179. watch([
  25180. () => props.color.get("hue"),
  25181. () => props.color.get("value"),
  25182. () => props.color.value
  25183. ], () => update());
  25184. return {
  25185. rootKls: computed(() => ns.b()),
  25186. cursorKls: computed(() => ns.e("cursor")),
  25187. rootStyle: computed(() => ({ backgroundColor: background.value })),
  25188. cursorStyle: computed(() => ({
  25189. top: addUnit(cursorTop.value),
  25190. left: addUnit(cursorLeft.value)
  25191. })),
  25192. update
  25193. };
  25194. };
  25195. //#endregion
  25196. //#region ../../packages/components/color-picker-panel/src/components/sv-panel.vue?vue&type=script&setup=true&lang.ts
  25197. const _hoisted_1$53 = [
  25198. "tabindex",
  25199. "aria-disabled",
  25200. "aria-label",
  25201. "aria-valuenow",
  25202. "aria-valuetext"
  25203. ];
  25204. var sv_panel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25205. name: "ElSvPanel",
  25206. __name: "sv-panel",
  25207. props: svPanelProps,
  25208. setup(__props, { expose: __expose }) {
  25209. const props = __props;
  25210. const { cursorRef, cursorTop, cursorLeft, background, saturation, brightness, handleClick, handleDrag, handleKeydown } = useSvPanel(props);
  25211. const { rootKls, cursorKls, rootStyle, cursorStyle, update } = useSvPanelDOM(props, {
  25212. cursorTop,
  25213. cursorLeft,
  25214. background,
  25215. handleDrag
  25216. });
  25217. const { t } = useLocale();
  25218. const ariaLabel = computed(() => t("el.colorpicker.svLabel"));
  25219. const ariaValuetext = computed(() => {
  25220. return t("el.colorpicker.svDescription", {
  25221. saturation: saturation.value,
  25222. brightness: brightness.value,
  25223. color: props.color.value
  25224. });
  25225. });
  25226. __expose({ update });
  25227. return (_ctx, _cache) => {
  25228. return openBlock(), createElementBlock("div", {
  25229. class: normalizeClass(unref(rootKls)),
  25230. style: normalizeStyle(unref(rootStyle)),
  25231. onClick: _cache[1] || (_cache[1] = (...args) => unref(handleClick) && unref(handleClick)(...args))
  25232. }, [createElementVNode("div", {
  25233. ref_key: "cursorRef",
  25234. ref: cursorRef,
  25235. class: normalizeClass(unref(cursorKls)),
  25236. style: normalizeStyle(unref(cursorStyle)),
  25237. tabindex: __props.disabled ? void 0 : 0,
  25238. "aria-disabled": __props.disabled,
  25239. role: "slider",
  25240. "aria-valuemin": "0,0",
  25241. "aria-valuemax": "100,100",
  25242. "aria-label": ariaLabel.value,
  25243. "aria-valuenow": `${unref(saturation)},${unref(brightness)}`,
  25244. "aria-valuetext": ariaValuetext.value,
  25245. onKeydown: _cache[0] || (_cache[0] = (...args) => unref(handleKeydown) && unref(handleKeydown)(...args))
  25246. }, null, 46, _hoisted_1$53)], 6);
  25247. };
  25248. }
  25249. });
  25250. //#endregion
  25251. //#region ../../packages/components/color-picker-panel/src/components/sv-panel.vue
  25252. var sv_panel_default = sv_panel_vue_vue_type_script_setup_true_lang_default;
  25253. //#endregion
  25254. //#region ../../packages/components/color-picker-panel/src/composables/use-common-color.ts
  25255. const useCommonColor = (props, emit) => {
  25256. const color = reactive(new Color({
  25257. enableAlpha: props.showAlpha,
  25258. format: props.colorFormat || "",
  25259. value: props.modelValue
  25260. }));
  25261. watch(() => [props.colorFormat, props.showAlpha], () => {
  25262. color.enableAlpha = props.showAlpha;
  25263. color.format = props.colorFormat || color.format;
  25264. color.doOnChange();
  25265. emit(UPDATE_MODEL_EVENT, color.value);
  25266. });
  25267. return { color };
  25268. };
  25269. //#endregion
  25270. //#region ../../packages/components/color-picker-panel/src/color-picker-panel.vue?vue&type=script&setup=true&lang.ts
  25271. var color_picker_panel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25272. name: "ElColorPickerPanel",
  25273. __name: "color-picker-panel",
  25274. props: colorPickerPanelProps,
  25275. emits: colorPickerPanelEmits,
  25276. setup(__props, { expose: __expose, emit: __emit }) {
  25277. const props = __props;
  25278. const emit = __emit;
  25279. const ns = useNamespace("color-picker-panel");
  25280. const { formItem } = useFormItem();
  25281. const disabled = useFormDisabled();
  25282. const hueRef = ref();
  25283. const svRef = ref();
  25284. const alphaRef = ref();
  25285. const inputRef = ref();
  25286. const customInput = ref("");
  25287. const { color } = inject(ROOT_COMMON_COLOR_INJECTION_KEY, () => useCommonColor(props, emit), true);
  25288. function handleConfirm() {
  25289. color.fromString(customInput.value);
  25290. if (color.value !== customInput.value) customInput.value = color.value;
  25291. }
  25292. function handleFocusout() {
  25293. if (props.validateEvent) formItem?.validate?.("blur").catch(NOOP);
  25294. }
  25295. function update() {
  25296. hueRef.value?.update();
  25297. svRef.value?.update();
  25298. alphaRef.value?.update();
  25299. }
  25300. onMounted(() => {
  25301. if (props.modelValue) customInput.value = color.value;
  25302. nextTick(update);
  25303. });
  25304. watch(() => props.modelValue, (newVal) => {
  25305. if (newVal !== color.value) newVal ? color.fromString(newVal) : color.clear();
  25306. });
  25307. watch(() => color.value, (val) => {
  25308. emit(UPDATE_MODEL_EVENT, val);
  25309. customInput.value = val;
  25310. if (props.validateEvent) formItem?.validate("change").catch(NOOP);
  25311. });
  25312. provide(colorPickerPanelContextKey, { currentColor: computed(() => color.value) });
  25313. __expose({
  25314. color,
  25315. inputRef,
  25316. update
  25317. });
  25318. return (_ctx, _cache) => {
  25319. return openBlock(), createElementBlock("div", {
  25320. class: normalizeClass([
  25321. unref(ns).b(),
  25322. unref(ns).is("disabled", unref(disabled)),
  25323. unref(ns).is("border", __props.border)
  25324. ]),
  25325. onFocusout: handleFocusout
  25326. }, [
  25327. createElementVNode("div", { class: normalizeClass(unref(ns).e("wrapper")) }, [createVNode(hue_slider_default, {
  25328. ref_key: "hueRef",
  25329. ref: hueRef,
  25330. color: unref(color),
  25331. vertical: "",
  25332. disabled: unref(disabled),
  25333. class: normalizeClass(["hue-slider", __props.hueSliderClass]),
  25334. style: normalizeStyle(__props.hueSliderStyle)
  25335. }, null, 8, [
  25336. "color",
  25337. "disabled",
  25338. "class",
  25339. "style"
  25340. ]), createVNode(sv_panel_default, {
  25341. ref_key: "svRef",
  25342. ref: svRef,
  25343. color: unref(color),
  25344. disabled: unref(disabled)
  25345. }, null, 8, ["color", "disabled"])], 2),
  25346. __props.showAlpha ? (openBlock(), createBlock(alpha_slider_default, {
  25347. key: 0,
  25348. ref_key: "alphaRef",
  25349. ref: alphaRef,
  25350. color: unref(color),
  25351. disabled: unref(disabled)
  25352. }, null, 8, ["color", "disabled"])) : createCommentVNode("v-if", true),
  25353. __props.predefine ? (openBlock(), createBlock(predefine_default, {
  25354. key: 1,
  25355. ref: "predefine",
  25356. "enable-alpha": __props.showAlpha,
  25357. color: unref(color),
  25358. colors: __props.predefine,
  25359. disabled: unref(disabled)
  25360. }, null, 8, [
  25361. "enable-alpha",
  25362. "color",
  25363. "colors",
  25364. "disabled"
  25365. ])) : createCommentVNode("v-if", true),
  25366. createElementVNode("div", { class: normalizeClass(unref(ns).e("footer")) }, [createVNode(unref(ElInput), {
  25367. ref_key: "inputRef",
  25368. ref: inputRef,
  25369. modelValue: customInput.value,
  25370. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => customInput.value = $event),
  25371. "validate-event": false,
  25372. size: "small",
  25373. disabled: unref(disabled),
  25374. onChange: handleConfirm
  25375. }, null, 8, ["modelValue", "disabled"]), renderSlot(_ctx.$slots, "footer")], 2)
  25376. ], 34);
  25377. };
  25378. }
  25379. });
  25380. //#endregion
  25381. //#region ../../packages/components/color-picker-panel/src/color-picker-panel.vue
  25382. var color_picker_panel_default = color_picker_panel_vue_vue_type_script_setup_true_lang_default;
  25383. //#endregion
  25384. //#region ../../packages/components/color-picker-panel/index.ts
  25385. const ElColorPickerPanel = withInstall(color_picker_panel_default);
  25386. //#endregion
  25387. //#region ../../packages/components/color-picker/src/color-picker.ts
  25388. const colorPickerProps = buildProps({
  25389. persistent: {
  25390. type: Boolean,
  25391. default: true
  25392. },
  25393. modelValue: {
  25394. type: definePropType(String),
  25395. default: void 0
  25396. },
  25397. id: String,
  25398. showAlpha: Boolean,
  25399. colorFormat: { type: definePropType(String) },
  25400. disabled: {
  25401. type: Boolean,
  25402. default: void 0
  25403. },
  25404. clearable: {
  25405. type: Boolean,
  25406. default: true
  25407. },
  25408. size: useSizeProp,
  25409. popperClass: useTooltipContentProps.popperClass,
  25410. popperStyle: useTooltipContentProps.popperStyle,
  25411. tabindex: {
  25412. type: [String, Number],
  25413. default: 0
  25414. },
  25415. teleported: useTooltipContentProps.teleported,
  25416. appendTo: useTooltipContentProps.appendTo,
  25417. predefine: { type: definePropType(Array) },
  25418. validateEvent: {
  25419. type: Boolean,
  25420. default: true
  25421. },
  25422. ...useEmptyValuesProps,
  25423. ...useAriaProps(["ariaLabel"])
  25424. });
  25425. const colorPickerEmits = {
  25426. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNil(val),
  25427. [CHANGE_EVENT]: (val) => isString(val) || isNil(val),
  25428. activeChange: (val) => isString(val) || isNil(val),
  25429. focus: (evt) => evt instanceof FocusEvent,
  25430. blur: (evt) => evt instanceof FocusEvent,
  25431. clear: () => true
  25432. };
  25433. const colorPickerPropsDefaults = {
  25434. persistent: true,
  25435. modelValue: void 0,
  25436. disabled: void 0,
  25437. clearable: true,
  25438. popperStyle: void 0,
  25439. tabindex: 0,
  25440. teleported: true,
  25441. validateEvent: true,
  25442. valueOnClear: void 0
  25443. };
  25444. //#endregion
  25445. //#region ../../packages/components/color-picker/src/color-picker.vue?vue&type=script&setup=true&lang.ts
  25446. const _hoisted_1$52 = [
  25447. "id",
  25448. "aria-label",
  25449. "aria-labelledby",
  25450. "aria-description",
  25451. "aria-disabled",
  25452. "tabindex"
  25453. ];
  25454. var color_picker_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25455. name: "ElColorPicker",
  25456. __name: "color-picker",
  25457. props: colorPickerProps,
  25458. emits: colorPickerEmits,
  25459. setup(__props, { expose: __expose, emit: __emit }) {
  25460. const props = __props;
  25461. const emit = __emit;
  25462. const { t } = useLocale();
  25463. const ns = useNamespace("color");
  25464. const { formItem } = useFormItem();
  25465. const colorSize = useFormSize();
  25466. const colorDisabled = useFormDisabled();
  25467. const { valueOnClear, isEmptyValue } = useEmptyValues(props, null);
  25468. const commonColor = useCommonColor(props, emit);
  25469. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, { formItemContext: formItem });
  25470. const popper = ref();
  25471. const triggerRef = ref();
  25472. const pickerPanelRef = ref();
  25473. const showPicker = ref(false);
  25474. const showPanelColor = ref(false);
  25475. let shouldActiveChange = true;
  25476. const { isFocused, handleFocus, handleBlur } = useFocusController(triggerRef, {
  25477. disabled: colorDisabled,
  25478. beforeBlur(event) {
  25479. return popper.value?.isFocusInsideContent(event);
  25480. },
  25481. afterBlur() {
  25482. setShowPicker(false);
  25483. resetColor();
  25484. if (props.validateEvent) formItem?.validate?.("blur").catch(NOOP);
  25485. }
  25486. });
  25487. const color = reactiveComputed(() => pickerPanelRef.value?.color ?? commonColor.color);
  25488. const panelProps = computed(() => pick(props, Object.keys(colorPickerPanelProps)));
  25489. const displayedColor = computed(() => {
  25490. if (!props.modelValue && !showPanelColor.value) return "transparent";
  25491. return displayedRgb(color, props.showAlpha);
  25492. });
  25493. const currentColor = computed(() => {
  25494. return !props.modelValue && !showPanelColor.value ? "" : color.value;
  25495. });
  25496. const buttonAriaLabel = computed(() => {
  25497. return !isLabeledByFormItem.value ? props.ariaLabel || t("el.colorpicker.defaultLabel") : void 0;
  25498. });
  25499. const buttonAriaLabelledby = computed(() => {
  25500. return isLabeledByFormItem.value ? formItem?.labelId : void 0;
  25501. });
  25502. const btnKls = computed(() => {
  25503. return [
  25504. ns.b("picker"),
  25505. ns.is("disabled", colorDisabled.value),
  25506. ns.bm("picker", colorSize.value),
  25507. ns.is("focused", isFocused.value)
  25508. ];
  25509. });
  25510. function displayedRgb(color, showAlpha) {
  25511. const { r, g, b, a } = color.toRgb();
  25512. return showAlpha ? `rgba(${r}, ${g}, ${b}, ${a})` : `rgb(${r}, ${g}, ${b})`;
  25513. }
  25514. function setShowPicker(value) {
  25515. showPicker.value = value;
  25516. }
  25517. const debounceSetShowPicker = debounce(setShowPicker, 100, { leading: true });
  25518. function show() {
  25519. if (colorDisabled.value) return;
  25520. setShowPicker(true);
  25521. }
  25522. function hide() {
  25523. debounceSetShowPicker(false);
  25524. resetColor();
  25525. }
  25526. function resetColor() {
  25527. nextTick(() => {
  25528. if (props.modelValue) color.fromString(props.modelValue);
  25529. else {
  25530. color.value = "";
  25531. nextTick(() => {
  25532. showPanelColor.value = false;
  25533. });
  25534. }
  25535. });
  25536. }
  25537. function handleTrigger() {
  25538. if (colorDisabled.value) return;
  25539. if (showPicker.value) resetColor();
  25540. debounceSetShowPicker(!showPicker.value);
  25541. }
  25542. function confirmValue() {
  25543. const value = isEmptyValue(color.value) ? valueOnClear.value : color.value;
  25544. emit(UPDATE_MODEL_EVENT, value);
  25545. emit(CHANGE_EVENT, value);
  25546. if (props.validateEvent) formItem?.validate("change").catch(NOOP);
  25547. debounceSetShowPicker(false);
  25548. nextTick(() => {
  25549. const newColor = new Color({
  25550. enableAlpha: props.showAlpha,
  25551. format: props.colorFormat || "",
  25552. value: props.modelValue
  25553. });
  25554. if (!color.compare(newColor)) resetColor();
  25555. });
  25556. }
  25557. function clear() {
  25558. debounceSetShowPicker(false);
  25559. emit(UPDATE_MODEL_EVENT, valueOnClear.value);
  25560. emit(CHANGE_EVENT, valueOnClear.value);
  25561. if (props.modelValue !== valueOnClear.value && props.validateEvent) formItem?.validate("change").catch(NOOP);
  25562. resetColor();
  25563. emit("clear");
  25564. }
  25565. function handleShowTooltip() {
  25566. pickerPanelRef?.value?.inputRef?.focus();
  25567. }
  25568. function handleClickOutside() {
  25569. if (!showPicker.value) return;
  25570. hide();
  25571. isFocused.value && focus();
  25572. }
  25573. function handleEsc(event) {
  25574. event.preventDefault();
  25575. event.stopPropagation();
  25576. setShowPicker(false);
  25577. resetColor();
  25578. }
  25579. function handleKeyDown(event) {
  25580. switch (getEventCode(event)) {
  25581. case EVENT_CODE.enter:
  25582. case EVENT_CODE.numpadEnter:
  25583. case EVENT_CODE.space:
  25584. event.preventDefault();
  25585. event.stopPropagation();
  25586. show();
  25587. break;
  25588. case EVENT_CODE.esc:
  25589. handleEsc(event);
  25590. break;
  25591. }
  25592. }
  25593. function focus() {
  25594. triggerRef.value.focus();
  25595. }
  25596. function blur() {
  25597. triggerRef.value.blur();
  25598. }
  25599. watch(() => currentColor.value, (val) => {
  25600. shouldActiveChange && emit("activeChange", val);
  25601. shouldActiveChange = true;
  25602. });
  25603. watch(() => color.value, () => {
  25604. if (!props.modelValue && !showPanelColor.value) showPanelColor.value = true;
  25605. });
  25606. watch(() => props.modelValue, (newVal) => {
  25607. if (!newVal) showPanelColor.value = false;
  25608. else if (newVal && newVal !== color.value) {
  25609. shouldActiveChange = false;
  25610. color.fromString(newVal);
  25611. }
  25612. });
  25613. watch(() => showPicker.value, () => {
  25614. pickerPanelRef.value && nextTick(pickerPanelRef.value.update);
  25615. });
  25616. provide(ROOT_COMMON_COLOR_INJECTION_KEY, commonColor);
  25617. __expose({
  25618. color,
  25619. show,
  25620. hide,
  25621. focus,
  25622. blur
  25623. });
  25624. return (_ctx, _cache) => {
  25625. return openBlock(), createBlock(unref(ElTooltip), {
  25626. ref_key: "popper",
  25627. ref: popper,
  25628. visible: showPicker.value,
  25629. "show-arrow": false,
  25630. "fallback-placements": [
  25631. "bottom",
  25632. "top",
  25633. "right",
  25634. "left"
  25635. ],
  25636. offset: 0,
  25637. "gpu-acceleration": false,
  25638. "popper-class": [unref(ns).be("picker", "panel"), __props.popperClass],
  25639. "popper-style": __props.popperStyle,
  25640. "stop-popper-mouse-event": false,
  25641. pure: "",
  25642. loop: "",
  25643. role: "dialog",
  25644. effect: "light",
  25645. trigger: "click",
  25646. teleported: __props.teleported,
  25647. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  25648. persistent: __props.persistent,
  25649. "append-to": __props.appendTo,
  25650. onShow: handleShowTooltip,
  25651. onHide: _cache[2] || (_cache[2] = ($event) => setShowPicker(false))
  25652. }, {
  25653. content: withCtx(() => [withDirectives((openBlock(), createBlock(unref(ElColorPickerPanel), mergeProps({
  25654. ref_key: "pickerPanelRef",
  25655. ref: pickerPanelRef
  25656. }, panelProps.value, {
  25657. border: false,
  25658. "validate-event": false,
  25659. onKeydown: withKeys(handleEsc, ["esc"])
  25660. }), {
  25661. footer: withCtx(() => [createElementVNode("div", null, [__props.clearable ? (openBlock(), createBlock(unref(ElButton), {
  25662. key: 0,
  25663. class: normalizeClass(unref(ns).be("footer", "link-btn")),
  25664. text: "",
  25665. size: "small",
  25666. onClick: clear
  25667. }, {
  25668. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.colorpicker.clear")), 1)]),
  25669. _: 1
  25670. }, 8, ["class"])) : createCommentVNode("v-if", true), createVNode(unref(ElButton), {
  25671. plain: "",
  25672. size: "small",
  25673. class: normalizeClass(unref(ns).be("footer", "btn")),
  25674. onClick: confirmValue
  25675. }, {
  25676. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.colorpicker.confirm")), 1)]),
  25677. _: 1
  25678. }, 8, ["class"])])]),
  25679. _: 1
  25680. }, 16)), [[
  25681. unref(ClickOutside),
  25682. handleClickOutside,
  25683. triggerRef.value
  25684. ]])]),
  25685. default: withCtx(() => [createElementVNode("div", mergeProps({
  25686. id: unref(buttonId),
  25687. ref_key: "triggerRef",
  25688. ref: triggerRef
  25689. }, _ctx.$attrs, {
  25690. class: btnKls.value,
  25691. role: "button",
  25692. "aria-label": buttonAriaLabel.value,
  25693. "aria-labelledby": buttonAriaLabelledby.value,
  25694. "aria-description": unref(t)("el.colorpicker.description", { color: __props.modelValue || "" }),
  25695. "aria-disabled": unref(colorDisabled),
  25696. tabindex: unref(colorDisabled) ? void 0 : __props.tabindex,
  25697. onKeydown: handleKeyDown,
  25698. onFocus: _cache[0] || (_cache[0] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
  25699. onBlur: _cache[1] || (_cache[1] = (...args) => unref(handleBlur) && unref(handleBlur)(...args))
  25700. }), [createElementVNode("div", {
  25701. class: normalizeClass(unref(ns).be("picker", "trigger")),
  25702. onClick: handleTrigger
  25703. }, [createElementVNode("span", { class: normalizeClass([unref(ns).be("picker", "color"), unref(ns).is("alpha", __props.showAlpha)]) }, [createElementVNode("span", {
  25704. class: normalizeClass(unref(ns).be("picker", "color-inner")),
  25705. style: normalizeStyle({ backgroundColor: displayedColor.value })
  25706. }, [withDirectives(createVNode(unref(ElIcon), { class: normalizeClass([unref(ns).be("picker", "icon"), unref(ns).is("icon-arrow-down")]) }, {
  25707. default: withCtx(() => [createVNode(unref(arrow_down_default))]),
  25708. _: 1
  25709. }, 8, ["class"]), [[vShow, __props.modelValue || showPanelColor.value]]), withDirectives(createVNode(unref(ElIcon), { class: normalizeClass([unref(ns).be("picker", "empty"), unref(ns).is("icon-close")]) }, {
  25710. default: withCtx(() => [createVNode(unref(close_default))]),
  25711. _: 1
  25712. }, 8, ["class"]), [[vShow, !__props.modelValue && !showPanelColor.value]])], 6)], 2)], 2)], 16, _hoisted_1$52)]),
  25713. _: 1
  25714. }, 8, [
  25715. "visible",
  25716. "popper-class",
  25717. "popper-style",
  25718. "teleported",
  25719. "transition",
  25720. "persistent",
  25721. "append-to"
  25722. ]);
  25723. };
  25724. }
  25725. });
  25726. //#endregion
  25727. //#region ../../packages/components/color-picker/src/color-picker.vue
  25728. var color_picker_default = color_picker_vue_vue_type_script_setup_true_lang_default;
  25729. //#endregion
  25730. //#region ../../packages/components/color-picker/index.ts
  25731. const ElColorPicker = withInstall(color_picker_default);
  25732. //#endregion
  25733. //#region ../../packages/components/container/src/container.vue?vue&type=script&setup=true&lang.ts
  25734. var container_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25735. name: "ElContainer",
  25736. __name: "container",
  25737. props: { direction: {
  25738. type: String,
  25739. required: false
  25740. } },
  25741. setup(__props) {
  25742. const props = __props;
  25743. const slots = useSlots();
  25744. const ns = useNamespace("container");
  25745. const isVertical = computed(() => {
  25746. if (props.direction === "vertical") return true;
  25747. else if (props.direction === "horizontal") return false;
  25748. if (slots && slots.default) return slots.default().some((vNode) => {
  25749. const tag = vNode.type.name;
  25750. return tag === "ElHeader" || tag === "ElFooter";
  25751. });
  25752. else return false;
  25753. });
  25754. return (_ctx, _cache) => {
  25755. return openBlock(), createElementBlock("section", { class: normalizeClass([unref(ns).b(), unref(ns).is("vertical", isVertical.value)]) }, [renderSlot(_ctx.$slots, "default")], 2);
  25756. };
  25757. }
  25758. });
  25759. //#endregion
  25760. //#region ../../packages/components/container/src/container.vue
  25761. var container_default = container_vue_vue_type_script_setup_true_lang_default;
  25762. //#endregion
  25763. //#region ../../packages/components/container/src/aside.vue?vue&type=script&setup=true&lang.ts
  25764. var aside_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25765. name: "ElAside",
  25766. __name: "aside",
  25767. props: { width: {
  25768. type: [String, null],
  25769. required: false,
  25770. default: null
  25771. } },
  25772. setup(__props) {
  25773. const props = __props;
  25774. const ns = useNamespace("aside");
  25775. const style = computed(() => props.width ? ns.cssVarBlock({ width: props.width }) : {});
  25776. return (_ctx, _cache) => {
  25777. return openBlock(), createElementBlock("aside", {
  25778. class: normalizeClass(unref(ns).b()),
  25779. style: normalizeStyle(style.value)
  25780. }, [renderSlot(_ctx.$slots, "default")], 6);
  25781. };
  25782. }
  25783. });
  25784. //#endregion
  25785. //#region ../../packages/components/container/src/aside.vue
  25786. var aside_default = aside_vue_vue_type_script_setup_true_lang_default;
  25787. //#endregion
  25788. //#region ../../packages/components/container/src/footer.vue?vue&type=script&setup=true&lang.ts
  25789. var footer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25790. name: "ElFooter",
  25791. __name: "footer",
  25792. props: { height: {
  25793. type: [String, null],
  25794. required: false,
  25795. default: null
  25796. } },
  25797. setup(__props) {
  25798. const props = __props;
  25799. const ns = useNamespace("footer");
  25800. const style = computed(() => props.height ? ns.cssVarBlock({ height: props.height }) : {});
  25801. return (_ctx, _cache) => {
  25802. return openBlock(), createElementBlock("footer", {
  25803. class: normalizeClass(unref(ns).b()),
  25804. style: normalizeStyle(style.value)
  25805. }, [renderSlot(_ctx.$slots, "default")], 6);
  25806. };
  25807. }
  25808. });
  25809. //#endregion
  25810. //#region ../../packages/components/container/src/footer.vue
  25811. var footer_default = footer_vue_vue_type_script_setup_true_lang_default;
  25812. //#endregion
  25813. //#region ../../packages/components/container/src/header.vue?vue&type=script&setup=true&lang.ts
  25814. var header_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25815. name: "ElHeader",
  25816. __name: "header",
  25817. props: { height: {
  25818. type: [String, null],
  25819. required: false,
  25820. default: null
  25821. } },
  25822. setup(__props) {
  25823. const props = __props;
  25824. const ns = useNamespace("header");
  25825. const style = computed(() => {
  25826. return props.height ? ns.cssVarBlock({ height: props.height }) : {};
  25827. });
  25828. return (_ctx, _cache) => {
  25829. return openBlock(), createElementBlock("header", {
  25830. class: normalizeClass(unref(ns).b()),
  25831. style: normalizeStyle(style.value)
  25832. }, [renderSlot(_ctx.$slots, "default")], 6);
  25833. };
  25834. }
  25835. });
  25836. //#endregion
  25837. //#region ../../packages/components/container/src/header.vue
  25838. var header_default = header_vue_vue_type_script_setup_true_lang_default;
  25839. //#endregion
  25840. //#region ../../packages/components/container/src/main.vue?vue&type=script&setup=true&lang.ts
  25841. var main_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  25842. name: "ElMain",
  25843. __name: "main",
  25844. setup(__props) {
  25845. const ns = useNamespace("main");
  25846. return (_ctx, _cache) => {
  25847. return openBlock(), createElementBlock("main", { class: normalizeClass(unref(ns).b()) }, [renderSlot(_ctx.$slots, "default")], 2);
  25848. };
  25849. }
  25850. });
  25851. //#endregion
  25852. //#region ../../packages/components/container/src/main.vue
  25853. var main_default = main_vue_vue_type_script_setup_true_lang_default;
  25854. //#endregion
  25855. //#region ../../packages/components/container/index.ts
  25856. const ElContainer = withInstall(container_default, {
  25857. Aside: aside_default,
  25858. Footer: footer_default,
  25859. Header: header_default,
  25860. Main: main_default
  25861. });
  25862. const ElAside = withNoopInstall(aside_default);
  25863. const ElFooter = withNoopInstall(footer_default);
  25864. const ElHeader = withNoopInstall(header_default);
  25865. const ElMain = withNoopInstall(main_default);
  25866. //#endregion
  25867. //#region ../../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/plugin/advancedFormat.js
  25868. var require_advancedFormat = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  25869. (function(e, t) {
  25870. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_advancedFormat = t();
  25871. })(exports, (function() {
  25872. "use strict";
  25873. return function(e, t) {
  25874. var r = t.prototype, n = r.format;
  25875. r.format = function(e) {
  25876. var t = this, r = this.$locale();
  25877. if (!this.isValid()) return n.bind(this)(e);
  25878. var s = this.$utils(), a = (e || "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(e) {
  25879. switch (e) {
  25880. case "Q": return Math.ceil((t.$M + 1) / 3);
  25881. case "Do": return r.ordinal(t.$D);
  25882. case "gggg": return t.weekYear();
  25883. case "GGGG": return t.isoWeekYear();
  25884. case "wo": return r.ordinal(t.week(), "W");
  25885. case "w":
  25886. case "ww": return s.s(t.week(), "w" === e ? 1 : 2, "0");
  25887. case "W":
  25888. case "WW": return s.s(t.isoWeek(), "W" === e ? 1 : 2, "0");
  25889. case "k":
  25890. case "kk": return s.s(String(0 === t.$H ? 24 : t.$H), "k" === e ? 1 : 2, "0");
  25891. case "X": return Math.floor(t.$d.getTime() / 1e3);
  25892. case "x": return t.$d.getTime();
  25893. case "z": return "[" + t.offsetName() + "]";
  25894. case "zzz": return "[" + t.offsetName("long") + "]";
  25895. default: return e;
  25896. }
  25897. }));
  25898. return n.bind(this)(a);
  25899. };
  25900. };
  25901. }));
  25902. }));
  25903. //#endregion
  25904. //#region ../../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/plugin/weekOfYear.js
  25905. var require_weekOfYear = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  25906. (function(e, t) {
  25907. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_weekOfYear = t();
  25908. })(exports, (function() {
  25909. "use strict";
  25910. var e = "week", t = "year";
  25911. return function(i, n, r) {
  25912. var f = n.prototype;
  25913. f.week = function(i) {
  25914. if (void 0 === i && (i = null), null !== i) return this.add(7 * (i - this.week()), "day");
  25915. var n = this.$locale().yearStart || 1;
  25916. if (11 === this.month() && this.date() > 25) {
  25917. var f = r(this).startOf(t).add(1, t).date(n), s = r(this).endOf(e);
  25918. if (f.isBefore(s)) return 1;
  25919. }
  25920. var a = r(this).startOf(t).date(n).startOf(e).subtract(1, "millisecond"), o = this.diff(a, e, !0);
  25921. return o < 0 ? r(this).startOf("week").week() : Math.ceil(o);
  25922. }, f.weeks = function(e) {
  25923. return void 0 === e && (e = null), this.week(e);
  25924. };
  25925. };
  25926. }));
  25927. }));
  25928. //#endregion
  25929. //#region ../../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/plugin/weekYear.js
  25930. var require_weekYear = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  25931. (function(e, t) {
  25932. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_weekYear = t();
  25933. })(exports, (function() {
  25934. "use strict";
  25935. return function(e, t) {
  25936. t.prototype.weekYear = function() {
  25937. var e = this.month(), t = this.week(), n = this.year();
  25938. return 1 === t && 11 === e ? n + 1 : 0 === e && t >= 52 ? n - 1 : n;
  25939. };
  25940. };
  25941. }));
  25942. }));
  25943. //#endregion
  25944. //#region ../../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/plugin/dayOfYear.js
  25945. var require_dayOfYear = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  25946. (function(e, t) {
  25947. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_dayOfYear = t();
  25948. })(exports, (function() {
  25949. "use strict";
  25950. return function(e, t, n) {
  25951. t.prototype.dayOfYear = function(e) {
  25952. var t = Math.round((n(this).startOf("day") - n(this).startOf("year")) / 864e5) + 1;
  25953. return null == e ? t : this.add(e - t, "day");
  25954. };
  25955. };
  25956. }));
  25957. }));
  25958. //#endregion
  25959. //#region ../../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/plugin/isSameOrAfter.js
  25960. var require_isSameOrAfter = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  25961. (function(e, t) {
  25962. "object" == typeof exports && "undefined" != typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define(t) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_isSameOrAfter = t();
  25963. })(exports, (function() {
  25964. "use strict";
  25965. return function(e, t) {
  25966. t.prototype.isSameOrAfter = function(e, t) {
  25967. return this.isSame(e, t) || this.isAfter(e, t);
  25968. };
  25969. };
  25970. }));
  25971. }));
  25972. //#endregion
  25973. //#region ../../node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/plugin/isSameOrBefore.js
  25974. var require_isSameOrBefore = /* @__PURE__ */ __commonJSMin(((exports, module) => {
  25975. (function(e, i) {
  25976. "object" == typeof exports && "undefined" != typeof module ? module.exports = i() : "function" == typeof define && define.amd ? define(i) : (e = "undefined" != typeof globalThis ? globalThis : e || self).dayjs_plugin_isSameOrBefore = i();
  25977. })(exports, (function() {
  25978. "use strict";
  25979. return function(e, i) {
  25980. i.prototype.isSameOrBefore = function(e, i) {
  25981. return this.isSame(e, i) || this.isBefore(e, i);
  25982. };
  25983. };
  25984. }));
  25985. }));
  25986. //#endregion
  25987. //#region ../../packages/components/date-picker-panel/src/props/date-picker-panel.ts
  25988. var import_advancedFormat = /* @__PURE__ */ __toESM(require_advancedFormat());
  25989. var import_weekOfYear = /* @__PURE__ */ __toESM(require_weekOfYear());
  25990. var import_weekYear = /* @__PURE__ */ __toESM(require_weekYear());
  25991. var import_dayOfYear = /* @__PURE__ */ __toESM(require_dayOfYear());
  25992. var import_isSameOrAfter = /* @__PURE__ */ __toESM(require_isSameOrAfter());
  25993. var import_isSameOrBefore = /* @__PURE__ */ __toESM(require_isSameOrBefore());
  25994. const datePickerPanelProps = buildProps({
  25995. valueFormat: String,
  25996. dateFormat: String,
  25997. timeFormat: String,
  25998. disabled: {
  25999. type: Boolean,
  26000. default: void 0
  26001. },
  26002. modelValue: {
  26003. type: definePropType([
  26004. Date,
  26005. Array,
  26006. String,
  26007. Number
  26008. ]),
  26009. default: ""
  26010. },
  26011. defaultValue: { type: definePropType([Date, Array]) },
  26012. defaultTime: { type: definePropType([Date, Array]) },
  26013. isRange: Boolean,
  26014. ...disabledTimeListsProps,
  26015. disabledDate: { type: Function },
  26016. cellClassName: { type: Function },
  26017. shortcuts: {
  26018. type: Array,
  26019. default: () => []
  26020. },
  26021. arrowControl: Boolean,
  26022. unlinkPanels: Boolean,
  26023. showNow: {
  26024. type: Boolean,
  26025. default: true
  26026. },
  26027. showConfirm: Boolean,
  26028. showFooter: Boolean,
  26029. showWeekNumber: Boolean,
  26030. type: {
  26031. type: definePropType(String),
  26032. default: "date"
  26033. },
  26034. clearable: {
  26035. type: Boolean,
  26036. default: true
  26037. },
  26038. border: {
  26039. type: Boolean,
  26040. default: true
  26041. },
  26042. editable: {
  26043. type: Boolean,
  26044. default: true
  26045. }
  26046. });
  26047. //#endregion
  26048. //#region ../../packages/components/date-picker-panel/src/constants.ts
  26049. const ROOT_PICKER_INJECTION_KEY = Symbol("rootPickerContextKey");
  26050. const ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY = "ElIsDefaultFormat";
  26051. //#endregion
  26052. //#region ../../packages/components/date-picker-panel/src/props/shared.ts
  26053. const selectionModes = [
  26054. "date",
  26055. "dates",
  26056. "year",
  26057. "years",
  26058. "month",
  26059. "months",
  26060. "week",
  26061. "range"
  26062. ];
  26063. const datePickerSharedProps = buildProps({
  26064. cellClassName: { type: definePropType(Function) },
  26065. disabledDate: { type: definePropType(Function) },
  26066. date: {
  26067. type: definePropType(Object),
  26068. required: true
  26069. },
  26070. minDate: { type: definePropType(Object) },
  26071. maxDate: { type: definePropType(Object) },
  26072. parsedValue: { type: definePropType([Object, Array]) },
  26073. rangeState: {
  26074. type: definePropType(Object),
  26075. default: () => ({
  26076. endDate: null,
  26077. selecting: false
  26078. })
  26079. },
  26080. disabled: Boolean
  26081. });
  26082. const panelSharedProps = buildProps({
  26083. type: {
  26084. type: definePropType(String),
  26085. required: true,
  26086. values: datePickTypes
  26087. },
  26088. dateFormat: String,
  26089. timeFormat: String,
  26090. showNow: {
  26091. type: Boolean,
  26092. default: true
  26093. },
  26094. showConfirm: Boolean,
  26095. showFooter: {
  26096. type: Boolean,
  26097. default: true
  26098. },
  26099. showWeekNumber: Boolean,
  26100. border: Boolean,
  26101. disabled: Boolean,
  26102. editable: {
  26103. type: Boolean,
  26104. default: true
  26105. }
  26106. });
  26107. const panelRangeSharedProps = buildProps({
  26108. unlinkPanels: Boolean,
  26109. visible: {
  26110. type: Boolean,
  26111. default: true
  26112. },
  26113. showConfirm: Boolean,
  26114. showFooter: {
  26115. type: Boolean,
  26116. default: true
  26117. },
  26118. border: Boolean,
  26119. disabled: Boolean,
  26120. parsedValue: { type: definePropType(Array) },
  26121. singlePanel: Boolean
  26122. });
  26123. const selectionModeWithDefault = (mode) => {
  26124. return {
  26125. type: String,
  26126. values: selectionModes,
  26127. default: mode
  26128. };
  26129. };
  26130. //#endregion
  26131. //#region ../../packages/components/date-picker-panel/src/props/panel-date-pick.ts
  26132. const panelDatePickProps = buildProps({
  26133. ...panelSharedProps,
  26134. parsedValue: { type: definePropType([Object, Array]) },
  26135. visible: {
  26136. type: Boolean,
  26137. default: true
  26138. },
  26139. format: {
  26140. type: String,
  26141. default: ""
  26142. }
  26143. });
  26144. //#endregion
  26145. //#region ../../packages/components/date-picker-panel/src/utils.ts
  26146. const isValidRange = (range) => {
  26147. if (!isArray$1(range)) return false;
  26148. const [left, right] = range;
  26149. return import_dayjs_min.default.isDayjs(left) && import_dayjs_min.default.isDayjs(right) && (0, import_dayjs_min.default)(left).isValid() && (0, import_dayjs_min.default)(right).isValid() && left.isSameOrBefore(right);
  26150. };
  26151. const getDefaultValue = (defaultValue, { lang, step = 1, unit, unlinkPanels }) => {
  26152. let start;
  26153. if (isArray$1(defaultValue)) {
  26154. let [left, right] = defaultValue.map((d) => (0, import_dayjs_min.default)(d).locale(lang));
  26155. if (!unlinkPanels) right = left.add(step, unit);
  26156. return [left, right];
  26157. } else if (defaultValue) start = (0, import_dayjs_min.default)(defaultValue);
  26158. else start = (0, import_dayjs_min.default)();
  26159. start = start.locale(lang);
  26160. return [start, start.add(step, unit)];
  26161. };
  26162. const buildPickerTable = (dimension, rows, { columnIndexOffset, startDate, nextEndDate, now, unit, relativeDateGetter, setCellMetadata, setRowMetadata }) => {
  26163. for (let rowIndex = 0; rowIndex < dimension.row; rowIndex++) {
  26164. const row = rows[rowIndex];
  26165. for (let columnIndex = 0; columnIndex < dimension.column; columnIndex++) {
  26166. let cell = row[columnIndex + columnIndexOffset];
  26167. if (!cell) cell = {
  26168. row: rowIndex,
  26169. column: columnIndex,
  26170. type: "normal",
  26171. inRange: false,
  26172. start: false,
  26173. end: false
  26174. };
  26175. const nextStartDate = relativeDateGetter(rowIndex * dimension.column + columnIndex);
  26176. cell.dayjs = nextStartDate;
  26177. cell.date = nextStartDate.toDate();
  26178. cell.timestamp = nextStartDate.valueOf();
  26179. cell.type = "normal";
  26180. cell.inRange = !!(startDate && nextStartDate.isSameOrAfter(startDate, unit) && nextEndDate && nextStartDate.isSameOrBefore(nextEndDate, unit)) || !!(startDate && nextStartDate.isSameOrBefore(startDate, unit) && nextEndDate && nextStartDate.isSameOrAfter(nextEndDate, unit));
  26181. if (startDate?.isSameOrAfter(nextEndDate)) {
  26182. cell.start = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  26183. cell.end = startDate && nextStartDate.isSame(startDate, unit);
  26184. } else {
  26185. cell.start = !!startDate && nextStartDate.isSame(startDate, unit);
  26186. cell.end = !!nextEndDate && nextStartDate.isSame(nextEndDate, unit);
  26187. }
  26188. if (nextStartDate.isSame(now, unit)) cell.type = "today";
  26189. setCellMetadata?.(cell, {
  26190. rowIndex,
  26191. columnIndex
  26192. });
  26193. row[columnIndex + columnIndexOffset] = cell;
  26194. }
  26195. setRowMetadata?.(row);
  26196. }
  26197. };
  26198. const datesInMonth = (date, year, month, lang) => {
  26199. const firstDay = (0, import_dayjs_min.default)().locale(lang).startOf("month").month(month).year(year).hour(date.hour()).minute(date.minute()).second(date.second());
  26200. return rangeArr(firstDay.daysInMonth()).map((n) => firstDay.add(n, "day").toDate());
  26201. };
  26202. const getValidDateOfMonth = (date, year, month, lang, disabledDate) => {
  26203. const _value = (0, import_dayjs_min.default)().year(year).month(month).startOf("month").hour(date.hour()).minute(date.minute()).second(date.second());
  26204. const _date = datesInMonth(date, year, month, lang).find((date) => {
  26205. return !disabledDate?.(date);
  26206. });
  26207. if (_date) return (0, import_dayjs_min.default)(_date).locale(lang);
  26208. return _value.locale(lang);
  26209. };
  26210. const getValidDateOfYear = (value, lang, disabledDate) => {
  26211. const year = value.year();
  26212. if (!disabledDate?.(value.toDate())) return value.locale(lang);
  26213. const month = value.month();
  26214. if (!datesInMonth(value, year, month, lang).every(disabledDate)) return getValidDateOfMonth(value, year, month, lang, disabledDate);
  26215. for (let i = 0; i < 12; i++) if (!datesInMonth(value, year, i, lang).every(disabledDate)) return getValidDateOfMonth(value, year, i, lang, disabledDate);
  26216. return value;
  26217. };
  26218. const correctlyParseUserInput = (value, format, lang, defaultFormat) => {
  26219. if (isArray$1(value)) return value.map((v) => correctlyParseUserInput(v, format, lang, defaultFormat));
  26220. if (isString(value)) {
  26221. const dayjsValue = defaultFormat?.value ? (0, import_dayjs_min.default)(value) : (0, import_dayjs_min.default)(value, format);
  26222. if (!dayjsValue.isValid()) return dayjsValue;
  26223. }
  26224. return (0, import_dayjs_min.default)(value, format).locale(lang);
  26225. };
  26226. //#endregion
  26227. //#region ../../packages/components/date-picker-panel/src/props/basic-date-table.ts
  26228. const basicDateTableProps = buildProps({
  26229. ...datePickerSharedProps,
  26230. showWeekNumber: Boolean,
  26231. selectionMode: selectionModeWithDefault("date")
  26232. });
  26233. const basicDateTableEmits = [
  26234. "changerange",
  26235. "pick",
  26236. "select"
  26237. ];
  26238. //#endregion
  26239. //#region ../../packages/components/date-picker-panel/src/composables/use-basic-date-table.ts
  26240. const isNormalDay = (type = "") => {
  26241. return ["normal", "today"].includes(type);
  26242. };
  26243. const useBasicDateTable = (props, emit) => {
  26244. const { lang } = useLocale();
  26245. const tbodyRef = ref();
  26246. const currentCellRef = ref();
  26247. const lastRow = ref();
  26248. const lastColumn = ref();
  26249. const tableRows = ref([
  26250. [],
  26251. [],
  26252. [],
  26253. [],
  26254. [],
  26255. []
  26256. ]);
  26257. let focusWithClick = false;
  26258. const firstDayOfWeek = props.date.$locale().weekStart || 7;
  26259. const WEEKS_CONSTANT = props.date.locale("en").localeData().weekdaysShort().map((_) => _.toLowerCase());
  26260. const offsetDay = computed(() => {
  26261. return firstDayOfWeek > 3 ? 7 - firstDayOfWeek : -firstDayOfWeek;
  26262. });
  26263. const startDate = computed(() => {
  26264. const startDayOfMonth = props.date.startOf("month");
  26265. return startDayOfMonth.subtract(startDayOfMonth.day() || 7, "day");
  26266. });
  26267. const WEEKS = computed(() => {
  26268. return WEEKS_CONSTANT.concat(WEEKS_CONSTANT).slice(firstDayOfWeek, firstDayOfWeek + 7);
  26269. });
  26270. const hasCurrent = computed(() => {
  26271. return flatten(unref(rows)).some((row) => {
  26272. return row.isCurrent;
  26273. });
  26274. });
  26275. const days = computed(() => {
  26276. const startOfMonth = props.date.startOf("month");
  26277. return {
  26278. startOfMonthDay: startOfMonth.day() || 7,
  26279. dateCountOfMonth: startOfMonth.daysInMonth(),
  26280. dateCountOfLastMonth: startOfMonth.subtract(1, "month").daysInMonth()
  26281. };
  26282. });
  26283. const selectedDate = computed(() => {
  26284. return props.selectionMode === "dates" ? castArray(props.parsedValue) : [];
  26285. });
  26286. const setDateText = (cell, { count, rowIndex, columnIndex }) => {
  26287. const { startOfMonthDay, dateCountOfMonth, dateCountOfLastMonth } = unref(days);
  26288. const offset = unref(offsetDay);
  26289. if (rowIndex >= 0 && rowIndex <= 1) {
  26290. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  26291. if (columnIndex + rowIndex * 7 >= numberOfDaysFromPreviousMonth) {
  26292. cell.text = count;
  26293. return true;
  26294. } else {
  26295. cell.text = dateCountOfLastMonth - (numberOfDaysFromPreviousMonth - columnIndex % 7) + 1 + rowIndex * 7;
  26296. cell.type = "prev-month";
  26297. }
  26298. } else {
  26299. if (count <= dateCountOfMonth) cell.text = count;
  26300. else {
  26301. cell.text = count - dateCountOfMonth;
  26302. cell.type = "next-month";
  26303. }
  26304. return true;
  26305. }
  26306. return false;
  26307. };
  26308. const setCellMetadata = (cell, { columnIndex, rowIndex }, count) => {
  26309. const { disabledDate, cellClassName } = props;
  26310. const _selectedDate = unref(selectedDate);
  26311. const shouldIncrement = setDateText(cell, {
  26312. count,
  26313. rowIndex,
  26314. columnIndex
  26315. });
  26316. const cellDate = cell.dayjs.toDate();
  26317. cell.selected = _selectedDate.find((d) => d.isSame(cell.dayjs, "day"));
  26318. cell.isSelected = !!cell.selected;
  26319. cell.isCurrent = isCurrent(cell);
  26320. cell.disabled = disabledDate?.(cellDate);
  26321. cell.customClass = cellClassName?.(cellDate);
  26322. return shouldIncrement;
  26323. };
  26324. const setRowMetadata = (row) => {
  26325. if (props.selectionMode === "week") {
  26326. const [start, end] = props.showWeekNumber ? [1, 7] : [0, 6];
  26327. const isActive = isWeekActive(row[start + 1]);
  26328. row[start].inRange = isActive;
  26329. row[start].start = isActive;
  26330. row[end].inRange = isActive;
  26331. row[end].end = isActive;
  26332. }
  26333. };
  26334. const rows = computed(() => {
  26335. const { minDate, maxDate, rangeState, showWeekNumber } = props;
  26336. const offset = unref(offsetDay);
  26337. const rows_ = unref(tableRows);
  26338. const dateUnit = "day";
  26339. let count = 1;
  26340. buildPickerTable({
  26341. row: 6,
  26342. column: 7
  26343. }, rows_, {
  26344. startDate: minDate,
  26345. columnIndexOffset: showWeekNumber ? 1 : 0,
  26346. nextEndDate: rangeState.endDate || maxDate || rangeState.selecting && minDate || null,
  26347. now: (0, import_dayjs_min.default)().locale(unref(lang)).startOf(dateUnit),
  26348. unit: dateUnit,
  26349. relativeDateGetter: (idx) => unref(startDate).add(idx - offset, dateUnit),
  26350. setCellMetadata: (...args) => {
  26351. if (setCellMetadata(...args, count)) count += 1;
  26352. },
  26353. setRowMetadata
  26354. });
  26355. if (showWeekNumber) {
  26356. for (let rowIndex = 0; rowIndex < 6; rowIndex++) if (rows_[rowIndex][1].dayjs) rows_[rowIndex][0] = {
  26357. type: "week",
  26358. text: rows_[rowIndex][1].dayjs.week()
  26359. };
  26360. }
  26361. return rows_;
  26362. });
  26363. watch(() => props.date, async () => {
  26364. if (unref(tbodyRef)?.contains(document.activeElement)) {
  26365. await nextTick();
  26366. await focus();
  26367. }
  26368. });
  26369. const focus = async () => unref(currentCellRef)?.focus();
  26370. const isCurrent = (cell) => {
  26371. return props.selectionMode === "date" && isNormalDay(cell.type) && cellMatchesDate(cell, props.parsedValue);
  26372. };
  26373. const cellMatchesDate = (cell, date) => {
  26374. if (!date) return false;
  26375. return (0, import_dayjs_min.default)(date).locale(unref(lang)).isSame(props.date.date(Number(cell.text)), "day");
  26376. };
  26377. const getDateOfCell = (row, column) => {
  26378. const startOfMonthDay = unref(days).startOfMonthDay;
  26379. const offset = unref(offsetDay);
  26380. const numberOfDaysFromPreviousMonth = startOfMonthDay + offset < 0 ? 7 + startOfMonthDay + offset : startOfMonthDay + offset;
  26381. const offsetFromStart = row * 7 + (column - (props.showWeekNumber ? 1 : 0));
  26382. return props.date.startOf("month").subtract(numberOfDaysFromPreviousMonth, "day").add(offsetFromStart, "day");
  26383. };
  26384. const handleMouseMove = (event) => {
  26385. if (!props.rangeState.selecting) return;
  26386. let target = event.target;
  26387. if (target.tagName === "SPAN") target = target.parentNode?.parentNode;
  26388. if (target.tagName === "DIV") target = target.parentNode;
  26389. if (target.tagName !== "TD") return;
  26390. const row = target.parentNode.rowIndex - 1;
  26391. const column = target.cellIndex;
  26392. if (unref(rows)[row][column].disabled) return;
  26393. if (row !== unref(lastRow) || column !== unref(lastColumn)) {
  26394. lastRow.value = row;
  26395. lastColumn.value = column;
  26396. emit("changerange", {
  26397. selecting: true,
  26398. endDate: getDateOfCell(row, column)
  26399. });
  26400. }
  26401. };
  26402. const isSelectedCell = (cell) => {
  26403. return !unref(hasCurrent) && cell?.text === 1 && isNormalDay(cell.type) || cell.isCurrent;
  26404. };
  26405. const handleFocus = (event) => {
  26406. if (focusWithClick || unref(hasCurrent) || props.selectionMode !== "date") return;
  26407. handlePickDate(event, true);
  26408. };
  26409. const handleMouseDown = (event) => {
  26410. if (!event.target.closest("td")) return;
  26411. focusWithClick = true;
  26412. };
  26413. const handleMouseUp = (event) => {
  26414. if (!event.target.closest("td")) return;
  26415. focusWithClick = false;
  26416. };
  26417. const handleRangePick = (newDate) => {
  26418. if (!props.rangeState.selecting || !props.minDate) {
  26419. emit("pick", {
  26420. minDate: newDate,
  26421. maxDate: null
  26422. });
  26423. emit("select", true);
  26424. } else {
  26425. if (newDate >= props.minDate) emit("pick", {
  26426. minDate: props.minDate,
  26427. maxDate: newDate
  26428. });
  26429. else emit("pick", {
  26430. minDate: newDate,
  26431. maxDate: props.minDate
  26432. });
  26433. emit("select", false);
  26434. }
  26435. };
  26436. const handleWeekPick = (newDate) => {
  26437. const weekNumber = newDate.week();
  26438. const value = `${newDate.year()}w${weekNumber}`;
  26439. emit("pick", {
  26440. year: newDate.year(),
  26441. week: weekNumber,
  26442. value,
  26443. date: newDate.startOf("week")
  26444. });
  26445. };
  26446. const handleDatesPick = (newDate, selected) => {
  26447. emit("pick", selected ? castArray(props.parsedValue).filter((d) => d?.valueOf() !== newDate.valueOf()) : castArray(props.parsedValue).concat([newDate]));
  26448. };
  26449. const handlePickDate = (event, isKeyboardMovement = false) => {
  26450. if (props.disabled) return;
  26451. const target = event.target.closest("td");
  26452. if (!target) return;
  26453. const row = target.parentNode.rowIndex - 1;
  26454. const column = target.cellIndex;
  26455. const cell = unref(rows)[row][column];
  26456. if (cell.disabled || cell.type === "week") return;
  26457. const newDate = getDateOfCell(row, column);
  26458. switch (props.selectionMode) {
  26459. case "range":
  26460. handleRangePick(newDate);
  26461. break;
  26462. case "date":
  26463. emit("pick", newDate, isKeyboardMovement);
  26464. break;
  26465. case "week":
  26466. handleWeekPick(newDate);
  26467. break;
  26468. case "dates":
  26469. handleDatesPick(newDate, !!cell.selected);
  26470. break;
  26471. default: break;
  26472. }
  26473. };
  26474. const isWeekActive = (cell) => {
  26475. if (props.selectionMode !== "week") return false;
  26476. let newDate = props.date.startOf("day");
  26477. if (cell.type === "prev-month") newDate = newDate.subtract(1, "month");
  26478. if (cell.type === "next-month") newDate = newDate.add(1, "month");
  26479. newDate = newDate.date(Number.parseInt(cell.text, 10));
  26480. if (props.parsedValue && !isArray$1(props.parsedValue)) {
  26481. const dayOffset = (props.parsedValue.day() - firstDayOfWeek + 7) % 7 - 1;
  26482. return props.parsedValue.subtract(dayOffset, "day").isSame(newDate, "day");
  26483. }
  26484. return false;
  26485. };
  26486. return {
  26487. WEEKS,
  26488. rows,
  26489. tbodyRef,
  26490. currentCellRef,
  26491. focus,
  26492. isCurrent,
  26493. isWeekActive,
  26494. isSelectedCell,
  26495. handlePickDate,
  26496. handleMouseUp,
  26497. handleMouseDown,
  26498. handleMouseMove,
  26499. handleFocus
  26500. };
  26501. };
  26502. const useBasicDateTableDOM = (props, { isCurrent, isWeekActive }) => {
  26503. const ns = useNamespace("date-table");
  26504. const { t } = useLocale();
  26505. const tableKls = computed(() => [ns.b(), ns.is("week-mode", props.selectionMode === "week" && !props.disabled)]);
  26506. const tableLabel = computed(() => t("el.datepicker.dateTablePrompt"));
  26507. const getCellClasses = (cell) => {
  26508. const classes = [];
  26509. if (isNormalDay(cell.type) && !cell.disabled) {
  26510. classes.push("available");
  26511. if (cell.type === "today") classes.push("today");
  26512. } else classes.push(cell.type);
  26513. if (isCurrent(cell)) classes.push("current");
  26514. if (cell.inRange && (isNormalDay(cell.type) || props.selectionMode === "week")) {
  26515. classes.push("in-range");
  26516. if (cell.start) classes.push("start-date");
  26517. if (cell.end) classes.push("end-date");
  26518. }
  26519. if (cell.disabled || props.disabled) classes.push("disabled");
  26520. if (cell.selected) classes.push("selected");
  26521. if (cell.customClass) classes.push(cell.customClass);
  26522. return classes.join(" ");
  26523. };
  26524. const getRowKls = (cell) => [ns.e("row"), { current: isWeekActive(cell) }];
  26525. return {
  26526. tableKls,
  26527. tableLabel,
  26528. weekHeaderClass: ns.e("week-header"),
  26529. getCellClasses,
  26530. getRowKls,
  26531. t
  26532. };
  26533. };
  26534. //#endregion
  26535. //#region ../../packages/components/date-picker-panel/src/props/basic-cell.ts
  26536. const basicCellProps = buildProps({ cell: { type: definePropType(Object) } });
  26537. //#endregion
  26538. //#region ../../packages/components/date-picker-panel/src/date-picker-com/basic-cell-render.tsx
  26539. var basic_cell_render_default = /* @__PURE__ */ defineComponent({
  26540. name: "ElDatePickerCell",
  26541. props: basicCellProps,
  26542. setup(props) {
  26543. const ns = useNamespace("date-table-cell");
  26544. const { slots } = inject(ROOT_PICKER_INJECTION_KEY);
  26545. return () => {
  26546. const { cell } = props;
  26547. return renderSlot(slots, "default", { ...cell }, () => [createVNode("div", { "class": ns.b() }, [createVNode("span", { "class": ns.e("text") }, [cell?.renderText ?? cell?.text])])]);
  26548. };
  26549. }
  26550. });
  26551. //#endregion
  26552. //#region ../../packages/components/date-picker-panel/src/date-picker-com/basic-date-table.vue?vue&type=script&setup=true&lang.ts
  26553. const _hoisted_1$51 = ["aria-label"];
  26554. const _hoisted_2$33 = ["aria-label"];
  26555. const _hoisted_3$15 = [
  26556. "aria-current",
  26557. "aria-selected",
  26558. "tabindex",
  26559. "aria-disabled"
  26560. ];
  26561. var basic_date_table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  26562. __name: "basic-date-table",
  26563. props: basicDateTableProps,
  26564. emits: basicDateTableEmits,
  26565. setup(__props, { expose: __expose, emit: __emit }) {
  26566. const props = __props;
  26567. const { WEEKS, rows, tbodyRef, currentCellRef, focus, isCurrent, isWeekActive, isSelectedCell, handlePickDate, handleMouseUp, handleMouseDown, handleMouseMove, handleFocus } = useBasicDateTable(props, __emit);
  26568. const { tableLabel, tableKls, getCellClasses, getRowKls, weekHeaderClass, t } = useBasicDateTableDOM(props, {
  26569. isCurrent,
  26570. isWeekActive
  26571. });
  26572. let isUnmounting = false;
  26573. onBeforeUnmount(() => {
  26574. isUnmounting = true;
  26575. });
  26576. __expose({ focus });
  26577. return (_ctx, _cache) => {
  26578. return openBlock(), createElementBlock("table", {
  26579. "aria-label": unref(tableLabel),
  26580. class: normalizeClass(unref(tableKls)),
  26581. cellspacing: "0",
  26582. cellpadding: "0",
  26583. role: "grid",
  26584. onClick: _cache[1] || (_cache[1] = (...args) => unref(handlePickDate) && unref(handlePickDate)(...args)),
  26585. onMousemove: _cache[2] || (_cache[2] = (...args) => unref(handleMouseMove) && unref(handleMouseMove)(...args)),
  26586. onMousedown: _cache[3] || (_cache[3] = (...args) => unref(handleMouseDown) && unref(handleMouseDown)(...args)),
  26587. onMouseup: _cache[4] || (_cache[4] = (...args) => unref(handleMouseUp) && unref(handleMouseUp)(...args))
  26588. }, [createElementVNode("tbody", {
  26589. ref_key: "tbodyRef",
  26590. ref: tbodyRef
  26591. }, [createElementVNode("tr", null, [_ctx.showWeekNumber ? (openBlock(), createElementBlock("th", {
  26592. key: 0,
  26593. scope: "col",
  26594. class: normalizeClass(unref(weekHeaderClass))
  26595. }, null, 2)) : createCommentVNode("v-if", true), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(WEEKS), (week, key) => {
  26596. return openBlock(), createElementBlock("th", {
  26597. key,
  26598. "aria-label": unref(t)("el.datepicker.weeksFull." + week),
  26599. scope: "col"
  26600. }, toDisplayString(unref(t)("el.datepicker.weeks." + week)), 9, _hoisted_2$33);
  26601. }), 128))]), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(rows), (row, rowKey) => {
  26602. return openBlock(), createElementBlock("tr", {
  26603. key: rowKey,
  26604. class: normalizeClass(unref(getRowKls)(_ctx.showWeekNumber ? row[2] : row[1]))
  26605. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, columnKey) => {
  26606. return openBlock(), createElementBlock("td", {
  26607. key: `${rowKey}.${columnKey}`,
  26608. ref_for: true,
  26609. ref: (el) => !unref(isUnmounting) && unref(isSelectedCell)(cell) && (currentCellRef.value = el),
  26610. class: normalizeClass(unref(getCellClasses)(cell)),
  26611. "aria-current": cell.isCurrent ? "date" : void 0,
  26612. "aria-selected": cell.isCurrent,
  26613. tabindex: _ctx.disabled ? void 0 : unref(isSelectedCell)(cell) ? 0 : -1,
  26614. "aria-disabled": _ctx.disabled,
  26615. onFocus: _cache[0] || (_cache[0] = (...args) => unref(handleFocus) && unref(handleFocus)(...args))
  26616. }, [createVNode(unref(basic_cell_render_default), { cell }, null, 8, ["cell"])], 42, _hoisted_3$15);
  26617. }), 128))], 2);
  26618. }), 128))], 512)], 42, _hoisted_1$51);
  26619. };
  26620. }
  26621. });
  26622. //#endregion
  26623. //#region ../../packages/components/date-picker-panel/src/date-picker-com/basic-date-table.vue
  26624. var basic_date_table_default = basic_date_table_vue_vue_type_script_setup_true_lang_default;
  26625. //#endregion
  26626. //#region ../../packages/components/date-picker-panel/src/props/basic-month-table.ts
  26627. const basicMonthTableProps = buildProps({
  26628. ...datePickerSharedProps,
  26629. selectionMode: selectionModeWithDefault("month")
  26630. });
  26631. //#endregion
  26632. //#region ../../packages/components/date-picker-panel/src/date-picker-com/basic-month-table.vue?vue&type=script&setup=true&lang.ts
  26633. const _hoisted_1$50 = ["aria-label"];
  26634. const _hoisted_2$32 = [
  26635. "aria-selected",
  26636. "aria-label",
  26637. "tabindex",
  26638. "onKeydown"
  26639. ];
  26640. var basic_month_table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  26641. __name: "basic-month-table",
  26642. props: basicMonthTableProps,
  26643. emits: [
  26644. "changerange",
  26645. "pick",
  26646. "select"
  26647. ],
  26648. setup(__props, { expose: __expose, emit: __emit }) {
  26649. const props = __props;
  26650. const emit = __emit;
  26651. const ns = useNamespace("month-table");
  26652. const { t, lang } = useLocale();
  26653. const tbodyRef = ref();
  26654. const currentCellRef = ref();
  26655. const months = ref(props.date.locale("en").localeData().monthsShort().map((_) => _.toLowerCase()));
  26656. const tableRows = ref([
  26657. [],
  26658. [],
  26659. []
  26660. ]);
  26661. const lastRow = ref();
  26662. const lastColumn = ref();
  26663. const rows = computed(() => {
  26664. const rows = tableRows.value;
  26665. const now = (0, import_dayjs_min.default)().locale(lang.value).startOf("month");
  26666. for (let i = 0; i < 3; i++) {
  26667. const row = rows[i];
  26668. for (let j = 0; j < 4; j++) {
  26669. const cell = row[j] ||= {
  26670. row: i,
  26671. column: j,
  26672. type: "normal",
  26673. inRange: false,
  26674. start: false,
  26675. end: false,
  26676. text: -1,
  26677. disabled: false,
  26678. isSelected: false,
  26679. customClass: void 0,
  26680. date: void 0,
  26681. dayjs: void 0,
  26682. isCurrent: void 0,
  26683. selected: void 0,
  26684. renderText: void 0,
  26685. timestamp: void 0
  26686. };
  26687. cell.type = "normal";
  26688. const index = i * 4 + j;
  26689. const calTime = props.date.startOf("year").month(index);
  26690. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  26691. 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"));
  26692. if (props.minDate?.isSameOrAfter(calEndDate)) {
  26693. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  26694. cell.end = props.minDate && calTime.isSame(props.minDate, "month");
  26695. } else {
  26696. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "month"));
  26697. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "month"));
  26698. }
  26699. if (now.isSame(calTime)) cell.type = "today";
  26700. const cellDate = calTime.toDate();
  26701. cell.text = index;
  26702. cell.disabled = props.disabledDate?.(cellDate) || false;
  26703. cell.date = cellDate;
  26704. cell.customClass = props.cellClassName?.(cellDate);
  26705. cell.dayjs = calTime;
  26706. cell.timestamp = calTime.valueOf();
  26707. cell.isSelected = isSelectedCell(cell);
  26708. }
  26709. }
  26710. return rows;
  26711. });
  26712. const focus = () => {
  26713. currentCellRef.value?.focus();
  26714. };
  26715. const getCellStyle = (cell) => {
  26716. const style = {};
  26717. const year = props.date.year();
  26718. const today = /* @__PURE__ */ new Date();
  26719. const month = cell.text;
  26720. style.disabled = props.disabled || (props.disabledDate ? datesInMonth(props.date, year, month, lang.value).every(props.disabledDate) : false);
  26721. style.current = castArray(props.parsedValue).some((date) => import_dayjs_min.default.isDayjs(date) && date.year() === year && date.month() === month);
  26722. style.today = today.getFullYear() === year && today.getMonth() === month;
  26723. if (cell.customClass) style[cell.customClass] = true;
  26724. if (cell.inRange) {
  26725. style["in-range"] = true;
  26726. if (cell.start) style["start-date"] = true;
  26727. if (cell.end) style["end-date"] = true;
  26728. }
  26729. return style;
  26730. };
  26731. const isSelectedCell = (cell) => {
  26732. const year = props.date.year();
  26733. const month = cell.text;
  26734. return castArray(props.date).some((date) => date.year() === year && date.month() === month);
  26735. };
  26736. const handleMouseMove = (event) => {
  26737. if (!props.rangeState.selecting) return;
  26738. let target = event.target;
  26739. if (target.tagName === "SPAN") target = target.parentNode?.parentNode;
  26740. if (target.tagName === "DIV") target = target.parentNode;
  26741. if (target.tagName !== "TD") return;
  26742. const row = target.parentNode.rowIndex;
  26743. const column = target.cellIndex;
  26744. if (rows.value[row][column].disabled) return;
  26745. if (row !== lastRow.value || column !== lastColumn.value) {
  26746. lastRow.value = row;
  26747. lastColumn.value = column;
  26748. emit("changerange", {
  26749. selecting: true,
  26750. endDate: props.date.startOf("year").month(row * 4 + column)
  26751. });
  26752. }
  26753. };
  26754. const handleMonthTableClick = (event) => {
  26755. if (props.disabled) return;
  26756. const target = event.target?.closest("td");
  26757. if (target?.tagName !== "TD") return;
  26758. if (hasClass(target, "disabled")) return;
  26759. const column = target.cellIndex;
  26760. const month = target.parentNode.rowIndex * 4 + column;
  26761. const newDate = props.date.startOf("year").month(month);
  26762. if (props.selectionMode === "months") {
  26763. if (event.type === "keydown") {
  26764. emit("pick", castArray(props.parsedValue), false);
  26765. return;
  26766. }
  26767. const newMonth = getValidDateOfMonth(props.date, props.date.year(), month, lang.value, props.disabledDate);
  26768. emit("pick", hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => d?.year() !== newMonth.year() || d?.month() !== newMonth.month()) : castArray(props.parsedValue).concat([(0, import_dayjs_min.default)(newMonth)]));
  26769. } else if (props.selectionMode === "range") if (!props.rangeState.selecting) {
  26770. emit("pick", {
  26771. minDate: newDate,
  26772. maxDate: null
  26773. });
  26774. emit("select", true);
  26775. } else {
  26776. if (props.minDate && newDate >= props.minDate) emit("pick", {
  26777. minDate: props.minDate,
  26778. maxDate: newDate
  26779. });
  26780. else emit("pick", {
  26781. minDate: newDate,
  26782. maxDate: props.minDate
  26783. });
  26784. emit("select", false);
  26785. }
  26786. else emit("pick", month);
  26787. };
  26788. watch(() => props.date, async () => {
  26789. if (tbodyRef.value?.contains(document.activeElement)) {
  26790. await nextTick();
  26791. currentCellRef.value?.focus();
  26792. }
  26793. });
  26794. __expose({ focus });
  26795. return (_ctx, _cache) => {
  26796. return openBlock(), createElementBlock("table", {
  26797. role: "grid",
  26798. "aria-label": unref(t)("el.datepicker.monthTablePrompt"),
  26799. class: normalizeClass(unref(ns).b()),
  26800. onClick: handleMonthTableClick,
  26801. onMousemove: handleMouseMove
  26802. }, [createElementVNode("tbody", {
  26803. ref_key: "tbodyRef",
  26804. ref: tbodyRef
  26805. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row, key) => {
  26806. return openBlock(), createElementBlock("tr", { key }, [(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, key_) => {
  26807. return openBlock(), createElementBlock("td", {
  26808. key: key_,
  26809. ref_for: true,
  26810. ref: (el) => cell.isSelected && (currentCellRef.value = el),
  26811. class: normalizeClass(getCellStyle(cell)),
  26812. "aria-selected": !!cell.isSelected,
  26813. "aria-label": unref(t)(`el.datepicker.month${+cell.text + 1}`),
  26814. tabindex: cell.isSelected ? 0 : -1,
  26815. onKeydown: [withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["space"]), withKeys(withModifiers(handleMonthTableClick, ["prevent", "stop"]), ["enter"])]
  26816. }, [createVNode(unref(basic_cell_render_default), { cell: {
  26817. ...cell,
  26818. renderText: unref(t)("el.datepicker.months." + months.value[cell.text])
  26819. } }, null, 8, ["cell"])], 42, _hoisted_2$32);
  26820. }), 128))]);
  26821. }), 128))], 512)], 42, _hoisted_1$50);
  26822. };
  26823. }
  26824. });
  26825. //#endregion
  26826. //#region ../../packages/components/date-picker-panel/src/date-picker-com/basic-month-table.vue
  26827. var basic_month_table_default = basic_month_table_vue_vue_type_script_setup_true_lang_default;
  26828. //#endregion
  26829. //#region ../../packages/components/date-picker-panel/src/props/basic-year-table.ts
  26830. const basicYearTableProps = buildProps({
  26831. ...datePickerSharedProps,
  26832. selectionMode: selectionModeWithDefault("year")
  26833. });
  26834. //#endregion
  26835. //#region ../../packages/components/date-picker-panel/src/date-picker-com/basic-year-table.vue?vue&type=script&setup=true&lang.ts
  26836. const _hoisted_1$49 = ["aria-label"];
  26837. const _hoisted_2$31 = [
  26838. "aria-selected",
  26839. "aria-label",
  26840. "tabindex",
  26841. "onKeydown"
  26842. ];
  26843. var basic_year_table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  26844. __name: "basic-year-table",
  26845. props: basicYearTableProps,
  26846. emits: [
  26847. "changerange",
  26848. "pick",
  26849. "select"
  26850. ],
  26851. setup(__props, { expose: __expose, emit: __emit }) {
  26852. const datesInYear = (year, lang) => {
  26853. const firstDay = (0, import_dayjs_min.default)(String(year)).locale(lang).startOf("year");
  26854. return rangeArr(firstDay.endOf("year").dayOfYear()).map((n) => firstDay.add(n, "day").toDate());
  26855. };
  26856. const props = __props;
  26857. const emit = __emit;
  26858. const ns = useNamespace("year-table");
  26859. const { t, lang } = useLocale();
  26860. const tbodyRef = ref();
  26861. const currentCellRef = ref();
  26862. const startYear = computed(() => {
  26863. return Math.floor(props.date.year() / 10) * 10;
  26864. });
  26865. const tableRows = ref([
  26866. [],
  26867. [],
  26868. []
  26869. ]);
  26870. const lastRow = ref();
  26871. const lastColumn = ref();
  26872. const rows = computed(() => {
  26873. const rows = tableRows.value;
  26874. const now = (0, import_dayjs_min.default)().locale(lang.value).startOf("year");
  26875. for (let i = 0; i < 3; i++) {
  26876. const row = rows[i];
  26877. for (let j = 0; j < 4; j++) {
  26878. if (i * 4 + j >= 10) break;
  26879. let cell = row[j];
  26880. if (!cell) cell = {
  26881. row: i,
  26882. column: j,
  26883. type: "normal",
  26884. inRange: false,
  26885. start: false,
  26886. end: false,
  26887. text: -1,
  26888. disabled: false,
  26889. isSelected: false,
  26890. customClass: void 0,
  26891. date: void 0,
  26892. dayjs: void 0,
  26893. isCurrent: void 0,
  26894. selected: void 0,
  26895. renderText: void 0,
  26896. timestamp: void 0
  26897. };
  26898. cell.type = "normal";
  26899. const index = i * 4 + j + startYear.value;
  26900. const calTime = (0, import_dayjs_min.default)().year(index);
  26901. const calEndDate = props.rangeState.endDate || props.maxDate || props.rangeState.selecting && props.minDate || null;
  26902. cell.inRange = !!(props.minDate && calTime.isSameOrAfter(props.minDate, "year") && calEndDate && calTime.isSameOrBefore(calEndDate, "year")) || !!(props.minDate && calTime.isSameOrBefore(props.minDate, "year") && calEndDate && calTime.isSameOrAfter(calEndDate, "year"));
  26903. if (props.minDate?.isSameOrAfter(calEndDate)) {
  26904. cell.start = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  26905. cell.end = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  26906. } else {
  26907. cell.start = !!(props.minDate && calTime.isSame(props.minDate, "year"));
  26908. cell.end = !!(calEndDate && calTime.isSame(calEndDate, "year"));
  26909. }
  26910. if (now.isSame(calTime)) cell.type = "today";
  26911. cell.text = index;
  26912. const cellDate = calTime.toDate();
  26913. cell.disabled = props.disabledDate?.(cellDate) || false;
  26914. cell.date = cellDate;
  26915. cell.customClass = props.cellClassName?.(cellDate);
  26916. cell.dayjs = calTime;
  26917. cell.timestamp = calTime.valueOf();
  26918. cell.isSelected = isSelectedCell(cell);
  26919. row[j] = cell;
  26920. }
  26921. }
  26922. return rows;
  26923. });
  26924. const focus = () => {
  26925. currentCellRef.value?.focus();
  26926. };
  26927. const getCellKls = (cell) => {
  26928. const kls = {};
  26929. const today = (0, import_dayjs_min.default)().locale(lang.value);
  26930. const year = cell.text;
  26931. kls.disabled = props.disabled || (props.disabledDate ? datesInYear(year, lang.value).every(props.disabledDate) : false);
  26932. kls.today = today.year() === year;
  26933. kls.current = castArray(props.parsedValue).some((d) => d.year() === year);
  26934. if (cell.customClass) kls[cell.customClass] = true;
  26935. if (cell.inRange) {
  26936. kls["in-range"] = true;
  26937. if (cell.start) kls["start-date"] = true;
  26938. if (cell.end) kls["end-date"] = true;
  26939. }
  26940. return kls;
  26941. };
  26942. const isSelectedCell = (cell) => {
  26943. const year = cell.text;
  26944. return castArray(props.date).some((date) => date.year() === year);
  26945. };
  26946. const handleYearTableClick = (event) => {
  26947. if (props.disabled) return;
  26948. const target = event.target?.closest("td");
  26949. if (!target || !target.textContent || hasClass(target, "disabled")) return;
  26950. const column = target.cellIndex;
  26951. const selectedYear = target.parentNode.rowIndex * 4 + column + startYear.value;
  26952. const newDate = (0, import_dayjs_min.default)().year(selectedYear);
  26953. if (props.selectionMode === "range") if (!props.rangeState.selecting) {
  26954. emit("pick", {
  26955. minDate: newDate,
  26956. maxDate: null
  26957. });
  26958. emit("select", true);
  26959. } else {
  26960. if (props.minDate && newDate >= props.minDate) emit("pick", {
  26961. minDate: props.minDate,
  26962. maxDate: newDate
  26963. });
  26964. else emit("pick", {
  26965. minDate: newDate,
  26966. maxDate: props.minDate
  26967. });
  26968. emit("select", false);
  26969. }
  26970. else if (props.selectionMode === "years") {
  26971. if (event.type === "keydown") {
  26972. emit("pick", castArray(props.parsedValue), false);
  26973. return;
  26974. }
  26975. const vaildYear = getValidDateOfYear(newDate.startOf("year"), lang.value, props.disabledDate);
  26976. emit("pick", hasClass(target, "current") ? castArray(props.parsedValue).filter((d) => d?.year() !== selectedYear) : castArray(props.parsedValue).concat([vaildYear]));
  26977. } else emit("pick", selectedYear);
  26978. };
  26979. const handleMouseMove = (event) => {
  26980. if (!props.rangeState.selecting) return;
  26981. const target = event.target?.closest("td");
  26982. if (!target) return;
  26983. const row = target.parentNode.rowIndex;
  26984. const column = target.cellIndex;
  26985. if (rows.value[row][column].disabled) return;
  26986. if (row !== lastRow.value || column !== lastColumn.value) {
  26987. lastRow.value = row;
  26988. lastColumn.value = column;
  26989. emit("changerange", {
  26990. selecting: true,
  26991. endDate: (0, import_dayjs_min.default)().year(startYear.value).add(row * 4 + column, "year")
  26992. });
  26993. }
  26994. };
  26995. watch(() => props.date, async () => {
  26996. if (tbodyRef.value?.contains(document.activeElement)) {
  26997. await nextTick();
  26998. currentCellRef.value?.focus();
  26999. }
  27000. });
  27001. __expose({ focus });
  27002. return (_ctx, _cache) => {
  27003. return openBlock(), createElementBlock("table", {
  27004. role: "grid",
  27005. "aria-label": unref(t)("el.datepicker.yearTablePrompt"),
  27006. class: normalizeClass(unref(ns).b()),
  27007. onClick: handleYearTableClick,
  27008. onMousemove: handleMouseMove
  27009. }, [createElementVNode("tbody", {
  27010. ref_key: "tbodyRef",
  27011. ref: tbodyRef
  27012. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row, rowKey) => {
  27013. return openBlock(), createElementBlock("tr", { key: rowKey }, [(openBlock(true), createElementBlock(Fragment, null, renderList(row, (cell, cellKey) => {
  27014. return openBlock(), createElementBlock("td", {
  27015. key: `${rowKey}_${cellKey}`,
  27016. ref_for: true,
  27017. ref: (el) => cell.isSelected && (currentCellRef.value = el),
  27018. class: normalizeClass(["available", getCellKls(cell)]),
  27019. "aria-selected": cell.isSelected,
  27020. "aria-label": String(cell.text),
  27021. tabindex: cell.isSelected ? 0 : -1,
  27022. onKeydown: [withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["space"]), withKeys(withModifiers(handleYearTableClick, ["prevent", "stop"]), ["enter"])]
  27023. }, [createVNode(unref(basic_cell_render_default), { cell }, null, 8, ["cell"])], 42, _hoisted_2$31);
  27024. }), 128))]);
  27025. }), 128))], 512)], 42, _hoisted_1$49);
  27026. };
  27027. }
  27028. });
  27029. //#endregion
  27030. //#region ../../packages/components/date-picker-panel/src/date-picker-com/basic-year-table.vue
  27031. var basic_year_table_default = basic_year_table_vue_vue_type_script_setup_true_lang_default;
  27032. //#endregion
  27033. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-date-pick.vue?vue&type=script&setup=true&lang.ts
  27034. const _hoisted_1$48 = ["disabled", "onClick"];
  27035. const _hoisted_2$30 = ["aria-label", "disabled"];
  27036. const _hoisted_3$14 = ["aria-label", "disabled"];
  27037. const _hoisted_4$11 = ["tabindex", "aria-disabled"];
  27038. const _hoisted_5$8 = ["tabindex", "aria-disabled"];
  27039. const _hoisted_6$3 = ["aria-label", "disabled"];
  27040. const _hoisted_7$2 = ["aria-label", "disabled"];
  27041. var panel_date_pick_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  27042. __name: "panel-date-pick",
  27043. props: panelDatePickProps,
  27044. emits: [
  27045. "pick",
  27046. "set-picker-option",
  27047. "panel-change"
  27048. ],
  27049. setup(__props, { emit: __emit }) {
  27050. const timeWithinRange = (_, __, ___) => true;
  27051. const props = __props;
  27052. const contextEmit = __emit;
  27053. const ppNs = useNamespace("picker-panel");
  27054. const dpNs = useNamespace("date-picker");
  27055. const attrs = useAttrs$1();
  27056. const slots = useSlots();
  27057. const { t, lang } = useLocale();
  27058. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  27059. const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  27060. const { shortcuts, disabledDate, cellClassName, defaultTime } = pickerBase.props;
  27061. const defaultValue = toRef(pickerBase.props, "defaultValue");
  27062. const currentViewRef = ref();
  27063. const innerDate = ref((0, import_dayjs_min.default)().locale(lang.value));
  27064. const isChangeToNow = ref(false);
  27065. let isShortcut = false;
  27066. const defaultTimeD = computed(() => {
  27067. return (0, import_dayjs_min.default)(defaultTime).locale(lang.value);
  27068. });
  27069. const month = computed(() => {
  27070. return innerDate.value.month();
  27071. });
  27072. const year = computed(() => {
  27073. return innerDate.value.year();
  27074. });
  27075. const selectableRange = ref([]);
  27076. const userInputDate = ref(null);
  27077. const userInputTime = ref(null);
  27078. const checkDateWithinRange = (date) => {
  27079. return selectableRange.value.length > 0 ? timeWithinRange(date, selectableRange.value, props.format || "HH:mm:ss") : true;
  27080. };
  27081. const formatEmit = (emitDayjs) => {
  27082. if (defaultTime && !visibleTime.value && !isChangeToNow.value && !isShortcut) return defaultTimeD.value.year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  27083. if (showTime.value) return emitDayjs.millisecond(0);
  27084. return emitDayjs.startOf("day");
  27085. };
  27086. const emit = (value, ...args) => {
  27087. if (!value) contextEmit("pick", value, ...args);
  27088. else if (isArray$1(value)) contextEmit("pick", value.map(formatEmit), ...args);
  27089. else contextEmit("pick", formatEmit(value), ...args);
  27090. userInputDate.value = null;
  27091. userInputTime.value = null;
  27092. isChangeToNow.value = false;
  27093. isShortcut = false;
  27094. };
  27095. const handleDatePick = async (value, keepOpen) => {
  27096. if (selectionMode.value === "date" && import_dayjs_min.default.isDayjs(value)) {
  27097. const parsedDateValue = extractFirst(props.parsedValue);
  27098. let newDate = parsedDateValue ? parsedDateValue.year(value.year()).month(value.month()).date(value.date()) : value;
  27099. if (!checkDateWithinRange(newDate)) newDate = selectableRange.value[0][0].year(value.year()).month(value.month()).date(value.date());
  27100. innerDate.value = newDate;
  27101. emit(newDate, showTime.value || keepOpen);
  27102. } else if (selectionMode.value === "week") emit(value.date);
  27103. else if (selectionMode.value === "dates") emit(value, true);
  27104. };
  27105. const moveByMonth = (forward) => {
  27106. const action = forward ? "add" : "subtract";
  27107. innerDate.value = innerDate.value[action](1, "month");
  27108. handlePanelChange("month");
  27109. };
  27110. const moveByYear = (forward) => {
  27111. const currentDate = innerDate.value;
  27112. const action = forward ? "add" : "subtract";
  27113. innerDate.value = currentView.value === "year" ? currentDate[action](10, "year") : currentDate[action](1, "year");
  27114. handlePanelChange("year");
  27115. };
  27116. const currentView = ref("date");
  27117. const yearLabel = computed(() => {
  27118. const yearTranslation = t("el.datepicker.year");
  27119. if (currentView.value === "year") {
  27120. const startYear = Math.floor(year.value / 10) * 10;
  27121. if (yearTranslation) return `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}`;
  27122. return `${startYear} - ${startYear + 9}`;
  27123. }
  27124. return `${year.value} ${yearTranslation}`;
  27125. });
  27126. const handleShortcutClick = (shortcut) => {
  27127. const shortcutValue = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  27128. if (shortcutValue) {
  27129. isShortcut = true;
  27130. emit((0, import_dayjs_min.default)(shortcutValue).locale(lang.value));
  27131. return;
  27132. }
  27133. if (shortcut.onClick) shortcut.onClick({
  27134. attrs,
  27135. slots,
  27136. emit: contextEmit
  27137. });
  27138. };
  27139. const selectionMode = computed(() => {
  27140. const { type } = props;
  27141. if ([
  27142. "week",
  27143. "month",
  27144. "months",
  27145. "year",
  27146. "years",
  27147. "dates"
  27148. ].includes(type)) return type;
  27149. return "date";
  27150. });
  27151. const isMultipleType = computed(() => {
  27152. return selectionMode.value === "dates" || selectionMode.value === "months" || selectionMode.value === "years";
  27153. });
  27154. const keyboardMode = computed(() => {
  27155. return selectionMode.value === "date" ? currentView.value : selectionMode.value;
  27156. });
  27157. const hasShortcuts = computed(() => !!shortcuts.length);
  27158. const handleMonthPick = async (month, keepOpen) => {
  27159. if (selectionMode.value === "month") {
  27160. innerDate.value = getValidDateOfMonth(innerDate.value, innerDate.value.year(), month, lang.value, disabledDate);
  27161. emit(innerDate.value, false);
  27162. } else if (selectionMode.value === "months") emit(month, keepOpen ?? true);
  27163. else {
  27164. innerDate.value = getValidDateOfMonth(innerDate.value, innerDate.value.year(), month, lang.value, disabledDate);
  27165. currentView.value = "date";
  27166. if ([
  27167. "month",
  27168. "year",
  27169. "date",
  27170. "week"
  27171. ].includes(selectionMode.value)) {
  27172. emit(innerDate.value, true);
  27173. await nextTick();
  27174. handleFocusPicker();
  27175. }
  27176. }
  27177. handlePanelChange("month");
  27178. };
  27179. const handleYearPick = async (year, keepOpen) => {
  27180. if (selectionMode.value === "year") {
  27181. innerDate.value = getValidDateOfYear(innerDate.value.startOf("year").year(year), lang.value, disabledDate);
  27182. emit(innerDate.value, false);
  27183. } else if (selectionMode.value === "years") emit(year, keepOpen ?? true);
  27184. else {
  27185. innerDate.value = getValidDateOfYear(innerDate.value.year(year), lang.value, disabledDate);
  27186. currentView.value = "month";
  27187. if ([
  27188. "month",
  27189. "year",
  27190. "date",
  27191. "week"
  27192. ].includes(selectionMode.value)) {
  27193. emit(innerDate.value, true);
  27194. await nextTick();
  27195. handleFocusPicker();
  27196. }
  27197. }
  27198. handlePanelChange("year");
  27199. };
  27200. const dateDisabled = useFormDisabled();
  27201. const showPicker = async (view) => {
  27202. if (dateDisabled.value) return;
  27203. currentView.value = view;
  27204. await nextTick();
  27205. handleFocusPicker();
  27206. };
  27207. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  27208. const footerVisible = computed(() => {
  27209. const showDateFooter = showTime.value || selectionMode.value === "dates";
  27210. const showYearFooter = selectionMode.value === "years";
  27211. const showMonthFooter = selectionMode.value === "months";
  27212. const isDateView = currentView.value === "date";
  27213. const isYearView = currentView.value === "year";
  27214. const isMonthView = currentView.value === "month";
  27215. return showDateFooter && isDateView || showYearFooter && isYearView || showMonthFooter && isMonthView;
  27216. });
  27217. const footerFilled = computed(() => !isMultipleType.value && props.showNow || props.showConfirm);
  27218. const disabledConfirm = computed(() => {
  27219. if (!disabledDate) return false;
  27220. if (!props.parsedValue) return true;
  27221. if (isArray$1(props.parsedValue)) return disabledDate(props.parsedValue[0].toDate());
  27222. return disabledDate(props.parsedValue.toDate());
  27223. });
  27224. const onConfirm = () => {
  27225. if (isMultipleType.value) emit(props.parsedValue);
  27226. else {
  27227. let result = extractFirst(props.parsedValue);
  27228. if (!result) {
  27229. const defaultTimeD = (0, import_dayjs_min.default)(defaultTime).locale(lang.value);
  27230. const defaultValueD = getDefaultValue();
  27231. result = defaultTimeD.year(defaultValueD.year()).month(defaultValueD.month()).date(defaultValueD.date());
  27232. }
  27233. innerDate.value = result;
  27234. emit(result);
  27235. }
  27236. };
  27237. const disabledNow = computed(() => {
  27238. if (!disabledDate) return false;
  27239. return disabledDate((0, import_dayjs_min.default)().locale(lang.value).toDate());
  27240. });
  27241. const changeToNow = () => {
  27242. const nowDate = (0, import_dayjs_min.default)().locale(lang.value).toDate();
  27243. isChangeToNow.value = true;
  27244. if ((!disabledDate || !disabledDate(nowDate)) && checkDateWithinRange(nowDate)) {
  27245. innerDate.value = (0, import_dayjs_min.default)().locale(lang.value);
  27246. emit(innerDate.value);
  27247. }
  27248. };
  27249. const timeFormat = computed(() => {
  27250. return props.timeFormat || extractTimeFormat(props.format) || "HH:mm:ss";
  27251. });
  27252. const dateFormat = computed(() => {
  27253. return props.dateFormat || extractDateFormat(props.format) || "YYYY-MM-DD";
  27254. });
  27255. const visibleTime = computed(() => {
  27256. if (userInputTime.value) return userInputTime.value;
  27257. if (!props.parsedValue && !defaultValue.value) return;
  27258. return (extractFirst(props.parsedValue) || innerDate.value).format(timeFormat.value);
  27259. });
  27260. const visibleDate = computed(() => {
  27261. if (userInputDate.value) return userInputDate.value;
  27262. if (!props.parsedValue && !defaultValue.value) return;
  27263. return (extractFirst(props.parsedValue) || innerDate.value).format(dateFormat.value);
  27264. });
  27265. const timePickerVisible = ref(false);
  27266. const onTimePickerInputFocus = () => {
  27267. timePickerVisible.value = true;
  27268. };
  27269. const handleTimePickClose = () => {
  27270. timePickerVisible.value = false;
  27271. };
  27272. const getUnits = (date) => {
  27273. return {
  27274. hour: date.hour(),
  27275. minute: date.minute(),
  27276. second: date.second(),
  27277. year: date.year(),
  27278. month: date.month(),
  27279. date: date.date()
  27280. };
  27281. };
  27282. const handleTimePick = (value, visible, first) => {
  27283. const { hour, minute, second } = getUnits(value);
  27284. const parsedDateValue = extractFirst(props.parsedValue);
  27285. innerDate.value = parsedDateValue ? parsedDateValue.hour(hour).minute(minute).second(second) : value;
  27286. emit(innerDate.value, true);
  27287. if (!first) timePickerVisible.value = visible;
  27288. };
  27289. const handleVisibleTimeChange = (value) => {
  27290. const newDate = (0, import_dayjs_min.default)(value, timeFormat.value).locale(lang.value);
  27291. if (newDate.isValid() && checkDateWithinRange(newDate)) {
  27292. const { year, month, date } = getUnits(innerDate.value);
  27293. innerDate.value = newDate.year(year).month(month).date(date);
  27294. userInputTime.value = null;
  27295. timePickerVisible.value = false;
  27296. emit(innerDate.value, true);
  27297. }
  27298. };
  27299. const handleVisibleDateChange = (value) => {
  27300. const newDate = correctlyParseUserInput(value, dateFormat.value, lang.value, isDefaultFormat);
  27301. if (newDate.isValid()) {
  27302. if (disabledDate && disabledDate(newDate.toDate())) return;
  27303. const { hour, minute, second } = getUnits(innerDate.value);
  27304. innerDate.value = newDate.hour(hour).minute(minute).second(second);
  27305. userInputDate.value = null;
  27306. emit(innerDate.value, true);
  27307. }
  27308. };
  27309. const isValidValue = (date) => {
  27310. return import_dayjs_min.default.isDayjs(date) && date.isValid() && (disabledDate ? !disabledDate(date.toDate()) : true);
  27311. };
  27312. const parseUserInput = (value) => {
  27313. return correctlyParseUserInput(value, props.format, lang.value, isDefaultFormat);
  27314. };
  27315. const getDefaultValue = () => {
  27316. const parseDate = (0, import_dayjs_min.default)(defaultValue.value).locale(lang.value);
  27317. if (!defaultValue.value) {
  27318. const defaultTimeDValue = defaultTimeD.value;
  27319. return (0, import_dayjs_min.default)().hour(defaultTimeDValue.hour()).minute(defaultTimeDValue.minute()).second(defaultTimeDValue.second()).locale(lang.value);
  27320. }
  27321. return parseDate;
  27322. };
  27323. const handleFocusPicker = () => {
  27324. if ([
  27325. "week",
  27326. "month",
  27327. "year",
  27328. "date"
  27329. ].includes(selectionMode.value)) currentViewRef.value?.focus();
  27330. };
  27331. const _handleFocusPicker = () => {
  27332. handleFocusPicker();
  27333. if (selectionMode.value === "week") handleKeyControl(EVENT_CODE.down);
  27334. };
  27335. const handleKeydownTable = (event) => {
  27336. const code = getEventCode(event);
  27337. if ([
  27338. EVENT_CODE.up,
  27339. EVENT_CODE.down,
  27340. EVENT_CODE.left,
  27341. EVENT_CODE.right,
  27342. EVENT_CODE.home,
  27343. EVENT_CODE.end,
  27344. EVENT_CODE.pageUp,
  27345. EVENT_CODE.pageDown
  27346. ].includes(code)) {
  27347. handleKeyControl(code);
  27348. event.stopPropagation();
  27349. event.preventDefault();
  27350. }
  27351. if ([
  27352. EVENT_CODE.enter,
  27353. EVENT_CODE.space,
  27354. EVENT_CODE.numpadEnter
  27355. ].includes(code) && userInputDate.value === null && userInputTime.value === null) {
  27356. event.preventDefault();
  27357. emit(innerDate.value, false);
  27358. }
  27359. };
  27360. const handleKeyControl = (code) => {
  27361. const { up, down, left, right, home, end, pageUp, pageDown } = EVENT_CODE;
  27362. const mapping = {
  27363. year: {
  27364. [up]: -4,
  27365. [down]: 4,
  27366. [left]: -1,
  27367. [right]: 1,
  27368. offset: (date, step) => date.setFullYear(date.getFullYear() + step)
  27369. },
  27370. month: {
  27371. [up]: -4,
  27372. [down]: 4,
  27373. [left]: -1,
  27374. [right]: 1,
  27375. offset: (date, step) => date.setMonth(date.getMonth() + step)
  27376. },
  27377. week: {
  27378. [up]: -1,
  27379. [down]: 1,
  27380. [left]: -1,
  27381. [right]: 1,
  27382. offset: (date, step) => date.setDate(date.getDate() + step * 7)
  27383. },
  27384. date: {
  27385. [up]: -7,
  27386. [down]: 7,
  27387. [left]: -1,
  27388. [right]: 1,
  27389. [home]: (date) => -date.getDay(),
  27390. [end]: (date) => -date.getDay() + 6,
  27391. [pageUp]: (date) => -new Date(date.getFullYear(), date.getMonth(), 0).getDate(),
  27392. [pageDown]: (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate(),
  27393. offset: (date, step) => date.setDate(date.getDate() + step)
  27394. }
  27395. };
  27396. const newDate = innerDate.value.toDate();
  27397. while (Math.abs(innerDate.value.diff(newDate, "year", true)) < 1) {
  27398. const map = mapping[keyboardMode.value];
  27399. if (!map) return;
  27400. map.offset(newDate, isFunction$1(map[code]) ? map[code](newDate) : map[code] ?? 0);
  27401. if (disabledDate && disabledDate(newDate)) break;
  27402. const result = (0, import_dayjs_min.default)(newDate).locale(lang.value);
  27403. innerDate.value = result;
  27404. contextEmit("pick", result, true);
  27405. break;
  27406. }
  27407. };
  27408. const handlePanelChange = (mode) => {
  27409. contextEmit("panel-change", innerDate.value.toDate(), mode, currentView.value);
  27410. };
  27411. watch(() => selectionMode.value, (val) => {
  27412. if (["month", "year"].includes(val)) {
  27413. currentView.value = val;
  27414. return;
  27415. } else if (val === "years") {
  27416. currentView.value = "year";
  27417. return;
  27418. } else if (val === "months") {
  27419. currentView.value = "month";
  27420. return;
  27421. }
  27422. currentView.value = "date";
  27423. }, { immediate: true });
  27424. watch(() => defaultValue.value, (val) => {
  27425. if (val) innerDate.value = getDefaultValue();
  27426. }, { immediate: true });
  27427. watch(() => props.parsedValue, (val) => {
  27428. if (val) {
  27429. if (isMultipleType.value) return;
  27430. if (isArray$1(val)) return;
  27431. innerDate.value = val;
  27432. } else innerDate.value = getDefaultValue();
  27433. }, { immediate: true });
  27434. contextEmit("set-picker-option", ["isValidValue", isValidValue]);
  27435. contextEmit("set-picker-option", ["parseUserInput", parseUserInput]);
  27436. contextEmit("set-picker-option", ["handleFocusPicker", _handleFocusPicker]);
  27437. return (_ctx, _cache) => {
  27438. return openBlock(), createElementBlock("div", { class: normalizeClass([
  27439. unref(ppNs).b(),
  27440. unref(dpNs).b(),
  27441. unref(ppNs).is("border", _ctx.border),
  27442. unref(ppNs).is("disabled", unref(dateDisabled)),
  27443. {
  27444. "has-sidebar": _ctx.$slots.sidebar || hasShortcuts.value,
  27445. "has-time": showTime.value
  27446. }
  27447. ]) }, [createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body-wrapper")) }, [
  27448. renderSlot(_ctx.$slots, "sidebar", { class: normalizeClass(unref(ppNs).e("sidebar")) }),
  27449. hasShortcuts.value ? (openBlock(), createElementBlock("div", {
  27450. key: 0,
  27451. class: normalizeClass(unref(ppNs).e("sidebar"))
  27452. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  27453. return openBlock(), createElementBlock("button", {
  27454. key,
  27455. type: "button",
  27456. disabled: unref(dateDisabled),
  27457. class: normalizeClass(unref(ppNs).e("shortcut")),
  27458. onClick: ($event) => handleShortcutClick(shortcut)
  27459. }, toDisplayString(shortcut.text), 11, _hoisted_1$48);
  27460. }), 128))], 2)) : createCommentVNode("v-if", true),
  27461. createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body")) }, [
  27462. showTime.value ? (openBlock(), createElementBlock("div", {
  27463. key: 0,
  27464. class: normalizeClass(unref(dpNs).e("time-header"))
  27465. }, [createElementVNode("span", { class: normalizeClass(unref(dpNs).e("editor-wrap")) }, [createVNode(unref(ElInput), {
  27466. placeholder: unref(t)("el.datepicker.selectDate"),
  27467. "model-value": visibleDate.value,
  27468. size: "small",
  27469. "validate-event": false,
  27470. disabled: unref(dateDisabled),
  27471. readonly: !_ctx.editable,
  27472. onInput: _cache[0] || (_cache[0] = (val) => userInputDate.value = val),
  27473. onChange: handleVisibleDateChange
  27474. }, null, 8, [
  27475. "placeholder",
  27476. "model-value",
  27477. "disabled",
  27478. "readonly"
  27479. ])], 2), withDirectives((openBlock(), createElementBlock("span", { class: normalizeClass(unref(dpNs).e("editor-wrap")) }, [createVNode(unref(ElInput), {
  27480. placeholder: unref(t)("el.datepicker.selectTime"),
  27481. "model-value": visibleTime.value,
  27482. size: "small",
  27483. "validate-event": false,
  27484. disabled: unref(dateDisabled),
  27485. readonly: !_ctx.editable,
  27486. onFocus: onTimePickerInputFocus,
  27487. onInput: _cache[1] || (_cache[1] = (val) => userInputTime.value = val),
  27488. onChange: handleVisibleTimeChange
  27489. }, null, 8, [
  27490. "placeholder",
  27491. "model-value",
  27492. "disabled",
  27493. "readonly"
  27494. ]), createVNode(unref(panel_time_pick_default), {
  27495. visible: timePickerVisible.value,
  27496. format: timeFormat.value,
  27497. "parsed-value": innerDate.value,
  27498. onPick: handleTimePick
  27499. }, null, 8, [
  27500. "visible",
  27501. "format",
  27502. "parsed-value"
  27503. ])], 2)), [[unref(ClickOutside), handleTimePickClose]])], 2)) : createCommentVNode("v-if", true),
  27504. withDirectives(createElementVNode("div", { class: normalizeClass([unref(dpNs).e("header"), (currentView.value === "year" || currentView.value === "month") && unref(dpNs).em("header", "bordered")]) }, [
  27505. createElementVNode("span", { class: normalizeClass(unref(dpNs).e("prev-btn")) }, [createElementVNode("button", {
  27506. type: "button",
  27507. "aria-label": unref(t)(`el.datepicker.prevYear`),
  27508. class: normalizeClass(["d-arrow-left", unref(ppNs).e("icon-btn")]),
  27509. disabled: unref(dateDisabled),
  27510. onClick: _cache[2] || (_cache[2] = ($event) => moveByYear(false))
  27511. }, [renderSlot(_ctx.$slots, "prev-year", {}, () => [createVNode(unref(ElIcon), null, {
  27512. default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
  27513. _: 1
  27514. })])], 10, _hoisted_2$30), withDirectives(createElementVNode("button", {
  27515. type: "button",
  27516. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  27517. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
  27518. disabled: unref(dateDisabled),
  27519. onClick: _cache[3] || (_cache[3] = ($event) => moveByMonth(false))
  27520. }, [renderSlot(_ctx.$slots, "prev-month", {}, () => [createVNode(unref(ElIcon), null, {
  27521. default: withCtx(() => [createVNode(unref(arrow_left_default))]),
  27522. _: 1
  27523. })])], 10, _hoisted_3$14), [[vShow, currentView.value === "date"]])], 2),
  27524. createElementVNode("span", {
  27525. role: "button",
  27526. class: normalizeClass(unref(dpNs).e("header-label")),
  27527. "aria-live": "polite",
  27528. tabindex: _ctx.disabled ? void 0 : 0,
  27529. "aria-disabled": _ctx.disabled,
  27530. onKeydown: _cache[4] || (_cache[4] = withKeys(($event) => showPicker("year"), ["enter"])),
  27531. onClick: _cache[5] || (_cache[5] = ($event) => showPicker("year"))
  27532. }, toDisplayString(yearLabel.value), 43, _hoisted_4$11),
  27533. withDirectives(createElementVNode("span", {
  27534. role: "button",
  27535. "aria-live": "polite",
  27536. tabindex: _ctx.disabled ? void 0 : 0,
  27537. "aria-disabled": _ctx.disabled,
  27538. class: normalizeClass([unref(dpNs).e("header-label"), { active: currentView.value === "month" }]),
  27539. onKeydown: _cache[6] || (_cache[6] = withKeys(($event) => showPicker("month"), ["enter"])),
  27540. onClick: _cache[7] || (_cache[7] = ($event) => showPicker("month"))
  27541. }, toDisplayString(unref(t)(`el.datepicker.month${month.value + 1}`)), 43, _hoisted_5$8), [[vShow, currentView.value === "date"]]),
  27542. createElementVNode("span", { class: normalizeClass(unref(dpNs).e("next-btn")) }, [withDirectives(createElementVNode("button", {
  27543. type: "button",
  27544. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  27545. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
  27546. disabled: unref(dateDisabled),
  27547. onClick: _cache[8] || (_cache[8] = ($event) => moveByMonth(true))
  27548. }, [renderSlot(_ctx.$slots, "next-month", {}, () => [createVNode(unref(ElIcon), null, {
  27549. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  27550. _: 1
  27551. })])], 10, _hoisted_6$3), [[vShow, currentView.value === "date"]]), createElementVNode("button", {
  27552. type: "button",
  27553. "aria-label": unref(t)(`el.datepicker.nextYear`),
  27554. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  27555. disabled: unref(dateDisabled),
  27556. onClick: _cache[9] || (_cache[9] = ($event) => moveByYear(true))
  27557. }, [renderSlot(_ctx.$slots, "next-year", {}, () => [createVNode(unref(ElIcon), null, {
  27558. default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
  27559. _: 1
  27560. })])], 10, _hoisted_7$2)], 2)
  27561. ], 2), [[vShow, currentView.value !== "time"]]),
  27562. createElementVNode("div", {
  27563. class: normalizeClass(unref(ppNs).e("content")),
  27564. onKeydown: handleKeydownTable
  27565. }, [
  27566. currentView.value === "date" ? (openBlock(), createBlock(basic_date_table_default, {
  27567. key: 0,
  27568. ref_key: "currentViewRef",
  27569. ref: currentViewRef,
  27570. "selection-mode": selectionMode.value,
  27571. date: innerDate.value,
  27572. "parsed-value": _ctx.parsedValue,
  27573. "disabled-date": unref(disabledDate),
  27574. disabled: unref(dateDisabled),
  27575. "cell-class-name": unref(cellClassName),
  27576. "show-week-number": _ctx.showWeekNumber,
  27577. onPick: handleDatePick
  27578. }, null, 8, [
  27579. "selection-mode",
  27580. "date",
  27581. "parsed-value",
  27582. "disabled-date",
  27583. "disabled",
  27584. "cell-class-name",
  27585. "show-week-number"
  27586. ])) : createCommentVNode("v-if", true),
  27587. currentView.value === "year" ? (openBlock(), createBlock(basic_year_table_default, {
  27588. key: 1,
  27589. ref_key: "currentViewRef",
  27590. ref: currentViewRef,
  27591. "selection-mode": selectionMode.value,
  27592. date: innerDate.value,
  27593. "disabled-date": unref(disabledDate),
  27594. disabled: unref(dateDisabled),
  27595. "parsed-value": _ctx.parsedValue,
  27596. "cell-class-name": unref(cellClassName),
  27597. onPick: handleYearPick
  27598. }, null, 8, [
  27599. "selection-mode",
  27600. "date",
  27601. "disabled-date",
  27602. "disabled",
  27603. "parsed-value",
  27604. "cell-class-name"
  27605. ])) : createCommentVNode("v-if", true),
  27606. currentView.value === "month" ? (openBlock(), createBlock(basic_month_table_default, {
  27607. key: 2,
  27608. ref_key: "currentViewRef",
  27609. ref: currentViewRef,
  27610. "selection-mode": selectionMode.value,
  27611. date: innerDate.value,
  27612. "parsed-value": _ctx.parsedValue,
  27613. "disabled-date": unref(disabledDate),
  27614. disabled: unref(dateDisabled),
  27615. "cell-class-name": unref(cellClassName),
  27616. onPick: handleMonthPick
  27617. }, null, 8, [
  27618. "selection-mode",
  27619. "date",
  27620. "parsed-value",
  27621. "disabled-date",
  27622. "disabled",
  27623. "cell-class-name"
  27624. ])) : createCommentVNode("v-if", true)
  27625. ], 34)
  27626. ], 2)
  27627. ], 2), _ctx.showFooter && footerVisible.value && footerFilled.value ? (openBlock(), createElementBlock("div", {
  27628. key: 0,
  27629. class: normalizeClass(unref(ppNs).e("footer"))
  27630. }, [withDirectives(createVNode(unref(ElButton), {
  27631. text: "",
  27632. size: "small",
  27633. class: normalizeClass(unref(ppNs).e("link-btn")),
  27634. disabled: disabledNow.value,
  27635. onClick: changeToNow
  27636. }, {
  27637. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.now")), 1)]),
  27638. _: 1
  27639. }, 8, ["class", "disabled"]), [[vShow, !isMultipleType.value && _ctx.showNow]]), _ctx.showConfirm ? (openBlock(), createBlock(unref(ElButton), {
  27640. key: 0,
  27641. plain: "",
  27642. size: "small",
  27643. class: normalizeClass(unref(ppNs).e("link-btn")),
  27644. disabled: disabledConfirm.value,
  27645. onClick: onConfirm
  27646. }, {
  27647. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)]),
  27648. _: 1
  27649. }, 8, ["class", "disabled"])) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true)], 2);
  27650. };
  27651. }
  27652. });
  27653. //#endregion
  27654. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-date-pick.vue
  27655. var panel_date_pick_default = panel_date_pick_vue_vue_type_script_setup_true_lang_default;
  27656. //#endregion
  27657. //#region ../../packages/components/date-picker-panel/src/props/panel-date-range.ts
  27658. const panelDateRangeProps = buildProps({
  27659. ...panelSharedProps,
  27660. ...panelRangeSharedProps
  27661. });
  27662. //#endregion
  27663. //#region ../../packages/components/date-picker-panel/src/composables/use-shortcut.ts
  27664. const useShortcut = (lang) => {
  27665. const { emit } = getCurrentInstance();
  27666. const attrs = useAttrs$1();
  27667. const slots = useSlots();
  27668. const handleShortcutClick = (shortcut) => {
  27669. const shortcutValues = isFunction$1(shortcut.value) ? shortcut.value() : shortcut.value;
  27670. if (shortcutValues) {
  27671. emit("pick", [(0, import_dayjs_min.default)(shortcutValues[0]).locale(lang.value), (0, import_dayjs_min.default)(shortcutValues[1]).locale(lang.value)]);
  27672. return;
  27673. }
  27674. if (shortcut.onClick) shortcut.onClick({
  27675. attrs,
  27676. slots,
  27677. emit
  27678. });
  27679. };
  27680. return handleShortcutClick;
  27681. };
  27682. //#endregion
  27683. //#region ../../packages/components/date-picker-panel/src/composables/use-range-picker.ts
  27684. const useRangePicker = (props, { defaultValue, defaultTime, leftDate, rightDate, step, unit, sortDates }) => {
  27685. const { emit } = getCurrentInstance();
  27686. const { pickerNs } = inject(ROOT_PICKER_INJECTION_KEY);
  27687. const drpNs = useNamespace("date-range-picker");
  27688. const { t, lang } = useLocale();
  27689. const handleShortcutClick = useShortcut(lang);
  27690. const minDate = ref();
  27691. const maxDate = ref();
  27692. const rangeState = ref({
  27693. endDate: null,
  27694. selecting: false
  27695. });
  27696. const handleChangeRange = (val) => {
  27697. rangeState.value = val;
  27698. };
  27699. const handleRangeConfirm = (visible = false) => {
  27700. const _minDate = unref(minDate);
  27701. const _maxDate = unref(maxDate);
  27702. if (isValidRange([_minDate, _maxDate])) emit("pick", [_minDate, _maxDate], visible);
  27703. };
  27704. const onSelect = (selecting) => {
  27705. rangeState.value.selecting = selecting;
  27706. if (!selecting) rangeState.value.endDate = null;
  27707. };
  27708. const parseValue = (parsedValue) => {
  27709. if (isArray$1(parsedValue) && parsedValue.length === 2) {
  27710. const [start, end] = parsedValue;
  27711. minDate.value = start;
  27712. leftDate.value = start;
  27713. maxDate.value = end;
  27714. sortDates(unref(minDate), unref(maxDate));
  27715. } else restoreDefault();
  27716. };
  27717. const restoreDefault = () => {
  27718. let [start, end] = getDefaultValue(unref(defaultValue), {
  27719. lang: unref(lang),
  27720. step,
  27721. unit,
  27722. unlinkPanels: props.unlinkPanels
  27723. });
  27724. const getShift = (day) => {
  27725. return day.diff(day.startOf("d"), "ms");
  27726. };
  27727. const maybeTimes = unref(defaultTime);
  27728. if (maybeTimes) {
  27729. let leftShift = 0;
  27730. let rightShift = 0;
  27731. if (isArray$1(maybeTimes)) {
  27732. const [timeStart, timeEnd] = maybeTimes.map(import_dayjs_min.default);
  27733. leftShift = getShift(timeStart);
  27734. rightShift = getShift(timeEnd);
  27735. } else {
  27736. const shift = getShift((0, import_dayjs_min.default)(maybeTimes));
  27737. leftShift = shift;
  27738. rightShift = shift;
  27739. }
  27740. start = start.startOf("d").add(leftShift, "ms");
  27741. end = end.startOf("d").add(rightShift, "ms");
  27742. }
  27743. minDate.value = void 0;
  27744. maxDate.value = void 0;
  27745. leftDate.value = start;
  27746. rightDate.value = end;
  27747. };
  27748. watch(defaultValue, (val) => {
  27749. if (val) restoreDefault();
  27750. }, { immediate: true });
  27751. watch(() => props.parsedValue, (parsedValue) => {
  27752. if (!parsedValue?.length || !isEqual$1(parsedValue, [minDate.value, maxDate.value])) parseValue(parsedValue);
  27753. }, { immediate: true });
  27754. watch(() => props.visible, () => {
  27755. if (props.visible) parseValue(props.parsedValue);
  27756. }, { immediate: true });
  27757. return {
  27758. minDate,
  27759. maxDate,
  27760. rangeState,
  27761. lang,
  27762. ppNs: pickerNs,
  27763. drpNs,
  27764. handleChangeRange,
  27765. handleRangeConfirm,
  27766. handleShortcutClick,
  27767. onSelect,
  27768. parseValue,
  27769. t
  27770. };
  27771. };
  27772. //#endregion
  27773. //#region ../../packages/components/date-picker-panel/src/composables/use-panel-date-range.ts
  27774. const usePanelDateRange = (props, emit, leftDate, rightDate) => {
  27775. const leftCurrentView = ref("date");
  27776. const leftCurrentViewRef = ref();
  27777. const rightCurrentView = ref("date");
  27778. const rightCurrentViewRef = ref();
  27779. const { disabledDate } = inject(PICKER_BASE_INJECTION_KEY).props;
  27780. const { t, lang } = useLocale();
  27781. const leftYear = computed(() => {
  27782. return leftDate.value.year();
  27783. });
  27784. const leftMonth = computed(() => {
  27785. return leftDate.value.month();
  27786. });
  27787. const rightYear = computed(() => {
  27788. return rightDate.value.year();
  27789. });
  27790. const rightMonth = computed(() => {
  27791. return rightDate.value.month();
  27792. });
  27793. function computedYearLabel(currentView, yearValue) {
  27794. const yearTranslation = t("el.datepicker.year");
  27795. if (currentView.value === "year") {
  27796. const startYear = Math.floor(yearValue.value / 10) * 10;
  27797. return yearTranslation ? `${startYear} ${yearTranslation} - ${startYear + 9} ${yearTranslation}` : `${startYear} - ${startYear + 9}`;
  27798. }
  27799. return `${yearValue.value} ${yearTranslation}`;
  27800. }
  27801. function focusPicker(currentViewRef) {
  27802. currentViewRef?.focus();
  27803. }
  27804. async function showPicker(pickerType, view) {
  27805. if (props.disabled) return;
  27806. const currentView = pickerType === "left" ? leftCurrentView : rightCurrentView;
  27807. const currentViewRef = pickerType === "left" ? leftCurrentViewRef : rightCurrentViewRef;
  27808. currentView.value = view;
  27809. await nextTick();
  27810. focusPicker(currentViewRef.value);
  27811. }
  27812. async function handlePick(mode, pickerType, value) {
  27813. if (props.disabled) return;
  27814. const isLeftPicker = pickerType === "left";
  27815. const startDate = isLeftPicker ? leftDate : rightDate;
  27816. const endDate = isLeftPicker ? rightDate : leftDate;
  27817. const currentView = isLeftPicker ? leftCurrentView : rightCurrentView;
  27818. const currentViewRef = isLeftPicker ? leftCurrentViewRef : rightCurrentViewRef;
  27819. if (mode === "year") startDate.value = getValidDateOfYear(startDate.value.year(value), lang.value, disabledDate);
  27820. if (mode === "month") startDate.value = getValidDateOfMonth(startDate.value, startDate.value.year(), value, lang.value, disabledDate);
  27821. if (!props.unlinkPanels) endDate.value = pickerType === "left" ? startDate.value.add(1, "month") : startDate.value.subtract(1, "month");
  27822. currentView.value = mode === "year" ? "month" : "date";
  27823. await nextTick();
  27824. focusPicker(currentViewRef.value);
  27825. handlePanelChange(mode);
  27826. }
  27827. function handlePanelChange(mode) {
  27828. emit("panel-change", [leftDate.value.toDate(), rightDate.value.toDate()], mode);
  27829. }
  27830. function adjustDateByView(currentView, date, forward) {
  27831. const action = forward ? "add" : "subtract";
  27832. return currentView === "year" ? date[action](10, "year") : date[action](1, "year");
  27833. }
  27834. return {
  27835. leftCurrentView,
  27836. rightCurrentView,
  27837. leftCurrentViewRef,
  27838. rightCurrentViewRef,
  27839. leftYear,
  27840. rightYear,
  27841. leftMonth,
  27842. rightMonth,
  27843. leftYearLabel: computed(() => computedYearLabel(leftCurrentView, leftYear)),
  27844. rightYearLabel: computed(() => computedYearLabel(rightCurrentView, rightYear)),
  27845. showLeftPicker: (view) => showPicker("left", view),
  27846. showRightPicker: (view) => showPicker("right", view),
  27847. handleLeftYearPick: (year) => handlePick("year", "left", year),
  27848. handleRightYearPick: (year) => handlePick("year", "right", year),
  27849. handleLeftMonthPick: (month) => handlePick("month", "left", month),
  27850. handleRightMonthPick: (month) => handlePick("month", "right", month),
  27851. handlePanelChange,
  27852. adjustDateByView
  27853. };
  27854. };
  27855. //#endregion
  27856. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-date-range.vue?vue&type=script&setup=true&lang.ts
  27857. const _hoisted_1$47 = ["disabled", "onClick"];
  27858. const _hoisted_2$29 = ["aria-label", "disabled"];
  27859. const _hoisted_3$13 = ["aria-label", "disabled"];
  27860. const _hoisted_4$10 = ["disabled", "aria-label"];
  27861. const _hoisted_5$7 = ["disabled", "aria-label"];
  27862. const _hoisted_6$2 = ["tabindex", "aria-disabled"];
  27863. const _hoisted_7$1 = ["tabindex", "aria-disabled"];
  27864. const _hoisted_8$1 = ["disabled", "aria-label"];
  27865. const _hoisted_9$1 = ["disabled", "aria-label"];
  27866. const _hoisted_10$1 = ["aria-label", "disabled"];
  27867. const _hoisted_11$1 = ["disabled", "aria-label"];
  27868. const _hoisted_12$1 = ["tabindex", "aria-disabled"];
  27869. const _hoisted_13$1 = ["tabindex", "aria-disabled"];
  27870. const unit$2 = "month";
  27871. var panel_date_range_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  27872. __name: "panel-date-range",
  27873. props: panelDateRangeProps,
  27874. emits: [
  27875. "pick",
  27876. "set-picker-option",
  27877. "calendar-change",
  27878. "panel-change",
  27879. "clear"
  27880. ],
  27881. setup(__props, { emit: __emit }) {
  27882. const props = __props;
  27883. const emit = __emit;
  27884. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  27885. const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  27886. const { disabledDate, cellClassName, defaultTime, clearable } = pickerBase.props;
  27887. const format = toRef(pickerBase.props, "format");
  27888. const shortcuts = toRef(pickerBase.props, "shortcuts");
  27889. const defaultValue = toRef(pickerBase.props, "defaultValue");
  27890. const { lang } = useLocale();
  27891. const leftDate = ref((0, import_dayjs_min.default)().locale(lang.value));
  27892. const rightDate = ref((0, import_dayjs_min.default)().locale(lang.value).add(1, unit$2));
  27893. const { minDate, maxDate, rangeState, ppNs, drpNs, handleChangeRange, handleRangeConfirm, handleShortcutClick, onSelect, parseValue, t } = useRangePicker(props, {
  27894. defaultValue,
  27895. defaultTime,
  27896. leftDate,
  27897. rightDate,
  27898. unit: unit$2,
  27899. sortDates
  27900. });
  27901. watch(() => props.visible, (visible) => {
  27902. if (!visible && rangeState.value.selecting) {
  27903. parseValue(props.parsedValue);
  27904. onSelect(false);
  27905. }
  27906. });
  27907. const dateUserInput = ref({
  27908. min: null,
  27909. max: null
  27910. });
  27911. const timeUserInput = ref({
  27912. min: null,
  27913. max: null
  27914. });
  27915. const { leftCurrentView, rightCurrentView, leftCurrentViewRef, rightCurrentViewRef, leftYear, rightYear, leftMonth, rightMonth, leftYearLabel, rightYearLabel, showLeftPicker, showRightPicker, handleLeftYearPick, handleRightYearPick, handleLeftMonthPick, handleRightMonthPick, handlePanelChange, adjustDateByView } = usePanelDateRange(props, emit, leftDate, rightDate);
  27916. const hasShortcuts = computed(() => !!shortcuts.value.length);
  27917. const minVisibleDate = computed(() => {
  27918. if (dateUserInput.value.min !== null) return dateUserInput.value.min;
  27919. if (minDate.value) return minDate.value.format(dateFormat.value);
  27920. return "";
  27921. });
  27922. const maxVisibleDate = computed(() => {
  27923. if (dateUserInput.value.max !== null) return dateUserInput.value.max;
  27924. if (maxDate.value || minDate.value) return (maxDate.value || minDate.value).format(dateFormat.value);
  27925. return "";
  27926. });
  27927. const minVisibleTime = computed(() => {
  27928. if (timeUserInput.value.min !== null) return timeUserInput.value.min;
  27929. if (minDate.value) return minDate.value.format(timeFormat.value);
  27930. return "";
  27931. });
  27932. const maxVisibleTime = computed(() => {
  27933. if (timeUserInput.value.max !== null) return timeUserInput.value.max;
  27934. if (maxDate.value || minDate.value) return (maxDate.value || minDate.value).format(timeFormat.value);
  27935. return "";
  27936. });
  27937. const timeFormat = computed(() => {
  27938. return props.timeFormat || extractTimeFormat(format.value || "") || "HH:mm:ss";
  27939. });
  27940. const dateFormat = computed(() => {
  27941. return props.dateFormat || extractDateFormat(format.value || "") || "YYYY-MM-DD";
  27942. });
  27943. const isValidValue = (date) => {
  27944. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  27945. };
  27946. const leftPrevYear = () => {
  27947. leftDate.value = adjustDateByView(leftCurrentView.value, leftDate.value, false);
  27948. if (!props.unlinkPanels) rightDate.value = leftDate.value.add(1, "month");
  27949. handlePanelChange("year");
  27950. };
  27951. const leftPrevMonth = () => {
  27952. leftDate.value = leftDate.value.subtract(1, "month");
  27953. if (!props.unlinkPanels) rightDate.value = leftDate.value.add(1, "month");
  27954. handlePanelChange("month");
  27955. };
  27956. const rightNextYear = () => {
  27957. if (!props.unlinkPanels) {
  27958. leftDate.value = adjustDateByView(rightCurrentView.value, leftDate.value, true);
  27959. rightDate.value = leftDate.value.add(1, "month");
  27960. } else rightDate.value = adjustDateByView(rightCurrentView.value, rightDate.value, true);
  27961. handlePanelChange("year");
  27962. };
  27963. const rightNextMonth = () => {
  27964. if (!props.unlinkPanels) {
  27965. leftDate.value = leftDate.value.add(1, "month");
  27966. rightDate.value = leftDate.value.add(1, "month");
  27967. } else rightDate.value = rightDate.value.add(1, "month");
  27968. handlePanelChange("month");
  27969. };
  27970. const leftNextYear = () => {
  27971. leftDate.value = adjustDateByView(leftCurrentView.value, leftDate.value, true);
  27972. handlePanelChange("year");
  27973. };
  27974. const leftNextMonth = () => {
  27975. leftDate.value = leftDate.value.add(1, "month");
  27976. handlePanelChange("month");
  27977. };
  27978. const rightPrevYear = () => {
  27979. rightDate.value = adjustDateByView(rightCurrentView.value, rightDate.value, false);
  27980. handlePanelChange("year");
  27981. };
  27982. const rightPrevMonth = () => {
  27983. rightDate.value = rightDate.value.subtract(1, "month");
  27984. handlePanelChange("month");
  27985. };
  27986. const enableMonthArrow = computed(() => {
  27987. const nextMonth = (leftMonth.value + 1) % 12;
  27988. const yearOffset = leftMonth.value + 1 >= 12 ? 1 : 0;
  27989. return props.singlePanel || props.unlinkPanels && new Date(leftYear.value + yearOffset, nextMonth) < new Date(rightYear.value, rightMonth.value);
  27990. });
  27991. const enableYearArrow = computed(() => {
  27992. return props.singlePanel || props.unlinkPanels && rightYear.value * 12 + rightMonth.value - (leftYear.value * 12 + leftMonth.value + 1) >= 12;
  27993. });
  27994. const dateRangeDisabled = useFormDisabled();
  27995. const btnDisabled = computed(() => {
  27996. return !(minDate.value && maxDate.value && !rangeState.value.selecting && isValidRange([minDate.value, maxDate.value]) && !dateRangeDisabled.value);
  27997. });
  27998. const showTime = computed(() => props.type === "datetime" || props.type === "datetimerange");
  27999. const formatEmit = (emitDayjs, index) => {
  28000. if (!emitDayjs) return;
  28001. if (defaultTime) return (0, import_dayjs_min.default)(defaultTime[index] || defaultTime).locale(lang.value).year(emitDayjs.year()).month(emitDayjs.month()).date(emitDayjs.date());
  28002. return emitDayjs;
  28003. };
  28004. const handleRangePick = (val, close = true) => {
  28005. const min_ = val.minDate;
  28006. const max_ = val.maxDate;
  28007. const minDate_ = formatEmit(min_, 0);
  28008. const maxDate_ = formatEmit(max_, 1);
  28009. if (maxDate.value === maxDate_ && minDate.value === minDate_) return;
  28010. emit("calendar-change", [min_.toDate(), max_ && max_.toDate()]);
  28011. maxDate.value = maxDate_;
  28012. minDate.value = minDate_;
  28013. if (!showTime.value && close) close = !minDate_ || !maxDate_;
  28014. handleRangeConfirm(close);
  28015. };
  28016. const minTimePickerVisible = ref(false);
  28017. const maxTimePickerVisible = ref(false);
  28018. const handleMinTimeClose = () => {
  28019. minTimePickerVisible.value = false;
  28020. };
  28021. const handleMaxTimeClose = () => {
  28022. maxTimePickerVisible.value = false;
  28023. };
  28024. const findValidDateToward = (from, toward) => {
  28025. if (!disabledDate || !disabledDate(from.toDate())) return from;
  28026. const forward = from.isBefore(toward);
  28027. let cursor = from;
  28028. while (forward ? cursor.isBefore(toward) : cursor.isAfter(toward)) {
  28029. cursor = forward ? cursor.add(1, "day") : cursor.subtract(1, "day");
  28030. if (!disabledDate(cursor.toDate())) return cursor;
  28031. }
  28032. return from;
  28033. };
  28034. const handleDateInput = (value, type) => {
  28035. dateUserInput.value[type] = value;
  28036. const parsedValueD = (0, import_dayjs_min.default)(value, dateFormat.value).locale(lang.value);
  28037. if (parsedValueD.isValid()) {
  28038. if (disabledDate && disabledDate(parsedValueD.toDate())) return;
  28039. if (type === "min") {
  28040. leftDate.value = parsedValueD;
  28041. minDate.value = (minDate.value || leftDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  28042. if (!props.unlinkPanels && !maxDate.value) {
  28043. const adjustedMax = findValidDateToward(minDate.value.add(1, "month"), minDate.value);
  28044. rightDate.value = adjustedMax;
  28045. maxDate.value = adjustedMax;
  28046. }
  28047. } else {
  28048. rightDate.value = parsedValueD;
  28049. maxDate.value = (maxDate.value || rightDate.value).year(parsedValueD.year()).month(parsedValueD.month()).date(parsedValueD.date());
  28050. if (!props.unlinkPanels && !minDate.value) {
  28051. const adjustedMin = findValidDateToward(maxDate.value.subtract(1, "month"), maxDate.value);
  28052. leftDate.value = adjustedMin;
  28053. minDate.value = adjustedMin;
  28054. }
  28055. }
  28056. sortDates(minDate.value, maxDate.value);
  28057. handleRangeConfirm(true);
  28058. }
  28059. };
  28060. const handleDateChange = (_, type) => {
  28061. dateUserInput.value[type] = null;
  28062. if (type === "min") {
  28063. if (!props.unlinkPanels && maxDate.value && minDate.value && maxDate.value.isBefore(minDate.value)) {
  28064. const adjustedMax = findValidDateToward(minDate.value.add(1, "month"), minDate.value);
  28065. rightDate.value = adjustedMax;
  28066. maxDate.value = adjustedMax;
  28067. }
  28068. } else if (!props.unlinkPanels && minDate.value && maxDate.value && minDate.value.isAfter(maxDate.value)) {
  28069. const adjustedMin = findValidDateToward(maxDate.value.subtract(1, "month"), maxDate.value);
  28070. leftDate.value = adjustedMin;
  28071. minDate.value = adjustedMin;
  28072. }
  28073. sortDates(minDate.value, maxDate.value);
  28074. handleRangeConfirm(true);
  28075. };
  28076. const handleTimeInput = (value, type) => {
  28077. timeUserInput.value[type] = value;
  28078. const parsedValueD = (0, import_dayjs_min.default)(value, timeFormat.value).locale(lang.value);
  28079. if (parsedValueD.isValid()) if (type === "min") {
  28080. minTimePickerVisible.value = true;
  28081. minDate.value = (minDate.value || leftDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  28082. leftDate.value = minDate.value;
  28083. } else {
  28084. maxTimePickerVisible.value = true;
  28085. maxDate.value = (maxDate.value || rightDate.value).hour(parsedValueD.hour()).minute(parsedValueD.minute()).second(parsedValueD.second());
  28086. rightDate.value = maxDate.value;
  28087. }
  28088. };
  28089. const handleTimeChange = (_value, type) => {
  28090. timeUserInput.value[type] = null;
  28091. if (type === "min") {
  28092. leftDate.value = minDate.value;
  28093. minTimePickerVisible.value = false;
  28094. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) maxDate.value = minDate.value;
  28095. } else {
  28096. rightDate.value = maxDate.value;
  28097. maxTimePickerVisible.value = false;
  28098. if (maxDate.value && maxDate.value.isBefore(minDate.value)) minDate.value = maxDate.value;
  28099. }
  28100. handleRangeConfirm(true);
  28101. };
  28102. const handleMinTimePick = (value, visible, first) => {
  28103. if (timeUserInput.value.min) return;
  28104. if (value) minDate.value = (minDate.value || leftDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  28105. if (!first) minTimePickerVisible.value = visible;
  28106. if (!maxDate.value || maxDate.value.isBefore(minDate.value)) {
  28107. maxDate.value = minDate.value;
  28108. rightDate.value = value;
  28109. nextTick(() => {
  28110. parseValue(props.parsedValue);
  28111. });
  28112. }
  28113. handleRangeConfirm(true);
  28114. };
  28115. const handleMaxTimePick = (value, visible, first) => {
  28116. if (timeUserInput.value.max) return;
  28117. if (value) maxDate.value = (maxDate.value || rightDate.value).hour(value.hour()).minute(value.minute()).second(value.second());
  28118. if (!first) maxTimePickerVisible.value = visible;
  28119. if (maxDate.value && maxDate.value.isBefore(minDate.value)) minDate.value = maxDate.value;
  28120. handleRangeConfirm(true);
  28121. };
  28122. const onClear = () => {
  28123. handleClear();
  28124. emit("clear");
  28125. };
  28126. const handleClear = () => {
  28127. let valueOnClear = null;
  28128. if (pickerBase?.emptyValues) valueOnClear = pickerBase.emptyValues.valueOnClear.value;
  28129. leftDate.value = getDefaultValue(unref(defaultValue), {
  28130. lang: unref(lang),
  28131. unit: "month",
  28132. unlinkPanels: props.unlinkPanels
  28133. })[0];
  28134. rightDate.value = leftDate.value.add(1, "month");
  28135. maxDate.value = void 0;
  28136. minDate.value = void 0;
  28137. handleRangeConfirm(true);
  28138. emit("pick", valueOnClear);
  28139. };
  28140. const parseUserInput = (value) => {
  28141. return correctlyParseUserInput(value, format.value || "", lang.value, isDefaultFormat);
  28142. };
  28143. function sortDates(minDate, maxDate) {
  28144. if (props.unlinkPanels && maxDate) {
  28145. const minDateYear = minDate?.year() || 0;
  28146. const minDateMonth = minDate?.month() || 0;
  28147. const maxDateYear = maxDate.year();
  28148. const maxDateMonth = maxDate.month();
  28149. rightDate.value = minDateYear === maxDateYear && minDateMonth === maxDateMonth ? maxDate.add(1, unit$2) : maxDate;
  28150. } else {
  28151. rightDate.value = leftDate.value.add(1, unit$2);
  28152. if (maxDate) rightDate.value = rightDate.value.hour(maxDate.hour()).minute(maxDate.minute()).second(maxDate.second());
  28153. }
  28154. }
  28155. emit("set-picker-option", ["isValidValue", isValidValue]);
  28156. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  28157. emit("set-picker-option", ["handleClear", handleClear]);
  28158. return (_ctx, _cache) => {
  28159. return openBlock(), createElementBlock("div", { class: normalizeClass([
  28160. unref(ppNs).b(),
  28161. unref(drpNs).b(),
  28162. unref(ppNs).is("border", _ctx.border),
  28163. unref(ppNs).is("disabled", unref(dateRangeDisabled)),
  28164. {
  28165. "has-sidebar": _ctx.$slots.sidebar || hasShortcuts.value,
  28166. "has-time": showTime.value,
  28167. "single-panel": _ctx.singlePanel
  28168. }
  28169. ]) }, [createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body-wrapper")) }, [
  28170. renderSlot(_ctx.$slots, "sidebar", { class: normalizeClass(unref(ppNs).e("sidebar")) }),
  28171. hasShortcuts.value ? (openBlock(), createElementBlock("div", {
  28172. key: 0,
  28173. class: normalizeClass(unref(ppNs).e("sidebar"))
  28174. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(shortcuts.value, (shortcut, key) => {
  28175. return openBlock(), createElementBlock("button", {
  28176. key,
  28177. type: "button",
  28178. disabled: unref(dateRangeDisabled),
  28179. class: normalizeClass(unref(ppNs).e("shortcut")),
  28180. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  28181. }, toDisplayString(shortcut.text), 11, _hoisted_1$47);
  28182. }), 128))], 2)) : createCommentVNode("v-if", true),
  28183. createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body")) }, [
  28184. showTime.value ? (openBlock(), createElementBlock("div", {
  28185. key: 0,
  28186. class: normalizeClass(unref(drpNs).e("time-header"))
  28187. }, [
  28188. createElementVNode("span", { class: normalizeClass(unref(drpNs).e("editors-wrap")) }, [createElementVNode("span", { class: normalizeClass(unref(drpNs).e("time-picker-wrap")) }, [createVNode(unref(ElInput), {
  28189. size: "small",
  28190. disabled: unref(rangeState).selecting || unref(dateRangeDisabled),
  28191. placeholder: unref(t)("el.datepicker.startDate"),
  28192. class: normalizeClass(unref(drpNs).e("editor")),
  28193. "model-value": minVisibleDate.value,
  28194. "validate-event": false,
  28195. readonly: !_ctx.editable,
  28196. onInput: _cache[0] || (_cache[0] = (val) => handleDateInput(val, "min")),
  28197. onChange: _cache[1] || (_cache[1] = (val) => handleDateChange(val, "min"))
  28198. }, null, 8, [
  28199. "disabled",
  28200. "placeholder",
  28201. "class",
  28202. "model-value",
  28203. "readonly"
  28204. ])], 2), withDirectives((openBlock(), createElementBlock("span", { class: normalizeClass(unref(drpNs).e("time-picker-wrap")) }, [createVNode(unref(ElInput), {
  28205. size: "small",
  28206. class: normalizeClass(unref(drpNs).e("editor")),
  28207. disabled: unref(rangeState).selecting || unref(dateRangeDisabled),
  28208. placeholder: unref(t)("el.datepicker.startTime"),
  28209. "model-value": minVisibleTime.value,
  28210. "validate-event": false,
  28211. readonly: !_ctx.editable,
  28212. onFocus: _cache[2] || (_cache[2] = ($event) => minTimePickerVisible.value = true),
  28213. onInput: _cache[3] || (_cache[3] = (val) => handleTimeInput(val, "min")),
  28214. onChange: _cache[4] || (_cache[4] = (val) => handleTimeChange(val, "min"))
  28215. }, null, 8, [
  28216. "class",
  28217. "disabled",
  28218. "placeholder",
  28219. "model-value",
  28220. "readonly"
  28221. ]), createVNode(unref(panel_time_pick_default), {
  28222. visible: minTimePickerVisible.value,
  28223. format: timeFormat.value,
  28224. "datetime-role": "start",
  28225. "parsed-value": unref(minDate) || leftDate.value,
  28226. onPick: handleMinTimePick
  28227. }, null, 8, [
  28228. "visible",
  28229. "format",
  28230. "parsed-value"
  28231. ])], 2)), [[unref(ClickOutside), handleMinTimeClose]])], 2),
  28232. createElementVNode("span", null, [createVNode(unref(ElIcon), null, {
  28233. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  28234. _: 1
  28235. })]),
  28236. createElementVNode("span", { class: normalizeClass([unref(drpNs).e("editors-wrap"), "is-right"]) }, [createElementVNode("span", { class: normalizeClass(unref(drpNs).e("time-picker-wrap")) }, [createVNode(unref(ElInput), {
  28237. size: "small",
  28238. class: normalizeClass(unref(drpNs).e("editor")),
  28239. disabled: unref(rangeState).selecting || unref(dateRangeDisabled),
  28240. placeholder: unref(t)("el.datepicker.endDate"),
  28241. "model-value": maxVisibleDate.value,
  28242. readonly: !unref(minDate) || !_ctx.editable,
  28243. "validate-event": false,
  28244. onInput: _cache[5] || (_cache[5] = (val) => handleDateInput(val, "max")),
  28245. onChange: _cache[6] || (_cache[6] = (val) => handleDateChange(val, "max"))
  28246. }, null, 8, [
  28247. "class",
  28248. "disabled",
  28249. "placeholder",
  28250. "model-value",
  28251. "readonly"
  28252. ])], 2), withDirectives((openBlock(), createElementBlock("span", { class: normalizeClass(unref(drpNs).e("time-picker-wrap")) }, [createVNode(unref(ElInput), {
  28253. size: "small",
  28254. class: normalizeClass(unref(drpNs).e("editor")),
  28255. disabled: unref(rangeState).selecting || unref(dateRangeDisabled),
  28256. placeholder: unref(t)("el.datepicker.endTime"),
  28257. "model-value": maxVisibleTime.value,
  28258. readonly: !unref(minDate) || !_ctx.editable,
  28259. "validate-event": false,
  28260. onFocus: _cache[7] || (_cache[7] = ($event) => unref(minDate) && (maxTimePickerVisible.value = true)),
  28261. onInput: _cache[8] || (_cache[8] = (val) => handleTimeInput(val, "max")),
  28262. onChange: _cache[9] || (_cache[9] = (val) => handleTimeChange(val, "max"))
  28263. }, null, 8, [
  28264. "class",
  28265. "disabled",
  28266. "placeholder",
  28267. "model-value",
  28268. "readonly"
  28269. ]), createVNode(unref(panel_time_pick_default), {
  28270. "datetime-role": "end",
  28271. visible: maxTimePickerVisible.value,
  28272. format: timeFormat.value,
  28273. "parsed-value": unref(maxDate) || rightDate.value,
  28274. onPick: handleMaxTimePick
  28275. }, null, 8, [
  28276. "visible",
  28277. "format",
  28278. "parsed-value"
  28279. ])], 2)), [[unref(ClickOutside), handleMaxTimeClose]])], 2)
  28280. ], 2)) : createCommentVNode("v-if", true),
  28281. createElementVNode("div", { class: normalizeClass([
  28282. unref(ppNs).e("content"),
  28283. unref(drpNs).e("content"),
  28284. unref(drpNs).is("left", !_ctx.singlePanel)
  28285. ]) }, [
  28286. createElementVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
  28287. createElementVNode("button", {
  28288. type: "button",
  28289. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  28290. "aria-label": unref(t)(`el.datepicker.prevYear`),
  28291. disabled: unref(dateRangeDisabled),
  28292. onClick: leftPrevYear
  28293. }, [renderSlot(_ctx.$slots, "prev-year", {}, () => [createVNode(unref(ElIcon), null, {
  28294. default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
  28295. _: 1
  28296. })])], 10, _hoisted_2$29),
  28297. withDirectives(createElementVNode("button", {
  28298. type: "button",
  28299. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-left"]),
  28300. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  28301. disabled: unref(dateRangeDisabled),
  28302. onClick: leftPrevMonth
  28303. }, [renderSlot(_ctx.$slots, "prev-month", {}, () => [createVNode(unref(ElIcon), null, {
  28304. default: withCtx(() => [createVNode(unref(arrow_left_default))]),
  28305. _: 1
  28306. })])], 10, _hoisted_3$13), [[vShow, unref(leftCurrentView) === "date"]]),
  28307. _ctx.unlinkPanels || _ctx.singlePanel ? (openBlock(), createElementBlock("button", {
  28308. key: 0,
  28309. type: "button",
  28310. disabled: !enableYearArrow.value || unref(dateRangeDisabled),
  28311. class: normalizeClass([[unref(ppNs).e("icon-btn"), unref(ppNs).is("disabled", !enableYearArrow.value || unref(dateRangeDisabled))], "d-arrow-right"]),
  28312. "aria-label": unref(t)(`el.datepicker.nextYear`),
  28313. onClick: leftNextYear
  28314. }, [renderSlot(_ctx.$slots, "next-year", {}, () => [createVNode(unref(ElIcon), null, {
  28315. default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
  28316. _: 1
  28317. })])], 10, _hoisted_4$10)) : createCommentVNode("v-if", true),
  28318. _ctx.unlinkPanels && unref(leftCurrentView) === "date" || _ctx.singlePanel ? (openBlock(), createElementBlock("button", {
  28319. key: 1,
  28320. type: "button",
  28321. disabled: !enableMonthArrow.value || unref(dateRangeDisabled),
  28322. class: normalizeClass([[unref(ppNs).e("icon-btn"), unref(ppNs).is("disabled", !enableMonthArrow.value || unref(dateRangeDisabled))], "arrow-right"]),
  28323. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  28324. onClick: leftNextMonth
  28325. }, [renderSlot(_ctx.$slots, "next-month", {}, () => [createVNode(unref(ElIcon), null, {
  28326. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  28327. _: 1
  28328. })])], 10, _hoisted_5$7)) : createCommentVNode("v-if", true),
  28329. createElementVNode("div", null, [createElementVNode("span", {
  28330. role: "button",
  28331. class: normalizeClass(unref(drpNs).e("header-label")),
  28332. "aria-live": "polite",
  28333. tabindex: _ctx.disabled ? void 0 : 0,
  28334. "aria-disabled": _ctx.disabled,
  28335. onKeydown: _cache[10] || (_cache[10] = withKeys(($event) => unref(showLeftPicker)("year"), ["enter"])),
  28336. onClick: _cache[11] || (_cache[11] = ($event) => unref(showLeftPicker)("year"))
  28337. }, toDisplayString(unref(leftYearLabel)), 43, _hoisted_6$2), withDirectives(createElementVNode("span", {
  28338. role: "button",
  28339. "aria-live": "polite",
  28340. tabindex: _ctx.disabled ? void 0 : 0,
  28341. "aria-disabled": _ctx.disabled,
  28342. class: normalizeClass([unref(drpNs).e("header-label"), { active: unref(leftCurrentView) === "month" }]),
  28343. onKeydown: _cache[12] || (_cache[12] = withKeys(($event) => unref(showLeftPicker)("month"), ["enter"])),
  28344. onClick: _cache[13] || (_cache[13] = ($event) => unref(showLeftPicker)("month"))
  28345. }, toDisplayString(unref(t)(`el.datepicker.month${leftDate.value.month() + 1}`)), 43, _hoisted_7$1), [[vShow, unref(leftCurrentView) === "date"]])])
  28346. ], 2),
  28347. unref(leftCurrentView) === "date" ? (openBlock(), createBlock(basic_date_table_default, {
  28348. key: 0,
  28349. ref_key: "leftCurrentViewRef",
  28350. ref: leftCurrentViewRef,
  28351. "selection-mode": "range",
  28352. date: leftDate.value,
  28353. "min-date": unref(minDate),
  28354. "max-date": unref(maxDate),
  28355. "range-state": unref(rangeState),
  28356. "disabled-date": unref(disabledDate),
  28357. "cell-class-name": unref(cellClassName),
  28358. "show-week-number": _ctx.showWeekNumber,
  28359. disabled: unref(dateRangeDisabled),
  28360. onChangerange: unref(handleChangeRange),
  28361. onPick: handleRangePick,
  28362. onSelect: unref(onSelect)
  28363. }, null, 8, [
  28364. "date",
  28365. "min-date",
  28366. "max-date",
  28367. "range-state",
  28368. "disabled-date",
  28369. "cell-class-name",
  28370. "show-week-number",
  28371. "disabled",
  28372. "onChangerange",
  28373. "onSelect"
  28374. ])) : createCommentVNode("v-if", true),
  28375. unref(leftCurrentView) === "year" ? (openBlock(), createBlock(basic_year_table_default, {
  28376. key: 1,
  28377. ref_key: "leftCurrentViewRef",
  28378. ref: leftCurrentViewRef,
  28379. "selection-mode": "year",
  28380. date: leftDate.value,
  28381. "disabled-date": unref(disabledDate),
  28382. "parsed-value": _ctx.parsedValue,
  28383. disabled: unref(dateRangeDisabled),
  28384. onPick: unref(handleLeftYearPick)
  28385. }, null, 8, [
  28386. "date",
  28387. "disabled-date",
  28388. "parsed-value",
  28389. "disabled",
  28390. "onPick"
  28391. ])) : createCommentVNode("v-if", true),
  28392. unref(leftCurrentView) === "month" ? (openBlock(), createBlock(basic_month_table_default, {
  28393. key: 2,
  28394. ref_key: "leftCurrentViewRef",
  28395. ref: leftCurrentViewRef,
  28396. "selection-mode": "month",
  28397. date: leftDate.value,
  28398. "parsed-value": _ctx.parsedValue,
  28399. "disabled-date": unref(disabledDate),
  28400. disabled: unref(dateRangeDisabled),
  28401. onPick: unref(handleLeftMonthPick)
  28402. }, null, 8, [
  28403. "date",
  28404. "parsed-value",
  28405. "disabled-date",
  28406. "disabled",
  28407. "onPick"
  28408. ])) : createCommentVNode("v-if", true)
  28409. ], 2),
  28410. !_ctx.singlePanel ? (openBlock(), createElementBlock("div", {
  28411. key: 1,
  28412. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"])
  28413. }, [
  28414. createElementVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
  28415. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28416. key: 0,
  28417. type: "button",
  28418. disabled: !enableYearArrow.value || unref(dateRangeDisabled),
  28419. class: normalizeClass([[unref(ppNs).e("icon-btn"), unref(ppNs).is("disabled", !enableYearArrow.value || unref(dateRangeDisabled))], "d-arrow-left"]),
  28420. "aria-label": unref(t)(`el.datepicker.prevYear`),
  28421. onClick: rightPrevYear
  28422. }, [renderSlot(_ctx.$slots, "prev-year", {}, () => [createVNode(unref(ElIcon), null, {
  28423. default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
  28424. _: 1
  28425. })])], 10, _hoisted_8$1)) : createCommentVNode("v-if", true),
  28426. _ctx.unlinkPanels && unref(rightCurrentView) === "date" ? (openBlock(), createElementBlock("button", {
  28427. key: 1,
  28428. type: "button",
  28429. disabled: !enableMonthArrow.value || unref(dateRangeDisabled),
  28430. class: normalizeClass([[unref(ppNs).e("icon-btn"), unref(ppNs).is("disabled", !enableMonthArrow.value || unref(dateRangeDisabled))], "arrow-left"]),
  28431. "aria-label": unref(t)(`el.datepicker.prevMonth`),
  28432. onClick: rightPrevMonth
  28433. }, [renderSlot(_ctx.$slots, "prev-month", {}, () => [createVNode(unref(ElIcon), null, {
  28434. default: withCtx(() => [createVNode(unref(arrow_left_default))]),
  28435. _: 1
  28436. })])], 10, _hoisted_9$1)) : createCommentVNode("v-if", true),
  28437. createElementVNode("button", {
  28438. type: "button",
  28439. "aria-label": unref(t)(`el.datepicker.nextYear`),
  28440. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  28441. disabled: unref(dateRangeDisabled),
  28442. onClick: rightNextYear
  28443. }, [renderSlot(_ctx.$slots, "next-year", {}, () => [createVNode(unref(ElIcon), null, {
  28444. default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
  28445. _: 1
  28446. })])], 10, _hoisted_10$1),
  28447. withDirectives(createElementVNode("button", {
  28448. type: "button",
  28449. class: normalizeClass([unref(ppNs).e("icon-btn"), "arrow-right"]),
  28450. disabled: unref(dateRangeDisabled),
  28451. "aria-label": unref(t)(`el.datepicker.nextMonth`),
  28452. onClick: rightNextMonth
  28453. }, [renderSlot(_ctx.$slots, "next-month", {}, () => [createVNode(unref(ElIcon), null, {
  28454. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  28455. _: 1
  28456. })])], 10, _hoisted_11$1), [[vShow, unref(rightCurrentView) === "date"]]),
  28457. createElementVNode("div", null, [createElementVNode("span", {
  28458. role: "button",
  28459. class: normalizeClass(unref(drpNs).e("header-label")),
  28460. "aria-live": "polite",
  28461. tabindex: _ctx.disabled ? void 0 : 0,
  28462. "aria-disabled": _ctx.disabled,
  28463. onKeydown: _cache[14] || (_cache[14] = withKeys(($event) => unref(showRightPicker)("year"), ["enter"])),
  28464. onClick: _cache[15] || (_cache[15] = ($event) => unref(showRightPicker)("year"))
  28465. }, toDisplayString(unref(rightYearLabel)), 43, _hoisted_12$1), withDirectives(createElementVNode("span", {
  28466. role: "button",
  28467. "aria-live": "polite",
  28468. tabindex: _ctx.disabled ? void 0 : 0,
  28469. "aria-disabled": _ctx.disabled,
  28470. class: normalizeClass([unref(drpNs).e("header-label"), { active: unref(rightCurrentView) === "month" }]),
  28471. onKeydown: _cache[16] || (_cache[16] = withKeys(($event) => unref(showRightPicker)("month"), ["enter"])),
  28472. onClick: _cache[17] || (_cache[17] = ($event) => unref(showRightPicker)("month"))
  28473. }, toDisplayString(unref(t)(`el.datepicker.month${rightDate.value.month() + 1}`)), 43, _hoisted_13$1), [[vShow, unref(rightCurrentView) === "date"]])])
  28474. ], 2),
  28475. unref(rightCurrentView) === "date" ? (openBlock(), createBlock(basic_date_table_default, {
  28476. key: 0,
  28477. ref_key: "rightCurrentViewRef",
  28478. ref: rightCurrentViewRef,
  28479. "selection-mode": "range",
  28480. date: rightDate.value,
  28481. "min-date": unref(minDate),
  28482. "max-date": unref(maxDate),
  28483. "range-state": unref(rangeState),
  28484. "disabled-date": unref(disabledDate),
  28485. "cell-class-name": unref(cellClassName),
  28486. "show-week-number": _ctx.showWeekNumber,
  28487. disabled: unref(dateRangeDisabled),
  28488. onChangerange: unref(handleChangeRange),
  28489. onPick: handleRangePick,
  28490. onSelect: unref(onSelect)
  28491. }, null, 8, [
  28492. "date",
  28493. "min-date",
  28494. "max-date",
  28495. "range-state",
  28496. "disabled-date",
  28497. "cell-class-name",
  28498. "show-week-number",
  28499. "disabled",
  28500. "onChangerange",
  28501. "onSelect"
  28502. ])) : createCommentVNode("v-if", true),
  28503. unref(rightCurrentView) === "year" ? (openBlock(), createBlock(basic_year_table_default, {
  28504. key: 1,
  28505. ref_key: "rightCurrentViewRef",
  28506. ref: rightCurrentViewRef,
  28507. "selection-mode": "year",
  28508. date: rightDate.value,
  28509. "disabled-date": unref(disabledDate),
  28510. "parsed-value": _ctx.parsedValue,
  28511. disabled: unref(dateRangeDisabled),
  28512. onPick: unref(handleRightYearPick)
  28513. }, null, 8, [
  28514. "date",
  28515. "disabled-date",
  28516. "parsed-value",
  28517. "disabled",
  28518. "onPick"
  28519. ])) : createCommentVNode("v-if", true),
  28520. unref(rightCurrentView) === "month" ? (openBlock(), createBlock(basic_month_table_default, {
  28521. key: 2,
  28522. ref_key: "rightCurrentViewRef",
  28523. ref: rightCurrentViewRef,
  28524. "selection-mode": "month",
  28525. date: rightDate.value,
  28526. "parsed-value": _ctx.parsedValue,
  28527. "disabled-date": unref(disabledDate),
  28528. disabled: unref(dateRangeDisabled),
  28529. onPick: unref(handleRightMonthPick)
  28530. }, null, 8, [
  28531. "date",
  28532. "parsed-value",
  28533. "disabled-date",
  28534. "disabled",
  28535. "onPick"
  28536. ])) : createCommentVNode("v-if", true)
  28537. ], 2)) : createCommentVNode("v-if", true)
  28538. ], 2)
  28539. ], 2), _ctx.showFooter && showTime.value && (_ctx.showConfirm || unref(clearable)) ? (openBlock(), createElementBlock("div", {
  28540. key: 0,
  28541. class: normalizeClass(unref(ppNs).e("footer"))
  28542. }, [unref(clearable) ? (openBlock(), createBlock(unref(ElButton), {
  28543. key: 0,
  28544. text: "",
  28545. size: "small",
  28546. class: normalizeClass(unref(ppNs).e("link-btn")),
  28547. onClick: onClear
  28548. }, {
  28549. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.clear")), 1)]),
  28550. _: 1
  28551. }, 8, ["class"])) : createCommentVNode("v-if", true), _ctx.showConfirm ? (openBlock(), createBlock(unref(ElButton), {
  28552. key: 1,
  28553. plain: "",
  28554. size: "small",
  28555. class: normalizeClass(unref(ppNs).e("link-btn")),
  28556. disabled: btnDisabled.value,
  28557. onClick: _cache[18] || (_cache[18] = ($event) => unref(handleRangeConfirm)(false))
  28558. }, {
  28559. default: withCtx(() => [createTextVNode(toDisplayString(unref(t)("el.datepicker.confirm")), 1)]),
  28560. _: 1
  28561. }, 8, ["class", "disabled"])) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true)], 2);
  28562. };
  28563. }
  28564. });
  28565. //#endregion
  28566. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-date-range.vue
  28567. var panel_date_range_default = panel_date_range_vue_vue_type_script_setup_true_lang_default;
  28568. //#endregion
  28569. //#region ../../packages/components/date-picker-panel/src/props/panel-month-range.ts
  28570. const panelMonthRangeProps = buildProps({ ...panelRangeSharedProps });
  28571. const panelMonthRangeEmits = [
  28572. "pick",
  28573. "set-picker-option",
  28574. "calendar-change"
  28575. ];
  28576. //#endregion
  28577. //#region ../../packages/components/date-picker-panel/src/composables/use-month-range-header.ts
  28578. const useMonthRangeHeader = ({ unlinkPanels, leftDate, rightDate }) => {
  28579. const { t } = useLocale();
  28580. const leftPrevYear = () => {
  28581. leftDate.value = leftDate.value.subtract(1, "year");
  28582. if (!unlinkPanels.value) rightDate.value = rightDate.value.subtract(1, "year");
  28583. };
  28584. const rightNextYear = () => {
  28585. if (!unlinkPanels.value) leftDate.value = leftDate.value.add(1, "year");
  28586. rightDate.value = rightDate.value.add(1, "year");
  28587. };
  28588. const leftNextYear = () => {
  28589. leftDate.value = leftDate.value.add(1, "year");
  28590. };
  28591. const rightPrevYear = () => {
  28592. rightDate.value = rightDate.value.subtract(1, "year");
  28593. };
  28594. return {
  28595. leftPrevYear,
  28596. rightNextYear,
  28597. leftNextYear,
  28598. rightPrevYear,
  28599. leftLabel: computed(() => {
  28600. return `${leftDate.value.year()} ${t("el.datepicker.year")}`;
  28601. }),
  28602. rightLabel: computed(() => {
  28603. return `${rightDate.value.year()} ${t("el.datepicker.year")}`;
  28604. }),
  28605. leftYear: computed(() => {
  28606. return leftDate.value.year();
  28607. }),
  28608. rightYear: computed(() => {
  28609. return rightDate.value.year() === leftDate.value.year() ? leftDate.value.year() + 1 : rightDate.value.year();
  28610. })
  28611. };
  28612. };
  28613. //#endregion
  28614. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-month-range.vue?vue&type=script&setup=true&lang.ts
  28615. const _hoisted_1$46 = ["disabled", "onClick"];
  28616. const _hoisted_2$28 = ["disabled"];
  28617. const _hoisted_3$12 = ["disabled"];
  28618. const _hoisted_4$9 = ["disabled"];
  28619. const _hoisted_5$6 = ["disabled"];
  28620. const unit$1 = "year";
  28621. var panel_month_range_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  28622. name: "DatePickerMonthRange",
  28623. __name: "panel-month-range",
  28624. props: panelMonthRangeProps,
  28625. emits: panelMonthRangeEmits,
  28626. setup(__props, { emit: __emit }) {
  28627. const props = __props;
  28628. const emit = __emit;
  28629. const { lang } = useLocale();
  28630. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  28631. const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  28632. const { shortcuts, disabledDate, cellClassName } = pickerBase.props;
  28633. const format = toRef(pickerBase.props, "format");
  28634. const defaultValue = toRef(pickerBase.props, "defaultValue");
  28635. const leftDate = ref((0, import_dayjs_min.default)().locale(lang.value));
  28636. const rightDate = ref((0, import_dayjs_min.default)().locale(lang.value).add(1, unit$1));
  28637. const { minDate, maxDate, rangeState, ppNs, drpNs, handleChangeRange, handleRangeConfirm, handleShortcutClick, onSelect, parseValue } = useRangePicker(props, {
  28638. defaultValue,
  28639. leftDate,
  28640. rightDate,
  28641. unit: unit$1,
  28642. sortDates
  28643. });
  28644. const hasShortcuts = computed(() => !!shortcuts.length);
  28645. const { leftPrevYear, rightNextYear, leftNextYear, rightPrevYear, leftLabel, rightLabel, leftYear, rightYear } = useMonthRangeHeader({
  28646. unlinkPanels: toRef(props, "unlinkPanels"),
  28647. leftDate,
  28648. rightDate
  28649. });
  28650. const enableYearArrow = computed(() => {
  28651. return props.singlePanel || props.unlinkPanels && rightYear.value > leftYear.value + 1;
  28652. });
  28653. const handleRangePick = (val, close = true) => {
  28654. const minDate_ = val.minDate;
  28655. const maxDate_ = val.maxDate;
  28656. if (maxDate.value === maxDate_ && minDate.value === minDate_) return;
  28657. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  28658. maxDate.value = maxDate_;
  28659. minDate.value = minDate_;
  28660. if (!close) return;
  28661. handleRangeConfirm();
  28662. };
  28663. const handleClear = () => {
  28664. let valueOnClear = null;
  28665. if (pickerBase?.emptyValues) valueOnClear = pickerBase.emptyValues.valueOnClear.value;
  28666. leftDate.value = getDefaultValue(unref(defaultValue), {
  28667. lang: unref(lang),
  28668. unit: "year",
  28669. unlinkPanels: props.unlinkPanels
  28670. })[0];
  28671. rightDate.value = leftDate.value.add(1, "year");
  28672. emit("pick", valueOnClear);
  28673. };
  28674. const parseUserInput = (value) => {
  28675. return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
  28676. };
  28677. function sortDates(minDate, maxDate) {
  28678. if (props.unlinkPanels && maxDate) rightDate.value = (minDate?.year() || 0) === maxDate.year() ? maxDate.add(1, unit$1) : maxDate;
  28679. else rightDate.value = leftDate.value.add(1, unit$1);
  28680. }
  28681. const monthRangeDisabled = useFormDisabled();
  28682. watch(() => props.visible, (visible) => {
  28683. if (!visible && rangeState.value.selecting) {
  28684. parseValue(props.parsedValue);
  28685. onSelect(false);
  28686. }
  28687. });
  28688. emit("set-picker-option", ["isValidValue", isValidRange]);
  28689. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  28690. emit("set-picker-option", ["handleClear", handleClear]);
  28691. return (_ctx, _cache) => {
  28692. return openBlock(), createElementBlock("div", { class: normalizeClass([
  28693. unref(ppNs).b(),
  28694. unref(drpNs).b(),
  28695. unref(ppNs).is("border", _ctx.border),
  28696. unref(ppNs).is("disabled", unref(monthRangeDisabled)),
  28697. {
  28698. "has-sidebar": Boolean(_ctx.$slots.sidebar) || hasShortcuts.value,
  28699. "single-panel": _ctx.singlePanel
  28700. }
  28701. ]) }, [createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body-wrapper")) }, [
  28702. renderSlot(_ctx.$slots, "sidebar", { class: normalizeClass(unref(ppNs).e("sidebar")) }),
  28703. hasShortcuts.value ? (openBlock(), createElementBlock("div", {
  28704. key: 0,
  28705. class: normalizeClass(unref(ppNs).e("sidebar"))
  28706. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  28707. return openBlock(), createElementBlock("button", {
  28708. key,
  28709. type: "button",
  28710. class: normalizeClass(unref(ppNs).e("shortcut")),
  28711. disabled: unref(monthRangeDisabled),
  28712. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  28713. }, toDisplayString(shortcut.text), 11, _hoisted_1$46);
  28714. }), 128))], 2)) : createCommentVNode("v-if", true),
  28715. createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body")) }, [createElementVNode("div", { class: normalizeClass([
  28716. unref(ppNs).e("content"),
  28717. unref(drpNs).e("content"),
  28718. unref(drpNs).is("left", !_ctx.singlePanel)
  28719. ]) }, [createElementVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
  28720. createElementVNode("button", {
  28721. type: "button",
  28722. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-left"]),
  28723. disabled: unref(monthRangeDisabled),
  28724. onClick: _cache[0] || (_cache[0] = (...args) => unref(leftPrevYear) && unref(leftPrevYear)(...args))
  28725. }, [renderSlot(_ctx.$slots, "prev-year", {}, () => [createVNode(unref(ElIcon), null, {
  28726. default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
  28727. _: 1
  28728. })])], 10, _hoisted_2$28),
  28729. _ctx.unlinkPanels || _ctx.singlePanel ? (openBlock(), createElementBlock("button", {
  28730. key: 0,
  28731. type: "button",
  28732. disabled: !enableYearArrow.value || unref(monthRangeDisabled),
  28733. class: normalizeClass([[unref(ppNs).e("icon-btn"), unref(ppNs).is("disabled", !enableYearArrow.value || unref(monthRangeDisabled))], "d-arrow-right"]),
  28734. onClick: _cache[1] || (_cache[1] = (...args) => unref(leftNextYear) && unref(leftNextYear)(...args))
  28735. }, [renderSlot(_ctx.$slots, "next-year", {}, () => [createVNode(unref(ElIcon), null, {
  28736. default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
  28737. _: 1
  28738. })])], 10, _hoisted_3$12)) : createCommentVNode("v-if", true),
  28739. createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
  28740. ], 2), createVNode(basic_month_table_default, {
  28741. "selection-mode": "range",
  28742. date: leftDate.value,
  28743. "min-date": unref(minDate),
  28744. "max-date": unref(maxDate),
  28745. "range-state": unref(rangeState),
  28746. "disabled-date": unref(disabledDate),
  28747. disabled: unref(monthRangeDisabled),
  28748. "cell-class-name": unref(cellClassName),
  28749. onChangerange: unref(handleChangeRange),
  28750. onPick: handleRangePick,
  28751. onSelect: unref(onSelect)
  28752. }, null, 8, [
  28753. "date",
  28754. "min-date",
  28755. "max-date",
  28756. "range-state",
  28757. "disabled-date",
  28758. "disabled",
  28759. "cell-class-name",
  28760. "onChangerange",
  28761. "onSelect"
  28762. ])], 2), !_ctx.singlePanel ? (openBlock(), createElementBlock("div", {
  28763. key: 0,
  28764. class: normalizeClass([[unref(ppNs).e("content"), unref(drpNs).e("content")], "is-right"])
  28765. }, [createElementVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
  28766. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  28767. key: 0,
  28768. type: "button",
  28769. disabled: !enableYearArrow.value || unref(monthRangeDisabled),
  28770. class: normalizeClass([[unref(ppNs).e("icon-btn"), unref(ppNs).is("disabled", !enableYearArrow.value || unref(monthRangeDisabled))], "d-arrow-left"]),
  28771. onClick: _cache[2] || (_cache[2] = (...args) => unref(rightPrevYear) && unref(rightPrevYear)(...args))
  28772. }, [renderSlot(_ctx.$slots, "prev-year", {}, () => [createVNode(unref(ElIcon), null, {
  28773. default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
  28774. _: 1
  28775. })])], 10, _hoisted_4$9)) : createCommentVNode("v-if", true),
  28776. createElementVNode("button", {
  28777. type: "button",
  28778. class: normalizeClass([unref(ppNs).e("icon-btn"), "d-arrow-right"]),
  28779. disabled: unref(monthRangeDisabled),
  28780. onClick: _cache[3] || (_cache[3] = (...args) => unref(rightNextYear) && unref(rightNextYear)(...args))
  28781. }, [renderSlot(_ctx.$slots, "next-year", {}, () => [createVNode(unref(ElIcon), null, {
  28782. default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
  28783. _: 1
  28784. })])], 10, _hoisted_5$6),
  28785. createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
  28786. ], 2), createVNode(basic_month_table_default, {
  28787. "selection-mode": "range",
  28788. date: rightDate.value,
  28789. "min-date": unref(minDate),
  28790. "max-date": unref(maxDate),
  28791. "range-state": unref(rangeState),
  28792. "disabled-date": unref(disabledDate),
  28793. disabled: unref(monthRangeDisabled),
  28794. "cell-class-name": unref(cellClassName),
  28795. onChangerange: unref(handleChangeRange),
  28796. onPick: handleRangePick,
  28797. onSelect: unref(onSelect)
  28798. }, null, 8, [
  28799. "date",
  28800. "min-date",
  28801. "max-date",
  28802. "range-state",
  28803. "disabled-date",
  28804. "disabled",
  28805. "cell-class-name",
  28806. "onChangerange",
  28807. "onSelect"
  28808. ])], 2)) : createCommentVNode("v-if", true)], 2)
  28809. ], 2)], 2);
  28810. };
  28811. }
  28812. });
  28813. //#endregion
  28814. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-month-range.vue
  28815. var panel_month_range_default = panel_month_range_vue_vue_type_script_setup_true_lang_default;
  28816. //#endregion
  28817. //#region ../../packages/components/date-picker-panel/src/props/panel-year-range.ts
  28818. const panelYearRangeProps = buildProps({ ...panelRangeSharedProps });
  28819. const panelYearRangeEmits = [
  28820. "pick",
  28821. "set-picker-option",
  28822. "calendar-change"
  28823. ];
  28824. //#endregion
  28825. //#region ../../packages/components/date-picker-panel/src/composables/use-year-range-header.ts
  28826. const useYearRangeHeader = ({ unlinkPanels, leftDate, rightDate }) => {
  28827. const leftPrevYear = () => {
  28828. leftDate.value = leftDate.value.subtract(10, "year");
  28829. if (!unlinkPanels.value) rightDate.value = rightDate.value.subtract(10, "year");
  28830. };
  28831. const rightNextYear = () => {
  28832. if (!unlinkPanels.value) leftDate.value = leftDate.value.add(10, "year");
  28833. rightDate.value = rightDate.value.add(10, "year");
  28834. };
  28835. const leftNextYear = () => {
  28836. leftDate.value = leftDate.value.add(10, "year");
  28837. };
  28838. const rightPrevYear = () => {
  28839. rightDate.value = rightDate.value.subtract(10, "year");
  28840. };
  28841. return {
  28842. leftPrevYear,
  28843. rightNextYear,
  28844. leftNextYear,
  28845. rightPrevYear,
  28846. leftLabel: computed(() => {
  28847. const leftStartDate = Math.floor(leftDate.value.year() / 10) * 10;
  28848. return `${leftStartDate}-${leftStartDate + 9}`;
  28849. }),
  28850. rightLabel: computed(() => {
  28851. const rightStartDate = Math.floor(rightDate.value.year() / 10) * 10;
  28852. return `${rightStartDate}-${rightStartDate + 9}`;
  28853. }),
  28854. leftYear: computed(() => {
  28855. return Math.floor(leftDate.value.year() / 10) * 10 + 9;
  28856. }),
  28857. rightYear: computed(() => {
  28858. return Math.floor(rightDate.value.year() / 10) * 10;
  28859. })
  28860. };
  28861. };
  28862. //#endregion
  28863. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-year-range.vue?vue&type=script&setup=true&lang.ts
  28864. const _hoisted_1$45 = ["disabled", "onClick"];
  28865. const _hoisted_2$27 = ["disabled"];
  28866. const _hoisted_3$11 = ["disabled"];
  28867. const _hoisted_4$8 = ["disabled"];
  28868. const _hoisted_5$5 = ["disabled"];
  28869. const step = 10;
  28870. const unit = "year";
  28871. var panel_year_range_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  28872. name: "DatePickerYearRange",
  28873. __name: "panel-year-range",
  28874. props: panelYearRangeProps,
  28875. emits: panelYearRangeEmits,
  28876. setup(__props, { emit: __emit }) {
  28877. const props = __props;
  28878. const emit = __emit;
  28879. const { lang } = useLocale();
  28880. const leftDate = ref((0, import_dayjs_min.default)().locale(lang.value));
  28881. const rightDate = ref((0, import_dayjs_min.default)().locale(lang.value).add(step, unit));
  28882. const isDefaultFormat = inject(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, void 0);
  28883. const pickerBase = inject(PICKER_BASE_INJECTION_KEY);
  28884. const { shortcuts, disabledDate, cellClassName } = pickerBase.props;
  28885. const format = toRef(pickerBase.props, "format");
  28886. const defaultValue = toRef(pickerBase.props, "defaultValue");
  28887. const { minDate, maxDate, rangeState, ppNs, drpNs, handleChangeRange, handleRangeConfirm, handleShortcutClick, onSelect, parseValue } = useRangePicker(props, {
  28888. defaultValue,
  28889. leftDate,
  28890. rightDate,
  28891. step,
  28892. unit,
  28893. sortDates
  28894. });
  28895. const { leftPrevYear, rightNextYear, leftNextYear, rightPrevYear, leftLabel, rightLabel, leftYear, rightYear } = useYearRangeHeader({
  28896. unlinkPanels: toRef(props, "unlinkPanels"),
  28897. leftDate,
  28898. rightDate
  28899. });
  28900. const yearRangeDisabled = useFormDisabled();
  28901. const hasShortcuts = computed(() => !!shortcuts.length);
  28902. const panelKls = computed(() => [
  28903. ppNs.b(),
  28904. drpNs.b(),
  28905. ppNs.is("border", props.border),
  28906. ppNs.is("disabled", yearRangeDisabled.value),
  28907. {
  28908. "has-sidebar": Boolean(useSlots().sidebar) || hasShortcuts.value,
  28909. "single-panel": props.singlePanel
  28910. }
  28911. ]);
  28912. const leftPanelKls = computed(() => {
  28913. return {
  28914. content: [
  28915. ppNs.e("content"),
  28916. drpNs.e("content"),
  28917. drpNs.is("left", !props.singlePanel)
  28918. ],
  28919. arrowLeftBtn: [ppNs.e("icon-btn"), "d-arrow-left"],
  28920. arrowRightBtn: [
  28921. ppNs.e("icon-btn"),
  28922. ppNs.is("disabled", !enableYearArrow.value || yearRangeDisabled.value),
  28923. "d-arrow-right"
  28924. ]
  28925. };
  28926. });
  28927. const rightPanelKls = computed(() => {
  28928. return {
  28929. content: [
  28930. ppNs.e("content"),
  28931. drpNs.e("content"),
  28932. "is-right"
  28933. ],
  28934. arrowLeftBtn: [
  28935. ppNs.e("icon-btn"),
  28936. ppNs.is("disabled", !enableYearArrow.value || yearRangeDisabled.value),
  28937. "d-arrow-left"
  28938. ],
  28939. arrowRightBtn: [ppNs.e("icon-btn"), "d-arrow-right"]
  28940. };
  28941. });
  28942. const enableYearArrow = computed(() => {
  28943. return props.singlePanel || props.unlinkPanels && rightYear.value > leftYear.value + 1;
  28944. });
  28945. const handleRangePick = (val, close = true) => {
  28946. const minDate_ = val.minDate;
  28947. const maxDate_ = val.maxDate;
  28948. if (maxDate.value === maxDate_ && minDate.value === minDate_) return;
  28949. emit("calendar-change", [minDate_.toDate(), maxDate_ && maxDate_.toDate()]);
  28950. maxDate.value = maxDate_;
  28951. minDate.value = minDate_;
  28952. if (!close) return;
  28953. handleRangeConfirm();
  28954. };
  28955. const parseUserInput = (value) => {
  28956. return correctlyParseUserInput(value, format.value, lang.value, isDefaultFormat);
  28957. };
  28958. const isValidValue = (date) => {
  28959. return isValidRange(date) && (disabledDate ? !disabledDate(date[0].toDate()) && !disabledDate(date[1].toDate()) : true);
  28960. };
  28961. const handleClear = () => {
  28962. let valueOnClear = null;
  28963. if (pickerBase?.emptyValues) valueOnClear = pickerBase.emptyValues.valueOnClear.value;
  28964. const defaultArr = getDefaultValue(unref(defaultValue), {
  28965. lang: unref(lang),
  28966. step,
  28967. unit,
  28968. unlinkPanels: props.unlinkPanels
  28969. });
  28970. leftDate.value = defaultArr[0];
  28971. rightDate.value = defaultArr[1];
  28972. emit("pick", valueOnClear);
  28973. };
  28974. function sortDates(minDate, maxDate) {
  28975. if (props.unlinkPanels && maxDate) {
  28976. const minDateYear = minDate?.year() || 0;
  28977. const maxDateYear = maxDate.year();
  28978. rightDate.value = minDateYear + step > maxDateYear ? maxDate.add(step, unit) : maxDate;
  28979. } else rightDate.value = leftDate.value.add(step, unit);
  28980. }
  28981. watch(() => props.visible, (visible) => {
  28982. if (!visible && rangeState.value.selecting) {
  28983. parseValue(props.parsedValue);
  28984. onSelect(false);
  28985. }
  28986. });
  28987. emit("set-picker-option", ["isValidValue", isValidValue]);
  28988. emit("set-picker-option", ["parseUserInput", parseUserInput]);
  28989. emit("set-picker-option", ["handleClear", handleClear]);
  28990. return (_ctx, _cache) => {
  28991. return openBlock(), createElementBlock("div", { class: normalizeClass(panelKls.value) }, [createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body-wrapper")) }, [
  28992. renderSlot(_ctx.$slots, "sidebar", { class: normalizeClass(unref(ppNs).e("sidebar")) }),
  28993. hasShortcuts.value ? (openBlock(), createElementBlock("div", {
  28994. key: 0,
  28995. class: normalizeClass(unref(ppNs).e("sidebar"))
  28996. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(shortcuts), (shortcut, key) => {
  28997. return openBlock(), createElementBlock("button", {
  28998. key,
  28999. type: "button",
  29000. class: normalizeClass(unref(ppNs).e("shortcut")),
  29001. disabled: unref(yearRangeDisabled),
  29002. onClick: ($event) => unref(handleShortcutClick)(shortcut)
  29003. }, toDisplayString(shortcut.text), 11, _hoisted_1$45);
  29004. }), 128))], 2)) : createCommentVNode("v-if", true),
  29005. createElementVNode("div", { class: normalizeClass(unref(ppNs).e("body")) }, [createElementVNode("div", { class: normalizeClass(leftPanelKls.value.content) }, [createElementVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
  29006. createElementVNode("button", {
  29007. type: "button",
  29008. class: normalizeClass(leftPanelKls.value.arrowLeftBtn),
  29009. disabled: unref(yearRangeDisabled),
  29010. onClick: _cache[0] || (_cache[0] = (...args) => unref(leftPrevYear) && unref(leftPrevYear)(...args))
  29011. }, [renderSlot(_ctx.$slots, "prev-year", {}, () => [createVNode(unref(ElIcon), null, {
  29012. default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
  29013. _: 1
  29014. })])], 10, _hoisted_2$27),
  29015. _ctx.unlinkPanels || _ctx.singlePanel ? (openBlock(), createElementBlock("button", {
  29016. key: 0,
  29017. type: "button",
  29018. disabled: !enableYearArrow.value || unref(yearRangeDisabled),
  29019. class: normalizeClass(leftPanelKls.value.arrowRightBtn),
  29020. onClick: _cache[1] || (_cache[1] = (...args) => unref(leftNextYear) && unref(leftNextYear)(...args))
  29021. }, [renderSlot(_ctx.$slots, "next-year", {}, () => [createVNode(unref(ElIcon), null, {
  29022. default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
  29023. _: 1
  29024. })])], 10, _hoisted_3$11)) : createCommentVNode("v-if", true),
  29025. createElementVNode("div", null, toDisplayString(unref(leftLabel)), 1)
  29026. ], 2), createVNode(basic_year_table_default, {
  29027. "selection-mode": "range",
  29028. date: leftDate.value,
  29029. "min-date": unref(minDate),
  29030. "max-date": unref(maxDate),
  29031. "range-state": unref(rangeState),
  29032. "disabled-date": unref(disabledDate),
  29033. disabled: unref(yearRangeDisabled),
  29034. "cell-class-name": unref(cellClassName),
  29035. onChangerange: unref(handleChangeRange),
  29036. onPick: handleRangePick,
  29037. onSelect: unref(onSelect)
  29038. }, null, 8, [
  29039. "date",
  29040. "min-date",
  29041. "max-date",
  29042. "range-state",
  29043. "disabled-date",
  29044. "disabled",
  29045. "cell-class-name",
  29046. "onChangerange",
  29047. "onSelect"
  29048. ])], 2), !_ctx.singlePanel ? (openBlock(), createElementBlock("div", {
  29049. key: 0,
  29050. class: normalizeClass(rightPanelKls.value.content)
  29051. }, [createElementVNode("div", { class: normalizeClass(unref(drpNs).e("header")) }, [
  29052. _ctx.unlinkPanels ? (openBlock(), createElementBlock("button", {
  29053. key: 0,
  29054. type: "button",
  29055. disabled: !enableYearArrow.value || unref(yearRangeDisabled),
  29056. class: normalizeClass(rightPanelKls.value.arrowLeftBtn),
  29057. onClick: _cache[2] || (_cache[2] = (...args) => unref(rightPrevYear) && unref(rightPrevYear)(...args))
  29058. }, [renderSlot(_ctx.$slots, "prev-year", {}, () => [createVNode(unref(ElIcon), null, {
  29059. default: withCtx(() => [createVNode(unref(d_arrow_left_default))]),
  29060. _: 1
  29061. })])], 10, _hoisted_4$8)) : createCommentVNode("v-if", true),
  29062. createElementVNode("button", {
  29063. type: "button",
  29064. class: normalizeClass(rightPanelKls.value.arrowRightBtn),
  29065. disabled: unref(yearRangeDisabled),
  29066. onClick: _cache[3] || (_cache[3] = (...args) => unref(rightNextYear) && unref(rightNextYear)(...args))
  29067. }, [renderSlot(_ctx.$slots, "next-year", {}, () => [createVNode(unref(ElIcon), null, {
  29068. default: withCtx(() => [createVNode(unref(d_arrow_right_default))]),
  29069. _: 1
  29070. })])], 10, _hoisted_5$5),
  29071. createElementVNode("div", null, toDisplayString(unref(rightLabel)), 1)
  29072. ], 2), createVNode(basic_year_table_default, {
  29073. "selection-mode": "range",
  29074. date: rightDate.value,
  29075. "min-date": unref(minDate),
  29076. "max-date": unref(maxDate),
  29077. "range-state": unref(rangeState),
  29078. "disabled-date": unref(disabledDate),
  29079. disabled: unref(yearRangeDisabled),
  29080. "cell-class-name": unref(cellClassName),
  29081. onChangerange: unref(handleChangeRange),
  29082. onPick: handleRangePick,
  29083. onSelect: unref(onSelect)
  29084. }, null, 8, [
  29085. "date",
  29086. "min-date",
  29087. "max-date",
  29088. "range-state",
  29089. "disabled-date",
  29090. "disabled",
  29091. "cell-class-name",
  29092. "onChangerange",
  29093. "onSelect"
  29094. ])], 2)) : createCommentVNode("v-if", true)], 2)
  29095. ], 2)], 2);
  29096. };
  29097. }
  29098. });
  29099. //#endregion
  29100. //#region ../../packages/components/date-picker-panel/src/date-picker-com/panel-year-range.vue
  29101. var panel_year_range_default = panel_year_range_vue_vue_type_script_setup_true_lang_default;
  29102. //#endregion
  29103. //#region ../../packages/components/date-picker-panel/src/panel-utils.ts
  29104. const getPanel = function(type) {
  29105. switch (type) {
  29106. case "daterange":
  29107. case "datetimerange": return panel_date_range_default;
  29108. case "monthrange": return panel_month_range_default;
  29109. case "yearrange": return panel_year_range_default;
  29110. default: return panel_date_pick_default;
  29111. }
  29112. };
  29113. //#endregion
  29114. //#region ../../packages/components/date-picker-panel/src/date-picker-panel.tsx
  29115. function _isSlot$7(s) {
  29116. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  29117. }
  29118. import_dayjs_min.default.extend(import_localeData.default);
  29119. import_dayjs_min.default.extend(import_advancedFormat.default);
  29120. import_dayjs_min.default.extend(import_customParseFormat.default);
  29121. import_dayjs_min.default.extend(import_weekOfYear.default);
  29122. import_dayjs_min.default.extend(import_weekYear.default);
  29123. import_dayjs_min.default.extend(import_dayOfYear.default);
  29124. import_dayjs_min.default.extend(import_isSameOrAfter.default);
  29125. import_dayjs_min.default.extend(import_isSameOrBefore.default);
  29126. var date_picker_panel_default = /* @__PURE__ */ defineComponent({
  29127. name: "ElDatePickerPanel",
  29128. install: null,
  29129. inheritAttrs: false,
  29130. props: datePickerPanelProps,
  29131. emits: [
  29132. UPDATE_MODEL_EVENT,
  29133. "calendar-change",
  29134. "panel-change",
  29135. "visible-change",
  29136. "clear"
  29137. ],
  29138. setup(props, { slots, emit, attrs }) {
  29139. const ns = useNamespace("picker-panel");
  29140. if (isUndefined(inject("EP_PICKER_BASE", void 0))) provide(PICKER_BASE_INJECTION_KEY, { props: reactive({ ...toRefs(props) }) });
  29141. provide(ROOT_PICKER_INJECTION_KEY, {
  29142. slots,
  29143. pickerNs: ns
  29144. });
  29145. const { parsedValue, onCalendarChange, onPanelChange, onSetPickerOption, onPick } = inject(ROOT_COMMON_PICKER_INJECTION_KEY, () => useCommonPicker(props, emit), true);
  29146. return () => {
  29147. return createVNode(getPanel(props.type), mergeProps(omit(attrs, "onPick"), props, {
  29148. "parsedValue": parsedValue.value,
  29149. "onSet-picker-option": onSetPickerOption,
  29150. "onCalendar-change": onCalendarChange,
  29151. "onPanel-change": onPanelChange,
  29152. "onClear": () => emit("clear"),
  29153. "onPick": onPick
  29154. }), _isSlot$7(slots) ? slots : { default: () => [slots] });
  29155. };
  29156. }
  29157. });
  29158. //#endregion
  29159. //#region ../../packages/components/date-picker-panel/index.ts
  29160. const ElDatePickerPanel = withInstall(date_picker_panel_default);
  29161. //#endregion
  29162. //#region ../../packages/components/date-picker/src/props.ts
  29163. const datePickerProps = buildProps({
  29164. ...timePickerDefaultProps,
  29165. type: {
  29166. type: definePropType(String),
  29167. default: "date"
  29168. }
  29169. });
  29170. //#endregion
  29171. //#region ../../packages/components/date-picker/src/date-picker.tsx
  29172. function _isSlot$6(s) {
  29173. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  29174. }
  29175. var date_picker_default = /* @__PURE__ */ defineComponent({
  29176. name: "ElDatePicker",
  29177. install: null,
  29178. props: datePickerProps,
  29179. emits: [UPDATE_MODEL_EVENT],
  29180. setup(props, { expose, emit, slots }) {
  29181. provide(ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, computed(() => {
  29182. return !props.format;
  29183. }));
  29184. provide(PICKER_POPPER_OPTIONS_INJECTION_KEY, reactive(toRef(props, "popperOptions")));
  29185. const commonPicker = ref();
  29186. expose({
  29187. focus: () => {
  29188. commonPicker.value?.focus();
  29189. },
  29190. blur: () => {
  29191. commonPicker.value?.blur();
  29192. },
  29193. handleOpen: () => {
  29194. commonPicker.value?.handleOpen();
  29195. },
  29196. handleClose: () => {
  29197. commonPicker.value?.handleClose();
  29198. }
  29199. });
  29200. const onModelValueUpdated = (val) => {
  29201. emit(UPDATE_MODEL_EVENT, val);
  29202. };
  29203. return () => {
  29204. return createVNode(picker_default, mergeProps(props, {
  29205. "format": props.format ?? (DEFAULT_FORMATS_DATEPICKER[props.type] || "YYYY-MM-DD"),
  29206. "type": props.type,
  29207. "ref": commonPicker,
  29208. "onUpdate:modelValue": onModelValueUpdated
  29209. }), {
  29210. default: (scopedProps) => createVNode(ElDatePickerPanel, mergeProps({
  29211. "disabled": props.disabled,
  29212. "editable": props.editable,
  29213. "border": false
  29214. }, scopedProps), _isSlot$6(slots) ? slots : { default: () => [slots] }),
  29215. "range-separator": slots["range-separator"]
  29216. });
  29217. };
  29218. }
  29219. });
  29220. //#endregion
  29221. //#region ../../packages/components/date-picker/index.ts
  29222. const ElDatePicker = withInstall(date_picker_default);
  29223. //#endregion
  29224. //#region ../../packages/components/descriptions/src/description.ts
  29225. const descriptionProps = buildProps({
  29226. border: Boolean,
  29227. column: {
  29228. type: Number,
  29229. default: 3
  29230. },
  29231. direction: {
  29232. type: String,
  29233. values: ["horizontal", "vertical"],
  29234. default: "horizontal"
  29235. },
  29236. size: useSizeProp,
  29237. title: {
  29238. type: String,
  29239. default: ""
  29240. },
  29241. extra: {
  29242. type: String,
  29243. default: ""
  29244. },
  29245. labelWidth: { type: [String, Number] }
  29246. });
  29247. //#endregion
  29248. //#region ../../packages/components/descriptions/src/descriptions-row.ts
  29249. const descriptionsRowProps = buildProps({ row: {
  29250. type: definePropType(Array),
  29251. default: () => []
  29252. } });
  29253. //#endregion
  29254. //#region ../../packages/components/descriptions/src/token.ts
  29255. const descriptionsKey = Symbol("elDescriptions");
  29256. //#endregion
  29257. //#region ../../packages/components/descriptions/src/descriptions-cell.ts
  29258. var descriptions_cell_default = defineComponent({
  29259. name: "ElDescriptionsCell",
  29260. props: {
  29261. cell: { type: Object },
  29262. tag: {
  29263. type: String,
  29264. default: "td"
  29265. },
  29266. type: { type: String }
  29267. },
  29268. setup() {
  29269. return { descriptions: inject(descriptionsKey, {}) };
  29270. },
  29271. render() {
  29272. const item = getNormalizedProps(this.cell);
  29273. const directives = (this.cell?.dirs || []).map((dire) => {
  29274. const { dir, arg, modifiers, value } = dire;
  29275. return [
  29276. dir,
  29277. value,
  29278. arg,
  29279. modifiers
  29280. ];
  29281. });
  29282. const { border, direction } = this.descriptions;
  29283. const isVertical = direction === "vertical";
  29284. const renderLabel = () => this.cell?.children?.label?.() || item.label;
  29285. const renderContent = () => this.cell?.children?.default?.();
  29286. const span = item.span;
  29287. const rowspan = item.rowspan;
  29288. const align = item.align ? `is-${item.align}` : "";
  29289. const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : align;
  29290. const className = item.className;
  29291. const labelClassName = item.labelClassName;
  29292. const style = {
  29293. width: addUnit(this.type === "label" ? item.labelWidth ?? this.descriptions.labelWidth ?? item.width : item.width),
  29294. minWidth: addUnit(item.minWidth)
  29295. };
  29296. const ns = useNamespace("descriptions");
  29297. switch (this.type) {
  29298. case "label": return withDirectives(h(this.tag, {
  29299. style,
  29300. class: [
  29301. ns.e("cell"),
  29302. ns.e("label"),
  29303. ns.is("bordered-label", border),
  29304. ns.is("vertical-label", isVertical),
  29305. labelAlign,
  29306. labelClassName
  29307. ],
  29308. colSpan: isVertical ? span : 1,
  29309. rowspan: isVertical ? 1 : rowspan
  29310. }, renderLabel()), directives);
  29311. case "content": return withDirectives(h(this.tag, {
  29312. style,
  29313. class: [
  29314. ns.e("cell"),
  29315. ns.e("content"),
  29316. ns.is("bordered-content", border),
  29317. ns.is("vertical-content", isVertical),
  29318. align,
  29319. className
  29320. ],
  29321. colSpan: isVertical ? span : span * 2 - 1,
  29322. rowspan: isVertical ? rowspan * 2 - 1 : rowspan
  29323. }, renderContent()), directives);
  29324. default: {
  29325. const label = renderLabel();
  29326. const labelStyle = {};
  29327. const width = addUnit(item.labelWidth ?? this.descriptions.labelWidth);
  29328. if (width) {
  29329. labelStyle.width = width;
  29330. labelStyle.display = "inline-block";
  29331. }
  29332. return withDirectives(h("td", {
  29333. style,
  29334. class: [ns.e("cell"), align],
  29335. colSpan: span,
  29336. rowspan
  29337. }, [!isNil(label) ? h("span", {
  29338. style: labelStyle,
  29339. class: [ns.e("label"), labelClassName]
  29340. }, label) : void 0, h("span", { class: [ns.e("content"), className] }, renderContent())]), directives);
  29341. }
  29342. }
  29343. }
  29344. });
  29345. //#endregion
  29346. //#region ../../packages/components/descriptions/src/descriptions-row.vue?vue&type=script&setup=true&lang.ts
  29347. const _hoisted_1$44 = { key: 1 };
  29348. var descriptions_row_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  29349. name: "ElDescriptionsRow",
  29350. __name: "descriptions-row",
  29351. props: descriptionsRowProps,
  29352. setup(__props) {
  29353. const descriptions = inject(descriptionsKey, {});
  29354. return (_ctx, _cache) => {
  29355. return unref(descriptions).direction === "vertical" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.row, (cell, _index) => {
  29356. return openBlock(), createBlock(unref(descriptions_cell_default), {
  29357. key: `tr1-${_index}`,
  29358. cell,
  29359. tag: "th",
  29360. type: "label"
  29361. }, null, 8, ["cell"]);
  29362. }), 128))]), createElementVNode("tr", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.row, (cell, _index) => {
  29363. return openBlock(), createBlock(unref(descriptions_cell_default), {
  29364. key: `tr2-${_index}`,
  29365. cell,
  29366. tag: "td",
  29367. type: "content"
  29368. }, null, 8, ["cell"]);
  29369. }), 128))])], 64)) : (openBlock(), createElementBlock("tr", _hoisted_1$44, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.row, (cell, _index) => {
  29370. return openBlock(), createElementBlock(Fragment, { key: `tr3-${_index}` }, [unref(descriptions).border ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createVNode(unref(descriptions_cell_default), {
  29371. cell,
  29372. tag: "td",
  29373. type: "label"
  29374. }, null, 8, ["cell"]), createVNode(unref(descriptions_cell_default), {
  29375. cell,
  29376. tag: "td",
  29377. type: "content"
  29378. }, null, 8, ["cell"])], 64)) : (openBlock(), createBlock(unref(descriptions_cell_default), {
  29379. key: 1,
  29380. cell,
  29381. tag: "td",
  29382. type: "both"
  29383. }, null, 8, ["cell"]))], 64);
  29384. }), 128))]));
  29385. };
  29386. }
  29387. });
  29388. //#endregion
  29389. //#region ../../packages/components/descriptions/src/descriptions-row.vue
  29390. var descriptions_row_default = descriptions_row_vue_vue_type_script_setup_true_lang_default;
  29391. //#endregion
  29392. //#region ../../packages/components/descriptions/src/constants.ts
  29393. const COMPONENT_NAME$10 = "ElDescriptionsItem";
  29394. //#endregion
  29395. //#region ../../packages/components/descriptions/src/description.vue?vue&type=script&setup=true&lang.ts
  29396. var description_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  29397. name: "ElDescriptions",
  29398. __name: "description",
  29399. props: descriptionProps,
  29400. setup(__props) {
  29401. const props = __props;
  29402. const ns = useNamespace("descriptions");
  29403. const descriptionsSize = useFormSize();
  29404. const slots = useSlots();
  29405. provide(descriptionsKey, props);
  29406. const descriptionKls = computed(() => [ns.b(), ns.m(descriptionsSize.value)]);
  29407. const filledNode = (node, span, count, isLast = false) => {
  29408. if (!node.props) node.props = {};
  29409. if (span > count) node.props.span = count;
  29410. if (isLast) node.props.span = span;
  29411. return node;
  29412. };
  29413. const getRows = () => {
  29414. if (!slots.default) return [];
  29415. const children = flattedChildren(slots.default()).filter((node) => node?.type?.name === COMPONENT_NAME$10);
  29416. const rows = [];
  29417. let temp = [];
  29418. let count = props.column;
  29419. let totalSpan = 0;
  29420. const rowspanTemp = [];
  29421. children.forEach((node, index) => {
  29422. const span = node.props?.span || 1;
  29423. const rowspan = node.props?.rowspan || 1;
  29424. const rowNo = rows.length;
  29425. rowspanTemp[rowNo] ||= 0;
  29426. if (rowspan > 1) for (let i = 1; i < rowspan; i++) {
  29427. rowspanTemp[rowNo + i] ||= 0;
  29428. rowspanTemp[rowNo + i]++;
  29429. totalSpan++;
  29430. }
  29431. if (rowspanTemp[rowNo] > 0) {
  29432. count -= rowspanTemp[rowNo];
  29433. rowspanTemp[rowNo] = 0;
  29434. }
  29435. if (index < children.length - 1) totalSpan += span > count ? count : span;
  29436. if (index === children.length - 1) {
  29437. const lastSpan = props.column - totalSpan % props.column;
  29438. temp.push(filledNode(node, lastSpan, count, true));
  29439. rows.push(temp);
  29440. return;
  29441. }
  29442. if (span < count) {
  29443. count -= span;
  29444. temp.push(node);
  29445. } else {
  29446. temp.push(filledNode(node, span, count));
  29447. rows.push(temp);
  29448. count = props.column;
  29449. temp = [];
  29450. }
  29451. });
  29452. return rows;
  29453. };
  29454. return (_ctx, _cache) => {
  29455. return openBlock(), createElementBlock("div", { class: normalizeClass(descriptionKls.value) }, [__props.title || __props.extra || _ctx.$slots.title || _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  29456. key: 0,
  29457. class: normalizeClass(unref(ns).e("header"))
  29458. }, [createElementVNode("div", { class: normalizeClass(unref(ns).e("title")) }, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 2), createElementVNode("div", { class: normalizeClass(unref(ns).e("extra")) }, [renderSlot(_ctx.$slots, "extra", {}, () => [createTextVNode(toDisplayString(__props.extra), 1)])], 2)], 2)) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("body")) }, [createElementVNode("table", { class: normalizeClass([unref(ns).e("table"), unref(ns).is("bordered", __props.border)]) }, [createElementVNode("tbody", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(getRows(), (row, _index) => {
  29459. return openBlock(), createBlock(descriptions_row_default, {
  29460. key: _index,
  29461. row
  29462. }, null, 8, ["row"]);
  29463. }), 128))])], 2)], 2)], 2);
  29464. };
  29465. }
  29466. });
  29467. //#endregion
  29468. //#region ../../packages/components/descriptions/src/description.vue
  29469. var description_default = description_vue_vue_type_script_setup_true_lang_default;
  29470. //#endregion
  29471. //#region ../../packages/components/descriptions/src/description-item.ts
  29472. const descriptionItemProps = buildProps({
  29473. label: {
  29474. type: String,
  29475. default: ""
  29476. },
  29477. span: {
  29478. type: Number,
  29479. default: 1
  29480. },
  29481. rowspan: {
  29482. type: Number,
  29483. default: 1
  29484. },
  29485. width: {
  29486. type: [String, Number],
  29487. default: ""
  29488. },
  29489. minWidth: {
  29490. type: [String, Number],
  29491. default: ""
  29492. },
  29493. labelWidth: { type: [String, Number] },
  29494. align: {
  29495. type: String,
  29496. values: columnAlignment,
  29497. default: "left"
  29498. },
  29499. labelAlign: {
  29500. type: String,
  29501. values: columnAlignment
  29502. },
  29503. className: {
  29504. type: String,
  29505. default: ""
  29506. },
  29507. labelClassName: {
  29508. type: String,
  29509. default: ""
  29510. }
  29511. });
  29512. const DescriptionItem = defineComponent({
  29513. name: COMPONENT_NAME$10,
  29514. props: descriptionItemProps
  29515. });
  29516. //#endregion
  29517. //#region ../../packages/components/descriptions/index.ts
  29518. const ElDescriptions = withInstall(description_default, { DescriptionsItem: DescriptionItem });
  29519. const ElDescriptionsItem = withNoopInstall(DescriptionItem);
  29520. //#endregion
  29521. //#region ../../packages/components/dialog/src/dialog-content.ts
  29522. const dialogContentProps = buildProps({
  29523. center: Boolean,
  29524. alignCenter: {
  29525. type: Boolean,
  29526. default: void 0
  29527. },
  29528. closeIcon: { type: iconPropType },
  29529. draggable: {
  29530. type: Boolean,
  29531. default: void 0
  29532. },
  29533. overflow: {
  29534. type: Boolean,
  29535. default: void 0
  29536. },
  29537. fullscreen: Boolean,
  29538. headerClass: String,
  29539. bodyClass: String,
  29540. footerClass: String,
  29541. showClose: {
  29542. type: Boolean,
  29543. default: true
  29544. },
  29545. title: {
  29546. type: String,
  29547. default: ""
  29548. },
  29549. ariaLevel: {
  29550. type: String,
  29551. default: "2"
  29552. }
  29553. });
  29554. const dialogContentEmits = { close: () => true };
  29555. const dialogContentPropsDefaults = {
  29556. alignCenter: void 0,
  29557. draggable: void 0,
  29558. overflow: void 0,
  29559. showClose: true,
  29560. title: "",
  29561. ariaLevel: "2"
  29562. };
  29563. //#endregion
  29564. //#region ../../packages/components/dialog/src/dialog.ts
  29565. const dialogProps = buildProps({
  29566. ...dialogContentProps,
  29567. appendToBody: Boolean,
  29568. appendTo: {
  29569. type: definePropType([String, Object]),
  29570. default: "body"
  29571. },
  29572. beforeClose: { type: definePropType(Function) },
  29573. destroyOnClose: Boolean,
  29574. closeOnClickModal: {
  29575. type: Boolean,
  29576. default: true
  29577. },
  29578. closeOnPressEscape: {
  29579. type: Boolean,
  29580. default: true
  29581. },
  29582. lockScroll: {
  29583. type: Boolean,
  29584. default: true
  29585. },
  29586. modal: {
  29587. type: Boolean,
  29588. default: true
  29589. },
  29590. modalPenetrable: Boolean,
  29591. openDelay: {
  29592. type: Number,
  29593. default: 0
  29594. },
  29595. closeDelay: {
  29596. type: Number,
  29597. default: 0
  29598. },
  29599. top: { type: String },
  29600. modelValue: Boolean,
  29601. modalClass: String,
  29602. headerClass: String,
  29603. bodyClass: String,
  29604. footerClass: String,
  29605. width: { type: [String, Number] },
  29606. zIndex: { type: Number },
  29607. trapFocus: Boolean,
  29608. headerAriaLevel: {
  29609. type: String,
  29610. default: "2"
  29611. },
  29612. transition: {
  29613. type: definePropType([String, Object]),
  29614. default: void 0
  29615. }
  29616. });
  29617. const dialogEmits = {
  29618. open: () => true,
  29619. opened: () => true,
  29620. close: () => true,
  29621. closed: () => true,
  29622. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  29623. openAutoFocus: () => true,
  29624. closeAutoFocus: () => true
  29625. };
  29626. const dialogContextKey = Symbol("dialogContextKey");
  29627. const dialogPropsDefaults = {
  29628. ...dialogContentPropsDefaults,
  29629. appendTo: "body",
  29630. closeOnClickModal: true,
  29631. closeOnPressEscape: true,
  29632. lockScroll: true,
  29633. modal: true,
  29634. openDelay: 0,
  29635. closeDelay: 0,
  29636. headerAriaLevel: "2",
  29637. transition: void 0
  29638. };
  29639. //#endregion
  29640. //#region ../../packages/components/overlay/src/overlay.ts
  29641. const overlayProps = buildProps({
  29642. mask: {
  29643. type: Boolean,
  29644. default: true
  29645. },
  29646. customMaskEvent: Boolean,
  29647. overlayClass: { type: definePropType([
  29648. String,
  29649. Array,
  29650. Object
  29651. ]) },
  29652. zIndex: { type: definePropType([String, Number]) }
  29653. });
  29654. const overlayEmits = { click: (evt) => evt instanceof MouseEvent };
  29655. const BLOCK = "overlay";
  29656. var overlay_default = defineComponent({
  29657. name: "ElOverlay",
  29658. props: overlayProps,
  29659. emits: overlayEmits,
  29660. setup(props, { slots, emit }) {
  29661. const ns = useNamespace(BLOCK);
  29662. const onMaskClick = (e) => {
  29663. emit("click", e);
  29664. };
  29665. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  29666. return () => {
  29667. return props.mask ? createVNode("div", {
  29668. class: [ns.b(), props.overlayClass],
  29669. style: { zIndex: props.zIndex },
  29670. onClick,
  29671. onMousedown,
  29672. onMouseup
  29673. }, [renderSlot(slots, "default")], 4 | 2 | 8, [
  29674. "onClick",
  29675. "onMouseup",
  29676. "onMousedown"
  29677. ]) : h("div", {
  29678. class: props.overlayClass,
  29679. style: {
  29680. zIndex: props.zIndex,
  29681. position: "fixed",
  29682. top: "0px",
  29683. right: "0px",
  29684. bottom: "0px",
  29685. left: "0px"
  29686. }
  29687. }, [renderSlot(slots, "default")]);
  29688. };
  29689. }
  29690. });
  29691. //#endregion
  29692. //#region ../../packages/components/overlay/index.ts
  29693. const ElOverlay = overlay_default;
  29694. //#endregion
  29695. //#region ../../packages/components/dialog/src/constants.ts
  29696. const dialogInjectionKey = Symbol("dialogInjectionKey");
  29697. const DEFAULT_DIALOG_TRANSITION = "dialog-fade";
  29698. //#endregion
  29699. //#region ../../packages/components/dialog/src/dialog-content.vue?vue&type=script&setup=true&lang.ts
  29700. const _hoisted_1$43 = ["aria-level"];
  29701. const _hoisted_2$26 = ["aria-label"];
  29702. const _hoisted_3$10 = ["id"];
  29703. var dialog_content_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  29704. name: "ElDialogContent",
  29705. __name: "dialog-content",
  29706. props: dialogContentProps,
  29707. emits: dialogContentEmits,
  29708. setup(__props, { expose: __expose }) {
  29709. const { t } = useLocale();
  29710. const { Close } = CloseComponents;
  29711. const props = __props;
  29712. const { dialogRef, headerRef, bodyId, ns, style } = inject(dialogInjectionKey);
  29713. const { focusTrapRef } = inject(FOCUS_TRAP_INJECTION_KEY);
  29714. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  29715. const draggable = computed(() => !!props.draggable);
  29716. const { resetPosition, updatePosition, isDragging } = useDraggable(dialogRef, headerRef, draggable, computed(() => !!props.overflow));
  29717. const dialogKls = computed(() => [
  29718. ns.b(),
  29719. ns.is("fullscreen", props.fullscreen),
  29720. ns.is("draggable", draggable.value),
  29721. ns.is("dragging", isDragging.value),
  29722. ns.is("align-center", !!props.alignCenter),
  29723. { [ns.m("center")]: props.center }
  29724. ]);
  29725. __expose({
  29726. resetPosition,
  29727. updatePosition
  29728. });
  29729. return (_ctx, _cache) => {
  29730. return openBlock(), createElementBlock("div", {
  29731. ref: unref(composedDialogRef),
  29732. class: normalizeClass(dialogKls.value),
  29733. style: normalizeStyle(unref(style)),
  29734. tabindex: "-1"
  29735. }, [
  29736. createElementVNode("header", {
  29737. ref_key: "headerRef",
  29738. ref: headerRef,
  29739. class: normalizeClass([
  29740. unref(ns).e("header"),
  29741. __props.headerClass,
  29742. { "show-close": __props.showClose }
  29743. ])
  29744. }, [renderSlot(_ctx.$slots, "header", {}, () => [createElementVNode("span", {
  29745. role: "heading",
  29746. "aria-level": __props.ariaLevel,
  29747. class: normalizeClass(unref(ns).e("title"))
  29748. }, toDisplayString(__props.title), 11, _hoisted_1$43)]), __props.showClose ? (openBlock(), createElementBlock("button", {
  29749. key: 0,
  29750. "aria-label": unref(t)("el.dialog.close"),
  29751. class: normalizeClass(unref(ns).e("headerbtn")),
  29752. type: "button",
  29753. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  29754. }, [createVNode(unref(ElIcon), { class: normalizeClass(unref(ns).e("close")) }, {
  29755. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.closeIcon || unref(Close))))]),
  29756. _: 1
  29757. }, 8, ["class"])], 10, _hoisted_2$26)) : createCommentVNode("v-if", true)], 2),
  29758. createElementVNode("div", {
  29759. id: unref(bodyId),
  29760. class: normalizeClass([unref(ns).e("body"), __props.bodyClass])
  29761. }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_3$10),
  29762. _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", {
  29763. key: 0,
  29764. class: normalizeClass([unref(ns).e("footer"), __props.footerClass])
  29765. }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true)
  29766. ], 6);
  29767. };
  29768. }
  29769. });
  29770. //#endregion
  29771. //#region ../../packages/components/dialog/src/dialog-content.vue
  29772. var dialog_content_default = dialog_content_vue_vue_type_script_setup_true_lang_default;
  29773. //#endregion
  29774. //#region ../../packages/components/dialog/src/use-dialog.ts
  29775. const COMPONENT_NAME$9 = "ElDialog";
  29776. const useDialog = (props, targetRef) => {
  29777. const emit = getCurrentInstance().emit;
  29778. const { nextZIndex } = useZIndex();
  29779. let lastPosition = "";
  29780. const titleId = useId();
  29781. const bodyId = useId();
  29782. const visible = ref(false);
  29783. const closed = ref(false);
  29784. const rendered = ref(false);
  29785. const zIndex = ref(props.zIndex ?? nextZIndex());
  29786. const closing = ref(false);
  29787. let openTimer = void 0;
  29788. let closeTimer = void 0;
  29789. const config = useGlobalConfig();
  29790. const namespace = computed(() => config.value?.namespace ?? "el");
  29791. const globalConfig = computed(() => config.value?.dialog);
  29792. const style = computed(() => {
  29793. const style = {};
  29794. const varPrefix = `--${namespace.value}-dialog`;
  29795. if (!props.fullscreen) {
  29796. if (props.top) style[`${varPrefix}-margin-top`] = props.top;
  29797. const width = addUnit(props.width);
  29798. if (width) style[`${varPrefix}-width`] = width;
  29799. }
  29800. return style;
  29801. });
  29802. const _draggable = computed(() => (props.draggable ?? globalConfig.value?.draggable ?? false) && !props.fullscreen);
  29803. const _alignCenter = computed(() => props.alignCenter ?? globalConfig.value?.alignCenter ?? false);
  29804. const _overflow = computed(() => props.overflow ?? globalConfig.value?.overflow ?? false);
  29805. const penetrable = computed(() => props.modalPenetrable && !props.modal && !props.fullscreen);
  29806. const overlayDialogStyle = computed(() => {
  29807. if (_alignCenter.value) return { display: "flex" };
  29808. return {};
  29809. });
  29810. const transitionConfig = computed(() => {
  29811. const transition = props.transition ?? globalConfig.value?.transition ?? "dialog-fade";
  29812. const baseConfig = {
  29813. name: transition,
  29814. onAfterEnter: afterEnter,
  29815. onBeforeLeave: beforeLeave,
  29816. onAfterLeave: afterLeave
  29817. };
  29818. if (isObject$1(transition)) {
  29819. const config = { ...transition };
  29820. const _mergeHook = (userHook, defaultHook) => {
  29821. return (el) => {
  29822. if (isArray$1(userHook)) userHook.forEach((fn) => {
  29823. if (isFunction$1(fn)) fn(el);
  29824. });
  29825. else if (isFunction$1(userHook)) userHook(el);
  29826. defaultHook();
  29827. };
  29828. };
  29829. config.onAfterEnter = _mergeHook(config.onAfterEnter, afterEnter);
  29830. config.onBeforeLeave = _mergeHook(config.onBeforeLeave, beforeLeave);
  29831. config.onAfterLeave = _mergeHook(config.onAfterLeave, afterLeave);
  29832. if (!config.name) {
  29833. config.name = DEFAULT_DIALOG_TRANSITION;
  29834. /* @__PURE__ */ debugWarn(COMPONENT_NAME$9, `transition.name is missing when using object syntax, fallback to '${DEFAULT_DIALOG_TRANSITION}'`);
  29835. }
  29836. return config;
  29837. }
  29838. return baseConfig;
  29839. });
  29840. function afterEnter() {
  29841. emit("opened");
  29842. }
  29843. function afterLeave() {
  29844. emit("closed");
  29845. emit(UPDATE_MODEL_EVENT, false);
  29846. if (props.destroyOnClose) rendered.value = false;
  29847. closing.value = false;
  29848. }
  29849. function beforeLeave() {
  29850. closing.value = true;
  29851. emit("close");
  29852. }
  29853. function open() {
  29854. closeTimer?.();
  29855. openTimer?.();
  29856. if (props.openDelay && props.openDelay > 0) ({stop: openTimer} = useTimeoutFn(() => doOpen(), props.openDelay));
  29857. else doOpen();
  29858. }
  29859. function close() {
  29860. openTimer?.();
  29861. closeTimer?.();
  29862. if (props.closeDelay && props.closeDelay > 0) ({stop: closeTimer} = useTimeoutFn(() => doClose(), props.closeDelay));
  29863. else doClose();
  29864. }
  29865. function handleClose() {
  29866. function hide(shouldCancel) {
  29867. if (shouldCancel) return;
  29868. closed.value = true;
  29869. visible.value = false;
  29870. }
  29871. if (props.beforeClose) props.beforeClose(hide);
  29872. else close();
  29873. }
  29874. function onModalClick() {
  29875. if (props.closeOnClickModal) handleClose();
  29876. }
  29877. function doOpen() {
  29878. if (!isClient) return;
  29879. visible.value = true;
  29880. }
  29881. function doClose() {
  29882. visible.value = false;
  29883. }
  29884. function onOpenAutoFocus() {
  29885. emit("openAutoFocus");
  29886. }
  29887. function onCloseAutoFocus() {
  29888. emit("closeAutoFocus");
  29889. }
  29890. function onFocusoutPrevented(event) {
  29891. if (event.detail?.focusReason === "pointer") event.preventDefault();
  29892. }
  29893. if (props.lockScroll) useLockscreen(visible);
  29894. function onCloseRequested() {
  29895. if (props.closeOnPressEscape) handleClose();
  29896. }
  29897. function bringToFront() {
  29898. if (!visible.value || !penetrable.value || props.zIndex !== void 0) return;
  29899. zIndex.value = nextZIndex();
  29900. }
  29901. watch(() => props.zIndex, () => {
  29902. zIndex.value = props.zIndex ?? nextZIndex();
  29903. });
  29904. watch(() => props.modelValue, (val) => {
  29905. if (val) {
  29906. closed.value = false;
  29907. closing.value = false;
  29908. open();
  29909. rendered.value = true;
  29910. zIndex.value = props.zIndex ?? nextZIndex();
  29911. nextTick(() => {
  29912. emit("open");
  29913. if (targetRef.value) {
  29914. targetRef.value.parentElement.scrollTop = 0;
  29915. targetRef.value.parentElement.scrollLeft = 0;
  29916. targetRef.value.scrollTop = 0;
  29917. }
  29918. });
  29919. } else if (visible.value) close();
  29920. });
  29921. watch(() => props.fullscreen, (val) => {
  29922. if (!targetRef.value) return;
  29923. if (val) {
  29924. lastPosition = targetRef.value.style.transform;
  29925. targetRef.value.style.transform = "";
  29926. } else targetRef.value.style.transform = lastPosition;
  29927. });
  29928. onMounted(() => {
  29929. if (props.modelValue) {
  29930. visible.value = true;
  29931. rendered.value = true;
  29932. open();
  29933. }
  29934. });
  29935. return {
  29936. afterEnter,
  29937. afterLeave,
  29938. beforeLeave,
  29939. handleClose,
  29940. onModalClick,
  29941. close,
  29942. doClose,
  29943. onOpenAutoFocus,
  29944. onCloseAutoFocus,
  29945. onCloseRequested,
  29946. onFocusoutPrevented,
  29947. bringToFront,
  29948. titleId,
  29949. bodyId,
  29950. closed,
  29951. style,
  29952. overlayDialogStyle,
  29953. rendered,
  29954. visible,
  29955. zIndex,
  29956. transitionConfig,
  29957. _draggable,
  29958. _alignCenter,
  29959. _overflow,
  29960. closing,
  29961. penetrable
  29962. };
  29963. };
  29964. //#endregion
  29965. //#region ../../packages/components/dialog/src/dialog.vue?vue&type=script&setup=true&lang.ts
  29966. const _hoisted_1$42 = [
  29967. "aria-label",
  29968. "aria-labelledby",
  29969. "aria-describedby"
  29970. ];
  29971. var dialog_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  29972. name: "ElDialog",
  29973. inheritAttrs: false,
  29974. __name: "dialog",
  29975. props: dialogProps,
  29976. emits: dialogEmits,
  29977. setup(__props, { expose: __expose }) {
  29978. const props = __props;
  29979. const slots = useSlots();
  29980. useDeprecated({
  29981. scope: "el-dialog",
  29982. from: "the title slot",
  29983. replacement: "the header slot",
  29984. version: "3.0.0",
  29985. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  29986. }, computed(() => !!slots.title));
  29987. const ns = useNamespace("dialog");
  29988. const dialogRef = ref();
  29989. const headerRef = ref();
  29990. const dialogContentRef = ref();
  29991. const { visible, titleId, bodyId, style, overlayDialogStyle, rendered, transitionConfig, zIndex, _draggable, _alignCenter, _overflow, penetrable, handleClose, onModalClick, onOpenAutoFocus, onCloseAutoFocus, onCloseRequested, onFocusoutPrevented, bringToFront, closing } = useDialog(props, dialogRef);
  29992. provide(dialogInjectionKey, {
  29993. dialogRef,
  29994. headerRef,
  29995. bodyId,
  29996. ns,
  29997. rendered,
  29998. style
  29999. });
  30000. const overlayEvent = useSameTarget(onModalClick);
  30001. const resetPosition = () => {
  30002. dialogContentRef.value?.resetPosition();
  30003. };
  30004. __expose({
  30005. visible,
  30006. dialogContentRef,
  30007. resetPosition,
  30008. handleClose
  30009. });
  30010. return (_ctx, _cache) => {
  30011. return openBlock(), createBlock(Teleport, {
  30012. to: __props.appendTo,
  30013. disabled: __props.appendTo !== "body" ? false : !__props.appendToBody
  30014. }, [createVNode(Transition, mergeProps(unref(transitionConfig), { persisted: "" }), {
  30015. default: withCtx(() => [withDirectives(createVNode(unref(ElOverlay), {
  30016. "custom-mask-event": "",
  30017. mask: __props.modal,
  30018. "overlay-class": [
  30019. __props.modalClass ?? "",
  30020. `${unref(ns).namespace.value}-modal-dialog`,
  30021. unref(ns).is("penetrable", unref(penetrable))
  30022. ],
  30023. "z-index": unref(zIndex)
  30024. }, {
  30025. default: withCtx(() => [createElementVNode("div", {
  30026. role: "dialog",
  30027. "aria-modal": "true",
  30028. "aria-label": __props.title || void 0,
  30029. "aria-labelledby": !__props.title ? unref(titleId) : void 0,
  30030. "aria-describedby": unref(bodyId),
  30031. class: normalizeClass([`${unref(ns).namespace.value}-overlay-dialog`, unref(ns).is("closing", unref(closing))]),
  30032. style: normalizeStyle(unref(overlayDialogStyle)),
  30033. onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)),
  30034. onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)),
  30035. onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args))
  30036. }, [createVNode(unref(focus_trap_default), {
  30037. loop: "",
  30038. trapped: unref(visible),
  30039. "focus-start-el": "container",
  30040. onFocusAfterTrapped: unref(onOpenAutoFocus),
  30041. onFocusAfterReleased: unref(onCloseAutoFocus),
  30042. onFocusoutPrevented: unref(onFocusoutPrevented),
  30043. onReleaseRequested: unref(onCloseRequested)
  30044. }, {
  30045. default: withCtx(() => [unref(rendered) ? (openBlock(), createBlock(dialog_content_default, mergeProps({
  30046. key: 0,
  30047. ref_key: "dialogContentRef",
  30048. ref: dialogContentRef
  30049. }, _ctx.$attrs, {
  30050. center: __props.center,
  30051. "align-center": unref(_alignCenter),
  30052. "close-icon": __props.closeIcon,
  30053. draggable: unref(_draggable),
  30054. overflow: unref(_overflow),
  30055. fullscreen: __props.fullscreen,
  30056. "header-class": __props.headerClass,
  30057. "body-class": __props.bodyClass,
  30058. "footer-class": __props.footerClass,
  30059. "show-close": __props.showClose,
  30060. title: __props.title,
  30061. "aria-level": __props.headerAriaLevel,
  30062. onClose: unref(handleClose),
  30063. onMousedown: unref(bringToFront)
  30064. }), createSlots({
  30065. header: withCtx(() => [!_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  30066. key: 0,
  30067. close: unref(handleClose),
  30068. titleId: unref(titleId),
  30069. titleClass: unref(ns).e("title")
  30070. }) : renderSlot(_ctx.$slots, "title", { key: 1 })]),
  30071. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  30072. _: 2
  30073. }, [_ctx.$slots.footer ? {
  30074. name: "footer",
  30075. fn: withCtx(() => [renderSlot(_ctx.$slots, "footer")]),
  30076. key: "0"
  30077. } : void 0]), 1040, [
  30078. "center",
  30079. "align-center",
  30080. "close-icon",
  30081. "draggable",
  30082. "overflow",
  30083. "fullscreen",
  30084. "header-class",
  30085. "body-class",
  30086. "footer-class",
  30087. "show-close",
  30088. "title",
  30089. "aria-level",
  30090. "onClose",
  30091. "onMousedown"
  30092. ])) : createCommentVNode("v-if", true)]),
  30093. _: 3
  30094. }, 8, [
  30095. "trapped",
  30096. "onFocusAfterTrapped",
  30097. "onFocusAfterReleased",
  30098. "onFocusoutPrevented",
  30099. "onReleaseRequested"
  30100. ])], 46, _hoisted_1$42)]),
  30101. _: 3
  30102. }, 8, [
  30103. "mask",
  30104. "overlay-class",
  30105. "z-index"
  30106. ]), [[vShow, unref(visible)]])]),
  30107. _: 3
  30108. }, 16)], 8, ["to", "disabled"]);
  30109. };
  30110. }
  30111. });
  30112. //#endregion
  30113. //#region ../../packages/components/dialog/src/dialog.vue
  30114. var dialog_default = dialog_vue_vue_type_script_setup_true_lang_default;
  30115. //#endregion
  30116. //#region ../../packages/components/dialog/index.ts
  30117. const ElDialog = withInstall(dialog_default);
  30118. //#endregion
  30119. //#region ../../packages/components/divider/src/divider.ts
  30120. const dividerProps = buildProps({
  30121. direction: {
  30122. type: String,
  30123. values: ["horizontal", "vertical"],
  30124. default: "horizontal"
  30125. },
  30126. contentPosition: {
  30127. type: String,
  30128. values: [
  30129. "left",
  30130. "center",
  30131. "right"
  30132. ],
  30133. default: "center"
  30134. },
  30135. borderStyle: {
  30136. type: definePropType(String),
  30137. default: "solid"
  30138. }
  30139. });
  30140. //#endregion
  30141. //#region ../../packages/components/divider/src/divider.vue?vue&type=script&setup=true&lang.ts
  30142. var divider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  30143. name: "ElDivider",
  30144. __name: "divider",
  30145. props: dividerProps,
  30146. setup(__props) {
  30147. const props = __props;
  30148. const ns = useNamespace("divider");
  30149. const dividerStyle = computed(() => {
  30150. return ns.cssVar({ "border-style": props.borderStyle });
  30151. });
  30152. return (_ctx, _cache) => {
  30153. return openBlock(), createElementBlock("div", {
  30154. class: normalizeClass([unref(ns).b(), unref(ns).m(__props.direction)]),
  30155. style: normalizeStyle(dividerStyle.value),
  30156. role: "separator"
  30157. }, [_ctx.$slots.default && __props.direction !== "vertical" ? (openBlock(), createElementBlock("div", {
  30158. key: 0,
  30159. class: normalizeClass([unref(ns).e("text"), unref(ns).is(__props.contentPosition)])
  30160. }, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("v-if", true)], 6);
  30161. };
  30162. }
  30163. });
  30164. //#endregion
  30165. //#region ../../packages/components/divider/src/divider.vue
  30166. var divider_default = divider_vue_vue_type_script_setup_true_lang_default;
  30167. //#endregion
  30168. //#region ../../packages/components/divider/index.ts
  30169. const ElDivider = withInstall(divider_default);
  30170. //#endregion
  30171. //#region ../../packages/components/drawer/src/drawer.ts
  30172. const drawerProps = buildProps({
  30173. ...dialogProps,
  30174. direction: {
  30175. type: String,
  30176. default: "rtl",
  30177. values: [
  30178. "ltr",
  30179. "rtl",
  30180. "ttb",
  30181. "btt"
  30182. ]
  30183. },
  30184. resizable: Boolean,
  30185. size: {
  30186. type: [String, Number],
  30187. default: "30%"
  30188. },
  30189. withHeader: {
  30190. type: Boolean,
  30191. default: true
  30192. },
  30193. modalFade: {
  30194. type: Boolean,
  30195. default: true
  30196. },
  30197. headerAriaLevel: {
  30198. type: String,
  30199. default: "2"
  30200. }
  30201. });
  30202. const drawerEmits = {
  30203. ...dialogEmits,
  30204. "resize-start": (evt, size) => evt instanceof MouseEvent && typeof size === "number",
  30205. resize: (evt, size) => evt instanceof MouseEvent && typeof size === "number",
  30206. "resize-end": (evt, size) => evt instanceof MouseEvent && typeof size === "number"
  30207. };
  30208. //#endregion
  30209. //#region ../../packages/components/drawer/src/composables/useResizable.ts
  30210. function useResizable(props, target, emit) {
  30211. const { width, height } = useWindowSize();
  30212. const isHorizontal = computed(() => ["ltr", "rtl"].includes(props.direction));
  30213. const sign = computed(() => ["ltr", "ttb"].includes(props.direction) ? 1 : -1);
  30214. const windowSize = computed(() => isHorizontal.value ? width.value : height.value);
  30215. const getSize = computed(() => {
  30216. return clamp$2(startSize.value + sign.value * offset.value, 4, windowSize.value);
  30217. });
  30218. const startSize = ref(0);
  30219. const offset = ref(0);
  30220. const isResizing = ref(false);
  30221. const hasStartedDragging = ref(false);
  30222. let startPos = [];
  30223. let cleanups = [];
  30224. const getActualSize = () => {
  30225. const drawerEl = target.value?.closest("[aria-modal=\"true\"]");
  30226. if (drawerEl) return isHorizontal.value ? drawerEl.offsetWidth : drawerEl.offsetHeight;
  30227. return 100;
  30228. };
  30229. watch(() => [props.size, props.resizable], () => {
  30230. hasStartedDragging.value = false;
  30231. startSize.value = 0;
  30232. offset.value = 0;
  30233. onMouseUp();
  30234. });
  30235. const onMousedown = (e) => {
  30236. if (!props.resizable) return;
  30237. if (!hasStartedDragging.value) {
  30238. startSize.value = getActualSize();
  30239. hasStartedDragging.value = true;
  30240. }
  30241. startPos = [e.pageX, e.pageY];
  30242. isResizing.value = true;
  30243. emit("resize-start", e, startSize.value);
  30244. cleanups.push(useEventListener(window, "mouseup", onMouseUp), useEventListener(window, "mousemove", onMouseMove));
  30245. };
  30246. const onMouseMove = (e) => {
  30247. const { pageX, pageY } = e;
  30248. const offsetX = pageX - startPos[0];
  30249. const offsetY = pageY - startPos[1];
  30250. offset.value = isHorizontal.value ? offsetX : offsetY;
  30251. emit("resize", e, getSize.value);
  30252. };
  30253. const onMouseUp = (e) => {
  30254. if (!isResizing.value) return;
  30255. startPos = [];
  30256. startSize.value = getSize.value;
  30257. offset.value = 0;
  30258. isResizing.value = false;
  30259. cleanups.forEach((cleanup) => cleanup?.());
  30260. cleanups = [];
  30261. if (e) emit("resize-end", e, startSize.value);
  30262. };
  30263. const cleanup = useEventListener(target, "mousedown", onMousedown);
  30264. onBeforeUnmount(() => {
  30265. cleanup();
  30266. onMouseUp();
  30267. });
  30268. return {
  30269. size: computed(() => {
  30270. return hasStartedDragging.value ? `${getSize.value}px` : addUnit(props.size);
  30271. }),
  30272. isResizing,
  30273. isHorizontal
  30274. };
  30275. }
  30276. //#endregion
  30277. //#region ../../packages/components/drawer/src/drawer.vue?vue&type=script&setup=true&lang.ts
  30278. const _hoisted_1$41 = [
  30279. "aria-label",
  30280. "aria-labelledby",
  30281. "aria-describedby"
  30282. ];
  30283. const _hoisted_2$25 = ["id", "aria-level"];
  30284. const _hoisted_3$9 = ["aria-label"];
  30285. const _hoisted_4$7 = ["id"];
  30286. var drawer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  30287. name: "ElDrawer",
  30288. inheritAttrs: false,
  30289. __name: "drawer",
  30290. props: drawerProps,
  30291. emits: drawerEmits,
  30292. setup(__props, { expose: __expose, emit: __emit }) {
  30293. const props = __props;
  30294. const emit = __emit;
  30295. const slots = useSlots();
  30296. useDeprecated({
  30297. scope: "el-drawer",
  30298. from: "the title slot",
  30299. replacement: "the header slot",
  30300. version: "3.0.0",
  30301. ref: "https://element-plus.org/en-US/component/drawer.html#slots"
  30302. }, computed(() => !!slots.title));
  30303. const drawerRef = ref();
  30304. const focusStartRef = ref();
  30305. const draggerRef = ref();
  30306. const ns = useNamespace("drawer");
  30307. const { t } = useLocale();
  30308. const { afterEnter, afterLeave, beforeLeave, visible, rendered, titleId, bodyId, zIndex, onModalClick, onOpenAutoFocus, onCloseAutoFocus, onFocusoutPrevented, onCloseRequested, handleClose } = useDialog(props, drawerRef);
  30309. const { isHorizontal, size, isResizing } = useResizable(props, draggerRef, emit);
  30310. const penetrable = computed(() => props.modalPenetrable && !props.modal);
  30311. __expose({ handleClose });
  30312. return (_ctx, _cache) => {
  30313. return openBlock(), createBlock(Teleport, {
  30314. to: __props.appendTo,
  30315. disabled: __props.appendTo !== "body" ? false : !__props.appendToBody
  30316. }, [createVNode(Transition, {
  30317. name: unref(ns).b("fade"),
  30318. onAfterEnter: unref(afterEnter),
  30319. onAfterLeave: unref(afterLeave),
  30320. onBeforeLeave: unref(beforeLeave),
  30321. persisted: ""
  30322. }, {
  30323. default: withCtx(() => [withDirectives(createVNode(unref(ElOverlay), {
  30324. mask: __props.modal,
  30325. "overlay-class": [
  30326. unref(ns).is("drawer"),
  30327. __props.modalClass ?? "",
  30328. `${unref(ns).namespace.value}-modal-drawer`,
  30329. unref(ns).is("penetrable", penetrable.value)
  30330. ],
  30331. "z-index": unref(zIndex),
  30332. onClick: unref(onModalClick)
  30333. }, {
  30334. default: withCtx(() => [createVNode(unref(focus_trap_default), {
  30335. loop: "",
  30336. trapped: unref(visible),
  30337. "focus-trap-el": drawerRef.value,
  30338. "focus-start-el": focusStartRef.value,
  30339. onFocusAfterTrapped: unref(onOpenAutoFocus),
  30340. onFocusAfterReleased: unref(onCloseAutoFocus),
  30341. onFocusoutPrevented: unref(onFocusoutPrevented),
  30342. onReleaseRequested: unref(onCloseRequested)
  30343. }, {
  30344. default: withCtx(() => [createElementVNode("div", mergeProps({
  30345. ref_key: "drawerRef",
  30346. ref: drawerRef,
  30347. "aria-modal": "true",
  30348. "aria-label": __props.title || void 0,
  30349. "aria-labelledby": !__props.title ? unref(titleId) : void 0,
  30350. "aria-describedby": unref(bodyId)
  30351. }, _ctx.$attrs, {
  30352. class: [
  30353. unref(ns).b(),
  30354. __props.direction,
  30355. unref(visible) && "open",
  30356. unref(ns).is("dragging", unref(isResizing))
  30357. ],
  30358. style: { [unref(isHorizontal) ? "width" : "height"]: unref(size) },
  30359. role: "dialog",
  30360. onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
  30361. }), [
  30362. createElementVNode("span", {
  30363. ref_key: "focusStartRef",
  30364. ref: focusStartRef,
  30365. class: normalizeClass(unref(ns).e("sr-focus")),
  30366. tabindex: "-1"
  30367. }, null, 2),
  30368. __props.withHeader ? (openBlock(), createElementBlock("header", {
  30369. key: 0,
  30370. class: normalizeClass([unref(ns).e("header"), __props.headerClass])
  30371. }, [!_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  30372. key: 0,
  30373. close: unref(handleClose),
  30374. titleId: unref(titleId),
  30375. titleClass: unref(ns).e("title")
  30376. }, () => [createElementVNode("span", {
  30377. id: unref(titleId),
  30378. role: "heading",
  30379. "aria-level": __props.headerAriaLevel,
  30380. class: normalizeClass(unref(ns).e("title"))
  30381. }, toDisplayString(__props.title), 11, _hoisted_2$25)]) : renderSlot(_ctx.$slots, "title", { key: 1 }, () => [createCommentVNode(" DEPRECATED SLOT ")]), __props.showClose ? (openBlock(), createElementBlock("button", {
  30382. key: 2,
  30383. "aria-label": unref(t)("el.drawer.close"),
  30384. class: normalizeClass(unref(ns).e("close-btn")),
  30385. type: "button",
  30386. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClose) && unref(handleClose)(...args))
  30387. }, [createVNode(unref(ElIcon), { class: normalizeClass(unref(ns).e("close")) }, {
  30388. default: withCtx(() => [createVNode(unref(close_default))]),
  30389. _: 1
  30390. }, 8, ["class"])], 10, _hoisted_3$9)) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true),
  30391. unref(rendered) ? (openBlock(), createElementBlock("div", {
  30392. key: 1,
  30393. id: unref(bodyId),
  30394. class: normalizeClass([unref(ns).e("body"), __props.bodyClass])
  30395. }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_4$7)) : createCommentVNode("v-if", true),
  30396. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  30397. key: 2,
  30398. class: normalizeClass([unref(ns).e("footer"), __props.footerClass])
  30399. }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true),
  30400. __props.resizable ? (openBlock(), createElementBlock("div", {
  30401. key: 3,
  30402. ref_key: "draggerRef",
  30403. ref: draggerRef,
  30404. style: normalizeStyle({ zIndex: unref(zIndex) }),
  30405. class: normalizeClass(unref(ns).e("dragger"))
  30406. }, null, 6)) : createCommentVNode("v-if", true)
  30407. ], 16, _hoisted_1$41)]),
  30408. _: 3
  30409. }, 8, [
  30410. "trapped",
  30411. "focus-trap-el",
  30412. "focus-start-el",
  30413. "onFocusAfterTrapped",
  30414. "onFocusAfterReleased",
  30415. "onFocusoutPrevented",
  30416. "onReleaseRequested"
  30417. ])]),
  30418. _: 3
  30419. }, 8, [
  30420. "mask",
  30421. "overlay-class",
  30422. "z-index",
  30423. "onClick"
  30424. ]), [[vShow, unref(visible)]])]),
  30425. _: 3
  30426. }, 8, [
  30427. "name",
  30428. "onAfterEnter",
  30429. "onAfterLeave",
  30430. "onBeforeLeave"
  30431. ])], 8, ["to", "disabled"]);
  30432. };
  30433. }
  30434. });
  30435. //#endregion
  30436. //#region ../../packages/components/drawer/src/drawer.vue
  30437. var drawer_default = drawer_vue_vue_type_script_setup_true_lang_default;
  30438. //#endregion
  30439. //#region ../../packages/components/drawer/index.ts
  30440. const ElDrawer = withInstall(drawer_default);
  30441. //#endregion
  30442. //#region ../../packages/components/collection/src/collection.vue?vue&type=script&lang.ts
  30443. var collection_vue_vue_type_script_lang_default = defineComponent({ inheritAttrs: false });
  30444. //#endregion
  30445. //#region ../../packages/components/collection/src/collection.vue
  30446. function _sfc_render$15(_ctx, _cache, $props, $setup, $data, $options) {
  30447. return renderSlot(_ctx.$slots, "default");
  30448. }
  30449. var collection_default = /* @__PURE__ */ _plugin_vue_export_helper_default(collection_vue_vue_type_script_lang_default, [["render", _sfc_render$15]]);
  30450. //#endregion
  30451. //#region ../../packages/components/collection/src/collection-item.vue?vue&type=script&lang.ts
  30452. var collection_item_vue_vue_type_script_lang_default = defineComponent({
  30453. name: "ElCollectionItem",
  30454. inheritAttrs: false
  30455. });
  30456. //#endregion
  30457. //#region ../../packages/components/collection/src/collection-item.vue
  30458. function _sfc_render$14(_ctx, _cache, $props, $setup, $data, $options) {
  30459. return renderSlot(_ctx.$slots, "default");
  30460. }
  30461. var collection_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(collection_item_vue_vue_type_script_lang_default, [["render", _sfc_render$14]]);
  30462. //#endregion
  30463. //#region ../../packages/components/collection/src/collection.ts
  30464. const COLLECTION_ITEM_SIGN = `data-el-collection-item`;
  30465. const createCollectionWithScope = (name) => {
  30466. const COLLECTION_NAME = `El${name}Collection`;
  30467. const COLLECTION_ITEM_NAME = `${COLLECTION_NAME}Item`;
  30468. const COLLECTION_INJECTION_KEY = Symbol(COLLECTION_NAME);
  30469. const COLLECTION_ITEM_INJECTION_KEY = Symbol(COLLECTION_ITEM_NAME);
  30470. return {
  30471. COLLECTION_INJECTION_KEY,
  30472. COLLECTION_ITEM_INJECTION_KEY,
  30473. ElCollection: Object.assign({}, collection_default, {
  30474. name: COLLECTION_NAME,
  30475. setup() {
  30476. const collectionRef = ref();
  30477. const itemMap = /* @__PURE__ */ new Map();
  30478. const getItems = (() => {
  30479. const collectionEl = unref(collectionRef);
  30480. if (!collectionEl) return [];
  30481. const orderedNodes = Array.from(collectionEl.querySelectorAll(`[${COLLECTION_ITEM_SIGN}]`));
  30482. return [...itemMap.values()].sort((a, b) => orderedNodes.indexOf(a.ref) - orderedNodes.indexOf(b.ref));
  30483. });
  30484. provide(COLLECTION_INJECTION_KEY, {
  30485. itemMap,
  30486. getItems,
  30487. collectionRef
  30488. });
  30489. }
  30490. }),
  30491. ElCollectionItem: Object.assign({}, collection_item_default, {
  30492. name: COLLECTION_ITEM_NAME,
  30493. setup(_, { attrs }) {
  30494. const collectionItemRef = ref();
  30495. const collectionInjection = inject(COLLECTION_INJECTION_KEY, void 0);
  30496. provide(COLLECTION_ITEM_INJECTION_KEY, { collectionItemRef });
  30497. onMounted(() => {
  30498. const collectionItemEl = unref(collectionItemRef);
  30499. if (collectionItemEl) collectionInjection.itemMap.set(collectionItemEl, {
  30500. ref: collectionItemEl,
  30501. ...attrs
  30502. });
  30503. });
  30504. onBeforeUnmount(() => {
  30505. const collectionItemEl = unref(collectionItemRef);
  30506. collectionInjection.itemMap.delete(collectionItemEl);
  30507. });
  30508. }
  30509. })
  30510. };
  30511. };
  30512. //#endregion
  30513. //#region ../../packages/components/roving-focus-group/src/roving-focus-group.ts
  30514. const rovingFocusGroupProps = buildProps({
  30515. style: {
  30516. type: definePropType([
  30517. String,
  30518. Array,
  30519. Object,
  30520. Boolean
  30521. ]),
  30522. default: void 0
  30523. },
  30524. currentTabId: { type: definePropType(String) },
  30525. defaultCurrentTabId: String,
  30526. loop: Boolean,
  30527. dir: {
  30528. type: String,
  30529. values: ["ltr", "rtl"],
  30530. default: "ltr"
  30531. },
  30532. orientation: { type: definePropType(String) },
  30533. onBlur: Function,
  30534. onFocus: Function,
  30535. onMousedown: Function
  30536. });
  30537. const { ElCollection, ElCollectionItem, COLLECTION_INJECTION_KEY, COLLECTION_ITEM_INJECTION_KEY } = createCollectionWithScope("RovingFocusGroup");
  30538. //#endregion
  30539. //#region ../../packages/components/roving-focus-group/src/tokens.ts
  30540. const ROVING_FOCUS_GROUP_INJECTION_KEY = Symbol("elRovingFocusGroup");
  30541. const ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY = Symbol("elRovingFocusGroupItem");
  30542. //#endregion
  30543. //#region ../../packages/components/roving-focus-group/src/utils.ts
  30544. const MAP_KEY_TO_FOCUS_INTENT = {
  30545. ArrowLeft: "prev",
  30546. ArrowUp: "prev",
  30547. ArrowRight: "next",
  30548. ArrowDown: "next",
  30549. PageUp: "first",
  30550. Home: "first",
  30551. PageDown: "last",
  30552. End: "last"
  30553. };
  30554. const getDirectionAwareKey = (key, dir) => {
  30555. if (dir !== "rtl") return key;
  30556. switch (key) {
  30557. case EVENT_CODE.right: return EVENT_CODE.left;
  30558. case EVENT_CODE.left: return EVENT_CODE.right;
  30559. default: return key;
  30560. }
  30561. };
  30562. const getFocusIntent = (event, orientation, dir) => {
  30563. const key = getDirectionAwareKey(getEventCode(event), dir);
  30564. if (orientation === "vertical" && [EVENT_CODE.left, EVENT_CODE.right].includes(key)) return void 0;
  30565. if (orientation === "horizontal" && [EVENT_CODE.up, EVENT_CODE.down].includes(key)) return void 0;
  30566. return MAP_KEY_TO_FOCUS_INTENT[key];
  30567. };
  30568. const reorderArray = (array, atIdx) => {
  30569. return array.map((_, idx) => array[(idx + atIdx) % array.length]);
  30570. };
  30571. const focusFirst = (elements) => {
  30572. const { activeElement: prevActive } = document;
  30573. for (const element of elements) {
  30574. if (element === prevActive) return;
  30575. element.focus();
  30576. if (prevActive !== document.activeElement) return;
  30577. }
  30578. };
  30579. //#endregion
  30580. //#region ../../packages/components/roving-focus-group/src/roving-focus-group-impl.vue?vue&type=script&lang.ts
  30581. const CURRENT_TAB_ID_CHANGE_EVT = "currentTabIdChange";
  30582. const ENTRY_FOCUS_EVT = "rovingFocusGroup.entryFocus";
  30583. const EVT_OPTS = {
  30584. bubbles: false,
  30585. cancelable: true
  30586. };
  30587. var roving_focus_group_impl_vue_vue_type_script_lang_default = defineComponent({
  30588. name: "ElRovingFocusGroupImpl",
  30589. inheritAttrs: false,
  30590. props: rovingFocusGroupProps,
  30591. emits: [CURRENT_TAB_ID_CHANGE_EVT, "entryFocus"],
  30592. setup(props, { emit }) {
  30593. const currentTabbedId = ref((props.currentTabId || props.defaultCurrentTabId) ?? null);
  30594. const isBackingOut = ref(false);
  30595. const isClickFocus = ref(false);
  30596. const rovingFocusGroupRef = ref();
  30597. const { getItems } = inject(COLLECTION_INJECTION_KEY, void 0);
  30598. const rovingFocusGroupRootStyle = computed(() => {
  30599. return [{ outline: "none" }, props.style];
  30600. });
  30601. const onItemFocus = (tabbedId) => {
  30602. emit(CURRENT_TAB_ID_CHANGE_EVT, tabbedId);
  30603. };
  30604. const onItemShiftTab = () => {
  30605. isBackingOut.value = true;
  30606. };
  30607. const onMousedown = composeEventHandlers((e) => {
  30608. props.onMousedown?.(e);
  30609. }, () => {
  30610. isClickFocus.value = true;
  30611. });
  30612. const onFocus = composeEventHandlers((e) => {
  30613. props.onFocus?.(e);
  30614. }, (e) => {
  30615. const isKeyboardFocus = !unref(isClickFocus);
  30616. const { target, currentTarget } = e;
  30617. if (target === currentTarget && isKeyboardFocus && !unref(isBackingOut)) {
  30618. const entryFocusEvt = new Event(ENTRY_FOCUS_EVT, EVT_OPTS);
  30619. currentTarget?.dispatchEvent(entryFocusEvt);
  30620. if (!entryFocusEvt.defaultPrevented) {
  30621. const items = getItems().filter((item) => item.focusable);
  30622. focusFirst([
  30623. items.find((item) => item.active),
  30624. items.find((item) => item.id === unref(currentTabbedId)),
  30625. ...items
  30626. ].filter(Boolean).map((item) => item.ref));
  30627. }
  30628. }
  30629. isClickFocus.value = false;
  30630. });
  30631. const onBlur = composeEventHandlers((e) => {
  30632. props.onBlur?.(e);
  30633. }, () => {
  30634. isBackingOut.value = false;
  30635. });
  30636. const handleEntryFocus = (...args) => {
  30637. emit("entryFocus", ...args);
  30638. };
  30639. const onKeydown = (e) => {
  30640. const focusIntent = getFocusIntent(e);
  30641. if (focusIntent) {
  30642. e.preventDefault();
  30643. let elements = getItems().filter((item) => item.focusable).map((item) => item.ref);
  30644. switch (focusIntent) {
  30645. case "last":
  30646. elements.reverse();
  30647. break;
  30648. case "prev":
  30649. case "next": {
  30650. if (focusIntent === "prev") elements.reverse();
  30651. const currentIdx = elements.indexOf(e.currentTarget);
  30652. elements = props.loop ? reorderArray(elements, currentIdx + 1) : elements.slice(currentIdx + 1);
  30653. break;
  30654. }
  30655. default: break;
  30656. }
  30657. nextTick(() => {
  30658. focusFirst(elements);
  30659. });
  30660. }
  30661. };
  30662. provide(ROVING_FOCUS_GROUP_INJECTION_KEY, {
  30663. currentTabbedId: readonly(currentTabbedId),
  30664. loop: toRef(props, "loop"),
  30665. tabIndex: computed(() => {
  30666. return unref(isBackingOut) ? -1 : 0;
  30667. }),
  30668. rovingFocusGroupRef,
  30669. rovingFocusGroupRootStyle,
  30670. orientation: toRef(props, "orientation"),
  30671. dir: toRef(props, "dir"),
  30672. onItemFocus,
  30673. onItemShiftTab,
  30674. onBlur,
  30675. onFocus,
  30676. onMousedown,
  30677. onKeydown
  30678. });
  30679. watch(() => props.currentTabId, (val) => {
  30680. currentTabbedId.value = val ?? null;
  30681. });
  30682. useEventListener(rovingFocusGroupRef, ENTRY_FOCUS_EVT, handleEntryFocus);
  30683. }
  30684. });
  30685. //#endregion
  30686. //#region ../../packages/components/roving-focus-group/src/roving-focus-group-impl.vue
  30687. function _sfc_render$13(_ctx, _cache, $props, $setup, $data, $options) {
  30688. return renderSlot(_ctx.$slots, "default");
  30689. }
  30690. var roving_focus_group_impl_default = /* @__PURE__ */ _plugin_vue_export_helper_default(roving_focus_group_impl_vue_vue_type_script_lang_default, [["render", _sfc_render$13]]);
  30691. //#endregion
  30692. //#region ../../packages/components/roving-focus-group/src/roving-focus-group.vue?vue&type=script&lang.ts
  30693. var roving_focus_group_vue_vue_type_script_lang_default = defineComponent({
  30694. name: "ElRovingFocusGroup",
  30695. components: {
  30696. ElFocusGroupCollection: ElCollection,
  30697. ElRovingFocusGroupImpl: roving_focus_group_impl_default
  30698. }
  30699. });
  30700. //#endregion
  30701. //#region ../../packages/components/roving-focus-group/src/roving-focus-group.vue
  30702. function _sfc_render$12(_ctx, _cache, $props, $setup, $data, $options) {
  30703. const _component_el_roving_focus_group_impl = resolveComponent("el-roving-focus-group-impl");
  30704. const _component_el_focus_group_collection = resolveComponent("el-focus-group-collection");
  30705. return openBlock(), createBlock(_component_el_focus_group_collection, null, {
  30706. default: withCtx(() => [createVNode(_component_el_roving_focus_group_impl, normalizeProps(guardReactiveProps(_ctx.$attrs)), {
  30707. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  30708. _: 3
  30709. }, 16)]),
  30710. _: 3
  30711. });
  30712. }
  30713. var roving_focus_group_default$1 = /* @__PURE__ */ _plugin_vue_export_helper_default(roving_focus_group_vue_vue_type_script_lang_default, [["render", _sfc_render$12]]);
  30714. //#endregion
  30715. //#region ../../packages/components/roving-focus-group/src/roving-focus-item.vue?vue&type=script&lang.ts
  30716. var roving_focus_item_vue_vue_type_script_lang_default = defineComponent({
  30717. components: { ElRovingFocusCollectionItem: ElCollectionItem },
  30718. props: {
  30719. focusable: {
  30720. type: Boolean,
  30721. default: true
  30722. },
  30723. active: Boolean
  30724. },
  30725. emits: [
  30726. "mousedown",
  30727. "focus",
  30728. "keydown"
  30729. ],
  30730. setup(props, { emit }) {
  30731. const { currentTabbedId, onItemFocus, onItemShiftTab, onKeydown } = inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  30732. const id = useId();
  30733. const rovingFocusGroupItemRef = ref();
  30734. const handleMousedown = composeEventHandlers((e) => {
  30735. emit("mousedown", e);
  30736. }, (e) => {
  30737. if (!props.focusable) e.preventDefault();
  30738. else onItemFocus(unref(id));
  30739. });
  30740. const handleFocus = composeEventHandlers((e) => {
  30741. emit("focus", e);
  30742. }, () => {
  30743. onItemFocus(unref(id));
  30744. });
  30745. const handleKeydown = composeEventHandlers((e) => {
  30746. emit("keydown", e);
  30747. }, (e) => {
  30748. const { shiftKey, target, currentTarget } = e;
  30749. if (getEventCode(e) === EVENT_CODE.tab && shiftKey) {
  30750. onItemShiftTab();
  30751. return;
  30752. }
  30753. if (target !== currentTarget) return;
  30754. onKeydown(e);
  30755. });
  30756. const isCurrentTab = computed(() => currentTabbedId.value === unref(id));
  30757. provide(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, {
  30758. rovingFocusGroupItemRef,
  30759. tabIndex: computed(() => unref(isCurrentTab) ? 0 : -1),
  30760. handleMousedown,
  30761. handleFocus,
  30762. handleKeydown
  30763. });
  30764. return {
  30765. id,
  30766. handleKeydown,
  30767. handleFocus,
  30768. handleMousedown
  30769. };
  30770. }
  30771. });
  30772. //#endregion
  30773. //#region ../../packages/components/roving-focus-group/src/roving-focus-item.vue
  30774. function _sfc_render$11(_ctx, _cache, $props, $setup, $data, $options) {
  30775. const _component_el_roving_focus_collection_item = resolveComponent("el-roving-focus-collection-item");
  30776. return openBlock(), createBlock(_component_el_roving_focus_collection_item, {
  30777. id: _ctx.id,
  30778. focusable: _ctx.focusable,
  30779. active: _ctx.active
  30780. }, {
  30781. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  30782. _: 3
  30783. }, 8, [
  30784. "id",
  30785. "focusable",
  30786. "active"
  30787. ]);
  30788. }
  30789. var roving_focus_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(roving_focus_item_vue_vue_type_script_lang_default, [["render", _sfc_render$11]]);
  30790. //#endregion
  30791. //#region ../../packages/components/roving-focus-group/index.ts
  30792. var roving_focus_group_default = roving_focus_group_default$1;
  30793. //#endregion
  30794. //#region ../../packages/components/dropdown/src/dropdown.ts
  30795. const dropdownProps = buildProps({
  30796. trigger: {
  30797. ...useTooltipTriggerProps.trigger,
  30798. type: definePropType([String, Array])
  30799. },
  30800. triggerKeys: {
  30801. type: definePropType(Array),
  30802. default: () => [
  30803. EVENT_CODE.enter,
  30804. EVENT_CODE.numpadEnter,
  30805. EVENT_CODE.space,
  30806. EVENT_CODE.down
  30807. ]
  30808. },
  30809. virtualTriggering: useTooltipTriggerProps.virtualTriggering,
  30810. virtualRef: useTooltipTriggerProps.virtualRef,
  30811. effect: {
  30812. ...useTooltipContentProps.effect,
  30813. default: "light"
  30814. },
  30815. type: { type: definePropType(String) },
  30816. placement: {
  30817. type: definePropType(String),
  30818. default: "bottom"
  30819. },
  30820. popperOptions: {
  30821. type: definePropType(Object),
  30822. default: () => ({})
  30823. },
  30824. id: String,
  30825. size: {
  30826. type: String,
  30827. default: ""
  30828. },
  30829. splitButton: Boolean,
  30830. hideOnClick: {
  30831. type: Boolean,
  30832. default: true
  30833. },
  30834. loop: {
  30835. type: Boolean,
  30836. default: true
  30837. },
  30838. showArrow: {
  30839. type: Boolean,
  30840. default: true
  30841. },
  30842. showTimeout: {
  30843. type: Number,
  30844. default: 150
  30845. },
  30846. hideTimeout: {
  30847. type: Number,
  30848. default: 150
  30849. },
  30850. tabindex: {
  30851. type: definePropType([Number, String]),
  30852. default: 0
  30853. },
  30854. maxHeight: {
  30855. type: definePropType([Number, String]),
  30856. default: ""
  30857. },
  30858. popperClass: useTooltipContentProps.popperClass,
  30859. popperStyle: useTooltipContentProps.popperStyle,
  30860. disabled: Boolean,
  30861. role: {
  30862. type: String,
  30863. values: roleTypes,
  30864. default: "menu"
  30865. },
  30866. buttonProps: { type: definePropType(Object) },
  30867. teleported: useTooltipContentProps.teleported,
  30868. appendTo: useTooltipContentProps.appendTo,
  30869. persistent: {
  30870. type: Boolean,
  30871. default: true
  30872. }
  30873. });
  30874. const dropdownItemProps = buildProps({
  30875. command: {
  30876. type: [
  30877. Object,
  30878. String,
  30879. Number
  30880. ],
  30881. default: () => ({})
  30882. },
  30883. disabled: Boolean,
  30884. divided: Boolean,
  30885. textValue: String,
  30886. icon: { type: iconPropType }
  30887. });
  30888. const dropdownMenuProps = buildProps({ onKeydown: { type: definePropType(Function) } });
  30889. const FIRST_KEYS = [
  30890. EVENT_CODE.down,
  30891. EVENT_CODE.pageDown,
  30892. EVENT_CODE.home
  30893. ];
  30894. const LAST_KEYS = [
  30895. EVENT_CODE.up,
  30896. EVENT_CODE.pageUp,
  30897. EVENT_CODE.end
  30898. ];
  30899. const FIRST_LAST_KEYS = [...FIRST_KEYS, ...LAST_KEYS];
  30900. //#endregion
  30901. //#region ../../packages/components/dropdown/src/tokens.ts
  30902. const DROPDOWN_INJECTION_KEY = Symbol("elDropdown");
  30903. const DROPDOWN_INSTANCE_INJECTION_KEY = "elDropdown";
  30904. //#endregion
  30905. //#region ../../packages/components/dropdown/src/dropdown.vue?vue&type=script&lang.ts
  30906. const { ButtonGroup: ElButtonGroup$1 } = ElButton;
  30907. var dropdown_vue_vue_type_script_lang_default = defineComponent({
  30908. name: "ElDropdown",
  30909. components: {
  30910. ElButton,
  30911. ElButtonGroup: ElButtonGroup$1,
  30912. ElScrollbar,
  30913. ElTooltip,
  30914. ElRovingFocusGroup: roving_focus_group_default,
  30915. ElOnlyChild: OnlyChild,
  30916. ElIcon,
  30917. ArrowDown: arrow_down_default
  30918. },
  30919. props: dropdownProps,
  30920. emits: [
  30921. "visible-change",
  30922. "click",
  30923. "command"
  30924. ],
  30925. setup(props, { emit }) {
  30926. const _instance = getCurrentInstance();
  30927. const ns = useNamespace("dropdown");
  30928. const { t } = useLocale();
  30929. const triggeringElementRef = ref();
  30930. const referenceElementRef = ref();
  30931. const popperRef = ref();
  30932. const contentRef = ref();
  30933. const scrollbar = ref(null);
  30934. const currentTabId = ref(null);
  30935. const isUsingKeyboard = ref(false);
  30936. const wrapStyle = computed(() => ({ maxHeight: addUnit(props.maxHeight) }));
  30937. const dropdownTriggerKls = computed(() => [ns.m(dropdownSize.value)]);
  30938. const trigger = computed(() => castArray$1(props.trigger));
  30939. const defaultTriggerId = useId().value;
  30940. const triggerId = computed(() => props.id || defaultTriggerId);
  30941. function handleClick() {
  30942. popperRef.value?.onClose(void 0, 0);
  30943. }
  30944. function handleClose() {
  30945. popperRef.value?.onClose();
  30946. }
  30947. function handleOpen() {
  30948. popperRef.value?.onOpen();
  30949. }
  30950. const dropdownSize = useFormSize();
  30951. function commandHandler(...args) {
  30952. emit("command", ...args);
  30953. }
  30954. function onItemEnter() {}
  30955. function onItemLeave() {
  30956. const contentEl = unref(contentRef);
  30957. trigger.value.includes("hover") && contentEl?.focus({ preventScroll: true });
  30958. currentTabId.value = null;
  30959. }
  30960. function handleCurrentTabIdChange(id) {
  30961. currentTabId.value = id;
  30962. }
  30963. function handleBeforeShowTooltip() {
  30964. emit("visible-change", true);
  30965. }
  30966. function handleShowTooltip(event) {
  30967. isUsingKeyboard.value = event?.type === "keydown";
  30968. contentRef.value?.focus();
  30969. }
  30970. function handleBeforeHideTooltip() {
  30971. emit("visible-change", false);
  30972. }
  30973. provide(DROPDOWN_INJECTION_KEY, {
  30974. contentRef,
  30975. role: computed(() => props.role),
  30976. triggerId,
  30977. isUsingKeyboard,
  30978. onItemEnter,
  30979. onItemLeave,
  30980. handleClose
  30981. });
  30982. provide(DROPDOWN_INSTANCE_INJECTION_KEY, {
  30983. instance: _instance,
  30984. dropdownSize,
  30985. handleClick,
  30986. commandHandler,
  30987. trigger: toRef(props, "trigger"),
  30988. hideOnClick: toRef(props, "hideOnClick")
  30989. });
  30990. const handlerMainButtonClick = (event) => {
  30991. emit("click", event);
  30992. };
  30993. return {
  30994. t,
  30995. ns,
  30996. scrollbar,
  30997. wrapStyle,
  30998. dropdownTriggerKls,
  30999. dropdownSize,
  31000. triggerId,
  31001. currentTabId,
  31002. handleCurrentTabIdChange,
  31003. handlerMainButtonClick,
  31004. handleClose,
  31005. handleOpen,
  31006. handleBeforeShowTooltip,
  31007. handleShowTooltip,
  31008. handleBeforeHideTooltip,
  31009. popperRef,
  31010. contentRef,
  31011. triggeringElementRef,
  31012. referenceElementRef
  31013. };
  31014. }
  31015. });
  31016. //#endregion
  31017. //#region ../../packages/components/dropdown/src/dropdown.vue
  31018. function _sfc_render$10(_ctx, _cache, $props, $setup, $data, $options) {
  31019. const _component_el_roving_focus_group = resolveComponent("el-roving-focus-group");
  31020. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  31021. const _component_el_only_child = resolveComponent("el-only-child");
  31022. const _component_el_tooltip = resolveComponent("el-tooltip");
  31023. const _component_el_button = resolveComponent("el-button");
  31024. const _component_arrow_down = resolveComponent("arrow-down");
  31025. const _component_el_icon = resolveComponent("el-icon");
  31026. const _component_el_button_group = resolveComponent("el-button-group");
  31027. return openBlock(), createElementBlock("div", { class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("disabled", _ctx.disabled)]) }, [createVNode(_component_el_tooltip, {
  31028. ref: "popperRef",
  31029. role: _ctx.role,
  31030. effect: _ctx.effect,
  31031. "fallback-placements": ["bottom", "top"],
  31032. "popper-options": _ctx.popperOptions,
  31033. "gpu-acceleration": false,
  31034. placement: _ctx.placement,
  31035. "popper-class": [_ctx.ns.e("popper"), _ctx.popperClass],
  31036. "popper-style": _ctx.popperStyle,
  31037. trigger: _ctx.trigger,
  31038. "trigger-keys": _ctx.triggerKeys,
  31039. "trigger-target-el": _ctx.contentRef,
  31040. "show-arrow": _ctx.showArrow,
  31041. "show-after": _ctx.trigger === "hover" ? _ctx.showTimeout : 0,
  31042. "hide-after": _ctx.trigger === "hover" ? _ctx.hideTimeout : 0,
  31043. "virtual-ref": _ctx.virtualRef ?? _ctx.triggeringElementRef,
  31044. "virtual-triggering": _ctx.virtualTriggering || _ctx.splitButton,
  31045. disabled: _ctx.disabled,
  31046. transition: `${_ctx.ns.namespace.value}-zoom-in-top`,
  31047. teleported: _ctx.teleported,
  31048. "append-to": _ctx.appendTo,
  31049. pure: "",
  31050. "focus-on-target": "",
  31051. persistent: _ctx.persistent,
  31052. onBeforeShow: _ctx.handleBeforeShowTooltip,
  31053. onShow: _ctx.handleShowTooltip,
  31054. onBeforeHide: _ctx.handleBeforeHideTooltip
  31055. }, createSlots({
  31056. content: withCtx(() => [createVNode(_component_el_scrollbar, {
  31057. ref: "scrollbar",
  31058. "wrap-style": _ctx.wrapStyle,
  31059. tag: "div",
  31060. "view-class": _ctx.ns.e("list")
  31061. }, {
  31062. default: withCtx(() => [createVNode(_component_el_roving_focus_group, {
  31063. loop: _ctx.loop,
  31064. "current-tab-id": _ctx.currentTabId,
  31065. orientation: "horizontal",
  31066. onCurrentTabIdChange: _ctx.handleCurrentTabIdChange
  31067. }, {
  31068. default: withCtx(() => [renderSlot(_ctx.$slots, "dropdown")]),
  31069. _: 3
  31070. }, 8, [
  31071. "loop",
  31072. "current-tab-id",
  31073. "onCurrentTabIdChange"
  31074. ])]),
  31075. _: 3
  31076. }, 8, ["wrap-style", "view-class"])]),
  31077. _: 2
  31078. }, [!_ctx.splitButton ? {
  31079. name: "default",
  31080. fn: withCtx(() => [createVNode(_component_el_only_child, {
  31081. id: _ctx.triggerId,
  31082. ref: "triggeringElementRef",
  31083. role: "button",
  31084. tabindex: _ctx.tabindex
  31085. }, {
  31086. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  31087. _: 3
  31088. }, 8, ["id", "tabindex"])]),
  31089. key: "0"
  31090. } : void 0]), 1032, [
  31091. "role",
  31092. "effect",
  31093. "popper-options",
  31094. "placement",
  31095. "popper-class",
  31096. "popper-style",
  31097. "trigger",
  31098. "trigger-keys",
  31099. "trigger-target-el",
  31100. "show-arrow",
  31101. "show-after",
  31102. "hide-after",
  31103. "virtual-ref",
  31104. "virtual-triggering",
  31105. "disabled",
  31106. "transition",
  31107. "teleported",
  31108. "append-to",
  31109. "persistent",
  31110. "onBeforeShow",
  31111. "onShow",
  31112. "onBeforeHide"
  31113. ]), _ctx.splitButton ? (openBlock(), createBlock(_component_el_button_group, { key: 0 }, {
  31114. default: withCtx(() => [createVNode(_component_el_button, mergeProps({ ref: "referenceElementRef" }, _ctx.buttonProps, {
  31115. size: _ctx.dropdownSize,
  31116. type: _ctx.type,
  31117. disabled: _ctx.disabled,
  31118. tabindex: _ctx.tabindex,
  31119. onClick: _ctx.handlerMainButtonClick
  31120. }), {
  31121. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  31122. _: 3
  31123. }, 16, [
  31124. "size",
  31125. "type",
  31126. "disabled",
  31127. "tabindex",
  31128. "onClick"
  31129. ]), createVNode(_component_el_button, mergeProps({
  31130. id: _ctx.triggerId,
  31131. ref: "triggeringElementRef"
  31132. }, _ctx.buttonProps, {
  31133. role: "button",
  31134. size: _ctx.dropdownSize,
  31135. type: _ctx.type,
  31136. class: _ctx.ns.e("caret-button"),
  31137. disabled: _ctx.disabled,
  31138. tabindex: _ctx.tabindex,
  31139. "aria-label": _ctx.t("el.dropdown.toggleDropdown")
  31140. }), {
  31141. default: withCtx(() => [createVNode(_component_el_icon, { class: normalizeClass(_ctx.ns.e("icon")) }, {
  31142. default: withCtx(() => [createVNode(_component_arrow_down)]),
  31143. _: 1
  31144. }, 8, ["class"])]),
  31145. _: 1
  31146. }, 16, [
  31147. "id",
  31148. "size",
  31149. "type",
  31150. "class",
  31151. "disabled",
  31152. "tabindex",
  31153. "aria-label"
  31154. ])]),
  31155. _: 3
  31156. })) : createCommentVNode("v-if", true)], 2);
  31157. }
  31158. var dropdown_default = /* @__PURE__ */ _plugin_vue_export_helper_default(dropdown_vue_vue_type_script_lang_default, [["render", _sfc_render$10]]);
  31159. //#endregion
  31160. //#region ../../packages/components/dropdown/src/dropdown-item-impl.vue?vue&type=script&lang.ts
  31161. var dropdown_item_impl_vue_vue_type_script_lang_default = defineComponent({
  31162. name: "DropdownItemImpl",
  31163. components: { ElIcon },
  31164. props: dropdownItemProps,
  31165. emits: [
  31166. "pointermove",
  31167. "pointerleave",
  31168. "click",
  31169. "clickimpl"
  31170. ],
  31171. setup(_, { emit }) {
  31172. const ns = useNamespace("dropdown");
  31173. const { role: menuRole } = inject(DROPDOWN_INJECTION_KEY, void 0);
  31174. const { collectionItemRef: rovingFocusCollectionItemRef } = inject(COLLECTION_ITEM_INJECTION_KEY, void 0);
  31175. const { rovingFocusGroupItemRef, tabIndex, handleFocus, handleKeydown: handleItemKeydown, handleMousedown } = inject(ROVING_FOCUS_GROUP_ITEM_INJECTION_KEY, void 0);
  31176. const itemRef = composeRefs(rovingFocusCollectionItemRef, rovingFocusGroupItemRef);
  31177. const role = computed(() => {
  31178. if (menuRole.value === "menu") return "menuitem";
  31179. else if (menuRole.value === "navigation") return "link";
  31180. return "button";
  31181. });
  31182. const handleKeydown = composeEventHandlers((e) => {
  31183. const code = getEventCode(e);
  31184. if ([
  31185. EVENT_CODE.enter,
  31186. EVENT_CODE.numpadEnter,
  31187. EVENT_CODE.space
  31188. ].includes(code)) {
  31189. e.preventDefault();
  31190. e.stopImmediatePropagation();
  31191. emit("clickimpl", e);
  31192. return true;
  31193. }
  31194. }, handleItemKeydown);
  31195. return {
  31196. ns,
  31197. itemRef,
  31198. dataset: { [COLLECTION_ITEM_SIGN]: "" },
  31199. role,
  31200. tabIndex,
  31201. handleFocus,
  31202. handleKeydown,
  31203. handleMousedown
  31204. };
  31205. }
  31206. });
  31207. //#endregion
  31208. //#region ../../packages/components/dropdown/src/dropdown-item-impl.vue
  31209. const _hoisted_1$40 = [
  31210. "aria-disabled",
  31211. "tabindex",
  31212. "role"
  31213. ];
  31214. function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
  31215. const _component_el_icon = resolveComponent("el-icon");
  31216. return openBlock(), createElementBlock(Fragment, null, [_ctx.divided ? (openBlock(), createElementBlock("li", {
  31217. key: 0,
  31218. role: "separator",
  31219. class: normalizeClass(_ctx.ns.bem("menu", "item", "divided"))
  31220. }, null, 2)) : createCommentVNode("v-if", true), createElementVNode("li", mergeProps({ ref: _ctx.itemRef }, {
  31221. ..._ctx.dataset,
  31222. ..._ctx.$attrs
  31223. }, {
  31224. "aria-disabled": _ctx.disabled,
  31225. class: [_ctx.ns.be("menu", "item"), _ctx.ns.is("disabled", _ctx.disabled)],
  31226. tabindex: _ctx.tabIndex,
  31227. role: _ctx.role,
  31228. onClick: _cache[0] || (_cache[0] = (e) => _ctx.$emit("clickimpl", e)),
  31229. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  31230. onKeydown: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args), ["self"])),
  31231. onMousedown: _cache[3] || (_cache[3] = (...args) => _ctx.handleMousedown && _ctx.handleMousedown(...args)),
  31232. onPointermove: _cache[4] || (_cache[4] = (e) => _ctx.$emit("pointermove", e)),
  31233. onPointerleave: _cache[5] || (_cache[5] = (e) => _ctx.$emit("pointerleave", e))
  31234. }), [_ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
  31235. default: withCtx(() => [renderSlot(_ctx.$slots, "icon", {}, () => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.icon)))])]),
  31236. _: 3
  31237. })) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$40)], 64);
  31238. }
  31239. var dropdown_item_impl_default = /* @__PURE__ */ _plugin_vue_export_helper_default(dropdown_item_impl_vue_vue_type_script_lang_default, [["render", _sfc_render$9]]);
  31240. //#endregion
  31241. //#region ../../packages/components/dropdown/src/useDropdown.ts
  31242. const useDropdown = () => {
  31243. const elDropdown = inject(DROPDOWN_INSTANCE_INJECTION_KEY, {});
  31244. return {
  31245. elDropdown,
  31246. _elDropdownSize: computed(() => elDropdown?.dropdownSize)
  31247. };
  31248. };
  31249. //#endregion
  31250. //#region ../../packages/components/dropdown/src/dropdown-item.vue?vue&type=script&lang.ts
  31251. var dropdown_item_vue_vue_type_script_lang_default = defineComponent({
  31252. name: "ElDropdownItem",
  31253. components: {
  31254. ElRovingFocusItem: roving_focus_item_default,
  31255. ElDropdownItemImpl: dropdown_item_impl_default
  31256. },
  31257. inheritAttrs: false,
  31258. props: dropdownItemProps,
  31259. emits: [
  31260. "pointermove",
  31261. "pointerleave",
  31262. "click"
  31263. ],
  31264. setup(props, { emit, attrs }) {
  31265. const { elDropdown } = useDropdown();
  31266. const _instance = getCurrentInstance();
  31267. const { onItemEnter, onItemLeave } = inject(DROPDOWN_INJECTION_KEY, void 0);
  31268. const handlePointerMove = composeEventHandlers((e) => {
  31269. emit("pointermove", e);
  31270. return e.defaultPrevented;
  31271. }, whenMouse((e) => {
  31272. if (props.disabled) {
  31273. onItemLeave(e);
  31274. return;
  31275. }
  31276. const target = e.currentTarget;
  31277. if (target === document.activeElement || target.contains(document.activeElement)) return;
  31278. onItemEnter(e);
  31279. if (!e.defaultPrevented) target?.focus({ preventScroll: true });
  31280. }));
  31281. const handlePointerLeave = composeEventHandlers((e) => {
  31282. emit("pointerleave", e);
  31283. return e.defaultPrevented;
  31284. }, whenMouse(onItemLeave));
  31285. return {
  31286. handleClick: composeEventHandlers((e) => {
  31287. if (props.disabled) return;
  31288. emit("click", e);
  31289. return e.type !== "keydown" && e.defaultPrevented;
  31290. }, (e) => {
  31291. if (props.disabled) {
  31292. e.stopImmediatePropagation();
  31293. return;
  31294. }
  31295. if (elDropdown?.hideOnClick?.value) elDropdown.handleClick?.();
  31296. elDropdown.commandHandler?.(props.command, _instance, e);
  31297. }),
  31298. handlePointerMove,
  31299. handlePointerLeave,
  31300. propsAndAttrs: computed(() => ({
  31301. ...props,
  31302. ...attrs
  31303. }))
  31304. };
  31305. }
  31306. });
  31307. //#endregion
  31308. //#region ../../packages/components/dropdown/src/dropdown-item.vue
  31309. function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
  31310. const _component_el_dropdown_item_impl = resolveComponent("el-dropdown-item-impl");
  31311. const _component_el_roving_focus_item = resolveComponent("el-roving-focus-item");
  31312. return openBlock(), createBlock(_component_el_roving_focus_item, { focusable: !_ctx.disabled }, {
  31313. default: withCtx(() => [createVNode(_component_el_dropdown_item_impl, mergeProps(_ctx.propsAndAttrs, {
  31314. onPointerleave: _ctx.handlePointerLeave,
  31315. onPointermove: _ctx.handlePointerMove,
  31316. onClickimpl: _ctx.handleClick
  31317. }), createSlots({
  31318. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  31319. _: 2
  31320. }, [_ctx.$slots.icon ? {
  31321. name: "icon",
  31322. fn: withCtx(() => [renderSlot(_ctx.$slots, "icon")]),
  31323. key: "0"
  31324. } : void 0]), 1040, [
  31325. "onPointerleave",
  31326. "onPointermove",
  31327. "onClickimpl"
  31328. ])]),
  31329. _: 3
  31330. }, 8, ["focusable"]);
  31331. }
  31332. var dropdown_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(dropdown_item_vue_vue_type_script_lang_default, [["render", _sfc_render$8]]);
  31333. //#endregion
  31334. //#region ../../packages/components/dropdown/src/dropdown-menu.vue?vue&type=script&lang.ts
  31335. var dropdown_menu_vue_vue_type_script_lang_default = defineComponent({
  31336. name: "ElDropdownMenu",
  31337. props: dropdownMenuProps,
  31338. setup(props) {
  31339. const ns = useNamespace("dropdown");
  31340. const { _elDropdownSize } = useDropdown();
  31341. const size = _elDropdownSize.value;
  31342. const { contentRef, role, triggerId, isUsingKeyboard, handleClose } = inject(DROPDOWN_INJECTION_KEY, void 0);
  31343. const { rovingFocusGroupRef, rovingFocusGroupRootStyle, onBlur, onFocus, onKeydown, onMousedown } = inject(ROVING_FOCUS_GROUP_INJECTION_KEY, void 0);
  31344. const { collectionRef: rovingFocusGroupCollectionRef } = inject(COLLECTION_INJECTION_KEY, void 0);
  31345. const dropdownKls = computed(() => {
  31346. return [ns.b("menu"), ns.bm("menu", size?.value)];
  31347. });
  31348. const dropdownListWrapperRef = composeRefs(contentRef, rovingFocusGroupRef, rovingFocusGroupCollectionRef);
  31349. const handleKeydown = composeEventHandlers((e) => {
  31350. props.onKeydown?.(e);
  31351. }, (e) => {
  31352. const { currentTarget, target } = e;
  31353. const code = getEventCode(e);
  31354. if (currentTarget.contains(target)) {}
  31355. if (EVENT_CODE.tab === code) return handleClose();
  31356. onKeydown(e);
  31357. });
  31358. function handleFocus(e) {
  31359. isUsingKeyboard.value && onFocus(e);
  31360. }
  31361. return {
  31362. size,
  31363. rovingFocusGroupRootStyle,
  31364. dropdownKls,
  31365. role,
  31366. triggerId,
  31367. dropdownListWrapperRef,
  31368. handleKeydown,
  31369. onBlur,
  31370. handleFocus,
  31371. onMousedown
  31372. };
  31373. }
  31374. });
  31375. //#endregion
  31376. //#region ../../packages/components/dropdown/src/dropdown-menu.vue
  31377. const _hoisted_1$39 = ["role", "aria-labelledby"];
  31378. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  31379. return openBlock(), createElementBlock("ul", {
  31380. ref: _ctx.dropdownListWrapperRef,
  31381. class: normalizeClass(_ctx.dropdownKls),
  31382. style: normalizeStyle(_ctx.rovingFocusGroupRootStyle),
  31383. tabindex: -1,
  31384. role: _ctx.role,
  31385. "aria-labelledby": _ctx.triggerId,
  31386. onFocusin: _cache[0] || (_cache[0] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  31387. onFocusout: _cache[1] || (_cache[1] = (...args) => _ctx.onBlur && _ctx.onBlur(...args)),
  31388. onKeydown: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args), ["self"])),
  31389. onMousedown: _cache[3] || (_cache[3] = withModifiers((...args) => _ctx.onMousedown && _ctx.onMousedown(...args), ["self"]))
  31390. }, [renderSlot(_ctx.$slots, "default")], 46, _hoisted_1$39);
  31391. }
  31392. var dropdown_menu_default = /* @__PURE__ */ _plugin_vue_export_helper_default(dropdown_menu_vue_vue_type_script_lang_default, [["render", _sfc_render$7]]);
  31393. //#endregion
  31394. //#region ../../packages/components/dropdown/index.ts
  31395. const ElDropdown = withInstall(dropdown_default, {
  31396. DropdownItem: dropdown_item_default,
  31397. DropdownMenu: dropdown_menu_default
  31398. });
  31399. const ElDropdownItem = withNoopInstall(dropdown_item_default);
  31400. const ElDropdownMenu = withNoopInstall(dropdown_menu_default);
  31401. //#endregion
  31402. //#region ../../packages/components/empty/src/empty.ts
  31403. const emptyProps = buildProps({
  31404. image: {
  31405. type: String,
  31406. default: ""
  31407. },
  31408. imageSize: Number,
  31409. description: {
  31410. type: String,
  31411. default: ""
  31412. }
  31413. });
  31414. //#endregion
  31415. //#region ../../packages/components/empty/src/img-empty.vue?vue&type=script&setup=true&lang.ts
  31416. const _hoisted_1$38 = {
  31417. viewBox: "0 0 79 86",
  31418. version: "1.1",
  31419. xmlns: "http://www.w3.org/2000/svg",
  31420. "xmlns:xlink": "http://www.w3.org/1999/xlink"
  31421. };
  31422. const _hoisted_2$24 = ["id"];
  31423. const _hoisted_3$8 = ["stop-color"];
  31424. const _hoisted_4$6 = ["stop-color"];
  31425. const _hoisted_5$4 = ["id"];
  31426. const _hoisted_6$1 = ["stop-color"];
  31427. const _hoisted_7 = ["stop-color"];
  31428. const _hoisted_8 = ["id"];
  31429. const _hoisted_9 = {
  31430. stroke: "none",
  31431. "stroke-width": "1",
  31432. fill: "none",
  31433. "fill-rule": "evenodd"
  31434. };
  31435. const _hoisted_10 = { transform: "translate(-1268.000000, -535.000000)" };
  31436. const _hoisted_11 = { transform: "translate(1268.000000, 535.000000)" };
  31437. const _hoisted_12 = ["fill"];
  31438. const _hoisted_13 = ["fill"];
  31439. const _hoisted_14 = { transform: "translate(34.500000, 31.500000) scale(-1, 1) rotate(-25.000000) translate(-34.500000, -31.500000) translate(7.000000, 10.000000)" };
  31440. const _hoisted_15 = ["fill"];
  31441. const _hoisted_16 = ["fill"];
  31442. const _hoisted_17 = ["fill"];
  31443. const _hoisted_18 = ["fill"];
  31444. const _hoisted_19 = ["fill"];
  31445. const _hoisted_20 = { transform: "translate(53.000000, 45.000000)" };
  31446. const _hoisted_21 = ["fill", "xlink:href"];
  31447. const _hoisted_22 = ["fill", "mask"];
  31448. const _hoisted_23 = ["fill"];
  31449. var img_empty_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  31450. name: "ImgEmpty",
  31451. __name: "img-empty",
  31452. setup(__props) {
  31453. const ns = useNamespace("empty");
  31454. const id = useId();
  31455. return (_ctx, _cache) => {
  31456. return openBlock(), createElementBlock("svg", _hoisted_1$38, [createElementVNode("defs", null, [
  31457. createElementVNode("linearGradient", {
  31458. id: `linearGradient-1-${unref(id)}`,
  31459. x1: "38.8503086%",
  31460. y1: "0%",
  31461. x2: "61.1496914%",
  31462. y2: "100%"
  31463. }, [createElementVNode("stop", {
  31464. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-1")})`,
  31465. offset: "0%"
  31466. }, null, 8, _hoisted_3$8), createElementVNode("stop", {
  31467. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-4")})`,
  31468. offset: "100%"
  31469. }, null, 8, _hoisted_4$6)], 8, _hoisted_2$24),
  31470. createElementVNode("linearGradient", {
  31471. id: `linearGradient-2-${unref(id)}`,
  31472. x1: "0%",
  31473. y1: "9.5%",
  31474. x2: "100%",
  31475. y2: "90.5%"
  31476. }, [createElementVNode("stop", {
  31477. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-1")})`,
  31478. offset: "0%"
  31479. }, null, 8, _hoisted_6$1), createElementVNode("stop", {
  31480. "stop-color": `var(${unref(ns).cssVarBlockName("fill-color-6")})`,
  31481. offset: "100%"
  31482. }, null, 8, _hoisted_7)], 8, _hoisted_5$4),
  31483. createElementVNode("rect", {
  31484. id: `path-3-${unref(id)}`,
  31485. x: "0",
  31486. y: "0",
  31487. width: "17",
  31488. height: "36"
  31489. }, null, 8, _hoisted_8)
  31490. ]), createElementVNode("g", _hoisted_9, [createElementVNode("g", _hoisted_10, [createElementVNode("g", _hoisted_11, [
  31491. createElementVNode("path", {
  31492. 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",
  31493. fill: `var(${unref(ns).cssVarBlockName("fill-color-3")})`
  31494. }, null, 8, _hoisted_12),
  31495. createElementVNode("polygon", {
  31496. fill: `var(${unref(ns).cssVarBlockName("fill-color-7")})`,
  31497. transform: "translate(27.500000, 51.500000) scale(1, -1) translate(-27.500000, -51.500000) ",
  31498. points: "13 58 53 58 42 45 2 45"
  31499. }, null, 8, _hoisted_13),
  31500. createElementVNode("g", _hoisted_14, [
  31501. createElementVNode("polygon", {
  31502. fill: `var(${unref(ns).cssVarBlockName("fill-color-7")})`,
  31503. transform: "translate(11.500000, 5.000000) scale(1, -1) translate(-11.500000, -5.000000) ",
  31504. points: "2.84078316e-14 3 18 3 23 7 5 7"
  31505. }, null, 8, _hoisted_15),
  31506. createElementVNode("polygon", {
  31507. fill: `var(${unref(ns).cssVarBlockName("fill-color-5")})`,
  31508. points: "-3.69149156e-15 7 38 7 38 43 -3.69149156e-15 43"
  31509. }, null, 8, _hoisted_16),
  31510. createElementVNode("rect", {
  31511. fill: `url(#linearGradient-1-${unref(id)})`,
  31512. transform: "translate(46.500000, 25.000000) scale(-1, 1) translate(-46.500000, -25.000000) ",
  31513. x: "38",
  31514. y: "7",
  31515. width: "17",
  31516. height: "36"
  31517. }, null, 8, _hoisted_17),
  31518. createElementVNode("polygon", {
  31519. fill: `var(${unref(ns).cssVarBlockName("fill-color-2")})`,
  31520. transform: "translate(39.500000, 3.500000) scale(-1, 1) translate(-39.500000, -3.500000) ",
  31521. points: "24 7 41 7 55 -3.63806207e-12 38 -3.63806207e-12"
  31522. }, null, 8, _hoisted_18)
  31523. ]),
  31524. createElementVNode("rect", {
  31525. fill: `url(#linearGradient-2-${unref(id)})`,
  31526. x: "13",
  31527. y: "45",
  31528. width: "40",
  31529. height: "36"
  31530. }, null, 8, _hoisted_19),
  31531. createElementVNode("g", _hoisted_20, [createElementVNode("use", {
  31532. fill: `var(${unref(ns).cssVarBlockName("fill-color-8")})`,
  31533. transform: "translate(8.500000, 18.000000) scale(-1, 1) translate(-8.500000, -18.000000) ",
  31534. "xlink:href": `#path-3-${unref(id)}`
  31535. }, null, 8, _hoisted_21), createElementVNode("polygon", {
  31536. fill: `var(${unref(ns).cssVarBlockName("fill-color-9")})`,
  31537. mask: `url(#mask-4-${unref(id)})`,
  31538. transform: "translate(12.000000, 9.000000) scale(-1, 1) translate(-12.000000, -9.000000) ",
  31539. points: "7 0 24 0 20 18 7 16.5"
  31540. }, null, 8, _hoisted_22)]),
  31541. createElementVNode("polygon", {
  31542. fill: `var(${unref(ns).cssVarBlockName("fill-color-2")})`,
  31543. transform: "translate(66.000000, 51.500000) scale(-1, 1) translate(-66.000000, -51.500000) ",
  31544. points: "62 45 79 45 70 58 53 58"
  31545. }, null, 8, _hoisted_23)
  31546. ])])])]);
  31547. };
  31548. }
  31549. });
  31550. //#endregion
  31551. //#region ../../packages/components/empty/src/img-empty.vue
  31552. var img_empty_default = img_empty_vue_vue_type_script_setup_true_lang_default;
  31553. //#endregion
  31554. //#region ../../packages/components/empty/src/empty.vue?vue&type=script&setup=true&lang.ts
  31555. const _hoisted_1$37 = ["src"];
  31556. const _hoisted_2$23 = { key: 1 };
  31557. var empty_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  31558. name: "ElEmpty",
  31559. __name: "empty",
  31560. props: emptyProps,
  31561. setup(__props) {
  31562. const props = __props;
  31563. const { t } = useLocale();
  31564. const ns = useNamespace("empty");
  31565. const emptyDescription = computed(() => props.description || t("el.table.emptyText"));
  31566. const imageStyle = computed(() => ({ width: addUnit(props.imageSize) }));
  31567. return (_ctx, _cache) => {
  31568. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b()) }, [
  31569. createElementVNode("div", {
  31570. class: normalizeClass(unref(ns).e("image")),
  31571. style: normalizeStyle(imageStyle.value)
  31572. }, [__props.image ? (openBlock(), createElementBlock("img", {
  31573. key: 0,
  31574. src: __props.image,
  31575. ondragstart: "return false"
  31576. }, null, 8, _hoisted_1$37)) : renderSlot(_ctx.$slots, "image", { key: 1 }, () => [createVNode(img_empty_default)])], 6),
  31577. createElementVNode("div", { class: normalizeClass(unref(ns).e("description")) }, [_ctx.$slots.description ? renderSlot(_ctx.$slots, "description", { key: 0 }) : (openBlock(), createElementBlock("p", _hoisted_2$23, toDisplayString(emptyDescription.value), 1))], 2),
  31578. _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
  31579. key: 0,
  31580. class: normalizeClass(unref(ns).e("bottom"))
  31581. }, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("v-if", true)
  31582. ], 2);
  31583. };
  31584. }
  31585. });
  31586. //#endregion
  31587. //#region ../../packages/components/empty/src/empty.vue
  31588. var empty_default = empty_vue_vue_type_script_setup_true_lang_default;
  31589. //#endregion
  31590. //#region ../../packages/components/empty/index.ts
  31591. const ElEmpty = withInstall(empty_default);
  31592. //#endregion
  31593. //#region ../../packages/components/image/src/image.ts
  31594. const imageProps = buildProps({
  31595. hideOnClickModal: Boolean,
  31596. src: {
  31597. type: String,
  31598. default: ""
  31599. },
  31600. fit: {
  31601. type: String,
  31602. values: [
  31603. "",
  31604. "contain",
  31605. "cover",
  31606. "fill",
  31607. "none",
  31608. "scale-down"
  31609. ],
  31610. default: ""
  31611. },
  31612. loading: {
  31613. type: String,
  31614. values: ["eager", "lazy"]
  31615. },
  31616. lazy: Boolean,
  31617. scrollContainer: { type: definePropType([String, Object]) },
  31618. previewSrcList: {
  31619. type: definePropType(Array),
  31620. default: () => mutable([])
  31621. },
  31622. previewTeleported: Boolean,
  31623. zIndex: { type: Number },
  31624. initialIndex: {
  31625. type: Number,
  31626. default: 0
  31627. },
  31628. infinite: {
  31629. type: Boolean,
  31630. default: true
  31631. },
  31632. closeOnPressEscape: {
  31633. type: Boolean,
  31634. default: true
  31635. },
  31636. zoomRate: {
  31637. type: Number,
  31638. default: 1.2
  31639. },
  31640. scale: {
  31641. type: Number,
  31642. default: 1
  31643. },
  31644. minScale: {
  31645. type: Number,
  31646. default: .2
  31647. },
  31648. maxScale: {
  31649. type: Number,
  31650. default: 7
  31651. },
  31652. showProgress: Boolean,
  31653. crossorigin: { type: definePropType(String) }
  31654. });
  31655. const imageEmits = {
  31656. load: (evt) => evt instanceof Event,
  31657. error: (evt) => evt instanceof Event,
  31658. switch: (val) => isNumber(val),
  31659. close: () => true,
  31660. show: () => true
  31661. };
  31662. //#endregion
  31663. //#region ../../packages/components/image-viewer/src/image-viewer.ts
  31664. const imageViewerProps = buildProps({
  31665. urlList: {
  31666. type: definePropType(Array),
  31667. default: () => mutable([])
  31668. },
  31669. zIndex: { type: Number },
  31670. initialIndex: {
  31671. type: Number,
  31672. default: 0
  31673. },
  31674. infinite: {
  31675. type: Boolean,
  31676. default: true
  31677. },
  31678. hideOnClickModal: Boolean,
  31679. teleported: Boolean,
  31680. closeOnPressEscape: {
  31681. type: Boolean,
  31682. default: true
  31683. },
  31684. zoomRate: {
  31685. type: Number,
  31686. default: 1.2
  31687. },
  31688. scale: {
  31689. type: Number,
  31690. default: 1
  31691. },
  31692. minScale: {
  31693. type: Number,
  31694. default: .2
  31695. },
  31696. maxScale: {
  31697. type: Number,
  31698. default: 7
  31699. },
  31700. showProgress: Boolean,
  31701. crossorigin: { type: definePropType(String) }
  31702. });
  31703. const imageViewerEmits = {
  31704. close: () => true,
  31705. error: (evt) => evt instanceof Event,
  31706. switch: (index) => isNumber(index),
  31707. rotate: (deg) => isNumber(deg)
  31708. };
  31709. //#endregion
  31710. //#region ../../packages/components/image-viewer/src/image-viewer.vue?vue&type=script&setup=true&lang.ts
  31711. const _hoisted_1$36 = ["src", "crossorigin"];
  31712. var image_viewer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  31713. name: "ElImageViewer",
  31714. __name: "image-viewer",
  31715. props: imageViewerProps,
  31716. emits: imageViewerEmits,
  31717. setup(__props, { expose: __expose, emit: __emit }) {
  31718. const modes = {
  31719. CONTAIN: {
  31720. name: "contain",
  31721. icon: markRaw(full_screen_default)
  31722. },
  31723. ORIGINAL: {
  31724. name: "original",
  31725. icon: markRaw(scale_to_original_default)
  31726. }
  31727. };
  31728. const props = __props;
  31729. const emit = __emit;
  31730. let stopWheelListener;
  31731. const { t } = useLocale();
  31732. const ns = useNamespace("image-viewer");
  31733. const { nextZIndex } = useZIndex();
  31734. const wrapper = ref();
  31735. const imgRef = ref();
  31736. const scopeEventListener = effectScope();
  31737. const scaleClamped = computed(() => {
  31738. const { scale, minScale, maxScale } = props;
  31739. return clamp$2(scale, minScale, maxScale);
  31740. });
  31741. const loading = ref(true);
  31742. const loadError = ref(false);
  31743. const visible = ref(false);
  31744. const activeIndex = ref(props.initialIndex);
  31745. const mode = shallowRef(modes.CONTAIN);
  31746. const transform = ref({
  31747. scale: scaleClamped.value,
  31748. deg: 0,
  31749. offsetX: 0,
  31750. offsetY: 0,
  31751. enableTransition: false
  31752. });
  31753. const zIndex = ref(props.zIndex ?? nextZIndex());
  31754. useLockscreen(visible, { ns });
  31755. const isSingle = computed(() => {
  31756. const { urlList } = props;
  31757. return urlList.length <= 1;
  31758. });
  31759. const isFirst = computed(() => activeIndex.value === 0);
  31760. const isLast = computed(() => activeIndex.value === props.urlList.length - 1);
  31761. const currentImg = computed(() => props.urlList[activeIndex.value]);
  31762. const arrowPrevKls = computed(() => [
  31763. ns.e("btn"),
  31764. ns.e("prev"),
  31765. ns.is("disabled", !props.infinite && isFirst.value)
  31766. ]);
  31767. const arrowNextKls = computed(() => [
  31768. ns.e("btn"),
  31769. ns.e("next"),
  31770. ns.is("disabled", !props.infinite && isLast.value)
  31771. ]);
  31772. const imgStyle = computed(() => {
  31773. const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
  31774. let translateX = offsetX / scale;
  31775. let translateY = offsetY / scale;
  31776. const radian = deg * Math.PI / 180;
  31777. const cosRadian = Math.cos(radian);
  31778. const sinRadian = Math.sin(radian);
  31779. translateX = translateX * cosRadian + translateY * sinRadian;
  31780. translateY = translateY * cosRadian - offsetX / scale * sinRadian;
  31781. const style = {
  31782. transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
  31783. transition: enableTransition ? "transform .3s" : ""
  31784. };
  31785. if (mode.value.name === modes.CONTAIN.name) style.maxWidth = style.maxHeight = "100%";
  31786. return style;
  31787. });
  31788. const progress = computed(() => `${activeIndex.value + 1} / ${props.urlList.length}`);
  31789. function hide() {
  31790. unregisterEventListener();
  31791. stopWheelListener?.();
  31792. visible.value = false;
  31793. emit("close");
  31794. }
  31795. function registerEventListener() {
  31796. const keydownHandler = throttle((e) => {
  31797. switch (getEventCode(e)) {
  31798. case EVENT_CODE.esc:
  31799. props.closeOnPressEscape && hide();
  31800. break;
  31801. case EVENT_CODE.space:
  31802. toggleMode();
  31803. break;
  31804. case EVENT_CODE.left:
  31805. prev();
  31806. break;
  31807. case EVENT_CODE.up:
  31808. handleActions("zoomIn");
  31809. break;
  31810. case EVENT_CODE.right:
  31811. next();
  31812. break;
  31813. case EVENT_CODE.down:
  31814. handleActions("zoomOut");
  31815. break;
  31816. }
  31817. });
  31818. const mousewheelHandler = throttle((e) => {
  31819. handleActions((e.deltaY || e.deltaX) < 0 ? "zoomIn" : "zoomOut", {
  31820. zoomRate: props.zoomRate,
  31821. enableTransition: false
  31822. });
  31823. });
  31824. scopeEventListener.run(() => {
  31825. useEventListener(document, "keydown", keydownHandler);
  31826. useEventListener(wrapper, "wheel", mousewheelHandler);
  31827. });
  31828. }
  31829. function unregisterEventListener() {
  31830. scopeEventListener.stop();
  31831. }
  31832. function handleImgLoad() {
  31833. loading.value = false;
  31834. }
  31835. function handleImgError(e) {
  31836. loadError.value = true;
  31837. loading.value = false;
  31838. emit("error", e);
  31839. e.target.alt = t("el.image.error");
  31840. }
  31841. function handleMouseDown(e) {
  31842. if (loading.value || e.button !== 0 || !wrapper.value) return;
  31843. transform.value.enableTransition = false;
  31844. const { offsetX, offsetY } = transform.value;
  31845. const startX = e.pageX;
  31846. const startY = e.pageY;
  31847. const dragHandler = throttle((ev) => {
  31848. transform.value = {
  31849. ...transform.value,
  31850. offsetX: offsetX + ev.pageX - startX,
  31851. offsetY: offsetY + ev.pageY - startY
  31852. };
  31853. });
  31854. const removeMousemove = useEventListener(document, "mousemove", dragHandler);
  31855. const removeMouseup = useEventListener(document, "mouseup", () => {
  31856. removeMousemove();
  31857. removeMouseup();
  31858. });
  31859. e.preventDefault();
  31860. }
  31861. function handleTouchStart(e) {
  31862. if (loading.value || !wrapper.value || e.touches.length !== 1) return;
  31863. transform.value.enableTransition = false;
  31864. const { offsetX, offsetY } = transform.value;
  31865. const { pageX: startX, pageY: startY } = e.touches[0];
  31866. const dragHandler = throttle((ev) => {
  31867. const targetTouch = ev.touches[0];
  31868. transform.value = {
  31869. ...transform.value,
  31870. offsetX: offsetX + targetTouch.pageX - startX,
  31871. offsetY: offsetY + targetTouch.pageY - startY
  31872. };
  31873. });
  31874. const removeTouchmove = useEventListener(document, "touchmove", dragHandler);
  31875. const removeTouchend = useEventListener(document, "touchend", () => {
  31876. removeTouchmove();
  31877. removeTouchend();
  31878. });
  31879. e.preventDefault();
  31880. }
  31881. function reset() {
  31882. transform.value = {
  31883. scale: scaleClamped.value,
  31884. deg: 0,
  31885. offsetX: 0,
  31886. offsetY: 0,
  31887. enableTransition: false
  31888. };
  31889. }
  31890. function toggleMode() {
  31891. if (loading.value || loadError.value) return;
  31892. const modeNames = keysOf(modes);
  31893. const modeValues = Object.values(modes);
  31894. const currentMode = mode.value.name;
  31895. mode.value = modes[modeNames[(modeValues.findIndex((i) => i.name === currentMode) + 1) % modeNames.length]];
  31896. reset();
  31897. }
  31898. function setActiveItem(index) {
  31899. loadError.value = false;
  31900. const len = props.urlList.length;
  31901. activeIndex.value = (index + len) % len;
  31902. }
  31903. function prev() {
  31904. if (isFirst.value && !props.infinite) return;
  31905. setActiveItem(activeIndex.value - 1);
  31906. }
  31907. function next() {
  31908. if (isLast.value && !props.infinite) return;
  31909. setActiveItem(activeIndex.value + 1);
  31910. }
  31911. function handleActions(action, options = {}) {
  31912. if (loading.value || loadError.value) return;
  31913. const { minScale, maxScale } = props;
  31914. const { zoomRate, rotateDeg, enableTransition } = {
  31915. zoomRate: props.zoomRate,
  31916. rotateDeg: 90,
  31917. enableTransition: true,
  31918. ...options
  31919. };
  31920. switch (action) {
  31921. case "zoomOut":
  31922. if (transform.value.scale > minScale) transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
  31923. break;
  31924. case "zoomIn":
  31925. if (transform.value.scale < maxScale) transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
  31926. break;
  31927. case "clockwise":
  31928. transform.value.deg += rotateDeg;
  31929. emit("rotate", transform.value.deg);
  31930. break;
  31931. case "anticlockwise":
  31932. transform.value.deg -= rotateDeg;
  31933. emit("rotate", transform.value.deg);
  31934. break;
  31935. }
  31936. transform.value.enableTransition = enableTransition;
  31937. }
  31938. function onFocusoutPrevented(event) {
  31939. if (event.detail?.focusReason === "pointer") event.preventDefault();
  31940. }
  31941. function onCloseRequested() {
  31942. if (props.closeOnPressEscape) hide();
  31943. }
  31944. function wheelHandler(e) {
  31945. if (!e.ctrlKey) return;
  31946. if (e.deltaY < 0) {
  31947. e.preventDefault();
  31948. return false;
  31949. } else if (e.deltaY > 0) {
  31950. e.preventDefault();
  31951. return false;
  31952. }
  31953. }
  31954. watch(() => scaleClamped.value, (val) => {
  31955. transform.value.scale = val;
  31956. });
  31957. watch(currentImg, () => {
  31958. nextTick(() => {
  31959. if (!imgRef.value?.complete) loading.value = true;
  31960. });
  31961. });
  31962. watch(activeIndex, (val) => {
  31963. reset();
  31964. emit("switch", val);
  31965. });
  31966. onMounted(() => {
  31967. visible.value = true;
  31968. registerEventListener();
  31969. stopWheelListener = useEventListener("wheel", wheelHandler, { passive: false });
  31970. });
  31971. __expose({ setActiveItem });
  31972. return (_ctx, _cache) => {
  31973. return openBlock(), createBlock(Teleport, {
  31974. to: "body",
  31975. disabled: !__props.teleported
  31976. }, [createVNode(Transition, {
  31977. name: "viewer-fade",
  31978. appear: ""
  31979. }, {
  31980. default: withCtx(() => [createElementVNode("div", {
  31981. ref_key: "wrapper",
  31982. ref: wrapper,
  31983. tabindex: -1,
  31984. class: normalizeClass(unref(ns).e("wrapper")),
  31985. style: normalizeStyle({ zIndex: zIndex.value })
  31986. }, [createVNode(unref(focus_trap_default), {
  31987. loop: "",
  31988. trapped: "",
  31989. "focus-trap-el": wrapper.value,
  31990. "focus-start-el": "container",
  31991. onFocusoutPrevented,
  31992. onReleaseRequested: onCloseRequested
  31993. }, {
  31994. default: withCtx(() => [
  31995. createElementVNode("div", {
  31996. class: normalizeClass(unref(ns).e("mask")),
  31997. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => __props.hideOnClickModal && hide(), ["self"]))
  31998. }, null, 2),
  31999. createCommentVNode(" CLOSE "),
  32000. createElementVNode("span", {
  32001. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
  32002. onClick: hide
  32003. }, [createVNode(unref(ElIcon), null, {
  32004. default: withCtx(() => [createVNode(unref(close_default))]),
  32005. _: 1
  32006. })], 2),
  32007. createCommentVNode(" ARROW "),
  32008. !isSingle.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", {
  32009. class: normalizeClass(arrowPrevKls.value),
  32010. onClick: prev
  32011. }, [createVNode(unref(ElIcon), null, {
  32012. default: withCtx(() => [createVNode(unref(arrow_left_default))]),
  32013. _: 1
  32014. })], 2), createElementVNode("span", {
  32015. class: normalizeClass(arrowNextKls.value),
  32016. onClick: next
  32017. }, [createVNode(unref(ElIcon), null, {
  32018. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  32019. _: 1
  32020. })], 2)], 64)) : createCommentVNode("v-if", true),
  32021. _ctx.$slots.progress || __props.showProgress ? (openBlock(), createElementBlock("div", {
  32022. key: 1,
  32023. class: normalizeClass([unref(ns).e("btn"), unref(ns).e("progress")])
  32024. }, [renderSlot(_ctx.$slots, "progress", {
  32025. activeIndex: activeIndex.value,
  32026. total: __props.urlList.length
  32027. }, () => [createTextVNode(toDisplayString(progress.value), 1)])], 2)) : createCommentVNode("v-if", true),
  32028. createCommentVNode(" ACTIONS "),
  32029. createElementVNode("div", { class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")]) }, [createElementVNode("div", { class: normalizeClass(unref(ns).e("actions__inner")) }, [renderSlot(_ctx.$slots, "toolbar", {
  32030. actions: handleActions,
  32031. prev,
  32032. next,
  32033. reset: toggleMode,
  32034. activeIndex: activeIndex.value,
  32035. setActiveItem
  32036. }, () => [
  32037. createVNode(unref(ElIcon), { onClick: _cache[1] || (_cache[1] = ($event) => handleActions("zoomOut")) }, {
  32038. default: withCtx(() => [createVNode(unref(zoom_out_default))]),
  32039. _: 1
  32040. }),
  32041. createVNode(unref(ElIcon), { onClick: _cache[2] || (_cache[2] = ($event) => handleActions("zoomIn")) }, {
  32042. default: withCtx(() => [createVNode(unref(zoom_in_default))]),
  32043. _: 1
  32044. }),
  32045. createElementVNode("i", { class: normalizeClass(unref(ns).e("actions__divider")) }, null, 2),
  32046. createVNode(unref(ElIcon), { onClick: toggleMode }, {
  32047. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(mode.value.icon)))]),
  32048. _: 1
  32049. }),
  32050. createElementVNode("i", { class: normalizeClass(unref(ns).e("actions__divider")) }, null, 2),
  32051. createVNode(unref(ElIcon), { onClick: _cache[3] || (_cache[3] = ($event) => handleActions("anticlockwise")) }, {
  32052. default: withCtx(() => [createVNode(unref(refresh_left_default))]),
  32053. _: 1
  32054. }),
  32055. createVNode(unref(ElIcon), { onClick: _cache[4] || (_cache[4] = ($event) => handleActions("clockwise")) }, {
  32056. default: withCtx(() => [createVNode(unref(refresh_right_default))]),
  32057. _: 1
  32058. })
  32059. ])], 2)], 2),
  32060. createCommentVNode(" CANVAS "),
  32061. createElementVNode("div", { class: normalizeClass(unref(ns).e("canvas")) }, [loadError.value && _ctx.$slots["viewer-error"] ? renderSlot(_ctx.$slots, "viewer-error", {
  32062. key: 0,
  32063. activeIndex: activeIndex.value,
  32064. src: currentImg.value
  32065. }) : (openBlock(), createElementBlock("img", {
  32066. ref_key: "imgRef",
  32067. ref: imgRef,
  32068. key: currentImg.value,
  32069. src: currentImg.value,
  32070. style: normalizeStyle(imgStyle.value),
  32071. class: normalizeClass(unref(ns).e("img")),
  32072. crossorigin: __props.crossorigin,
  32073. onLoad: handleImgLoad,
  32074. onError: handleImgError,
  32075. onMousedown: handleMouseDown,
  32076. onTouchstart: handleTouchStart
  32077. }, null, 46, _hoisted_1$36))], 2),
  32078. renderSlot(_ctx.$slots, "default")
  32079. ]),
  32080. _: 3
  32081. }, 8, ["focus-trap-el"])], 6)]),
  32082. _: 3
  32083. })], 8, ["disabled"]);
  32084. };
  32085. }
  32086. });
  32087. //#endregion
  32088. //#region ../../packages/components/image-viewer/src/image-viewer.vue
  32089. var image_viewer_default = image_viewer_vue_vue_type_script_setup_true_lang_default;
  32090. //#endregion
  32091. //#region ../../packages/components/image-viewer/index.ts
  32092. const ElImageViewer = withInstall(image_viewer_default);
  32093. //#endregion
  32094. //#region ../../packages/components/image/src/image.vue?vue&type=script&setup=true&lang.ts
  32095. const _hoisted_1$35 = [
  32096. "src",
  32097. "loading",
  32098. "crossorigin"
  32099. ];
  32100. const _hoisted_2$22 = { key: 0 };
  32101. var image_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  32102. name: "ElImage",
  32103. inheritAttrs: false,
  32104. __name: "image",
  32105. props: imageProps,
  32106. emits: imageEmits,
  32107. setup(__props, { expose: __expose, emit: __emit }) {
  32108. const props = __props;
  32109. const emit = __emit;
  32110. const { t } = useLocale();
  32111. const ns = useNamespace("image");
  32112. const rawAttrs = useAttrs$1();
  32113. const containerAttrs = computed(() => {
  32114. return fromPairs(Object.entries(rawAttrs).filter(([key]) => /^(data-|on[A-Z])/i.test(key) || ["id", "style"].includes(key)));
  32115. });
  32116. const imgAttrs = useAttrs({
  32117. excludeListeners: true,
  32118. excludeKeys: computed(() => {
  32119. return Object.keys(containerAttrs.value);
  32120. })
  32121. });
  32122. const imageSrc = ref();
  32123. const hasLoadError = ref(false);
  32124. const isLoading = ref(true);
  32125. const showViewer = ref(false);
  32126. const container = ref();
  32127. const _scrollContainer = ref();
  32128. const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
  32129. let stopScrollListener;
  32130. const imageKls = computed(() => [
  32131. ns.e("inner"),
  32132. preview.value && ns.e("preview"),
  32133. isLoading.value && ns.is("loading")
  32134. ]);
  32135. const imageStyle = computed(() => {
  32136. const { fit } = props;
  32137. if (isClient && fit) return { objectFit: fit };
  32138. return {};
  32139. });
  32140. const preview = computed(() => {
  32141. const { previewSrcList } = props;
  32142. return isArray$1(previewSrcList) && previewSrcList.length > 0;
  32143. });
  32144. const imageIndex = computed(() => {
  32145. const { previewSrcList, initialIndex } = props;
  32146. let previewIndex = initialIndex;
  32147. if (initialIndex > previewSrcList.length - 1) previewIndex = 0;
  32148. return previewIndex;
  32149. });
  32150. const isManual = computed(() => {
  32151. if (props.loading === "eager") return false;
  32152. return !supportLoading && props.loading === "lazy" || props.lazy;
  32153. });
  32154. const loadImage = () => {
  32155. if (!isClient) return;
  32156. isLoading.value = true;
  32157. hasLoadError.value = false;
  32158. imageSrc.value = props.src;
  32159. };
  32160. function handleLoad(event) {
  32161. isLoading.value = false;
  32162. hasLoadError.value = false;
  32163. emit("load", event);
  32164. }
  32165. function handleError(event) {
  32166. isLoading.value = false;
  32167. hasLoadError.value = true;
  32168. emit("error", event);
  32169. }
  32170. function handleLazyLoad(isIntersecting) {
  32171. if (isIntersecting) {
  32172. loadImage();
  32173. removeLazyLoadListener();
  32174. }
  32175. }
  32176. const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200, true);
  32177. async function addLazyLoadListener() {
  32178. if (!isClient) return;
  32179. await nextTick();
  32180. const { scrollContainer } = props;
  32181. if (isElement$1(scrollContainer)) _scrollContainer.value = scrollContainer;
  32182. else if (isString(scrollContainer) && scrollContainer !== "") _scrollContainer.value = document.querySelector(scrollContainer) ?? void 0;
  32183. else if (container.value) {
  32184. const scrollContainer = getScrollContainer(container.value);
  32185. _scrollContainer.value = isWindow(scrollContainer) ? void 0 : scrollContainer;
  32186. }
  32187. const { stop } = useIntersectionObserver(container, ([entry]) => {
  32188. lazyLoadHandler(entry.isIntersecting);
  32189. }, { root: _scrollContainer });
  32190. stopScrollListener = stop;
  32191. }
  32192. function removeLazyLoadListener() {
  32193. if (!isClient || !lazyLoadHandler) return;
  32194. stopScrollListener?.();
  32195. _scrollContainer.value = void 0;
  32196. stopScrollListener = void 0;
  32197. }
  32198. function clickHandler() {
  32199. if (!preview.value) return;
  32200. showViewer.value = true;
  32201. emit("show");
  32202. }
  32203. function closeViewer() {
  32204. showViewer.value = false;
  32205. emit("close");
  32206. }
  32207. function switchViewer(val) {
  32208. emit("switch", val);
  32209. }
  32210. watch(() => props.src, () => {
  32211. if (isManual.value) {
  32212. isLoading.value = true;
  32213. hasLoadError.value = false;
  32214. removeLazyLoadListener();
  32215. addLazyLoadListener();
  32216. } else loadImage();
  32217. });
  32218. onMounted(() => {
  32219. if (isManual.value) addLazyLoadListener();
  32220. else loadImage();
  32221. });
  32222. __expose({ showPreview: clickHandler });
  32223. return (_ctx, _cache) => {
  32224. return openBlock(), createElementBlock("div", mergeProps({
  32225. ref_key: "container",
  32226. ref: container
  32227. }, containerAttrs.value, { class: [unref(ns).b(), _ctx.$attrs.class] }), [hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 0 }, () => [createElementVNode("div", { class: normalizeClass(unref(ns).e("error")) }, toDisplayString(unref(t)("el.image.error")), 3)]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [imageSrc.value !== void 0 ? (openBlock(), createElementBlock("img", mergeProps({ key: 0 }, unref(imgAttrs), {
  32228. src: imageSrc.value,
  32229. loading: __props.loading,
  32230. style: imageStyle.value,
  32231. class: imageKls.value,
  32232. crossorigin: __props.crossorigin,
  32233. onClick: clickHandler,
  32234. onLoad: handleLoad,
  32235. onError: handleError
  32236. }), null, 16, _hoisted_1$35)) : createCommentVNode("v-if", true), isLoading.value ? (openBlock(), createElementBlock("div", {
  32237. key: 1,
  32238. class: normalizeClass(unref(ns).e("wrapper"))
  32239. }, [renderSlot(_ctx.$slots, "placeholder", {}, () => [createElementVNode("div", { class: normalizeClass(unref(ns).e("placeholder")) }, null, 2)])], 2)) : createCommentVNode("v-if", true)], 64)), preview.value ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
  32240. key: 0,
  32241. "z-index": __props.zIndex,
  32242. "initial-index": imageIndex.value,
  32243. infinite: __props.infinite,
  32244. "zoom-rate": __props.zoomRate,
  32245. "min-scale": __props.minScale,
  32246. "max-scale": __props.maxScale,
  32247. "show-progress": __props.showProgress,
  32248. "url-list": __props.previewSrcList,
  32249. scale: __props.scale,
  32250. crossorigin: __props.crossorigin,
  32251. "hide-on-click-modal": __props.hideOnClickModal,
  32252. teleported: __props.previewTeleported,
  32253. "close-on-press-escape": __props.closeOnPressEscape,
  32254. onClose: closeViewer,
  32255. onSwitch: switchViewer
  32256. }, createSlots({
  32257. toolbar: withCtx((toolbar) => [renderSlot(_ctx.$slots, "toolbar", normalizeProps(guardReactiveProps(toolbar)))]),
  32258. default: withCtx(() => [_ctx.$slots.viewer ? (openBlock(), createElementBlock("div", _hoisted_2$22, [renderSlot(_ctx.$slots, "viewer")])) : createCommentVNode("v-if", true)]),
  32259. _: 2
  32260. }, [_ctx.$slots.progress ? {
  32261. name: "progress",
  32262. fn: withCtx((progress) => [renderSlot(_ctx.$slots, "progress", normalizeProps(guardReactiveProps(progress)))]),
  32263. key: "0"
  32264. } : void 0, _ctx.$slots["viewer-error"] ? {
  32265. name: "viewer-error",
  32266. fn: withCtx((viewerError) => [renderSlot(_ctx.$slots, "viewer-error", normalizeProps(guardReactiveProps(viewerError)))]),
  32267. key: "1"
  32268. } : void 0]), 1032, [
  32269. "z-index",
  32270. "initial-index",
  32271. "infinite",
  32272. "zoom-rate",
  32273. "min-scale",
  32274. "max-scale",
  32275. "show-progress",
  32276. "url-list",
  32277. "scale",
  32278. "crossorigin",
  32279. "hide-on-click-modal",
  32280. "teleported",
  32281. "close-on-press-escape"
  32282. ])) : createCommentVNode("v-if", true)], 64)) : createCommentVNode("v-if", true)], 16);
  32283. };
  32284. }
  32285. });
  32286. //#endregion
  32287. //#region ../../packages/components/image/src/image.vue
  32288. var image_default = image_vue_vue_type_script_setup_true_lang_default;
  32289. //#endregion
  32290. //#region ../../packages/components/image/index.ts
  32291. const ElImage = withInstall(image_default);
  32292. //#endregion
  32293. //#region ../../packages/components/input-number/src/input-number.ts
  32294. const inputNumberProps = buildProps({
  32295. id: {
  32296. type: String,
  32297. default: void 0
  32298. },
  32299. step: {
  32300. type: Number,
  32301. default: 1
  32302. },
  32303. stepStrictly: Boolean,
  32304. max: {
  32305. type: Number,
  32306. default: Number.MAX_SAFE_INTEGER
  32307. },
  32308. min: {
  32309. type: Number,
  32310. default: Number.MIN_SAFE_INTEGER
  32311. },
  32312. modelValue: { type: [Number, null] },
  32313. readonly: Boolean,
  32314. disabled: {
  32315. type: Boolean,
  32316. default: void 0
  32317. },
  32318. size: useSizeProp,
  32319. controls: {
  32320. type: Boolean,
  32321. default: true
  32322. },
  32323. controlsPosition: {
  32324. type: String,
  32325. default: "",
  32326. values: ["", "right"]
  32327. },
  32328. valueOnClear: {
  32329. type: definePropType([
  32330. String,
  32331. Number,
  32332. null
  32333. ]),
  32334. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  32335. default: null
  32336. },
  32337. name: String,
  32338. placeholder: String,
  32339. precision: {
  32340. type: Number,
  32341. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  32342. },
  32343. validateEvent: {
  32344. type: Boolean,
  32345. default: true
  32346. },
  32347. ...useAriaProps(["ariaLabel"]),
  32348. inputmode: {
  32349. type: definePropType(String),
  32350. default: void 0
  32351. },
  32352. align: {
  32353. type: definePropType(String),
  32354. default: "center"
  32355. },
  32356. disabledScientific: Boolean,
  32357. formatter: { type: Function },
  32358. parser: { type: Function },
  32359. tabindex: {
  32360. type: [String, Number],
  32361. default: 0
  32362. }
  32363. });
  32364. const inputNumberEmits = {
  32365. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  32366. blur: (e) => e instanceof FocusEvent,
  32367. focus: (e) => e instanceof FocusEvent,
  32368. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  32369. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  32370. };
  32371. //#endregion
  32372. //#region ../../packages/components/input-number/src/input-number.vue?vue&type=script&setup=true&lang.ts
  32373. const _hoisted_1$34 = ["aria-label"];
  32374. const _hoisted_2$21 = ["aria-label"];
  32375. var input_number_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  32376. name: "ElInputNumber",
  32377. __name: "input-number",
  32378. props: inputNumberProps,
  32379. emits: inputNumberEmits,
  32380. setup(__props, { expose: __expose, emit: __emit }) {
  32381. const props = __props;
  32382. const emit = __emit;
  32383. const { t } = useLocale();
  32384. const ns = useNamespace("input-number");
  32385. const input = ref();
  32386. const data = reactive({
  32387. currentValue: props.modelValue,
  32388. userInput: null
  32389. });
  32390. const { formItem } = useFormItem();
  32391. const minDisabled = computed(() => isNumber(props.modelValue) && props.modelValue <= props.min);
  32392. const maxDisabled = computed(() => isNumber(props.modelValue) && props.modelValue >= props.max);
  32393. const numPrecision = computed(() => {
  32394. const stepPrecision = getPrecision(props.step);
  32395. if (!isUndefined(props.precision)) {
  32396. if (stepPrecision > props.precision) /* @__PURE__ */ debugWarn("InputNumber", "precision should not be less than the decimal places of step");
  32397. return props.precision;
  32398. } else return Math.max(getPrecision(props.modelValue), stepPrecision);
  32399. });
  32400. const controlsAtRight = computed(() => {
  32401. return props.controls && props.controlsPosition === "right";
  32402. });
  32403. const inputNumberSize = useFormSize();
  32404. const inputNumberDisabled = useFormDisabled();
  32405. const displayValue = computed(() => {
  32406. if (data.userInput !== null) return data.userInput;
  32407. let currentValue = data.currentValue;
  32408. if (isNil(currentValue)) return "";
  32409. if (isNumber(currentValue)) {
  32410. if (Number.isNaN(currentValue)) return "";
  32411. if (!isUndefined(props.precision)) currentValue = currentValue.toFixed(props.precision);
  32412. }
  32413. return currentValue;
  32414. });
  32415. const toPrecision = (num, pre) => {
  32416. if (isUndefined(pre)) pre = numPrecision.value;
  32417. if (pre === 0) return Math.round(num);
  32418. let snum = String(num);
  32419. const pointPos = snum.indexOf(".");
  32420. if (pointPos === -1) return num;
  32421. if (!snum.replace(".", "").split("")[pointPos + pre]) return num;
  32422. const length = snum.length;
  32423. if (snum.charAt(length - 1) === "5") snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  32424. return Number.parseFloat(Number(snum).toFixed(pre));
  32425. };
  32426. const getPrecision = (value) => {
  32427. if (isNil(value)) return 0;
  32428. const valueString = value.toString();
  32429. const dotPosition = valueString.indexOf(".");
  32430. let precision = 0;
  32431. if (dotPosition !== -1) precision = valueString.length - dotPosition - 1;
  32432. return precision;
  32433. };
  32434. const ensurePrecision = (val, coefficient = 1) => {
  32435. if (!isNumber(val)) return data.currentValue;
  32436. if (val >= Number.MAX_SAFE_INTEGER && coefficient === 1) {
  32437. /* @__PURE__ */ debugWarn("InputNumber", "The value has reached the maximum safe integer limit.");
  32438. return val;
  32439. } else if (val <= Number.MIN_SAFE_INTEGER && coefficient === -1) {
  32440. /* @__PURE__ */ debugWarn("InputNumber", "The value has reached the minimum safe integer limit.");
  32441. return val;
  32442. }
  32443. return toPrecision(val + props.step * coefficient);
  32444. };
  32445. const handleKeydown = (event) => {
  32446. const code = getEventCode(event);
  32447. const key = getEventKey(event);
  32448. if (props.disabledScientific && ["e", "E"].includes(key)) {
  32449. event.preventDefault();
  32450. return;
  32451. }
  32452. switch (code) {
  32453. case EVENT_CODE.up:
  32454. event.preventDefault();
  32455. increase();
  32456. break;
  32457. case EVENT_CODE.down:
  32458. event.preventDefault();
  32459. decrease();
  32460. break;
  32461. }
  32462. };
  32463. const increase = () => {
  32464. if (props.readonly || inputNumberDisabled.value || maxDisabled.value) return;
  32465. setCurrentValue(ensurePrecision(Number(displayValue.value) || 0));
  32466. emit(INPUT_EVENT, data.currentValue);
  32467. setCurrentValueToModelValue();
  32468. };
  32469. const decrease = () => {
  32470. if (props.readonly || inputNumberDisabled.value || minDisabled.value) return;
  32471. setCurrentValue(ensurePrecision(Number(displayValue.value) || 0, -1));
  32472. emit(INPUT_EVENT, data.currentValue);
  32473. setCurrentValueToModelValue();
  32474. };
  32475. const verifyValue = (value, update) => {
  32476. const { max, min, step, precision, stepStrictly, valueOnClear } = props;
  32477. if (max < min) throwError("InputNumber", "min should not be greater than max.");
  32478. let newVal = !value ? Number(value) : Number.parseFloat(String(value));
  32479. if (isNil(value) || Number.isNaN(newVal)) return null;
  32480. if (value === "") {
  32481. if (valueOnClear === null) return null;
  32482. newVal = isString(valueOnClear) ? {
  32483. min,
  32484. max
  32485. }[valueOnClear] : valueOnClear;
  32486. }
  32487. if (stepStrictly) {
  32488. newVal = toPrecision(Math.round(toPrecision(newVal / step)) * step, precision);
  32489. if (newVal !== value) update && emit("update:modelValue", newVal);
  32490. }
  32491. if (!isUndefined(precision)) newVal = toPrecision(newVal, precision);
  32492. if (newVal > max || newVal < min) {
  32493. newVal = newVal > max ? max : min;
  32494. update && emit("update:modelValue", newVal);
  32495. }
  32496. return newVal;
  32497. };
  32498. const setCurrentValue = (value, emitChange = true) => {
  32499. const oldVal = data.currentValue;
  32500. const newVal = verifyValue(value);
  32501. if (!emitChange) {
  32502. emit(UPDATE_MODEL_EVENT, newVal);
  32503. return;
  32504. }
  32505. data.userInput = null;
  32506. if (oldVal === newVal && value) return;
  32507. emit(UPDATE_MODEL_EVENT, newVal);
  32508. if (oldVal !== newVal) emit(CHANGE_EVENT, newVal, oldVal);
  32509. if (props.validateEvent) formItem?.validate?.("change").catch(NOOP);
  32510. data.currentValue = newVal;
  32511. };
  32512. const handleInput = (value) => {
  32513. data.userInput = value;
  32514. let newVal = value === "" ? null : Number.parseFloat(value);
  32515. if (Number.isNaN(newVal)) newVal = null;
  32516. emit(INPUT_EVENT, newVal);
  32517. setCurrentValue(newVal, false);
  32518. };
  32519. const handleInputChange = (value) => {
  32520. const newVal = value !== "" ? Number.parseFloat(value) : "";
  32521. if (isNumber(newVal) && !Number.isNaN(newVal) || props.formatter && Number.isNaN(newVal) || newVal === "") setCurrentValue(newVal);
  32522. setCurrentValueToModelValue();
  32523. data.userInput = null;
  32524. };
  32525. const focus = () => {
  32526. input.value?.focus?.();
  32527. };
  32528. const blur = () => {
  32529. input.value?.blur?.();
  32530. };
  32531. const handleFocus = (event) => {
  32532. emit("focus", event);
  32533. };
  32534. const handleBlur = (event) => {
  32535. data.userInput = null;
  32536. if (data.currentValue === null && input.value?.input) input.value.input.value = props.formatter?.("") ?? "";
  32537. emit("blur", event);
  32538. if (props.validateEvent) formItem?.validate?.("blur").catch(NOOP);
  32539. };
  32540. const setCurrentValueToModelValue = () => {
  32541. if (data.currentValue !== props.modelValue) data.currentValue = props.modelValue;
  32542. };
  32543. const handleWheel = (e) => {
  32544. if (document.activeElement === e.target) e.preventDefault();
  32545. };
  32546. watch(() => props.modelValue, (value, oldValue) => {
  32547. const newValue = verifyValue(value, true);
  32548. if (data.userInput === null && newValue !== oldValue) data.currentValue = newValue;
  32549. }, { immediate: true });
  32550. watch(() => props.precision, () => {
  32551. data.currentValue = verifyValue(props.modelValue);
  32552. });
  32553. onMounted(() => {
  32554. const { min, max, modelValue } = props;
  32555. const innerInput = input.value?.input;
  32556. innerInput.setAttribute("role", "spinbutton");
  32557. if (Number.isFinite(max)) innerInput.setAttribute("aria-valuemax", String(max));
  32558. else innerInput.removeAttribute("aria-valuemax");
  32559. if (Number.isFinite(min)) innerInput.setAttribute("aria-valuemin", String(min));
  32560. else innerInput.removeAttribute("aria-valuemin");
  32561. innerInput.setAttribute("aria-valuenow", data.currentValue || data.currentValue === 0 ? String(data.currentValue) : "");
  32562. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  32563. if (!isNumber(modelValue) && modelValue != null) {
  32564. let val = Number(modelValue);
  32565. if (Number.isNaN(val)) val = null;
  32566. emit(UPDATE_MODEL_EVENT, val);
  32567. }
  32568. innerInput.addEventListener("wheel", handleWheel, { passive: false });
  32569. });
  32570. onUpdated(() => {
  32571. (input.value?.input)?.setAttribute("aria-valuenow", `${data.currentValue ?? ""}`);
  32572. });
  32573. __expose({
  32574. focus,
  32575. blur
  32576. });
  32577. return (_ctx, _cache) => {
  32578. return openBlock(), createElementBlock("div", {
  32579. class: normalizeClass([
  32580. unref(ns).b(),
  32581. unref(ns).m(unref(inputNumberSize)),
  32582. unref(ns).is("disabled", unref(inputNumberDisabled)),
  32583. unref(ns).is("without-controls", !__props.controls),
  32584. unref(ns).is("controls-right", controlsAtRight.value),
  32585. unref(ns).is(__props.align, !!__props.align)
  32586. ]),
  32587. onDragstart: _cache[0] || (_cache[0] = withModifiers(() => {}, ["prevent"]))
  32588. }, [
  32589. __props.controls ? withDirectives((openBlock(), createElementBlock("span", {
  32590. key: 0,
  32591. role: "button",
  32592. "aria-label": unref(t)("el.inputNumber.decrease"),
  32593. class: normalizeClass([unref(ns).e("decrease"), unref(ns).is("disabled", minDisabled.value)]),
  32594. onKeydown: withKeys(decrease, ["enter"])
  32595. }, [renderSlot(_ctx.$slots, "decrease-icon", {}, () => [createVNode(unref(ElIcon), null, {
  32596. default: withCtx(() => [controlsAtRight.value ? (openBlock(), createBlock(unref(arrow_down_default), { key: 0 })) : (openBlock(), createBlock(unref(minus_default), { key: 1 }))]),
  32597. _: 1
  32598. })])], 42, _hoisted_1$34)), [[unref(vRepeatClick), decrease]]) : createCommentVNode("v-if", true),
  32599. __props.controls ? withDirectives((openBlock(), createElementBlock("span", {
  32600. key: 1,
  32601. role: "button",
  32602. "aria-label": unref(t)("el.inputNumber.increase"),
  32603. class: normalizeClass([unref(ns).e("increase"), unref(ns).is("disabled", maxDisabled.value)]),
  32604. onKeydown: withKeys(increase, ["enter"])
  32605. }, [renderSlot(_ctx.$slots, "increase-icon", {}, () => [createVNode(unref(ElIcon), null, {
  32606. default: withCtx(() => [controlsAtRight.value ? (openBlock(), createBlock(unref(arrow_up_default), { key: 0 })) : (openBlock(), createBlock(unref(plus_default), { key: 1 }))]),
  32607. _: 1
  32608. })])], 42, _hoisted_2$21)), [[unref(vRepeatClick), increase]]) : createCommentVNode("v-if", true),
  32609. createVNode(unref(ElInput), {
  32610. id: __props.id,
  32611. ref_key: "input",
  32612. ref: input,
  32613. type: __props.formatter ? "text" : "number",
  32614. step: __props.step,
  32615. "model-value": displayValue.value,
  32616. placeholder: __props.placeholder,
  32617. readonly: __props.readonly,
  32618. disabled: unref(inputNumberDisabled),
  32619. size: unref(inputNumberSize),
  32620. max: __props.max,
  32621. min: __props.min,
  32622. name: __props.name,
  32623. "aria-label": __props.ariaLabel,
  32624. "validate-event": false,
  32625. inputmode: __props.inputmode,
  32626. formatter: __props.formatter,
  32627. parser: __props.parser,
  32628. tabindex: __props.tabindex,
  32629. onKeydown: handleKeydown,
  32630. onBlur: handleBlur,
  32631. onFocus: handleFocus,
  32632. onInput: handleInput,
  32633. onChange: handleInputChange
  32634. }, createSlots({ _: 2 }, [_ctx.$slots.prefix ? {
  32635. name: "prefix",
  32636. fn: withCtx(() => [renderSlot(_ctx.$slots, "prefix")]),
  32637. key: "0"
  32638. } : void 0, _ctx.$slots.suffix ? {
  32639. name: "suffix",
  32640. fn: withCtx(() => [renderSlot(_ctx.$slots, "suffix")]),
  32641. key: "1"
  32642. } : void 0]), 1032, [
  32643. "id",
  32644. "type",
  32645. "step",
  32646. "model-value",
  32647. "placeholder",
  32648. "readonly",
  32649. "disabled",
  32650. "size",
  32651. "max",
  32652. "min",
  32653. "name",
  32654. "aria-label",
  32655. "inputmode",
  32656. "formatter",
  32657. "parser",
  32658. "tabindex"
  32659. ])
  32660. ], 34);
  32661. };
  32662. }
  32663. });
  32664. //#endregion
  32665. //#region ../../packages/components/input-number/src/input-number.vue
  32666. var input_number_default = input_number_vue_vue_type_script_setup_true_lang_default;
  32667. //#endregion
  32668. //#region ../../packages/components/input-number/index.ts
  32669. const ElInputNumber = withInstall(input_number_default);
  32670. //#endregion
  32671. //#region ../../packages/components/input-tag/src/input-tag.ts
  32672. const inputTagProps = buildProps({
  32673. modelValue: { type: definePropType(Array) },
  32674. max: Number,
  32675. tagType: {
  32676. ...tagProps.type,
  32677. default: "info"
  32678. },
  32679. tagEffect: tagProps.effect,
  32680. effect: {
  32681. type: definePropType(String),
  32682. default: "light"
  32683. },
  32684. trigger: {
  32685. type: definePropType(String),
  32686. default: EVENT_CODE.enter
  32687. },
  32688. draggable: Boolean,
  32689. delimiter: {
  32690. type: [String, RegExp],
  32691. default: ""
  32692. },
  32693. size: useSizeProp,
  32694. clearable: Boolean,
  32695. clearIcon: {
  32696. type: iconPropType,
  32697. default: circle_close_default
  32698. },
  32699. disabled: {
  32700. type: Boolean,
  32701. default: void 0
  32702. },
  32703. validateEvent: {
  32704. type: Boolean,
  32705. default: true
  32706. },
  32707. readonly: Boolean,
  32708. autofocus: Boolean,
  32709. id: {
  32710. type: String,
  32711. default: void 0
  32712. },
  32713. tabindex: {
  32714. type: [String, Number],
  32715. default: 0
  32716. },
  32717. maxlength: { type: [String, Number] },
  32718. minlength: { type: [String, Number] },
  32719. placeholder: String,
  32720. autocomplete: {
  32721. type: definePropType(String),
  32722. default: "off"
  32723. },
  32724. saveOnBlur: {
  32725. type: Boolean,
  32726. default: true
  32727. },
  32728. collapseTags: Boolean,
  32729. collapseTagsTooltip: Boolean,
  32730. maxCollapseTags: {
  32731. type: Number,
  32732. default: 1
  32733. },
  32734. ariaLabel: String
  32735. });
  32736. const inputTagEmits = {
  32737. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  32738. [CHANGE_EVENT]: (value) => isArray$1(value) || isUndefined(value),
  32739. [INPUT_EVENT]: (value) => isString(value),
  32740. "add-tag": (value) => isString(value) || isArray$1(value),
  32741. "remove-tag": (value, index) => isString(value) && isNumber(index),
  32742. "drag-tag": (oldIndex, newIndex, value) => isNumber(oldIndex) && isNumber(newIndex) && isString(value),
  32743. focus: (evt) => evt instanceof FocusEvent,
  32744. blur: (evt) => evt instanceof FocusEvent,
  32745. clear: () => true
  32746. };
  32747. //#endregion
  32748. //#region ../../packages/components/input-tag/src/composables/use-drag-tag.ts
  32749. function useDragTag({ wrapperRef, handleDragged, afterDragged }) {
  32750. const ns = useNamespace("input-tag");
  32751. const dropIndicatorRef = shallowRef();
  32752. const showDropIndicator = ref(false);
  32753. let draggingIndex;
  32754. let draggingTag;
  32755. let dropIndex;
  32756. let dropType;
  32757. function getTagClassName(index) {
  32758. return `.${ns.e("inner")} .${ns.namespace.value}-tag:nth-child(${index + 1})`;
  32759. }
  32760. function handleDragStart(event, index) {
  32761. draggingIndex = index;
  32762. draggingTag = wrapperRef.value.querySelector(getTagClassName(index));
  32763. if (draggingTag) draggingTag.style.opacity = "0.5";
  32764. event.dataTransfer.effectAllowed = "move";
  32765. }
  32766. function handleDragOver(event, index) {
  32767. dropIndex = index;
  32768. event.preventDefault();
  32769. event.dataTransfer.dropEffect = "move";
  32770. if (isUndefined(draggingIndex) || draggingIndex === index) {
  32771. showDropIndicator.value = false;
  32772. return;
  32773. }
  32774. const dropPosition = wrapperRef.value.querySelector(getTagClassName(index)).getBoundingClientRect();
  32775. const dropPrev = !(draggingIndex + 1 === index);
  32776. const dropNext = !(draggingIndex - 1 === index);
  32777. const distance = event.clientX - dropPosition.left;
  32778. const prevPercent = dropPrev ? dropNext ? .5 : 1 : -1;
  32779. const nextPercent = dropNext ? dropPrev ? .5 : 0 : 1;
  32780. if (distance <= dropPosition.width * prevPercent) dropType = "before";
  32781. else if (distance > dropPosition.width * nextPercent) dropType = "after";
  32782. else dropType = void 0;
  32783. const innerEl = wrapperRef.value.querySelector(`.${ns.e("inner")}`);
  32784. const innerPosition = innerEl.getBoundingClientRect();
  32785. const gap = Number.parseFloat(getStyle(innerEl, "gap")) / 2;
  32786. const indicatorTop = dropPosition.top - innerPosition.top;
  32787. let indicatorLeft = -9999;
  32788. if (dropType === "before") indicatorLeft = Math.max(dropPosition.left - innerPosition.left - gap, Math.floor(-gap / 2));
  32789. else if (dropType === "after") {
  32790. const left = dropPosition.right - innerPosition.left;
  32791. indicatorLeft = left + (innerPosition.width === left ? Math.floor(gap / 2) : gap);
  32792. }
  32793. setStyle(dropIndicatorRef.value, {
  32794. top: `${indicatorTop}px`,
  32795. left: `${indicatorLeft}px`
  32796. });
  32797. showDropIndicator.value = !!dropType;
  32798. }
  32799. function handleDragEnd(event) {
  32800. event.preventDefault();
  32801. if (draggingTag) draggingTag.style.opacity = "";
  32802. if (dropType && !isUndefined(draggingIndex) && !isUndefined(dropIndex) && draggingIndex !== dropIndex) handleDragged(draggingIndex, dropIndex, dropType);
  32803. showDropIndicator.value = false;
  32804. draggingIndex = void 0;
  32805. draggingTag = null;
  32806. dropIndex = void 0;
  32807. dropType = void 0;
  32808. afterDragged?.();
  32809. }
  32810. return {
  32811. dropIndicatorRef,
  32812. showDropIndicator,
  32813. handleDragStart,
  32814. handleDragOver,
  32815. handleDragEnd
  32816. };
  32817. }
  32818. //#endregion
  32819. //#region ../../packages/components/input-tag/src/composables/use-hovering.ts
  32820. function useHovering() {
  32821. const hovering = ref(false);
  32822. const handleMouseEnter = () => {
  32823. hovering.value = true;
  32824. };
  32825. const handleMouseLeave = () => {
  32826. hovering.value = false;
  32827. };
  32828. return {
  32829. hovering,
  32830. handleMouseEnter,
  32831. handleMouseLeave
  32832. };
  32833. }
  32834. //#endregion
  32835. //#region ../../packages/components/input-tag/src/composables/use-input-tag.ts
  32836. function useInputTag({ props, emit, formItem }) {
  32837. const disabled = useFormDisabled();
  32838. const size = useFormSize();
  32839. const inputRef = shallowRef();
  32840. const inputValue = ref();
  32841. const tagTooltipRef = ref();
  32842. const tagSize = computed(() => {
  32843. return ["small"].includes(size.value) ? "small" : "default";
  32844. });
  32845. const placeholder = computed(() => {
  32846. return props.modelValue?.length ? void 0 : props.placeholder;
  32847. });
  32848. const closable = computed(() => !(props.readonly || disabled.value));
  32849. const inputLimit = computed(() => {
  32850. return isUndefined(props.max) ? false : (props.modelValue?.length ?? 0) >= props.max;
  32851. });
  32852. const showTagList = computed(() => {
  32853. return props.collapseTags ? props.modelValue?.slice(0, props.maxCollapseTags) : props.modelValue;
  32854. });
  32855. const collapseTagList = computed(() => {
  32856. return props.collapseTags ? props.modelValue?.slice(props.maxCollapseTags) : [];
  32857. });
  32858. const addTagsEmit = (value) => {
  32859. const list = [...props.modelValue ?? [], ...castArray$1(value)];
  32860. emit(UPDATE_MODEL_EVENT, list);
  32861. emit(CHANGE_EVENT, list);
  32862. emit("add-tag", value);
  32863. inputValue.value = void 0;
  32864. };
  32865. const getDelimitedTags = (input) => {
  32866. const parts = input.split(props.delimiter);
  32867. const tags = parts.length > 1 ? parts.map((val) => val.trim()).filter(Boolean) : [];
  32868. if (props.max) {
  32869. const maxInsert = props.max - (props.modelValue?.length ?? 0);
  32870. tags.splice(maxInsert);
  32871. }
  32872. return tags.length === 1 ? tags[0] : tags;
  32873. };
  32874. const handlePaste = (event) => {
  32875. const pasted = event.clipboardData?.getData("text");
  32876. if (props.readonly || inputLimit.value || !props.delimiter || !pasted) return;
  32877. const { selectionStart = 0, selectionEnd = 0, value } = event.target;
  32878. const nextValue = value.slice(0, selectionStart) + pasted + value.slice(selectionEnd);
  32879. const tags = getDelimitedTags(nextValue);
  32880. if (tags.length) {
  32881. addTagsEmit(tags);
  32882. emit(INPUT_EVENT, nextValue);
  32883. event.preventDefault();
  32884. }
  32885. };
  32886. const handleInput = (event) => {
  32887. if (inputLimit.value) {
  32888. inputValue.value = void 0;
  32889. return;
  32890. }
  32891. if (isComposing.value) return;
  32892. if (props.delimiter && inputValue.value) {
  32893. const tags = getDelimitedTags(inputValue.value);
  32894. if (tags.length) addTagsEmit(tags);
  32895. }
  32896. emit(INPUT_EVENT, event.target.value);
  32897. };
  32898. const handleKeydown = (event) => {
  32899. if (isComposing.value) return;
  32900. switch (getEventCode(event)) {
  32901. case props.trigger:
  32902. event.preventDefault();
  32903. event.stopPropagation();
  32904. handleAddTag();
  32905. break;
  32906. case EVENT_CODE.numpadEnter:
  32907. if (props.trigger === EVENT_CODE.enter) {
  32908. event.preventDefault();
  32909. event.stopPropagation();
  32910. handleAddTag();
  32911. }
  32912. break;
  32913. case EVENT_CODE.backspace:
  32914. if (!inputValue.value && props.modelValue?.length) {
  32915. event.preventDefault();
  32916. event.stopPropagation();
  32917. handleRemoveTag(props.modelValue.length - 1);
  32918. }
  32919. break;
  32920. }
  32921. };
  32922. const handleKeyup = (event) => {
  32923. if (isComposing.value || !isAndroid()) return;
  32924. switch (getEventCode(event)) {
  32925. case EVENT_CODE.space:
  32926. if (props.trigger === EVENT_CODE.space) {
  32927. event.preventDefault();
  32928. event.stopPropagation();
  32929. handleAddTag();
  32930. }
  32931. break;
  32932. }
  32933. };
  32934. const handleAddTag = () => {
  32935. const value = inputValue.value?.trim();
  32936. if (!value || inputLimit.value) return;
  32937. addTagsEmit(value);
  32938. };
  32939. const handleRemoveTag = (index) => {
  32940. const value = (props.modelValue ?? []).slice();
  32941. const [item] = value.splice(index, 1);
  32942. emit(UPDATE_MODEL_EVENT, value);
  32943. emit(CHANGE_EVENT, value);
  32944. emit("remove-tag", item, index);
  32945. };
  32946. const handleClear = () => {
  32947. inputValue.value = void 0;
  32948. emit(UPDATE_MODEL_EVENT, void 0);
  32949. emit(CHANGE_EVENT, void 0);
  32950. emit("clear");
  32951. };
  32952. const handleDragged = (draggingIndex, dropIndex, type) => {
  32953. const value = (props.modelValue ?? []).slice();
  32954. const [draggedItem] = value.splice(draggingIndex, 1);
  32955. const step = dropIndex > draggingIndex && type === "before" ? -1 : dropIndex < draggingIndex && type === "after" ? 1 : 0;
  32956. value.splice(dropIndex + step, 0, draggedItem);
  32957. emit(UPDATE_MODEL_EVENT, value);
  32958. emit(CHANGE_EVENT, value);
  32959. emit("drag-tag", draggingIndex, dropIndex + step, draggedItem);
  32960. };
  32961. const focus = () => {
  32962. inputRef.value?.focus();
  32963. };
  32964. const blur = () => {
  32965. inputRef.value?.blur();
  32966. };
  32967. const { wrapperRef, isFocused } = useFocusController(inputRef, {
  32968. disabled,
  32969. beforeBlur(event) {
  32970. return tagTooltipRef.value?.isFocusInsideContent(event);
  32971. },
  32972. afterBlur() {
  32973. if (props.saveOnBlur) handleAddTag();
  32974. else inputValue.value = void 0;
  32975. if (props.validateEvent) formItem?.validate?.("blur").catch(NOOP);
  32976. }
  32977. });
  32978. const { isComposing, handleCompositionStart, handleCompositionUpdate, handleCompositionEnd } = useComposition({ afterComposition: handleInput });
  32979. watch(() => props.modelValue, () => {
  32980. if (props.validateEvent) formItem?.validate?.(CHANGE_EVENT).catch(NOOP);
  32981. });
  32982. return {
  32983. inputRef,
  32984. wrapperRef,
  32985. tagTooltipRef,
  32986. isFocused,
  32987. isComposing,
  32988. inputValue,
  32989. size,
  32990. tagSize,
  32991. placeholder,
  32992. closable,
  32993. disabled,
  32994. inputLimit,
  32995. showTagList,
  32996. collapseTagList,
  32997. handleDragged,
  32998. handlePaste,
  32999. handleInput,
  33000. handleKeydown,
  33001. handleKeyup,
  33002. handleAddTag,
  33003. handleRemoveTag,
  33004. handleClear,
  33005. handleCompositionStart,
  33006. handleCompositionUpdate,
  33007. handleCompositionEnd,
  33008. focus,
  33009. blur
  33010. };
  33011. }
  33012. //#endregion
  33013. //#region ../../packages/components/input-tag/src/composables/use-input-tag-dom.ts
  33014. function useInputTagDom({ props, isFocused, hovering, disabled, inputValue, size, validateState, validateIcon, needStatusIcon }) {
  33015. const attrs = useAttrs$1();
  33016. const slots = useSlots();
  33017. const ns = useNamespace("input-tag");
  33018. const nsInput = useNamespace("input");
  33019. const collapseItemRef = ref();
  33020. const innerRef = ref();
  33021. const containerKls = computed(() => [
  33022. ns.b(),
  33023. ns.is("focused", isFocused.value),
  33024. ns.is("hovering", hovering.value),
  33025. ns.is("disabled", disabled.value),
  33026. ns.m(size.value),
  33027. ns.e("wrapper"),
  33028. attrs.class
  33029. ]);
  33030. const containerStyle = computed(() => [attrs.style]);
  33031. const innerKls = computed(() => [
  33032. ns.e("inner"),
  33033. ns.is("draggable", props.draggable),
  33034. ns.is("left-space", !props.modelValue?.length && !slots.prefix),
  33035. ns.is("right-space", !props.modelValue?.length && !showSuffix.value)
  33036. ]);
  33037. const showClear = computed(() => {
  33038. return props.clearable && !disabled.value && !props.readonly && (props.modelValue?.length || inputValue.value) && (isFocused.value || hovering.value);
  33039. });
  33040. const showSuffix = computed(() => {
  33041. return slots.suffix || showClear.value || validateState.value && validateIcon.value && needStatusIcon.value;
  33042. });
  33043. const states = reactive({
  33044. innerWidth: 0,
  33045. collapseItemWidth: 0
  33046. });
  33047. const getGapWidth = () => {
  33048. if (!innerRef.value) return 0;
  33049. const style = window.getComputedStyle(innerRef.value);
  33050. return Number.parseFloat(style.gap || "6px");
  33051. };
  33052. const resetInnerWidth = () => {
  33053. states.innerWidth = Number.parseFloat(window.getComputedStyle(innerRef.value).width);
  33054. };
  33055. const resetCollapseItemWidth = () => {
  33056. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  33057. };
  33058. const tagStyle = computed(() => {
  33059. if (!props.collapseTags) return {};
  33060. const gapWidth = getGapWidth();
  33061. const inputSlotWidth = gapWidth + 11;
  33062. const maxWidth = collapseItemRef.value && props.maxCollapseTags === 1 ? states.innerWidth - states.collapseItemWidth - gapWidth - inputSlotWidth : states.innerWidth - inputSlotWidth;
  33063. return { maxWidth: `${Math.max(maxWidth, 0)}px` };
  33064. });
  33065. useResizeObserver(innerRef, resetInnerWidth);
  33066. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  33067. return {
  33068. ns,
  33069. nsInput,
  33070. containerKls,
  33071. containerStyle,
  33072. innerKls,
  33073. showClear,
  33074. showSuffix,
  33075. tagStyle,
  33076. collapseItemRef,
  33077. innerRef
  33078. };
  33079. }
  33080. //#endregion
  33081. //#region ../../packages/components/input-tag/src/input-tag.vue?vue&type=script&setup=true&lang.ts
  33082. const _hoisted_1$33 = [
  33083. "id",
  33084. "minlength",
  33085. "maxlength",
  33086. "disabled",
  33087. "readonly",
  33088. "autocomplete",
  33089. "tabindex",
  33090. "placeholder",
  33091. "autofocus",
  33092. "ariaLabel"
  33093. ];
  33094. const _hoisted_2$20 = ["textContent"];
  33095. var input_tag_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  33096. name: "ElInputTag",
  33097. inheritAttrs: false,
  33098. __name: "input-tag",
  33099. props: inputTagProps,
  33100. emits: inputTagEmits,
  33101. setup(__props, { expose: __expose, emit: __emit }) {
  33102. const props = __props;
  33103. const emit = __emit;
  33104. const attrs = useAttrs();
  33105. const slots = useSlots();
  33106. const { form, formItem } = useFormItem();
  33107. const { inputId } = useFormItemInputId(props, { formItemContext: formItem });
  33108. const needStatusIcon = computed(() => form?.statusIcon ?? false);
  33109. const validateState = computed(() => formItem?.validateState || "");
  33110. const validateIcon = computed(() => {
  33111. return validateState.value && ValidateComponentsMap[validateState.value];
  33112. });
  33113. const { inputRef, wrapperRef, tagTooltipRef, isFocused, inputValue, size, tagSize, placeholder, closable, disabled, showTagList, collapseTagList, handleDragged, handlePaste, handleInput, handleKeydown, handleKeyup, handleRemoveTag, handleClear, handleCompositionStart, handleCompositionUpdate, handleCompositionEnd, focus, blur } = useInputTag({
  33114. props,
  33115. emit,
  33116. formItem
  33117. });
  33118. const { hovering, handleMouseEnter, handleMouseLeave } = useHovering();
  33119. const { calculatorRef, inputStyle } = useCalcInputWidth();
  33120. const { dropIndicatorRef, showDropIndicator, handleDragStart, handleDragOver, handleDragEnd } = useDragTag({
  33121. wrapperRef,
  33122. handleDragged,
  33123. afterDragged: focus
  33124. });
  33125. const { ns, nsInput, containerKls, containerStyle, innerKls, showClear, showSuffix, tagStyle, collapseItemRef, innerRef } = useInputTagDom({
  33126. props,
  33127. hovering,
  33128. isFocused,
  33129. inputValue,
  33130. disabled,
  33131. size,
  33132. validateState,
  33133. validateIcon,
  33134. needStatusIcon
  33135. });
  33136. __expose({
  33137. focus,
  33138. blur
  33139. });
  33140. return (_ctx, _cache) => {
  33141. return openBlock(), createElementBlock("div", {
  33142. ref_key: "wrapperRef",
  33143. ref: wrapperRef,
  33144. class: normalizeClass(unref(containerKls)),
  33145. style: normalizeStyle(unref(containerStyle)),
  33146. onMouseenter: _cache[9] || (_cache[9] = (...args) => unref(handleMouseEnter) && unref(handleMouseEnter)(...args)),
  33147. onMouseleave: _cache[10] || (_cache[10] = (...args) => unref(handleMouseLeave) && unref(handleMouseLeave)(...args))
  33148. }, [
  33149. unref(slots).prefix ? (openBlock(), createElementBlock("div", {
  33150. key: 0,
  33151. class: normalizeClass(unref(ns).e("prefix"))
  33152. }, [renderSlot(_ctx.$slots, "prefix")], 2)) : createCommentVNode("v-if", true),
  33153. createElementVNode("div", {
  33154. ref_key: "innerRef",
  33155. ref: innerRef,
  33156. class: normalizeClass(unref(innerKls))
  33157. }, [
  33158. (openBlock(true), createElementBlock(Fragment, null, renderList(unref(showTagList), (item, index) => {
  33159. return openBlock(), createBlock(unref(ElTag), {
  33160. key: index,
  33161. size: unref(tagSize),
  33162. closable: unref(closable),
  33163. type: __props.tagType,
  33164. effect: __props.tagEffect,
  33165. draggable: unref(closable) && __props.draggable,
  33166. style: normalizeStyle(unref(tagStyle)),
  33167. "disable-transitions": "",
  33168. onClose: ($event) => unref(handleRemoveTag)(index),
  33169. onDragstart: (event) => unref(handleDragStart)(event, index),
  33170. onDragover: (event) => unref(handleDragOver)(event, index),
  33171. onDragend: unref(handleDragEnd),
  33172. onDrop: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
  33173. }, {
  33174. default: withCtx(() => [renderSlot(_ctx.$slots, "tag", {
  33175. value: item,
  33176. index
  33177. }, () => [createTextVNode(toDisplayString(item), 1)])]),
  33178. _: 2
  33179. }, 1032, [
  33180. "size",
  33181. "closable",
  33182. "type",
  33183. "effect",
  33184. "draggable",
  33185. "style",
  33186. "onClose",
  33187. "onDragstart",
  33188. "onDragover",
  33189. "onDragend"
  33190. ]);
  33191. }), 128)),
  33192. __props.collapseTags && __props.modelValue && __props.modelValue.length > __props.maxCollapseTags ? (openBlock(), createBlock(unref(ElTooltip), {
  33193. key: 0,
  33194. ref_key: "tagTooltipRef",
  33195. ref: tagTooltipRef,
  33196. disabled: !__props.collapseTagsTooltip,
  33197. "fallback-placements": [
  33198. "bottom",
  33199. "top",
  33200. "right",
  33201. "left"
  33202. ],
  33203. effect: __props.effect,
  33204. placement: "bottom"
  33205. }, {
  33206. default: withCtx(() => [createElementVNode("div", {
  33207. ref_key: "collapseItemRef",
  33208. ref: collapseItemRef,
  33209. class: normalizeClass(unref(ns).e("collapse-tag"))
  33210. }, [createVNode(unref(ElTag), {
  33211. closable: false,
  33212. size: unref(tagSize),
  33213. type: __props.tagType,
  33214. effect: __props.tagEffect,
  33215. "disable-transitions": ""
  33216. }, {
  33217. default: withCtx(() => [createTextVNode(" + " + toDisplayString(__props.modelValue.length - __props.maxCollapseTags), 1)]),
  33218. _: 1
  33219. }, 8, [
  33220. "size",
  33221. "type",
  33222. "effect"
  33223. ])], 2)]),
  33224. content: withCtx(() => [createElementVNode("div", { class: normalizeClass(unref(ns).e("input-tag-list")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(collapseTagList), (item, index) => {
  33225. return openBlock(), createBlock(unref(ElTag), {
  33226. key: index,
  33227. size: unref(tagSize),
  33228. closable: unref(closable),
  33229. type: __props.tagType,
  33230. effect: __props.tagEffect,
  33231. "disable-transitions": "",
  33232. onClose: ($event) => unref(handleRemoveTag)(index + __props.maxCollapseTags)
  33233. }, {
  33234. default: withCtx(() => [renderSlot(_ctx.$slots, "tag", {
  33235. value: item,
  33236. index: index + __props.maxCollapseTags
  33237. }, () => [createTextVNode(toDisplayString(item), 1)])]),
  33238. _: 2
  33239. }, 1032, [
  33240. "size",
  33241. "closable",
  33242. "type",
  33243. "effect",
  33244. "onClose"
  33245. ]);
  33246. }), 128))], 2)]),
  33247. _: 3
  33248. }, 8, ["disabled", "effect"])) : createCommentVNode("v-if", true),
  33249. createElementVNode("div", { class: normalizeClass(unref(ns).e("input-wrapper")) }, [withDirectives(createElementVNode("input", mergeProps({
  33250. id: unref(inputId),
  33251. ref_key: "inputRef",
  33252. ref: inputRef,
  33253. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(inputValue) ? inputValue.value = $event : null)
  33254. }, unref(attrs), {
  33255. type: "text",
  33256. minlength: __props.minlength,
  33257. maxlength: __props.maxlength,
  33258. disabled: unref(disabled),
  33259. readonly: __props.readonly,
  33260. autocomplete: __props.autocomplete,
  33261. tabindex: __props.tabindex,
  33262. placeholder: unref(placeholder),
  33263. autofocus: __props.autofocus,
  33264. ariaLabel: __props.ariaLabel,
  33265. class: unref(ns).e("input"),
  33266. style: unref(inputStyle),
  33267. onCompositionstart: _cache[2] || (_cache[2] = (...args) => unref(handleCompositionStart) && unref(handleCompositionStart)(...args)),
  33268. onCompositionupdate: _cache[3] || (_cache[3] = (...args) => unref(handleCompositionUpdate) && unref(handleCompositionUpdate)(...args)),
  33269. onCompositionend: _cache[4] || (_cache[4] = (...args) => unref(handleCompositionEnd) && unref(handleCompositionEnd)(...args)),
  33270. onPaste: _cache[5] || (_cache[5] = (...args) => unref(handlePaste) && unref(handlePaste)(...args)),
  33271. onInput: _cache[6] || (_cache[6] = (...args) => unref(handleInput) && unref(handleInput)(...args)),
  33272. onKeydown: _cache[7] || (_cache[7] = (...args) => unref(handleKeydown) && unref(handleKeydown)(...args)),
  33273. onKeyup: _cache[8] || (_cache[8] = (...args) => unref(handleKeyup) && unref(handleKeyup)(...args))
  33274. }), null, 16, _hoisted_1$33), [[vModelText, unref(inputValue)]]), createElementVNode("span", {
  33275. ref_key: "calculatorRef",
  33276. ref: calculatorRef,
  33277. "aria-hidden": "true",
  33278. class: normalizeClass(unref(ns).e("input-calculator")),
  33279. textContent: toDisplayString(unref(inputValue))
  33280. }, null, 10, _hoisted_2$20)], 2),
  33281. withDirectives(createElementVNode("div", {
  33282. ref_key: "dropIndicatorRef",
  33283. ref: dropIndicatorRef,
  33284. class: normalizeClass(unref(ns).e("drop-indicator"))
  33285. }, null, 2), [[vShow, unref(showDropIndicator)]])
  33286. ], 2),
  33287. unref(showSuffix) ? (openBlock(), createElementBlock("div", {
  33288. key: 1,
  33289. class: normalizeClass(unref(ns).e("suffix"))
  33290. }, [
  33291. renderSlot(_ctx.$slots, "suffix"),
  33292. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  33293. key: 0,
  33294. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("clear")]),
  33295. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  33296. onClick: unref(handleClear)
  33297. }, {
  33298. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.clearIcon)))]),
  33299. _: 1
  33300. }, 8, [
  33301. "class",
  33302. "onMousedown",
  33303. "onClick"
  33304. ])) : createCommentVNode("v-if", true),
  33305. validateState.value && validateIcon.value && needStatusIcon.value ? (openBlock(), createBlock(unref(ElIcon), {
  33306. key: 1,
  33307. class: normalizeClass([
  33308. unref(nsInput).e("icon"),
  33309. unref(nsInput).e("validateIcon"),
  33310. unref(nsInput).is("loading", validateState.value === "validating")
  33311. ])
  33312. }, {
  33313. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(validateIcon.value)))]),
  33314. _: 1
  33315. }, 8, ["class"])) : createCommentVNode("v-if", true)
  33316. ], 2)) : createCommentVNode("v-if", true)
  33317. ], 38);
  33318. };
  33319. }
  33320. });
  33321. //#endregion
  33322. //#region ../../packages/components/input-tag/src/input-tag.vue
  33323. var input_tag_default = input_tag_vue_vue_type_script_setup_true_lang_default;
  33324. //#endregion
  33325. //#region ../../packages/components/input-tag/index.ts
  33326. const ElInputTag = withInstall(input_tag_default);
  33327. //#endregion
  33328. //#region ../../packages/components/input-otp/src/input-otp.ts
  33329. const inputOtpEmits = {
  33330. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  33331. [CHANGE_EVENT]: (value) => isString(value),
  33332. finish: (value) => isString(value),
  33333. focus: (eve) => eve instanceof FocusEvent,
  33334. blur: (eve) => eve instanceof FocusEvent
  33335. };
  33336. //#endregion
  33337. //#region ../../packages/components/input-otp/src/input-otp.vue?vue&type=script&setup=true&lang.ts
  33338. const _hoisted_1$32 = [
  33339. "id",
  33340. "aria-label",
  33341. "aria-labelledby"
  33342. ];
  33343. const _hoisted_2$19 = [
  33344. "value",
  33345. "type",
  33346. "disabled",
  33347. "readonly",
  33348. "inputmode",
  33349. "aria-label",
  33350. "onClick",
  33351. "onKeydown",
  33352. "onInput"
  33353. ];
  33354. var input_otp_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  33355. name: "ElInputOtp",
  33356. __name: "input-otp",
  33357. props: {
  33358. modelValue: {
  33359. type: [String, Number],
  33360. required: false
  33361. },
  33362. length: {
  33363. type: Number,
  33364. required: false,
  33365. default: 6
  33366. },
  33367. validator: {
  33368. type: Function,
  33369. required: false,
  33370. default: () => true
  33371. },
  33372. inputmode: {
  33373. type: null,
  33374. required: false
  33375. },
  33376. type: {
  33377. type: String,
  33378. required: false,
  33379. default: "outlined"
  33380. },
  33381. size: {
  33382. type: null,
  33383. required: false,
  33384. default: "default"
  33385. },
  33386. mask: {
  33387. type: Boolean,
  33388. required: false
  33389. },
  33390. disabled: {
  33391. type: Boolean,
  33392. required: false,
  33393. default: void 0
  33394. },
  33395. readonly: {
  33396. type: Boolean,
  33397. required: false
  33398. },
  33399. id: {
  33400. type: String,
  33401. required: false
  33402. },
  33403. validateEvent: {
  33404. type: Boolean,
  33405. required: false,
  33406. default: true
  33407. },
  33408. separator: {
  33409. type: [
  33410. String,
  33411. Object,
  33412. Function
  33413. ],
  33414. required: false
  33415. },
  33416. ariaLabel: {
  33417. type: String,
  33418. required: false
  33419. }
  33420. },
  33421. emits: inputOtpEmits,
  33422. setup(__props, { expose: __expose, emit: __emit }) {
  33423. const props = __props;
  33424. const emit = __emit;
  33425. const initialValue = computed(() => {
  33426. const value = String(props.modelValue ?? "");
  33427. return Array.from({ length: props.length }, (_, i) => value.charAt(i));
  33428. });
  33429. const separators = computed(() => {
  33430. const { separator } = props;
  33431. const _separator = isFunction$1(separator) ? separator : () => separator;
  33432. return Array.from({ length: props.length - 1 }, (_, i) => _separator(i));
  33433. });
  33434. const innerValue = ref(initialValue.value);
  33435. const isFocused = ref(false);
  33436. const inputRefs = ref([]);
  33437. const ns = useNamespace("input-otp");
  33438. const { t } = useLocale();
  33439. const { formItem } = useFormItem();
  33440. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, { formItemContext: formItem });
  33441. const disabled = useFormDisabled();
  33442. let modelValueOnFocus = props.modelValue;
  33443. const getFirstIndex = (maxIndex) => {
  33444. const index = innerValue.value.findIndex((char, i) => !char && i <= maxIndex);
  33445. return index === -1 ? maxIndex : index;
  33446. };
  33447. const handleFocus = (event) => {
  33448. if (inputRefs.value?.includes(event.relatedTarget)) return;
  33449. isFocused.value = true;
  33450. emit("focus", event);
  33451. };
  33452. const handleBlur = (event) => {
  33453. if (inputRefs.value?.includes(event.relatedTarget)) return;
  33454. isFocused.value = false;
  33455. emit("blur", event);
  33456. if (props.validateEvent) formItem?.validate?.("blur").catch(NOOP);
  33457. };
  33458. const updateModelValue = (emitFinish = true) => {
  33459. const value = innerValue.value.join("").slice(0, props.length);
  33460. if (value !== props.modelValue) {
  33461. emit(UPDATE_MODEL_EVENT, value);
  33462. if (emitFinish && value.length === props.length) emit("finish", value);
  33463. }
  33464. };
  33465. const handleKeydown = (event, index) => {
  33466. const code = getEventCode(event);
  33467. let preventDefault = true;
  33468. switch (code) {
  33469. case EVENT_CODE.backspace:
  33470. if (props.readonly) break;
  33471. innerValue.value[index] = "";
  33472. focus(index - 1);
  33473. updateModelValue();
  33474. break;
  33475. case EVENT_CODE.delete:
  33476. if (props.readonly) break;
  33477. innerValue.value[index] = "";
  33478. focus(index);
  33479. updateModelValue();
  33480. break;
  33481. case EVENT_CODE.up:
  33482. case EVENT_CODE.left:
  33483. focus(index - 1);
  33484. break;
  33485. case EVENT_CODE.down:
  33486. case EVENT_CODE.right:
  33487. focus(index + 1);
  33488. break;
  33489. default: preventDefault = false;
  33490. }
  33491. if (preventDefault) event.preventDefault();
  33492. };
  33493. const handleInput = (event, index) => {
  33494. const target = event.target;
  33495. const targetIndex = getFirstIndex(index);
  33496. let focusIndex = targetIndex + 1;
  33497. let value = target.value;
  33498. if (value.length > 1) {
  33499. const chars = castValues(value, targetIndex);
  33500. target.value = innerValue.value[index] ?? "";
  33501. chars.forEach((char, i) => innerValue.value[targetIndex + i] = char);
  33502. focus(targetIndex + chars.length);
  33503. updateModelValue();
  33504. return;
  33505. }
  33506. if (!props.validator(value, targetIndex)) {
  33507. target.value = innerValue.value[index] ?? "";
  33508. value = target.value;
  33509. focusIndex = targetIndex;
  33510. }
  33511. innerValue.value[targetIndex] = value;
  33512. if (targetIndex !== index) target.value = innerValue.value[index] ?? "";
  33513. focus(focusIndex);
  33514. updateModelValue();
  33515. };
  33516. const castValues = (value, startIndex = 0) => {
  33517. const chars = `${value ?? ""}`.split("");
  33518. const result = [];
  33519. for (const char of chars) {
  33520. if (result.length + startIndex >= props.length) break;
  33521. if (props.validator(char, result.length + startIndex)) result.push(char);
  33522. }
  33523. return result;
  33524. };
  33525. const focus = (index = 0) => {
  33526. const focusIndex = clamp$2(index, 0, props.length - 1);
  33527. const target = inputRefs.value?.[focusIndex];
  33528. if (document.activeElement !== target) target?.focus();
  33529. rAF(() => {
  33530. if (!props.readonly && document.activeElement === target) target?.select();
  33531. });
  33532. };
  33533. const blur = () => {
  33534. (inputRefs.value?.find((input) => document.activeElement === input))?.blur();
  33535. };
  33536. watch(() => props.modelValue, () => {
  33537. innerValue.value = initialValue.value;
  33538. if (props.validateEvent) formItem?.validate?.("change").catch(NOOP);
  33539. });
  33540. watch(() => props.length, () => {
  33541. innerValue.value = initialValue.value;
  33542. updateModelValue(false);
  33543. });
  33544. watch(isFocused, (value) => {
  33545. if (value) {
  33546. modelValueOnFocus = props.modelValue;
  33547. return;
  33548. }
  33549. if (modelValueOnFocus !== props.modelValue) emit(CHANGE_EVENT, props.modelValue);
  33550. });
  33551. __expose({
  33552. inputRefs,
  33553. focus,
  33554. blur
  33555. });
  33556. return (_ctx, _cache) => {
  33557. return openBlock(), createElementBlock("div", {
  33558. id: unref(inputId),
  33559. class: normalizeClass([
  33560. unref(ns).b(),
  33561. unref(ns).m(__props.size),
  33562. unref(ns).m(__props.type),
  33563. unref(ns).is("disabled", unref(disabled))
  33564. ]),
  33565. role: "group",
  33566. "aria-label": !unref(isLabeledByFormItem) ? __props.ariaLabel || unref(t)("el.inputOTP.groupLabel") : void 0,
  33567. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem)?.labelId : void 0
  33568. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.length, (_, index) => {
  33569. return openBlock(), createElementBlock(Fragment, { key: index }, [createElementVNode("label", { class: normalizeClass(unref(ns).e("input-field")) }, [createElementVNode("input", {
  33570. ref_for: true,
  33571. ref_key: "inputRefs",
  33572. ref: inputRefs,
  33573. value: innerValue.value[index],
  33574. class: normalizeClass(unref(ns).e("input")),
  33575. type: __props.mask ? "password" : "text",
  33576. disabled: unref(disabled),
  33577. readonly: __props.readonly,
  33578. inputmode: __props.inputmode,
  33579. autocomplete: "one-time-code",
  33580. "aria-label": unref(t)("el.inputOTP.defaultLabel", { index: index + 1 }),
  33581. onFocus: handleFocus,
  33582. onBlur: handleBlur,
  33583. onClick: ($event) => focus(index),
  33584. onKeydown: ($event) => handleKeydown($event, index),
  33585. onInput: ($event) => handleInput($event, index)
  33586. }, null, 42, _hoisted_2$19)], 2), (_ctx.$slots.separator || separators.value[index]) && index < __props.length - 1 ? renderSlot(_ctx.$slots, "separator", {
  33587. key: 0,
  33588. index
  33589. }, () => [(openBlock(), createBlock(resolveDynamicComponent(() => separators.value[index])))]) : createCommentVNode("v-if", true)], 64);
  33590. }), 128))], 10, _hoisted_1$32);
  33591. };
  33592. }
  33593. });
  33594. //#endregion
  33595. //#region ../../packages/components/input-otp/src/input-otp.vue
  33596. var input_otp_default = input_otp_vue_vue_type_script_setup_true_lang_default;
  33597. //#endregion
  33598. //#region ../../packages/components/input-otp/index.ts
  33599. const ElInputOtp = withInstall(input_otp_default);
  33600. //#endregion
  33601. //#region ../../packages/components/link/src/link.ts
  33602. const linkProps = buildProps({
  33603. type: {
  33604. type: String,
  33605. values: [
  33606. "primary",
  33607. "success",
  33608. "warning",
  33609. "info",
  33610. "danger",
  33611. "default"
  33612. ],
  33613. default: void 0
  33614. },
  33615. underline: {
  33616. type: [Boolean, String],
  33617. values: [
  33618. true,
  33619. false,
  33620. "always",
  33621. "never",
  33622. "hover"
  33623. ],
  33624. default: void 0
  33625. },
  33626. disabled: Boolean,
  33627. href: {
  33628. type: String,
  33629. default: ""
  33630. },
  33631. target: {
  33632. type: String,
  33633. default: "_self"
  33634. },
  33635. icon: { type: iconPropType }
  33636. });
  33637. const linkEmits = { click: (evt) => evt instanceof MouseEvent };
  33638. //#endregion
  33639. //#region ../../packages/components/link/src/link.vue?vue&type=script&setup=true&lang.ts
  33640. const _hoisted_1$31 = ["href", "target"];
  33641. var link_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  33642. name: "ElLink",
  33643. __name: "link",
  33644. props: linkProps,
  33645. emits: linkEmits,
  33646. setup(__props, { emit: __emit }) {
  33647. const props = __props;
  33648. const emit = __emit;
  33649. const globalConfig = useGlobalConfig("link");
  33650. useDeprecated({
  33651. scope: "el-link",
  33652. from: "The underline option (boolean)",
  33653. replacement: "'always' | 'hover' | 'never'",
  33654. version: "3.0.0",
  33655. ref: "https://element-plus.org/en-US/component/link.html#underline"
  33656. }, computed(() => isBoolean(props.underline)));
  33657. const ns = useNamespace("link");
  33658. const linkKls = computed(() => [
  33659. ns.b(),
  33660. ns.m(props.type ?? globalConfig.value?.type ?? "default"),
  33661. ns.is("disabled", props.disabled),
  33662. ns.is("underline", underline.value === "always"),
  33663. ns.is("hover-underline", underline.value === "hover" && !props.disabled)
  33664. ]);
  33665. const underline = computed(() => {
  33666. if (isBoolean(props.underline)) return props.underline ? "hover" : "never";
  33667. else return props.underline ?? globalConfig.value?.underline ?? "hover";
  33668. });
  33669. function handleClick(event) {
  33670. if (!props.disabled) emit("click", event);
  33671. }
  33672. return (_ctx, _cache) => {
  33673. return openBlock(), createElementBlock("a", {
  33674. class: normalizeClass(linkKls.value),
  33675. href: __props.disabled || !__props.href ? void 0 : __props.href,
  33676. target: __props.disabled || !__props.href ? void 0 : __props.target,
  33677. onClick: handleClick
  33678. }, [
  33679. __props.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  33680. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
  33681. _: 1
  33682. })) : createCommentVNode("v-if", true),
  33683. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  33684. key: 1,
  33685. class: normalizeClass(unref(ns).e("inner"))
  33686. }, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("v-if", true),
  33687. _ctx.$slots.icon ? renderSlot(_ctx.$slots, "icon", { key: 2 }) : createCommentVNode("v-if", true)
  33688. ], 10, _hoisted_1$31);
  33689. };
  33690. }
  33691. });
  33692. //#endregion
  33693. //#region ../../packages/components/link/src/link.vue
  33694. var link_default = link_vue_vue_type_script_setup_true_lang_default;
  33695. //#endregion
  33696. //#region ../../packages/components/link/index.ts
  33697. const ElLink = withInstall(link_default);
  33698. //#endregion
  33699. //#region ../../packages/components/menu/src/utils/submenu.ts
  33700. var SubMenu = class {
  33701. constructor(parent, domNode) {
  33702. this.parent = parent;
  33703. this.domNode = domNode;
  33704. this.subIndex = 0;
  33705. this.subMenuItems = this.domNode.querySelectorAll("li");
  33706. this.addListeners();
  33707. }
  33708. gotoSubIndex(idx) {
  33709. if (idx === this.subMenuItems.length) idx = 0;
  33710. else if (idx < 0) idx = this.subMenuItems.length - 1;
  33711. this.subMenuItems[idx].focus();
  33712. this.subIndex = idx;
  33713. }
  33714. addListeners() {
  33715. const parentNode = this.parent.domNode;
  33716. this.subMenuItems.forEach((el) => {
  33717. el.addEventListener("keydown", (event) => {
  33718. const code = getEventCode(event);
  33719. let prevDef = false;
  33720. switch (code) {
  33721. case EVENT_CODE.down:
  33722. this.gotoSubIndex(this.subIndex + 1);
  33723. prevDef = true;
  33724. break;
  33725. case EVENT_CODE.up:
  33726. this.gotoSubIndex(this.subIndex - 1);
  33727. prevDef = true;
  33728. break;
  33729. case EVENT_CODE.tab:
  33730. triggerEvent(parentNode, "mouseleave");
  33731. break;
  33732. case EVENT_CODE.enter:
  33733. case EVENT_CODE.numpadEnter:
  33734. case EVENT_CODE.space:
  33735. prevDef = true;
  33736. event.currentTarget.click();
  33737. break;
  33738. }
  33739. if (prevDef) {
  33740. event.preventDefault();
  33741. event.stopPropagation();
  33742. }
  33743. return false;
  33744. });
  33745. });
  33746. }
  33747. };
  33748. //#endregion
  33749. //#region ../../packages/components/menu/src/utils/menu-item.ts
  33750. var MenuItem = class {
  33751. constructor(domNode, namespace) {
  33752. this.domNode = domNode;
  33753. this.submenu = null;
  33754. this.init(namespace);
  33755. }
  33756. init(namespace) {
  33757. this.domNode.setAttribute("tabindex", "0");
  33758. const menuChild = this.domNode.querySelector(`.${namespace}-menu`);
  33759. if (menuChild) this.submenu = new SubMenu(this, menuChild);
  33760. this.addListeners();
  33761. }
  33762. addListeners() {
  33763. this.domNode.addEventListener("keydown", (event) => {
  33764. const code = getEventCode(event);
  33765. let prevDef = false;
  33766. switch (code) {
  33767. case EVENT_CODE.down:
  33768. triggerEvent(event.currentTarget, "mouseenter");
  33769. this.submenu?.gotoSubIndex(0);
  33770. prevDef = true;
  33771. break;
  33772. case EVENT_CODE.up:
  33773. triggerEvent(event.currentTarget, "mouseenter");
  33774. this.submenu?.gotoSubIndex(this.submenu.subMenuItems.length - 1);
  33775. prevDef = true;
  33776. break;
  33777. case EVENT_CODE.tab:
  33778. triggerEvent(event.currentTarget, "mouseleave");
  33779. break;
  33780. case EVENT_CODE.enter:
  33781. case EVENT_CODE.numpadEnter:
  33782. case EVENT_CODE.space:
  33783. prevDef = true;
  33784. event.currentTarget.click();
  33785. break;
  33786. }
  33787. if (prevDef) event.preventDefault();
  33788. });
  33789. }
  33790. };
  33791. //#endregion
  33792. //#region ../../packages/components/menu/src/utils/menu-bar.ts
  33793. var Menu = class {
  33794. constructor(domNode, namespace) {
  33795. this.domNode = domNode;
  33796. this.init(namespace);
  33797. }
  33798. init(namespace) {
  33799. const menuChildren = this.domNode.childNodes;
  33800. Array.from(menuChildren).forEach((child) => {
  33801. if (child.nodeType === 1) new MenuItem(child, namespace);
  33802. });
  33803. }
  33804. };
  33805. //#endregion
  33806. //#region ../../packages/components/menu/src/menu-collapse-transition.vue?vue&type=script&setup=true&lang.ts
  33807. var menu_collapse_transition_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  33808. name: "ElMenuCollapseTransition",
  33809. __name: "menu-collapse-transition",
  33810. setup(__props) {
  33811. const ns = useNamespace("menu");
  33812. const listeners = {
  33813. onBeforeEnter: (el) => el.style.opacity = "0.2",
  33814. onEnter(el, done) {
  33815. addClass(el, `${ns.namespace.value}-opacity-transition`);
  33816. el.style.opacity = "1";
  33817. done();
  33818. },
  33819. onAfterEnter(el) {
  33820. removeClass(el, `${ns.namespace.value}-opacity-transition`);
  33821. el.style.opacity = "";
  33822. },
  33823. onBeforeLeave(el) {
  33824. if (!el.dataset) el.dataset = {};
  33825. if (hasClass(el, ns.m("collapse"))) {
  33826. removeClass(el, ns.m("collapse"));
  33827. el.dataset.oldOverflow = el.style.overflow;
  33828. el.dataset.scrollWidth = el.clientWidth.toString();
  33829. addClass(el, ns.m("collapse"));
  33830. } else {
  33831. addClass(el, ns.m("collapse"));
  33832. el.dataset.oldOverflow = el.style.overflow;
  33833. el.dataset.scrollWidth = el.clientWidth.toString();
  33834. removeClass(el, ns.m("collapse"));
  33835. }
  33836. el.style.width = `${el.scrollWidth}px`;
  33837. el.style.overflow = "hidden";
  33838. },
  33839. onLeave(el) {
  33840. addClass(el, "horizontal-collapse-transition");
  33841. el.style.width = `${el.dataset.scrollWidth}px`;
  33842. }
  33843. };
  33844. return (_ctx, _cache) => {
  33845. return openBlock(), createBlock(Transition, mergeProps({ mode: "out-in" }, listeners), {
  33846. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  33847. _: 3
  33848. }, 16);
  33849. };
  33850. }
  33851. });
  33852. //#endregion
  33853. //#region ../../packages/components/menu/src/menu-collapse-transition.vue
  33854. var menu_collapse_transition_default = menu_collapse_transition_vue_vue_type_script_setup_true_lang_default;
  33855. //#endregion
  33856. //#region ../../packages/components/menu/src/use-menu.ts
  33857. function useMenu(instance, currentIndex) {
  33858. const indexPath = computed(() => {
  33859. let parent = instance.parent;
  33860. const path = [currentIndex.value];
  33861. while (parent.type.name !== "ElMenu") {
  33862. if (parent.props.index) path.unshift(parent.props.index);
  33863. parent = parent.parent;
  33864. }
  33865. return path;
  33866. });
  33867. return {
  33868. parentMenu: computed(() => {
  33869. let parent = instance.parent;
  33870. while (parent && !["ElMenu", "ElSubMenu"].includes(parent.type.name)) parent = parent.parent;
  33871. return parent;
  33872. }),
  33873. indexPath
  33874. };
  33875. }
  33876. //#endregion
  33877. //#region ../../packages/components/menu/src/use-menu-color.ts
  33878. function useMenuColor(props) {
  33879. return computed(() => {
  33880. const color = props.backgroundColor;
  33881. return color ? new TinyColor(color).shade(20).toString() : "";
  33882. });
  33883. }
  33884. //#endregion
  33885. //#region ../../packages/components/menu/src/use-menu-css-var.ts
  33886. const useMenuCssVar = (props, level) => {
  33887. const ns = useNamespace("menu");
  33888. return computed(() => ns.cssVarBlock({
  33889. "text-color": props.textColor || "",
  33890. "hover-text-color": props.textColor || "",
  33891. "bg-color": props.backgroundColor || "",
  33892. "hover-bg-color": useMenuColor(props).value || "",
  33893. "active-color": props.activeTextColor || "",
  33894. level: `${level}`
  33895. }));
  33896. };
  33897. //#endregion
  33898. //#region ../../packages/components/menu/src/tokens.ts
  33899. const MENU_INJECTION_KEY = "rootMenu";
  33900. const SUB_MENU_INJECTION_KEY = "subMenu:";
  33901. //#endregion
  33902. //#region ../../packages/components/menu/src/sub-menu.ts
  33903. const subMenuProps = buildProps({
  33904. index: {
  33905. type: String,
  33906. required: true
  33907. },
  33908. showTimeout: Number,
  33909. hideTimeout: Number,
  33910. popperClass: String,
  33911. popperStyle: { type: definePropType([String, Object]) },
  33912. disabled: Boolean,
  33913. teleported: {
  33914. type: Boolean,
  33915. default: void 0
  33916. },
  33917. popperOffset: Number,
  33918. expandCloseIcon: { type: iconPropType },
  33919. expandOpenIcon: { type: iconPropType },
  33920. collapseCloseIcon: { type: iconPropType },
  33921. collapseOpenIcon: { type: iconPropType }
  33922. });
  33923. const COMPONENT_NAME$8 = "ElSubMenu";
  33924. var sub_menu_default = defineComponent({
  33925. name: COMPONENT_NAME$8,
  33926. props: subMenuProps,
  33927. setup(props, { slots, expose }) {
  33928. const instance = getCurrentInstance();
  33929. const { indexPath, parentMenu } = useMenu(instance, computed(() => props.index));
  33930. const nsMenu = useNamespace("menu");
  33931. const nsSubMenu = useNamespace("sub-menu");
  33932. const rootMenu = inject(MENU_INJECTION_KEY);
  33933. if (!rootMenu) throwError(COMPONENT_NAME$8, "can not inject root menu");
  33934. const subMenu = inject(`${SUB_MENU_INJECTION_KEY}${parentMenu.value.uid}`);
  33935. if (!subMenu) throwError(COMPONENT_NAME$8, "can not inject sub menu");
  33936. const items = ref({});
  33937. const subMenus = ref({});
  33938. let timeout;
  33939. const mouseInChild = ref(false);
  33940. const verticalTitleRef = ref();
  33941. const vPopper = ref();
  33942. const isFirstLevel = computed(() => subMenu.level === 0);
  33943. const currentPlacement = computed(() => mode.value === "horizontal" && isFirstLevel.value ? "bottom-start" : "right-start");
  33944. const subMenuTitleIcon = computed(() => {
  33945. if (mode.value === "horizontal" && isFirstLevel.value || mode.value === "vertical" && !rootMenu.props.collapse) {
  33946. if (props.expandCloseIcon && props.expandOpenIcon) return opened.value ? props.expandOpenIcon : props.expandCloseIcon;
  33947. return arrow_down_default;
  33948. } else {
  33949. if (props.collapseCloseIcon && props.collapseOpenIcon) return opened.value ? props.collapseOpenIcon : props.collapseCloseIcon;
  33950. return arrow_right_default;
  33951. }
  33952. });
  33953. const appendToBody = computed(() => {
  33954. const value = props.teleported;
  33955. return isUndefined(value) ? isFirstLevel.value : value;
  33956. });
  33957. const menuTransitionName = computed(() => rootMenu.props.collapse ? `${nsMenu.namespace.value}-zoom-in-left` : `${nsMenu.namespace.value}-zoom-in-top`);
  33958. const fallbackPlacements = computed(() => mode.value === "horizontal" && isFirstLevel.value ? [
  33959. "bottom-start",
  33960. "bottom-end",
  33961. "top-start",
  33962. "top-end",
  33963. "right-start",
  33964. "left-start"
  33965. ] : [
  33966. "right-start",
  33967. "right",
  33968. "right-end",
  33969. "left-start",
  33970. "bottom-start",
  33971. "bottom-end",
  33972. "top-start",
  33973. "top-end"
  33974. ]);
  33975. const opened = computed(() => rootMenu.openedMenus.includes(props.index));
  33976. const active = computed(() => [...Object.values(items.value), ...Object.values(subMenus.value)].some(({ active }) => active));
  33977. const mode = computed(() => rootMenu.props.mode);
  33978. const persistent = computed(() => rootMenu.props.persistent);
  33979. const item = reactive({
  33980. index: props.index,
  33981. indexPath,
  33982. active
  33983. });
  33984. const ulStyle = useMenuCssVar(rootMenu.props, subMenu.level + 1);
  33985. const subMenuPopperOffset = computed(() => props.popperOffset ?? rootMenu.props.popperOffset);
  33986. const subMenuPopperClass = computed(() => props.popperClass ?? rootMenu.props.popperClass);
  33987. const subMenuPopperStyle = computed(() => props.popperStyle ?? rootMenu.props.popperStyle);
  33988. const subMenuShowTimeout = computed(() => props.showTimeout ?? rootMenu.props.showTimeout);
  33989. const subMenuHideTimeout = computed(() => props.hideTimeout ?? rootMenu.props.hideTimeout);
  33990. const doDestroy = () => vPopper.value?.popperRef?.popperInstanceRef?.destroy();
  33991. const handleCollapseToggle = (value) => {
  33992. if (!value) doDestroy();
  33993. };
  33994. const handleClick = () => {
  33995. if (rootMenu.props.menuTrigger === "hover" && rootMenu.props.mode === "horizontal" || rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) return;
  33996. rootMenu.handleSubMenuClick({
  33997. index: props.index,
  33998. indexPath: indexPath.value,
  33999. active: active.value
  34000. });
  34001. };
  34002. const handleMouseenter = (event, showTimeout = subMenuShowTimeout.value) => {
  34003. if (event.type === "focus") return;
  34004. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical" || props.disabled) {
  34005. subMenu.mouseInChild.value = true;
  34006. return;
  34007. }
  34008. subMenu.mouseInChild.value = true;
  34009. timeout?.();
  34010. ({stop: timeout} = useTimeoutFn(() => {
  34011. rootMenu.openMenu(props.index, indexPath.value);
  34012. }, showTimeout));
  34013. if (appendToBody.value) parentMenu.value.vnode.el?.dispatchEvent(new MouseEvent("mouseenter"));
  34014. if (event.type === "mouseenter" && event.target) nextTick(() => {
  34015. focusElement(event.target, { preventScroll: true });
  34016. });
  34017. };
  34018. const handleMouseleave = (deepDispatch = false) => {
  34019. if (rootMenu.props.menuTrigger === "click" && rootMenu.props.mode === "horizontal" || !rootMenu.props.collapse && rootMenu.props.mode === "vertical") {
  34020. subMenu.mouseInChild.value = false;
  34021. return;
  34022. }
  34023. timeout?.();
  34024. subMenu.mouseInChild.value = false;
  34025. ({stop: timeout} = useTimeoutFn(() => !mouseInChild.value && rootMenu.closeMenu(props.index, indexPath.value), subMenuHideTimeout.value));
  34026. if (appendToBody.value && deepDispatch) subMenu.handleMouseleave?.(true);
  34027. };
  34028. watch(() => rootMenu.props.collapse, (value) => handleCollapseToggle(Boolean(value)));
  34029. {
  34030. const addSubMenu = (item) => {
  34031. subMenus.value[item.index] = item;
  34032. };
  34033. const removeSubMenu = (item) => {
  34034. delete subMenus.value[item.index];
  34035. };
  34036. provide(`${SUB_MENU_INJECTION_KEY}${instance.uid}`, {
  34037. addSubMenu,
  34038. removeSubMenu,
  34039. handleMouseleave,
  34040. mouseInChild,
  34041. level: subMenu.level + 1
  34042. });
  34043. }
  34044. expose({ opened });
  34045. onMounted(() => {
  34046. rootMenu.addSubMenu(item);
  34047. subMenu.addSubMenu(item);
  34048. });
  34049. onBeforeUnmount(() => {
  34050. subMenu.removeSubMenu(item);
  34051. rootMenu.removeSubMenu(item);
  34052. });
  34053. return () => {
  34054. const titleTag = [slots.title?.(), h(ElIcon, {
  34055. class: nsSubMenu.e("icon-arrow"),
  34056. style: { transform: opened.value ? props.expandCloseIcon && props.expandOpenIcon || props.collapseCloseIcon && props.collapseOpenIcon && rootMenu.props.collapse ? "none" : "rotateZ(180deg)" : "none" }
  34057. }, { default: () => isString(subMenuTitleIcon.value) ? h(instance.appContext.components[subMenuTitleIcon.value]) : h(subMenuTitleIcon.value) })];
  34058. const child = rootMenu.isMenuPopup ? h(ElTooltip, {
  34059. ref: vPopper,
  34060. visible: opened.value,
  34061. effect: "light",
  34062. pure: true,
  34063. offset: subMenuPopperOffset.value,
  34064. showArrow: false,
  34065. persistent: persistent.value,
  34066. popperClass: subMenuPopperClass.value,
  34067. popperStyle: subMenuPopperStyle.value,
  34068. placement: currentPlacement.value,
  34069. teleported: appendToBody.value,
  34070. fallbackPlacements: fallbackPlacements.value,
  34071. transition: menuTransitionName.value,
  34072. gpuAcceleration: false
  34073. }, {
  34074. content: () => h("div", {
  34075. class: [
  34076. nsMenu.m(mode.value),
  34077. nsMenu.m("popup-container"),
  34078. subMenuPopperClass.value
  34079. ],
  34080. onMouseenter: (evt) => handleMouseenter(evt, 100),
  34081. onMouseleave: () => handleMouseleave(true),
  34082. onFocus: (evt) => handleMouseenter(evt, 100)
  34083. }, [h("ul", {
  34084. class: [
  34085. nsMenu.b(),
  34086. nsMenu.m("popup"),
  34087. nsMenu.m(`popup-${currentPlacement.value}`)
  34088. ],
  34089. style: ulStyle.value
  34090. }, [slots.default?.()])]),
  34091. default: () => h("div", {
  34092. class: nsSubMenu.e("title"),
  34093. onClick: handleClick
  34094. }, titleTag)
  34095. }) : h(Fragment, {}, [h("div", {
  34096. class: nsSubMenu.e("title"),
  34097. ref: verticalTitleRef,
  34098. onClick: handleClick
  34099. }, titleTag), h(ElCollapseTransition, {}, { default: () => withDirectives(h("ul", {
  34100. role: "menu",
  34101. class: [nsMenu.b(), nsMenu.m("inline")],
  34102. style: ulStyle.value
  34103. }, [slots.default?.()]), [[vShow, opened.value]]) })]);
  34104. return h("li", {
  34105. class: [
  34106. nsSubMenu.b(),
  34107. nsSubMenu.is("active", active.value),
  34108. nsSubMenu.is("opened", opened.value),
  34109. nsSubMenu.is("disabled", props.disabled)
  34110. ],
  34111. role: "menuitem",
  34112. ariaHaspopup: true,
  34113. ariaExpanded: opened.value,
  34114. onMouseenter: handleMouseenter,
  34115. onMouseleave: () => handleMouseleave(),
  34116. onFocus: handleMouseenter
  34117. }, [child]);
  34118. };
  34119. }
  34120. });
  34121. //#endregion
  34122. //#region ../../packages/components/menu/src/menu.ts
  34123. const menuProps = buildProps({
  34124. mode: {
  34125. type: String,
  34126. values: ["horizontal", "vertical"],
  34127. default: "vertical"
  34128. },
  34129. defaultActive: {
  34130. type: String,
  34131. default: ""
  34132. },
  34133. defaultOpeneds: {
  34134. type: definePropType(Array),
  34135. default: () => mutable([])
  34136. },
  34137. uniqueOpened: Boolean,
  34138. router: Boolean,
  34139. menuTrigger: {
  34140. type: String,
  34141. values: ["hover", "click"],
  34142. default: "hover"
  34143. },
  34144. collapse: Boolean,
  34145. backgroundColor: String,
  34146. textColor: String,
  34147. activeTextColor: String,
  34148. closeOnClickOutside: Boolean,
  34149. collapseTransition: {
  34150. type: Boolean,
  34151. default: true
  34152. },
  34153. ellipsis: {
  34154. type: Boolean,
  34155. default: true
  34156. },
  34157. popperOffset: {
  34158. type: Number,
  34159. default: 6
  34160. },
  34161. ellipsisIcon: {
  34162. type: iconPropType,
  34163. default: () => more_default
  34164. },
  34165. popperEffect: {
  34166. type: definePropType(String),
  34167. default: "dark"
  34168. },
  34169. popperClass: String,
  34170. popperStyle: { type: definePropType([String, Object]) },
  34171. showTimeout: {
  34172. type: Number,
  34173. default: 300
  34174. },
  34175. hideTimeout: {
  34176. type: Number,
  34177. default: 300
  34178. },
  34179. persistent: {
  34180. type: Boolean,
  34181. default: true
  34182. }
  34183. });
  34184. const checkIndexPath = (indexPath) => isArray$1(indexPath) && indexPath.every((path) => isString(path));
  34185. const menuEmits = {
  34186. close: (index, indexPath) => isString(index) && checkIndexPath(indexPath),
  34187. open: (index, indexPath) => isString(index) && checkIndexPath(indexPath),
  34188. select: (index, indexPath, item, routerResult) => isString(index) && checkIndexPath(indexPath) && isObject$1(item) && (isUndefined(routerResult) || routerResult instanceof Promise)
  34189. };
  34190. const DEFAULT_MORE_ITEM_WIDTH = 64;
  34191. var menu_default = defineComponent({
  34192. name: "ElMenu",
  34193. props: menuProps,
  34194. emits: menuEmits,
  34195. setup(props, { emit, slots, expose }) {
  34196. const instance = getCurrentInstance();
  34197. const router = instance.appContext.config.globalProperties.$router;
  34198. const menu = ref();
  34199. const subMenu = ref();
  34200. const nsMenu = useNamespace("menu");
  34201. const nsSubMenu = useNamespace("sub-menu");
  34202. let moreItemWidth = DEFAULT_MORE_ITEM_WIDTH;
  34203. const sliceIndex = ref(-1);
  34204. const openedMenus = ref(props.defaultOpeneds && !props.collapse ? props.defaultOpeneds.slice(0) : []);
  34205. const activeIndex = ref(props.defaultActive);
  34206. const items = ref({});
  34207. const subMenus = ref({});
  34208. const isMenuPopup = computed(() => props.mode === "horizontal" || props.mode === "vertical" && props.collapse);
  34209. const initMenu = () => {
  34210. const activeItem = activeIndex.value && items.value[activeIndex.value];
  34211. if (!activeItem || props.mode === "horizontal" || props.collapse) return;
  34212. activeItem.indexPath.forEach((index) => {
  34213. const subMenu = subMenus.value[index];
  34214. subMenu && openMenu(index, subMenu.indexPath);
  34215. });
  34216. };
  34217. const openMenu = (index, indexPath) => {
  34218. if (openedMenus.value.includes(index)) return;
  34219. if (props.uniqueOpened) openedMenus.value = openedMenus.value.filter((index) => indexPath.includes(index));
  34220. openedMenus.value.push(index);
  34221. emit("open", index, indexPath);
  34222. };
  34223. const close = (index) => {
  34224. const i = openedMenus.value.indexOf(index);
  34225. if (i !== -1) openedMenus.value.splice(i, 1);
  34226. };
  34227. const closeMenu = (index, indexPath) => {
  34228. close(index);
  34229. emit("close", index, indexPath);
  34230. };
  34231. const handleSubMenuClick = ({ index, indexPath }) => {
  34232. openedMenus.value.includes(index) ? closeMenu(index, indexPath) : openMenu(index, indexPath);
  34233. };
  34234. const handleMenuItemClick = (menuItem) => {
  34235. if (props.mode === "horizontal" || props.collapse) openedMenus.value = [];
  34236. const { index, indexPath } = menuItem;
  34237. if (isNil(index) || isNil(indexPath)) return;
  34238. if (props.router && router) {
  34239. const route = menuItem.route || index;
  34240. const routerResult = router.push(route).then((res) => {
  34241. if (!res) activeIndex.value = index;
  34242. return res;
  34243. });
  34244. emit("select", index, indexPath, {
  34245. index,
  34246. indexPath,
  34247. route
  34248. }, routerResult);
  34249. } else {
  34250. activeIndex.value = index;
  34251. emit("select", index, indexPath, {
  34252. index,
  34253. indexPath
  34254. });
  34255. }
  34256. };
  34257. const updateActiveIndex = (val) => {
  34258. const itemsInData = items.value;
  34259. activeIndex.value = (itemsInData[val] || activeIndex.value && itemsInData[activeIndex.value] || itemsInData[props.defaultActive])?.index ?? val;
  34260. };
  34261. const calcMenuItemWidth = (menuItem) => {
  34262. const computedStyle = getComputedStyle(menuItem);
  34263. const marginLeft = Number.parseInt(computedStyle.marginLeft, 10);
  34264. const marginRight = Number.parseInt(computedStyle.marginRight, 10);
  34265. return menuItem.offsetWidth + marginLeft + marginRight || 0;
  34266. };
  34267. const calcSliceIndex = () => {
  34268. if (!menu.value) return -1;
  34269. const items = Array.from(menu.value.childNodes).filter((item) => item.nodeName !== "#comment" && (item.nodeName !== "#text" || item.nodeValue));
  34270. const computedMenuStyle = getComputedStyle(menu.value);
  34271. const paddingLeft = Number.parseInt(computedMenuStyle.paddingLeft, 10);
  34272. const paddingRight = Number.parseInt(computedMenuStyle.paddingRight, 10);
  34273. const menuWidth = menu.value.clientWidth - paddingLeft - paddingRight;
  34274. let calcWidth = 0;
  34275. let sliceIndex = 0;
  34276. items.forEach((item, index) => {
  34277. calcWidth += calcMenuItemWidth(item);
  34278. if (calcWidth <= menuWidth - moreItemWidth) sliceIndex = index + 1;
  34279. });
  34280. return sliceIndex === items.length ? -1 : sliceIndex;
  34281. };
  34282. const getIndexPath = (index) => subMenus.value[index].indexPath;
  34283. const debounce = (fn, wait = 33.34) => {
  34284. let timer;
  34285. return () => {
  34286. timer && clearTimeout(timer);
  34287. timer = setTimeout(() => {
  34288. fn();
  34289. }, wait);
  34290. };
  34291. };
  34292. let isFirstTimeRender = true;
  34293. const handleResize = () => {
  34294. const el = unrefElement(subMenu);
  34295. if (el) moreItemWidth = calcMenuItemWidth(el) || DEFAULT_MORE_ITEM_WIDTH;
  34296. if (sliceIndex.value === calcSliceIndex()) return;
  34297. const callback = () => {
  34298. sliceIndex.value = -1;
  34299. nextTick(() => {
  34300. sliceIndex.value = calcSliceIndex();
  34301. });
  34302. };
  34303. isFirstTimeRender ? callback() : debounce(callback)();
  34304. isFirstTimeRender = false;
  34305. };
  34306. watch(() => props.defaultActive, (currentActive) => {
  34307. if (!items.value[currentActive]) activeIndex.value = "";
  34308. updateActiveIndex(currentActive);
  34309. });
  34310. watch(() => props.collapse, (value) => {
  34311. if (value) openedMenus.value = [];
  34312. });
  34313. watch(items.value, initMenu);
  34314. let resizeStopper;
  34315. watchEffect(() => {
  34316. if (props.mode === "horizontal" && props.ellipsis) resizeStopper = useResizeObserver(menu, handleResize).stop;
  34317. else resizeStopper?.();
  34318. });
  34319. const mouseInChild = ref(false);
  34320. {
  34321. const addSubMenu = (item) => {
  34322. subMenus.value[item.index] = item;
  34323. };
  34324. const removeSubMenu = (item) => {
  34325. delete subMenus.value[item.index];
  34326. };
  34327. const addMenuItem = (item) => {
  34328. items.value[item.index] = item;
  34329. };
  34330. const removeMenuItem = (item) => {
  34331. delete items.value[item.index];
  34332. };
  34333. provide(MENU_INJECTION_KEY, reactive({
  34334. props,
  34335. openedMenus,
  34336. items,
  34337. subMenus,
  34338. activeIndex,
  34339. isMenuPopup,
  34340. addMenuItem,
  34341. removeMenuItem,
  34342. addSubMenu,
  34343. removeSubMenu,
  34344. openMenu,
  34345. closeMenu,
  34346. handleMenuItemClick,
  34347. handleSubMenuClick
  34348. }));
  34349. provide(`${SUB_MENU_INJECTION_KEY}${instance.uid}`, {
  34350. addSubMenu,
  34351. removeSubMenu,
  34352. mouseInChild,
  34353. level: 0
  34354. });
  34355. }
  34356. onMounted(() => {
  34357. if (props.mode === "horizontal") new Menu(instance.vnode.el, nsMenu.namespace.value);
  34358. });
  34359. {
  34360. const open = (index) => {
  34361. const { indexPath } = subMenus.value[index];
  34362. indexPath.forEach((i) => openMenu(i, indexPath));
  34363. };
  34364. expose({
  34365. open,
  34366. close,
  34367. updateActiveIndex,
  34368. handleResize
  34369. });
  34370. }
  34371. const ulStyle = useMenuCssVar(props, 0);
  34372. return () => {
  34373. let slot = slots.default?.() ?? [];
  34374. const vShowMore = [];
  34375. if (props.mode === "horizontal" && menu.value) {
  34376. const originalSlot = flattedChildren(slot).filter((vnode) => {
  34377. return vnode?.shapeFlag !== 8;
  34378. });
  34379. const slotDefault = sliceIndex.value === -1 ? originalSlot : originalSlot.slice(0, sliceIndex.value);
  34380. const slotMore = sliceIndex.value === -1 ? [] : originalSlot.slice(sliceIndex.value);
  34381. if (slotMore?.length && props.ellipsis) {
  34382. slot = slotDefault;
  34383. vShowMore.push(h(sub_menu_default, {
  34384. ref: subMenu,
  34385. index: "sub-menu-more",
  34386. class: nsSubMenu.e("hide-arrow"),
  34387. popperOffset: props.popperOffset
  34388. }, {
  34389. title: () => h(ElIcon, { class: nsSubMenu.e("icon-more") }, { default: () => h(props.ellipsisIcon) }),
  34390. default: () => slotMore
  34391. }));
  34392. }
  34393. }
  34394. const directives = props.closeOnClickOutside ? [[ClickOutside, () => {
  34395. if (!openedMenus.value.length) return;
  34396. if (!mouseInChild.value) {
  34397. openedMenus.value.forEach((openedMenu) => emit("close", openedMenu, getIndexPath(openedMenu)));
  34398. openedMenus.value = [];
  34399. }
  34400. }]] : [];
  34401. const vMenu = withDirectives(h("ul", {
  34402. key: String(props.collapse),
  34403. role: "menubar",
  34404. ref: menu,
  34405. style: ulStyle.value,
  34406. class: {
  34407. [nsMenu.b()]: true,
  34408. [nsMenu.m(props.mode)]: true,
  34409. [nsMenu.m("collapse")]: props.collapse
  34410. }
  34411. }, [...slot, ...vShowMore]), directives);
  34412. if (props.collapseTransition && props.mode === "vertical") return h(menu_collapse_transition_default, () => vMenu);
  34413. return vMenu;
  34414. };
  34415. }
  34416. });
  34417. //#endregion
  34418. //#region ../../packages/components/menu/src/menu-item.ts
  34419. const menuItemProps = buildProps({
  34420. index: {
  34421. type: String,
  34422. required: true
  34423. },
  34424. route: { type: definePropType([String, Object]) },
  34425. disabled: Boolean
  34426. });
  34427. const menuItemEmits = { click: (item) => isString(item.index) && isArray$1(item.indexPath) };
  34428. //#endregion
  34429. //#region ../../packages/components/menu/src/menu-item.vue?vue&type=script&setup=true&lang.ts
  34430. const COMPONENT_NAME$7 = "ElMenuItem";
  34431. var menu_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  34432. name: COMPONENT_NAME$7,
  34433. __name: "menu-item",
  34434. props: menuItemProps,
  34435. emits: menuItemEmits,
  34436. setup(__props, { expose: __expose, emit: __emit }) {
  34437. const props = __props;
  34438. const emit = __emit;
  34439. const instance = getCurrentInstance();
  34440. const rootMenu = inject(MENU_INJECTION_KEY);
  34441. const nsMenu = useNamespace("menu");
  34442. const nsMenuItem = useNamespace("menu-item");
  34443. if (!rootMenu) throwError(COMPONENT_NAME$7, "can not inject root menu");
  34444. const { parentMenu, indexPath } = useMenu(instance, toRef(props, "index"));
  34445. const subMenu = inject(`${SUB_MENU_INJECTION_KEY}${parentMenu.value.uid}`);
  34446. if (!subMenu) throwError(COMPONENT_NAME$7, "can not inject sub menu");
  34447. const active = computed(() => props.index === rootMenu.activeIndex);
  34448. const item = reactive({
  34449. index: props.index,
  34450. indexPath,
  34451. active
  34452. });
  34453. const handleClick = () => {
  34454. if (!props.disabled) {
  34455. rootMenu.handleMenuItemClick({
  34456. index: props.index,
  34457. indexPath: indexPath.value,
  34458. route: props.route
  34459. });
  34460. emit("click", item);
  34461. }
  34462. };
  34463. onMounted(() => {
  34464. subMenu.addSubMenu(item);
  34465. rootMenu.addMenuItem(item);
  34466. });
  34467. onBeforeUnmount(() => {
  34468. subMenu.removeSubMenu(item);
  34469. rootMenu.removeMenuItem(item);
  34470. });
  34471. __expose({
  34472. parentMenu,
  34473. rootMenu,
  34474. active,
  34475. nsMenu,
  34476. nsMenuItem,
  34477. handleClick
  34478. });
  34479. return (_ctx, _cache) => {
  34480. return openBlock(), createElementBlock("li", {
  34481. class: normalizeClass([
  34482. unref(nsMenuItem).b(),
  34483. unref(nsMenuItem).is("active", active.value),
  34484. unref(nsMenuItem).is("disabled", __props.disabled)
  34485. ]),
  34486. role: "menuitem",
  34487. tabindex: "-1",
  34488. onClick: handleClick
  34489. }, [unref(parentMenu).type.name === "ElMenu" && unref(rootMenu).props.collapse && _ctx.$slots.title ? (openBlock(), createBlock(unref(ElTooltip), {
  34490. key: 0,
  34491. effect: unref(rootMenu).props.popperEffect,
  34492. placement: "right",
  34493. "fallback-placements": ["left"],
  34494. "popper-class": unref(rootMenu).props.popperClass,
  34495. "popper-style": unref(rootMenu).props.popperStyle,
  34496. persistent: unref(rootMenu).props.persistent,
  34497. "focus-on-target": ""
  34498. }, {
  34499. content: withCtx(() => [renderSlot(_ctx.$slots, "title")]),
  34500. default: withCtx(() => [createElementVNode("div", { class: normalizeClass(unref(nsMenu).be("tooltip", "trigger")) }, [renderSlot(_ctx.$slots, "default")], 2)]),
  34501. _: 3
  34502. }, 8, [
  34503. "effect",
  34504. "popper-class",
  34505. "popper-style",
  34506. "persistent"
  34507. ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [renderSlot(_ctx.$slots, "default"), renderSlot(_ctx.$slots, "title")], 64))], 2);
  34508. };
  34509. }
  34510. });
  34511. //#endregion
  34512. //#region ../../packages/components/menu/src/menu-item.vue
  34513. var menu_item_default = menu_item_vue_vue_type_script_setup_true_lang_default;
  34514. //#endregion
  34515. //#region ../../packages/components/menu/src/menu-item-group.ts
  34516. const menuItemGroupProps = { title: String };
  34517. //#endregion
  34518. //#region ../../packages/components/menu/src/menu-item-group.vue?vue&type=script&setup=true&lang.ts
  34519. var menu_item_group_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  34520. name: "ElMenuItemGroup",
  34521. __name: "menu-item-group",
  34522. props: menuItemGroupProps,
  34523. setup(__props) {
  34524. const ns = useNamespace("menu-item-group");
  34525. return (_ctx, _cache) => {
  34526. return openBlock(), createElementBlock("li", { class: normalizeClass(unref(ns).b()) }, [createElementVNode("div", { class: normalizeClass(unref(ns).e("title")) }, [!_ctx.$slots.title ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(__props.title), 1)], 64)) : renderSlot(_ctx.$slots, "title", { key: 1 })], 2), createElementVNode("ul", null, [renderSlot(_ctx.$slots, "default")])], 2);
  34527. };
  34528. }
  34529. });
  34530. //#endregion
  34531. //#region ../../packages/components/menu/src/menu-item-group.vue
  34532. var menu_item_group_default = menu_item_group_vue_vue_type_script_setup_true_lang_default;
  34533. //#endregion
  34534. //#region ../../packages/components/menu/index.ts
  34535. const ElMenu = withInstall(menu_default, {
  34536. MenuItem: menu_item_default,
  34537. MenuItemGroup: menu_item_group_default,
  34538. SubMenu: sub_menu_default
  34539. });
  34540. const ElMenuItem = withNoopInstall(menu_item_default);
  34541. const ElMenuItemGroup = withNoopInstall(menu_item_group_default);
  34542. const ElSubMenu = withNoopInstall(sub_menu_default);
  34543. //#endregion
  34544. //#region ../../packages/components/page-header/src/page-header.ts
  34545. const pageHeaderProps = buildProps({
  34546. icon: {
  34547. type: iconPropType,
  34548. default: () => back_default
  34549. },
  34550. title: String,
  34551. content: {
  34552. type: String,
  34553. default: ""
  34554. }
  34555. });
  34556. const pageHeaderEmits = { back: () => true };
  34557. //#endregion
  34558. //#region ../../packages/components/page-header/src/page-header.vue?vue&type=script&setup=true&lang.ts
  34559. const _hoisted_1$30 = ["aria-label"];
  34560. var page_header_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  34561. name: "ElPageHeader",
  34562. __name: "page-header",
  34563. props: pageHeaderProps,
  34564. emits: pageHeaderEmits,
  34565. setup(__props, { emit: __emit }) {
  34566. const emit = __emit;
  34567. const { t } = useLocale();
  34568. const ns = useNamespace("page-header");
  34569. function handleClick() {
  34570. emit("back");
  34571. }
  34572. return (_ctx, _cache) => {
  34573. return openBlock(), createElementBlock("div", { class: normalizeClass([
  34574. unref(ns).b(),
  34575. unref(ns).is("contentful", !!_ctx.$slots.default),
  34576. {
  34577. [unref(ns).m("has-breadcrumb")]: !!_ctx.$slots.breadcrumb,
  34578. [unref(ns).m("has-extra")]: !!_ctx.$slots.extra
  34579. }
  34580. ]) }, [
  34581. _ctx.$slots.breadcrumb ? (openBlock(), createElementBlock("div", {
  34582. key: 0,
  34583. class: normalizeClass(unref(ns).e("breadcrumb"))
  34584. }, [renderSlot(_ctx.$slots, "breadcrumb")], 2)) : createCommentVNode("v-if", true),
  34585. createElementVNode("div", { class: normalizeClass(unref(ns).e("header")) }, [createElementVNode("div", { class: normalizeClass(unref(ns).e("left")) }, [
  34586. createElementVNode("div", {
  34587. class: normalizeClass(unref(ns).e("back")),
  34588. role: "button",
  34589. tabindex: "0",
  34590. onClick: handleClick
  34591. }, [__props.icon || _ctx.$slots.icon ? (openBlock(), createElementBlock("div", {
  34592. key: 0,
  34593. "aria-label": __props.title || unref(t)("el.pageHeader.title"),
  34594. class: normalizeClass(unref(ns).e("icon"))
  34595. }, [renderSlot(_ctx.$slots, "icon", {}, () => [__props.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  34596. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
  34597. _: 1
  34598. })) : createCommentVNode("v-if", true)])], 10, _hoisted_1$30)) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("title")) }, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title || unref(t)("el.pageHeader.title")), 1)])], 2)], 2),
  34599. createVNode(unref(ElDivider), { direction: "vertical" }),
  34600. createElementVNode("div", { class: normalizeClass(unref(ns).e("content")) }, [renderSlot(_ctx.$slots, "content", {}, () => [createTextVNode(toDisplayString(__props.content), 1)])], 2)
  34601. ], 2), _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  34602. key: 0,
  34603. class: normalizeClass(unref(ns).e("extra"))
  34604. }, [renderSlot(_ctx.$slots, "extra")], 2)) : createCommentVNode("v-if", true)], 2),
  34605. _ctx.$slots.default ? (openBlock(), createElementBlock("div", {
  34606. key: 1,
  34607. class: normalizeClass(unref(ns).e("main"))
  34608. }, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("v-if", true)
  34609. ], 2);
  34610. };
  34611. }
  34612. });
  34613. //#endregion
  34614. //#region ../../packages/components/page-header/src/page-header.vue
  34615. var page_header_default = page_header_vue_vue_type_script_setup_true_lang_default;
  34616. //#endregion
  34617. //#region ../../packages/components/page-header/index.ts
  34618. const ElPageHeader = withInstall(page_header_default);
  34619. //#endregion
  34620. //#region ../../packages/components/pagination/src/constants.ts
  34621. const elPaginationKey = Symbol("elPaginationKey");
  34622. //#endregion
  34623. //#region ../../packages/components/pagination/src/components/prev.ts
  34624. const paginationPrevProps = buildProps({
  34625. disabled: Boolean,
  34626. currentPage: {
  34627. type: Number,
  34628. default: 1
  34629. },
  34630. prevText: { type: String },
  34631. prevIcon: { type: iconPropType }
  34632. });
  34633. const paginationPrevEmits = { click: (evt) => evt instanceof MouseEvent };
  34634. //#endregion
  34635. //#region ../../packages/components/pagination/src/components/prev.vue?vue&type=script&setup=true&lang.ts
  34636. const _hoisted_1$29 = [
  34637. "disabled",
  34638. "aria-label",
  34639. "aria-disabled"
  34640. ];
  34641. const _hoisted_2$18 = { key: 0 };
  34642. var prev_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  34643. name: "ElPaginationPrev",
  34644. __name: "prev",
  34645. props: paginationPrevProps,
  34646. emits: paginationPrevEmits,
  34647. setup(__props) {
  34648. const props = __props;
  34649. const { t } = useLocale();
  34650. const internalDisabled = computed(() => props.disabled || props.currentPage <= 1);
  34651. return (_ctx, _cache) => {
  34652. return openBlock(), createElementBlock("button", {
  34653. type: "button",
  34654. class: "btn-prev",
  34655. disabled: internalDisabled.value,
  34656. "aria-label": _ctx.prevText || unref(t)("el.pagination.prev"),
  34657. "aria-disabled": internalDisabled.value,
  34658. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
  34659. }, [_ctx.prevText ? (openBlock(), createElementBlock("span", _hoisted_2$18, toDisplayString(_ctx.prevText), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  34660. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.prevIcon)))]),
  34661. _: 1
  34662. }))], 8, _hoisted_1$29);
  34663. };
  34664. }
  34665. });
  34666. //#endregion
  34667. //#region ../../packages/components/pagination/src/components/prev.vue
  34668. var prev_default = prev_vue_vue_type_script_setup_true_lang_default;
  34669. //#endregion
  34670. //#region ../../packages/components/pagination/src/components/next.ts
  34671. const paginationNextProps = buildProps({
  34672. disabled: Boolean,
  34673. currentPage: {
  34674. type: Number,
  34675. default: 1
  34676. },
  34677. pageCount: {
  34678. type: Number,
  34679. default: 50
  34680. },
  34681. nextText: { type: String },
  34682. nextIcon: { type: iconPropType }
  34683. });
  34684. //#endregion
  34685. //#region ../../packages/components/pagination/src/components/next.vue?vue&type=script&setup=true&lang.ts
  34686. const _hoisted_1$28 = [
  34687. "disabled",
  34688. "aria-label",
  34689. "aria-disabled"
  34690. ];
  34691. const _hoisted_2$17 = { key: 0 };
  34692. var next_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  34693. name: "ElPaginationNext",
  34694. __name: "next",
  34695. props: paginationNextProps,
  34696. emits: ["click"],
  34697. setup(__props) {
  34698. const props = __props;
  34699. const { t } = useLocale();
  34700. const internalDisabled = computed(() => props.disabled || props.currentPage === props.pageCount || props.pageCount === 0);
  34701. return (_ctx, _cache) => {
  34702. return openBlock(), createElementBlock("button", {
  34703. type: "button",
  34704. class: "btn-next",
  34705. disabled: internalDisabled.value,
  34706. "aria-label": _ctx.nextText || unref(t)("el.pagination.next"),
  34707. "aria-disabled": internalDisabled.value,
  34708. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
  34709. }, [_ctx.nextText ? (openBlock(), createElementBlock("span", _hoisted_2$17, toDisplayString(_ctx.nextText), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  34710. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.nextIcon)))]),
  34711. _: 1
  34712. }))], 8, _hoisted_1$28);
  34713. };
  34714. }
  34715. });
  34716. //#endregion
  34717. //#region ../../packages/components/pagination/src/components/next.vue
  34718. var next_default = next_vue_vue_type_script_setup_true_lang_default;
  34719. //#endregion
  34720. //#region ../../packages/components/pagination/src/usePagination.ts
  34721. const usePagination = () => inject(elPaginationKey, {});
  34722. //#endregion
  34723. //#region ../../packages/components/pagination/src/components/sizes.ts
  34724. const paginationSizesProps = buildProps({
  34725. pageSize: {
  34726. type: Number,
  34727. required: true
  34728. },
  34729. pageSizes: {
  34730. type: definePropType(Array),
  34731. default: () => mutable([
  34732. 10,
  34733. 20,
  34734. 30,
  34735. 40,
  34736. 50,
  34737. 100
  34738. ])
  34739. },
  34740. popperClass: { type: String },
  34741. popperStyle: { type: definePropType([String, Object]) },
  34742. disabled: Boolean,
  34743. teleported: Boolean,
  34744. size: {
  34745. type: String,
  34746. values: componentSizes
  34747. },
  34748. appendSizeTo: String
  34749. });
  34750. //#endregion
  34751. //#region ../../packages/components/pagination/src/components/sizes.vue?vue&type=script&setup=true&lang.ts
  34752. var sizes_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  34753. name: "ElPaginationSizes",
  34754. __name: "sizes",
  34755. props: paginationSizesProps,
  34756. emits: ["page-size-change"],
  34757. setup(__props, { emit: __emit }) {
  34758. const props = __props;
  34759. const emit = __emit;
  34760. const { t } = useLocale();
  34761. const ns = useNamespace("pagination");
  34762. const pagination = usePagination();
  34763. const innerPageSize = ref(props.pageSize);
  34764. watch(() => props.pageSizes, (newVal, oldVal) => {
  34765. if (isEqual$1(newVal, oldVal)) return;
  34766. if (isArray$1(newVal)) emit("page-size-change", newVal.includes(props.pageSize) ? props.pageSize : props.pageSizes[0]);
  34767. });
  34768. watch(() => props.pageSize, (newVal) => {
  34769. innerPageSize.value = newVal;
  34770. });
  34771. const innerPageSizes = computed(() => props.pageSizes);
  34772. function handleChange(val) {
  34773. if (val !== innerPageSize.value) {
  34774. innerPageSize.value = val;
  34775. pagination.handleSizeChange?.(Number(val));
  34776. }
  34777. }
  34778. return (_ctx, _cache) => {
  34779. return openBlock(), createElementBlock("span", { class: normalizeClass(unref(ns).e("sizes")) }, [createVNode(unref(ElSelect), {
  34780. "model-value": innerPageSize.value,
  34781. disabled: _ctx.disabled,
  34782. "popper-class": _ctx.popperClass,
  34783. "popper-style": _ctx.popperStyle,
  34784. size: _ctx.size,
  34785. teleported: _ctx.teleported,
  34786. "validate-event": false,
  34787. "append-to": _ctx.appendSizeTo,
  34788. onChange: handleChange
  34789. }, {
  34790. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(innerPageSizes.value, (item) => {
  34791. return openBlock(), createBlock(unref(ElOption), {
  34792. key: item,
  34793. value: item,
  34794. label: item + unref(t)("el.pagination.pagesize")
  34795. }, null, 8, ["value", "label"]);
  34796. }), 128))]),
  34797. _: 1
  34798. }, 8, [
  34799. "model-value",
  34800. "disabled",
  34801. "popper-class",
  34802. "popper-style",
  34803. "size",
  34804. "teleported",
  34805. "append-to"
  34806. ])], 2);
  34807. };
  34808. }
  34809. });
  34810. //#endregion
  34811. //#region ../../packages/components/pagination/src/components/sizes.vue
  34812. var sizes_default = sizes_vue_vue_type_script_setup_true_lang_default;
  34813. //#endregion
  34814. //#region ../../packages/components/pagination/src/components/jumper.ts
  34815. const paginationJumperProps = buildProps({ size: {
  34816. type: String,
  34817. values: componentSizes
  34818. } });
  34819. //#endregion
  34820. //#region ../../packages/components/pagination/src/components/jumper.vue?vue&type=script&setup=true&lang.ts
  34821. const _hoisted_1$27 = ["disabled"];
  34822. var jumper_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  34823. name: "ElPaginationJumper",
  34824. __name: "jumper",
  34825. props: paginationJumperProps,
  34826. setup(__props) {
  34827. const { t } = useLocale();
  34828. const ns = useNamespace("pagination");
  34829. const { pageCount, disabled, currentPage, changeEvent } = usePagination();
  34830. const userInput = ref();
  34831. const innerValue = computed(() => userInput.value ?? currentPage?.value);
  34832. function handleInput(val) {
  34833. userInput.value = val ? +val : "";
  34834. }
  34835. function handleChange(val) {
  34836. val = Math.trunc(+val);
  34837. changeEvent?.(val);
  34838. userInput.value = void 0;
  34839. }
  34840. return (_ctx, _cache) => {
  34841. return openBlock(), createElementBlock("span", {
  34842. class: normalizeClass(unref(ns).e("jump")),
  34843. disabled: unref(disabled)
  34844. }, [
  34845. createElementVNode("span", { class: normalizeClass([unref(ns).e("goto")]) }, toDisplayString(unref(t)("el.pagination.goto")), 3),
  34846. createVNode(unref(ElInput), {
  34847. size: _ctx.size,
  34848. class: normalizeClass([unref(ns).e("editor"), unref(ns).is("in-pagination")]),
  34849. min: 1,
  34850. max: unref(pageCount),
  34851. disabled: unref(disabled),
  34852. "model-value": innerValue.value,
  34853. "validate-event": false,
  34854. "aria-label": unref(t)("el.pagination.page"),
  34855. type: "number",
  34856. "onUpdate:modelValue": handleInput,
  34857. onChange: handleChange
  34858. }, null, 8, [
  34859. "size",
  34860. "class",
  34861. "max",
  34862. "disabled",
  34863. "model-value",
  34864. "aria-label"
  34865. ]),
  34866. createElementVNode("span", { class: normalizeClass([unref(ns).e("classifier")]) }, toDisplayString(unref(t)("el.pagination.pageClassifier")), 3)
  34867. ], 10, _hoisted_1$27);
  34868. };
  34869. }
  34870. });
  34871. //#endregion
  34872. //#region ../../packages/components/pagination/src/components/jumper.vue
  34873. var jumper_default = jumper_vue_vue_type_script_setup_true_lang_default;
  34874. //#endregion
  34875. //#region ../../packages/components/pagination/src/components/total.ts
  34876. const paginationTotalProps = buildProps({ total: {
  34877. type: Number,
  34878. default: 1e3
  34879. } });
  34880. //#endregion
  34881. //#region ../../packages/components/pagination/src/components/total.vue?vue&type=script&setup=true&lang.ts
  34882. const _hoisted_1$26 = ["disabled"];
  34883. var total_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  34884. name: "ElPaginationTotal",
  34885. __name: "total",
  34886. props: paginationTotalProps,
  34887. setup(__props) {
  34888. const { t } = useLocale();
  34889. const ns = useNamespace("pagination");
  34890. const { disabled } = usePagination();
  34891. return (_ctx, _cache) => {
  34892. return openBlock(), createElementBlock("span", {
  34893. class: normalizeClass(unref(ns).e("total")),
  34894. disabled: unref(disabled)
  34895. }, toDisplayString(unref(t)("el.pagination.total", { total: _ctx.total })), 11, _hoisted_1$26);
  34896. };
  34897. }
  34898. });
  34899. //#endregion
  34900. //#region ../../packages/components/pagination/src/components/total.vue
  34901. var total_default = total_vue_vue_type_script_setup_true_lang_default;
  34902. //#endregion
  34903. //#region ../../packages/components/pagination/src/components/pager.ts
  34904. const paginationPagerProps = buildProps({
  34905. currentPage: {
  34906. type: Number,
  34907. default: 1
  34908. },
  34909. pageCount: {
  34910. type: Number,
  34911. required: true
  34912. },
  34913. pagerCount: {
  34914. type: Number,
  34915. default: 7
  34916. },
  34917. disabled: Boolean
  34918. });
  34919. //#endregion
  34920. //#region ../../packages/components/pagination/src/components/pager.vue?vue&type=script&setup=true&lang.ts
  34921. const _hoisted_1$25 = [
  34922. "aria-current",
  34923. "aria-label",
  34924. "tabindex"
  34925. ];
  34926. const _hoisted_2$16 = ["tabindex", "aria-label"];
  34927. const _hoisted_3$7 = [
  34928. "aria-current",
  34929. "aria-label",
  34930. "tabindex"
  34931. ];
  34932. const _hoisted_4$5 = ["tabindex", "aria-label"];
  34933. const _hoisted_5$3 = [
  34934. "aria-current",
  34935. "aria-label",
  34936. "tabindex"
  34937. ];
  34938. var pager_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  34939. name: "ElPaginationPager",
  34940. __name: "pager",
  34941. props: paginationPagerProps,
  34942. emits: [CHANGE_EVENT],
  34943. setup(__props, { emit: __emit }) {
  34944. const props = __props;
  34945. const emit = __emit;
  34946. const nsPager = useNamespace("pager");
  34947. const nsIcon = useNamespace("icon");
  34948. const { t } = useLocale();
  34949. const showPrevMore = ref(false);
  34950. const showNextMore = ref(false);
  34951. const quickPrevHover = ref(false);
  34952. const quickNextHover = ref(false);
  34953. const quickPrevFocus = ref(false);
  34954. const quickNextFocus = ref(false);
  34955. const pagers = computed(() => {
  34956. const pagerCount = props.pagerCount;
  34957. const halfPagerCount = (pagerCount - 1) / 2;
  34958. const currentPage = Number(props.currentPage);
  34959. const pageCount = Number(props.pageCount);
  34960. let showPrevMore = false;
  34961. let showNextMore = false;
  34962. if (pageCount > pagerCount) {
  34963. if (currentPage > pagerCount - halfPagerCount) showPrevMore = true;
  34964. if (currentPage < pageCount - halfPagerCount) showNextMore = true;
  34965. }
  34966. const array = [];
  34967. if (showPrevMore && !showNextMore) {
  34968. const startPage = pageCount - (pagerCount - 2);
  34969. for (let i = startPage; i < pageCount; i++) array.push(i);
  34970. } else if (!showPrevMore && showNextMore) for (let i = 2; i < pagerCount; i++) array.push(i);
  34971. else if (showPrevMore && showNextMore) {
  34972. const offset = Math.floor(pagerCount / 2) - 1;
  34973. for (let i = currentPage - offset; i <= currentPage + offset; i++) array.push(i);
  34974. } else for (let i = 2; i < pageCount; i++) array.push(i);
  34975. return array;
  34976. });
  34977. const prevMoreKls = computed(() => [
  34978. "more",
  34979. "btn-quickprev",
  34980. nsIcon.b(),
  34981. nsPager.is("disabled", props.disabled)
  34982. ]);
  34983. const nextMoreKls = computed(() => [
  34984. "more",
  34985. "btn-quicknext",
  34986. nsIcon.b(),
  34987. nsPager.is("disabled", props.disabled)
  34988. ]);
  34989. const tabindex = computed(() => props.disabled ? -1 : 0);
  34990. watch(() => [
  34991. props.pageCount,
  34992. props.pagerCount,
  34993. props.currentPage
  34994. ], ([pageCount, pagerCount, currentPage]) => {
  34995. const halfPagerCount = (pagerCount - 1) / 2;
  34996. let showPrev = false;
  34997. let showNext = false;
  34998. if (pageCount > pagerCount) {
  34999. showPrev = currentPage > pagerCount - halfPagerCount;
  35000. showNext = currentPage < pageCount - halfPagerCount;
  35001. }
  35002. quickPrevHover.value &&= showPrev;
  35003. quickNextHover.value &&= showNext;
  35004. showPrevMore.value = showPrev;
  35005. showNextMore.value = showNext;
  35006. }, { immediate: true });
  35007. function onMouseEnter(forward = false) {
  35008. if (props.disabled) return;
  35009. if (forward) quickPrevHover.value = true;
  35010. else quickNextHover.value = true;
  35011. }
  35012. function onFocus(forward = false) {
  35013. if (forward) quickPrevFocus.value = true;
  35014. else quickNextFocus.value = true;
  35015. }
  35016. function onEnter(e) {
  35017. const target = e.target;
  35018. if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("number")) {
  35019. const newPage = Number(target.textContent);
  35020. if (newPage !== props.currentPage) emit(CHANGE_EVENT, newPage);
  35021. } else if (target.tagName.toLowerCase() === "li" && Array.from(target.classList).includes("more")) onPagerClick(e);
  35022. }
  35023. function onPagerClick(event) {
  35024. const target = event.target;
  35025. if (target.tagName.toLowerCase() === "ul" || props.disabled) return;
  35026. let newPage = Number(target.textContent);
  35027. const pageCount = props.pageCount;
  35028. const currentPage = props.currentPage;
  35029. const pagerCountOffset = props.pagerCount - 2;
  35030. if (target.className.includes("more")) {
  35031. if (target.className.includes("quickprev")) newPage = currentPage - pagerCountOffset;
  35032. else if (target.className.includes("quicknext")) newPage = currentPage + pagerCountOffset;
  35033. }
  35034. if (!Number.isNaN(+newPage)) {
  35035. if (newPage < 1) newPage = 1;
  35036. if (newPage > pageCount) newPage = pageCount;
  35037. }
  35038. if (newPage !== currentPage) emit(CHANGE_EVENT, newPage);
  35039. }
  35040. return (_ctx, _cache) => {
  35041. return openBlock(), createElementBlock("ul", {
  35042. class: normalizeClass(unref(nsPager).b()),
  35043. onClick: onPagerClick,
  35044. onKeyup: withKeys(onEnter, ["enter"])
  35045. }, [
  35046. _ctx.pageCount > 0 ? (openBlock(), createElementBlock("li", {
  35047. key: 0,
  35048. class: normalizeClass([[unref(nsPager).is("active", _ctx.currentPage === 1), unref(nsPager).is("disabled", _ctx.disabled)], "number"]),
  35049. "aria-current": _ctx.currentPage === 1,
  35050. "aria-label": unref(t)("el.pagination.currentPage", { pager: 1 }),
  35051. tabindex: tabindex.value
  35052. }, " 1 ", 10, _hoisted_1$25)) : createCommentVNode("v-if", true),
  35053. showPrevMore.value ? (openBlock(), createElementBlock("li", {
  35054. key: 1,
  35055. class: normalizeClass(prevMoreKls.value),
  35056. tabindex: tabindex.value,
  35057. "aria-label": unref(t)("el.pagination.prevPages", { pager: _ctx.pagerCount - 2 }),
  35058. onMouseenter: _cache[0] || (_cache[0] = ($event) => onMouseEnter(true)),
  35059. onMouseleave: _cache[1] || (_cache[1] = ($event) => quickPrevHover.value = false),
  35060. onFocus: _cache[2] || (_cache[2] = ($event) => onFocus(true)),
  35061. onBlur: _cache[3] || (_cache[3] = ($event) => quickPrevFocus.value = false)
  35062. }, [(quickPrevHover.value || quickPrevFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(d_arrow_left_default), { key: 0 })) : (openBlock(), createBlock(unref(more_filled_default), { key: 1 }))], 42, _hoisted_2$16)) : createCommentVNode("v-if", true),
  35063. (openBlock(true), createElementBlock(Fragment, null, renderList(pagers.value, (pager) => {
  35064. return openBlock(), createElementBlock("li", {
  35065. key: pager,
  35066. class: normalizeClass([[unref(nsPager).is("active", _ctx.currentPage === pager), unref(nsPager).is("disabled", _ctx.disabled)], "number"]),
  35067. "aria-current": _ctx.currentPage === pager,
  35068. "aria-label": unref(t)("el.pagination.currentPage", { pager }),
  35069. tabindex: tabindex.value
  35070. }, toDisplayString(pager), 11, _hoisted_3$7);
  35071. }), 128)),
  35072. showNextMore.value ? (openBlock(), createElementBlock("li", {
  35073. key: 2,
  35074. class: normalizeClass(nextMoreKls.value),
  35075. tabindex: tabindex.value,
  35076. "aria-label": unref(t)("el.pagination.nextPages", { pager: _ctx.pagerCount - 2 }),
  35077. onMouseenter: _cache[4] || (_cache[4] = ($event) => onMouseEnter()),
  35078. onMouseleave: _cache[5] || (_cache[5] = ($event) => quickNextHover.value = false),
  35079. onFocus: _cache[6] || (_cache[6] = ($event) => onFocus()),
  35080. onBlur: _cache[7] || (_cache[7] = ($event) => quickNextFocus.value = false)
  35081. }, [(quickNextHover.value || quickNextFocus.value) && !_ctx.disabled ? (openBlock(), createBlock(unref(d_arrow_right_default), { key: 0 })) : (openBlock(), createBlock(unref(more_filled_default), { key: 1 }))], 42, _hoisted_4$5)) : createCommentVNode("v-if", true),
  35082. _ctx.pageCount > 1 ? (openBlock(), createElementBlock("li", {
  35083. key: 3,
  35084. class: normalizeClass([[unref(nsPager).is("active", _ctx.currentPage === _ctx.pageCount), unref(nsPager).is("disabled", _ctx.disabled)], "number"]),
  35085. "aria-current": _ctx.currentPage === _ctx.pageCount,
  35086. "aria-label": unref(t)("el.pagination.currentPage", { pager: _ctx.pageCount }),
  35087. tabindex: tabindex.value
  35088. }, toDisplayString(_ctx.pageCount), 11, _hoisted_5$3)) : createCommentVNode("v-if", true)
  35089. ], 34);
  35090. };
  35091. }
  35092. });
  35093. //#endregion
  35094. //#region ../../packages/components/pagination/src/components/pager.vue
  35095. var pager_default = pager_vue_vue_type_script_setup_true_lang_default;
  35096. //#endregion
  35097. //#region ../../packages/components/pagination/src/pagination.ts
  35098. const isAbsent = (v) => typeof v !== "number";
  35099. const paginationProps = buildProps({
  35100. pageSize: Number,
  35101. defaultPageSize: Number,
  35102. total: Number,
  35103. pageCount: Number,
  35104. pagerCount: {
  35105. type: Number,
  35106. validator: (value) => {
  35107. return isNumber(value) && Math.trunc(value) === value && value > 4 && value < 22 && value % 2 === 1;
  35108. },
  35109. default: 7
  35110. },
  35111. currentPage: Number,
  35112. defaultCurrentPage: Number,
  35113. layout: {
  35114. type: String,
  35115. default: [
  35116. "prev",
  35117. "pager",
  35118. "next",
  35119. "jumper",
  35120. "->",
  35121. "total"
  35122. ].join(", ")
  35123. },
  35124. pageSizes: {
  35125. type: definePropType(Array),
  35126. default: () => mutable([
  35127. 10,
  35128. 20,
  35129. 30,
  35130. 40,
  35131. 50,
  35132. 100
  35133. ])
  35134. },
  35135. popperClass: {
  35136. type: String,
  35137. default: ""
  35138. },
  35139. popperStyle: { type: definePropType([String, Object]) },
  35140. prevText: {
  35141. type: String,
  35142. default: ""
  35143. },
  35144. prevIcon: {
  35145. type: iconPropType,
  35146. default: () => arrow_left_default
  35147. },
  35148. nextText: {
  35149. type: String,
  35150. default: ""
  35151. },
  35152. nextIcon: {
  35153. type: iconPropType,
  35154. default: () => arrow_right_default
  35155. },
  35156. teleported: {
  35157. type: Boolean,
  35158. default: true
  35159. },
  35160. small: Boolean,
  35161. size: useSizeProp,
  35162. background: Boolean,
  35163. disabled: Boolean,
  35164. hideOnSinglePage: Boolean,
  35165. appendSizeTo: String
  35166. });
  35167. const paginationEmits = {
  35168. "update:current-page": (val) => isNumber(val),
  35169. "update:page-size": (val) => isNumber(val),
  35170. "size-change": (val) => isNumber(val),
  35171. change: (currentPage, pageSize) => isNumber(currentPage) && isNumber(pageSize),
  35172. "current-change": (val) => isNumber(val),
  35173. "prev-click": (val) => isNumber(val),
  35174. "next-click": (val) => isNumber(val)
  35175. };
  35176. const componentName = "ElPagination";
  35177. var pagination_default = defineComponent({
  35178. name: componentName,
  35179. props: paginationProps,
  35180. emits: paginationEmits,
  35181. setup(props, { emit, slots }) {
  35182. const { t } = useLocale();
  35183. const ns = useNamespace("pagination");
  35184. const vnodeProps = getCurrentInstance().vnode.props || {};
  35185. const _globalSize = useGlobalSize();
  35186. const _size = computed(() => props.small ? "small" : props.size ?? _globalSize.value);
  35187. useDeprecated({
  35188. from: "small",
  35189. replacement: "size",
  35190. version: "3.0.0",
  35191. scope: "el-pagination",
  35192. ref: "https://element-plus.org/zh-CN/component/pagination.html"
  35193. }, computed(() => !!props.small));
  35194. const hasCurrentPageListener = "onUpdate:currentPage" in vnodeProps || "onUpdate:current-page" in vnodeProps || "onCurrentChange" in vnodeProps;
  35195. const hasPageSizeListener = "onUpdate:pageSize" in vnodeProps || "onUpdate:page-size" in vnodeProps || "onSizeChange" in vnodeProps;
  35196. const assertValidUsage = computed(() => {
  35197. if (isAbsent(props.total) && isAbsent(props.pageCount)) return false;
  35198. if (!isAbsent(props.currentPage) && !hasCurrentPageListener) return false;
  35199. if (props.layout.includes("sizes")) {
  35200. if (!isAbsent(props.pageCount)) {
  35201. if (!hasPageSizeListener) return false;
  35202. } else if (!isAbsent(props.total)) {
  35203. if (!isAbsent(props.pageSize)) {
  35204. if (!hasPageSizeListener) return false;
  35205. }
  35206. }
  35207. }
  35208. return true;
  35209. });
  35210. const innerPageSize = ref(isAbsent(props.defaultPageSize) ? 10 : props.defaultPageSize);
  35211. const innerCurrentPage = ref(isAbsent(props.defaultCurrentPage) ? 1 : props.defaultCurrentPage);
  35212. const pageSizeBridge = computed({
  35213. get() {
  35214. return isAbsent(props.pageSize) ? innerPageSize.value : props.pageSize;
  35215. },
  35216. set(v) {
  35217. if (isAbsent(props.pageSize)) innerPageSize.value = v;
  35218. if (hasPageSizeListener) {
  35219. emit("update:page-size", v);
  35220. emit("size-change", v);
  35221. }
  35222. }
  35223. });
  35224. const pageCountBridge = computed(() => {
  35225. let pageCount = 0;
  35226. if (!isAbsent(props.pageCount)) pageCount = props.pageCount;
  35227. else if (!isAbsent(props.total)) pageCount = Math.max(1, Math.ceil(props.total / pageSizeBridge.value));
  35228. return pageCount;
  35229. });
  35230. const currentPageBridge = computed({
  35231. get() {
  35232. return isAbsent(props.currentPage) ? innerCurrentPage.value : props.currentPage;
  35233. },
  35234. set(v) {
  35235. let newCurrentPage = v;
  35236. if (v < 1) newCurrentPage = 1;
  35237. else if (v > pageCountBridge.value) newCurrentPage = pageCountBridge.value;
  35238. if (isAbsent(props.currentPage)) innerCurrentPage.value = newCurrentPage;
  35239. if (hasCurrentPageListener) {
  35240. emit("update:current-page", newCurrentPage);
  35241. emit("current-change", newCurrentPage);
  35242. }
  35243. }
  35244. });
  35245. watch(pageCountBridge, (val) => {
  35246. if (currentPageBridge.value > val) currentPageBridge.value = val;
  35247. });
  35248. watch([currentPageBridge, pageSizeBridge], (value) => {
  35249. emit(CHANGE_EVENT, ...value);
  35250. }, { flush: "post" });
  35251. function handleCurrentChange(val) {
  35252. currentPageBridge.value = val;
  35253. }
  35254. function handleSizeChange(val) {
  35255. pageSizeBridge.value = val;
  35256. const newPageCount = pageCountBridge.value;
  35257. if (currentPageBridge.value > newPageCount) currentPageBridge.value = newPageCount;
  35258. }
  35259. function prev() {
  35260. if (props.disabled) return;
  35261. currentPageBridge.value -= 1;
  35262. emit("prev-click", currentPageBridge.value);
  35263. }
  35264. function next() {
  35265. if (props.disabled) return;
  35266. currentPageBridge.value += 1;
  35267. emit("next-click", currentPageBridge.value);
  35268. }
  35269. function addClass(element, cls) {
  35270. if (element) {
  35271. if (!element.props) element.props = {};
  35272. element.props.class = [element.props.class, cls].join(" ");
  35273. }
  35274. }
  35275. provide(elPaginationKey, {
  35276. pageCount: pageCountBridge,
  35277. disabled: computed(() => props.disabled),
  35278. currentPage: currentPageBridge,
  35279. changeEvent: handleCurrentChange,
  35280. handleSizeChange
  35281. });
  35282. return () => {
  35283. if (!assertValidUsage.value) {
  35284. /* @__PURE__ */ debugWarn(componentName, t("el.pagination.deprecationWarning"));
  35285. return null;
  35286. }
  35287. if (!props.layout) return null;
  35288. if (props.hideOnSinglePage && pageCountBridge.value <= 1) return null;
  35289. const rootChildren = [];
  35290. const rightWrapperChildren = [];
  35291. const rightWrapperRoot = h("div", { class: ns.e("rightwrapper") }, rightWrapperChildren);
  35292. const TEMPLATE_MAP = {
  35293. prev: h(prev_default, {
  35294. disabled: props.disabled,
  35295. currentPage: currentPageBridge.value,
  35296. prevText: props.prevText,
  35297. prevIcon: props.prevIcon,
  35298. onClick: prev
  35299. }),
  35300. jumper: h(jumper_default, { size: _size.value }),
  35301. pager: h(pager_default, {
  35302. currentPage: currentPageBridge.value,
  35303. pageCount: pageCountBridge.value,
  35304. pagerCount: props.pagerCount,
  35305. onChange: handleCurrentChange,
  35306. disabled: props.disabled
  35307. }),
  35308. next: h(next_default, {
  35309. disabled: props.disabled,
  35310. currentPage: currentPageBridge.value,
  35311. pageCount: pageCountBridge.value,
  35312. nextText: props.nextText,
  35313. nextIcon: props.nextIcon,
  35314. onClick: next
  35315. }),
  35316. sizes: h(sizes_default, {
  35317. pageSize: pageSizeBridge.value,
  35318. pageSizes: props.pageSizes,
  35319. popperClass: props.popperClass,
  35320. popperStyle: props.popperStyle,
  35321. disabled: props.disabled,
  35322. teleported: props.teleported,
  35323. size: _size.value,
  35324. appendSizeTo: props.appendSizeTo
  35325. }),
  35326. slot: slots?.default?.() ?? null,
  35327. total: h(total_default, { total: isAbsent(props.total) ? 0 : props.total })
  35328. };
  35329. const components = props.layout.split(",").map((item) => item.trim());
  35330. let haveRightWrapper = false;
  35331. components.forEach((c) => {
  35332. if (c === "->") {
  35333. haveRightWrapper = true;
  35334. return;
  35335. }
  35336. if (!haveRightWrapper) rootChildren.push(TEMPLATE_MAP[c]);
  35337. else rightWrapperChildren.push(TEMPLATE_MAP[c]);
  35338. });
  35339. addClass(rootChildren[0], ns.is("first"));
  35340. addClass(rootChildren[rootChildren.length - 1], ns.is("last"));
  35341. if (haveRightWrapper && rightWrapperChildren.length > 0) {
  35342. addClass(rightWrapperChildren[0], ns.is("first"));
  35343. addClass(rightWrapperChildren[rightWrapperChildren.length - 1], ns.is("last"));
  35344. rootChildren.push(rightWrapperRoot);
  35345. }
  35346. return h("div", { class: [
  35347. ns.b(),
  35348. ns.is("background", props.background),
  35349. ns.m(_size.value)
  35350. ] }, rootChildren);
  35351. };
  35352. }
  35353. });
  35354. //#endregion
  35355. //#region ../../packages/components/pagination/index.ts
  35356. const ElPagination = withInstall(pagination_default);
  35357. //#endregion
  35358. //#region ../../packages/components/popconfirm/src/popconfirm.ts
  35359. const popconfirmProps = buildProps({
  35360. title: String,
  35361. confirmButtonText: String,
  35362. cancelButtonText: String,
  35363. confirmButtonType: {
  35364. type: String,
  35365. values: buttonTypes,
  35366. default: "primary"
  35367. },
  35368. cancelButtonType: {
  35369. type: String,
  35370. values: buttonTypes,
  35371. default: "text"
  35372. },
  35373. icon: {
  35374. type: iconPropType,
  35375. default: () => question_filled_default
  35376. },
  35377. iconColor: {
  35378. type: String,
  35379. default: "#f90"
  35380. },
  35381. hideIcon: Boolean,
  35382. hideAfter: {
  35383. type: Number,
  35384. default: 200
  35385. },
  35386. effect: {
  35387. ...useTooltipContentProps.effect,
  35388. default: "light"
  35389. },
  35390. teleported: useTooltipContentProps.teleported,
  35391. persistent: useTooltipContentProps.persistent,
  35392. width: {
  35393. type: [String, Number],
  35394. default: 150
  35395. },
  35396. virtualTriggering: useTooltipTriggerProps.virtualTriggering,
  35397. virtualRef: useTooltipTriggerProps.virtualRef
  35398. });
  35399. const popconfirmEmits = {
  35400. confirm: (e) => e instanceof MouseEvent,
  35401. cancel: (e) => e instanceof MouseEvent
  35402. };
  35403. //#endregion
  35404. //#region ../../packages/components/popconfirm/src/popconfirm.vue?vue&type=script&setup=true&lang.ts
  35405. var popconfirm_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  35406. name: "ElPopconfirm",
  35407. __name: "popconfirm",
  35408. props: popconfirmProps,
  35409. emits: popconfirmEmits,
  35410. setup(__props, { expose: __expose, emit: __emit }) {
  35411. const props = __props;
  35412. const emit = __emit;
  35413. const { t } = useLocale();
  35414. const ns = useNamespace("popconfirm");
  35415. const tooltipRef = ref();
  35416. const rootRef = ref();
  35417. const popperRef = computed(() => {
  35418. return unref(tooltipRef)?.popperRef;
  35419. });
  35420. const showPopper = () => {
  35421. rootRef.value?.focus?.();
  35422. };
  35423. const hidePopper = () => {
  35424. tooltipRef.value?.onClose?.();
  35425. };
  35426. const style = computed(() => {
  35427. return { width: addUnit(props.width) };
  35428. });
  35429. const confirm = (e) => {
  35430. emit("confirm", e);
  35431. hidePopper();
  35432. };
  35433. const cancel = (e) => {
  35434. emit("cancel", e);
  35435. hidePopper();
  35436. };
  35437. const finalConfirmButtonText = computed(() => props.confirmButtonText || t("el.popconfirm.confirmButtonText"));
  35438. const finalCancelButtonText = computed(() => props.cancelButtonText || t("el.popconfirm.cancelButtonText"));
  35439. __expose({
  35440. popperRef,
  35441. hide: hidePopper
  35442. });
  35443. return (_ctx, _cache) => {
  35444. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  35445. ref_key: "tooltipRef",
  35446. ref: tooltipRef,
  35447. trigger: "click",
  35448. effect: __props.effect
  35449. }, _ctx.$attrs, {
  35450. "virtual-triggering": __props.virtualTriggering,
  35451. "virtual-ref": __props.virtualRef,
  35452. "popper-class": `${unref(ns).namespace.value}-popover`,
  35453. "popper-style": style.value,
  35454. teleported: __props.teleported,
  35455. "fallback-placements": [
  35456. "bottom",
  35457. "top",
  35458. "right",
  35459. "left"
  35460. ],
  35461. "hide-after": __props.hideAfter,
  35462. persistent: __props.persistent,
  35463. loop: "",
  35464. onShow: showPopper
  35465. }), {
  35466. content: withCtx(() => [createElementVNode("div", {
  35467. ref_key: "rootRef",
  35468. ref: rootRef,
  35469. tabindex: "-1",
  35470. class: normalizeClass(unref(ns).b())
  35471. }, [createElementVNode("div", { class: normalizeClass(unref(ns).e("main")) }, [!__props.hideIcon && __props.icon ? (openBlock(), createBlock(unref(ElIcon), {
  35472. key: 0,
  35473. class: normalizeClass(unref(ns).e("icon")),
  35474. style: normalizeStyle({ color: __props.iconColor })
  35475. }, {
  35476. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
  35477. _: 1
  35478. }, 8, ["class", "style"])) : createCommentVNode("v-if", true), createTextVNode(" " + toDisplayString(__props.title), 1)], 2), createElementVNode("div", { class: normalizeClass(unref(ns).e("action")) }, [renderSlot(_ctx.$slots, "actions", {
  35479. confirm,
  35480. cancel
  35481. }, () => [createVNode(unref(ElButton), {
  35482. size: "small",
  35483. type: __props.cancelButtonType === "text" ? "" : __props.cancelButtonType,
  35484. text: __props.cancelButtonType === "text",
  35485. onClick: cancel
  35486. }, {
  35487. default: withCtx(() => [createTextVNode(toDisplayString(finalCancelButtonText.value), 1)]),
  35488. _: 1
  35489. }, 8, ["type", "text"]), createVNode(unref(ElButton), {
  35490. size: "small",
  35491. type: __props.confirmButtonType === "text" ? "" : __props.confirmButtonType,
  35492. text: __props.confirmButtonType === "text",
  35493. onClick: confirm
  35494. }, {
  35495. default: withCtx(() => [createTextVNode(toDisplayString(finalConfirmButtonText.value), 1)]),
  35496. _: 1
  35497. }, 8, ["type", "text"])])], 2)], 2)]),
  35498. default: withCtx(() => [_ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)]),
  35499. _: 3
  35500. }, 16, [
  35501. "effect",
  35502. "virtual-triggering",
  35503. "virtual-ref",
  35504. "popper-class",
  35505. "popper-style",
  35506. "teleported",
  35507. "hide-after",
  35508. "persistent"
  35509. ]);
  35510. };
  35511. }
  35512. });
  35513. //#endregion
  35514. //#region ../../packages/components/popconfirm/src/popconfirm.vue
  35515. var popconfirm_default = popconfirm_vue_vue_type_script_setup_true_lang_default;
  35516. //#endregion
  35517. //#region ../../packages/components/popconfirm/index.ts
  35518. const ElPopconfirm = withInstall(popconfirm_default);
  35519. //#endregion
  35520. //#region ../../packages/components/popover/src/popover.ts
  35521. const popoverProps = buildProps({
  35522. trigger: useTooltipTriggerProps.trigger,
  35523. triggerKeys: useTooltipTriggerProps.triggerKeys,
  35524. placement: dropdownProps.placement,
  35525. disabled: useTooltipTriggerProps.disabled,
  35526. visible: useTooltipContentProps.visible,
  35527. transition: useTooltipContentProps.transition,
  35528. popperOptions: dropdownProps.popperOptions,
  35529. tabindex: dropdownProps.tabindex,
  35530. content: useTooltipContentProps.content,
  35531. popperStyle: useTooltipContentProps.popperStyle,
  35532. popperClass: useTooltipContentProps.popperClass,
  35533. enterable: {
  35534. ...useTooltipContentProps.enterable,
  35535. default: true
  35536. },
  35537. effect: {
  35538. ...useTooltipContentProps.effect,
  35539. default: "light"
  35540. },
  35541. teleported: useTooltipContentProps.teleported,
  35542. appendTo: useTooltipContentProps.appendTo,
  35543. title: String,
  35544. width: {
  35545. type: [String, Number],
  35546. default: 150
  35547. },
  35548. offset: {
  35549. type: Number,
  35550. default: void 0
  35551. },
  35552. showAfter: {
  35553. type: Number,
  35554. default: 0
  35555. },
  35556. hideAfter: {
  35557. type: Number,
  35558. default: 200
  35559. },
  35560. autoClose: {
  35561. type: Number,
  35562. default: 0
  35563. },
  35564. showArrow: {
  35565. type: Boolean,
  35566. default: true
  35567. },
  35568. persistent: {
  35569. type: Boolean,
  35570. default: true
  35571. },
  35572. "onUpdate:visible": { type: Function }
  35573. });
  35574. const popoverEmits = {
  35575. "update:visible": (value) => isBoolean(value),
  35576. "before-enter": () => true,
  35577. "before-leave": () => true,
  35578. "after-enter": () => true,
  35579. "after-leave": () => true
  35580. };
  35581. const popoverPropsDefaults = {
  35582. trigger: "hover",
  35583. triggerKeys: () => [
  35584. EVENT_CODE.enter,
  35585. EVENT_CODE.numpadEnter,
  35586. EVENT_CODE.space
  35587. ],
  35588. placement: "bottom",
  35589. visible: null,
  35590. popperOptions: () => ({}),
  35591. tabindex: 0,
  35592. content: "",
  35593. popperStyle: void 0,
  35594. enterable: true,
  35595. effect: "light",
  35596. teleported: true,
  35597. width: 150,
  35598. offset: void 0,
  35599. showAfter: 0,
  35600. hideAfter: 200,
  35601. autoClose: 0,
  35602. showArrow: true,
  35603. persistent: true
  35604. };
  35605. //#endregion
  35606. //#region ../../packages/components/popover/src/popover.vue?vue&type=script&setup=true&lang.ts
  35607. const updateEventKeyRaw = `onUpdate:visible`;
  35608. var popover_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  35609. name: "ElPopover",
  35610. __name: "popover",
  35611. props: popoverProps,
  35612. emits: popoverEmits,
  35613. setup(__props, { expose: __expose, emit: __emit }) {
  35614. const props = __props;
  35615. const emit = __emit;
  35616. const onUpdateVisible = computed(() => {
  35617. return props[updateEventKeyRaw];
  35618. });
  35619. const ns = useNamespace("popover");
  35620. const tooltipRef = ref();
  35621. const popperRef = computed(() => {
  35622. return unref(tooltipRef)?.popperRef;
  35623. });
  35624. const style = computed(() => {
  35625. return [{ width: addUnit(props.width) }, props.popperStyle];
  35626. });
  35627. const kls = computed(() => {
  35628. return [
  35629. ns.b(),
  35630. props.popperClass,
  35631. { [ns.m("plain")]: !!props.content }
  35632. ];
  35633. });
  35634. const gpuAcceleration = computed(() => {
  35635. return props.transition === `${ns.namespace.value}-fade-in-linear`;
  35636. });
  35637. const hide = () => {
  35638. tooltipRef.value?.hide();
  35639. };
  35640. const beforeEnter = () => {
  35641. emit("before-enter");
  35642. };
  35643. const beforeLeave = () => {
  35644. emit("before-leave");
  35645. };
  35646. const afterEnter = () => {
  35647. emit("after-enter");
  35648. };
  35649. const afterLeave = () => {
  35650. emit("update:visible", false);
  35651. emit("after-leave");
  35652. };
  35653. __expose({
  35654. popperRef,
  35655. hide
  35656. });
  35657. return (_ctx, _cache) => {
  35658. return openBlock(), createBlock(unref(ElTooltip), mergeProps({
  35659. ref_key: "tooltipRef",
  35660. ref: tooltipRef
  35661. }, _ctx.$attrs, {
  35662. trigger: __props.trigger,
  35663. "trigger-keys": __props.triggerKeys,
  35664. placement: __props.placement,
  35665. disabled: __props.disabled,
  35666. visible: __props.visible,
  35667. transition: __props.transition,
  35668. "popper-options": __props.popperOptions,
  35669. tabindex: __props.tabindex,
  35670. content: __props.content,
  35671. offset: __props.offset,
  35672. "show-after": __props.showAfter,
  35673. "hide-after": __props.hideAfter,
  35674. "auto-close": __props.autoClose,
  35675. "show-arrow": __props.showArrow,
  35676. "aria-label": __props.title,
  35677. effect: __props.effect,
  35678. enterable: __props.enterable,
  35679. "popper-class": kls.value,
  35680. "popper-style": style.value,
  35681. teleported: __props.teleported,
  35682. "append-to": __props.appendTo,
  35683. persistent: __props.persistent,
  35684. "gpu-acceleration": gpuAcceleration.value,
  35685. "onUpdate:visible": onUpdateVisible.value,
  35686. onBeforeShow: beforeEnter,
  35687. onBeforeHide: beforeLeave,
  35688. onShow: afterEnter,
  35689. onHide: afterLeave
  35690. }), {
  35691. content: withCtx(() => [__props.title ? (openBlock(), createElementBlock("div", {
  35692. key: 0,
  35693. class: normalizeClass(unref(ns).e("title")),
  35694. role: "title"
  35695. }, toDisplayString(__props.title), 3)) : createCommentVNode("v-if", true), renderSlot(_ctx.$slots, "default", { hide }, () => [createTextVNode(toDisplayString(__props.content), 1)])]),
  35696. default: withCtx(() => [_ctx.$slots.reference ? renderSlot(_ctx.$slots, "reference", { key: 0 }) : createCommentVNode("v-if", true)]),
  35697. _: 3
  35698. }, 16, [
  35699. "trigger",
  35700. "trigger-keys",
  35701. "placement",
  35702. "disabled",
  35703. "visible",
  35704. "transition",
  35705. "popper-options",
  35706. "tabindex",
  35707. "content",
  35708. "offset",
  35709. "show-after",
  35710. "hide-after",
  35711. "auto-close",
  35712. "show-arrow",
  35713. "aria-label",
  35714. "effect",
  35715. "enterable",
  35716. "popper-class",
  35717. "popper-style",
  35718. "teleported",
  35719. "append-to",
  35720. "persistent",
  35721. "gpu-acceleration",
  35722. "onUpdate:visible"
  35723. ]);
  35724. };
  35725. }
  35726. });
  35727. //#endregion
  35728. //#region ../../packages/components/popover/src/popover.vue
  35729. var popover_default = popover_vue_vue_type_script_setup_true_lang_default;
  35730. //#endregion
  35731. //#region ../../packages/components/popover/src/directive.ts
  35732. const attachEvents = (el, binding) => {
  35733. const popover = (binding.arg || binding.value)?.popperRef;
  35734. if (popover) popover.triggerRef = el;
  35735. };
  35736. var directive_default = {
  35737. mounted(el, binding) {
  35738. attachEvents(el, binding);
  35739. },
  35740. updated(el, binding) {
  35741. attachEvents(el, binding);
  35742. }
  35743. };
  35744. const VPopover = "popover";
  35745. //#endregion
  35746. //#region ../../packages/components/popover/index.ts
  35747. const ElPopoverDirective = withInstallDirective(directive_default, VPopover);
  35748. const ElPopover = withInstall(popover_default, { directive: ElPopoverDirective });
  35749. //#endregion
  35750. //#region ../../packages/components/progress/src/progress.ts
  35751. const progressProps = buildProps({
  35752. type: {
  35753. type: String,
  35754. default: "line",
  35755. values: [
  35756. "line",
  35757. "circle",
  35758. "dashboard"
  35759. ]
  35760. },
  35761. percentage: {
  35762. type: Number,
  35763. default: 0,
  35764. validator: (val) => val >= 0 && val <= 100
  35765. },
  35766. status: {
  35767. type: String,
  35768. default: "",
  35769. values: [
  35770. "",
  35771. "success",
  35772. "exception",
  35773. "warning"
  35774. ]
  35775. },
  35776. indeterminate: Boolean,
  35777. duration: {
  35778. type: Number,
  35779. default: 3
  35780. },
  35781. strokeWidth: {
  35782. type: Number,
  35783. default: 6
  35784. },
  35785. strokeLinecap: {
  35786. type: definePropType(String),
  35787. default: "round"
  35788. },
  35789. textInside: Boolean,
  35790. width: {
  35791. type: Number,
  35792. default: 126
  35793. },
  35794. showText: {
  35795. type: Boolean,
  35796. default: true
  35797. },
  35798. color: {
  35799. type: definePropType([
  35800. String,
  35801. Array,
  35802. Function
  35803. ]),
  35804. default: ""
  35805. },
  35806. striped: Boolean,
  35807. stripedFlow: Boolean,
  35808. format: {
  35809. type: definePropType(Function),
  35810. default: (percentage) => `${percentage}%`
  35811. }
  35812. });
  35813. //#endregion
  35814. //#region ../../packages/components/progress/src/progress.vue?vue&type=script&setup=true&lang.ts
  35815. const _hoisted_1$24 = ["aria-valuenow"];
  35816. const _hoisted_2$15 = { viewBox: "0 0 100 100" };
  35817. const _hoisted_3$6 = [
  35818. "d",
  35819. "stroke",
  35820. "stroke-linecap",
  35821. "stroke-width"
  35822. ];
  35823. const _hoisted_4$4 = [
  35824. "d",
  35825. "stroke",
  35826. "opacity",
  35827. "stroke-linecap",
  35828. "stroke-width"
  35829. ];
  35830. const _hoisted_5$2 = { key: 0 };
  35831. var progress_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  35832. name: "ElProgress",
  35833. __name: "progress",
  35834. props: progressProps,
  35835. setup(__props) {
  35836. const STATUS_COLOR_MAP = {
  35837. success: "#13ce66",
  35838. exception: "#ff4949",
  35839. warning: "#e6a23c",
  35840. default: "#20a0ff"
  35841. };
  35842. const props = __props;
  35843. const ns = useNamespace("progress");
  35844. const barStyle = computed(() => {
  35845. const barStyle = {
  35846. width: `${props.percentage}%`,
  35847. animationDuration: `${props.duration}s`
  35848. };
  35849. const color = getCurrentColor(props.percentage);
  35850. if (color.includes("gradient")) barStyle.background = color;
  35851. else barStyle.backgroundColor = color;
  35852. return barStyle;
  35853. });
  35854. const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
  35855. const radius = computed(() => {
  35856. if (["circle", "dashboard"].includes(props.type)) return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
  35857. return 0;
  35858. });
  35859. const trackPath = computed(() => {
  35860. const r = radius.value;
  35861. const isDashboard = props.type === "dashboard";
  35862. return `
  35863. M 50 50
  35864. m 0 ${isDashboard ? "" : "-"}${r}
  35865. a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
  35866. a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
  35867. `;
  35868. });
  35869. const perimeter = computed(() => 2 * Math.PI * radius.value);
  35870. const rate = computed(() => props.type === "dashboard" ? .75 : 1);
  35871. const strokeDashoffset = computed(() => {
  35872. return `${-1 * perimeter.value * (1 - rate.value) / 2}px`;
  35873. });
  35874. const trailPathStyle = computed(() => ({
  35875. strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
  35876. strokeDashoffset: strokeDashoffset.value
  35877. }));
  35878. const circlePathStyle = computed(() => ({
  35879. strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
  35880. strokeDashoffset: strokeDashoffset.value,
  35881. transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
  35882. }));
  35883. const stroke = computed(() => {
  35884. let ret;
  35885. if (props.color) ret = getCurrentColor(props.percentage);
  35886. else ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
  35887. return ret;
  35888. });
  35889. const statusIcon = computed(() => {
  35890. if (props.status === "warning") return warning_filled_default;
  35891. if (props.type === "line") return props.status === "success" ? circle_check_default : circle_close_default;
  35892. else return props.status === "success" ? check_default : close_default;
  35893. });
  35894. const progressTextSize = computed(() => {
  35895. return props.type === "line" ? 12 + props.strokeWidth * .4 : props.width * .111111 + 2;
  35896. });
  35897. const content = computed(() => props.format(props.percentage));
  35898. function getColors(color) {
  35899. const span = 100 / color.length;
  35900. return color.map((seriesColor, index) => {
  35901. if (isString(seriesColor)) return {
  35902. color: seriesColor,
  35903. percentage: (index + 1) * span
  35904. };
  35905. return seriesColor;
  35906. }).sort((a, b) => a.percentage - b.percentage);
  35907. }
  35908. const getCurrentColor = (percentage) => {
  35909. const { color } = props;
  35910. if (isFunction$1(color)) return color(percentage);
  35911. else if (isString(color)) return color;
  35912. else {
  35913. const colors = getColors(color);
  35914. for (const color of colors) if (color.percentage > percentage) return color.color;
  35915. return colors[colors.length - 1]?.color;
  35916. }
  35917. };
  35918. return (_ctx, _cache) => {
  35919. return openBlock(), createElementBlock("div", {
  35920. class: normalizeClass([
  35921. unref(ns).b(),
  35922. unref(ns).m(__props.type),
  35923. unref(ns).is(__props.status),
  35924. {
  35925. [unref(ns).m("without-text")]: !__props.showText,
  35926. [unref(ns).m("text-inside")]: __props.textInside
  35927. }
  35928. ]),
  35929. role: "progressbar",
  35930. "aria-valuenow": __props.percentage,
  35931. "aria-valuemin": "0",
  35932. "aria-valuemax": "100"
  35933. }, [__props.type === "line" ? (openBlock(), createElementBlock("div", {
  35934. key: 0,
  35935. class: normalizeClass(unref(ns).b("bar"))
  35936. }, [createElementVNode("div", {
  35937. class: normalizeClass(unref(ns).be("bar", "outer")),
  35938. style: normalizeStyle({ height: `${__props.strokeWidth}px` })
  35939. }, [createElementVNode("div", {
  35940. class: normalizeClass([
  35941. unref(ns).be("bar", "inner"),
  35942. { [unref(ns).bem("bar", "inner", "indeterminate")]: __props.indeterminate },
  35943. { [unref(ns).bem("bar", "inner", "striped")]: __props.striped },
  35944. { [unref(ns).bem("bar", "inner", "striped-flow")]: __props.stripedFlow }
  35945. ]),
  35946. style: normalizeStyle(barStyle.value)
  35947. }, [(__props.showText || _ctx.$slots.default) && __props.textInside ? (openBlock(), createElementBlock("div", {
  35948. key: 0,
  35949. class: normalizeClass(unref(ns).be("bar", "innerText"))
  35950. }, [renderSlot(_ctx.$slots, "default", { percentage: __props.percentage }, () => [createElementVNode("span", null, toDisplayString(content.value), 1)])], 2)) : createCommentVNode("v-if", true)], 6)], 6)], 2)) : (openBlock(), createElementBlock("div", {
  35951. key: 1,
  35952. class: normalizeClass(unref(ns).b("circle")),
  35953. style: normalizeStyle({
  35954. height: `${__props.width}px`,
  35955. width: `${__props.width}px`
  35956. })
  35957. }, [(openBlock(), createElementBlock("svg", _hoisted_2$15, [createElementVNode("path", {
  35958. class: normalizeClass(unref(ns).be("circle", "track")),
  35959. d: trackPath.value,
  35960. stroke: `var(${unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
  35961. "stroke-linecap": __props.strokeLinecap,
  35962. "stroke-width": relativeStrokeWidth.value,
  35963. fill: "none",
  35964. style: normalizeStyle(trailPathStyle.value)
  35965. }, null, 14, _hoisted_3$6), createElementVNode("path", {
  35966. class: normalizeClass(unref(ns).be("circle", "path")),
  35967. d: trackPath.value,
  35968. stroke: stroke.value,
  35969. fill: "none",
  35970. opacity: __props.percentage ? 1 : 0,
  35971. "stroke-linecap": __props.strokeLinecap,
  35972. "stroke-width": relativeStrokeWidth.value,
  35973. style: normalizeStyle(circlePathStyle.value)
  35974. }, null, 14, _hoisted_4$4)]))], 6)), (__props.showText || _ctx.$slots.default) && !__props.textInside ? (openBlock(), createElementBlock("div", {
  35975. key: 2,
  35976. class: normalizeClass(unref(ns).e("text")),
  35977. style: normalizeStyle({ fontSize: `${progressTextSize.value}px` })
  35978. }, [renderSlot(_ctx.$slots, "default", { percentage: __props.percentage }, () => [!__props.status ? (openBlock(), createElementBlock("span", _hoisted_5$2, toDisplayString(content.value), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  35979. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(statusIcon.value)))]),
  35980. _: 1
  35981. }))])], 6)) : createCommentVNode("v-if", true)], 10, _hoisted_1$24);
  35982. };
  35983. }
  35984. });
  35985. //#endregion
  35986. //#region ../../packages/components/progress/src/progress.vue
  35987. var progress_default = progress_vue_vue_type_script_setup_true_lang_default;
  35988. //#endregion
  35989. //#region ../../packages/components/progress/index.ts
  35990. const ElProgress = withInstall(progress_default);
  35991. //#endregion
  35992. //#region ../../packages/components/rate/src/rate.ts
  35993. const rateProps = buildProps({
  35994. modelValue: {
  35995. type: Number,
  35996. default: 0
  35997. },
  35998. id: {
  35999. type: String,
  36000. default: void 0
  36001. },
  36002. lowThreshold: {
  36003. type: Number,
  36004. default: 2
  36005. },
  36006. highThreshold: {
  36007. type: Number,
  36008. default: 4
  36009. },
  36010. max: {
  36011. type: Number,
  36012. default: 5
  36013. },
  36014. colors: {
  36015. type: definePropType([Array, Object]),
  36016. default: () => mutable([
  36017. "",
  36018. "",
  36019. ""
  36020. ])
  36021. },
  36022. voidColor: {
  36023. type: String,
  36024. default: ""
  36025. },
  36026. disabledVoidColor: {
  36027. type: String,
  36028. default: ""
  36029. },
  36030. icons: {
  36031. type: definePropType([Array, Object]),
  36032. default: () => [
  36033. star_filled_default,
  36034. star_filled_default,
  36035. star_filled_default
  36036. ]
  36037. },
  36038. voidIcon: {
  36039. type: iconPropType,
  36040. default: () => star_default
  36041. },
  36042. disabledVoidIcon: {
  36043. type: iconPropType,
  36044. default: () => star_filled_default
  36045. },
  36046. disabled: {
  36047. type: Boolean,
  36048. default: void 0
  36049. },
  36050. allowHalf: Boolean,
  36051. showText: Boolean,
  36052. showScore: Boolean,
  36053. textColor: {
  36054. type: String,
  36055. default: ""
  36056. },
  36057. texts: {
  36058. type: definePropType(Array),
  36059. default: () => mutable([
  36060. "Extremely bad",
  36061. "Disappointed",
  36062. "Fair",
  36063. "Satisfied",
  36064. "Surprise"
  36065. ])
  36066. },
  36067. scoreTemplate: {
  36068. type: String,
  36069. default: "{value}"
  36070. },
  36071. size: useSizeProp,
  36072. clearable: Boolean,
  36073. ...useAriaProps(["ariaLabel"])
  36074. });
  36075. const rateEmits = {
  36076. [CHANGE_EVENT]: (value) => isNumber(value),
  36077. [UPDATE_MODEL_EVENT]: (value) => isNumber(value)
  36078. };
  36079. //#endregion
  36080. //#region ../../packages/components/rate/src/rate.vue?vue&type=script&setup=true&lang.ts
  36081. const _hoisted_1$23 = [
  36082. "id",
  36083. "aria-label",
  36084. "aria-labelledby",
  36085. "aria-valuenow",
  36086. "aria-valuetext",
  36087. "aria-valuemax",
  36088. "tabindex",
  36089. "aria-disabled"
  36090. ];
  36091. const _hoisted_2$14 = ["onMousemove", "onClick"];
  36092. var rate_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  36093. name: "ElRate",
  36094. __name: "rate",
  36095. props: rateProps,
  36096. emits: rateEmits,
  36097. setup(__props, { expose: __expose, emit: __emit }) {
  36098. function getValueFromMap(value, map) {
  36099. const isExcludedObject = (val) => isObject$1(val);
  36100. const matchedValue = map[Object.keys(map).map((key) => +key).filter((key) => {
  36101. const val = map[key];
  36102. return (isExcludedObject(val) ? val.excluded : false) ? value < key : value <= key;
  36103. }).sort((a, b) => a - b)[0]];
  36104. return isExcludedObject(matchedValue) && matchedValue.value || matchedValue;
  36105. }
  36106. const props = __props;
  36107. const emit = __emit;
  36108. const formItemContext = inject(formItemContextKey, void 0);
  36109. const rateSize = useFormSize();
  36110. const ns = useNamespace("rate");
  36111. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, { formItemContext });
  36112. const currentValue = ref(clamp$1(props.modelValue, 0, props.max));
  36113. const hoverIndex = ref(-1);
  36114. const pointerAtLeftHalf = ref(true);
  36115. const iconRefs = ref([]);
  36116. const iconClientWidths = computed(() => iconRefs.value.map((icon) => icon.$el.clientWidth));
  36117. const rateClasses = computed(() => [ns.b(), ns.m(rateSize.value)]);
  36118. const rateDisabled = useFormDisabled();
  36119. const rateStyles = computed(() => {
  36120. return ns.cssVarBlock({
  36121. "void-color": props.voidColor,
  36122. "disabled-void-color": props.disabledVoidColor,
  36123. "fill-color": activeColor.value
  36124. });
  36125. });
  36126. const text = computed(() => {
  36127. let result = "";
  36128. if (props.showScore) result = props.scoreTemplate.replace(/\{\s*value\s*\}/, rateDisabled.value ? `${props.modelValue}` : `${currentValue.value}`);
  36129. else if (props.showText) result = props.texts[Math.ceil(currentValue.value) - 1];
  36130. return result;
  36131. });
  36132. const valueDecimal = computed(() => props.modelValue * 100 - Math.floor(props.modelValue) * 100);
  36133. const colorMap = computed(() => isArray$1(props.colors) ? {
  36134. [props.lowThreshold]: props.colors[0],
  36135. [props.highThreshold]: {
  36136. value: props.colors[1],
  36137. excluded: true
  36138. },
  36139. [props.max]: props.colors[2]
  36140. } : props.colors);
  36141. const activeColor = computed(() => {
  36142. const color = getValueFromMap(currentValue.value, colorMap.value);
  36143. return isObject$1(color) ? "" : color;
  36144. });
  36145. const decimalStyle = computed(() => {
  36146. let width = "";
  36147. if (rateDisabled.value) width = `${valueDecimal.value}%`;
  36148. else if (props.allowHalf) width = "50%";
  36149. return {
  36150. color: activeColor.value,
  36151. width
  36152. };
  36153. });
  36154. const componentMap = computed(() => {
  36155. let icons = isArray$1(props.icons) ? [...props.icons] : { ...props.icons };
  36156. icons = markRaw(icons);
  36157. return isArray$1(icons) ? {
  36158. [props.lowThreshold]: icons[0],
  36159. [props.highThreshold]: {
  36160. value: icons[1],
  36161. excluded: true
  36162. },
  36163. [props.max]: icons[2]
  36164. } : icons;
  36165. });
  36166. const decimalIconComponent = computed(() => getValueFromMap(props.modelValue, componentMap.value));
  36167. const voidComponent = computed(() => rateDisabled.value ? isString(props.disabledVoidIcon) ? props.disabledVoidIcon : markRaw(props.disabledVoidIcon) : isString(props.voidIcon) ? props.voidIcon : markRaw(props.voidIcon));
  36168. const activeComponent = computed(() => getValueFromMap(currentValue.value, componentMap.value));
  36169. function showDecimalIcon(item) {
  36170. const showWhenDisabled = rateDisabled.value && valueDecimal.value > 0 && item - 1 < props.modelValue && item > props.modelValue;
  36171. const showWhenAllowHalf = props.allowHalf && pointerAtLeftHalf.value && item - .5 <= currentValue.value && item > currentValue.value;
  36172. return showWhenDisabled || showWhenAllowHalf;
  36173. }
  36174. function emitValue(value) {
  36175. if (props.clearable && value === props.modelValue) value = 0;
  36176. emit(UPDATE_MODEL_EVENT, value);
  36177. if (props.modelValue !== value) emit(CHANGE_EVENT, value);
  36178. }
  36179. function selectValue(value) {
  36180. if (rateDisabled.value) return;
  36181. if (props.allowHalf && pointerAtLeftHalf.value) emitValue(currentValue.value);
  36182. else emitValue(value);
  36183. }
  36184. function handleKey(e) {
  36185. if (rateDisabled.value) return;
  36186. const code = getEventCode(e);
  36187. const step = props.allowHalf ? .5 : 1;
  36188. let _currentValue = currentValue.value;
  36189. switch (code) {
  36190. case EVENT_CODE.up:
  36191. case EVENT_CODE.right:
  36192. _currentValue += step;
  36193. break;
  36194. case EVENT_CODE.left:
  36195. case EVENT_CODE.down:
  36196. _currentValue -= step;
  36197. break;
  36198. }
  36199. _currentValue = clamp$1(_currentValue, 0, props.max);
  36200. if (_currentValue === currentValue.value) return;
  36201. e.stopPropagation();
  36202. e.preventDefault();
  36203. emit(UPDATE_MODEL_EVENT, _currentValue);
  36204. emit(CHANGE_EVENT, _currentValue);
  36205. return _currentValue;
  36206. }
  36207. function setCurrentValue(value, event) {
  36208. if (rateDisabled.value) return;
  36209. if (props.allowHalf && event) {
  36210. pointerAtLeftHalf.value = event.offsetX * 2 <= iconClientWidths.value[value - 1];
  36211. currentValue.value = pointerAtLeftHalf.value ? value - .5 : value;
  36212. } else currentValue.value = value;
  36213. hoverIndex.value = value;
  36214. }
  36215. function resetCurrentValue() {
  36216. if (rateDisabled.value) return;
  36217. if (props.allowHalf) pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  36218. currentValue.value = clamp$1(props.modelValue, 0, props.max);
  36219. hoverIndex.value = -1;
  36220. }
  36221. watch(() => props.modelValue, (val) => {
  36222. currentValue.value = clamp$1(val, 0, props.max);
  36223. pointerAtLeftHalf.value = props.modelValue !== Math.floor(props.modelValue);
  36224. });
  36225. if (!props.modelValue) emit(UPDATE_MODEL_EVENT, 0);
  36226. __expose({
  36227. setCurrentValue,
  36228. resetCurrentValue
  36229. });
  36230. return (_ctx, _cache) => {
  36231. return openBlock(), createElementBlock("div", {
  36232. id: unref(inputId),
  36233. class: normalizeClass([rateClasses.value, unref(ns).is("disabled", unref(rateDisabled))]),
  36234. role: "slider",
  36235. "aria-label": !unref(isLabeledByFormItem) ? __props.ariaLabel || "rating" : void 0,
  36236. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItemContext)?.labelId : void 0,
  36237. "aria-valuenow": currentValue.value,
  36238. "aria-valuetext": text.value || void 0,
  36239. "aria-valuemin": "0",
  36240. "aria-valuemax": __props.max,
  36241. style: normalizeStyle(rateStyles.value),
  36242. tabindex: unref(rateDisabled) ? void 0 : 0,
  36243. "aria-disabled": unref(rateDisabled),
  36244. onKeydown: handleKey
  36245. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.max, (item, key) => {
  36246. return openBlock(), createElementBlock("span", {
  36247. key,
  36248. class: normalizeClass(unref(ns).e("item")),
  36249. onMousemove: ($event) => setCurrentValue(item, $event),
  36250. onMouseleave: resetCurrentValue,
  36251. onClick: ($event) => selectValue(item)
  36252. }, [createVNode(unref(ElIcon), {
  36253. ref_for: true,
  36254. ref_key: "iconRefs",
  36255. ref: iconRefs,
  36256. class: normalizeClass([
  36257. unref(ns).e("icon"),
  36258. { hover: hoverIndex.value === item },
  36259. unref(ns).is("active", item <= currentValue.value),
  36260. unref(ns).is("focus-visible", item === Math.ceil(currentValue.value || 1))
  36261. ])
  36262. }, {
  36263. default: withCtx(() => [
  36264. withDirectives((openBlock(), createBlock(resolveDynamicComponent(activeComponent.value), null, null, 512)), [[vShow, !showDecimalIcon(item) && item <= currentValue.value]]),
  36265. withDirectives((openBlock(), createBlock(resolveDynamicComponent(voidComponent.value), null, null, 512)), [[vShow, !showDecimalIcon(item) && item > currentValue.value]]),
  36266. withDirectives((openBlock(), createBlock(resolveDynamicComponent(voidComponent.value), { class: normalizeClass([unref(ns).em("decimal", "box")]) }, null, 8, ["class"])), [[vShow, showDecimalIcon(item)]]),
  36267. withDirectives(createVNode(unref(ElIcon), {
  36268. style: normalizeStyle(decimalStyle.value),
  36269. class: normalizeClass([unref(ns).e("icon"), unref(ns).e("decimal")])
  36270. }, {
  36271. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(decimalIconComponent.value)))]),
  36272. _: 1
  36273. }, 8, ["style", "class"]), [[vShow, showDecimalIcon(item)]])
  36274. ]),
  36275. _: 2
  36276. }, 1032, ["class"])], 42, _hoisted_2$14);
  36277. }), 128)), __props.showText || __props.showScore ? (openBlock(), createElementBlock("span", {
  36278. key: 0,
  36279. class: normalizeClass(unref(ns).e("text")),
  36280. style: normalizeStyle({ color: __props.textColor })
  36281. }, toDisplayString(text.value), 7)) : createCommentVNode("v-if", true)], 46, _hoisted_1$23);
  36282. };
  36283. }
  36284. });
  36285. //#endregion
  36286. //#region ../../packages/components/rate/src/rate.vue
  36287. var rate_default = rate_vue_vue_type_script_setup_true_lang_default;
  36288. //#endregion
  36289. //#region ../../packages/components/rate/index.ts
  36290. const ElRate = withInstall(rate_default);
  36291. //#endregion
  36292. //#region ../../packages/components/result/src/result.ts
  36293. const IconMap = {
  36294. primary: "icon-primary",
  36295. success: "icon-success",
  36296. warning: "icon-warning",
  36297. error: "icon-error",
  36298. info: "icon-info"
  36299. };
  36300. const IconComponentMap = {
  36301. [IconMap.primary]: info_filled_default,
  36302. [IconMap.success]: circle_check_filled_default,
  36303. [IconMap.warning]: warning_filled_default,
  36304. [IconMap.error]: circle_close_filled_default,
  36305. [IconMap.info]: info_filled_default
  36306. };
  36307. const resultProps = buildProps({
  36308. title: {
  36309. type: String,
  36310. default: ""
  36311. },
  36312. subTitle: {
  36313. type: String,
  36314. default: ""
  36315. },
  36316. icon: {
  36317. type: String,
  36318. values: [
  36319. "primary",
  36320. "success",
  36321. "warning",
  36322. "info",
  36323. "error"
  36324. ],
  36325. default: "info"
  36326. }
  36327. });
  36328. //#endregion
  36329. //#region ../../packages/components/result/src/result.vue?vue&type=script&setup=true&lang.ts
  36330. var result_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  36331. name: "ElResult",
  36332. __name: "result",
  36333. props: resultProps,
  36334. setup(__props) {
  36335. const props = __props;
  36336. const ns = useNamespace("result");
  36337. const resultIcon = computed(() => {
  36338. const icon = props.icon;
  36339. const iconClass = icon && IconMap[icon] ? IconMap[icon] : "icon-info";
  36340. return {
  36341. class: iconClass,
  36342. component: IconComponentMap[iconClass] || IconComponentMap["icon-info"]
  36343. };
  36344. });
  36345. return (_ctx, _cache) => {
  36346. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b()) }, [
  36347. createElementVNode("div", { class: normalizeClass(unref(ns).e("icon")) }, [renderSlot(_ctx.$slots, "icon", {}, () => [resultIcon.value.component ? (openBlock(), createBlock(resolveDynamicComponent(resultIcon.value.component), {
  36348. key: 0,
  36349. class: normalizeClass(resultIcon.value.class)
  36350. }, null, 8, ["class"])) : createCommentVNode("v-if", true)])], 2),
  36351. __props.title || _ctx.$slots.title ? (openBlock(), createElementBlock("div", {
  36352. key: 0,
  36353. class: normalizeClass(unref(ns).e("title"))
  36354. }, [renderSlot(_ctx.$slots, "title", {}, () => [createElementVNode("p", null, toDisplayString(__props.title), 1)])], 2)) : createCommentVNode("v-if", true),
  36355. __props.subTitle || _ctx.$slots["sub-title"] ? (openBlock(), createElementBlock("div", {
  36356. key: 1,
  36357. class: normalizeClass(unref(ns).e("subtitle"))
  36358. }, [renderSlot(_ctx.$slots, "sub-title", {}, () => [createElementVNode("p", null, toDisplayString(__props.subTitle), 1)])], 2)) : createCommentVNode("v-if", true),
  36359. _ctx.$slots.extra ? (openBlock(), createElementBlock("div", {
  36360. key: 2,
  36361. class: normalizeClass(unref(ns).e("extra"))
  36362. }, [renderSlot(_ctx.$slots, "extra")], 2)) : createCommentVNode("v-if", true)
  36363. ], 2);
  36364. };
  36365. }
  36366. });
  36367. //#endregion
  36368. //#region ../../packages/components/result/src/result.vue
  36369. var result_default = result_vue_vue_type_script_setup_true_lang_default;
  36370. //#endregion
  36371. //#region ../../packages/components/result/index.ts
  36372. const ElResult = withInstall(result_default);
  36373. //#endregion
  36374. //#region ../../packages/components/select-v2/src/group-item.vue?vue&type=script&lang.ts
  36375. var group_item_vue_vue_type_script_lang_default = defineComponent({
  36376. props: {
  36377. item: {
  36378. type: Object,
  36379. required: true
  36380. },
  36381. style: { type: Object },
  36382. height: Number
  36383. },
  36384. setup() {
  36385. return { ns: useNamespace("select") };
  36386. }
  36387. });
  36388. //#endregion
  36389. //#region ../../packages/components/select-v2/src/group-item.vue
  36390. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  36391. return openBlock(), createElementBlock("div", {
  36392. class: normalizeClass(_ctx.ns.be("group", "title")),
  36393. style: normalizeStyle({
  36394. ..._ctx.style,
  36395. lineHeight: `${_ctx.height}px`
  36396. })
  36397. }, toDisplayString(_ctx.item.label), 7);
  36398. }
  36399. var group_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(group_item_vue_vue_type_script_lang_default, [["render", _sfc_render$6]]);
  36400. //#endregion
  36401. //#region ../../packages/components/select-v2/src/useOption.ts
  36402. function useOption(props, { emit }) {
  36403. return {
  36404. hoverItem: () => {
  36405. if (!props.disabled) emit("hover", props.index);
  36406. },
  36407. selectOptionClick: () => {
  36408. if (!props.disabled) emit("select", props.item, props.index);
  36409. }
  36410. };
  36411. }
  36412. //#endregion
  36413. //#region ../../packages/components/select-v2/src/defaults.ts
  36414. const selectV2Props = buildProps({
  36415. allowCreate: Boolean,
  36416. autocomplete: {
  36417. type: definePropType(String),
  36418. default: "none"
  36419. },
  36420. automaticDropdown: Boolean,
  36421. clearable: Boolean,
  36422. clearIcon: {
  36423. type: iconPropType,
  36424. default: circle_close_default
  36425. },
  36426. effect: {
  36427. type: definePropType(String),
  36428. default: "light"
  36429. },
  36430. collapseTags: Boolean,
  36431. collapseTagsTooltip: Boolean,
  36432. tagTooltip: {
  36433. type: definePropType(Object),
  36434. default: () => ({})
  36435. },
  36436. maxCollapseTags: {
  36437. type: Number,
  36438. default: 1
  36439. },
  36440. defaultFirstOption: Boolean,
  36441. disabled: {
  36442. type: Boolean,
  36443. default: void 0
  36444. },
  36445. estimatedOptionHeight: {
  36446. type: Number,
  36447. default: void 0
  36448. },
  36449. filterable: Boolean,
  36450. filterMethod: { type: definePropType(Function) },
  36451. height: {
  36452. type: Number,
  36453. default: 274
  36454. },
  36455. itemHeight: {
  36456. type: Number,
  36457. default: 34
  36458. },
  36459. id: String,
  36460. loading: Boolean,
  36461. loadingText: String,
  36462. modelValue: {
  36463. type: definePropType([
  36464. Array,
  36465. String,
  36466. Number,
  36467. Boolean,
  36468. Object
  36469. ]),
  36470. default: void 0
  36471. },
  36472. multiple: Boolean,
  36473. multipleLimit: {
  36474. type: Number,
  36475. default: 0
  36476. },
  36477. name: String,
  36478. noDataText: String,
  36479. noMatchText: String,
  36480. remoteMethod: { type: definePropType(Function) },
  36481. reserveKeyword: {
  36482. type: Boolean,
  36483. default: true
  36484. },
  36485. options: {
  36486. type: definePropType(Array),
  36487. required: true
  36488. },
  36489. placeholder: { type: String },
  36490. teleported: useTooltipContentProps.teleported,
  36491. persistent: {
  36492. type: Boolean,
  36493. default: true
  36494. },
  36495. popperClass: useTooltipContentProps.popperClass,
  36496. popperStyle: useTooltipContentProps.popperStyle,
  36497. popperOptions: {
  36498. type: definePropType(Object),
  36499. default: () => ({})
  36500. },
  36501. remote: Boolean,
  36502. debounce: {
  36503. type: Number,
  36504. default: 300
  36505. },
  36506. size: useSizeProp,
  36507. props: {
  36508. type: definePropType(Object),
  36509. default: () => defaultProps$2
  36510. },
  36511. valueKey: {
  36512. type: String,
  36513. default: "value"
  36514. },
  36515. scrollbarAlwaysOn: Boolean,
  36516. validateEvent: {
  36517. type: Boolean,
  36518. default: true
  36519. },
  36520. offset: {
  36521. type: Number,
  36522. default: 12
  36523. },
  36524. remoteShowSuffix: Boolean,
  36525. showArrow: {
  36526. type: Boolean,
  36527. default: true
  36528. },
  36529. placement: {
  36530. type: definePropType(String),
  36531. values: Ee,
  36532. default: "bottom-start"
  36533. },
  36534. fallbackPlacements: {
  36535. type: definePropType(Array),
  36536. default: [
  36537. "bottom-start",
  36538. "top-start",
  36539. "right",
  36540. "left"
  36541. ]
  36542. },
  36543. tagType: {
  36544. ...tagProps.type,
  36545. default: "info"
  36546. },
  36547. tagEffect: {
  36548. ...tagProps.effect,
  36549. default: "light"
  36550. },
  36551. tabindex: {
  36552. type: [String, Number],
  36553. default: 0
  36554. },
  36555. appendTo: useTooltipContentProps.appendTo,
  36556. fitInputWidth: {
  36557. type: [Boolean, Number],
  36558. default: true,
  36559. validator(val) {
  36560. return isBoolean(val) || isNumber(val);
  36561. }
  36562. },
  36563. suffixIcon: {
  36564. type: iconPropType,
  36565. default: arrow_down_default
  36566. },
  36567. ...useEmptyValuesProps,
  36568. ...useAriaProps(["ariaLabel"])
  36569. });
  36570. const optionV2Props = buildProps({
  36571. data: Array,
  36572. disabled: Boolean,
  36573. hovering: Boolean,
  36574. item: {
  36575. type: definePropType(Object),
  36576. required: true
  36577. },
  36578. index: Number,
  36579. style: Object,
  36580. selected: Boolean,
  36581. created: Boolean
  36582. });
  36583. const selectV2Emits = {
  36584. [UPDATE_MODEL_EVENT]: (val) => true,
  36585. [CHANGE_EVENT]: (val) => true,
  36586. "end-reached": scrollbarEmits["end-reached"],
  36587. "remove-tag": (val) => true,
  36588. "visible-change": (visible) => true,
  36589. focus: (evt) => evt instanceof FocusEvent,
  36590. blur: (evt) => evt instanceof FocusEvent,
  36591. clear: () => true
  36592. };
  36593. const optionV2Emits = {
  36594. hover: (index) => isNumber(index),
  36595. select: (val, index) => true
  36596. };
  36597. //#endregion
  36598. //#region ../../packages/components/select-v2/src/token.ts
  36599. const selectV2InjectionKey = Symbol("ElSelectV2Injection");
  36600. //#endregion
  36601. //#region ../../packages/components/select-v2/src/option-item.vue?vue&type=script&lang.ts
  36602. var option_item_vue_vue_type_script_lang_default = defineComponent({
  36603. props: optionV2Props,
  36604. emits: optionV2Emits,
  36605. setup(props, { emit }) {
  36606. const select = inject(selectV2InjectionKey);
  36607. const ns = useNamespace("select");
  36608. const mouseMoveEventName = isIOS ? null : "mousemove";
  36609. const { hoverItem, selectOptionClick } = useOption(props, { emit });
  36610. const { getLabel } = useProps(select.props);
  36611. const contentId = select.contentId;
  36612. const handleMousedown = (event) => {
  36613. let target = event.target;
  36614. const currentTarget = event.currentTarget;
  36615. while (target && target !== currentTarget) {
  36616. if (isFocusable(target)) return;
  36617. target = target.parentElement;
  36618. }
  36619. event.preventDefault();
  36620. };
  36621. return {
  36622. ns,
  36623. contentId,
  36624. mouseMoveEventName,
  36625. hoverItem,
  36626. handleMousedown,
  36627. selectOptionClick,
  36628. getLabel
  36629. };
  36630. }
  36631. });
  36632. //#endregion
  36633. //#region ../../packages/components/select-v2/src/option-item.vue
  36634. const _hoisted_1$22 = [
  36635. "id",
  36636. "aria-selected",
  36637. "aria-disabled"
  36638. ];
  36639. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  36640. return openBlock(), createElementBlock("li", mergeProps({
  36641. id: `${_ctx.contentId}-${_ctx.index}`,
  36642. role: "option",
  36643. "aria-selected": _ctx.selected,
  36644. "aria-disabled": _ctx.disabled || void 0,
  36645. style: _ctx.style,
  36646. class: [
  36647. _ctx.ns.be("dropdown", "item"),
  36648. _ctx.ns.is("selected", _ctx.selected),
  36649. _ctx.ns.is("disabled", _ctx.disabled),
  36650. _ctx.ns.is("created", _ctx.created),
  36651. _ctx.ns.is("hovering", _ctx.hovering)
  36652. ]
  36653. }, { [toHandlerKey(_ctx.mouseMoveEventName)]: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)) }, {
  36654. onMousedown: _cache[1] || (_cache[1] = (...args) => _ctx.handleMousedown && _ctx.handleMousedown(...args)),
  36655. onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  36656. }), [renderSlot(_ctx.$slots, "default", {
  36657. item: _ctx.item,
  36658. index: _ctx.index,
  36659. disabled: _ctx.disabled
  36660. }, () => [createElementVNode("span", null, toDisplayString(_ctx.getLabel(_ctx.item)), 1)])], 16, _hoisted_1$22);
  36661. }
  36662. var option_item_default = /* @__PURE__ */ _plugin_vue_export_helper_default(option_item_vue_vue_type_script_lang_default, [["render", _sfc_render$5]]);
  36663. //#endregion
  36664. //#region ../../packages/components/select-v2/src/select-dropdown.tsx
  36665. const props = {
  36666. loading: Boolean,
  36667. data: {
  36668. type: Array,
  36669. required: true
  36670. },
  36671. hoveringIndex: Number,
  36672. width: Number,
  36673. id: String,
  36674. ariaLabel: String
  36675. };
  36676. var select_dropdown_default = /* @__PURE__ */ defineComponent({
  36677. name: "ElSelectDropdown",
  36678. props,
  36679. emits: { "end-reached": scrollbarEmits["end-reached"] },
  36680. setup(props, { slots, expose, emit }) {
  36681. const select = inject(selectV2InjectionKey);
  36682. const ns = useNamespace("select");
  36683. const { getLabel, getValue, getDisabled } = useProps(select.props);
  36684. const cachedHeights = ref([]);
  36685. const listRef = ref();
  36686. const size = computed(() => props.data.length);
  36687. watch(() => size.value, () => {
  36688. select.tooltipRef.value?.updatePopper?.();
  36689. });
  36690. const isSized = computed(() => isUndefined(select.props.estimatedOptionHeight));
  36691. const listProps = computed(() => {
  36692. if (isSized.value) return { itemSize: select.props.itemHeight };
  36693. return {
  36694. estimatedSize: select.props.estimatedOptionHeight,
  36695. itemSize: (idx) => cachedHeights.value[idx]
  36696. };
  36697. });
  36698. const contains = (arr = [], target) => {
  36699. const { props: { valueKey } } = select;
  36700. if (!isObject$1(target)) return arr.includes(target);
  36701. return arr && arr.some((item) => {
  36702. return toRaw(get(item, valueKey)) === get(target, valueKey);
  36703. });
  36704. };
  36705. const isEqual = (selected, target) => {
  36706. if (!isObject$1(target)) return selected === target;
  36707. else {
  36708. const { valueKey } = select.props;
  36709. return get(selected, valueKey) === get(target, valueKey);
  36710. }
  36711. };
  36712. const isItemSelected = (modelValue, target) => {
  36713. if (select.props.multiple) return contains(modelValue, getValue(target));
  36714. return isEqual(modelValue, getValue(target));
  36715. };
  36716. const isItemDisabled = (modelValue, selected) => {
  36717. const { disabled, multiple, multipleLimit } = select.props;
  36718. return disabled || !selected && (multiple ? multipleLimit > 0 && modelValue.length >= multipleLimit : false);
  36719. };
  36720. const isItemHovering = (target) => props.hoveringIndex === target;
  36721. const scrollToItem = (index) => {
  36722. const list = listRef.value;
  36723. if (list) list.scrollToItem(index);
  36724. };
  36725. const resetScrollTop = () => {
  36726. const list = listRef.value;
  36727. if (list) list.resetScrollTop();
  36728. };
  36729. expose({
  36730. listRef,
  36731. isSized,
  36732. isItemDisabled,
  36733. isItemHovering,
  36734. isItemSelected,
  36735. scrollToItem,
  36736. resetScrollTop
  36737. });
  36738. const Item = (itemProps) => {
  36739. const { index, data, style } = itemProps;
  36740. const sized = unref(isSized);
  36741. const { itemSize, estimatedSize } = unref(listProps);
  36742. const { modelValue } = select.props;
  36743. const { onSelect, onHover } = select;
  36744. const item = data[index];
  36745. if (item.type === "Group") return createVNode(group_item_default, {
  36746. "item": item,
  36747. "style": style,
  36748. "height": sized ? itemSize : estimatedSize
  36749. }, null);
  36750. const isSelected = isItemSelected(modelValue, item);
  36751. const isDisabled = isItemDisabled(modelValue, isSelected);
  36752. const isHovering = isItemHovering(index);
  36753. return createVNode(option_item_default, mergeProps(itemProps, {
  36754. "selected": isSelected,
  36755. "disabled": getDisabled(item) || isDisabled,
  36756. "created": !!item.created,
  36757. "hovering": isHovering,
  36758. "item": item,
  36759. "onSelect": onSelect,
  36760. "onHover": onHover
  36761. }), { default: (props) => slots.default?.(props) || createVNode("span", null, [getLabel(item)]) });
  36762. };
  36763. const { onKeyboardNavigate, onKeyboardSelect } = select;
  36764. const onForward = () => {
  36765. onKeyboardNavigate("forward");
  36766. };
  36767. const onBackward = () => {
  36768. onKeyboardNavigate("backward");
  36769. };
  36770. const onKeydown = (e) => {
  36771. const code = getEventCode(e);
  36772. const { tab, esc, down, up, enter, numpadEnter } = EVENT_CODE;
  36773. if ([
  36774. esc,
  36775. down,
  36776. up,
  36777. enter,
  36778. numpadEnter
  36779. ].includes(code)) {
  36780. e.preventDefault();
  36781. e.stopPropagation();
  36782. }
  36783. switch (code) {
  36784. case tab:
  36785. case esc: break;
  36786. case down:
  36787. onForward();
  36788. break;
  36789. case up:
  36790. onBackward();
  36791. break;
  36792. case enter:
  36793. case numpadEnter:
  36794. onKeyboardSelect();
  36795. break;
  36796. }
  36797. };
  36798. const onEndReached = (direction) => {
  36799. emit("end-reached", direction);
  36800. };
  36801. return () => {
  36802. const { data, width } = props;
  36803. const { height, multiple, scrollbarAlwaysOn } = select.props;
  36804. const isScrollbarAlwaysOn = isIOS ? true : scrollbarAlwaysOn;
  36805. const List = unref(isSized) ? FixedSizeList : DynamicSizeList;
  36806. return createVNode("div", {
  36807. "class": [ns.b("dropdown"), ns.is("multiple", multiple)],
  36808. "style": { width: `${width}px` }
  36809. }, [
  36810. slots.header?.(),
  36811. slots.loading?.() || slots.empty?.() || createVNode(List, mergeProps({ "ref": listRef }, unref(listProps), {
  36812. "className": ns.be("dropdown", "list"),
  36813. "scrollbarAlwaysOn": isScrollbarAlwaysOn,
  36814. "data": data,
  36815. "height": height,
  36816. "width": width,
  36817. "total": data.length,
  36818. "innerElement": "ul",
  36819. "innerProps": {
  36820. id: props.id,
  36821. role: "listbox",
  36822. "aria-label": props.ariaLabel,
  36823. "aria-orientation": "vertical"
  36824. },
  36825. "onEndReached": onEndReached,
  36826. "onKeydown": onKeydown
  36827. }), { default: (props) => createVNode(Item, props, null) }),
  36828. slots.footer?.()
  36829. ]);
  36830. };
  36831. }
  36832. });
  36833. //#endregion
  36834. //#region ../../packages/components/select-v2/src/useAllowCreate.ts
  36835. function useAllowCreate(props, states) {
  36836. const { aliasProps, getLabel, getValue } = useProps(props);
  36837. const createOptionCount = ref(0);
  36838. const cachedSelectedOption = ref();
  36839. const enableAllowCreateMode = computed(() => {
  36840. return props.allowCreate && props.filterable;
  36841. });
  36842. watch(() => props.options, (options) => {
  36843. const optionLabelsSet = new Set(options.map((option) => getLabel(option)));
  36844. states.createdOptions = states.createdOptions.filter((createdOption) => !optionLabelsSet.has(getLabel(createdOption)));
  36845. });
  36846. function hasExistingOption(query) {
  36847. const hasOption = (option) => getLabel(option) === query;
  36848. return props.options && props.options.some(hasOption) || states.createdOptions.some(hasOption);
  36849. }
  36850. function selectNewOption(option) {
  36851. if (!enableAllowCreateMode.value) return;
  36852. if (props.multiple && option.created) createOptionCount.value++;
  36853. else cachedSelectedOption.value = option;
  36854. }
  36855. function createNewOption(query) {
  36856. if (enableAllowCreateMode.value) if (query && query.length > 0) {
  36857. if (hasExistingOption(query)) {
  36858. states.createdOptions = states.createdOptions.filter((createdOption) => getLabel(createdOption) !== states.previousQuery);
  36859. return;
  36860. }
  36861. const newOption = {
  36862. [aliasProps.value.value]: query,
  36863. [aliasProps.value.label]: query,
  36864. created: true,
  36865. [aliasProps.value.disabled]: false
  36866. };
  36867. if (states.createdOptions.length >= createOptionCount.value) states.createdOptions[createOptionCount.value] = newOption;
  36868. else states.createdOptions.push(newOption);
  36869. } else if (props.multiple) states.createdOptions.length = createOptionCount.value;
  36870. else {
  36871. const selectedOption = cachedSelectedOption.value;
  36872. states.createdOptions.length = 0;
  36873. if (selectedOption && selectedOption.created) states.createdOptions.push(selectedOption);
  36874. }
  36875. }
  36876. function removeNewOption(option) {
  36877. if (!enableAllowCreateMode.value || !option || !option.created || option.created && props.reserveKeyword && states.inputValue === getLabel(option)) return;
  36878. const idx = states.createdOptions.findIndex((it) => getValue(it) === getValue(option));
  36879. if (~idx) {
  36880. states.createdOptions.splice(idx, 1);
  36881. createOptionCount.value--;
  36882. }
  36883. }
  36884. function clearAllNewOption() {
  36885. if (enableAllowCreateMode.value) {
  36886. states.createdOptions.length = 0;
  36887. createOptionCount.value = 0;
  36888. }
  36889. }
  36890. return {
  36891. createNewOption,
  36892. removeNewOption,
  36893. selectNewOption,
  36894. clearAllNewOption
  36895. };
  36896. }
  36897. //#endregion
  36898. //#region ../../packages/components/select-v2/src/useSelect.ts
  36899. const useSelect$1 = (props, emit) => {
  36900. const { t } = useLocale();
  36901. const slots = useSlots();
  36902. const nsSelect = useNamespace("select");
  36903. const nsInput = useNamespace("input");
  36904. const { form: elForm, formItem: elFormItem } = useFormItem();
  36905. const { inputId } = useFormItemInputId(props, { formItemContext: elFormItem });
  36906. const { aliasProps, getLabel, getValue, getDisabled, getOptions } = useProps(props);
  36907. const { valueOnClear, isEmptyValue } = useEmptyValues(props);
  36908. const states = reactive({
  36909. inputValue: "",
  36910. cachedOptions: [],
  36911. createdOptions: [],
  36912. hoveringIndex: -1,
  36913. inputHovering: false,
  36914. selectionWidth: 0,
  36915. collapseItemWidth: 0,
  36916. previousQuery: null,
  36917. previousValue: void 0,
  36918. selectedLabel: "",
  36919. menuVisibleOnFocus: false,
  36920. isBeforeHide: false
  36921. });
  36922. const popperSize = ref(-1);
  36923. const debouncing = ref(false);
  36924. const selectRef = ref();
  36925. const selectionRef = ref();
  36926. const tooltipRef = ref();
  36927. const tagTooltipRef = ref();
  36928. const inputRef = ref();
  36929. const prefixRef = ref();
  36930. const suffixRef = ref();
  36931. const menuRef = ref();
  36932. const tagMenuRef = ref();
  36933. const collapseItemRef = ref();
  36934. const { isComposing, handleCompositionStart, handleCompositionEnd, handleCompositionUpdate } = useComposition({ afterComposition: (e) => onInput(e) });
  36935. const selectDisabled = useFormDisabled();
  36936. const { wrapperRef, isFocused, handleBlur } = useFocusController(inputRef, {
  36937. disabled: selectDisabled,
  36938. afterFocus() {
  36939. if (props.automaticDropdown && !expanded.value) {
  36940. expanded.value = true;
  36941. states.menuVisibleOnFocus = true;
  36942. }
  36943. },
  36944. beforeBlur(event) {
  36945. return tooltipRef.value?.isFocusInsideContent(event) || tagTooltipRef.value?.isFocusInsideContent(event);
  36946. },
  36947. afterBlur() {
  36948. expanded.value = false;
  36949. states.menuVisibleOnFocus = false;
  36950. if (props.validateEvent) elFormItem?.validate?.("blur").catch(NOOP);
  36951. }
  36952. });
  36953. const allOptions = computed(() => filterOptions(""));
  36954. const hasOptions = computed(() => {
  36955. if (props.loading) return false;
  36956. return props.options.length > 0 || states.createdOptions.length > 0;
  36957. });
  36958. const filteredOptions = ref([]);
  36959. const expanded = ref(false);
  36960. const needStatusIcon = computed(() => elForm?.statusIcon ?? false);
  36961. const popupHeight = computed(() => {
  36962. const totalHeight = filteredOptions.value.length * props.itemHeight;
  36963. return totalHeight > props.height ? props.height : totalHeight;
  36964. });
  36965. const hasModelValue = computed(() => {
  36966. return props.multiple ? isArray$1(props.modelValue) && props.modelValue.length > 0 : !isEmptyValue(props.modelValue);
  36967. });
  36968. const showClearBtn = computed(() => {
  36969. return props.clearable && !selectDisabled.value && hasModelValue.value && (isFocused.value || states.inputHovering);
  36970. });
  36971. const iconComponent = computed(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  36972. const iconReverse = computed(() => iconComponent.value && nsSelect.is("reverse", expanded.value));
  36973. const validateState = computed(() => elFormItem?.validateState || "");
  36974. const validateIcon = computed(() => {
  36975. if (!validateState.value) return;
  36976. return ValidateComponentsMap[validateState.value];
  36977. });
  36978. const debounce = computed(() => props.remote ? props.debounce : 0);
  36979. const isRemoteSearchEmpty = computed(() => props.remote && !states.inputValue && !hasOptions.value);
  36980. const emptyText = computed(() => {
  36981. if (props.loading) return props.loadingText || t("el.select.loading");
  36982. else {
  36983. if (props.filterable && states.inputValue && hasOptions.value && filteredOptions.value.length === 0) return props.noMatchText || t("el.select.noMatch");
  36984. if (!hasOptions.value) return props.noDataText || t("el.select.noData");
  36985. }
  36986. return null;
  36987. });
  36988. const isFilterMethodValid = computed(() => props.filterable && isFunction$1(props.filterMethod));
  36989. const isRemoteMethodValid = computed(() => props.filterable && props.remote && isFunction$1(props.remoteMethod));
  36990. const filterOptions = (query) => {
  36991. const regexp = new RegExp(escapeStringRegexp(query), "i");
  36992. const isValidOption = (o) => {
  36993. if (isFilterMethodValid.value || isRemoteMethodValid.value) return true;
  36994. return query ? regexp.test(getLabel(o) || "") : true;
  36995. };
  36996. if (props.loading) return [];
  36997. return [...states.createdOptions, ...props.options].reduce((all, item) => {
  36998. const options = getOptions(item);
  36999. if (isArray$1(options)) {
  37000. const filtered = options.filter(isValidOption);
  37001. if (filtered.length > 0) all.push({
  37002. label: getLabel(item),
  37003. type: "Group"
  37004. }, ...filtered);
  37005. } else if (props.remote || isValidOption(item)) all.push(item);
  37006. return all;
  37007. }, []);
  37008. };
  37009. const updateOptions = () => {
  37010. filteredOptions.value = filterOptions(states.inputValue);
  37011. };
  37012. const allOptionsValueMap = computed(() => {
  37013. const valueMap = /* @__PURE__ */ new Map();
  37014. allOptions.value.forEach((option, index) => {
  37015. valueMap.set(getValueKey(getValue(option)), {
  37016. option,
  37017. index
  37018. });
  37019. });
  37020. return valueMap;
  37021. });
  37022. const filteredOptionsValueMap = computed(() => {
  37023. const valueMap = /* @__PURE__ */ new Map();
  37024. filteredOptions.value.forEach((option, index) => {
  37025. valueMap.set(getValueKey(getValue(option)), {
  37026. option,
  37027. index
  37028. });
  37029. });
  37030. return valueMap;
  37031. });
  37032. const optionsAllDisabled = computed(() => filteredOptions.value.every((option) => getDisabled(option)));
  37033. const selectSize = useFormSize();
  37034. const collapseTagSize = computed(() => "small" === selectSize.value ? "small" : "default");
  37035. const calculatePopperSize = () => {
  37036. if (isNumber(props.fitInputWidth)) {
  37037. popperSize.value = props.fitInputWidth;
  37038. return;
  37039. }
  37040. const width = selectRef.value?.offsetWidth || 200;
  37041. if (!props.fitInputWidth && hasOptions.value) nextTick(() => {
  37042. popperSize.value = Math.max(width, calculateLabelMaxWidth());
  37043. });
  37044. else popperSize.value = width;
  37045. };
  37046. const calculateLabelMaxWidth = () => {
  37047. const ctx = document.createElement("canvas").getContext("2d");
  37048. const selector = nsSelect.be("dropdown", "item");
  37049. const dropdownItemEl = (menuRef.value?.listRef?.innerRef || document).querySelector(`.${selector}`);
  37050. if (dropdownItemEl === null || ctx === null) return 0;
  37051. const style = getComputedStyle(dropdownItemEl);
  37052. const padding = Number.parseFloat(style.paddingLeft) + Number.parseFloat(style.paddingRight);
  37053. ctx.font = `bold ${style.font.replace(new RegExp(`\\b${style.fontWeight}\\b`), "")}`;
  37054. return filteredOptions.value.reduce((max, option) => {
  37055. const metrics = ctx.measureText(getLabel(option));
  37056. return Math.max(metrics.width, max);
  37057. }, 0) + padding;
  37058. };
  37059. const getGapWidth = () => {
  37060. if (!selectionRef.value) return 0;
  37061. const style = window.getComputedStyle(selectionRef.value);
  37062. return Number.parseFloat(style.gap || "6px");
  37063. };
  37064. const tagStyle = computed(() => {
  37065. const gapWidth = getGapWidth();
  37066. const inputSlotWidth = props.filterable ? gapWidth + 11 : 0;
  37067. return { maxWidth: `${collapseItemRef.value && props.maxCollapseTags === 1 ? states.selectionWidth - states.collapseItemWidth - gapWidth - inputSlotWidth : states.selectionWidth - inputSlotWidth}px` };
  37068. });
  37069. const collapseTagStyle = computed(() => {
  37070. return { maxWidth: `${states.selectionWidth}px` };
  37071. });
  37072. const shouldShowPlaceholder = computed(() => {
  37073. if (isArray$1(props.modelValue)) return props.modelValue.length === 0 && !states.inputValue;
  37074. return props.filterable ? !states.inputValue : true;
  37075. });
  37076. const currentPlaceholder = computed(() => {
  37077. const _placeholder = props.placeholder ?? t("el.select.placeholder");
  37078. return props.multiple || !hasModelValue.value ? _placeholder : states.selectedLabel;
  37079. });
  37080. const popperRef = computed(() => tooltipRef.value?.popperRef?.contentRef);
  37081. const indexRef = computed(() => {
  37082. if (props.multiple) {
  37083. const len = props.modelValue.length;
  37084. if (len > 0 && filteredOptionsValueMap.value.has(props.modelValue[len - 1])) {
  37085. const { index } = filteredOptionsValueMap.value.get(props.modelValue[len - 1]);
  37086. return index;
  37087. }
  37088. } else if (!isEmptyValue(props.modelValue) && filteredOptionsValueMap.value.has(props.modelValue)) {
  37089. const { index } = filteredOptionsValueMap.value.get(props.modelValue);
  37090. return index;
  37091. }
  37092. return -1;
  37093. });
  37094. const dropdownMenuVisible = computed({
  37095. get() {
  37096. return expanded.value && (props.loading || !isRemoteSearchEmpty.value || props.remote && !!slots.empty) && (!debouncing.value || !isEmpty(states.previousQuery) || hasOptions.value);
  37097. },
  37098. set(val) {
  37099. expanded.value = val;
  37100. }
  37101. });
  37102. const showTagList = computed(() => {
  37103. if (!props.multiple) return [];
  37104. return props.collapseTags ? states.cachedOptions.slice(0, props.maxCollapseTags) : states.cachedOptions;
  37105. });
  37106. const collapseTagList = computed(() => {
  37107. if (!props.multiple) return [];
  37108. return props.collapseTags ? states.cachedOptions.slice(props.maxCollapseTags) : [];
  37109. });
  37110. const { createNewOption, removeNewOption, selectNewOption, clearAllNewOption } = useAllowCreate(props, states);
  37111. const toggleMenu = (event) => {
  37112. if (selectDisabled.value || props.filterable && expanded.value && event && !suffixRef.value?.contains(event.target)) return;
  37113. if (states.menuVisibleOnFocus) states.menuVisibleOnFocus = false;
  37114. else expanded.value = !expanded.value;
  37115. };
  37116. const onInputChange = () => {
  37117. if (states.inputValue.length > 0 && !expanded.value) expanded.value = true;
  37118. createNewOption(states.inputValue);
  37119. nextTick(() => {
  37120. handleQueryChange(states.inputValue);
  37121. });
  37122. };
  37123. const debouncedOnInputChange = useDebounceFn(() => {
  37124. onInputChange();
  37125. debouncing.value = false;
  37126. }, debounce);
  37127. const handleQueryChange = (val) => {
  37128. if (states.previousQuery === val || isComposing.value) return;
  37129. states.previousQuery = val;
  37130. if (props.filterable && isFunction$1(props.filterMethod)) props.filterMethod(val);
  37131. else if (props.filterable && props.remote && isFunction$1(props.remoteMethod)) props.remoteMethod(val);
  37132. if (props.defaultFirstOption && (props.filterable || props.remote) && filteredOptions.value.length) nextTick(checkDefaultFirstOption);
  37133. else nextTick(updateHoveringIndex);
  37134. };
  37135. const checkDefaultFirstOption = () => {
  37136. const optionsInDropdown = filteredOptions.value.filter((n) => !n.disabled && n.type !== "Group");
  37137. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  37138. const firstOriginOption = optionsInDropdown[0];
  37139. states.hoveringIndex = getValueIndex(filteredOptions.value, userCreatedOption || firstOriginOption);
  37140. };
  37141. const emitChange = (val) => {
  37142. if (!isEqual$1(props.modelValue, val)) emit(CHANGE_EVENT, val);
  37143. };
  37144. const update = (val) => {
  37145. emit(UPDATE_MODEL_EVENT, val);
  37146. emitChange(val);
  37147. states.previousValue = props.multiple ? String(val) : val;
  37148. nextTick(() => {
  37149. if (props.multiple && isArray$1(props.modelValue)) {
  37150. const cachedOptions = states.cachedOptions.slice();
  37151. const selectedOptions = props.modelValue.map((value) => getOption(value, cachedOptions));
  37152. if (!isEqual$1(states.cachedOptions, selectedOptions)) states.cachedOptions = selectedOptions;
  37153. } else initStates(true);
  37154. });
  37155. };
  37156. const getValueIndex = (arr = [], value) => {
  37157. if (!isObject$1(value)) return arr.indexOf(value);
  37158. const valueKey = props.valueKey;
  37159. let index = -1;
  37160. arr.some((item, i) => {
  37161. if (get(item, valueKey) === get(value, valueKey)) {
  37162. index = i;
  37163. return true;
  37164. }
  37165. return false;
  37166. });
  37167. return index;
  37168. };
  37169. const getValueKey = (item) => {
  37170. return isObject$1(item) ? get(item, props.valueKey) : item;
  37171. };
  37172. const handleResize = () => {
  37173. calculatePopperSize();
  37174. };
  37175. const onEndReached = (direction) => {
  37176. emit("end-reached", direction);
  37177. };
  37178. const resetSelectionWidth = () => {
  37179. states.selectionWidth = Number.parseFloat(window.getComputedStyle(selectionRef.value).width);
  37180. };
  37181. const resetCollapseItemWidth = () => {
  37182. states.collapseItemWidth = collapseItemRef.value.getBoundingClientRect().width;
  37183. };
  37184. const updateTooltip = () => {
  37185. tooltipRef.value?.updatePopper?.();
  37186. };
  37187. const updateTagTooltip = () => {
  37188. tagTooltipRef.value?.updatePopper?.();
  37189. };
  37190. const onSelect = (option) => {
  37191. const optionValue = getValue(option);
  37192. if (props.multiple) {
  37193. let selectedOptions = props.modelValue.slice();
  37194. const index = getValueIndex(selectedOptions, optionValue);
  37195. if (index > -1) {
  37196. selectedOptions = [...selectedOptions.slice(0, index), ...selectedOptions.slice(index + 1)];
  37197. states.cachedOptions.splice(index, 1);
  37198. removeNewOption(option);
  37199. } else if (props.multipleLimit <= 0 || selectedOptions.length < props.multipleLimit) {
  37200. selectedOptions = [...selectedOptions, optionValue];
  37201. states.cachedOptions.push(option);
  37202. selectNewOption(option);
  37203. }
  37204. update(selectedOptions);
  37205. if (option.created) handleQueryChange("");
  37206. if (props.filterable && (option.created || !props.reserveKeyword)) states.inputValue = "";
  37207. } else {
  37208. states.selectedLabel = getLabel(option);
  37209. !isEqual$1(props.modelValue, optionValue) && update(optionValue);
  37210. expanded.value = false;
  37211. selectNewOption(option);
  37212. if (!option.created) clearAllNewOption();
  37213. }
  37214. focus();
  37215. };
  37216. const deleteTag = (event, option) => {
  37217. let selectedOptions = props.modelValue.slice();
  37218. const index = getValueIndex(selectedOptions, getValue(option));
  37219. if (index > -1 && !selectDisabled.value) {
  37220. selectedOptions = [...props.modelValue.slice(0, index), ...props.modelValue.slice(index + 1)];
  37221. states.cachedOptions.splice(index, 1);
  37222. update(selectedOptions);
  37223. emit("remove-tag", getValue(option));
  37224. removeNewOption(option);
  37225. }
  37226. event.stopPropagation();
  37227. focus();
  37228. };
  37229. const focus = () => {
  37230. inputRef.value?.focus();
  37231. };
  37232. const blur = () => {
  37233. if (expanded.value) {
  37234. expanded.value = false;
  37235. nextTick(() => inputRef.value?.blur());
  37236. return;
  37237. }
  37238. inputRef.value?.blur();
  37239. };
  37240. const handleEsc = () => {
  37241. if (states.inputValue.length > 0) states.inputValue = "";
  37242. else expanded.value = false;
  37243. };
  37244. const getLastNotDisabledIndex = (value) => findLastIndex(value, (it) => !states.cachedOptions.some((option) => getValue(option) === it && getDisabled(option)));
  37245. const handleDel = (e) => {
  37246. const code = getEventCode(e);
  37247. if (!props.multiple) return;
  37248. if (code === EVENT_CODE.delete) return;
  37249. if (states.inputValue.length === 0) {
  37250. e.preventDefault();
  37251. const selected = props.modelValue.slice();
  37252. const lastNotDisabledIndex = getLastNotDisabledIndex(selected);
  37253. if (lastNotDisabledIndex < 0) return;
  37254. const removeTagValue = selected[lastNotDisabledIndex];
  37255. selected.splice(lastNotDisabledIndex, 1);
  37256. const option = states.cachedOptions[lastNotDisabledIndex];
  37257. states.cachedOptions.splice(lastNotDisabledIndex, 1);
  37258. removeNewOption(option);
  37259. update(selected);
  37260. emit("remove-tag", removeTagValue);
  37261. }
  37262. };
  37263. const handleClear = () => {
  37264. let emptyValue;
  37265. if (isArray$1(props.modelValue)) emptyValue = [];
  37266. else emptyValue = valueOnClear.value;
  37267. states.selectedLabel = "";
  37268. expanded.value = false;
  37269. update(emptyValue);
  37270. emit("clear");
  37271. clearAllNewOption();
  37272. focus();
  37273. };
  37274. const onKeyboardNavigate = (direction, hoveringIndex = void 0) => {
  37275. const options = filteredOptions.value;
  37276. if (!["forward", "backward"].includes(direction) || selectDisabled.value || options.length <= 0 || optionsAllDisabled.value || isComposing.value) return;
  37277. if (!expanded.value) return toggleMenu();
  37278. if (isUndefined(hoveringIndex)) hoveringIndex = states.hoveringIndex;
  37279. let newIndex = -1;
  37280. if (direction === "forward") {
  37281. newIndex = hoveringIndex + 1;
  37282. if (newIndex >= options.length) newIndex = 0;
  37283. } else if (direction === "backward") {
  37284. newIndex = hoveringIndex - 1;
  37285. if (newIndex < 0 || newIndex >= options.length) newIndex = options.length - 1;
  37286. }
  37287. const option = options[newIndex];
  37288. if (getDisabled(option) || option.type === "Group") return onKeyboardNavigate(direction, newIndex);
  37289. else {
  37290. states.hoveringIndex = newIndex;
  37291. scrollToItem(newIndex);
  37292. }
  37293. };
  37294. const onKeyboardSelect = () => {
  37295. if (!expanded.value) return toggleMenu();
  37296. else if (~states.hoveringIndex && filteredOptions.value[states.hoveringIndex]) onSelect(filteredOptions.value[states.hoveringIndex]);
  37297. };
  37298. const onHoverOption = (idx) => {
  37299. states.hoveringIndex = idx ?? -1;
  37300. };
  37301. const updateHoveringIndex = () => {
  37302. if (!props.multiple) states.hoveringIndex = filteredOptions.value.findIndex((item) => {
  37303. return getValueKey(getValue(item)) === getValueKey(props.modelValue);
  37304. });
  37305. else {
  37306. const length = props.modelValue.length;
  37307. if (length > 0) {
  37308. const lastValue = props.modelValue[length - 1];
  37309. states.hoveringIndex = filteredOptions.value.findIndex((item) => getValueKey(lastValue) === getValueKey(getValue(item)));
  37310. } else states.hoveringIndex = -1;
  37311. }
  37312. };
  37313. const onInput = (event) => {
  37314. states.inputValue = event.target.value;
  37315. if (props.remote) {
  37316. debouncing.value = true;
  37317. debouncedOnInputChange();
  37318. } else return onInputChange();
  37319. };
  37320. const handleClickOutside = (event) => {
  37321. expanded.value = false;
  37322. if (isFocused.value) handleBlur(new FocusEvent("blur", event));
  37323. };
  37324. const handleMenuEnter = () => {
  37325. states.isBeforeHide = false;
  37326. return nextTick(() => {
  37327. if (~indexRef.value) scrollToItem(indexRef.value);
  37328. });
  37329. };
  37330. const scrollToItem = (index) => {
  37331. menuRef.value.scrollToItem(index);
  37332. };
  37333. const getOption = (value, cachedOptions) => {
  37334. const selectValue = getValueKey(value);
  37335. if (allOptionsValueMap.value.has(selectValue)) {
  37336. const { option } = allOptionsValueMap.value.get(selectValue);
  37337. return option;
  37338. }
  37339. if (cachedOptions && cachedOptions.length) {
  37340. const option = cachedOptions.find((option) => getValueKey(getValue(option)) === selectValue);
  37341. if (option) return option;
  37342. }
  37343. return {
  37344. [aliasProps.value.value]: value,
  37345. [aliasProps.value.label]: value
  37346. };
  37347. };
  37348. const getIndex = (option) => allOptionsValueMap.value.get(getValue(option))?.index ?? -1;
  37349. const initStates = (needUpdateSelectedLabel = false) => {
  37350. if (props.multiple) if (props.modelValue.length > 0) {
  37351. const cachedOptions = states.cachedOptions.slice();
  37352. states.cachedOptions.length = 0;
  37353. states.previousValue = props.modelValue.toString();
  37354. for (const value of props.modelValue) {
  37355. const option = getOption(value, cachedOptions);
  37356. states.cachedOptions.push(option);
  37357. }
  37358. } else {
  37359. states.cachedOptions = [];
  37360. states.previousValue = void 0;
  37361. }
  37362. else if (hasModelValue.value) {
  37363. states.previousValue = props.modelValue;
  37364. const options = filteredOptions.value;
  37365. const selectedItemIndex = options.findIndex((option) => getValueKey(getValue(option)) === getValueKey(props.modelValue));
  37366. if (~selectedItemIndex) states.selectedLabel = getLabel(options[selectedItemIndex]);
  37367. else if (!states.selectedLabel || needUpdateSelectedLabel) states.selectedLabel = getValueKey(props.modelValue);
  37368. } else {
  37369. states.selectedLabel = "";
  37370. states.previousValue = void 0;
  37371. }
  37372. clearAllNewOption();
  37373. calculatePopperSize();
  37374. };
  37375. watch(() => props.fitInputWidth, () => {
  37376. calculatePopperSize();
  37377. });
  37378. watch(expanded, (val) => {
  37379. if (val) {
  37380. if (!props.persistent) calculatePopperSize();
  37381. handleQueryChange("");
  37382. } else {
  37383. states.inputValue = "";
  37384. states.previousQuery = null;
  37385. states.isBeforeHide = true;
  37386. states.menuVisibleOnFocus = false;
  37387. createNewOption("");
  37388. }
  37389. });
  37390. watch(() => props.modelValue, (val, oldVal) => {
  37391. if (!val || isArray$1(val) && val.length === 0 || props.multiple && !isEqual$1(val.toString(), states.previousValue) || !props.multiple && getValueKey(val) !== getValueKey(states.previousValue)) initStates(true);
  37392. if (!isEqual$1(val, oldVal) && props.validateEvent) elFormItem?.validate?.("change").catch(NOOP);
  37393. }, { deep: true });
  37394. watch(() => props.options, () => {
  37395. const input = inputRef.value;
  37396. if (!input || input && document.activeElement !== input) initStates();
  37397. }, {
  37398. deep: true,
  37399. flush: "post"
  37400. });
  37401. watch(() => filteredOptions.value, () => {
  37402. calculatePopperSize();
  37403. return menuRef.value && nextTick(menuRef.value.resetScrollTop);
  37404. });
  37405. watchEffect(() => {
  37406. if (states.isBeforeHide) return;
  37407. updateOptions();
  37408. });
  37409. watchEffect(() => {
  37410. const { valueKey, options } = props;
  37411. const duplicateValue = /* @__PURE__ */ new Map();
  37412. for (const item of options) {
  37413. const optionValue = getValue(item);
  37414. let v = optionValue;
  37415. if (isObject$1(v)) v = get(optionValue, valueKey);
  37416. if (duplicateValue.get(v)) {
  37417. /* @__PURE__ */ debugWarn("ElSelectV2", `The option values you provided seem to be duplicated, which may cause some problems, please check.`);
  37418. break;
  37419. } else duplicateValue.set(v, true);
  37420. }
  37421. });
  37422. onMounted(() => {
  37423. initStates();
  37424. });
  37425. useResizeObserver(selectRef, handleResize);
  37426. useResizeObserver(selectionRef, resetSelectionWidth);
  37427. useResizeObserver(wrapperRef, updateTooltip);
  37428. useResizeObserver(tagMenuRef, updateTagTooltip);
  37429. useResizeObserver(collapseItemRef, resetCollapseItemWidth);
  37430. let stop;
  37431. watch(() => dropdownMenuVisible.value, (newVal) => {
  37432. if (newVal) stop = useResizeObserver(menuRef, updateTooltip).stop;
  37433. else {
  37434. stop?.();
  37435. stop = void 0;
  37436. }
  37437. emit("visible-change", newVal);
  37438. });
  37439. return {
  37440. inputId,
  37441. collapseTagSize,
  37442. currentPlaceholder,
  37443. expanded,
  37444. emptyText,
  37445. popupHeight,
  37446. debounce,
  37447. allOptions,
  37448. allOptionsValueMap,
  37449. filteredOptions,
  37450. iconComponent,
  37451. iconReverse,
  37452. tagStyle,
  37453. collapseTagStyle,
  37454. popperSize,
  37455. dropdownMenuVisible,
  37456. hasModelValue,
  37457. shouldShowPlaceholder,
  37458. selectDisabled,
  37459. selectSize,
  37460. needStatusIcon,
  37461. showClearBtn,
  37462. states,
  37463. isFocused,
  37464. nsSelect,
  37465. nsInput,
  37466. inputRef,
  37467. menuRef,
  37468. tagMenuRef,
  37469. tooltipRef,
  37470. tagTooltipRef,
  37471. selectRef,
  37472. wrapperRef,
  37473. selectionRef,
  37474. prefixRef,
  37475. suffixRef,
  37476. collapseItemRef,
  37477. popperRef,
  37478. validateState,
  37479. validateIcon,
  37480. showTagList,
  37481. collapseTagList,
  37482. debouncedOnInputChange,
  37483. deleteTag,
  37484. getLabel,
  37485. getValue,
  37486. getDisabled,
  37487. getValueKey,
  37488. getIndex,
  37489. handleClear,
  37490. handleClickOutside,
  37491. handleDel,
  37492. handleEsc,
  37493. focus,
  37494. blur,
  37495. handleMenuEnter,
  37496. handleResize,
  37497. resetSelectionWidth,
  37498. updateTooltip,
  37499. updateTagTooltip,
  37500. updateOptions,
  37501. toggleMenu,
  37502. scrollTo: scrollToItem,
  37503. onInput,
  37504. onKeyboardNavigate,
  37505. onKeyboardSelect,
  37506. onEndReached,
  37507. onSelect,
  37508. onHover: onHoverOption,
  37509. handleCompositionStart,
  37510. handleCompositionEnd,
  37511. handleCompositionUpdate
  37512. };
  37513. };
  37514. //#endregion
  37515. //#region ../../packages/components/select-v2/src/select.vue?vue&type=script&lang.ts
  37516. var select_vue_vue_type_script_lang_default = defineComponent({
  37517. name: "ElSelectV2",
  37518. components: {
  37519. ElSelectMenu: select_dropdown_default,
  37520. ElTag,
  37521. ElTooltip,
  37522. ElIcon
  37523. },
  37524. directives: { ClickOutside },
  37525. props: selectV2Props,
  37526. emits: selectV2Emits,
  37527. setup(props, { emit }) {
  37528. const modelValue = computed(() => {
  37529. const { modelValue: rawModelValue, multiple } = props;
  37530. const fallback = multiple ? [] : void 0;
  37531. if (isArray$1(rawModelValue)) return multiple ? rawModelValue : fallback;
  37532. return multiple ? fallback : rawModelValue;
  37533. });
  37534. const API = useSelect$1(reactive({
  37535. ...toRefs(props),
  37536. modelValue
  37537. }), emit);
  37538. const { calculatorRef, inputStyle } = useCalcInputWidth();
  37539. const contentId = useId();
  37540. provide(selectV2InjectionKey, {
  37541. props: reactive({
  37542. ...toRefs(props),
  37543. height: API.popupHeight,
  37544. modelValue
  37545. }),
  37546. expanded: API.expanded,
  37547. tooltipRef: API.tooltipRef,
  37548. contentId,
  37549. onSelect: API.onSelect,
  37550. onHover: API.onHover,
  37551. onKeyboardNavigate: API.onKeyboardNavigate,
  37552. onKeyboardSelect: API.onKeyboardSelect
  37553. });
  37554. const selectedLabel = computed(() => {
  37555. if (!props.multiple) return API.states.selectedLabel;
  37556. return API.states.cachedOptions.map((i) => API.getLabel(i));
  37557. });
  37558. return {
  37559. ...API,
  37560. modelValue,
  37561. selectedLabel,
  37562. calculatorRef,
  37563. inputStyle,
  37564. contentId,
  37565. BORDER_HORIZONTAL_WIDTH: 2
  37566. };
  37567. }
  37568. });
  37569. //#endregion
  37570. //#region ../../packages/components/select-v2/src/select.vue
  37571. const _hoisted_1$21 = [
  37572. "id",
  37573. "value",
  37574. "autocomplete",
  37575. "tabindex",
  37576. "aria-expanded",
  37577. "aria-label",
  37578. "disabled",
  37579. "aria-controls",
  37580. "aria-activedescendant",
  37581. "readonly",
  37582. "name"
  37583. ];
  37584. const _hoisted_2$13 = ["textContent"];
  37585. const _hoisted_3$5 = { key: 1 };
  37586. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  37587. const _component_el_tag = resolveComponent("el-tag");
  37588. const _component_el_tooltip = resolveComponent("el-tooltip");
  37589. const _component_el_icon = resolveComponent("el-icon");
  37590. const _component_el_select_menu = resolveComponent("el-select-menu");
  37591. const _directive_click_outside = resolveDirective("click-outside");
  37592. return withDirectives((openBlock(), createElementBlock("div", {
  37593. ref: "selectRef",
  37594. class: normalizeClass([_ctx.nsSelect.b(), _ctx.nsSelect.m(_ctx.selectSize)]),
  37595. onMouseenter: _cache[15] || (_cache[15] = ($event) => _ctx.states.inputHovering = true),
  37596. onMouseleave: _cache[16] || (_cache[16] = ($event) => _ctx.states.inputHovering = false)
  37597. }, [createVNode(_component_el_tooltip, {
  37598. ref: "tooltipRef",
  37599. visible: _ctx.dropdownMenuVisible,
  37600. teleported: _ctx.teleported,
  37601. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  37602. "popper-style": _ctx.popperStyle,
  37603. "gpu-acceleration": false,
  37604. "stop-popper-mouse-event": false,
  37605. "popper-options": _ctx.popperOptions,
  37606. "fallback-placements": _ctx.fallbackPlacements,
  37607. effect: _ctx.effect,
  37608. placement: _ctx.placement,
  37609. pure: "",
  37610. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  37611. trigger: "click",
  37612. persistent: _ctx.persistent,
  37613. "append-to": _ctx.appendTo,
  37614. "show-arrow": _ctx.showArrow,
  37615. offset: _ctx.offset,
  37616. onBeforeShow: _ctx.handleMenuEnter,
  37617. onHide: _cache[14] || (_cache[14] = ($event) => _ctx.states.isBeforeHide = false)
  37618. }, {
  37619. default: withCtx(() => [createElementVNode("div", {
  37620. ref: "wrapperRef",
  37621. class: normalizeClass([
  37622. _ctx.nsSelect.e("wrapper"),
  37623. _ctx.nsSelect.is("focused", _ctx.isFocused),
  37624. _ctx.nsSelect.is("hovering", _ctx.states.inputHovering),
  37625. _ctx.nsSelect.is("filterable", _ctx.filterable),
  37626. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  37627. ]),
  37628. onClick: _cache[11] || (_cache[11] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["prevent"]))
  37629. }, [
  37630. _ctx.$slots.prefix ? (openBlock(), createElementBlock("div", {
  37631. key: 0,
  37632. ref: "prefixRef",
  37633. class: normalizeClass(_ctx.nsSelect.e("prefix"))
  37634. }, [renderSlot(_ctx.$slots, "prefix")], 2)) : createCommentVNode("v-if", true),
  37635. createElementVNode("div", {
  37636. ref: "selectionRef",
  37637. class: normalizeClass([_ctx.nsSelect.e("selection"), _ctx.nsSelect.is("near", _ctx.multiple && !_ctx.$slots.prefix && !!_ctx.modelValue.length)])
  37638. }, [
  37639. _ctx.multiple ? renderSlot(_ctx.$slots, "tag", {
  37640. key: 0,
  37641. data: _ctx.states.cachedOptions,
  37642. deleteTag: _ctx.deleteTag,
  37643. selectDisabled: _ctx.selectDisabled
  37644. }, () => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  37645. return openBlock(), createElementBlock("div", {
  37646. key: _ctx.getValueKey(_ctx.getValue(item)),
  37647. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  37648. }, [createVNode(_component_el_tag, {
  37649. closable: !_ctx.selectDisabled && !_ctx.getDisabled(item),
  37650. size: _ctx.collapseTagSize,
  37651. type: _ctx.tagType,
  37652. effect: _ctx.tagEffect,
  37653. "disable-transitions": "",
  37654. style: normalizeStyle(_ctx.tagStyle),
  37655. onClose: ($event) => _ctx.deleteTag($event, item)
  37656. }, {
  37657. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, [renderSlot(_ctx.$slots, "label", {
  37658. index: _ctx.getIndex(item),
  37659. label: _ctx.getLabel(item),
  37660. value: _ctx.getValue(item)
  37661. }, () => [createTextVNode(toDisplayString(_ctx.getLabel(item)), 1)])], 2)]),
  37662. _: 2
  37663. }, 1032, [
  37664. "closable",
  37665. "size",
  37666. "type",
  37667. "effect",
  37668. "style",
  37669. "onClose"
  37670. ])], 2);
  37671. }), 128)), _ctx.collapseTags && _ctx.states.cachedOptions.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tooltip, {
  37672. key: 0,
  37673. ref: "tagTooltipRef",
  37674. disabled: _ctx.dropdownMenuVisible || !_ctx.collapseTagsTooltip,
  37675. "fallback-placements": _ctx.tagTooltip?.fallbackPlacements ?? [
  37676. "bottom",
  37677. "top",
  37678. "right",
  37679. "left"
  37680. ],
  37681. effect: _ctx.tagTooltip?.effect ?? _ctx.effect,
  37682. placement: _ctx.tagTooltip?.placement ?? "bottom",
  37683. "popper-class": _ctx.tagTooltip?.popperClass ?? _ctx.popperClass,
  37684. "popper-style": _ctx.tagTooltip?.popperStyle ?? _ctx.popperStyle,
  37685. teleported: _ctx.tagTooltip?.teleported ?? _ctx.teleported,
  37686. "append-to": _ctx.tagTooltip?.appendTo ?? _ctx.appendTo,
  37687. "popper-options": _ctx.tagTooltip?.popperOptions ?? _ctx.popperOptions,
  37688. transition: _ctx.tagTooltip?.transition,
  37689. "show-after": _ctx.tagTooltip?.showAfter,
  37690. "hide-after": _ctx.tagTooltip?.hideAfter,
  37691. "auto-close": _ctx.tagTooltip?.autoClose,
  37692. offset: _ctx.tagTooltip?.offset
  37693. }, {
  37694. default: withCtx(() => [createElementVNode("div", {
  37695. ref: "collapseItemRef",
  37696. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  37697. }, [createVNode(_component_el_tag, {
  37698. closable: false,
  37699. size: _ctx.collapseTagSize,
  37700. type: _ctx.tagType,
  37701. effect: _ctx.tagEffect,
  37702. style: normalizeStyle(_ctx.collapseTagStyle),
  37703. "disable-transitions": ""
  37704. }, {
  37705. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, " + " + toDisplayString(_ctx.states.cachedOptions.length - _ctx.maxCollapseTags), 3)]),
  37706. _: 1
  37707. }, 8, [
  37708. "size",
  37709. "type",
  37710. "effect",
  37711. "style"
  37712. ])], 2)]),
  37713. content: withCtx(() => [createElementVNode("div", {
  37714. ref: "tagMenuRef",
  37715. class: normalizeClass(_ctx.nsSelect.e("selection"))
  37716. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (selected) => {
  37717. return openBlock(), createElementBlock("div", {
  37718. key: _ctx.getValueKey(_ctx.getValue(selected)),
  37719. class: normalizeClass(_ctx.nsSelect.e("selected-item"))
  37720. }, [createVNode(_component_el_tag, {
  37721. class: "in-tooltip",
  37722. closable: !_ctx.selectDisabled && !_ctx.getDisabled(selected),
  37723. size: _ctx.collapseTagSize,
  37724. type: _ctx.tagType,
  37725. effect: _ctx.tagEffect,
  37726. "disable-transitions": "",
  37727. onClose: ($event) => _ctx.deleteTag($event, selected)
  37728. }, {
  37729. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(_ctx.nsSelect.e("tags-text")) }, [renderSlot(_ctx.$slots, "label", {
  37730. index: _ctx.getIndex(selected),
  37731. label: _ctx.getLabel(selected),
  37732. value: _ctx.getValue(selected)
  37733. }, () => [createTextVNode(toDisplayString(_ctx.getLabel(selected)), 1)])], 2)]),
  37734. _: 2
  37735. }, 1032, [
  37736. "closable",
  37737. "size",
  37738. "type",
  37739. "effect",
  37740. "onClose"
  37741. ])], 2);
  37742. }), 128))], 2)]),
  37743. _: 3
  37744. }, 8, [
  37745. "disabled",
  37746. "fallback-placements",
  37747. "effect",
  37748. "placement",
  37749. "popper-class",
  37750. "popper-style",
  37751. "teleported",
  37752. "append-to",
  37753. "popper-options",
  37754. "transition",
  37755. "show-after",
  37756. "hide-after",
  37757. "auto-close",
  37758. "offset"
  37759. ])) : createCommentVNode("v-if", true)]) : createCommentVNode("v-if", true),
  37760. createElementVNode("div", { class: normalizeClass([
  37761. _ctx.nsSelect.e("selected-item"),
  37762. _ctx.nsSelect.e("input-wrapper"),
  37763. _ctx.nsSelect.is("hidden", !_ctx.filterable || _ctx.selectDisabled || _ctx.multiple && !_ctx.states.inputValue && !_ctx.isFocused)
  37764. ]) }, [createElementVNode("input", {
  37765. id: _ctx.inputId,
  37766. ref: "inputRef",
  37767. value: _ctx.states.inputValue,
  37768. style: normalizeStyle(_ctx.inputStyle),
  37769. autocomplete: _ctx.autocomplete,
  37770. tabindex: _ctx.tabindex,
  37771. "aria-autocomplete": "none",
  37772. "aria-haspopup": "listbox",
  37773. autocapitalize: "off",
  37774. "aria-expanded": _ctx.expanded,
  37775. "aria-label": _ctx.ariaLabel,
  37776. class: normalizeClass([_ctx.nsSelect.e("input"), _ctx.nsSelect.is(_ctx.selectSize)]),
  37777. disabled: _ctx.selectDisabled,
  37778. role: "combobox",
  37779. "aria-controls": _ctx.contentId,
  37780. "aria-activedescendant": _ctx.states.hoveringIndex >= 0 ? `${_ctx.contentId}-${_ctx.states.hoveringIndex}` : "",
  37781. readonly: !_ctx.filterable,
  37782. spellcheck: "false",
  37783. type: "text",
  37784. name: _ctx.name,
  37785. onInput: _cache[0] || (_cache[0] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
  37786. onChange: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"])),
  37787. onCompositionstart: _cache[2] || (_cache[2] = (...args) => _ctx.handleCompositionStart && _ctx.handleCompositionStart(...args)),
  37788. onCompositionupdate: _cache[3] || (_cache[3] = (...args) => _ctx.handleCompositionUpdate && _ctx.handleCompositionUpdate(...args)),
  37789. onCompositionend: _cache[4] || (_cache[4] = (...args) => _ctx.handleCompositionEnd && _ctx.handleCompositionEnd(...args)),
  37790. onKeydown: [
  37791. _cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("backward"), ["stop", "prevent"]), ["up"])),
  37792. _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.onKeyboardNavigate("forward"), ["stop", "prevent"]), ["down"])),
  37793. _cache[7] || (_cache[7] = withKeys(withModifiers((...args) => _ctx.onKeyboardSelect && _ctx.onKeyboardSelect(...args), ["stop", "prevent"]), ["enter"])),
  37794. _cache[8] || (_cache[8] = withKeys(withModifiers((...args) => _ctx.handleEsc && _ctx.handleEsc(...args), ["stop", "prevent"]), ["esc"])),
  37795. _cache[9] || (_cache[9] = withKeys(withModifiers((...args) => _ctx.handleDel && _ctx.handleDel(...args), ["stop"]), ["delete"]))
  37796. ],
  37797. onClick: _cache[10] || (_cache[10] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  37798. }, null, 46, _hoisted_1$21), _ctx.filterable ? (openBlock(), createElementBlock("span", {
  37799. key: 0,
  37800. ref: "calculatorRef",
  37801. "aria-hidden": "true",
  37802. class: normalizeClass(_ctx.nsSelect.e("input-calculator")),
  37803. textContent: toDisplayString(_ctx.states.inputValue)
  37804. }, null, 10, _hoisted_2$13)) : createCommentVNode("v-if", true)], 2),
  37805. _ctx.shouldShowPlaceholder ? (openBlock(), createElementBlock("div", {
  37806. key: 1,
  37807. class: normalizeClass([
  37808. _ctx.nsSelect.e("selected-item"),
  37809. _ctx.nsSelect.e("placeholder"),
  37810. _ctx.nsSelect.is("transparent", !_ctx.hasModelValue || _ctx.expanded && !_ctx.states.inputValue)
  37811. ])
  37812. }, [_ctx.hasModelValue ? renderSlot(_ctx.$slots, "label", {
  37813. key: 0,
  37814. index: _ctx.allOptionsValueMap.get(_ctx.modelValue)?.index ?? -1,
  37815. label: _ctx.currentPlaceholder,
  37816. value: _ctx.modelValue
  37817. }, () => [createElementVNode("span", null, toDisplayString(_ctx.currentPlaceholder), 1)]) : (openBlock(), createElementBlock("span", _hoisted_3$5, toDisplayString(_ctx.currentPlaceholder), 1))], 2)) : createCommentVNode("v-if", true)
  37818. ], 2),
  37819. createElementVNode("div", {
  37820. ref: "suffixRef",
  37821. class: normalizeClass(_ctx.nsSelect.e("suffix"))
  37822. }, [
  37823. _ctx.iconComponent ? withDirectives((openBlock(), createBlock(_component_el_icon, {
  37824. key: 0,
  37825. class: normalizeClass([
  37826. _ctx.nsSelect.e("caret"),
  37827. _ctx.nsInput.e("icon"),
  37828. _ctx.iconReverse
  37829. ])
  37830. }, {
  37831. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))]),
  37832. _: 1
  37833. }, 8, ["class"])), [[vShow, !_ctx.showClearBtn]]) : createCommentVNode("v-if", true),
  37834. _ctx.showClearBtn && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  37835. key: 1,
  37836. class: normalizeClass([
  37837. _ctx.nsSelect.e("caret"),
  37838. _ctx.nsInput.e("icon"),
  37839. _ctx.nsSelect.e("clear")
  37840. ]),
  37841. onClick: withModifiers(_ctx.handleClear, ["prevent", "stop"])
  37842. }, {
  37843. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))]),
  37844. _: 1
  37845. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  37846. _ctx.validateState && _ctx.validateIcon && _ctx.needStatusIcon ? (openBlock(), createBlock(_component_el_icon, {
  37847. key: 2,
  37848. class: normalizeClass([
  37849. _ctx.nsInput.e("icon"),
  37850. _ctx.nsInput.e("validateIcon"),
  37851. _ctx.nsInput.is("loading", _ctx.validateState === "validating")
  37852. ])
  37853. }, {
  37854. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.validateIcon)))]),
  37855. _: 1
  37856. }, 8, ["class"])) : createCommentVNode("v-if", true)
  37857. ], 2)
  37858. ], 2)]),
  37859. content: withCtx(() => [createVNode(_component_el_select_menu, {
  37860. id: _ctx.contentId,
  37861. ref: "menuRef",
  37862. data: _ctx.filteredOptions,
  37863. width: _ctx.popperSize - _ctx.BORDER_HORIZONTAL_WIDTH,
  37864. "hovering-index": _ctx.states.hoveringIndex,
  37865. "scrollbar-always-on": _ctx.scrollbarAlwaysOn,
  37866. "aria-label": _ctx.ariaLabel,
  37867. onEndReached: _ctx.onEndReached
  37868. }, createSlots({
  37869. default: withCtx((scope) => [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(scope)))]),
  37870. _: 2
  37871. }, [
  37872. _ctx.$slots.header ? {
  37873. name: "header",
  37874. fn: withCtx(() => [createElementVNode("div", {
  37875. class: normalizeClass(_ctx.nsSelect.be("dropdown", "header")),
  37876. onClick: _cache[12] || (_cache[12] = withModifiers(() => {}, ["stop"]))
  37877. }, [renderSlot(_ctx.$slots, "header")], 2)]),
  37878. key: "0"
  37879. } : void 0,
  37880. _ctx.$slots.loading && _ctx.loading ? {
  37881. name: "loading",
  37882. fn: withCtx(() => [createElementVNode("div", { class: normalizeClass(_ctx.nsSelect.be("dropdown", "loading")) }, [renderSlot(_ctx.$slots, "loading")], 2)]),
  37883. key: "1"
  37884. } : _ctx.loading || _ctx.filteredOptions.length === 0 ? {
  37885. name: "empty",
  37886. fn: withCtx(() => [createElementVNode("div", { class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty")) }, [renderSlot(_ctx.$slots, "empty", {}, () => [createElementVNode("span", null, toDisplayString(_ctx.emptyText), 1)])], 2)]),
  37887. key: "2"
  37888. } : void 0,
  37889. _ctx.$slots.footer ? {
  37890. name: "footer",
  37891. fn: withCtx(() => [createElementVNode("div", {
  37892. class: normalizeClass(_ctx.nsSelect.be("dropdown", "footer")),
  37893. onClick: _cache[13] || (_cache[13] = withModifiers(() => {}, ["stop"]))
  37894. }, [renderSlot(_ctx.$slots, "footer")], 2)]),
  37895. key: "3"
  37896. } : void 0
  37897. ]), 1032, [
  37898. "id",
  37899. "data",
  37900. "width",
  37901. "hovering-index",
  37902. "scrollbar-always-on",
  37903. "aria-label",
  37904. "onEndReached"
  37905. ])]),
  37906. _: 3
  37907. }, 8, [
  37908. "visible",
  37909. "teleported",
  37910. "popper-class",
  37911. "popper-style",
  37912. "popper-options",
  37913. "fallback-placements",
  37914. "effect",
  37915. "placement",
  37916. "transition",
  37917. "persistent",
  37918. "append-to",
  37919. "show-arrow",
  37920. "offset",
  37921. "onBeforeShow"
  37922. ])], 34)), [[
  37923. _directive_click_outside,
  37924. _ctx.handleClickOutside,
  37925. _ctx.popperRef
  37926. ]]);
  37927. }
  37928. var select_default = /* @__PURE__ */ _plugin_vue_export_helper_default(select_vue_vue_type_script_lang_default, [["render", _sfc_render$4]]);
  37929. //#endregion
  37930. //#region ../../packages/components/select-v2/index.ts
  37931. const ElSelectV2 = withInstall(select_default);
  37932. //#endregion
  37933. //#region ../../packages/components/skeleton/src/skeleton.ts
  37934. const skeletonProps = buildProps({
  37935. animated: Boolean,
  37936. count: {
  37937. type: Number,
  37938. default: 1
  37939. },
  37940. rows: {
  37941. type: Number,
  37942. default: 3
  37943. },
  37944. loading: {
  37945. type: Boolean,
  37946. default: true
  37947. },
  37948. throttle: { type: definePropType([Number, Object]) }
  37949. });
  37950. //#endregion
  37951. //#region ../../packages/components/skeleton/src/skeleton-item.ts
  37952. const skeletonItemProps = buildProps({ variant: {
  37953. type: String,
  37954. values: [
  37955. "circle",
  37956. "rect",
  37957. "h1",
  37958. "h3",
  37959. "text",
  37960. "caption",
  37961. "p",
  37962. "image",
  37963. "button"
  37964. ],
  37965. default: "text"
  37966. } });
  37967. //#endregion
  37968. //#region ../../packages/components/skeleton/src/skeleton-item.vue?vue&type=script&setup=true&lang.ts
  37969. var skeleton_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  37970. name: "ElSkeletonItem",
  37971. __name: "skeleton-item",
  37972. props: skeletonItemProps,
  37973. setup(__props) {
  37974. const ns = useNamespace("skeleton");
  37975. return (_ctx, _cache) => {
  37976. return openBlock(), createElementBlock("div", { class: normalizeClass([unref(ns).e("item"), unref(ns).e(__props.variant)]) }, [__props.variant === "image" ? (openBlock(), createBlock(unref(picture_filled_default), { key: 0 })) : createCommentVNode("v-if", true)], 2);
  37977. };
  37978. }
  37979. });
  37980. //#endregion
  37981. //#region ../../packages/components/skeleton/src/skeleton-item.vue
  37982. var skeleton_item_default = skeleton_item_vue_vue_type_script_setup_true_lang_default;
  37983. //#endregion
  37984. //#region ../../packages/components/skeleton/src/skeleton.vue?vue&type=script&setup=true&lang.ts
  37985. var skeleton_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  37986. name: "ElSkeleton",
  37987. __name: "skeleton",
  37988. props: skeletonProps,
  37989. setup(__props, { expose: __expose }) {
  37990. const props = __props;
  37991. const ns = useNamespace("skeleton");
  37992. const uiLoading = useThrottleRender(toRef(props, "loading"), props.throttle);
  37993. __expose({ uiLoading });
  37994. return (_ctx, _cache) => {
  37995. return unref(uiLoading) ? (openBlock(), createElementBlock("div", mergeProps({
  37996. key: 0,
  37997. class: [unref(ns).b(), unref(ns).is("animated", __props.animated)]
  37998. }, _ctx.$attrs), [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.count, (i) => {
  37999. return openBlock(), createElementBlock(Fragment, { key: i }, [unref(uiLoading) ? renderSlot(_ctx.$slots, "template", { key: i }, () => [createVNode(skeleton_item_default, {
  38000. class: normalizeClass(unref(ns).is("first")),
  38001. variant: "p"
  38002. }, null, 8, ["class"]), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.rows, (item) => {
  38003. return openBlock(), createBlock(skeleton_item_default, {
  38004. key: item,
  38005. class: normalizeClass([unref(ns).e("paragraph"), unref(ns).is("last", item === __props.rows && __props.rows > 1)]),
  38006. variant: "p"
  38007. }, null, 8, ["class"]);
  38008. }), 128))]) : createCommentVNode("v-if", true)], 64);
  38009. }), 128))], 16)) : renderSlot(_ctx.$slots, "default", normalizeProps(mergeProps({ key: 1 }, _ctx.$attrs)));
  38010. };
  38011. }
  38012. });
  38013. //#endregion
  38014. //#region ../../packages/components/skeleton/src/skeleton.vue
  38015. var skeleton_default = skeleton_vue_vue_type_script_setup_true_lang_default;
  38016. //#endregion
  38017. //#region ../../packages/components/skeleton/index.ts
  38018. const ElSkeleton = withInstall(skeleton_default, { SkeletonItem: skeleton_item_default });
  38019. const ElSkeletonItem = withNoopInstall(skeleton_item_default);
  38020. //#endregion
  38021. //#region ../../packages/components/slider/src/constants.ts
  38022. const sliderContextKey = Symbol("sliderContextKey");
  38023. //#endregion
  38024. //#region ../../packages/components/slider/src/slider.ts
  38025. const sliderProps = buildProps({
  38026. modelValue: {
  38027. type: definePropType([Number, Array]),
  38028. default: 0
  38029. },
  38030. id: {
  38031. type: String,
  38032. default: void 0
  38033. },
  38034. min: {
  38035. type: Number,
  38036. default: 0
  38037. },
  38038. max: {
  38039. type: Number,
  38040. default: 100
  38041. },
  38042. step: {
  38043. type: definePropType([Number, String]),
  38044. default: 1
  38045. },
  38046. showInput: Boolean,
  38047. showInputControls: {
  38048. type: Boolean,
  38049. default: true
  38050. },
  38051. size: useSizeProp,
  38052. inputSize: useSizeProp,
  38053. showStops: Boolean,
  38054. showTooltip: {
  38055. type: Boolean,
  38056. default: true
  38057. },
  38058. formatTooltip: {
  38059. type: definePropType(Function),
  38060. default: void 0
  38061. },
  38062. disabled: {
  38063. type: Boolean,
  38064. default: void 0
  38065. },
  38066. range: Boolean,
  38067. vertical: Boolean,
  38068. height: String,
  38069. rangeStartLabel: {
  38070. type: String,
  38071. default: void 0
  38072. },
  38073. rangeEndLabel: {
  38074. type: String,
  38075. default: void 0
  38076. },
  38077. formatValueText: {
  38078. type: definePropType(Function),
  38079. default: void 0
  38080. },
  38081. tooltipClass: {
  38082. type: String,
  38083. default: void 0
  38084. },
  38085. placement: {
  38086. type: String,
  38087. values: Ee,
  38088. default: "top"
  38089. },
  38090. marks: { type: definePropType(Object) },
  38091. validateEvent: {
  38092. type: Boolean,
  38093. default: true
  38094. },
  38095. persistent: {
  38096. type: Boolean,
  38097. default: true
  38098. },
  38099. ...useAriaProps(["ariaLabel"])
  38100. });
  38101. const isValidValue$1 = (value) => isNumber(value) || isArray$1(value) && value.every(isNumber);
  38102. const sliderEmits = {
  38103. [UPDATE_MODEL_EVENT]: isValidValue$1,
  38104. [INPUT_EVENT]: isValidValue$1,
  38105. [CHANGE_EVENT]: isValidValue$1
  38106. };
  38107. //#endregion
  38108. //#region ../../packages/components/slider/src/composables/use-lifecycle.ts
  38109. const useLifecycle = (props, initData, resetSize) => {
  38110. const sliderWrapper = ref();
  38111. onMounted(async () => {
  38112. if (props.range) {
  38113. if (isArray$1(props.modelValue)) {
  38114. initData.firstValue = Math.max(props.min, props.modelValue[0]);
  38115. initData.secondValue = Math.min(props.max, props.modelValue[1]);
  38116. } else {
  38117. initData.firstValue = props.min;
  38118. initData.secondValue = props.max;
  38119. }
  38120. initData.oldValue = [initData.firstValue, initData.secondValue];
  38121. } else {
  38122. if (!isNumber(props.modelValue) || Number.isNaN(props.modelValue)) initData.firstValue = props.min;
  38123. else initData.firstValue = Math.min(props.max, Math.max(props.min, props.modelValue));
  38124. initData.oldValue = initData.firstValue;
  38125. }
  38126. useEventListener(window, "resize", resetSize);
  38127. await nextTick();
  38128. resetSize();
  38129. });
  38130. return { sliderWrapper };
  38131. };
  38132. //#endregion
  38133. //#region ../../packages/components/slider/src/composables/use-marks.ts
  38134. const useMarks = (props) => {
  38135. const markList = computed(() => {
  38136. if (!props.marks) return [];
  38137. return Object.keys(props.marks).map(Number.parseFloat).sort((a, b) => a - b).filter((point) => point <= props.max && point >= props.min).map((point) => ({
  38138. point,
  38139. position: (point - props.min) * 100 / (props.max - props.min),
  38140. mark: props.marks[point]
  38141. }));
  38142. });
  38143. watchEffect(() => {
  38144. if (props.step === "mark" && !props.marks) /* @__PURE__ */ debugWarn("ElSlider", "marks prop must be provided when step is mark");
  38145. if (props.marks) {
  38146. const keys = Object.keys(props.marks);
  38147. const validPoints = markList.value.map((m) => m.point);
  38148. const invalidKeys = keys.filter((key) => {
  38149. const parsed = Number.parseFloat(key);
  38150. return Number.isNaN(parsed) || !validPoints.includes(parsed);
  38151. });
  38152. if (invalidKeys.length > 0) /* @__PURE__ */ debugWarn("ElSlider", `Some marks keys are invalid (not a number or out of [min, max]): [${invalidKeys.map((k) => `'${k}'`).join(", ")}] and will be ignored.`);
  38153. }
  38154. });
  38155. return markList;
  38156. };
  38157. //#endregion
  38158. //#region ../../packages/components/slider/src/composables/use-slide.ts
  38159. const useSlide = (props, initData, emit) => {
  38160. const { formItem: elFormItem } = useFormItem();
  38161. const slider = shallowRef();
  38162. const firstButton = ref();
  38163. const secondButton = ref();
  38164. const buttonRefs = {
  38165. firstButton,
  38166. secondButton
  38167. };
  38168. const sliderDisabled = useFormDisabled();
  38169. const minValue = computed(() => {
  38170. return Math.min(initData.firstValue, initData.secondValue);
  38171. });
  38172. const maxValue = computed(() => {
  38173. return Math.max(initData.firstValue, initData.secondValue);
  38174. });
  38175. const barSize = computed(() => {
  38176. return props.range ? `${100 * (maxValue.value - minValue.value) / (props.max - props.min)}%` : `${100 * (initData.firstValue - props.min) / (props.max - props.min)}%`;
  38177. });
  38178. const barStart = computed(() => {
  38179. return props.range ? `${100 * (minValue.value - props.min) / (props.max - props.min)}%` : "0%";
  38180. });
  38181. const runwayStyle = computed(() => {
  38182. return props.vertical ? { height: props.height } : {};
  38183. });
  38184. const barStyle = computed(() => {
  38185. return props.vertical ? {
  38186. height: barSize.value,
  38187. bottom: barStart.value
  38188. } : {
  38189. width: barSize.value,
  38190. left: barStart.value
  38191. };
  38192. });
  38193. const resetSize = () => {
  38194. if (slider.value) initData.sliderSize = slider.value.getBoundingClientRect()[props.vertical ? "height" : "width"];
  38195. };
  38196. const getButtonRefByPercent = (percent) => {
  38197. const targetValue = props.min + percent * (props.max - props.min) / 100;
  38198. if (!props.range) return firstButton;
  38199. let buttonRefName;
  38200. if (Math.abs(minValue.value - targetValue) < Math.abs(maxValue.value - targetValue)) buttonRefName = initData.firstValue < initData.secondValue ? "firstButton" : "secondButton";
  38201. else buttonRefName = initData.firstValue > initData.secondValue ? "firstButton" : "secondButton";
  38202. return buttonRefs[buttonRefName];
  38203. };
  38204. const setPosition = (percent) => {
  38205. const buttonRef = getButtonRefByPercent(percent);
  38206. buttonRef.value.setPosition(percent);
  38207. return buttonRef;
  38208. };
  38209. const setFirstValue = (firstValue) => {
  38210. initData.firstValue = firstValue ?? props.min;
  38211. _emit(props.range ? [minValue.value, maxValue.value] : firstValue ?? props.min);
  38212. };
  38213. const setSecondValue = (secondValue) => {
  38214. initData.secondValue = secondValue;
  38215. if (props.range) _emit([minValue.value, maxValue.value]);
  38216. };
  38217. const _emit = (val) => {
  38218. emit(UPDATE_MODEL_EVENT, val);
  38219. emit(INPUT_EVENT, val);
  38220. };
  38221. const emitChange = async () => {
  38222. await nextTick();
  38223. emit(CHANGE_EVENT, props.range ? [minValue.value, maxValue.value] : props.modelValue);
  38224. };
  38225. const handleSliderPointerEvent = (event) => {
  38226. if (sliderDisabled.value || initData.dragging) return;
  38227. resetSize();
  38228. let newPercent = 0;
  38229. if (props.vertical) {
  38230. const clientY = event.touches?.item(0)?.clientY ?? event.clientY;
  38231. newPercent = (slider.value.getBoundingClientRect().bottom - clientY) / initData.sliderSize * 100;
  38232. } else newPercent = ((event.touches?.item(0)?.clientX ?? event.clientX) - slider.value.getBoundingClientRect().left) / initData.sliderSize * 100;
  38233. if (newPercent < 0 || newPercent > 100) return;
  38234. return setPosition(newPercent);
  38235. };
  38236. const onSliderWrapperPrevent = (event) => {
  38237. if (buttonRefs["firstButton"].value?.dragging || buttonRefs["secondButton"].value?.dragging) event.preventDefault();
  38238. };
  38239. const onSliderDown = async (event) => {
  38240. const buttonRef = handleSliderPointerEvent(event);
  38241. if (buttonRef) {
  38242. await nextTick();
  38243. buttonRef.value.onButtonDown(event);
  38244. }
  38245. };
  38246. const onSliderClick = (event) => {
  38247. if (handleSliderPointerEvent(event)) emitChange();
  38248. };
  38249. const onSliderMarkerDown = (position) => {
  38250. if (sliderDisabled.value || initData.dragging) return;
  38251. if (setPosition(position)) emitChange();
  38252. };
  38253. return {
  38254. elFormItem,
  38255. slider,
  38256. firstButton,
  38257. secondButton,
  38258. sliderDisabled,
  38259. minValue,
  38260. maxValue,
  38261. runwayStyle,
  38262. barStyle,
  38263. resetSize,
  38264. setPosition,
  38265. emitChange,
  38266. onSliderWrapperPrevent,
  38267. onSliderClick,
  38268. onSliderDown,
  38269. onSliderMarkerDown,
  38270. setFirstValue,
  38271. setSecondValue
  38272. };
  38273. };
  38274. //#endregion
  38275. //#region ../../packages/components/slider/src/composables/use-slider-button.ts
  38276. const useTooltip = (props, formatTooltip, showTooltip) => {
  38277. const tooltip = ref();
  38278. const tooltipVisible = ref(false);
  38279. const enableFormat = computed(() => {
  38280. return formatTooltip.value instanceof Function;
  38281. });
  38282. return {
  38283. tooltip,
  38284. tooltipVisible,
  38285. formatValue: computed(() => {
  38286. return enableFormat.value && formatTooltip.value(props.modelValue) || props.modelValue;
  38287. }),
  38288. displayTooltip: debounce(() => {
  38289. showTooltip.value && (tooltipVisible.value = true);
  38290. }, 50),
  38291. hideTooltip: debounce(() => {
  38292. showTooltip.value && (tooltipVisible.value = false);
  38293. }, 50)
  38294. };
  38295. };
  38296. const useSliderButton = (props, initData, emit) => {
  38297. const { disabled, min, max, step, showTooltip, persistent, precision, sliderSize, formatTooltip, emitChange, resetSize, updateDragging, markList } = inject(sliderContextKey);
  38298. const { tooltip, tooltipVisible, formatValue, displayTooltip, hideTooltip } = useTooltip(props, formatTooltip, showTooltip);
  38299. const button = ref();
  38300. const currentPosition = computed(() => {
  38301. return `${(props.modelValue - min.value) / (max.value - min.value) * 100}%`;
  38302. });
  38303. const wrapperStyle = computed(() => {
  38304. return props.vertical ? { bottom: currentPosition.value } : { left: currentPosition.value };
  38305. });
  38306. const shouldMoveToMark = computed(() => {
  38307. return step.value === "mark" && markList.value.length > 0;
  38308. });
  38309. const handleMouseEnter = () => {
  38310. initData.hovering = true;
  38311. displayTooltip();
  38312. };
  38313. const handleMouseLeave = () => {
  38314. initData.hovering = false;
  38315. if (!initData.dragging) hideTooltip();
  38316. };
  38317. const onButtonDown = (event) => {
  38318. if (disabled.value) return;
  38319. event.preventDefault();
  38320. onDragStart(event);
  38321. window.addEventListener("mousemove", onDragging);
  38322. window.addEventListener("touchmove", onDragging);
  38323. window.addEventListener("mouseup", onDragEnd);
  38324. window.addEventListener("touchend", onDragEnd);
  38325. window.addEventListener("contextmenu", onDragEnd);
  38326. button.value.focus();
  38327. };
  38328. const incrementPosition = (amount) => {
  38329. if (disabled.value) return;
  38330. initData.newPosition = Number.parseFloat(currentPosition.value) + amount / (max.value - min.value) * 100;
  38331. setPosition(initData.newPosition);
  38332. emitChange();
  38333. };
  38334. const moveToMark = (amount) => {
  38335. if (disabled.value || !markList.value.length) return;
  38336. const current = props.modelValue;
  38337. const epsilon = Number.EPSILON;
  38338. const stride = Math.abs(amount);
  38339. let target;
  38340. if (amount > 0) {
  38341. const startIndex = markList.value.findIndex((m) => m.point > current + epsilon);
  38342. if (startIndex !== -1) {
  38343. const targetIndex = Math.min(startIndex + stride - 1, markList.value.length - 1);
  38344. target = markList.value[targetIndex].point;
  38345. }
  38346. } else {
  38347. let startIndex = -1;
  38348. for (let i = markList.value.length - 1; i >= 0; i--) if (markList.value[i].point < current - epsilon) {
  38349. startIndex = i;
  38350. break;
  38351. }
  38352. if (startIndex !== -1) {
  38353. const targetIndex = Math.max(startIndex - (stride - 1), 0);
  38354. target = markList.value[targetIndex].point;
  38355. }
  38356. }
  38357. if (target !== void 0 && target !== current) {
  38358. setPosition((target - min.value) / (max.value - min.value) * 100);
  38359. emitChange();
  38360. }
  38361. };
  38362. const onLeftKeyDown = () => {
  38363. if (shouldMoveToMark.value) moveToMark(-1);
  38364. else if (isNumber(step.value)) incrementPosition(-step.value);
  38365. };
  38366. const onRightKeyDown = () => {
  38367. if (shouldMoveToMark.value) moveToMark(1);
  38368. else if (isNumber(step.value)) incrementPosition(step.value);
  38369. };
  38370. const onPageDownKeyDown = () => {
  38371. if (shouldMoveToMark.value) moveToMark(-4);
  38372. else if (isNumber(step.value)) incrementPosition(-step.value * 4);
  38373. };
  38374. const onPageUpKeyDown = () => {
  38375. if (shouldMoveToMark.value) moveToMark(4);
  38376. else if (isNumber(step.value)) incrementPosition(step.value * 4);
  38377. };
  38378. const onHomeKeyDown = () => {
  38379. if (disabled.value) return;
  38380. setPosition(0);
  38381. emitChange();
  38382. };
  38383. const onEndKeyDown = () => {
  38384. if (disabled.value) return;
  38385. setPosition(100);
  38386. emitChange();
  38387. };
  38388. const onKeyDown = (event) => {
  38389. const code = getEventCode(event);
  38390. let isPreventDefault = true;
  38391. switch (code) {
  38392. case EVENT_CODE.left:
  38393. case EVENT_CODE.down:
  38394. onLeftKeyDown();
  38395. break;
  38396. case EVENT_CODE.right:
  38397. case EVENT_CODE.up:
  38398. onRightKeyDown();
  38399. break;
  38400. case EVENT_CODE.home:
  38401. onHomeKeyDown();
  38402. break;
  38403. case EVENT_CODE.end:
  38404. onEndKeyDown();
  38405. break;
  38406. case EVENT_CODE.pageDown:
  38407. onPageDownKeyDown();
  38408. break;
  38409. case EVENT_CODE.pageUp:
  38410. onPageUpKeyDown();
  38411. break;
  38412. default:
  38413. isPreventDefault = false;
  38414. break;
  38415. }
  38416. isPreventDefault && event.preventDefault();
  38417. };
  38418. const getClientXY = (event) => {
  38419. let clientX;
  38420. let clientY;
  38421. if (event.type.startsWith("touch")) {
  38422. clientY = event.touches[0].clientY;
  38423. clientX = event.touches[0].clientX;
  38424. } else {
  38425. clientY = event.clientY;
  38426. clientX = event.clientX;
  38427. }
  38428. return {
  38429. clientX,
  38430. clientY
  38431. };
  38432. };
  38433. const onDragStart = (event) => {
  38434. initData.dragging = true;
  38435. initData.isClick = true;
  38436. const { clientX, clientY } = getClientXY(event);
  38437. if (props.vertical) initData.startY = clientY;
  38438. else initData.startX = clientX;
  38439. initData.startPosition = Number.parseFloat(currentPosition.value);
  38440. initData.newPosition = initData.startPosition;
  38441. };
  38442. const onDragging = (event) => {
  38443. if (initData.dragging) {
  38444. initData.isClick = false;
  38445. displayTooltip();
  38446. resetSize();
  38447. let diff;
  38448. const { clientX, clientY } = getClientXY(event);
  38449. if (props.vertical) {
  38450. initData.currentY = clientY;
  38451. diff = (initData.startY - initData.currentY) / sliderSize.value * 100;
  38452. } else {
  38453. initData.currentX = clientX;
  38454. diff = (initData.currentX - initData.startX) / sliderSize.value * 100;
  38455. }
  38456. initData.newPosition = initData.startPosition + diff;
  38457. setPosition(initData.newPosition);
  38458. }
  38459. };
  38460. const onDragEnd = () => {
  38461. if (initData.dragging) {
  38462. setTimeout(() => {
  38463. initData.dragging = false;
  38464. if (!initData.hovering) hideTooltip();
  38465. if (!initData.isClick) setPosition(initData.newPosition);
  38466. emitChange();
  38467. }, 0);
  38468. window.removeEventListener("mousemove", onDragging);
  38469. window.removeEventListener("touchmove", onDragging);
  38470. window.removeEventListener("mouseup", onDragEnd);
  38471. window.removeEventListener("touchend", onDragEnd);
  38472. window.removeEventListener("contextmenu", onDragEnd);
  38473. }
  38474. };
  38475. const setPosition = async (newPosition) => {
  38476. if (newPosition === null || Number.isNaN(+newPosition)) return;
  38477. newPosition = clamp$1(newPosition, 0, 100);
  38478. let value;
  38479. if (step.value === "mark") if (markList.value.length === 0) value = newPosition <= 50 ? min.value : max.value;
  38480. else value = markList.value.reduce((prev, curr) => {
  38481. return Math.abs(curr.position - newPosition) < Math.abs(prev.position - newPosition) ? curr : prev;
  38482. }).point;
  38483. else {
  38484. const fullSteps = Math.floor((max.value - min.value) / step.value);
  38485. const fullRangePercentage = fullSteps * step.value / (max.value - min.value) * 100;
  38486. const threshold = fullRangePercentage + (100 - fullRangePercentage) / 2;
  38487. if (newPosition < fullRangePercentage) {
  38488. const valueBetween = fullRangePercentage / fullSteps;
  38489. const steps = Math.round(newPosition / valueBetween);
  38490. value = min.value + steps * step.value;
  38491. } else if (newPosition < threshold) value = min.value + fullSteps * step.value;
  38492. else value = max.value;
  38493. value = Number.parseFloat(value.toFixed(precision.value));
  38494. }
  38495. if (value !== props.modelValue) emit(UPDATE_MODEL_EVENT, value);
  38496. if (!initData.dragging && props.modelValue !== initData.oldValue) initData.oldValue = props.modelValue;
  38497. await nextTick();
  38498. initData.dragging && displayTooltip();
  38499. tooltip.value.updatePopper();
  38500. };
  38501. watch(() => initData.dragging, (val) => {
  38502. updateDragging(val);
  38503. });
  38504. useEventListener(button, "touchstart", onButtonDown, { passive: false });
  38505. return {
  38506. disabled,
  38507. button,
  38508. tooltip,
  38509. tooltipVisible,
  38510. showTooltip,
  38511. persistent,
  38512. wrapperStyle,
  38513. formatValue,
  38514. handleMouseEnter,
  38515. handleMouseLeave,
  38516. onButtonDown,
  38517. onKeyDown,
  38518. setPosition
  38519. };
  38520. };
  38521. //#endregion
  38522. //#region ../../packages/components/slider/src/composables/use-stops.ts
  38523. const useStops = (props, initData, minValue, maxValue) => {
  38524. const stops = computed(() => {
  38525. if (!props.showStops || props.min > props.max) return [];
  38526. if (props.step === "mark" || props.step === 0) {
  38527. if (props.step === 0) /* @__PURE__ */ debugWarn("ElSlider", "step should not be 0.");
  38528. return [];
  38529. }
  38530. const stopCount = Math.ceil((props.max - props.min) / props.step);
  38531. const stepWidth = 100 * props.step / (props.max - props.min);
  38532. const result = Array.from({ length: stopCount - 1 }).map((_, index) => (index + 1) * stepWidth);
  38533. if (props.range) return result.filter((step) => {
  38534. return step < 100 * (minValue.value - props.min) / (props.max - props.min) || step > 100 * (maxValue.value - props.min) / (props.max - props.min);
  38535. });
  38536. else return result.filter((step) => step > 100 * (initData.firstValue - props.min) / (props.max - props.min));
  38537. });
  38538. const getStopStyle = (position) => {
  38539. return props.vertical ? { bottom: `${position}%` } : { left: `${position}%` };
  38540. };
  38541. return {
  38542. stops,
  38543. getStopStyle
  38544. };
  38545. };
  38546. //#endregion
  38547. //#region ../../packages/components/slider/src/composables/use-watch.ts
  38548. const useWatch = (props, initData, minValue, maxValue, emit, elFormItem) => {
  38549. const _emit = (val) => {
  38550. emit(UPDATE_MODEL_EVENT, val);
  38551. emit(INPUT_EVENT, val);
  38552. };
  38553. const valueChanged = () => {
  38554. if (props.range) return ![minValue.value, maxValue.value].every((item, index) => item === initData.oldValue[index]);
  38555. else return props.modelValue !== initData.oldValue;
  38556. };
  38557. const setValues = () => {
  38558. if (props.min > props.max) throwError("Slider", "min should not be greater than max.");
  38559. const val = props.modelValue;
  38560. if (props.range && isArray$1(val)) if (val[1] < props.min) _emit([props.min, props.min]);
  38561. else if (val[0] > props.max) _emit([props.max, props.max]);
  38562. else if (val[0] < props.min) _emit([props.min, val[1]]);
  38563. else if (val[1] > props.max) _emit([val[0], props.max]);
  38564. else {
  38565. initData.firstValue = val[0];
  38566. initData.secondValue = val[1];
  38567. if (valueChanged()) {
  38568. if (props.validateEvent) elFormItem?.validate?.("change").catch(NOOP);
  38569. initData.oldValue = val.slice();
  38570. }
  38571. }
  38572. else if (!props.range && isNumber(val) && !Number.isNaN(val)) if (val < props.min) _emit(props.min);
  38573. else if (val > props.max) _emit(props.max);
  38574. else {
  38575. initData.firstValue = val;
  38576. if (valueChanged()) {
  38577. if (props.validateEvent) elFormItem?.validate?.("change").catch(NOOP);
  38578. initData.oldValue = val;
  38579. }
  38580. }
  38581. };
  38582. setValues();
  38583. watch(() => initData.dragging, (val) => {
  38584. if (!val) setValues();
  38585. });
  38586. watch(() => props.modelValue, (val, oldVal) => {
  38587. if (initData.dragging || isArray$1(val) && isArray$1(oldVal) && val.every((item, index) => item === oldVal[index]) && initData.firstValue === val[0] && initData.secondValue === val[1]) return;
  38588. setValues();
  38589. }, { deep: true });
  38590. watch(() => [props.min, props.max], () => {
  38591. setValues();
  38592. });
  38593. };
  38594. //#endregion
  38595. //#region ../../packages/components/slider/src/button.ts
  38596. const sliderButtonProps = buildProps({
  38597. modelValue: {
  38598. type: Number,
  38599. default: 0
  38600. },
  38601. vertical: Boolean,
  38602. tooltipClass: String,
  38603. placement: {
  38604. type: String,
  38605. values: Ee,
  38606. default: "top"
  38607. }
  38608. });
  38609. const sliderButtonEmits = { [UPDATE_MODEL_EVENT]: (value) => isNumber(value) };
  38610. //#endregion
  38611. //#region ../../packages/components/slider/src/button.vue?vue&type=script&setup=true&lang.ts
  38612. const _hoisted_1$20 = ["tabindex"];
  38613. var button_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  38614. name: "ElSliderButton",
  38615. __name: "button",
  38616. props: sliderButtonProps,
  38617. emits: sliderButtonEmits,
  38618. setup(__props, { expose: __expose, emit: __emit }) {
  38619. const props = __props;
  38620. const emit = __emit;
  38621. const ns = useNamespace("slider");
  38622. const initData = reactive({
  38623. hovering: false,
  38624. dragging: false,
  38625. isClick: false,
  38626. startX: 0,
  38627. currentX: 0,
  38628. startY: 0,
  38629. currentY: 0,
  38630. startPosition: 0,
  38631. newPosition: 0,
  38632. oldValue: props.modelValue
  38633. });
  38634. const tooltipPersistent = computed(() => !showTooltip.value ? false : persistent.value);
  38635. const { disabled, button, tooltip, showTooltip, persistent, tooltipVisible, wrapperStyle, formatValue, handleMouseEnter, handleMouseLeave, onButtonDown, onKeyDown, setPosition } = useSliderButton(props, initData, emit);
  38636. const { hovering, dragging } = toRefs(initData);
  38637. __expose({
  38638. onButtonDown,
  38639. onKeyDown,
  38640. setPosition,
  38641. hovering,
  38642. dragging
  38643. });
  38644. return (_ctx, _cache) => {
  38645. return openBlock(), createElementBlock("div", {
  38646. ref_key: "button",
  38647. ref: button,
  38648. class: normalizeClass([unref(ns).e("button-wrapper"), {
  38649. hover: unref(hovering),
  38650. dragging: unref(dragging)
  38651. }]),
  38652. style: normalizeStyle(unref(wrapperStyle)),
  38653. tabindex: unref(disabled) ? void 0 : 0,
  38654. onMouseenter: _cache[0] || (_cache[0] = (...args) => unref(handleMouseEnter) && unref(handleMouseEnter)(...args)),
  38655. onMouseleave: _cache[1] || (_cache[1] = (...args) => unref(handleMouseLeave) && unref(handleMouseLeave)(...args)),
  38656. onMousedown: _cache[2] || (_cache[2] = (...args) => unref(onButtonDown) && unref(onButtonDown)(...args)),
  38657. onFocus: _cache[3] || (_cache[3] = (...args) => unref(handleMouseEnter) && unref(handleMouseEnter)(...args)),
  38658. onBlur: _cache[4] || (_cache[4] = (...args) => unref(handleMouseLeave) && unref(handleMouseLeave)(...args)),
  38659. onKeydown: _cache[5] || (_cache[5] = (...args) => unref(onKeyDown) && unref(onKeyDown)(...args))
  38660. }, [createVNode(unref(ElTooltip), {
  38661. ref_key: "tooltip",
  38662. ref: tooltip,
  38663. visible: unref(tooltipVisible),
  38664. placement: _ctx.placement,
  38665. "fallback-placements": [
  38666. "top",
  38667. "bottom",
  38668. "right",
  38669. "left"
  38670. ],
  38671. "stop-popper-mouse-event": false,
  38672. "popper-class": _ctx.tooltipClass,
  38673. disabled: !unref(showTooltip),
  38674. persistent: tooltipPersistent.value
  38675. }, {
  38676. content: withCtx(() => [createElementVNode("span", null, toDisplayString(unref(formatValue)), 1)]),
  38677. default: withCtx(() => [createElementVNode("div", { class: normalizeClass([unref(ns).e("button"), {
  38678. hover: unref(hovering),
  38679. dragging: unref(dragging)
  38680. }]) }, null, 2)]),
  38681. _: 1
  38682. }, 8, [
  38683. "visible",
  38684. "placement",
  38685. "popper-class",
  38686. "disabled",
  38687. "persistent"
  38688. ])], 46, _hoisted_1$20);
  38689. };
  38690. }
  38691. });
  38692. //#endregion
  38693. //#region ../../packages/components/slider/src/button.vue
  38694. var button_default = button_vue_vue_type_script_setup_true_lang_default;
  38695. //#endregion
  38696. //#region ../../packages/components/slider/src/marker.ts
  38697. const sliderMarkerProps = buildProps({ mark: {
  38698. type: definePropType([String, Object]),
  38699. default: void 0
  38700. } });
  38701. var marker_default = defineComponent({
  38702. name: "ElSliderMarker",
  38703. props: sliderMarkerProps,
  38704. setup(props) {
  38705. const ns = useNamespace("slider");
  38706. const label = computed(() => {
  38707. return isString(props.mark) ? props.mark : props.mark.label;
  38708. });
  38709. const style = computed(() => isString(props.mark) ? void 0 : props.mark.style);
  38710. return () => h("div", {
  38711. class: ns.e("marks-text"),
  38712. style: style.value
  38713. }, label.value);
  38714. }
  38715. });
  38716. //#endregion
  38717. //#region ../../packages/components/slider/src/slider.vue?vue&type=script&setup=true&lang.ts
  38718. const _hoisted_1$19 = [
  38719. "id",
  38720. "role",
  38721. "aria-label",
  38722. "aria-labelledby"
  38723. ];
  38724. const _hoisted_2$12 = { key: 1 };
  38725. var slider_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  38726. name: "ElSlider",
  38727. __name: "slider",
  38728. props: sliderProps,
  38729. emits: sliderEmits,
  38730. setup(__props, { expose: __expose, emit: __emit }) {
  38731. const props = __props;
  38732. const emit = __emit;
  38733. const ns = useNamespace("slider");
  38734. const { t } = useLocale();
  38735. const initData = reactive({
  38736. firstValue: 0,
  38737. secondValue: 0,
  38738. oldValue: 0,
  38739. dragging: false,
  38740. sliderSize: 1
  38741. });
  38742. const { elFormItem, slider, firstButton, secondButton, sliderDisabled, minValue, maxValue, runwayStyle, barStyle, resetSize, emitChange, onSliderWrapperPrevent, onSliderClick, onSliderDown, onSliderMarkerDown, setFirstValue, setSecondValue } = useSlide(props, initData, emit);
  38743. const { stops, getStopStyle } = useStops(props, initData, minValue, maxValue);
  38744. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, { formItemContext: elFormItem });
  38745. const sliderWrapperSize = useFormSize();
  38746. const sliderInputSize = computed(() => props.inputSize || sliderWrapperSize.value);
  38747. const renderInput = computed(() => {
  38748. return props.showInput && !props.range && props.step !== "mark";
  38749. });
  38750. const groupLabel = computed(() => {
  38751. return props.ariaLabel || t("el.slider.defaultLabel", {
  38752. min: props.min,
  38753. max: props.max
  38754. });
  38755. });
  38756. const firstButtonLabel = computed(() => {
  38757. if (props.range) return props.rangeStartLabel || t("el.slider.defaultRangeStartLabel");
  38758. else return groupLabel.value;
  38759. });
  38760. const firstValueText = computed(() => {
  38761. return props.formatValueText ? props.formatValueText(firstValue.value) : `${firstValue.value}`;
  38762. });
  38763. const secondButtonLabel = computed(() => {
  38764. return props.rangeEndLabel || t("el.slider.defaultRangeEndLabel");
  38765. });
  38766. const secondValueText = computed(() => {
  38767. return props.formatValueText ? props.formatValueText(secondValue.value) : `${secondValue.value}`;
  38768. });
  38769. const sliderKls = computed(() => [
  38770. ns.b(),
  38771. ns.m(sliderWrapperSize.value),
  38772. ns.is("vertical", props.vertical),
  38773. { [ns.m("with-input")]: renderInput.value }
  38774. ]);
  38775. const markList = useMarks(props);
  38776. useWatch(props, initData, minValue, maxValue, emit, elFormItem);
  38777. const sliderInputStep = computed(() => {
  38778. return isNumber(props.step) ? props.step : 1;
  38779. });
  38780. const precision = computed(() => {
  38781. const stepValue = isNumber(props.step) ? props.step : 1;
  38782. const precisions = [
  38783. props.min,
  38784. props.max,
  38785. stepValue
  38786. ].map((item) => {
  38787. const decimal = `${item}`.split(".")[1];
  38788. return decimal ? decimal.length : 0;
  38789. });
  38790. return Math.max.apply(null, precisions);
  38791. });
  38792. const { sliderWrapper } = useLifecycle(props, initData, resetSize);
  38793. const { firstValue, secondValue, sliderSize } = toRefs(initData);
  38794. const updateDragging = (val) => {
  38795. initData.dragging = val;
  38796. };
  38797. useEventListener(sliderWrapper, "touchstart", onSliderWrapperPrevent, { passive: false });
  38798. useEventListener(sliderWrapper, "touchmove", onSliderWrapperPrevent, { passive: false });
  38799. provide(sliderContextKey, {
  38800. ...toRefs(props),
  38801. sliderSize,
  38802. disabled: sliderDisabled,
  38803. precision,
  38804. markList,
  38805. emitChange,
  38806. resetSize,
  38807. updateDragging
  38808. });
  38809. __expose({ onSliderClick });
  38810. return (_ctx, _cache) => {
  38811. return openBlock(), createElementBlock("div", {
  38812. id: _ctx.range ? unref(inputId) : void 0,
  38813. ref_key: "sliderWrapper",
  38814. ref: sliderWrapper,
  38815. class: normalizeClass(sliderKls.value),
  38816. role: _ctx.range ? "group" : void 0,
  38817. "aria-label": _ctx.range && !unref(isLabeledByFormItem) ? groupLabel.value : void 0,
  38818. "aria-labelledby": _ctx.range && unref(isLabeledByFormItem) ? unref(elFormItem)?.labelId : void 0
  38819. }, [createElementVNode("div", {
  38820. ref_key: "slider",
  38821. ref: slider,
  38822. class: normalizeClass([
  38823. unref(ns).e("runway"),
  38824. { "show-input": renderInput.value },
  38825. unref(ns).is("disabled", unref(sliderDisabled))
  38826. ]),
  38827. style: normalizeStyle(unref(runwayStyle)),
  38828. onMousedown: _cache[0] || (_cache[0] = (...args) => unref(onSliderDown) && unref(onSliderDown)(...args)),
  38829. onTouchstartPassive: _cache[1] || (_cache[1] = (...args) => unref(onSliderDown) && unref(onSliderDown)(...args))
  38830. }, [
  38831. createElementVNode("div", {
  38832. class: normalizeClass(unref(ns).e("bar")),
  38833. style: normalizeStyle(unref(barStyle))
  38834. }, null, 6),
  38835. createVNode(button_default, {
  38836. id: !_ctx.range ? unref(inputId) : void 0,
  38837. ref_key: "firstButton",
  38838. ref: firstButton,
  38839. "model-value": unref(firstValue),
  38840. vertical: _ctx.vertical,
  38841. "tooltip-class": _ctx.tooltipClass,
  38842. placement: _ctx.placement,
  38843. role: "slider",
  38844. "aria-label": _ctx.range || !unref(isLabeledByFormItem) ? firstButtonLabel.value : void 0,
  38845. "aria-labelledby": !_ctx.range && unref(isLabeledByFormItem) ? unref(elFormItem)?.labelId : void 0,
  38846. "aria-valuemin": _ctx.min,
  38847. "aria-valuemax": _ctx.range ? unref(secondValue) : _ctx.max,
  38848. "aria-valuenow": unref(firstValue),
  38849. "aria-valuetext": firstValueText.value,
  38850. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  38851. "aria-disabled": unref(sliderDisabled),
  38852. "onUpdate:modelValue": unref(setFirstValue)
  38853. }, null, 8, [
  38854. "id",
  38855. "model-value",
  38856. "vertical",
  38857. "tooltip-class",
  38858. "placement",
  38859. "aria-label",
  38860. "aria-labelledby",
  38861. "aria-valuemin",
  38862. "aria-valuemax",
  38863. "aria-valuenow",
  38864. "aria-valuetext",
  38865. "aria-orientation",
  38866. "aria-disabled",
  38867. "onUpdate:modelValue"
  38868. ]),
  38869. _ctx.range ? (openBlock(), createBlock(button_default, {
  38870. key: 0,
  38871. ref_key: "secondButton",
  38872. ref: secondButton,
  38873. "model-value": unref(secondValue),
  38874. vertical: _ctx.vertical,
  38875. "tooltip-class": _ctx.tooltipClass,
  38876. placement: _ctx.placement,
  38877. role: "slider",
  38878. "aria-label": secondButtonLabel.value,
  38879. "aria-valuemin": unref(firstValue),
  38880. "aria-valuemax": _ctx.max,
  38881. "aria-valuenow": unref(secondValue),
  38882. "aria-valuetext": secondValueText.value,
  38883. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  38884. "aria-disabled": unref(sliderDisabled),
  38885. "onUpdate:modelValue": unref(setSecondValue)
  38886. }, null, 8, [
  38887. "model-value",
  38888. "vertical",
  38889. "tooltip-class",
  38890. "placement",
  38891. "aria-label",
  38892. "aria-valuemin",
  38893. "aria-valuemax",
  38894. "aria-valuenow",
  38895. "aria-valuetext",
  38896. "aria-orientation",
  38897. "aria-disabled",
  38898. "onUpdate:modelValue"
  38899. ])) : createCommentVNode("v-if", true),
  38900. _ctx.showStops ? (openBlock(), createElementBlock("div", _hoisted_2$12, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(stops), (item, key) => {
  38901. return openBlock(), createElementBlock("div", {
  38902. key,
  38903. class: normalizeClass(unref(ns).e("stop")),
  38904. style: normalizeStyle(unref(getStopStyle)(item))
  38905. }, null, 6);
  38906. }), 128))])) : createCommentVNode("v-if", true),
  38907. unref(markList).length > 0 ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [createElementVNode("div", null, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(markList), (item, key) => {
  38908. return openBlock(), createElementBlock("div", {
  38909. key,
  38910. style: normalizeStyle(unref(getStopStyle)(item.position)),
  38911. class: normalizeClass([unref(ns).e("stop"), unref(ns).e("marks-stop")])
  38912. }, null, 6);
  38913. }), 128))]), createElementVNode("div", { class: normalizeClass(unref(ns).e("marks")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(markList), (item, key) => {
  38914. return openBlock(), createBlock(unref(marker_default), {
  38915. key,
  38916. mark: item.mark,
  38917. style: normalizeStyle(unref(getStopStyle)(item.position)),
  38918. onMousedown: withModifiers(($event) => unref(onSliderMarkerDown)(item.position), ["stop"])
  38919. }, null, 8, [
  38920. "mark",
  38921. "style",
  38922. "onMousedown"
  38923. ]);
  38924. }), 128))], 2)], 64)) : createCommentVNode("v-if", true)
  38925. ], 38), renderInput.value ? (openBlock(), createBlock(unref(ElInputNumber), {
  38926. key: 0,
  38927. ref: "input",
  38928. "model-value": unref(firstValue),
  38929. class: normalizeClass(unref(ns).e("input")),
  38930. step: sliderInputStep.value,
  38931. disabled: unref(sliderDisabled),
  38932. controls: _ctx.showInputControls,
  38933. min: _ctx.min,
  38934. max: _ctx.max,
  38935. precision: precision.value,
  38936. size: sliderInputSize.value,
  38937. "onUpdate:modelValue": unref(setFirstValue),
  38938. onChange: unref(emitChange)
  38939. }, null, 8, [
  38940. "model-value",
  38941. "class",
  38942. "step",
  38943. "disabled",
  38944. "controls",
  38945. "min",
  38946. "max",
  38947. "precision",
  38948. "size",
  38949. "onUpdate:modelValue",
  38950. "onChange"
  38951. ])) : createCommentVNode("v-if", true)], 10, _hoisted_1$19);
  38952. };
  38953. }
  38954. });
  38955. //#endregion
  38956. //#region ../../packages/components/slider/src/slider.vue
  38957. var slider_default = slider_vue_vue_type_script_setup_true_lang_default;
  38958. //#endregion
  38959. //#region ../../packages/components/slider/index.ts
  38960. const ElSlider = withInstall(slider_default);
  38961. //#endregion
  38962. //#region ../../packages/components/space/src/item.ts
  38963. const spaceItemProps = buildProps({ prefixCls: { type: String } });
  38964. const SpaceItem = defineComponent({
  38965. name: "ElSpaceItem",
  38966. props: spaceItemProps,
  38967. setup(props, { slots }) {
  38968. const ns = useNamespace("space");
  38969. const classes = computed(() => `${props.prefixCls || ns.b()}__item`);
  38970. return () => h("div", { class: classes.value }, renderSlot(slots, "default"));
  38971. }
  38972. });
  38973. //#endregion
  38974. //#region ../../packages/components/space/src/use-space.ts
  38975. const SIZE_MAP = {
  38976. small: 8,
  38977. default: 12,
  38978. large: 16
  38979. };
  38980. function useSpace(props) {
  38981. const ns = useNamespace("space");
  38982. const classes = computed(() => [
  38983. ns.b(),
  38984. ns.m(props.direction),
  38985. props.class
  38986. ]);
  38987. const horizontalSize = ref(0);
  38988. const verticalSize = ref(0);
  38989. const containerStyle = computed(() => {
  38990. return [
  38991. props.wrap || props.fill ? { flexWrap: "wrap" } : {},
  38992. { alignItems: props.alignment },
  38993. {
  38994. rowGap: `${verticalSize.value}px`,
  38995. columnGap: `${horizontalSize.value}px`
  38996. },
  38997. props.style
  38998. ];
  38999. });
  39000. const itemStyle = computed(() => {
  39001. return props.fill ? {
  39002. flexGrow: 1,
  39003. minWidth: `${props.fillRatio}%`
  39004. } : {};
  39005. });
  39006. watchEffect(() => {
  39007. const { size = "small", wrap, direction: dir, fill } = props;
  39008. if (isArray$1(size)) {
  39009. const [h = 0, v = 0] = size;
  39010. horizontalSize.value = h;
  39011. verticalSize.value = v;
  39012. } else {
  39013. let val;
  39014. if (isNumber(size)) val = size;
  39015. else val = SIZE_MAP[size || "small"] || SIZE_MAP.small;
  39016. if ((wrap || fill) && dir === "horizontal") horizontalSize.value = verticalSize.value = val;
  39017. else if (dir === "horizontal") {
  39018. horizontalSize.value = val;
  39019. verticalSize.value = 0;
  39020. } else {
  39021. verticalSize.value = val;
  39022. horizontalSize.value = 0;
  39023. }
  39024. }
  39025. });
  39026. return {
  39027. classes,
  39028. containerStyle,
  39029. itemStyle
  39030. };
  39031. }
  39032. //#endregion
  39033. //#region ../../packages/components/space/src/space.ts
  39034. const spaceProps = buildProps({
  39035. direction: {
  39036. type: String,
  39037. values: ["horizontal", "vertical"],
  39038. default: "horizontal"
  39039. },
  39040. class: {
  39041. type: definePropType([
  39042. String,
  39043. Object,
  39044. Array
  39045. ]),
  39046. default: ""
  39047. },
  39048. style: {
  39049. type: definePropType([
  39050. String,
  39051. Array,
  39052. Object,
  39053. Boolean
  39054. ]),
  39055. default: ""
  39056. },
  39057. alignment: {
  39058. type: definePropType(String),
  39059. default: "center"
  39060. },
  39061. prefixCls: { type: String },
  39062. spacer: {
  39063. type: definePropType([
  39064. Object,
  39065. String,
  39066. Number,
  39067. Array
  39068. ]),
  39069. default: null,
  39070. validator: (val) => isVNode(val) || isNumber(val) || isString(val)
  39071. },
  39072. wrap: Boolean,
  39073. fill: Boolean,
  39074. fillRatio: {
  39075. type: Number,
  39076. default: 100
  39077. },
  39078. size: {
  39079. type: [
  39080. String,
  39081. Array,
  39082. Number
  39083. ],
  39084. values: componentSizes,
  39085. validator: (val) => {
  39086. return isNumber(val) || isArray$1(val) && val.length === 2 && val.every(isNumber);
  39087. }
  39088. }
  39089. });
  39090. const Space = defineComponent({
  39091. name: "ElSpace",
  39092. props: spaceProps,
  39093. setup(props, { slots }) {
  39094. const { classes, containerStyle, itemStyle } = useSpace(props);
  39095. function extractChildren(children, parentKey = "", extractedChildren = []) {
  39096. const { prefixCls } = props;
  39097. children.forEach((child, loopKey) => {
  39098. if (isFragment(child)) {
  39099. if (isArray$1(child.children)) child.children.forEach((nested, key) => {
  39100. if (isFragment(nested) && isArray$1(nested.children)) extractChildren(nested.children, `${parentKey + key}-`, extractedChildren);
  39101. else if (isVNode(nested) && nested?.type === Comment) extractedChildren.push(nested);
  39102. else extractedChildren.push(createVNode(SpaceItem, {
  39103. style: itemStyle.value,
  39104. prefixCls,
  39105. key: `nested-${parentKey + key}`
  39106. }, { default: () => [nested] }, 8 | 4, ["style", "prefixCls"]));
  39107. });
  39108. } else if (isValidElementNode(child)) extractedChildren.push(createVNode(SpaceItem, {
  39109. style: itemStyle.value,
  39110. prefixCls,
  39111. key: `LoopKey${parentKey + loopKey}`
  39112. }, { default: () => [child] }, 8 | 4, ["style", "prefixCls"]));
  39113. });
  39114. return extractedChildren;
  39115. }
  39116. return () => {
  39117. const { spacer, direction } = props;
  39118. const children = renderSlot(slots, "default", { key: 0 }, () => []);
  39119. if ((children.children ?? []).length === 0) return null;
  39120. if (isArray$1(children.children)) {
  39121. let extractedChildren = extractChildren(children.children);
  39122. if (spacer) {
  39123. const len = extractedChildren.length - 1;
  39124. extractedChildren = extractedChildren.reduce((acc, child, idx) => {
  39125. const children = [...acc, child];
  39126. if (idx !== len) children.push(createVNode("span", {
  39127. style: [itemStyle.value, direction === "vertical" ? "width: 100%" : null],
  39128. key: idx
  39129. }, [isVNode(spacer) ? spacer : createTextVNode(spacer, 1)], 4));
  39130. return children;
  39131. }, []);
  39132. }
  39133. return createVNode("div", {
  39134. class: classes.value,
  39135. style: containerStyle.value
  39136. }, extractedChildren, 4 | 2);
  39137. }
  39138. return children.children;
  39139. };
  39140. }
  39141. });
  39142. //#endregion
  39143. //#region ../../packages/components/space/index.ts
  39144. const ElSpace = withInstall(Space);
  39145. //#endregion
  39146. //#region ../../packages/components/statistic/src/statistic.ts
  39147. const statisticProps = buildProps({
  39148. decimalSeparator: {
  39149. type: String,
  39150. default: "."
  39151. },
  39152. groupSeparator: {
  39153. type: String,
  39154. default: ","
  39155. },
  39156. precision: {
  39157. type: Number,
  39158. default: 0
  39159. },
  39160. formatter: Function,
  39161. value: {
  39162. type: definePropType([Number, Object]),
  39163. default: 0
  39164. },
  39165. prefix: String,
  39166. suffix: String,
  39167. title: String,
  39168. valueStyle: {
  39169. type: definePropType([
  39170. String,
  39171. Object,
  39172. Array,
  39173. Boolean
  39174. ]),
  39175. default: void 0
  39176. }
  39177. });
  39178. //#endregion
  39179. //#region ../../packages/components/statistic/src/statistic.vue?vue&type=script&setup=true&lang.ts
  39180. var statistic_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  39181. name: "ElStatistic",
  39182. __name: "statistic",
  39183. props: statisticProps,
  39184. setup(__props, { expose: __expose }) {
  39185. const props = __props;
  39186. const ns = useNamespace("statistic");
  39187. const displayValue = computed(() => {
  39188. const { value, formatter, precision, decimalSeparator, groupSeparator } = props;
  39189. if (isFunction$1(formatter)) return formatter(value);
  39190. if (!isNumber(value) || Number.isNaN(value)) return value;
  39191. let [integer, decimal = ""] = String(value).split(".");
  39192. decimal = decimal.padEnd(precision, "0").slice(0, precision > 0 ? precision : 0);
  39193. integer = integer.replace(/\B(?=(\d{3})+(?!\d))/g, groupSeparator);
  39194. return [integer, decimal].join(decimal ? decimalSeparator : "");
  39195. });
  39196. __expose({ displayValue });
  39197. return (_ctx, _cache) => {
  39198. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b()) }, [_ctx.$slots.title || __props.title ? (openBlock(), createElementBlock("div", {
  39199. key: 0,
  39200. class: normalizeClass(unref(ns).e("head"))
  39201. }, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 2)) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("content")) }, [
  39202. _ctx.$slots.prefix || __props.prefix ? (openBlock(), createElementBlock("div", {
  39203. key: 0,
  39204. class: normalizeClass(unref(ns).e("prefix"))
  39205. }, [renderSlot(_ctx.$slots, "prefix", {}, () => [createElementVNode("span", null, toDisplayString(__props.prefix), 1)])], 2)) : createCommentVNode("v-if", true),
  39206. createElementVNode("span", {
  39207. class: normalizeClass(unref(ns).e("number")),
  39208. style: normalizeStyle(__props.valueStyle)
  39209. }, toDisplayString(displayValue.value), 7),
  39210. _ctx.$slots.suffix || __props.suffix ? (openBlock(), createElementBlock("div", {
  39211. key: 1,
  39212. class: normalizeClass(unref(ns).e("suffix"))
  39213. }, [renderSlot(_ctx.$slots, "suffix", {}, () => [createElementVNode("span", null, toDisplayString(__props.suffix), 1)])], 2)) : createCommentVNode("v-if", true)
  39214. ], 2)], 2);
  39215. };
  39216. }
  39217. });
  39218. //#endregion
  39219. //#region ../../packages/components/statistic/src/statistic.vue
  39220. var statistic_default = statistic_vue_vue_type_script_setup_true_lang_default;
  39221. //#endregion
  39222. //#region ../../packages/components/statistic/index.ts
  39223. const ElStatistic = withInstall(statistic_default);
  39224. //#endregion
  39225. //#region ../../packages/components/countdown/src/countdown.ts
  39226. const countdownProps = buildProps({
  39227. format: {
  39228. type: String,
  39229. default: "HH:mm:ss"
  39230. },
  39231. prefix: String,
  39232. suffix: String,
  39233. title: String,
  39234. value: {
  39235. type: definePropType([Number, Object]),
  39236. default: 0
  39237. },
  39238. valueStyle: {
  39239. type: definePropType([
  39240. String,
  39241. Object,
  39242. Array,
  39243. Boolean
  39244. ]),
  39245. default: void 0
  39246. }
  39247. });
  39248. const countdownEmits = {
  39249. finish: () => true,
  39250. [CHANGE_EVENT]: (value) => isNumber(value)
  39251. };
  39252. //#endregion
  39253. //#region ../../packages/components/countdown/src/utils.ts
  39254. const timeUnits$1 = [
  39255. ["Y", 1e3 * 60 * 60 * 24 * 365],
  39256. ["M", 1e3 * 60 * 60 * 24 * 30],
  39257. ["D", 1e3 * 60 * 60 * 24],
  39258. ["H", 1e3 * 60 * 60],
  39259. ["m", 1e3 * 60],
  39260. ["s", 1e3],
  39261. ["S", 1]
  39262. ];
  39263. const getTime = (value) => {
  39264. return isNumber(value) ? new Date(value).getTime() : value.valueOf();
  39265. };
  39266. const formatTime$1 = (timestamp, format) => {
  39267. let timeLeft = timestamp;
  39268. return timeUnits$1.reduce((current, [name, unit]) => {
  39269. const replaceRegex = new RegExp(`${name}+(?![^\\[\\]]*\\])`, "g");
  39270. if (replaceRegex.test(current)) {
  39271. const value = Math.floor(timeLeft / unit);
  39272. timeLeft -= value * unit;
  39273. return current.replace(replaceRegex, (match) => String(value).padStart(match.length, "0"));
  39274. }
  39275. return current;
  39276. }, format).replace(/\[([^\]]*)]/g, "$1");
  39277. };
  39278. //#endregion
  39279. //#region ../../packages/components/countdown/src/countdown.vue?vue&type=script&setup=true&lang.ts
  39280. var countdown_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  39281. name: "ElCountdown",
  39282. __name: "countdown",
  39283. props: countdownProps,
  39284. emits: countdownEmits,
  39285. setup(__props, { expose: __expose, emit: __emit }) {
  39286. const props = __props;
  39287. const emit = __emit;
  39288. let timer;
  39289. const rawValue = ref(0);
  39290. const displayValue = computed(() => formatTime$1(rawValue.value, props.format));
  39291. const formatter = (val) => formatTime$1(val, props.format);
  39292. const stopTimer = () => {
  39293. if (timer) {
  39294. cAF(timer);
  39295. timer = void 0;
  39296. }
  39297. };
  39298. const startTimer = () => {
  39299. const timestamp = getTime(props.value);
  39300. const frameFunc = () => {
  39301. let diff = timestamp - Date.now();
  39302. emit(CHANGE_EVENT, diff);
  39303. if (diff <= 0) {
  39304. diff = 0;
  39305. stopTimer();
  39306. emit("finish");
  39307. } else timer = rAF(frameFunc);
  39308. rawValue.value = diff;
  39309. };
  39310. timer = rAF(frameFunc);
  39311. };
  39312. onMounted(() => {
  39313. rawValue.value = getTime(props.value) - Date.now();
  39314. watch(() => [props.value, props.format], () => {
  39315. stopTimer();
  39316. startTimer();
  39317. }, { immediate: true });
  39318. });
  39319. onBeforeUnmount(() => {
  39320. stopTimer();
  39321. });
  39322. __expose({ displayValue });
  39323. return (_ctx, _cache) => {
  39324. return openBlock(), createBlock(unref(ElStatistic), {
  39325. value: rawValue.value,
  39326. title: __props.title,
  39327. prefix: __props.prefix,
  39328. suffix: __props.suffix,
  39329. "value-style": __props.valueStyle,
  39330. formatter
  39331. }, createSlots({ _: 2 }, [renderList(_ctx.$slots, (_, name) => {
  39332. return {
  39333. name,
  39334. fn: withCtx(() => [renderSlot(_ctx.$slots, name)])
  39335. };
  39336. })]), 1032, [
  39337. "value",
  39338. "title",
  39339. "prefix",
  39340. "suffix",
  39341. "value-style"
  39342. ]);
  39343. };
  39344. }
  39345. });
  39346. //#endregion
  39347. //#region ../../packages/components/countdown/src/countdown.vue
  39348. var countdown_default = countdown_vue_vue_type_script_setup_true_lang_default;
  39349. //#endregion
  39350. //#region ../../packages/components/countdown/index.ts
  39351. const ElCountdown = withInstall(countdown_default);
  39352. //#endregion
  39353. //#region ../../packages/components/steps/src/steps.ts
  39354. const stepsProps = buildProps({
  39355. space: {
  39356. type: [Number, String],
  39357. default: ""
  39358. },
  39359. active: {
  39360. type: Number,
  39361. default: 0
  39362. },
  39363. direction: {
  39364. type: String,
  39365. default: "horizontal",
  39366. values: ["horizontal", "vertical"]
  39367. },
  39368. alignCenter: { type: Boolean },
  39369. simple: { type: Boolean },
  39370. finishStatus: {
  39371. type: String,
  39372. values: [
  39373. "wait",
  39374. "process",
  39375. "finish",
  39376. "error",
  39377. "success"
  39378. ],
  39379. default: "finish"
  39380. },
  39381. processStatus: {
  39382. type: String,
  39383. values: [
  39384. "wait",
  39385. "process",
  39386. "finish",
  39387. "error",
  39388. "success"
  39389. ],
  39390. default: "process"
  39391. }
  39392. });
  39393. const stepsEmits = { [CHANGE_EVENT]: (newVal, oldVal) => [newVal, oldVal].every(isNumber) };
  39394. //#endregion
  39395. //#region ../../packages/components/steps/src/tokens.ts
  39396. const STEPS_INJECTION_KEY = "ElSteps";
  39397. //#endregion
  39398. //#region ../../packages/components/steps/src/steps.vue?vue&type=script&setup=true&lang.ts
  39399. var steps_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  39400. name: "ElSteps",
  39401. __name: "steps",
  39402. props: stepsProps,
  39403. emits: stepsEmits,
  39404. setup(__props, { emit: __emit }) {
  39405. const props = __props;
  39406. const emit = __emit;
  39407. const ns = useNamespace("steps");
  39408. const { children: steps, addChild: addStep, removeChild: removeStep, ChildrenSorter: StepsSorter } = useOrderedChildren(getCurrentInstance(), "ElStep");
  39409. watch(steps, () => {
  39410. steps.value.forEach((instance, index) => {
  39411. instance.setIndex(index);
  39412. });
  39413. });
  39414. provide(STEPS_INJECTION_KEY, {
  39415. props,
  39416. steps,
  39417. addStep,
  39418. removeStep
  39419. });
  39420. watch(() => props.active, (newVal, oldVal) => {
  39421. emit(CHANGE_EVENT, newVal, oldVal);
  39422. });
  39423. return (_ctx, _cache) => {
  39424. return openBlock(), createElementBlock("div", { class: normalizeClass([unref(ns).b(), unref(ns).m(__props.simple ? "simple" : __props.direction)]) }, [renderSlot(_ctx.$slots, "default"), createVNode(unref(StepsSorter))], 2);
  39425. };
  39426. }
  39427. });
  39428. //#endregion
  39429. //#region ../../packages/components/steps/src/steps.vue
  39430. var steps_default$1 = steps_vue_vue_type_script_setup_true_lang_default;
  39431. //#endregion
  39432. //#region ../../packages/components/steps/src/item.ts
  39433. const stepProps = buildProps({
  39434. title: {
  39435. type: String,
  39436. default: ""
  39437. },
  39438. icon: { type: iconPropType },
  39439. description: {
  39440. type: String,
  39441. default: ""
  39442. },
  39443. status: {
  39444. type: String,
  39445. values: [
  39446. "",
  39447. "wait",
  39448. "process",
  39449. "finish",
  39450. "error",
  39451. "success"
  39452. ],
  39453. default: ""
  39454. }
  39455. });
  39456. //#endregion
  39457. //#region ../../packages/components/steps/src/item.vue?vue&type=script&setup=true&lang.ts
  39458. var item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  39459. name: "ElStep",
  39460. __name: "item",
  39461. props: stepProps,
  39462. setup(__props) {
  39463. const props = __props;
  39464. const ns = useNamespace("step");
  39465. const index = ref(-1);
  39466. const lineStyle = ref({});
  39467. const internalStatus = ref("");
  39468. const parent = inject(STEPS_INJECTION_KEY);
  39469. const currentInstance = getCurrentInstance();
  39470. let stepDiff = 0;
  39471. let beforeActive = 0;
  39472. onMounted(() => {
  39473. watch([
  39474. () => parent.props.active,
  39475. () => parent.props.processStatus,
  39476. () => parent.props.finishStatus
  39477. ], ([active], [oldActive]) => {
  39478. beforeActive = oldActive || 0;
  39479. stepDiff = active - beforeActive;
  39480. updateStatus(active);
  39481. }, { immediate: true });
  39482. });
  39483. const currentStatus = computed(() => {
  39484. return props.status || internalStatus.value;
  39485. });
  39486. const prevInternalStatus = computed(() => {
  39487. const prevStep = parent.steps.value[index.value - 1];
  39488. return prevStep ? prevStep.internalStatus.value : "wait";
  39489. });
  39490. const isCenter = computed(() => {
  39491. return parent.props.alignCenter;
  39492. });
  39493. const isVertical = computed(() => {
  39494. return parent.props.direction === "vertical";
  39495. });
  39496. const isSimple = computed(() => {
  39497. return parent.props.simple;
  39498. });
  39499. const stepsCount = computed(() => {
  39500. return parent.steps.value.length;
  39501. });
  39502. const isLast = computed(() => {
  39503. return parent.steps.value[stepsCount.value - 1]?.uid === currentInstance.uid;
  39504. });
  39505. const space = computed(() => {
  39506. return isSimple.value ? "" : parent.props.space;
  39507. });
  39508. const containerKls = computed(() => {
  39509. return [
  39510. ns.b(),
  39511. ns.is(isSimple.value ? "simple" : parent.props.direction),
  39512. ns.is("flex", isLast.value && !space.value && !isCenter.value),
  39513. ns.is("center", isCenter.value && !isVertical.value && !isSimple.value)
  39514. ];
  39515. });
  39516. const style = computed(() => {
  39517. const style = { flexBasis: isNumber(space.value) ? `${space.value}px` : space.value ? space.value : `${100 / (stepsCount.value - (isCenter.value ? 0 : 1))}%` };
  39518. if (isVertical.value) return style;
  39519. if (isLast.value) style.maxWidth = `${100 / stepsCount.value}%`;
  39520. return style;
  39521. });
  39522. const setIndex = (val) => {
  39523. index.value = val;
  39524. };
  39525. const calcProgress = (status) => {
  39526. const isWait = status === "wait";
  39527. const style = { transitionDelay: `${Math.abs(stepDiff) === 1 ? 0 : stepDiff > 0 ? (index.value + 1 - beforeActive) * 150 : -(index.value + 1 - parent.props.active) * 150}ms` };
  39528. const step = status === parent.props.processStatus || isWait ? 0 : 100;
  39529. style.borderWidth = step && !isSimple.value ? "1px" : 0;
  39530. style[parent.props.direction === "vertical" ? "height" : "width"] = `${step}%`;
  39531. lineStyle.value = style;
  39532. };
  39533. const updateStatus = (activeIndex) => {
  39534. if (activeIndex > index.value) internalStatus.value = parent.props.finishStatus;
  39535. else if (activeIndex === index.value && prevInternalStatus.value !== "error") internalStatus.value = parent.props.processStatus;
  39536. else internalStatus.value = "wait";
  39537. const prevChild = parent.steps.value[index.value - 1];
  39538. if (prevChild) prevChild.calcProgress(internalStatus.value);
  39539. };
  39540. const stepItemState = {
  39541. uid: currentInstance.uid,
  39542. getVnode: () => currentInstance.vnode,
  39543. currentStatus,
  39544. internalStatus,
  39545. setIndex,
  39546. calcProgress
  39547. };
  39548. parent.addStep(stepItemState);
  39549. onBeforeUnmount(() => {
  39550. parent.removeStep(stepItemState);
  39551. });
  39552. return (_ctx, _cache) => {
  39553. return openBlock(), createElementBlock("div", {
  39554. style: normalizeStyle(style.value),
  39555. class: normalizeClass(containerKls.value)
  39556. }, [
  39557. createCommentVNode(" icon & line "),
  39558. createElementVNode("div", { class: normalizeClass([unref(ns).e("head"), unref(ns).is(currentStatus.value)]) }, [!isSimple.value ? (openBlock(), createElementBlock("div", {
  39559. key: 0,
  39560. class: normalizeClass(unref(ns).e("line"))
  39561. }, [createElementVNode("i", {
  39562. class: normalizeClass(unref(ns).e("line-inner")),
  39563. style: normalizeStyle(lineStyle.value)
  39564. }, null, 6)], 2)) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass([unref(ns).e("icon"), unref(ns).is(__props.icon || _ctx.$slots.icon ? "icon" : "text")]) }, [renderSlot(_ctx.$slots, "icon", {}, () => [__props.icon ? (openBlock(), createBlock(unref(ElIcon), {
  39565. key: 0,
  39566. class: normalizeClass(unref(ns).e("icon-inner"))
  39567. }, {
  39568. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
  39569. _: 1
  39570. }, 8, ["class"])) : currentStatus.value === "success" ? (openBlock(), createBlock(unref(ElIcon), {
  39571. key: 1,
  39572. class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
  39573. }, {
  39574. default: withCtx(() => [createVNode(unref(check_default))]),
  39575. _: 1
  39576. }, 8, ["class"])) : currentStatus.value === "error" ? (openBlock(), createBlock(unref(ElIcon), {
  39577. key: 2,
  39578. class: normalizeClass([unref(ns).e("icon-inner"), unref(ns).is("status")])
  39579. }, {
  39580. default: withCtx(() => [createVNode(unref(close_default))]),
  39581. _: 1
  39582. }, 8, ["class"])) : !isSimple.value ? (openBlock(), createElementBlock("div", {
  39583. key: 3,
  39584. class: normalizeClass(unref(ns).e("icon-inner"))
  39585. }, toDisplayString(index.value + 1), 3)) : createCommentVNode("v-if", true)])], 2)], 2),
  39586. createCommentVNode(" title & description "),
  39587. createElementVNode("div", { class: normalizeClass(unref(ns).e("main")) }, [createElementVNode("div", { class: normalizeClass([unref(ns).e("title"), unref(ns).is(currentStatus.value)]) }, [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 2), isSimple.value ? (openBlock(), createElementBlock("div", {
  39588. key: 0,
  39589. class: normalizeClass(unref(ns).e("arrow"))
  39590. }, null, 2)) : (openBlock(), createElementBlock("div", {
  39591. key: 1,
  39592. class: normalizeClass([unref(ns).e("description"), unref(ns).is(currentStatus.value)])
  39593. }, [renderSlot(_ctx.$slots, "description", {}, () => [createTextVNode(toDisplayString(__props.description), 1)])], 2))], 2)
  39594. ], 6);
  39595. };
  39596. }
  39597. });
  39598. //#endregion
  39599. //#region ../../packages/components/steps/src/item.vue
  39600. var item_default = item_vue_vue_type_script_setup_true_lang_default;
  39601. //#endregion
  39602. //#region ../../packages/components/steps/index.ts
  39603. const ElSteps = withInstall(steps_default$1, { Step: item_default });
  39604. const ElStep = withNoopInstall(item_default);
  39605. //#endregion
  39606. //#region ../../packages/components/switch/src/switch.ts
  39607. const switchProps = buildProps({
  39608. modelValue: {
  39609. type: [
  39610. Boolean,
  39611. String,
  39612. Number
  39613. ],
  39614. default: false
  39615. },
  39616. disabled: {
  39617. type: Boolean,
  39618. default: void 0
  39619. },
  39620. loading: Boolean,
  39621. size: {
  39622. type: String,
  39623. validator: isValidComponentSize
  39624. },
  39625. width: {
  39626. type: [String, Number],
  39627. default: ""
  39628. },
  39629. inlinePrompt: Boolean,
  39630. inactiveActionIcon: { type: iconPropType },
  39631. activeActionIcon: { type: iconPropType },
  39632. activeIcon: { type: iconPropType },
  39633. inactiveIcon: { type: iconPropType },
  39634. activeText: {
  39635. type: String,
  39636. default: ""
  39637. },
  39638. inactiveText: {
  39639. type: String,
  39640. default: ""
  39641. },
  39642. activeValue: {
  39643. type: [
  39644. Boolean,
  39645. String,
  39646. Number
  39647. ],
  39648. default: true
  39649. },
  39650. inactiveValue: {
  39651. type: [
  39652. Boolean,
  39653. String,
  39654. Number
  39655. ],
  39656. default: false
  39657. },
  39658. name: {
  39659. type: String,
  39660. default: ""
  39661. },
  39662. validateEvent: {
  39663. type: Boolean,
  39664. default: true
  39665. },
  39666. beforeChange: { type: definePropType(Function) },
  39667. id: String,
  39668. tabindex: { type: [String, Number] },
  39669. ...useAriaProps(["ariaLabel"])
  39670. });
  39671. const switchEmits = {
  39672. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  39673. [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  39674. [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
  39675. };
  39676. //#endregion
  39677. //#region ../../packages/components/switch/src/switch.vue?vue&type=script&setup=true&lang.ts
  39678. const _hoisted_1$18 = [
  39679. "id",
  39680. "aria-checked",
  39681. "aria-disabled",
  39682. "aria-label",
  39683. "name",
  39684. "true-value",
  39685. "false-value",
  39686. "disabled",
  39687. "tabindex"
  39688. ];
  39689. const _hoisted_2$11 = ["aria-hidden"];
  39690. const _hoisted_3$4 = { key: 1 };
  39691. const _hoisted_4$3 = { key: 1 };
  39692. const _hoisted_5$1 = ["aria-hidden"];
  39693. const COMPONENT_NAME$6 = "ElSwitch";
  39694. var switch_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  39695. name: COMPONENT_NAME$6,
  39696. __name: "switch",
  39697. props: switchProps,
  39698. emits: switchEmits,
  39699. setup(__props, { expose: __expose, emit: __emit }) {
  39700. const props = __props;
  39701. const emit = __emit;
  39702. const { formItem } = useFormItem();
  39703. const switchSize = useFormSize();
  39704. const ns = useNamespace("switch");
  39705. const { inputId } = useFormItemInputId(props, { formItemContext: formItem });
  39706. const switchDisabled = useFormDisabled(computed(() => {
  39707. if (props.loading) return true;
  39708. }));
  39709. const isControlled = ref(props.modelValue !== false);
  39710. const input = shallowRef();
  39711. const switchKls = computed(() => [
  39712. ns.b(),
  39713. ns.m(switchSize.value),
  39714. ns.is("disabled", switchDisabled.value),
  39715. ns.is("checked", checked.value)
  39716. ]);
  39717. const labelLeftKls = computed(() => [
  39718. ns.e("label"),
  39719. ns.em("label", "left"),
  39720. ns.is("active", !checked.value)
  39721. ]);
  39722. const labelRightKls = computed(() => [
  39723. ns.e("label"),
  39724. ns.em("label", "right"),
  39725. ns.is("active", checked.value)
  39726. ]);
  39727. const coreStyle = computed(() => ({ width: addUnit(props.width) }));
  39728. watch(() => props.modelValue, () => {
  39729. isControlled.value = true;
  39730. });
  39731. const actualValue = computed(() => {
  39732. return isControlled.value ? props.modelValue : false;
  39733. });
  39734. const checked = computed(() => actualValue.value === props.activeValue);
  39735. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  39736. /* @__PURE__ */ debugWarn(COMPONENT_NAME$6, "model-value must be active-value or inactive-value");
  39737. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  39738. emit(CHANGE_EVENT, props.inactiveValue);
  39739. emit(INPUT_EVENT, props.inactiveValue);
  39740. }
  39741. watch(checked, (val) => {
  39742. input.value.checked = val;
  39743. if (props.validateEvent) formItem?.validate?.("change").catch(NOOP);
  39744. });
  39745. const handleChange = () => {
  39746. const val = checked.value ? props.inactiveValue : props.activeValue;
  39747. emit(UPDATE_MODEL_EVENT, val);
  39748. emit(CHANGE_EVENT, val);
  39749. emit(INPUT_EVENT, val);
  39750. nextTick(() => {
  39751. input.value.checked = checked.value;
  39752. });
  39753. };
  39754. const switchValue = () => {
  39755. if (switchDisabled.value) return;
  39756. const { beforeChange } = props;
  39757. if (!beforeChange) {
  39758. handleChange();
  39759. return;
  39760. }
  39761. const shouldChange = beforeChange();
  39762. if (![isPromise(shouldChange), isBoolean(shouldChange)].includes(true)) throwError(COMPONENT_NAME$6, "beforeChange must return type `Promise<boolean>` or `boolean`");
  39763. if (isPromise(shouldChange)) shouldChange.then((result) => {
  39764. if (result) handleChange();
  39765. }).catch((e) => {
  39766. /* @__PURE__ */ debugWarn(COMPONENT_NAME$6, `some error occurred: ${e}`);
  39767. });
  39768. else if (shouldChange) handleChange();
  39769. };
  39770. const focus = () => {
  39771. input.value?.focus?.();
  39772. };
  39773. onMounted(() => {
  39774. input.value.checked = checked.value;
  39775. });
  39776. __expose({
  39777. focus,
  39778. checked
  39779. });
  39780. return (_ctx, _cache) => {
  39781. return openBlock(), createElementBlock("div", {
  39782. class: normalizeClass(switchKls.value),
  39783. onClick: withModifiers(switchValue, ["prevent"])
  39784. }, [
  39785. createElementVNode("input", {
  39786. id: unref(inputId),
  39787. ref_key: "input",
  39788. ref: input,
  39789. class: normalizeClass(unref(ns).e("input")),
  39790. type: "checkbox",
  39791. role: "switch",
  39792. "aria-checked": checked.value,
  39793. "aria-disabled": unref(switchDisabled),
  39794. "aria-label": __props.ariaLabel,
  39795. name: __props.name,
  39796. "true-value": __props.activeValue,
  39797. "false-value": __props.inactiveValue,
  39798. disabled: unref(switchDisabled),
  39799. tabindex: __props.tabindex,
  39800. onChange: handleChange,
  39801. onKeydown: withKeys(switchValue, ["enter"])
  39802. }, null, 42, _hoisted_1$18),
  39803. !__props.inlinePrompt && (__props.inactiveIcon || __props.inactiveText || _ctx.$slots.inactive) ? (openBlock(), createElementBlock("span", {
  39804. key: 0,
  39805. class: normalizeClass(labelLeftKls.value)
  39806. }, [renderSlot(_ctx.$slots, "inactive", {}, () => [__props.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  39807. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.inactiveIcon)))]),
  39808. _: 1
  39809. })) : createCommentVNode("v-if", true), !__props.inactiveIcon && __props.inactiveText ? (openBlock(), createElementBlock("span", {
  39810. key: 1,
  39811. "aria-hidden": checked.value
  39812. }, toDisplayString(__props.inactiveText), 9, _hoisted_2$11)) : createCommentVNode("v-if", true)])], 2)) : createCommentVNode("v-if", true),
  39813. createElementVNode("span", {
  39814. class: normalizeClass(unref(ns).e("core")),
  39815. style: normalizeStyle(coreStyle.value)
  39816. }, [__props.inlinePrompt ? (openBlock(), createElementBlock("div", {
  39817. key: 0,
  39818. class: normalizeClass(unref(ns).e("inner"))
  39819. }, [!checked.value ? (openBlock(), createElementBlock("div", {
  39820. key: 0,
  39821. class: normalizeClass(unref(ns).e("inner-wrapper"))
  39822. }, [renderSlot(_ctx.$slots, "inactive", {}, () => [__props.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  39823. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.inactiveIcon)))]),
  39824. _: 1
  39825. })) : createCommentVNode("v-if", true), !__props.inactiveIcon && __props.inactiveText ? (openBlock(), createElementBlock("span", _hoisted_3$4, toDisplayString(__props.inactiveText), 1)) : createCommentVNode("v-if", true)])], 2)) : (openBlock(), createElementBlock("div", {
  39826. key: 1,
  39827. class: normalizeClass(unref(ns).e("inner-wrapper"))
  39828. }, [renderSlot(_ctx.$slots, "active", {}, () => [__props.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  39829. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.activeIcon)))]),
  39830. _: 1
  39831. })) : createCommentVNode("v-if", true), !__props.activeIcon && __props.activeText ? (openBlock(), createElementBlock("span", _hoisted_4$3, toDisplayString(__props.activeText), 1)) : createCommentVNode("v-if", true)])], 2))], 2)) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("action")) }, [__props.loading ? (openBlock(), createBlock(unref(ElIcon), {
  39832. key: 0,
  39833. class: normalizeClass(unref(ns).is("loading"))
  39834. }, {
  39835. default: withCtx(() => [createVNode(unref(loading_default))]),
  39836. _: 1
  39837. }, 8, ["class"])) : checked.value ? renderSlot(_ctx.$slots, "active-action", { key: 1 }, () => [__props.activeActionIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  39838. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.activeActionIcon)))]),
  39839. _: 1
  39840. })) : createCommentVNode("v-if", true)]) : !checked.value ? renderSlot(_ctx.$slots, "inactive-action", { key: 2 }, () => [__props.inactiveActionIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  39841. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.inactiveActionIcon)))]),
  39842. _: 1
  39843. })) : createCommentVNode("v-if", true)]) : createCommentVNode("v-if", true)], 2)], 6),
  39844. !__props.inlinePrompt && (__props.activeIcon || __props.activeText || _ctx.$slots.active) ? (openBlock(), createElementBlock("span", {
  39845. key: 1,
  39846. class: normalizeClass(labelRightKls.value)
  39847. }, [renderSlot(_ctx.$slots, "active", {}, () => [__props.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  39848. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.activeIcon)))]),
  39849. _: 1
  39850. })) : createCommentVNode("v-if", true), !__props.activeIcon && __props.activeText ? (openBlock(), createElementBlock("span", {
  39851. key: 1,
  39852. "aria-hidden": !checked.value
  39853. }, toDisplayString(__props.activeText), 9, _hoisted_5$1)) : createCommentVNode("v-if", true)])], 2)) : createCommentVNode("v-if", true)
  39854. ], 2);
  39855. };
  39856. }
  39857. });
  39858. //#endregion
  39859. //#region ../../packages/components/switch/src/switch.vue
  39860. var switch_default = switch_vue_vue_type_script_setup_true_lang_default;
  39861. //#endregion
  39862. //#region ../../packages/components/switch/index.ts
  39863. const ElSwitch = withInstall(switch_default);
  39864. //#endregion
  39865. //#region ../../packages/components/table/src/table/defaults.ts
  39866. const tableProps = {
  39867. data: {
  39868. type: Array,
  39869. default: () => []
  39870. },
  39871. size: useSizeProp,
  39872. width: [String, Number],
  39873. height: [String, Number],
  39874. maxHeight: [String, Number],
  39875. fit: {
  39876. type: Boolean,
  39877. default: true
  39878. },
  39879. stripe: Boolean,
  39880. border: Boolean,
  39881. rowKey: [String, Function],
  39882. showHeader: {
  39883. type: Boolean,
  39884. default: true
  39885. },
  39886. showSummary: Boolean,
  39887. sumText: String,
  39888. summaryMethod: Function,
  39889. rowClassName: [String, Function],
  39890. rowStyle: [Object, Function],
  39891. cellClassName: [String, Function],
  39892. cellStyle: [Object, Function],
  39893. headerRowClassName: [String, Function],
  39894. headerRowStyle: [Object, Function],
  39895. headerCellClassName: [String, Function],
  39896. headerCellStyle: [Object, Function],
  39897. highlightCurrentRow: Boolean,
  39898. currentRowKey: [String, Number],
  39899. emptyText: String,
  39900. expandRowKeys: Array,
  39901. defaultExpandAll: Boolean,
  39902. rowExpandable: { type: Function },
  39903. defaultSort: Object,
  39904. tooltipEffect: String,
  39905. tooltipOptions: Object,
  39906. spanMethod: Function,
  39907. selectOnIndeterminate: {
  39908. type: Boolean,
  39909. default: true
  39910. },
  39911. indent: {
  39912. type: Number,
  39913. default: 16
  39914. },
  39915. treeProps: {
  39916. type: Object,
  39917. default: () => {
  39918. return {
  39919. hasChildren: "hasChildren",
  39920. children: "children",
  39921. checkStrictly: false
  39922. };
  39923. }
  39924. },
  39925. lazy: Boolean,
  39926. load: Function,
  39927. style: {
  39928. type: [
  39929. String,
  39930. Object,
  39931. Array,
  39932. Boolean
  39933. ],
  39934. default: () => ({})
  39935. },
  39936. className: {
  39937. type: String,
  39938. default: ""
  39939. },
  39940. tableLayout: {
  39941. type: String,
  39942. default: "fixed"
  39943. },
  39944. scrollbarAlwaysOn: Boolean,
  39945. flexible: Boolean,
  39946. showOverflowTooltip: {
  39947. type: [Boolean, Object],
  39948. default: void 0
  39949. },
  39950. tooltipFormatter: Function,
  39951. appendFilterPanelTo: String,
  39952. scrollbarTabindex: {
  39953. type: [Number, String],
  39954. default: void 0
  39955. },
  39956. allowDragLastColumn: {
  39957. type: Boolean,
  39958. default: true
  39959. },
  39960. preserveExpandedContent: Boolean,
  39961. nativeScrollbar: Boolean
  39962. };
  39963. //#endregion
  39964. //#region ../../packages/components/table/src/util.ts
  39965. let tableIdSeed = 1;
  39966. let columnIdSeed = 1;
  39967. const createTableId = (namespace) => `${namespace}-table_${tableIdSeed++}`;
  39968. const createTableColumnId = (parentId) => `${parentId}_column_${columnIdSeed++}`;
  39969. const getCell = function(event) {
  39970. return event.target?.closest("td");
  39971. };
  39972. const orderBy = function(array, sortKey, reverse, sortMethod, sortBy) {
  39973. if (!sortKey && !sortMethod && (!sortBy || isArray$1(sortBy) && !sortBy.length)) return array;
  39974. if (isString(reverse)) reverse = reverse === "descending" ? -1 : 1;
  39975. else reverse = reverse && reverse < 0 ? -1 : 1;
  39976. const getKey = sortMethod ? null : function(value, index) {
  39977. if (sortBy) return flatMap(castArray$1(sortBy), (by) => {
  39978. if (isString(by)) return get(value, by);
  39979. else return by(value, index, array);
  39980. });
  39981. if (sortKey !== "$key") {
  39982. if (isObject$1(value) && "$value" in value) value = value.$value;
  39983. }
  39984. return [isObject$1(value) ? sortKey ? get(value, sortKey) : null : value];
  39985. };
  39986. const compare = function(a, b) {
  39987. if (sortMethod) return sortMethod(a.value, b.value);
  39988. for (let i = 0, len = a.key?.length ?? 0; i < len; i++) {
  39989. if (a.key?.[i] < b.key?.[i]) return -1;
  39990. if (a.key?.[i] > b.key?.[i]) return 1;
  39991. }
  39992. return 0;
  39993. };
  39994. return array.map((value, index) => {
  39995. return {
  39996. value,
  39997. index,
  39998. key: getKey ? getKey(value, index) : null
  39999. };
  40000. }).sort((a, b) => {
  40001. let order = compare(a, b);
  40002. if (!order) order = a.index - b.index;
  40003. return order * +reverse;
  40004. }).map((item) => item.value);
  40005. };
  40006. const getColumnById = function(table, columnId) {
  40007. let column = null;
  40008. table.columns.forEach((item) => {
  40009. if (item.id === columnId) column = item;
  40010. });
  40011. return column;
  40012. };
  40013. const getColumnByKey = function(table, columnKey) {
  40014. let column = null;
  40015. for (let i = 0; i < table.columns.length; i++) {
  40016. const item = table.columns[i];
  40017. if (item.columnKey === columnKey) {
  40018. column = item;
  40019. break;
  40020. }
  40021. }
  40022. if (!column) throwError("ElTable", `No column matching with column-key: ${columnKey}`);
  40023. return column;
  40024. };
  40025. const getColumnByCell = function(table, cell, namespace) {
  40026. const matches = (cell.className || "").match(new RegExp(`${namespace}-table_[^\\s]+`, "gm"));
  40027. if (matches) return getColumnById(table, matches[0]);
  40028. return null;
  40029. };
  40030. const getRowIdentity = (row, rowKey) => {
  40031. if (!row) throw new Error("Row is required when get row identity");
  40032. if (isString(rowKey)) {
  40033. if (!rowKey.includes(".")) return `${row[rowKey]}`;
  40034. const key = rowKey.split(".");
  40035. let current = row;
  40036. for (const element of key) current = current[element];
  40037. return `${current}`;
  40038. } else if (isFunction$1(rowKey)) return rowKey.call(null, row);
  40039. return "";
  40040. };
  40041. const getKeysMap = function(array, rowKey, flatten = false, childrenKey = "children") {
  40042. const data = array || [];
  40043. const arrayMap = {};
  40044. data.forEach((row, index) => {
  40045. arrayMap[getRowIdentity(row, rowKey)] = {
  40046. row,
  40047. index
  40048. };
  40049. if (flatten) {
  40050. const children = row[childrenKey];
  40051. if (isArray$1(children)) Object.assign(arrayMap, getKeysMap(children, rowKey, true, childrenKey));
  40052. }
  40053. });
  40054. return arrayMap;
  40055. };
  40056. function mergeOptions(defaults, config) {
  40057. const options = {};
  40058. let key;
  40059. for (key in defaults) options[key] = defaults[key];
  40060. for (key in config) if (hasOwn(config, key)) {
  40061. const value = config[key];
  40062. if (!isUndefined(value)) options[key] = value;
  40063. }
  40064. return options;
  40065. }
  40066. function parseWidth(width) {
  40067. if (width === "") return width;
  40068. if (!isUndefined(width)) {
  40069. width = Number.parseInt(width, 10);
  40070. if (Number.isNaN(width)) width = "";
  40071. }
  40072. return width;
  40073. }
  40074. function parseMinWidth(minWidth) {
  40075. if (minWidth === "") return minWidth;
  40076. if (!isUndefined(minWidth)) {
  40077. minWidth = parseWidth(minWidth);
  40078. if (Number.isNaN(minWidth)) minWidth = 80;
  40079. }
  40080. return minWidth;
  40081. }
  40082. function parseHeight(height) {
  40083. if (isNumber(height)) return height;
  40084. if (isString(height)) if (/^\d+(?:px)?$/.test(height)) return Number.parseInt(height, 10);
  40085. else return height;
  40086. return null;
  40087. }
  40088. function compose(...funcs) {
  40089. if (funcs.length === 0) return (arg) => arg;
  40090. if (funcs.length === 1) return funcs[0];
  40091. return funcs.reduce((a, b) => (...args) => a(b(...args)));
  40092. }
  40093. function toggleRowStatus(statusArr, row, newVal, tableTreeProps, selectable, rowIndex, rowKey) {
  40094. let _rowIndex = rowIndex ?? 0;
  40095. let changed = false;
  40096. const getIndex = () => {
  40097. if (!rowKey) return statusArr.indexOf(row);
  40098. const id = getRowIdentity(row, rowKey);
  40099. return statusArr.findIndex((item) => getRowIdentity(item, rowKey) === id);
  40100. };
  40101. const index = getIndex();
  40102. const included = index !== -1;
  40103. const isRowSelectable = selectable?.call(null, row, _rowIndex);
  40104. const toggleStatus = (type) => {
  40105. if (type === "add") statusArr.push(row);
  40106. else statusArr.splice(index, 1);
  40107. changed = true;
  40108. };
  40109. const getChildrenCount = (row) => {
  40110. let count = 0;
  40111. const children = tableTreeProps?.children && row[tableTreeProps.children];
  40112. if (children && isArray$1(children)) {
  40113. count += children.length;
  40114. children.forEach((item) => {
  40115. count += getChildrenCount(item);
  40116. });
  40117. }
  40118. return count;
  40119. };
  40120. if (!selectable || isRowSelectable) if (isBoolean(newVal)) {
  40121. if (newVal && !included) toggleStatus("add");
  40122. else if (!newVal && included) toggleStatus("remove");
  40123. } else included ? toggleStatus("remove") : toggleStatus("add");
  40124. if (!tableTreeProps?.checkStrictly && tableTreeProps?.children && isArray$1(row[tableTreeProps.children])) row[tableTreeProps.children].forEach((item) => {
  40125. const childChanged = toggleRowStatus(statusArr, item, newVal ?? !included, tableTreeProps, selectable, _rowIndex + 1, rowKey);
  40126. _rowIndex += getChildrenCount(item) + 1;
  40127. if (childChanged) changed = childChanged;
  40128. });
  40129. return changed;
  40130. }
  40131. function walkTreeNode(root, cb, childrenKey = "children", lazyKey = "hasChildren", lazy = false) {
  40132. const isNil = (array) => !(isArray$1(array) && array.length);
  40133. function _walker(parent, children, level) {
  40134. cb(parent, children, level);
  40135. children.forEach((item) => {
  40136. if (item[lazyKey] && lazy) {
  40137. cb(item, null, level + 1);
  40138. return;
  40139. }
  40140. const children = item[childrenKey];
  40141. if (!isNil(children)) _walker(item, children, level + 1);
  40142. });
  40143. }
  40144. root.forEach((item) => {
  40145. if (item[lazyKey] && lazy) {
  40146. cb(item, null, 0);
  40147. return;
  40148. }
  40149. const children = item[childrenKey];
  40150. if (!isNil(children)) _walker(item, children, 0);
  40151. });
  40152. }
  40153. const getTableOverflowTooltipProps = (props, innerText, row, column) => {
  40154. const tooltipFormatterContent = isFunction$1(column?.tooltipFormatter) ? column.tooltipFormatter({
  40155. row,
  40156. column,
  40157. cellValue: getProp(row, column.property).value
  40158. }) : void 0;
  40159. if (isVNode(tooltipFormatterContent)) return {
  40160. slotContent: tooltipFormatterContent,
  40161. content: null,
  40162. strategy: "fixed",
  40163. ...props
  40164. };
  40165. return {
  40166. slotContent: null,
  40167. content: tooltipFormatterContent ?? innerText,
  40168. strategy: "fixed",
  40169. ...props
  40170. };
  40171. };
  40172. let removePopper = null;
  40173. function createTablePopper(props, popperContent, row, column, trigger, table) {
  40174. const tableOverflowTooltipProps = getTableOverflowTooltipProps(props, popperContent, row, column);
  40175. const mergedProps = {
  40176. ...tableOverflowTooltipProps,
  40177. slotContent: void 0
  40178. };
  40179. if (removePopper?.trigger === trigger) {
  40180. const comp = removePopper.vm?.component;
  40181. merge(comp?.props, mergedProps);
  40182. if (comp && tableOverflowTooltipProps.slotContent) comp.slots.content = () => [tableOverflowTooltipProps.slotContent];
  40183. return;
  40184. }
  40185. removePopper?.();
  40186. const parentNode = table?.refs.tableWrapper;
  40187. const ns = parentNode?.dataset.prefix;
  40188. const vm = createVNode(ElTooltip, {
  40189. virtualTriggering: true,
  40190. virtualRef: trigger,
  40191. appendTo: parentNode,
  40192. placement: "top",
  40193. transition: "none",
  40194. offset: 0,
  40195. hideAfter: 0,
  40196. ...mergedProps
  40197. }, tableOverflowTooltipProps.slotContent ? { content: () => tableOverflowTooltipProps.slotContent } : void 0);
  40198. vm.appContext = {
  40199. ...table.appContext,
  40200. ...table
  40201. };
  40202. const container = document.createElement("div");
  40203. render(vm, container);
  40204. vm.component.exposed.onOpen();
  40205. const scrollContainer = parentNode?.querySelector(`.${ns}-scrollbar__wrap`);
  40206. removePopper = () => {
  40207. if (vm.component?.exposed?.onClose) vm.component.exposed.onClose();
  40208. render(null, container);
  40209. const currentRemovePopper = removePopper;
  40210. scrollContainer?.removeEventListener("scroll", currentRemovePopper);
  40211. currentRemovePopper.trigger = void 0;
  40212. currentRemovePopper.vm = void 0;
  40213. removePopper = null;
  40214. };
  40215. removePopper.trigger = trigger ?? void 0;
  40216. removePopper.vm = vm;
  40217. scrollContainer?.addEventListener("scroll", removePopper);
  40218. }
  40219. function getCurrentColumns(column) {
  40220. if (column.children) return flatMap(column.children, getCurrentColumns);
  40221. else return [column];
  40222. }
  40223. function getColSpan(colSpan, column) {
  40224. return colSpan + column.colSpan;
  40225. }
  40226. const isFixedColumn = (index, fixed, store, realColumns) => {
  40227. let start = 0;
  40228. let after = index;
  40229. const columns = store.states.columns.value;
  40230. if (realColumns) {
  40231. const curColumns = getCurrentColumns(realColumns[index]);
  40232. start = columns.slice(0, columns.indexOf(curColumns[0])).reduce(getColSpan, 0);
  40233. after = start + curColumns.reduce(getColSpan, 0) - 1;
  40234. } else start = index;
  40235. let fixedLayout;
  40236. switch (fixed) {
  40237. case "left":
  40238. if (after < store.states.fixedLeafColumnsLength.value) fixedLayout = "left";
  40239. break;
  40240. case "right":
  40241. if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) fixedLayout = "right";
  40242. break;
  40243. default: if (after < store.states.fixedLeafColumnsLength.value) fixedLayout = "left";
  40244. else if (start >= columns.length - store.states.rightFixedLeafColumnsLength.value) fixedLayout = "right";
  40245. }
  40246. return fixedLayout ? {
  40247. direction: fixedLayout,
  40248. start,
  40249. after
  40250. } : {};
  40251. };
  40252. const getFixedColumnsClass = (namespace, index, fixed, store, realColumns, offset = 0) => {
  40253. const classes = [];
  40254. const { direction, start, after } = isFixedColumn(index, fixed, store, realColumns);
  40255. if (direction) {
  40256. const isLeft = direction === "left";
  40257. classes.push(`${namespace}-fixed-column--${direction}`);
  40258. if (isLeft && after + offset === store.states.fixedLeafColumnsLength.value - 1) classes.push("is-last-column");
  40259. else if (!isLeft && start - offset === store.states.columns.value.length - store.states.rightFixedLeafColumnsLength.value) classes.push("is-first-column");
  40260. }
  40261. return classes;
  40262. };
  40263. function getOffset(offset, column) {
  40264. return offset + (isNull(column.realWidth) || Number.isNaN(column.realWidth) ? Number(column.width) : column.realWidth);
  40265. }
  40266. const getFixedColumnOffset = (index, fixed, store, realColumns) => {
  40267. const { direction, start = 0, after = 0 } = isFixedColumn(index, fixed, store, realColumns);
  40268. if (!direction) return;
  40269. const styles = {};
  40270. const isLeft = direction === "left";
  40271. const columns = store.states.columns.value;
  40272. if (isLeft) styles.left = columns.slice(0, start).reduce(getOffset, 0);
  40273. else styles.right = columns.slice(after + 1).reverse().reduce(getOffset, 0);
  40274. return styles;
  40275. };
  40276. const ensurePosition = (style, key) => {
  40277. if (!style) return;
  40278. if (!Number.isNaN(style[key])) style[key] = `${style[key]}px`;
  40279. };
  40280. function ensureValidVNode(vnodes) {
  40281. return vnodes.some((child) => {
  40282. if (!isVNode(child)) return true;
  40283. if (child.type === Comment) return false;
  40284. if (child.type === Fragment && !ensureValidVNode(child.children)) return false;
  40285. return true;
  40286. }) ? vnodes : null;
  40287. }
  40288. //#endregion
  40289. //#region ../../packages/components/table/src/store/expand.ts
  40290. function useExpand(watcherData) {
  40291. const instance = getCurrentInstance();
  40292. const defaultExpandAll = ref(false);
  40293. const expandRows = ref([]);
  40294. const canRowExpand = (row, index) => {
  40295. const expandableFn = instance.store.states.rowExpandable.value;
  40296. return expandableFn?.(row, index) ?? true;
  40297. };
  40298. const updateExpandRows = () => {
  40299. const data = watcherData.data.value || [];
  40300. const rowKey = watcherData.rowKey.value;
  40301. if (defaultExpandAll.value) expandRows.value = instance.store.states.rowExpandable.value ? data.filter(canRowExpand) : data.slice();
  40302. else if (rowKey) {
  40303. const expandRowsMap = getKeysMap(expandRows.value, rowKey);
  40304. expandRows.value = data.filter((row, index) => {
  40305. return !!expandRowsMap[getRowIdentity(row, rowKey)] && canRowExpand(row, index);
  40306. });
  40307. } else expandRows.value = [];
  40308. };
  40309. const toggleRowExpansion = (row, expanded) => {
  40310. const rowIndex = (watcherData.data.value || []).indexOf(row);
  40311. if (rowIndex > -1 && !canRowExpand(row, rowIndex)) return;
  40312. if (toggleRowStatus(expandRows.value, row, expanded, void 0, void 0, void 0, watcherData.rowKey.value)) instance.emit("expand-change", row, expandRows.value.slice());
  40313. };
  40314. const setExpandRowKeys = (rowKeys) => {
  40315. instance.store.assertRowKey();
  40316. const data = watcherData.data.value || [];
  40317. const rowKey = watcherData.rowKey.value;
  40318. const keysMap = getKeysMap(data, rowKey);
  40319. expandRows.value = rowKeys.reduce((prev, cur) => {
  40320. const info = keysMap[cur];
  40321. if (info && canRowExpand(info.row, info.index)) prev.push(info.row);
  40322. return prev;
  40323. }, []);
  40324. };
  40325. const isRowExpanded = (row) => {
  40326. const rowKey = watcherData.rowKey.value;
  40327. if (rowKey) return !!getKeysMap(expandRows.value, rowKey)[getRowIdentity(row, rowKey)];
  40328. return expandRows.value.includes(row);
  40329. };
  40330. return {
  40331. updateExpandRows,
  40332. toggleRowExpansion,
  40333. setExpandRowKeys,
  40334. isRowExpanded,
  40335. states: {
  40336. expandRows,
  40337. defaultExpandAll
  40338. }
  40339. };
  40340. }
  40341. //#endregion
  40342. //#region ../../packages/components/table/src/store/current.ts
  40343. function useCurrent(watcherData) {
  40344. const instance = getCurrentInstance();
  40345. const _currentRowKey = ref(null);
  40346. const currentRow = ref(null);
  40347. const setCurrentRowKey = (key) => {
  40348. instance.store.assertRowKey();
  40349. _currentRowKey.value = key;
  40350. setCurrentRowByKey(key);
  40351. };
  40352. const restoreCurrentRowKey = () => {
  40353. _currentRowKey.value = null;
  40354. };
  40355. const setCurrentRowByKey = (key) => {
  40356. const { data, rowKey } = watcherData;
  40357. const oldCurrentRow = currentRow.value;
  40358. let _currentRow = null;
  40359. if (rowKey.value) _currentRow = (unref(data) || []).find((item) => getRowIdentity(item, rowKey.value) === key) ?? null;
  40360. currentRow.value = _currentRow ?? null;
  40361. instance.emit("current-change", currentRow.value, oldCurrentRow);
  40362. };
  40363. const updateCurrentRow = (_currentRow) => {
  40364. const oldCurrentRow = currentRow.value;
  40365. if (_currentRow && _currentRow !== oldCurrentRow) {
  40366. currentRow.value = _currentRow;
  40367. instance.emit("current-change", currentRow.value, oldCurrentRow);
  40368. return;
  40369. }
  40370. if (!_currentRow && oldCurrentRow) {
  40371. currentRow.value = null;
  40372. instance.emit("current-change", null, oldCurrentRow);
  40373. }
  40374. };
  40375. const updateCurrentRowData = () => {
  40376. const rowKey = watcherData.rowKey.value;
  40377. const data = watcherData.data.value || [];
  40378. const oldCurrentRow = currentRow.value;
  40379. if (oldCurrentRow && !data.includes(oldCurrentRow)) if (rowKey) setCurrentRowByKey(getRowIdentity(oldCurrentRow, rowKey));
  40380. else {
  40381. currentRow.value = null;
  40382. instance.emit("current-change", null, oldCurrentRow);
  40383. }
  40384. else if (_currentRowKey.value) {
  40385. setCurrentRowByKey(_currentRowKey.value);
  40386. restoreCurrentRowKey();
  40387. }
  40388. };
  40389. return {
  40390. setCurrentRowKey,
  40391. restoreCurrentRowKey,
  40392. setCurrentRowByKey,
  40393. updateCurrentRow,
  40394. updateCurrentRowData,
  40395. states: {
  40396. _currentRowKey,
  40397. currentRow
  40398. }
  40399. };
  40400. }
  40401. //#endregion
  40402. //#region ../../packages/components/table/src/store/tree.ts
  40403. function useTree$2(watcherData) {
  40404. const expandRowKeys = ref([]);
  40405. const treeData = ref({});
  40406. const indent = ref(16);
  40407. const lazy = ref(false);
  40408. const lazyTreeNodeMap = ref({});
  40409. const lazyColumnIdentifier = ref("hasChildren");
  40410. const childrenColumnName = ref("children");
  40411. const checkStrictly = ref(false);
  40412. const instance = getCurrentInstance();
  40413. const normalizedData = computed(() => {
  40414. if (!watcherData.rowKey.value) return {};
  40415. return normalize(watcherData.data.value || []);
  40416. });
  40417. const normalizedLazyNode = computed(() => {
  40418. const rowKey = watcherData.rowKey.value;
  40419. const keys = Object.keys(lazyTreeNodeMap.value);
  40420. const res = {};
  40421. if (!keys.length) return res;
  40422. keys.forEach((key) => {
  40423. if (lazyTreeNodeMap.value[key].length) {
  40424. const item = { children: [] };
  40425. lazyTreeNodeMap.value[key].forEach((row) => {
  40426. const currentRowKey = getRowIdentity(row, rowKey);
  40427. item.children.push(currentRowKey);
  40428. if (row[lazyColumnIdentifier.value] && !res[currentRowKey]) res[currentRowKey] = { children: [] };
  40429. });
  40430. res[key] = item;
  40431. }
  40432. });
  40433. return res;
  40434. });
  40435. const normalize = (data) => {
  40436. const rowKey = watcherData.rowKey.value;
  40437. const res = {};
  40438. walkTreeNode(data, (parent, children, level) => {
  40439. const parentId = getRowIdentity(parent, rowKey);
  40440. if (isArray$1(children)) res[parentId] = {
  40441. children: children.map((row) => getRowIdentity(row, rowKey)),
  40442. level
  40443. };
  40444. else if (lazy.value) res[parentId] = {
  40445. children: [],
  40446. lazy: true,
  40447. level
  40448. };
  40449. }, childrenColumnName.value, lazyColumnIdentifier.value, lazy.value);
  40450. return res;
  40451. };
  40452. const updateTreeData = (ifChangeExpandRowKeys = false, ifExpandAll) => {
  40453. ifExpandAll ||= instance.store?.states.defaultExpandAll.value;
  40454. const nested = normalizedData.value;
  40455. const normalizedLazyNode_ = normalizedLazyNode.value;
  40456. const keys = Object.keys(nested);
  40457. const newTreeData = {};
  40458. if (keys.length) {
  40459. const oldTreeData = unref(treeData);
  40460. const rootLazyRowKeys = [];
  40461. const getExpanded = (oldValue, key) => {
  40462. if (ifChangeExpandRowKeys) if (expandRowKeys.value) return ifExpandAll || expandRowKeys.value.includes(key);
  40463. else return !!(ifExpandAll || oldValue?.expanded);
  40464. else {
  40465. const included = ifExpandAll || expandRowKeys.value && expandRowKeys.value.includes(key);
  40466. return !!(oldValue?.expanded || included);
  40467. }
  40468. };
  40469. keys.forEach((key) => {
  40470. const oldValue = oldTreeData[key];
  40471. const newValue = { ...nested[key] };
  40472. newValue.expanded = getExpanded(oldValue, key);
  40473. if (newValue.lazy) {
  40474. const { loaded = false, loading = false } = oldValue || {};
  40475. newValue.loaded = !!loaded;
  40476. newValue.loading = !!loading;
  40477. rootLazyRowKeys.push(key);
  40478. }
  40479. newTreeData[key] = newValue;
  40480. });
  40481. const lazyKeys = Object.keys(normalizedLazyNode_);
  40482. if (lazy.value && lazyKeys.length && rootLazyRowKeys.length) lazyKeys.forEach((key) => {
  40483. const oldValue = oldTreeData[key];
  40484. const lazyNodeChildren = normalizedLazyNode_[key].children;
  40485. if (rootLazyRowKeys.includes(key)) {
  40486. if (newTreeData[key].children?.length !== 0) throw new Error("[ElTable]children must be an empty array.");
  40487. newTreeData[key].children = lazyNodeChildren;
  40488. } else {
  40489. const { loaded = false, loading = false } = oldValue || {};
  40490. newTreeData[key] = {
  40491. lazy: true,
  40492. loaded: !!loaded,
  40493. loading: !!loading,
  40494. expanded: getExpanded(oldValue, key),
  40495. children: lazyNodeChildren,
  40496. level: void 0
  40497. };
  40498. }
  40499. });
  40500. }
  40501. treeData.value = newTreeData;
  40502. instance.store?.updateTableScrollY();
  40503. };
  40504. watch(() => expandRowKeys.value, () => {
  40505. updateTreeData(true);
  40506. }, { deep: true });
  40507. watch(() => normalizedData.value, () => {
  40508. updateTreeData();
  40509. });
  40510. watch(() => normalizedLazyNode.value, () => {
  40511. updateTreeData();
  40512. });
  40513. const updateTreeExpandKeys = (value) => {
  40514. expandRowKeys.value = value;
  40515. updateTreeData();
  40516. };
  40517. const isUseLazy = (data) => {
  40518. return lazy.value && data && "loaded" in data && !data.loaded;
  40519. };
  40520. const toggleTreeExpansion = (row, expanded) => {
  40521. instance.store.assertRowKey();
  40522. const rowKey = watcherData.rowKey.value;
  40523. const id = getRowIdentity(row, rowKey);
  40524. const data = id && treeData.value[id];
  40525. if (id && data && "expanded" in data) {
  40526. const oldExpanded = data.expanded;
  40527. expanded = isUndefined(expanded) ? !data.expanded : expanded;
  40528. treeData.value[id].expanded = expanded;
  40529. if (oldExpanded !== expanded) instance.emit("expand-change", row, expanded);
  40530. expanded && isUseLazy(data) && loadData(row, id, data);
  40531. instance.store.updateTableScrollY();
  40532. }
  40533. };
  40534. const loadOrToggle = (row) => {
  40535. instance.store.assertRowKey();
  40536. const rowKey = watcherData.rowKey.value;
  40537. const id = getRowIdentity(row, rowKey);
  40538. const data = treeData.value[id];
  40539. if (isUseLazy(data)) loadData(row, id, data);
  40540. else toggleTreeExpansion(row, void 0);
  40541. };
  40542. const loadData = (row, key, treeNode) => {
  40543. const { load } = instance.props;
  40544. if (load && !treeData.value[key].loaded) {
  40545. treeData.value[key].loading = true;
  40546. load(row, treeNode, (data) => {
  40547. if (!isArray$1(data)) throw new TypeError("[ElTable] data must be an array");
  40548. treeData.value[key].loading = false;
  40549. treeData.value[key].loaded = true;
  40550. treeData.value[key].expanded = true;
  40551. if (data.length) lazyTreeNodeMap.value = {
  40552. ...lazyTreeNodeMap.value,
  40553. [key]: data
  40554. };
  40555. instance.emit("expand-change", row, true);
  40556. });
  40557. }
  40558. };
  40559. const updateKeyChildren = (key, data) => {
  40560. const { lazy, rowKey } = instance.props;
  40561. if (!lazy) return;
  40562. if (!rowKey) throw new Error("[Table] rowKey is required in updateKeyChild");
  40563. if (lazyTreeNodeMap.value[key]) lazyTreeNodeMap.value = {
  40564. ...lazyTreeNodeMap.value,
  40565. [key]: data
  40566. };
  40567. };
  40568. return {
  40569. loadData,
  40570. loadOrToggle,
  40571. toggleTreeExpansion,
  40572. updateTreeExpandKeys,
  40573. updateTreeData,
  40574. updateKeyChildren,
  40575. normalize,
  40576. states: {
  40577. expandRowKeys,
  40578. treeData,
  40579. indent,
  40580. lazy,
  40581. lazyTreeNodeMap,
  40582. lazyColumnIdentifier,
  40583. childrenColumnName,
  40584. checkStrictly
  40585. }
  40586. };
  40587. }
  40588. //#endregion
  40589. //#region ../../packages/components/table/src/store/watcher.ts
  40590. const sortData = (data, states) => {
  40591. const sortingColumn = states.sortingColumn;
  40592. if (!sortingColumn || isString(sortingColumn.sortable)) return data;
  40593. return orderBy(data, states.sortProp, states.sortOrder, sortingColumn.sortMethod, sortingColumn.sortBy);
  40594. };
  40595. const doFlattenColumns = (columns) => {
  40596. const result = [];
  40597. columns.forEach((column) => {
  40598. if (column.children && column.children.length > 0) result.push.apply(result, doFlattenColumns(column.children));
  40599. else result.push(column);
  40600. });
  40601. return result;
  40602. };
  40603. function useWatcher$1() {
  40604. const instance = getCurrentInstance();
  40605. const { size: tableSize } = toRefs(instance.proxy?.$props);
  40606. const rowKey = ref(null);
  40607. const data = ref([]);
  40608. const _data = ref([]);
  40609. const isComplex = ref(false);
  40610. const _columns = ref([]);
  40611. const originColumns = ref([]);
  40612. const columns = ref([]);
  40613. const fixedColumns = ref([]);
  40614. const rightFixedColumns = ref([]);
  40615. const leafColumns = ref([]);
  40616. const fixedLeafColumns = ref([]);
  40617. const rightFixedLeafColumns = ref([]);
  40618. const updateOrderFns = [];
  40619. const leafColumnsLength = ref(0);
  40620. const fixedLeafColumnsLength = ref(0);
  40621. const rightFixedLeafColumnsLength = ref(0);
  40622. const isAllSelected = ref(false);
  40623. const selection = ref([]);
  40624. const selectionIndeterminate = ref({});
  40625. const reserveSelection = ref(false);
  40626. const selectOnIndeterminate = ref(false);
  40627. const selectable = ref(null);
  40628. const rowExpandable = ref(null);
  40629. const filters = ref({});
  40630. const filteredData = ref(null);
  40631. const sortingColumn = ref(null);
  40632. const sortProp = ref(null);
  40633. const sortOrder = ref(null);
  40634. const hoverRow = ref(null);
  40635. let halfSelection = [];
  40636. const selectedMap = computed(() => {
  40637. return rowKey.value ? getKeysMap(selection.value, rowKey.value) : void 0;
  40638. });
  40639. const getRowChildren = (row) => {
  40640. const { childrenColumnName, lazyTreeNodeMap } = instance.store.states;
  40641. const inlineChildren = row[childrenColumnName.value] ?? [];
  40642. if (!rowKey.value) return inlineChildren;
  40643. const id = getRowIdentity(row, rowKey.value);
  40644. return [...lazyTreeNodeMap.value?.[id] ?? [], ...inlineChildren];
  40645. };
  40646. watch(data, () => {
  40647. if (instance.state) {
  40648. scheduleLayout(false);
  40649. if (instance.props.tableLayout === "auto") instance.refs.tableHeaderRef?.updateFixedColumnStyle();
  40650. }
  40651. }, { deep: true });
  40652. const assertRowKey = () => {
  40653. if (!rowKey.value) throw new Error("[ElTable] prop row-key is required");
  40654. };
  40655. const updateChildFixed = (column) => {
  40656. column.children?.forEach((childColumn) => {
  40657. childColumn.fixed = column.fixed;
  40658. updateChildFixed(childColumn);
  40659. });
  40660. };
  40661. const updateColumns = () => {
  40662. _columns.value.forEach((column) => {
  40663. updateChildFixed(column);
  40664. });
  40665. fixedColumns.value = _columns.value.filter((column) => [true, "left"].includes(column.fixed));
  40666. const selectColumn = _columns.value.find((column) => column.type === "selection");
  40667. let selectColFixLeft;
  40668. if (selectColumn && selectColumn.fixed !== "right" && !fixedColumns.value.includes(selectColumn)) {
  40669. if (_columns.value.indexOf(selectColumn) === 0 && fixedColumns.value.length) {
  40670. fixedColumns.value.unshift(selectColumn);
  40671. selectColFixLeft = true;
  40672. }
  40673. }
  40674. rightFixedColumns.value = _columns.value.filter((column) => column.fixed === "right");
  40675. const notFixedColumns = _columns.value.filter((column) => (selectColFixLeft ? column.type !== "selection" : true) && !column.fixed);
  40676. originColumns.value = Array.from(fixedColumns.value).concat(notFixedColumns).concat(rightFixedColumns.value);
  40677. const leafColumns = doFlattenColumns(notFixedColumns);
  40678. const fixedLeafColumns = doFlattenColumns(fixedColumns.value);
  40679. const rightFixedLeafColumns = doFlattenColumns(rightFixedColumns.value);
  40680. leafColumnsLength.value = leafColumns.length;
  40681. fixedLeafColumnsLength.value = fixedLeafColumns.length;
  40682. rightFixedLeafColumnsLength.value = rightFixedLeafColumns.length;
  40683. columns.value = Array.from(fixedLeafColumns).concat(leafColumns).concat(rightFixedLeafColumns);
  40684. isComplex.value = fixedColumns.value.length > 0 || rightFixedColumns.value.length > 0;
  40685. };
  40686. const scheduleLayout = (needUpdateColumns, immediate = false) => {
  40687. if (needUpdateColumns) updateColumns();
  40688. if (immediate) instance.state.doLayout();
  40689. else instance.state.debouncedUpdateLayout();
  40690. };
  40691. const isSelected = (row) => {
  40692. if (selectedMap.value) return !!selectedMap.value[getRowIdentity(row, rowKey.value)];
  40693. else return selection.value.includes(row);
  40694. };
  40695. const rowIndexMap = computed(() => {
  40696. const map = /* @__PURE__ */ new Map();
  40697. if (!rowKey.value || !selectable.value) return map;
  40698. let index = 0;
  40699. const _traverse = (rows) => {
  40700. if (!isArray$1(rows)) return;
  40701. rows.forEach((row) => {
  40702. const id = getRowIdentity(row, rowKey.value);
  40703. map.set(id, index);
  40704. index += 1;
  40705. const children = getRowChildren(row);
  40706. if (children.length) _traverse(children);
  40707. });
  40708. };
  40709. _traverse(data.value || []);
  40710. return map;
  40711. });
  40712. const updateSelectionByChildren = (options = {}) => {
  40713. const { emitChange = true } = options;
  40714. if (treeStates.checkStrictly.value || !rowKey.value) {
  40715. selectionIndeterminate.value = {};
  40716. halfSelection = [];
  40717. return;
  40718. }
  40719. const rowKeyValue = rowKey.value;
  40720. const rowIndexMapValue = options.rowIndexMap ?? rowIndexMap.value;
  40721. const selectableFn = selectable.value;
  40722. const rowIdCache = /* @__PURE__ */ new WeakMap();
  40723. const getCachedRowId = (row) => {
  40724. const cachedId = rowIdCache.get(row);
  40725. if (cachedId) return cachedId;
  40726. const id = getRowIdentity(row, rowKeyValue);
  40727. rowIdCache.set(row, id);
  40728. return id;
  40729. };
  40730. const indeterminateMap = {};
  40731. const nextHalfSelection = [];
  40732. const selectedIdSet = new Set(selection.value.map((row) => getCachedRowId(row)));
  40733. const rowsToAdd = [];
  40734. let selectionChanged = false;
  40735. const _updateSelectionForRow = (row, id, selected) => {
  40736. const isRowSelected = selectedIdSet.has(id);
  40737. if (selected && !isRowSelected) {
  40738. rowsToAdd.push(row);
  40739. selectedIdSet.add(id);
  40740. selectionChanged = true;
  40741. } else if (!selected && isRowSelected) {
  40742. selectedIdSet.delete(id);
  40743. selectionChanged = true;
  40744. }
  40745. };
  40746. const _walk = (rows) => {
  40747. let selectedCount = 0;
  40748. let selectableCount = 0;
  40749. if (!isArray$1(rows)) return {
  40750. selectedCount,
  40751. selectableCount
  40752. };
  40753. rows.forEach((row) => {
  40754. const id = getCachedRowId(row);
  40755. const children = getRowChildren(row);
  40756. let childSelectedCount = 0;
  40757. let childSelectableCount = 0;
  40758. if (children.length) {
  40759. const childResult = _walk(children);
  40760. childSelectedCount = childResult.selectedCount;
  40761. childSelectableCount = childResult.selectableCount;
  40762. }
  40763. const rowSelectable = selectableFn ? selectableFn.call(null, row, rowIndexMapValue.get(id) ?? 0) : true;
  40764. if (rowSelectable) {
  40765. if (childSelectableCount > 0) {
  40766. const allSelected = childSelectedCount === childSelectableCount;
  40767. if (!allSelected && !(childSelectedCount === 0)) {
  40768. indeterminateMap[id] = true;
  40769. nextHalfSelection.push(row);
  40770. }
  40771. _updateSelectionForRow(row, id, allSelected);
  40772. }
  40773. }
  40774. if (rowSelectable) {
  40775. selectableCount += 1;
  40776. if (selectedIdSet.has(id)) selectedCount += 1;
  40777. }
  40778. selectedCount += childSelectedCount;
  40779. selectableCount += childSelectableCount;
  40780. });
  40781. return {
  40782. selectedCount,
  40783. selectableCount
  40784. };
  40785. };
  40786. _walk(data.value || []);
  40787. if (selectionChanged) {
  40788. const nextSelection = selection.value.filter((row) => selectedIdSet.has(getCachedRowId(row)));
  40789. rowsToAdd.forEach((row) => {
  40790. if (!selectedIdSet.has(getCachedRowId(row))) return;
  40791. nextSelection.push(row);
  40792. });
  40793. selection.value = nextSelection;
  40794. }
  40795. selectionIndeterminate.value = indeterminateMap;
  40796. halfSelection = nextHalfSelection;
  40797. if (selectionChanged && emitChange) instance.emit("selection-change", selection.value ? selection.value.slice() : []);
  40798. };
  40799. const clearSelection = () => {
  40800. isAllSelected.value = false;
  40801. const oldSelection = selection.value;
  40802. selection.value = [];
  40803. selectionIndeterminate.value = {};
  40804. halfSelection = [];
  40805. if (oldSelection.length) instance.emit("selection-change", []);
  40806. };
  40807. const cleanSelection = () => {
  40808. let deleted;
  40809. if (rowKey.value) {
  40810. deleted = [];
  40811. const childrenKey = instance?.store?.states?.childrenColumnName.value;
  40812. const dataMap = getKeysMap(data.value, rowKey.value, true, childrenKey);
  40813. const { lazyTreeNodeMap } = instance.store.states;
  40814. if (lazyTreeNodeMap.value) Object.entries(lazyTreeNodeMap.value).forEach(([parentId, lazyRows]) => {
  40815. if (dataMap[parentId]) lazyRows.forEach((row) => {
  40816. const id = getRowIdentity(row, rowKey.value);
  40817. if (!dataMap[id]) dataMap[id] = {
  40818. row,
  40819. index: -1
  40820. };
  40821. });
  40822. });
  40823. for (const key in selectedMap.value) if (hasOwn(selectedMap.value, key) && !dataMap[key]) deleted.push(selectedMap.value[key].row);
  40824. } else deleted = selection.value.filter((item) => !data.value.includes(item));
  40825. if (deleted.length) {
  40826. const newSelection = selection.value.filter((item) => !deleted.includes(item));
  40827. selection.value = newSelection;
  40828. updateSelectionByChildren({ emitChange: false });
  40829. instance.emit("selection-change", [...newSelection]);
  40830. }
  40831. };
  40832. const getSelectionRows = () => {
  40833. return (selection.value || []).slice();
  40834. };
  40835. const getHalfSelectionRows = () => {
  40836. return halfSelection.slice();
  40837. };
  40838. const cascadeToLazyChildren = (row, selected, rowIndexMap) => {
  40839. if (!rowKey.value || treeStates.checkStrictly.value || !treeStates.lazy.value) return;
  40840. const { lazyTreeNodeMap, childrenColumnName } = instance.store.states;
  40841. const id = getRowIdentity(row, rowKey.value);
  40842. const lazyChildren = lazyTreeNodeMap.value?.[id] ?? [];
  40843. const inlineChildren = row[childrenColumnName.value] ?? [];
  40844. const treeProps = {
  40845. children: childrenColumnName.value,
  40846. checkStrictly: false
  40847. };
  40848. for (const child of lazyChildren) {
  40849. const childIndex = rowIndexMap.get(getRowIdentity(child, rowKey.value)) ?? 0;
  40850. toggleRowStatus(selection.value, child, selected, treeProps, selectable.value, childIndex, rowKey.value);
  40851. cascadeToLazyChildren(child, selected, rowIndexMap);
  40852. }
  40853. for (const child of inlineChildren) cascadeToLazyChildren(child, selected, rowIndexMap);
  40854. };
  40855. const toggleRowSelection = (row, selected, emitChange = true, ignoreSelectable = false) => {
  40856. const treeProps = {
  40857. children: instance?.store?.states?.childrenColumnName.value,
  40858. checkStrictly: instance?.store?.states?.checkStrictly.value
  40859. };
  40860. if (toggleRowStatus(selection.value, row, selected, treeProps, ignoreSelectable ? void 0 : selectable.value, data.value.indexOf(row), rowKey.value)) {
  40861. if (treeStates.lazy.value && !treeStates.checkStrictly.value) {
  40862. cascadeToLazyChildren(row, selected ?? isSelected(row), rowIndexMap.value);
  40863. updateSelectionByChildren({
  40864. emitChange: false,
  40865. rowIndexMap: rowIndexMap.value
  40866. });
  40867. } else updateSelectionByChildren({ emitChange: false });
  40868. const newSelection = (selection.value || []).slice();
  40869. if (emitChange) instance.emit("select", newSelection, row);
  40870. instance.emit("selection-change", newSelection);
  40871. }
  40872. };
  40873. const _toggleAllSelection = () => {
  40874. const value = selectOnIndeterminate.value ? !isAllSelected.value : !(isAllSelected.value || selection.value.length);
  40875. isAllSelected.value = value;
  40876. let selectionChanged = false;
  40877. let childrenCount = 0;
  40878. const rowKey = instance?.store?.states?.rowKey.value;
  40879. const { childrenColumnName } = instance.store.states;
  40880. const treeProps = {
  40881. children: childrenColumnName.value,
  40882. checkStrictly: false
  40883. };
  40884. data.value.forEach((row, index) => {
  40885. const rowIndex = index + childrenCount;
  40886. if (toggleRowStatus(selection.value, row, value, treeProps, selectable.value, rowIndex, rowKey)) selectionChanged = true;
  40887. childrenCount += getChildrenCount(getRowIdentity(row, rowKey));
  40888. });
  40889. const rowIndexMapVal = rowIndexMap.value;
  40890. if (treeStates.lazy.value && !treeStates.checkStrictly.value && rowKey) for (const lazyRows of Object.values(treeStates.lazyTreeNodeMap.value)) for (const child of lazyRows) {
  40891. const childIndex = rowIndexMapVal.get(getRowIdentity(child, rowKey)) ?? 0;
  40892. if (toggleRowStatus(selection.value, child, value, treeProps, selectable.value, childIndex, rowKey)) selectionChanged = true;
  40893. cascadeToLazyChildren(child, value, rowIndexMapVal);
  40894. }
  40895. updateSelectionByChildren({
  40896. emitChange: false,
  40897. rowIndexMap: rowIndexMapVal
  40898. });
  40899. if (selectionChanged) instance.emit("selection-change", selection.value ? [...selection.value] : []);
  40900. instance.emit("select-all", (selection.value || []).slice());
  40901. };
  40902. const updateAllSelected = () => {
  40903. if (data.value?.length === 0) {
  40904. isAllSelected.value = false;
  40905. return;
  40906. }
  40907. let rowIndex = 0;
  40908. let selectedCount = 0;
  40909. const checkSelectedStatus = (rows) => {
  40910. for (const row of rows) {
  40911. const isRowSelectable = selectable.value && selectable.value.call(null, row, rowIndex);
  40912. if (!isSelected(row)) {
  40913. if (!selectable.value || isRowSelectable) return false;
  40914. } else selectedCount++;
  40915. rowIndex++;
  40916. const children = getRowChildren(row);
  40917. if (children.length && !checkSelectedStatus(children)) return false;
  40918. }
  40919. return true;
  40920. };
  40921. const isAllSelected_ = checkSelectedStatus(data.value || []);
  40922. isAllSelected.value = selectedCount === 0 ? false : isAllSelected_;
  40923. };
  40924. const getRowIndeterminate = (row) => {
  40925. if (!rowKey.value) return false;
  40926. const id = getRowIdentity(row, rowKey.value);
  40927. return !!selectionIndeterminate.value[id];
  40928. };
  40929. const getChildrenCount = (rowKey) => {
  40930. if (!instance || !instance.store) return 0;
  40931. const { treeData } = instance.store.states;
  40932. let count = 0;
  40933. const children = treeData.value[rowKey]?.children;
  40934. if (children) {
  40935. count += children.length;
  40936. children.forEach((childKey) => {
  40937. count += getChildrenCount(childKey);
  40938. });
  40939. }
  40940. return count;
  40941. };
  40942. const updateFilters = (column, values) => {
  40943. const filters_ = {};
  40944. castArray$1(column).forEach((col) => {
  40945. filters.value[col.id] = values;
  40946. filters_[col.columnKey || col.id] = values;
  40947. });
  40948. return filters_;
  40949. };
  40950. const updateSort = (column, prop, order) => {
  40951. if (sortingColumn.value && sortingColumn.value !== column) sortingColumn.value.order = null;
  40952. sortingColumn.value = column;
  40953. sortProp.value = prop;
  40954. sortOrder.value = order;
  40955. };
  40956. const execFilter = () => {
  40957. let sourceData = unref(_data);
  40958. Object.keys(filters.value).forEach((columnId) => {
  40959. const values = filters.value[columnId];
  40960. if (!values || values.length === 0) return;
  40961. const column = getColumnById({ columns: columns.value }, columnId);
  40962. if (column && column.filterMethod) sourceData = sourceData.filter((row) => {
  40963. return values.some((value) => column.filterMethod.call(null, value, row, column));
  40964. });
  40965. });
  40966. filteredData.value = sourceData;
  40967. };
  40968. const execSort = () => {
  40969. data.value = sortData(filteredData.value ?? [], {
  40970. sortingColumn: sortingColumn.value,
  40971. sortProp: sortProp.value,
  40972. sortOrder: sortOrder.value
  40973. });
  40974. };
  40975. const execQuery = (ignore = void 0) => {
  40976. if (!ignore?.filter) execFilter();
  40977. execSort();
  40978. };
  40979. const clearFilter = (columnKeys) => {
  40980. const { tableHeaderRef } = instance.refs;
  40981. if (!tableHeaderRef) return;
  40982. const panels = Object.assign({}, tableHeaderRef.filterPanels);
  40983. const keys = Object.keys(panels);
  40984. if (!keys.length) return;
  40985. if (isString(columnKeys)) columnKeys = [columnKeys];
  40986. if (isArray$1(columnKeys)) {
  40987. const columns_ = columnKeys.map((key) => getColumnByKey({ columns: columns.value }, key));
  40988. keys.forEach((key) => {
  40989. const column = columns_.find((col) => col.id === key);
  40990. if (column) column.filteredValue = [];
  40991. });
  40992. instance.store.commit("filterChange", {
  40993. column: columns_,
  40994. values: [],
  40995. silent: true,
  40996. multi: true
  40997. });
  40998. } else {
  40999. keys.forEach((key) => {
  41000. const column = columns.value.find((col) => col.id === key);
  41001. if (column) column.filteredValue = [];
  41002. });
  41003. filters.value = {};
  41004. instance.store.commit("filterChange", {
  41005. column: {},
  41006. values: [],
  41007. silent: true
  41008. });
  41009. }
  41010. };
  41011. const clearSort = () => {
  41012. if (!sortingColumn.value) return;
  41013. updateSort(null, null, null);
  41014. instance.store.commit("changeSortCondition", { silent: true });
  41015. };
  41016. const { setExpandRowKeys, toggleRowExpansion, updateExpandRows, states: expandStates, isRowExpanded } = useExpand({
  41017. data,
  41018. rowKey
  41019. });
  41020. const { updateTreeExpandKeys, toggleTreeExpansion, updateTreeData, updateKeyChildren, loadOrToggle, states: treeStates } = useTree$2({
  41021. data,
  41022. rowKey
  41023. });
  41024. const { updateCurrentRowData, updateCurrentRow, setCurrentRowKey, states: currentData } = useCurrent({
  41025. data,
  41026. rowKey
  41027. });
  41028. const setExpandRowKeysAdapter = (val) => {
  41029. setExpandRowKeys(val);
  41030. updateTreeExpandKeys(val);
  41031. };
  41032. const toggleRowExpansionAdapter = (row, expanded) => {
  41033. if (columns.value.some(({ type }) => type === "expand")) toggleRowExpansion(row, expanded);
  41034. else toggleTreeExpansion(row, expanded);
  41035. };
  41036. watch(() => treeStates.checkStrictly.value, (value) => {
  41037. if (value) {
  41038. selectionIndeterminate.value = {};
  41039. halfSelection = [];
  41040. } else updateSelectionByChildren({ emitChange: false });
  41041. updateAllSelected();
  41042. });
  41043. watch(() => treeStates.lazyTreeNodeMap.value, () => {
  41044. if (!treeStates.lazy.value || treeStates.checkStrictly.value || !rowKey.value) return;
  41045. const rowIndexMapVal = rowIndexMap.value;
  41046. const prevLen = selection.value.length;
  41047. for (const parentId of Object.keys(treeStates.lazyTreeNodeMap.value)) {
  41048. if (!selectedMap.value?.[parentId]) continue;
  41049. cascadeToLazyChildren(selectedMap.value[parentId].row, true, rowIndexMapVal);
  41050. }
  41051. const cascadeChanged = selection.value.length !== prevLen;
  41052. updateSelectionByChildren({
  41053. emitChange: !cascadeChanged,
  41054. rowIndexMap: rowIndexMapVal
  41055. });
  41056. updateAllSelected();
  41057. if (cascadeChanged) instance.emit("selection-change", [...selection.value]);
  41058. });
  41059. return {
  41060. assertRowKey,
  41061. updateColumns,
  41062. scheduleLayout,
  41063. isSelected,
  41064. clearSelection,
  41065. cleanSelection,
  41066. getSelectionRows,
  41067. getHalfSelectionRows,
  41068. toggleRowSelection,
  41069. _toggleAllSelection,
  41070. toggleAllSelection: null,
  41071. updateAllSelected,
  41072. updateSelectionByChildren,
  41073. getRowIndeterminate,
  41074. updateFilters,
  41075. updateCurrentRow,
  41076. updateSort,
  41077. execFilter,
  41078. execSort,
  41079. execQuery,
  41080. clearFilter,
  41081. clearSort,
  41082. toggleRowExpansion,
  41083. setExpandRowKeysAdapter,
  41084. setCurrentRowKey,
  41085. toggleRowExpansionAdapter,
  41086. isRowExpanded,
  41087. updateExpandRows,
  41088. updateCurrentRowData,
  41089. loadOrToggle,
  41090. updateTreeData,
  41091. updateKeyChildren,
  41092. states: {
  41093. tableSize,
  41094. rowKey,
  41095. data,
  41096. _data,
  41097. isComplex,
  41098. _columns,
  41099. originColumns,
  41100. columns,
  41101. fixedColumns,
  41102. rightFixedColumns,
  41103. leafColumns,
  41104. fixedLeafColumns,
  41105. rightFixedLeafColumns,
  41106. updateOrderFns,
  41107. leafColumnsLength,
  41108. fixedLeafColumnsLength,
  41109. rightFixedLeafColumnsLength,
  41110. isAllSelected,
  41111. selection,
  41112. selectionIndeterminate,
  41113. reserveSelection,
  41114. selectOnIndeterminate,
  41115. selectable,
  41116. rowExpandable,
  41117. filters,
  41118. filteredData,
  41119. sortingColumn,
  41120. sortProp,
  41121. sortOrder,
  41122. hoverRow,
  41123. ...expandStates,
  41124. ...treeStates,
  41125. ...currentData
  41126. }
  41127. };
  41128. }
  41129. //#endregion
  41130. //#region ../../packages/components/table/src/store/index.ts
  41131. function replaceColumn(array, column) {
  41132. return array.map((item) => {
  41133. if (item.id === column.id) return column;
  41134. else if (item.children?.length) item.children = replaceColumn(item.children, column);
  41135. return item;
  41136. });
  41137. }
  41138. function sortColumn(array) {
  41139. array.forEach((item) => {
  41140. item.no = item.getColumnIndex?.();
  41141. if (item.children?.length) sortColumn(item.children);
  41142. });
  41143. array.sort((cur, pre) => cur.no - pre.no);
  41144. }
  41145. function useStore() {
  41146. const instance = getCurrentInstance();
  41147. const watcher = useWatcher$1();
  41148. const ns = useNamespace("table");
  41149. const { t } = useLocale();
  41150. const mutations = {
  41151. setData(states, data) {
  41152. const dataInstanceChanged = unref(states._data) !== data;
  41153. states.data.value = data;
  41154. states._data.value = data;
  41155. instance.store.execQuery();
  41156. instance.store.updateCurrentRowData();
  41157. instance.store.updateExpandRows();
  41158. instance.store.updateTreeData(instance.store.states.defaultExpandAll.value);
  41159. if (unref(states.reserveSelection)) instance.store.assertRowKey();
  41160. else if (dataInstanceChanged) instance.store.clearSelection();
  41161. else instance.store.cleanSelection();
  41162. instance.store.updateSelectionByChildren({ emitChange: false });
  41163. instance.store.updateAllSelected();
  41164. if (instance.$ready) instance.store.scheduleLayout();
  41165. },
  41166. insertColumn(states, column, parent, updateColumnOrder) {
  41167. const array = unref(states._columns);
  41168. let newColumns = [];
  41169. if (!parent) {
  41170. array.push(column);
  41171. newColumns = array;
  41172. } else {
  41173. if (parent && !parent.children) parent.children = [];
  41174. parent.children?.push(column);
  41175. newColumns = replaceColumn(array, parent);
  41176. }
  41177. sortColumn(newColumns);
  41178. states._columns.value = newColumns;
  41179. states.updateOrderFns.push(updateColumnOrder);
  41180. if (column.type === "selection") {
  41181. states.selectable.value = column.selectable;
  41182. states.reserveSelection.value = column.reserveSelection;
  41183. }
  41184. if (instance.$ready) {
  41185. instance.store.updateColumns();
  41186. instance.store.scheduleLayout();
  41187. }
  41188. },
  41189. updateColumnOrder(states, column) {
  41190. if (column.getColumnIndex?.() === column.no) return;
  41191. sortColumn(states._columns.value);
  41192. if (instance.$ready) instance.store.updateColumns();
  41193. },
  41194. removeColumn(states, column, parent, updateColumnOrder) {
  41195. const array = unref(states._columns) || [];
  41196. if (parent) {
  41197. parent.children?.splice(parent.children.findIndex((item) => item.id === column.id), 1);
  41198. nextTick(() => {
  41199. if (parent.children?.length === 0) delete parent.children;
  41200. });
  41201. states._columns.value = replaceColumn(array, parent);
  41202. } else {
  41203. const index = array.indexOf(column);
  41204. if (index > -1) {
  41205. array.splice(index, 1);
  41206. states._columns.value = array;
  41207. }
  41208. }
  41209. const updateFnIndex = states.updateOrderFns.indexOf(updateColumnOrder);
  41210. updateFnIndex > -1 && states.updateOrderFns.splice(updateFnIndex, 1);
  41211. if (instance.$ready) {
  41212. instance.store.updateColumns();
  41213. instance.store.scheduleLayout();
  41214. }
  41215. },
  41216. sort(states, options) {
  41217. const { prop, order, init } = options;
  41218. if (prop) {
  41219. const column = unref(states.columns).find((column) => column.property === prop);
  41220. if (column) {
  41221. column.order = order;
  41222. instance.store.updateSort(column, prop, order);
  41223. instance.store.commit("changeSortCondition", { init });
  41224. }
  41225. }
  41226. },
  41227. changeSortCondition(states, options) {
  41228. const { sortingColumn, sortProp, sortOrder } = states;
  41229. const columnValue = unref(sortingColumn), propValue = unref(sortProp), orderValue = unref(sortOrder);
  41230. if (isNull(orderValue)) {
  41231. states.sortingColumn.value = null;
  41232. states.sortProp.value = null;
  41233. }
  41234. instance.store.execQuery({ filter: true });
  41235. if (!options || !(options.silent || options.init)) instance.emit("sort-change", {
  41236. column: columnValue,
  41237. prop: propValue,
  41238. order: orderValue
  41239. });
  41240. instance.store.updateTableScrollY();
  41241. },
  41242. filterChange(_states, options) {
  41243. const { column, values, silent } = options;
  41244. const newFilters = instance.store.updateFilters(column, values);
  41245. instance.store.execQuery();
  41246. if (!silent) instance.emit("filter-change", newFilters);
  41247. instance.store.updateTableScrollY();
  41248. },
  41249. toggleAllSelection() {
  41250. instance.store.toggleAllSelection?.();
  41251. },
  41252. rowSelectedChanged(_states, row) {
  41253. instance.store.toggleRowSelection(row);
  41254. instance.store.updateAllSelected();
  41255. },
  41256. setHoverRow(states, row) {
  41257. states.hoverRow.value = row;
  41258. },
  41259. setCurrentRow(_states, row) {
  41260. instance.store.updateCurrentRow(row);
  41261. }
  41262. };
  41263. const commit = function(name, ...args) {
  41264. const mutations = instance.store.mutations;
  41265. if (mutations[name]) mutations[name].apply(instance, [instance.store.states, ...args]);
  41266. else throw new Error(`Action not found: ${name}`);
  41267. };
  41268. const updateTableScrollY = function() {
  41269. nextTick(() => instance.layout.updateScrollY.apply(instance.layout));
  41270. };
  41271. return {
  41272. ns,
  41273. t,
  41274. ...watcher,
  41275. mutations,
  41276. commit,
  41277. updateTableScrollY
  41278. };
  41279. }
  41280. //#endregion
  41281. //#region ../../packages/components/table/src/store/helper.ts
  41282. const InitialStateMap = {
  41283. rowKey: "rowKey",
  41284. defaultExpandAll: "defaultExpandAll",
  41285. rowExpandable: "rowExpandable",
  41286. selectOnIndeterminate: "selectOnIndeterminate",
  41287. indent: "indent",
  41288. lazy: "lazy",
  41289. ["treeProps.hasChildren"]: {
  41290. key: "lazyColumnIdentifier",
  41291. default: "hasChildren"
  41292. },
  41293. ["treeProps.children"]: {
  41294. key: "childrenColumnName",
  41295. default: "children"
  41296. },
  41297. ["treeProps.checkStrictly"]: {
  41298. key: "checkStrictly",
  41299. default: false
  41300. }
  41301. };
  41302. function createStore(table, props) {
  41303. if (!table) throw new Error("Table is required.");
  41304. const store = useStore();
  41305. store.toggleAllSelection = debounce(store._toggleAllSelection, 10);
  41306. Object.keys(InitialStateMap).forEach((key) => {
  41307. handleValue(getArrKeysValue(props, key), key, store);
  41308. });
  41309. proxyTableProps(store, props);
  41310. return store;
  41311. }
  41312. function proxyTableProps(store, props) {
  41313. Object.keys(InitialStateMap).forEach((key) => {
  41314. watch(() => getArrKeysValue(props, key), (value) => {
  41315. handleValue(value, key, store);
  41316. });
  41317. });
  41318. }
  41319. function handleValue(value, propsKey, store) {
  41320. let newVal = value;
  41321. let storeKey = InitialStateMap[propsKey];
  41322. if (isObject$1(storeKey)) {
  41323. newVal = newVal || storeKey.default;
  41324. storeKey = storeKey.key;
  41325. }
  41326. store.states[storeKey].value = newVal;
  41327. }
  41328. function getArrKeysValue(props, key) {
  41329. if (key.includes(".")) {
  41330. const keyList = key.split(".");
  41331. let value = props;
  41332. keyList.forEach((k) => {
  41333. value = value[k];
  41334. });
  41335. return value;
  41336. } else return props[key];
  41337. }
  41338. //#endregion
  41339. //#region ../../packages/components/table/src/table-layout.ts
  41340. var TableLayout = class {
  41341. constructor(options) {
  41342. this.observers = [];
  41343. this.table = null;
  41344. this.store = null;
  41345. this.columns = [];
  41346. this.fit = true;
  41347. this.showHeader = true;
  41348. this.heightMap = {};
  41349. this.height = ref(null);
  41350. this.scrollX = ref(false);
  41351. this.scrollY = ref(false);
  41352. this.bodyWidth = ref(null);
  41353. this.fixedWidth = ref(null);
  41354. this.rightFixedWidth = ref(null);
  41355. this.gutterWidth = 0;
  41356. for (const name in options) if (hasOwn(options, name)) if (isRef(this[name])) this[name].value = options[name];
  41357. else this[name] = options[name];
  41358. if (!this.table) throw new Error("Table is required for Table Layout");
  41359. if (!this.store) throw new Error("Store is required for Table Layout");
  41360. }
  41361. updateScrollY() {
  41362. const height = this.height.value;
  41363. if (isNull(height)) return false;
  41364. const scrollBarRef = this.table.refs.scrollBarRef;
  41365. if (this.table.vnode.el && scrollBarRef?.wrapRef) {
  41366. let scrollY = true;
  41367. const prevScrollY = this.scrollY.value;
  41368. scrollY = scrollBarRef.wrapRef.scrollHeight > scrollBarRef.wrapRef.clientHeight;
  41369. this.scrollY.value = scrollY;
  41370. return prevScrollY !== scrollY;
  41371. }
  41372. return false;
  41373. }
  41374. setHeight(value, prop = "height") {
  41375. if (!isClient) return;
  41376. const el = this.table.vnode.el;
  41377. value = parseHeight(value);
  41378. this.height.value = Number(value);
  41379. this.heightMap[prop] = value;
  41380. if (!el && (value || value === 0)) {
  41381. nextTick(() => {
  41382. if (this.heightMap[prop] === value) this.setHeight(value, prop);
  41383. });
  41384. return;
  41385. }
  41386. if (el && isNumber(value)) {
  41387. el.style[prop] = `${value}px`;
  41388. this.updateElsHeight();
  41389. } else if (el && isString(value)) {
  41390. el.style[prop] = value;
  41391. this.updateElsHeight();
  41392. }
  41393. }
  41394. setMaxHeight(value) {
  41395. this.setHeight(value, "max-height");
  41396. }
  41397. getFlattenColumns() {
  41398. const flattenColumns = [];
  41399. this.table.store.states.columns.value.forEach((column) => {
  41400. if (column.isColumnGroup) flattenColumns.push.apply(flattenColumns, column.columns);
  41401. else flattenColumns.push(column);
  41402. });
  41403. return flattenColumns;
  41404. }
  41405. updateElsHeight() {
  41406. this.updateScrollY();
  41407. this.notifyObservers("scrollable");
  41408. }
  41409. headerDisplayNone(elm) {
  41410. if (!elm) return true;
  41411. let headerChild = elm;
  41412. while (headerChild.tagName !== "DIV") {
  41413. if (getComputedStyle(headerChild).display === "none") return true;
  41414. headerChild = headerChild.parentElement;
  41415. }
  41416. return false;
  41417. }
  41418. updateColumnsWidth() {
  41419. if (!isClient) return;
  41420. const fit = this.fit;
  41421. const bodyWidth = this.table.vnode.el?.clientWidth;
  41422. let bodyMinWidth = 0;
  41423. const flattenColumns = this.getFlattenColumns();
  41424. const flexColumns = flattenColumns.filter((column) => !isNumber(column.width));
  41425. flattenColumns.forEach((column) => {
  41426. if (isNumber(column.width) && column.realWidth) column.realWidth = null;
  41427. });
  41428. if (flexColumns.length > 0 && fit) {
  41429. flattenColumns.forEach((column) => {
  41430. bodyMinWidth += Number(column.width || column.minWidth || 80);
  41431. });
  41432. if (bodyMinWidth <= bodyWidth) {
  41433. this.scrollX.value = false;
  41434. const totalFlexWidth = bodyWidth - bodyMinWidth;
  41435. if (flexColumns.length === 1) flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth;
  41436. else {
  41437. const flexWidthPerPixel = totalFlexWidth / flexColumns.reduce((prev, column) => prev + Number(column.minWidth || 80), 0);
  41438. let noneFirstWidth = 0;
  41439. flexColumns.forEach((column, index) => {
  41440. if (index === 0) return;
  41441. const flexWidth = Math.floor(Number(column.minWidth || 80) * flexWidthPerPixel);
  41442. noneFirstWidth += flexWidth;
  41443. column.realWidth = Number(column.minWidth || 80) + flexWidth;
  41444. });
  41445. flexColumns[0].realWidth = Number(flexColumns[0].minWidth || 80) + totalFlexWidth - noneFirstWidth;
  41446. }
  41447. } else {
  41448. this.scrollX.value = true;
  41449. flexColumns.forEach((column) => {
  41450. column.realWidth = Number(column.minWidth);
  41451. });
  41452. }
  41453. this.bodyWidth.value = Math.max(bodyMinWidth, bodyWidth);
  41454. this.table.state.resizeState.value.width = this.bodyWidth.value;
  41455. } else {
  41456. flattenColumns.forEach((column) => {
  41457. if (!column.width && !column.minWidth) column.realWidth = 80;
  41458. else column.realWidth = Number(column.width || column.minWidth);
  41459. bodyMinWidth += column.realWidth;
  41460. });
  41461. this.scrollX.value = bodyMinWidth > bodyWidth;
  41462. this.bodyWidth.value = bodyMinWidth;
  41463. }
  41464. const fixedColumns = this.store.states.fixedColumns.value;
  41465. if (fixedColumns.length > 0) {
  41466. let fixedWidth = 0;
  41467. fixedColumns.forEach((column) => {
  41468. fixedWidth += Number(column.realWidth || column.width);
  41469. });
  41470. this.fixedWidth.value = fixedWidth;
  41471. }
  41472. const rightFixedColumns = this.store.states.rightFixedColumns.value;
  41473. if (rightFixedColumns.length > 0) {
  41474. let rightFixedWidth = 0;
  41475. rightFixedColumns.forEach((column) => {
  41476. rightFixedWidth += Number(column.realWidth || column.width);
  41477. });
  41478. this.rightFixedWidth.value = rightFixedWidth;
  41479. }
  41480. this.notifyObservers("columns");
  41481. }
  41482. addObserver(observer) {
  41483. this.observers.push(observer);
  41484. }
  41485. removeObserver(observer) {
  41486. const index = this.observers.indexOf(observer);
  41487. if (index !== -1) this.observers.splice(index, 1);
  41488. }
  41489. notifyObservers(event) {
  41490. this.observers.forEach((observer) => {
  41491. switch (event) {
  41492. case "columns":
  41493. observer.state?.onColumnsChange(this);
  41494. break;
  41495. case "scrollable":
  41496. observer.state?.onScrollableChange(this);
  41497. break;
  41498. default: throw new Error(`Table Layout don't have event ${event}.`);
  41499. }
  41500. });
  41501. }
  41502. };
  41503. //#endregion
  41504. //#region ../../packages/components/table/src/filter-panel.vue?vue&type=script&lang.ts
  41505. var filter_panel_vue_vue_type_script_lang_default = defineComponent({
  41506. name: "ElTableFilterPanel",
  41507. components: {
  41508. ElCheckbox,
  41509. ElCheckboxGroup,
  41510. ElScrollbar,
  41511. ElTooltip,
  41512. ElIcon,
  41513. ArrowDown: arrow_down_default,
  41514. ArrowUp: arrow_up_default
  41515. },
  41516. props: {
  41517. placement: {
  41518. type: String,
  41519. default: "bottom-start"
  41520. },
  41521. store: { type: Object },
  41522. column: { type: Object },
  41523. upDataColumn: { type: Function },
  41524. appendTo: useTooltipContentProps.appendTo
  41525. },
  41526. setup(props) {
  41527. const instance = getCurrentInstance();
  41528. const { t } = useLocale();
  41529. const ns = useNamespace("table-filter");
  41530. const parent = instance?.parent;
  41531. if (props.column && !parent.filterPanels.value[props.column.id]) parent.filterPanels.value[props.column.id] = instance;
  41532. const tooltipRef = ref(null);
  41533. const rootRef = ref(null);
  41534. const checkedIndex = ref(0);
  41535. const filters = computed(() => {
  41536. return props.column && props.column.filters;
  41537. });
  41538. const filterClassName = computed(() => {
  41539. if (props.column && props.column.filterClassName) return `${ns.b()} ${props.column.filterClassName}`;
  41540. return ns.b();
  41541. });
  41542. const filterValue = computed({
  41543. get: () => (props.column?.filteredValue || [])[0],
  41544. set: (value) => {
  41545. if (filteredValue.value) if (!isPropAbsent(value)) filteredValue.value.splice(0, 1, value);
  41546. else filteredValue.value.splice(0, 1);
  41547. }
  41548. });
  41549. const filteredValue = computed({
  41550. get() {
  41551. if (props.column) return props.column.filteredValue || [];
  41552. return [];
  41553. },
  41554. set(value) {
  41555. if (props.column) props.upDataColumn?.("filteredValue", value);
  41556. }
  41557. });
  41558. const multiple = computed(() => {
  41559. if (props.column) return props.column.filterMultiple;
  41560. return true;
  41561. });
  41562. const isActive = (filter) => {
  41563. return filter.value === filterValue.value;
  41564. };
  41565. const hidden = () => {
  41566. tooltipRef.value?.onClose();
  41567. };
  41568. const handleConfirm = () => {
  41569. confirmFilter(filteredValue.value);
  41570. hidden();
  41571. };
  41572. const handleReset = () => {
  41573. filteredValue.value = [];
  41574. confirmFilter(filteredValue.value);
  41575. hidden();
  41576. };
  41577. const handleSelect = (_filterValue, index) => {
  41578. filterValue.value = _filterValue;
  41579. checkedIndex.value = index;
  41580. if (!isPropAbsent(_filterValue)) confirmFilter(filteredValue.value);
  41581. else confirmFilter([]);
  41582. hidden();
  41583. };
  41584. const confirmFilter = (filteredValue) => {
  41585. props.store?.commit("filterChange", {
  41586. column: props.column,
  41587. values: filteredValue
  41588. });
  41589. props.store?.updateAllSelected();
  41590. };
  41591. const handleShowTooltip = () => {
  41592. rootRef.value?.focus();
  41593. !multiple.value && initCheckedIndex();
  41594. if (props.column) props.upDataColumn?.("filterOpened", true);
  41595. };
  41596. const handleHideTooltip = () => {
  41597. if (props.column) props.upDataColumn?.("filterOpened", false);
  41598. };
  41599. const initCheckedIndex = () => {
  41600. if (isPropAbsent(filterValue)) {
  41601. checkedIndex.value = 0;
  41602. return;
  41603. }
  41604. const idx = (filters.value || []).findIndex((item) => {
  41605. return item.value === filterValue.value;
  41606. });
  41607. checkedIndex.value = idx >= 0 ? idx + 1 : 0;
  41608. };
  41609. const handleKeydown = (event) => {
  41610. const code = getEventCode(event);
  41611. const len = (filters.value ? filters.value.length : 0) + 1;
  41612. let index = checkedIndex.value;
  41613. let isPreventDefault = true;
  41614. switch (code) {
  41615. case EVENT_CODE.down:
  41616. case EVENT_CODE.right:
  41617. index = (index + 1) % len;
  41618. break;
  41619. case EVENT_CODE.up:
  41620. case EVENT_CODE.left:
  41621. index = (index - 1 + len) % len;
  41622. break;
  41623. case EVENT_CODE.tab:
  41624. hidden();
  41625. isPreventDefault = false;
  41626. break;
  41627. case EVENT_CODE.enter:
  41628. case EVENT_CODE.space:
  41629. if (index === 0) handleSelect(null, 0);
  41630. else {
  41631. const item = (filters.value || [])[index - 1];
  41632. item.value && handleSelect(item.value, index);
  41633. }
  41634. break;
  41635. default:
  41636. isPreventDefault = false;
  41637. break;
  41638. }
  41639. isPreventDefault && event.preventDefault();
  41640. checkedIndex.value = index;
  41641. rootRef.value?.querySelector(`.${ns.e("list-item")}:nth-child(${index + 1})`)?.focus();
  41642. };
  41643. return {
  41644. multiple,
  41645. filterClassName,
  41646. filteredValue,
  41647. filterValue,
  41648. filters,
  41649. handleConfirm,
  41650. handleReset,
  41651. handleSelect,
  41652. isPropAbsent,
  41653. isActive,
  41654. t,
  41655. ns,
  41656. tooltipRef,
  41657. rootRef,
  41658. checkedIndex,
  41659. handleShowTooltip,
  41660. handleHideTooltip,
  41661. handleKeydown
  41662. };
  41663. }
  41664. });
  41665. //#endregion
  41666. //#region ../../packages/components/table/src/filter-panel.vue
  41667. const _hoisted_1$17 = ["disabled"];
  41668. const _hoisted_2$10 = ["tabindex", "aria-checked"];
  41669. const _hoisted_3$3 = [
  41670. "tabindex",
  41671. "aria-checked",
  41672. "onClick"
  41673. ];
  41674. const _hoisted_4$2 = ["aria-label"];
  41675. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  41676. const _component_el_checkbox = resolveComponent("el-checkbox");
  41677. const _component_el_checkbox_group = resolveComponent("el-checkbox-group");
  41678. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  41679. const _component_arrow_up = resolveComponent("arrow-up");
  41680. const _component_arrow_down = resolveComponent("arrow-down");
  41681. const _component_el_icon = resolveComponent("el-icon");
  41682. const _component_el_tooltip = resolveComponent("el-tooltip");
  41683. return openBlock(), createBlock(_component_el_tooltip, {
  41684. ref: "tooltipRef",
  41685. offset: 0,
  41686. placement: _ctx.placement,
  41687. "show-arrow": false,
  41688. trigger: "click",
  41689. role: "dialog",
  41690. teleported: "",
  41691. effect: "light",
  41692. pure: "",
  41693. loop: "",
  41694. "popper-class": _ctx.filterClassName,
  41695. persistent: "",
  41696. "append-to": _ctx.appendTo,
  41697. onShow: _ctx.handleShowTooltip,
  41698. onHide: _ctx.handleHideTooltip
  41699. }, {
  41700. content: withCtx(() => [_ctx.multiple ? (openBlock(), createElementBlock("div", {
  41701. key: 0,
  41702. ref: "rootRef",
  41703. tabindex: "-1",
  41704. class: normalizeClass(_ctx.ns.e("multiple"))
  41705. }, [createElementVNode("div", { class: normalizeClass(_ctx.ns.e("content")) }, [createVNode(_component_el_scrollbar, { "wrap-class": _ctx.ns.e("wrap") }, {
  41706. default: withCtx(() => [createVNode(_component_el_checkbox_group, {
  41707. modelValue: _ctx.filteredValue,
  41708. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filteredValue = $event),
  41709. class: normalizeClass(_ctx.ns.e("checkbox-group"))
  41710. }, {
  41711. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter) => {
  41712. return openBlock(), createBlock(_component_el_checkbox, {
  41713. key: filter.value,
  41714. value: filter.value
  41715. }, {
  41716. default: withCtx(() => [createTextVNode(toDisplayString(filter.text), 1)]),
  41717. _: 2
  41718. }, 1032, ["value"]);
  41719. }), 128))]),
  41720. _: 1
  41721. }, 8, ["modelValue", "class"])]),
  41722. _: 1
  41723. }, 8, ["wrap-class"])], 2), createElementVNode("div", { class: normalizeClass(_ctx.ns.e("bottom")) }, [createElementVNode("button", {
  41724. class: normalizeClass(_ctx.ns.is("disabled", _ctx.filteredValue.length === 0)),
  41725. disabled: _ctx.filteredValue.length === 0,
  41726. type: "button",
  41727. onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleConfirm && _ctx.handleConfirm(...args))
  41728. }, toDisplayString(_ctx.t("el.table.confirmFilter")), 11, _hoisted_1$17), createElementVNode("button", {
  41729. type: "button",
  41730. onClick: _cache[2] || (_cache[2] = (...args) => _ctx.handleReset && _ctx.handleReset(...args))
  41731. }, toDisplayString(_ctx.t("el.table.resetFilter")), 1)], 2)], 2)) : (openBlock(), createElementBlock("ul", {
  41732. key: 1,
  41733. ref: "rootRef",
  41734. tabindex: "-1",
  41735. role: "radiogroup",
  41736. class: normalizeClass(_ctx.ns.e("list")),
  41737. onKeydown: _cache[4] || (_cache[4] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args))
  41738. }, [createElementVNode("li", {
  41739. role: "radio",
  41740. class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isPropAbsent(_ctx.filterValue))]),
  41741. tabindex: _ctx.checkedIndex === 0 ? 0 : -1,
  41742. "aria-checked": _ctx.isPropAbsent(_ctx.filterValue),
  41743. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleSelect(null, 0))
  41744. }, toDisplayString(_ctx.t("el.table.clearFilter")), 11, _hoisted_2$10), (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.filters, (filter, idx) => {
  41745. return openBlock(), createElementBlock("li", {
  41746. key: filter.value,
  41747. role: "radio",
  41748. class: normalizeClass([_ctx.ns.e("list-item"), _ctx.ns.is("active", _ctx.isActive(filter))]),
  41749. tabindex: _ctx.checkedIndex === idx + 1 ? 0 : -1,
  41750. "aria-checked": _ctx.isActive(filter),
  41751. onClick: ($event) => _ctx.handleSelect(filter.value, idx + 1)
  41752. }, toDisplayString(filter.text), 11, _hoisted_3$3);
  41753. }), 128))], 34))]),
  41754. default: withCtx(() => [createElementVNode("button", {
  41755. type: "button",
  41756. class: normalizeClass(`${_ctx.ns.namespace.value}-table__column-filter-trigger`),
  41757. "aria-label": _ctx.t("el.table.filterLabel", { column: _ctx.column?.label || "" })
  41758. }, [createVNode(_component_el_icon, null, {
  41759. default: withCtx(() => [renderSlot(_ctx.$slots, "filter-icon", {}, () => [_ctx.column?.filterOpened ? (openBlock(), createBlock(_component_arrow_up, { key: 0 })) : (openBlock(), createBlock(_component_arrow_down, { key: 1 }))])]),
  41760. _: 3
  41761. })], 10, _hoisted_4$2)]),
  41762. _: 3
  41763. }, 8, [
  41764. "placement",
  41765. "popper-class",
  41766. "append-to",
  41767. "onShow",
  41768. "onHide"
  41769. ]);
  41770. }
  41771. var filter_panel_default = /* @__PURE__ */ _plugin_vue_export_helper_default(filter_panel_vue_vue_type_script_lang_default, [["render", _sfc_render$3]]);
  41772. //#endregion
  41773. //#region ../../packages/components/table/src/layout-observer.ts
  41774. function useLayoutObserver(root) {
  41775. const instance = getCurrentInstance();
  41776. onBeforeMount(() => {
  41777. tableLayout.value.addObserver(instance);
  41778. });
  41779. onMounted(() => {
  41780. onColumnsChange(tableLayout.value);
  41781. onScrollableChange(tableLayout.value);
  41782. });
  41783. onUpdated(() => {
  41784. onColumnsChange(tableLayout.value);
  41785. onScrollableChange(tableLayout.value);
  41786. });
  41787. onUnmounted(() => {
  41788. tableLayout.value.removeObserver(instance);
  41789. });
  41790. const tableLayout = computed(() => {
  41791. const layout = root.layout;
  41792. if (!layout) throw new Error("Can not find table layout.");
  41793. return layout;
  41794. });
  41795. const onColumnsChange = (layout) => {
  41796. const cols = root.vnode.el?.querySelectorAll("colgroup > col") || [];
  41797. if (!cols.length) return;
  41798. const flattenColumns = layout.getFlattenColumns();
  41799. const columnsMap = {};
  41800. flattenColumns.forEach((column) => {
  41801. columnsMap[column.id] = column;
  41802. });
  41803. for (let i = 0, j = cols.length; i < j; i++) {
  41804. const col = cols[i];
  41805. const column = columnsMap[col.getAttribute("name")];
  41806. if (column) col.setAttribute("width", column.realWidth || column.width);
  41807. }
  41808. };
  41809. const onScrollableChange = (layout) => {
  41810. const cols = root.vnode.el?.querySelectorAll("colgroup > col[name=gutter]") || [];
  41811. for (let i = 0, j = cols.length; i < j; i++) cols[i].setAttribute("width", layout.scrollY.value ? layout.gutterWidth : "0");
  41812. const ths = root.vnode.el?.querySelectorAll("th.gutter") || [];
  41813. for (let i = 0, j = ths.length; i < j; i++) {
  41814. const th = ths[i];
  41815. th.style.width = layout.scrollY.value ? `${layout.gutterWidth}px` : "0";
  41816. th.style.display = layout.scrollY.value ? "" : "none";
  41817. }
  41818. };
  41819. return {
  41820. tableLayout: tableLayout.value,
  41821. onColumnsChange,
  41822. onScrollableChange
  41823. };
  41824. }
  41825. //#endregion
  41826. //#region ../../packages/components/table/src/tokens.ts
  41827. const TABLE_INJECTION_KEY = Symbol("ElTable");
  41828. //#endregion
  41829. //#region ../../packages/components/table/src/table-header/event-helper.ts
  41830. function useEvent(props, emit) {
  41831. const instance = getCurrentInstance();
  41832. const parent = inject(TABLE_INJECTION_KEY);
  41833. const handleFilterClick = (event) => {
  41834. event.stopPropagation();
  41835. };
  41836. const handleHeaderClick = (event, column) => {
  41837. if (!column.filters && column.sortable) handleSortClick(event, column, false);
  41838. else if (column.filterable && !column.sortable) handleFilterClick(event);
  41839. parent?.emit("header-click", column, event);
  41840. };
  41841. const handleHeaderContextMenu = (event, column) => {
  41842. parent?.emit("header-contextmenu", column, event);
  41843. };
  41844. const draggingColumn = ref(null);
  41845. const dragging = ref(false);
  41846. const dragState = ref();
  41847. const handleMouseDown = (event, column) => {
  41848. if (!isClient) return;
  41849. if (column.children && column.children.length > 0) return;
  41850. /* istanbul ignore if */
  41851. if (draggingColumn.value && props.border && draggingColumn.value.id === column.id) {
  41852. dragging.value = true;
  41853. const table = parent;
  41854. emit("set-drag-visible", true);
  41855. const tableLeft = (table?.vnode.el)?.getBoundingClientRect().left;
  41856. const columnEl = instance?.vnode?.el?.querySelector(`th.${column.id}`);
  41857. const columnRect = columnEl.getBoundingClientRect();
  41858. const minLeft = columnRect.left - tableLeft + 30;
  41859. addClass(columnEl, "noclick");
  41860. dragState.value = {
  41861. startMouseLeft: event.clientX,
  41862. startLeft: columnRect.right - tableLeft,
  41863. startColumnLeft: columnRect.left - tableLeft,
  41864. tableLeft
  41865. };
  41866. const resizeProxy = table?.refs.resizeProxy;
  41867. resizeProxy.style.left = `${dragState.value.startLeft}px`;
  41868. document.onselectstart = function() {
  41869. return false;
  41870. };
  41871. document.ondragstart = function() {
  41872. return false;
  41873. };
  41874. const handleMouseMove = (event) => {
  41875. const deltaLeft = event.clientX - dragState.value.startMouseLeft;
  41876. const proxyLeft = dragState.value.startLeft + deltaLeft;
  41877. resizeProxy.style.left = `${Math.max(minLeft, proxyLeft)}px`;
  41878. };
  41879. const handleMouseUp = () => {
  41880. if (dragging.value) {
  41881. const { startColumnLeft, startLeft } = dragState.value;
  41882. column.width = column.realWidth = Number.parseInt(resizeProxy.style.left, 10) - startColumnLeft;
  41883. table?.emit("header-dragend", column.width, startLeft - startColumnLeft, column, event);
  41884. requestAnimationFrame(() => {
  41885. props.store.scheduleLayout(false, true);
  41886. });
  41887. document.body.style.cursor = "";
  41888. dragging.value = false;
  41889. draggingColumn.value = null;
  41890. dragState.value = void 0;
  41891. emit("set-drag-visible", false);
  41892. }
  41893. document.removeEventListener("mousemove", handleMouseMove);
  41894. document.removeEventListener("mouseup", handleMouseUp);
  41895. document.onselectstart = null;
  41896. document.ondragstart = null;
  41897. setTimeout(() => {
  41898. removeClass(columnEl, "noclick");
  41899. }, 0);
  41900. };
  41901. document.addEventListener("mousemove", handleMouseMove);
  41902. document.addEventListener("mouseup", handleMouseUp);
  41903. }
  41904. };
  41905. const handleMouseMove = (event, column) => {
  41906. if (!props.border || column.children && column.children.length > 0) return;
  41907. const el = event.target;
  41908. const target = isElement$1(el) ? el.closest("th") : null;
  41909. if (!target) return;
  41910. const isSortable = hasClass(target, "is-sortable");
  41911. if (isSortable) {
  41912. const cursor = dragging.value ? "col-resize" : "";
  41913. target.style.cursor = cursor;
  41914. const caret = target.querySelector(".caret-wrapper");
  41915. if (caret) caret.style.cursor = cursor;
  41916. }
  41917. if (!column.resizable || dragging.value) {
  41918. draggingColumn.value = null;
  41919. return;
  41920. }
  41921. const rect = target.getBoundingClientRect();
  41922. const isLastTh = target.parentNode?.lastElementChild === target;
  41923. const allowDrag = props.allowDragLastColumn || !isLastTh;
  41924. const isResizeHandleActive = rect.width > 12 && rect.right - event.clientX < 8 && allowDrag;
  41925. const cursor = isResizeHandleActive ? "col-resize" : "";
  41926. document.body.style.cursor = cursor;
  41927. draggingColumn.value = isResizeHandleActive ? column : null;
  41928. if (isSortable) target.style.cursor = cursor;
  41929. };
  41930. const handleMouseOut = () => {
  41931. if (!isClient || dragging.value) return;
  41932. document.body.style.cursor = "";
  41933. };
  41934. const toggleOrder = ({ order, sortOrders }) => {
  41935. if (order === "") return sortOrders[0];
  41936. const index = sortOrders.indexOf(order || null);
  41937. return sortOrders[index > sortOrders.length - 2 ? 0 : index + 1];
  41938. };
  41939. const handleSortClick = (event, column, givenOrder) => {
  41940. event.stopPropagation();
  41941. const order = column.order === givenOrder ? null : givenOrder || toggleOrder(column);
  41942. const target = event.target?.closest("th");
  41943. if (target) {
  41944. if (hasClass(target, "noclick")) {
  41945. removeClass(target, "noclick");
  41946. return;
  41947. }
  41948. }
  41949. if (!column.sortable) return;
  41950. const clickTarget = event.currentTarget;
  41951. if (["ascending", "descending"].some((str) => hasClass(clickTarget, str) && !column.sortOrders.includes(str))) return;
  41952. const states = props.store.states;
  41953. let sortProp = states.sortProp.value;
  41954. let sortOrder;
  41955. const sortingColumn = states.sortingColumn.value;
  41956. if (sortingColumn !== column || sortingColumn === column && isNull(sortingColumn.order)) {
  41957. if (sortingColumn) sortingColumn.order = null;
  41958. states.sortingColumn.value = column;
  41959. sortProp = column.property ?? null;
  41960. }
  41961. if (!order) sortOrder = column.order = null;
  41962. else sortOrder = column.order = order;
  41963. states.sortProp.value = sortProp;
  41964. states.sortOrder.value = sortOrder;
  41965. parent?.store.commit("changeSortCondition");
  41966. };
  41967. return {
  41968. handleHeaderClick,
  41969. handleHeaderContextMenu,
  41970. handleMouseDown,
  41971. handleMouseMove,
  41972. handleMouseOut,
  41973. handleSortClick,
  41974. handleFilterClick
  41975. };
  41976. }
  41977. //#endregion
  41978. //#region ../../packages/components/table/src/table-header/style.helper.ts
  41979. function useStyle$2(props) {
  41980. const parent = inject(TABLE_INJECTION_KEY);
  41981. const ns = useNamespace("table");
  41982. const getHeaderRowStyle = (rowIndex) => {
  41983. const headerRowStyle = parent?.props.headerRowStyle;
  41984. if (isFunction$1(headerRowStyle)) return headerRowStyle.call(null, { rowIndex });
  41985. return headerRowStyle;
  41986. };
  41987. const getHeaderRowClass = (rowIndex) => {
  41988. const classes = [];
  41989. const headerRowClassName = parent?.props.headerRowClassName;
  41990. if (isString(headerRowClassName)) classes.push(headerRowClassName);
  41991. else if (isFunction$1(headerRowClassName)) classes.push(headerRowClassName.call(null, { rowIndex }));
  41992. return classes.join(" ");
  41993. };
  41994. const getHeaderCellStyle = (rowIndex, columnIndex, row, column) => {
  41995. let headerCellStyles = parent?.props.headerCellStyle ?? {};
  41996. if (isFunction$1(headerCellStyles)) headerCellStyles = headerCellStyles.call(null, {
  41997. rowIndex,
  41998. columnIndex,
  41999. row,
  42000. column
  42001. });
  42002. const fixedStyle = getFixedColumnOffset(columnIndex, column.fixed, props.store, row);
  42003. ensurePosition(fixedStyle, "left");
  42004. ensurePosition(fixedStyle, "right");
  42005. return Object.assign({}, headerCellStyles, fixedStyle);
  42006. };
  42007. const getHeaderCellClass = (rowIndex, columnIndex, row, column) => {
  42008. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, column.fixed, props.store, row);
  42009. const classes = [
  42010. column.id,
  42011. column.order,
  42012. column.headerAlign,
  42013. column.className,
  42014. column.labelClassName,
  42015. ...fixedClasses
  42016. ];
  42017. if (!column.children) classes.push("is-leaf");
  42018. if (column.sortable) classes.push("is-sortable");
  42019. const headerCellClassName = parent?.props.headerCellClassName;
  42020. if (isString(headerCellClassName)) classes.push(headerCellClassName);
  42021. else if (isFunction$1(headerCellClassName)) classes.push(headerCellClassName.call(null, {
  42022. rowIndex,
  42023. columnIndex,
  42024. row,
  42025. column
  42026. }));
  42027. classes.push(ns.e("cell"));
  42028. return classes.filter((className) => Boolean(className)).join(" ");
  42029. };
  42030. return {
  42031. getHeaderRowStyle,
  42032. getHeaderRowClass,
  42033. getHeaderCellStyle,
  42034. getHeaderCellClass
  42035. };
  42036. }
  42037. //#endregion
  42038. //#region ../../packages/components/table/src/table-header/utils-helper.ts
  42039. const getAllColumns = (columns) => {
  42040. const result = [];
  42041. columns.forEach((column) => {
  42042. if (column.children) {
  42043. result.push(column);
  42044. result.push.apply(result, getAllColumns(column.children));
  42045. } else result.push(column);
  42046. });
  42047. return result;
  42048. };
  42049. const convertToRows = (originColumns) => {
  42050. let maxLevel = 1;
  42051. const traverse = (column, parent) => {
  42052. if (parent) {
  42053. column.level = parent.level + 1;
  42054. if (maxLevel < column.level) maxLevel = column.level;
  42055. }
  42056. if (column.children) {
  42057. let colSpan = 0;
  42058. column.children.forEach((subColumn) => {
  42059. traverse(subColumn, column);
  42060. colSpan += subColumn.colSpan;
  42061. });
  42062. column.colSpan = colSpan;
  42063. } else column.colSpan = 1;
  42064. };
  42065. originColumns.forEach((column) => {
  42066. column.level = 1;
  42067. traverse(column, void 0);
  42068. });
  42069. const rows = [];
  42070. for (let i = 0; i < maxLevel; i++) rows.push([]);
  42071. getAllColumns(originColumns).forEach((column) => {
  42072. if (!column.children) column.rowSpan = maxLevel - column.level + 1;
  42073. else {
  42074. column.rowSpan = 1;
  42075. column.children.forEach((col) => col.isSubColumn = true);
  42076. }
  42077. rows[column.level - 1].push(column);
  42078. });
  42079. return rows;
  42080. };
  42081. function useUtils$1(props) {
  42082. const parent = inject(TABLE_INJECTION_KEY);
  42083. const columnRows = computed(() => {
  42084. return convertToRows(props.store.states.originColumns.value);
  42085. });
  42086. const isGroup = computed(() => {
  42087. const result = columnRows.value.length > 1;
  42088. if (result && parent) parent.state.isGroup.value = true;
  42089. return result;
  42090. });
  42091. const toggleAllSelection = (event) => {
  42092. event.stopPropagation();
  42093. parent?.store.commit("toggleAllSelection");
  42094. };
  42095. return {
  42096. isGroup,
  42097. toggleAllSelection,
  42098. columnRows
  42099. };
  42100. }
  42101. //#endregion
  42102. //#region ../../packages/components/table/src/table-header/index.ts
  42103. var table_header_default = defineComponent({
  42104. name: "ElTableHeader",
  42105. components: { ElCheckbox },
  42106. props: {
  42107. fixed: {
  42108. type: String,
  42109. default: ""
  42110. },
  42111. store: {
  42112. required: true,
  42113. type: Object
  42114. },
  42115. border: Boolean,
  42116. defaultSort: {
  42117. type: Object,
  42118. default: () => {
  42119. return {
  42120. prop: "",
  42121. order: ""
  42122. };
  42123. }
  42124. },
  42125. appendFilterPanelTo: { type: String },
  42126. allowDragLastColumn: { type: Boolean }
  42127. },
  42128. setup(props, { emit }) {
  42129. const instance = getCurrentInstance();
  42130. const parent = inject(TABLE_INJECTION_KEY);
  42131. const ns = useNamespace("table");
  42132. const filterPanels = ref({});
  42133. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  42134. const isTableLayoutAuto = parent?.props.tableLayout === "auto";
  42135. const saveIndexSelection = reactive(/* @__PURE__ */ new Map());
  42136. const theadRef = ref();
  42137. let delayId;
  42138. const updateFixedColumnStyle = () => {
  42139. delayId = setTimeout(() => {
  42140. if (saveIndexSelection.size > 0) {
  42141. saveIndexSelection.forEach((column, key) => {
  42142. const el = theadRef.value.querySelector(`.${key.replace(/\s/g, ".")}`);
  42143. if (el) column.width = el.getBoundingClientRect().width || column.width;
  42144. });
  42145. saveIndexSelection.clear();
  42146. }
  42147. });
  42148. };
  42149. watch(saveIndexSelection, updateFixedColumnStyle);
  42150. onBeforeUnmount(() => {
  42151. if (delayId) {
  42152. clearTimeout(delayId);
  42153. delayId = void 0;
  42154. }
  42155. });
  42156. onMounted(async () => {
  42157. await nextTick();
  42158. await nextTick();
  42159. const { prop, order } = props.defaultSort;
  42160. parent?.store.commit("sort", {
  42161. prop,
  42162. order,
  42163. init: true
  42164. });
  42165. updateFixedColumnStyle();
  42166. });
  42167. const { handleHeaderClick, handleHeaderContextMenu, handleMouseDown, handleMouseMove, handleMouseOut, handleSortClick, handleFilterClick } = useEvent(props, emit);
  42168. const { getHeaderRowStyle, getHeaderRowClass, getHeaderCellStyle, getHeaderCellClass } = useStyle$2(props);
  42169. const { isGroup, toggleAllSelection, columnRows } = useUtils$1(props);
  42170. const { t } = useLocale();
  42171. instance.state = {
  42172. onColumnsChange,
  42173. onScrollableChange
  42174. };
  42175. instance.filterPanels = filterPanels;
  42176. return {
  42177. ns,
  42178. t,
  42179. filterPanels,
  42180. onColumnsChange,
  42181. onScrollableChange,
  42182. columnRows,
  42183. getHeaderRowClass,
  42184. getHeaderRowStyle,
  42185. getHeaderCellClass,
  42186. getHeaderCellStyle,
  42187. handleHeaderClick,
  42188. handleHeaderContextMenu,
  42189. handleMouseDown,
  42190. handleMouseMove,
  42191. handleMouseOut,
  42192. handleSortClick,
  42193. handleFilterClick,
  42194. isGroup,
  42195. toggleAllSelection,
  42196. saveIndexSelection,
  42197. isTableLayoutAuto,
  42198. theadRef,
  42199. updateFixedColumnStyle
  42200. };
  42201. },
  42202. render() {
  42203. const { ns, t, isGroup, columnRows, getHeaderCellStyle, getHeaderCellClass, getHeaderRowClass, getHeaderRowStyle, handleHeaderClick, handleHeaderContextMenu, handleMouseDown, handleMouseMove, handleSortClick, handleMouseOut, store, $parent, saveIndexSelection, isTableLayoutAuto } = this;
  42204. let rowSpan = 1;
  42205. return h("thead", {
  42206. ref: "theadRef",
  42207. class: ns.is("group", isGroup)
  42208. }, columnRows.map((subColumns, rowIndex) => h("tr", {
  42209. class: getHeaderRowClass(rowIndex),
  42210. key: rowIndex,
  42211. style: getHeaderRowStyle(rowIndex)
  42212. }, subColumns.map((column, cellIndex) => {
  42213. if (column.rowSpan > rowSpan) rowSpan = column.rowSpan;
  42214. const _class = getHeaderCellClass(rowIndex, cellIndex, subColumns, column);
  42215. if (isTableLayoutAuto && column.fixed) saveIndexSelection.set(_class, column);
  42216. return h("th", {
  42217. class: _class,
  42218. colspan: column.colSpan,
  42219. key: `${column.id}-thead`,
  42220. rowspan: column.rowSpan,
  42221. scope: column.colSpan > 1 ? "colgroup" : "col",
  42222. ariaSort: column.sortable ? column.order : void 0,
  42223. style: getHeaderCellStyle(rowIndex, cellIndex, subColumns, column),
  42224. onClick: ($event) => {
  42225. if ($event.currentTarget?.classList.contains("noclick")) return;
  42226. handleHeaderClick($event, column);
  42227. },
  42228. onContextmenu: ($event) => handleHeaderContextMenu($event, column),
  42229. onMousedown: ($event) => handleMouseDown($event, column),
  42230. onMousemove: ($event) => handleMouseMove($event, column),
  42231. onMouseout: handleMouseOut
  42232. }, [h("div", { class: ["cell", column.filteredValue && column.filteredValue.length > 0 ? "highlight" : ""] }, [
  42233. column.renderHeader ? column.renderHeader({
  42234. column,
  42235. $index: cellIndex,
  42236. store,
  42237. _self: $parent
  42238. }) : column.label,
  42239. column.sortable && h("button", {
  42240. type: "button",
  42241. class: "caret-wrapper",
  42242. "aria-label": t("el.table.sortLabel", { column: column.label || "" }),
  42243. onClick: ($event) => handleSortClick($event, column)
  42244. }, [h("i", {
  42245. onClick: ($event) => handleSortClick($event, column, "ascending"),
  42246. class: "sort-caret ascending"
  42247. }), h("i", {
  42248. onClick: ($event) => handleSortClick($event, column, "descending"),
  42249. class: "sort-caret descending"
  42250. })]),
  42251. column.filterable && h(filter_panel_default, {
  42252. store,
  42253. placement: column.filterPlacement || "bottom-start",
  42254. appendTo: $parent?.appendFilterPanelTo,
  42255. column,
  42256. upDataColumn: (key, value) => {
  42257. column[key] = value;
  42258. }
  42259. }, { "filter-icon": () => column.renderFilterIcon ? column.renderFilterIcon({ filterOpened: column.filterOpened }) : null })
  42260. ])]);
  42261. }))));
  42262. }
  42263. });
  42264. //#endregion
  42265. //#region ../../packages/components/table/src/table-body/events-helper.ts
  42266. function useEvents(props) {
  42267. const parent = inject(TABLE_INJECTION_KEY);
  42268. const tooltipContent = ref("");
  42269. const tooltipTrigger = ref(h("div"));
  42270. const handleEvent = (event, row, name) => {
  42271. const table = parent;
  42272. const cell = getCell(event);
  42273. let column = null;
  42274. const namespace = table?.vnode.el?.dataset.prefix;
  42275. if (cell) {
  42276. column = getColumnByCell({ columns: props.store?.states.columns.value ?? [] }, cell, namespace);
  42277. if (column) table?.emit(`cell-${name}`, row, column, cell, event);
  42278. }
  42279. table?.emit(`row-${name}`, row, column, event);
  42280. };
  42281. const handleDoubleClick = (event, row) => {
  42282. handleEvent(event, row, "dblclick");
  42283. };
  42284. const handleClick = (event, row) => {
  42285. props.store?.commit("setCurrentRow", row);
  42286. handleEvent(event, row, "click");
  42287. };
  42288. const handleContextMenu = (event, row) => {
  42289. handleEvent(event, row, "contextmenu");
  42290. };
  42291. const handleMouseEnter = debounce((index) => {
  42292. props.store?.commit("setHoverRow", index);
  42293. }, 30);
  42294. const handleMouseLeave = debounce(() => {
  42295. props.store?.commit("setHoverRow", null);
  42296. }, 30);
  42297. const getPadding = (el) => {
  42298. const style = window.getComputedStyle(el, null);
  42299. return {
  42300. left: Number.parseInt(style.paddingLeft, 10) || 0,
  42301. right: Number.parseInt(style.paddingRight, 10) || 0,
  42302. top: Number.parseInt(style.paddingTop, 10) || 0,
  42303. bottom: Number.parseInt(style.paddingBottom, 10) || 0
  42304. };
  42305. };
  42306. const toggleRowClassByCell = (rowSpan, event, toggle) => {
  42307. let node = (event?.target)?.parentNode;
  42308. while (rowSpan > 1) {
  42309. node = node?.nextSibling;
  42310. if (!node || node.nodeName !== "TR") break;
  42311. toggle(node, "hover-row hover-fixed-row");
  42312. rowSpan--;
  42313. }
  42314. };
  42315. const handleCellMouseEnter = (event, row, tooltipOptions) => {
  42316. if (!parent) return;
  42317. const table = parent;
  42318. const cell = getCell(event);
  42319. const namespace = table?.vnode.el?.dataset.prefix;
  42320. let column = null;
  42321. if (cell) {
  42322. column = getColumnByCell({ columns: props.store?.states.columns.value ?? [] }, cell, namespace);
  42323. if (!column) return;
  42324. if (cell.rowSpan > 1) toggleRowClassByCell(cell.rowSpan, event, addClass);
  42325. const hoverState = table.hoverState = {
  42326. cell,
  42327. column,
  42328. row
  42329. };
  42330. table?.emit("cell-mouse-enter", hoverState.row, hoverState.column, hoverState.cell, event);
  42331. }
  42332. if (!tooltipOptions) {
  42333. if (removePopper?.trigger === cell) removePopper?.();
  42334. return;
  42335. }
  42336. const cellChild = event.target.querySelector(".cell");
  42337. if (!(hasClass(cellChild, `${namespace}-tooltip`) && cellChild.childNodes.length && cellChild.textContent?.trim())) return;
  42338. const range = document.createRange();
  42339. range.setStart(cellChild, 0);
  42340. range.setEnd(cellChild, cellChild.childNodes.length);
  42341. const { width: rangeWidth, height: rangeHeight } = range.getBoundingClientRect();
  42342. const { width: cellChildWidth, height: cellChildHeight } = cellChild.getBoundingClientRect();
  42343. const { top, left, right, bottom } = getPadding(cellChild);
  42344. const horizontalPadding = left + right;
  42345. const verticalPadding = top + bottom;
  42346. if (isGreaterThan(rangeWidth + horizontalPadding, cellChildWidth) || isGreaterThan(rangeHeight + verticalPadding, cellChildHeight) || isGreaterThan(cellChild.scrollWidth, cellChildWidth)) createTablePopper(tooltipOptions, (cell?.innerText || cell?.textContent) ?? "", row, column, cell, table);
  42347. else if (removePopper?.trigger === cell) removePopper?.();
  42348. };
  42349. const handleCellMouseLeave = (event) => {
  42350. const cell = getCell(event);
  42351. if (!cell) return;
  42352. if (cell.rowSpan > 1) toggleRowClassByCell(cell.rowSpan, event, removeClass);
  42353. const oldHoverState = parent?.hoverState;
  42354. parent?.emit("cell-mouse-leave", oldHoverState?.row, oldHoverState?.column, oldHoverState?.cell, event);
  42355. };
  42356. return {
  42357. handleDoubleClick,
  42358. handleClick,
  42359. handleContextMenu,
  42360. handleMouseEnter,
  42361. handleMouseLeave,
  42362. handleCellMouseEnter,
  42363. handleCellMouseLeave,
  42364. tooltipContent,
  42365. tooltipTrigger
  42366. };
  42367. }
  42368. //#endregion
  42369. //#region ../../packages/components/table/src/table-body/styles-helper.ts
  42370. function useStyles$1(props) {
  42371. const parent = inject(TABLE_INJECTION_KEY);
  42372. const ns = useNamespace("table");
  42373. const getRowStyle = (row, rowIndex) => {
  42374. const rowStyle = parent?.props.rowStyle;
  42375. if (isFunction$1(rowStyle)) return rowStyle.call(null, {
  42376. row,
  42377. rowIndex
  42378. });
  42379. return rowStyle || null;
  42380. };
  42381. const getRowClass = (row, rowIndex, displayIndex) => {
  42382. const classes = [ns.e("row")];
  42383. if (parent?.props.highlightCurrentRow && row === props.store?.states.currentRow.value) classes.push("current-row");
  42384. if (props.stripe && displayIndex % 2 === 1) classes.push(ns.em("row", "striped"));
  42385. const rowClassName = parent?.props.rowClassName;
  42386. if (isString(rowClassName)) classes.push(rowClassName);
  42387. else if (isFunction$1(rowClassName)) classes.push(rowClassName.call(null, {
  42388. row,
  42389. rowIndex
  42390. }));
  42391. return classes;
  42392. };
  42393. const getCellStyle = (rowIndex, columnIndex, row, column) => {
  42394. const cellStyle = parent?.props.cellStyle;
  42395. let cellStyles = cellStyle ?? {};
  42396. if (isFunction$1(cellStyle)) cellStyles = cellStyle.call(null, {
  42397. rowIndex,
  42398. columnIndex,
  42399. row,
  42400. column
  42401. });
  42402. const fixedStyle = getFixedColumnOffset(columnIndex, props?.fixed, props.store);
  42403. ensurePosition(fixedStyle, "left");
  42404. ensurePosition(fixedStyle, "right");
  42405. return Object.assign({}, cellStyles, fixedStyle);
  42406. };
  42407. const getCellClass = (rowIndex, columnIndex, row, column, offset) => {
  42408. const fixedClasses = getFixedColumnsClass(ns.b(), columnIndex, props?.fixed, props.store, void 0, offset);
  42409. const classes = [
  42410. column.id,
  42411. column.align,
  42412. column.className,
  42413. ...fixedClasses
  42414. ];
  42415. const cellClassName = parent?.props.cellClassName;
  42416. if (isString(cellClassName)) classes.push(cellClassName);
  42417. else if (isFunction$1(cellClassName)) classes.push(cellClassName.call(null, {
  42418. rowIndex,
  42419. columnIndex,
  42420. row,
  42421. column
  42422. }));
  42423. classes.push(ns.e("cell"));
  42424. return classes.filter((className) => Boolean(className)).join(" ");
  42425. };
  42426. const getSpan = (row, column, rowIndex, columnIndex) => {
  42427. let rowspan = 1;
  42428. let colspan = 1;
  42429. const fn = parent?.props.spanMethod;
  42430. if (isFunction$1(fn)) {
  42431. const result = fn({
  42432. row,
  42433. column,
  42434. rowIndex,
  42435. columnIndex
  42436. });
  42437. if (isArray$1(result)) {
  42438. rowspan = result[0];
  42439. colspan = result[1];
  42440. } else if (isObject$1(result)) {
  42441. rowspan = result.rowspan;
  42442. colspan = result.colspan;
  42443. }
  42444. }
  42445. return {
  42446. rowspan,
  42447. colspan
  42448. };
  42449. };
  42450. const getColspanRealWidth = (columns, colspan, index) => {
  42451. if (colspan < 1) return columns[index].realWidth;
  42452. const widthArr = columns.map(({ realWidth, width }) => realWidth || width).slice(index, index + colspan);
  42453. return Number(widthArr.reduce((acc, width) => Number(acc) + Number(width), -1));
  42454. };
  42455. return {
  42456. getRowStyle,
  42457. getRowClass,
  42458. getCellStyle,
  42459. getCellClass,
  42460. getSpan,
  42461. getColspanRealWidth
  42462. };
  42463. }
  42464. //#endregion
  42465. //#region ../../packages/components/table/src/table-body/td-wrapper.vue?vue&type=script&setup=true&lang.ts
  42466. const _hoisted_1$16 = ["colspan", "rowspan"];
  42467. var td_wrapper_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  42468. name: "TableTdWrapper",
  42469. __name: "td-wrapper",
  42470. props: {
  42471. colspan: {
  42472. type: Number,
  42473. default: 1
  42474. },
  42475. rowspan: {
  42476. type: Number,
  42477. default: 1
  42478. }
  42479. },
  42480. setup(__props) {
  42481. return (_ctx, _cache) => {
  42482. return openBlock(), createElementBlock("td", {
  42483. colspan: __props.colspan,
  42484. rowspan: __props.rowspan
  42485. }, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_1$16);
  42486. };
  42487. }
  42488. });
  42489. //#endregion
  42490. //#region ../../packages/components/table/src/table-body/td-wrapper.vue
  42491. var td_wrapper_default = td_wrapper_vue_vue_type_script_setup_true_lang_default;
  42492. //#endregion
  42493. //#region ../../packages/components/table/src/table-body/render-helper.ts
  42494. function useRender$1(props) {
  42495. const parent = inject(TABLE_INJECTION_KEY);
  42496. const ns = useNamespace("table");
  42497. const { handleDoubleClick, handleClick, handleContextMenu, handleMouseEnter, handleMouseLeave, handleCellMouseEnter, handleCellMouseLeave, tooltipContent, tooltipTrigger } = useEvents(props);
  42498. const { getRowStyle, getRowClass, getCellStyle, getCellClass, getSpan, getColspanRealWidth } = useStyles$1(props);
  42499. let displayIndex = -1;
  42500. const firstDefaultColumnIndex = computed(() => {
  42501. return props.store?.states.columns.value.findIndex(({ type }) => type === "default");
  42502. });
  42503. const getKeyOfRow = (row, index) => {
  42504. const rowKey = (parent?.props)?.rowKey;
  42505. if (rowKey) return getRowIdentity(row, rowKey);
  42506. return index;
  42507. };
  42508. const rowRender = (row, $index, treeRowData, expanded = false) => {
  42509. const { tooltipEffect, tooltipOptions, store } = props;
  42510. const { indent, columns } = store.states;
  42511. const rowClasses = [];
  42512. let display = true;
  42513. if (treeRowData) {
  42514. rowClasses.push(ns.em("row", `level-${treeRowData.level}`));
  42515. display = !!treeRowData.display;
  42516. }
  42517. if ($index === 0) displayIndex = -1;
  42518. if (props.stripe && display) displayIndex++;
  42519. rowClasses.push(...getRowClass(row, $index, displayIndex));
  42520. return h("tr", {
  42521. style: [display ? null : { display: "none" }, getRowStyle(row, $index)],
  42522. class: rowClasses,
  42523. key: getKeyOfRow(row, $index),
  42524. onDblclick: ($event) => handleDoubleClick($event, row),
  42525. onClick: ($event) => handleClick($event, row),
  42526. onContextmenu: ($event) => handleContextMenu($event, row),
  42527. onMouseenter: () => handleMouseEnter($index),
  42528. onMouseleave: handleMouseLeave
  42529. }, columns.value.map((column, cellIndex) => {
  42530. const { rowspan, colspan } = getSpan(row, column, $index, cellIndex);
  42531. if (!rowspan || !colspan) return null;
  42532. const columnData = Object.assign({}, column);
  42533. columnData.realWidth = getColspanRealWidth(columns.value, colspan, cellIndex);
  42534. const data = {
  42535. store,
  42536. _self: props.context || parent,
  42537. column: columnData,
  42538. row,
  42539. $index,
  42540. cellIndex,
  42541. expanded
  42542. };
  42543. if (cellIndex === firstDefaultColumnIndex.value && treeRowData) {
  42544. data.treeNode = {
  42545. indent: treeRowData.level && treeRowData.level * indent.value,
  42546. level: treeRowData.level
  42547. };
  42548. if (isBoolean(treeRowData.expanded)) {
  42549. data.treeNode.expanded = treeRowData.expanded;
  42550. if ("loading" in treeRowData) data.treeNode.loading = treeRowData.loading;
  42551. if ("noLazyChildren" in treeRowData) data.treeNode.noLazyChildren = treeRowData.noLazyChildren;
  42552. }
  42553. }
  42554. const baseKey = `${getKeyOfRow(row, $index)},${cellIndex}`;
  42555. const patchKey = columnData.columnKey || columnData.rawColumnKey || "";
  42556. const mergedTooltipOptions = column.showOverflowTooltip && merge({ effect: tooltipEffect }, tooltipOptions, column.showOverflowTooltip);
  42557. return h(td_wrapper_default, {
  42558. style: getCellStyle($index, cellIndex, row, column),
  42559. class: getCellClass($index, cellIndex, row, column, colspan - 1),
  42560. key: `${patchKey}${baseKey}`,
  42561. rowspan,
  42562. colspan,
  42563. onMouseenter: ($event) => handleCellMouseEnter($event, row, mergedTooltipOptions),
  42564. onMouseleave: handleCellMouseLeave
  42565. }, { default: () => cellChildren(cellIndex, column, data) });
  42566. }));
  42567. };
  42568. const cellChildren = (_cellIndex, column, data) => {
  42569. return column.renderCell(data);
  42570. };
  42571. const wrappedRowRender = (row, $index) => {
  42572. const store = props.store;
  42573. const { isRowExpanded, assertRowKey } = store;
  42574. const { treeData, lazyTreeNodeMap, childrenColumnName, rowKey } = store.states;
  42575. const columns = store.states.columns.value;
  42576. if (columns.some(({ type }) => type === "expand")) {
  42577. const expanded = isRowExpanded(row);
  42578. const tr = rowRender(row, $index, void 0, expanded);
  42579. const renderExpanded = parent?.renderExpanded;
  42580. if (!renderExpanded) {
  42581. console.error("[Element Error]renderExpanded is required.");
  42582. return tr;
  42583. }
  42584. const rows = [[tr]];
  42585. if (parent.props.preserveExpandedContent || expanded) rows[0].push(h("tr", {
  42586. key: `expanded-row__${tr.key}`,
  42587. style: { display: expanded ? "" : "none" }
  42588. }, [h("td", {
  42589. colspan: columns.length,
  42590. class: `${ns.e("cell")} ${ns.e("expanded-cell")}`
  42591. }, [renderExpanded({
  42592. row,
  42593. $index,
  42594. store,
  42595. expanded
  42596. })])]));
  42597. return rows;
  42598. } else if (Object.keys(treeData.value).length) {
  42599. assertRowKey();
  42600. const key = getRowIdentity(row, rowKey.value);
  42601. let cur = treeData.value[key];
  42602. let treeRowData = null;
  42603. if (cur) {
  42604. treeRowData = {
  42605. expanded: cur.expanded,
  42606. level: cur.level,
  42607. display: true,
  42608. noLazyChildren: void 0,
  42609. loading: void 0
  42610. };
  42611. if (isBoolean(cur.lazy)) {
  42612. if (treeRowData && isBoolean(cur.loaded) && cur.loaded) treeRowData.noLazyChildren = !(cur.children && cur.children.length);
  42613. treeRowData.loading = cur.loading;
  42614. }
  42615. }
  42616. const tmp = [rowRender(row, $index, treeRowData ?? void 0)];
  42617. if (cur) {
  42618. let i = 0;
  42619. const traverse = (children, parent) => {
  42620. if (!(children && children.length && parent)) return;
  42621. children.forEach((node) => {
  42622. const innerTreeRowData = {
  42623. display: parent.display && parent.expanded,
  42624. level: parent.level + 1,
  42625. expanded: false,
  42626. noLazyChildren: false,
  42627. loading: false
  42628. };
  42629. const childKey = getRowIdentity(node, rowKey.value);
  42630. if (isPropAbsent(childKey)) throw new Error("For nested data item, row-key is required.");
  42631. cur = { ...treeData.value[childKey] };
  42632. if (cur) {
  42633. innerTreeRowData.expanded = cur.expanded;
  42634. cur.level = cur.level || innerTreeRowData.level;
  42635. cur.display = !!(cur.expanded && innerTreeRowData.display);
  42636. if (isBoolean(cur.lazy)) {
  42637. if (isBoolean(cur.loaded) && cur.loaded) innerTreeRowData.noLazyChildren = !(cur.children && cur.children.length);
  42638. innerTreeRowData.loading = cur.loading;
  42639. }
  42640. }
  42641. i++;
  42642. tmp.push(rowRender(node, $index + i, innerTreeRowData));
  42643. if (cur) traverse(lazyTreeNodeMap.value[childKey] || node[childrenColumnName.value], cur);
  42644. });
  42645. };
  42646. cur.display = true;
  42647. traverse(lazyTreeNodeMap.value[key] || row[childrenColumnName.value], cur);
  42648. }
  42649. return tmp;
  42650. } else return rowRender(row, $index, void 0);
  42651. };
  42652. return {
  42653. wrappedRowRender,
  42654. tooltipContent,
  42655. tooltipTrigger
  42656. };
  42657. }
  42658. //#endregion
  42659. //#region ../../packages/components/table/src/table-body/defaults.ts
  42660. const defaultProps$1 = {
  42661. store: {
  42662. required: true,
  42663. type: Object
  42664. },
  42665. stripe: Boolean,
  42666. tooltipEffect: String,
  42667. tooltipOptions: { type: Object },
  42668. context: {
  42669. default: () => ({}),
  42670. type: Object
  42671. },
  42672. rowClassName: [String, Function],
  42673. rowStyle: [Object, Function],
  42674. fixed: {
  42675. type: String,
  42676. default: ""
  42677. },
  42678. highlight: Boolean
  42679. };
  42680. //#endregion
  42681. //#region ../../packages/components/table/src/table-body/index.ts
  42682. var table_body_default = defineComponent({
  42683. name: "ElTableBody",
  42684. props: defaultProps$1,
  42685. setup(props) {
  42686. const instance = getCurrentInstance();
  42687. const parent = inject(TABLE_INJECTION_KEY);
  42688. const ns = useNamespace("table");
  42689. const { wrappedRowRender, tooltipContent, tooltipTrigger } = useRender$1(props);
  42690. const { onColumnsChange, onScrollableChange } = useLayoutObserver(parent);
  42691. const hoveredCellList = [];
  42692. watch(props.store?.states.hoverRow, (newVal, oldVal) => {
  42693. const el = instance?.vnode.el;
  42694. const rows = Array.from(el?.children || []).filter((e) => e?.classList.contains(`${ns.e("row")}`));
  42695. let rowNum = newVal;
  42696. const childNodes = rows[rowNum]?.childNodes;
  42697. if (childNodes?.length) {
  42698. let control = 0;
  42699. Array.from(childNodes).reduce((acc, item, index) => {
  42700. if (childNodes[index]?.colSpan > 1) control = childNodes[index]?.colSpan;
  42701. if (item.nodeName !== "TD" && control === 0) acc.push(index);
  42702. control > 0 && control--;
  42703. return acc;
  42704. }, []).forEach((rowIndex) => {
  42705. rowNum = newVal;
  42706. while (rowNum > 0) {
  42707. const preChildNodes = rows[rowNum - 1]?.childNodes;
  42708. if (preChildNodes[rowIndex] && preChildNodes[rowIndex].nodeName === "TD" && preChildNodes[rowIndex].rowSpan > 1) {
  42709. addClass(preChildNodes[rowIndex], "hover-cell");
  42710. hoveredCellList.push(preChildNodes[rowIndex]);
  42711. break;
  42712. }
  42713. rowNum--;
  42714. }
  42715. });
  42716. } else {
  42717. hoveredCellList.forEach((item) => removeClass(item, "hover-cell"));
  42718. hoveredCellList.length = 0;
  42719. }
  42720. if (!props.store?.states.isComplex.value || !isClient) return;
  42721. rAF(() => {
  42722. const oldRow = rows[oldVal];
  42723. const newRow = rows[newVal];
  42724. if (oldRow && !oldRow.classList.contains("hover-fixed-row")) removeClass(oldRow, "hover-row");
  42725. if (newRow) addClass(newRow, "hover-row");
  42726. });
  42727. });
  42728. onUnmounted(() => {
  42729. removePopper?.();
  42730. });
  42731. return {
  42732. ns,
  42733. onColumnsChange,
  42734. onScrollableChange,
  42735. wrappedRowRender,
  42736. tooltipContent,
  42737. tooltipTrigger
  42738. };
  42739. },
  42740. render() {
  42741. const { wrappedRowRender, store } = this;
  42742. return h("tbody", { tabIndex: -1 }, [(store?.states.data.value || []).reduce((acc, row) => {
  42743. return acc.concat(wrappedRowRender(row, acc.length));
  42744. }, [])]);
  42745. }
  42746. });
  42747. //#endregion
  42748. //#region ../../packages/components/table/src/table-footer/mapState-helper.ts
  42749. function useMapState() {
  42750. const store = inject(TABLE_INJECTION_KEY)?.store;
  42751. return {
  42752. leftFixedLeafCount: computed(() => {
  42753. return store?.states.fixedLeafColumnsLength.value ?? 0;
  42754. }),
  42755. rightFixedLeafCount: computed(() => {
  42756. return store?.states.rightFixedColumns.value.length ?? 0;
  42757. }),
  42758. columnsCount: computed(() => {
  42759. return store?.states.columns.value.length ?? 0;
  42760. }),
  42761. leftFixedCount: computed(() => {
  42762. return store?.states.fixedColumns.value.length ?? 0;
  42763. }),
  42764. rightFixedCount: computed(() => {
  42765. return store?.states.rightFixedColumns.value.length ?? 0;
  42766. }),
  42767. columns: computed(() => store?.states.columns.value ?? [])
  42768. };
  42769. }
  42770. //#endregion
  42771. //#region ../../packages/components/table/src/table-footer/style-helper.ts
  42772. function useStyle$1(props) {
  42773. const { columns } = useMapState();
  42774. const ns = useNamespace("table");
  42775. const getCellClasses = (columns, cellIndex) => {
  42776. const column = columns[cellIndex];
  42777. const classes = [
  42778. ns.e("cell"),
  42779. column.id,
  42780. column.align,
  42781. column.labelClassName,
  42782. ...getFixedColumnsClass(ns.b(), cellIndex, column.fixed, props.store)
  42783. ];
  42784. if (column.className) classes.push(column.className);
  42785. if (!column.children) classes.push(ns.is("leaf"));
  42786. return classes;
  42787. };
  42788. const getCellStyles = (column, cellIndex) => {
  42789. const fixedStyle = getFixedColumnOffset(cellIndex, column.fixed, props.store);
  42790. ensurePosition(fixedStyle, "left");
  42791. ensurePosition(fixedStyle, "right");
  42792. return fixedStyle;
  42793. };
  42794. return {
  42795. getCellClasses,
  42796. getCellStyles,
  42797. columns
  42798. };
  42799. }
  42800. //#endregion
  42801. //#region ../../packages/components/table/src/table-footer/index.ts
  42802. var table_footer_default = defineComponent({
  42803. name: "ElTableFooter",
  42804. props: {
  42805. fixed: {
  42806. type: String,
  42807. default: ""
  42808. },
  42809. store: {
  42810. required: true,
  42811. type: Object
  42812. },
  42813. summaryMethod: Function,
  42814. sumText: String,
  42815. border: Boolean,
  42816. defaultSort: {
  42817. type: Object,
  42818. default: () => {
  42819. return {
  42820. prop: "",
  42821. order: ""
  42822. };
  42823. }
  42824. }
  42825. },
  42826. setup(props) {
  42827. const parent = inject(TABLE_INJECTION_KEY);
  42828. const ns = useNamespace("table");
  42829. const { getCellClasses, getCellStyles, columns } = useStyle$1(props);
  42830. const { onScrollableChange, onColumnsChange } = useLayoutObserver(parent);
  42831. return {
  42832. ns,
  42833. onScrollableChange,
  42834. onColumnsChange,
  42835. getCellClasses,
  42836. getCellStyles,
  42837. columns
  42838. };
  42839. },
  42840. render() {
  42841. const { columns, getCellStyles, getCellClasses, summaryMethod, sumText } = this;
  42842. const data = this.store.states.data.value;
  42843. let sums = [];
  42844. if (summaryMethod) sums = summaryMethod({
  42845. columns,
  42846. data
  42847. });
  42848. else columns.forEach((column, index) => {
  42849. if (index === 0) {
  42850. sums[index] = sumText;
  42851. return;
  42852. }
  42853. const values = data.map((item) => Number(item[column.property]));
  42854. const precisions = [];
  42855. let notNumber = true;
  42856. values.forEach((value) => {
  42857. if (!Number.isNaN(+value)) {
  42858. notNumber = false;
  42859. const decimal = `${value}`.split(".")[1];
  42860. precisions.push(decimal ? decimal.length : 0);
  42861. }
  42862. });
  42863. const precision = Math.max.apply(null, precisions);
  42864. if (!notNumber) sums[index] = values.reduce((prev, curr) => {
  42865. const value = Number(curr);
  42866. if (!Number.isNaN(+value)) return Number.parseFloat((prev + curr).toFixed(Math.min(precision, 20)));
  42867. else return prev;
  42868. }, 0);
  42869. else sums[index] = "";
  42870. });
  42871. return h(h("tfoot", [h("tr", {}, [...columns.map((column, cellIndex) => h("td", {
  42872. key: cellIndex,
  42873. colspan: column.colSpan,
  42874. rowspan: column.rowSpan,
  42875. class: getCellClasses(columns, cellIndex),
  42876. style: getCellStyles(column, cellIndex)
  42877. }, [h("div", { class: ["cell", column.labelClassName] }, [sums[cellIndex]])]))])]));
  42878. }
  42879. });
  42880. //#endregion
  42881. //#region ../../packages/components/table/src/table/utils-helper.ts
  42882. function useUtils(store) {
  42883. const setCurrentRow = (row) => {
  42884. store.commit("setCurrentRow", row);
  42885. };
  42886. const getSelectionRows = () => {
  42887. return store.getSelectionRows();
  42888. };
  42889. const getHalfSelectionRows = () => {
  42890. return store.getHalfSelectionRows();
  42891. };
  42892. const toggleRowSelection = (row, selected, ignoreSelectable = true) => {
  42893. store.toggleRowSelection(row, selected, false, ignoreSelectable);
  42894. store.updateAllSelected();
  42895. };
  42896. const clearSelection = () => {
  42897. store.clearSelection();
  42898. };
  42899. const clearFilter = (columnKeys) => {
  42900. store.clearFilter(columnKeys);
  42901. };
  42902. const toggleAllSelection = () => {
  42903. store.commit("toggleAllSelection");
  42904. };
  42905. const toggleRowExpansion = (row, expanded) => {
  42906. store.toggleRowExpansionAdapter(row, expanded);
  42907. };
  42908. const clearSort = () => {
  42909. store.clearSort();
  42910. };
  42911. const sort = (prop, order) => {
  42912. store.commit("sort", {
  42913. prop,
  42914. order
  42915. });
  42916. };
  42917. const updateKeyChildren = (key, data) => {
  42918. store.updateKeyChildren(key, data);
  42919. };
  42920. return {
  42921. setCurrentRow,
  42922. getSelectionRows,
  42923. getHalfSelectionRows,
  42924. toggleRowSelection,
  42925. clearSelection,
  42926. clearFilter,
  42927. toggleAllSelection,
  42928. toggleRowExpansion,
  42929. clearSort,
  42930. sort,
  42931. updateKeyChildren
  42932. };
  42933. }
  42934. //#endregion
  42935. //#region ../../packages/components/table/src/table/style-helper.ts
  42936. function useStyle(props, layout, store, table) {
  42937. const isHidden = ref(false);
  42938. const renderExpanded = ref(null);
  42939. const resizeProxyVisible = ref(false);
  42940. const setDragVisible = (visible) => {
  42941. resizeProxyVisible.value = visible;
  42942. };
  42943. const resizeState = ref({
  42944. width: null,
  42945. height: null,
  42946. headerHeight: null
  42947. });
  42948. const isGroup = ref(false);
  42949. const scrollbarViewStyle = {
  42950. display: "inline-block",
  42951. verticalAlign: "middle"
  42952. };
  42953. const tableWidth = ref();
  42954. const tableScrollHeight = ref(0);
  42955. const bodyScrollHeight = ref(0);
  42956. const headerScrollHeight = ref(0);
  42957. const footerScrollHeight = ref(0);
  42958. const appendScrollHeight = ref(0);
  42959. watch(() => props.height, (value) => {
  42960. layout.setHeight(value ?? null);
  42961. }, { immediate: true });
  42962. watch(() => props.maxHeight, (value) => {
  42963. layout.setMaxHeight(value ?? null);
  42964. }, { immediate: true });
  42965. watch(() => [props.currentRowKey, store.states.rowKey], ([currentRowKey, rowKey]) => {
  42966. if (!unref(rowKey) || !unref(currentRowKey)) return;
  42967. store.setCurrentRowKey(`${currentRowKey}`);
  42968. }, { immediate: true });
  42969. watch(() => props.data, (data) => {
  42970. table.store.commit("setData", data);
  42971. }, {
  42972. immediate: true,
  42973. deep: true
  42974. });
  42975. watchEffect(() => {
  42976. if (props.expandRowKeys) store.setExpandRowKeysAdapter(props.expandRowKeys);
  42977. });
  42978. const handleMouseLeave = () => {
  42979. table.store.commit("setHoverRow", null);
  42980. if (table.hoverState) table.hoverState = null;
  42981. };
  42982. const handleHeaderFooterMousewheel = (_event, data) => {
  42983. const { pixelX, pixelY } = data;
  42984. if (Math.abs(pixelX) >= Math.abs(pixelY)) table.refs.bodyWrapper.scrollLeft += data.pixelX / 5;
  42985. };
  42986. const shouldUpdateHeight = computed(() => {
  42987. return props.height || props.maxHeight || store.states.fixedColumns.value.length > 0 || store.states.rightFixedColumns.value.length > 0;
  42988. });
  42989. const tableBodyStyles = computed(() => {
  42990. return { width: layout.bodyWidth.value ? `${layout.bodyWidth.value}px` : "" };
  42991. });
  42992. const doLayout = () => {
  42993. if (shouldUpdateHeight.value) layout.updateElsHeight();
  42994. layout.updateColumnsWidth();
  42995. if (typeof window === "undefined") return;
  42996. requestAnimationFrame(syncPosition);
  42997. };
  42998. onMounted(async () => {
  42999. await nextTick();
  43000. store.updateColumns();
  43001. bindEvents();
  43002. requestAnimationFrame(doLayout);
  43003. const el = table.vnode.el;
  43004. const tableHeader = table.refs.headerWrapper;
  43005. if (props.flexible && el && el.parentElement) el.parentElement.style.minWidth = "0";
  43006. resizeState.value = {
  43007. width: tableWidth.value = el.offsetWidth,
  43008. height: el.offsetHeight,
  43009. headerHeight: props.showHeader && tableHeader ? tableHeader.offsetHeight : null
  43010. };
  43011. store.states.columns.value.forEach((column) => {
  43012. if (column.filteredValue && column.filteredValue.length) table.store.commit("filterChange", {
  43013. column,
  43014. values: column.filteredValue,
  43015. silent: true
  43016. });
  43017. });
  43018. table.$ready = true;
  43019. });
  43020. const setScrollClassByEl = (el, className) => {
  43021. if (!el) return;
  43022. const classList = Array.from(el.classList).filter((item) => !item.startsWith("is-scrolling-"));
  43023. classList.push(layout.scrollX.value ? className : "is-scrolling-none");
  43024. el.className = classList.join(" ");
  43025. };
  43026. const setScrollClass = (className) => {
  43027. const { tableWrapper } = table.refs;
  43028. setScrollClassByEl(tableWrapper, className);
  43029. };
  43030. const hasScrollClass = (className) => {
  43031. const { tableWrapper } = table.refs;
  43032. return !!(tableWrapper && tableWrapper.classList.contains(className));
  43033. };
  43034. const syncPosition = function() {
  43035. if (!table.refs.scrollBarRef) return;
  43036. if (!layout.scrollX.value) {
  43037. const scrollingNoneClass = "is-scrolling-none";
  43038. if (!hasScrollClass(scrollingNoneClass)) setScrollClass(scrollingNoneClass);
  43039. return;
  43040. }
  43041. const scrollContainer = table.refs.scrollBarRef.wrapRef;
  43042. if (!scrollContainer) return;
  43043. const { scrollLeft, offsetWidth, scrollWidth } = scrollContainer;
  43044. const { headerWrapper, footerWrapper } = table.refs;
  43045. if (headerWrapper) headerWrapper.scrollLeft = scrollLeft;
  43046. if (footerWrapper) footerWrapper.scrollLeft = scrollLeft;
  43047. if (scrollLeft >= scrollWidth - offsetWidth - 1) setScrollClass("is-scrolling-right");
  43048. else if (scrollLeft === 0) setScrollClass("is-scrolling-left");
  43049. else setScrollClass("is-scrolling-middle");
  43050. };
  43051. const bindEvents = () => {
  43052. if (!table.refs.scrollBarRef) return;
  43053. if (table.refs.scrollBarRef.wrapRef) useEventListener(table.refs.scrollBarRef.wrapRef, "scroll", syncPosition, { passive: true });
  43054. if (props.fit) useResizeObserver(table.vnode.el, resizeListener);
  43055. else useEventListener(window, "resize", resizeListener);
  43056. useResizeObserver(table.refs.tableInnerWrapper, () => {
  43057. resizeListener();
  43058. table.refs?.scrollBarRef?.update();
  43059. });
  43060. };
  43061. const resizeListener = () => {
  43062. const el = table.vnode.el;
  43063. if (!table.$ready || !el) return;
  43064. let shouldUpdateLayout = false;
  43065. const { width: oldWidth, height: oldHeight, headerHeight: oldHeaderHeight } = resizeState.value;
  43066. const width = tableWidth.value = el.offsetWidth;
  43067. if (oldWidth !== width) shouldUpdateLayout = true;
  43068. const height = el.offsetHeight;
  43069. if ((props.height || shouldUpdateHeight.value) && oldHeight !== height) shouldUpdateLayout = true;
  43070. const tableHeader = props.tableLayout === "fixed" ? table.refs.headerWrapper : table.refs.tableHeaderRef?.$el;
  43071. if (props.showHeader && tableHeader?.offsetHeight !== oldHeaderHeight) shouldUpdateLayout = true;
  43072. tableScrollHeight.value = table.refs.tableWrapper?.scrollHeight || 0;
  43073. headerScrollHeight.value = tableHeader?.scrollHeight || 0;
  43074. footerScrollHeight.value = table.refs.footerWrapper?.offsetHeight || 0;
  43075. appendScrollHeight.value = table.refs.appendWrapper?.offsetHeight || 0;
  43076. bodyScrollHeight.value = tableScrollHeight.value - headerScrollHeight.value - footerScrollHeight.value - appendScrollHeight.value;
  43077. if (shouldUpdateLayout) {
  43078. resizeState.value = {
  43079. width,
  43080. height,
  43081. headerHeight: props.showHeader && tableHeader?.offsetHeight || 0
  43082. };
  43083. doLayout();
  43084. }
  43085. };
  43086. const tableSize = useFormSize();
  43087. const bodyWidth = computed(() => {
  43088. const { bodyWidth: bodyWidth_, scrollY, gutterWidth } = layout;
  43089. return bodyWidth_.value ? `${bodyWidth_.value - (scrollY.value ? gutterWidth : 0)}px` : "";
  43090. });
  43091. const tableLayout = computed(() => {
  43092. if (props.maxHeight) return "fixed";
  43093. return props.tableLayout;
  43094. });
  43095. return {
  43096. isHidden,
  43097. renderExpanded,
  43098. setDragVisible,
  43099. isGroup,
  43100. handleMouseLeave,
  43101. handleHeaderFooterMousewheel,
  43102. tableSize,
  43103. emptyBlockStyle: computed(() => {
  43104. if (props.data && props.data.length) return;
  43105. let height = "100%";
  43106. if (props.height && bodyScrollHeight.value) height = `${bodyScrollHeight.value}px`;
  43107. const width = tableWidth.value;
  43108. return {
  43109. width: width ? `${width}px` : "",
  43110. height
  43111. };
  43112. }),
  43113. resizeProxyVisible,
  43114. bodyWidth,
  43115. resizeState,
  43116. doLayout,
  43117. tableBodyStyles,
  43118. tableLayout,
  43119. scrollbarViewStyle,
  43120. scrollbarStyle: computed(() => {
  43121. if (props.height) return { height: "100%" };
  43122. if (props.maxHeight) if (!Number.isNaN(Number(props.maxHeight))) return { maxHeight: `${+props.maxHeight - headerScrollHeight.value - footerScrollHeight.value}px` };
  43123. else return { maxHeight: `calc(${props.maxHeight} - ${headerScrollHeight.value + footerScrollHeight.value}px)` };
  43124. return {};
  43125. })
  43126. };
  43127. }
  43128. //#endregion
  43129. //#region ../../packages/components/table/src/table/key-render-helper.ts
  43130. function useKeyRender(table) {
  43131. let observer;
  43132. const initWatchDom = () => {
  43133. const columnsWrapper = table.vnode.el.querySelector(".hidden-columns");
  43134. const config = {
  43135. childList: true,
  43136. subtree: true
  43137. };
  43138. const updateOrderFns = table.store.states.updateOrderFns;
  43139. observer = new MutationObserver(() => {
  43140. updateOrderFns.forEach((fn) => fn());
  43141. });
  43142. observer.observe(columnsWrapper, config);
  43143. };
  43144. onMounted(() => {
  43145. initWatchDom();
  43146. });
  43147. onUnmounted(() => {
  43148. observer?.disconnect();
  43149. });
  43150. }
  43151. //#endregion
  43152. //#region ../../packages/components/table/src/h-helper.ts
  43153. function hColgroup(props) {
  43154. const isAuto = props.tableLayout === "auto";
  43155. let columns = props.columns || [];
  43156. if (isAuto) {
  43157. if (columns.every(({ width }) => isUndefined(width))) columns = [];
  43158. }
  43159. const getPropsData = (column) => {
  43160. const propsData = {
  43161. key: `${props.tableLayout}_${column.id}`,
  43162. style: {},
  43163. name: void 0
  43164. };
  43165. if (isAuto) propsData.style = { width: `${column.width}px` };
  43166. else propsData.name = column.id;
  43167. return propsData;
  43168. };
  43169. return h("colgroup", {}, columns.map((column) => h("col", getPropsData(column))));
  43170. }
  43171. hColgroup.props = ["columns", "tableLayout"];
  43172. //#endregion
  43173. //#region ../../packages/components/table/src/composables/use-scrollbar.ts
  43174. const useScrollbar$1 = () => {
  43175. const scrollBarRef = ref();
  43176. const scrollTo = (options, yCoord) => {
  43177. const scrollbar = scrollBarRef.value;
  43178. if (scrollbar) scrollbar.scrollTo(options, yCoord);
  43179. };
  43180. const setScrollPosition = (position, offset) => {
  43181. const scrollbar = scrollBarRef.value;
  43182. if (scrollbar && isNumber(offset) && ["Top", "Left"].includes(position)) scrollbar[`setScroll${position}`](offset);
  43183. };
  43184. const setScrollTop = (top) => setScrollPosition("Top", top);
  43185. const setScrollLeft = (left) => setScrollPosition("Left", left);
  43186. return {
  43187. scrollBarRef,
  43188. scrollTo,
  43189. setScrollTop,
  43190. setScrollLeft
  43191. };
  43192. };
  43193. //#endregion
  43194. //#region ../../packages/components/table/src/table.vue?vue&type=script&setup=true&lang.ts
  43195. const _hoisted_1$15 = ["data-prefix"];
  43196. const _hoisted_2$9 = {
  43197. ref: "hiddenColumns",
  43198. class: "hidden-columns"
  43199. };
  43200. var table_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  43201. name: "ElTable",
  43202. __name: "table",
  43203. props: tableProps,
  43204. emits: [
  43205. "select",
  43206. "select-all",
  43207. "selection-change",
  43208. "cell-mouse-enter",
  43209. "cell-mouse-leave",
  43210. "cell-dblclick",
  43211. "cell-contextmenu",
  43212. "cell-click",
  43213. "row-dblclick",
  43214. "row-click",
  43215. "row-contextmenu",
  43216. "header-click",
  43217. "header-contextmenu",
  43218. "sort-change",
  43219. "filter-change",
  43220. "current-change",
  43221. "header-dragend",
  43222. "expand-change",
  43223. "scroll"
  43224. ],
  43225. setup(__props, { expose: __expose }) {
  43226. const props = __props;
  43227. const { t } = useLocale();
  43228. const ns = useNamespace("table");
  43229. const globalConfig = useGlobalConfig("table");
  43230. const table = getCurrentInstance();
  43231. provide(TABLE_INJECTION_KEY, table);
  43232. const store = createStore(table, props);
  43233. table.store = store;
  43234. const layout = new TableLayout({
  43235. store: table.store,
  43236. table,
  43237. fit: props.fit,
  43238. showHeader: props.showHeader
  43239. });
  43240. table.layout = layout;
  43241. const isEmpty = computed(() => (store.states.data.value || []).length === 0);
  43242. const { setCurrentRow, getSelectionRows, getHalfSelectionRows, toggleRowSelection, clearSelection, clearFilter, toggleAllSelection, toggleRowExpansion, clearSort, sort, updateKeyChildren } = useUtils(store);
  43243. const { isHidden, renderExpanded, setDragVisible, isGroup, handleMouseLeave, handleHeaderFooterMousewheel, tableSize, emptyBlockStyle, resizeProxyVisible, bodyWidth, resizeState, doLayout, tableBodyStyles, tableLayout, scrollbarViewStyle, scrollbarStyle } = useStyle(props, layout, store, table);
  43244. const { scrollBarRef, scrollTo, setScrollLeft, setScrollTop } = useScrollbar$1();
  43245. const debouncedUpdateLayout = debounce(doLayout, 50);
  43246. const tableId = createTableId(ns.namespace.value);
  43247. const context = table;
  43248. table.tableId = tableId;
  43249. table.state = {
  43250. isGroup,
  43251. resizeState,
  43252. doLayout,
  43253. debouncedUpdateLayout
  43254. };
  43255. const computedSumText = computed(() => props.sumText ?? t("el.table.sumText"));
  43256. const computedEmptyText = computed(() => {
  43257. return props.emptyText ?? t("el.table.emptyText");
  43258. });
  43259. const computedTooltipEffect = computed(() => props.tooltipEffect ?? globalConfig.value?.tooltipEffect);
  43260. const computedTooltipOptions = computed(() => props.tooltipOptions ?? globalConfig.value?.tooltipOptions);
  43261. const columns = computed(() => {
  43262. return convertToRows(store.states.originColumns.value)[0];
  43263. });
  43264. useKeyRender(table);
  43265. onBeforeUnmount(() => {
  43266. debouncedUpdateLayout.cancel();
  43267. });
  43268. __expose({
  43269. ns,
  43270. layout,
  43271. store,
  43272. columns,
  43273. handleHeaderFooterMousewheel,
  43274. handleMouseLeave,
  43275. tableId,
  43276. tableSize,
  43277. isHidden,
  43278. isEmpty,
  43279. renderExpanded,
  43280. resizeProxyVisible,
  43281. resizeState,
  43282. isGroup,
  43283. bodyWidth,
  43284. tableBodyStyles,
  43285. emptyBlockStyle,
  43286. debouncedUpdateLayout,
  43287. setCurrentRow,
  43288. getSelectionRows,
  43289. getHalfSelectionRows,
  43290. toggleRowSelection,
  43291. clearSelection,
  43292. clearFilter,
  43293. toggleAllSelection,
  43294. toggleRowExpansion,
  43295. clearSort,
  43296. doLayout,
  43297. sort,
  43298. updateKeyChildren,
  43299. t,
  43300. setDragVisible,
  43301. context,
  43302. computedSumText,
  43303. computedEmptyText,
  43304. computedTooltipEffect,
  43305. computedTooltipOptions,
  43306. tableLayout,
  43307. scrollbarViewStyle,
  43308. scrollbarStyle,
  43309. scrollBarRef,
  43310. scrollTo,
  43311. setScrollLeft,
  43312. setScrollTop,
  43313. allowDragLastColumn: props.allowDragLastColumn
  43314. });
  43315. return (_ctx, _cache) => {
  43316. return openBlock(), createElementBlock("div", {
  43317. ref: "tableWrapper",
  43318. class: normalizeClass([
  43319. {
  43320. [unref(ns).m("fit")]: __props.fit,
  43321. [unref(ns).m("striped")]: __props.stripe,
  43322. [unref(ns).m("border")]: __props.border || unref(isGroup),
  43323. [unref(ns).m("hidden")]: unref(isHidden),
  43324. [unref(ns).m("group")]: unref(isGroup),
  43325. [unref(ns).m("fluid-height")]: __props.maxHeight,
  43326. [unref(ns).m("scrollable-x")]: unref(layout).scrollX.value,
  43327. [unref(ns).m("scrollable-y")]: unref(layout).scrollY.value,
  43328. [unref(ns).m("enable-row-hover")]: !unref(store).states.isComplex.value,
  43329. [unref(ns).m("enable-row-transition")]: (unref(store).states.data.value || []).length !== 0 && (unref(store).states.data.value || []).length < 100,
  43330. "has-footer": __props.showSummary
  43331. },
  43332. unref(ns).m(unref(tableSize)),
  43333. __props.className,
  43334. unref(ns).b(),
  43335. unref(ns).m(`layout-${unref(tableLayout)}`)
  43336. ]),
  43337. style: normalizeStyle(__props.style),
  43338. "data-prefix": unref(ns).namespace.value,
  43339. onMouseleave: _cache[1] || (_cache[1] = (...args) => unref(handleMouseLeave) && unref(handleMouseLeave)(...args))
  43340. }, [createElementVNode("div", {
  43341. ref: "tableInnerWrapper",
  43342. class: normalizeClass(unref(ns).e("inner-wrapper"))
  43343. }, [
  43344. createElementVNode("div", _hoisted_2$9, [renderSlot(_ctx.$slots, "default")], 512),
  43345. __props.showHeader && unref(tableLayout) === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  43346. key: 0,
  43347. ref: "headerWrapper",
  43348. class: normalizeClass(unref(ns).e("header-wrapper"))
  43349. }, [createElementVNode("table", {
  43350. ref: "tableHeader",
  43351. class: normalizeClass(unref(ns).e("header")),
  43352. style: normalizeStyle(unref(tableBodyStyles)),
  43353. border: "0",
  43354. cellpadding: "0",
  43355. cellspacing: "0"
  43356. }, [createVNode(unref(hColgroup), {
  43357. columns: unref(store).states.columns.value,
  43358. "table-layout": unref(tableLayout)
  43359. }, null, 8, ["columns", "table-layout"]), createVNode(unref(table_header_default), {
  43360. ref: "tableHeaderRef",
  43361. border: __props.border,
  43362. "default-sort": __props.defaultSort,
  43363. store: unref(store),
  43364. "append-filter-panel-to": __props.appendFilterPanelTo,
  43365. "allow-drag-last-column": __props.allowDragLastColumn,
  43366. onSetDragVisible: unref(setDragVisible)
  43367. }, null, 8, [
  43368. "border",
  43369. "default-sort",
  43370. "store",
  43371. "append-filter-panel-to",
  43372. "allow-drag-last-column",
  43373. "onSetDragVisible"
  43374. ])], 6)], 2)), [[unref(Mousewheel), unref(handleHeaderFooterMousewheel)]]) : createCommentVNode("v-if", true),
  43375. createElementVNode("div", {
  43376. ref: "bodyWrapper",
  43377. class: normalizeClass(unref(ns).e("body-wrapper"))
  43378. }, [createVNode(unref(ElScrollbar), {
  43379. ref_key: "scrollBarRef",
  43380. ref: scrollBarRef,
  43381. "view-style": unref(scrollbarViewStyle),
  43382. "wrap-style": unref(scrollbarStyle),
  43383. always: __props.scrollbarAlwaysOn,
  43384. tabindex: __props.scrollbarTabindex,
  43385. native: __props.nativeScrollbar,
  43386. onScroll: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("scroll", $event))
  43387. }, {
  43388. default: withCtx(() => [
  43389. createElementVNode("table", {
  43390. ref: "tableBody",
  43391. class: normalizeClass(unref(ns).e("body")),
  43392. cellspacing: "0",
  43393. cellpadding: "0",
  43394. border: "0",
  43395. style: normalizeStyle({
  43396. width: unref(bodyWidth),
  43397. tableLayout: unref(tableLayout)
  43398. })
  43399. }, [
  43400. createVNode(unref(hColgroup), {
  43401. columns: unref(store).states.columns.value,
  43402. "table-layout": unref(tableLayout)
  43403. }, null, 8, ["columns", "table-layout"]),
  43404. __props.showHeader && unref(tableLayout) === "auto" ? (openBlock(), createBlock(unref(table_header_default), {
  43405. key: 0,
  43406. ref: "tableHeaderRef",
  43407. class: normalizeClass(unref(ns).e("body-header")),
  43408. border: __props.border,
  43409. "default-sort": __props.defaultSort,
  43410. store: unref(store),
  43411. "append-filter-panel-to": __props.appendFilterPanelTo,
  43412. onSetDragVisible: unref(setDragVisible)
  43413. }, null, 8, [
  43414. "class",
  43415. "border",
  43416. "default-sort",
  43417. "store",
  43418. "append-filter-panel-to",
  43419. "onSetDragVisible"
  43420. ])) : createCommentVNode("v-if", true),
  43421. createVNode(unref(table_body_default), {
  43422. context: unref(context),
  43423. highlight: __props.highlightCurrentRow,
  43424. "row-class-name": __props.rowClassName,
  43425. "tooltip-effect": computedTooltipEffect.value,
  43426. "tooltip-options": computedTooltipOptions.value,
  43427. "row-style": __props.rowStyle,
  43428. store: unref(store),
  43429. stripe: __props.stripe
  43430. }, null, 8, [
  43431. "context",
  43432. "highlight",
  43433. "row-class-name",
  43434. "tooltip-effect",
  43435. "tooltip-options",
  43436. "row-style",
  43437. "store",
  43438. "stripe"
  43439. ]),
  43440. __props.showSummary && unref(tableLayout) === "auto" ? (openBlock(), createBlock(unref(table_footer_default), {
  43441. key: 1,
  43442. class: normalizeClass(unref(ns).e("body-footer")),
  43443. border: __props.border,
  43444. "default-sort": __props.defaultSort,
  43445. store: unref(store),
  43446. "sum-text": computedSumText.value,
  43447. "summary-method": __props.summaryMethod
  43448. }, null, 8, [
  43449. "class",
  43450. "border",
  43451. "default-sort",
  43452. "store",
  43453. "sum-text",
  43454. "summary-method"
  43455. ])) : createCommentVNode("v-if", true)
  43456. ], 6),
  43457. isEmpty.value ? (openBlock(), createElementBlock("div", {
  43458. key: 0,
  43459. ref: "emptyBlock",
  43460. style: normalizeStyle(unref(emptyBlockStyle)),
  43461. class: normalizeClass(unref(ns).e("empty-block"))
  43462. }, [createElementVNode("span", { class: normalizeClass(unref(ns).e("empty-text")) }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(computedEmptyText.value), 1)])], 2)], 6)) : createCommentVNode("v-if", true),
  43463. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  43464. key: 1,
  43465. ref: "appendWrapper",
  43466. class: normalizeClass(unref(ns).e("append-wrapper"))
  43467. }, [renderSlot(_ctx.$slots, "append")], 2)) : createCommentVNode("v-if", true)
  43468. ]),
  43469. _: 3
  43470. }, 8, [
  43471. "view-style",
  43472. "wrap-style",
  43473. "always",
  43474. "tabindex",
  43475. "native"
  43476. ])], 2),
  43477. __props.showSummary && unref(tableLayout) === "fixed" ? withDirectives((openBlock(), createElementBlock("div", {
  43478. key: 1,
  43479. ref: "footerWrapper",
  43480. class: normalizeClass(unref(ns).e("footer-wrapper"))
  43481. }, [createElementVNode("table", {
  43482. class: normalizeClass(unref(ns).e("footer")),
  43483. cellspacing: "0",
  43484. cellpadding: "0",
  43485. border: "0",
  43486. style: normalizeStyle(unref(tableBodyStyles))
  43487. }, [createVNode(unref(hColgroup), {
  43488. columns: unref(store).states.columns.value,
  43489. "table-layout": unref(tableLayout)
  43490. }, null, 8, ["columns", "table-layout"]), createVNode(unref(table_footer_default), {
  43491. border: __props.border,
  43492. "default-sort": __props.defaultSort,
  43493. store: unref(store),
  43494. "sum-text": computedSumText.value,
  43495. "summary-method": __props.summaryMethod
  43496. }, null, 8, [
  43497. "border",
  43498. "default-sort",
  43499. "store",
  43500. "sum-text",
  43501. "summary-method"
  43502. ])], 6)], 2)), [[vShow, !isEmpty.value], [unref(Mousewheel), unref(handleHeaderFooterMousewheel)]]) : createCommentVNode("v-if", true),
  43503. __props.border || unref(isGroup) ? (openBlock(), createElementBlock("div", {
  43504. key: 2,
  43505. class: normalizeClass(unref(ns).e("border-left-patch"))
  43506. }, null, 2)) : createCommentVNode("v-if", true)
  43507. ], 2), withDirectives(createElementVNode("div", {
  43508. ref: "resizeProxy",
  43509. class: normalizeClass(unref(ns).e("column-resize-proxy"))
  43510. }, null, 2), [[vShow, unref(resizeProxyVisible)]])], 46, _hoisted_1$15);
  43511. };
  43512. }
  43513. });
  43514. //#endregion
  43515. //#region ../../packages/components/table/src/table.vue
  43516. var table_default = table_vue_vue_type_script_setup_true_lang_default;
  43517. //#endregion
  43518. //#region ../../packages/components/table/src/table-column/defaults.ts
  43519. const tableColumnProps = {
  43520. type: {
  43521. type: String,
  43522. default: "default"
  43523. },
  43524. label: String,
  43525. className: String,
  43526. labelClassName: String,
  43527. property: String,
  43528. prop: String,
  43529. width: {
  43530. type: [String, Number],
  43531. default: ""
  43532. },
  43533. minWidth: {
  43534. type: [String, Number],
  43535. default: ""
  43536. },
  43537. renderHeader: Function,
  43538. sortable: {
  43539. type: [Boolean, String],
  43540. default: false
  43541. },
  43542. sortMethod: Function,
  43543. sortBy: [
  43544. String,
  43545. Function,
  43546. Array
  43547. ],
  43548. resizable: {
  43549. type: Boolean,
  43550. default: true
  43551. },
  43552. columnKey: String,
  43553. align: String,
  43554. headerAlign: String,
  43555. showOverflowTooltip: {
  43556. type: [Boolean, Object],
  43557. default: void 0
  43558. },
  43559. tooltipFormatter: Function,
  43560. fixed: [Boolean, String],
  43561. formatter: Function,
  43562. selectable: Function,
  43563. reserveSelection: Boolean,
  43564. filterMethod: Function,
  43565. filteredValue: Array,
  43566. filters: Array,
  43567. filterPlacement: String,
  43568. filterMultiple: {
  43569. type: Boolean,
  43570. default: true
  43571. },
  43572. filterClassName: String,
  43573. index: [Number, Function],
  43574. sortOrders: {
  43575. type: Array,
  43576. default: () => {
  43577. return [
  43578. "ascending",
  43579. "descending",
  43580. null
  43581. ];
  43582. },
  43583. validator: (val) => {
  43584. return val.every((order) => [
  43585. "ascending",
  43586. "descending",
  43587. null
  43588. ].includes(order));
  43589. }
  43590. }
  43591. };
  43592. //#endregion
  43593. //#region ../../packages/components/table/src/config.ts
  43594. const defaultClassNames = {
  43595. selection: "table-column--selection",
  43596. expand: "table__expand-column"
  43597. };
  43598. const cellStarts = {
  43599. default: { order: "" },
  43600. selection: {
  43601. width: 48,
  43602. minWidth: 48,
  43603. realWidth: 48,
  43604. order: ""
  43605. },
  43606. expand: {
  43607. width: 48,
  43608. minWidth: 48,
  43609. realWidth: 48,
  43610. order: ""
  43611. },
  43612. index: {
  43613. width: 48,
  43614. minWidth: 48,
  43615. realWidth: 48,
  43616. order: ""
  43617. }
  43618. };
  43619. const getDefaultClassName = (type) => {
  43620. return defaultClassNames[type] || "";
  43621. };
  43622. const cellForced = {
  43623. selection: {
  43624. renderHeader({ store }) {
  43625. function isDisabled() {
  43626. return store.states.data.value && store.states.data.value.length === 0;
  43627. }
  43628. return h(ElCheckbox, {
  43629. disabled: isDisabled(),
  43630. size: store.states.tableSize.value,
  43631. indeterminate: store.states.selection.value.length > 0 && !store.states.isAllSelected.value,
  43632. "onUpdate:modelValue": store.toggleAllSelection ?? void 0,
  43633. modelValue: store.states.isAllSelected.value,
  43634. ariaLabel: store.t("el.table.selectAllLabel")
  43635. });
  43636. },
  43637. renderCell({ row, column, store, $index }) {
  43638. return h(ElCheckbox, {
  43639. disabled: column.selectable ? !column.selectable.call(null, row, $index) : false,
  43640. size: store.states.tableSize.value,
  43641. onChange: () => {
  43642. store.commit("rowSelectedChanged", row);
  43643. },
  43644. onClick: (event) => event.stopPropagation(),
  43645. modelValue: store.isSelected(row),
  43646. indeterminate: store.getRowIndeterminate(row),
  43647. ariaLabel: store.t("el.table.selectRowLabel")
  43648. });
  43649. },
  43650. sortable: false,
  43651. resizable: false
  43652. },
  43653. index: {
  43654. renderHeader({ column }) {
  43655. return column.label || "#";
  43656. },
  43657. renderCell({ column, $index }) {
  43658. let i = $index + 1;
  43659. const index = column.index;
  43660. if (isNumber(index)) i = $index + index;
  43661. else if (isFunction$1(index)) i = index($index);
  43662. return h("div", {}, [i]);
  43663. },
  43664. sortable: false
  43665. },
  43666. expand: {
  43667. renderHeader({ column }) {
  43668. return column.label || "";
  43669. },
  43670. renderCell({ column, row, store, expanded, $index }) {
  43671. const { ns } = store;
  43672. const classes = [ns.e("expand-icon")];
  43673. if (!column.renderExpand && expanded) classes.push(ns.em("expand-icon", "expanded"));
  43674. const callback = function(e) {
  43675. e.stopPropagation();
  43676. store.toggleRowExpansion(row);
  43677. };
  43678. const isRowExpandable = store.states.rowExpandable.value?.(row, $index) ?? true;
  43679. if (!isRowExpandable) classes.push(ns.is("disabled"));
  43680. return h("button", {
  43681. type: "button",
  43682. disabled: !isRowExpandable,
  43683. "aria-label": store.t(expanded ? "el.table.collapseRowLabel" : "el.table.expandRowLabel"),
  43684. "aria-expanded": expanded,
  43685. class: classes,
  43686. onClick: callback
  43687. }, { default: () => {
  43688. if (column.renderExpand) return [column.renderExpand({
  43689. expanded,
  43690. expandable: isRowExpandable
  43691. })];
  43692. return [h(ElIcon, null, { default: () => {
  43693. return [h(arrow_right_default)];
  43694. } })];
  43695. } });
  43696. },
  43697. sortable: false,
  43698. resizable: false
  43699. }
  43700. };
  43701. function defaultRenderCell({ row, column, $index }) {
  43702. const property = column.property;
  43703. const value = property && getProp(row, property).value;
  43704. if (column && column.formatter) return column.formatter(row, column, value, $index);
  43705. return value?.toString?.() || "";
  43706. }
  43707. function treeCellPrefix({ row, treeNode, store }, createPlaceholder = false) {
  43708. const { ns } = store;
  43709. if (!treeNode) {
  43710. if (createPlaceholder) return [h("span", { class: ns.e("placeholder") })];
  43711. return null;
  43712. }
  43713. const ele = [];
  43714. const callback = function(e) {
  43715. e.stopPropagation();
  43716. if (treeNode.loading) return;
  43717. store.loadOrToggle(row);
  43718. };
  43719. if (treeNode.indent) ele.push(h("span", {
  43720. class: ns.e("indent"),
  43721. style: { "padding-left": `${treeNode.indent}px` }
  43722. }));
  43723. if (isBoolean(treeNode.expanded) && !treeNode.noLazyChildren) {
  43724. const expandClasses = [ns.e("expand-icon"), treeNode.expanded ? ns.em("expand-icon", "expanded") : ""];
  43725. let icon = arrow_right_default;
  43726. if (treeNode.loading) icon = loading_default;
  43727. ele.push(h("button", {
  43728. type: "button",
  43729. "aria-label": store.t(treeNode.expanded ? "el.table.collapseRowLabel" : "el.table.expandRowLabel"),
  43730. "aria-expanded": treeNode.expanded,
  43731. class: expandClasses,
  43732. onClick: callback
  43733. }, { default: () => {
  43734. return [h(ElIcon, { class: ns.is("loading", treeNode.loading) }, { default: () => [h(icon)] })];
  43735. } }));
  43736. } else ele.push(h("span", { class: ns.e("placeholder") }));
  43737. return ele;
  43738. }
  43739. //#endregion
  43740. //#region ../../packages/components/table/src/table-column/watcher-helper.ts
  43741. function getAllAliases(props, aliases) {
  43742. return props.reduce((prev, cur) => {
  43743. prev[cur] = cur;
  43744. return prev;
  43745. }, aliases);
  43746. }
  43747. function useWatcher(owner, props_) {
  43748. const instance = getCurrentInstance();
  43749. const registerComplexWatchers = () => {
  43750. const props = ["fixed"];
  43751. const aliases = {
  43752. realWidth: "width",
  43753. realMinWidth: "minWidth"
  43754. };
  43755. const allAliases = getAllAliases(props, aliases);
  43756. Object.keys(allAliases).forEach((key) => {
  43757. const columnKey = aliases[key];
  43758. if (hasOwn(props_, columnKey)) watch(() => props_[columnKey], (newVal) => {
  43759. let value = newVal;
  43760. if (columnKey === "width" && key === "realWidth") value = parseWidth(newVal);
  43761. if (columnKey === "minWidth" && key === "realMinWidth") value = parseMinWidth(newVal);
  43762. instance.columnConfig.value[columnKey] = value;
  43763. instance.columnConfig.value[key] = value;
  43764. const updateColumns = columnKey === "fixed";
  43765. owner.value.store.scheduleLayout(updateColumns);
  43766. });
  43767. });
  43768. };
  43769. const registerNormalWatchers = () => {
  43770. const props = [
  43771. "label",
  43772. "filters",
  43773. "filterMultiple",
  43774. "filteredValue",
  43775. "sortable",
  43776. "index",
  43777. "formatter",
  43778. "className",
  43779. "labelClassName",
  43780. "filterClassName",
  43781. "showOverflowTooltip",
  43782. "tooltipFormatter",
  43783. "resizable"
  43784. ];
  43785. const parentProps = ["showOverflowTooltip"];
  43786. const aliases = {
  43787. property: "prop",
  43788. align: "realAlign",
  43789. headerAlign: "realHeaderAlign"
  43790. };
  43791. const allAliases = getAllAliases(props, aliases);
  43792. Object.keys(allAliases).forEach((key) => {
  43793. const columnKey = aliases[key];
  43794. if (hasOwn(props_, columnKey)) watch(() => props_[columnKey], (newVal) => {
  43795. instance.columnConfig.value[key] = newVal;
  43796. if (key === "filters" || key === "filterMethod") instance.columnConfig.value["filterable"] = !!(instance.columnConfig.value["filters"] || instance.columnConfig.value["filterMethod"]);
  43797. });
  43798. });
  43799. parentProps.forEach((key) => {
  43800. if (hasOwn(owner.value.props, key)) watch(() => owner.value.props[key], (newVal) => {
  43801. if (instance.columnConfig.value.type === "selection") return;
  43802. if (!isUndefined(props_[key])) return;
  43803. instance.columnConfig.value[key] = newVal;
  43804. });
  43805. });
  43806. const globalConfig = useGlobalConfig("table");
  43807. if (globalConfig.value && hasOwn(globalConfig.value, "showOverflowTooltip")) watch(() => globalConfig.value?.showOverflowTooltip, (newVal) => {
  43808. if (instance.columnConfig.value.type === "selection") return;
  43809. if (!isUndefined(props_.showOverflowTooltip) || !isUndefined(owner.value.props.showOverflowTooltip)) return;
  43810. instance.columnConfig.value.showOverflowTooltip = newVal;
  43811. });
  43812. };
  43813. return {
  43814. registerComplexWatchers,
  43815. registerNormalWatchers
  43816. };
  43817. }
  43818. //#endregion
  43819. //#region ../../packages/components/table/src/table-column/render-helper.ts
  43820. function useRender(props, slots, owner) {
  43821. const instance = getCurrentInstance();
  43822. const columnId = ref("");
  43823. const isSubColumn = ref(false);
  43824. const realAlign = ref();
  43825. const realHeaderAlign = ref();
  43826. const ns = useNamespace("table");
  43827. watchEffect(() => {
  43828. realAlign.value = props.align ? `is-${props.align}` : null;
  43829. realAlign.value;
  43830. });
  43831. watchEffect(() => {
  43832. realHeaderAlign.value = props.headerAlign ? `is-${props.headerAlign}` : realAlign.value;
  43833. realHeaderAlign.value;
  43834. });
  43835. const columnOrTableParent = computed(() => {
  43836. let parent = instance.vnode.vParent || instance.parent;
  43837. while (parent && !parent.tableId && !parent.columnId) parent = parent.vnode.vParent || parent.parent;
  43838. return parent;
  43839. });
  43840. const hasTreeColumn = computed(() => {
  43841. const { store } = instance.parent;
  43842. if (!store) return false;
  43843. const { treeData } = store.states;
  43844. const treeDataValue = treeData.value;
  43845. return treeDataValue && Object.keys(treeDataValue).length > 0;
  43846. });
  43847. const realWidth = ref(parseWidth(props.width));
  43848. const realMinWidth = ref(parseMinWidth(props.minWidth));
  43849. const setColumnWidth = (column) => {
  43850. if (realWidth.value) column.width = realWidth.value;
  43851. if (realMinWidth.value) column.minWidth = realMinWidth.value;
  43852. if (!realWidth.value && realMinWidth.value) column.width = void 0;
  43853. if (!column.minWidth) column.minWidth = 80;
  43854. column.realWidth = Number(isUndefined(column.width) ? column.minWidth : column.width);
  43855. return column;
  43856. };
  43857. const setColumnForcedProps = (column) => {
  43858. const type = column.type;
  43859. const source = cellForced[type] || {};
  43860. Object.keys(source).forEach((prop) => {
  43861. const value = source[prop];
  43862. if (prop !== "className" && !isUndefined(value)) column[prop] = value;
  43863. });
  43864. const className = getDefaultClassName(type);
  43865. if (className) {
  43866. const forceClass = `${unref(ns.namespace)}-${className}`;
  43867. column.className = column.className ? `${column.className} ${forceClass}` : forceClass;
  43868. }
  43869. return column;
  43870. };
  43871. const checkSubColumn = (children) => {
  43872. if (isArray$1(children)) children.forEach((child) => check(child));
  43873. else check(children);
  43874. function check(item) {
  43875. if (item?.type?.name === "ElTableColumn") item.vParent = instance;
  43876. }
  43877. };
  43878. const setColumnRenders = (column) => {
  43879. if (props.renderHeader) /* @__PURE__ */ debugWarn("TableColumn", "Comparing to render-header, scoped-slot header is easier to use. We recommend users to use scoped-slot header.");
  43880. else if (column.type !== "selection") column.renderHeader = (scope) => {
  43881. instance.columnConfig.value["label"];
  43882. if (slots.header) {
  43883. const slotResult = slots.header(scope);
  43884. if (ensureValidVNode(slotResult)) return h(Fragment, slotResult);
  43885. }
  43886. return createTextVNode(column.label);
  43887. };
  43888. if (slots["filter-icon"]) column.renderFilterIcon = (scope) => {
  43889. return renderSlot(slots, "filter-icon", scope);
  43890. };
  43891. if (slots.expand) column.renderExpand = (scope) => {
  43892. return renderSlot(slots, "expand", scope);
  43893. };
  43894. let originRenderCell = column.renderCell;
  43895. if (column.type === "expand") {
  43896. column.renderCell = (data) => h("div", { class: "cell" }, [originRenderCell(data)]);
  43897. owner.value.renderExpanded = (row) => {
  43898. return slots.default ? slots.default(row) : slots.default;
  43899. };
  43900. } else {
  43901. originRenderCell = originRenderCell || defaultRenderCell;
  43902. column.renderCell = (data) => {
  43903. let children = null;
  43904. if (slots.default) {
  43905. const vnodes = slots.default(data);
  43906. children = vnodes.some((v) => v.type !== Comment) ? vnodes : originRenderCell(data);
  43907. } else children = originRenderCell(data);
  43908. const { columns } = owner.value.store.states;
  43909. const firstUserColumnIndex = columns.value.findIndex((item) => item.type === "default");
  43910. const prefix = treeCellPrefix(data, hasTreeColumn.value && data.cellIndex === firstUserColumnIndex);
  43911. const props = {
  43912. class: "cell",
  43913. style: {}
  43914. };
  43915. if (column.showOverflowTooltip) {
  43916. props.class = `${props.class} ${unref(ns.namespace)}-tooltip`;
  43917. props.style = { width: `${(data.column.realWidth || Number(data.column.width)) - 1}px` };
  43918. }
  43919. checkSubColumn(children);
  43920. return h("div", props, [prefix, children]);
  43921. };
  43922. }
  43923. return column;
  43924. };
  43925. const getPropsData = (...propsKey) => {
  43926. return propsKey.reduce((prev, cur) => {
  43927. if (isArray$1(cur)) cur.forEach((key) => {
  43928. prev[key] = props[key];
  43929. });
  43930. return prev;
  43931. }, {});
  43932. };
  43933. const getColumnElIndex = (children, child) => {
  43934. return Array.prototype.indexOf.call(children, child);
  43935. };
  43936. const updateColumnOrder = () => {
  43937. owner.value.store.commit("updateColumnOrder", instance.columnConfig.value);
  43938. };
  43939. return {
  43940. columnId,
  43941. realAlign,
  43942. isSubColumn,
  43943. realHeaderAlign,
  43944. columnOrTableParent,
  43945. setColumnWidth,
  43946. setColumnForcedProps,
  43947. setColumnRenders,
  43948. getPropsData,
  43949. getColumnElIndex,
  43950. updateColumnOrder
  43951. };
  43952. }
  43953. //#endregion
  43954. //#region ../../packages/components/table/src/table-column/index.vue?vue&type=script&setup=true&lang.ts
  43955. var index_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  43956. name: "ElTableColumn",
  43957. __name: "index",
  43958. props: tableColumnProps,
  43959. setup(__props) {
  43960. const props = __props;
  43961. const slots = useSlots();
  43962. const instance = getCurrentInstance();
  43963. const globalConfig = useGlobalConfig("table");
  43964. const columnConfig = ref({});
  43965. const owner = computed(() => {
  43966. let parent = instance.parent;
  43967. while (parent && !parent.tableId) parent = parent.parent;
  43968. return parent;
  43969. });
  43970. const { registerNormalWatchers, registerComplexWatchers } = useWatcher(owner, props);
  43971. const { columnId, isSubColumn, realHeaderAlign, columnOrTableParent, setColumnWidth, setColumnForcedProps, setColumnRenders, getPropsData, getColumnElIndex, realAlign, updateColumnOrder } = useRender(props, slots, owner);
  43972. const parent = columnOrTableParent.value;
  43973. columnId.value = createTableColumnId("tableId" in parent ? parent.tableId : parent.columnId);
  43974. onBeforeMount(() => {
  43975. isSubColumn.value = owner.value !== parent;
  43976. const type = props.type || "default";
  43977. const sortable = props.sortable === "" ? true : props.sortable;
  43978. const showOverflowTooltip = type === "selection" ? false : isUndefined(props.showOverflowTooltip) ? parent.props.showOverflowTooltip ?? globalConfig.value?.showOverflowTooltip : props.showOverflowTooltip;
  43979. const tooltipFormatter = isUndefined(props.tooltipFormatter) ? parent.props.tooltipFormatter ?? globalConfig.value?.tooltipFormatter : props.tooltipFormatter;
  43980. const defaults = {
  43981. ...cellStarts[type],
  43982. id: columnId.value,
  43983. type,
  43984. property: props.prop || props.property,
  43985. align: realAlign,
  43986. headerAlign: realHeaderAlign,
  43987. showOverflowTooltip,
  43988. tooltipFormatter,
  43989. filterable: props.filters || props.filterMethod,
  43990. filteredValue: [],
  43991. filterPlacement: "",
  43992. filterClassName: "",
  43993. isColumnGroup: false,
  43994. isSubColumn: false,
  43995. filterOpened: false,
  43996. sortable,
  43997. index: props.index,
  43998. rawColumnKey: instance.vnode.key
  43999. };
  44000. let column = getPropsData([
  44001. "columnKey",
  44002. "label",
  44003. "className",
  44004. "labelClassName",
  44005. "type",
  44006. "renderHeader",
  44007. "formatter",
  44008. "fixed",
  44009. "resizable"
  44010. ], [
  44011. "sortMethod",
  44012. "sortBy",
  44013. "sortOrders"
  44014. ], ["selectable", "reserveSelection"], [
  44015. "filterMethod",
  44016. "filters",
  44017. "filterMultiple",
  44018. "filterOpened",
  44019. "filteredValue",
  44020. "filterPlacement",
  44021. "filterClassName"
  44022. ]);
  44023. column = mergeOptions(defaults, column);
  44024. column = compose(setColumnRenders, setColumnWidth, setColumnForcedProps)(column);
  44025. columnConfig.value = column;
  44026. registerNormalWatchers();
  44027. registerComplexWatchers();
  44028. });
  44029. onMounted(() => {
  44030. const parent = columnOrTableParent.value;
  44031. const children = isSubColumn.value ? parent.vnode.el?.children : parent.refs.hiddenColumns?.children;
  44032. const getColumnIndex = () => getColumnElIndex(children || [], instance.vnode.el);
  44033. columnConfig.value.getColumnIndex = getColumnIndex;
  44034. getColumnIndex() > -1 && owner.value.store.commit("insertColumn", columnConfig.value, isSubColumn.value ? "columnConfig" in parent && parent.columnConfig.value : null, updateColumnOrder);
  44035. });
  44036. onBeforeUnmount(() => {
  44037. const getColumnIndex = columnConfig.value.getColumnIndex;
  44038. (getColumnIndex ? getColumnIndex() : -1) > -1 && owner.value.store.commit("removeColumn", columnConfig.value, isSubColumn.value ? "columnConfig" in parent && parent.columnConfig.value : null, updateColumnOrder);
  44039. });
  44040. instance.columnId = columnId.value;
  44041. instance.columnConfig = columnConfig;
  44042. const TableColumnRenderer = () => {
  44043. try {
  44044. const renderDefault = slots.default?.({
  44045. row: {},
  44046. column: {},
  44047. $index: -1
  44048. });
  44049. const children = [];
  44050. if (isArray$1(renderDefault)) {
  44051. for (const childNode of renderDefault) if (childNode.type?.name === "ElTableColumn" || childNode.shapeFlag & 2) children.push(childNode);
  44052. else if (childNode.type === Fragment && isArray$1(childNode.children)) childNode.children.forEach((vnode) => {
  44053. if (vnode?.patchFlag !== 1024 && !isString(vnode?.children)) children.push(vnode);
  44054. });
  44055. }
  44056. return h("div", children);
  44057. } catch {
  44058. return h("div", []);
  44059. }
  44060. };
  44061. return (_ctx, _cache) => {
  44062. return openBlock(), createBlock(TableColumnRenderer);
  44063. };
  44064. }
  44065. });
  44066. //#endregion
  44067. //#region ../../packages/components/table/src/table-column/index.vue
  44068. var table_column_default$1 = index_vue_vue_type_script_setup_true_lang_default;
  44069. //#endregion
  44070. //#region ../../packages/components/table/src/table-column/index.ts
  44071. var table_column_default = table_column_default$1;
  44072. //#endregion
  44073. //#region ../../packages/components/table/src/tableColumn.ts
  44074. var tableColumn_default = table_column_default;
  44075. //#endregion
  44076. //#region ../../packages/components/table/index.ts
  44077. const ElTable = withInstall(table_default, { TableColumn: tableColumn_default });
  44078. const ElTableColumn = withNoopInstall(tableColumn_default);
  44079. //#endregion
  44080. //#region ../../packages/components/table-v2/src/constants.ts
  44081. let SortOrder = /* @__PURE__ */ function(SortOrder) {
  44082. SortOrder["ASC"] = "asc";
  44083. SortOrder["DESC"] = "desc";
  44084. return SortOrder;
  44085. }({});
  44086. let Alignment = /* @__PURE__ */ function(Alignment) {
  44087. Alignment["LEFT"] = "left";
  44088. Alignment["CENTER"] = "center";
  44089. Alignment["RIGHT"] = "right";
  44090. return Alignment;
  44091. }({});
  44092. let FixedDir = /* @__PURE__ */ function(FixedDir) {
  44093. FixedDir["LEFT"] = "left";
  44094. FixedDir["RIGHT"] = "right";
  44095. return FixedDir;
  44096. }({});
  44097. const oppositeOrderMap = {
  44098. ["asc"]: "desc",
  44099. ["desc"]: "asc"
  44100. };
  44101. //#endregion
  44102. //#region ../../packages/components/table-v2/src/private.ts
  44103. const placeholderSign = Symbol("placeholder");
  44104. //#endregion
  44105. //#region ../../packages/components/table-v2/src/composables/utils.ts
  44106. const calcColumnStyle = (column, fixedColumn, fixed) => {
  44107. const flex = {
  44108. flexGrow: 0,
  44109. flexShrink: 0,
  44110. ...fixed ? {} : {
  44111. flexGrow: column.flexGrow ?? 0,
  44112. flexShrink: column.flexShrink ?? 1
  44113. }
  44114. };
  44115. const style = {
  44116. ...column.style ?? {},
  44117. ...flex,
  44118. flexBasis: "auto",
  44119. width: column.width
  44120. };
  44121. if (!fixedColumn) {
  44122. if (column.maxWidth) style.maxWidth = column.maxWidth;
  44123. if (column.minWidth) style.minWidth = column.minWidth;
  44124. }
  44125. return style;
  44126. };
  44127. //#endregion
  44128. //#region ../../packages/components/table-v2/src/composables/use-columns.ts
  44129. function useColumns(props, columns, fixed) {
  44130. const _columns = computed(() => unref(columns).map((column, index) => ({
  44131. ...column,
  44132. key: column.key ?? column.dataKey ?? index
  44133. })));
  44134. const visibleColumns = computed(() => {
  44135. return unref(_columns).filter((column) => !column.hidden);
  44136. });
  44137. const fixedColumnsOnLeft = computed(() => unref(visibleColumns).filter((column) => column.fixed === "left" || column.fixed === true));
  44138. const fixedColumnsOnRight = computed(() => unref(visibleColumns).filter((column) => column.fixed === "right"));
  44139. const normalColumns = computed(() => unref(visibleColumns).filter((column) => !column.fixed));
  44140. const mainColumns = computed(() => {
  44141. const ret = [];
  44142. unref(fixedColumnsOnLeft).forEach((column) => {
  44143. ret.push({
  44144. ...column,
  44145. placeholderSign
  44146. });
  44147. });
  44148. unref(normalColumns).forEach((column) => {
  44149. ret.push(column);
  44150. });
  44151. unref(fixedColumnsOnRight).forEach((column) => {
  44152. ret.push({
  44153. ...column,
  44154. placeholderSign
  44155. });
  44156. });
  44157. return ret;
  44158. });
  44159. const hasFixedColumns = computed(() => {
  44160. return unref(fixedColumnsOnLeft).length || unref(fixedColumnsOnRight).length;
  44161. });
  44162. const columnsStyles = computed(() => {
  44163. return unref(_columns).reduce((style, column) => {
  44164. style[column.key] = calcColumnStyle(column, unref(fixed), props.fixed);
  44165. return style;
  44166. }, {});
  44167. });
  44168. const columnsTotalWidth = computed(() => {
  44169. return unref(visibleColumns).reduce((width, column) => width + column.width, 0);
  44170. });
  44171. const getColumn = (key) => {
  44172. return unref(_columns).find((column) => column.key === key);
  44173. };
  44174. const getColumnStyle = (key) => {
  44175. return unref(columnsStyles)[key];
  44176. };
  44177. const updateColumnWidth = (column, width) => {
  44178. column.width = width;
  44179. };
  44180. function onColumnSorted(e) {
  44181. const { key } = e.currentTarget.dataset;
  44182. if (!key) return;
  44183. const { sortState, sortBy } = props;
  44184. let order = "asc";
  44185. if (isObject$1(sortState)) order = oppositeOrderMap[sortState[key]];
  44186. else order = oppositeOrderMap[sortBy.order];
  44187. props.onColumnSort?.({
  44188. column: getColumn(key),
  44189. key,
  44190. order
  44191. });
  44192. }
  44193. return {
  44194. columns: _columns,
  44195. columnsStyles,
  44196. columnsTotalWidth,
  44197. fixedColumnsOnLeft,
  44198. fixedColumnsOnRight,
  44199. hasFixedColumns,
  44200. mainColumns,
  44201. normalColumns,
  44202. visibleColumns,
  44203. getColumn,
  44204. getColumnStyle,
  44205. updateColumnWidth,
  44206. onColumnSorted
  44207. };
  44208. }
  44209. //#endregion
  44210. //#region ../../packages/components/table-v2/src/composables/use-scrollbar.ts
  44211. const useScrollbar = (props, { mainTableRef, leftTableRef, rightTableRef, onMaybeEndReached }) => {
  44212. const scrollPos = ref({
  44213. scrollLeft: 0,
  44214. scrollTop: 0
  44215. });
  44216. function doScroll(params) {
  44217. const { scrollTop } = params;
  44218. mainTableRef.value?.scrollTo(params);
  44219. leftTableRef.value?.scrollToTop(scrollTop);
  44220. rightTableRef.value?.scrollToTop(scrollTop);
  44221. }
  44222. function scrollTo(params) {
  44223. scrollPos.value = params;
  44224. doScroll(params);
  44225. }
  44226. function scrollToTop(scrollTop) {
  44227. scrollPos.value.scrollTop = scrollTop;
  44228. doScroll(unref(scrollPos));
  44229. }
  44230. function scrollToLeft(scrollLeft) {
  44231. scrollPos.value.scrollLeft = scrollLeft;
  44232. mainTableRef.value?.scrollTo?.(unref(scrollPos));
  44233. }
  44234. function onScroll(params) {
  44235. scrollTo(params);
  44236. props.onScroll?.(params);
  44237. }
  44238. function onVerticalScroll({ scrollTop }) {
  44239. const { scrollTop: currentScrollTop } = unref(scrollPos);
  44240. if (scrollTop !== currentScrollTop) scrollToTop(scrollTop);
  44241. }
  44242. function scrollToRow(row, strategy = "auto") {
  44243. mainTableRef.value?.scrollToRow(row, strategy);
  44244. }
  44245. watch(() => unref(scrollPos).scrollTop, (cur, prev) => {
  44246. if (cur > prev) onMaybeEndReached();
  44247. });
  44248. return {
  44249. scrollPos,
  44250. scrollTo,
  44251. scrollToLeft,
  44252. scrollToTop,
  44253. scrollToRow,
  44254. onScroll,
  44255. onVerticalScroll
  44256. };
  44257. };
  44258. //#endregion
  44259. //#region ../../packages/components/table-v2/src/composables/use-row.ts
  44260. const useRow = (props, { mainTableRef, leftTableRef, rightTableRef, tableInstance, ns, isScrolling }) => {
  44261. const vm = getCurrentInstance();
  44262. const { emit } = vm;
  44263. const isResetting = shallowRef(false);
  44264. const expandedRowKeys = ref(props.defaultExpandedRowKeys || []);
  44265. const lastRenderedRowIndex = ref(-1);
  44266. const resetIndex = shallowRef(null);
  44267. const rowHeights = ref({});
  44268. const pendingRowHeights = ref({});
  44269. const leftTableHeights = shallowRef({});
  44270. const mainTableHeights = shallowRef({});
  44271. const rightTableHeights = shallowRef({});
  44272. const isDynamic = computed(() => isNumber(props.estimatedRowHeight));
  44273. function onRowsRendered(params) {
  44274. props.onRowsRendered?.(params);
  44275. if (params.rowCacheEnd > unref(lastRenderedRowIndex)) lastRenderedRowIndex.value = params.rowCacheEnd;
  44276. }
  44277. function onRowHovered({ hovered, rowKey }) {
  44278. if (isScrolling.value) return;
  44279. tableInstance.vnode.el.querySelectorAll(`[rowkey="${String(rowKey)}"]`).forEach((row) => {
  44280. if (hovered) row.classList.add(ns.is("hovered"));
  44281. else row.classList.remove(ns.is("hovered"));
  44282. });
  44283. }
  44284. function onRowExpanded({ expanded, rowData, rowIndex, rowKey }) {
  44285. const _expandedRowKeys = [...unref(expandedRowKeys)];
  44286. const currentKeyIndex = _expandedRowKeys.indexOf(rowKey);
  44287. if (expanded) {
  44288. if (currentKeyIndex === -1) _expandedRowKeys.push(rowKey);
  44289. } else if (currentKeyIndex > -1) _expandedRowKeys.splice(currentKeyIndex, 1);
  44290. expandedRowKeys.value = _expandedRowKeys;
  44291. emit("update:expandedRowKeys", _expandedRowKeys);
  44292. props.onRowExpand?.({
  44293. expanded,
  44294. rowData,
  44295. rowIndex,
  44296. rowKey
  44297. });
  44298. props.onExpandedRowsChange?.(_expandedRowKeys);
  44299. if (tableInstance.vnode.el.querySelector(`.${ns.is("hovered")}[rowkey="${String(rowKey)}"]`)) nextTick(() => onRowHovered({
  44300. hovered: true,
  44301. rowKey
  44302. }));
  44303. }
  44304. const flushingRowHeights = debounce(() => {
  44305. isResetting.value = true;
  44306. rowHeights.value = {
  44307. ...unref(rowHeights),
  44308. ...unref(pendingRowHeights)
  44309. };
  44310. resetAfterIndex(unref(resetIndex), false);
  44311. pendingRowHeights.value = {};
  44312. resetIndex.value = null;
  44313. mainTableRef.value?.forceUpdate();
  44314. leftTableRef.value?.forceUpdate();
  44315. rightTableRef.value?.forceUpdate();
  44316. vm.proxy?.$forceUpdate();
  44317. isResetting.value = false;
  44318. }, 0);
  44319. function resetAfterIndex(index, forceUpdate = false) {
  44320. if (!unref(isDynamic)) return;
  44321. [
  44322. mainTableRef,
  44323. leftTableRef,
  44324. rightTableRef
  44325. ].forEach((tableRef) => {
  44326. const table = unref(tableRef);
  44327. if (table) table.resetAfterRowIndex(index, forceUpdate);
  44328. });
  44329. }
  44330. function resetHeights(rowKey, height, rowIdx) {
  44331. const resetIdx = unref(resetIndex);
  44332. if (resetIdx === null) resetIndex.value = rowIdx;
  44333. else if (resetIdx > rowIdx) resetIndex.value = rowIdx;
  44334. pendingRowHeights.value[rowKey] = height;
  44335. }
  44336. function onRowHeightChange({ rowKey, height, rowIndex }, fixedDir) {
  44337. if (!fixedDir) mainTableHeights.value[rowKey] = height;
  44338. else if (fixedDir === "right") rightTableHeights.value[rowKey] = height;
  44339. else leftTableHeights.value[rowKey] = height;
  44340. const maximumHeight = Math.max(...[
  44341. leftTableHeights,
  44342. rightTableHeights,
  44343. mainTableHeights
  44344. ].map((records) => records.value[rowKey] || 0));
  44345. if (unref(rowHeights)[rowKey] !== maximumHeight) {
  44346. resetHeights(rowKey, maximumHeight, rowIndex);
  44347. flushingRowHeights();
  44348. }
  44349. }
  44350. return {
  44351. expandedRowKeys,
  44352. lastRenderedRowIndex,
  44353. isDynamic,
  44354. isResetting,
  44355. rowHeights,
  44356. resetAfterIndex,
  44357. onRowExpanded,
  44358. onRowHovered,
  44359. onRowsRendered,
  44360. onRowHeightChange
  44361. };
  44362. };
  44363. //#endregion
  44364. //#region ../../packages/components/table-v2/src/composables/use-data.ts
  44365. const useData = (props, { expandedRowKeys, lastRenderedRowIndex, resetAfterIndex }) => {
  44366. const depthMap = ref({});
  44367. const flattenedData = computed(() => {
  44368. const depths = {};
  44369. const { data, rowKey } = props;
  44370. const _expandedRowKeys = unref(expandedRowKeys);
  44371. if (!_expandedRowKeys || !_expandedRowKeys.length) return data;
  44372. const array = [];
  44373. const keysSet = /* @__PURE__ */ new Set();
  44374. _expandedRowKeys.forEach((x) => keysSet.add(x));
  44375. let copy = data.slice();
  44376. copy.forEach((x) => depths[x[rowKey]] = 0);
  44377. while (copy.length > 0) {
  44378. const item = copy.shift();
  44379. array.push(item);
  44380. if (keysSet.has(item[rowKey]) && isArray$1(item.children) && item.children.length > 0) {
  44381. copy = [...item.children, ...copy];
  44382. item.children.forEach((child) => depths[child[rowKey]] = depths[item[rowKey]] + 1);
  44383. }
  44384. }
  44385. depthMap.value = depths;
  44386. return array;
  44387. });
  44388. const data = computed(() => {
  44389. const { data, expandColumnKey } = props;
  44390. return expandColumnKey ? unref(flattenedData) : data;
  44391. });
  44392. watch(data, (val, prev) => {
  44393. if (val !== prev) {
  44394. lastRenderedRowIndex.value = -1;
  44395. resetAfterIndex(0, true);
  44396. }
  44397. });
  44398. return {
  44399. data,
  44400. depthMap
  44401. };
  44402. };
  44403. //#endregion
  44404. //#region ../../packages/components/table-v2/src/utils.ts
  44405. const sumReducer = (sum, num) => sum + num;
  44406. const sum = (listLike) => {
  44407. return isArray$1(listLike) ? listLike.reduce(sumReducer, 0) : listLike;
  44408. };
  44409. const tryCall = (fLike, params, defaultRet = {}) => {
  44410. return isFunction$1(fLike) ? fLike(params) : fLike ?? defaultRet;
  44411. };
  44412. const enforceUnit = (style) => {
  44413. [
  44414. "width",
  44415. "maxWidth",
  44416. "minWidth",
  44417. "height"
  44418. ].forEach((key) => {
  44419. style[key] = addUnit(style[key]);
  44420. });
  44421. return style;
  44422. };
  44423. const componentToSlot = (ComponentLike) => isVNode(ComponentLike) ? (props) => h(ComponentLike, props) : ComponentLike;
  44424. //#endregion
  44425. //#region ../../packages/components/table-v2/src/composables/use-styles.ts
  44426. const useStyles = (props, { columnsTotalWidth, rowsHeight, fixedColumnsOnLeft, fixedColumnsOnRight }) => {
  44427. const bodyWidth = computed(() => {
  44428. const { fixed, width, vScrollbarSize } = props;
  44429. const ret = width - vScrollbarSize;
  44430. return fixed ? Math.max(Math.round(unref(columnsTotalWidth)), ret) : ret;
  44431. });
  44432. const mainTableHeight = computed(() => {
  44433. const { height = 0, maxHeight = 0, footerHeight, hScrollbarSize } = props;
  44434. if (maxHeight > 0) {
  44435. const _fixedRowsHeight = unref(fixedRowsHeight);
  44436. const _rowsHeight = unref(rowsHeight);
  44437. const total = unref(headerHeight) + _fixedRowsHeight + _rowsHeight + hScrollbarSize;
  44438. return Math.min(total, maxHeight - footerHeight);
  44439. }
  44440. return height - footerHeight;
  44441. });
  44442. const fixedTableHeight = computed(() => {
  44443. const { maxHeight } = props;
  44444. const tableHeight = unref(mainTableHeight);
  44445. if (isNumber(maxHeight) && maxHeight > 0) return tableHeight;
  44446. const totalHeight = unref(rowsHeight) + unref(headerHeight) + unref(fixedRowsHeight);
  44447. return Math.min(tableHeight, totalHeight);
  44448. });
  44449. const mapColumn = (column) => column.width;
  44450. const leftTableWidth = computed(() => sum(unref(fixedColumnsOnLeft).map(mapColumn)));
  44451. const rightTableWidth = computed(() => sum(unref(fixedColumnsOnRight).map(mapColumn)));
  44452. const headerHeight = computed(() => sum(props.headerHeight));
  44453. const fixedRowsHeight = computed(() => {
  44454. return (props.fixedData?.length || 0) * props.rowHeight;
  44455. });
  44456. const windowHeight = computed(() => {
  44457. return unref(mainTableHeight) - unref(headerHeight) - unref(fixedRowsHeight);
  44458. });
  44459. const rootStyle = computed(() => {
  44460. const { style = {}, height, width } = props;
  44461. return enforceUnit({
  44462. ...style,
  44463. height,
  44464. width
  44465. });
  44466. });
  44467. return {
  44468. bodyWidth,
  44469. fixedTableHeight,
  44470. mainTableHeight,
  44471. leftTableWidth,
  44472. rightTableWidth,
  44473. windowHeight,
  44474. footerHeight: computed(() => enforceUnit({ height: props.footerHeight })),
  44475. emptyStyle: computed(() => ({
  44476. top: addUnit(unref(headerHeight)),
  44477. bottom: addUnit(props.footerHeight),
  44478. width: addUnit(props.width)
  44479. })),
  44480. rootStyle,
  44481. headerHeight
  44482. };
  44483. };
  44484. //#endregion
  44485. //#region ../../packages/components/table-v2/src/composables/use-auto-resize.ts
  44486. const useAutoResize = (props) => {
  44487. const sizer = ref();
  44488. const width$ = ref(0);
  44489. const height$ = ref(0);
  44490. let resizerStopper;
  44491. onMounted(() => {
  44492. resizerStopper = useResizeObserver(sizer, ([entry]) => {
  44493. const { width, height } = entry.contentRect;
  44494. const { paddingLeft, paddingRight, paddingTop, paddingBottom } = getComputedStyle(entry.target);
  44495. const left = Number.parseInt(paddingLeft) || 0;
  44496. const right = Number.parseInt(paddingRight) || 0;
  44497. const top = Number.parseInt(paddingTop) || 0;
  44498. const bottom = Number.parseInt(paddingBottom) || 0;
  44499. width$.value = width - left - right;
  44500. height$.value = height - top - bottom;
  44501. }).stop;
  44502. });
  44503. onBeforeUnmount(() => {
  44504. resizerStopper?.();
  44505. });
  44506. watch([width$, height$], ([width, height]) => {
  44507. props.onResize?.({
  44508. width,
  44509. height
  44510. });
  44511. });
  44512. return {
  44513. sizer,
  44514. width: width$,
  44515. height: height$
  44516. };
  44517. };
  44518. //#endregion
  44519. //#region ../../packages/components/table-v2/src/use-table.ts
  44520. function useTable(props) {
  44521. const mainTableRef = ref();
  44522. const leftTableRef = ref();
  44523. const rightTableRef = ref();
  44524. const { columns, columnsStyles, columnsTotalWidth, fixedColumnsOnLeft, fixedColumnsOnRight, hasFixedColumns, mainColumns, onColumnSorted } = useColumns(props, toRef(props, "columns"), toRef(props, "fixed"));
  44525. const { scrollTo, scrollToLeft, scrollToTop, scrollToRow, onScroll, onVerticalScroll, scrollPos } = useScrollbar(props, {
  44526. mainTableRef,
  44527. leftTableRef,
  44528. rightTableRef,
  44529. onMaybeEndReached
  44530. });
  44531. const ns = useNamespace("table-v2");
  44532. const instance = getCurrentInstance();
  44533. const isScrolling = shallowRef(false);
  44534. const { expandedRowKeys, lastRenderedRowIndex, isDynamic, isResetting, rowHeights, resetAfterIndex, onRowExpanded, onRowHeightChange, onRowHovered, onRowsRendered } = useRow(props, {
  44535. mainTableRef,
  44536. leftTableRef,
  44537. rightTableRef,
  44538. tableInstance: instance,
  44539. ns,
  44540. isScrolling
  44541. });
  44542. const { data, depthMap } = useData(props, {
  44543. expandedRowKeys,
  44544. lastRenderedRowIndex,
  44545. resetAfterIndex
  44546. });
  44547. const rowsHeight = computed(() => {
  44548. const { estimatedRowHeight, rowHeight } = props;
  44549. const _data = unref(data);
  44550. if (isNumber(estimatedRowHeight)) return Object.values(unref(rowHeights)).reduce((acc, curr) => acc + curr, 0);
  44551. return _data.length * rowHeight;
  44552. });
  44553. const { bodyWidth, fixedTableHeight, mainTableHeight, leftTableWidth, rightTableWidth, windowHeight, footerHeight, emptyStyle, rootStyle, headerHeight } = useStyles(props, {
  44554. columnsTotalWidth,
  44555. fixedColumnsOnLeft,
  44556. fixedColumnsOnRight,
  44557. rowsHeight
  44558. });
  44559. const containerRef = ref();
  44560. const showEmpty = computed(() => {
  44561. const noData = unref(data).length === 0;
  44562. return isArray$1(props.fixedData) ? props.fixedData.length === 0 && noData : noData;
  44563. });
  44564. function getRowHeight(rowIndex) {
  44565. const { estimatedRowHeight, rowHeight, rowKey } = props;
  44566. if (!estimatedRowHeight) return rowHeight;
  44567. return unref(rowHeights)[unref(data)[rowIndex][rowKey]] || estimatedRowHeight;
  44568. }
  44569. const isEndReached = ref(false);
  44570. function onMaybeEndReached() {
  44571. const { onEndReached } = props;
  44572. if (!onEndReached) return;
  44573. const { scrollTop } = unref(scrollPos);
  44574. const _totalHeight = unref(rowsHeight);
  44575. const remainDistance = _totalHeight - (scrollTop + unref(windowHeight)) + props.hScrollbarSize;
  44576. if (!isEndReached.value && unref(lastRenderedRowIndex) >= 0 && _totalHeight <= scrollTop + unref(mainTableHeight) - unref(headerHeight)) {
  44577. isEndReached.value = true;
  44578. onEndReached(remainDistance);
  44579. } else isEndReached.value = false;
  44580. }
  44581. watch(() => unref(rowsHeight), () => isEndReached.value = false);
  44582. watch(() => props.expandedRowKeys, (val) => expandedRowKeys.value = val, { deep: true });
  44583. return {
  44584. columns,
  44585. containerRef,
  44586. mainTableRef,
  44587. leftTableRef,
  44588. rightTableRef,
  44589. isDynamic,
  44590. isResetting,
  44591. isScrolling,
  44592. hasFixedColumns,
  44593. columnsStyles,
  44594. columnsTotalWidth,
  44595. data,
  44596. expandedRowKeys,
  44597. depthMap,
  44598. fixedColumnsOnLeft,
  44599. fixedColumnsOnRight,
  44600. mainColumns,
  44601. bodyWidth,
  44602. emptyStyle,
  44603. rootStyle,
  44604. footerHeight,
  44605. mainTableHeight,
  44606. fixedTableHeight,
  44607. leftTableWidth,
  44608. rightTableWidth,
  44609. showEmpty,
  44610. getRowHeight,
  44611. onColumnSorted,
  44612. onRowHovered,
  44613. onRowExpanded,
  44614. onRowsRendered,
  44615. onRowHeightChange,
  44616. scrollTo,
  44617. scrollToLeft,
  44618. scrollToTop,
  44619. scrollToRow,
  44620. onScroll,
  44621. onVerticalScroll
  44622. };
  44623. }
  44624. //#endregion
  44625. //#region ../../packages/components/table-v2/src/tokens.ts
  44626. const TableV2InjectionKey = Symbol("tableV2");
  44627. const TABLE_V2_GRID_INJECTION_KEY = "tableV2GridScrollLeft";
  44628. //#endregion
  44629. //#region ../../packages/components/table-v2/src/common.ts
  44630. const classType = String;
  44631. const columns = {
  44632. type: definePropType(Array),
  44633. required: true
  44634. };
  44635. const column = { type: definePropType(Object) };
  44636. const fixedDataType = { type: definePropType(Array) };
  44637. const dataType = {
  44638. ...fixedDataType,
  44639. required: true
  44640. };
  44641. const expandColumnKey = String;
  44642. const expandKeys = {
  44643. type: definePropType(Array),
  44644. default: () => mutable([])
  44645. };
  44646. const requiredNumber = {
  44647. type: Number,
  44648. required: true
  44649. };
  44650. const rowKey = {
  44651. type: definePropType([
  44652. String,
  44653. Number,
  44654. Symbol
  44655. ]),
  44656. default: "id"
  44657. };
  44658. const styleType = { type: definePropType(Object) };
  44659. //#endregion
  44660. //#region ../../packages/components/table-v2/src/row.ts
  44661. const tableV2RowProps = buildProps({
  44662. class: String,
  44663. columns,
  44664. columnsStyles: {
  44665. type: definePropType(Object),
  44666. required: true
  44667. },
  44668. depth: Number,
  44669. expandColumnKey,
  44670. estimatedRowHeight: {
  44671. ...virtualizedGridProps.estimatedRowHeight,
  44672. default: void 0
  44673. },
  44674. isScrolling: Boolean,
  44675. onRowExpand: { type: definePropType(Function) },
  44676. onRowHover: { type: definePropType(Function) },
  44677. onRowHeightChange: { type: definePropType(Function) },
  44678. rowData: {
  44679. type: definePropType(Object),
  44680. required: true
  44681. },
  44682. rowEventHandlers: { type: definePropType(Object) },
  44683. rowIndex: {
  44684. type: Number,
  44685. required: true
  44686. },
  44687. rowKey,
  44688. style: { type: definePropType(Object) }
  44689. });
  44690. //#endregion
  44691. //#region ../../packages/components/table-v2/src/header.ts
  44692. const requiredNumberType = {
  44693. type: Number,
  44694. required: true
  44695. };
  44696. const tableV2HeaderProps = buildProps({
  44697. class: String,
  44698. columns,
  44699. fixedHeaderData: { type: definePropType(Array) },
  44700. headerData: {
  44701. type: definePropType(Array),
  44702. required: true
  44703. },
  44704. headerHeight: {
  44705. type: definePropType([Number, Array]),
  44706. default: 50
  44707. },
  44708. rowWidth: requiredNumberType,
  44709. rowHeight: {
  44710. type: Number,
  44711. default: 50
  44712. },
  44713. height: requiredNumberType,
  44714. width: requiredNumberType
  44715. });
  44716. //#endregion
  44717. //#region ../../packages/components/table-v2/src/grid.ts
  44718. const tableV2GridProps = buildProps({
  44719. columns,
  44720. data: dataType,
  44721. fixedData: fixedDataType,
  44722. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  44723. width: requiredNumber,
  44724. height: requiredNumber,
  44725. headerWidth: requiredNumber,
  44726. headerHeight: tableV2HeaderProps.headerHeight,
  44727. bodyWidth: requiredNumber,
  44728. rowHeight: requiredNumber,
  44729. cache: virtualizedListProps.cache,
  44730. useIsScrolling: Boolean,
  44731. scrollbarAlwaysOn: virtualizedGridProps.scrollbarAlwaysOn,
  44732. scrollbarStartGap: virtualizedGridProps.scrollbarStartGap,
  44733. scrollbarEndGap: virtualizedGridProps.scrollbarEndGap,
  44734. class: classType,
  44735. style: styleType,
  44736. containerStyle: styleType,
  44737. getRowHeight: {
  44738. type: definePropType(Function),
  44739. required: true
  44740. },
  44741. rowKey: tableV2RowProps.rowKey,
  44742. onRowsRendered: { type: definePropType(Function) },
  44743. onScroll: { type: definePropType(Function) }
  44744. });
  44745. //#endregion
  44746. //#region ../../packages/components/table-v2/src/table.ts
  44747. const tableV2Props = buildProps({
  44748. cache: tableV2GridProps.cache,
  44749. estimatedRowHeight: tableV2RowProps.estimatedRowHeight,
  44750. rowKey,
  44751. headerClass: { type: definePropType([String, Function]) },
  44752. headerProps: { type: definePropType([Object, Function]) },
  44753. headerCellProps: { type: definePropType([Object, Function]) },
  44754. headerHeight: tableV2HeaderProps.headerHeight,
  44755. footerHeight: {
  44756. type: Number,
  44757. default: 0
  44758. },
  44759. rowClass: { type: definePropType([String, Function]) },
  44760. rowProps: { type: definePropType([Object, Function]) },
  44761. rowHeight: {
  44762. type: Number,
  44763. default: 50
  44764. },
  44765. cellProps: { type: definePropType([Object, Function]) },
  44766. columns,
  44767. data: dataType,
  44768. dataGetter: { type: definePropType(Function) },
  44769. fixedData: fixedDataType,
  44770. expandColumnKey: tableV2RowProps.expandColumnKey,
  44771. expandedRowKeys: expandKeys,
  44772. defaultExpandedRowKeys: expandKeys,
  44773. class: classType,
  44774. fixed: Boolean,
  44775. style: { type: definePropType(Object) },
  44776. width: requiredNumber,
  44777. height: requiredNumber,
  44778. maxHeight: Number,
  44779. useIsScrolling: Boolean,
  44780. indentSize: {
  44781. type: Number,
  44782. default: 12
  44783. },
  44784. iconSize: {
  44785. type: Number,
  44786. default: 12
  44787. },
  44788. hScrollbarSize: virtualizedGridProps.hScrollbarSize,
  44789. vScrollbarSize: virtualizedGridProps.vScrollbarSize,
  44790. scrollbarAlwaysOn: virtualizedScrollbarProps.alwaysOn,
  44791. sortBy: {
  44792. type: definePropType(Object),
  44793. default: () => ({})
  44794. },
  44795. sortState: {
  44796. type: definePropType(Object),
  44797. default: void 0
  44798. },
  44799. onColumnSort: { type: definePropType(Function) },
  44800. onExpandedRowsChange: { type: definePropType(Function) },
  44801. onEndReached: { type: definePropType(Function) },
  44802. onRowExpand: tableV2RowProps.onRowExpand,
  44803. onScroll: tableV2GridProps.onScroll,
  44804. onRowsRendered: tableV2GridProps.onRowsRendered,
  44805. rowEventHandlers: tableV2RowProps.rowEventHandlers
  44806. });
  44807. //#endregion
  44808. //#region ../../packages/components/table-v2/src/components/cell.tsx
  44809. const TableV2Cell = (props, { slots }) => {
  44810. const { cellData, style } = props;
  44811. const displayText = cellData?.toString?.() || "";
  44812. const defaultSlot = renderSlot(slots, "default", props, () => [displayText]);
  44813. return createVNode("div", {
  44814. "class": props.class,
  44815. "title": displayText,
  44816. "style": style
  44817. }, [defaultSlot]);
  44818. };
  44819. TableV2Cell.displayName = "ElTableV2Cell";
  44820. TableV2Cell.inheritAttrs = false;
  44821. //#endregion
  44822. //#region ../../packages/components/table-v2/src/components/header-cell.tsx
  44823. const HeaderCell = (props, { slots }) => renderSlot(slots, "default", props, () => [createVNode("div", {
  44824. "class": props.class,
  44825. "title": props.column?.title
  44826. }, [props.column?.title])]);
  44827. HeaderCell.displayName = "ElTableV2HeaderCell";
  44828. HeaderCell.inheritAttrs = false;
  44829. //#endregion
  44830. //#region ../../packages/components/table-v2/src/header-row.ts
  44831. const tableV2HeaderRowProps = buildProps({
  44832. class: String,
  44833. columns,
  44834. columnsStyles: {
  44835. type: definePropType(Object),
  44836. required: true
  44837. },
  44838. headerIndex: Number,
  44839. style: { type: definePropType(Object) }
  44840. });
  44841. //#endregion
  44842. //#region ../../packages/components/table-v2/src/components/header-row.tsx
  44843. const TableV2HeaderRow = /* @__PURE__ */ defineComponent({
  44844. name: "ElTableV2HeaderRow",
  44845. props: tableV2HeaderRowProps,
  44846. setup(props, { slots }) {
  44847. return () => {
  44848. const { columns, columnsStyles, headerIndex, style } = props;
  44849. let Cells = columns.map((column, columnIndex) => {
  44850. return slots.cell({
  44851. columns,
  44852. column,
  44853. columnIndex,
  44854. headerIndex,
  44855. style: columnsStyles[column.key]
  44856. });
  44857. });
  44858. if (slots.header) Cells = slots.header({
  44859. cells: Cells.map((node) => {
  44860. if (isArray$1(node) && node.length === 1) return node[0];
  44861. return node;
  44862. }),
  44863. columns,
  44864. headerIndex
  44865. });
  44866. return createVNode("div", {
  44867. "class": props.class,
  44868. "style": style,
  44869. "role": "row"
  44870. }, [Cells]);
  44871. };
  44872. }
  44873. });
  44874. //#endregion
  44875. //#region ../../packages/components/table-v2/src/components/header.tsx
  44876. const TableV2Header = /* @__PURE__ */ defineComponent({
  44877. name: "ElTableV2Header",
  44878. props: tableV2HeaderProps,
  44879. setup(props, { slots, expose }) {
  44880. const ns = useNamespace("table-v2");
  44881. const scrollLeftInfo = inject(TABLE_V2_GRID_INJECTION_KEY);
  44882. const headerRef = ref();
  44883. const headerStyle = computed(() => enforceUnit({
  44884. width: props.width,
  44885. height: props.height
  44886. }));
  44887. const rowStyle = computed(() => enforceUnit({
  44888. width: props.rowWidth,
  44889. height: props.height
  44890. }));
  44891. const headerHeights = computed(() => castArray$1(unref(props.headerHeight)));
  44892. const scrollToLeft = (left) => {
  44893. const headerEl = unref(headerRef);
  44894. nextTick(() => {
  44895. headerEl?.scroll && headerEl.scroll({ left });
  44896. });
  44897. };
  44898. const renderFixedRows = () => {
  44899. const fixedRowClassName = ns.e("fixed-header-row");
  44900. const { columns, fixedHeaderData, rowHeight } = props;
  44901. return fixedHeaderData?.map((fixedRowData, fixedRowIndex) => {
  44902. const style = enforceUnit({
  44903. height: rowHeight,
  44904. width: "100%"
  44905. });
  44906. return slots.fixed?.({
  44907. class: fixedRowClassName,
  44908. columns,
  44909. rowData: fixedRowData,
  44910. rowIndex: -(fixedRowIndex + 1),
  44911. style
  44912. });
  44913. });
  44914. };
  44915. const renderDynamicRows = () => {
  44916. const dynamicRowClassName = ns.e("dynamic-header-row");
  44917. const { columns } = props;
  44918. return unref(headerHeights).map((rowHeight, rowIndex) => {
  44919. const style = enforceUnit({
  44920. width: "100%",
  44921. height: rowHeight
  44922. });
  44923. return slots.dynamic?.({
  44924. class: dynamicRowClassName,
  44925. columns,
  44926. headerIndex: rowIndex,
  44927. style
  44928. });
  44929. });
  44930. };
  44931. onUpdated(() => {
  44932. if (scrollLeftInfo?.value) scrollToLeft(scrollLeftInfo.value);
  44933. });
  44934. expose({ scrollToLeft });
  44935. return () => {
  44936. if (props.height <= 0) return;
  44937. return createVNode("div", {
  44938. "ref": headerRef,
  44939. "class": props.class,
  44940. "style": unref(headerStyle),
  44941. "role": "rowgroup"
  44942. }, [createVNode("div", {
  44943. "style": unref(rowStyle),
  44944. "class": ns.e("header")
  44945. }, [renderDynamicRows(), renderFixedRows()])]);
  44946. };
  44947. }
  44948. });
  44949. //#endregion
  44950. //#region ../../packages/components/table-v2/src/components/row.tsx
  44951. const useTableRow = (props) => {
  44952. const { isScrolling } = inject(TableV2InjectionKey);
  44953. const measured = ref(false);
  44954. const rowRef = ref();
  44955. const measurable = computed(() => {
  44956. return isNumber(props.estimatedRowHeight) && props.rowIndex >= 0;
  44957. });
  44958. const doMeasure = (isInit = false) => {
  44959. const $rowRef = unref(rowRef);
  44960. if (!$rowRef) return;
  44961. const { columns, onRowHeightChange, rowKey, rowIndex, style } = props;
  44962. const { height } = $rowRef.getBoundingClientRect();
  44963. measured.value = true;
  44964. nextTick(() => {
  44965. if (isInit || height !== Number.parseInt(style.height)) {
  44966. const firstColumn = columns[0];
  44967. const isPlaceholder = firstColumn?.placeholderSign === placeholderSign;
  44968. onRowHeightChange?.({
  44969. rowKey,
  44970. height,
  44971. rowIndex
  44972. }, firstColumn && !isPlaceholder && firstColumn.fixed);
  44973. }
  44974. });
  44975. };
  44976. const eventHandlers = computed(() => {
  44977. const { rowData, rowIndex, rowKey, onRowHover } = props;
  44978. const handlers = props.rowEventHandlers || {};
  44979. const eventHandlers = {};
  44980. Object.entries(handlers).forEach(([eventName, handler]) => {
  44981. if (isFunction$1(handler)) eventHandlers[eventName] = (event) => {
  44982. handler({
  44983. event,
  44984. rowData,
  44985. rowIndex,
  44986. rowKey
  44987. });
  44988. };
  44989. });
  44990. if (onRowHover) [{
  44991. name: "onMouseleave",
  44992. hovered: false
  44993. }, {
  44994. name: "onMouseenter",
  44995. hovered: true
  44996. }].forEach(({ name, hovered }) => {
  44997. const existedHandler = eventHandlers[name];
  44998. eventHandlers[name] = (event) => {
  44999. onRowHover({
  45000. event,
  45001. hovered,
  45002. rowData,
  45003. rowIndex,
  45004. rowKey
  45005. });
  45006. existedHandler?.(event);
  45007. };
  45008. });
  45009. return eventHandlers;
  45010. });
  45011. const onExpand = (expanded) => {
  45012. const { onRowExpand, rowData, rowIndex, rowKey } = props;
  45013. onRowExpand?.({
  45014. expanded,
  45015. rowData,
  45016. rowIndex,
  45017. rowKey
  45018. });
  45019. };
  45020. onMounted(() => {
  45021. if (unref(measurable)) doMeasure(true);
  45022. });
  45023. return {
  45024. isScrolling,
  45025. measurable,
  45026. measured,
  45027. rowRef,
  45028. eventHandlers,
  45029. onExpand
  45030. };
  45031. };
  45032. const TableV2Row = /* @__PURE__ */ defineComponent({
  45033. name: "ElTableV2TableRow",
  45034. props: tableV2RowProps,
  45035. setup(props, { expose, slots, attrs }) {
  45036. const { eventHandlers, isScrolling, measurable, measured, rowRef, onExpand } = useTableRow(props);
  45037. expose({ onExpand });
  45038. return () => {
  45039. const { columns, columnsStyles, expandColumnKey, depth, rowData, rowIndex, style } = props;
  45040. let ColumnCells = columns.map((column, columnIndex) => {
  45041. const expandable = isArray$1(rowData.children) && rowData.children.length > 0 && column.key === expandColumnKey;
  45042. return slots.cell({
  45043. column,
  45044. columns,
  45045. columnIndex,
  45046. depth,
  45047. style: columnsStyles[column.key],
  45048. rowData,
  45049. rowIndex,
  45050. isScrolling: unref(isScrolling),
  45051. expandIconProps: expandable ? {
  45052. rowData,
  45053. rowIndex,
  45054. onExpand
  45055. } : void 0
  45056. });
  45057. });
  45058. if (slots.row) ColumnCells = slots.row({
  45059. cells: ColumnCells.map((node) => {
  45060. if (isArray$1(node) && node.length === 1) return node[0];
  45061. return node;
  45062. }),
  45063. style,
  45064. columns,
  45065. depth,
  45066. rowData,
  45067. rowIndex,
  45068. isScrolling: unref(isScrolling)
  45069. });
  45070. if (unref(measurable)) {
  45071. const { height, ...exceptHeightStyle } = style || {};
  45072. const _measured = unref(measured);
  45073. return createVNode("div", mergeProps({
  45074. "ref": rowRef,
  45075. "class": props.class,
  45076. "style": _measured ? style : exceptHeightStyle,
  45077. "role": "row"
  45078. }, attrs, unref(eventHandlers)), [ColumnCells]);
  45079. }
  45080. return createVNode("div", mergeProps(attrs, {
  45081. "ref": rowRef,
  45082. "class": props.class,
  45083. "style": style,
  45084. "role": "row"
  45085. }, unref(eventHandlers)), [ColumnCells]);
  45086. };
  45087. }
  45088. });
  45089. //#endregion
  45090. //#region ../../packages/components/table-v2/src/components/sort-icon.tsx
  45091. const SortIcon = (props) => {
  45092. const { sortOrder } = props;
  45093. return createVNode("button", {
  45094. "type": "button",
  45095. "aria-label": props.ariaLabel,
  45096. "class": props.class
  45097. }, [createVNode(ElIcon, { "size": 14 }, { default: () => [sortOrder === "asc" ? createVNode(sort_up_default, null, null) : createVNode(sort_down_default, null, null)] })]);
  45098. };
  45099. //#endregion
  45100. //#region ../../packages/components/table-v2/src/components/expand-icon.tsx
  45101. const ExpandIcon = (props) => {
  45102. const { expanded, expandable, onExpand, style, size, ariaLabel } = props;
  45103. return createVNode("button", mergeProps({
  45104. onClick: expandable ? () => onExpand(!expanded) : void 0,
  45105. ariaLabel,
  45106. ariaExpanded: expanded,
  45107. class: props.class
  45108. }, { "type": "button" }), [createVNode(ElIcon, {
  45109. "size": size,
  45110. "style": style
  45111. }, { default: () => [createVNode(arrow_right_default, null, null)] })]);
  45112. };
  45113. ExpandIcon.inheritAttrs = false;
  45114. //#endregion
  45115. //#region ../../packages/components/table-v2/src/table-grid.tsx
  45116. const COMPONENT_NAME$5 = "ElTableV2Grid";
  45117. const useTableGrid = (props) => {
  45118. const headerRef = ref();
  45119. const bodyRef = ref();
  45120. const scrollLeft = ref(0);
  45121. const totalHeight = computed(() => {
  45122. const { data, rowHeight, estimatedRowHeight } = props;
  45123. if (estimatedRowHeight) return;
  45124. return data.length * rowHeight;
  45125. });
  45126. const fixedRowHeight = computed(() => {
  45127. const { fixedData, rowHeight } = props;
  45128. return (fixedData?.length || 0) * rowHeight;
  45129. });
  45130. const headerHeight = computed(() => sum(props.headerHeight));
  45131. const gridHeight = computed(() => {
  45132. const { height } = props;
  45133. return Math.max(0, height - unref(headerHeight) - unref(fixedRowHeight));
  45134. });
  45135. const hasHeader = computed(() => {
  45136. return unref(headerHeight) + unref(fixedRowHeight) > 0;
  45137. });
  45138. const itemKey = ({ data, rowIndex }) => data[rowIndex][props.rowKey];
  45139. function onItemRendered({ rowCacheStart, rowCacheEnd, rowVisibleStart, rowVisibleEnd }) {
  45140. props.onRowsRendered?.({
  45141. rowCacheStart,
  45142. rowCacheEnd,
  45143. rowVisibleStart,
  45144. rowVisibleEnd
  45145. });
  45146. }
  45147. function resetAfterRowIndex(index, forceUpdate) {
  45148. bodyRef.value?.resetAfterRowIndex(index, forceUpdate);
  45149. }
  45150. function scrollTo(leftOrOptions, top) {
  45151. const header$ = unref(headerRef);
  45152. const body$ = unref(bodyRef);
  45153. if (isObject$1(leftOrOptions)) {
  45154. header$?.scrollToLeft(leftOrOptions.scrollLeft);
  45155. scrollLeft.value = leftOrOptions.scrollLeft;
  45156. body$?.scrollTo(leftOrOptions);
  45157. } else {
  45158. header$?.scrollToLeft(leftOrOptions);
  45159. scrollLeft.value = leftOrOptions;
  45160. body$?.scrollTo({
  45161. scrollLeft: leftOrOptions,
  45162. scrollTop: top
  45163. });
  45164. }
  45165. }
  45166. function scrollToTop(scrollTop) {
  45167. unref(bodyRef)?.scrollTo({ scrollTop });
  45168. }
  45169. function scrollToRow(row, strategy) {
  45170. const body = unref(bodyRef);
  45171. if (!body) return;
  45172. const prevScrollLeft = scrollLeft.value;
  45173. body.scrollToItem(row, 0, strategy);
  45174. if (prevScrollLeft) scrollTo({ scrollLeft: prevScrollLeft });
  45175. }
  45176. function forceUpdate() {
  45177. unref(bodyRef)?.$forceUpdate();
  45178. unref(headerRef)?.$forceUpdate();
  45179. }
  45180. watch(() => props.bodyWidth, () => {
  45181. if (isNumber(props.estimatedRowHeight)) bodyRef.value?.resetAfter({ columnIndex: 0 }, false);
  45182. });
  45183. return {
  45184. bodyRef,
  45185. forceUpdate,
  45186. fixedRowHeight,
  45187. gridHeight,
  45188. hasHeader,
  45189. headerHeight,
  45190. headerRef,
  45191. totalHeight,
  45192. itemKey,
  45193. onItemRendered,
  45194. resetAfterRowIndex,
  45195. scrollTo,
  45196. scrollToTop,
  45197. scrollToRow,
  45198. scrollLeft
  45199. };
  45200. };
  45201. const TableGrid = /* @__PURE__ */ defineComponent({
  45202. name: COMPONENT_NAME$5,
  45203. props: tableV2GridProps,
  45204. setup(props, { slots, expose }) {
  45205. const { ns } = inject(TableV2InjectionKey);
  45206. const { bodyRef, fixedRowHeight, gridHeight, hasHeader, headerRef, headerHeight, totalHeight, forceUpdate, itemKey, onItemRendered, resetAfterRowIndex, scrollTo, scrollToTop, scrollToRow, scrollLeft } = useTableGrid(props);
  45207. provide(TABLE_V2_GRID_INJECTION_KEY, scrollLeft);
  45208. onActivated(async () => {
  45209. await nextTick();
  45210. const scrollTop = bodyRef.value?.states.scrollTop;
  45211. scrollTop && scrollToTop(Math.round(scrollTop) + 1);
  45212. });
  45213. expose({
  45214. forceUpdate,
  45215. totalHeight,
  45216. scrollTo,
  45217. scrollToTop,
  45218. scrollToRow,
  45219. resetAfterRowIndex
  45220. });
  45221. const getColumnWidth = () => props.bodyWidth;
  45222. return () => {
  45223. const { cache, columns, data, fixedData, useIsScrolling, scrollbarAlwaysOn, scrollbarEndGap, scrollbarStartGap, style, rowHeight, bodyWidth, estimatedRowHeight, headerWidth, height, width, getRowHeight, onScroll } = props;
  45224. const isDynamicRowEnabled = isNumber(estimatedRowHeight);
  45225. const Grid = isDynamicRowEnabled ? DynamicSizeGrid : FixedSizeGrid;
  45226. const _headerHeight = unref(headerHeight);
  45227. return createVNode("div", {
  45228. "role": "table",
  45229. "class": [ns.e("table"), props.class],
  45230. "style": style
  45231. }, [createVNode(Grid, {
  45232. "ref": bodyRef,
  45233. "data": data,
  45234. "useIsScrolling": useIsScrolling,
  45235. "itemKey": itemKey,
  45236. "columnCache": 0,
  45237. "columnWidth": isDynamicRowEnabled ? getColumnWidth : bodyWidth,
  45238. "totalColumn": 1,
  45239. "totalRow": data.length,
  45240. "rowCache": cache,
  45241. "rowHeight": isDynamicRowEnabled ? getRowHeight : rowHeight,
  45242. "width": width,
  45243. "height": unref(gridHeight),
  45244. "class": ns.e("body"),
  45245. "role": "rowgroup",
  45246. "scrollbarStartGap": scrollbarStartGap,
  45247. "scrollbarEndGap": scrollbarEndGap,
  45248. "scrollbarAlwaysOn": scrollbarAlwaysOn,
  45249. "onScroll": onScroll,
  45250. "onItemRendered": onItemRendered,
  45251. "perfMode": false
  45252. }, { default: (params) => {
  45253. const rowData = data[params.rowIndex];
  45254. return slots.row?.({
  45255. ...params,
  45256. columns,
  45257. rowData
  45258. });
  45259. } }), unref(hasHeader) && createVNode(TableV2Header, {
  45260. "ref": headerRef,
  45261. "class": ns.e("header-wrapper"),
  45262. "columns": columns,
  45263. "headerData": data,
  45264. "headerHeight": props.headerHeight,
  45265. "fixedHeaderData": fixedData,
  45266. "rowWidth": headerWidth,
  45267. "rowHeight": rowHeight,
  45268. "width": width,
  45269. "height": Math.min(_headerHeight + unref(fixedRowHeight), height)
  45270. }, {
  45271. dynamic: slots.header,
  45272. fixed: slots.row
  45273. })]);
  45274. };
  45275. }
  45276. });
  45277. //#endregion
  45278. //#region ../../packages/components/table-v2/src/renderers/main-table.tsx
  45279. function _isSlot$5(s) {
  45280. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  45281. }
  45282. const MainTable = (props, { slots }) => {
  45283. const { mainTableRef, ...rest } = props;
  45284. return createVNode(TableGrid, mergeProps({ "ref": mainTableRef }, rest), _isSlot$5(slots) ? slots : { default: () => [slots] });
  45285. };
  45286. //#endregion
  45287. //#region ../../packages/components/table-v2/src/renderers/left-table.tsx
  45288. function _isSlot$4(s) {
  45289. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  45290. }
  45291. const LeftTable = (props, { slots }) => {
  45292. if (!props.columns.length) return;
  45293. const { leftTableRef, ...rest } = props;
  45294. return createVNode(TableGrid, mergeProps({ "ref": leftTableRef }, rest), _isSlot$4(slots) ? slots : { default: () => [slots] });
  45295. };
  45296. //#endregion
  45297. //#region ../../packages/components/table-v2/src/renderers/right-table.tsx
  45298. function _isSlot$3(s) {
  45299. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  45300. }
  45301. const RightTable = (props, { slots }) => {
  45302. if (!props.columns.length) return;
  45303. const { rightTableRef, ...rest } = props;
  45304. return createVNode(TableGrid, mergeProps({ "ref": rightTableRef }, rest), _isSlot$3(slots) ? slots : { default: () => [slots] });
  45305. };
  45306. //#endregion
  45307. //#region ../../packages/components/table-v2/src/renderers/row.tsx
  45308. function _isSlot$2(s) {
  45309. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  45310. }
  45311. const RowRenderer = (props, { slots }) => {
  45312. const { columns, columnsStyles, depthMap, expandColumnKey, expandedRowKeys, estimatedRowHeight, hasFixedColumns, rowData, rowIndex, style, isScrolling, rowProps, rowClass, rowKey, rowEventHandlers, ns, onRowHovered, onRowExpanded } = props;
  45313. const rowKls = tryCall(rowClass, {
  45314. columns,
  45315. rowData,
  45316. rowIndex
  45317. }, "");
  45318. const additionalProps = tryCall(rowProps, {
  45319. columns,
  45320. rowData,
  45321. rowIndex
  45322. });
  45323. const _rowKey = rowData[rowKey];
  45324. const depth = depthMap[_rowKey] || 0;
  45325. const canExpand = Boolean(expandColumnKey);
  45326. const isFixedRow = rowIndex < 0;
  45327. const kls = [
  45328. ns.e("row"),
  45329. rowKls,
  45330. ns.is("expanded", canExpand && expandedRowKeys.includes(_rowKey)),
  45331. ns.is("fixed", !depth && isFixedRow),
  45332. ns.is("customized", Boolean(slots.row)),
  45333. { [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0 }
  45334. ];
  45335. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  45336. const _rowProps = {
  45337. ...additionalProps,
  45338. columns,
  45339. columnsStyles,
  45340. class: kls,
  45341. depth,
  45342. expandColumnKey,
  45343. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  45344. isScrolling,
  45345. rowIndex,
  45346. rowData,
  45347. rowKey: _rowKey,
  45348. rowEventHandlers,
  45349. style
  45350. };
  45351. const handlerMouseEnter = (e) => {
  45352. onRowHover?.({
  45353. hovered: true,
  45354. rowKey: _rowKey,
  45355. event: e,
  45356. rowData,
  45357. rowIndex
  45358. });
  45359. };
  45360. const handlerMouseLeave = (e) => {
  45361. onRowHover?.({
  45362. hovered: false,
  45363. rowKey: _rowKey,
  45364. event: e,
  45365. rowData,
  45366. rowIndex
  45367. });
  45368. };
  45369. return createVNode(TableV2Row, mergeProps(_rowProps, {
  45370. "onRowExpand": onRowExpanded,
  45371. "onMouseenter": handlerMouseEnter,
  45372. "onMouseleave": handlerMouseLeave,
  45373. "rowkey": _rowKey
  45374. }), _isSlot$2(slots) ? slots : { default: () => [slots] });
  45375. };
  45376. //#endregion
  45377. //#region ../../packages/components/table-v2/src/renderers/cell.tsx
  45378. const CellRenderer = ({ columns, column, columnIndex, depth, expandIconProps, isScrolling, rowData, rowIndex, style, expandedRowKeys, ns, t, cellProps: _cellProps, expandColumnKey, indentSize, iconSize, rowKey }, { slots }) => {
  45379. const cellStyle = enforceUnit(style);
  45380. if (column.placeholderSign === placeholderSign) return createVNode("div", {
  45381. "class": ns.em("row-cell", "placeholder"),
  45382. "style": cellStyle
  45383. }, null);
  45384. const { cellRenderer, dataKey, dataGetter } = column;
  45385. const cellData = isFunction$1(dataGetter) ? dataGetter({
  45386. columns,
  45387. column,
  45388. columnIndex,
  45389. rowData,
  45390. rowIndex
  45391. }) : get(rowData, dataKey ?? "");
  45392. const extraCellProps = tryCall(_cellProps, {
  45393. cellData,
  45394. columns,
  45395. column,
  45396. columnIndex,
  45397. rowIndex,
  45398. rowData
  45399. });
  45400. const cellProps = {
  45401. class: ns.e("cell-text"),
  45402. columns,
  45403. column,
  45404. columnIndex,
  45405. cellData,
  45406. isScrolling,
  45407. rowData,
  45408. rowIndex
  45409. };
  45410. const columnCellRenderer = componentToSlot(cellRenderer);
  45411. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : renderSlot(slots, "default", cellProps, () => [createVNode(TableV2Cell, cellProps, null)]);
  45412. const kls = [
  45413. ns.e("row-cell"),
  45414. column.class,
  45415. column.align === "center" && ns.is("align-center"),
  45416. column.align === "right" && ns.is("align-right")
  45417. ];
  45418. const expandable = rowIndex >= 0 && expandColumnKey && column.key === expandColumnKey;
  45419. const expanded = rowIndex >= 0 && expandedRowKeys.includes(rowData[rowKey]);
  45420. let IconOrPlaceholder;
  45421. const iconStyle = `margin-inline-start: ${depth * indentSize}px;`;
  45422. if (expandable) if (isObject$1(expandIconProps)) IconOrPlaceholder = createVNode(ExpandIcon, mergeProps(expandIconProps, {
  45423. "class": [ns.e("expand-icon"), ns.is("expanded", expanded)],
  45424. "size": iconSize,
  45425. "expanded": expanded,
  45426. "ariaLabel": t(expanded ? "el.table.collapseRowLabel" : "el.table.expandRowLabel"),
  45427. "style": iconStyle,
  45428. "expandable": true
  45429. }), null);
  45430. else IconOrPlaceholder = createVNode("div", { "style": [iconStyle, `width: ${iconSize}px; height: ${iconSize}px;`].join(" ") }, null);
  45431. return createVNode("div", mergeProps({
  45432. "class": kls,
  45433. "style": cellStyle
  45434. }, extraCellProps, { "role": "cell" }), [IconOrPlaceholder, Cell]);
  45435. };
  45436. CellRenderer.inheritAttrs = false;
  45437. //#endregion
  45438. //#region ../../packages/components/table-v2/src/renderers/header.tsx
  45439. function _isSlot$1(s) {
  45440. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  45441. }
  45442. const HeaderRenderer = ({ columns, columnsStyles, headerIndex, style, headerClass, headerProps, ns }, { slots }) => {
  45443. const param = {
  45444. columns,
  45445. headerIndex
  45446. };
  45447. const kls = [
  45448. ns.e("header-row"),
  45449. tryCall(headerClass, param, ""),
  45450. ns.is("customized", Boolean(slots.header))
  45451. ];
  45452. return createVNode(TableV2HeaderRow, {
  45453. ...tryCall(headerProps, param),
  45454. columnsStyles,
  45455. class: kls,
  45456. columns,
  45457. headerIndex,
  45458. style
  45459. }, _isSlot$1(slots) ? slots : { default: () => [slots] });
  45460. };
  45461. //#endregion
  45462. //#region ../../packages/components/table-v2/src/renderers/header-cell.tsx
  45463. const HeaderCellRenderer = (props, { slots }) => {
  45464. const { column, ns, t, style, onColumnSorted } = props;
  45465. const cellStyle = enforceUnit(style);
  45466. if (column.placeholderSign === placeholderSign) return createVNode("div", {
  45467. "class": ns.em("header-row-cell", "placeholder"),
  45468. "style": cellStyle
  45469. }, null);
  45470. const { headerCellRenderer, headerClass, sortable } = column;
  45471. const cellProps = {
  45472. ...props,
  45473. class: ns.e("header-cell-text")
  45474. };
  45475. const columnCellRenderer = componentToSlot(headerCellRenderer);
  45476. const Cell = columnCellRenderer ? columnCellRenderer(cellProps) : renderSlot(slots, "default", cellProps, () => [createVNode(HeaderCell, cellProps, null)]);
  45477. const { sortBy, sortState, headerCellProps } = props;
  45478. let sorting, sortOrder, ariaSort;
  45479. if (sortState) {
  45480. const order = sortState[column.key];
  45481. sorting = Boolean(oppositeOrderMap[order]);
  45482. sortOrder = sorting ? order : "asc";
  45483. } else {
  45484. sorting = column.key === sortBy.key;
  45485. sortOrder = sorting ? sortBy.order : "asc";
  45486. }
  45487. if (sortOrder === "asc") ariaSort = "ascending";
  45488. else if (sortOrder === "desc") ariaSort = "descending";
  45489. else ariaSort = void 0;
  45490. const cellKls = [
  45491. ns.e("header-cell"),
  45492. tryCall(headerClass, props, ""),
  45493. column.align === "center" && ns.is("align-center"),
  45494. column.align === "right" && ns.is("align-right"),
  45495. sortable && ns.is("sortable")
  45496. ];
  45497. return createVNode("div", mergeProps({
  45498. ...tryCall(headerCellProps, props),
  45499. onClick: column.sortable ? onColumnSorted : void 0,
  45500. ariaSort: sortable ? ariaSort : void 0,
  45501. class: cellKls,
  45502. style: cellStyle,
  45503. ["data-key"]: column.key
  45504. }, { "role": "columnheader" }), [Cell, sortable && createVNode(SortIcon, {
  45505. "class": [ns.e("sort-icon"), sorting && ns.is("sorting")],
  45506. "sortOrder": sortOrder,
  45507. "ariaLabel": t("el.table.sortLabel", { column: column.title || "" })
  45508. }, null)]);
  45509. };
  45510. //#endregion
  45511. //#region ../../packages/components/table-v2/src/renderers/footer.tsx
  45512. const Footer$1 = (props, { slots }) => {
  45513. return createVNode("div", {
  45514. "class": props.class,
  45515. "style": props.style
  45516. }, [slots.default?.()]);
  45517. };
  45518. Footer$1.displayName = "ElTableV2Footer";
  45519. //#endregion
  45520. //#region ../../packages/components/table-v2/src/renderers/empty.tsx
  45521. const Footer = (props, { slots }) => {
  45522. const defaultSlot = renderSlot(slots, "default", {}, () => [createVNode(ElEmpty, null, null)]);
  45523. return createVNode("div", {
  45524. "class": props.class,
  45525. "style": props.style
  45526. }, [defaultSlot]);
  45527. };
  45528. Footer.displayName = "ElTableV2Empty";
  45529. //#endregion
  45530. //#region ../../packages/components/table-v2/src/renderers/overlay.tsx
  45531. const Overlay = (props, { slots }) => {
  45532. return createVNode("div", {
  45533. "class": props.class,
  45534. "style": props.style
  45535. }, [slots.default?.()]);
  45536. };
  45537. Overlay.displayName = "ElTableV2Overlay";
  45538. //#endregion
  45539. //#region ../../packages/components/table-v2/src/table-v2.tsx
  45540. function _isSlot(s) {
  45541. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
  45542. }
  45543. const TableV2 = /* @__PURE__ */ defineComponent({
  45544. name: "ElTableV2",
  45545. props: tableV2Props,
  45546. slots: Object,
  45547. setup(props, { slots, expose }) {
  45548. const ns = useNamespace("table-v2");
  45549. const { t } = useLocale();
  45550. const { columnsStyles, fixedColumnsOnLeft, fixedColumnsOnRight, mainColumns, mainTableHeight, fixedTableHeight, leftTableWidth, rightTableWidth, data, depthMap, expandedRowKeys, hasFixedColumns, mainTableRef, leftTableRef, rightTableRef, isDynamic, isResetting, isScrolling, bodyWidth, emptyStyle, rootStyle, footerHeight, showEmpty, scrollTo, scrollToLeft, scrollToTop, scrollToRow, getRowHeight, onColumnSorted, onRowHeightChange, onRowHovered, onRowExpanded, onRowsRendered, onScroll, onVerticalScroll } = useTable(props);
  45551. expose({
  45552. scrollTo,
  45553. scrollToLeft,
  45554. scrollToTop,
  45555. scrollToRow
  45556. });
  45557. provide(TableV2InjectionKey, {
  45558. ns,
  45559. isResetting,
  45560. isScrolling
  45561. });
  45562. return () => {
  45563. const { cache, cellProps, estimatedRowHeight, expandColumnKey, fixedData, headerHeight, headerClass, headerProps, headerCellProps, sortBy, sortState, rowHeight, rowClass, rowEventHandlers, rowKey, rowProps, scrollbarAlwaysOn, indentSize, iconSize, useIsScrolling, vScrollbarSize, width } = props;
  45564. const _data = unref(data);
  45565. const mainTableProps = {
  45566. cache,
  45567. class: ns.e("main"),
  45568. columns: unref(mainColumns),
  45569. data: _data,
  45570. fixedData,
  45571. estimatedRowHeight,
  45572. bodyWidth: unref(bodyWidth),
  45573. headerHeight,
  45574. headerWidth: unref(bodyWidth),
  45575. height: unref(mainTableHeight),
  45576. mainTableRef,
  45577. rowKey,
  45578. rowHeight,
  45579. scrollbarAlwaysOn,
  45580. scrollbarStartGap: 2,
  45581. scrollbarEndGap: vScrollbarSize,
  45582. useIsScrolling,
  45583. width,
  45584. getRowHeight,
  45585. onRowsRendered,
  45586. onScroll
  45587. };
  45588. const leftColumnsWidth = unref(leftTableWidth);
  45589. const _fixedTableHeight = unref(fixedTableHeight);
  45590. const leftTableProps = {
  45591. cache,
  45592. class: ns.e("left"),
  45593. columns: unref(fixedColumnsOnLeft),
  45594. data: _data,
  45595. fixedData,
  45596. estimatedRowHeight,
  45597. leftTableRef,
  45598. rowHeight,
  45599. bodyWidth: leftColumnsWidth,
  45600. headerWidth: leftColumnsWidth,
  45601. headerHeight,
  45602. height: _fixedTableHeight,
  45603. rowKey,
  45604. scrollbarAlwaysOn,
  45605. scrollbarStartGap: 2,
  45606. scrollbarEndGap: vScrollbarSize,
  45607. useIsScrolling,
  45608. width: leftColumnsWidth,
  45609. getRowHeight,
  45610. onScroll: onVerticalScroll
  45611. };
  45612. const rightColumnsWidth = unref(rightTableWidth);
  45613. const rightTableProps = {
  45614. cache,
  45615. class: ns.e("right"),
  45616. columns: unref(fixedColumnsOnRight),
  45617. data: _data,
  45618. fixedData,
  45619. estimatedRowHeight,
  45620. rightTableRef,
  45621. rowHeight,
  45622. bodyWidth: rightColumnsWidth,
  45623. headerWidth: rightColumnsWidth,
  45624. headerHeight,
  45625. height: _fixedTableHeight,
  45626. rowKey,
  45627. scrollbarAlwaysOn,
  45628. scrollbarStartGap: 2,
  45629. scrollbarEndGap: vScrollbarSize,
  45630. width: rightColumnsWidth,
  45631. style: `${ns.cssVarName("table-scrollbar-size")}: ${vScrollbarSize}px`,
  45632. useIsScrolling,
  45633. getRowHeight,
  45634. onScroll: onVerticalScroll
  45635. };
  45636. const _columnsStyles = unref(columnsStyles);
  45637. const tableRowProps = {
  45638. ns,
  45639. depthMap: unref(depthMap),
  45640. columnsStyles: _columnsStyles,
  45641. expandColumnKey,
  45642. expandedRowKeys: unref(expandedRowKeys),
  45643. estimatedRowHeight,
  45644. hasFixedColumns: unref(hasFixedColumns),
  45645. rowProps,
  45646. rowClass,
  45647. rowKey,
  45648. rowEventHandlers,
  45649. onRowHovered,
  45650. onRowExpanded,
  45651. onRowHeightChange
  45652. };
  45653. const tableCellProps = {
  45654. cellProps,
  45655. expandColumnKey,
  45656. indentSize,
  45657. iconSize,
  45658. rowKey,
  45659. expandedRowKeys: unref(expandedRowKeys),
  45660. ns,
  45661. t
  45662. };
  45663. const tableHeaderProps = {
  45664. ns,
  45665. headerClass,
  45666. headerProps,
  45667. columnsStyles: _columnsStyles
  45668. };
  45669. const tableHeaderCellProps = {
  45670. ns,
  45671. t,
  45672. sortBy,
  45673. sortState,
  45674. headerCellProps,
  45675. onColumnSorted
  45676. };
  45677. const tableSlots = {
  45678. row: (props) => createVNode(RowRenderer, mergeProps(props, tableRowProps), {
  45679. row: slots.row,
  45680. cell: (props) => {
  45681. let _slot;
  45682. return slots.cell ? createVNode(CellRenderer, mergeProps(props, tableCellProps, { "style": _columnsStyles[props.column.key] }), _isSlot(_slot = slots.cell(props)) ? _slot : { default: () => [_slot] }) : createVNode(CellRenderer, mergeProps(props, tableCellProps, { "style": _columnsStyles[props.column.key] }), null);
  45683. }
  45684. }),
  45685. header: (props) => createVNode(HeaderRenderer, mergeProps(props, tableHeaderProps), {
  45686. header: slots.header,
  45687. cell: (props) => {
  45688. let _slot2;
  45689. return slots["header-cell"] ? createVNode(HeaderCellRenderer, mergeProps(props, tableHeaderCellProps, { "style": _columnsStyles[props.column.key] }), _isSlot(_slot2 = slots["header-cell"](props)) ? _slot2 : { default: () => [_slot2] }) : createVNode(HeaderCellRenderer, mergeProps(props, tableHeaderCellProps, { "style": _columnsStyles[props.column.key] }), null);
  45690. }
  45691. })
  45692. };
  45693. const rootKls = [
  45694. props.class,
  45695. ns.b(),
  45696. ns.e("root"),
  45697. ns.is("dynamic", unref(isDynamic))
  45698. ];
  45699. const footerProps = {
  45700. class: ns.e("footer"),
  45701. style: unref(footerHeight)
  45702. };
  45703. return createVNode("div", {
  45704. "class": rootKls,
  45705. "style": unref(rootStyle)
  45706. }, [
  45707. createVNode(MainTable, mainTableProps, _isSlot(tableSlots) ? tableSlots : { default: () => [tableSlots] }),
  45708. createVNode(LeftTable, leftTableProps, _isSlot(tableSlots) ? tableSlots : { default: () => [tableSlots] }),
  45709. createVNode(RightTable, rightTableProps, _isSlot(tableSlots) ? tableSlots : { default: () => [tableSlots] }),
  45710. slots.footer && createVNode(Footer$1, footerProps, { default: slots.footer }),
  45711. unref(showEmpty) && createVNode(Footer, {
  45712. "class": ns.e("empty"),
  45713. "style": unref(emptyStyle)
  45714. }, { default: slots.empty }),
  45715. slots.overlay && createVNode(Overlay, { "class": ns.e("overlay") }, { default: slots.overlay })
  45716. ]);
  45717. };
  45718. }
  45719. });
  45720. //#endregion
  45721. //#region ../../packages/components/table-v2/src/auto-resizer.ts
  45722. const autoResizerProps = buildProps({
  45723. disableWidth: Boolean,
  45724. disableHeight: Boolean,
  45725. onResize: { type: definePropType(Function) }
  45726. });
  45727. //#endregion
  45728. //#region ../../packages/components/table-v2/src/components/auto-resizer.tsx
  45729. const AutoResizer = /* @__PURE__ */ defineComponent({
  45730. name: "ElAutoResizer",
  45731. props: autoResizerProps,
  45732. setup(props, { slots }) {
  45733. const ns = useNamespace("auto-resizer");
  45734. const { height, width, sizer } = useAutoResize(props);
  45735. const style = {
  45736. width: "100%",
  45737. height: "100%"
  45738. };
  45739. return () => {
  45740. return createVNode("div", {
  45741. "ref": sizer,
  45742. "class": ns.b(),
  45743. "style": style
  45744. }, [slots.default?.({
  45745. height: height.value,
  45746. width: width.value
  45747. })]);
  45748. };
  45749. }
  45750. });
  45751. //#endregion
  45752. //#region ../../packages/components/table-v2/index.ts
  45753. const ElTableV2 = withInstall(TableV2);
  45754. const ElAutoResizer = withInstall(AutoResizer);
  45755. //#endregion
  45756. //#region ../../packages/components/tabs/src/constants.ts
  45757. const tabsRootContextKey = Symbol("tabsRootContextKey");
  45758. //#endregion
  45759. //#region ../../packages/components/tabs/src/tab-bar.ts
  45760. const tabBarProps = buildProps({
  45761. tabs: {
  45762. type: definePropType(Array),
  45763. default: () => mutable([])
  45764. },
  45765. tabRefs: {
  45766. type: definePropType(Object),
  45767. default: () => mutable({})
  45768. }
  45769. });
  45770. //#endregion
  45771. //#region ../../packages/components/tabs/src/tab-bar.vue?vue&type=script&setup=true&lang.ts
  45772. const COMPONENT_NAME$4 = "ElTabBar";
  45773. var tab_bar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  45774. name: COMPONENT_NAME$4,
  45775. __name: "tab-bar",
  45776. props: tabBarProps,
  45777. setup(__props, { expose: __expose }) {
  45778. const props = __props;
  45779. const rootTabs = inject(tabsRootContextKey);
  45780. if (!rootTabs) throwError(COMPONENT_NAME$4, "<el-tabs><el-tab-bar /></el-tabs>");
  45781. const ns = useNamespace("tabs");
  45782. const barRef = ref();
  45783. const barStyle = ref();
  45784. const renderActiveBar = computed(() => isUndefined(rootTabs.props.defaultValue) || Boolean(barStyle.value?.transform));
  45785. const getBarStyle = () => {
  45786. let offset = 0;
  45787. let tabSize = 0;
  45788. const sizeName = ["top", "bottom"].includes(rootTabs.props.tabPosition) ? "width" : "height";
  45789. const sizeDir = sizeName === "width" ? "x" : "y";
  45790. const position = sizeDir === "x" ? "left" : "top";
  45791. props.tabs.every((tab) => {
  45792. if (isUndefined(tab.paneName)) return false;
  45793. const $el = props.tabRefs[tab.paneName];
  45794. if (!$el) return false;
  45795. if (!tab.active) return true;
  45796. offset = $el[`offset${capitalize(position)}`];
  45797. tabSize = $el[`client${capitalize(sizeName)}`];
  45798. const tabStyles = window.getComputedStyle($el);
  45799. if (sizeName === "width") {
  45800. tabSize -= Number.parseFloat(tabStyles.paddingLeft) + Number.parseFloat(tabStyles.paddingRight);
  45801. offset += Number.parseFloat(tabStyles.paddingLeft);
  45802. }
  45803. return false;
  45804. });
  45805. return {
  45806. [sizeName]: `${tabSize}px`,
  45807. transform: `translate${capitalize(sizeDir)}(${offset}px)`
  45808. };
  45809. };
  45810. const update = () => barStyle.value = getBarStyle();
  45811. const tabObservers = [];
  45812. const observerTabs = () => {
  45813. tabObservers.forEach((observer) => observer.stop());
  45814. tabObservers.length = 0;
  45815. Object.values(props.tabRefs).forEach((tab) => {
  45816. tabObservers.push(useResizeObserver(tab, update));
  45817. });
  45818. };
  45819. watch(() => props.tabs, async () => {
  45820. await nextTick();
  45821. update();
  45822. observerTabs();
  45823. }, { immediate: true });
  45824. const barObserver = useResizeObserver(barRef, () => update());
  45825. onBeforeUnmount(() => {
  45826. tabObservers.forEach((observer) => observer.stop());
  45827. tabObservers.length = 0;
  45828. barObserver.stop();
  45829. });
  45830. __expose({
  45831. ref: barRef,
  45832. update
  45833. });
  45834. return (_ctx, _cache) => {
  45835. return renderActiveBar.value ? (openBlock(), createElementBlock("div", {
  45836. key: 0,
  45837. ref_key: "barRef",
  45838. ref: barRef,
  45839. class: normalizeClass([unref(ns).e("active-bar"), unref(ns).is(unref(rootTabs).props.tabPosition)]),
  45840. style: normalizeStyle(barStyle.value)
  45841. }, null, 6)) : createCommentVNode("v-if", true);
  45842. };
  45843. }
  45844. });
  45845. //#endregion
  45846. //#region ../../packages/components/tabs/src/tab-bar.vue
  45847. var tab_bar_default = tab_bar_vue_vue_type_script_setup_true_lang_default;
  45848. //#endregion
  45849. //#region ../../packages/components/tabs/src/composables/use-tab-nav-touch.ts
  45850. const TOUCH_SCROLL_THRESHOLD = 5;
  45851. const useTabNavTouch = ({ scrollable, navOffset, navSize, navContainerSize, isHorizontal }) => {
  45852. const isTouchScrolling = ref(false);
  45853. const maxOffset = computed(() => Math.max(navSize.value - navContainerSize.value, 0));
  45854. let touchState;
  45855. let isMainAxisTouch;
  45856. const handleTouchStart = (event) => {
  45857. if (!scrollable.value || event.touches.length !== 1) return;
  45858. const { clientX, clientY } = getClientXY(event);
  45859. touchState = {
  45860. startX: clientX,
  45861. startY: clientY,
  45862. startOffset: navOffset.value
  45863. };
  45864. isMainAxisTouch = void 0;
  45865. };
  45866. const handleTouchMove = (event) => {
  45867. if (!touchState || !scrollable.value) return;
  45868. if (event.touches.length !== 1) {
  45869. handleTouchEnd();
  45870. return;
  45871. }
  45872. const { clientX, clientY } = getClientXY(event);
  45873. const deltaX = touchState.startX - clientX;
  45874. const deltaY = touchState.startY - clientY;
  45875. const mainAxisDelta = isHorizontal.value ? deltaX : deltaY;
  45876. const crossAxisDelta = isHorizontal.value ? deltaY : deltaX;
  45877. const mainAxisDistance = Math.abs(mainAxisDelta);
  45878. const crossAxisDistance = Math.abs(crossAxisDelta);
  45879. if (isUndefined$1(isMainAxisTouch)) {
  45880. if (Math.max(mainAxisDistance, crossAxisDistance) <= TOUCH_SCROLL_THRESHOLD) return;
  45881. isMainAxisTouch = mainAxisDistance > crossAxisDistance;
  45882. }
  45883. if (!isMainAxisTouch) return;
  45884. const nextOffset = clamp$1(touchState.startOffset + mainAxisDelta, 0, maxOffset.value);
  45885. if (maxOffset.value <= 0 || nextOffset === navOffset.value || !event.cancelable) return;
  45886. event.preventDefault();
  45887. isTouchScrolling.value = true;
  45888. navOffset.value = nextOffset;
  45889. };
  45890. const handleTouchEnd = () => {
  45891. touchState = void 0;
  45892. isMainAxisTouch = void 0;
  45893. isTouchScrolling.value = false;
  45894. };
  45895. return {
  45896. isTouchScrolling,
  45897. handleTouchStart,
  45898. handleTouchMove,
  45899. handleTouchEnd
  45900. };
  45901. };
  45902. //#endregion
  45903. //#region ../../packages/components/tabs/src/tab-nav.tsx
  45904. const tabNavProps = buildProps({
  45905. panes: {
  45906. type: definePropType(Array),
  45907. default: () => mutable([])
  45908. },
  45909. currentName: {
  45910. type: [String, Number],
  45911. default: ""
  45912. },
  45913. editable: Boolean,
  45914. type: {
  45915. type: String,
  45916. values: [
  45917. "card",
  45918. "border-card",
  45919. ""
  45920. ],
  45921. default: ""
  45922. },
  45923. stretch: Boolean,
  45924. tabindex: {
  45925. type: [String, Number],
  45926. default: void 0
  45927. }
  45928. });
  45929. const tabNavEmits = {
  45930. tabClick: (tab, tabName, ev) => ev instanceof Event,
  45931. tabRemove: (tab, ev) => ev instanceof Event
  45932. };
  45933. const COMPONENT_NAME$3 = "ElTabNav";
  45934. const TabNav = /* @__PURE__ */ defineComponent({
  45935. name: COMPONENT_NAME$3,
  45936. props: tabNavProps,
  45937. emits: tabNavEmits,
  45938. setup(props, { expose, emit }) {
  45939. const rootTabs = inject(tabsRootContextKey);
  45940. if (!rootTabs) throwError(COMPONENT_NAME$3, `<el-tabs><tab-nav /></el-tabs>`);
  45941. const ns = useNamespace("tabs");
  45942. const visibility = useDocumentVisibility();
  45943. const focused = useWindowFocus();
  45944. const navScroll$ = ref();
  45945. const nav$ = ref();
  45946. const el$ = ref();
  45947. const tabRefsMap = ref({});
  45948. const tabBarRef = ref();
  45949. const scrollable = ref(false);
  45950. const navOffset = ref(0);
  45951. const isFocus = ref(false);
  45952. const focusable = ref(true);
  45953. const isWheelScrolling = ref(false);
  45954. const tracker = shallowRef();
  45955. const isHorizontal = computed(() => ["top", "bottom"].includes(rootTabs.props.tabPosition));
  45956. const sizeName = computed(() => isHorizontal.value ? "width" : "height");
  45957. const navStyle = computed(() => {
  45958. const dir = sizeName.value === "width" ? "X" : "Y";
  45959. return {
  45960. transition: isWheelScrolling.value || isTouchScrolling.value ? "none" : void 0,
  45961. transform: `translate${dir}(-${navOffset.value}px)`
  45962. };
  45963. });
  45964. const { width: navContainerWidth, height: navContainerHeight } = useElementSize(navScroll$);
  45965. const { width: navWidth, height: navHeight } = useElementSize(nav$, {
  45966. width: 0,
  45967. height: 0
  45968. }, { box: "border-box" });
  45969. const navContainerSize = computed(() => isHorizontal.value ? navContainerWidth.value : navContainerHeight.value);
  45970. const navSize = computed(() => isHorizontal.value ? navWidth.value : navHeight.value);
  45971. const { onWheel } = useWheel({
  45972. atStartEdge: computed(() => navOffset.value <= 0),
  45973. atEndEdge: computed(() => navSize.value - navOffset.value <= navContainerSize.value),
  45974. layout: computed(() => isHorizontal.value ? "horizontal" : "vertical")
  45975. }, (offset) => {
  45976. navOffset.value = clamp$1(navOffset.value + offset, 0, navSize.value - navContainerSize.value);
  45977. });
  45978. const handleWheel = (event) => {
  45979. isWheelScrolling.value = true;
  45980. onWheel(event);
  45981. rAF(() => {
  45982. isWheelScrolling.value = false;
  45983. });
  45984. };
  45985. const { isTouchScrolling, handleTouchStart, handleTouchMove, handleTouchEnd } = useTabNavTouch({
  45986. scrollable,
  45987. navOffset,
  45988. navSize,
  45989. navContainerSize,
  45990. isHorizontal
  45991. });
  45992. const scrollPrev = () => {
  45993. if (!navScroll$.value) return;
  45994. const containerSize = navScroll$.value.getBoundingClientRect()[sizeName.value];
  45995. const currentOffset = navOffset.value;
  45996. if (!currentOffset) return;
  45997. navOffset.value = currentOffset > containerSize ? currentOffset - containerSize : 0;
  45998. };
  45999. const scrollNext = () => {
  46000. if (!navScroll$.value || !nav$.value) return;
  46001. const navSize = nav$.value.getBoundingClientRect()[sizeName.value];
  46002. const containerSize = navScroll$.value.getBoundingClientRect()[sizeName.value];
  46003. const currentOffset = navOffset.value;
  46004. if (!isGreaterThan(navSize - currentOffset, containerSize)) return;
  46005. navOffset.value = navSize - currentOffset > containerSize * 2 ? currentOffset + containerSize : navSize - containerSize;
  46006. };
  46007. const scrollToActiveTab = async () => {
  46008. const nav = nav$.value;
  46009. if (!scrollable.value || !el$.value || !navScroll$.value || !nav) return;
  46010. await nextTick();
  46011. const activeTab = tabRefsMap.value[props.currentName];
  46012. if (!activeTab) return;
  46013. const navScroll = navScroll$.value;
  46014. const activeTabBounding = activeTab.getBoundingClientRect();
  46015. const navScrollBounding = navScroll.getBoundingClientRect();
  46016. const navScrollLeft = navScrollBounding.left + 1;
  46017. const navScrollRight = navScrollBounding.right - 1;
  46018. const navBounding = nav.getBoundingClientRect();
  46019. const maxOffset = isHorizontal.value ? navBounding.width - navScrollBounding.width : navBounding.height - navScrollBounding.height;
  46020. const currentOffset = navOffset.value;
  46021. let newOffset = currentOffset;
  46022. if (isHorizontal.value) {
  46023. if (activeTabBounding.left < navScrollLeft) newOffset = currentOffset - (navScrollLeft - activeTabBounding.left);
  46024. if (activeTabBounding.right > navScrollRight) newOffset = currentOffset + activeTabBounding.right - navScrollRight;
  46025. } else {
  46026. if (activeTabBounding.top < navScrollBounding.top) newOffset = currentOffset - (navScrollBounding.top - activeTabBounding.top);
  46027. if (activeTabBounding.bottom > navScrollBounding.bottom) newOffset = currentOffset + (activeTabBounding.bottom - navScrollBounding.bottom);
  46028. }
  46029. newOffset = Math.max(newOffset, 0);
  46030. navOffset.value = Math.min(newOffset, maxOffset);
  46031. };
  46032. const update = () => {
  46033. if (!nav$.value || !navScroll$.value) return;
  46034. props.stretch && tabBarRef.value?.update();
  46035. const navSize = nav$.value.getBoundingClientRect()[sizeName.value];
  46036. const containerSize = navScroll$.value.getBoundingClientRect()[sizeName.value];
  46037. const currentOffset = navOffset.value;
  46038. if (containerSize < navSize) {
  46039. scrollable.value = scrollable.value || {};
  46040. scrollable.value.prev = currentOffset;
  46041. scrollable.value.next = isGreaterThan(navSize, currentOffset + containerSize);
  46042. if (isGreaterThan(containerSize, navSize - currentOffset)) navOffset.value = navSize - containerSize;
  46043. } else {
  46044. scrollable.value = false;
  46045. if (currentOffset > 0) navOffset.value = 0;
  46046. }
  46047. };
  46048. const changeTab = (event) => {
  46049. const code = getEventCode(event);
  46050. let step = 0;
  46051. switch (code) {
  46052. case EVENT_CODE.left:
  46053. case EVENT_CODE.up:
  46054. step = -1;
  46055. break;
  46056. case EVENT_CODE.right:
  46057. case EVENT_CODE.down:
  46058. step = 1;
  46059. break;
  46060. default: return;
  46061. }
  46062. const tabList = Array.from(event.currentTarget.querySelectorAll("[role=tab]:not(.is-disabled)"));
  46063. let nextIndex = tabList.indexOf(event.target) + step;
  46064. if (nextIndex < 0) nextIndex = tabList.length - 1;
  46065. else if (nextIndex >= tabList.length) nextIndex = 0;
  46066. tabList[nextIndex].focus({ preventScroll: true });
  46067. tabList[nextIndex].click();
  46068. setFocus();
  46069. };
  46070. const setFocus = () => {
  46071. if (focusable.value) isFocus.value = true;
  46072. };
  46073. const removeFocus = () => isFocus.value = false;
  46074. const setRefs = (el, key) => {
  46075. tabRefsMap.value[key] = el;
  46076. };
  46077. const focusActiveTab = async () => {
  46078. await nextTick();
  46079. tabRefsMap.value[props.currentName]?.focus({ preventScroll: true });
  46080. };
  46081. watch(visibility, (visibility) => {
  46082. if (visibility === "hidden") focusable.value = false;
  46083. else if (visibility === "visible") setTimeout(() => focusable.value = true, 50);
  46084. });
  46085. watch(focused, (focused) => {
  46086. if (focused) setTimeout(() => focusable.value = true, 50);
  46087. else focusable.value = false;
  46088. });
  46089. useResizeObserver(el$, () => {
  46090. rAF(update);
  46091. });
  46092. onMounted(() => setTimeout(() => scrollToActiveTab(), 0));
  46093. onUpdated(() => update());
  46094. expose({
  46095. scrollToActiveTab,
  46096. removeFocus,
  46097. focusActiveTab,
  46098. tabListRef: nav$,
  46099. tabBarRef,
  46100. scheduleRender: () => triggerRef(tracker)
  46101. });
  46102. return () => {
  46103. const scrollBtn = scrollable.value ? [createVNode("span", {
  46104. "class": [ns.e("nav-prev"), ns.is("disabled", !scrollable.value.prev)],
  46105. "onClick": scrollPrev
  46106. }, [createVNode(ElIcon, null, { default: () => [createVNode(arrow_left_default, null, null)] })]), createVNode("span", {
  46107. "class": [ns.e("nav-next"), ns.is("disabled", !scrollable.value.next)],
  46108. "onClick": scrollNext
  46109. }, [createVNode(ElIcon, null, { default: () => [createVNode(arrow_right_default, null, null)] })])] : null;
  46110. const tabs = props.panes.map((pane, index) => {
  46111. const uid = pane.uid;
  46112. const disabled = pane.props.disabled;
  46113. const tabName = pane.props.name ?? pane.index ?? `${index}`;
  46114. const closable = !disabled && (pane.isClosable || pane.props.closable !== false && props.editable);
  46115. pane.index = `${index}`;
  46116. const btnClose = closable ? createVNode(ElIcon, {
  46117. "class": "is-icon-close",
  46118. "onClick": (ev) => emit("tabRemove", pane, ev)
  46119. }, { default: () => [createVNode(close_default, null, null)] }) : null;
  46120. const tabLabelContent = pane.slots.label?.() || pane.props.label;
  46121. const tabindex = !disabled && pane.active ? props.tabindex ?? rootTabs.props.tabindex : -1;
  46122. return createVNode("div", {
  46123. "ref": (el) => setRefs(el, tabName),
  46124. "class": [
  46125. ns.e("item"),
  46126. ns.is(rootTabs.props.tabPosition),
  46127. ns.is("active", pane.active),
  46128. ns.is("disabled", disabled),
  46129. ns.is("closable", closable),
  46130. ns.is("focus", isFocus.value)
  46131. ],
  46132. "id": `tab-${tabName}`,
  46133. "key": `tab-${uid}`,
  46134. "aria-controls": `pane-${tabName}`,
  46135. "role": "tab",
  46136. "aria-selected": pane.active,
  46137. "tabindex": tabindex,
  46138. "onFocus": () => setFocus(),
  46139. "onBlur": () => removeFocus(),
  46140. "onClick": (ev) => {
  46141. removeFocus();
  46142. emit("tabClick", pane, tabName, ev);
  46143. },
  46144. "onKeydown": (ev) => {
  46145. const code = getEventCode(ev);
  46146. if (closable && (code === EVENT_CODE.delete || code === EVENT_CODE.backspace)) emit("tabRemove", pane, ev);
  46147. }
  46148. }, [...[tabLabelContent, btnClose]]);
  46149. });
  46150. tracker.value;
  46151. return createVNode("div", {
  46152. "ref": el$,
  46153. "class": [
  46154. ns.e("nav-wrap"),
  46155. ns.is("scrollable", !!scrollable.value),
  46156. ns.is(rootTabs.props.tabPosition)
  46157. ]
  46158. }, [scrollBtn, createVNode("div", {
  46159. "class": ns.e("nav-scroll"),
  46160. "ref": navScroll$
  46161. }, [props.panes.length > 0 ? createVNode("div", {
  46162. "class": [
  46163. ns.e("nav"),
  46164. ns.is(rootTabs.props.tabPosition),
  46165. ns.is("stretch", props.stretch && ["top", "bottom"].includes(rootTabs.props.tabPosition))
  46166. ],
  46167. "ref": nav$,
  46168. "style": navStyle.value,
  46169. "role": "tablist",
  46170. "onKeydown": changeTab,
  46171. "onWheel": handleWheel,
  46172. "onTouchstart": handleTouchStart,
  46173. "onTouchmove": handleTouchMove,
  46174. "onTouchend": handleTouchEnd,
  46175. "onTouchcancel": handleTouchEnd
  46176. }, [...[!props.type ? createVNode(tab_bar_default, {
  46177. "ref": tabBarRef,
  46178. "tabs": [...props.panes],
  46179. "tabRefs": tabRefsMap.value
  46180. }, null) : null, tabs]]) : null])]);
  46181. };
  46182. }
  46183. });
  46184. //#endregion
  46185. //#region ../../packages/components/tabs/src/tabs.tsx
  46186. const tabsProps = buildProps({
  46187. type: {
  46188. type: String,
  46189. values: [
  46190. "card",
  46191. "border-card",
  46192. ""
  46193. ],
  46194. default: ""
  46195. },
  46196. closable: Boolean,
  46197. addable: Boolean,
  46198. modelValue: { type: [String, Number] },
  46199. defaultValue: { type: [String, Number] },
  46200. editable: Boolean,
  46201. tabPosition: {
  46202. type: String,
  46203. values: [
  46204. "top",
  46205. "right",
  46206. "bottom",
  46207. "left"
  46208. ],
  46209. default: "top"
  46210. },
  46211. beforeLeave: {
  46212. type: definePropType(Function),
  46213. default: () => true
  46214. },
  46215. stretch: Boolean,
  46216. tabindex: {
  46217. type: [String, Number],
  46218. default: 0
  46219. }
  46220. });
  46221. const isPaneName = (value) => isString(value) || isNumber(value);
  46222. const tabsEmits = {
  46223. [UPDATE_MODEL_EVENT]: (name) => isPaneName(name),
  46224. tabClick: (pane, ev) => ev instanceof Event,
  46225. tabChange: (name) => isPaneName(name),
  46226. edit: (paneName, action) => ["remove", "add"].includes(action),
  46227. tabRemove: (name) => isPaneName(name),
  46228. tabAdd: () => true
  46229. };
  46230. const Tabs = /* @__PURE__ */ defineComponent({
  46231. name: "ElTabs",
  46232. props: tabsProps,
  46233. emits: tabsEmits,
  46234. setup(props, { emit, slots, expose }) {
  46235. const ns = useNamespace("tabs");
  46236. const isVertical = computed(() => ["left", "right"].includes(props.tabPosition));
  46237. const { children: panes, addChild: registerPane, removeChild: unregisterPane, ChildrenSorter: PanesSorter } = useOrderedChildren(getCurrentInstance(), "ElTabPane");
  46238. const nav$ = ref();
  46239. const currentName = ref((isUndefined(props.modelValue) ? props.defaultValue : props.modelValue) ?? "0");
  46240. const setCurrentName = async (value, trigger = false) => {
  46241. if (currentName.value === value || isUndefined(value)) return;
  46242. try {
  46243. let canLeave;
  46244. if (props.beforeLeave) {
  46245. const result = props.beforeLeave(value, currentName.value);
  46246. canLeave = result instanceof Promise ? await result : result;
  46247. } else canLeave = true;
  46248. if (canLeave !== false) {
  46249. const isFocusInsidePane = panes.value.find((item) => item.paneName === currentName.value)?.isFocusInsidePane();
  46250. currentName.value = value;
  46251. if (trigger) {
  46252. emit(UPDATE_MODEL_EVENT, value);
  46253. emit("tabChange", value);
  46254. }
  46255. nav$.value?.removeFocus?.();
  46256. if (isFocusInsidePane) nav$.value?.focusActiveTab();
  46257. }
  46258. } catch {}
  46259. };
  46260. const handleTabClick = (tab, tabName, event) => {
  46261. if (tab.props.disabled) return;
  46262. emit("tabClick", tab, event);
  46263. setCurrentName(tabName, true);
  46264. };
  46265. const handleTabRemove = (pane, ev) => {
  46266. if (pane.props.disabled || isUndefined(pane.props.name)) return;
  46267. ev.stopPropagation();
  46268. emit("edit", pane.props.name, "remove");
  46269. emit("tabRemove", pane.props.name);
  46270. };
  46271. const handleTabAdd = () => {
  46272. emit("edit", void 0, "add");
  46273. emit("tabAdd");
  46274. };
  46275. const handleKeydown = (event) => {
  46276. const code = getEventCode(event);
  46277. if ([EVENT_CODE.enter, EVENT_CODE.numpadEnter].includes(code)) handleTabAdd();
  46278. };
  46279. const swapChildren = (vnode) => {
  46280. const actualFirstChild = vnode.el.firstChild;
  46281. const firstChild = ["bottom", "right"].includes(props.tabPosition) ? vnode.children[0].el : vnode.children[1].el;
  46282. if (actualFirstChild !== firstChild) actualFirstChild.before(firstChild);
  46283. };
  46284. watch(() => props.modelValue, (modelValue) => setCurrentName(modelValue));
  46285. watch(currentName, async () => {
  46286. await nextTick();
  46287. nav$.value?.scrollToActiveTab();
  46288. });
  46289. provide(tabsRootContextKey, {
  46290. props,
  46291. currentName,
  46292. registerPane,
  46293. unregisterPane,
  46294. nav$
  46295. });
  46296. expose({
  46297. currentName,
  46298. get tabNavRef() {
  46299. return omit(nav$.value, ["scheduleRender"]);
  46300. }
  46301. });
  46302. return () => {
  46303. const addSlot = slots["add-icon"];
  46304. const newButton = props.editable || props.addable ? createVNode("div", {
  46305. "class": [ns.e("new-tab"), isVertical.value && ns.e("new-tab-vertical")],
  46306. "tabindex": props.tabindex,
  46307. "onClick": handleTabAdd,
  46308. "onKeydown": handleKeydown
  46309. }, [addSlot ? renderSlot(slots, "add-icon") : createVNode(ElIcon, { "class": ns.is("icon-plus") }, { default: () => [createVNode(plus_default, null, null)] })]) : null;
  46310. const tabNav = () => createVNode(TabNav, {
  46311. "ref": nav$,
  46312. "currentName": currentName.value,
  46313. "editable": props.editable,
  46314. "type": props.type,
  46315. "panes": panes.value,
  46316. "stretch": props.stretch,
  46317. "onTabClick": handleTabClick,
  46318. "onTabRemove": handleTabRemove
  46319. }, null);
  46320. const header = createVNode("div", { "class": [
  46321. ns.e("header"),
  46322. isVertical.value && ns.e("header-vertical"),
  46323. ns.is(props.tabPosition)
  46324. ] }, [createVNode(PanesSorter, null, {
  46325. default: tabNav,
  46326. $stable: true
  46327. }), newButton]);
  46328. const panels = createVNode("div", { "class": ns.e("content") }, [renderSlot(slots, "default")]);
  46329. return createVNode("div", {
  46330. "class": [
  46331. ns.b(),
  46332. ns.m(props.tabPosition),
  46333. {
  46334. [ns.m("card")]: props.type === "card",
  46335. [ns.m("border-card")]: props.type === "border-card"
  46336. }
  46337. ],
  46338. "onVnodeMounted": swapChildren,
  46339. "onVnodeUpdated": swapChildren
  46340. }, [panels, header]);
  46341. };
  46342. }
  46343. });
  46344. //#endregion
  46345. //#region ../../packages/components/tabs/src/tab-pane.ts
  46346. const tabPaneProps = buildProps({
  46347. label: {
  46348. type: String,
  46349. default: ""
  46350. },
  46351. name: { type: [String, Number] },
  46352. closable: {
  46353. type: Boolean,
  46354. default: void 0
  46355. },
  46356. disabled: Boolean,
  46357. lazy: Boolean
  46358. });
  46359. //#endregion
  46360. //#region ../../packages/components/tabs/src/tab-pane.vue?vue&type=script&setup=true&lang.ts
  46361. const _hoisted_1$14 = [
  46362. "id",
  46363. "aria-hidden",
  46364. "aria-labelledby"
  46365. ];
  46366. const COMPONENT_NAME$2 = "ElTabPane";
  46367. var tab_pane_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  46368. name: COMPONENT_NAME$2,
  46369. __name: "tab-pane",
  46370. props: tabPaneProps,
  46371. setup(__props) {
  46372. const props = __props;
  46373. const instance = getCurrentInstance();
  46374. const slots = useSlots();
  46375. const tabsRoot = inject(tabsRootContextKey);
  46376. if (!tabsRoot) throwError(COMPONENT_NAME$2, "usage: <el-tabs><el-tab-pane /></el-tabs/>");
  46377. const ns = useNamespace("tab-pane");
  46378. const paneRef = ref();
  46379. const index = ref();
  46380. const isClosable = computed(() => props.closable ?? tabsRoot.props.closable);
  46381. const active = computed(() => tabsRoot.currentName.value === (props.name ?? index.value));
  46382. const loaded = ref(active.value);
  46383. const paneName = computed(() => props.name ?? index.value);
  46384. const shouldBeRender = computed(() => !props.lazy || loaded.value || active.value);
  46385. const isFocusInsidePane = () => {
  46386. return paneRef.value?.contains(document.activeElement);
  46387. };
  46388. watch(active, (val) => {
  46389. if (val) loaded.value = true;
  46390. });
  46391. const pane = reactive({
  46392. uid: instance.uid,
  46393. getVnode: () => instance.vnode,
  46394. slots,
  46395. props,
  46396. paneName,
  46397. active,
  46398. index,
  46399. isClosable,
  46400. isFocusInsidePane
  46401. });
  46402. tabsRoot.registerPane(pane);
  46403. onBeforeUnmount(() => {
  46404. tabsRoot.unregisterPane(pane);
  46405. });
  46406. onBeforeUpdate(() => {
  46407. if (slots.label) tabsRoot.nav$.value?.scheduleRender();
  46408. });
  46409. return (_ctx, _cache) => {
  46410. return shouldBeRender.value ? withDirectives((openBlock(), createElementBlock("div", {
  46411. key: 0,
  46412. id: `pane-${paneName.value}`,
  46413. ref_key: "paneRef",
  46414. ref: paneRef,
  46415. class: normalizeClass(unref(ns).b()),
  46416. role: "tabpanel",
  46417. "aria-hidden": !active.value,
  46418. "aria-labelledby": `tab-${paneName.value}`
  46419. }, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$14)), [[vShow, active.value]]) : createCommentVNode("v-if", true);
  46420. };
  46421. }
  46422. });
  46423. //#endregion
  46424. //#region ../../packages/components/tabs/src/tab-pane.vue
  46425. var tab_pane_default = tab_pane_vue_vue_type_script_setup_true_lang_default;
  46426. //#endregion
  46427. //#region ../../packages/components/tabs/index.ts
  46428. const ElTabs = withInstall(Tabs, { TabPane: tab_pane_default });
  46429. const ElTabPane = withNoopInstall(tab_pane_default);
  46430. //#endregion
  46431. //#region ../../packages/components/text/src/text.ts
  46432. const textProps = buildProps({
  46433. type: {
  46434. type: String,
  46435. values: [
  46436. "primary",
  46437. "success",
  46438. "info",
  46439. "warning",
  46440. "danger",
  46441. ""
  46442. ],
  46443. default: ""
  46444. },
  46445. size: {
  46446. type: String,
  46447. values: componentSizes,
  46448. default: ""
  46449. },
  46450. truncated: Boolean,
  46451. lineClamp: { type: [String, Number] },
  46452. tag: {
  46453. type: String,
  46454. default: "span"
  46455. }
  46456. });
  46457. //#endregion
  46458. //#region ../../packages/components/text/src/text.vue?vue&type=script&setup=true&lang.ts
  46459. var text_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  46460. name: "ElText",
  46461. __name: "text",
  46462. props: textProps,
  46463. setup(__props) {
  46464. const props = __props;
  46465. const attrs = useAttrs$1();
  46466. const textRef = ref();
  46467. const textSize = useFormSize();
  46468. const ns = useNamespace("text");
  46469. const textKls = computed(() => [
  46470. ns.b(),
  46471. ns.m(props.type),
  46472. ns.m(textSize.value),
  46473. ns.is("truncated", props.truncated),
  46474. ns.is("line-clamp", !isUndefined(props.lineClamp))
  46475. ]);
  46476. const bindTitle = async () => {
  46477. await nextTick();
  46478. if (attrs.title) return;
  46479. let shouldAddTitle = false;
  46480. const text = textRef.value?.textContent || "";
  46481. if (props.truncated) {
  46482. const width = textRef.value?.offsetWidth;
  46483. const scrollWidth = textRef.value?.scrollWidth;
  46484. if (width && scrollWidth && scrollWidth > width) shouldAddTitle = true;
  46485. } else if (!isUndefined(props.lineClamp)) {
  46486. const height = textRef.value?.offsetHeight;
  46487. const scrollHeight = textRef.value?.scrollHeight;
  46488. if (height && scrollHeight && scrollHeight > height) shouldAddTitle = true;
  46489. }
  46490. if (shouldAddTitle) textRef.value?.setAttribute("title", text);
  46491. else textRef.value?.removeAttribute("title");
  46492. };
  46493. onMounted(bindTitle);
  46494. onUpdated(bindTitle);
  46495. return (_ctx, _cache) => {
  46496. return openBlock(), createBlock(resolveDynamicComponent(__props.tag), {
  46497. ref_key: "textRef",
  46498. ref: textRef,
  46499. class: normalizeClass(textKls.value),
  46500. style: normalizeStyle({ "-webkit-line-clamp": __props.lineClamp })
  46501. }, {
  46502. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  46503. _: 3
  46504. }, 8, ["class", "style"]);
  46505. };
  46506. }
  46507. });
  46508. //#endregion
  46509. //#region ../../packages/components/text/src/text.vue
  46510. var text_default = text_vue_vue_type_script_setup_true_lang_default;
  46511. //#endregion
  46512. //#region ../../packages/components/text/index.ts
  46513. const ElText = withInstall(text_default);
  46514. //#endregion
  46515. //#region ../../packages/components/time-select/src/time-select.ts
  46516. const DEFAULT_START = "09:00";
  46517. const DEFAULT_END = "18:00";
  46518. const DEFAULT_STEP = "00:30";
  46519. const timeSelectProps = buildProps({
  46520. format: {
  46521. type: String,
  46522. default: "HH:mm"
  46523. },
  46524. modelValue: { type: definePropType(String) },
  46525. disabled: {
  46526. type: Boolean,
  46527. default: void 0
  46528. },
  46529. editable: {
  46530. type: Boolean,
  46531. default: true
  46532. },
  46533. effect: {
  46534. type: definePropType(String),
  46535. default: "light"
  46536. },
  46537. clearable: {
  46538. type: Boolean,
  46539. default: true
  46540. },
  46541. size: useSizeProp,
  46542. placeholder: String,
  46543. start: {
  46544. type: String,
  46545. default: DEFAULT_START
  46546. },
  46547. end: {
  46548. type: String,
  46549. default: DEFAULT_END
  46550. },
  46551. step: {
  46552. type: String,
  46553. default: DEFAULT_STEP
  46554. },
  46555. minTime: { type: definePropType(String) },
  46556. maxTime: { type: definePropType(String) },
  46557. includeEndTime: Boolean,
  46558. name: String,
  46559. prefixIcon: {
  46560. type: definePropType([String, Object]),
  46561. default: () => clock_default
  46562. },
  46563. clearIcon: {
  46564. type: definePropType([String, Object]),
  46565. default: () => circle_close_default
  46566. },
  46567. popperClass: {
  46568. type: String,
  46569. default: ""
  46570. },
  46571. popperStyle: { type: definePropType([String, Object]) },
  46572. ...useEmptyValuesProps
  46573. });
  46574. //#endregion
  46575. //#region ../../packages/components/time-select/src/utils.ts
  46576. const parseTime = (time) => {
  46577. const values = (time || "").split(":");
  46578. if (values.length >= 2) {
  46579. let hours = Number.parseInt(values[0], 10);
  46580. const minutes = Number.parseInt(values[1], 10);
  46581. if (Number.isNaN(hours) || Number.isNaN(minutes)) return null;
  46582. const timeUpper = time.toUpperCase();
  46583. if (timeUpper.includes("AM") && hours === 12) hours = 0;
  46584. else if (timeUpper.includes("PM") && hours !== 12) hours += 12;
  46585. return {
  46586. hours,
  46587. minutes
  46588. };
  46589. }
  46590. return null;
  46591. };
  46592. const isValidTime = (time) => !!time && time.hours >= 0 && time.minutes >= 0 && !Number.isNaN(time.hours) && !Number.isNaN(time.minutes);
  46593. const compareTime = (time1, time2) => {
  46594. const value1 = parseTime(time1);
  46595. if (!value1) return -1;
  46596. const value2 = parseTime(time2);
  46597. if (!value2) return -1;
  46598. const minutes1 = value1.minutes + value1.hours * 60;
  46599. const minutes2 = value2.minutes + value2.hours * 60;
  46600. if (minutes1 === minutes2) return 0;
  46601. return minutes1 > minutes2 ? 1 : -1;
  46602. };
  46603. const padTime = (time) => {
  46604. return `${time}`.padStart(2, "0");
  46605. };
  46606. const formatTime = (time) => {
  46607. return `${padTime(time.hours)}:${padTime(time.minutes)}`;
  46608. };
  46609. const nextTime = (time, step) => {
  46610. const timeValue = parseTime(time);
  46611. if (!timeValue) return "";
  46612. const stepValue = parseTime(step);
  46613. if (!stepValue) return "";
  46614. const next = {
  46615. hours: timeValue.hours,
  46616. minutes: timeValue.minutes
  46617. };
  46618. next.minutes += stepValue.minutes;
  46619. next.hours += stepValue.hours;
  46620. next.hours += Math.floor(next.minutes / 60);
  46621. next.minutes = next.minutes % 60;
  46622. return formatTime(next);
  46623. };
  46624. //#endregion
  46625. //#region ../../packages/components/time-select/src/time-select.vue?vue&type=script&setup=true&lang.ts
  46626. var time_select_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  46627. name: "ElTimeSelect",
  46628. __name: "time-select",
  46629. props: timeSelectProps,
  46630. emits: [
  46631. CHANGE_EVENT,
  46632. "blur",
  46633. "focus",
  46634. "clear",
  46635. UPDATE_MODEL_EVENT
  46636. ],
  46637. setup(__props, { expose: __expose }) {
  46638. import_dayjs_min.default.extend(import_customParseFormat.default);
  46639. const { Option: ElOption } = ElSelect;
  46640. const props = __props;
  46641. const nsInput = useNamespace("input");
  46642. const select = ref();
  46643. const _disabled = useFormDisabled();
  46644. const { lang } = useLocale();
  46645. const getValidTimeOrDefault = (value, propName, defaultValue, allowZero = true) => {
  46646. const time = parseTime(value);
  46647. if (!isValidTime(time) || !allowZero && time.hours === 0 && time.minutes === 0) {
  46648. /* @__PURE__ */ debugWarn("ElTimeSelect", `invalid ${propName}, fallback to default ${propName} (${defaultValue}).`);
  46649. return defaultValue;
  46650. }
  46651. return formatTime(time);
  46652. };
  46653. const value = computed(() => props.modelValue);
  46654. const start = computed(() => getValidTimeOrDefault(props.start, "start", DEFAULT_START));
  46655. const end = computed(() => getValidTimeOrDefault(props.end, "end", DEFAULT_END));
  46656. const minTime = computed(() => {
  46657. const time = parseTime(props.minTime || "");
  46658. return time ? formatTime(time) : null;
  46659. });
  46660. const maxTime = computed(() => {
  46661. const time = parseTime(props.maxTime || "");
  46662. return time ? formatTime(time) : null;
  46663. });
  46664. const step = computed(() => getValidTimeOrDefault(props.step, "step", DEFAULT_STEP, false));
  46665. const items = computed(() => {
  46666. const result = [];
  46667. const push = (formattedValue, rawValue) => {
  46668. result.push({
  46669. value: formattedValue,
  46670. rawValue,
  46671. disabled: compareTime(rawValue, minTime.value || "-1:-1") <= 0 || compareTime(rawValue, maxTime.value || "100:100") >= 0
  46672. });
  46673. };
  46674. let current = start.value;
  46675. while (compareTime(current, end.value) <= 0) {
  46676. push((0, import_dayjs_min.default)(current, "HH:mm").locale(lang.value).format(props.format), current);
  46677. current = nextTime(current, step.value);
  46678. }
  46679. if (props.includeEndTime && result[result.length - 1]?.rawValue !== end.value) push((0, import_dayjs_min.default)(end.value, "HH:mm").locale(lang.value).format(props.format), end.value);
  46680. return result;
  46681. });
  46682. const blur = () => {
  46683. select.value?.blur?.();
  46684. };
  46685. const focus = () => {
  46686. select.value?.focus?.();
  46687. };
  46688. __expose({
  46689. blur,
  46690. focus
  46691. });
  46692. return (_ctx, _cache) => {
  46693. return openBlock(), createBlock(unref(ElSelect), {
  46694. ref_key: "select",
  46695. ref: select,
  46696. name: __props.name,
  46697. "model-value": value.value,
  46698. disabled: unref(_disabled),
  46699. clearable: __props.clearable,
  46700. "clear-icon": __props.clearIcon,
  46701. size: __props.size,
  46702. effect: __props.effect,
  46703. placeholder: __props.placeholder,
  46704. "default-first-option": "",
  46705. filterable: __props.editable,
  46706. "empty-values": __props.emptyValues,
  46707. "value-on-clear": __props.valueOnClear,
  46708. "popper-class": __props.popperClass,
  46709. "popper-style": __props.popperStyle,
  46710. "onUpdate:modelValue": _cache[0] || (_cache[0] = (event) => _ctx.$emit(unref("update:modelValue"), event)),
  46711. onChange: _cache[1] || (_cache[1] = (event) => _ctx.$emit(unref("change"), event)),
  46712. onBlur: _cache[2] || (_cache[2] = (event) => _ctx.$emit("blur", event)),
  46713. onFocus: _cache[3] || (_cache[3] = (event) => _ctx.$emit("focus", event)),
  46714. onClear: _cache[4] || (_cache[4] = () => _ctx.$emit("clear"))
  46715. }, {
  46716. prefix: withCtx(() => [__props.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  46717. key: 0,
  46718. class: normalizeClass(unref(nsInput).e("prefix-icon"))
  46719. }, {
  46720. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.prefixIcon)))]),
  46721. _: 1
  46722. }, 8, ["class"])) : createCommentVNode("v-if", true)]),
  46723. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item) => {
  46724. return openBlock(), createBlock(unref(ElOption), {
  46725. key: item.value,
  46726. label: item.value,
  46727. value: item.value,
  46728. disabled: item.disabled
  46729. }, null, 8, [
  46730. "label",
  46731. "value",
  46732. "disabled"
  46733. ]);
  46734. }), 128))]),
  46735. _: 1
  46736. }, 8, [
  46737. "name",
  46738. "model-value",
  46739. "disabled",
  46740. "clearable",
  46741. "clear-icon",
  46742. "size",
  46743. "effect",
  46744. "placeholder",
  46745. "filterable",
  46746. "empty-values",
  46747. "value-on-clear",
  46748. "popper-class",
  46749. "popper-style"
  46750. ]);
  46751. };
  46752. }
  46753. });
  46754. //#endregion
  46755. //#region ../../packages/components/time-select/src/time-select.vue
  46756. var time_select_default = time_select_vue_vue_type_script_setup_true_lang_default;
  46757. //#endregion
  46758. //#region ../../packages/components/time-select/index.ts
  46759. const ElTimeSelect = withInstall(time_select_default);
  46760. //#endregion
  46761. //#region ../../packages/components/timeline/src/tokens.ts
  46762. const TIMELINE_INJECTION_KEY = "timeline";
  46763. //#endregion
  46764. //#region ../../packages/components/timeline/src/timeline.ts
  46765. const timelineProps = buildProps({
  46766. mode: {
  46767. type: String,
  46768. values: [
  46769. "start",
  46770. "alternate",
  46771. "alternate-reverse",
  46772. "end"
  46773. ],
  46774. default: "start"
  46775. },
  46776. reverse: Boolean
  46777. });
  46778. const Timeline = defineComponent({
  46779. name: "ElTimeline",
  46780. props: timelineProps,
  46781. setup(props, { slots }) {
  46782. const ns = useNamespace("timeline");
  46783. provide(TIMELINE_INJECTION_KEY, {
  46784. props,
  46785. slots
  46786. });
  46787. const timelineKls = computed(() => [ns.b(), ns.is(props.mode)]);
  46788. return () => {
  46789. const children = flattedChildren(slots.default?.() ?? []);
  46790. return h("ul", { class: timelineKls.value }, props.reverse ? children.reverse() : children);
  46791. };
  46792. }
  46793. });
  46794. //#endregion
  46795. //#region ../../packages/components/timeline/src/timeline-item.ts
  46796. const timelineItemProps = buildProps({
  46797. timestamp: {
  46798. type: String,
  46799. default: ""
  46800. },
  46801. hideTimestamp: Boolean,
  46802. center: Boolean,
  46803. placement: {
  46804. type: String,
  46805. values: ["top", "bottom"],
  46806. default: "bottom"
  46807. },
  46808. type: {
  46809. type: String,
  46810. values: [
  46811. "primary",
  46812. "success",
  46813. "warning",
  46814. "danger",
  46815. "info"
  46816. ],
  46817. default: ""
  46818. },
  46819. color: {
  46820. type: String,
  46821. default: ""
  46822. },
  46823. size: {
  46824. type: String,
  46825. values: ["normal", "large"],
  46826. default: "normal"
  46827. },
  46828. icon: { type: iconPropType },
  46829. hollow: Boolean
  46830. });
  46831. //#endregion
  46832. //#region ../../packages/components/timeline/src/timeline-item.vue?vue&type=script&setup=true&lang.ts
  46833. var timeline_item_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  46834. name: "ElTimelineItem",
  46835. __name: "timeline-item",
  46836. props: timelineItemProps,
  46837. setup(__props) {
  46838. const props = __props;
  46839. const { props: timelineProps } = inject(TIMELINE_INJECTION_KEY);
  46840. const ns = useNamespace("timeline-item");
  46841. const defaultNodeKls = computed(() => [
  46842. ns.e("node"),
  46843. ns.em("node", props.size || ""),
  46844. ns.em("node", props.type || ""),
  46845. ns.is("hollow", props.hollow)
  46846. ]);
  46847. const timelineItemKls = computed(() => [
  46848. ns.b(),
  46849. { [ns.e("center")]: props.center },
  46850. ns.is(timelineProps.mode)
  46851. ]);
  46852. return (_ctx, _cache) => {
  46853. return openBlock(), createElementBlock("li", { class: normalizeClass(timelineItemKls.value) }, [
  46854. createElementVNode("div", { class: normalizeClass(unref(ns).e("tail")) }, null, 2),
  46855. !_ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
  46856. key: 0,
  46857. class: normalizeClass(defaultNodeKls.value),
  46858. style: normalizeStyle({ backgroundColor: __props.color })
  46859. }, [__props.icon ? (openBlock(), createBlock(unref(ElIcon), {
  46860. key: 0,
  46861. class: normalizeClass(unref(ns).e("icon"))
  46862. }, {
  46863. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.icon)))]),
  46864. _: 1
  46865. }, 8, ["class"])) : createCommentVNode("v-if", true)], 6)) : createCommentVNode("v-if", true),
  46866. _ctx.$slots.dot ? (openBlock(), createElementBlock("div", {
  46867. key: 1,
  46868. class: normalizeClass(unref(ns).e("dot"))
  46869. }, [renderSlot(_ctx.$slots, "dot")], 2)) : createCommentVNode("v-if", true),
  46870. createElementVNode("div", { class: normalizeClass(unref(ns).e("wrapper")) }, [
  46871. !__props.hideTimestamp && __props.placement === "top" ? (openBlock(), createElementBlock("div", {
  46872. key: 0,
  46873. class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("top")])
  46874. }, toDisplayString(__props.timestamp), 3)) : createCommentVNode("v-if", true),
  46875. createElementVNode("div", { class: normalizeClass(unref(ns).e("content")) }, [renderSlot(_ctx.$slots, "default")], 2),
  46876. !__props.hideTimestamp && __props.placement === "bottom" ? (openBlock(), createElementBlock("div", {
  46877. key: 1,
  46878. class: normalizeClass([unref(ns).e("timestamp"), unref(ns).is("bottom")])
  46879. }, toDisplayString(__props.timestamp), 3)) : createCommentVNode("v-if", true)
  46880. ], 2)
  46881. ], 2);
  46882. };
  46883. }
  46884. });
  46885. //#endregion
  46886. //#region ../../packages/components/timeline/src/timeline-item.vue
  46887. var timeline_item_default = timeline_item_vue_vue_type_script_setup_true_lang_default;
  46888. //#endregion
  46889. //#region ../../packages/components/timeline/index.ts
  46890. const ElTimeline = withInstall(Timeline, { TimelineItem: timeline_item_default });
  46891. const ElTimelineItem = withNoopInstall(timeline_item_default);
  46892. //#endregion
  46893. //#region ../../packages/components/transfer/src/transfer.ts
  46894. const LEFT_CHECK_CHANGE_EVENT = "left-check-change";
  46895. const RIGHT_CHECK_CHANGE_EVENT = "right-check-change";
  46896. const transferProps = buildProps({
  46897. data: {
  46898. type: definePropType(Array),
  46899. default: () => []
  46900. },
  46901. titles: {
  46902. type: definePropType(Array),
  46903. default: () => []
  46904. },
  46905. buttonTexts: {
  46906. type: definePropType(Array),
  46907. default: () => []
  46908. },
  46909. filterPlaceholder: String,
  46910. filterMethod: { type: definePropType(Function) },
  46911. leftDefaultChecked: {
  46912. type: definePropType(Array),
  46913. default: () => []
  46914. },
  46915. rightDefaultChecked: {
  46916. type: definePropType(Array),
  46917. default: () => []
  46918. },
  46919. renderContent: { type: definePropType(Function) },
  46920. modelValue: {
  46921. type: definePropType(Array),
  46922. default: () => []
  46923. },
  46924. format: {
  46925. type: definePropType(Object),
  46926. default: () => ({})
  46927. },
  46928. filterable: Boolean,
  46929. props: {
  46930. type: definePropType(Object),
  46931. default: () => mutable({
  46932. label: "label",
  46933. key: "key",
  46934. disabled: "disabled"
  46935. })
  46936. },
  46937. targetOrder: {
  46938. type: String,
  46939. values: [
  46940. "original",
  46941. "push",
  46942. "unshift"
  46943. ],
  46944. default: "original"
  46945. },
  46946. validateEvent: {
  46947. type: Boolean,
  46948. default: true
  46949. }
  46950. });
  46951. const transferCheckedChangeFn = (value, movedKeys) => [value, movedKeys].every(isArray$1) || isArray$1(value) && isNil(movedKeys);
  46952. const transferEmits = {
  46953. [CHANGE_EVENT]: (value, direction, movedKeys) => [value, movedKeys].every(isArray$1) && ["left", "right"].includes(direction),
  46954. [UPDATE_MODEL_EVENT]: (value) => isArray$1(value),
  46955. [LEFT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn,
  46956. [RIGHT_CHECK_CHANGE_EVENT]: transferCheckedChangeFn
  46957. };
  46958. //#endregion
  46959. //#region ../../packages/components/transfer/src/transfer-panel.ts
  46960. const CHECKED_CHANGE_EVENT = "checked-change";
  46961. const transferPanelProps = buildProps({
  46962. data: transferProps.data,
  46963. optionRender: { type: definePropType(Function) },
  46964. placeholder: String,
  46965. title: String,
  46966. filterable: Boolean,
  46967. format: transferProps.format,
  46968. filterMethod: transferProps.filterMethod,
  46969. defaultChecked: transferProps.leftDefaultChecked,
  46970. props: transferProps.props
  46971. });
  46972. const transferPanelEmits = { [CHECKED_CHANGE_EVENT]: transferCheckedChangeFn };
  46973. //#endregion
  46974. //#region ../../packages/components/transfer/src/composables/use-props-alias.ts
  46975. const usePropsAlias = (props) => {
  46976. const initProps = {
  46977. label: "label",
  46978. key: "key",
  46979. disabled: "disabled"
  46980. };
  46981. return computed(() => ({
  46982. ...initProps,
  46983. ...props.props
  46984. }));
  46985. };
  46986. //#endregion
  46987. //#region ../../packages/components/transfer/src/composables/use-check.ts
  46988. const useCheck$1 = (props, panelState, emit) => {
  46989. const propsAlias = usePropsAlias(props);
  46990. const filteredData = computed(() => {
  46991. return props.data.filter((item) => {
  46992. if (isFunction$1(props.filterMethod)) return props.filterMethod(panelState.query, item);
  46993. else return String(item[propsAlias.value.label] || item[propsAlias.value.key]).toLowerCase().includes(panelState.query.toLowerCase());
  46994. });
  46995. });
  46996. const checkableData = computed(() => filteredData.value.filter((item) => !item[propsAlias.value.disabled]));
  46997. const checkedSummary = computed(() => {
  46998. const checkedLength = panelState.checked.length;
  46999. const dataLength = props.data.length;
  47000. const { noChecked, hasChecked } = props.format;
  47001. if (noChecked && hasChecked) return checkedLength > 0 ? hasChecked.replace(/\${checked}/g, checkedLength.toString()).replace(/\${total}/g, dataLength.toString()) : noChecked.replace(/\${total}/g, dataLength.toString());
  47002. else return `${checkedLength}/${dataLength}`;
  47003. });
  47004. const isIndeterminate = computed(() => {
  47005. const checkedLength = panelState.checked.length;
  47006. return checkedLength > 0 && checkedLength < checkableData.value.length;
  47007. });
  47008. const updateAllChecked = () => {
  47009. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  47010. panelState.allChecked = checkableDataKeys.length > 0 && checkableDataKeys.every((item) => panelState.checked.includes(item));
  47011. };
  47012. const handleAllCheckedChange = (value) => {
  47013. panelState.checked = value ? checkableData.value.map((item) => item[propsAlias.value.key]) : [];
  47014. };
  47015. watch(() => panelState.checked, (val, oldVal) => {
  47016. updateAllChecked();
  47017. if (panelState.checkChangeByUser) emit(CHECKED_CHANGE_EVENT, val, val.concat(oldVal).filter((v) => !val.includes(v) || !oldVal.includes(v)));
  47018. else {
  47019. emit(CHECKED_CHANGE_EVENT, val);
  47020. panelState.checkChangeByUser = true;
  47021. }
  47022. });
  47023. watch(checkableData, () => {
  47024. updateAllChecked();
  47025. });
  47026. watch(() => props.data, () => {
  47027. const checked = [];
  47028. const filteredDataKeys = filteredData.value.map((item) => item[propsAlias.value.key]);
  47029. panelState.checked.forEach((item) => {
  47030. if (filteredDataKeys.includes(item)) checked.push(item);
  47031. });
  47032. panelState.checkChangeByUser = false;
  47033. panelState.checked = checked;
  47034. });
  47035. watch(() => props.defaultChecked, (val, oldVal) => {
  47036. if (oldVal && val.length === oldVal.length && val.every((item) => oldVal.includes(item))) return;
  47037. const checked = [];
  47038. const checkableDataKeys = checkableData.value.map((item) => item[propsAlias.value.key]);
  47039. val.forEach((item) => {
  47040. if (checkableDataKeys.includes(item)) checked.push(item);
  47041. });
  47042. panelState.checkChangeByUser = false;
  47043. panelState.checked = checked;
  47044. }, { immediate: true });
  47045. return {
  47046. filteredData,
  47047. checkableData,
  47048. checkedSummary,
  47049. isIndeterminate,
  47050. updateAllChecked,
  47051. handleAllCheckedChange
  47052. };
  47053. };
  47054. //#endregion
  47055. //#region ../../packages/components/transfer/src/composables/use-checked-change.ts
  47056. const useCheckedChange = (checkedState, emit) => {
  47057. const onSourceCheckedChange = (val, movedKeys) => {
  47058. checkedState.leftChecked = val;
  47059. if (!movedKeys) return;
  47060. emit(LEFT_CHECK_CHANGE_EVENT, val, movedKeys);
  47061. };
  47062. const onTargetCheckedChange = (val, movedKeys) => {
  47063. checkedState.rightChecked = val;
  47064. if (!movedKeys) return;
  47065. emit(RIGHT_CHECK_CHANGE_EVENT, val, movedKeys);
  47066. };
  47067. return {
  47068. onSourceCheckedChange,
  47069. onTargetCheckedChange
  47070. };
  47071. };
  47072. //#endregion
  47073. //#region ../../packages/components/transfer/src/composables/use-computed-data.ts
  47074. const useComputedData = (props) => {
  47075. const propsAlias = usePropsAlias(props);
  47076. const dataObj = computed(() => props.data.reduce((o, cur) => (o[cur[propsAlias.value.key]] = cur, o), {}));
  47077. return {
  47078. sourceData: computed(() => props.data.filter((item) => !props.modelValue.includes(item[propsAlias.value.key]))),
  47079. targetData: computed(() => {
  47080. if (props.targetOrder === "original") return props.data.filter((item) => props.modelValue.includes(item[propsAlias.value.key]));
  47081. else return props.modelValue.reduce((arr, cur) => {
  47082. const val = dataObj.value[cur];
  47083. if (val) arr.push(val);
  47084. return arr;
  47085. }, []);
  47086. })
  47087. };
  47088. };
  47089. //#endregion
  47090. //#region ../../packages/components/transfer/src/composables/use-move.ts
  47091. const useMove = (props, checkedState, emit) => {
  47092. const propsAlias = usePropsAlias(props);
  47093. const _emit = (value, direction, movedKeys) => {
  47094. emit(UPDATE_MODEL_EVENT, value);
  47095. emit(CHANGE_EVENT, value, direction, movedKeys);
  47096. };
  47097. const addToLeft = () => {
  47098. const currentValue = props.modelValue.slice();
  47099. checkedState.rightChecked.forEach((item) => {
  47100. const index = currentValue.indexOf(item);
  47101. if (index > -1) currentValue.splice(index, 1);
  47102. });
  47103. _emit(currentValue, "left", checkedState.rightChecked);
  47104. };
  47105. const addToRight = () => {
  47106. let currentValue = props.modelValue.slice();
  47107. const itemsToBeMoved = props.data.filter((item) => {
  47108. const itemKey = item[propsAlias.value.key];
  47109. return checkedState.leftChecked.includes(itemKey) && !props.modelValue.includes(itemKey);
  47110. }).map((item) => item[propsAlias.value.key]);
  47111. currentValue = props.targetOrder === "unshift" ? itemsToBeMoved.concat(currentValue) : currentValue.concat(itemsToBeMoved);
  47112. if (props.targetOrder === "original") currentValue = props.data.filter((item) => currentValue.includes(item[propsAlias.value.key])).map((item) => item[propsAlias.value.key]);
  47113. _emit(currentValue, "right", checkedState.leftChecked);
  47114. };
  47115. return {
  47116. addToLeft,
  47117. addToRight
  47118. };
  47119. };
  47120. //#endregion
  47121. //#region ../../packages/components/transfer/src/transfer-panel.vue?vue&type=script&setup=true&lang.ts
  47122. var transfer_panel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  47123. name: "ElTransferPanel",
  47124. __name: "transfer-panel",
  47125. props: transferPanelProps,
  47126. emits: transferPanelEmits,
  47127. setup(__props, { expose: __expose, emit: __emit }) {
  47128. const props = __props;
  47129. const emit = __emit;
  47130. const slots = useSlots();
  47131. const OptionContent = ({ option }) => option;
  47132. const { t } = useLocale();
  47133. const ns = useNamespace("transfer");
  47134. const panelState = reactive({
  47135. checked: [],
  47136. allChecked: false,
  47137. query: "",
  47138. checkChangeByUser: true
  47139. });
  47140. const propsAlias = usePropsAlias(props);
  47141. const { filteredData, checkedSummary, isIndeterminate, handleAllCheckedChange } = useCheck$1(props, panelState, emit);
  47142. const hasNoMatch = computed(() => !isEmpty(panelState.query) && isEmpty(filteredData.value));
  47143. const hasFooter = computed(() => !isEmpty(slots.default()[0].children));
  47144. const { checked, allChecked, query } = toRefs(panelState);
  47145. __expose({ query });
  47146. return (_ctx, _cache) => {
  47147. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b("panel")) }, [
  47148. createElementVNode("p", { class: normalizeClass(unref(ns).be("panel", "header")) }, [createVNode(unref(ElCheckbox), {
  47149. modelValue: unref(allChecked),
  47150. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(allChecked) ? allChecked.value = $event : null),
  47151. indeterminate: unref(isIndeterminate),
  47152. "validate-event": false,
  47153. onChange: unref(handleAllCheckedChange)
  47154. }, {
  47155. default: withCtx(() => [createElementVNode("span", { class: normalizeClass(unref(ns).be("panel", "header-title")) }, toDisplayString(__props.title), 3), createElementVNode("span", { class: normalizeClass(unref(ns).be("panel", "header-count")) }, toDisplayString(unref(checkedSummary)), 3)]),
  47156. _: 1
  47157. }, 8, [
  47158. "modelValue",
  47159. "indeterminate",
  47160. "onChange"
  47161. ])], 2),
  47162. createElementVNode("div", { class: normalizeClass([unref(ns).be("panel", "body"), unref(ns).is("with-footer", hasFooter.value)]) }, [
  47163. __props.filterable ? (openBlock(), createBlock(unref(ElInput), {
  47164. key: 0,
  47165. modelValue: unref(query),
  47166. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(query) ? query.value = $event : null),
  47167. class: normalizeClass(unref(ns).be("panel", "filter")),
  47168. size: "default",
  47169. placeholder: __props.placeholder,
  47170. "prefix-icon": unref(search_default),
  47171. clearable: "",
  47172. "validate-event": false
  47173. }, null, 8, [
  47174. "modelValue",
  47175. "class",
  47176. "placeholder",
  47177. "prefix-icon"
  47178. ])) : createCommentVNode("v-if", true),
  47179. withDirectives(createVNode(unref(ElCheckboxGroup), {
  47180. modelValue: unref(checked),
  47181. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(checked) ? checked.value = $event : null),
  47182. "validate-event": false,
  47183. class: normalizeClass([unref(ns).is("filterable", __props.filterable), unref(ns).be("panel", "list")])
  47184. }, {
  47185. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(filteredData), (item) => {
  47186. return openBlock(), createBlock(unref(ElCheckbox), {
  47187. key: item[unref(propsAlias).key],
  47188. class: normalizeClass(unref(ns).be("panel", "item")),
  47189. value: item[unref(propsAlias).key],
  47190. disabled: item[unref(propsAlias).disabled],
  47191. "validate-event": false
  47192. }, {
  47193. default: withCtx(() => [createVNode(OptionContent, { option: __props.optionRender?.(item) }, null, 8, ["option"])]),
  47194. _: 2
  47195. }, 1032, [
  47196. "class",
  47197. "value",
  47198. "disabled"
  47199. ]);
  47200. }), 128))]),
  47201. _: 1
  47202. }, 8, ["modelValue", "class"]), [[vShow, !hasNoMatch.value && !unref(isEmpty)(__props.data)]]),
  47203. withDirectives(createElementVNode("div", { class: normalizeClass(unref(ns).be("panel", "empty")) }, [renderSlot(_ctx.$slots, "empty", {}, () => [createTextVNode(toDisplayString(hasNoMatch.value ? unref(t)("el.transfer.noMatch") : unref(t)("el.transfer.noData")), 1)])], 2), [[vShow, hasNoMatch.value || unref(isEmpty)(__props.data)]])
  47204. ], 2),
  47205. hasFooter.value ? (openBlock(), createElementBlock("p", {
  47206. key: 0,
  47207. class: normalizeClass(unref(ns).be("panel", "footer"))
  47208. }, [renderSlot(_ctx.$slots, "default")], 2)) : createCommentVNode("v-if", true)
  47209. ], 2);
  47210. };
  47211. }
  47212. });
  47213. //#endregion
  47214. //#region ../../packages/components/transfer/src/transfer-panel.vue
  47215. var transfer_panel_default = transfer_panel_vue_vue_type_script_setup_true_lang_default;
  47216. //#endregion
  47217. //#region ../../packages/components/transfer/src/transfer.vue?vue&type=script&setup=true&lang.ts
  47218. const _hoisted_1$13 = { key: 0 };
  47219. const _hoisted_2$8 = { key: 0 };
  47220. var transfer_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  47221. name: "ElTransfer",
  47222. __name: "transfer",
  47223. props: transferProps,
  47224. emits: transferEmits,
  47225. setup(__props, { expose: __expose, emit: __emit }) {
  47226. const props = __props;
  47227. const emit = __emit;
  47228. const slots = useSlots();
  47229. const { t } = useLocale();
  47230. const ns = useNamespace("transfer");
  47231. const { formItem } = useFormItem();
  47232. const checkedState = reactive({
  47233. leftChecked: [],
  47234. rightChecked: []
  47235. });
  47236. const propsAlias = usePropsAlias(props);
  47237. const { sourceData, targetData } = useComputedData(props);
  47238. const { onSourceCheckedChange, onTargetCheckedChange } = useCheckedChange(checkedState, emit);
  47239. const { addToLeft, addToRight } = useMove(props, checkedState, emit);
  47240. const leftPanel = ref();
  47241. const rightPanel = ref();
  47242. const clearQuery = (which) => {
  47243. switch (which) {
  47244. case "left":
  47245. leftPanel.value.query = "";
  47246. break;
  47247. case "right":
  47248. rightPanel.value.query = "";
  47249. break;
  47250. }
  47251. };
  47252. const hasButtonTexts = computed(() => props.buttonTexts.length === 2);
  47253. const leftPanelTitle = computed(() => props.titles[0] || t("el.transfer.titles.0"));
  47254. const rightPanelTitle = computed(() => props.titles[1] || t("el.transfer.titles.1"));
  47255. const panelFilterPlaceholder = computed(() => props.filterPlaceholder || t("el.transfer.filterPlaceholder"));
  47256. watch(() => props.modelValue, () => {
  47257. if (props.validateEvent) formItem?.validate?.("change").catch(NOOP);
  47258. });
  47259. const optionRender = computed(() => (option) => {
  47260. if (props.renderContent) return props.renderContent(h, option);
  47261. const defaultSlotVNodes = (slots.default?.({ option }) || []).filter((node) => node.type !== Comment);
  47262. if (defaultSlotVNodes.length) return defaultSlotVNodes;
  47263. return h("span", option[propsAlias.value.label] || option[propsAlias.value.key]);
  47264. });
  47265. __expose({
  47266. clearQuery,
  47267. leftPanel,
  47268. rightPanel
  47269. });
  47270. return (_ctx, _cache) => {
  47271. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).b()) }, [
  47272. createVNode(transfer_panel_default, {
  47273. ref_key: "leftPanel",
  47274. ref: leftPanel,
  47275. data: unref(sourceData),
  47276. "option-render": optionRender.value,
  47277. placeholder: panelFilterPlaceholder.value,
  47278. title: leftPanelTitle.value,
  47279. filterable: __props.filterable,
  47280. format: __props.format,
  47281. "filter-method": __props.filterMethod,
  47282. "default-checked": __props.leftDefaultChecked,
  47283. props: props.props,
  47284. onCheckedChange: unref(onSourceCheckedChange)
  47285. }, {
  47286. empty: withCtx(() => [renderSlot(_ctx.$slots, "left-empty")]),
  47287. default: withCtx(() => [renderSlot(_ctx.$slots, "left-footer")]),
  47288. _: 3
  47289. }, 8, [
  47290. "data",
  47291. "option-render",
  47292. "placeholder",
  47293. "title",
  47294. "filterable",
  47295. "format",
  47296. "filter-method",
  47297. "default-checked",
  47298. "props",
  47299. "onCheckedChange"
  47300. ]),
  47301. createElementVNode("div", { class: normalizeClass(unref(ns).e("buttons")) }, [createVNode(unref(ElButton), {
  47302. type: "primary",
  47303. class: normalizeClass([unref(ns).e("button"), unref(ns).is("with-texts", hasButtonTexts.value)]),
  47304. disabled: unref(isEmpty)(checkedState.rightChecked),
  47305. onClick: unref(addToLeft)
  47306. }, {
  47307. default: withCtx(() => [createVNode(unref(ElIcon), null, {
  47308. default: withCtx(() => [createVNode(unref(arrow_left_default))]),
  47309. _: 1
  47310. }), !unref(isUndefined)(__props.buttonTexts[0]) ? (openBlock(), createElementBlock("span", _hoisted_1$13, toDisplayString(__props.buttonTexts[0]), 1)) : createCommentVNode("v-if", true)]),
  47311. _: 1
  47312. }, 8, [
  47313. "class",
  47314. "disabled",
  47315. "onClick"
  47316. ]), createVNode(unref(ElButton), {
  47317. type: "primary",
  47318. class: normalizeClass([unref(ns).e("button"), unref(ns).is("with-texts", hasButtonTexts.value)]),
  47319. disabled: unref(isEmpty)(checkedState.leftChecked),
  47320. onClick: unref(addToRight)
  47321. }, {
  47322. default: withCtx(() => [!unref(isUndefined)(__props.buttonTexts[1]) ? (openBlock(), createElementBlock("span", _hoisted_2$8, toDisplayString(__props.buttonTexts[1]), 1)) : createCommentVNode("v-if", true), createVNode(unref(ElIcon), null, {
  47323. default: withCtx(() => [createVNode(unref(arrow_right_default))]),
  47324. _: 1
  47325. })]),
  47326. _: 1
  47327. }, 8, [
  47328. "class",
  47329. "disabled",
  47330. "onClick"
  47331. ])], 2),
  47332. createVNode(transfer_panel_default, {
  47333. ref_key: "rightPanel",
  47334. ref: rightPanel,
  47335. data: unref(targetData),
  47336. "option-render": optionRender.value,
  47337. placeholder: panelFilterPlaceholder.value,
  47338. filterable: __props.filterable,
  47339. format: __props.format,
  47340. "filter-method": __props.filterMethod,
  47341. title: rightPanelTitle.value,
  47342. "default-checked": __props.rightDefaultChecked,
  47343. props: props.props,
  47344. onCheckedChange: unref(onTargetCheckedChange)
  47345. }, {
  47346. empty: withCtx(() => [renderSlot(_ctx.$slots, "right-empty")]),
  47347. default: withCtx(() => [renderSlot(_ctx.$slots, "right-footer")]),
  47348. _: 3
  47349. }, 8, [
  47350. "data",
  47351. "option-render",
  47352. "placeholder",
  47353. "filterable",
  47354. "format",
  47355. "filter-method",
  47356. "title",
  47357. "default-checked",
  47358. "props",
  47359. "onCheckedChange"
  47360. ])
  47361. ], 2);
  47362. };
  47363. }
  47364. });
  47365. //#endregion
  47366. //#region ../../packages/components/transfer/src/transfer.vue
  47367. var transfer_default = transfer_vue_vue_type_script_setup_true_lang_default;
  47368. //#endregion
  47369. //#region ../../packages/components/transfer/index.ts
  47370. const ElTransfer = withInstall(transfer_default);
  47371. //#endregion
  47372. //#region ../../packages/components/tree/src/model/util.ts
  47373. const NODE_KEY = "$treeNodeId";
  47374. const markNodeData = function(node, data) {
  47375. if (!data || data["$treeNodeId"]) return;
  47376. Object.defineProperty(data, NODE_KEY, {
  47377. value: node.id,
  47378. enumerable: false,
  47379. configurable: false,
  47380. writable: false
  47381. });
  47382. };
  47383. const getNodeKey = (key, data) => data?.[key || "$treeNodeId"];
  47384. const handleCurrentChange = (store, emit, setCurrent) => {
  47385. const preCurrentNode = store.value.currentNode;
  47386. setCurrent();
  47387. const currentNode = store.value.currentNode;
  47388. if (preCurrentNode === currentNode) return;
  47389. emit("current-change", currentNode ? currentNode.data : null, currentNode);
  47390. };
  47391. //#endregion
  47392. //#region ../../packages/components/tree/src/model/node.ts
  47393. const getChildState = (node) => {
  47394. let all = true;
  47395. let none = true;
  47396. let allWithoutDisable = true;
  47397. let isEffectivelyChecked = true;
  47398. for (let i = 0, j = node.length; i < j; i++) {
  47399. const n = node[i];
  47400. if (n.checked !== true || n.indeterminate) {
  47401. all = false;
  47402. if (!n.disabled) allWithoutDisable = false;
  47403. }
  47404. if (n.checked !== false || n.indeterminate) none = false;
  47405. if (!n.isEffectivelyChecked) isEffectivelyChecked = false;
  47406. }
  47407. return {
  47408. all,
  47409. none,
  47410. allWithoutDisable,
  47411. half: !all && !none,
  47412. isEffectivelyChecked
  47413. };
  47414. };
  47415. const reInitChecked = function(node) {
  47416. if (node.childNodes.length === 0 || node.loading) {
  47417. node.isEffectivelyChecked = node.disabled || node.checked;
  47418. return;
  47419. }
  47420. const { all, none, half, isEffectivelyChecked } = getChildState(node.childNodes);
  47421. node.isEffectivelyChecked = isEffectivelyChecked;
  47422. if (all) {
  47423. node.checked = true;
  47424. node.indeterminate = false;
  47425. } else if (half) {
  47426. node.checked = false;
  47427. node.indeterminate = true;
  47428. } else if (none) {
  47429. node.checked = false;
  47430. node.indeterminate = false;
  47431. }
  47432. const parent = node.parent;
  47433. if (!parent || parent.level === 0) return;
  47434. if (!node.store.checkStrictly) reInitChecked(parent);
  47435. };
  47436. const getPropertyFromData = function(node, prop) {
  47437. const props = node.store.props;
  47438. const data = node.data || {};
  47439. const config = props[prop];
  47440. if (isFunction$1(config)) return config(data, node);
  47441. else if (isString(config)) return data[config];
  47442. else if (isUndefined(config)) {
  47443. const dataProp = data[prop];
  47444. return isUndefined(dataProp) ? "" : dataProp;
  47445. }
  47446. };
  47447. const setCanFocus = function(childNodes, focus) {
  47448. childNodes.forEach((item) => {
  47449. item.canFocus = focus;
  47450. setCanFocus(item.childNodes, focus);
  47451. });
  47452. };
  47453. let nodeIdSeed = 0;
  47454. var Node$1 = class Node$1 {
  47455. constructor(options) {
  47456. this.isLeafByUser = void 0;
  47457. this.isLeaf = void 0;
  47458. this.isEffectivelyChecked = false;
  47459. this.id = nodeIdSeed++;
  47460. this.text = null;
  47461. this.checked = false;
  47462. this.indeterminate = false;
  47463. this.data = null;
  47464. this.expanded = false;
  47465. this.parent = null;
  47466. this.visible = true;
  47467. this.isCurrent = false;
  47468. this.canFocus = false;
  47469. for (const name in options) if (hasOwn(options, name)) this[name] = options[name];
  47470. this.level = 0;
  47471. this.loaded = false;
  47472. this.childNodes = [];
  47473. this.loading = false;
  47474. if (this.parent) this.level = this.parent.level + 1;
  47475. }
  47476. initialize() {
  47477. const store = this.store;
  47478. if (!store) throw new Error("[Node]store is required!");
  47479. store.registerNode(this);
  47480. const props = store.props;
  47481. if (props && typeof props.isLeaf !== "undefined") {
  47482. const isLeaf = getPropertyFromData(this, "isLeaf");
  47483. if (isBoolean(isLeaf)) this.isLeafByUser = isLeaf;
  47484. }
  47485. if (store.lazy !== true && this.data) {
  47486. this.setData(this.data);
  47487. if (store.defaultExpandAll) {
  47488. this.expanded = true;
  47489. this.canFocus = true;
  47490. }
  47491. } else if (this.level > 0 && store.lazy && store.defaultExpandAll && !this.isLeafByUser) this.expand();
  47492. if (!isArray$1(this.data)) markNodeData(this, this.data);
  47493. if (!this.data) return;
  47494. const defaultExpandedKeys = store.defaultExpandedKeys;
  47495. const key = store.key;
  47496. if (key && !isNil(this.key) && defaultExpandedKeys && defaultExpandedKeys.includes(this.key)) this.expand(null, store.autoExpandParent);
  47497. if (key && store.currentNodeKey !== void 0 && this.key === store.currentNodeKey) {
  47498. store.currentNode && (store.currentNode.isCurrent = false);
  47499. store.currentNode = this;
  47500. store.currentNode.isCurrent = true;
  47501. }
  47502. if (store.lazy) store._initDefaultCheckedNode(this);
  47503. this.updateLeafState();
  47504. if (this.level === 1 || this.parent?.expanded === true) this.canFocus = true;
  47505. }
  47506. setData(data) {
  47507. if (!isArray$1(data)) markNodeData(this, data);
  47508. this.data = data;
  47509. this.childNodes = [];
  47510. let children;
  47511. if (this.level === 0 && isArray$1(this.data)) children = this.data;
  47512. else children = getPropertyFromData(this, "children") || [];
  47513. for (let i = 0, j = children.length; i < j; i++) this.insertChild({ data: children[i] });
  47514. }
  47515. get label() {
  47516. return getPropertyFromData(this, "label");
  47517. }
  47518. get key() {
  47519. const nodeKey = this.store.key;
  47520. if (this.data) return this.data[nodeKey];
  47521. return null;
  47522. }
  47523. get disabled() {
  47524. return getPropertyFromData(this, "disabled");
  47525. }
  47526. get nextSibling() {
  47527. const parent = this.parent;
  47528. if (parent) {
  47529. const index = parent.childNodes.indexOf(this);
  47530. if (index > -1) return parent.childNodes[index + 1];
  47531. }
  47532. return null;
  47533. }
  47534. get previousSibling() {
  47535. const parent = this.parent;
  47536. if (parent) {
  47537. const index = parent.childNodes.indexOf(this);
  47538. if (index > -1) return index > 0 ? parent.childNodes[index - 1] : null;
  47539. }
  47540. return null;
  47541. }
  47542. contains(target, deep = true) {
  47543. return (this.childNodes || []).some((child) => child === target || deep && child.contains(target));
  47544. }
  47545. remove() {
  47546. const parent = this.parent;
  47547. if (parent) parent.removeChild(this);
  47548. }
  47549. insertChild(child, index, batch) {
  47550. if (!child) throw new Error("InsertChild error: child is required.");
  47551. if (!(child instanceof Node$1)) {
  47552. if (!batch) {
  47553. const children = this.getChildren(true);
  47554. if (!children?.includes(child.data)) if (isUndefined(index) || index < 0) children?.push(child.data);
  47555. else children?.splice(index, 0, child.data);
  47556. }
  47557. Object.assign(child, {
  47558. parent: this,
  47559. store: this.store
  47560. });
  47561. child = reactive(new Node$1(child));
  47562. if (child instanceof Node$1) child.initialize();
  47563. }
  47564. child.level = this.level + 1;
  47565. if (isUndefined(index) || index < 0) this.childNodes.push(child);
  47566. else this.childNodes.splice(index, 0, child);
  47567. this.updateLeafState();
  47568. }
  47569. insertBefore(child, ref) {
  47570. let index;
  47571. if (ref) index = this.childNodes.indexOf(ref);
  47572. this.insertChild(child, index);
  47573. }
  47574. insertAfter(child, ref) {
  47575. let index;
  47576. if (ref) {
  47577. index = this.childNodes.indexOf(ref);
  47578. if (index !== -1) index += 1;
  47579. }
  47580. this.insertChild(child, index);
  47581. }
  47582. removeChild(child) {
  47583. const children = this.getChildren() || [];
  47584. const dataIndex = children.indexOf(child.data);
  47585. if (dataIndex > -1) children.splice(dataIndex, 1);
  47586. const index = this.childNodes.indexOf(child);
  47587. if (index > -1) {
  47588. this.store && this.store.deregisterNode(child);
  47589. child.parent = null;
  47590. this.childNodes.splice(index, 1);
  47591. }
  47592. this.updateLeafState();
  47593. }
  47594. removeChildByData(data) {
  47595. const targetNode = this.childNodes.find((child) => child.data === data);
  47596. if (targetNode) this.removeChild(targetNode);
  47597. }
  47598. expand(callback, expandParent) {
  47599. const done = () => {
  47600. if (expandParent) {
  47601. let parent = this.parent;
  47602. while (parent && parent.level > 0) {
  47603. parent.expanded = true;
  47604. parent = parent.parent;
  47605. }
  47606. }
  47607. this.expanded = true;
  47608. if (callback) callback();
  47609. setCanFocus(this.childNodes, true);
  47610. };
  47611. if (this.shouldLoadData()) this.loadData((data) => {
  47612. if (isArray$1(data)) {
  47613. if (!this.store.checkStrictly) if (this.checked) this.setChecked(true, true);
  47614. else reInitChecked(this);
  47615. done();
  47616. }
  47617. });
  47618. else done();
  47619. }
  47620. doCreateChildren(array, defaultProps = {}) {
  47621. array.forEach((item) => {
  47622. this.insertChild(Object.assign({ data: item }, defaultProps), void 0, true);
  47623. });
  47624. }
  47625. collapse() {
  47626. this.expanded = false;
  47627. setCanFocus(this.childNodes, false);
  47628. }
  47629. shouldLoadData() {
  47630. return Boolean(this.store.lazy === true && this.store.load && !this.loaded);
  47631. }
  47632. updateLeafState() {
  47633. if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== "undefined") {
  47634. this.isLeaf = this.isLeafByUser;
  47635. this.isEffectivelyChecked = this.isLeaf && this.disabled;
  47636. return;
  47637. }
  47638. const childNodes = this.childNodes;
  47639. if (!this.store.lazy || this.store.lazy === true && this.loaded === true) {
  47640. this.isLeaf = !childNodes || childNodes.length === 0;
  47641. this.isEffectivelyChecked = this.isLeaf && this.disabled;
  47642. return;
  47643. }
  47644. this.isLeaf = false;
  47645. }
  47646. setChecked(value, deep, recursion, passValue) {
  47647. this.indeterminate = value === "half";
  47648. this.checked = value === true;
  47649. this.isEffectivelyChecked = !this.childNodes.length && (this.disabled || this.checked);
  47650. if (this.store.checkStrictly && !deep) return;
  47651. if (!(this.shouldLoadData() && !this.store.checkDescendants)) {
  47652. const handleDescendants = () => {
  47653. if (deep) {
  47654. const childNodes = this.childNodes;
  47655. for (let i = 0, j = childNodes.length; i < j; i++) {
  47656. const child = childNodes[i];
  47657. passValue = passValue || value !== false;
  47658. const isCheck = child.disabled && child.isLeaf ? child.checked : passValue;
  47659. child.setChecked(isCheck, deep, true, passValue);
  47660. }
  47661. const { half, all, isEffectivelyChecked } = getChildState(childNodes);
  47662. if (!all) {
  47663. this.checked = all;
  47664. this.indeterminate = half;
  47665. }
  47666. this.isEffectivelyChecked = !this.childNodes.length ? this.disabled || this.checked : isEffectivelyChecked;
  47667. }
  47668. };
  47669. if (this.shouldLoadData()) {
  47670. this.loadData(() => {
  47671. handleDescendants();
  47672. reInitChecked(this);
  47673. }, { checked: value !== false });
  47674. return;
  47675. } else handleDescendants();
  47676. }
  47677. const parent = this.parent;
  47678. if (!parent || parent.level === 0) return;
  47679. if (!recursion && !this.store.checkStrictly) reInitChecked(parent);
  47680. }
  47681. getChildren(forceInit = false) {
  47682. if (this.level === 0) return this.data;
  47683. const data = this.data;
  47684. if (!data) return null;
  47685. const props = this.store.props;
  47686. let children = "children";
  47687. if (props) children = props.children || "children";
  47688. if (isUndefined(data[children])) data[children] = null;
  47689. if (forceInit && !data[children]) data[children] = [];
  47690. return data[children];
  47691. }
  47692. updateChildren() {
  47693. const newData = this.getChildren() || [];
  47694. const oldData = this.childNodes.map((node) => node.data);
  47695. const newDataMap = {};
  47696. const newNodes = [];
  47697. newData.forEach((item, index) => {
  47698. const key = item[NODE_KEY];
  47699. if (!!key && oldData.some((data) => data?.["$treeNodeId"] === key)) newDataMap[key] = {
  47700. index,
  47701. data: item
  47702. };
  47703. else newNodes.push({
  47704. index,
  47705. data: item
  47706. });
  47707. });
  47708. if (!this.store.lazy) oldData.forEach((item) => {
  47709. if (!newDataMap[item?.["$treeNodeId"]]) this.removeChildByData(item);
  47710. });
  47711. newNodes.forEach(({ index, data }) => {
  47712. this.insertChild({ data }, index);
  47713. });
  47714. this.updateLeafState();
  47715. }
  47716. loadData(callback, defaultProps = {}) {
  47717. if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
  47718. this.loading = true;
  47719. const resolve = (children) => {
  47720. this.childNodes = [];
  47721. this.doCreateChildren(children, defaultProps);
  47722. this.loaded = true;
  47723. this.loading = false;
  47724. this.updateLeafState();
  47725. if (callback) callback.call(this, children);
  47726. };
  47727. const reject = () => {
  47728. this.loading = false;
  47729. };
  47730. this.store.load(this, resolve, reject);
  47731. } else if (callback) callback.call(this);
  47732. }
  47733. eachNode(callback) {
  47734. const arr = [this];
  47735. while (arr.length) {
  47736. const node = arr.shift();
  47737. arr.unshift(...node.childNodes);
  47738. callback(node);
  47739. }
  47740. }
  47741. reInitChecked() {
  47742. if (this.store.checkStrictly) return;
  47743. reInitChecked(this);
  47744. }
  47745. };
  47746. //#endregion
  47747. //#region ../../packages/components/tree/src/model/tree-store.ts
  47748. var TreeStore = class {
  47749. constructor(options) {
  47750. this.lazy = false;
  47751. this.checkStrictly = false;
  47752. this.autoExpandParent = false;
  47753. this.defaultExpandAll = false;
  47754. this.checkDescendants = false;
  47755. this.currentNode = null;
  47756. this.currentNodeKey = null;
  47757. for (const option in options) if (hasOwn(options, option)) this[option] = options[option];
  47758. this.nodesMap = {};
  47759. }
  47760. initialize() {
  47761. this.root = new Node$1({
  47762. data: this.data,
  47763. store: this
  47764. });
  47765. this.root.initialize();
  47766. if (this.lazy && this.load) {
  47767. const loadFn = this.load;
  47768. loadFn(this.root, (data) => {
  47769. this.root.doCreateChildren(data);
  47770. this._initDefaultCheckedNodes();
  47771. }, NOOP);
  47772. } else this._initDefaultCheckedNodes();
  47773. }
  47774. filter(value) {
  47775. const filterNodeMethod = this.filterNodeMethod;
  47776. const lazy = this.lazy;
  47777. const traverse = async function(node) {
  47778. const childNodes = node.root ? node.root.childNodes : node.childNodes;
  47779. for (const [index, child] of childNodes.entries()) {
  47780. child.visible = !!filterNodeMethod?.call(child, value, child.data, child);
  47781. if (index % 80 === 0 && index > 0) await nextTick();
  47782. await traverse(child);
  47783. }
  47784. if (!node.visible && childNodes.length) {
  47785. let allHidden = true;
  47786. allHidden = !childNodes.some((child) => child.visible);
  47787. if (node.root) node.root.visible = allHidden === false;
  47788. else node.visible = allHidden === false;
  47789. }
  47790. if (!value) return;
  47791. if (node.visible && !node.isLeaf) {
  47792. if (!lazy || node.loaded) node.expand();
  47793. }
  47794. };
  47795. traverse(this);
  47796. }
  47797. setData(newVal) {
  47798. if (newVal !== this.root.data) {
  47799. this.nodesMap = {};
  47800. this.root.setData(newVal);
  47801. this._initDefaultCheckedNodes();
  47802. this.setCurrentNodeKey(this.currentNodeKey);
  47803. } else this.root.updateChildren();
  47804. }
  47805. getNode(data) {
  47806. if (data instanceof Node$1) return data;
  47807. const key = isObject$1(data) ? getNodeKey(this.key, data) : data;
  47808. return this.nodesMap[key] || null;
  47809. }
  47810. insertBefore(data, refData) {
  47811. const refNode = this.getNode(refData);
  47812. refNode.parent?.insertBefore({ data }, refNode);
  47813. }
  47814. insertAfter(data, refData) {
  47815. const refNode = this.getNode(refData);
  47816. refNode.parent?.insertAfter({ data }, refNode);
  47817. }
  47818. remove(data) {
  47819. const node = this.getNode(data);
  47820. if (node && node.parent) {
  47821. if (node === this.currentNode) this.currentNode = null;
  47822. node.parent.removeChild(node);
  47823. }
  47824. }
  47825. append(data, parentData) {
  47826. const parentNode = !isPropAbsent(parentData) ? this.getNode(parentData) : this.root;
  47827. if (parentNode) parentNode.insertChild({ data });
  47828. }
  47829. _initDefaultCheckedNodes() {
  47830. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  47831. const nodesMap = this.nodesMap;
  47832. defaultCheckedKeys.forEach((checkedKey) => {
  47833. const node = nodesMap[checkedKey];
  47834. if (node) node.setChecked(true, !this.checkStrictly);
  47835. });
  47836. }
  47837. _initDefaultCheckedNode(node) {
  47838. const defaultCheckedKeys = this.defaultCheckedKeys || [];
  47839. if (!isNil(node.key) && defaultCheckedKeys.includes(node.key)) node.setChecked(true, !this.checkStrictly);
  47840. }
  47841. setDefaultCheckedKey(newVal) {
  47842. if (newVal !== this.defaultCheckedKeys) {
  47843. this.defaultCheckedKeys = newVal;
  47844. this._initDefaultCheckedNodes();
  47845. }
  47846. }
  47847. registerNode(node) {
  47848. const key = this.key;
  47849. if (!node || !node.data) return;
  47850. if (!key) this.nodesMap[node.id] = node;
  47851. else {
  47852. const nodeKey = node.key;
  47853. if (!isNil(nodeKey)) this.nodesMap[nodeKey] = node;
  47854. }
  47855. }
  47856. deregisterNode(node) {
  47857. if (!this.key || !node || !node.data) return;
  47858. node.childNodes.forEach((child) => {
  47859. this.deregisterNode(child);
  47860. });
  47861. delete this.nodesMap[node.key];
  47862. }
  47863. getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
  47864. const checkedNodes = [];
  47865. const traverse = function(node) {
  47866. (node.root ? node.root.childNodes : node.childNodes).forEach((child) => {
  47867. if ((child.checked || includeHalfChecked && child.indeterminate) && (!leafOnly || leafOnly && child.isLeaf)) checkedNodes.push(child.data);
  47868. traverse(child);
  47869. });
  47870. };
  47871. traverse(this);
  47872. return checkedNodes;
  47873. }
  47874. getCheckedKeys(leafOnly = false) {
  47875. return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
  47876. }
  47877. getHalfCheckedNodes() {
  47878. const nodes = [];
  47879. const traverse = function(node) {
  47880. (node.root ? node.root.childNodes : node.childNodes).forEach((child) => {
  47881. if (child.indeterminate) nodes.push(child.data);
  47882. traverse(child);
  47883. });
  47884. };
  47885. traverse(this);
  47886. return nodes;
  47887. }
  47888. getHalfCheckedKeys() {
  47889. return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
  47890. }
  47891. _getAllNodes() {
  47892. const allNodes = [];
  47893. const nodesMap = this.nodesMap;
  47894. for (const nodeKey in nodesMap) if (hasOwn(nodesMap, nodeKey)) allNodes.push(nodesMap[nodeKey]);
  47895. return allNodes;
  47896. }
  47897. updateChildren(key, data) {
  47898. const node = this.nodesMap[key];
  47899. if (!node) return;
  47900. const childNodes = node.childNodes;
  47901. for (let i = childNodes.length - 1; i >= 0; i--) {
  47902. const child = childNodes[i];
  47903. this.remove(child.data);
  47904. }
  47905. for (let i = 0, j = data.length; i < j; i++) {
  47906. const child = data[i];
  47907. this.append(child, node.data);
  47908. }
  47909. }
  47910. _setCheckedKeys(key, leafOnly = false, checkedKeys) {
  47911. const allNodes = this._getAllNodes().sort((a, b) => a.level - b.level);
  47912. const cache = Object.create(null);
  47913. const keys = Object.keys(checkedKeys);
  47914. allNodes.forEach((node) => node.setChecked(false, false));
  47915. const cacheCheckedChild = (node) => {
  47916. node.childNodes.forEach((child) => {
  47917. cache[child.data[key]] = true;
  47918. if (child.childNodes?.length) cacheCheckedChild(child);
  47919. });
  47920. };
  47921. for (let i = 0, j = allNodes.length; i < j; i++) {
  47922. const node = allNodes[i];
  47923. const nodeKey = node.data[key].toString();
  47924. if (!keys.includes(nodeKey)) {
  47925. if (node.checked && !cache[nodeKey]) node.setChecked(false, false);
  47926. continue;
  47927. }
  47928. if (node.childNodes.length) cacheCheckedChild(node);
  47929. if (node.isLeaf || this.checkStrictly) {
  47930. node.setChecked(true, false);
  47931. continue;
  47932. }
  47933. node.setChecked(true, true);
  47934. if (leafOnly) {
  47935. node.setChecked(false, false, true);
  47936. const traverse = function(node) {
  47937. node.childNodes.forEach((child) => {
  47938. if (!child.isLeaf) child.setChecked(false, false, true);
  47939. traverse(child);
  47940. });
  47941. node.reInitChecked();
  47942. };
  47943. traverse(node);
  47944. }
  47945. }
  47946. }
  47947. setCheckedNodes(array, leafOnly = false) {
  47948. const key = this.key;
  47949. const checkedKeys = {};
  47950. array.forEach((item) => {
  47951. checkedKeys[(item || {})[key]] = true;
  47952. });
  47953. this._setCheckedKeys(key, leafOnly, checkedKeys);
  47954. }
  47955. setCheckedKeys(keys, leafOnly = false) {
  47956. this.defaultCheckedKeys = keys;
  47957. const key = this.key;
  47958. const checkedKeys = {};
  47959. keys.forEach((key) => {
  47960. checkedKeys[key] = true;
  47961. });
  47962. this._setCheckedKeys(key, leafOnly, checkedKeys);
  47963. }
  47964. setDefaultExpandedKeys(keys) {
  47965. keys = keys || [];
  47966. this.defaultExpandedKeys = keys;
  47967. keys.forEach((key) => {
  47968. const node = this.getNode(key);
  47969. if (node) node.expand(null, this.autoExpandParent);
  47970. });
  47971. }
  47972. setChecked(data, checked, deep) {
  47973. const node = this.getNode(data);
  47974. if (node) node.setChecked(!!checked, deep);
  47975. }
  47976. getCurrentNode() {
  47977. return this.currentNode;
  47978. }
  47979. setCurrentNode(currentNode) {
  47980. const prevCurrentNode = this.currentNode;
  47981. if (prevCurrentNode) prevCurrentNode.isCurrent = false;
  47982. this.currentNode = currentNode;
  47983. this.currentNode.isCurrent = true;
  47984. }
  47985. setUserCurrentNode(node, shouldAutoExpandParent = true) {
  47986. const key = node[this.key];
  47987. const currNode = this.nodesMap[key];
  47988. this.setCurrentNode(currNode);
  47989. if (shouldAutoExpandParent && this.currentNode && this.currentNode.level > 1) this.currentNode.parent?.expand(null, true);
  47990. }
  47991. setCurrentNodeKey(key, shouldAutoExpandParent = true) {
  47992. this.currentNodeKey = key;
  47993. if (isPropAbsent(key)) {
  47994. this.currentNode && (this.currentNode.isCurrent = false);
  47995. this.currentNode = null;
  47996. return;
  47997. }
  47998. const node = this.getNode(key);
  47999. if (node) {
  48000. this.setCurrentNode(node);
  48001. if (shouldAutoExpandParent && this.currentNode && this.currentNode.level > 1) this.currentNode.parent?.expand(null, true);
  48002. }
  48003. }
  48004. };
  48005. //#endregion
  48006. //#region ../../packages/components/tree/src/tokens.ts
  48007. const ROOT_TREE_INJECTION_KEY = "RootTree";
  48008. const NODE_INSTANCE_INJECTION_KEY = "NodeInstance";
  48009. const TREE_NODE_MAP_INJECTION_KEY = "TreeNodeMap";
  48010. //#endregion
  48011. //#region ../../packages/components/tree/src/tree-node-content.vue?vue&type=script&lang.ts
  48012. var tree_node_content_vue_vue_type_script_lang_default = defineComponent({
  48013. name: "ElTreeNodeContent",
  48014. props: {
  48015. node: {
  48016. type: Object,
  48017. required: true
  48018. },
  48019. renderContent: Function
  48020. },
  48021. setup(props) {
  48022. const ns = useNamespace("tree");
  48023. const nodeInstance = inject(NODE_INSTANCE_INJECTION_KEY);
  48024. const tree = inject(ROOT_TREE_INJECTION_KEY);
  48025. return () => {
  48026. const node = props.node;
  48027. const { data, store } = node;
  48028. return props.renderContent ? props.renderContent(h, {
  48029. _self: nodeInstance,
  48030. node,
  48031. data,
  48032. store
  48033. }) : renderSlot(tree.ctx.slots, "default", {
  48034. node,
  48035. data
  48036. }, () => [h(ElText, {
  48037. tag: "span",
  48038. truncated: true,
  48039. class: ns.be("node", "label")
  48040. }, () => [node.label])]);
  48041. };
  48042. }
  48043. });
  48044. //#endregion
  48045. //#region ../../packages/components/tree/src/tree-node-content.vue
  48046. var tree_node_content_default$1 = tree_node_content_vue_vue_type_script_lang_default;
  48047. //#endregion
  48048. //#region ../../packages/components/tree/src/model/useNodeExpandEventBroadcast.ts
  48049. function useNodeExpandEventBroadcast(props) {
  48050. const parentNodeMap = inject(TREE_NODE_MAP_INJECTION_KEY, null);
  48051. let currentNodeMap = {
  48052. treeNodeExpand: (node) => {
  48053. if (props.node !== node) props.node?.collapse();
  48054. },
  48055. children: /* @__PURE__ */ new Set()
  48056. };
  48057. if (parentNodeMap) parentNodeMap.children.add(currentNodeMap);
  48058. onBeforeUnmount(() => {
  48059. if (parentNodeMap) parentNodeMap.children.delete(currentNodeMap);
  48060. currentNodeMap = null;
  48061. });
  48062. provide(TREE_NODE_MAP_INJECTION_KEY, currentNodeMap);
  48063. return { broadcastExpanded: (node) => {
  48064. if (!props.accordion) return;
  48065. for (const childNode of currentNodeMap.children) childNode.treeNodeExpand(node);
  48066. } };
  48067. }
  48068. //#endregion
  48069. //#region ../../packages/components/tree/src/model/useDragNode.ts
  48070. const dragEventsKey = Symbol("dragEvents");
  48071. function useDragNodeHandler({ props, ctx, el$, dropIndicator$, store }) {
  48072. const ns = useNamespace("tree");
  48073. const dragState = ref({
  48074. showDropIndicator: false,
  48075. draggingNode: null,
  48076. dropNode: null,
  48077. allowDrop: true,
  48078. dropType: null
  48079. });
  48080. const treeNodeDragStart = ({ event, treeNode }) => {
  48081. if (!event.dataTransfer) return;
  48082. if (isFunction$1(props.allowDrag) && !props.allowDrag(treeNode.node)) {
  48083. event.preventDefault();
  48084. return false;
  48085. }
  48086. event.dataTransfer.effectAllowed = "move";
  48087. try {
  48088. event.dataTransfer.setData("text/plain", "");
  48089. } catch {}
  48090. dragState.value.draggingNode = treeNode;
  48091. ctx.emit("node-drag-start", treeNode.node, event);
  48092. };
  48093. const treeNodeDragOver = ({ event, treeNode }) => {
  48094. if (!event.dataTransfer) return;
  48095. const dropNode = treeNode;
  48096. const oldDropNode = dragState.value.dropNode;
  48097. if (oldDropNode && oldDropNode.node.id !== dropNode.node.id) removeClass(oldDropNode.$el, ns.is("drop-inner"));
  48098. const draggingNode = dragState.value.draggingNode;
  48099. if (!draggingNode || !dropNode) return;
  48100. let dropPrev = true;
  48101. let dropInner = true;
  48102. let dropNext = true;
  48103. let userAllowDropInner = true;
  48104. if (isFunction$1(props.allowDrop)) {
  48105. dropPrev = props.allowDrop(draggingNode.node, dropNode.node, "prev");
  48106. userAllowDropInner = dropInner = props.allowDrop(draggingNode.node, dropNode.node, "inner");
  48107. dropNext = props.allowDrop(draggingNode.node, dropNode.node, "next");
  48108. }
  48109. event.dataTransfer.dropEffect = dropInner || dropPrev || dropNext ? "move" : "none";
  48110. if ((dropPrev || dropInner || dropNext) && oldDropNode?.node.id !== dropNode.node.id) {
  48111. if (oldDropNode) ctx.emit("node-drag-leave", draggingNode.node, oldDropNode.node, event);
  48112. ctx.emit("node-drag-enter", draggingNode.node, dropNode.node, event);
  48113. }
  48114. if (dropPrev || dropInner || dropNext) dragState.value.dropNode = dropNode;
  48115. else dragState.value.dropNode = null;
  48116. if (dropNode.node.nextSibling === draggingNode.node) dropNext = false;
  48117. if (dropNode.node.previousSibling === draggingNode.node) dropPrev = false;
  48118. if (dropNode.node.contains(draggingNode.node, false)) dropInner = false;
  48119. if (draggingNode.node === dropNode.node || draggingNode.node.contains(dropNode.node)) {
  48120. dropPrev = false;
  48121. dropInner = false;
  48122. dropNext = false;
  48123. }
  48124. const dropEl = dropNode.$el;
  48125. const targetPosition = dropEl.querySelector(`.${ns.be("node", "content")}`).getBoundingClientRect();
  48126. const treePosition = el$.value.getBoundingClientRect();
  48127. const treeScrollTop = el$.value.scrollTop;
  48128. let dropType;
  48129. const prevPercent = dropPrev ? dropInner ? .25 : dropNext ? .45 : 1 : Number.NEGATIVE_INFINITY;
  48130. const nextPercent = dropNext ? dropInner ? .75 : dropPrev ? .55 : 0 : Number.POSITIVE_INFINITY;
  48131. let indicatorTop = -9999;
  48132. const distance = event.clientY - targetPosition.top;
  48133. if (distance < targetPosition.height * prevPercent) dropType = "before";
  48134. else if (distance > targetPosition.height * nextPercent) dropType = "after";
  48135. else if (dropInner) dropType = "inner";
  48136. else dropType = "none";
  48137. const iconPosition = dropEl.querySelector(`.${ns.be("node", "expand-icon")}`).getBoundingClientRect();
  48138. const dropIndicator = dropIndicator$.value;
  48139. if (dropType === "before") indicatorTop = iconPosition.top - treePosition.top + treeScrollTop;
  48140. else if (dropType === "after") indicatorTop = iconPosition.bottom - treePosition.top + treeScrollTop;
  48141. dropIndicator.style.top = `${indicatorTop}px`;
  48142. dropIndicator.style.left = `${iconPosition.right - treePosition.left}px`;
  48143. if (dropType === "inner") addClass(dropEl, ns.is("drop-inner"));
  48144. else removeClass(dropEl, ns.is("drop-inner"));
  48145. dragState.value.showDropIndicator = dropType === "before" || dropType === "after";
  48146. dragState.value.allowDrop = dragState.value.showDropIndicator || userAllowDropInner;
  48147. dragState.value.dropType = dropType;
  48148. ctx.emit("node-drag-over", draggingNode.node, dropNode.node, event);
  48149. };
  48150. const treeNodeDragEnd = (event) => {
  48151. const { draggingNode, dropType, dropNode } = dragState.value;
  48152. event.preventDefault();
  48153. if (event.dataTransfer) event.dataTransfer.dropEffect = "move";
  48154. if (draggingNode?.node.data && dropNode) {
  48155. const draggingNodeCopy = { data: draggingNode.node.data };
  48156. if (dropType !== "none") draggingNode.node.remove();
  48157. if (dropType === "before") dropNode.node.parent?.insertBefore(draggingNodeCopy, dropNode.node);
  48158. else if (dropType === "after") dropNode.node.parent?.insertAfter(draggingNodeCopy, dropNode.node);
  48159. else if (dropType === "inner") dropNode.node.insertChild(draggingNodeCopy);
  48160. if (dropType !== "none") {
  48161. store.value.registerNode(draggingNodeCopy);
  48162. if (store.value.key) draggingNode.node.eachNode((node) => {
  48163. store.value.nodesMap[node.data[store.value.key]]?.setChecked(node.checked, !store.value.checkStrictly);
  48164. });
  48165. }
  48166. removeClass(dropNode.$el, ns.is("drop-inner"));
  48167. ctx.emit("node-drag-end", draggingNode.node, dropNode.node, dropType, event);
  48168. if (dropType !== "none") ctx.emit("node-drop", draggingNode.node, dropNode.node, dropType, event);
  48169. }
  48170. if (draggingNode && !dropNode) ctx.emit("node-drag-end", draggingNode.node, null, dropType, event);
  48171. dragState.value.showDropIndicator = false;
  48172. dragState.value.draggingNode = null;
  48173. dragState.value.dropNode = null;
  48174. dragState.value.allowDrop = true;
  48175. };
  48176. provide(dragEventsKey, {
  48177. treeNodeDragStart,
  48178. treeNodeDragOver,
  48179. treeNodeDragEnd
  48180. });
  48181. return { dragState };
  48182. }
  48183. //#endregion
  48184. //#region ../../packages/components/tree/src/tree-node.vue?vue&type=script&lang.ts
  48185. var tree_node_vue_vue_type_script_lang_default = defineComponent({
  48186. name: "ElTreeNode",
  48187. components: {
  48188. ElCollapseTransition,
  48189. ElCheckbox,
  48190. NodeContent: tree_node_content_default$1,
  48191. ElIcon,
  48192. Loading: loading_default
  48193. },
  48194. props: {
  48195. node: {
  48196. type: Node$1,
  48197. default: () => ({})
  48198. },
  48199. props: {
  48200. type: Object,
  48201. default: () => ({})
  48202. },
  48203. accordion: Boolean,
  48204. renderContent: Function,
  48205. renderAfterExpand: Boolean,
  48206. showCheckbox: Boolean
  48207. },
  48208. emits: ["node-expand"],
  48209. setup(props, ctx) {
  48210. const ns = useNamespace("tree");
  48211. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  48212. const tree = inject(ROOT_TREE_INJECTION_KEY);
  48213. const expanded = ref(false);
  48214. const childNodeRendered = ref(false);
  48215. const oldChecked = ref();
  48216. const oldIndeterminate = ref();
  48217. const node$ = ref();
  48218. const dragEvents = inject(dragEventsKey);
  48219. const instance = getCurrentInstance();
  48220. provide(NODE_INSTANCE_INJECTION_KEY, instance);
  48221. if (!tree) /* @__PURE__ */ debugWarn("Tree", "Can not find node's tree.");
  48222. if (props.node.expanded) {
  48223. expanded.value = true;
  48224. childNodeRendered.value = true;
  48225. }
  48226. const childrenKey = tree.props.props["children"] || "children";
  48227. watch(() => {
  48228. const children = props.node.data?.[childrenKey];
  48229. return children && [...children];
  48230. }, () => {
  48231. props.node.updateChildren();
  48232. });
  48233. watch(() => props.node.indeterminate, (val) => {
  48234. handleSelectChange(props.node.checked, val);
  48235. });
  48236. watch(() => props.node.checked, (val) => {
  48237. handleSelectChange(val, props.node.indeterminate);
  48238. });
  48239. watch(() => props.node.childNodes.length, () => props.node.reInitChecked());
  48240. watch(() => props.node.expanded, (val) => {
  48241. nextTick(() => expanded.value = val);
  48242. if (val) childNodeRendered.value = true;
  48243. });
  48244. const getNodeKey$2 = (node) => {
  48245. return tree.props.nodeKey ? getNodeKey(tree.props.nodeKey, node.data) : node.id;
  48246. };
  48247. const getNodeClass = (node) => {
  48248. const nodeClassFunc = props.props.class;
  48249. if (!nodeClassFunc) return {};
  48250. let className;
  48251. if (isFunction$1(nodeClassFunc)) {
  48252. const { data } = node;
  48253. className = nodeClassFunc(data, node);
  48254. } else className = nodeClassFunc;
  48255. if (isString(className)) return { [className]: true };
  48256. else return className;
  48257. };
  48258. const handleSelectChange = (checked, indeterminate) => {
  48259. if (oldChecked.value !== checked || oldIndeterminate.value !== indeterminate) tree.ctx.emit("check-change", props.node.data, checked, indeterminate);
  48260. oldChecked.value = checked;
  48261. oldIndeterminate.value = indeterminate;
  48262. };
  48263. const handleClick = (e) => {
  48264. handleCurrentChange(tree.store, tree.ctx.emit, () => {
  48265. if (tree?.props?.nodeKey) {
  48266. const curNodeKey = getNodeKey$2(props.node);
  48267. tree.store.value.setCurrentNodeKey(curNodeKey);
  48268. } else tree.store.value.setCurrentNode(props.node);
  48269. });
  48270. tree.currentNode.value = props.node;
  48271. if (tree.props.expandOnClickNode) handleExpandIconClick();
  48272. if ((tree.props.checkOnClickNode || props.node.isLeaf && tree.props.checkOnClickLeaf && props.showCheckbox) && !props.node.disabled) handleCheckChange(!props.node.checked);
  48273. tree.ctx.emit("node-click", props.node.data, props.node, instance, e);
  48274. };
  48275. const handleContextMenu = (event) => {
  48276. if (tree.instance.vnode.props?.["onNodeContextmenu"]) {
  48277. event.stopPropagation();
  48278. event.preventDefault();
  48279. }
  48280. tree.ctx.emit("node-contextmenu", event, props.node.data, props.node, instance);
  48281. };
  48282. const handleExpandIconClick = () => {
  48283. if (props.node.isLeaf) return;
  48284. if (expanded.value) {
  48285. tree.ctx.emit("node-collapse", props.node.data, props.node, instance);
  48286. props.node.collapse();
  48287. } else props.node.expand(() => {
  48288. ctx.emit("node-expand", props.node.data, props.node, instance);
  48289. });
  48290. };
  48291. const handleCheckChange = (value) => {
  48292. const checkStrictly = tree?.props.checkStrictly;
  48293. const childNodes = props.node.childNodes;
  48294. if (!checkStrictly && childNodes.length) value = childNodes.some((node) => !node.isEffectivelyChecked);
  48295. props.node.setChecked(value, !checkStrictly);
  48296. nextTick(() => {
  48297. const store = tree.store.value;
  48298. tree.ctx.emit("check", props.node.data, {
  48299. checkedNodes: store.getCheckedNodes(),
  48300. checkedKeys: store.getCheckedKeys(),
  48301. halfCheckedNodes: store.getHalfCheckedNodes(),
  48302. halfCheckedKeys: store.getHalfCheckedKeys()
  48303. });
  48304. });
  48305. };
  48306. const handleChildNodeExpand = (nodeData, node, instance) => {
  48307. broadcastExpanded(node);
  48308. tree.ctx.emit("node-expand", nodeData, node, instance);
  48309. };
  48310. const handleDragStart = (event) => {
  48311. if (!tree.props.draggable) return;
  48312. dragEvents.treeNodeDragStart({
  48313. event,
  48314. treeNode: props
  48315. });
  48316. };
  48317. const handleDragOver = (event) => {
  48318. event.preventDefault();
  48319. if (!tree.props.draggable) return;
  48320. dragEvents.treeNodeDragOver({
  48321. event,
  48322. treeNode: {
  48323. $el: node$.value,
  48324. node: props.node
  48325. }
  48326. });
  48327. };
  48328. const handleDrop = (event) => {
  48329. event.preventDefault();
  48330. };
  48331. const handleDragEnd = (event) => {
  48332. if (!tree.props.draggable) return;
  48333. dragEvents.treeNodeDragEnd(event);
  48334. };
  48335. return {
  48336. ns,
  48337. node$,
  48338. tree,
  48339. expanded,
  48340. childNodeRendered,
  48341. oldChecked,
  48342. oldIndeterminate,
  48343. getNodeKey: getNodeKey$2,
  48344. getNodeClass,
  48345. handleSelectChange,
  48346. handleClick,
  48347. handleContextMenu,
  48348. handleExpandIconClick,
  48349. handleCheckChange,
  48350. handleChildNodeExpand,
  48351. handleDragStart,
  48352. handleDragOver,
  48353. handleDrop,
  48354. handleDragEnd,
  48355. CaretRight: caret_right_default
  48356. };
  48357. }
  48358. });
  48359. //#endregion
  48360. //#region ../../packages/components/tree/src/tree-node.vue
  48361. const _hoisted_1$12 = [
  48362. "aria-expanded",
  48363. "aria-disabled",
  48364. "aria-checked",
  48365. "draggable",
  48366. "data-key"
  48367. ];
  48368. const _hoisted_2$7 = ["aria-expanded"];
  48369. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  48370. const _component_el_icon = resolveComponent("el-icon");
  48371. const _component_el_checkbox = resolveComponent("el-checkbox");
  48372. const _component_loading = resolveComponent("loading");
  48373. const _component_node_content = resolveComponent("node-content");
  48374. const _component_el_tree_node = resolveComponent("el-tree-node");
  48375. const _component_el_collapse_transition = resolveComponent("el-collapse-transition");
  48376. return withDirectives((openBlock(), createElementBlock("div", {
  48377. ref: "node$",
  48378. class: normalizeClass([
  48379. _ctx.ns.b("node"),
  48380. _ctx.ns.is("expanded", _ctx.expanded),
  48381. _ctx.ns.is("current", _ctx.node.isCurrent),
  48382. _ctx.ns.is("hidden", !_ctx.node.visible),
  48383. _ctx.ns.is("focusable", !_ctx.node.disabled),
  48384. _ctx.ns.is("checked", !_ctx.node.disabled && _ctx.node.checked),
  48385. _ctx.getNodeClass(_ctx.node)
  48386. ]),
  48387. role: "treeitem",
  48388. tabindex: "-1",
  48389. "aria-expanded": _ctx.expanded,
  48390. "aria-disabled": _ctx.node.disabled,
  48391. "aria-checked": _ctx.node.checked,
  48392. draggable: _ctx.tree.props.draggable,
  48393. "data-key": _ctx.getNodeKey(_ctx.node),
  48394. onClick: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.handleClick && _ctx.handleClick(...args), ["stop"])),
  48395. onContextmenu: _cache[3] || (_cache[3] = (...args) => _ctx.handleContextMenu && _ctx.handleContextMenu(...args)),
  48396. onDragstart: _cache[4] || (_cache[4] = withModifiers((...args) => _ctx.handleDragStart && _ctx.handleDragStart(...args), ["stop"])),
  48397. onDragover: _cache[5] || (_cache[5] = withModifiers((...args) => _ctx.handleDragOver && _ctx.handleDragOver(...args), ["stop"])),
  48398. onDragend: _cache[6] || (_cache[6] = withModifiers((...args) => _ctx.handleDragEnd && _ctx.handleDragEnd(...args), ["stop"])),
  48399. onDrop: _cache[7] || (_cache[7] = withModifiers((...args) => _ctx.handleDrop && _ctx.handleDrop(...args), ["stop"]))
  48400. }, [createElementVNode("div", {
  48401. class: normalizeClass(_ctx.ns.be("node", "content")),
  48402. style: normalizeStyle({ paddingLeft: (_ctx.node.level - 1) * _ctx.tree.props.indent + "px" })
  48403. }, [
  48404. _ctx.tree.props.icon || _ctx.CaretRight ? (openBlock(), createBlock(_component_el_icon, {
  48405. key: 0,
  48406. class: normalizeClass([
  48407. _ctx.ns.be("node", "expand-icon"),
  48408. _ctx.ns.is("leaf", _ctx.node.isLeaf),
  48409. { expanded: !_ctx.node.isLeaf && _ctx.expanded }
  48410. ]),
  48411. onClick: withModifiers(_ctx.handleExpandIconClick, ["stop"])
  48412. }, {
  48413. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.tree.props.icon || _ctx.CaretRight)))]),
  48414. _: 1
  48415. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true),
  48416. _ctx.showCheckbox ? (openBlock(), createBlock(_component_el_checkbox, {
  48417. key: 1,
  48418. "model-value": _ctx.node.checked,
  48419. indeterminate: _ctx.node.indeterminate,
  48420. disabled: !!_ctx.node.disabled,
  48421. onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"])),
  48422. onChange: _ctx.handleCheckChange
  48423. }, null, 8, [
  48424. "model-value",
  48425. "indeterminate",
  48426. "disabled",
  48427. "onChange"
  48428. ])) : createCommentVNode("v-if", true),
  48429. _ctx.node.loading ? (openBlock(), createBlock(_component_el_icon, {
  48430. key: 2,
  48431. class: normalizeClass([_ctx.ns.be("node", "loading-icon"), _ctx.ns.is("loading")])
  48432. }, {
  48433. default: withCtx(() => [createVNode(_component_loading)]),
  48434. _: 1
  48435. }, 8, ["class"])) : createCommentVNode("v-if", true),
  48436. createVNode(_component_node_content, {
  48437. node: _ctx.node,
  48438. "render-content": _ctx.renderContent
  48439. }, null, 8, ["node", "render-content"])
  48440. ], 6), createVNode(_component_el_collapse_transition, null, {
  48441. default: withCtx(() => [!_ctx.renderAfterExpand || _ctx.childNodeRendered ? withDirectives((openBlock(), createElementBlock("div", {
  48442. key: 0,
  48443. class: normalizeClass(_ctx.ns.be("node", "children")),
  48444. role: "group",
  48445. "aria-expanded": _ctx.expanded,
  48446. onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
  48447. }, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.node.childNodes, (child) => {
  48448. return openBlock(), createBlock(_component_el_tree_node, {
  48449. key: _ctx.getNodeKey(child),
  48450. "render-content": _ctx.renderContent,
  48451. "render-after-expand": _ctx.renderAfterExpand,
  48452. "show-checkbox": _ctx.showCheckbox,
  48453. node: child,
  48454. accordion: _ctx.accordion,
  48455. props: _ctx.props,
  48456. onNodeExpand: _ctx.handleChildNodeExpand
  48457. }, null, 8, [
  48458. "render-content",
  48459. "render-after-expand",
  48460. "show-checkbox",
  48461. "node",
  48462. "accordion",
  48463. "props",
  48464. "onNodeExpand"
  48465. ]);
  48466. }), 128))], 10, _hoisted_2$7)), [[vShow, _ctx.expanded]]) : createCommentVNode("v-if", true)]),
  48467. _: 1
  48468. })], 42, _hoisted_1$12)), [[vShow, _ctx.node.visible]]);
  48469. }
  48470. var tree_node_default$1 = /* @__PURE__ */ _plugin_vue_export_helper_default(tree_node_vue_vue_type_script_lang_default, [["render", _sfc_render$2]]);
  48471. //#endregion
  48472. //#region ../../packages/components/tree/src/model/useKeydown.ts
  48473. function useKeydown({ el$ }, store) {
  48474. const ns = useNamespace("tree");
  48475. onMounted(() => {
  48476. initTabIndex();
  48477. });
  48478. onUpdated(() => {
  48479. el$.value?.querySelectorAll("input[type=checkbox]").forEach((checkbox) => {
  48480. checkbox.setAttribute("tabindex", "-1");
  48481. });
  48482. });
  48483. function canNodeFocus(treeItems, nextIndex) {
  48484. const currentNode = store.value.getNode(treeItems[nextIndex].dataset.key);
  48485. return currentNode.canFocus && currentNode.visible && (currentNode.parent?.expanded || currentNode.parent?.level === 0);
  48486. }
  48487. const handleKeydown = (ev) => {
  48488. const currentItem = ev.target;
  48489. if (!currentItem.className.includes(ns.b("node"))) return;
  48490. const code = getEventCode(ev);
  48491. const treeItems = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  48492. const currentIndex = treeItems.indexOf(currentItem);
  48493. let nextIndex;
  48494. if ([EVENT_CODE.up, EVENT_CODE.down].includes(code)) {
  48495. ev.preventDefault();
  48496. if (code === EVENT_CODE.up) {
  48497. nextIndex = currentIndex === -1 ? 0 : currentIndex !== 0 ? currentIndex - 1 : treeItems.length - 1;
  48498. const startIndex = nextIndex;
  48499. while (true) {
  48500. if (canNodeFocus(treeItems, nextIndex)) break;
  48501. nextIndex--;
  48502. if (nextIndex === startIndex) {
  48503. nextIndex = -1;
  48504. break;
  48505. }
  48506. if (nextIndex < 0) nextIndex = treeItems.length - 1;
  48507. }
  48508. } else {
  48509. nextIndex = currentIndex === -1 ? 0 : currentIndex < treeItems.length - 1 ? currentIndex + 1 : 0;
  48510. const startIndex = nextIndex;
  48511. while (true) {
  48512. if (canNodeFocus(treeItems, nextIndex)) break;
  48513. nextIndex++;
  48514. if (nextIndex === startIndex) {
  48515. nextIndex = -1;
  48516. break;
  48517. }
  48518. if (nextIndex >= treeItems.length) nextIndex = 0;
  48519. }
  48520. }
  48521. nextIndex !== -1 && treeItems[nextIndex].focus();
  48522. }
  48523. if ([EVENT_CODE.left, EVENT_CODE.right].includes(code)) {
  48524. ev.preventDefault();
  48525. currentItem.click();
  48526. }
  48527. const hasInput = currentItem.querySelector("[type=\"checkbox\"]");
  48528. if ([
  48529. EVENT_CODE.enter,
  48530. EVENT_CODE.numpadEnter,
  48531. EVENT_CODE.space
  48532. ].includes(code) && hasInput) {
  48533. ev.preventDefault();
  48534. hasInput.click();
  48535. }
  48536. };
  48537. useEventListener(el$, "keydown", handleKeydown);
  48538. const initTabIndex = () => {
  48539. if (!el$.value) return;
  48540. const treeItems = Array.from(el$.value.querySelectorAll(`.${ns.is("focusable")}[role=treeitem]`));
  48541. Array.from(el$.value.querySelectorAll("input[type=checkbox]")).forEach((checkbox) => {
  48542. checkbox.setAttribute("tabindex", "-1");
  48543. });
  48544. const checkedItem = el$.value.querySelectorAll(`.${ns.is("checked")}[role=treeitem]`);
  48545. if (checkedItem.length) {
  48546. checkedItem[0].setAttribute("tabindex", "0");
  48547. return;
  48548. }
  48549. treeItems[0]?.setAttribute("tabindex", "0");
  48550. };
  48551. }
  48552. //#endregion
  48553. //#region ../../packages/components/tree/src/tree.ts
  48554. const treeProps = buildProps({
  48555. data: {
  48556. type: definePropType(Array),
  48557. default: () => []
  48558. },
  48559. emptyText: { type: String },
  48560. renderAfterExpand: {
  48561. type: Boolean,
  48562. default: true
  48563. },
  48564. nodeKey: String,
  48565. checkStrictly: Boolean,
  48566. defaultExpandAll: Boolean,
  48567. expandOnClickNode: {
  48568. type: Boolean,
  48569. default: true
  48570. },
  48571. checkOnClickNode: Boolean,
  48572. checkOnClickLeaf: {
  48573. type: Boolean,
  48574. default: true
  48575. },
  48576. checkDescendants: Boolean,
  48577. autoExpandParent: {
  48578. type: Boolean,
  48579. default: true
  48580. },
  48581. defaultCheckedKeys: { type: Array },
  48582. defaultExpandedKeys: { type: Array },
  48583. currentNodeKey: { type: [String, Number] },
  48584. renderContent: { type: definePropType(Function) },
  48585. showCheckbox: Boolean,
  48586. draggable: Boolean,
  48587. allowDrag: { type: definePropType(Function) },
  48588. allowDrop: { type: definePropType(Function) },
  48589. props: {
  48590. type: Object,
  48591. default: () => ({
  48592. children: "children",
  48593. label: "label",
  48594. disabled: "disabled"
  48595. })
  48596. },
  48597. lazy: Boolean,
  48598. highlightCurrent: Boolean,
  48599. load: { type: Function },
  48600. filterNodeMethod: { type: Function },
  48601. accordion: Boolean,
  48602. indent: {
  48603. type: Number,
  48604. default: 18
  48605. },
  48606. icon: { type: iconPropType }
  48607. });
  48608. const treeEmits = {
  48609. "check-change": (data, checked, indeterminate) => data && isBoolean(checked) && isBoolean(indeterminate),
  48610. "current-change": (data, node) => true,
  48611. "node-click": (data, node, nodeInstance, evt) => data && node && evt instanceof Event,
  48612. "node-contextmenu": (evt, data, node, nodeInstance) => evt instanceof Event && data && node,
  48613. "node-collapse": (data, node, nodeInstance) => data && node,
  48614. "node-expand": (data, node, nodeInstance) => data && node,
  48615. check: (data, checkedInfo) => data && checkedInfo,
  48616. "node-drag-start": (node, evt) => node && evt,
  48617. "node-drag-end": (draggingNode, dropNode, dropType, evt) => draggingNode && evt,
  48618. "node-drop": (draggingNode, dropNode, dropType, evt) => draggingNode && dropNode && evt,
  48619. "node-drag-leave": (draggingNode, oldDropNode, evt) => draggingNode && oldDropNode && evt,
  48620. "node-drag-enter": (draggingNode, dropNode, evt) => draggingNode && dropNode && evt,
  48621. "node-drag-over": (draggingNode, dropNode, evt) => draggingNode && dropNode && evt
  48622. };
  48623. //#endregion
  48624. //#region ../../packages/components/tree/src/tree.vue?vue&type=script&lang.ts
  48625. var tree_vue_vue_type_script_lang_default = defineComponent({
  48626. name: "ElTree",
  48627. components: { ElTreeNode: tree_node_default$1 },
  48628. props: treeProps,
  48629. emits: treeEmits,
  48630. setup(props, ctx) {
  48631. const { t } = useLocale();
  48632. const ns = useNamespace("tree");
  48633. const store = ref(new TreeStore({
  48634. key: props.nodeKey,
  48635. data: props.data,
  48636. lazy: props.lazy,
  48637. props: props.props,
  48638. load: props.load,
  48639. currentNodeKey: props.currentNodeKey,
  48640. checkStrictly: props.checkStrictly,
  48641. checkDescendants: props.checkDescendants,
  48642. defaultCheckedKeys: props.defaultCheckedKeys,
  48643. defaultExpandedKeys: props.defaultExpandedKeys,
  48644. autoExpandParent: props.autoExpandParent,
  48645. defaultExpandAll: props.defaultExpandAll,
  48646. filterNodeMethod: props.filterNodeMethod
  48647. }));
  48648. store.value.initialize();
  48649. const root = ref(store.value.root);
  48650. const currentNode = ref(null);
  48651. const el$ = ref(null);
  48652. const dropIndicator$ = ref(null);
  48653. const { broadcastExpanded } = useNodeExpandEventBroadcast(props);
  48654. const { dragState } = useDragNodeHandler({
  48655. props,
  48656. ctx,
  48657. el$,
  48658. dropIndicator$,
  48659. store
  48660. });
  48661. useKeydown({ el$ }, store);
  48662. const instance = getCurrentInstance();
  48663. const isSelectTree = computed(() => {
  48664. let parent = instance?.parent;
  48665. while (parent) {
  48666. if (parent.type.name === "ElTreeSelect") return true;
  48667. parent = parent.parent;
  48668. }
  48669. return false;
  48670. });
  48671. const isEmpty = computed(() => {
  48672. const { childNodes } = root.value;
  48673. return (!childNodes || childNodes.length === 0 || childNodes.every(({ visible }) => !visible)) && !isSelectTree.value;
  48674. });
  48675. watch(() => props.currentNodeKey, (newVal) => {
  48676. store.value.setCurrentNodeKey(newVal ?? null);
  48677. });
  48678. watch(() => props.defaultCheckedKeys, (newVal, oldVal) => {
  48679. if (isEqual$1(newVal, oldVal)) return;
  48680. store.value.setDefaultCheckedKey(newVal ?? []);
  48681. });
  48682. watch(() => props.defaultExpandedKeys, (newVal) => {
  48683. store.value.setDefaultExpandedKeys(newVal ?? []);
  48684. });
  48685. watch(() => props.data, (newVal) => {
  48686. store.value.setData(newVal);
  48687. }, { deep: true });
  48688. watch(() => props.checkStrictly, (newVal) => {
  48689. store.value.checkStrictly = newVal;
  48690. });
  48691. const filter = (value) => {
  48692. if (!props.filterNodeMethod) throw new Error("[Tree] filterNodeMethod is required when filter");
  48693. store.value.filter(value);
  48694. };
  48695. const getNodeKey$1 = (node) => {
  48696. return props.nodeKey ? getNodeKey(props.nodeKey, node.data) : node.id;
  48697. };
  48698. const requireNodeKey = (methodName) => {
  48699. if (!props.nodeKey) throw new Error(`[Tree] nodeKey is required in ${methodName}`);
  48700. };
  48701. const getNodePath = (data) => {
  48702. requireNodeKey("getNodePath");
  48703. const node = store.value.getNode(data);
  48704. if (!node) return [];
  48705. const path = [node.data];
  48706. let parent = node.parent;
  48707. while (parent && parent !== root.value) {
  48708. path.push(parent.data);
  48709. parent = parent.parent;
  48710. }
  48711. return path.reverse();
  48712. };
  48713. const getCheckedNodes = (leafOnly, includeHalfChecked) => {
  48714. return store.value.getCheckedNodes(leafOnly, includeHalfChecked);
  48715. };
  48716. const getCheckedKeys = (leafOnly) => {
  48717. return store.value.getCheckedKeys(leafOnly);
  48718. };
  48719. const getCurrentNode = () => {
  48720. const currentNode = store.value.getCurrentNode();
  48721. return currentNode ? currentNode.data : null;
  48722. };
  48723. const getCurrentKey = () => {
  48724. requireNodeKey("getCurrentKey");
  48725. const currentNode = getCurrentNode();
  48726. return currentNode ? currentNode[props.nodeKey] : null;
  48727. };
  48728. const setCheckedNodes = (nodes, leafOnly) => {
  48729. requireNodeKey("setCheckedNodes");
  48730. store.value.setCheckedNodes(nodes, leafOnly);
  48731. };
  48732. const setCheckedKeys = (keys, leafOnly) => {
  48733. requireNodeKey("setCheckedKeys");
  48734. store.value.setCheckedKeys(keys, leafOnly);
  48735. };
  48736. const setChecked = (data, checked, deep = false) => {
  48737. store.value.setChecked(data, checked, deep);
  48738. };
  48739. const getHalfCheckedNodes = () => {
  48740. return store.value.getHalfCheckedNodes();
  48741. };
  48742. const getHalfCheckedKeys = () => {
  48743. return store.value.getHalfCheckedKeys();
  48744. };
  48745. const setCurrentNode = (node, shouldAutoExpandParent = true) => {
  48746. requireNodeKey("setCurrentNode");
  48747. handleCurrentChange(store, ctx.emit, () => {
  48748. broadcastExpanded(node);
  48749. store.value.setUserCurrentNode(node, shouldAutoExpandParent);
  48750. });
  48751. };
  48752. const setCurrentKey = (key = null, shouldAutoExpandParent = true) => {
  48753. requireNodeKey("setCurrentKey");
  48754. handleCurrentChange(store, ctx.emit, () => {
  48755. broadcastExpanded();
  48756. store.value.setCurrentNodeKey(key, shouldAutoExpandParent);
  48757. });
  48758. };
  48759. const getNode = (data) => {
  48760. return store.value.getNode(data);
  48761. };
  48762. const remove = (data) => {
  48763. store.value.remove(data);
  48764. };
  48765. const append = (data, parentNode) => {
  48766. store.value.append(data, parentNode);
  48767. };
  48768. const insertBefore = (data, refNode) => {
  48769. store.value.insertBefore(data, refNode);
  48770. };
  48771. const insertAfter = (data, refNode) => {
  48772. store.value.insertAfter(data, refNode);
  48773. };
  48774. const handleNodeExpand = (nodeData, node, instance) => {
  48775. broadcastExpanded(node);
  48776. ctx.emit("node-expand", nodeData, node, instance);
  48777. };
  48778. const updateKeyChildren = (key, data) => {
  48779. requireNodeKey("updateKeyChildren");
  48780. store.value.updateChildren(key, data);
  48781. };
  48782. provide(ROOT_TREE_INJECTION_KEY, {
  48783. ctx,
  48784. props,
  48785. store,
  48786. root,
  48787. currentNode,
  48788. instance
  48789. });
  48790. provide(formItemContextKey, void 0);
  48791. return {
  48792. ns,
  48793. store,
  48794. root,
  48795. currentNode,
  48796. dragState,
  48797. el$,
  48798. dropIndicator$,
  48799. isEmpty,
  48800. filter,
  48801. getNodeKey: getNodeKey$1,
  48802. getNodePath,
  48803. getCheckedNodes,
  48804. getCheckedKeys,
  48805. getCurrentNode,
  48806. getCurrentKey,
  48807. setCheckedNodes,
  48808. setCheckedKeys,
  48809. setChecked,
  48810. getHalfCheckedNodes,
  48811. getHalfCheckedKeys,
  48812. setCurrentNode,
  48813. setCurrentKey,
  48814. t,
  48815. getNode,
  48816. remove,
  48817. append,
  48818. insertBefore,
  48819. insertAfter,
  48820. handleNodeExpand,
  48821. updateKeyChildren
  48822. };
  48823. }
  48824. });
  48825. //#endregion
  48826. //#region ../../packages/components/tree/src/tree.vue
  48827. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  48828. const _component_el_tree_node = resolveComponent("el-tree-node");
  48829. return openBlock(), createElementBlock("div", {
  48830. ref: "el$",
  48831. class: normalizeClass([
  48832. _ctx.ns.b(),
  48833. _ctx.ns.is("dragging", !!_ctx.dragState.draggingNode),
  48834. _ctx.ns.is("drop-not-allow", !_ctx.dragState.allowDrop),
  48835. _ctx.ns.is("drop-inner", _ctx.dragState.dropType === "inner"),
  48836. { [_ctx.ns.m("highlight-current")]: _ctx.highlightCurrent }
  48837. ]),
  48838. role: "tree"
  48839. }, [
  48840. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.root.childNodes, (child) => {
  48841. return openBlock(), createBlock(_component_el_tree_node, {
  48842. key: _ctx.getNodeKey(child),
  48843. node: child,
  48844. props: _ctx.props,
  48845. accordion: _ctx.accordion,
  48846. "render-after-expand": _ctx.renderAfterExpand,
  48847. "show-checkbox": _ctx.showCheckbox,
  48848. "render-content": _ctx.renderContent,
  48849. onNodeExpand: _ctx.handleNodeExpand
  48850. }, null, 8, [
  48851. "node",
  48852. "props",
  48853. "accordion",
  48854. "render-after-expand",
  48855. "show-checkbox",
  48856. "render-content",
  48857. "onNodeExpand"
  48858. ]);
  48859. }), 128)),
  48860. _ctx.isEmpty ? (openBlock(), createElementBlock("div", {
  48861. key: 0,
  48862. class: normalizeClass(_ctx.ns.e("empty-block"))
  48863. }, [renderSlot(_ctx.$slots, "empty", {}, () => [createElementVNode("span", { class: normalizeClass(_ctx.ns.e("empty-text")) }, toDisplayString(_ctx.emptyText ?? _ctx.t("el.tree.emptyText")), 3)])], 2)) : createCommentVNode("v-if", true),
  48864. withDirectives(createElementVNode("div", {
  48865. ref: "dropIndicator$",
  48866. class: normalizeClass(_ctx.ns.e("drop-indicator"))
  48867. }, null, 2), [[vShow, _ctx.dragState.showDropIndicator]])
  48868. ], 2);
  48869. }
  48870. var tree_default$1 = /* @__PURE__ */ _plugin_vue_export_helper_default(tree_vue_vue_type_script_lang_default, [["render", _sfc_render$1]]);
  48871. //#endregion
  48872. //#region ../../packages/components/tree/index.ts
  48873. const ElTree = withInstall(tree_default$1);
  48874. //#endregion
  48875. //#region ../../packages/components/tree-select/src/select.ts
  48876. const useSelect = (props, { attrs, emit }, { select, tree, key }) => {
  48877. const ns = useNamespace("tree-select");
  48878. watch(() => props.data, () => {
  48879. if (props.filterable) nextTick(() => {
  48880. tree.value?.filter(select.value?.states.inputValue);
  48881. });
  48882. }, { flush: "post" });
  48883. const focusLastNode = (listNode) => {
  48884. const lastNode = listNode.at(-1);
  48885. if (lastNode.expanded && lastNode.childNodes.at(-1)) focusLastNode([lastNode.childNodes.at(-1)]);
  48886. else {
  48887. (tree.value.el$?.querySelector(`[data-key="${listNode.at(-1).key}"]`))?.focus({ preventScroll: true });
  48888. return;
  48889. }
  48890. };
  48891. onMounted(() => {
  48892. useEventListener(() => select.value?.$el, "keydown", async (evt) => {
  48893. const code = getEventCode(evt);
  48894. const { dropdownMenuVisible } = select.value;
  48895. if ([EVENT_CODE.down, EVENT_CODE.up].includes(code) && dropdownMenuVisible) {
  48896. await nextTick();
  48897. setTimeout(() => {
  48898. if (EVENT_CODE.up === code) {
  48899. const listNode = tree.value.store.root.childNodes;
  48900. focusLastNode(listNode);
  48901. return;
  48902. }
  48903. select.value.optionsArray[select.value.states.hoveringIndex].$el?.parentNode?.parentNode?.focus({ preventScroll: true });
  48904. });
  48905. }
  48906. }, { capture: true });
  48907. });
  48908. return {
  48909. ...pick(toRefs(props), Object.keys(ElSelect.props)),
  48910. ...attrs,
  48911. class: computed(() => attrs.class),
  48912. style: computed(() => attrs.style),
  48913. "onUpdate:modelValue": (value) => emit(UPDATE_MODEL_EVENT, value),
  48914. valueKey: key,
  48915. popperClass: computed(() => {
  48916. const classes = [ns.e("popper")];
  48917. if (props.popperClass) classes.push(props.popperClass);
  48918. return classes.join(" ");
  48919. }),
  48920. filterMethod: (keyword = "") => {
  48921. if (props.filterMethod) props.filterMethod(keyword);
  48922. else if (props.remoteMethod) props.remoteMethod(keyword);
  48923. else tree.value?.filter(keyword);
  48924. }
  48925. };
  48926. };
  48927. //#endregion
  48928. //#region ../../packages/components/tree-select/src/tree-select-option.ts
  48929. const component = defineComponent({
  48930. extends: ElOption,
  48931. setup(props, ctx) {
  48932. const result = ElOption.setup(props, ctx);
  48933. delete result.selectOptionClick;
  48934. const vm = getCurrentInstance().proxy;
  48935. nextTick(() => {
  48936. if (!result.select.states.cachedOptions.get(vm.value)) result.select.onOptionCreate(vm);
  48937. });
  48938. watch(() => ctx.attrs.visible, (val) => {
  48939. nextTick(() => {
  48940. result.states.visible = val;
  48941. });
  48942. }, { immediate: true });
  48943. return result;
  48944. },
  48945. methods: { selectOptionClick() {
  48946. this.$el.parentElement.click();
  48947. } }
  48948. });
  48949. //#endregion
  48950. //#region ../../packages/components/tree-select/src/utils.ts
  48951. function isValidValue(val) {
  48952. return val || val === 0;
  48953. }
  48954. function isValidArray(val) {
  48955. return isArray$1(val) && val.length;
  48956. }
  48957. function toValidArray(val) {
  48958. return isArray$1(val) ? val : isValidValue(val) ? [val] : [];
  48959. }
  48960. function treeFind(treeData, findCallback, getChildren, resultCallback, parent) {
  48961. for (let i = 0; i < treeData.length; i++) {
  48962. const data = treeData[i];
  48963. if (findCallback(data, i, treeData, parent)) return resultCallback ? resultCallback(data, i, treeData, parent) : data;
  48964. else {
  48965. const children = getChildren(data);
  48966. if (isValidArray(children)) {
  48967. const find = treeFind(children, findCallback, getChildren, resultCallback, data);
  48968. if (find) return find;
  48969. }
  48970. }
  48971. }
  48972. }
  48973. function treeEach(treeData, callback, getChildren, parent) {
  48974. for (let i = 0; i < treeData.length; i++) {
  48975. const data = treeData[i];
  48976. callback(data, i, treeData, parent);
  48977. const children = getChildren(data);
  48978. if (isValidArray(children)) treeEach(children, callback, getChildren, data);
  48979. }
  48980. }
  48981. //#endregion
  48982. //#region ../../packages/components/tree-select/src/tree.ts
  48983. const useTree$1 = (props, { attrs, slots, emit }, { select, tree, key }) => {
  48984. watch([() => props.modelValue, tree], () => {
  48985. if (props.showCheckbox) nextTick(() => {
  48986. const treeInstance = tree.value;
  48987. if (treeInstance && !isEqual$1(treeInstance.getCheckedKeys(), toValidArray(props.modelValue))) treeInstance.setCheckedKeys(toValidArray(props.modelValue));
  48988. });
  48989. }, {
  48990. immediate: true,
  48991. deep: true
  48992. });
  48993. const propsMap = computed(() => ({
  48994. value: key.value,
  48995. label: "label",
  48996. children: "children",
  48997. disabled: "disabled",
  48998. isLeaf: "isLeaf",
  48999. ...props.props
  49000. }));
  49001. const getNodeValByProp = (prop, data) => {
  49002. const propVal = propsMap.value[prop];
  49003. if (isFunction$1(propVal)) return propVal(data, tree.value?.getNode(getNodeValByProp("value", data)));
  49004. else return data[propVal];
  49005. };
  49006. const defaultExpandedParentKeys = toValidArray(props.modelValue).map((value) => {
  49007. return treeFind(props.data || [], (data) => getNodeValByProp("value", data) === value, (data) => getNodeValByProp("children", data), (data, index, array, parent) => parent && getNodeValByProp("value", parent));
  49008. }).filter((item) => isValidValue(item));
  49009. const cacheOptions = computed(() => {
  49010. if (!props.renderAfterExpand && !props.lazy) return [];
  49011. const options = [];
  49012. treeEach(props.data.concat(props.cacheData), (node) => {
  49013. const value = getNodeValByProp("value", node);
  49014. options.push({
  49015. value,
  49016. currentLabel: getNodeValByProp("label", node),
  49017. isDisabled: getNodeValByProp("disabled", node)
  49018. });
  49019. }, (data) => getNodeValByProp("children", data));
  49020. return options;
  49021. });
  49022. const getChildCheckedKeys = () => {
  49023. return tree.value?.getCheckedKeys().filter((checkedKey) => {
  49024. const node = tree.value?.getNode(checkedKey);
  49025. return !isNil(node) && isEmpty(node.childNodes);
  49026. });
  49027. };
  49028. const emitChange = (val) => {
  49029. if (!isEqual$1(props.modelValue, val)) emit(CHANGE_EVENT, val);
  49030. };
  49031. function update(val) {
  49032. emit(UPDATE_MODEL_EVENT, val);
  49033. emitChange(val);
  49034. }
  49035. return {
  49036. ...pick(toRefs(props), Object.keys(ElTree.props)),
  49037. ...attrs,
  49038. nodeKey: key,
  49039. expandOnClickNode: computed(() => {
  49040. return !props.checkStrictly && props.expandOnClickNode;
  49041. }),
  49042. defaultExpandedKeys: computed(() => {
  49043. return props.defaultExpandedKeys ? props.defaultExpandedKeys.concat(defaultExpandedParentKeys) : defaultExpandedParentKeys;
  49044. }),
  49045. renderContent: (h, { node, data, store }) => {
  49046. return h(component, {
  49047. value: getNodeValByProp("value", data),
  49048. label: getNodeValByProp("label", data),
  49049. disabled: getNodeValByProp("disabled", data),
  49050. visible: node.visible
  49051. }, props.renderContent ? () => props.renderContent(h, {
  49052. node,
  49053. data,
  49054. store
  49055. }) : slots.default ? () => slots.default({
  49056. node,
  49057. data,
  49058. store
  49059. }) : void 0);
  49060. },
  49061. filterNodeMethod: (value, data, node) => {
  49062. if (props.filterNodeMethod) return props.filterNodeMethod(value, data, node);
  49063. if (!value) return true;
  49064. return new RegExp(escapeStringRegexp(value), "i").test(getNodeValByProp("label", data) || "");
  49065. },
  49066. onNodeClick: (data, node, e) => {
  49067. attrs.onNodeClick?.(data, node, e);
  49068. if (props.showCheckbox && props.checkOnClickNode) return;
  49069. if (!props.showCheckbox && (props.checkStrictly || node.isLeaf)) {
  49070. if (!getNodeValByProp("disabled", data)) {
  49071. const option = select.value?.states.options.get(getNodeValByProp("value", data));
  49072. select.value?.handleOptionSelect(option);
  49073. }
  49074. } else if (props.expandOnClickNode) e.proxy.handleExpandIconClick();
  49075. },
  49076. onCheck: (data, params) => {
  49077. if (!props.showCheckbox) return;
  49078. const dataValue = getNodeValByProp("value", data);
  49079. const dataMap = {};
  49080. treeEach([tree.value.store.root], (node) => dataMap[node.key] = node, (node) => node.childNodes);
  49081. const uncachedCheckedKeys = params.checkedKeys;
  49082. const cachedKeys = props.multiple ? toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item)) : [];
  49083. const checkedKeys = cachedKeys.concat(uncachedCheckedKeys);
  49084. if (props.checkStrictly) update(props.multiple ? checkedKeys : checkedKeys.includes(dataValue) ? dataValue : void 0);
  49085. else if (props.multiple) {
  49086. const childKeys = getChildCheckedKeys();
  49087. update(cachedKeys.concat(childKeys));
  49088. } else {
  49089. const firstLeaf = treeFind([data], (data) => !isValidArray(getNodeValByProp("children", data)) && !getNodeValByProp("disabled", data), (data) => getNodeValByProp("children", data));
  49090. const firstLeafKey = firstLeaf ? getNodeValByProp("value", firstLeaf) : void 0;
  49091. const hasCheckedChild = isValidValue(props.modelValue) && !!treeFind([data], (data) => getNodeValByProp("value", data) === props.modelValue, (data) => getNodeValByProp("children", data));
  49092. update(firstLeafKey === props.modelValue || hasCheckedChild ? void 0 : firstLeafKey);
  49093. }
  49094. nextTick(() => {
  49095. const checkedKeys = toValidArray(props.modelValue);
  49096. tree.value.setCheckedKeys(checkedKeys);
  49097. attrs.onCheck?.(data, {
  49098. checkedKeys: tree.value.getCheckedKeys(),
  49099. checkedNodes: tree.value.getCheckedNodes(),
  49100. halfCheckedKeys: tree.value.getHalfCheckedKeys(),
  49101. halfCheckedNodes: tree.value.getHalfCheckedNodes()
  49102. });
  49103. });
  49104. select.value?.focus();
  49105. },
  49106. onNodeExpand: (data, node, e) => {
  49107. attrs.onNodeExpand?.(data, node, e);
  49108. nextTick(() => {
  49109. if (!props.checkStrictly && props.lazy && props.multiple && node.checked) {
  49110. const dataMap = {};
  49111. const uncachedCheckedKeys = tree.value.getCheckedKeys();
  49112. treeEach([tree.value.store.root], (node) => dataMap[node.key] = node, (node) => node.childNodes);
  49113. const cachedKeys = toValidArray(props.modelValue).filter((item) => !(item in dataMap) && !uncachedCheckedKeys.includes(item));
  49114. const childKeys = getChildCheckedKeys();
  49115. update(cachedKeys.concat(childKeys));
  49116. }
  49117. });
  49118. },
  49119. cacheOptions
  49120. };
  49121. };
  49122. //#endregion
  49123. //#region ../../packages/components/tree-select/src/cache-options.ts
  49124. var cache_options_default = defineComponent({
  49125. props: { data: {
  49126. type: Array,
  49127. default: () => []
  49128. } },
  49129. setup(props) {
  49130. const select = inject(selectKey);
  49131. watch(() => props.data, () => {
  49132. props.data.forEach((item) => {
  49133. if (!select.states.cachedOptions.has(item.value)) select.states.cachedOptions.set(item.value, item);
  49134. });
  49135. const inputs = select.selectRef?.querySelectorAll("input") || [];
  49136. if (isClient && !Array.from(inputs).includes(document.activeElement)) select.setSelected();
  49137. }, {
  49138. flush: "post",
  49139. immediate: true
  49140. });
  49141. return () => void 0;
  49142. }
  49143. });
  49144. //#endregion
  49145. //#region ../../packages/components/tree-select/src/tree-select.vue?vue&type=script&lang.ts
  49146. var tree_select_vue_vue_type_script_lang_default = defineComponent({
  49147. name: "ElTreeSelect",
  49148. inheritAttrs: false,
  49149. props: {
  49150. ...selectProps,
  49151. ...treeProps,
  49152. cacheData: {
  49153. type: Array,
  49154. default: () => []
  49155. }
  49156. },
  49157. setup(props, context) {
  49158. const { slots, expose, emit, attrs } = context;
  49159. const childAttrs = {
  49160. ...attrs,
  49161. onChange: void 0
  49162. };
  49163. const select = ref();
  49164. const tree = ref();
  49165. const key = computed(() => props.nodeKey || props.valueKey || "value");
  49166. const selectProps = useSelect(props, {
  49167. attrs,
  49168. emit
  49169. }, {
  49170. select,
  49171. tree,
  49172. key
  49173. });
  49174. const { cacheOptions, ...treeProps } = useTree$1(props, {
  49175. attrs: childAttrs,
  49176. slots,
  49177. emit
  49178. }, {
  49179. select,
  49180. tree,
  49181. key
  49182. });
  49183. const methods = reactive({});
  49184. expose(methods);
  49185. onMounted(() => {
  49186. Object.assign(methods, {
  49187. ...pick(tree.value, [
  49188. "filter",
  49189. "updateKeyChildren",
  49190. "getCheckedNodes",
  49191. "setCheckedNodes",
  49192. "getCheckedKeys",
  49193. "setCheckedKeys",
  49194. "setChecked",
  49195. "getHalfCheckedNodes",
  49196. "getHalfCheckedKeys",
  49197. "getCurrentKey",
  49198. "getCurrentNode",
  49199. "setCurrentKey",
  49200. "setCurrentNode",
  49201. "getNode",
  49202. "remove",
  49203. "append",
  49204. "insertBefore",
  49205. "insertAfter"
  49206. ]),
  49207. ...pick(select.value, [
  49208. "focus",
  49209. "blur",
  49210. "selectedLabel"
  49211. ]),
  49212. treeRef: tree.value,
  49213. selectRef: select.value
  49214. });
  49215. });
  49216. return () => h(ElSelect, reactive({
  49217. ...selectProps,
  49218. ref: (ref) => select.value = ref
  49219. }), {
  49220. ...slots,
  49221. default: () => [h(cache_options_default, { data: cacheOptions.value }), h(ElTree, reactive({
  49222. ...treeProps,
  49223. ref: (ref) => tree.value = ref
  49224. }))]
  49225. });
  49226. }
  49227. });
  49228. //#endregion
  49229. //#region ../../packages/components/tree-select/src/tree-select.vue
  49230. var tree_select_default = tree_select_vue_vue_type_script_lang_default;
  49231. //#endregion
  49232. //#region ../../packages/components/tree-select/index.ts
  49233. const ElTreeSelect = withInstall(tree_select_default);
  49234. //#endregion
  49235. //#region ../../packages/components/tree-v2/src/virtual-tree.ts
  49236. const ROOT_TREE_INJECTION_KEY$1 = Symbol();
  49237. const EMPTY_NODE = {
  49238. key: -1,
  49239. level: -1,
  49240. data: {}
  49241. };
  49242. const itemSize = {
  49243. type: Number,
  49244. default: 26
  49245. };
  49246. const treeProps$1 = buildProps({
  49247. data: {
  49248. type: definePropType(Array),
  49249. default: () => mutable([])
  49250. },
  49251. emptyText: { type: String },
  49252. height: {
  49253. type: Number,
  49254. default: 200
  49255. },
  49256. props: {
  49257. type: definePropType(Object),
  49258. default: () => mutable({
  49259. children: "children",
  49260. label: "label",
  49261. disabled: "disabled",
  49262. value: "id",
  49263. class: ""
  49264. })
  49265. },
  49266. highlightCurrent: Boolean,
  49267. showCheckbox: Boolean,
  49268. defaultCheckedKeys: {
  49269. type: definePropType(Array),
  49270. default: () => mutable([])
  49271. },
  49272. checkStrictly: Boolean,
  49273. defaultExpandedKeys: {
  49274. type: definePropType(Array),
  49275. default: () => mutable([])
  49276. },
  49277. indent: {
  49278. type: Number,
  49279. default: 16
  49280. },
  49281. itemSize,
  49282. icon: { type: iconPropType },
  49283. expandOnClickNode: {
  49284. type: Boolean,
  49285. default: true
  49286. },
  49287. checkOnClickNode: Boolean,
  49288. checkOnClickLeaf: {
  49289. type: Boolean,
  49290. default: true
  49291. },
  49292. currentNodeKey: { type: definePropType([String, Number]) },
  49293. accordion: Boolean,
  49294. filterMethod: { type: definePropType(Function) },
  49295. perfMode: {
  49296. type: Boolean,
  49297. default: true
  49298. },
  49299. scrollbarAlwaysOn: Boolean
  49300. });
  49301. const treeNodeProps = buildProps({
  49302. node: {
  49303. type: definePropType(Object),
  49304. default: () => mutable(EMPTY_NODE)
  49305. },
  49306. expanded: Boolean,
  49307. checked: Boolean,
  49308. indeterminate: Boolean,
  49309. showCheckbox: Boolean,
  49310. disabled: Boolean,
  49311. current: Boolean,
  49312. hiddenExpandIcon: Boolean,
  49313. itemSize
  49314. });
  49315. const treeNodeContentProps = buildProps({ node: {
  49316. type: definePropType(Object),
  49317. required: true
  49318. } });
  49319. const NODE_CLICK = "node-click";
  49320. const NODE_DROP = "node-drop";
  49321. const NODE_EXPAND = "node-expand";
  49322. const NODE_COLLAPSE = "node-collapse";
  49323. const CURRENT_CHANGE = "current-change";
  49324. const NODE_CHECK = "check";
  49325. const NODE_CHECK_CHANGE = "check-change";
  49326. const NODE_CONTEXTMENU = "node-contextmenu";
  49327. const treeEmits$1 = {
  49328. [NODE_CLICK]: (data, node, e) => data && node && e,
  49329. [NODE_DROP]: (data, node, e) => data && node && e,
  49330. [NODE_EXPAND]: (data, node) => data && node,
  49331. [NODE_COLLAPSE]: (data, node) => data && node,
  49332. [CURRENT_CHANGE]: (data, node) => data && node,
  49333. [NODE_CHECK]: (data, checkedInfo) => data && checkedInfo,
  49334. [NODE_CHECK_CHANGE]: (data, checked) => data && isBoolean(checked),
  49335. [NODE_CONTEXTMENU]: (evt, data, node) => evt && data && node
  49336. };
  49337. const treeNodeEmits = {
  49338. click: (node, e) => !!(node && e),
  49339. drop: (node, e) => !!(node && e),
  49340. toggle: (node) => !!node,
  49341. check: (node, checked) => node && isBoolean(checked)
  49342. };
  49343. //#endregion
  49344. //#region ../../packages/components/tree-v2/src/composables/useCheck.ts
  49345. function useCheck(props, tree) {
  49346. const checkedKeys = ref(/* @__PURE__ */ new Set());
  49347. const indeterminateKeys = ref(/* @__PURE__ */ new Set());
  49348. const { emit } = getCurrentInstance();
  49349. watch([() => tree.value, () => props.defaultCheckedKeys], () => {
  49350. return nextTick(() => {
  49351. _setCheckedKeys(props.defaultCheckedKeys);
  49352. });
  49353. }, { immediate: true });
  49354. const updateCheckedKeys = (deep = false) => {
  49355. if (!tree.value || !props.showCheckbox || props.checkStrictly && !deep) return;
  49356. const { levelTreeNodeMap, maxLevel } = tree.value;
  49357. const checkedKeySet = checkedKeys.value;
  49358. const indeterminateKeySet = /* @__PURE__ */ new Set();
  49359. for (let level = maxLevel; level >= 1; --level) {
  49360. const nodes = levelTreeNodeMap.get(level);
  49361. if (!nodes) continue;
  49362. nodes.forEach((node) => {
  49363. const children = node.children;
  49364. let isEffectivelyChecked = !node.isLeaf || node.disabled || checkedKeySet.has(node.key);
  49365. if (children) {
  49366. let allChecked = true;
  49367. let hasChecked = false;
  49368. for (const childNode of children) {
  49369. const key = childNode.key;
  49370. if (!childNode.isEffectivelyChecked) isEffectivelyChecked = false;
  49371. if (checkedKeySet.has(key)) hasChecked = true;
  49372. else if (indeterminateKeySet.has(key)) {
  49373. allChecked = false;
  49374. hasChecked = true;
  49375. break;
  49376. } else allChecked = false;
  49377. }
  49378. if (allChecked) checkedKeySet.add(node.key);
  49379. else if (hasChecked) {
  49380. indeterminateKeySet.add(node.key);
  49381. checkedKeySet.delete(node.key);
  49382. } else {
  49383. checkedKeySet.delete(node.key);
  49384. indeterminateKeySet.delete(node.key);
  49385. }
  49386. }
  49387. node.isEffectivelyChecked = isEffectivelyChecked;
  49388. });
  49389. }
  49390. indeterminateKeys.value = indeterminateKeySet;
  49391. };
  49392. const isChecked = (node) => checkedKeys.value.has(node.key);
  49393. const isIndeterminate = (node) => indeterminateKeys.value.has(node.key);
  49394. const toggleCheckbox = (node, isChecked, nodeClick = true, immediateUpdate = true, deep = false) => {
  49395. const checkedKeySet = checkedKeys.value;
  49396. const children = node.children;
  49397. if ((!props.checkStrictly || deep) && nodeClick && children?.length) isChecked = children.some((node) => !node.isEffectivelyChecked);
  49398. const toggle = (node, checked) => {
  49399. checkedKeySet[checked ? "add" : "delete"](node.key);
  49400. const children = node.children;
  49401. if ((!props.checkStrictly || deep) && children) children.forEach((childNode) => {
  49402. if (!childNode.disabled || childNode.children) toggle(childNode, checked);
  49403. });
  49404. };
  49405. toggle(node, isChecked);
  49406. if (immediateUpdate) updateCheckedKeys();
  49407. if (nodeClick) afterNodeCheck(node, isChecked);
  49408. };
  49409. const afterNodeCheck = (node, checked) => {
  49410. const { checkedNodes, checkedKeys } = getChecked();
  49411. const { halfCheckedNodes, halfCheckedKeys } = getHalfChecked();
  49412. emit(NODE_CHECK, node.data, {
  49413. checkedKeys,
  49414. checkedNodes,
  49415. halfCheckedKeys,
  49416. halfCheckedNodes
  49417. });
  49418. emit(NODE_CHECK_CHANGE, node.data, checked);
  49419. };
  49420. function getCheckedKeys(leafOnly = false) {
  49421. return getChecked(leafOnly).checkedKeys;
  49422. }
  49423. function getCheckedNodes(leafOnly = false) {
  49424. return getChecked(leafOnly).checkedNodes;
  49425. }
  49426. function getHalfCheckedKeys() {
  49427. return getHalfChecked().halfCheckedKeys;
  49428. }
  49429. function getHalfCheckedNodes() {
  49430. return getHalfChecked().halfCheckedNodes;
  49431. }
  49432. function getChecked(leafOnly = false) {
  49433. const checkedNodes = [];
  49434. const keys = [];
  49435. if (tree?.value && props.showCheckbox) {
  49436. const { treeNodeMap } = tree.value;
  49437. checkedKeys.value.forEach((key) => {
  49438. const node = treeNodeMap.get(key);
  49439. if (node && (!leafOnly || leafOnly && node.isLeaf)) {
  49440. keys.push(key);
  49441. checkedNodes.push(node.data);
  49442. }
  49443. });
  49444. }
  49445. return {
  49446. checkedKeys: keys,
  49447. checkedNodes
  49448. };
  49449. }
  49450. function getHalfChecked() {
  49451. const halfCheckedNodes = [];
  49452. const halfCheckedKeys = [];
  49453. if (tree?.value && props.showCheckbox) {
  49454. const { treeNodeMap } = tree.value;
  49455. indeterminateKeys.value.forEach((key) => {
  49456. const node = treeNodeMap.get(key);
  49457. if (node) {
  49458. halfCheckedKeys.push(key);
  49459. halfCheckedNodes.push(node.data);
  49460. }
  49461. });
  49462. }
  49463. return {
  49464. halfCheckedNodes,
  49465. halfCheckedKeys
  49466. };
  49467. }
  49468. function setCheckedKeys(keys) {
  49469. checkedKeys.value.clear();
  49470. indeterminateKeys.value.clear();
  49471. nextTick(() => {
  49472. _setCheckedKeys(keys);
  49473. });
  49474. }
  49475. function setChecked(key, isChecked, deep) {
  49476. if (tree?.value && props.showCheckbox) {
  49477. const node = tree.value.treeNodeMap.get(key);
  49478. if (node) toggleCheckbox(node, isChecked, false, void 0, deep);
  49479. }
  49480. }
  49481. function _setCheckedKeys(keys) {
  49482. if (tree?.value) {
  49483. const { treeNodeMap } = tree.value;
  49484. if (props.showCheckbox && treeNodeMap && keys?.length > 0) {
  49485. for (const key of keys) {
  49486. const node = treeNodeMap.get(key);
  49487. if (node && !isChecked(node)) toggleCheckbox(node, true, false, false);
  49488. }
  49489. updateCheckedKeys();
  49490. }
  49491. }
  49492. }
  49493. return {
  49494. updateCheckedKeys,
  49495. toggleCheckbox,
  49496. isChecked,
  49497. isIndeterminate,
  49498. getCheckedKeys,
  49499. getCheckedNodes,
  49500. getHalfCheckedKeys,
  49501. getHalfCheckedNodes,
  49502. setChecked,
  49503. setCheckedKeys
  49504. };
  49505. }
  49506. //#endregion
  49507. //#region ../../packages/components/tree-v2/src/composables/useFilter.ts
  49508. function useFilter(props, tree) {
  49509. const hiddenNodeKeySet = ref(/* @__PURE__ */ new Set([]));
  49510. const hiddenExpandIconKeySet = ref(/* @__PURE__ */ new Set([]));
  49511. const filterable = computed(() => {
  49512. return isFunction$1(props.filterMethod);
  49513. });
  49514. function doFilter(query) {
  49515. if (!filterable.value) return;
  49516. const expandKeySet = /* @__PURE__ */ new Set();
  49517. const hiddenExpandIconKeys = hiddenExpandIconKeySet.value;
  49518. const hiddenKeys = hiddenNodeKeySet.value;
  49519. const family = [];
  49520. const nodes = tree.value?.treeNodes || [];
  49521. const filter = props.filterMethod;
  49522. hiddenKeys.clear();
  49523. function traverse(nodes) {
  49524. nodes.forEach((node) => {
  49525. family.push(node);
  49526. if (filter?.(query, node.data, node)) family.forEach((member) => {
  49527. expandKeySet.add(member.key);
  49528. member.expanded = true;
  49529. });
  49530. else {
  49531. node.expanded = false;
  49532. if (node.isLeaf) hiddenKeys.add(node.key);
  49533. }
  49534. const children = node.children;
  49535. if (children) traverse(children);
  49536. if (!node.isLeaf) {
  49537. if (!expandKeySet.has(node.key)) hiddenKeys.add(node.key);
  49538. else if (children) {
  49539. let allHidden = true;
  49540. for (const childNode of children) if (!hiddenKeys.has(childNode.key)) {
  49541. allHidden = false;
  49542. break;
  49543. }
  49544. if (allHidden) hiddenExpandIconKeys.add(node.key);
  49545. else hiddenExpandIconKeys.delete(node.key);
  49546. }
  49547. }
  49548. family.pop();
  49549. });
  49550. }
  49551. traverse(nodes);
  49552. return expandKeySet;
  49553. }
  49554. function isForceHiddenExpandIcon(node) {
  49555. return hiddenExpandIconKeySet.value.has(node.key);
  49556. }
  49557. return {
  49558. hiddenExpandIconKeySet,
  49559. hiddenNodeKeySet,
  49560. doFilter,
  49561. isForceHiddenExpandIcon
  49562. };
  49563. }
  49564. //#endregion
  49565. //#region ../../packages/components/tree-v2/src/composables/useTree.ts
  49566. function useTree(props, emit) {
  49567. const expandedKeySet = ref(/* @__PURE__ */ new Set());
  49568. const currentKey = ref();
  49569. const tree = shallowRef();
  49570. const listRef = ref();
  49571. const { isIndeterminate, isChecked, toggleCheckbox, getCheckedKeys, getCheckedNodes, getHalfCheckedKeys, getHalfCheckedNodes, setChecked, setCheckedKeys } = useCheck(props, tree);
  49572. const { doFilter, hiddenNodeKeySet, isForceHiddenExpandIcon } = useFilter(props, tree);
  49573. const valueKey = computed(() => {
  49574. return props.props?.value || "id";
  49575. });
  49576. const childrenKey = computed(() => {
  49577. return props.props?.children || "children";
  49578. });
  49579. const disabledKey = computed(() => {
  49580. return props.props?.disabled || "disabled";
  49581. });
  49582. const labelKey = computed(() => {
  49583. return props.props?.label || "label";
  49584. });
  49585. const flattenTree = computed(() => {
  49586. const expandedKeys = expandedKeySet.value;
  49587. const hiddenKeys = hiddenNodeKeySet.value;
  49588. const flattenNodes = [];
  49589. const nodes = tree.value?.treeNodes || [];
  49590. const stack = [];
  49591. for (let i = nodes.length - 1; i >= 0; --i) stack.push(nodes[i]);
  49592. while (stack.length) {
  49593. const node = stack.pop();
  49594. if (hiddenKeys.has(node.key)) continue;
  49595. flattenNodes.push(node);
  49596. if (node.children && expandedKeys.has(node.key)) for (let i = node.children.length - 1; i >= 0; --i) stack.push(node.children[i]);
  49597. }
  49598. return flattenNodes;
  49599. });
  49600. const isNotEmpty = computed(() => {
  49601. return flattenTree.value.length > 0;
  49602. });
  49603. function createTree(data) {
  49604. const treeNodeMap = /* @__PURE__ */ new Map();
  49605. const levelTreeNodeMap = /* @__PURE__ */ new Map();
  49606. let maxLevel = 1;
  49607. function traverse(nodes, level = 1, parent = void 0) {
  49608. const siblings = [];
  49609. for (const rawNode of nodes) {
  49610. const value = getKey(rawNode);
  49611. const node = {
  49612. level,
  49613. key: value,
  49614. data: rawNode
  49615. };
  49616. node.label = getLabel(rawNode);
  49617. node.parent = parent;
  49618. const children = getChildren(rawNode);
  49619. node.disabled = getDisabled(rawNode);
  49620. node.isLeaf = !children || children.length === 0;
  49621. node.expanded = expandedKeySet.value.has(value);
  49622. if (children && children.length) node.children = traverse(children, level + 1, node);
  49623. siblings.push(node);
  49624. treeNodeMap.set(value, node);
  49625. if (!levelTreeNodeMap.has(level)) levelTreeNodeMap.set(level, []);
  49626. levelTreeNodeMap.get(level)?.push(node);
  49627. }
  49628. if (level > maxLevel) maxLevel = level;
  49629. return siblings;
  49630. }
  49631. const treeNodes = traverse(data);
  49632. return {
  49633. treeNodeMap,
  49634. levelTreeNodeMap,
  49635. maxLevel,
  49636. treeNodes
  49637. };
  49638. }
  49639. function filter(query) {
  49640. const keys = doFilter(query);
  49641. if (keys) expandedKeySet.value = keys;
  49642. }
  49643. function getChildren(node) {
  49644. return node[childrenKey.value];
  49645. }
  49646. function getKey(node) {
  49647. if (!node) return "";
  49648. return node[valueKey.value];
  49649. }
  49650. function getDisabled(node) {
  49651. return node[disabledKey.value];
  49652. }
  49653. function getLabel(node) {
  49654. return node[labelKey.value];
  49655. }
  49656. function toggleExpand(node) {
  49657. if (expandedKeySet.value.has(node.key)) collapseNode(node);
  49658. else expandNode(node);
  49659. }
  49660. function setExpandedKeys(keys) {
  49661. const expandedKeys = /* @__PURE__ */ new Set();
  49662. const nodeMap = tree.value.treeNodeMap;
  49663. expandedKeySet.value.forEach((key) => {
  49664. const node = nodeMap.get(key);
  49665. if (node) node.expanded = false;
  49666. });
  49667. keys.forEach((k) => {
  49668. let node = nodeMap.get(k);
  49669. while (node && !expandedKeys.has(node.key)) {
  49670. expandedKeys.add(node.key);
  49671. node.expanded = true;
  49672. node = node.parent;
  49673. }
  49674. });
  49675. expandedKeySet.value = expandedKeys;
  49676. }
  49677. function handleNodeClick(node, e) {
  49678. handleCurrentChange(node);
  49679. emit(NODE_CLICK, node.data, node, e);
  49680. if (props.expandOnClickNode) toggleExpand(node);
  49681. if (props.showCheckbox && (props.checkOnClickNode || node.isLeaf && props.checkOnClickLeaf) && !node.disabled) toggleCheckbox(node, !isChecked(node), true);
  49682. }
  49683. function handleNodeDrop(node, e) {
  49684. emit(NODE_DROP, node.data, node, e);
  49685. }
  49686. function handleCurrentChange(node) {
  49687. if (!isCurrent(node)) {
  49688. currentKey.value = node.key;
  49689. emit(CURRENT_CHANGE, node.data, node);
  49690. }
  49691. }
  49692. function handleNodeCheck(node, checked) {
  49693. toggleCheckbox(node, checked);
  49694. }
  49695. function expandNode(node) {
  49696. const keySet = expandedKeySet.value;
  49697. if (tree.value && props.accordion) {
  49698. const { treeNodeMap } = tree.value;
  49699. keySet.forEach((key) => {
  49700. const treeNode = treeNodeMap.get(key);
  49701. if (node && node.level === treeNode?.level) {
  49702. keySet.delete(key);
  49703. treeNode.expanded = false;
  49704. }
  49705. });
  49706. }
  49707. keySet.add(node.key);
  49708. const _node = getNode(node.key);
  49709. if (_node) {
  49710. _node.expanded = true;
  49711. emit(NODE_EXPAND, _node.data, _node);
  49712. }
  49713. }
  49714. function collapseNode(node) {
  49715. expandedKeySet.value.delete(node.key);
  49716. const _node = getNode(node.key);
  49717. if (_node) {
  49718. _node.expanded = false;
  49719. emit(NODE_COLLAPSE, _node.data, _node);
  49720. }
  49721. }
  49722. function isDisabled(node) {
  49723. return !!node.disabled;
  49724. }
  49725. function isCurrent(node) {
  49726. const current = currentKey.value;
  49727. return current !== void 0 && current === node.key;
  49728. }
  49729. function getCurrentNode() {
  49730. if (currentKey.value === void 0) return void 0;
  49731. return tree.value?.treeNodeMap.get(currentKey.value)?.data;
  49732. }
  49733. function getCurrentKey() {
  49734. return currentKey.value;
  49735. }
  49736. function setCurrentKey(key) {
  49737. currentKey.value = key;
  49738. }
  49739. function setData(data) {
  49740. tree.value = createTree(data);
  49741. }
  49742. function getNode(data) {
  49743. const key = isObject$1(data) ? getKey(data) : data;
  49744. return tree.value?.treeNodeMap.get(key);
  49745. }
  49746. function scrollToNode(key, strategy = "auto") {
  49747. const node = getNode(key);
  49748. if (node && listRef.value) listRef.value.scrollToItem(flattenTree.value.indexOf(node), strategy);
  49749. }
  49750. function scrollTo(offset) {
  49751. listRef.value?.scrollTo(offset);
  49752. }
  49753. watch(() => props.currentNodeKey, (key) => {
  49754. currentKey.value = key;
  49755. }, { immediate: true });
  49756. watch(() => props.defaultExpandedKeys, (keys) => {
  49757. setExpandedKeys(keys || []);
  49758. });
  49759. watch(() => props.data, (data) => {
  49760. setData(data);
  49761. setExpandedKeys(props.defaultExpandedKeys || []);
  49762. }, { immediate: true });
  49763. return {
  49764. tree,
  49765. flattenTree,
  49766. isNotEmpty,
  49767. listRef,
  49768. getKey,
  49769. getChildren,
  49770. toggleExpand,
  49771. toggleCheckbox,
  49772. isChecked,
  49773. isIndeterminate,
  49774. isDisabled,
  49775. isCurrent,
  49776. isForceHiddenExpandIcon,
  49777. handleNodeClick,
  49778. handleNodeDrop,
  49779. handleNodeCheck,
  49780. getCurrentNode,
  49781. getCurrentKey,
  49782. setCurrentKey,
  49783. getCheckedKeys,
  49784. getCheckedNodes,
  49785. getHalfCheckedKeys,
  49786. getHalfCheckedNodes,
  49787. setChecked,
  49788. setCheckedKeys,
  49789. filter,
  49790. setData,
  49791. getNode,
  49792. expandNode,
  49793. collapseNode,
  49794. setExpandedKeys,
  49795. scrollToNode,
  49796. scrollTo
  49797. };
  49798. }
  49799. //#endregion
  49800. //#region ../../packages/components/tree-v2/src/tree-node-content.ts
  49801. var tree_node_content_default = defineComponent({
  49802. name: "ElTreeNodeContent",
  49803. props: treeNodeContentProps,
  49804. setup(props) {
  49805. const tree = inject(ROOT_TREE_INJECTION_KEY$1);
  49806. const ns = useNamespace("tree");
  49807. return () => {
  49808. const node = props.node;
  49809. const { data } = node;
  49810. return tree?.ctx.slots.default ? tree.ctx.slots.default({
  49811. node,
  49812. data
  49813. }) : h(ElText, {
  49814. tag: "span",
  49815. truncated: true,
  49816. class: ns.be("node", "label")
  49817. }, () => [node?.label]);
  49818. };
  49819. }
  49820. });
  49821. //#endregion
  49822. //#region ../../packages/components/tree-v2/src/tree-node.vue?vue&type=script&setup=true&lang.ts
  49823. const _hoisted_1$11 = [
  49824. "aria-expanded",
  49825. "aria-disabled",
  49826. "aria-checked",
  49827. "data-key"
  49828. ];
  49829. var tree_node_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  49830. name: "ElTreeNode",
  49831. __name: "tree-node",
  49832. props: treeNodeProps,
  49833. emits: treeNodeEmits,
  49834. setup(__props, { emit: __emit }) {
  49835. const props = __props;
  49836. const emit = __emit;
  49837. const tree = inject(ROOT_TREE_INJECTION_KEY$1);
  49838. const ns = useNamespace("tree");
  49839. const indent = computed(() => tree?.props.indent ?? 16);
  49840. const icon = computed(() => tree?.props.icon ?? caret_right_default);
  49841. const getNodeClass = (node) => {
  49842. const nodeClassFunc = tree?.props.props?.class;
  49843. if (!nodeClassFunc) return {};
  49844. let className;
  49845. if (isFunction$1(nodeClassFunc)) {
  49846. const { data } = node;
  49847. className = nodeClassFunc(data, node);
  49848. } else className = nodeClassFunc;
  49849. return isString(className) ? { [className]: true } : className;
  49850. };
  49851. const handleClick = (e) => {
  49852. emit("click", props.node, e);
  49853. };
  49854. const handleDrop = (e) => {
  49855. emit("drop", props.node, e);
  49856. };
  49857. const handleExpandIconClick = () => {
  49858. emit("toggle", props.node);
  49859. };
  49860. const handleCheckChange = (value) => {
  49861. emit("check", props.node, value);
  49862. };
  49863. const handleContextMenu = (event) => {
  49864. if (tree?.instance?.vnode?.props?.["onNodeContextmenu"]) {
  49865. event.stopPropagation();
  49866. event.preventDefault();
  49867. }
  49868. tree?.ctx.emit(NODE_CONTEXTMENU, event, props.node?.data, props.node);
  49869. };
  49870. return (_ctx, _cache) => {
  49871. return openBlock(), createElementBlock("div", {
  49872. ref: "node$",
  49873. class: normalizeClass([
  49874. unref(ns).b("node"),
  49875. unref(ns).is("expanded", __props.expanded),
  49876. unref(ns).is("current", __props.current),
  49877. unref(ns).is("focusable", !__props.disabled),
  49878. unref(ns).is("checked", !__props.disabled && __props.checked),
  49879. getNodeClass(__props.node)
  49880. ]),
  49881. role: "treeitem",
  49882. tabindex: "-1",
  49883. "aria-expanded": __props.expanded,
  49884. "aria-disabled": __props.disabled,
  49885. "aria-checked": __props.checked,
  49886. "data-key": __props.node?.key,
  49887. onClick: withModifiers(handleClick, ["stop"]),
  49888. onContextmenu: handleContextMenu,
  49889. onDragover: _cache[1] || (_cache[1] = withModifiers(() => {}, ["prevent"])),
  49890. onDragenter: _cache[2] || (_cache[2] = withModifiers(() => {}, ["prevent"])),
  49891. onDrop: withModifiers(handleDrop, ["stop"])
  49892. }, [createElementVNode("div", {
  49893. class: normalizeClass(unref(ns).be("node", "content")),
  49894. style: normalizeStyle({
  49895. paddingLeft: `${(__props.node.level - 1) * indent.value}px`,
  49896. height: __props.itemSize + "px"
  49897. })
  49898. }, [
  49899. icon.value ? (openBlock(), createBlock(unref(ElIcon), {
  49900. key: 0,
  49901. class: normalizeClass([
  49902. unref(ns).is("leaf", !!__props.node?.isLeaf),
  49903. unref(ns).is("hidden", __props.hiddenExpandIcon),
  49904. { expanded: !__props.node?.isLeaf && __props.expanded },
  49905. unref(ns).be("node", "expand-icon")
  49906. ]),
  49907. onClick: withModifiers(handleExpandIconClick, ["stop"])
  49908. }, {
  49909. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(icon.value)))]),
  49910. _: 1
  49911. }, 8, ["class"])) : createCommentVNode("v-if", true),
  49912. __props.showCheckbox ? (openBlock(), createBlock(unref(ElCheckbox), {
  49913. key: 1,
  49914. "model-value": __props.checked,
  49915. indeterminate: __props.indeterminate,
  49916. disabled: __props.disabled,
  49917. onChange: handleCheckChange,
  49918. onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
  49919. }, null, 8, [
  49920. "model-value",
  49921. "indeterminate",
  49922. "disabled"
  49923. ])) : createCommentVNode("v-if", true),
  49924. createVNode(unref(tree_node_content_default), { node: {
  49925. ...__props.node,
  49926. expanded: __props.expanded
  49927. } }, null, 8, ["node"])
  49928. ], 6)], 42, _hoisted_1$11);
  49929. };
  49930. }
  49931. });
  49932. //#endregion
  49933. //#region ../../packages/components/tree-v2/src/tree-node.vue
  49934. var tree_node_default = tree_node_vue_vue_type_script_setup_true_lang_default;
  49935. //#endregion
  49936. //#region ../../packages/components/tree-v2/src/tree.vue?vue&type=script&setup=true&lang.ts
  49937. var tree_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  49938. name: "ElTreeV2",
  49939. __name: "tree",
  49940. props: treeProps$1,
  49941. emits: treeEmits$1,
  49942. setup(__props, { expose: __expose, emit: __emit }) {
  49943. const props = __props;
  49944. const emit = __emit;
  49945. const slots = useSlots();
  49946. const treeNodeSize = computed(() => props.itemSize);
  49947. provide(ROOT_TREE_INJECTION_KEY$1, {
  49948. ctx: {
  49949. emit,
  49950. slots
  49951. },
  49952. props,
  49953. instance: getCurrentInstance()
  49954. });
  49955. provide(formItemContextKey, void 0);
  49956. const { t } = useLocale();
  49957. const ns = useNamespace("tree");
  49958. const { flattenTree, isNotEmpty, listRef, toggleExpand, isIndeterminate, isChecked, isDisabled, isCurrent, isForceHiddenExpandIcon, handleNodeClick, handleNodeDrop, handleNodeCheck, toggleCheckbox, getCurrentNode, getCurrentKey, setCurrentKey, getCheckedKeys, getCheckedNodes, getHalfCheckedKeys, getHalfCheckedNodes, setChecked, setCheckedKeys, filter, setData, getNode, expandNode, collapseNode, setExpandedKeys, scrollToNode, scrollTo } = useTree(props, emit);
  49959. __expose({
  49960. toggleCheckbox,
  49961. getCurrentNode,
  49962. getCurrentKey,
  49963. setCurrentKey,
  49964. getCheckedKeys,
  49965. getCheckedNodes,
  49966. getHalfCheckedKeys,
  49967. getHalfCheckedNodes,
  49968. setChecked,
  49969. setCheckedKeys,
  49970. filter,
  49971. setData,
  49972. getNode,
  49973. expandNode,
  49974. collapseNode,
  49975. setExpandedKeys,
  49976. scrollToNode,
  49977. scrollTo
  49978. });
  49979. return (_ctx, _cache) => {
  49980. return openBlock(), createElementBlock("div", {
  49981. class: normalizeClass([unref(ns).b(), { [unref(ns).m("highlight-current")]: __props.highlightCurrent }]),
  49982. role: "tree"
  49983. }, [unref(isNotEmpty) ? (openBlock(), createBlock(unref(FixedSizeList), {
  49984. key: 0,
  49985. ref_key: "listRef",
  49986. ref: listRef,
  49987. "class-name": unref(ns).b("virtual-list"),
  49988. data: unref(flattenTree),
  49989. total: unref(flattenTree).length,
  49990. height: __props.height,
  49991. "item-size": treeNodeSize.value,
  49992. "perf-mode": __props.perfMode,
  49993. "scrollbar-always-on": __props.scrollbarAlwaysOn
  49994. }, {
  49995. default: withCtx(({ data, index, style }) => [(openBlock(), createBlock(tree_node_default, {
  49996. key: data[index].key,
  49997. style: normalizeStyle(style),
  49998. node: data[index],
  49999. expanded: data[index].expanded,
  50000. "show-checkbox": __props.showCheckbox,
  50001. checked: unref(isChecked)(data[index]),
  50002. indeterminate: unref(isIndeterminate)(data[index]),
  50003. "item-size": treeNodeSize.value,
  50004. disabled: unref(isDisabled)(data[index]),
  50005. current: unref(isCurrent)(data[index]),
  50006. "hidden-expand-icon": unref(isForceHiddenExpandIcon)(data[index]),
  50007. onClick: unref(handleNodeClick),
  50008. onToggle: unref(toggleExpand),
  50009. onCheck: unref(handleNodeCheck),
  50010. onDrop: unref(handleNodeDrop)
  50011. }, null, 8, [
  50012. "style",
  50013. "node",
  50014. "expanded",
  50015. "show-checkbox",
  50016. "checked",
  50017. "indeterminate",
  50018. "item-size",
  50019. "disabled",
  50020. "current",
  50021. "hidden-expand-icon",
  50022. "onClick",
  50023. "onToggle",
  50024. "onCheck",
  50025. "onDrop"
  50026. ]))]),
  50027. _: 1
  50028. }, 8, [
  50029. "class-name",
  50030. "data",
  50031. "total",
  50032. "height",
  50033. "item-size",
  50034. "perf-mode",
  50035. "scrollbar-always-on"
  50036. ])) : (openBlock(), createElementBlock("div", {
  50037. key: 1,
  50038. class: normalizeClass(unref(ns).e("empty-block"))
  50039. }, [renderSlot(_ctx.$slots, "empty", {}, () => [createElementVNode("span", { class: normalizeClass(unref(ns).e("empty-text")) }, toDisplayString(__props.emptyText ?? unref(t)("el.tree.emptyText")), 3)])], 2))], 2);
  50040. };
  50041. }
  50042. });
  50043. //#endregion
  50044. //#region ../../packages/components/tree-v2/src/tree.vue
  50045. var tree_default = tree_vue_vue_type_script_setup_true_lang_default;
  50046. //#endregion
  50047. //#region ../../packages/components/tree-v2/index.ts
  50048. const ElTreeV2 = withInstall(tree_default);
  50049. //#endregion
  50050. //#region ../../packages/components/upload/src/ajax.ts
  50051. const SCOPE$3 = "ElUpload";
  50052. var UploadAjaxError = class extends Error {
  50053. constructor(message, status, method, url) {
  50054. super(message);
  50055. this.name = "UploadAjaxError";
  50056. this.status = status;
  50057. this.method = method;
  50058. this.url = url;
  50059. }
  50060. };
  50061. function getError(action, option, xhr) {
  50062. let msg;
  50063. if (xhr.response) msg = `${xhr.response.error || xhr.response}`;
  50064. else if (xhr.responseText) msg = `${xhr.responseText}`;
  50065. else msg = `fail to ${option.method} ${action} ${xhr.status}`;
  50066. return new UploadAjaxError(msg, xhr.status, option.method, action);
  50067. }
  50068. function getBody(xhr) {
  50069. const text = xhr.responseText || xhr.response;
  50070. if (!text) return text;
  50071. try {
  50072. return JSON.parse(text);
  50073. } catch {
  50074. return text;
  50075. }
  50076. }
  50077. const ajaxUpload = (option) => {
  50078. if (typeof XMLHttpRequest === "undefined") throwError(SCOPE$3, "XMLHttpRequest is undefined");
  50079. const xhr = new XMLHttpRequest();
  50080. const action = option.action;
  50081. if (xhr.upload) xhr.upload.addEventListener("progress", (evt) => {
  50082. const progressEvt = evt;
  50083. progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
  50084. option.onProgress(progressEvt);
  50085. });
  50086. const formData = new FormData();
  50087. if (option.data) for (const [key, value] of Object.entries(option.data)) if (isArray$1(value)) if (value.length === 2 && value[0] instanceof Blob && isString(value[1])) formData.append(key, value[0], value[1]);
  50088. else value.forEach((item) => {
  50089. formData.append(key, item);
  50090. });
  50091. else formData.append(key, value);
  50092. formData.append(option.filename, option.file, option.file.name);
  50093. xhr.addEventListener("error", () => {
  50094. option.onError(getError(action, option, xhr));
  50095. });
  50096. xhr.addEventListener("load", () => {
  50097. if (xhr.status < 200 || xhr.status >= 300) return option.onError(getError(action, option, xhr));
  50098. option.onSuccess(getBody(xhr));
  50099. });
  50100. xhr.open(option.method, action, true);
  50101. if (option.withCredentials && "withCredentials" in xhr) xhr.withCredentials = true;
  50102. const headers = option.headers || {};
  50103. if (headers instanceof Headers) headers.forEach((value, key) => xhr.setRequestHeader(key, value));
  50104. else for (const [key, value] of Object.entries(headers)) {
  50105. if (isNil(value)) continue;
  50106. xhr.setRequestHeader(key, String(value));
  50107. }
  50108. xhr.send(formData);
  50109. return xhr;
  50110. };
  50111. //#endregion
  50112. //#region ../../packages/components/upload/src/upload.ts
  50113. const uploadListTypes = [
  50114. "text",
  50115. "picture",
  50116. "picture-card"
  50117. ];
  50118. let fileId = 1;
  50119. const genFileId = () => Date.now() + fileId++;
  50120. const uploadBaseProps = buildProps({
  50121. action: {
  50122. type: String,
  50123. default: "#"
  50124. },
  50125. headers: { type: definePropType(Object) },
  50126. method: {
  50127. type: String,
  50128. default: "post"
  50129. },
  50130. data: {
  50131. type: definePropType([
  50132. Object,
  50133. Function,
  50134. Promise
  50135. ]),
  50136. default: () => mutable({})
  50137. },
  50138. multiple: Boolean,
  50139. name: {
  50140. type: String,
  50141. default: "file"
  50142. },
  50143. drag: Boolean,
  50144. withCredentials: Boolean,
  50145. showFileList: {
  50146. type: Boolean,
  50147. default: true
  50148. },
  50149. accept: {
  50150. type: String,
  50151. default: ""
  50152. },
  50153. fileList: {
  50154. type: definePropType(Array),
  50155. default: () => mutable([])
  50156. },
  50157. autoUpload: {
  50158. type: Boolean,
  50159. default: true
  50160. },
  50161. listType: {
  50162. type: String,
  50163. values: uploadListTypes,
  50164. default: "text"
  50165. },
  50166. httpRequest: {
  50167. type: definePropType(Function),
  50168. default: ajaxUpload
  50169. },
  50170. disabled: {
  50171. type: Boolean,
  50172. default: void 0
  50173. },
  50174. limit: Number,
  50175. directory: Boolean
  50176. });
  50177. const uploadProps = buildProps({
  50178. ...uploadBaseProps,
  50179. beforeUpload: {
  50180. type: definePropType(Function),
  50181. default: NOOP
  50182. },
  50183. beforeRemove: { type: definePropType(Function) },
  50184. onRemove: {
  50185. type: definePropType(Function),
  50186. default: NOOP
  50187. },
  50188. onChange: {
  50189. type: definePropType(Function),
  50190. default: NOOP
  50191. },
  50192. onPreview: {
  50193. type: definePropType(Function),
  50194. default: NOOP
  50195. },
  50196. onSuccess: {
  50197. type: definePropType(Function),
  50198. default: NOOP
  50199. },
  50200. onProgress: {
  50201. type: definePropType(Function),
  50202. default: NOOP
  50203. },
  50204. onError: {
  50205. type: definePropType(Function),
  50206. default: NOOP
  50207. },
  50208. onExceed: {
  50209. type: definePropType(Function),
  50210. default: NOOP
  50211. },
  50212. crossorigin: { type: definePropType(String) }
  50213. });
  50214. const uploadBasePropsDefaults = {
  50215. action: "#",
  50216. method: "post",
  50217. data: () => mutable({}),
  50218. name: "file",
  50219. showFileList: true,
  50220. accept: "",
  50221. fileList: () => mutable([]),
  50222. autoUpload: true,
  50223. listType: "text",
  50224. httpRequest: ajaxUpload,
  50225. disabled: void 0
  50226. };
  50227. const uploadPropsDefaults = {
  50228. ...uploadBasePropsDefaults,
  50229. beforeUpload: NOOP,
  50230. onRemove: NOOP,
  50231. onChange: NOOP,
  50232. onPreview: NOOP,
  50233. onSuccess: NOOP,
  50234. onProgress: NOOP,
  50235. onError: NOOP,
  50236. onExceed: NOOP
  50237. };
  50238. //#endregion
  50239. //#region ../../packages/components/upload/src/constants.ts
  50240. const uploadContextKey = Symbol("uploadContextKey");
  50241. //#endregion
  50242. //#region ../../packages/components/upload/src/upload-list.ts
  50243. const uploadListProps = buildProps({
  50244. files: {
  50245. type: definePropType(Array),
  50246. default: () => mutable([])
  50247. },
  50248. disabled: {
  50249. type: Boolean,
  50250. default: void 0
  50251. },
  50252. handlePreview: {
  50253. type: definePropType(Function),
  50254. default: NOOP
  50255. },
  50256. listType: {
  50257. type: String,
  50258. values: uploadListTypes,
  50259. default: "text"
  50260. },
  50261. crossorigin: { type: definePropType(String) }
  50262. });
  50263. const uploadListEmits = { remove: (file) => !!file };
  50264. //#endregion
  50265. //#region ../../packages/components/upload/src/upload-list.vue?vue&type=script&setup=true&lang.ts
  50266. const _hoisted_1$10 = [
  50267. "tabindex",
  50268. "aria-disabled",
  50269. "onKeydown"
  50270. ];
  50271. const _hoisted_2$6 = ["src", "crossorigin"];
  50272. const _hoisted_3$2 = ["onClick"];
  50273. const _hoisted_4$1 = ["title"];
  50274. const _hoisted_5 = ["onClick"];
  50275. const _hoisted_6 = ["onClick"];
  50276. var upload_list_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  50277. name: "ElUploadList",
  50278. __name: "upload-list",
  50279. props: uploadListProps,
  50280. emits: uploadListEmits,
  50281. setup(__props, { emit: __emit }) {
  50282. const props = __props;
  50283. const emit = __emit;
  50284. const { t } = useLocale();
  50285. const nsUpload = useNamespace("upload");
  50286. const nsIcon = useNamespace("icon");
  50287. const nsList = useNamespace("list");
  50288. const disabled = useFormDisabled();
  50289. const focusing = ref(false);
  50290. const containerKls = computed(() => [
  50291. nsUpload.b("list"),
  50292. nsUpload.bm("list", props.listType),
  50293. nsUpload.is("disabled", disabled.value)
  50294. ]);
  50295. const handleRemove = (file) => {
  50296. emit("remove", file);
  50297. };
  50298. return (_ctx, _cache) => {
  50299. return openBlock(), createBlock(TransitionGroup, {
  50300. tag: "ul",
  50301. class: normalizeClass(containerKls.value),
  50302. name: unref(nsList).b()
  50303. }, {
  50304. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.files, (file, index) => {
  50305. return openBlock(), createElementBlock("li", {
  50306. key: file.uid || file.name,
  50307. class: normalizeClass([
  50308. unref(nsUpload).be("list", "item"),
  50309. unref(nsUpload).is(file.status),
  50310. { focusing: focusing.value }
  50311. ]),
  50312. tabindex: unref(disabled) ? void 0 : 0,
  50313. "aria-disabled": unref(disabled),
  50314. role: "button",
  50315. onKeydown: withKeys(($event) => !unref(disabled) && handleRemove(file), ["delete"]),
  50316. onFocus: _cache[0] || (_cache[0] = ($event) => focusing.value = true),
  50317. onBlur: _cache[1] || (_cache[1] = ($event) => focusing.value = false),
  50318. onClick: _cache[2] || (_cache[2] = ($event) => focusing.value = false)
  50319. }, [renderSlot(_ctx.$slots, "default", {
  50320. file,
  50321. index
  50322. }, () => [
  50323. __props.listType === "picture" || file.status !== "uploading" && __props.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
  50324. key: 0,
  50325. class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
  50326. src: file.url,
  50327. crossorigin: __props.crossorigin,
  50328. alt: ""
  50329. }, null, 10, _hoisted_2$6)) : createCommentVNode("v-if", true),
  50330. file.status === "uploading" || __props.listType !== "picture-card" ? (openBlock(), createElementBlock("div", {
  50331. key: 1,
  50332. class: normalizeClass(unref(nsUpload).be("list", "item-info"))
  50333. }, [createElementVNode("a", {
  50334. class: normalizeClass(unref(nsUpload).be("list", "item-name")),
  50335. onClick: withModifiers(($event) => __props.handlePreview(file), ["prevent"])
  50336. }, [createVNode(unref(ElIcon), { class: normalizeClass(unref(nsIcon).m("document")) }, {
  50337. default: withCtx(() => [createVNode(unref(document_default))]),
  50338. _: 1
  50339. }, 8, ["class"]), createElementVNode("span", {
  50340. class: normalizeClass(unref(nsUpload).be("list", "item-file-name")),
  50341. title: file.name
  50342. }, toDisplayString(file.name), 11, _hoisted_4$1)], 10, _hoisted_3$2), file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
  50343. key: 0,
  50344. type: __props.listType === "picture-card" ? "circle" : "line",
  50345. "stroke-width": __props.listType === "picture-card" ? 6 : 2,
  50346. percentage: Number(file.percentage),
  50347. style: normalizeStyle(__props.listType === "picture-card" ? "" : "margin-top: 0.5rem")
  50348. }, null, 8, [
  50349. "type",
  50350. "stroke-width",
  50351. "percentage",
  50352. "style"
  50353. ])) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true),
  50354. createElementVNode("label", { class: normalizeClass(unref(nsUpload).be("list", "item-status-label")) }, [__props.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
  50355. key: 0,
  50356. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
  50357. }, {
  50358. default: withCtx(() => [createVNode(unref(circle_check_default))]),
  50359. _: 1
  50360. }, 8, ["class"])) : ["picture-card", "picture"].includes(__props.listType) ? (openBlock(), createBlock(unref(ElIcon), {
  50361. key: 1,
  50362. class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
  50363. }, {
  50364. default: withCtx(() => [createVNode(unref(check_default))]),
  50365. _: 1
  50366. }, 8, ["class"])) : createCommentVNode("v-if", true)], 2),
  50367. !unref(disabled) ? (openBlock(), createBlock(unref(ElIcon), {
  50368. key: 2,
  50369. class: normalizeClass(unref(nsIcon).m("close")),
  50370. "aria-label": unref(t)("el.upload.delete"),
  50371. role: "button",
  50372. tabindex: "0",
  50373. onClick: ($event) => handleRemove(file),
  50374. onKeydown: withKeys(withModifiers(($event) => handleRemove(file), ["prevent"]), ["enter", "space"])
  50375. }, {
  50376. default: withCtx(() => [createVNode(unref(close_default))]),
  50377. _: 1
  50378. }, 8, [
  50379. "class",
  50380. "aria-label",
  50381. "onClick",
  50382. "onKeydown"
  50383. ])) : createCommentVNode("v-if", true),
  50384. !unref(disabled) ? (openBlock(), createElementBlock("i", {
  50385. key: 3,
  50386. class: normalizeClass(unref(nsIcon).m("close-tip"))
  50387. }, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
  50388. __props.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
  50389. key: 4,
  50390. class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
  50391. }, [createElementVNode("span", {
  50392. class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
  50393. onClick: ($event) => __props.handlePreview(file)
  50394. }, [createVNode(unref(ElIcon), { class: normalizeClass(unref(nsIcon).m("zoom-in")) }, {
  50395. default: withCtx(() => [createVNode(unref(zoom_in_default))]),
  50396. _: 1
  50397. }, 8, ["class"])], 10, _hoisted_5), !unref(disabled) ? (openBlock(), createElementBlock("span", {
  50398. key: 0,
  50399. class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
  50400. onClick: ($event) => handleRemove(file)
  50401. }, [createVNode(unref(ElIcon), { class: normalizeClass(unref(nsIcon).m("delete")) }, {
  50402. default: withCtx(() => [createVNode(unref(delete_default))]),
  50403. _: 1
  50404. }, 8, ["class"])], 10, _hoisted_6)) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true)
  50405. ])], 42, _hoisted_1$10);
  50406. }), 128)), renderSlot(_ctx.$slots, "append")]),
  50407. _: 3
  50408. }, 8, ["class", "name"]);
  50409. };
  50410. }
  50411. });
  50412. //#endregion
  50413. //#region ../../packages/components/upload/src/upload-list.vue
  50414. var upload_list_default = upload_list_vue_vue_type_script_setup_true_lang_default;
  50415. //#endregion
  50416. //#region ../../packages/components/upload/src/upload-content.ts
  50417. const uploadContentProps = buildProps({
  50418. ...uploadBaseProps,
  50419. beforeUpload: {
  50420. type: definePropType(Function),
  50421. default: NOOP
  50422. },
  50423. onRemove: {
  50424. type: definePropType(Function),
  50425. default: NOOP
  50426. },
  50427. onStart: {
  50428. type: definePropType(Function),
  50429. default: NOOP
  50430. },
  50431. onSuccess: {
  50432. type: definePropType(Function),
  50433. default: NOOP
  50434. },
  50435. onProgress: {
  50436. type: definePropType(Function),
  50437. default: NOOP
  50438. },
  50439. onError: {
  50440. type: definePropType(Function),
  50441. default: NOOP
  50442. },
  50443. onExceed: {
  50444. type: definePropType(Function),
  50445. default: NOOP
  50446. }
  50447. });
  50448. const uploadContentPropsDefaults = {
  50449. ...uploadBasePropsDefaults,
  50450. beforeUpload: NOOP,
  50451. onRemove: NOOP,
  50452. onStart: NOOP,
  50453. onSuccess: NOOP,
  50454. onProgress: NOOP,
  50455. onError: NOOP,
  50456. onExceed: NOOP
  50457. };
  50458. //#endregion
  50459. //#region ../../packages/components/upload/src/upload-dragger.ts
  50460. const uploadDraggerProps = buildProps({
  50461. disabled: {
  50462. type: Boolean,
  50463. default: void 0
  50464. },
  50465. directory: Boolean
  50466. });
  50467. const uploadDraggerEmits = { file: (file) => isArray$1(file) };
  50468. //#endregion
  50469. //#region ../../packages/components/upload/src/upload-dragger.vue?vue&type=script&setup=true&lang.ts
  50470. const COMPONENT_NAME$1 = "ElUploadDrag";
  50471. var upload_dragger_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  50472. name: COMPONENT_NAME$1,
  50473. __name: "upload-dragger",
  50474. props: uploadDraggerProps,
  50475. emits: uploadDraggerEmits,
  50476. setup(__props, { emit: __emit }) {
  50477. const props = __props;
  50478. const emit = __emit;
  50479. if (!inject(uploadContextKey)) throwError(COMPONENT_NAME$1, "usage: <el-upload><el-upload-dragger /></el-upload>");
  50480. const ns = useNamespace("upload");
  50481. const dragover = ref(false);
  50482. const disabled = useFormDisabled();
  50483. const getFile = (entry) => {
  50484. return new Promise((resolve, reject) => entry.file(resolve, reject));
  50485. };
  50486. const getAllFiles = async (entry) => {
  50487. try {
  50488. if (entry.isFile) {
  50489. const file = await getFile(entry);
  50490. file.isDirectory = false;
  50491. return [file];
  50492. }
  50493. if (entry.isDirectory) {
  50494. const dirReader = entry.createReader();
  50495. const getEntries = () => {
  50496. return new Promise((resolve, reject) => dirReader.readEntries(resolve, reject));
  50497. };
  50498. const entries = [];
  50499. let readEntries = await getEntries();
  50500. while (readEntries.length > 0) {
  50501. entries.push(...readEntries);
  50502. readEntries = await getEntries();
  50503. }
  50504. const filePromises = entries.map((entry) => getAllFiles(entry).catch(() => []));
  50505. return flatten(await Promise.all(filePromises));
  50506. }
  50507. } catch {
  50508. return [];
  50509. }
  50510. return [];
  50511. };
  50512. const onDrop = async (e) => {
  50513. if (disabled.value) return;
  50514. dragover.value = false;
  50515. e.stopPropagation();
  50516. const files = Array.from(e.dataTransfer.files);
  50517. const items = e.dataTransfer.items || [];
  50518. if (props.directory) {
  50519. const entries = Array.from(items).map((item) => item?.webkitGetAsEntry?.()).filter((entry) => entry);
  50520. emit("file", flatten(await Promise.all(entries.map(getAllFiles))));
  50521. return;
  50522. }
  50523. files.forEach((file, index) => {
  50524. const entry = items[index]?.webkitGetAsEntry?.();
  50525. if (entry) file.isDirectory = entry.isDirectory;
  50526. });
  50527. emit("file", files);
  50528. };
  50529. const onDragover = () => {
  50530. if (!disabled.value) dragover.value = true;
  50531. };
  50532. const onDragleave = (e) => {
  50533. if (!e.currentTarget.contains(e.relatedTarget)) dragover.value = false;
  50534. };
  50535. return (_ctx, _cache) => {
  50536. return openBlock(), createElementBlock("div", {
  50537. class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
  50538. onDrop: withModifiers(onDrop, ["prevent"]),
  50539. onDragover: withModifiers(onDragover, ["prevent"]),
  50540. onDragleave: withModifiers(onDragleave, ["prevent"])
  50541. }, [renderSlot(_ctx.$slots, "default")], 34);
  50542. };
  50543. }
  50544. });
  50545. //#endregion
  50546. //#region ../../packages/components/upload/src/upload-dragger.vue
  50547. var upload_dragger_default = upload_dragger_vue_vue_type_script_setup_true_lang_default;
  50548. //#endregion
  50549. //#region ../../packages/components/upload/src/upload-content.vue?vue&type=script&setup=true&lang.ts
  50550. const _hoisted_1$9 = [
  50551. "tabindex",
  50552. "aria-disabled",
  50553. "onKeydown"
  50554. ];
  50555. const _hoisted_2$5 = [
  50556. "name",
  50557. "disabled",
  50558. "multiple",
  50559. "accept",
  50560. "webkitdirectory"
  50561. ];
  50562. var upload_content_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  50563. name: "ElUploadContent",
  50564. inheritAttrs: false,
  50565. __name: "upload-content",
  50566. props: uploadContentProps,
  50567. setup(__props, { expose: __expose }) {
  50568. const props = __props;
  50569. const ns = useNamespace("upload");
  50570. const disabled = useFormDisabled();
  50571. const requests = shallowRef({});
  50572. const inputRef = shallowRef();
  50573. const uploadFiles = (files) => {
  50574. if (files.length === 0) return;
  50575. const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
  50576. if (limit && fileList.length + files.length > limit) {
  50577. onExceed(files, fileList);
  50578. return;
  50579. }
  50580. if (!multiple) files = files.slice(0, 1);
  50581. for (const file of files) {
  50582. const rawFile = file;
  50583. rawFile.uid = genFileId();
  50584. onStart(rawFile);
  50585. if (autoUpload) upload(rawFile);
  50586. }
  50587. };
  50588. const upload = async (rawFile) => {
  50589. inputRef.value.value = "";
  50590. if (!props.beforeUpload) return doUpload(rawFile);
  50591. let hookResult;
  50592. let beforeData = {};
  50593. try {
  50594. const originData = props.data;
  50595. const beforeUploadPromise = props.beforeUpload(rawFile);
  50596. beforeData = isPlainObject$1(props.data) ? cloneDeep(props.data) : props.data;
  50597. hookResult = await beforeUploadPromise;
  50598. if (isPlainObject$1(props.data) && isEqual$1(originData, beforeData)) beforeData = cloneDeep(props.data);
  50599. } catch {
  50600. hookResult = false;
  50601. }
  50602. if (hookResult === false) {
  50603. props.onRemove(rawFile);
  50604. return;
  50605. }
  50606. let file = rawFile;
  50607. if (hookResult instanceof Blob) if (hookResult instanceof File) file = hookResult;
  50608. else file = new File([hookResult], rawFile.name, { type: rawFile.type });
  50609. doUpload(Object.assign(file, { uid: rawFile.uid }), beforeData);
  50610. };
  50611. const resolveData = async (data, rawFile) => {
  50612. if (isFunction$1(data)) return data(rawFile);
  50613. return data;
  50614. };
  50615. const doUpload = async (rawFile, beforeData) => {
  50616. const { headers, data, method, withCredentials, name: filename, action, onProgress, onSuccess, onError, httpRequest } = props;
  50617. try {
  50618. beforeData = await resolveData(beforeData ?? data, rawFile);
  50619. } catch {
  50620. props.onRemove(rawFile);
  50621. return;
  50622. }
  50623. const { uid } = rawFile;
  50624. const options = {
  50625. headers: headers || {},
  50626. withCredentials,
  50627. file: rawFile,
  50628. data: beforeData,
  50629. method,
  50630. filename,
  50631. action,
  50632. onProgress: (evt) => {
  50633. onProgress(evt, rawFile);
  50634. },
  50635. onSuccess: (res) => {
  50636. onSuccess(res, rawFile);
  50637. delete requests.value[uid];
  50638. },
  50639. onError: (err) => {
  50640. onError(err, rawFile);
  50641. delete requests.value[uid];
  50642. }
  50643. };
  50644. const request = httpRequest(options);
  50645. requests.value[uid] = request;
  50646. if (request instanceof Promise) request.then(options.onSuccess, options.onError);
  50647. };
  50648. const handleChange = (e) => {
  50649. const files = e.target.files;
  50650. if (!files) return;
  50651. uploadFiles(Array.from(files));
  50652. };
  50653. const handleClick = () => {
  50654. if (!disabled.value) {
  50655. inputRef.value.value = "";
  50656. inputRef.value.click();
  50657. }
  50658. };
  50659. const handleKeydown = () => {
  50660. handleClick();
  50661. };
  50662. const abort = (file) => {
  50663. entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true).forEach(([uid, req]) => {
  50664. if (req instanceof XMLHttpRequest) req.abort();
  50665. delete requests.value[uid];
  50666. });
  50667. };
  50668. __expose({
  50669. abort,
  50670. upload
  50671. });
  50672. return (_ctx, _cache) => {
  50673. return openBlock(), createElementBlock("div", {
  50674. class: normalizeClass([
  50675. unref(ns).b(),
  50676. unref(ns).m(__props.listType),
  50677. unref(ns).is("drag", __props.drag),
  50678. unref(ns).is("disabled", unref(disabled))
  50679. ]),
  50680. tabindex: unref(disabled) ? void 0 : 0,
  50681. "aria-disabled": unref(disabled),
  50682. role: "button",
  50683. onClick: handleClick,
  50684. onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
  50685. }, [__props.drag ? (openBlock(), createBlock(upload_dragger_default, {
  50686. key: 0,
  50687. disabled: unref(disabled),
  50688. directory: __props.directory,
  50689. onFile: uploadFiles
  50690. }, {
  50691. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  50692. _: 3
  50693. }, 8, ["disabled", "directory"])) : renderSlot(_ctx.$slots, "default", { key: 1 }), createElementVNode("input", {
  50694. ref_key: "inputRef",
  50695. ref: inputRef,
  50696. class: normalizeClass(unref(ns).e("input")),
  50697. name: __props.name,
  50698. disabled: unref(disabled),
  50699. multiple: __props.multiple,
  50700. accept: __props.accept,
  50701. webkitdirectory: __props.directory || void 0,
  50702. type: "file",
  50703. onChange: handleChange,
  50704. onClick: _cache[0] || (_cache[0] = withModifiers(() => {}, ["stop"]))
  50705. }, null, 42, _hoisted_2$5)], 42, _hoisted_1$9);
  50706. };
  50707. }
  50708. });
  50709. //#endregion
  50710. //#region ../../packages/components/upload/src/upload-content.vue
  50711. var upload_content_default = upload_content_vue_vue_type_script_setup_true_lang_default;
  50712. //#endregion
  50713. //#region ../../packages/components/upload/src/use-handlers.ts
  50714. const SCOPE$2 = "ElUpload";
  50715. const revokeFileObjectURL = (file) => {
  50716. if (file.url?.startsWith("blob:")) URL.revokeObjectURL(file.url);
  50717. };
  50718. const useHandlers = (props, uploadRef) => {
  50719. const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
  50720. const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
  50721. function abort(file) {
  50722. uploadRef.value?.abort(file);
  50723. }
  50724. function clearFiles(states = [
  50725. "ready",
  50726. "uploading",
  50727. "success",
  50728. "fail"
  50729. ]) {
  50730. uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
  50731. }
  50732. function removeFile(file) {
  50733. uploadFiles.value = uploadFiles.value.filter((uploadFile) => uploadFile.uid !== file.uid);
  50734. }
  50735. const emitChange = (file) => {
  50736. nextTick(() => props.onChange(file, uploadFiles.value));
  50737. };
  50738. const handleError = (err, rawFile) => {
  50739. const file = getFile(rawFile);
  50740. if (!file) return;
  50741. console.error(err);
  50742. file.status = "fail";
  50743. removeFile(file);
  50744. props.onError(err, file, uploadFiles.value);
  50745. emitChange(file);
  50746. };
  50747. const handleProgress = (evt, rawFile) => {
  50748. const file = getFile(rawFile);
  50749. if (!file) return;
  50750. props.onProgress(evt, file, uploadFiles.value);
  50751. file.status = "uploading";
  50752. file.percentage = Math.round(evt.percent);
  50753. };
  50754. const handleSuccess = (response, rawFile) => {
  50755. const file = getFile(rawFile);
  50756. if (!file) return;
  50757. file.status = "success";
  50758. file.response = response;
  50759. props.onSuccess(response, file, uploadFiles.value);
  50760. emitChange(file);
  50761. };
  50762. const handleStart = (file) => {
  50763. if (isNil(file.uid)) file.uid = genFileId();
  50764. const uploadFile = {
  50765. name: file.name,
  50766. percentage: 0,
  50767. status: "ready",
  50768. size: file.size,
  50769. raw: file,
  50770. uid: file.uid
  50771. };
  50772. if (props.listType === "picture-card" || props.listType === "picture") try {
  50773. uploadFile.url = URL.createObjectURL(file);
  50774. } catch (err) {
  50775. /* @__PURE__ */ debugWarn(SCOPE$2, err.message);
  50776. props.onError(err, uploadFile, uploadFiles.value);
  50777. }
  50778. uploadFiles.value = [...uploadFiles.value, uploadFile];
  50779. emitChange(uploadFile);
  50780. };
  50781. const handleRemove = async (file) => {
  50782. const uploadFile = file instanceof File ? getFile(file) : file;
  50783. if (!uploadFile) throwError(SCOPE$2, "file to be removed not found");
  50784. const doRemove = (file) => {
  50785. abort(file);
  50786. removeFile(file);
  50787. props.onRemove(file, uploadFiles.value);
  50788. revokeFileObjectURL(file);
  50789. };
  50790. if (props.beforeRemove) {
  50791. if (await props.beforeRemove(uploadFile, uploadFiles.value) !== false) doRemove(uploadFile);
  50792. } else doRemove(uploadFile);
  50793. };
  50794. function submit() {
  50795. uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => raw && uploadRef.value?.upload(raw));
  50796. }
  50797. watch(() => props.listType, (val) => {
  50798. if (val !== "picture-card" && val !== "picture") return;
  50799. uploadFiles.value = uploadFiles.value.map((file) => {
  50800. const { raw, url } = file;
  50801. if (!url && raw) try {
  50802. file.url = URL.createObjectURL(raw);
  50803. } catch (err) {
  50804. props.onError(err, file, uploadFiles.value);
  50805. }
  50806. return file;
  50807. });
  50808. });
  50809. watch(uploadFiles, (files) => {
  50810. for (const file of files) {
  50811. file.uid ||= genFileId();
  50812. file.status ||= "success";
  50813. }
  50814. }, {
  50815. immediate: true,
  50816. deep: true
  50817. });
  50818. return {
  50819. uploadFiles,
  50820. abort,
  50821. clearFiles,
  50822. handleError,
  50823. handleProgress,
  50824. handleStart,
  50825. handleSuccess,
  50826. handleRemove,
  50827. submit,
  50828. revokeFileObjectURL
  50829. };
  50830. };
  50831. //#endregion
  50832. //#region ../../packages/components/upload/src/upload.vue?vue&type=script&setup=true&lang.ts
  50833. var upload_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  50834. name: "ElUpload",
  50835. __name: "upload",
  50836. props: uploadProps,
  50837. setup(__props, { expose: __expose }) {
  50838. const props = __props;
  50839. const disabled = useFormDisabled();
  50840. const uploadRef = shallowRef();
  50841. const { abort, submit, clearFiles, uploadFiles, handleStart, handleError, handleRemove, handleSuccess, handleProgress, revokeFileObjectURL } = useHandlers(props, uploadRef);
  50842. const isPictureCard = computed(() => props.listType === "picture-card");
  50843. const uploadContentProps = computed(() => ({
  50844. ...props,
  50845. fileList: uploadFiles.value,
  50846. onStart: handleStart,
  50847. onProgress: handleProgress,
  50848. onSuccess: handleSuccess,
  50849. onError: handleError,
  50850. onRemove: handleRemove
  50851. }));
  50852. onBeforeUnmount(() => {
  50853. uploadFiles.value.forEach(revokeFileObjectURL);
  50854. });
  50855. provide(uploadContextKey, { accept: toRef(props, "accept") });
  50856. __expose({
  50857. abort,
  50858. submit,
  50859. clearFiles,
  50860. handleStart,
  50861. handleRemove
  50862. });
  50863. return (_ctx, _cache) => {
  50864. return openBlock(), createElementBlock("div", null, [
  50865. isPictureCard.value && __props.showFileList ? (openBlock(), createBlock(upload_list_default, {
  50866. key: 0,
  50867. disabled: unref(disabled),
  50868. "list-type": __props.listType,
  50869. files: unref(uploadFiles),
  50870. crossorigin: __props.crossorigin,
  50871. "handle-preview": __props.onPreview,
  50872. onRemove: unref(handleRemove)
  50873. }, createSlots({
  50874. append: withCtx(() => [createVNode(upload_content_default, mergeProps({
  50875. ref_key: "uploadRef",
  50876. ref: uploadRef
  50877. }, uploadContentProps.value), {
  50878. default: withCtx(() => [_ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true), !_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)]),
  50879. _: 3
  50880. }, 16)]),
  50881. _: 2
  50882. }, [_ctx.$slots.file ? {
  50883. name: "default",
  50884. fn: withCtx(({ file, index }) => [renderSlot(_ctx.$slots, "file", {
  50885. file,
  50886. index
  50887. })]),
  50888. key: "0"
  50889. } : void 0]), 1032, [
  50890. "disabled",
  50891. "list-type",
  50892. "files",
  50893. "crossorigin",
  50894. "handle-preview",
  50895. "onRemove"
  50896. ])) : createCommentVNode("v-if", true),
  50897. !isPictureCard.value || isPictureCard.value && !__props.showFileList ? (openBlock(), createBlock(upload_content_default, mergeProps({
  50898. key: 1,
  50899. ref_key: "uploadRef",
  50900. ref: uploadRef
  50901. }, uploadContentProps.value), {
  50902. default: withCtx(() => [_ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true), !_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)]),
  50903. _: 3
  50904. }, 16)) : createCommentVNode("v-if", true),
  50905. _ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
  50906. renderSlot(_ctx.$slots, "tip"),
  50907. !isPictureCard.value && __props.showFileList ? (openBlock(), createBlock(upload_list_default, {
  50908. key: 3,
  50909. disabled: unref(disabled),
  50910. "list-type": __props.listType,
  50911. files: unref(uploadFiles),
  50912. crossorigin: __props.crossorigin,
  50913. "handle-preview": __props.onPreview,
  50914. onRemove: unref(handleRemove)
  50915. }, createSlots({ _: 2 }, [_ctx.$slots.file ? {
  50916. name: "default",
  50917. fn: withCtx(({ file, index }) => [renderSlot(_ctx.$slots, "file", {
  50918. file,
  50919. index
  50920. })]),
  50921. key: "0"
  50922. } : void 0]), 1032, [
  50923. "disabled",
  50924. "list-type",
  50925. "files",
  50926. "crossorigin",
  50927. "handle-preview",
  50928. "onRemove"
  50929. ])) : createCommentVNode("v-if", true)
  50930. ]);
  50931. };
  50932. }
  50933. });
  50934. //#endregion
  50935. //#region ../../packages/components/upload/src/upload.vue
  50936. var upload_default = upload_vue_vue_type_script_setup_true_lang_default;
  50937. //#endregion
  50938. //#region ../../packages/components/upload/index.ts
  50939. const ElUpload = withInstall(upload_default);
  50940. //#endregion
  50941. //#region ../../packages/components/watermark/src/watermark.ts
  50942. const watermarkProps = buildProps({
  50943. zIndex: {
  50944. type: Number,
  50945. default: 9
  50946. },
  50947. rotate: {
  50948. type: Number,
  50949. default: -22
  50950. },
  50951. width: Number,
  50952. height: Number,
  50953. image: String,
  50954. content: {
  50955. type: definePropType([String, Array]),
  50956. default: "Element Plus"
  50957. },
  50958. font: { type: definePropType(Object) },
  50959. gap: {
  50960. type: definePropType(Array),
  50961. default: () => [100, 100]
  50962. },
  50963. offset: { type: definePropType(Array) }
  50964. });
  50965. //#endregion
  50966. //#region ../../packages/components/watermark/src/utils.ts
  50967. function toLowercaseSeparator(key) {
  50968. return key.replace(/([A-Z])/g, "-$1").toLowerCase();
  50969. }
  50970. function getStyleStr(style) {
  50971. return Object.keys(style).map((key) => `${toLowercaseSeparator(key)}: ${style[key]};`).join(" ");
  50972. }
  50973. function getPixelRatio() {
  50974. return window.devicePixelRatio || 1;
  50975. }
  50976. const reRendering = (mutation, watermarkElement) => {
  50977. let flag = false;
  50978. if (mutation.removedNodes.length && watermarkElement) flag = Array.from(mutation.removedNodes).includes(watermarkElement);
  50979. if (mutation.type === "attributes" && mutation.target === watermarkElement) flag = true;
  50980. return flag;
  50981. };
  50982. //#endregion
  50983. //#region ../../packages/components/watermark/src/useClips.ts
  50984. const TEXT_ALIGN_RATIO_MAP = {
  50985. left: [0, .5],
  50986. start: [0, .5],
  50987. center: [.5, 0],
  50988. right: [1, -.5],
  50989. end: [1, -.5]
  50990. };
  50991. function prepareCanvas(width, height, ratio = 1) {
  50992. const canvas = document.createElement("canvas");
  50993. const ctx = canvas.getContext("2d");
  50994. const realWidth = width * ratio;
  50995. const realHeight = height * ratio;
  50996. canvas.setAttribute("width", `${realWidth}px`);
  50997. canvas.setAttribute("height", `${realHeight}px`);
  50998. ctx.save();
  50999. return [
  51000. ctx,
  51001. canvas,
  51002. realWidth,
  51003. realHeight
  51004. ];
  51005. }
  51006. function useClips() {
  51007. function getClips(content, rotate, ratio, width, height, font, gapX, gapY, space) {
  51008. const [ctx, canvas, contentWidth, contentHeight] = prepareCanvas(width, height, ratio);
  51009. let baselineOffset = 0;
  51010. if (content instanceof HTMLImageElement) ctx.drawImage(content, 0, 0, contentWidth, contentHeight);
  51011. else {
  51012. const { color, fontSize, fontStyle, fontWeight, fontFamily, textAlign, textBaseline } = font;
  51013. const mergedFontSize = Number(fontSize) * ratio;
  51014. ctx.font = `${fontStyle} normal ${fontWeight} ${mergedFontSize}px/${height}px ${fontFamily}`;
  51015. ctx.fillStyle = color;
  51016. ctx.textAlign = textAlign;
  51017. ctx.textBaseline = textBaseline;
  51018. const contents = isArray$1(content) ? content : [content];
  51019. if (textBaseline !== "top" && contents[0]) {
  51020. const argumentMetrics = ctx.measureText(contents[0]);
  51021. ctx.textBaseline = "top";
  51022. const topMetrics = ctx.measureText(contents[0]);
  51023. baselineOffset = argumentMetrics.actualBoundingBoxAscent - topMetrics.actualBoundingBoxAscent;
  51024. }
  51025. contents?.forEach((item, index) => {
  51026. const [alignRatio, spaceRatio] = TEXT_ALIGN_RATIO_MAP[textAlign];
  51027. ctx.fillText(item ?? "", contentWidth * alignRatio + space * spaceRatio, index * (mergedFontSize + font.fontGap * ratio));
  51028. });
  51029. }
  51030. const angle = Math.PI / 180 * Number(rotate);
  51031. const maxSize = Math.max(width, height);
  51032. const [rCtx, rCanvas, realMaxSize] = prepareCanvas(maxSize, maxSize, ratio);
  51033. rCtx.translate(realMaxSize / 2, realMaxSize / 2);
  51034. rCtx.rotate(angle);
  51035. if (contentWidth > 0 && contentHeight > 0) rCtx.drawImage(canvas, -contentWidth / 2, -contentHeight / 2);
  51036. function getRotatePos(x, y) {
  51037. return [x * Math.cos(angle) - y * Math.sin(angle), x * Math.sin(angle) + y * Math.cos(angle)];
  51038. }
  51039. let left = 0;
  51040. let right = 0;
  51041. let top = 0;
  51042. let bottom = 0;
  51043. const halfWidth = contentWidth / 2;
  51044. const halfHeight = contentHeight / 2;
  51045. [
  51046. [0 - halfWidth, 0 - halfHeight],
  51047. [0 + halfWidth, 0 - halfHeight],
  51048. [0 + halfWidth, 0 + halfHeight],
  51049. [0 - halfWidth, 0 + halfHeight]
  51050. ].forEach(([x, y]) => {
  51051. const [targetX, targetY] = getRotatePos(x, y);
  51052. left = Math.min(left, targetX);
  51053. right = Math.max(right, targetX);
  51054. top = Math.min(top, targetY);
  51055. bottom = Math.max(bottom, targetY);
  51056. });
  51057. const cutLeft = left + realMaxSize / 2;
  51058. const cutTop = top + realMaxSize / 2;
  51059. const cutWidth = right - left;
  51060. const cutHeight = bottom - top;
  51061. const realGapX = gapX * ratio;
  51062. const realGapY = gapY * ratio;
  51063. const filledWidth = (cutWidth + realGapX) * 2;
  51064. const filledHeight = cutHeight + realGapY;
  51065. const [fCtx, fCanvas] = prepareCanvas(filledWidth, filledHeight);
  51066. function drawImg(targetX = 0, targetY = 0) {
  51067. fCtx.drawImage(rCanvas, cutLeft, cutTop, cutWidth, cutHeight, targetX, targetY + baselineOffset, cutWidth, cutHeight);
  51068. }
  51069. drawImg();
  51070. drawImg(cutWidth + realGapX, -cutHeight / 2 - realGapY / 2);
  51071. drawImg(cutWidth + realGapX, +cutHeight / 2 + realGapY / 2);
  51072. return [
  51073. fCanvas.toDataURL(),
  51074. filledWidth / ratio,
  51075. filledHeight / ratio
  51076. ];
  51077. }
  51078. return getClips;
  51079. }
  51080. //#endregion
  51081. //#region ../../packages/components/watermark/src/watermark.vue?vue&type=script&setup=true&lang.ts
  51082. var watermark_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  51083. name: "ElWatermark",
  51084. __name: "watermark",
  51085. props: watermarkProps,
  51086. setup(__props) {
  51087. const style = { position: "relative" };
  51088. const props = __props;
  51089. const fontGap = computed(() => props.font?.fontGap ?? 3);
  51090. const color = computed(() => props.font?.color ?? "rgba(0,0,0,.15)");
  51091. const fontSize = computed(() => props.font?.fontSize ?? 16);
  51092. const fontWeight = computed(() => props.font?.fontWeight ?? "normal");
  51093. const fontStyle = computed(() => props.font?.fontStyle ?? "normal");
  51094. const fontFamily = computed(() => props.font?.fontFamily ?? "sans-serif");
  51095. const textAlign = computed(() => props.font?.textAlign ?? "center");
  51096. const textBaseline = computed(() => props.font?.textBaseline ?? "hanging");
  51097. const gapX = computed(() => props.gap[0]);
  51098. const gapY = computed(() => props.gap[1]);
  51099. const gapXCenter = computed(() => gapX.value / 2);
  51100. const gapYCenter = computed(() => gapY.value / 2);
  51101. const offsetLeft = computed(() => props.offset?.[0] ?? gapXCenter.value);
  51102. const offsetTop = computed(() => props.offset?.[1] ?? gapYCenter.value);
  51103. const getMarkStyle = () => {
  51104. const markStyle = {
  51105. zIndex: props.zIndex,
  51106. position: "absolute",
  51107. left: 0,
  51108. top: 0,
  51109. width: "100%",
  51110. height: "100%",
  51111. pointerEvents: "none",
  51112. backgroundRepeat: "repeat"
  51113. };
  51114. let positionLeft = offsetLeft.value - gapXCenter.value;
  51115. let positionTop = offsetTop.value - gapYCenter.value;
  51116. if (positionLeft > 0) {
  51117. markStyle.left = `${positionLeft}px`;
  51118. markStyle.width = `calc(100% - ${positionLeft}px)`;
  51119. positionLeft = 0;
  51120. }
  51121. if (positionTop > 0) {
  51122. markStyle.top = `${positionTop}px`;
  51123. markStyle.height = `calc(100% - ${positionTop}px)`;
  51124. positionTop = 0;
  51125. }
  51126. markStyle.backgroundPosition = `${positionLeft}px ${positionTop}px`;
  51127. return markStyle;
  51128. };
  51129. const containerRef = shallowRef(null);
  51130. const watermarkRef = shallowRef();
  51131. const stopObservation = ref(false);
  51132. const destroyWatermark = () => {
  51133. if (watermarkRef.value) {
  51134. watermarkRef.value.remove();
  51135. watermarkRef.value = void 0;
  51136. }
  51137. };
  51138. const appendWatermark = (base64Url, markWidth) => {
  51139. if (containerRef.value && watermarkRef.value) {
  51140. stopObservation.value = true;
  51141. watermarkRef.value.setAttribute("style", getStyleStr({
  51142. ...getMarkStyle(),
  51143. backgroundImage: `url('${base64Url}')`,
  51144. backgroundSize: `${Math.floor(markWidth)}px`
  51145. }));
  51146. containerRef.value?.append(watermarkRef.value);
  51147. setTimeout(() => {
  51148. stopObservation.value = false;
  51149. });
  51150. }
  51151. };
  51152. const getMarkSize = (ctx) => {
  51153. let defaultWidth = 120;
  51154. let defaultHeight = 64;
  51155. let space = 0;
  51156. const { image, content, width, height, rotate } = props;
  51157. if (!image && ctx.measureText) {
  51158. ctx.font = `${Number(fontSize.value)}px ${fontFamily.value}`;
  51159. const contents = isArray$1(content) ? content : [content];
  51160. let maxWidth = 0;
  51161. let maxHeight = 0;
  51162. contents.forEach((item) => {
  51163. const { width, fontBoundingBoxAscent, fontBoundingBoxDescent, actualBoundingBoxAscent, actualBoundingBoxDescent } = ctx.measureText(item);
  51164. const height = isUndefined(fontBoundingBoxAscent) ? actualBoundingBoxAscent + actualBoundingBoxDescent : fontBoundingBoxAscent + fontBoundingBoxDescent;
  51165. if (width > maxWidth) maxWidth = Math.ceil(width);
  51166. if (height > maxHeight) maxHeight = Math.ceil(height);
  51167. });
  51168. defaultWidth = maxWidth;
  51169. defaultHeight = maxHeight * contents.length + (contents.length - 1) * fontGap.value;
  51170. const angle = Math.PI / 180 * Number(rotate);
  51171. space = Math.ceil(Math.abs(Math.sin(angle) * defaultHeight) / 2);
  51172. defaultWidth += space;
  51173. }
  51174. return [
  51175. width ?? defaultWidth,
  51176. height ?? defaultHeight,
  51177. space
  51178. ];
  51179. };
  51180. const getClips = useClips();
  51181. const renderWatermark = () => {
  51182. const ctx = document.createElement("canvas").getContext("2d");
  51183. const image = props.image;
  51184. const content = props.content;
  51185. const rotate = props.rotate;
  51186. if (ctx) {
  51187. if (!watermarkRef.value) watermarkRef.value = document.createElement("div");
  51188. const ratio = getPixelRatio();
  51189. const [markWidth, markHeight, space] = getMarkSize(ctx);
  51190. const drawCanvas = (drawContent) => {
  51191. const [textClips, clipWidth] = getClips(drawContent || "", rotate, ratio, markWidth, markHeight, {
  51192. color: color.value,
  51193. fontSize: fontSize.value,
  51194. fontStyle: fontStyle.value,
  51195. fontWeight: fontWeight.value,
  51196. fontFamily: fontFamily.value,
  51197. fontGap: fontGap.value,
  51198. textAlign: textAlign.value,
  51199. textBaseline: textBaseline.value
  51200. }, gapX.value, gapY.value, space);
  51201. appendWatermark(textClips, clipWidth);
  51202. };
  51203. if (image) {
  51204. const img = new Image();
  51205. img.onload = () => {
  51206. drawCanvas(img);
  51207. };
  51208. img.onerror = () => {
  51209. drawCanvas(content);
  51210. };
  51211. img.crossOrigin = "anonymous";
  51212. img.referrerPolicy = "no-referrer";
  51213. img.src = image;
  51214. } else drawCanvas(content);
  51215. }
  51216. };
  51217. onMounted(() => {
  51218. renderWatermark();
  51219. });
  51220. watch(() => props, () => {
  51221. renderWatermark();
  51222. }, {
  51223. deep: true,
  51224. flush: "post"
  51225. });
  51226. onBeforeUnmount(() => {
  51227. destroyWatermark();
  51228. });
  51229. const onMutate = (mutations) => {
  51230. if (stopObservation.value) return;
  51231. mutations.forEach((mutation) => {
  51232. if (reRendering(mutation, watermarkRef.value)) {
  51233. destroyWatermark();
  51234. renderWatermark();
  51235. }
  51236. });
  51237. };
  51238. useMutationObserver(containerRef, onMutate, {
  51239. attributes: true,
  51240. subtree: true,
  51241. childList: true
  51242. });
  51243. return (_ctx, _cache) => {
  51244. return openBlock(), createElementBlock("div", {
  51245. ref_key: "containerRef",
  51246. ref: containerRef,
  51247. style: normalizeStyle([style])
  51248. }, [renderSlot(_ctx.$slots, "default")], 4);
  51249. };
  51250. }
  51251. });
  51252. //#endregion
  51253. //#region ../../packages/components/watermark/src/watermark.vue
  51254. var watermark_default = watermark_vue_vue_type_script_setup_true_lang_default;
  51255. //#endregion
  51256. //#region ../../packages/components/watermark/index.ts
  51257. const ElWatermark = withInstall(watermark_default);
  51258. //#endregion
  51259. //#region ../../packages/components/tour/src/content.ts
  51260. const tourStrategies = ["absolute", "fixed"];
  51261. const tourPlacements = [
  51262. "top-start",
  51263. "top-end",
  51264. "top",
  51265. "bottom-start",
  51266. "bottom-end",
  51267. "bottom",
  51268. "left-start",
  51269. "left-end",
  51270. "left",
  51271. "right-start",
  51272. "right-end",
  51273. "right"
  51274. ];
  51275. const tourContentProps = buildProps({
  51276. placement: {
  51277. type: definePropType(String),
  51278. values: tourPlacements,
  51279. default: "bottom"
  51280. },
  51281. reference: {
  51282. type: definePropType(Object),
  51283. default: null
  51284. },
  51285. strategy: {
  51286. type: definePropType(String),
  51287. values: tourStrategies,
  51288. default: "absolute"
  51289. },
  51290. offset: {
  51291. type: Number,
  51292. default: 10
  51293. },
  51294. showArrow: Boolean,
  51295. zIndex: {
  51296. type: Number,
  51297. default: 2001
  51298. }
  51299. });
  51300. const tourContentEmits = { close: () => true };
  51301. //#endregion
  51302. //#region ../../packages/components/tour/src/tour.ts
  51303. const tourProps = buildProps({
  51304. modelValue: Boolean,
  51305. current: { type: Number },
  51306. showArrow: {
  51307. type: Boolean,
  51308. default: true
  51309. },
  51310. showClose: {
  51311. type: Boolean,
  51312. default: true
  51313. },
  51314. closeIcon: { type: iconPropType },
  51315. placement: tourContentProps.placement,
  51316. contentStyle: { type: definePropType([Object]) },
  51317. mask: {
  51318. type: definePropType([Boolean, Object]),
  51319. default: true
  51320. },
  51321. gap: {
  51322. type: definePropType(Object),
  51323. default: () => ({
  51324. offset: 6,
  51325. radius: 2
  51326. })
  51327. },
  51328. zIndex: { type: Number },
  51329. scrollIntoViewOptions: {
  51330. type: definePropType([Boolean, Object]),
  51331. default: () => ({ block: "center" })
  51332. },
  51333. type: { type: definePropType(String) },
  51334. appendTo: {
  51335. type: definePropType([String, Object]),
  51336. default: "body"
  51337. },
  51338. closeOnPressEscape: {
  51339. type: Boolean,
  51340. default: true
  51341. },
  51342. targetAreaClickable: {
  51343. type: Boolean,
  51344. default: true
  51345. }
  51346. });
  51347. const tourEmits = {
  51348. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  51349. ["update:current"]: (current) => isNumber(current),
  51350. close: (current) => isNumber(current),
  51351. finish: () => true,
  51352. change: (current) => isNumber(current)
  51353. };
  51354. //#endregion
  51355. //#region ../../packages/components/tour/src/mask.ts
  51356. const maskProps = buildProps({
  51357. zIndex: {
  51358. type: Number,
  51359. default: 1001
  51360. },
  51361. visible: Boolean,
  51362. fill: {
  51363. type: String,
  51364. default: "rgba(0,0,0,0.5)"
  51365. },
  51366. pos: { type: definePropType(Object) },
  51367. targetAreaClickable: {
  51368. type: Boolean,
  51369. default: true
  51370. }
  51371. });
  51372. //#endregion
  51373. //#region ../../packages/components/tour/src/helper.ts
  51374. const useTarget = (target, open, gap, mergedMask, scrollIntoViewOptions) => {
  51375. const posInfo = ref(null);
  51376. const getTargetEl = () => {
  51377. let targetEl;
  51378. if (isString(target.value)) targetEl = document.querySelector(target.value);
  51379. else if (isFunction$1(target.value)) targetEl = target.value();
  51380. else targetEl = target.value;
  51381. return targetEl;
  51382. };
  51383. const updatePosInfo = () => {
  51384. const targetEl = getTargetEl();
  51385. if (!targetEl || !open.value) {
  51386. posInfo.value = null;
  51387. return;
  51388. }
  51389. if (!isInViewPort(targetEl)) targetEl.scrollIntoView(scrollIntoViewOptions.value);
  51390. const { left, top, width, height } = targetEl.getBoundingClientRect();
  51391. posInfo.value = {
  51392. left,
  51393. top,
  51394. width,
  51395. height,
  51396. radius: 0
  51397. };
  51398. };
  51399. onMounted(() => {
  51400. watch([open, target], () => {
  51401. updatePosInfo();
  51402. }, { immediate: true });
  51403. window.addEventListener("resize", updatePosInfo);
  51404. });
  51405. onBeforeUnmount(() => {
  51406. window.removeEventListener("resize", updatePosInfo);
  51407. });
  51408. const getGapOffset = (index) => (isArray$1(gap.value.offset) ? gap.value.offset[index] : gap.value.offset) ?? 6;
  51409. const mergedPosInfo = computed(() => {
  51410. if (!posInfo.value) return posInfo.value;
  51411. const gapOffsetX = getGapOffset(0);
  51412. const gapOffsetY = getGapOffset(1);
  51413. const gapRadius = gap.value?.radius || 2;
  51414. return {
  51415. left: posInfo.value.left - gapOffsetX,
  51416. top: posInfo.value.top - gapOffsetY,
  51417. width: posInfo.value.width + gapOffsetX * 2,
  51418. height: posInfo.value.height + gapOffsetY * 2,
  51419. radius: gapRadius
  51420. };
  51421. });
  51422. return {
  51423. mergedPosInfo,
  51424. triggerTarget: computed(() => {
  51425. const targetEl = getTargetEl();
  51426. if (!mergedMask.value || !targetEl || !window.DOMRect) return targetEl || void 0;
  51427. return { getBoundingClientRect() {
  51428. return window.DOMRect.fromRect({
  51429. width: mergedPosInfo.value?.width || 0,
  51430. height: mergedPosInfo.value?.height || 0,
  51431. x: mergedPosInfo.value?.left || 0,
  51432. y: mergedPosInfo.value?.top || 0
  51433. });
  51434. } };
  51435. })
  51436. };
  51437. };
  51438. const tourKey = Symbol("ElTour");
  51439. function isInViewPort(element) {
  51440. const viewWidth = window.innerWidth || document.documentElement.clientWidth;
  51441. const viewHeight = window.innerHeight || document.documentElement.clientHeight;
  51442. const { top, right, bottom, left } = element.getBoundingClientRect();
  51443. return top >= 0 && left >= 0 && right <= viewWidth && bottom <= viewHeight;
  51444. }
  51445. const useFloating$1 = (referenceRef, contentRef, arrowRef, placement, strategy, offset$2, zIndex, showArrow) => {
  51446. const x = ref();
  51447. const y = ref();
  51448. const middlewareData = ref({});
  51449. const states = {
  51450. x,
  51451. y,
  51452. placement,
  51453. strategy,
  51454. middlewareData
  51455. };
  51456. const middleware = computed(() => {
  51457. const _middleware = [
  51458. offset(unref(offset$2)),
  51459. flip(),
  51460. shift(),
  51461. overflowMiddleware()
  51462. ];
  51463. if (unref(showArrow) && unref(arrowRef)) _middleware.push(arrow({ element: unref(arrowRef) }));
  51464. return _middleware;
  51465. });
  51466. const update = async () => {
  51467. if (!isClient) return;
  51468. const referenceEl = unref(referenceRef);
  51469. const contentEl = unref(contentRef);
  51470. if (!referenceEl || !contentEl) return;
  51471. const data = await computePosition(referenceEl, contentEl, {
  51472. placement: unref(placement),
  51473. strategy: unref(strategy),
  51474. middleware: unref(middleware)
  51475. });
  51476. keysOf(states).forEach((key) => {
  51477. states[key].value = data[key];
  51478. });
  51479. };
  51480. const contentStyle = computed(() => {
  51481. if (!unref(referenceRef)) return {
  51482. position: "fixed",
  51483. top: "50%",
  51484. left: "50%",
  51485. transform: "translate3d(-50%, -50%, 0)",
  51486. maxWidth: "100vw",
  51487. zIndex: unref(zIndex)
  51488. };
  51489. const { overflow } = unref(middlewareData);
  51490. return {
  51491. position: unref(strategy),
  51492. zIndex: unref(zIndex),
  51493. top: unref(y) != null ? `${unref(y)}px` : "",
  51494. left: unref(x) != null ? `${unref(x)}px` : "",
  51495. maxWidth: overflow?.maxWidth ? `${overflow?.maxWidth}px` : ""
  51496. };
  51497. });
  51498. const arrowStyle = computed(() => {
  51499. if (!unref(showArrow)) return {};
  51500. const { arrow } = unref(middlewareData);
  51501. return {
  51502. left: arrow?.x != null ? `${arrow?.x}px` : "",
  51503. top: arrow?.y != null ? `${arrow?.y}px` : ""
  51504. };
  51505. });
  51506. let cleanup;
  51507. onMounted(() => {
  51508. const referenceEl = unref(referenceRef);
  51509. const contentEl = unref(contentRef);
  51510. if (referenceEl && contentEl) cleanup = autoUpdate(referenceEl, contentEl, update);
  51511. watchEffect(() => {
  51512. update();
  51513. });
  51514. });
  51515. onBeforeUnmount(() => {
  51516. cleanup && cleanup();
  51517. });
  51518. return {
  51519. update,
  51520. contentStyle,
  51521. arrowStyle
  51522. };
  51523. };
  51524. const overflowMiddleware = () => {
  51525. return {
  51526. name: "overflow",
  51527. async fn(state) {
  51528. const overflow = await detectOverflow(state);
  51529. let overWidth = 0;
  51530. if (overflow.left > 0) overWidth = overflow.left;
  51531. if (overflow.right > 0) overWidth = overflow.right;
  51532. return { data: { maxWidth: state.rects.floating.width - overWidth } };
  51533. }
  51534. };
  51535. };
  51536. //#endregion
  51537. //#region ../../packages/components/tour/src/mask.vue?vue&type=script&setup=true&lang.ts
  51538. const _hoisted_1$8 = { style: {
  51539. width: "100%",
  51540. height: "100%"
  51541. } };
  51542. const _hoisted_2$4 = ["d"];
  51543. var mask_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  51544. name: "ElTourMask",
  51545. inheritAttrs: false,
  51546. __name: "mask",
  51547. props: maskProps,
  51548. setup(__props) {
  51549. const props = __props;
  51550. const { ns } = inject(tourKey);
  51551. const radius = computed(() => props.pos?.radius ?? 2);
  51552. const roundInfo = computed(() => {
  51553. const v = radius.value;
  51554. const baseInfo = `a${v},${v} 0 0 1`;
  51555. return {
  51556. topRight: `${baseInfo} ${v},${v}`,
  51557. bottomRight: `${baseInfo} ${-v},${v}`,
  51558. bottomLeft: `${baseInfo} ${-v},${-v}`,
  51559. topLeft: `${baseInfo} ${v},${-v}`
  51560. };
  51561. });
  51562. const { width: windowWidth, height: windowHeight } = useWindowSize();
  51563. const path = computed(() => {
  51564. const width = windowWidth.value;
  51565. const height = windowHeight.value;
  51566. const info = roundInfo.value;
  51567. const _path = `M${width},0 L0,0 L0,${height} L${width},${height} L${width},0 Z`;
  51568. const _radius = radius.value;
  51569. return props.pos ? `${_path} M${props.pos.left + _radius},${props.pos.top} h${props.pos.width - _radius * 2} ${info.topRight} v${props.pos.height - _radius * 2} ${info.bottomRight} h${-props.pos.width + _radius * 2} ${info.bottomLeft} v${-props.pos.height + _radius * 2} ${info.topLeft} z` : _path;
  51570. });
  51571. const maskStyle = computed(() => ({
  51572. position: "fixed",
  51573. left: 0,
  51574. right: 0,
  51575. top: 0,
  51576. bottom: 0,
  51577. zIndex: props.zIndex,
  51578. pointerEvents: props.pos && props.targetAreaClickable ? "none" : "auto"
  51579. }));
  51580. const pathStyle = computed(() => ({
  51581. fill: props.fill,
  51582. pointerEvents: "auto",
  51583. cursor: "auto"
  51584. }));
  51585. useLockscreen(toRef(props, "visible"), { ns });
  51586. return (_ctx, _cache) => {
  51587. return __props.visible ? (openBlock(), createElementBlock("div", mergeProps({
  51588. key: 0,
  51589. class: unref(ns).e("mask"),
  51590. style: maskStyle.value
  51591. }, _ctx.$attrs), [(openBlock(), createElementBlock("svg", _hoisted_1$8, [createElementVNode("path", {
  51592. class: normalizeClass(unref(ns).e("hollow")),
  51593. style: normalizeStyle(pathStyle.value),
  51594. d: path.value
  51595. }, null, 14, _hoisted_2$4)]))], 16)) : createCommentVNode("v-if", true);
  51596. };
  51597. }
  51598. });
  51599. //#endregion
  51600. //#region ../../packages/components/tour/src/mask.vue
  51601. var mask_default = mask_vue_vue_type_script_setup_true_lang_default;
  51602. //#endregion
  51603. //#region ../../packages/components/tour/src/content.vue?vue&type=script&setup=true&lang.ts
  51604. const _hoisted_1$7 = ["data-side"];
  51605. var content_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  51606. name: "ElTourContent",
  51607. __name: "content",
  51608. props: tourContentProps,
  51609. emits: tourContentEmits,
  51610. setup(__props, { emit: __emit }) {
  51611. const props = __props;
  51612. const emit = __emit;
  51613. const placement = ref(props.placement);
  51614. const strategy = ref(props.strategy);
  51615. const contentRef = ref(null);
  51616. const arrowRef = ref(null);
  51617. watch(() => props.placement, () => {
  51618. placement.value = props.placement;
  51619. });
  51620. const { contentStyle, arrowStyle } = useFloating$1(toRef(props, "reference"), contentRef, arrowRef, placement, strategy, toRef(props, "offset"), toRef(props, "zIndex"), toRef(props, "showArrow"));
  51621. const side = computed(() => {
  51622. return placement.value.split("-")[0];
  51623. });
  51624. const { ns } = inject(tourKey);
  51625. const onCloseRequested = () => {
  51626. emit("close");
  51627. };
  51628. const onFocusoutPrevented = (event) => {
  51629. if (event.detail.focusReason === "pointer") event.preventDefault();
  51630. };
  51631. return (_ctx, _cache) => {
  51632. return openBlock(), createElementBlock("div", {
  51633. ref_key: "contentRef",
  51634. ref: contentRef,
  51635. style: normalizeStyle(unref(contentStyle)),
  51636. class: normalizeClass(unref(ns).e("content")),
  51637. "data-side": side.value,
  51638. tabindex: "-1"
  51639. }, [createVNode(unref(focus_trap_default), {
  51640. loop: "",
  51641. trapped: "",
  51642. "focus-start-el": "container",
  51643. "focus-trap-el": contentRef.value || void 0,
  51644. onReleaseRequested: onCloseRequested,
  51645. onFocusoutPrevented
  51646. }, {
  51647. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  51648. _: 3
  51649. }, 8, ["focus-trap-el"]), __props.showArrow ? (openBlock(), createElementBlock("span", {
  51650. key: 0,
  51651. ref_key: "arrowRef",
  51652. ref: arrowRef,
  51653. style: normalizeStyle(unref(arrowStyle)),
  51654. class: normalizeClass(unref(ns).e("arrow"))
  51655. }, null, 6)) : createCommentVNode("v-if", true)], 14, _hoisted_1$7);
  51656. };
  51657. }
  51658. });
  51659. //#endregion
  51660. //#region ../../packages/components/tour/src/content.vue
  51661. var content_default$1 = content_vue_vue_type_script_setup_true_lang_default;
  51662. //#endregion
  51663. //#region ../../packages/components/tour/src/steps.ts
  51664. var steps_default = defineComponent({
  51665. name: "ElTourSteps",
  51666. props: { current: {
  51667. type: Number,
  51668. default: 0
  51669. } },
  51670. emits: ["update-total"],
  51671. setup(props, { slots, emit }) {
  51672. let cacheTotal = 0;
  51673. return () => {
  51674. const children = slots.default?.();
  51675. const result = [];
  51676. let total = 0;
  51677. function filterSteps(children) {
  51678. if (!isArray$1(children)) return;
  51679. children.forEach((item) => {
  51680. if ((item?.type || {})?.name === "ElTourStep") {
  51681. result.push(item);
  51682. total += 1;
  51683. }
  51684. });
  51685. }
  51686. if (children.length) filterSteps(flattedChildren(children[0]?.children));
  51687. if (cacheTotal !== total) {
  51688. cacheTotal = total;
  51689. emit("update-total", total);
  51690. }
  51691. if (result.length) return result[props.current];
  51692. return null;
  51693. };
  51694. }
  51695. });
  51696. //#endregion
  51697. //#region ../../packages/components/tour/src/tour.vue?vue&type=script&setup=true&lang.ts
  51698. var tour_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  51699. name: "ElTour",
  51700. inheritAttrs: false,
  51701. __name: "tour",
  51702. props: tourProps,
  51703. emits: tourEmits,
  51704. setup(__props, { emit: __emit }) {
  51705. const props = __props;
  51706. const emit = __emit;
  51707. const ns = useNamespace("tour");
  51708. const total = ref(0);
  51709. const currentStep = ref();
  51710. const isControlled = computed(() => !isUndefined(props.current));
  51711. const innerCurrent = ref(props.current ?? 0);
  51712. const current = computed({
  51713. get() {
  51714. return isUndefined(props.current) ? innerCurrent.value : props.current;
  51715. },
  51716. set(newValue) {
  51717. if ((isControlled.value ? props.current : innerCurrent.value) === newValue) return;
  51718. if (!isControlled.value) innerCurrent.value = newValue;
  51719. emit("update:current", newValue);
  51720. }
  51721. });
  51722. const currentTarget = computed(() => currentStep.value?.target);
  51723. const kls = computed(() => [ns.b(), mergedType.value === "primary" ? ns.m("primary") : ""]);
  51724. const mergedPlacement = computed(() => currentStep.value?.placement || props.placement);
  51725. const mergedContentStyle = computed(() => currentStep.value?.contentStyle ?? props.contentStyle);
  51726. const mergedMask = computed(() => currentStep.value?.mask ?? props.mask);
  51727. const mergedShowMask = computed(() => !!mergedMask.value && props.modelValue);
  51728. const mergedMaskStyle = computed(() => isBoolean(mergedMask.value) ? void 0 : mergedMask.value);
  51729. const mergedShowArrow = computed(() => !!currentTarget.value && (currentStep.value?.showArrow ?? props.showArrow));
  51730. const mergedScrollIntoViewOptions = computed(() => currentStep.value?.scrollIntoViewOptions ?? props.scrollIntoViewOptions);
  51731. const mergedType = computed(() => currentStep.value?.type ?? props.type);
  51732. const { nextZIndex } = useZIndex();
  51733. const nowZIndex = nextZIndex();
  51734. const mergedZIndex = computed(() => props.zIndex ?? nowZIndex);
  51735. const { mergedPosInfo: pos, triggerTarget } = useTarget(currentTarget, toRef(props, "modelValue"), toRef(props, "gap"), mergedMask, mergedScrollIntoViewOptions);
  51736. watch(() => props.current, (val) => !isUndefined(val) && (innerCurrent.value = val));
  51737. watch(current, (newCurrent, oldCurrent) => {
  51738. if (!props.modelValue || newCurrent === oldCurrent) return;
  51739. emit(CHANGE_EVENT, newCurrent);
  51740. }, { flush: "post" });
  51741. watch(() => props.modelValue, (val) => {
  51742. if (!val && current.value !== 0) current.value = 0;
  51743. });
  51744. const onEscClose = () => {
  51745. if (props.closeOnPressEscape) {
  51746. emit(UPDATE_MODEL_EVENT, false);
  51747. emit("close", current.value);
  51748. }
  51749. };
  51750. const onUpdateTotal = (val) => {
  51751. total.value = val;
  51752. };
  51753. const slots = useSlots();
  51754. provide(tourKey, {
  51755. currentStep,
  51756. current,
  51757. total,
  51758. showClose: toRef(props, "showClose"),
  51759. closeIcon: toRef(props, "closeIcon"),
  51760. mergedType,
  51761. ns,
  51762. slots,
  51763. updateModelValue(modelValue) {
  51764. emit(UPDATE_MODEL_EVENT, modelValue);
  51765. },
  51766. onClose() {
  51767. emit("close", current.value);
  51768. },
  51769. onFinish() {
  51770. emit("finish");
  51771. }
  51772. });
  51773. return (_ctx, _cache) => {
  51774. return openBlock(), createElementBlock(Fragment, null, [
  51775. (openBlock(), createBlock(Teleport, { to: __props.appendTo }, [createElementVNode("div", mergeProps({ class: kls.value }, _ctx.$attrs), [createVNode(mask_default, {
  51776. visible: mergedShowMask.value,
  51777. fill: mergedMaskStyle.value?.color,
  51778. style: normalizeStyle(mergedMaskStyle.value?.style),
  51779. pos: unref(pos),
  51780. "z-index": mergedZIndex.value,
  51781. "target-area-clickable": __props.targetAreaClickable
  51782. }, null, 8, [
  51783. "visible",
  51784. "fill",
  51785. "style",
  51786. "pos",
  51787. "z-index",
  51788. "target-area-clickable"
  51789. ]), __props.modelValue ? (openBlock(), createBlock(content_default$1, {
  51790. key: current.value,
  51791. reference: unref(triggerTarget),
  51792. placement: mergedPlacement.value,
  51793. "show-arrow": mergedShowArrow.value,
  51794. "z-index": mergedZIndex.value,
  51795. style: normalizeStyle(mergedContentStyle.value),
  51796. onClose: onEscClose
  51797. }, {
  51798. default: withCtx(() => [createVNode(unref(steps_default), {
  51799. current: current.value,
  51800. onUpdateTotal
  51801. }, {
  51802. default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
  51803. _: 3
  51804. }, 8, ["current"])]),
  51805. _: 3
  51806. }, 8, [
  51807. "reference",
  51808. "placement",
  51809. "show-arrow",
  51810. "z-index",
  51811. "style"
  51812. ])) : createCommentVNode("v-if", true)], 16)], 8, ["to"])),
  51813. createCommentVNode(" just for IDE "),
  51814. createCommentVNode("v-if", true)
  51815. ], 64);
  51816. };
  51817. }
  51818. });
  51819. //#endregion
  51820. //#region ../../packages/components/tour/src/tour.vue
  51821. var tour_default = tour_vue_vue_type_script_setup_true_lang_default;
  51822. //#endregion
  51823. //#region ../../packages/components/tour/src/step.ts
  51824. const tourStepProps = buildProps({
  51825. target: { type: definePropType([
  51826. String,
  51827. Object,
  51828. Function
  51829. ]) },
  51830. title: String,
  51831. description: String,
  51832. showClose: {
  51833. type: Boolean,
  51834. default: void 0
  51835. },
  51836. closeIcon: { type: iconPropType },
  51837. showArrow: {
  51838. type: Boolean,
  51839. default: void 0
  51840. },
  51841. placement: tourContentProps.placement,
  51842. mask: {
  51843. type: definePropType([Boolean, Object]),
  51844. default: void 0
  51845. },
  51846. contentStyle: { type: definePropType([Object]) },
  51847. prevButtonProps: { type: definePropType(Object) },
  51848. nextButtonProps: { type: definePropType(Object) },
  51849. scrollIntoViewOptions: {
  51850. type: definePropType([Boolean, Object]),
  51851. default: void 0
  51852. },
  51853. type: { type: definePropType(String) }
  51854. });
  51855. const tourStepEmits = { close: () => true };
  51856. //#endregion
  51857. //#region ../../packages/components/tour/src/step.vue?vue&type=script&setup=true&lang.ts
  51858. const _hoisted_1$6 = ["aria-label"];
  51859. var step_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  51860. name: "ElTourStep",
  51861. __name: "step",
  51862. props: tourStepProps,
  51863. emits: tourStepEmits,
  51864. setup(__props, { emit: __emit }) {
  51865. const props = __props;
  51866. const emit = __emit;
  51867. const { Close } = CloseComponents;
  51868. const { t } = useLocale();
  51869. const { currentStep, current, total, showClose, closeIcon, mergedType, ns, slots: tourSlots, updateModelValue, onClose: tourOnClose, onFinish: tourOnFinish } = inject(tourKey);
  51870. watch(props, (val) => {
  51871. currentStep.value = val;
  51872. }, { immediate: true });
  51873. const mergedShowClose = computed(() => props.showClose ?? showClose.value);
  51874. const mergedCloseIcon = computed(() => props.closeIcon ?? closeIcon.value ?? Close);
  51875. const filterButtonProps = (btnProps) => {
  51876. if (!btnProps) return;
  51877. return omit(btnProps, ["children", "onClick"]);
  51878. };
  51879. const onPrev = () => {
  51880. current.value -= 1;
  51881. if (props.prevButtonProps?.onClick) props.prevButtonProps?.onClick();
  51882. };
  51883. const onNext = () => {
  51884. if (current.value >= total.value - 1) onFinish();
  51885. else current.value += 1;
  51886. if (props.nextButtonProps?.onClick) props.nextButtonProps.onClick();
  51887. };
  51888. const onFinish = () => {
  51889. onClose();
  51890. tourOnFinish();
  51891. };
  51892. const onClose = () => {
  51893. updateModelValue(false);
  51894. tourOnClose();
  51895. emit("close");
  51896. };
  51897. const handleKeydown = (e) => {
  51898. if (e.target?.isContentEditable) return;
  51899. switch (getEventCode(e)) {
  51900. case EVENT_CODE.left:
  51901. e.preventDefault();
  51902. current.value > 0 && onPrev();
  51903. break;
  51904. case EVENT_CODE.right:
  51905. e.preventDefault();
  51906. onNext();
  51907. break;
  51908. }
  51909. };
  51910. onMounted(() => {
  51911. window.addEventListener("keydown", handleKeydown);
  51912. });
  51913. onBeforeUnmount(() => {
  51914. window.removeEventListener("keydown", handleKeydown);
  51915. });
  51916. return (_ctx, _cache) => {
  51917. return openBlock(), createElementBlock(Fragment, null, [
  51918. mergedShowClose.value ? (openBlock(), createElementBlock("button", {
  51919. key: 0,
  51920. "aria-label": unref(t)("el.tour.close"),
  51921. class: normalizeClass(unref(ns).e("closebtn")),
  51922. type: "button",
  51923. onClick: onClose
  51924. }, [createVNode(unref(ElIcon), { class: normalizeClass(unref(ns).e("close")) }, {
  51925. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(mergedCloseIcon.value)))]),
  51926. _: 1
  51927. }, 8, ["class"])], 10, _hoisted_1$6)) : createCommentVNode("v-if", true),
  51928. createElementVNode("header", { class: normalizeClass([unref(ns).e("header"), { "show-close": unref(showClose) }]) }, [renderSlot(_ctx.$slots, "header", {}, () => [createElementVNode("span", {
  51929. role: "heading",
  51930. class: normalizeClass(unref(ns).e("title"))
  51931. }, toDisplayString(__props.title), 3)])], 2),
  51932. createElementVNode("div", { class: normalizeClass(unref(ns).e("body")) }, [renderSlot(_ctx.$slots, "default", {}, () => [createElementVNode("span", null, toDisplayString(__props.description), 1)])], 2),
  51933. createElementVNode("footer", { class: normalizeClass(unref(ns).e("footer")) }, [createElementVNode("div", { class: normalizeClass(unref(ns).b("indicators")) }, [unref(tourSlots).indicators ? (openBlock(), createBlock(resolveDynamicComponent(unref(tourSlots).indicators), {
  51934. key: 0,
  51935. current: unref(current),
  51936. total: unref(total)
  51937. }, null, 8, ["current", "total"])) : (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(unref(total), (item, index) => {
  51938. return openBlock(), createElementBlock("span", {
  51939. key: item,
  51940. class: normalizeClass([unref(ns).b("indicator"), unref(ns).is("active", index === unref(current))])
  51941. }, null, 2);
  51942. }), 128))], 2), createElementVNode("div", { class: normalizeClass(unref(ns).b("buttons")) }, [unref(current) > 0 ? (openBlock(), createBlock(unref(ElButton), mergeProps({
  51943. key: 0,
  51944. size: "small",
  51945. type: unref(mergedType)
  51946. }, filterButtonProps(__props.prevButtonProps), { onClick: onPrev }), {
  51947. default: withCtx(() => [createTextVNode(toDisplayString(__props.prevButtonProps?.children ?? unref(t)("el.tour.previous")), 1)]),
  51948. _: 1
  51949. }, 16, ["type"])) : createCommentVNode("v-if", true), unref(current) <= unref(total) - 1 ? (openBlock(), createBlock(unref(ElButton), mergeProps({
  51950. key: 1,
  51951. size: "small",
  51952. type: unref(mergedType) === "primary" ? "default" : "primary"
  51953. }, filterButtonProps(__props.nextButtonProps), { onClick: onNext }), {
  51954. default: withCtx(() => [createTextVNode(toDisplayString(__props.nextButtonProps?.children ?? (unref(current) === unref(total) - 1 ? unref(t)("el.tour.finish") : unref(t)("el.tour.next"))), 1)]),
  51955. _: 1
  51956. }, 16, ["type"])) : createCommentVNode("v-if", true)], 2)], 2)
  51957. ], 64);
  51958. };
  51959. }
  51960. });
  51961. //#endregion
  51962. //#region ../../packages/components/tour/src/step.vue
  51963. var step_default = step_vue_vue_type_script_setup_true_lang_default;
  51964. //#endregion
  51965. //#region ../../packages/components/tour/index.ts
  51966. const ElTour = withInstall(tour_default, { TourStep: step_default });
  51967. const ElTourStep = withNoopInstall(step_default);
  51968. //#endregion
  51969. //#region ../../packages/components/anchor/src/anchor.ts
  51970. const anchorProps = buildProps({
  51971. container: { type: definePropType([String, Object]) },
  51972. offset: {
  51973. type: Number,
  51974. default: 0
  51975. },
  51976. bound: {
  51977. type: Number,
  51978. default: 15
  51979. },
  51980. duration: {
  51981. type: Number,
  51982. default: 300
  51983. },
  51984. marker: {
  51985. type: Boolean,
  51986. default: true
  51987. },
  51988. type: {
  51989. type: definePropType(String),
  51990. default: "default"
  51991. },
  51992. direction: {
  51993. type: definePropType(String),
  51994. default: "vertical"
  51995. },
  51996. selectScrollTop: Boolean
  51997. });
  51998. const anchorEmits = {
  51999. change: (href) => isString(href),
  52000. click: (e, href) => e instanceof MouseEvent && (isString(href) || isUndefined(href))
  52001. };
  52002. //#endregion
  52003. //#region ../../packages/components/anchor/src/constants.ts
  52004. const anchorKey = Symbol("anchor");
  52005. //#endregion
  52006. //#region ../../packages/components/anchor/src/anchor.vue?vue&type=script&setup=true&lang.ts
  52007. var anchor_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  52008. name: "ElAnchor",
  52009. __name: "anchor",
  52010. props: anchorProps,
  52011. emits: anchorEmits,
  52012. setup(__props, { expose: __expose, emit: __emit }) {
  52013. const props = __props;
  52014. const emit = __emit;
  52015. const slots = useSlots();
  52016. const currentAnchor = ref("");
  52017. const markerStyle = ref({});
  52018. const anchorRef = ref(null);
  52019. const markerRef = ref(null);
  52020. const containerEl = ref();
  52021. const links = {};
  52022. let isScrolling = false;
  52023. let currentScrollTop = 0;
  52024. const ns = useNamespace("anchor");
  52025. const cls = computed(() => [
  52026. ns.b(),
  52027. props.type === "underline" ? ns.m("underline") : "",
  52028. ns.m(props.direction)
  52029. ]);
  52030. const addLink = (state) => {
  52031. links[state.href] = state.el;
  52032. };
  52033. const removeLink = (href) => {
  52034. delete links[href];
  52035. };
  52036. const setCurrentAnchor = (href) => {
  52037. if (currentAnchor.value !== href) {
  52038. currentAnchor.value = href;
  52039. emit(CHANGE_EVENT, href);
  52040. }
  52041. };
  52042. let clearAnimate = null;
  52043. let currentTargetHref = "";
  52044. const scrollToAnchor = (href) => {
  52045. if (!containerEl.value) return;
  52046. const target = getElement(href);
  52047. if (!target) return;
  52048. if (clearAnimate) {
  52049. if (currentTargetHref === href) return;
  52050. clearAnimate();
  52051. }
  52052. currentTargetHref = href;
  52053. isScrolling = true;
  52054. const scrollEle = getScrollElement(target, containerEl.value);
  52055. const distance = getOffsetTopDistance(target, scrollEle);
  52056. const max = scrollEle.scrollHeight - scrollEle.clientHeight;
  52057. const to = Math.min(distance - props.offset, max);
  52058. clearAnimate = animateScrollTo(containerEl.value, currentScrollTop, to, props.duration, () => {
  52059. setTimeout(() => {
  52060. isScrolling = false;
  52061. currentTargetHref = "";
  52062. }, 20);
  52063. });
  52064. };
  52065. const scrollTo = (href) => {
  52066. if (href) {
  52067. setCurrentAnchor(href);
  52068. scrollToAnchor(href);
  52069. }
  52070. };
  52071. const handleClick = (e, href) => {
  52072. emit("click", e, href);
  52073. scrollTo(href);
  52074. };
  52075. const handleScroll = throttleByRaf(() => {
  52076. if (containerEl.value) currentScrollTop = getScrollTop(containerEl.value);
  52077. const currentHref = getCurrentHref();
  52078. if (isScrolling || isUndefined(currentHref)) return;
  52079. setCurrentAnchor(currentHref);
  52080. });
  52081. const getCurrentHref = () => {
  52082. if (!containerEl.value) return;
  52083. const scrollTop = getScrollTop(containerEl.value);
  52084. const anchorTopList = [];
  52085. for (const href of Object.keys(links)) {
  52086. const target = getElement(href);
  52087. if (!target) continue;
  52088. const distance = getOffsetTopDistance(target, getScrollElement(target, containerEl.value));
  52089. anchorTopList.push({
  52090. top: distance - props.offset - props.bound,
  52091. href
  52092. });
  52093. }
  52094. anchorTopList.sort((prev, next) => prev.top - next.top);
  52095. for (let i = 0; i < anchorTopList.length; i++) {
  52096. const item = anchorTopList[i];
  52097. const next = anchorTopList[i + 1];
  52098. if (i === 0 && scrollTop === 0) return props.selectScrollTop ? item.href : "";
  52099. if (item.top <= scrollTop && (!next || next.top > scrollTop)) return item.href;
  52100. }
  52101. };
  52102. const getContainer = () => {
  52103. const el = getElement(props.container);
  52104. if (!el || isWindow(el)) containerEl.value = window;
  52105. else containerEl.value = el;
  52106. };
  52107. useEventListener(containerEl, "scroll", handleScroll);
  52108. const updateMarkerStyle = () => {
  52109. nextTick(() => {
  52110. if (!anchorRef.value || !markerRef.value || !currentAnchor.value) {
  52111. markerStyle.value = {};
  52112. return;
  52113. }
  52114. const currentLinkEl = links[currentAnchor.value];
  52115. if (!currentLinkEl) {
  52116. markerStyle.value = {};
  52117. return;
  52118. }
  52119. const anchorRect = anchorRef.value.getBoundingClientRect();
  52120. const markerRect = markerRef.value.getBoundingClientRect();
  52121. const linkRect = currentLinkEl.getBoundingClientRect();
  52122. if (props.direction === "horizontal") markerStyle.value = {
  52123. left: `${linkRect.left - anchorRect.left}px`,
  52124. width: `${linkRect.width}px`,
  52125. opacity: 1
  52126. };
  52127. else markerStyle.value = {
  52128. top: `${linkRect.top - anchorRect.top + (linkRect.height - markerRect.height) / 2}px`,
  52129. opacity: 1
  52130. };
  52131. });
  52132. };
  52133. watch(currentAnchor, updateMarkerStyle);
  52134. watch(() => slots.default?.(), updateMarkerStyle);
  52135. onMounted(() => {
  52136. getContainer();
  52137. const hash = decodeURIComponent(window.location.hash);
  52138. if (getElement(hash)) scrollTo(hash);
  52139. else handleScroll();
  52140. });
  52141. watch(() => props.container, () => {
  52142. getContainer();
  52143. });
  52144. provide(anchorKey, {
  52145. ns,
  52146. direction: props.direction,
  52147. currentAnchor,
  52148. addLink,
  52149. removeLink,
  52150. handleClick
  52151. });
  52152. __expose({ scrollTo });
  52153. return (_ctx, _cache) => {
  52154. return openBlock(), createElementBlock("div", {
  52155. ref_key: "anchorRef",
  52156. ref: anchorRef,
  52157. class: normalizeClass(cls.value)
  52158. }, [__props.marker ? (openBlock(), createElementBlock("div", {
  52159. key: 0,
  52160. ref_key: "markerRef",
  52161. ref: markerRef,
  52162. class: normalizeClass(unref(ns).e("marker")),
  52163. style: normalizeStyle(markerStyle.value)
  52164. }, null, 6)) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("list")) }, [renderSlot(_ctx.$slots, "default")], 2)], 2);
  52165. };
  52166. }
  52167. });
  52168. //#endregion
  52169. //#region ../../packages/components/anchor/src/anchor.vue
  52170. var anchor_default = anchor_vue_vue_type_script_setup_true_lang_default;
  52171. //#endregion
  52172. //#region ../../packages/components/anchor/src/anchor-link.ts
  52173. const anchorLinkProps = buildProps({
  52174. title: String,
  52175. href: String
  52176. });
  52177. //#endregion
  52178. //#region ../../packages/components/anchor/src/anchor-link.vue?vue&type=script&setup=true&lang.ts
  52179. const _hoisted_1$5 = ["href"];
  52180. var anchor_link_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  52181. name: "ElAnchorLink",
  52182. __name: "anchor-link",
  52183. props: anchorLinkProps,
  52184. setup(__props) {
  52185. const props = __props;
  52186. const linkRef = ref(null);
  52187. const { ns, direction, currentAnchor, addLink, removeLink, handleClick: contextHandleClick } = inject(anchorKey);
  52188. const cls = computed(() => [ns.e("link"), ns.is("active", currentAnchor.value === props.href)]);
  52189. const handleClick = (e) => {
  52190. contextHandleClick(e, props.href);
  52191. };
  52192. watch(() => props.href, (val, oldVal) => {
  52193. nextTick(() => {
  52194. if (oldVal) removeLink(oldVal);
  52195. if (val) addLink({
  52196. href: val,
  52197. el: linkRef.value
  52198. });
  52199. });
  52200. });
  52201. onMounted(() => {
  52202. const { href } = props;
  52203. if (href) addLink({
  52204. href,
  52205. el: linkRef.value
  52206. });
  52207. });
  52208. onBeforeUnmount(() => {
  52209. const { href } = props;
  52210. if (href) removeLink(href);
  52211. });
  52212. return (_ctx, _cache) => {
  52213. return openBlock(), createElementBlock("div", { class: normalizeClass(unref(ns).e("item")) }, [createElementVNode("a", {
  52214. ref_key: "linkRef",
  52215. ref: linkRef,
  52216. class: normalizeClass(cls.value),
  52217. href: __props.href,
  52218. onClick: handleClick
  52219. }, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.title), 1)])], 10, _hoisted_1$5), _ctx.$slots["sub-link"] && unref(direction) === "vertical" ? (openBlock(), createElementBlock("div", {
  52220. key: 0,
  52221. class: normalizeClass(unref(ns).e("list"))
  52222. }, [renderSlot(_ctx.$slots, "sub-link")], 2)) : createCommentVNode("v-if", true)], 2);
  52223. };
  52224. }
  52225. });
  52226. //#endregion
  52227. //#region ../../packages/components/anchor/src/anchor-link.vue
  52228. var anchor_link_default = anchor_link_vue_vue_type_script_setup_true_lang_default;
  52229. //#endregion
  52230. //#region ../../packages/components/anchor/index.ts
  52231. const ElAnchor = withInstall(anchor_default, { AnchorLink: anchor_link_default });
  52232. const ElAnchorLink = withNoopInstall(anchor_link_default);
  52233. //#endregion
  52234. //#region ../../packages/components/segmented/src/segmented.ts
  52235. const defaultProps = {
  52236. label: "label",
  52237. value: "value",
  52238. disabled: "disabled"
  52239. };
  52240. const segmentedProps = buildProps({
  52241. direction: {
  52242. type: definePropType(String),
  52243. default: "horizontal"
  52244. },
  52245. options: {
  52246. type: definePropType(Array),
  52247. default: () => []
  52248. },
  52249. modelValue: {
  52250. type: [
  52251. String,
  52252. Number,
  52253. Boolean
  52254. ],
  52255. default: void 0
  52256. },
  52257. props: {
  52258. type: definePropType(Object),
  52259. default: () => defaultProps
  52260. },
  52261. block: Boolean,
  52262. size: useSizeProp,
  52263. disabled: {
  52264. type: Boolean,
  52265. default: void 0
  52266. },
  52267. validateEvent: {
  52268. type: Boolean,
  52269. default: true
  52270. },
  52271. id: String,
  52272. name: String,
  52273. ...useAriaProps(["ariaLabel"])
  52274. });
  52275. const segmentedEmits = {
  52276. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  52277. [CHANGE_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val)
  52278. };
  52279. //#endregion
  52280. //#region ../../packages/components/segmented/src/segmented.vue?vue&type=script&setup=true&lang.ts
  52281. const _hoisted_1$4 = [
  52282. "id",
  52283. "aria-label",
  52284. "aria-labelledby"
  52285. ];
  52286. const _hoisted_2$3 = [
  52287. "name",
  52288. "disabled",
  52289. "checked",
  52290. "onChange"
  52291. ];
  52292. var segmented_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  52293. name: "ElSegmented",
  52294. __name: "segmented",
  52295. props: segmentedProps,
  52296. emits: segmentedEmits,
  52297. setup(__props, { emit: __emit }) {
  52298. const props = __props;
  52299. const emit = __emit;
  52300. const ns = useNamespace("segmented");
  52301. const segmentedId = useId();
  52302. const segmentedSize = useFormSize();
  52303. const _disabled = useFormDisabled();
  52304. const { formItem } = useFormItem();
  52305. const { inputId, isLabeledByFormItem } = useFormItemInputId(props, { formItemContext: formItem });
  52306. const segmentedRef = ref(null);
  52307. const activeElement = useActiveElement();
  52308. const state = reactive({
  52309. isInit: false,
  52310. width: 0,
  52311. height: 0,
  52312. translateX: 0,
  52313. translateY: 0,
  52314. focusVisible: false
  52315. });
  52316. const handleChange = (evt, item) => {
  52317. const value = getValue(item);
  52318. emit(UPDATE_MODEL_EVENT, value);
  52319. emit(CHANGE_EVENT, value);
  52320. evt.target.checked = value === props.modelValue;
  52321. };
  52322. const aliasProps = computed(() => ({
  52323. ...defaultProps,
  52324. ...props.props
  52325. }));
  52326. const getValue = (item) => {
  52327. return isObject$1(item) ? item[aliasProps.value.value] : item;
  52328. };
  52329. const getLabel = (item) => {
  52330. return isObject$1(item) ? item[aliasProps.value.label] : item;
  52331. };
  52332. const getDisabled = (item) => {
  52333. return !!(_disabled.value || (isObject$1(item) ? item[aliasProps.value.disabled] : false));
  52334. };
  52335. const getSelected = (item) => {
  52336. return props.modelValue === getValue(item);
  52337. };
  52338. const getOption = (value) => {
  52339. return props.options.find((item) => getValue(item) === value);
  52340. };
  52341. const getItemCls = (item) => {
  52342. return [
  52343. ns.e("item"),
  52344. ns.is("selected", getSelected(item)),
  52345. ns.is("disabled", getDisabled(item))
  52346. ];
  52347. };
  52348. const updateSelect = () => {
  52349. if (!segmentedRef.value) return;
  52350. const selectedItem = segmentedRef.value.querySelector(".is-selected");
  52351. const selectedItemInput = segmentedRef.value.querySelector(".is-selected input");
  52352. if (!selectedItem || !selectedItemInput) {
  52353. state.width = 0;
  52354. state.height = 0;
  52355. state.translateX = 0;
  52356. state.translateY = 0;
  52357. state.focusVisible = false;
  52358. return;
  52359. }
  52360. state.isInit = true;
  52361. if (props.direction === "vertical") {
  52362. state.height = selectedItem.offsetHeight;
  52363. state.translateY = selectedItem.offsetTop;
  52364. } else {
  52365. state.width = selectedItem.offsetWidth;
  52366. state.translateX = selectedItem.offsetLeft;
  52367. }
  52368. try {
  52369. state.focusVisible = selectedItemInput.matches(":focus-visible");
  52370. } catch {}
  52371. };
  52372. const segmentedCls = computed(() => [
  52373. ns.b(),
  52374. ns.m(segmentedSize.value),
  52375. ns.is("block", props.block)
  52376. ]);
  52377. const selectedStyle = computed(() => ({
  52378. width: props.direction === "vertical" ? "100%" : `${state.width}px`,
  52379. height: props.direction === "vertical" ? `${state.height}px` : "100%",
  52380. transform: props.direction === "vertical" ? `translateY(${state.translateY}px)` : `translateX(${state.translateX}px)`,
  52381. display: state.isInit ? "block" : "none"
  52382. }));
  52383. const selectedCls = computed(() => [
  52384. ns.e("item-selected"),
  52385. ns.is("disabled", getDisabled(getOption(props.modelValue))),
  52386. ns.is("focus-visible", state.focusVisible)
  52387. ]);
  52388. const name = computed(() => {
  52389. return props.name || segmentedId.value;
  52390. });
  52391. useResizeObserver(segmentedRef, updateSelect);
  52392. watch(activeElement, updateSelect);
  52393. watch(() => props.options, updateSelect, {
  52394. deep: true,
  52395. flush: "post"
  52396. });
  52397. watch(() => props.modelValue, () => {
  52398. updateSelect();
  52399. if (props.validateEvent) formItem?.validate?.("change").catch(NOOP);
  52400. }, { flush: "post" });
  52401. return (_ctx, _cache) => {
  52402. return __props.options.length ? (openBlock(), createElementBlock("div", {
  52403. key: 0,
  52404. id: unref(inputId),
  52405. ref_key: "segmentedRef",
  52406. ref: segmentedRef,
  52407. class: normalizeClass(segmentedCls.value),
  52408. role: "radiogroup",
  52409. "aria-label": !unref(isLabeledByFormItem) ? __props.ariaLabel || "segmented" : void 0,
  52410. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
  52411. }, [createElementVNode("div", { class: normalizeClass([unref(ns).e("group"), unref(ns).m(__props.direction)]) }, [createElementVNode("div", {
  52412. style: normalizeStyle(selectedStyle.value),
  52413. class: normalizeClass(selectedCls.value)
  52414. }, null, 6), (openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item, index) => {
  52415. return openBlock(), createElementBlock("label", {
  52416. key: index,
  52417. class: normalizeClass(getItemCls(item))
  52418. }, [createElementVNode("input", {
  52419. class: normalizeClass(unref(ns).e("item-input")),
  52420. type: "radio",
  52421. name: name.value,
  52422. disabled: getDisabled(item),
  52423. checked: getSelected(item),
  52424. onChange: ($event) => handleChange($event, item)
  52425. }, null, 42, _hoisted_2$3), createElementVNode("div", { class: normalizeClass(unref(ns).e("item-label")) }, [renderSlot(_ctx.$slots, "default", { item }, () => [createTextVNode(toDisplayString(getLabel(item)), 1)])], 2)], 2);
  52426. }), 128))], 2)], 10, _hoisted_1$4)) : createCommentVNode("v-if", true);
  52427. };
  52428. }
  52429. });
  52430. //#endregion
  52431. //#region ../../packages/components/segmented/src/segmented.vue
  52432. var segmented_default = segmented_vue_vue_type_script_setup_true_lang_default;
  52433. //#endregion
  52434. //#region ../../packages/components/segmented/index.ts
  52435. const ElSegmented = withInstall(segmented_default);
  52436. //#endregion
  52437. //#region ../../packages/components/mention/src/helper.ts
  52438. const filterOption = (pattern, option) => {
  52439. const lowerCase = pattern.toLowerCase();
  52440. return (option.label || option.value || "").toLowerCase().includes(lowerCase);
  52441. };
  52442. const getMentionCtx = (inputEl, prefix, split) => {
  52443. const { selectionEnd } = inputEl;
  52444. if (selectionEnd === null) return;
  52445. const inputValue = inputEl.value;
  52446. const prefixArray = castArray$1(prefix);
  52447. let splitIndex = -1;
  52448. let mentionCtx;
  52449. for (let i = selectionEnd - 1; i >= 0; --i) {
  52450. const char = inputValue[i];
  52451. if (splitIndex === -1 && (char === split || char === "\n" || char === "\r")) {
  52452. splitIndex = i;
  52453. continue;
  52454. }
  52455. if (prefixArray.includes(char)) {
  52456. const end = splitIndex === -1 ? selectionEnd : splitIndex;
  52457. mentionCtx = {
  52458. pattern: inputValue.slice(i + 1, end),
  52459. start: i + 1,
  52460. end,
  52461. prefix: char,
  52462. prefixIndex: i,
  52463. splitIndex,
  52464. selectionEnd
  52465. };
  52466. break;
  52467. }
  52468. }
  52469. return mentionCtx;
  52470. };
  52471. const getCursorPosition = (element, options = {
  52472. debug: false,
  52473. useSelectionEnd: false
  52474. }) => {
  52475. const selectionStart = element.selectionStart !== null ? element.selectionStart : 0;
  52476. const selectionEnd = element.selectionEnd !== null ? element.selectionEnd : 0;
  52477. const position = options.useSelectionEnd ? selectionEnd : selectionStart;
  52478. const properties = [
  52479. "direction",
  52480. "boxSizing",
  52481. "width",
  52482. "height",
  52483. "overflowX",
  52484. "overflowY",
  52485. "borderTopWidth",
  52486. "borderRightWidth",
  52487. "borderBottomWidth",
  52488. "borderLeftWidth",
  52489. "borderStyle",
  52490. "paddingTop",
  52491. "paddingRight",
  52492. "paddingBottom",
  52493. "paddingLeft",
  52494. "fontStyle",
  52495. "fontVariant",
  52496. "fontWeight",
  52497. "fontStretch",
  52498. "fontSize",
  52499. "fontSizeAdjust",
  52500. "lineHeight",
  52501. "fontFamily",
  52502. "textAlign",
  52503. "textTransform",
  52504. "textIndent",
  52505. "textDecoration",
  52506. "letterSpacing",
  52507. "wordSpacing",
  52508. "tabSize",
  52509. "MozTabSize"
  52510. ];
  52511. if (options.debug) {
  52512. const el = document.querySelector("#input-textarea-caret-position-mirror-div");
  52513. if (el?.parentNode) el.parentNode.removeChild(el);
  52514. }
  52515. const div = document.createElement("div");
  52516. div.id = "input-textarea-caret-position-mirror-div";
  52517. document.body.appendChild(div);
  52518. const style = div.style;
  52519. const computed = window.getComputedStyle(element);
  52520. const isInput = element.nodeName === "INPUT";
  52521. style.whiteSpace = isInput ? "nowrap" : "pre-wrap";
  52522. if (!isInput) style.wordWrap = "break-word";
  52523. style.position = "absolute";
  52524. if (!options.debug) style.visibility = "hidden";
  52525. properties.forEach((prop) => {
  52526. if (isInput && prop === "lineHeight") if (computed.boxSizing === "border-box") {
  52527. const height = Number.parseInt(computed.height);
  52528. const outerHeight = Number.parseInt(computed.paddingTop) + Number.parseInt(computed.paddingBottom) + Number.parseInt(computed.borderTopWidth) + Number.parseInt(computed.borderBottomWidth);
  52529. const targetHeight = outerHeight + Number.parseInt(computed.lineHeight);
  52530. if (height > targetHeight) style.lineHeight = `${height - outerHeight}px`;
  52531. else if (height === targetHeight) style.lineHeight = computed.lineHeight;
  52532. else style.lineHeight = "0";
  52533. } else style.lineHeight = computed.height;
  52534. else style[prop] = computed[prop];
  52535. });
  52536. if (isFirefox()) {
  52537. if (element.scrollHeight > Number.parseInt(computed.height)) style.overflowY = "scroll";
  52538. } else style.overflow = "hidden";
  52539. div.textContent = element.value.slice(0, Math.max(0, position));
  52540. if (isInput && div.textContent) div.textContent = div.textContent.replace(/\s/g, "\xA0");
  52541. const span = document.createElement("span");
  52542. span.textContent = element.value.slice(Math.max(0, position)) || ".";
  52543. span.style.position = "relative";
  52544. span.style.left = `${-element.scrollLeft}px`;
  52545. span.style.top = `${-element.scrollTop}px`;
  52546. div.appendChild(span);
  52547. const relativePosition = {
  52548. top: span.offsetTop + Number.parseInt(computed.borderTopWidth),
  52549. left: span.offsetLeft + Number.parseInt(computed.borderLeftWidth),
  52550. height: Number.parseInt(computed.fontSize) * 1.5
  52551. };
  52552. if (options.debug) span.style.backgroundColor = "#aaa";
  52553. else document.body.removeChild(div);
  52554. if (relativePosition.left >= element.clientWidth) relativePosition.left = element.clientWidth;
  52555. return relativePosition;
  52556. };
  52557. //#endregion
  52558. //#region ../../packages/components/mention/src/mention.ts
  52559. const mentionProps = buildProps({
  52560. ...inputProps,
  52561. options: {
  52562. type: definePropType(Array),
  52563. default: () => []
  52564. },
  52565. prefix: {
  52566. type: definePropType([String, Array]),
  52567. default: "@",
  52568. validator: (val) => {
  52569. if (isString(val)) return val.length === 1;
  52570. return val.every((v) => isString(v) && v.length === 1);
  52571. }
  52572. },
  52573. split: {
  52574. type: String,
  52575. default: " ",
  52576. validator: (val) => val.length === 1
  52577. },
  52578. filterOption: {
  52579. type: definePropType([Boolean, Function]),
  52580. default: () => filterOption,
  52581. validator: (val) => {
  52582. if (val === false) return true;
  52583. return isFunction$1(val);
  52584. }
  52585. },
  52586. placement: {
  52587. type: definePropType(String),
  52588. default: "bottom"
  52589. },
  52590. showArrow: Boolean,
  52591. offset: {
  52592. type: Number,
  52593. default: 0
  52594. },
  52595. whole: Boolean,
  52596. checkIsWhole: { type: definePropType(Function) },
  52597. modelValue: String,
  52598. loading: Boolean,
  52599. popperClass: useTooltipContentProps.popperClass,
  52600. popperStyle: useTooltipContentProps.popperStyle,
  52601. popperOptions: {
  52602. type: definePropType(Object),
  52603. default: () => ({})
  52604. },
  52605. props: {
  52606. type: definePropType(Object),
  52607. default: () => mentionDefaultProps
  52608. }
  52609. });
  52610. const mentionEmits = {
  52611. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  52612. "whole-remove": (pattern, prefix) => isString(pattern) && isString(prefix),
  52613. input: (value) => isString(value),
  52614. search: (pattern, prefix) => isString(pattern) && isString(prefix),
  52615. select: (option, prefix) => isObject$1(option) && isString(prefix),
  52616. focus: (evt) => evt instanceof FocusEvent,
  52617. blur: (evt) => evt instanceof FocusEvent
  52618. };
  52619. const mentionDefaultProps = {
  52620. value: "value",
  52621. label: "label",
  52622. disabled: "disabled"
  52623. };
  52624. //#endregion
  52625. //#region ../../packages/components/mention/src/mention-dropdown.ts
  52626. const mentionDropdownProps = buildProps({
  52627. options: {
  52628. type: definePropType(Array),
  52629. default: () => []
  52630. },
  52631. loading: Boolean,
  52632. disabled: Boolean,
  52633. contentId: String,
  52634. ariaLabel: String
  52635. });
  52636. const mentionDropdownEmits = { select: (option) => isString(option.value) };
  52637. //#endregion
  52638. //#region ../../packages/components/mention/src/mention-dropdown.vue?vue&type=script&setup=true&lang.ts
  52639. const _hoisted_1$3 = [
  52640. "id",
  52641. "aria-disabled",
  52642. "aria-selected",
  52643. "onMousemove",
  52644. "onClick"
  52645. ];
  52646. var mention_dropdown_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  52647. name: "ElMentionDropdown",
  52648. __name: "mention-dropdown",
  52649. props: mentionDropdownProps,
  52650. emits: mentionDropdownEmits,
  52651. setup(__props, { expose: __expose, emit: __emit }) {
  52652. const props = __props;
  52653. const emit = __emit;
  52654. const ns = useNamespace("mention");
  52655. const { t } = useLocale();
  52656. const hoveringIndex = ref(-1);
  52657. const scrollbarRef = ref();
  52658. const optionRefs = ref();
  52659. const dropdownRef = ref();
  52660. const optionkls = (item, index) => [
  52661. ns.be("dropdown", "item"),
  52662. ns.is("hovering", hoveringIndex.value === index),
  52663. ns.is("disabled", item.disabled || props.disabled)
  52664. ];
  52665. const handleSelect = (item) => {
  52666. if (item.disabled || props.disabled) return;
  52667. emit("select", item);
  52668. };
  52669. const handleMouseEnter = (index) => {
  52670. hoveringIndex.value = index;
  52671. };
  52672. const filteredAllDisabled = computed(() => props.disabled || props.options.every((item) => item.disabled));
  52673. const hoverOption = computed(() => props.options[hoveringIndex.value]);
  52674. const selectHoverOption = () => {
  52675. if (!hoverOption.value || hoverOption.value.disabled || props.disabled) return;
  52676. emit("select", hoverOption.value);
  52677. };
  52678. const navigateOptions = (direction) => {
  52679. const { options } = props;
  52680. if (options.length === 0 || filteredAllDisabled.value) return;
  52681. if (direction === "next") {
  52682. hoveringIndex.value++;
  52683. if (hoveringIndex.value === options.length) hoveringIndex.value = 0;
  52684. } else if (direction === "prev") {
  52685. hoveringIndex.value--;
  52686. if (hoveringIndex.value < 0) hoveringIndex.value = options.length - 1;
  52687. }
  52688. const option = options[hoveringIndex.value];
  52689. if (option.disabled) {
  52690. navigateOptions(direction);
  52691. return;
  52692. }
  52693. nextTick(() => scrollToOption(option));
  52694. };
  52695. const scrollToOption = (option) => {
  52696. const { options } = props;
  52697. const index = options.findIndex((item) => item.value === option.value);
  52698. const target = optionRefs.value?.[index];
  52699. if (target) {
  52700. const menu = dropdownRef.value?.querySelector?.(`.${ns.be("dropdown", "wrap")}`);
  52701. if (menu) scrollIntoView(menu, target);
  52702. }
  52703. scrollbarRef.value?.handleScroll();
  52704. };
  52705. const resetHoveringIndex = () => {
  52706. if (filteredAllDisabled.value || props.options.length === 0) hoveringIndex.value = -1;
  52707. else hoveringIndex.value = props.options.findIndex((item) => !item.disabled);
  52708. };
  52709. watch(() => props.options, resetHoveringIndex, { immediate: true });
  52710. __expose({
  52711. hoveringIndex,
  52712. navigateOptions,
  52713. selectHoverOption,
  52714. hoverOption
  52715. });
  52716. return (_ctx, _cache) => {
  52717. return openBlock(), createElementBlock("div", {
  52718. ref_key: "dropdownRef",
  52719. ref: dropdownRef,
  52720. class: normalizeClass(unref(ns).b("dropdown"))
  52721. }, [
  52722. _ctx.$slots.header ? (openBlock(), createElementBlock("div", {
  52723. key: 0,
  52724. class: normalizeClass(unref(ns).be("dropdown", "header"))
  52725. }, [renderSlot(_ctx.$slots, "header")], 2)) : createCommentVNode("v-if", true),
  52726. withDirectives(createVNode(unref(ElScrollbar), {
  52727. id: __props.contentId,
  52728. ref_key: "scrollbarRef",
  52729. ref: scrollbarRef,
  52730. tag: "ul",
  52731. "wrap-class": unref(ns).be("dropdown", "wrap"),
  52732. "view-class": unref(ns).be("dropdown", "list"),
  52733. role: "listbox",
  52734. "aria-label": __props.ariaLabel,
  52735. "aria-orientation": "vertical"
  52736. }, {
  52737. default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (item, index) => {
  52738. return openBlock(), createElementBlock("li", {
  52739. id: `${__props.contentId}-${index}`,
  52740. ref_for: true,
  52741. ref_key: "optionRefs",
  52742. ref: optionRefs,
  52743. key: index,
  52744. class: normalizeClass(optionkls(item, index)),
  52745. role: "option",
  52746. "aria-disabled": item.disabled || __props.disabled || void 0,
  52747. "aria-selected": hoveringIndex.value === index,
  52748. onMousemove: ($event) => handleMouseEnter(index),
  52749. onClick: withModifiers(($event) => handleSelect(item), ["stop"])
  52750. }, [renderSlot(_ctx.$slots, "label", {
  52751. item,
  52752. index
  52753. }, () => [createElementVNode("span", null, toDisplayString(item.label ?? item.value), 1)])], 42, _hoisted_1$3);
  52754. }), 128))]),
  52755. _: 3
  52756. }, 8, [
  52757. "id",
  52758. "wrap-class",
  52759. "view-class",
  52760. "aria-label"
  52761. ]), [[vShow, __props.options.length > 0 && !__props.loading]]),
  52762. __props.loading ? (openBlock(), createElementBlock("div", {
  52763. key: 1,
  52764. class: normalizeClass(unref(ns).be("dropdown", "loading"))
  52765. }, [renderSlot(_ctx.$slots, "loading", {}, () => [createTextVNode(toDisplayString(unref(t)("el.mention.loading")), 1)])], 2)) : createCommentVNode("v-if", true),
  52766. _ctx.$slots.footer ? (openBlock(), createElementBlock("div", {
  52767. key: 2,
  52768. class: normalizeClass(unref(ns).be("dropdown", "footer"))
  52769. }, [renderSlot(_ctx.$slots, "footer")], 2)) : createCommentVNode("v-if", true)
  52770. ], 2);
  52771. };
  52772. }
  52773. });
  52774. //#endregion
  52775. //#region ../../packages/components/mention/src/mention-dropdown.vue
  52776. var mention_dropdown_default = mention_dropdown_vue_vue_type_script_setup_true_lang_default;
  52777. //#endregion
  52778. //#region ../../packages/components/mention/src/mention.vue?vue&type=script&setup=true&lang.ts
  52779. var mention_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  52780. name: "ElMention",
  52781. inheritAttrs: false,
  52782. __name: "mention",
  52783. props: mentionProps,
  52784. emits: mentionEmits,
  52785. setup(__props, { expose: __expose, emit: __emit }) {
  52786. const props = __props;
  52787. const emit = __emit;
  52788. const passInputProps = computed(() => {
  52789. const inputProps = ElInput.props ?? [];
  52790. return pick(props, isArray$1(inputProps) ? inputProps : Object.keys(inputProps));
  52791. });
  52792. const ns = useNamespace("mention");
  52793. const disabled = useFormDisabled();
  52794. const contentId = useId();
  52795. const elInputRef = ref();
  52796. const tooltipRef = ref();
  52797. const dropdownRef = ref();
  52798. const visible = ref(false);
  52799. const cursorStyle = ref();
  52800. const mentionCtx = ref();
  52801. const computedPlacement = computed(() => props.showArrow ? props.placement : `${props.placement}-start`);
  52802. const computedFallbackPlacements = computed(() => props.showArrow ? ["bottom", "top"] : ["bottom-start", "top-start"]);
  52803. const aliasProps = computed(() => ({
  52804. ...mentionDefaultProps,
  52805. ...props.props
  52806. }));
  52807. const mapOption = (option) => {
  52808. const base = {
  52809. label: option[aliasProps.value.label],
  52810. value: option[aliasProps.value.value],
  52811. disabled: option[aliasProps.value.disabled]
  52812. };
  52813. return {
  52814. ...option,
  52815. ...base
  52816. };
  52817. };
  52818. const options = computed(() => props.options.map(mapOption));
  52819. const filteredOptions = computed(() => {
  52820. const { filterOption } = props;
  52821. if (!mentionCtx.value || !filterOption) return options.value;
  52822. return options.value.filter((option) => filterOption(mentionCtx.value.pattern, option));
  52823. });
  52824. const dropdownVisible = computed(() => {
  52825. return visible.value && (!!filteredOptions.value.length || props.loading);
  52826. });
  52827. const hoveringId = computed(() => {
  52828. return `${contentId.value}-${dropdownRef.value?.hoveringIndex}`;
  52829. });
  52830. const handleInputChange = (value) => {
  52831. emit(UPDATE_MODEL_EVENT, value);
  52832. emit(INPUT_EVENT, value);
  52833. syncAfterCursorMove();
  52834. };
  52835. const handleInputKeyDown = (event) => {
  52836. if (elInputRef.value?.isComposing) return;
  52837. const code = getEventCode(event);
  52838. switch (code) {
  52839. case EVENT_CODE.left:
  52840. case EVENT_CODE.right:
  52841. syncAfterCursorMove();
  52842. break;
  52843. case EVENT_CODE.up:
  52844. case EVENT_CODE.down:
  52845. if (!visible.value) return;
  52846. event.preventDefault();
  52847. dropdownRef.value?.navigateOptions(code === EVENT_CODE.up ? "prev" : "next");
  52848. break;
  52849. case EVENT_CODE.enter:
  52850. case EVENT_CODE.numpadEnter:
  52851. if (!visible.value) {
  52852. props.type !== "textarea" && syncAfterCursorMove();
  52853. return;
  52854. }
  52855. event.preventDefault();
  52856. if (dropdownRef.value?.hoverOption) dropdownRef.value?.selectHoverOption();
  52857. else visible.value = false;
  52858. break;
  52859. case EVENT_CODE.esc:
  52860. if (!visible.value) return;
  52861. event.preventDefault();
  52862. visible.value = false;
  52863. break;
  52864. case EVENT_CODE.backspace: if (props.whole && mentionCtx.value) {
  52865. const { splitIndex, selectionEnd, pattern, prefixIndex, prefix } = mentionCtx.value;
  52866. const inputEl = getInputEl();
  52867. if (!inputEl) return;
  52868. const inputValue = inputEl.value;
  52869. const matchOption = options.value.find((item) => item.value === pattern);
  52870. if ((isFunction$1(props.checkIsWhole) ? props.checkIsWhole(pattern, prefix) : matchOption) && splitIndex !== -1 && splitIndex + 1 === selectionEnd) {
  52871. event.preventDefault();
  52872. const newValue = inputValue.slice(0, prefixIndex) + inputValue.slice(splitIndex + 1);
  52873. emit(UPDATE_MODEL_EVENT, newValue);
  52874. emit(INPUT_EVENT, newValue);
  52875. emit("whole-remove", pattern, prefix);
  52876. const newSelectionEnd = prefixIndex;
  52877. nextTick(() => {
  52878. inputEl.selectionStart = newSelectionEnd;
  52879. inputEl.selectionEnd = newSelectionEnd;
  52880. syncDropdownVisible();
  52881. });
  52882. }
  52883. }
  52884. }
  52885. };
  52886. const { wrapperRef } = useFocusController(elInputRef, {
  52887. disabled,
  52888. afterFocus() {
  52889. syncAfterCursorMove();
  52890. },
  52891. beforeBlur(event) {
  52892. return tooltipRef.value?.isFocusInsideContent(event);
  52893. },
  52894. afterBlur() {
  52895. visible.value = false;
  52896. }
  52897. });
  52898. const handleInputMouseDown = () => {
  52899. syncAfterCursorMove();
  52900. };
  52901. const getOriginalOption = (mentionOption) => {
  52902. return props.options.find((option) => {
  52903. return mentionOption.value === option[aliasProps.value.value];
  52904. });
  52905. };
  52906. const handleSelect = (item) => {
  52907. if (!mentionCtx.value) return;
  52908. const inputEl = getInputEl();
  52909. if (!inputEl) return;
  52910. const inputValue = inputEl.value;
  52911. const { split } = props;
  52912. const newEndPart = inputValue.slice(mentionCtx.value.end);
  52913. const alreadySeparated = newEndPart.startsWith(split);
  52914. const newMiddlePart = `${item.value}${alreadySeparated ? "" : split}`;
  52915. const newValue = inputValue.slice(0, mentionCtx.value.start) + newMiddlePart + newEndPart;
  52916. emit(UPDATE_MODEL_EVENT, newValue);
  52917. emit(INPUT_EVENT, newValue);
  52918. emit("select", getOriginalOption(item), mentionCtx.value.prefix);
  52919. const newSelectionEnd = mentionCtx.value.start + newMiddlePart.length + (alreadySeparated ? 1 : 0);
  52920. nextTick(() => {
  52921. inputEl.selectionStart = newSelectionEnd;
  52922. inputEl.selectionEnd = newSelectionEnd;
  52923. inputEl.focus();
  52924. syncDropdownVisible();
  52925. });
  52926. };
  52927. const getInputEl = () => props.type === "textarea" ? elInputRef.value?.textarea : elInputRef.value?.input;
  52928. const syncAfterCursorMove = () => {
  52929. setTimeout(() => {
  52930. syncCursor();
  52931. syncDropdownVisible();
  52932. nextTick(() => tooltipRef.value?.updatePopper());
  52933. }, 0);
  52934. };
  52935. const syncCursor = () => {
  52936. const inputEl = getInputEl();
  52937. if (!inputEl) return;
  52938. const caretPosition = getCursorPosition(inputEl);
  52939. const inputRect = inputEl.getBoundingClientRect();
  52940. const wrapperRect = wrapperRef.value.getBoundingClientRect();
  52941. cursorStyle.value = {
  52942. position: "absolute",
  52943. width: 0,
  52944. height: `${caretPosition.height}px`,
  52945. left: `${caretPosition.left + inputRect.left - wrapperRect.left}px`,
  52946. top: `${caretPosition.top + inputRect.top - wrapperRect.top}px`
  52947. };
  52948. };
  52949. const syncDropdownVisible = () => {
  52950. const inputEl = getInputEl();
  52951. if (document.activeElement !== inputEl) {
  52952. visible.value = false;
  52953. return;
  52954. }
  52955. const { prefix, split } = props;
  52956. mentionCtx.value = getMentionCtx(inputEl, prefix, split);
  52957. if (mentionCtx.value && mentionCtx.value.splitIndex === -1) {
  52958. visible.value = true;
  52959. emit("search", mentionCtx.value.pattern, mentionCtx.value.prefix);
  52960. return;
  52961. }
  52962. visible.value = false;
  52963. };
  52964. __expose({
  52965. input: elInputRef,
  52966. tooltip: tooltipRef,
  52967. dropdownVisible
  52968. });
  52969. return (_ctx, _cache) => {
  52970. return openBlock(), createElementBlock("div", {
  52971. ref_key: "wrapperRef",
  52972. ref: wrapperRef,
  52973. class: normalizeClass(unref(ns).b())
  52974. }, [createVNode(unref(ElInput), mergeProps(mergeProps(passInputProps.value, _ctx.$attrs), {
  52975. ref_key: "elInputRef",
  52976. ref: elInputRef,
  52977. "model-value": __props.modelValue,
  52978. disabled: unref(disabled),
  52979. role: dropdownVisible.value ? "combobox" : void 0,
  52980. "aria-activedescendant": dropdownVisible.value ? hoveringId.value || "" : void 0,
  52981. "aria-controls": dropdownVisible.value ? unref(contentId) : void 0,
  52982. "aria-expanded": dropdownVisible.value || void 0,
  52983. "aria-label": __props.ariaLabel,
  52984. "aria-autocomplete": dropdownVisible.value ? "none" : void 0,
  52985. "aria-haspopup": dropdownVisible.value ? "listbox" : void 0,
  52986. onInput: handleInputChange,
  52987. onKeydown: handleInputKeyDown,
  52988. onMousedown: handleInputMouseDown
  52989. }), createSlots({ _: 2 }, [renderList(_ctx.$slots, (_, name) => {
  52990. return {
  52991. name,
  52992. fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))])
  52993. };
  52994. })]), 1040, [
  52995. "model-value",
  52996. "disabled",
  52997. "role",
  52998. "aria-activedescendant",
  52999. "aria-controls",
  53000. "aria-expanded",
  53001. "aria-label",
  53002. "aria-autocomplete",
  53003. "aria-haspopup"
  53004. ]), createVNode(unref(ElTooltip), {
  53005. ref_key: "tooltipRef",
  53006. ref: tooltipRef,
  53007. visible: dropdownVisible.value,
  53008. "popper-class": [unref(ns).e("popper"), __props.popperClass],
  53009. "popper-style": __props.popperStyle,
  53010. "popper-options": __props.popperOptions,
  53011. placement: computedPlacement.value,
  53012. "fallback-placements": computedFallbackPlacements.value,
  53013. effect: "light",
  53014. pure: "",
  53015. offset: __props.offset,
  53016. "show-arrow": __props.showArrow
  53017. }, {
  53018. default: withCtx(() => [createElementVNode("div", { style: normalizeStyle(cursorStyle.value) }, null, 4)]),
  53019. content: withCtx(() => [createVNode(mention_dropdown_default, {
  53020. ref_key: "dropdownRef",
  53021. ref: dropdownRef,
  53022. options: filteredOptions.value,
  53023. disabled: unref(disabled),
  53024. loading: __props.loading,
  53025. "content-id": unref(contentId),
  53026. "aria-label": __props.ariaLabel,
  53027. onSelect: handleSelect,
  53028. onClick: _cache[0] || (_cache[0] = withModifiers(($event) => elInputRef.value?.focus(), ["stop"]))
  53029. }, createSlots({ _: 2 }, [renderList(_ctx.$slots, (_, name) => {
  53030. return {
  53031. name,
  53032. fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, name, normalizeProps(guardReactiveProps(slotProps)))])
  53033. };
  53034. })]), 1032, [
  53035. "options",
  53036. "disabled",
  53037. "loading",
  53038. "content-id",
  53039. "aria-label"
  53040. ])]),
  53041. _: 3
  53042. }, 8, [
  53043. "visible",
  53044. "popper-class",
  53045. "popper-style",
  53046. "popper-options",
  53047. "placement",
  53048. "fallback-placements",
  53049. "offset",
  53050. "show-arrow"
  53051. ])], 2);
  53052. };
  53053. }
  53054. });
  53055. //#endregion
  53056. //#region ../../packages/components/mention/src/mention.vue
  53057. var mention_default = mention_vue_vue_type_script_setup_true_lang_default;
  53058. //#endregion
  53059. //#region ../../packages/components/mention/index.ts
  53060. const ElMention = withInstall(mention_default);
  53061. //#endregion
  53062. //#region ../../packages/components/splitter/src/splitter.ts
  53063. const splitterProps = buildProps({
  53064. layout: {
  53065. type: String,
  53066. default: "horizontal",
  53067. values: ["horizontal", "vertical"]
  53068. },
  53069. lazy: Boolean
  53070. });
  53071. const splitterEmits = {
  53072. resizeStart: (index, sizes) => true,
  53073. resize: (index, sizes) => true,
  53074. resizeEnd: (index, sizes) => true,
  53075. collapse: (index, type, sizes) => true
  53076. };
  53077. //#endregion
  53078. //#region ../../packages/components/splitter/src/hooks/useContainer.ts
  53079. function useContainer(layout) {
  53080. const containerEl = ref();
  53081. const { width, height } = useElementSize(containerEl);
  53082. return {
  53083. containerEl,
  53084. containerSize: computed(() => {
  53085. return layout.value === "horizontal" ? width.value : height.value;
  53086. })
  53087. };
  53088. }
  53089. //#endregion
  53090. //#region ../../packages/components/splitter/src/hooks/useSize.ts
  53091. function getPct(str) {
  53092. return Number(str.slice(0, -1)) / 100;
  53093. }
  53094. function getPx(str) {
  53095. return Number(str.slice(0, -2));
  53096. }
  53097. function isPct(itemSize) {
  53098. return isString(itemSize) && itemSize.endsWith("%");
  53099. }
  53100. function isPx(itemSize) {
  53101. return isString(itemSize) && itemSize.endsWith("px");
  53102. }
  53103. function useSize$1(panels, containerSize) {
  53104. const propSizes = computed(() => panels.value.map((i) => i.size));
  53105. const panelCounts = computed(() => panels.value.length);
  53106. const percentSizes = ref([]);
  53107. watch([
  53108. propSizes,
  53109. panelCounts,
  53110. containerSize
  53111. ], () => {
  53112. let ptgList = [];
  53113. let emptyCount = 0;
  53114. for (let i = 0; i < panelCounts.value; i += 1) {
  53115. const itemSize = panels.value[i]?.size;
  53116. if (isPct(itemSize)) ptgList[i] = getPct(itemSize);
  53117. else if (isPx(itemSize)) ptgList[i] = getPx(itemSize) / containerSize.value;
  53118. else if (itemSize || itemSize === 0) {
  53119. const num = Number(itemSize);
  53120. if (!Number.isNaN(num)) ptgList[i] = num / containerSize.value;
  53121. } else {
  53122. emptyCount += 1;
  53123. ptgList[i] = void 0;
  53124. }
  53125. }
  53126. const totalPtg = ptgList.reduce((acc, ptg) => acc + (ptg || 0), 0);
  53127. if (totalPtg > 1 || !emptyCount) {
  53128. const scale = 1 / totalPtg;
  53129. ptgList = ptgList.map((ptg) => ptg === void 0 ? 0 : ptg * scale);
  53130. } else {
  53131. const avgRest = (1 - totalPtg) / emptyCount;
  53132. ptgList = ptgList.map((ptg) => ptg === void 0 ? avgRest : ptg);
  53133. }
  53134. percentSizes.value = ptgList;
  53135. });
  53136. const ptg2px = (ptg) => ptg * containerSize.value;
  53137. return {
  53138. percentSizes,
  53139. pxSizes: computed(() => percentSizes.value.map(ptg2px))
  53140. };
  53141. }
  53142. //#endregion
  53143. //#region ../../packages/components/splitter/src/hooks/useResize.ts
  53144. function useResize(panels, containerSize, pxSizes, lazy) {
  53145. const ptg2px = (ptg) => ptg * containerSize.value || 0;
  53146. function getLimitSize(str, defaultLimit) {
  53147. if (isPct(str)) return ptg2px(getPct(str));
  53148. else if (isPx(str)) return getPx(str);
  53149. return str ?? defaultLimit;
  53150. }
  53151. const lazyOffset = ref(0);
  53152. const movingIndex = ref(null);
  53153. let cachePxSizes = [];
  53154. let updatePanelSizes = NOOP;
  53155. const limitSizes = computed(() => panels.value.map((item) => [item.min, item.max]));
  53156. watch(lazy, () => {
  53157. if (lazyOffset.value) {
  53158. const mouseup = new MouseEvent("mouseup", { bubbles: true });
  53159. window.dispatchEvent(mouseup);
  53160. }
  53161. });
  53162. const onMoveStart = (index) => {
  53163. lazyOffset.value = 0;
  53164. movingIndex.value = {
  53165. index,
  53166. confirmed: false
  53167. };
  53168. cachePxSizes = pxSizes.value;
  53169. };
  53170. const onMoving = (index, offset) => {
  53171. let confirmedIndex = null;
  53172. if ((!movingIndex.value || !movingIndex.value.confirmed) && offset !== 0) {
  53173. if (offset > 0) {
  53174. confirmedIndex = index;
  53175. movingIndex.value = {
  53176. index,
  53177. confirmed: true
  53178. };
  53179. } else for (let i = index; i >= 0; i -= 1) if (cachePxSizes[i] > 0) {
  53180. confirmedIndex = i;
  53181. movingIndex.value = {
  53182. index: i,
  53183. confirmed: true
  53184. };
  53185. break;
  53186. }
  53187. }
  53188. const mergedIndex = confirmedIndex ?? movingIndex.value?.index ?? index;
  53189. const numSizes = [...cachePxSizes];
  53190. const nextIndex = mergedIndex + 1;
  53191. const startMinSize = getLimitSize(limitSizes.value[mergedIndex][0], 0);
  53192. const endMinSize = getLimitSize(limitSizes.value[nextIndex][0], 0);
  53193. const startMaxSize = getLimitSize(limitSizes.value[mergedIndex][1], containerSize.value || 0);
  53194. const endMaxSize = getLimitSize(limitSizes.value[nextIndex][1], containerSize.value || 0);
  53195. let mergedOffset = offset;
  53196. if (numSizes[mergedIndex] + mergedOffset < startMinSize) mergedOffset = startMinSize - numSizes[mergedIndex];
  53197. if (numSizes[nextIndex] - mergedOffset < endMinSize) mergedOffset = numSizes[nextIndex] - endMinSize;
  53198. if (numSizes[mergedIndex] + mergedOffset > startMaxSize) mergedOffset = startMaxSize - numSizes[mergedIndex];
  53199. if (numSizes[nextIndex] - mergedOffset > endMaxSize) mergedOffset = numSizes[nextIndex] - endMaxSize;
  53200. numSizes[mergedIndex] += mergedOffset;
  53201. numSizes[nextIndex] -= mergedOffset;
  53202. lazyOffset.value = mergedOffset;
  53203. updatePanelSizes = () => {
  53204. panels.value.forEach((panel, index) => {
  53205. panel.size = numSizes[index];
  53206. });
  53207. updatePanelSizes = NOOP;
  53208. };
  53209. if (!lazy.value) updatePanelSizes();
  53210. };
  53211. const onMoveEnd = () => {
  53212. if (lazy.value) updatePanelSizes();
  53213. lazyOffset.value = 0;
  53214. movingIndex.value = null;
  53215. cachePxSizes = [];
  53216. };
  53217. const cacheCollapsedSize = [];
  53218. const onCollapse = (index, type) => {
  53219. if (!cacheCollapsedSize.length) cacheCollapsedSize.push(...pxSizes.value.map((size, i) => size <= 0 ? getLimitSize(limitSizes.value[i]?.[0], 0) : size));
  53220. const currentSizes = pxSizes.value;
  53221. const currentIndex = type === "start" ? index : index + 1;
  53222. const targetIndex = type === "start" ? index + 1 : index;
  53223. const currentSize = currentSizes[currentIndex];
  53224. const targetSize = currentSizes[targetIndex];
  53225. if (currentSize !== 0 && targetSize !== 0) {
  53226. currentSizes[currentIndex] = 0;
  53227. currentSizes[targetIndex] += currentSize;
  53228. cacheCollapsedSize[index] = currentSize;
  53229. } else {
  53230. const totalSize = currentSize + targetSize;
  53231. const targetCacheCollapsedSize = clamp$1(cacheCollapsedSize[index], 0, totalSize);
  53232. const currentCacheCollapsedSize = totalSize - targetCacheCollapsedSize;
  53233. currentSizes[targetIndex] = targetCacheCollapsedSize;
  53234. currentSizes[currentIndex] = currentCacheCollapsedSize;
  53235. }
  53236. panels.value.forEach((panel, index) => {
  53237. panel.size = currentSizes[index];
  53238. });
  53239. };
  53240. return {
  53241. lazyOffset,
  53242. onMoveStart,
  53243. onMoving,
  53244. onMoveEnd,
  53245. movingIndex,
  53246. onCollapse
  53247. };
  53248. }
  53249. //#endregion
  53250. //#region ../../packages/components/splitter/src/type.ts
  53251. const splitterRootContextKey = Symbol("splitterRootContextKey");
  53252. //#endregion
  53253. //#region ../../packages/components/splitter/src/splitter.vue?vue&type=script&setup=true&lang.ts
  53254. var splitter_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  53255. name: "ElSplitter",
  53256. __name: "splitter",
  53257. props: splitterProps,
  53258. emits: splitterEmits,
  53259. setup(__props, { emit: __emit }) {
  53260. const ns = useNamespace("splitter");
  53261. const emits = __emit;
  53262. const props = __props;
  53263. const layout = toRef(props, "layout");
  53264. const lazy = toRef(props, "lazy");
  53265. const { containerEl, containerSize } = useContainer(layout);
  53266. const { removeChild: unregisterPanel, children: panels, addChild: registerPanel, ChildrenSorter: PanelsSorter } = useOrderedChildren(getCurrentInstance(), "ElSplitterPanel");
  53267. watch(panels, () => {
  53268. movingIndex.value = null;
  53269. panels.value.forEach((instance, index) => {
  53270. instance.setIndex(index);
  53271. });
  53272. });
  53273. const { percentSizes, pxSizes } = useSize$1(panels, containerSize);
  53274. const { lazyOffset, movingIndex, onMoveStart, onMoving, onMoveEnd, onCollapse } = useResize(panels, containerSize, pxSizes, lazy);
  53275. const splitterStyles = computed(() => {
  53276. return { [ns.cssVarBlockName("bar-offset")]: lazy.value ? `${lazyOffset.value}px` : void 0 };
  53277. });
  53278. const onResizeStart = (index) => {
  53279. onMoveStart(index);
  53280. emits("resizeStart", index, pxSizes.value);
  53281. };
  53282. const onResize = (index, offset) => {
  53283. onMoving(index, offset);
  53284. if (!lazy.value) emits("resize", index, pxSizes.value);
  53285. };
  53286. const onResizeEnd = async (index) => {
  53287. onMoveEnd();
  53288. await nextTick();
  53289. emits("resizeEnd", index, pxSizes.value);
  53290. };
  53291. const onCollapsible = (index, type) => {
  53292. onCollapse(index, type);
  53293. emits("collapse", index, type, pxSizes.value);
  53294. };
  53295. provide(splitterRootContextKey, reactive({
  53296. panels,
  53297. percentSizes,
  53298. pxSizes,
  53299. layout,
  53300. lazy,
  53301. movingIndex,
  53302. containerSize,
  53303. onMoveStart: onResizeStart,
  53304. onMoving: onResize,
  53305. onMoveEnd: onResizeEnd,
  53306. onCollapse: onCollapsible,
  53307. registerPanel,
  53308. unregisterPanel
  53309. }));
  53310. return (_ctx, _cache) => {
  53311. return openBlock(), createElementBlock("div", {
  53312. ref_key: "containerEl",
  53313. ref: containerEl,
  53314. class: normalizeClass([unref(ns).b(), unref(ns).e(layout.value)]),
  53315. style: normalizeStyle(splitterStyles.value)
  53316. }, [
  53317. renderSlot(_ctx.$slots, "default"),
  53318. createVNode(unref(PanelsSorter)),
  53319. createCommentVNode(" Prevent iframe touch events from breaking "),
  53320. unref(movingIndex) ? (openBlock(), createElementBlock("div", {
  53321. key: 0,
  53322. class: normalizeClass([unref(ns).e("mask"), unref(ns).e(`mask-${layout.value}`)])
  53323. }, null, 2)) : createCommentVNode("v-if", true)
  53324. ], 6);
  53325. };
  53326. }
  53327. });
  53328. //#endregion
  53329. //#region ../../packages/components/splitter/src/splitter.vue
  53330. var splitter_default = splitter_vue_vue_type_script_setup_true_lang_default;
  53331. //#endregion
  53332. //#region ../../packages/components/splitter/src/split-panel.ts
  53333. const splitterPanelProps = buildProps({
  53334. min: { type: [String, Number] },
  53335. max: { type: [String, Number] },
  53336. size: { type: [String, Number] },
  53337. resizable: {
  53338. type: Boolean,
  53339. default: true
  53340. },
  53341. collapsible: Boolean
  53342. });
  53343. const splitterPanelEmits = { "update:size": (value) => typeof value === "number" || typeof value === "string" };
  53344. //#endregion
  53345. //#region ../../packages/components/splitter/src/hooks/usePanel.ts
  53346. function getCollapsible(collapsible) {
  53347. if (collapsible && isObject$1(collapsible)) return collapsible;
  53348. return {
  53349. start: !!collapsible,
  53350. end: !!collapsible
  53351. };
  53352. }
  53353. function isCollapsible(panel, size, nextPanel, nextSize) {
  53354. if (panel?.collapsible.end && size > 0) return true;
  53355. if (nextPanel?.collapsible.start && nextSize === 0 && size > 0) return true;
  53356. return false;
  53357. }
  53358. //#endregion
  53359. //#region ../../packages/components/splitter/src/split-bar.vue?vue&type=script&setup=true&lang.ts
  53360. var split_bar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  53361. name: "ElSplitterBar",
  53362. __name: "split-bar",
  53363. props: {
  53364. index: {
  53365. type: Number,
  53366. required: true
  53367. },
  53368. layout: {
  53369. type: String,
  53370. values: ["horizontal", "vertical"],
  53371. default: "horizontal"
  53372. },
  53373. resizable: {
  53374. type: Boolean,
  53375. default: true
  53376. },
  53377. lazy: Boolean,
  53378. startCollapsible: Boolean,
  53379. endCollapsible: Boolean
  53380. },
  53381. emits: [
  53382. "moveStart",
  53383. "moving",
  53384. "moveEnd",
  53385. "collapse"
  53386. ],
  53387. setup(__props, { emit: __emit }) {
  53388. const ns = useNamespace("splitter-bar");
  53389. const props = __props;
  53390. const emit = __emit;
  53391. const isHorizontal = computed(() => props.layout === "horizontal");
  53392. const barWrapStyles = computed(() => {
  53393. if (isHorizontal.value) return { width: 0 };
  53394. return { height: 0 };
  53395. });
  53396. const draggerStyles = computed(() => {
  53397. return {
  53398. width: isHorizontal.value ? "16px" : "100%",
  53399. height: isHorizontal.value ? "100%" : "16px",
  53400. cursor: !props.resizable ? "auto" : isHorizontal.value ? "ew-resize" : "ns-resize",
  53401. touchAction: "none"
  53402. };
  53403. });
  53404. const draggerPseudoClass = computed(() => {
  53405. const prefix = ns.e("dragger");
  53406. return {
  53407. [`${prefix}-horizontal`]: isHorizontal.value,
  53408. [`${prefix}-vertical`]: !isHorizontal.value,
  53409. [`${prefix}-active`]: !!startPos.value
  53410. };
  53411. });
  53412. const startPos = ref(null);
  53413. const onMousedown = (e) => {
  53414. if (!props.resizable) return;
  53415. startPos.value = [e.pageX, e.pageY];
  53416. emit("moveStart", props.index);
  53417. window.addEventListener("mouseup", onMouseUp);
  53418. window.addEventListener("mousemove", onMouseMove);
  53419. };
  53420. const onTouchStart = (e) => {
  53421. if (props.resizable && e.touches.length === 1) {
  53422. e.preventDefault();
  53423. const touch = e.touches[0];
  53424. startPos.value = [touch.pageX, touch.pageY];
  53425. emit("moveStart", props.index);
  53426. window.addEventListener("touchend", onTouchEnd);
  53427. window.addEventListener("touchmove", onTouchMove);
  53428. }
  53429. };
  53430. const onMouseMove = (e) => {
  53431. const { pageX, pageY } = e;
  53432. const offsetX = pageX - startPos.value[0];
  53433. const offsetY = pageY - startPos.value[1];
  53434. const offset = isHorizontal.value ? offsetX : offsetY;
  53435. emit("moving", props.index, offset);
  53436. };
  53437. const onTouchMove = (e) => {
  53438. if (e.touches.length === 1) {
  53439. e.preventDefault();
  53440. const touch = e.touches[0];
  53441. const offsetX = touch.pageX - startPos.value[0];
  53442. const offsetY = touch.pageY - startPos.value[1];
  53443. const offset = isHorizontal.value ? offsetX : offsetY;
  53444. emit("moving", props.index, offset);
  53445. }
  53446. };
  53447. const onMouseUp = () => {
  53448. startPos.value = null;
  53449. window.removeEventListener("mouseup", onMouseUp);
  53450. window.removeEventListener("mousemove", onMouseMove);
  53451. emit("moveEnd", props.index);
  53452. };
  53453. const onTouchEnd = () => {
  53454. startPos.value = null;
  53455. window.removeEventListener("touchend", onTouchEnd);
  53456. window.removeEventListener("touchmove", onTouchMove);
  53457. emit("moveEnd", props.index);
  53458. };
  53459. const StartIcon = computed(() => isHorizontal.value ? arrow_left_default : arrow_up_default);
  53460. const EndIcon = computed(() => isHorizontal.value ? arrow_right_default : arrow_down_default);
  53461. return (_ctx, _cache) => {
  53462. return openBlock(), createElementBlock("div", {
  53463. class: normalizeClass([unref(ns).b()]),
  53464. style: normalizeStyle(barWrapStyles.value)
  53465. }, [
  53466. __props.startCollapsible ? (openBlock(), createElementBlock("div", {
  53467. key: 0,
  53468. class: normalizeClass([unref(ns).e("collapse-icon"), unref(ns).e(`${__props.layout}-collapse-icon-start`)]),
  53469. onClick: _cache[0] || (_cache[0] = ($event) => emit("collapse", __props.index, "start"))
  53470. }, [renderSlot(_ctx.$slots, "start-collapsible", {}, () => [(openBlock(), createBlock(resolveDynamicComponent(StartIcon.value), { style: {
  53471. "width": "12px",
  53472. "height": "12px"
  53473. } }))])], 2)) : createCommentVNode("v-if", true),
  53474. createElementVNode("div", {
  53475. class: normalizeClass([
  53476. unref(ns).e("dragger"),
  53477. draggerPseudoClass.value,
  53478. unref(ns).is("disabled", !__props.resizable),
  53479. unref(ns).is("lazy", __props.resizable && __props.lazy)
  53480. ]),
  53481. style: normalizeStyle(draggerStyles.value),
  53482. onMousedown,
  53483. onTouchstart: onTouchStart
  53484. }, null, 38),
  53485. __props.endCollapsible ? (openBlock(), createElementBlock("div", {
  53486. key: 1,
  53487. class: normalizeClass([unref(ns).e("collapse-icon"), unref(ns).e(`${__props.layout}-collapse-icon-end`)]),
  53488. onClick: _cache[1] || (_cache[1] = ($event) => emit("collapse", __props.index, "end"))
  53489. }, [renderSlot(_ctx.$slots, "end-collapsible", {}, () => [(openBlock(), createBlock(resolveDynamicComponent(EndIcon.value), { style: {
  53490. "width": "12px",
  53491. "height": "12px"
  53492. } }))])], 2)) : createCommentVNode("v-if", true)
  53493. ], 6);
  53494. };
  53495. }
  53496. });
  53497. //#endregion
  53498. //#region ../../packages/components/splitter/src/split-bar.vue
  53499. var split_bar_default = split_bar_vue_vue_type_script_setup_true_lang_default;
  53500. //#endregion
  53501. //#region ../../packages/components/splitter/src/split-panel.vue?vue&type=script&setup=true&lang.ts
  53502. const COMPONENT_NAME = "ElSplitterPanel";
  53503. var split_panel_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  53504. name: COMPONENT_NAME,
  53505. __name: "split-panel",
  53506. props: splitterPanelProps,
  53507. emits: splitterPanelEmits,
  53508. setup(__props, { expose: __expose, emit: __emit }) {
  53509. const ns = useNamespace("splitter-panel");
  53510. const props = __props;
  53511. const emits = __emit;
  53512. const splitterContext = inject(splitterRootContextKey);
  53513. if (!splitterContext) throwError(COMPONENT_NAME, "usage: <el-splitter><el-splitter-panel /></el-splitter/>");
  53514. const { panels, layout, lazy, containerSize, pxSizes } = toRefs(splitterContext);
  53515. const { registerPanel, unregisterPanel, onCollapse, onMoveEnd, onMoveStart, onMoving } = splitterContext;
  53516. const panelEl = ref();
  53517. const instance = getCurrentInstance();
  53518. const uid = instance.uid;
  53519. const index = ref(0);
  53520. const panel = computed(() => panels.value[index.value]);
  53521. const setIndex = (val) => {
  53522. index.value = val;
  53523. };
  53524. const panelSize = computed(() => {
  53525. if (!panel.value) return 0;
  53526. return pxSizes.value[index.value] ?? 0;
  53527. });
  53528. const nextSize = computed(() => {
  53529. if (!panel.value) return 0;
  53530. return pxSizes.value[index.value + 1] ?? 0;
  53531. });
  53532. const nextPanel = computed(() => {
  53533. if (panel.value) return panels.value[index.value + 1];
  53534. return null;
  53535. });
  53536. const isResizable = computed(() => {
  53537. if (!nextPanel.value) return false;
  53538. return props.resizable && nextPanel.value?.resizable && (panelSize.value !== 0 || !props.min) && (nextSize.value !== 0 || !nextPanel.value.min);
  53539. });
  53540. const isShowBar = computed(() => {
  53541. if (!panel.value) return false;
  53542. return index.value !== panels.value.length - 1;
  53543. });
  53544. const startCollapsible = computed(() => isCollapsible(panel.value, panelSize.value, nextPanel.value, nextSize.value));
  53545. const endCollapsible = computed(() => isCollapsible(nextPanel.value, nextSize.value, panel.value, panelSize.value));
  53546. function sizeToPx(str) {
  53547. if (isPct(str)) return getPct(str) * containerSize.value || 0;
  53548. else if (isPx(str)) return getPx(str);
  53549. return str ?? 0;
  53550. }
  53551. let isSizeUpdating = false;
  53552. watch(() => props.size, () => {
  53553. if (!isSizeUpdating && panel.value) {
  53554. if (!containerSize.value) {
  53555. panel.value.size = props.size;
  53556. return;
  53557. }
  53558. const size = sizeToPx(props.size);
  53559. const maxSize = sizeToPx(props.max);
  53560. const minSize = sizeToPx(props.min);
  53561. const finalSize = Math.min(Math.max(size, minSize || 0), maxSize || size);
  53562. if (finalSize !== size) emits("update:size", finalSize);
  53563. panel.value.size = finalSize;
  53564. }
  53565. });
  53566. watch(() => panel.value?.size, (val) => {
  53567. if (val !== props.size) {
  53568. isSizeUpdating = true;
  53569. emits("update:size", val);
  53570. nextTick(() => isSizeUpdating = false);
  53571. }
  53572. });
  53573. watch(() => props.resizable, (val) => {
  53574. if (panel.value) panel.value.resizable = val;
  53575. });
  53576. const _panel = reactive({
  53577. uid,
  53578. getVnode: () => instance.vnode,
  53579. setIndex,
  53580. ...props,
  53581. collapsible: computed(() => getCollapsible(props.collapsible))
  53582. });
  53583. registerPanel(_panel);
  53584. onBeforeUnmount(() => unregisterPanel(_panel));
  53585. __expose({ splitterPanelRef: panelEl });
  53586. return (_ctx, _cache) => {
  53587. return openBlock(), createElementBlock(Fragment, null, [createElementVNode("div", mergeProps({
  53588. ref_key: "panelEl",
  53589. ref: panelEl,
  53590. class: [unref(ns).b()],
  53591. style: { flexBasis: `${panelSize.value}px` }
  53592. }, _ctx.$attrs), [renderSlot(_ctx.$slots, "default")], 16), isShowBar.value ? (openBlock(), createBlock(split_bar_default, {
  53593. key: 0,
  53594. index: index.value,
  53595. layout: unref(layout),
  53596. lazy: unref(lazy),
  53597. resizable: isResizable.value,
  53598. "start-collapsible": startCollapsible.value,
  53599. "end-collapsible": endCollapsible.value,
  53600. onMoveStart: unref(onMoveStart),
  53601. onMoving: unref(onMoving),
  53602. onMoveEnd: unref(onMoveEnd),
  53603. onCollapse: unref(onCollapse)
  53604. }, {
  53605. "start-collapsible": withCtx(() => [renderSlot(_ctx.$slots, "start-collapsible")]),
  53606. "end-collapsible": withCtx(() => [renderSlot(_ctx.$slots, "end-collapsible")]),
  53607. _: 3
  53608. }, 8, [
  53609. "index",
  53610. "layout",
  53611. "lazy",
  53612. "resizable",
  53613. "start-collapsible",
  53614. "end-collapsible",
  53615. "onMoveStart",
  53616. "onMoving",
  53617. "onMoveEnd",
  53618. "onCollapse"
  53619. ])) : createCommentVNode("v-if", true)], 64);
  53620. };
  53621. }
  53622. });
  53623. //#endregion
  53624. //#region ../../packages/components/splitter/src/split-panel.vue
  53625. var split_panel_default = split_panel_vue_vue_type_script_setup_true_lang_default;
  53626. //#endregion
  53627. //#region ../../packages/components/splitter/index.ts
  53628. const ElSplitter = withInstall(splitter_default, { SplitPanel: split_panel_default });
  53629. const ElSplitterPanel = withNoopInstall(split_panel_default);
  53630. //#endregion
  53631. //#region ../../packages/element-plus/component.ts
  53632. var component_default = [
  53633. ElAffix,
  53634. ElAlert,
  53635. ElAutocomplete,
  53636. ElAutoResizer,
  53637. ElAvatar,
  53638. ElAvatarGroup,
  53639. ElBacktop,
  53640. ElBadge,
  53641. ElBreadcrumb,
  53642. ElBreadcrumbItem,
  53643. ElButton,
  53644. ElButtonGroup,
  53645. ElCalendar,
  53646. ElCard,
  53647. ElCarousel,
  53648. ElCarouselItem,
  53649. ElCascader,
  53650. ElCascaderPanel,
  53651. ElCheckTag,
  53652. ElCheckbox,
  53653. ElCheckboxButton,
  53654. ElCheckboxGroup,
  53655. ElCol,
  53656. ElCollapse,
  53657. ElCollapseItem,
  53658. ElCollapseTransition,
  53659. ElColorPickerPanel,
  53660. ElColorPicker,
  53661. ElConfigProvider,
  53662. ElContainer,
  53663. ElAside,
  53664. ElFooter,
  53665. ElHeader,
  53666. ElMain,
  53667. ElDatePicker,
  53668. ElDatePickerPanel,
  53669. ElDescriptions,
  53670. ElDescriptionsItem,
  53671. ElDialog,
  53672. ElDivider,
  53673. ElDrawer,
  53674. ElDropdown,
  53675. ElDropdownItem,
  53676. ElDropdownMenu,
  53677. ElEmpty,
  53678. ElForm,
  53679. ElFormItem,
  53680. ElIcon,
  53681. ElImage,
  53682. ElImageViewer,
  53683. ElInput,
  53684. ElInputNumber,
  53685. ElInputTag,
  53686. ElInputOtp,
  53687. ElLink,
  53688. ElMenu,
  53689. ElMenuItem,
  53690. ElMenuItemGroup,
  53691. ElSubMenu,
  53692. ElPageHeader,
  53693. ElPagination,
  53694. ElPopconfirm,
  53695. ElPopover,
  53696. ElPopper,
  53697. ElProgress,
  53698. ElRadio,
  53699. ElRadioButton,
  53700. ElRadioGroup,
  53701. ElRate,
  53702. ElResult,
  53703. ElRow,
  53704. ElScrollbar,
  53705. ElSelect,
  53706. ElOption,
  53707. ElOptionGroup,
  53708. ElSelectV2,
  53709. ElSkeleton,
  53710. ElSkeletonItem,
  53711. ElSlider,
  53712. ElSpace,
  53713. ElStatistic,
  53714. ElCountdown,
  53715. ElSteps,
  53716. ElStep,
  53717. ElSwitch,
  53718. ElTable,
  53719. ElTableColumn,
  53720. ElTableV2,
  53721. ElTabs,
  53722. ElTabPane,
  53723. ElTag,
  53724. ElText,
  53725. ElTimePicker,
  53726. ElTimeSelect,
  53727. ElTimeline,
  53728. ElTimelineItem,
  53729. ElTooltip,
  53730. ElTransfer,
  53731. ElTree,
  53732. ElTreeSelect,
  53733. ElTreeV2,
  53734. ElUpload,
  53735. ElWatermark,
  53736. ElTour,
  53737. ElTourStep,
  53738. ElAnchor,
  53739. ElAnchorLink,
  53740. ElSegmented,
  53741. ElMention,
  53742. ElSplitter,
  53743. ElSplitterPanel
  53744. ];
  53745. //#endregion
  53746. //#region ../../packages/components/infinite-scroll/src/index.ts
  53747. const SCOPE$1 = "ElInfiniteScroll";
  53748. const CHECK_INTERVAL = 50;
  53749. const DEFAULT_DELAY = 200;
  53750. const DEFAULT_DISTANCE = 0;
  53751. const attributes = {
  53752. delay: {
  53753. type: Number,
  53754. default: 200
  53755. },
  53756. distance: {
  53757. type: Number,
  53758. default: 0
  53759. },
  53760. disabled: {
  53761. type: Boolean,
  53762. default: false
  53763. },
  53764. immediate: {
  53765. type: Boolean,
  53766. default: true
  53767. }
  53768. };
  53769. const getScrollOptions = (el, instance) => {
  53770. return Object.entries(attributes).reduce((acm, [name, option]) => {
  53771. const { type, default: defaultValue } = option;
  53772. const attrVal = el.getAttribute(`infinite-scroll-${name}`);
  53773. let value = instance[attrVal] ?? attrVal ?? defaultValue;
  53774. value = value === "false" ? false : value;
  53775. value = type(value);
  53776. acm[name] = Number.isNaN(value) ? defaultValue : value;
  53777. return acm;
  53778. }, {});
  53779. };
  53780. const destroyObserver = (el) => {
  53781. const { observer } = el[SCOPE$1];
  53782. if (observer) {
  53783. observer.disconnect();
  53784. delete el[SCOPE$1].observer;
  53785. }
  53786. };
  53787. const handleScroll = (el, cb) => {
  53788. const { container, containerEl, instance, observer, lastScrollTop } = el[SCOPE$1];
  53789. const { disabled, distance } = getScrollOptions(el, instance);
  53790. const { clientHeight, scrollHeight, scrollTop } = containerEl;
  53791. const delta = scrollTop - lastScrollTop;
  53792. el[SCOPE$1].lastScrollTop = scrollTop;
  53793. if (observer || disabled || delta < 0) return;
  53794. let shouldTrigger = false;
  53795. if (container === el) shouldTrigger = scrollHeight - (clientHeight + scrollTop) <= distance;
  53796. else {
  53797. const { clientTop, scrollHeight: height } = el;
  53798. const offsetTop = getOffsetTopDistance(el, containerEl);
  53799. shouldTrigger = scrollTop + clientHeight >= offsetTop + clientTop + height - distance;
  53800. }
  53801. if (shouldTrigger) cb.call(instance);
  53802. };
  53803. function checkFull(el, cb) {
  53804. const { containerEl, instance } = el[SCOPE$1];
  53805. const { disabled } = getScrollOptions(el, instance);
  53806. if (disabled || containerEl.clientHeight === 0) return;
  53807. if (containerEl.scrollHeight <= containerEl.clientHeight) cb.call(instance);
  53808. else destroyObserver(el);
  53809. }
  53810. const InfiniteScroll = {
  53811. async mounted(el, binding) {
  53812. const { instance, value: cb } = binding;
  53813. useDeprecated({
  53814. scope: SCOPE$1,
  53815. from: "the directive v-infinite-scroll",
  53816. replacement: "the el-scrollbar infinite scroll",
  53817. version: "3.0.0",
  53818. ref: "https://element-plus.org/en-US/component/scrollbar#infinite-scroll"
  53819. }, true);
  53820. if (!isFunction$1(cb)) throwError(SCOPE$1, "'v-infinite-scroll' binding value must be a function");
  53821. await nextTick();
  53822. const { delay, immediate } = getScrollOptions(el, instance);
  53823. const container = getScrollContainer(el, true);
  53824. const containerEl = container === window ? document.documentElement : container;
  53825. const onScroll = throttle(handleScroll.bind(null, el, cb), delay);
  53826. if (!container) return;
  53827. el[SCOPE$1] = {
  53828. instance,
  53829. container,
  53830. containerEl,
  53831. delay,
  53832. cb,
  53833. onScroll,
  53834. lastScrollTop: containerEl.scrollTop
  53835. };
  53836. if (immediate) {
  53837. const observer = new MutationObserver(throttle(checkFull.bind(null, el, cb), 50));
  53838. el[SCOPE$1].observer = observer;
  53839. observer.observe(el, {
  53840. childList: true,
  53841. subtree: true
  53842. });
  53843. checkFull(el, cb);
  53844. }
  53845. container.addEventListener("scroll", onScroll);
  53846. },
  53847. unmounted(el) {
  53848. if (!el["ElInfiniteScroll"]) return;
  53849. const { container, onScroll } = el[SCOPE$1];
  53850. container?.removeEventListener("scroll", onScroll);
  53851. destroyObserver(el);
  53852. },
  53853. async updated(el) {
  53854. if (!el["ElInfiniteScroll"]) await nextTick();
  53855. else {
  53856. const { containerEl, cb, observer } = el[SCOPE$1];
  53857. if (containerEl.clientHeight && observer) checkFull(el, cb);
  53858. }
  53859. }
  53860. };
  53861. //#endregion
  53862. //#region ../../packages/components/infinite-scroll/index.ts
  53863. const _InfiniteScroll = InfiniteScroll;
  53864. _InfiniteScroll.install = (app) => {
  53865. app.directive("InfiniteScroll", _InfiniteScroll);
  53866. };
  53867. const ElInfiniteScroll = _InfiniteScroll;
  53868. //#endregion
  53869. //#region ../../packages/components/loading/src/loading.ts
  53870. function createLoadingComponent(options, appContext) {
  53871. let afterLeaveTimer;
  53872. const afterLeaveFlag = ref(false);
  53873. const data = reactive({
  53874. ...options,
  53875. originalPosition: "",
  53876. originalOverflow: "",
  53877. visible: false
  53878. });
  53879. function setText(text) {
  53880. data.text = text;
  53881. }
  53882. function destroySelf() {
  53883. const target = data.parent;
  53884. const ns = vm.ns;
  53885. if (!target.vLoadingAddClassList) {
  53886. let loadingNumber = target.getAttribute("loading-number");
  53887. loadingNumber = Number.parseInt(loadingNumber) - 1;
  53888. if (!loadingNumber) {
  53889. removeClass(target, ns.bm("parent", "relative"));
  53890. target.removeAttribute("loading-number");
  53891. } else target.setAttribute("loading-number", loadingNumber.toString());
  53892. removeClass(target, ns.bm("parent", "hidden"));
  53893. }
  53894. removeElLoadingChild();
  53895. loadingInstance.unmount();
  53896. }
  53897. function removeElLoadingChild() {
  53898. vm.$el?.parentNode?.removeChild(vm.$el);
  53899. }
  53900. function close() {
  53901. if (options.beforeClose && !options.beforeClose()) return;
  53902. afterLeaveFlag.value = true;
  53903. clearTimeout(afterLeaveTimer);
  53904. afterLeaveTimer = setTimeout(handleAfterLeave, 400);
  53905. data.visible = false;
  53906. options.closed?.();
  53907. }
  53908. function handleAfterLeave() {
  53909. if (!afterLeaveFlag.value) return;
  53910. const target = data.parent;
  53911. afterLeaveFlag.value = false;
  53912. target.vLoadingAddClassList = void 0;
  53913. destroySelf();
  53914. }
  53915. const loadingInstance = createApp(defineComponent({
  53916. name: "ElLoading",
  53917. setup(_, { expose }) {
  53918. const { ns, zIndex } = useGlobalComponentSettings("loading");
  53919. expose({
  53920. ns,
  53921. zIndex
  53922. });
  53923. return () => {
  53924. const svg = data.spinner || data.svg;
  53925. const spinner = h("svg", {
  53926. class: "circular",
  53927. viewBox: data.svgViewBox ? data.svgViewBox : "0 0 50 50",
  53928. ...svg ? { innerHTML: svg } : {}
  53929. }, [h("circle", {
  53930. class: "path",
  53931. cx: "25",
  53932. cy: "25",
  53933. r: "20",
  53934. fill: "none"
  53935. })]);
  53936. const spinnerText = data.text ? h("p", { class: ns.b("text") }, [data.text]) : void 0;
  53937. return h(Transition, {
  53938. name: ns.b("fade"),
  53939. onAfterLeave: handleAfterLeave
  53940. }, { default: withCtx(() => [withDirectives(createVNode("div", {
  53941. style: { backgroundColor: data.background || "" },
  53942. class: [
  53943. ns.b("mask"),
  53944. data.customClass,
  53945. ns.is("fullscreen", data.fullscreen)
  53946. ]
  53947. }, [h("div", { class: ns.b("spinner") }, [spinner, spinnerText])]), [[vShow, data.visible]])]) });
  53948. };
  53949. }
  53950. }));
  53951. Object.assign(loadingInstance._context, appContext ?? {});
  53952. const vm = loadingInstance.mount(document.createElement("div"));
  53953. return {
  53954. ...toRefs(data),
  53955. setText,
  53956. removeElLoadingChild,
  53957. close,
  53958. handleAfterLeave,
  53959. vm,
  53960. get $el() {
  53961. return vm.$el;
  53962. }
  53963. };
  53964. }
  53965. //#endregion
  53966. //#region ../../packages/components/loading/src/service.ts
  53967. let fullscreenInstance = void 0;
  53968. const Loading = function(options = {}, context) {
  53969. if (!isClient) return void 0;
  53970. const resolved = resolveOptions(options);
  53971. if (resolved.fullscreen && fullscreenInstance) return fullscreenInstance;
  53972. const instance = createLoadingComponent({
  53973. ...resolved,
  53974. closed: () => {
  53975. resolved.closed?.();
  53976. if (resolved.fullscreen) fullscreenInstance = void 0;
  53977. }
  53978. }, context ?? Loading._context);
  53979. addStyle(resolved, resolved.parent, instance);
  53980. addClassList(resolved, resolved.parent, instance);
  53981. resolved.parent.vLoadingAddClassList = () => addClassList(resolved, resolved.parent, instance);
  53982. let loadingNumber = resolved.parent.getAttribute("loading-number");
  53983. if (!loadingNumber) loadingNumber = "1";
  53984. else loadingNumber = `${Number.parseInt(loadingNumber) + 1}`;
  53985. resolved.parent.setAttribute("loading-number", loadingNumber);
  53986. resolved.parent.appendChild(instance.$el);
  53987. nextTick(() => instance.visible.value = resolved.visible);
  53988. if (resolved.fullscreen) fullscreenInstance = instance;
  53989. return instance;
  53990. };
  53991. const resolveOptions = (options) => {
  53992. let target;
  53993. if (isString(options.target)) target = document.querySelector(options.target) ?? document.body;
  53994. else target = options.target || document.body;
  53995. return {
  53996. parent: target === document.body || options.body ? document.body : target,
  53997. background: options.background || "",
  53998. svg: options.svg || "",
  53999. svgViewBox: options.svgViewBox || "",
  54000. spinner: options.spinner || false,
  54001. text: options.text || "",
  54002. fullscreen: target === document.body && (options.fullscreen ?? true),
  54003. lock: options.lock ?? false,
  54004. customClass: options.customClass || "",
  54005. visible: options.visible ?? true,
  54006. beforeClose: options.beforeClose,
  54007. closed: options.closed,
  54008. target
  54009. };
  54010. };
  54011. const addStyle = async (options, parent, instance) => {
  54012. const { nextZIndex } = instance.vm.zIndex || instance.vm._.exposed.zIndex;
  54013. const maskStyle = {};
  54014. if (options.fullscreen) {
  54015. instance.originalPosition.value = getStyle(document.body, "position");
  54016. instance.originalOverflow.value = getStyle(document.body, "overflow");
  54017. maskStyle.zIndex = nextZIndex();
  54018. } else if (options.parent === document.body) {
  54019. instance.originalPosition.value = getStyle(document.body, "position");
  54020. await nextTick();
  54021. for (const property of ["top", "left"]) {
  54022. const scroll = property === "top" ? "scrollTop" : "scrollLeft";
  54023. maskStyle[property] = `${options.target.getBoundingClientRect()[property] + document.body[scroll] + document.documentElement[scroll] - Number.parseInt(getStyle(document.body, `margin-${property}`), 10)}px`;
  54024. }
  54025. for (const property of ["height", "width"]) maskStyle[property] = `${options.target.getBoundingClientRect()[property]}px`;
  54026. } else instance.originalPosition.value = getStyle(parent, "position");
  54027. for (const [key, value] of Object.entries(maskStyle)) instance.$el.style[key] = value;
  54028. };
  54029. const addClassList = (options, parent, instance) => {
  54030. const ns = instance.vm.ns || instance.vm._.exposed.ns;
  54031. if (![
  54032. "absolute",
  54033. "fixed",
  54034. "sticky"
  54035. ].includes(instance.originalPosition.value)) addClass(parent, ns.bm("parent", "relative"));
  54036. else removeClass(parent, ns.bm("parent", "relative"));
  54037. if (options.fullscreen && options.lock) addClass(parent, ns.bm("parent", "hidden"));
  54038. else removeClass(parent, ns.bm("parent", "hidden"));
  54039. };
  54040. Loading._context = null;
  54041. //#endregion
  54042. //#region ../../packages/components/loading/src/directive.ts
  54043. const INSTANCE_KEY = Symbol("ElLoading");
  54044. const getAttributeName = (name) => {
  54045. return `element-loading-${hyphenate(name)}`;
  54046. };
  54047. const createInstance = (el, binding) => {
  54048. const vm = binding.instance;
  54049. const getBindingProp = (key) => isObject$1(binding.value) ? binding.value[key] : void 0;
  54050. const resolveExpression = (key) => {
  54051. return ref(isString(key) && vm?.[key] || key);
  54052. };
  54053. const getProp = (name) => resolveExpression(getBindingProp(name) || el.getAttribute(getAttributeName(name)));
  54054. const fullscreen = getBindingProp("fullscreen") ?? binding.modifiers.fullscreen;
  54055. const options = {
  54056. text: getProp("text"),
  54057. svg: getProp("svg"),
  54058. svgViewBox: getProp("svgViewBox"),
  54059. spinner: getProp("spinner"),
  54060. background: getProp("background"),
  54061. customClass: getProp("customClass"),
  54062. fullscreen,
  54063. target: getBindingProp("target") ?? (fullscreen ? void 0 : el),
  54064. body: getBindingProp("body") ?? binding.modifiers.body,
  54065. lock: getBindingProp("lock") ?? binding.modifiers.lock
  54066. };
  54067. const instance = Loading(options);
  54068. instance._context = vLoading._context;
  54069. el[INSTANCE_KEY] = {
  54070. options,
  54071. instance
  54072. };
  54073. };
  54074. const updateOptions = (originalOptions, newOptions) => {
  54075. for (const key of Object.keys(originalOptions)) if (isRef(originalOptions[key])) originalOptions[key].value = newOptions[key];
  54076. };
  54077. const vLoading = {
  54078. mounted(el, binding) {
  54079. if (binding.value) createInstance(el, binding);
  54080. },
  54081. updated(el, binding) {
  54082. const instance = el[INSTANCE_KEY];
  54083. if (!binding.value) {
  54084. instance?.instance.close();
  54085. el[INSTANCE_KEY] = null;
  54086. return;
  54087. }
  54088. if (!instance) createInstance(el, binding);
  54089. else updateOptions(instance.options, isObject$1(binding.value) ? binding.value : {
  54090. text: el.getAttribute(getAttributeName("text")),
  54091. svg: el.getAttribute(getAttributeName("svg")),
  54092. svgViewBox: el.getAttribute(getAttributeName("svgViewBox")),
  54093. spinner: el.getAttribute(getAttributeName("spinner")),
  54094. background: el.getAttribute(getAttributeName("background")),
  54095. customClass: el.getAttribute(getAttributeName("customClass"))
  54096. });
  54097. },
  54098. unmounted(el) {
  54099. el[INSTANCE_KEY]?.instance.close();
  54100. el[INSTANCE_KEY] = null;
  54101. }
  54102. };
  54103. vLoading._context = null;
  54104. //#endregion
  54105. //#region ../../packages/components/loading/index.ts
  54106. const ElLoading = {
  54107. install(app) {
  54108. Loading._context = app._context;
  54109. vLoading._context = app._context;
  54110. app.directive("loading", vLoading);
  54111. app.config.globalProperties.$loading = Loading;
  54112. },
  54113. directive: vLoading,
  54114. service: Loading
  54115. };
  54116. //#endregion
  54117. //#region ../../packages/components/message/src/message.ts
  54118. const messageTypes = [
  54119. "primary",
  54120. "success",
  54121. "info",
  54122. "warning",
  54123. "error"
  54124. ];
  54125. const messagePlacement = [
  54126. "top",
  54127. "top-left",
  54128. "top-right",
  54129. "bottom",
  54130. "bottom-left",
  54131. "bottom-right"
  54132. ];
  54133. const MESSAGE_DEFAULT_PLACEMENT = "top";
  54134. const messageDefaults = mutable({
  54135. customClass: "",
  54136. dangerouslyUseHTMLString: false,
  54137. duration: 3e3,
  54138. icon: void 0,
  54139. id: "",
  54140. message: "",
  54141. onClose: void 0,
  54142. showClose: false,
  54143. type: "info",
  54144. plain: false,
  54145. offset: 16,
  54146. placement: void 0,
  54147. zIndex: 0,
  54148. grouping: false,
  54149. repeatNum: 1,
  54150. appendTo: isClient ? document.body : void 0
  54151. });
  54152. const messageProps = buildProps({
  54153. customClass: {
  54154. type: String,
  54155. default: messageDefaults.customClass
  54156. },
  54157. dangerouslyUseHTMLString: {
  54158. type: Boolean,
  54159. default: messageDefaults.dangerouslyUseHTMLString
  54160. },
  54161. duration: {
  54162. type: Number,
  54163. default: messageDefaults.duration
  54164. },
  54165. icon: {
  54166. type: iconPropType,
  54167. default: messageDefaults.icon
  54168. },
  54169. id: {
  54170. type: String,
  54171. default: messageDefaults.id
  54172. },
  54173. message: {
  54174. type: definePropType([
  54175. String,
  54176. Object,
  54177. Function
  54178. ]),
  54179. default: messageDefaults.message
  54180. },
  54181. onClose: {
  54182. type: definePropType(Function),
  54183. default: messageDefaults.onClose
  54184. },
  54185. showClose: {
  54186. type: Boolean,
  54187. default: messageDefaults.showClose
  54188. },
  54189. type: {
  54190. type: String,
  54191. values: messageTypes,
  54192. default: messageDefaults.type
  54193. },
  54194. plain: {
  54195. type: Boolean,
  54196. default: messageDefaults.plain
  54197. },
  54198. offset: {
  54199. type: Number,
  54200. default: messageDefaults.offset
  54201. },
  54202. placement: {
  54203. type: String,
  54204. values: messagePlacement,
  54205. default: messageDefaults.placement
  54206. },
  54207. zIndex: {
  54208. type: Number,
  54209. default: messageDefaults.zIndex
  54210. },
  54211. grouping: {
  54212. type: Boolean,
  54213. default: messageDefaults.grouping
  54214. },
  54215. repeatNum: {
  54216. type: Number,
  54217. default: messageDefaults.repeatNum
  54218. }
  54219. });
  54220. const messageEmits = { destroy: () => true };
  54221. //#endregion
  54222. //#region ../../packages/components/message/src/instance.ts
  54223. const placementInstances = shallowReactive({});
  54224. const getOrCreatePlacementInstances = (placement) => {
  54225. if (!placementInstances[placement]) placementInstances[placement] = shallowReactive([]);
  54226. return placementInstances[placement];
  54227. };
  54228. const getInstance = (id, placement) => {
  54229. const instances = placementInstances[placement] || [];
  54230. const idx = instances.findIndex((instance) => instance.id === id);
  54231. const current = instances[idx];
  54232. let prev;
  54233. if (idx > 0) prev = instances[idx - 1];
  54234. return {
  54235. current,
  54236. prev
  54237. };
  54238. };
  54239. const getLastOffset = (id, placement) => {
  54240. const { prev } = getInstance(id, placement);
  54241. if (!prev) return 0;
  54242. return prev.vm.exposed.bottom.value;
  54243. };
  54244. const getOffsetOrSpace = (id, offset, placement) => {
  54245. return (placementInstances[placement] || []).findIndex((instance) => instance.id === id) > 0 ? 16 : offset;
  54246. };
  54247. //#endregion
  54248. //#region ../../packages/components/message/src/message.vue?vue&type=script&setup=true&lang.ts
  54249. const _hoisted_1$2 = ["id"];
  54250. const _hoisted_2$2 = ["innerHTML"];
  54251. var message_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  54252. name: "ElMessage",
  54253. __name: "message",
  54254. props: messageProps,
  54255. emits: messageEmits,
  54256. setup(__props, { expose: __expose, emit: __emit }) {
  54257. const { Close } = TypeComponents;
  54258. const props = __props;
  54259. const emit = __emit;
  54260. const isStartTransition = ref(false);
  54261. const { ns, zIndex } = useGlobalComponentSettings("message");
  54262. const { currentZIndex, nextZIndex } = zIndex;
  54263. const messageRef = ref();
  54264. const visible = ref(false);
  54265. const height = ref(0);
  54266. let stopTimer = void 0;
  54267. const badgeType = computed(() => props.type ? props.type === "error" ? "danger" : props.type : "info");
  54268. const typeClass = computed(() => {
  54269. const type = props.type;
  54270. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  54271. });
  54272. const iconComponent = computed(() => props.icon || TypeComponentsMap[props.type] || "");
  54273. const placement = computed(() => props.placement || "top");
  54274. const lastOffset = computed(() => getLastOffset(props.id, placement.value));
  54275. const offset = computed(() => {
  54276. return Math.max(getOffsetOrSpace(props.id, props.offset, placement.value) + lastOffset.value, props.offset);
  54277. });
  54278. const bottom = computed(() => height.value + offset.value);
  54279. const horizontalClass = computed(() => {
  54280. if (placement.value.includes("left")) return ns.is("left");
  54281. if (placement.value.includes("right")) return ns.is("right");
  54282. return ns.is("center");
  54283. });
  54284. const verticalProperty = computed(() => placement.value.startsWith("top") ? "top" : "bottom");
  54285. const customStyle = computed(() => ({
  54286. [verticalProperty.value]: `${offset.value}px`,
  54287. zIndex: currentZIndex.value
  54288. }));
  54289. function startTimer() {
  54290. if (props.duration === 0) return;
  54291. ({stop: stopTimer} = useTimeoutFn(() => {
  54292. close();
  54293. }, props.duration));
  54294. }
  54295. function clearTimer() {
  54296. stopTimer?.();
  54297. }
  54298. function close() {
  54299. visible.value = false;
  54300. nextTick(() => {
  54301. if (!isStartTransition.value) {
  54302. props.onClose?.();
  54303. emit("destroy");
  54304. }
  54305. });
  54306. }
  54307. function keydown(event) {
  54308. if (getEventCode(event) === EVENT_CODE.esc) close();
  54309. }
  54310. onMounted(() => {
  54311. startTimer();
  54312. nextZIndex();
  54313. visible.value = true;
  54314. });
  54315. watch(() => props.repeatNum, () => {
  54316. clearTimer();
  54317. startTimer();
  54318. });
  54319. useEventListener(document, "keydown", keydown);
  54320. useResizeObserver(messageRef, () => {
  54321. height.value = messageRef.value.getBoundingClientRect().height;
  54322. });
  54323. __expose({
  54324. visible,
  54325. bottom,
  54326. close
  54327. });
  54328. return (_ctx, _cache) => {
  54329. return openBlock(), createBlock(Transition, {
  54330. name: unref(ns).b("fade"),
  54331. onBeforeEnter: _cache[0] || (_cache[0] = ($event) => isStartTransition.value = true),
  54332. onBeforeLeave: __props.onClose,
  54333. onAfterLeave: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("destroy")),
  54334. persisted: ""
  54335. }, {
  54336. default: withCtx(() => [withDirectives(createElementVNode("div", {
  54337. id: __props.id,
  54338. ref_key: "messageRef",
  54339. ref: messageRef,
  54340. class: normalizeClass([
  54341. unref(ns).b(),
  54342. { [unref(ns).m(__props.type)]: __props.type },
  54343. unref(ns).is("closable", __props.showClose),
  54344. unref(ns).is("plain", __props.plain),
  54345. unref(ns).is("bottom", verticalProperty.value === "bottom"),
  54346. horizontalClass.value,
  54347. __props.customClass
  54348. ]),
  54349. style: normalizeStyle(customStyle.value),
  54350. role: "alert",
  54351. onMouseenter: clearTimer,
  54352. onMouseleave: startTimer
  54353. }, [
  54354. __props.repeatNum > 1 ? (openBlock(), createBlock(unref(ElBadge), {
  54355. key: 0,
  54356. value: __props.repeatNum,
  54357. type: badgeType.value,
  54358. class: normalizeClass(unref(ns).e("badge"))
  54359. }, null, 8, [
  54360. "value",
  54361. "type",
  54362. "class"
  54363. ])) : createCommentVNode("v-if", true),
  54364. iconComponent.value ? (openBlock(), createBlock(unref(ElIcon), {
  54365. key: 1,
  54366. class: normalizeClass([unref(ns).e("icon"), typeClass.value])
  54367. }, {
  54368. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(iconComponent.value)))]),
  54369. _: 1
  54370. }, 8, ["class"])) : createCommentVNode("v-if", true),
  54371. !__props.dangerouslyUseHTMLString || _ctx.$slots.default ? (openBlock(), createElementBlock("p", {
  54372. key: 2,
  54373. class: normalizeClass(unref(ns).e("content"))
  54374. }, [renderSlot(_ctx.$slots, "default", {}, () => [createTextVNode(toDisplayString(__props.message), 1)])], 2)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "), createElementVNode("p", {
  54375. class: normalizeClass(unref(ns).e("content")),
  54376. innerHTML: __props.message
  54377. }, null, 10, _hoisted_2$2)], 2112)),
  54378. __props.showClose ? (openBlock(), createBlock(unref(ElIcon), {
  54379. key: 4,
  54380. class: normalizeClass(unref(ns).e("closeBtn")),
  54381. onClick: withModifiers(close, ["stop"])
  54382. }, {
  54383. default: withCtx(() => [createVNode(unref(Close))]),
  54384. _: 1
  54385. }, 8, ["class"])) : createCommentVNode("v-if", true)
  54386. ], 46, _hoisted_1$2), [[vShow, visible.value]])]),
  54387. _: 3
  54388. }, 8, ["name", "onBeforeLeave"]);
  54389. };
  54390. }
  54391. });
  54392. //#endregion
  54393. //#region ../../packages/components/message/src/message.vue
  54394. var message_default = message_vue_vue_type_script_setup_true_lang_default;
  54395. //#endregion
  54396. //#region ../../packages/components/message/src/method.ts
  54397. let seed$1 = 1;
  54398. const normalizeAppendTo = (normalized) => {
  54399. if (!normalized.appendTo) normalized.appendTo = document.body;
  54400. else if (isString(normalized.appendTo)) {
  54401. let appendTo = document.querySelector(normalized.appendTo);
  54402. if (!isElement$1(appendTo)) {
  54403. /* @__PURE__ */ debugWarn("ElMessage", "the appendTo option is not an HTMLElement. Falling back to document.body.");
  54404. appendTo = document.body;
  54405. }
  54406. normalized.appendTo = appendTo;
  54407. }
  54408. };
  54409. const normalizePlacement = (normalized) => {
  54410. if (!normalized.placement && isString(messageConfig.placement) && messageConfig.placement) normalized.placement = messageConfig.placement;
  54411. if (!normalized.placement) normalized.placement = "top";
  54412. if (!messagePlacement.includes(normalized.placement)) {
  54413. /* @__PURE__ */ debugWarn("ElMessage", `Invalid placement: ${normalized.placement}. Falling back to '${"top"}'.`);
  54414. normalized.placement = "top";
  54415. }
  54416. };
  54417. const normalizeOptions = (params) => {
  54418. const options = !params || isString(params) || isVNode(params) || isFunction$1(params) ? { message: params } : params;
  54419. const normalized = {
  54420. ...messageDefaults,
  54421. ...options
  54422. };
  54423. normalizeAppendTo(normalized);
  54424. normalizePlacement(normalized);
  54425. if (isBoolean(messageConfig.grouping) && !normalized.grouping) normalized.grouping = messageConfig.grouping;
  54426. if (isNumber(messageConfig.duration) && normalized.duration === 3e3) normalized.duration = messageConfig.duration;
  54427. if (isNumber(messageConfig.offset) && normalized.offset === 16) normalized.offset = messageConfig.offset;
  54428. if (isBoolean(messageConfig.showClose) && !normalized.showClose) normalized.showClose = messageConfig.showClose;
  54429. if (isBoolean(messageConfig.plain) && !normalized.plain) normalized.plain = messageConfig.plain;
  54430. return normalized;
  54431. };
  54432. const closeMessage = (instance) => {
  54433. const instances = placementInstances[instance.props.placement || "top"];
  54434. const idx = instances.indexOf(instance);
  54435. if (idx === -1) return;
  54436. instances.splice(idx, 1);
  54437. const { handler } = instance;
  54438. handler.close();
  54439. };
  54440. const createMessage = ({ appendTo, ...options }, context) => {
  54441. const id = `message_${seed$1++}`;
  54442. const userOnClose = options.onClose;
  54443. const container = document.createElement("div");
  54444. const props = {
  54445. ...options,
  54446. id,
  54447. onClose: () => {
  54448. userOnClose?.();
  54449. closeMessage(instance);
  54450. },
  54451. onDestroy: () => {
  54452. render(null, container);
  54453. }
  54454. };
  54455. const vnode = createVNode(message_default, props, isFunction$1(props.message) || isVNode(props.message) ? { default: isFunction$1(props.message) ? props.message : () => props.message } : null);
  54456. vnode.appContext = context || message._context;
  54457. render(vnode, container);
  54458. appendTo.appendChild(container.firstElementChild);
  54459. const vm = vnode.component;
  54460. const instance = {
  54461. id,
  54462. vnode,
  54463. vm,
  54464. handler: { close: () => {
  54465. vm.exposed.close();
  54466. } },
  54467. props: vnode.component.props
  54468. };
  54469. return instance;
  54470. };
  54471. const message = (options = {}, context) => {
  54472. if (!isClient) return { close: () => void 0 };
  54473. const normalized = normalizeOptions(options);
  54474. const instances = getOrCreatePlacementInstances(normalized.placement || "top");
  54475. if (normalized.grouping && instances.length) {
  54476. const instance = instances.find(({ vnode: vm }) => vm.props?.message === normalized.message);
  54477. if (instance) {
  54478. instance.props.repeatNum += 1;
  54479. instance.props.type = normalized.type;
  54480. return instance.handler;
  54481. }
  54482. }
  54483. if (isNumber(messageConfig.max) && instances.length >= messageConfig.max) return { close: () => void 0 };
  54484. const instance = createMessage(normalized, context);
  54485. instances.push(instance);
  54486. return instance.handler;
  54487. };
  54488. messageTypes.forEach((type) => {
  54489. message[type] = (options = {}, appContext) => {
  54490. return message({
  54491. ...normalizeOptions(options),
  54492. type
  54493. }, appContext);
  54494. };
  54495. });
  54496. function closeAll$1(type) {
  54497. for (const placement in placementInstances) if (hasOwn(placementInstances, placement)) {
  54498. const instances = [...placementInstances[placement]];
  54499. for (const instance of instances) if (!type || type === instance.props.type) instance.handler.close();
  54500. }
  54501. }
  54502. function closeAllByPlacement(placement) {
  54503. if (!placementInstances[placement]) return;
  54504. [...placementInstances[placement]].forEach((instance) => instance.handler.close());
  54505. }
  54506. message.closeAll = closeAll$1;
  54507. message.closeAllByPlacement = closeAllByPlacement;
  54508. message._context = null;
  54509. //#endregion
  54510. //#region ../../packages/components/message/index.ts
  54511. const ElMessage = withInstallFunction(message, "$message");
  54512. //#endregion
  54513. //#region ../../packages/components/message-box/src/index.vue?vue&type=script&lang.ts
  54514. var index_vue_vue_type_script_lang_default = defineComponent({
  54515. name: "ElMessageBox",
  54516. directives: { TrapFocus },
  54517. components: {
  54518. ElButton,
  54519. ElFocusTrap: focus_trap_default,
  54520. ElInput,
  54521. ElOverlay,
  54522. ElIcon,
  54523. ...TypeComponents
  54524. },
  54525. inheritAttrs: false,
  54526. props: {
  54527. buttonSize: {
  54528. type: String,
  54529. validator: isValidComponentSize
  54530. },
  54531. modal: {
  54532. type: Boolean,
  54533. default: true
  54534. },
  54535. lockScroll: {
  54536. type: Boolean,
  54537. default: true
  54538. },
  54539. showClose: {
  54540. type: Boolean,
  54541. default: true
  54542. },
  54543. closeOnClickModal: {
  54544. type: Boolean,
  54545. default: true
  54546. },
  54547. closeOnPressEscape: {
  54548. type: Boolean,
  54549. default: true
  54550. },
  54551. closeOnHashChange: {
  54552. type: Boolean,
  54553. default: true
  54554. },
  54555. center: Boolean,
  54556. draggable: Boolean,
  54557. overflow: Boolean,
  54558. roundButton: Boolean,
  54559. container: {
  54560. type: String,
  54561. default: "body"
  54562. },
  54563. boxType: {
  54564. type: String,
  54565. default: ""
  54566. }
  54567. },
  54568. emits: ["vanish", "action"],
  54569. setup(props, { emit }) {
  54570. const { locale, zIndex, ns, size: btnSize } = useGlobalComponentSettings("message-box", computed(() => props.buttonSize));
  54571. const { t } = locale;
  54572. const { nextZIndex } = zIndex;
  54573. const visible = ref(false);
  54574. const state = reactive({
  54575. autofocus: true,
  54576. beforeClose: null,
  54577. callback: null,
  54578. cancelButtonText: "",
  54579. cancelButtonClass: "",
  54580. confirmButtonText: "",
  54581. confirmButtonClass: "",
  54582. cancelButtonType: "",
  54583. confirmButtonType: "primary",
  54584. customClass: "",
  54585. customStyle: {},
  54586. dangerouslyUseHTMLString: false,
  54587. distinguishCancelAndClose: false,
  54588. icon: "",
  54589. closeIcon: "",
  54590. inputPattern: null,
  54591. inputPlaceholder: "",
  54592. inputType: "text",
  54593. inputValue: "",
  54594. inputValidator: void 0,
  54595. inputErrorMessage: "",
  54596. message: "",
  54597. modalFade: true,
  54598. modalClass: "",
  54599. showCancelButton: false,
  54600. showConfirmButton: true,
  54601. type: "",
  54602. title: void 0,
  54603. showInput: false,
  54604. action: "",
  54605. confirmButtonLoading: false,
  54606. cancelButtonLoading: false,
  54607. confirmButtonLoadingIcon: markRaw(loading_default),
  54608. cancelButtonLoadingIcon: markRaw(loading_default),
  54609. confirmButtonDisabled: false,
  54610. editorErrorMessage: "",
  54611. validateError: false,
  54612. zIndex: nextZIndex()
  54613. });
  54614. const typeClass = computed(() => {
  54615. const type = state.type;
  54616. return { [ns.bm("icon", type)]: type && TypeComponentsMap[type] };
  54617. });
  54618. const contentId = useId();
  54619. const inputId = useId();
  54620. const iconComponent = computed(() => {
  54621. const type = state.type;
  54622. return state.icon || type && TypeComponentsMap[type] || "";
  54623. });
  54624. const hasMessage = computed(() => !!state.message);
  54625. const rootRef = ref();
  54626. const headerRef = ref();
  54627. const focusStartRef = ref();
  54628. const inputRef = ref();
  54629. const confirmRef = ref();
  54630. const confirmButtonClasses = computed(() => state.confirmButtonClass);
  54631. watch(() => state.inputValue, async (val) => {
  54632. await nextTick();
  54633. if (props.boxType === "prompt" && val) validate();
  54634. }, { immediate: true });
  54635. watch(() => visible.value, (val) => {
  54636. if (val) {
  54637. if (props.boxType !== "prompt") if (state.autofocus) focusStartRef.value = confirmRef.value?.$el ?? rootRef.value;
  54638. else focusStartRef.value = rootRef.value;
  54639. state.zIndex = nextZIndex();
  54640. }
  54641. if (props.boxType !== "prompt") return;
  54642. if (val) nextTick().then(() => {
  54643. if (inputRef.value && inputRef.value.$el) if (state.autofocus) focusStartRef.value = getInputElement() ?? rootRef.value;
  54644. else focusStartRef.value = rootRef.value;
  54645. });
  54646. else {
  54647. state.editorErrorMessage = "";
  54648. state.validateError = false;
  54649. }
  54650. });
  54651. const { isDragging } = useDraggable(rootRef, headerRef, computed(() => props.draggable), computed(() => props.overflow));
  54652. onMounted(async () => {
  54653. await nextTick();
  54654. if (props.closeOnHashChange) window.addEventListener("hashchange", doClose);
  54655. });
  54656. onBeforeUnmount(() => {
  54657. if (props.closeOnHashChange) window.removeEventListener("hashchange", doClose);
  54658. });
  54659. function doClose() {
  54660. if (!visible.value) return;
  54661. visible.value = false;
  54662. nextTick(() => {
  54663. if (state.action) emit("action", state.action);
  54664. });
  54665. }
  54666. const handleWrapperClick = () => {
  54667. if (props.closeOnClickModal) handleAction(state.distinguishCancelAndClose ? "close" : "cancel");
  54668. };
  54669. const overlayEvent = useSameTarget(handleWrapperClick);
  54670. const handleInputEnter = (e) => {
  54671. if (state.inputType !== "textarea" && !inputRef.value?.isComposing) {
  54672. e.preventDefault();
  54673. return handleAction("confirm");
  54674. }
  54675. };
  54676. const handleAction = (action) => {
  54677. if (props.boxType === "prompt" && action === "confirm" && !validate()) return;
  54678. state.action = action;
  54679. if (state.beforeClose) state.beforeClose?.(action, state, doClose);
  54680. else doClose();
  54681. };
  54682. const validate = () => {
  54683. if (props.boxType === "prompt") {
  54684. const inputPattern = state.inputPattern;
  54685. if (inputPattern && !inputPattern.test(state.inputValue || "")) {
  54686. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  54687. state.validateError = true;
  54688. return false;
  54689. }
  54690. const inputValidator = state.inputValidator;
  54691. if (isFunction$1(inputValidator)) {
  54692. const validateResult = inputValidator(state.inputValue);
  54693. if (validateResult === false) {
  54694. state.editorErrorMessage = state.inputErrorMessage || t("el.messagebox.error");
  54695. state.validateError = true;
  54696. return false;
  54697. }
  54698. if (isString(validateResult)) {
  54699. state.editorErrorMessage = validateResult;
  54700. state.validateError = true;
  54701. return false;
  54702. }
  54703. }
  54704. }
  54705. state.editorErrorMessage = "";
  54706. state.validateError = false;
  54707. return true;
  54708. };
  54709. const getInputElement = () => {
  54710. const inputRefs = inputRef.value?.$refs;
  54711. return inputRefs?.input ?? inputRefs?.textarea;
  54712. };
  54713. const handleClose = () => {
  54714. handleAction("close");
  54715. };
  54716. const onCloseRequested = () => {
  54717. if (props.closeOnPressEscape) handleClose();
  54718. };
  54719. if (props.lockScroll) useLockscreen(visible, { ns });
  54720. return {
  54721. ...toRefs(state),
  54722. ns,
  54723. overlayEvent,
  54724. visible,
  54725. hasMessage,
  54726. typeClass,
  54727. contentId,
  54728. inputId,
  54729. btnSize,
  54730. iconComponent,
  54731. confirmButtonClasses,
  54732. rootRef,
  54733. focusStartRef,
  54734. headerRef,
  54735. inputRef,
  54736. isDragging,
  54737. confirmRef,
  54738. doClose,
  54739. handleClose,
  54740. onCloseRequested,
  54741. handleWrapperClick,
  54742. handleInputEnter,
  54743. handleAction,
  54744. t
  54745. };
  54746. }
  54747. });
  54748. //#endregion
  54749. //#region ../../packages/components/message-box/src/index.vue
  54750. const _hoisted_1$1 = ["aria-label", "aria-describedby"];
  54751. const _hoisted_2$1 = ["aria-label"];
  54752. const _hoisted_3$1 = ["id"];
  54753. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  54754. const _component_el_icon = resolveComponent("el-icon");
  54755. const _component_el_input = resolveComponent("el-input");
  54756. const _component_el_button = resolveComponent("el-button");
  54757. const _component_el_focus_trap = resolveComponent("el-focus-trap");
  54758. const _component_el_overlay = resolveComponent("el-overlay");
  54759. return openBlock(), createBlock(Transition, {
  54760. name: "fade-in-linear",
  54761. onAfterLeave: _cache[11] || (_cache[11] = ($event) => _ctx.$emit("vanish")),
  54762. persisted: ""
  54763. }, {
  54764. default: withCtx(() => [withDirectives(createVNode(_component_el_overlay, {
  54765. "z-index": _ctx.zIndex,
  54766. "overlay-class": [_ctx.ns.is("message-box"), _ctx.modalClass],
  54767. mask: _ctx.modal
  54768. }, {
  54769. default: withCtx(() => [createElementVNode("div", {
  54770. role: "dialog",
  54771. "aria-label": _ctx.title,
  54772. "aria-modal": "true",
  54773. "aria-describedby": !_ctx.showInput ? _ctx.contentId : void 0,
  54774. class: normalizeClass(`${_ctx.ns.namespace.value}-overlay-message-box`),
  54775. onClick: _cache[8] || (_cache[8] = (...args) => _ctx.overlayEvent.onClick && _ctx.overlayEvent.onClick(...args)),
  54776. onMousedown: _cache[9] || (_cache[9] = (...args) => _ctx.overlayEvent.onMousedown && _ctx.overlayEvent.onMousedown(...args)),
  54777. onMouseup: _cache[10] || (_cache[10] = (...args) => _ctx.overlayEvent.onMouseup && _ctx.overlayEvent.onMouseup(...args))
  54778. }, [createVNode(_component_el_focus_trap, {
  54779. loop: "",
  54780. trapped: _ctx.visible,
  54781. "focus-trap-el": _ctx.rootRef,
  54782. "focus-start-el": _ctx.focusStartRef,
  54783. onReleaseRequested: _ctx.onCloseRequested
  54784. }, {
  54785. default: withCtx(() => [createElementVNode("div", {
  54786. ref: "rootRef",
  54787. class: normalizeClass([
  54788. _ctx.ns.b(),
  54789. _ctx.customClass,
  54790. _ctx.ns.is("draggable", _ctx.draggable),
  54791. _ctx.ns.is("dragging", _ctx.isDragging),
  54792. { [_ctx.ns.m("center")]: _ctx.center }
  54793. ]),
  54794. style: normalizeStyle(_ctx.customStyle),
  54795. tabindex: "-1",
  54796. onClick: _cache[7] || (_cache[7] = withModifiers(() => {}, ["stop"]))
  54797. }, [
  54798. _ctx.title !== null && _ctx.title !== void 0 ? (openBlock(), createElementBlock("div", {
  54799. key: 0,
  54800. ref: "headerRef",
  54801. class: normalizeClass([_ctx.ns.e("header"), { "show-close": _ctx.showClose }])
  54802. }, [createElementVNode("div", { class: normalizeClass(_ctx.ns.e("title")) }, [_ctx.iconComponent && _ctx.center ? (openBlock(), createBlock(_component_el_icon, {
  54803. key: 0,
  54804. class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  54805. }, {
  54806. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))]),
  54807. _: 1
  54808. }, 8, ["class"])) : createCommentVNode("v-if", true), createElementVNode("span", null, toDisplayString(_ctx.title), 1)], 2), _ctx.showClose ? (openBlock(), createElementBlock("button", {
  54809. key: 0,
  54810. type: "button",
  54811. class: normalizeClass(_ctx.ns.e("headerbtn")),
  54812. "aria-label": _ctx.t("el.messagebox.close"),
  54813. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel")),
  54814. onKeydown: _cache[1] || (_cache[1] = withKeys(withModifiers(($event) => _ctx.handleAction(_ctx.distinguishCancelAndClose ? "close" : "cancel"), ["prevent"]), ["enter"]))
  54815. }, [createVNode(_component_el_icon, { class: normalizeClass(_ctx.ns.e("close")) }, {
  54816. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || "close")))]),
  54817. _: 1
  54818. }, 8, ["class"])], 42, _hoisted_2$1)) : createCommentVNode("v-if", true)], 2)) : createCommentVNode("v-if", true),
  54819. createElementVNode("div", {
  54820. id: _ctx.contentId,
  54821. class: normalizeClass(_ctx.ns.e("content"))
  54822. }, [createElementVNode("div", { class: normalizeClass(_ctx.ns.e("container")) }, [_ctx.iconComponent && !_ctx.center && _ctx.hasMessage ? (openBlock(), createBlock(_component_el_icon, {
  54823. key: 0,
  54824. class: normalizeClass([_ctx.ns.e("status"), _ctx.typeClass])
  54825. }, {
  54826. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))]),
  54827. _: 1
  54828. }, 8, ["class"])) : createCommentVNode("v-if", true), _ctx.hasMessage ? (openBlock(), createElementBlock("div", {
  54829. key: 1,
  54830. class: normalizeClass(_ctx.ns.e("message"))
  54831. }, [renderSlot(_ctx.$slots, "default", {}, () => [!_ctx.dangerouslyUseHTMLString ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  54832. key: 0,
  54833. for: _ctx.showInput ? _ctx.inputId : void 0,
  54834. textContent: toDisplayString(_ctx.message)
  54835. }, null, 8, ["for", "textContent"])) : (openBlock(), createBlock(resolveDynamicComponent(_ctx.showInput ? "label" : "p"), {
  54836. key: 1,
  54837. for: _ctx.showInput ? _ctx.inputId : void 0,
  54838. innerHTML: _ctx.message
  54839. }, null, 8, ["for", "innerHTML"]))])], 2)) : createCommentVNode("v-if", true)], 2), withDirectives(createElementVNode("div", { class: normalizeClass(_ctx.ns.e("input")) }, [createVNode(_component_el_input, {
  54840. id: _ctx.inputId,
  54841. ref: "inputRef",
  54842. modelValue: _ctx.inputValue,
  54843. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.inputValue = $event),
  54844. type: _ctx.inputType,
  54845. placeholder: _ctx.inputPlaceholder,
  54846. "aria-invalid": _ctx.validateError,
  54847. class: normalizeClass({ invalid: _ctx.validateError }),
  54848. onKeydown: withKeys(_ctx.handleInputEnter, ["enter"])
  54849. }, null, 8, [
  54850. "id",
  54851. "modelValue",
  54852. "type",
  54853. "placeholder",
  54854. "aria-invalid",
  54855. "class",
  54856. "onKeydown"
  54857. ]), createElementVNode("div", {
  54858. class: normalizeClass(_ctx.ns.e("errormsg")),
  54859. style: normalizeStyle({ visibility: !!_ctx.editorErrorMessage ? "visible" : "hidden" })
  54860. }, toDisplayString(_ctx.editorErrorMessage), 7)], 2), [[vShow, _ctx.showInput]])], 10, _hoisted_3$1),
  54861. _ctx.showCancelButton || _ctx.showConfirmButton ? (openBlock(), createElementBlock("div", {
  54862. key: 1,
  54863. class: normalizeClass(_ctx.ns.e("btns"))
  54864. }, [_ctx.showCancelButton ? (openBlock(), createBlock(_component_el_button, {
  54865. key: 0,
  54866. type: _ctx.cancelButtonType === "text" ? "" : _ctx.cancelButtonType,
  54867. text: _ctx.cancelButtonType === "text",
  54868. loading: _ctx.cancelButtonLoading,
  54869. "loading-icon": _ctx.cancelButtonLoadingIcon,
  54870. class: normalizeClass([_ctx.cancelButtonClass]),
  54871. round: _ctx.roundButton,
  54872. size: _ctx.btnSize,
  54873. onClick: _cache[3] || (_cache[3] = ($event) => _ctx.handleAction("cancel")),
  54874. onKeydown: _cache[4] || (_cache[4] = withKeys(withModifiers(($event) => _ctx.handleAction("cancel"), ["prevent"]), ["enter"]))
  54875. }, {
  54876. default: withCtx(() => [createTextVNode(toDisplayString(_ctx.cancelButtonText || _ctx.t("el.messagebox.cancel")), 1)]),
  54877. _: 1
  54878. }, 8, [
  54879. "type",
  54880. "text",
  54881. "loading",
  54882. "loading-icon",
  54883. "class",
  54884. "round",
  54885. "size"
  54886. ])) : createCommentVNode("v-if", true), withDirectives(createVNode(_component_el_button, {
  54887. ref: "confirmRef",
  54888. type: _ctx.confirmButtonType === "text" ? "" : _ctx.confirmButtonType,
  54889. text: _ctx.confirmButtonType === "text",
  54890. loading: _ctx.confirmButtonLoading,
  54891. "loading-icon": _ctx.confirmButtonLoadingIcon,
  54892. class: normalizeClass([_ctx.confirmButtonClasses]),
  54893. round: _ctx.roundButton,
  54894. disabled: _ctx.confirmButtonDisabled,
  54895. size: _ctx.btnSize,
  54896. onClick: _cache[5] || (_cache[5] = ($event) => _ctx.handleAction("confirm")),
  54897. onKeydown: _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.handleAction("confirm"), ["prevent"]), ["enter"]))
  54898. }, {
  54899. default: withCtx(() => [createTextVNode(toDisplayString(_ctx.confirmButtonText || _ctx.t("el.messagebox.confirm")), 1)]),
  54900. _: 1
  54901. }, 8, [
  54902. "type",
  54903. "text",
  54904. "loading",
  54905. "loading-icon",
  54906. "class",
  54907. "round",
  54908. "disabled",
  54909. "size"
  54910. ]), [[vShow, _ctx.showConfirmButton]])], 2)) : createCommentVNode("v-if", true)
  54911. ], 6)]),
  54912. _: 3
  54913. }, 8, [
  54914. "trapped",
  54915. "focus-trap-el",
  54916. "focus-start-el",
  54917. "onReleaseRequested"
  54918. ])], 42, _hoisted_1$1)]),
  54919. _: 3
  54920. }, 8, [
  54921. "z-index",
  54922. "overlay-class",
  54923. "mask"
  54924. ]), [[vShow, _ctx.visible]])]),
  54925. _: 3
  54926. });
  54927. }
  54928. var src_default = /* @__PURE__ */ _plugin_vue_export_helper_default(index_vue_vue_type_script_lang_default, [["render", _sfc_render]]);
  54929. //#endregion
  54930. //#region ../../packages/components/message-box/src/messageBox.ts
  54931. const messageInstance = /* @__PURE__ */ new Map();
  54932. const getAppendToElement = (props) => {
  54933. let appendTo = document.body;
  54934. if (props.appendTo) {
  54935. if (isString(props.appendTo)) appendTo = document.querySelector(props.appendTo);
  54936. if (isElement$1(props.appendTo)) appendTo = props.appendTo;
  54937. if (!isElement$1(appendTo)) {
  54938. /* @__PURE__ */ debugWarn("ElMessageBox", "the appendTo option is not an HTMLElement. Falling back to document.body.");
  54939. appendTo = document.body;
  54940. }
  54941. }
  54942. return appendTo;
  54943. };
  54944. const handleAction = (vnode, action) => {
  54945. const vm = vnode.component?.proxy;
  54946. return () => vm.handleAction(action);
  54947. };
  54948. const initInstance = (props, container, appContext = null) => {
  54949. const vnode = createVNode(src_default, props, isFunction$1(props.message) || isVNode(props.message) ? { default: isFunction$1(props.message) ? () => props.message({
  54950. confirm: handleAction(vnode, "confirm"),
  54951. cancel: handleAction(vnode, "cancel"),
  54952. close: handleAction(vnode, "close")
  54953. }) : () => props.message } : null);
  54954. vnode.appContext = appContext;
  54955. render(vnode, container);
  54956. getAppendToElement(props).appendChild(container.firstElementChild);
  54957. return vnode.component;
  54958. };
  54959. const genContainer = () => {
  54960. return document.createElement("div");
  54961. };
  54962. const showMessage = (options, appContext) => {
  54963. const container = genContainer();
  54964. options.onVanish = () => {
  54965. render(null, container);
  54966. messageInstance.delete(vm);
  54967. };
  54968. options.onAction = (action) => {
  54969. const currentMsg = messageInstance.get(vm);
  54970. let resolve;
  54971. if (options.showInput) resolve = {
  54972. value: vm.inputValue,
  54973. action
  54974. };
  54975. else resolve = action;
  54976. if (options.callback) options.callback(resolve, instance.proxy);
  54977. else if (action === "cancel" || action === "close") if (options.distinguishCancelAndClose && action !== "cancel") currentMsg.reject("close");
  54978. else currentMsg.reject("cancel");
  54979. else currentMsg.resolve(resolve);
  54980. };
  54981. const instance = initInstance(options, container, appContext);
  54982. const vm = instance.proxy;
  54983. for (const prop in options) if (hasOwn(options, prop) && !hasOwn(vm.$props, prop)) if (prop === "closeIcon" && isObject$1(options[prop])) vm[prop] = markRaw(options[prop]);
  54984. else vm[prop] = options[prop];
  54985. vm.visible = true;
  54986. return vm;
  54987. };
  54988. function MessageBox(options, appContext = null) {
  54989. if (!isClient) return Promise.reject();
  54990. let callback;
  54991. if (isString(options) || isVNode(options)) options = { message: options };
  54992. else callback = options.callback;
  54993. return new Promise((resolve, reject) => {
  54994. const vm = showMessage(options, appContext ?? MessageBox._context);
  54995. messageInstance.set(vm, {
  54996. options,
  54997. callback,
  54998. resolve,
  54999. reject
  55000. });
  55001. });
  55002. }
  55003. const MESSAGE_BOX_VARIANTS = [
  55004. "alert",
  55005. "confirm",
  55006. "prompt"
  55007. ];
  55008. const MESSAGE_BOX_DEFAULT_OPTS = {
  55009. alert: {
  55010. closeOnPressEscape: false,
  55011. closeOnClickModal: false
  55012. },
  55013. confirm: { showCancelButton: true },
  55014. prompt: {
  55015. showCancelButton: true,
  55016. showInput: true
  55017. }
  55018. };
  55019. MESSAGE_BOX_VARIANTS.forEach((boxType) => {
  55020. MessageBox[boxType] = messageBoxFactory(boxType);
  55021. });
  55022. function messageBoxFactory(boxType) {
  55023. return (message, title, options, appContext) => {
  55024. let titleOrOpts = "";
  55025. if (isObject$1(title)) {
  55026. options = title;
  55027. titleOrOpts = "";
  55028. } else if (isUndefined(title)) titleOrOpts = "";
  55029. else titleOrOpts = title;
  55030. return MessageBox(Object.assign({
  55031. title: titleOrOpts,
  55032. message,
  55033. type: "",
  55034. ...MESSAGE_BOX_DEFAULT_OPTS[boxType]
  55035. }, options, { boxType }), appContext);
  55036. };
  55037. }
  55038. MessageBox.close = () => {
  55039. messageInstance.forEach((_, vm) => {
  55040. vm.doClose();
  55041. });
  55042. messageInstance.clear();
  55043. };
  55044. MessageBox._context = null;
  55045. //#endregion
  55046. //#region ../../packages/components/message-box/index.ts
  55047. const _MessageBox = MessageBox;
  55048. _MessageBox.install = (app) => {
  55049. _MessageBox._context = app._context;
  55050. app.config.globalProperties.$msgbox = _MessageBox;
  55051. app.config.globalProperties.$messageBox = _MessageBox;
  55052. app.config.globalProperties.$alert = _MessageBox.alert;
  55053. app.config.globalProperties.$confirm = _MessageBox.confirm;
  55054. app.config.globalProperties.$prompt = _MessageBox.prompt;
  55055. };
  55056. const ElMessageBox = _MessageBox;
  55057. //#endregion
  55058. //#region ../../packages/components/notification/src/notification.ts
  55059. const notificationTypes = [
  55060. "primary",
  55061. "success",
  55062. "info",
  55063. "warning",
  55064. "error"
  55065. ];
  55066. const notificationProps = buildProps({
  55067. customClass: {
  55068. type: String,
  55069. default: ""
  55070. },
  55071. dangerouslyUseHTMLString: Boolean,
  55072. duration: {
  55073. type: Number,
  55074. default: 4500
  55075. },
  55076. icon: { type: iconPropType },
  55077. id: {
  55078. type: String,
  55079. default: ""
  55080. },
  55081. message: {
  55082. type: definePropType([
  55083. String,
  55084. Object,
  55085. Function
  55086. ]),
  55087. default: ""
  55088. },
  55089. offset: {
  55090. type: Number,
  55091. default: 0
  55092. },
  55093. onClick: {
  55094. type: definePropType(Function),
  55095. default: () => void 0
  55096. },
  55097. onClose: {
  55098. type: definePropType(Function),
  55099. required: true
  55100. },
  55101. position: {
  55102. type: String,
  55103. values: [
  55104. "top-right",
  55105. "top-left",
  55106. "bottom-right",
  55107. "bottom-left"
  55108. ],
  55109. default: "top-right"
  55110. },
  55111. showClose: {
  55112. type: Boolean,
  55113. default: true
  55114. },
  55115. title: {
  55116. type: String,
  55117. default: ""
  55118. },
  55119. type: {
  55120. type: String,
  55121. values: [...notificationTypes, ""],
  55122. default: ""
  55123. },
  55124. zIndex: Number,
  55125. closeIcon: {
  55126. type: iconPropType,
  55127. default: close_default
  55128. }
  55129. });
  55130. const notificationEmits = { destroy: () => true };
  55131. //#endregion
  55132. //#region ../../packages/components/notification/src/notification.vue?vue&type=script&setup=true&lang.ts
  55133. const _hoisted_1 = ["id"];
  55134. const _hoisted_2 = ["textContent"];
  55135. const _hoisted_3 = { key: 0 };
  55136. const _hoisted_4 = ["innerHTML"];
  55137. var notification_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
  55138. name: "ElNotification",
  55139. __name: "notification",
  55140. props: notificationProps,
  55141. emits: notificationEmits,
  55142. setup(__props, { expose: __expose }) {
  55143. const props = __props;
  55144. const { ns, zIndex } = useGlobalComponentSettings("notification");
  55145. const { nextZIndex, currentZIndex } = zIndex;
  55146. const visible = ref(false);
  55147. let timer = void 0;
  55148. const typeClass = computed(() => {
  55149. const type = props.type;
  55150. return type && TypeComponentsMap[props.type] ? ns.m(type) : "";
  55151. });
  55152. const iconComponent = computed(() => {
  55153. if (!props.type) return props.icon;
  55154. return TypeComponentsMap[props.type] || props.icon;
  55155. });
  55156. const horizontalClass = computed(() => props.position.endsWith("right") ? "right" : "left");
  55157. const verticalProperty = computed(() => props.position.startsWith("top") ? "top" : "bottom");
  55158. const positionStyle = computed(() => {
  55159. return {
  55160. [verticalProperty.value]: `${props.offset}px`,
  55161. zIndex: props.zIndex ?? currentZIndex.value
  55162. };
  55163. });
  55164. function startTimer() {
  55165. if (props.duration > 0) ({stop: timer} = useTimeoutFn(() => {
  55166. if (visible.value) close();
  55167. }, props.duration));
  55168. }
  55169. function clearTimer() {
  55170. timer?.();
  55171. }
  55172. function close() {
  55173. visible.value = false;
  55174. }
  55175. function onKeydown(event) {
  55176. switch (getEventCode(event)) {
  55177. case EVENT_CODE.delete:
  55178. case EVENT_CODE.backspace:
  55179. clearTimer();
  55180. break;
  55181. case EVENT_CODE.esc:
  55182. if (visible.value) close();
  55183. break;
  55184. default:
  55185. startTimer();
  55186. break;
  55187. }
  55188. }
  55189. onMounted(() => {
  55190. startTimer();
  55191. nextZIndex();
  55192. visible.value = true;
  55193. });
  55194. useEventListener(document, "keydown", onKeydown);
  55195. __expose({
  55196. visible,
  55197. close
  55198. });
  55199. return (_ctx, _cache) => {
  55200. return openBlock(), createBlock(Transition, {
  55201. name: unref(ns).b("fade"),
  55202. onBeforeLeave: __props.onClose,
  55203. onAfterLeave: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("destroy")),
  55204. persisted: ""
  55205. }, {
  55206. default: withCtx(() => [withDirectives(createElementVNode("div", {
  55207. id: __props.id,
  55208. class: normalizeClass([
  55209. unref(ns).b(),
  55210. __props.customClass,
  55211. horizontalClass.value
  55212. ]),
  55213. style: normalizeStyle(positionStyle.value),
  55214. role: "alert",
  55215. onMouseenter: clearTimer,
  55216. onMouseleave: startTimer,
  55217. onClick: _cache[0] || (_cache[0] = (...args) => __props.onClick && __props.onClick(...args))
  55218. }, [iconComponent.value ? (openBlock(), createBlock(unref(ElIcon), {
  55219. key: 0,
  55220. class: normalizeClass([unref(ns).e("icon"), typeClass.value])
  55221. }, {
  55222. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(iconComponent.value)))]),
  55223. _: 1
  55224. }, 8, ["class"])) : createCommentVNode("v-if", true), createElementVNode("div", { class: normalizeClass(unref(ns).e("group")) }, [
  55225. createElementVNode("h2", {
  55226. class: normalizeClass(unref(ns).e("title")),
  55227. textContent: toDisplayString(__props.title)
  55228. }, null, 10, _hoisted_2),
  55229. withDirectives(createElementVNode("div", {
  55230. class: normalizeClass(unref(ns).e("content")),
  55231. style: normalizeStyle(!!__props.title ? void 0 : { margin: 0 })
  55232. }, [renderSlot(_ctx.$slots, "default", {}, () => [!__props.dangerouslyUseHTMLString ? (openBlock(), createElementBlock("p", _hoisted_3, toDisplayString(__props.message), 1)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createCommentVNode(" Caution here, message could've been compromised, never use user's input as message "), createElementVNode("p", { innerHTML: __props.message }, null, 8, _hoisted_4)], 2112))])], 6), [[vShow, __props.message]]),
  55233. __props.showClose ? (openBlock(), createBlock(unref(ElIcon), {
  55234. key: 0,
  55235. class: normalizeClass(unref(ns).e("closeBtn")),
  55236. onClick: withModifiers(close, ["stop"])
  55237. }, {
  55238. default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.closeIcon)))]),
  55239. _: 1
  55240. }, 8, ["class"])) : createCommentVNode("v-if", true)
  55241. ], 2)], 46, _hoisted_1), [[vShow, visible.value]])]),
  55242. _: 3
  55243. }, 8, ["name", "onBeforeLeave"]);
  55244. };
  55245. }
  55246. });
  55247. //#endregion
  55248. //#region ../../packages/components/notification/src/notification.vue
  55249. var notification_default = notification_vue_vue_type_script_setup_true_lang_default;
  55250. //#endregion
  55251. //#region ../../packages/components/notification/src/notify.ts
  55252. const notifications = {
  55253. "top-left": [],
  55254. "top-right": [],
  55255. "bottom-left": [],
  55256. "bottom-right": []
  55257. };
  55258. const GAP_SIZE = 16;
  55259. let seed = 1;
  55260. const notify = function(options = {}, context) {
  55261. if (!isClient) return { close: () => void 0 };
  55262. if (isString(options) || isVNode(options)) options = { message: options };
  55263. const position = options.position || "top-right";
  55264. let verticalOffset = options.offset || 0;
  55265. notifications[position].forEach(({ vm }) => {
  55266. verticalOffset += (vm.el?.offsetHeight || 0) + GAP_SIZE;
  55267. });
  55268. verticalOffset += GAP_SIZE;
  55269. const id = `notification_${seed++}`;
  55270. const userOnClose = options.onClose;
  55271. const props = {
  55272. ...options,
  55273. offset: verticalOffset,
  55274. id,
  55275. onClose: () => {
  55276. close(id, position, userOnClose);
  55277. }
  55278. };
  55279. let appendTo = document.body;
  55280. if (isElement$1(options.appendTo)) appendTo = options.appendTo;
  55281. else if (isString(options.appendTo)) appendTo = document.querySelector(options.appendTo);
  55282. if (!isElement$1(appendTo)) {
  55283. /* @__PURE__ */ debugWarn("ElNotification", "the appendTo option is not an HTMLElement. Falling back to document.body.");
  55284. appendTo = document.body;
  55285. }
  55286. const container = document.createElement("div");
  55287. const vm = createVNode(notification_default, props, isFunction$1(props.message) ? props.message : isVNode(props.message) ? () => props.message : null);
  55288. vm.appContext = isUndefined(context) ? notify._context : context;
  55289. vm.props.onDestroy = () => {
  55290. render(null, container);
  55291. };
  55292. render(vm, container);
  55293. notifications[position].push({ vm });
  55294. appendTo.appendChild(container.firstElementChild);
  55295. return { close: () => {
  55296. vm.component.exposed.visible.value = false;
  55297. } };
  55298. };
  55299. notificationTypes.forEach((type) => {
  55300. notify[type] = (options = {}, appContext) => {
  55301. if (isString(options) || isVNode(options)) options = { message: options };
  55302. return notify({
  55303. ...options,
  55304. type
  55305. }, appContext);
  55306. };
  55307. });
  55308. function close(id, position, userOnClose) {
  55309. const orientedNotifications = notifications[position];
  55310. const idx = orientedNotifications.findIndex(({ vm }) => vm.component?.props.id === id);
  55311. if (idx === -1) return;
  55312. const { vm } = orientedNotifications[idx];
  55313. if (!vm) return;
  55314. userOnClose?.(vm);
  55315. const removedHeight = vm.el.offsetHeight;
  55316. const verticalPos = position.split("-")[0];
  55317. orientedNotifications.splice(idx, 1);
  55318. const len = orientedNotifications.length;
  55319. if (len < 1) return;
  55320. for (let i = idx; i < len; i++) {
  55321. const { el, component } = orientedNotifications[i].vm;
  55322. const pos = Number.parseInt(el.style[verticalPos], 10) - removedHeight - GAP_SIZE;
  55323. component.props.offset = pos;
  55324. }
  55325. }
  55326. function closeAll() {
  55327. for (const orientedNotifications of Object.values(notifications)) orientedNotifications.forEach(({ vm }) => {
  55328. vm.component.exposed.visible.value = false;
  55329. });
  55330. }
  55331. function updateOffsets(position = "top-right") {
  55332. let verticalOffset = notifications[position][0]?.vm.component?.props?.offset || 0;
  55333. for (const { vm } of notifications[position]) {
  55334. vm.component.props.offset = verticalOffset;
  55335. verticalOffset += (vm.el?.offsetHeight || 0) + GAP_SIZE;
  55336. }
  55337. }
  55338. notify.closeAll = closeAll;
  55339. notify.updateOffsets = updateOffsets;
  55340. notify._context = null;
  55341. //#endregion
  55342. //#region ../../packages/components/notification/index.ts
  55343. const ElNotification = withInstallFunction(notify, "$notify");
  55344. //#endregion
  55345. //#region ../../packages/element-plus/plugin.ts
  55346. var plugin_default = [
  55347. ElInfiniteScroll,
  55348. ElLoading,
  55349. ElMessage,
  55350. ElMessageBox,
  55351. ElNotification,
  55352. ElPopoverDirective
  55353. ];
  55354. //#endregion
  55355. //#region ../../packages/element-plus/defaults.ts
  55356. var defaults_default = makeInstaller([...component_default, ...plugin_default]);
  55357. //#endregion
  55358. //#region ../../packages/element-plus/index.ts
  55359. const install = defaults_default.install;
  55360. const version = defaults_default.version;
  55361. var element_plus_default = defaults_default;
  55362. //#endregion
  55363. var dayjs = import_dayjs_min.default;
  55364. export { BAR_MAP, BORDER_HORIZONTAL_WIDTH, CAROUSEL_ITEM_NAME, CASCADER_PANEL_HEIGHT, CASCADER_PANEL_INJECTION_KEY, CASCADER_PANEL_ITEM_SIZE, CHANGE_EVENT, ClickOutside, picker_default as CommonPicker, CommonProps, DEFAULT_DIALOG_TRANSITION, DEFAULT_EMPTY_VALUES, DEFAULT_END, DEFAULT_FORMATS_DATE, DEFAULT_FORMATS_DATEPICKER, DEFAULT_FORMATS_TIME, DEFAULT_START, DEFAULT_STEP, DEFAULT_VALUE_ON_CLEAR, DROPDOWN_INJECTION_KEY, DROPDOWN_INSTANCE_INJECTION_KEY, DefaultProps, DynamicSizeGrid, DynamicSizeList, EVENT_CODE, Effect, ElAffix, ElAlert, ElAnchor, ElAnchorLink, ElAside, ElAutoResizer, ElAutocomplete, ElAvatar, ElAvatarGroup, ElBacktop, ElBadge, ElBreadcrumb, ElBreadcrumbItem, ElButton, ElButtonGroup, ElCalendar, ElCard, ElCarousel, ElCarouselItem, ElCascader, ElCascaderPanel, ElCheckTag, ElCheckbox, ElCheckboxButton, ElCheckboxGroup, ElCol, ElCollapse, ElCollapseItem, ElCollapseTransition, ElColorPicker, ElColorPickerPanel, ElConfigProvider, ElContainer, ElCountdown, ElDatePicker, ElDatePickerPanel, ElDescriptions, ElDescriptionsItem, ElDialog, ElDivider, ElDrawer, ElDropdown, ElDropdownItem, ElDropdownMenu, ElEmpty, ElFooter, ElForm, ElFormItem, ElHeader, ElIcon, ElImage, ElImageViewer, ElInfiniteScroll, ElInput, ElInputNumber, ElInputOtp, ElInputTag, ElLink, ElLoading, vLoading as ElLoadingDirective, vLoading, Loading as ElLoadingService, ElMain, ElMention, ElMenu, ElMenuItem, ElMenuItemGroup, ElMessage, ElMessageBox, ElNotification, ElOption, ElOptionGroup, ElOverlay, ElPageHeader, ElPagination, ElPopconfirm, ElPopover, ElPopoverDirective, ElPopper, arrow_default as ElPopperArrow, content_default as ElPopperContent, trigger_default as ElPopperTrigger, ElProgress, ElRadio, ElRadioButton, ElRadioGroup, ElRate, ElResult, ElRow, ElScrollbar, ElSegmented, ElSelect, ElSelectV2, ElSkeleton, ElSkeletonItem, ElSlider, ElSpace, ElSplitter, ElSplitterPanel, ElStatistic, ElStep, ElSteps, ElSubMenu, ElSwitch, ElTabPane, ElTable, ElTableColumn, ElTableV2, ElTabs, ElTag, ElText, ElTimePicker, ElTimeSelect, ElTimeline, ElTimelineItem, ElTooltip, ElTour, ElTourStep, ElTransfer, ElTree, ElTreeSelect, ElTreeV2, ElUpload, ElWatermark, FIRST_KEYS, FIRST_LAST_KEYS, FORWARD_REF_INJECTION_KEY, FixedSizeGrid, FixedSizeList, GAP, ID_INJECTION_KEY, INPUT_EVENT, INSTALLED_KEY, IconComponentMap, IconMap, LAST_KEYS, LEFT_CHECK_CHANGE_EVENT, MENU_INJECTION_KEY, MESSAGE_DEFAULT_PLACEMENT, MINIMUM_INPUT_WIDTH, Mousewheel, NODE_INSTANCE_INJECTION_KEY, PICKER_BASE_INJECTION_KEY, PICKER_POPPER_OPTIONS_INJECTION_KEY, POPPER_CONTENT_INJECTION_KEY, POPPER_INJECTION_KEY, RIGHT_CHECK_CHANGE_EVENT, ROOT_COMMON_COLOR_INJECTION_KEY, ROOT_COMMON_PICKER_INJECTION_KEY, ROOT_PICKER_INJECTION_KEY, ROOT_PICKER_IS_DEFAULT_FORMAT_INJECTION_KEY, ROOT_TREE_INJECTION_KEY, RowAlign, RowJustify, SCOPE, SIZE_INJECTION_KEY, STEPS_INJECTION_KEY, SUB_MENU_INJECTION_KEY, TIMELINE_INJECTION_KEY, TOOLTIP_INJECTION_KEY, TREE_NODE_MAP_INJECTION_KEY, TableV2, Alignment as TableV2Alignment, FixedDir as TableV2FixedDir, placeholderSign as TableV2Placeholder, SortOrder as TableV2SortOrder, panel_time_pick_default as TimePickPanel, TrapFocus, UPDATE_MODEL_EVENT, WEEK_DAYS, ZINDEX_INJECTION_KEY, affixEmits, affixProps, alertEffects, alertEmits, alertProps, anchorEmits, anchorProps, ariaProps, arrowMiddleware, autoResizerProps, autocompleteEmits, autocompleteProps, avatarEmits, avatarGroupContextKey, avatarGroupProps, avatarProps, backtopEmits, backtopProps, badgeProps, breadcrumbItemProps, breadcrumbKey, breadcrumbProps, buildLocaleContext, buildTimeList, buildTranslator, buttonEmits, buttonGroupContextKey, buttonNativeTypes, buttonProps, buttonTypes, calendarEmits, calendarProps, cardContextKey, cardProps, carouselContextKey, carouselEmits, carouselItemProps, carouselProps, cascaderEmits, cascaderPanelEmits, cascaderPanelProps, cascaderProps, checkTagEmits, checkTagProps, checkboxDefaultProps, checkboxEmits, checkboxGroupContextKey, checkboxGroupEmits, checkboxGroupProps, checkboxProps, checkboxPropsDefaults, colProps, collapseContextKey, collapseEmits, collapseItemProps, collapseProps, colorPickerEmits, colorPickerPanelContextKey, colorPickerPanelEmits, colorPickerPanelProps, colorPickerProps, colorPickerPropsDefaults, columnAlignment, componentSizeMap, componentSizes, configProviderContextKey, configProviderProps, countdownEmits, countdownProps, createModelToggleComposable, dateEquals, datePickTypes, datePickerPanelProps, datePickerProps, dayOrDaysToDate, dayjs, element_plus_default as default, defaultInitialZIndex, defaultNamespace, defaultProps, descriptionItemProps, descriptionProps, dialogContextKey, dialogEmits, dialogInjectionKey, dialogProps, dialogPropsDefaults, dividerProps, drawerEmits, drawerProps, dropdownItemProps, dropdownMenuProps, dropdownProps, elPaginationKey, emitChangeFn, emptyProps, emptyValuesContextKey, extractDateFormat, extractTimeFormat, formContextKey, formEmits, formItemContextKey, formItemProps, formItemValidateStates, formMetaProps, formProps, formatter, genFileId, getPositionDataWithUnit, iconProps, imageEmits, imageProps, imageViewerEmits, imageViewerProps, inputEmits, inputNumberEmits, inputNumberProps, inputOtpEmits, inputProps, inputPropsDefaults, inputTagEmits, inputTagProps, install, linkEmits, linkProps, localeContextKey, makeInstaller, makeList, mentionDefaultProps, mentionEmits, mentionProps, menuEmits, menuItemEmits, menuItemGroupProps, menuItemProps, menuProps, messageConfig, messageDefaults, messageEmits, messagePlacement, messageProps, messageTypes, namespaceContextKey, notificationEmits, notificationProps, notificationTypes, overlayEmits, overlayProps, pageHeaderEmits, pageHeaderProps, paginationEmits, paginationProps, parseDate, popconfirmEmits, popconfirmProps, popoverEmits, popoverProps, popoverPropsDefaults, popperArrowProps, popperArrowPropsDefaults, popperContentEmits, popperContentProps, popperContentPropsDefaults, popperCoreConfigProps, popperCoreConfigPropsDefaults, popperProps, popperTriggerProps, progressProps, provideGlobalConfig, radioButtonProps, radioButtonPropsDefaults, radioDefaultProps, radioEmits, radioGroupEmits, radioGroupKey, radioGroupProps, radioGroupPropsDefaults, radioProps, radioPropsBase, radioPropsDefaults, rangeArr, rateEmits, rateProps, renderThumbStyle, resultProps, roleTypes, rowContextKey, rowProps, scrollbarContextKey, scrollbarEmits, scrollbarProps, segmentedEmits, segmentedProps, selectEmits, selectGroupKey, selectKey, selectProps, selectV2InjectionKey, skeletonItemProps, skeletonProps, sliderContextKey, sliderEmits, sliderProps, spaceItemProps, spaceProps, splitterEmits, splitterPanelEmits, splitterPanelProps, splitterProps, statisticProps, stepProps, stepsEmits, stepsProps, subMenuProps, switchEmits, switchProps, tabBarProps, tabNavEmits, tabNavProps, tabPaneProps, tableV2Props, tableV2RowProps, tabsEmits, tabsProps, tabsRootContextKey, tagEmits, tagProps, textProps, thumbProps, timePickerDefaultProps, timePickerRangeTriggerProps, timePickerRngeTriggerProps, timeSelectProps, timeUnits, timelineItemProps, timelineProps, tooltipEmits, tourContentEmits, tourContentProps, tourEmits, tourPlacements, tourProps, tourStepEmits, tourStepProps, tourStrategies, transferCheckedChangeFn, transferEmits, transferProps, translate, treeEmits, treeProps, uploadBaseProps, uploadBasePropsDefaults, uploadContentProps, uploadContentPropsDefaults, uploadContextKey, uploadDraggerEmits, uploadDraggerProps, uploadListEmits, uploadListProps, uploadListTypes, uploadProps, uploadPropsDefaults, useAriaProps, useAttrs, useCalcInputWidth, useCascaderConfig, useComposition, useCursor, useDelayedRender, useDelayedToggle, useDelayedToggleProps, useDelayedTogglePropsDefaults, useDeprecated, useDialog, useDisabled, useDraggable, useEmptyValues, useEmptyValuesProps, useEscapeKeydown, useFloating, useFloatingProps, useFocus, useFocusController, useFormDisabled, useFormItem, useFormItemInputId, useFormSize, useForwardRef, useForwardRefDirective, useGetDerivedNamespace, useGlobalComponentSettings, useGlobalConfig, useGlobalSize, useId, useIdInjection, useLocale, useLockscreen, useModal, useModelToggle, useModelToggleEmits, useModelToggleProps, useNamespace, useOrderedChildren, usePopper, usePopperArrowProps, usePopperContainer, usePopperContainerId, usePopperContentEmits, usePopperContentProps, usePopperCoreConfigProps, usePopperProps, usePopperTriggerProps, usePreventGlobal, useProp, useSameTarget, useSize, useSizeProp, useSizeProps, useSpace, useTeleport, useThrottleRender, useTimeout, useTooltipContentProps, useTooltipContentPropsDefaults, useTooltipModelToggle, useTooltipModelToggleEmits, useTooltipModelToggleProps, useTooltipProps, useTooltipTriggerProps, useTooltipTriggerPropsDefaults, useTransitionFallthrough, useTransitionFallthroughEmits, useZIndex, vRepeatClick, valueEquals, version, virtualizedGridProps, virtualizedListProps, virtualizedProps, virtualizedScrollbarProps, watermarkProps, zIndexContextKey };