דברים שרואים מכאן לא רואים בכלל
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

bootstrap.bundle.js 203KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312
  1. /*!
  2. * Bootstrap v5.3.8 (https://getbootstrap.com/)
  3. * Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5. */
  6. (function (global, factory) {
  7. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  8. typeof define === 'function' && define.amd ? define(factory) :
  9. (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory());
  10. })(this, (function () { 'use strict';
  11. /**
  12. * --------------------------------------------------------------------------
  13. * Bootstrap dom/data.js
  14. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  15. * --------------------------------------------------------------------------
  16. */
  17. /**
  18. * Constants
  19. */
  20. const elementMap = new Map();
  21. const Data = {
  22. set(element, key, instance) {
  23. if (!elementMap.has(element)) {
  24. elementMap.set(element, new Map());
  25. }
  26. const instanceMap = elementMap.get(element);
  27. // make it clear we only want one instance per element
  28. // can be removed later when multiple key/instances are fine to be used
  29. if (!instanceMap.has(key) && instanceMap.size !== 0) {
  30. // eslint-disable-next-line no-console
  31. console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
  32. return;
  33. }
  34. instanceMap.set(key, instance);
  35. },
  36. get(element, key) {
  37. if (elementMap.has(element)) {
  38. return elementMap.get(element).get(key) || null;
  39. }
  40. return null;
  41. },
  42. remove(element, key) {
  43. if (!elementMap.has(element)) {
  44. return;
  45. }
  46. const instanceMap = elementMap.get(element);
  47. instanceMap.delete(key);
  48. // free up element references if there are no instances left for an element
  49. if (instanceMap.size === 0) {
  50. elementMap.delete(element);
  51. }
  52. }
  53. };
  54. /**
  55. * --------------------------------------------------------------------------
  56. * Bootstrap util/index.js
  57. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  58. * --------------------------------------------------------------------------
  59. */
  60. const MAX_UID = 1000000;
  61. const MILLISECONDS_MULTIPLIER = 1000;
  62. const TRANSITION_END = 'transitionend';
  63. /**
  64. * Properly escape IDs selectors to handle weird IDs
  65. * @param {string} selector
  66. * @returns {string}
  67. */
  68. const parseSelector = selector => {
  69. if (selector && window.CSS && window.CSS.escape) {
  70. // document.querySelector needs escaping to handle IDs (html5+) containing for instance /
  71. selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`);
  72. }
  73. return selector;
  74. };
  75. // Shout-out Angus Croll (https://goo.gl/pxwQGp)
  76. const toType = object => {
  77. if (object === null || object === undefined) {
  78. return `${object}`;
  79. }
  80. return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
  81. };
  82. /**
  83. * Public Util API
  84. */
  85. const getUID = prefix => {
  86. do {
  87. prefix += Math.floor(Math.random() * MAX_UID);
  88. } while (document.getElementById(prefix));
  89. return prefix;
  90. };
  91. const getTransitionDurationFromElement = element => {
  92. if (!element) {
  93. return 0;
  94. }
  95. // Get transition-duration of the element
  96. let {
  97. transitionDuration,
  98. transitionDelay
  99. } = window.getComputedStyle(element);
  100. const floatTransitionDuration = Number.parseFloat(transitionDuration);
  101. const floatTransitionDelay = Number.parseFloat(transitionDelay);
  102. // Return 0 if element or transition duration is not found
  103. if (!floatTransitionDuration && !floatTransitionDelay) {
  104. return 0;
  105. }
  106. // If multiple durations are defined, take the first
  107. transitionDuration = transitionDuration.split(',')[0];
  108. transitionDelay = transitionDelay.split(',')[0];
  109. return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  110. };
  111. const triggerTransitionEnd = element => {
  112. element.dispatchEvent(new Event(TRANSITION_END));
  113. };
  114. const isElement$1 = object => {
  115. if (!object || typeof object !== 'object') {
  116. return false;
  117. }
  118. if (typeof object.jquery !== 'undefined') {
  119. object = object[0];
  120. }
  121. return typeof object.nodeType !== 'undefined';
  122. };
  123. const getElement = object => {
  124. // it's a jQuery object or a node element
  125. if (isElement$1(object)) {
  126. return object.jquery ? object[0] : object;
  127. }
  128. if (typeof object === 'string' && object.length > 0) {
  129. return document.querySelector(parseSelector(object));
  130. }
  131. return null;
  132. };
  133. const isVisible = element => {
  134. if (!isElement$1(element) || element.getClientRects().length === 0) {
  135. return false;
  136. }
  137. const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible';
  138. // Handle `details` element as its content may falsie appear visible when it is closed
  139. const closedDetails = element.closest('details:not([open])');
  140. if (!closedDetails) {
  141. return elementIsVisible;
  142. }
  143. if (closedDetails !== element) {
  144. const summary = element.closest('summary');
  145. if (summary && summary.parentNode !== closedDetails) {
  146. return false;
  147. }
  148. if (summary === null) {
  149. return false;
  150. }
  151. }
  152. return elementIsVisible;
  153. };
  154. const isDisabled = element => {
  155. if (!element || element.nodeType !== Node.ELEMENT_NODE) {
  156. return true;
  157. }
  158. if (element.classList.contains('disabled')) {
  159. return true;
  160. }
  161. if (typeof element.disabled !== 'undefined') {
  162. return element.disabled;
  163. }
  164. return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
  165. };
  166. const findShadowRoot = element => {
  167. if (!document.documentElement.attachShadow) {
  168. return null;
  169. }
  170. // Can find the shadow root otherwise it'll return the document
  171. if (typeof element.getRootNode === 'function') {
  172. const root = element.getRootNode();
  173. return root instanceof ShadowRoot ? root : null;
  174. }
  175. if (element instanceof ShadowRoot) {
  176. return element;
  177. }
  178. // when we don't find a shadow root
  179. if (!element.parentNode) {
  180. return null;
  181. }
  182. return findShadowRoot(element.parentNode);
  183. };
  184. const noop = () => {};
  185. /**
  186. * Trick to restart an element's animation
  187. *
  188. * @param {HTMLElement} element
  189. * @return void
  190. *
  191. * @see https://www.harrytheo.com/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation
  192. */
  193. const reflow = element => {
  194. element.offsetHeight; // eslint-disable-line no-unused-expressions
  195. };
  196. const getjQuery = () => {
  197. if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
  198. return window.jQuery;
  199. }
  200. return null;
  201. };
  202. const DOMContentLoadedCallbacks = [];
  203. const onDOMContentLoaded = callback => {
  204. if (document.readyState === 'loading') {
  205. // add listener on the first call when the document is in loading state
  206. if (!DOMContentLoadedCallbacks.length) {
  207. document.addEventListener('DOMContentLoaded', () => {
  208. for (const callback of DOMContentLoadedCallbacks) {
  209. callback();
  210. }
  211. });
  212. }
  213. DOMContentLoadedCallbacks.push(callback);
  214. } else {
  215. callback();
  216. }
  217. };
  218. const isRTL = () => document.documentElement.dir === 'rtl';
  219. const defineJQueryPlugin = plugin => {
  220. onDOMContentLoaded(() => {
  221. const $ = getjQuery();
  222. /* istanbul ignore if */
  223. if ($) {
  224. const name = plugin.NAME;
  225. const JQUERY_NO_CONFLICT = $.fn[name];
  226. $.fn[name] = plugin.jQueryInterface;
  227. $.fn[name].Constructor = plugin;
  228. $.fn[name].noConflict = () => {
  229. $.fn[name] = JQUERY_NO_CONFLICT;
  230. return plugin.jQueryInterface;
  231. };
  232. }
  233. });
  234. };
  235. const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
  236. return typeof possibleCallback === 'function' ? possibleCallback.call(...args) : defaultValue;
  237. };
  238. const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
  239. if (!waitForTransition) {
  240. execute(callback);
  241. return;
  242. }
  243. const durationPadding = 5;
  244. const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
  245. let called = false;
  246. const handler = ({
  247. target
  248. }) => {
  249. if (target !== transitionElement) {
  250. return;
  251. }
  252. called = true;
  253. transitionElement.removeEventListener(TRANSITION_END, handler);
  254. execute(callback);
  255. };
  256. transitionElement.addEventListener(TRANSITION_END, handler);
  257. setTimeout(() => {
  258. if (!called) {
  259. triggerTransitionEnd(transitionElement);
  260. }
  261. }, emulatedDuration);
  262. };
  263. /**
  264. * Return the previous/next element of a list.
  265. *
  266. * @param {array} list The list of elements
  267. * @param activeElement The active element
  268. * @param shouldGetNext Choose to get next or previous element
  269. * @param isCycleAllowed
  270. * @return {Element|elem} The proper element
  271. */
  272. const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
  273. const listLength = list.length;
  274. let index = list.indexOf(activeElement);
  275. // if the element does not exist in the list return an element
  276. // depending on the direction and if cycle is allowed
  277. if (index === -1) {
  278. return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
  279. }
  280. index += shouldGetNext ? 1 : -1;
  281. if (isCycleAllowed) {
  282. index = (index + listLength) % listLength;
  283. }
  284. return list[Math.max(0, Math.min(index, listLength - 1))];
  285. };
  286. /**
  287. * --------------------------------------------------------------------------
  288. * Bootstrap dom/event-handler.js
  289. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  290. * --------------------------------------------------------------------------
  291. */
  292. /**
  293. * Constants
  294. */
  295. const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
  296. const stripNameRegex = /\..*/;
  297. const stripUidRegex = /::\d+$/;
  298. const eventRegistry = {}; // Events storage
  299. let uidEvent = 1;
  300. const customEvents = {
  301. mouseenter: 'mouseover',
  302. mouseleave: 'mouseout'
  303. };
  304. const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']);
  305. /**
  306. * Private methods
  307. */
  308. function makeEventUid(element, uid) {
  309. return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
  310. }
  311. function getElementEvents(element) {
  312. const uid = makeEventUid(element);
  313. element.uidEvent = uid;
  314. eventRegistry[uid] = eventRegistry[uid] || {};
  315. return eventRegistry[uid];
  316. }
  317. function bootstrapHandler(element, fn) {
  318. return function handler(event) {
  319. hydrateObj(event, {
  320. delegateTarget: element
  321. });
  322. if (handler.oneOff) {
  323. EventHandler.off(element, event.type, fn);
  324. }
  325. return fn.apply(element, [event]);
  326. };
  327. }
  328. function bootstrapDelegationHandler(element, selector, fn) {
  329. return function handler(event) {
  330. const domElements = element.querySelectorAll(selector);
  331. for (let {
  332. target
  333. } = event; target && target !== this; target = target.parentNode) {
  334. for (const domElement of domElements) {
  335. if (domElement !== target) {
  336. continue;
  337. }
  338. hydrateObj(event, {
  339. delegateTarget: target
  340. });
  341. if (handler.oneOff) {
  342. EventHandler.off(element, event.type, selector, fn);
  343. }
  344. return fn.apply(target, [event]);
  345. }
  346. }
  347. };
  348. }
  349. function findHandler(events, callable, delegationSelector = null) {
  350. return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector);
  351. }
  352. function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
  353. const isDelegated = typeof handler === 'string';
  354. // TODO: tooltip passes `false` instead of selector, so we need to check
  355. const callable = isDelegated ? delegationFunction : handler || delegationFunction;
  356. let typeEvent = getTypeEvent(originalTypeEvent);
  357. if (!nativeEvents.has(typeEvent)) {
  358. typeEvent = originalTypeEvent;
  359. }
  360. return [isDelegated, callable, typeEvent];
  361. }
  362. function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
  363. if (typeof originalTypeEvent !== 'string' || !element) {
  364. return;
  365. }
  366. let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
  367. // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
  368. // this prevents the handler from being dispatched the same way as mouseover or mouseout does
  369. if (originalTypeEvent in customEvents) {
  370. const wrapFunction = fn => {
  371. return function (event) {
  372. if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
  373. return fn.call(this, event);
  374. }
  375. };
  376. };
  377. callable = wrapFunction(callable);
  378. }
  379. const events = getElementEvents(element);
  380. const handlers = events[typeEvent] || (events[typeEvent] = {});
  381. const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
  382. if (previousFunction) {
  383. previousFunction.oneOff = previousFunction.oneOff && oneOff;
  384. return;
  385. }
  386. const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ''));
  387. const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable);
  388. fn.delegationSelector = isDelegated ? handler : null;
  389. fn.callable = callable;
  390. fn.oneOff = oneOff;
  391. fn.uidEvent = uid;
  392. handlers[uid] = fn;
  393. element.addEventListener(typeEvent, fn, isDelegated);
  394. }
  395. function removeHandler(element, events, typeEvent, handler, delegationSelector) {
  396. const fn = findHandler(events[typeEvent], handler, delegationSelector);
  397. if (!fn) {
  398. return;
  399. }
  400. element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
  401. delete events[typeEvent][fn.uidEvent];
  402. }
  403. function removeNamespacedHandlers(element, events, typeEvent, namespace) {
  404. const storeElementEvent = events[typeEvent] || {};
  405. for (const [handlerKey, event] of Object.entries(storeElementEvent)) {
  406. if (handlerKey.includes(namespace)) {
  407. removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
  408. }
  409. }
  410. }
  411. function getTypeEvent(event) {
  412. // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
  413. event = event.replace(stripNameRegex, '');
  414. return customEvents[event] || event;
  415. }
  416. const EventHandler = {
  417. on(element, event, handler, delegationFunction) {
  418. addHandler(element, event, handler, delegationFunction, false);
  419. },
  420. one(element, event, handler, delegationFunction) {
  421. addHandler(element, event, handler, delegationFunction, true);
  422. },
  423. off(element, originalTypeEvent, handler, delegationFunction) {
  424. if (typeof originalTypeEvent !== 'string' || !element) {
  425. return;
  426. }
  427. const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
  428. const inNamespace = typeEvent !== originalTypeEvent;
  429. const events = getElementEvents(element);
  430. const storeElementEvent = events[typeEvent] || {};
  431. const isNamespace = originalTypeEvent.startsWith('.');
  432. if (typeof callable !== 'undefined') {
  433. // Simplest case: handler is passed, remove that listener ONLY.
  434. if (!Object.keys(storeElementEvent).length) {
  435. return;
  436. }
  437. removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
  438. return;
  439. }
  440. if (isNamespace) {
  441. for (const elementEvent of Object.keys(events)) {
  442. removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
  443. }
  444. }
  445. for (const [keyHandlers, event] of Object.entries(storeElementEvent)) {
  446. const handlerKey = keyHandlers.replace(stripUidRegex, '');
  447. if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
  448. removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
  449. }
  450. }
  451. },
  452. trigger(element, event, args) {
  453. if (typeof event !== 'string' || !element) {
  454. return null;
  455. }
  456. const $ = getjQuery();
  457. const typeEvent = getTypeEvent(event);
  458. const inNamespace = event !== typeEvent;
  459. let jQueryEvent = null;
  460. let bubbles = true;
  461. let nativeDispatch = true;
  462. let defaultPrevented = false;
  463. if (inNamespace && $) {
  464. jQueryEvent = $.Event(event, args);
  465. $(element).trigger(jQueryEvent);
  466. bubbles = !jQueryEvent.isPropagationStopped();
  467. nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
  468. defaultPrevented = jQueryEvent.isDefaultPrevented();
  469. }
  470. const evt = hydrateObj(new Event(event, {
  471. bubbles,
  472. cancelable: true
  473. }), args);
  474. if (defaultPrevented) {
  475. evt.preventDefault();
  476. }
  477. if (nativeDispatch) {
  478. element.dispatchEvent(evt);
  479. }
  480. if (evt.defaultPrevented && jQueryEvent) {
  481. jQueryEvent.preventDefault();
  482. }
  483. return evt;
  484. }
  485. };
  486. function hydrateObj(obj, meta = {}) {
  487. for (const [key, value] of Object.entries(meta)) {
  488. try {
  489. obj[key] = value;
  490. } catch (_unused) {
  491. Object.defineProperty(obj, key, {
  492. configurable: true,
  493. get() {
  494. return value;
  495. }
  496. });
  497. }
  498. }
  499. return obj;
  500. }
  501. /**
  502. * --------------------------------------------------------------------------
  503. * Bootstrap dom/manipulator.js
  504. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  505. * --------------------------------------------------------------------------
  506. */
  507. function normalizeData(value) {
  508. if (value === 'true') {
  509. return true;
  510. }
  511. if (value === 'false') {
  512. return false;
  513. }
  514. if (value === Number(value).toString()) {
  515. return Number(value);
  516. }
  517. if (value === '' || value === 'null') {
  518. return null;
  519. }
  520. if (typeof value !== 'string') {
  521. return value;
  522. }
  523. try {
  524. return JSON.parse(decodeURIComponent(value));
  525. } catch (_unused) {
  526. return value;
  527. }
  528. }
  529. function normalizeDataKey(key) {
  530. return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`);
  531. }
  532. const Manipulator = {
  533. setDataAttribute(element, key, value) {
  534. element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
  535. },
  536. removeDataAttribute(element, key) {
  537. element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
  538. },
  539. getDataAttributes(element) {
  540. if (!element) {
  541. return {};
  542. }
  543. const attributes = {};
  544. const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig'));
  545. for (const key of bsKeys) {
  546. let pureKey = key.replace(/^bs/, '');
  547. pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1);
  548. attributes[pureKey] = normalizeData(element.dataset[key]);
  549. }
  550. return attributes;
  551. },
  552. getDataAttribute(element, key) {
  553. return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
  554. }
  555. };
  556. /**
  557. * --------------------------------------------------------------------------
  558. * Bootstrap util/config.js
  559. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  560. * --------------------------------------------------------------------------
  561. */
  562. /**
  563. * Class definition
  564. */
  565. class Config {
  566. // Getters
  567. static get Default() {
  568. return {};
  569. }
  570. static get DefaultType() {
  571. return {};
  572. }
  573. static get NAME() {
  574. throw new Error('You have to implement the static method "NAME", for each component!');
  575. }
  576. _getConfig(config) {
  577. config = this._mergeConfigObj(config);
  578. config = this._configAfterMerge(config);
  579. this._typeCheckConfig(config);
  580. return config;
  581. }
  582. _configAfterMerge(config) {
  583. return config;
  584. }
  585. _mergeConfigObj(config, element) {
  586. const jsonConfig = isElement$1(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse
  587. return {
  588. ...this.constructor.Default,
  589. ...(typeof jsonConfig === 'object' ? jsonConfig : {}),
  590. ...(isElement$1(element) ? Manipulator.getDataAttributes(element) : {}),
  591. ...(typeof config === 'object' ? config : {})
  592. };
  593. }
  594. _typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
  595. for (const [property, expectedTypes] of Object.entries(configTypes)) {
  596. const value = config[property];
  597. const valueType = isElement$1(value) ? 'element' : toType(value);
  598. if (!new RegExp(expectedTypes).test(valueType)) {
  599. throw new TypeError(`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
  600. }
  601. }
  602. }
  603. }
  604. /**
  605. * --------------------------------------------------------------------------
  606. * Bootstrap base-component.js
  607. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  608. * --------------------------------------------------------------------------
  609. */
  610. /**
  611. * Constants
  612. */
  613. const VERSION = '5.3.8';
  614. /**
  615. * Class definition
  616. */
  617. class BaseComponent extends Config {
  618. constructor(element, config) {
  619. super();
  620. element = getElement(element);
  621. if (!element) {
  622. return;
  623. }
  624. this._element = element;
  625. this._config = this._getConfig(config);
  626. Data.set(this._element, this.constructor.DATA_KEY, this);
  627. }
  628. // Public
  629. dispose() {
  630. Data.remove(this._element, this.constructor.DATA_KEY);
  631. EventHandler.off(this._element, this.constructor.EVENT_KEY);
  632. for (const propertyName of Object.getOwnPropertyNames(this)) {
  633. this[propertyName] = null;
  634. }
  635. }
  636. // Private
  637. _queueCallback(callback, element, isAnimated = true) {
  638. executeAfterTransition(callback, element, isAnimated);
  639. }
  640. _getConfig(config) {
  641. config = this._mergeConfigObj(config, this._element);
  642. config = this._configAfterMerge(config);
  643. this._typeCheckConfig(config);
  644. return config;
  645. }
  646. // Static
  647. static getInstance(element) {
  648. return Data.get(getElement(element), this.DATA_KEY);
  649. }
  650. static getOrCreateInstance(element, config = {}) {
  651. return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null);
  652. }
  653. static get VERSION() {
  654. return VERSION;
  655. }
  656. static get DATA_KEY() {
  657. return `bs.${this.NAME}`;
  658. }
  659. static get EVENT_KEY() {
  660. return `.${this.DATA_KEY}`;
  661. }
  662. static eventName(name) {
  663. return `${name}${this.EVENT_KEY}`;
  664. }
  665. }
  666. /**
  667. * --------------------------------------------------------------------------
  668. * Bootstrap dom/selector-engine.js
  669. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  670. * --------------------------------------------------------------------------
  671. */
  672. const getSelector = element => {
  673. let selector = element.getAttribute('data-bs-target');
  674. if (!selector || selector === '#') {
  675. let hrefAttribute = element.getAttribute('href');
  676. // The only valid content that could double as a selector are IDs or classes,
  677. // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
  678. // `document.querySelector` will rightfully complain it is invalid.
  679. // See https://github.com/twbs/bootstrap/issues/32273
  680. if (!hrefAttribute || !hrefAttribute.includes('#') && !hrefAttribute.startsWith('.')) {
  681. return null;
  682. }
  683. // Just in case some CMS puts out a full URL with the anchor appended
  684. if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) {
  685. hrefAttribute = `#${hrefAttribute.split('#')[1]}`;
  686. }
  687. selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null;
  688. }
  689. return selector ? selector.split(',').map(sel => parseSelector(sel)).join(',') : null;
  690. };
  691. const SelectorEngine = {
  692. find(selector, element = document.documentElement) {
  693. return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
  694. },
  695. findOne(selector, element = document.documentElement) {
  696. return Element.prototype.querySelector.call(element, selector);
  697. },
  698. children(element, selector) {
  699. return [].concat(...element.children).filter(child => child.matches(selector));
  700. },
  701. parents(element, selector) {
  702. const parents = [];
  703. let ancestor = element.parentNode.closest(selector);
  704. while (ancestor) {
  705. parents.push(ancestor);
  706. ancestor = ancestor.parentNode.closest(selector);
  707. }
  708. return parents;
  709. },
  710. prev(element, selector) {
  711. let previous = element.previousElementSibling;
  712. while (previous) {
  713. if (previous.matches(selector)) {
  714. return [previous];
  715. }
  716. previous = previous.previousElementSibling;
  717. }
  718. return [];
  719. },
  720. // TODO: this is now unused; remove later along with prev()
  721. next(element, selector) {
  722. let next = element.nextElementSibling;
  723. while (next) {
  724. if (next.matches(selector)) {
  725. return [next];
  726. }
  727. next = next.nextElementSibling;
  728. }
  729. return [];
  730. },
  731. focusableChildren(element) {
  732. const focusables = ['a', 'button', 'input', 'textarea', 'select', 'details', '[tabindex]', '[contenteditable="true"]'].map(selector => `${selector}:not([tabindex^="-"])`).join(',');
  733. return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el));
  734. },
  735. getSelectorFromElement(element) {
  736. const selector = getSelector(element);
  737. if (selector) {
  738. return SelectorEngine.findOne(selector) ? selector : null;
  739. }
  740. return null;
  741. },
  742. getElementFromSelector(element) {
  743. const selector = getSelector(element);
  744. return selector ? SelectorEngine.findOne(selector) : null;
  745. },
  746. getMultipleElementsFromSelector(element) {
  747. const selector = getSelector(element);
  748. return selector ? SelectorEngine.find(selector) : [];
  749. }
  750. };
  751. /**
  752. * --------------------------------------------------------------------------
  753. * Bootstrap util/component-functions.js
  754. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  755. * --------------------------------------------------------------------------
  756. */
  757. const enableDismissTrigger = (component, method = 'hide') => {
  758. const clickEvent = `click.dismiss${component.EVENT_KEY}`;
  759. const name = component.NAME;
  760. EventHandler.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function (event) {
  761. if (['A', 'AREA'].includes(this.tagName)) {
  762. event.preventDefault();
  763. }
  764. if (isDisabled(this)) {
  765. return;
  766. }
  767. const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`);
  768. const instance = component.getOrCreateInstance(target);
  769. // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method
  770. instance[method]();
  771. });
  772. };
  773. /**
  774. * --------------------------------------------------------------------------
  775. * Bootstrap alert.js
  776. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  777. * --------------------------------------------------------------------------
  778. */
  779. /**
  780. * Constants
  781. */
  782. const NAME$f = 'alert';
  783. const DATA_KEY$a = 'bs.alert';
  784. const EVENT_KEY$b = `.${DATA_KEY$a}`;
  785. const EVENT_CLOSE = `close${EVENT_KEY$b}`;
  786. const EVENT_CLOSED = `closed${EVENT_KEY$b}`;
  787. const CLASS_NAME_FADE$5 = 'fade';
  788. const CLASS_NAME_SHOW$8 = 'show';
  789. /**
  790. * Class definition
  791. */
  792. class Alert extends BaseComponent {
  793. // Getters
  794. static get NAME() {
  795. return NAME$f;
  796. }
  797. // Public
  798. close() {
  799. const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE);
  800. if (closeEvent.defaultPrevented) {
  801. return;
  802. }
  803. this._element.classList.remove(CLASS_NAME_SHOW$8);
  804. const isAnimated = this._element.classList.contains(CLASS_NAME_FADE$5);
  805. this._queueCallback(() => this._destroyElement(), this._element, isAnimated);
  806. }
  807. // Private
  808. _destroyElement() {
  809. this._element.remove();
  810. EventHandler.trigger(this._element, EVENT_CLOSED);
  811. this.dispose();
  812. }
  813. // Static
  814. static jQueryInterface(config) {
  815. return this.each(function () {
  816. const data = Alert.getOrCreateInstance(this);
  817. if (typeof config !== 'string') {
  818. return;
  819. }
  820. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  821. throw new TypeError(`No method named "${config}"`);
  822. }
  823. data[config](this);
  824. });
  825. }
  826. }
  827. /**
  828. * Data API implementation
  829. */
  830. enableDismissTrigger(Alert, 'close');
  831. /**
  832. * jQuery
  833. */
  834. defineJQueryPlugin(Alert);
  835. /**
  836. * --------------------------------------------------------------------------
  837. * Bootstrap button.js
  838. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  839. * --------------------------------------------------------------------------
  840. */
  841. /**
  842. * Constants
  843. */
  844. const NAME$e = 'button';
  845. const DATA_KEY$9 = 'bs.button';
  846. const EVENT_KEY$a = `.${DATA_KEY$9}`;
  847. const DATA_API_KEY$6 = '.data-api';
  848. const CLASS_NAME_ACTIVE$3 = 'active';
  849. const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
  850. const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$6}`;
  851. /**
  852. * Class definition
  853. */
  854. class Button extends BaseComponent {
  855. // Getters
  856. static get NAME() {
  857. return NAME$e;
  858. }
  859. // Public
  860. toggle() {
  861. // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method
  862. this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3));
  863. }
  864. // Static
  865. static jQueryInterface(config) {
  866. return this.each(function () {
  867. const data = Button.getOrCreateInstance(this);
  868. if (config === 'toggle') {
  869. data[config]();
  870. }
  871. });
  872. }
  873. }
  874. /**
  875. * Data API implementation
  876. */
  877. EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => {
  878. event.preventDefault();
  879. const button = event.target.closest(SELECTOR_DATA_TOGGLE$5);
  880. const data = Button.getOrCreateInstance(button);
  881. data.toggle();
  882. });
  883. /**
  884. * jQuery
  885. */
  886. defineJQueryPlugin(Button);
  887. /**
  888. * --------------------------------------------------------------------------
  889. * Bootstrap util/swipe.js
  890. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  891. * --------------------------------------------------------------------------
  892. */
  893. /**
  894. * Constants
  895. */
  896. const NAME$d = 'swipe';
  897. const EVENT_KEY$9 = '.bs.swipe';
  898. const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
  899. const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
  900. const EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
  901. const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
  902. const EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
  903. const POINTER_TYPE_TOUCH = 'touch';
  904. const POINTER_TYPE_PEN = 'pen';
  905. const CLASS_NAME_POINTER_EVENT = 'pointer-event';
  906. const SWIPE_THRESHOLD = 40;
  907. const Default$c = {
  908. endCallback: null,
  909. leftCallback: null,
  910. rightCallback: null
  911. };
  912. const DefaultType$c = {
  913. endCallback: '(function|null)',
  914. leftCallback: '(function|null)',
  915. rightCallback: '(function|null)'
  916. };
  917. /**
  918. * Class definition
  919. */
  920. class Swipe extends Config {
  921. constructor(element, config) {
  922. super();
  923. this._element = element;
  924. if (!element || !Swipe.isSupported()) {
  925. return;
  926. }
  927. this._config = this._getConfig(config);
  928. this._deltaX = 0;
  929. this._supportPointerEvents = Boolean(window.PointerEvent);
  930. this._initEvents();
  931. }
  932. // Getters
  933. static get Default() {
  934. return Default$c;
  935. }
  936. static get DefaultType() {
  937. return DefaultType$c;
  938. }
  939. static get NAME() {
  940. return NAME$d;
  941. }
  942. // Public
  943. dispose() {
  944. EventHandler.off(this._element, EVENT_KEY$9);
  945. }
  946. // Private
  947. _start(event) {
  948. if (!this._supportPointerEvents) {
  949. this._deltaX = event.touches[0].clientX;
  950. return;
  951. }
  952. if (this._eventIsPointerPenTouch(event)) {
  953. this._deltaX = event.clientX;
  954. }
  955. }
  956. _end(event) {
  957. if (this._eventIsPointerPenTouch(event)) {
  958. this._deltaX = event.clientX - this._deltaX;
  959. }
  960. this._handleSwipe();
  961. execute(this._config.endCallback);
  962. }
  963. _move(event) {
  964. this._deltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this._deltaX;
  965. }
  966. _handleSwipe() {
  967. const absDeltaX = Math.abs(this._deltaX);
  968. if (absDeltaX <= SWIPE_THRESHOLD) {
  969. return;
  970. }
  971. const direction = absDeltaX / this._deltaX;
  972. this._deltaX = 0;
  973. if (!direction) {
  974. return;
  975. }
  976. execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback);
  977. }
  978. _initEvents() {
  979. if (this._supportPointerEvents) {
  980. EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event));
  981. EventHandler.on(this._element, EVENT_POINTERUP, event => this._end(event));
  982. this._element.classList.add(CLASS_NAME_POINTER_EVENT);
  983. } else {
  984. EventHandler.on(this._element, EVENT_TOUCHSTART, event => this._start(event));
  985. EventHandler.on(this._element, EVENT_TOUCHMOVE, event => this._move(event));
  986. EventHandler.on(this._element, EVENT_TOUCHEND, event => this._end(event));
  987. }
  988. }
  989. _eventIsPointerPenTouch(event) {
  990. return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH);
  991. }
  992. // Static
  993. static isSupported() {
  994. return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  995. }
  996. }
  997. /**
  998. * --------------------------------------------------------------------------
  999. * Bootstrap carousel.js
  1000. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1001. * --------------------------------------------------------------------------
  1002. */
  1003. /**
  1004. * Constants
  1005. */
  1006. const NAME$c = 'carousel';
  1007. const DATA_KEY$8 = 'bs.carousel';
  1008. const EVENT_KEY$8 = `.${DATA_KEY$8}`;
  1009. const DATA_API_KEY$5 = '.data-api';
  1010. const ARROW_LEFT_KEY$1 = 'ArrowLeft';
  1011. const ARROW_RIGHT_KEY$1 = 'ArrowRight';
  1012. const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  1013. const ORDER_NEXT = 'next';
  1014. const ORDER_PREV = 'prev';
  1015. const DIRECTION_LEFT = 'left';
  1016. const DIRECTION_RIGHT = 'right';
  1017. const EVENT_SLIDE = `slide${EVENT_KEY$8}`;
  1018. const EVENT_SLID = `slid${EVENT_KEY$8}`;
  1019. const EVENT_KEYDOWN$1 = `keydown${EVENT_KEY$8}`;
  1020. const EVENT_MOUSEENTER$1 = `mouseenter${EVENT_KEY$8}`;
  1021. const EVENT_MOUSELEAVE$1 = `mouseleave${EVENT_KEY$8}`;
  1022. const EVENT_DRAG_START = `dragstart${EVENT_KEY$8}`;
  1023. const EVENT_LOAD_DATA_API$3 = `load${EVENT_KEY$8}${DATA_API_KEY$5}`;
  1024. const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
  1025. const CLASS_NAME_CAROUSEL = 'carousel';
  1026. const CLASS_NAME_ACTIVE$2 = 'active';
  1027. const CLASS_NAME_SLIDE = 'slide';
  1028. const CLASS_NAME_END = 'carousel-item-end';
  1029. const CLASS_NAME_START = 'carousel-item-start';
  1030. const CLASS_NAME_NEXT = 'carousel-item-next';
  1031. const CLASS_NAME_PREV = 'carousel-item-prev';
  1032. const SELECTOR_ACTIVE = '.active';
  1033. const SELECTOR_ITEM = '.carousel-item';
  1034. const SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM;
  1035. const SELECTOR_ITEM_IMG = '.carousel-item img';
  1036. const SELECTOR_INDICATORS = '.carousel-indicators';
  1037. const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
  1038. const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
  1039. const KEY_TO_DIRECTION = {
  1040. [ARROW_LEFT_KEY$1]: DIRECTION_RIGHT,
  1041. [ARROW_RIGHT_KEY$1]: DIRECTION_LEFT
  1042. };
  1043. const Default$b = {
  1044. interval: 5000,
  1045. keyboard: true,
  1046. pause: 'hover',
  1047. ride: false,
  1048. touch: true,
  1049. wrap: true
  1050. };
  1051. const DefaultType$b = {
  1052. interval: '(number|boolean)',
  1053. // TODO:v6 remove boolean support
  1054. keyboard: 'boolean',
  1055. pause: '(string|boolean)',
  1056. ride: '(boolean|string)',
  1057. touch: 'boolean',
  1058. wrap: 'boolean'
  1059. };
  1060. /**
  1061. * Class definition
  1062. */
  1063. class Carousel extends BaseComponent {
  1064. constructor(element, config) {
  1065. super(element, config);
  1066. this._interval = null;
  1067. this._activeElement = null;
  1068. this._isSliding = false;
  1069. this.touchTimeout = null;
  1070. this._swipeHelper = null;
  1071. this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
  1072. this._addEventListeners();
  1073. if (this._config.ride === CLASS_NAME_CAROUSEL) {
  1074. this.cycle();
  1075. }
  1076. }
  1077. // Getters
  1078. static get Default() {
  1079. return Default$b;
  1080. }
  1081. static get DefaultType() {
  1082. return DefaultType$b;
  1083. }
  1084. static get NAME() {
  1085. return NAME$c;
  1086. }
  1087. // Public
  1088. next() {
  1089. this._slide(ORDER_NEXT);
  1090. }
  1091. nextWhenVisible() {
  1092. // FIXME TODO use `document.visibilityState`
  1093. // Don't call next when the page isn't visible
  1094. // or the carousel or its parent isn't visible
  1095. if (!document.hidden && isVisible(this._element)) {
  1096. this.next();
  1097. }
  1098. }
  1099. prev() {
  1100. this._slide(ORDER_PREV);
  1101. }
  1102. pause() {
  1103. if (this._isSliding) {
  1104. triggerTransitionEnd(this._element);
  1105. }
  1106. this._clearInterval();
  1107. }
  1108. cycle() {
  1109. this._clearInterval();
  1110. this._updateInterval();
  1111. this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval);
  1112. }
  1113. _maybeEnableCycle() {
  1114. if (!this._config.ride) {
  1115. return;
  1116. }
  1117. if (this._isSliding) {
  1118. EventHandler.one(this._element, EVENT_SLID, () => this.cycle());
  1119. return;
  1120. }
  1121. this.cycle();
  1122. }
  1123. to(index) {
  1124. const items = this._getItems();
  1125. if (index > items.length - 1 || index < 0) {
  1126. return;
  1127. }
  1128. if (this._isSliding) {
  1129. EventHandler.one(this._element, EVENT_SLID, () => this.to(index));
  1130. return;
  1131. }
  1132. const activeIndex = this._getItemIndex(this._getActive());
  1133. if (activeIndex === index) {
  1134. return;
  1135. }
  1136. const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
  1137. this._slide(order, items[index]);
  1138. }
  1139. dispose() {
  1140. if (this._swipeHelper) {
  1141. this._swipeHelper.dispose();
  1142. }
  1143. super.dispose();
  1144. }
  1145. // Private
  1146. _configAfterMerge(config) {
  1147. config.defaultInterval = config.interval;
  1148. return config;
  1149. }
  1150. _addEventListeners() {
  1151. if (this._config.keyboard) {
  1152. EventHandler.on(this._element, EVENT_KEYDOWN$1, event => this._keydown(event));
  1153. }
  1154. if (this._config.pause === 'hover') {
  1155. EventHandler.on(this._element, EVENT_MOUSEENTER$1, () => this.pause());
  1156. EventHandler.on(this._element, EVENT_MOUSELEAVE$1, () => this._maybeEnableCycle());
  1157. }
  1158. if (this._config.touch && Swipe.isSupported()) {
  1159. this._addTouchEventListeners();
  1160. }
  1161. }
  1162. _addTouchEventListeners() {
  1163. for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) {
  1164. EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault());
  1165. }
  1166. const endCallBack = () => {
  1167. if (this._config.pause !== 'hover') {
  1168. return;
  1169. }
  1170. // If it's a touch-enabled device, mouseenter/leave are fired as
  1171. // part of the mouse compatibility events on first tap - the carousel
  1172. // would stop cycling until user tapped out of it;
  1173. // here, we listen for touchend, explicitly pause the carousel
  1174. // (as if it's the second time we tap on it, mouseenter compat event
  1175. // is NOT fired) and after a timeout (to allow for mouse compatibility
  1176. // events to fire) we explicitly restart cycling
  1177. this.pause();
  1178. if (this.touchTimeout) {
  1179. clearTimeout(this.touchTimeout);
  1180. }
  1181. this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
  1182. };
  1183. const swipeConfig = {
  1184. leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),
  1185. rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),
  1186. endCallback: endCallBack
  1187. };
  1188. this._swipeHelper = new Swipe(this._element, swipeConfig);
  1189. }
  1190. _keydown(event) {
  1191. if (/input|textarea/i.test(event.target.tagName)) {
  1192. return;
  1193. }
  1194. const direction = KEY_TO_DIRECTION[event.key];
  1195. if (direction) {
  1196. event.preventDefault();
  1197. this._slide(this._directionToOrder(direction));
  1198. }
  1199. }
  1200. _getItemIndex(element) {
  1201. return this._getItems().indexOf(element);
  1202. }
  1203. _setActiveIndicatorElement(index) {
  1204. if (!this._indicatorsElement) {
  1205. return;
  1206. }
  1207. const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement);
  1208. activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2);
  1209. activeIndicator.removeAttribute('aria-current');
  1210. const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to="${index}"]`, this._indicatorsElement);
  1211. if (newActiveIndicator) {
  1212. newActiveIndicator.classList.add(CLASS_NAME_ACTIVE$2);
  1213. newActiveIndicator.setAttribute('aria-current', 'true');
  1214. }
  1215. }
  1216. _updateInterval() {
  1217. const element = this._activeElement || this._getActive();
  1218. if (!element) {
  1219. return;
  1220. }
  1221. const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
  1222. this._config.interval = elementInterval || this._config.defaultInterval;
  1223. }
  1224. _slide(order, element = null) {
  1225. if (this._isSliding) {
  1226. return;
  1227. }
  1228. const activeElement = this._getActive();
  1229. const isNext = order === ORDER_NEXT;
  1230. const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap);
  1231. if (nextElement === activeElement) {
  1232. return;
  1233. }
  1234. const nextElementIndex = this._getItemIndex(nextElement);
  1235. const triggerEvent = eventName => {
  1236. return EventHandler.trigger(this._element, eventName, {
  1237. relatedTarget: nextElement,
  1238. direction: this._orderToDirection(order),
  1239. from: this._getItemIndex(activeElement),
  1240. to: nextElementIndex
  1241. });
  1242. };
  1243. const slideEvent = triggerEvent(EVENT_SLIDE);
  1244. if (slideEvent.defaultPrevented) {
  1245. return;
  1246. }
  1247. if (!activeElement || !nextElement) {
  1248. // Some weirdness is happening, so we bail
  1249. // TODO: change tests that use empty divs to avoid this check
  1250. return;
  1251. }
  1252. const isCycling = Boolean(this._interval);
  1253. this.pause();
  1254. this._isSliding = true;
  1255. this._setActiveIndicatorElement(nextElementIndex);
  1256. this._activeElement = nextElement;
  1257. const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
  1258. const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
  1259. nextElement.classList.add(orderClassName);
  1260. reflow(nextElement);
  1261. activeElement.classList.add(directionalClassName);
  1262. nextElement.classList.add(directionalClassName);
  1263. const completeCallBack = () => {
  1264. nextElement.classList.remove(directionalClassName, orderClassName);
  1265. nextElement.classList.add(CLASS_NAME_ACTIVE$2);
  1266. activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName);
  1267. this._isSliding = false;
  1268. triggerEvent(EVENT_SLID);
  1269. };
  1270. this._queueCallback(completeCallBack, activeElement, this._isAnimated());
  1271. if (isCycling) {
  1272. this.cycle();
  1273. }
  1274. }
  1275. _isAnimated() {
  1276. return this._element.classList.contains(CLASS_NAME_SLIDE);
  1277. }
  1278. _getActive() {
  1279. return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
  1280. }
  1281. _getItems() {
  1282. return SelectorEngine.find(SELECTOR_ITEM, this._element);
  1283. }
  1284. _clearInterval() {
  1285. if (this._interval) {
  1286. clearInterval(this._interval);
  1287. this._interval = null;
  1288. }
  1289. }
  1290. _directionToOrder(direction) {
  1291. if (isRTL()) {
  1292. return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
  1293. }
  1294. return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
  1295. }
  1296. _orderToDirection(order) {
  1297. if (isRTL()) {
  1298. return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
  1299. }
  1300. return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
  1301. }
  1302. // Static
  1303. static jQueryInterface(config) {
  1304. return this.each(function () {
  1305. const data = Carousel.getOrCreateInstance(this, config);
  1306. if (typeof config === 'number') {
  1307. data.to(config);
  1308. return;
  1309. }
  1310. if (typeof config === 'string') {
  1311. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  1312. throw new TypeError(`No method named "${config}"`);
  1313. }
  1314. data[config]();
  1315. }
  1316. });
  1317. }
  1318. }
  1319. /**
  1320. * Data API implementation
  1321. */
  1322. EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, function (event) {
  1323. const target = SelectorEngine.getElementFromSelector(this);
  1324. if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
  1325. return;
  1326. }
  1327. event.preventDefault();
  1328. const carousel = Carousel.getOrCreateInstance(target);
  1329. const slideIndex = this.getAttribute('data-bs-slide-to');
  1330. if (slideIndex) {
  1331. carousel.to(slideIndex);
  1332. carousel._maybeEnableCycle();
  1333. return;
  1334. }
  1335. if (Manipulator.getDataAttribute(this, 'slide') === 'next') {
  1336. carousel.next();
  1337. carousel._maybeEnableCycle();
  1338. return;
  1339. }
  1340. carousel.prev();
  1341. carousel._maybeEnableCycle();
  1342. });
  1343. EventHandler.on(window, EVENT_LOAD_DATA_API$3, () => {
  1344. const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
  1345. for (const carousel of carousels) {
  1346. Carousel.getOrCreateInstance(carousel);
  1347. }
  1348. });
  1349. /**
  1350. * jQuery
  1351. */
  1352. defineJQueryPlugin(Carousel);
  1353. /**
  1354. * --------------------------------------------------------------------------
  1355. * Bootstrap collapse.js
  1356. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1357. * --------------------------------------------------------------------------
  1358. */
  1359. /**
  1360. * Constants
  1361. */
  1362. const NAME$b = 'collapse';
  1363. const DATA_KEY$7 = 'bs.collapse';
  1364. const EVENT_KEY$7 = `.${DATA_KEY$7}`;
  1365. const DATA_API_KEY$4 = '.data-api';
  1366. const EVENT_SHOW$6 = `show${EVENT_KEY$7}`;
  1367. const EVENT_SHOWN$6 = `shown${EVENT_KEY$7}`;
  1368. const EVENT_HIDE$6 = `hide${EVENT_KEY$7}`;
  1369. const EVENT_HIDDEN$6 = `hidden${EVENT_KEY$7}`;
  1370. const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
  1371. const CLASS_NAME_SHOW$7 = 'show';
  1372. const CLASS_NAME_COLLAPSE = 'collapse';
  1373. const CLASS_NAME_COLLAPSING = 'collapsing';
  1374. const CLASS_NAME_COLLAPSED = 'collapsed';
  1375. const CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
  1376. const CLASS_NAME_HORIZONTAL = 'collapse-horizontal';
  1377. const WIDTH = 'width';
  1378. const HEIGHT = 'height';
  1379. const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
  1380. const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
  1381. const Default$a = {
  1382. parent: null,
  1383. toggle: true
  1384. };
  1385. const DefaultType$a = {
  1386. parent: '(null|element)',
  1387. toggle: 'boolean'
  1388. };
  1389. /**
  1390. * Class definition
  1391. */
  1392. class Collapse extends BaseComponent {
  1393. constructor(element, config) {
  1394. super(element, config);
  1395. this._isTransitioning = false;
  1396. this._triggerArray = [];
  1397. const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
  1398. for (const elem of toggleList) {
  1399. const selector = SelectorEngine.getSelectorFromElement(elem);
  1400. const filterElement = SelectorEngine.find(selector).filter(foundElement => foundElement === this._element);
  1401. if (selector !== null && filterElement.length) {
  1402. this._triggerArray.push(elem);
  1403. }
  1404. }
  1405. this._initializeChildren();
  1406. if (!this._config.parent) {
  1407. this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
  1408. }
  1409. if (this._config.toggle) {
  1410. this.toggle();
  1411. }
  1412. }
  1413. // Getters
  1414. static get Default() {
  1415. return Default$a;
  1416. }
  1417. static get DefaultType() {
  1418. return DefaultType$a;
  1419. }
  1420. static get NAME() {
  1421. return NAME$b;
  1422. }
  1423. // Public
  1424. toggle() {
  1425. if (this._isShown()) {
  1426. this.hide();
  1427. } else {
  1428. this.show();
  1429. }
  1430. }
  1431. show() {
  1432. if (this._isTransitioning || this._isShown()) {
  1433. return;
  1434. }
  1435. let activeChildren = [];
  1436. // find active children
  1437. if (this._config.parent) {
  1438. activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter(element => element !== this._element).map(element => Collapse.getOrCreateInstance(element, {
  1439. toggle: false
  1440. }));
  1441. }
  1442. if (activeChildren.length && activeChildren[0]._isTransitioning) {
  1443. return;
  1444. }
  1445. const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$6);
  1446. if (startEvent.defaultPrevented) {
  1447. return;
  1448. }
  1449. for (const activeInstance of activeChildren) {
  1450. activeInstance.hide();
  1451. }
  1452. const dimension = this._getDimension();
  1453. this._element.classList.remove(CLASS_NAME_COLLAPSE);
  1454. this._element.classList.add(CLASS_NAME_COLLAPSING);
  1455. this._element.style[dimension] = 0;
  1456. this._addAriaAndCollapsedClass(this._triggerArray, true);
  1457. this._isTransitioning = true;
  1458. const complete = () => {
  1459. this._isTransitioning = false;
  1460. this._element.classList.remove(CLASS_NAME_COLLAPSING);
  1461. this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
  1462. this._element.style[dimension] = '';
  1463. EventHandler.trigger(this._element, EVENT_SHOWN$6);
  1464. };
  1465. const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  1466. const scrollSize = `scroll${capitalizedDimension}`;
  1467. this._queueCallback(complete, this._element, true);
  1468. this._element.style[dimension] = `${this._element[scrollSize]}px`;
  1469. }
  1470. hide() {
  1471. if (this._isTransitioning || !this._isShown()) {
  1472. return;
  1473. }
  1474. const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$6);
  1475. if (startEvent.defaultPrevented) {
  1476. return;
  1477. }
  1478. const dimension = this._getDimension();
  1479. this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
  1480. reflow(this._element);
  1481. this._element.classList.add(CLASS_NAME_COLLAPSING);
  1482. this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7);
  1483. for (const trigger of this._triggerArray) {
  1484. const element = SelectorEngine.getElementFromSelector(trigger);
  1485. if (element && !this._isShown(element)) {
  1486. this._addAriaAndCollapsedClass([trigger], false);
  1487. }
  1488. }
  1489. this._isTransitioning = true;
  1490. const complete = () => {
  1491. this._isTransitioning = false;
  1492. this._element.classList.remove(CLASS_NAME_COLLAPSING);
  1493. this._element.classList.add(CLASS_NAME_COLLAPSE);
  1494. EventHandler.trigger(this._element, EVENT_HIDDEN$6);
  1495. };
  1496. this._element.style[dimension] = '';
  1497. this._queueCallback(complete, this._element, true);
  1498. }
  1499. // Private
  1500. _isShown(element = this._element) {
  1501. return element.classList.contains(CLASS_NAME_SHOW$7);
  1502. }
  1503. _configAfterMerge(config) {
  1504. config.toggle = Boolean(config.toggle); // Coerce string values
  1505. config.parent = getElement(config.parent);
  1506. return config;
  1507. }
  1508. _getDimension() {
  1509. return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
  1510. }
  1511. _initializeChildren() {
  1512. if (!this._config.parent) {
  1513. return;
  1514. }
  1515. const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE$4);
  1516. for (const element of children) {
  1517. const selected = SelectorEngine.getElementFromSelector(element);
  1518. if (selected) {
  1519. this._addAriaAndCollapsedClass([element], this._isShown(selected));
  1520. }
  1521. }
  1522. }
  1523. _getFirstLevelChildren(selector) {
  1524. const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
  1525. // remove children if greater depth
  1526. return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element));
  1527. }
  1528. _addAriaAndCollapsedClass(triggerArray, isOpen) {
  1529. if (!triggerArray.length) {
  1530. return;
  1531. }
  1532. for (const element of triggerArray) {
  1533. element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen);
  1534. element.setAttribute('aria-expanded', isOpen);
  1535. }
  1536. }
  1537. // Static
  1538. static jQueryInterface(config) {
  1539. const _config = {};
  1540. if (typeof config === 'string' && /show|hide/.test(config)) {
  1541. _config.toggle = false;
  1542. }
  1543. return this.each(function () {
  1544. const data = Collapse.getOrCreateInstance(this, _config);
  1545. if (typeof config === 'string') {
  1546. if (typeof data[config] === 'undefined') {
  1547. throw new TypeError(`No method named "${config}"`);
  1548. }
  1549. data[config]();
  1550. }
  1551. });
  1552. }
  1553. }
  1554. /**
  1555. * Data API implementation
  1556. */
  1557. EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function (event) {
  1558. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  1559. if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') {
  1560. event.preventDefault();
  1561. }
  1562. for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) {
  1563. Collapse.getOrCreateInstance(element, {
  1564. toggle: false
  1565. }).toggle();
  1566. }
  1567. });
  1568. /**
  1569. * jQuery
  1570. */
  1571. defineJQueryPlugin(Collapse);
  1572. var top = 'top';
  1573. var bottom = 'bottom';
  1574. var right = 'right';
  1575. var left = 'left';
  1576. var auto = 'auto';
  1577. var basePlacements = [top, bottom, right, left];
  1578. var start = 'start';
  1579. var end = 'end';
  1580. var clippingParents = 'clippingParents';
  1581. var viewport = 'viewport';
  1582. var popper = 'popper';
  1583. var reference = 'reference';
  1584. var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
  1585. return acc.concat([placement + "-" + start, placement + "-" + end]);
  1586. }, []);
  1587. var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
  1588. return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
  1589. }, []); // modifiers that need to read the DOM
  1590. var beforeRead = 'beforeRead';
  1591. var read = 'read';
  1592. var afterRead = 'afterRead'; // pure-logic modifiers
  1593. var beforeMain = 'beforeMain';
  1594. var main = 'main';
  1595. var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
  1596. var beforeWrite = 'beforeWrite';
  1597. var write = 'write';
  1598. var afterWrite = 'afterWrite';
  1599. var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
  1600. function getNodeName(element) {
  1601. return element ? (element.nodeName || '').toLowerCase() : null;
  1602. }
  1603. function getWindow(node) {
  1604. if (node == null) {
  1605. return window;
  1606. }
  1607. if (node.toString() !== '[object Window]') {
  1608. var ownerDocument = node.ownerDocument;
  1609. return ownerDocument ? ownerDocument.defaultView || window : window;
  1610. }
  1611. return node;
  1612. }
  1613. function isElement(node) {
  1614. var OwnElement = getWindow(node).Element;
  1615. return node instanceof OwnElement || node instanceof Element;
  1616. }
  1617. function isHTMLElement(node) {
  1618. var OwnElement = getWindow(node).HTMLElement;
  1619. return node instanceof OwnElement || node instanceof HTMLElement;
  1620. }
  1621. function isShadowRoot(node) {
  1622. // IE 11 has no ShadowRoot
  1623. if (typeof ShadowRoot === 'undefined') {
  1624. return false;
  1625. }
  1626. var OwnElement = getWindow(node).ShadowRoot;
  1627. return node instanceof OwnElement || node instanceof ShadowRoot;
  1628. }
  1629. // and applies them to the HTMLElements such as popper and arrow
  1630. function applyStyles(_ref) {
  1631. var state = _ref.state;
  1632. Object.keys(state.elements).forEach(function (name) {
  1633. var style = state.styles[name] || {};
  1634. var attributes = state.attributes[name] || {};
  1635. var element = state.elements[name]; // arrow is optional + virtual elements
  1636. if (!isHTMLElement(element) || !getNodeName(element)) {
  1637. return;
  1638. } // Flow doesn't support to extend this property, but it's the most
  1639. // effective way to apply styles to an HTMLElement
  1640. // $FlowFixMe[cannot-write]
  1641. Object.assign(element.style, style);
  1642. Object.keys(attributes).forEach(function (name) {
  1643. var value = attributes[name];
  1644. if (value === false) {
  1645. element.removeAttribute(name);
  1646. } else {
  1647. element.setAttribute(name, value === true ? '' : value);
  1648. }
  1649. });
  1650. });
  1651. }
  1652. function effect$2(_ref2) {
  1653. var state = _ref2.state;
  1654. var initialStyles = {
  1655. popper: {
  1656. position: state.options.strategy,
  1657. left: '0',
  1658. top: '0',
  1659. margin: '0'
  1660. },
  1661. arrow: {
  1662. position: 'absolute'
  1663. },
  1664. reference: {}
  1665. };
  1666. Object.assign(state.elements.popper.style, initialStyles.popper);
  1667. state.styles = initialStyles;
  1668. if (state.elements.arrow) {
  1669. Object.assign(state.elements.arrow.style, initialStyles.arrow);
  1670. }
  1671. return function () {
  1672. Object.keys(state.elements).forEach(function (name) {
  1673. var element = state.elements[name];
  1674. var attributes = state.attributes[name] || {};
  1675. var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
  1676. var style = styleProperties.reduce(function (style, property) {
  1677. style[property] = '';
  1678. return style;
  1679. }, {}); // arrow is optional + virtual elements
  1680. if (!isHTMLElement(element) || !getNodeName(element)) {
  1681. return;
  1682. }
  1683. Object.assign(element.style, style);
  1684. Object.keys(attributes).forEach(function (attribute) {
  1685. element.removeAttribute(attribute);
  1686. });
  1687. });
  1688. };
  1689. } // eslint-disable-next-line import/no-unused-modules
  1690. const applyStyles$1 = {
  1691. name: 'applyStyles',
  1692. enabled: true,
  1693. phase: 'write',
  1694. fn: applyStyles,
  1695. effect: effect$2,
  1696. requires: ['computeStyles']
  1697. };
  1698. function getBasePlacement(placement) {
  1699. return placement.split('-')[0];
  1700. }
  1701. var max = Math.max;
  1702. var min = Math.min;
  1703. var round = Math.round;
  1704. function getUAString() {
  1705. var uaData = navigator.userAgentData;
  1706. if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
  1707. return uaData.brands.map(function (item) {
  1708. return item.brand + "/" + item.version;
  1709. }).join(' ');
  1710. }
  1711. return navigator.userAgent;
  1712. }
  1713. function isLayoutViewport() {
  1714. return !/^((?!chrome|android).)*safari/i.test(getUAString());
  1715. }
  1716. function getBoundingClientRect(element, includeScale, isFixedStrategy) {
  1717. if (includeScale === void 0) {
  1718. includeScale = false;
  1719. }
  1720. if (isFixedStrategy === void 0) {
  1721. isFixedStrategy = false;
  1722. }
  1723. var clientRect = element.getBoundingClientRect();
  1724. var scaleX = 1;
  1725. var scaleY = 1;
  1726. if (includeScale && isHTMLElement(element)) {
  1727. scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
  1728. scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
  1729. }
  1730. var _ref = isElement(element) ? getWindow(element) : window,
  1731. visualViewport = _ref.visualViewport;
  1732. var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
  1733. var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
  1734. var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
  1735. var width = clientRect.width / scaleX;
  1736. var height = clientRect.height / scaleY;
  1737. return {
  1738. width: width,
  1739. height: height,
  1740. top: y,
  1741. right: x + width,
  1742. bottom: y + height,
  1743. left: x,
  1744. x: x,
  1745. y: y
  1746. };
  1747. }
  1748. // means it doesn't take into account transforms.
  1749. function getLayoutRect(element) {
  1750. var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
  1751. // Fixes https://github.com/popperjs/popper-core/issues/1223
  1752. var width = element.offsetWidth;
  1753. var height = element.offsetHeight;
  1754. if (Math.abs(clientRect.width - width) <= 1) {
  1755. width = clientRect.width;
  1756. }
  1757. if (Math.abs(clientRect.height - height) <= 1) {
  1758. height = clientRect.height;
  1759. }
  1760. return {
  1761. x: element.offsetLeft,
  1762. y: element.offsetTop,
  1763. width: width,
  1764. height: height
  1765. };
  1766. }
  1767. function contains(parent, child) {
  1768. var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
  1769. if (parent.contains(child)) {
  1770. return true;
  1771. } // then fallback to custom implementation with Shadow DOM support
  1772. else if (rootNode && isShadowRoot(rootNode)) {
  1773. var next = child;
  1774. do {
  1775. if (next && parent.isSameNode(next)) {
  1776. return true;
  1777. } // $FlowFixMe[prop-missing]: need a better way to handle this...
  1778. next = next.parentNode || next.host;
  1779. } while (next);
  1780. } // Give up, the result is false
  1781. return false;
  1782. }
  1783. function getComputedStyle$1(element) {
  1784. return getWindow(element).getComputedStyle(element);
  1785. }
  1786. function isTableElement(element) {
  1787. return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
  1788. }
  1789. function getDocumentElement(element) {
  1790. // $FlowFixMe[incompatible-return]: assume body is always available
  1791. return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
  1792. element.document) || window.document).documentElement;
  1793. }
  1794. function getParentNode(element) {
  1795. if (getNodeName(element) === 'html') {
  1796. return element;
  1797. }
  1798. return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
  1799. // $FlowFixMe[incompatible-return]
  1800. // $FlowFixMe[prop-missing]
  1801. element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
  1802. element.parentNode || ( // DOM Element detected
  1803. isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
  1804. // $FlowFixMe[incompatible-call]: HTMLElement is a Node
  1805. getDocumentElement(element) // fallback
  1806. );
  1807. }
  1808. function getTrueOffsetParent(element) {
  1809. if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
  1810. getComputedStyle$1(element).position === 'fixed') {
  1811. return null;
  1812. }
  1813. return element.offsetParent;
  1814. } // `.offsetParent` reports `null` for fixed elements, while absolute elements
  1815. // return the containing block
  1816. function getContainingBlock(element) {
  1817. var isFirefox = /firefox/i.test(getUAString());
  1818. var isIE = /Trident/i.test(getUAString());
  1819. if (isIE && isHTMLElement(element)) {
  1820. // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
  1821. var elementCss = getComputedStyle$1(element);
  1822. if (elementCss.position === 'fixed') {
  1823. return null;
  1824. }
  1825. }
  1826. var currentNode = getParentNode(element);
  1827. if (isShadowRoot(currentNode)) {
  1828. currentNode = currentNode.host;
  1829. }
  1830. while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
  1831. var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that
  1832. // create a containing block.
  1833. // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
  1834. if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
  1835. return currentNode;
  1836. } else {
  1837. currentNode = currentNode.parentNode;
  1838. }
  1839. }
  1840. return null;
  1841. } // Gets the closest ancestor positioned element. Handles some edge cases,
  1842. // such as table ancestors and cross browser bugs.
  1843. function getOffsetParent(element) {
  1844. var window = getWindow(element);
  1845. var offsetParent = getTrueOffsetParent(element);
  1846. while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
  1847. offsetParent = getTrueOffsetParent(offsetParent);
  1848. }
  1849. if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static')) {
  1850. return window;
  1851. }
  1852. return offsetParent || getContainingBlock(element) || window;
  1853. }
  1854. function getMainAxisFromPlacement(placement) {
  1855. return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
  1856. }
  1857. function within(min$1, value, max$1) {
  1858. return max(min$1, min(value, max$1));
  1859. }
  1860. function withinMaxClamp(min, value, max) {
  1861. var v = within(min, value, max);
  1862. return v > max ? max : v;
  1863. }
  1864. function getFreshSideObject() {
  1865. return {
  1866. top: 0,
  1867. right: 0,
  1868. bottom: 0,
  1869. left: 0
  1870. };
  1871. }
  1872. function mergePaddingObject(paddingObject) {
  1873. return Object.assign({}, getFreshSideObject(), paddingObject);
  1874. }
  1875. function expandToHashMap(value, keys) {
  1876. return keys.reduce(function (hashMap, key) {
  1877. hashMap[key] = value;
  1878. return hashMap;
  1879. }, {});
  1880. }
  1881. var toPaddingObject = function toPaddingObject(padding, state) {
  1882. padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
  1883. placement: state.placement
  1884. })) : padding;
  1885. return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
  1886. };
  1887. function arrow(_ref) {
  1888. var _state$modifiersData$;
  1889. var state = _ref.state,
  1890. name = _ref.name,
  1891. options = _ref.options;
  1892. var arrowElement = state.elements.arrow;
  1893. var popperOffsets = state.modifiersData.popperOffsets;
  1894. var basePlacement = getBasePlacement(state.placement);
  1895. var axis = getMainAxisFromPlacement(basePlacement);
  1896. var isVertical = [left, right].indexOf(basePlacement) >= 0;
  1897. var len = isVertical ? 'height' : 'width';
  1898. if (!arrowElement || !popperOffsets) {
  1899. return;
  1900. }
  1901. var paddingObject = toPaddingObject(options.padding, state);
  1902. var arrowRect = getLayoutRect(arrowElement);
  1903. var minProp = axis === 'y' ? top : left;
  1904. var maxProp = axis === 'y' ? bottom : right;
  1905. var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
  1906. var startDiff = popperOffsets[axis] - state.rects.reference[axis];
  1907. var arrowOffsetParent = getOffsetParent(arrowElement);
  1908. var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
  1909. var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
  1910. // outside of the popper bounds
  1911. var min = paddingObject[minProp];
  1912. var max = clientSize - arrowRect[len] - paddingObject[maxProp];
  1913. var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
  1914. var offset = within(min, center, max); // Prevents breaking syntax highlighting...
  1915. var axisProp = axis;
  1916. state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
  1917. }
  1918. function effect$1(_ref2) {
  1919. var state = _ref2.state,
  1920. options = _ref2.options;
  1921. var _options$element = options.element,
  1922. arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
  1923. if (arrowElement == null) {
  1924. return;
  1925. } // CSS selector
  1926. if (typeof arrowElement === 'string') {
  1927. arrowElement = state.elements.popper.querySelector(arrowElement);
  1928. if (!arrowElement) {
  1929. return;
  1930. }
  1931. }
  1932. if (!contains(state.elements.popper, arrowElement)) {
  1933. return;
  1934. }
  1935. state.elements.arrow = arrowElement;
  1936. } // eslint-disable-next-line import/no-unused-modules
  1937. const arrow$1 = {
  1938. name: 'arrow',
  1939. enabled: true,
  1940. phase: 'main',
  1941. fn: arrow,
  1942. effect: effect$1,
  1943. requires: ['popperOffsets'],
  1944. requiresIfExists: ['preventOverflow']
  1945. };
  1946. function getVariation(placement) {
  1947. return placement.split('-')[1];
  1948. }
  1949. var unsetSides = {
  1950. top: 'auto',
  1951. right: 'auto',
  1952. bottom: 'auto',
  1953. left: 'auto'
  1954. }; // Round the offsets to the nearest suitable subpixel based on the DPR.
  1955. // Zooming can change the DPR, but it seems to report a value that will
  1956. // cleanly divide the values into the appropriate subpixels.
  1957. function roundOffsetsByDPR(_ref, win) {
  1958. var x = _ref.x,
  1959. y = _ref.y;
  1960. var dpr = win.devicePixelRatio || 1;
  1961. return {
  1962. x: round(x * dpr) / dpr || 0,
  1963. y: round(y * dpr) / dpr || 0
  1964. };
  1965. }
  1966. function mapToStyles(_ref2) {
  1967. var _Object$assign2;
  1968. var popper = _ref2.popper,
  1969. popperRect = _ref2.popperRect,
  1970. placement = _ref2.placement,
  1971. variation = _ref2.variation,
  1972. offsets = _ref2.offsets,
  1973. position = _ref2.position,
  1974. gpuAcceleration = _ref2.gpuAcceleration,
  1975. adaptive = _ref2.adaptive,
  1976. roundOffsets = _ref2.roundOffsets,
  1977. isFixed = _ref2.isFixed;
  1978. var _offsets$x = offsets.x,
  1979. x = _offsets$x === void 0 ? 0 : _offsets$x,
  1980. _offsets$y = offsets.y,
  1981. y = _offsets$y === void 0 ? 0 : _offsets$y;
  1982. var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
  1983. x: x,
  1984. y: y
  1985. }) : {
  1986. x: x,
  1987. y: y
  1988. };
  1989. x = _ref3.x;
  1990. y = _ref3.y;
  1991. var hasX = offsets.hasOwnProperty('x');
  1992. var hasY = offsets.hasOwnProperty('y');
  1993. var sideX = left;
  1994. var sideY = top;
  1995. var win = window;
  1996. if (adaptive) {
  1997. var offsetParent = getOffsetParent(popper);
  1998. var heightProp = 'clientHeight';
  1999. var widthProp = 'clientWidth';
  2000. if (offsetParent === getWindow(popper)) {
  2001. offsetParent = getDocumentElement(popper);
  2002. if (getComputedStyle$1(offsetParent).position !== 'static' && position === 'absolute') {
  2003. heightProp = 'scrollHeight';
  2004. widthProp = 'scrollWidth';
  2005. }
  2006. } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
  2007. offsetParent = offsetParent;
  2008. if (placement === top || (placement === left || placement === right) && variation === end) {
  2009. sideY = bottom;
  2010. var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
  2011. offsetParent[heightProp];
  2012. y -= offsetY - popperRect.height;
  2013. y *= gpuAcceleration ? 1 : -1;
  2014. }
  2015. if (placement === left || (placement === top || placement === bottom) && variation === end) {
  2016. sideX = right;
  2017. var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
  2018. offsetParent[widthProp];
  2019. x -= offsetX - popperRect.width;
  2020. x *= gpuAcceleration ? 1 : -1;
  2021. }
  2022. }
  2023. var commonStyles = Object.assign({
  2024. position: position
  2025. }, adaptive && unsetSides);
  2026. var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
  2027. x: x,
  2028. y: y
  2029. }, getWindow(popper)) : {
  2030. x: x,
  2031. y: y
  2032. };
  2033. x = _ref4.x;
  2034. y = _ref4.y;
  2035. if (gpuAcceleration) {
  2036. var _Object$assign;
  2037. return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
  2038. }
  2039. return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
  2040. }
  2041. function computeStyles(_ref5) {
  2042. var state = _ref5.state,
  2043. options = _ref5.options;
  2044. var _options$gpuAccelerat = options.gpuAcceleration,
  2045. gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
  2046. _options$adaptive = options.adaptive,
  2047. adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
  2048. _options$roundOffsets = options.roundOffsets,
  2049. roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
  2050. var commonStyles = {
  2051. placement: getBasePlacement(state.placement),
  2052. variation: getVariation(state.placement),
  2053. popper: state.elements.popper,
  2054. popperRect: state.rects.popper,
  2055. gpuAcceleration: gpuAcceleration,
  2056. isFixed: state.options.strategy === 'fixed'
  2057. };
  2058. if (state.modifiersData.popperOffsets != null) {
  2059. state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
  2060. offsets: state.modifiersData.popperOffsets,
  2061. position: state.options.strategy,
  2062. adaptive: adaptive,
  2063. roundOffsets: roundOffsets
  2064. })));
  2065. }
  2066. if (state.modifiersData.arrow != null) {
  2067. state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
  2068. offsets: state.modifiersData.arrow,
  2069. position: 'absolute',
  2070. adaptive: false,
  2071. roundOffsets: roundOffsets
  2072. })));
  2073. }
  2074. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  2075. 'data-popper-placement': state.placement
  2076. });
  2077. } // eslint-disable-next-line import/no-unused-modules
  2078. const computeStyles$1 = {
  2079. name: 'computeStyles',
  2080. enabled: true,
  2081. phase: 'beforeWrite',
  2082. fn: computeStyles,
  2083. data: {}
  2084. };
  2085. var passive = {
  2086. passive: true
  2087. };
  2088. function effect(_ref) {
  2089. var state = _ref.state,
  2090. instance = _ref.instance,
  2091. options = _ref.options;
  2092. var _options$scroll = options.scroll,
  2093. scroll = _options$scroll === void 0 ? true : _options$scroll,
  2094. _options$resize = options.resize,
  2095. resize = _options$resize === void 0 ? true : _options$resize;
  2096. var window = getWindow(state.elements.popper);
  2097. var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
  2098. if (scroll) {
  2099. scrollParents.forEach(function (scrollParent) {
  2100. scrollParent.addEventListener('scroll', instance.update, passive);
  2101. });
  2102. }
  2103. if (resize) {
  2104. window.addEventListener('resize', instance.update, passive);
  2105. }
  2106. return function () {
  2107. if (scroll) {
  2108. scrollParents.forEach(function (scrollParent) {
  2109. scrollParent.removeEventListener('scroll', instance.update, passive);
  2110. });
  2111. }
  2112. if (resize) {
  2113. window.removeEventListener('resize', instance.update, passive);
  2114. }
  2115. };
  2116. } // eslint-disable-next-line import/no-unused-modules
  2117. const eventListeners = {
  2118. name: 'eventListeners',
  2119. enabled: true,
  2120. phase: 'write',
  2121. fn: function fn() {},
  2122. effect: effect,
  2123. data: {}
  2124. };
  2125. var hash$1 = {
  2126. left: 'right',
  2127. right: 'left',
  2128. bottom: 'top',
  2129. top: 'bottom'
  2130. };
  2131. function getOppositePlacement(placement) {
  2132. return placement.replace(/left|right|bottom|top/g, function (matched) {
  2133. return hash$1[matched];
  2134. });
  2135. }
  2136. var hash = {
  2137. start: 'end',
  2138. end: 'start'
  2139. };
  2140. function getOppositeVariationPlacement(placement) {
  2141. return placement.replace(/start|end/g, function (matched) {
  2142. return hash[matched];
  2143. });
  2144. }
  2145. function getWindowScroll(node) {
  2146. var win = getWindow(node);
  2147. var scrollLeft = win.pageXOffset;
  2148. var scrollTop = win.pageYOffset;
  2149. return {
  2150. scrollLeft: scrollLeft,
  2151. scrollTop: scrollTop
  2152. };
  2153. }
  2154. function getWindowScrollBarX(element) {
  2155. // If <html> has a CSS width greater than the viewport, then this will be
  2156. // incorrect for RTL.
  2157. // Popper 1 is broken in this case and never had a bug report so let's assume
  2158. // it's not an issue. I don't think anyone ever specifies width on <html>
  2159. // anyway.
  2160. // Browsers where the left scrollbar doesn't cause an issue report `0` for
  2161. // this (e.g. Edge 2019, IE11, Safari)
  2162. return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
  2163. }
  2164. function getViewportRect(element, strategy) {
  2165. var win = getWindow(element);
  2166. var html = getDocumentElement(element);
  2167. var visualViewport = win.visualViewport;
  2168. var width = html.clientWidth;
  2169. var height = html.clientHeight;
  2170. var x = 0;
  2171. var y = 0;
  2172. if (visualViewport) {
  2173. width = visualViewport.width;
  2174. height = visualViewport.height;
  2175. var layoutViewport = isLayoutViewport();
  2176. if (layoutViewport || !layoutViewport && strategy === 'fixed') {
  2177. x = visualViewport.offsetLeft;
  2178. y = visualViewport.offsetTop;
  2179. }
  2180. }
  2181. return {
  2182. width: width,
  2183. height: height,
  2184. x: x + getWindowScrollBarX(element),
  2185. y: y
  2186. };
  2187. }
  2188. // of the `<html>` and `<body>` rect bounds if horizontally scrollable
  2189. function getDocumentRect(element) {
  2190. var _element$ownerDocumen;
  2191. var html = getDocumentElement(element);
  2192. var winScroll = getWindowScroll(element);
  2193. var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
  2194. var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
  2195. var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
  2196. var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
  2197. var y = -winScroll.scrollTop;
  2198. if (getComputedStyle$1(body || html).direction === 'rtl') {
  2199. x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
  2200. }
  2201. return {
  2202. width: width,
  2203. height: height,
  2204. x: x,
  2205. y: y
  2206. };
  2207. }
  2208. function isScrollParent(element) {
  2209. // Firefox wants us to check `-x` and `-y` variations as well
  2210. var _getComputedStyle = getComputedStyle$1(element),
  2211. overflow = _getComputedStyle.overflow,
  2212. overflowX = _getComputedStyle.overflowX,
  2213. overflowY = _getComputedStyle.overflowY;
  2214. return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
  2215. }
  2216. function getScrollParent(node) {
  2217. if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
  2218. // $FlowFixMe[incompatible-return]: assume body is always available
  2219. return node.ownerDocument.body;
  2220. }
  2221. if (isHTMLElement(node) && isScrollParent(node)) {
  2222. return node;
  2223. }
  2224. return getScrollParent(getParentNode(node));
  2225. }
  2226. /*
  2227. given a DOM element, return the list of all scroll parents, up the list of ancesors
  2228. until we get to the top window object. This list is what we attach scroll listeners
  2229. to, because if any of these parent elements scroll, we'll need to re-calculate the
  2230. reference element's position.
  2231. */
  2232. function listScrollParents(element, list) {
  2233. var _element$ownerDocumen;
  2234. if (list === void 0) {
  2235. list = [];
  2236. }
  2237. var scrollParent = getScrollParent(element);
  2238. var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
  2239. var win = getWindow(scrollParent);
  2240. var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
  2241. var updatedList = list.concat(target);
  2242. return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
  2243. updatedList.concat(listScrollParents(getParentNode(target)));
  2244. }
  2245. function rectToClientRect(rect) {
  2246. return Object.assign({}, rect, {
  2247. left: rect.x,
  2248. top: rect.y,
  2249. right: rect.x + rect.width,
  2250. bottom: rect.y + rect.height
  2251. });
  2252. }
  2253. function getInnerBoundingClientRect(element, strategy) {
  2254. var rect = getBoundingClientRect(element, false, strategy === 'fixed');
  2255. rect.top = rect.top + element.clientTop;
  2256. rect.left = rect.left + element.clientLeft;
  2257. rect.bottom = rect.top + element.clientHeight;
  2258. rect.right = rect.left + element.clientWidth;
  2259. rect.width = element.clientWidth;
  2260. rect.height = element.clientHeight;
  2261. rect.x = rect.left;
  2262. rect.y = rect.top;
  2263. return rect;
  2264. }
  2265. function getClientRectFromMixedType(element, clippingParent, strategy) {
  2266. return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
  2267. } // A "clipping parent" is an overflowable container with the characteristic of
  2268. // clipping (or hiding) overflowing elements with a position different from
  2269. // `initial`
  2270. function getClippingParents(element) {
  2271. var clippingParents = listScrollParents(getParentNode(element));
  2272. var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0;
  2273. var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
  2274. if (!isElement(clipperElement)) {
  2275. return [];
  2276. } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
  2277. return clippingParents.filter(function (clippingParent) {
  2278. return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
  2279. });
  2280. } // Gets the maximum area that the element is visible in due to any number of
  2281. // clipping parents
  2282. function getClippingRect(element, boundary, rootBoundary, strategy) {
  2283. var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
  2284. var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
  2285. var firstClippingParent = clippingParents[0];
  2286. var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
  2287. var rect = getClientRectFromMixedType(element, clippingParent, strategy);
  2288. accRect.top = max(rect.top, accRect.top);
  2289. accRect.right = min(rect.right, accRect.right);
  2290. accRect.bottom = min(rect.bottom, accRect.bottom);
  2291. accRect.left = max(rect.left, accRect.left);
  2292. return accRect;
  2293. }, getClientRectFromMixedType(element, firstClippingParent, strategy));
  2294. clippingRect.width = clippingRect.right - clippingRect.left;
  2295. clippingRect.height = clippingRect.bottom - clippingRect.top;
  2296. clippingRect.x = clippingRect.left;
  2297. clippingRect.y = clippingRect.top;
  2298. return clippingRect;
  2299. }
  2300. function computeOffsets(_ref) {
  2301. var reference = _ref.reference,
  2302. element = _ref.element,
  2303. placement = _ref.placement;
  2304. var basePlacement = placement ? getBasePlacement(placement) : null;
  2305. var variation = placement ? getVariation(placement) : null;
  2306. var commonX = reference.x + reference.width / 2 - element.width / 2;
  2307. var commonY = reference.y + reference.height / 2 - element.height / 2;
  2308. var offsets;
  2309. switch (basePlacement) {
  2310. case top:
  2311. offsets = {
  2312. x: commonX,
  2313. y: reference.y - element.height
  2314. };
  2315. break;
  2316. case bottom:
  2317. offsets = {
  2318. x: commonX,
  2319. y: reference.y + reference.height
  2320. };
  2321. break;
  2322. case right:
  2323. offsets = {
  2324. x: reference.x + reference.width,
  2325. y: commonY
  2326. };
  2327. break;
  2328. case left:
  2329. offsets = {
  2330. x: reference.x - element.width,
  2331. y: commonY
  2332. };
  2333. break;
  2334. default:
  2335. offsets = {
  2336. x: reference.x,
  2337. y: reference.y
  2338. };
  2339. }
  2340. var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
  2341. if (mainAxis != null) {
  2342. var len = mainAxis === 'y' ? 'height' : 'width';
  2343. switch (variation) {
  2344. case start:
  2345. offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
  2346. break;
  2347. case end:
  2348. offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
  2349. break;
  2350. }
  2351. }
  2352. return offsets;
  2353. }
  2354. function detectOverflow(state, options) {
  2355. if (options === void 0) {
  2356. options = {};
  2357. }
  2358. var _options = options,
  2359. _options$placement = _options.placement,
  2360. placement = _options$placement === void 0 ? state.placement : _options$placement,
  2361. _options$strategy = _options.strategy,
  2362. strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
  2363. _options$boundary = _options.boundary,
  2364. boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
  2365. _options$rootBoundary = _options.rootBoundary,
  2366. rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
  2367. _options$elementConte = _options.elementContext,
  2368. elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
  2369. _options$altBoundary = _options.altBoundary,
  2370. altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
  2371. _options$padding = _options.padding,
  2372. padding = _options$padding === void 0 ? 0 : _options$padding;
  2373. var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
  2374. var altContext = elementContext === popper ? reference : popper;
  2375. var popperRect = state.rects.popper;
  2376. var element = state.elements[altBoundary ? altContext : elementContext];
  2377. var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
  2378. var referenceClientRect = getBoundingClientRect(state.elements.reference);
  2379. var popperOffsets = computeOffsets({
  2380. reference: referenceClientRect,
  2381. element: popperRect,
  2382. placement: placement
  2383. });
  2384. var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
  2385. var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
  2386. // 0 or negative = within the clipping rect
  2387. var overflowOffsets = {
  2388. top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
  2389. bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
  2390. left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
  2391. right: elementClientRect.right - clippingClientRect.right + paddingObject.right
  2392. };
  2393. var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
  2394. if (elementContext === popper && offsetData) {
  2395. var offset = offsetData[placement];
  2396. Object.keys(overflowOffsets).forEach(function (key) {
  2397. var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
  2398. var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
  2399. overflowOffsets[key] += offset[axis] * multiply;
  2400. });
  2401. }
  2402. return overflowOffsets;
  2403. }
  2404. function computeAutoPlacement(state, options) {
  2405. if (options === void 0) {
  2406. options = {};
  2407. }
  2408. var _options = options,
  2409. placement = _options.placement,
  2410. boundary = _options.boundary,
  2411. rootBoundary = _options.rootBoundary,
  2412. padding = _options.padding,
  2413. flipVariations = _options.flipVariations,
  2414. _options$allowedAutoP = _options.allowedAutoPlacements,
  2415. allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
  2416. var variation = getVariation(placement);
  2417. var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
  2418. return getVariation(placement) === variation;
  2419. }) : basePlacements;
  2420. var allowedPlacements = placements$1.filter(function (placement) {
  2421. return allowedAutoPlacements.indexOf(placement) >= 0;
  2422. });
  2423. if (allowedPlacements.length === 0) {
  2424. allowedPlacements = placements$1;
  2425. } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
  2426. var overflows = allowedPlacements.reduce(function (acc, placement) {
  2427. acc[placement] = detectOverflow(state, {
  2428. placement: placement,
  2429. boundary: boundary,
  2430. rootBoundary: rootBoundary,
  2431. padding: padding
  2432. })[getBasePlacement(placement)];
  2433. return acc;
  2434. }, {});
  2435. return Object.keys(overflows).sort(function (a, b) {
  2436. return overflows[a] - overflows[b];
  2437. });
  2438. }
  2439. function getExpandedFallbackPlacements(placement) {
  2440. if (getBasePlacement(placement) === auto) {
  2441. return [];
  2442. }
  2443. var oppositePlacement = getOppositePlacement(placement);
  2444. return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
  2445. }
  2446. function flip(_ref) {
  2447. var state = _ref.state,
  2448. options = _ref.options,
  2449. name = _ref.name;
  2450. if (state.modifiersData[name]._skip) {
  2451. return;
  2452. }
  2453. var _options$mainAxis = options.mainAxis,
  2454. checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
  2455. _options$altAxis = options.altAxis,
  2456. checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
  2457. specifiedFallbackPlacements = options.fallbackPlacements,
  2458. padding = options.padding,
  2459. boundary = options.boundary,
  2460. rootBoundary = options.rootBoundary,
  2461. altBoundary = options.altBoundary,
  2462. _options$flipVariatio = options.flipVariations,
  2463. flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
  2464. allowedAutoPlacements = options.allowedAutoPlacements;
  2465. var preferredPlacement = state.options.placement;
  2466. var basePlacement = getBasePlacement(preferredPlacement);
  2467. var isBasePlacement = basePlacement === preferredPlacement;
  2468. var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
  2469. var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
  2470. return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
  2471. placement: placement,
  2472. boundary: boundary,
  2473. rootBoundary: rootBoundary,
  2474. padding: padding,
  2475. flipVariations: flipVariations,
  2476. allowedAutoPlacements: allowedAutoPlacements
  2477. }) : placement);
  2478. }, []);
  2479. var referenceRect = state.rects.reference;
  2480. var popperRect = state.rects.popper;
  2481. var checksMap = new Map();
  2482. var makeFallbackChecks = true;
  2483. var firstFittingPlacement = placements[0];
  2484. for (var i = 0; i < placements.length; i++) {
  2485. var placement = placements[i];
  2486. var _basePlacement = getBasePlacement(placement);
  2487. var isStartVariation = getVariation(placement) === start;
  2488. var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
  2489. var len = isVertical ? 'width' : 'height';
  2490. var overflow = detectOverflow(state, {
  2491. placement: placement,
  2492. boundary: boundary,
  2493. rootBoundary: rootBoundary,
  2494. altBoundary: altBoundary,
  2495. padding: padding
  2496. });
  2497. var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
  2498. if (referenceRect[len] > popperRect[len]) {
  2499. mainVariationSide = getOppositePlacement(mainVariationSide);
  2500. }
  2501. var altVariationSide = getOppositePlacement(mainVariationSide);
  2502. var checks = [];
  2503. if (checkMainAxis) {
  2504. checks.push(overflow[_basePlacement] <= 0);
  2505. }
  2506. if (checkAltAxis) {
  2507. checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
  2508. }
  2509. if (checks.every(function (check) {
  2510. return check;
  2511. })) {
  2512. firstFittingPlacement = placement;
  2513. makeFallbackChecks = false;
  2514. break;
  2515. }
  2516. checksMap.set(placement, checks);
  2517. }
  2518. if (makeFallbackChecks) {
  2519. // `2` may be desired in some cases – research later
  2520. var numberOfChecks = flipVariations ? 3 : 1;
  2521. var _loop = function _loop(_i) {
  2522. var fittingPlacement = placements.find(function (placement) {
  2523. var checks = checksMap.get(placement);
  2524. if (checks) {
  2525. return checks.slice(0, _i).every(function (check) {
  2526. return check;
  2527. });
  2528. }
  2529. });
  2530. if (fittingPlacement) {
  2531. firstFittingPlacement = fittingPlacement;
  2532. return "break";
  2533. }
  2534. };
  2535. for (var _i = numberOfChecks; _i > 0; _i--) {
  2536. var _ret = _loop(_i);
  2537. if (_ret === "break") break;
  2538. }
  2539. }
  2540. if (state.placement !== firstFittingPlacement) {
  2541. state.modifiersData[name]._skip = true;
  2542. state.placement = firstFittingPlacement;
  2543. state.reset = true;
  2544. }
  2545. } // eslint-disable-next-line import/no-unused-modules
  2546. const flip$1 = {
  2547. name: 'flip',
  2548. enabled: true,
  2549. phase: 'main',
  2550. fn: flip,
  2551. requiresIfExists: ['offset'],
  2552. data: {
  2553. _skip: false
  2554. }
  2555. };
  2556. function getSideOffsets(overflow, rect, preventedOffsets) {
  2557. if (preventedOffsets === void 0) {
  2558. preventedOffsets = {
  2559. x: 0,
  2560. y: 0
  2561. };
  2562. }
  2563. return {
  2564. top: overflow.top - rect.height - preventedOffsets.y,
  2565. right: overflow.right - rect.width + preventedOffsets.x,
  2566. bottom: overflow.bottom - rect.height + preventedOffsets.y,
  2567. left: overflow.left - rect.width - preventedOffsets.x
  2568. };
  2569. }
  2570. function isAnySideFullyClipped(overflow) {
  2571. return [top, right, bottom, left].some(function (side) {
  2572. return overflow[side] >= 0;
  2573. });
  2574. }
  2575. function hide(_ref) {
  2576. var state = _ref.state,
  2577. name = _ref.name;
  2578. var referenceRect = state.rects.reference;
  2579. var popperRect = state.rects.popper;
  2580. var preventedOffsets = state.modifiersData.preventOverflow;
  2581. var referenceOverflow = detectOverflow(state, {
  2582. elementContext: 'reference'
  2583. });
  2584. var popperAltOverflow = detectOverflow(state, {
  2585. altBoundary: true
  2586. });
  2587. var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
  2588. var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
  2589. var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
  2590. var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
  2591. state.modifiersData[name] = {
  2592. referenceClippingOffsets: referenceClippingOffsets,
  2593. popperEscapeOffsets: popperEscapeOffsets,
  2594. isReferenceHidden: isReferenceHidden,
  2595. hasPopperEscaped: hasPopperEscaped
  2596. };
  2597. state.attributes.popper = Object.assign({}, state.attributes.popper, {
  2598. 'data-popper-reference-hidden': isReferenceHidden,
  2599. 'data-popper-escaped': hasPopperEscaped
  2600. });
  2601. } // eslint-disable-next-line import/no-unused-modules
  2602. const hide$1 = {
  2603. name: 'hide',
  2604. enabled: true,
  2605. phase: 'main',
  2606. requiresIfExists: ['preventOverflow'],
  2607. fn: hide
  2608. };
  2609. function distanceAndSkiddingToXY(placement, rects, offset) {
  2610. var basePlacement = getBasePlacement(placement);
  2611. var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
  2612. var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
  2613. placement: placement
  2614. })) : offset,
  2615. skidding = _ref[0],
  2616. distance = _ref[1];
  2617. skidding = skidding || 0;
  2618. distance = (distance || 0) * invertDistance;
  2619. return [left, right].indexOf(basePlacement) >= 0 ? {
  2620. x: distance,
  2621. y: skidding
  2622. } : {
  2623. x: skidding,
  2624. y: distance
  2625. };
  2626. }
  2627. function offset(_ref2) {
  2628. var state = _ref2.state,
  2629. options = _ref2.options,
  2630. name = _ref2.name;
  2631. var _options$offset = options.offset,
  2632. offset = _options$offset === void 0 ? [0, 0] : _options$offset;
  2633. var data = placements.reduce(function (acc, placement) {
  2634. acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
  2635. return acc;
  2636. }, {});
  2637. var _data$state$placement = data[state.placement],
  2638. x = _data$state$placement.x,
  2639. y = _data$state$placement.y;
  2640. if (state.modifiersData.popperOffsets != null) {
  2641. state.modifiersData.popperOffsets.x += x;
  2642. state.modifiersData.popperOffsets.y += y;
  2643. }
  2644. state.modifiersData[name] = data;
  2645. } // eslint-disable-next-line import/no-unused-modules
  2646. const offset$1 = {
  2647. name: 'offset',
  2648. enabled: true,
  2649. phase: 'main',
  2650. requires: ['popperOffsets'],
  2651. fn: offset
  2652. };
  2653. function popperOffsets(_ref) {
  2654. var state = _ref.state,
  2655. name = _ref.name;
  2656. // Offsets are the actual position the popper needs to have to be
  2657. // properly positioned near its reference element
  2658. // This is the most basic placement, and will be adjusted by
  2659. // the modifiers in the next step
  2660. state.modifiersData[name] = computeOffsets({
  2661. reference: state.rects.reference,
  2662. element: state.rects.popper,
  2663. placement: state.placement
  2664. });
  2665. } // eslint-disable-next-line import/no-unused-modules
  2666. const popperOffsets$1 = {
  2667. name: 'popperOffsets',
  2668. enabled: true,
  2669. phase: 'read',
  2670. fn: popperOffsets,
  2671. data: {}
  2672. };
  2673. function getAltAxis(axis) {
  2674. return axis === 'x' ? 'y' : 'x';
  2675. }
  2676. function preventOverflow(_ref) {
  2677. var state = _ref.state,
  2678. options = _ref.options,
  2679. name = _ref.name;
  2680. var _options$mainAxis = options.mainAxis,
  2681. checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
  2682. _options$altAxis = options.altAxis,
  2683. checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
  2684. boundary = options.boundary,
  2685. rootBoundary = options.rootBoundary,
  2686. altBoundary = options.altBoundary,
  2687. padding = options.padding,
  2688. _options$tether = options.tether,
  2689. tether = _options$tether === void 0 ? true : _options$tether,
  2690. _options$tetherOffset = options.tetherOffset,
  2691. tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
  2692. var overflow = detectOverflow(state, {
  2693. boundary: boundary,
  2694. rootBoundary: rootBoundary,
  2695. padding: padding,
  2696. altBoundary: altBoundary
  2697. });
  2698. var basePlacement = getBasePlacement(state.placement);
  2699. var variation = getVariation(state.placement);
  2700. var isBasePlacement = !variation;
  2701. var mainAxis = getMainAxisFromPlacement(basePlacement);
  2702. var altAxis = getAltAxis(mainAxis);
  2703. var popperOffsets = state.modifiersData.popperOffsets;
  2704. var referenceRect = state.rects.reference;
  2705. var popperRect = state.rects.popper;
  2706. var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
  2707. placement: state.placement
  2708. })) : tetherOffset;
  2709. var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
  2710. mainAxis: tetherOffsetValue,
  2711. altAxis: tetherOffsetValue
  2712. } : Object.assign({
  2713. mainAxis: 0,
  2714. altAxis: 0
  2715. }, tetherOffsetValue);
  2716. var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
  2717. var data = {
  2718. x: 0,
  2719. y: 0
  2720. };
  2721. if (!popperOffsets) {
  2722. return;
  2723. }
  2724. if (checkMainAxis) {
  2725. var _offsetModifierState$;
  2726. var mainSide = mainAxis === 'y' ? top : left;
  2727. var altSide = mainAxis === 'y' ? bottom : right;
  2728. var len = mainAxis === 'y' ? 'height' : 'width';
  2729. var offset = popperOffsets[mainAxis];
  2730. var min$1 = offset + overflow[mainSide];
  2731. var max$1 = offset - overflow[altSide];
  2732. var additive = tether ? -popperRect[len] / 2 : 0;
  2733. var minLen = variation === start ? referenceRect[len] : popperRect[len];
  2734. var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
  2735. // outside the reference bounds
  2736. var arrowElement = state.elements.arrow;
  2737. var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
  2738. width: 0,
  2739. height: 0
  2740. };
  2741. var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
  2742. var arrowPaddingMin = arrowPaddingObject[mainSide];
  2743. var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
  2744. // to include its full size in the calculation. If the reference is small
  2745. // and near the edge of a boundary, the popper can overflow even if the
  2746. // reference is not overflowing as well (e.g. virtual elements with no
  2747. // width or height)
  2748. var arrowLen = within(0, referenceRect[len], arrowRect[len]);
  2749. var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
  2750. var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
  2751. var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
  2752. var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
  2753. var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
  2754. var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
  2755. var tetherMax = offset + maxOffset - offsetModifierValue;
  2756. var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
  2757. popperOffsets[mainAxis] = preventedOffset;
  2758. data[mainAxis] = preventedOffset - offset;
  2759. }
  2760. if (checkAltAxis) {
  2761. var _offsetModifierState$2;
  2762. var _mainSide = mainAxis === 'x' ? top : left;
  2763. var _altSide = mainAxis === 'x' ? bottom : right;
  2764. var _offset = popperOffsets[altAxis];
  2765. var _len = altAxis === 'y' ? 'height' : 'width';
  2766. var _min = _offset + overflow[_mainSide];
  2767. var _max = _offset - overflow[_altSide];
  2768. var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
  2769. var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
  2770. var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
  2771. var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
  2772. var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
  2773. popperOffsets[altAxis] = _preventedOffset;
  2774. data[altAxis] = _preventedOffset - _offset;
  2775. }
  2776. state.modifiersData[name] = data;
  2777. } // eslint-disable-next-line import/no-unused-modules
  2778. const preventOverflow$1 = {
  2779. name: 'preventOverflow',
  2780. enabled: true,
  2781. phase: 'main',
  2782. fn: preventOverflow,
  2783. requiresIfExists: ['offset']
  2784. };
  2785. function getHTMLElementScroll(element) {
  2786. return {
  2787. scrollLeft: element.scrollLeft,
  2788. scrollTop: element.scrollTop
  2789. };
  2790. }
  2791. function getNodeScroll(node) {
  2792. if (node === getWindow(node) || !isHTMLElement(node)) {
  2793. return getWindowScroll(node);
  2794. } else {
  2795. return getHTMLElementScroll(node);
  2796. }
  2797. }
  2798. function isElementScaled(element) {
  2799. var rect = element.getBoundingClientRect();
  2800. var scaleX = round(rect.width) / element.offsetWidth || 1;
  2801. var scaleY = round(rect.height) / element.offsetHeight || 1;
  2802. return scaleX !== 1 || scaleY !== 1;
  2803. } // Returns the composite rect of an element relative to its offsetParent.
  2804. // Composite means it takes into account transforms as well as layout.
  2805. function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
  2806. if (isFixed === void 0) {
  2807. isFixed = false;
  2808. }
  2809. var isOffsetParentAnElement = isHTMLElement(offsetParent);
  2810. var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
  2811. var documentElement = getDocumentElement(offsetParent);
  2812. var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
  2813. var scroll = {
  2814. scrollLeft: 0,
  2815. scrollTop: 0
  2816. };
  2817. var offsets = {
  2818. x: 0,
  2819. y: 0
  2820. };
  2821. if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
  2822. if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
  2823. isScrollParent(documentElement)) {
  2824. scroll = getNodeScroll(offsetParent);
  2825. }
  2826. if (isHTMLElement(offsetParent)) {
  2827. offsets = getBoundingClientRect(offsetParent, true);
  2828. offsets.x += offsetParent.clientLeft;
  2829. offsets.y += offsetParent.clientTop;
  2830. } else if (documentElement) {
  2831. offsets.x = getWindowScrollBarX(documentElement);
  2832. }
  2833. }
  2834. return {
  2835. x: rect.left + scroll.scrollLeft - offsets.x,
  2836. y: rect.top + scroll.scrollTop - offsets.y,
  2837. width: rect.width,
  2838. height: rect.height
  2839. };
  2840. }
  2841. function order(modifiers) {
  2842. var map = new Map();
  2843. var visited = new Set();
  2844. var result = [];
  2845. modifiers.forEach(function (modifier) {
  2846. map.set(modifier.name, modifier);
  2847. }); // On visiting object, check for its dependencies and visit them recursively
  2848. function sort(modifier) {
  2849. visited.add(modifier.name);
  2850. var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
  2851. requires.forEach(function (dep) {
  2852. if (!visited.has(dep)) {
  2853. var depModifier = map.get(dep);
  2854. if (depModifier) {
  2855. sort(depModifier);
  2856. }
  2857. }
  2858. });
  2859. result.push(modifier);
  2860. }
  2861. modifiers.forEach(function (modifier) {
  2862. if (!visited.has(modifier.name)) {
  2863. // check for visited object
  2864. sort(modifier);
  2865. }
  2866. });
  2867. return result;
  2868. }
  2869. function orderModifiers(modifiers) {
  2870. // order based on dependencies
  2871. var orderedModifiers = order(modifiers); // order based on phase
  2872. return modifierPhases.reduce(function (acc, phase) {
  2873. return acc.concat(orderedModifiers.filter(function (modifier) {
  2874. return modifier.phase === phase;
  2875. }));
  2876. }, []);
  2877. }
  2878. function debounce(fn) {
  2879. var pending;
  2880. return function () {
  2881. if (!pending) {
  2882. pending = new Promise(function (resolve) {
  2883. Promise.resolve().then(function () {
  2884. pending = undefined;
  2885. resolve(fn());
  2886. });
  2887. });
  2888. }
  2889. return pending;
  2890. };
  2891. }
  2892. function mergeByName(modifiers) {
  2893. var merged = modifiers.reduce(function (merged, current) {
  2894. var existing = merged[current.name];
  2895. merged[current.name] = existing ? Object.assign({}, existing, current, {
  2896. options: Object.assign({}, existing.options, current.options),
  2897. data: Object.assign({}, existing.data, current.data)
  2898. }) : current;
  2899. return merged;
  2900. }, {}); // IE11 does not support Object.values
  2901. return Object.keys(merged).map(function (key) {
  2902. return merged[key];
  2903. });
  2904. }
  2905. var DEFAULT_OPTIONS = {
  2906. placement: 'bottom',
  2907. modifiers: [],
  2908. strategy: 'absolute'
  2909. };
  2910. function areValidElements() {
  2911. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  2912. args[_key] = arguments[_key];
  2913. }
  2914. return !args.some(function (element) {
  2915. return !(element && typeof element.getBoundingClientRect === 'function');
  2916. });
  2917. }
  2918. function popperGenerator(generatorOptions) {
  2919. if (generatorOptions === void 0) {
  2920. generatorOptions = {};
  2921. }
  2922. var _generatorOptions = generatorOptions,
  2923. _generatorOptions$def = _generatorOptions.defaultModifiers,
  2924. defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
  2925. _generatorOptions$def2 = _generatorOptions.defaultOptions,
  2926. defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
  2927. return function createPopper(reference, popper, options) {
  2928. if (options === void 0) {
  2929. options = defaultOptions;
  2930. }
  2931. var state = {
  2932. placement: 'bottom',
  2933. orderedModifiers: [],
  2934. options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
  2935. modifiersData: {},
  2936. elements: {
  2937. reference: reference,
  2938. popper: popper
  2939. },
  2940. attributes: {},
  2941. styles: {}
  2942. };
  2943. var effectCleanupFns = [];
  2944. var isDestroyed = false;
  2945. var instance = {
  2946. state: state,
  2947. setOptions: function setOptions(setOptionsAction) {
  2948. var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
  2949. cleanupModifierEffects();
  2950. state.options = Object.assign({}, defaultOptions, state.options, options);
  2951. state.scrollParents = {
  2952. reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
  2953. popper: listScrollParents(popper)
  2954. }; // Orders the modifiers based on their dependencies and `phase`
  2955. // properties
  2956. var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
  2957. state.orderedModifiers = orderedModifiers.filter(function (m) {
  2958. return m.enabled;
  2959. });
  2960. runModifierEffects();
  2961. return instance.update();
  2962. },
  2963. // Sync update – it will always be executed, even if not necessary. This
  2964. // is useful for low frequency updates where sync behavior simplifies the
  2965. // logic.
  2966. // For high frequency updates (e.g. `resize` and `scroll` events), always
  2967. // prefer the async Popper#update method
  2968. forceUpdate: function forceUpdate() {
  2969. if (isDestroyed) {
  2970. return;
  2971. }
  2972. var _state$elements = state.elements,
  2973. reference = _state$elements.reference,
  2974. popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
  2975. // anymore
  2976. if (!areValidElements(reference, popper)) {
  2977. return;
  2978. } // Store the reference and popper rects to be read by modifiers
  2979. state.rects = {
  2980. reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
  2981. popper: getLayoutRect(popper)
  2982. }; // Modifiers have the ability to reset the current update cycle. The
  2983. // most common use case for this is the `flip` modifier changing the
  2984. // placement, which then needs to re-run all the modifiers, because the
  2985. // logic was previously ran for the previous placement and is therefore
  2986. // stale/incorrect
  2987. state.reset = false;
  2988. state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
  2989. // is filled with the initial data specified by the modifier. This means
  2990. // it doesn't persist and is fresh on each update.
  2991. // To ensure persistent data, use `${name}#persistent`
  2992. state.orderedModifiers.forEach(function (modifier) {
  2993. return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
  2994. });
  2995. for (var index = 0; index < state.orderedModifiers.length; index++) {
  2996. if (state.reset === true) {
  2997. state.reset = false;
  2998. index = -1;
  2999. continue;
  3000. }
  3001. var _state$orderedModifie = state.orderedModifiers[index],
  3002. fn = _state$orderedModifie.fn,
  3003. _state$orderedModifie2 = _state$orderedModifie.options,
  3004. _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
  3005. name = _state$orderedModifie.name;
  3006. if (typeof fn === 'function') {
  3007. state = fn({
  3008. state: state,
  3009. options: _options,
  3010. name: name,
  3011. instance: instance
  3012. }) || state;
  3013. }
  3014. }
  3015. },
  3016. // Async and optimistically optimized update – it will not be executed if
  3017. // not necessary (debounced to run at most once-per-tick)
  3018. update: debounce(function () {
  3019. return new Promise(function (resolve) {
  3020. instance.forceUpdate();
  3021. resolve(state);
  3022. });
  3023. }),
  3024. destroy: function destroy() {
  3025. cleanupModifierEffects();
  3026. isDestroyed = true;
  3027. }
  3028. };
  3029. if (!areValidElements(reference, popper)) {
  3030. return instance;
  3031. }
  3032. instance.setOptions(options).then(function (state) {
  3033. if (!isDestroyed && options.onFirstUpdate) {
  3034. options.onFirstUpdate(state);
  3035. }
  3036. }); // Modifiers have the ability to execute arbitrary code before the first
  3037. // update cycle runs. They will be executed in the same order as the update
  3038. // cycle. This is useful when a modifier adds some persistent data that
  3039. // other modifiers need to use, but the modifier is run after the dependent
  3040. // one.
  3041. function runModifierEffects() {
  3042. state.orderedModifiers.forEach(function (_ref) {
  3043. var name = _ref.name,
  3044. _ref$options = _ref.options,
  3045. options = _ref$options === void 0 ? {} : _ref$options,
  3046. effect = _ref.effect;
  3047. if (typeof effect === 'function') {
  3048. var cleanupFn = effect({
  3049. state: state,
  3050. name: name,
  3051. instance: instance,
  3052. options: options
  3053. });
  3054. var noopFn = function noopFn() {};
  3055. effectCleanupFns.push(cleanupFn || noopFn);
  3056. }
  3057. });
  3058. }
  3059. function cleanupModifierEffects() {
  3060. effectCleanupFns.forEach(function (fn) {
  3061. return fn();
  3062. });
  3063. effectCleanupFns = [];
  3064. }
  3065. return instance;
  3066. };
  3067. }
  3068. var createPopper$2 = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules
  3069. var defaultModifiers$1 = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1];
  3070. var createPopper$1 = /*#__PURE__*/popperGenerator({
  3071. defaultModifiers: defaultModifiers$1
  3072. }); // eslint-disable-next-line import/no-unused-modules
  3073. var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
  3074. var createPopper = /*#__PURE__*/popperGenerator({
  3075. defaultModifiers: defaultModifiers
  3076. }); // eslint-disable-next-line import/no-unused-modules
  3077. const Popper = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
  3078. __proto__: null,
  3079. afterMain,
  3080. afterRead,
  3081. afterWrite,
  3082. applyStyles: applyStyles$1,
  3083. arrow: arrow$1,
  3084. auto,
  3085. basePlacements,
  3086. beforeMain,
  3087. beforeRead,
  3088. beforeWrite,
  3089. bottom,
  3090. clippingParents,
  3091. computeStyles: computeStyles$1,
  3092. createPopper,
  3093. createPopperBase: createPopper$2,
  3094. createPopperLite: createPopper$1,
  3095. detectOverflow,
  3096. end,
  3097. eventListeners,
  3098. flip: flip$1,
  3099. hide: hide$1,
  3100. left,
  3101. main,
  3102. modifierPhases,
  3103. offset: offset$1,
  3104. placements,
  3105. popper,
  3106. popperGenerator,
  3107. popperOffsets: popperOffsets$1,
  3108. preventOverflow: preventOverflow$1,
  3109. read,
  3110. reference,
  3111. right,
  3112. start,
  3113. top,
  3114. variationPlacements,
  3115. viewport,
  3116. write
  3117. }, Symbol.toStringTag, { value: 'Module' }));
  3118. /**
  3119. * --------------------------------------------------------------------------
  3120. * Bootstrap dropdown.js
  3121. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3122. * --------------------------------------------------------------------------
  3123. */
  3124. /**
  3125. * Constants
  3126. */
  3127. const NAME$a = 'dropdown';
  3128. const DATA_KEY$6 = 'bs.dropdown';
  3129. const EVENT_KEY$6 = `.${DATA_KEY$6}`;
  3130. const DATA_API_KEY$3 = '.data-api';
  3131. const ESCAPE_KEY$2 = 'Escape';
  3132. const TAB_KEY$1 = 'Tab';
  3133. const ARROW_UP_KEY$1 = 'ArrowUp';
  3134. const ARROW_DOWN_KEY$1 = 'ArrowDown';
  3135. const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
  3136. const EVENT_HIDE$5 = `hide${EVENT_KEY$6}`;
  3137. const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$6}`;
  3138. const EVENT_SHOW$5 = `show${EVENT_KEY$6}`;
  3139. const EVENT_SHOWN$5 = `shown${EVENT_KEY$6}`;
  3140. const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
  3141. const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$6}${DATA_API_KEY$3}`;
  3142. const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$6}${DATA_API_KEY$3}`;
  3143. const CLASS_NAME_SHOW$6 = 'show';
  3144. const CLASS_NAME_DROPUP = 'dropup';
  3145. const CLASS_NAME_DROPEND = 'dropend';
  3146. const CLASS_NAME_DROPSTART = 'dropstart';
  3147. const CLASS_NAME_DROPUP_CENTER = 'dropup-center';
  3148. const CLASS_NAME_DROPDOWN_CENTER = 'dropdown-center';
  3149. const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)';
  3150. const SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE$3}.${CLASS_NAME_SHOW$6}`;
  3151. const SELECTOR_MENU = '.dropdown-menu';
  3152. const SELECTOR_NAVBAR = '.navbar';
  3153. const SELECTOR_NAVBAR_NAV = '.navbar-nav';
  3154. const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
  3155. const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start';
  3156. const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end';
  3157. const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start';
  3158. const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
  3159. const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
  3160. const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
  3161. const PLACEMENT_TOPCENTER = 'top';
  3162. const PLACEMENT_BOTTOMCENTER = 'bottom';
  3163. const Default$9 = {
  3164. autoClose: true,
  3165. boundary: 'clippingParents',
  3166. display: 'dynamic',
  3167. offset: [0, 2],
  3168. popperConfig: null,
  3169. reference: 'toggle'
  3170. };
  3171. const DefaultType$9 = {
  3172. autoClose: '(boolean|string)',
  3173. boundary: '(string|element)',
  3174. display: 'string',
  3175. offset: '(array|string|function)',
  3176. popperConfig: '(null|object|function)',
  3177. reference: '(string|element|object)'
  3178. };
  3179. /**
  3180. * Class definition
  3181. */
  3182. class Dropdown extends BaseComponent {
  3183. constructor(element, config) {
  3184. super(element, config);
  3185. this._popper = null;
  3186. this._parent = this._element.parentNode; // dropdown wrapper
  3187. // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
  3188. this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0] || SelectorEngine.findOne(SELECTOR_MENU, this._parent);
  3189. this._inNavbar = this._detectNavbar();
  3190. }
  3191. // Getters
  3192. static get Default() {
  3193. return Default$9;
  3194. }
  3195. static get DefaultType() {
  3196. return DefaultType$9;
  3197. }
  3198. static get NAME() {
  3199. return NAME$a;
  3200. }
  3201. // Public
  3202. toggle() {
  3203. return this._isShown() ? this.hide() : this.show();
  3204. }
  3205. show() {
  3206. if (isDisabled(this._element) || this._isShown()) {
  3207. return;
  3208. }
  3209. const relatedTarget = {
  3210. relatedTarget: this._element
  3211. };
  3212. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$5, relatedTarget);
  3213. if (showEvent.defaultPrevented) {
  3214. return;
  3215. }
  3216. this._createPopper();
  3217. // If this is a touch-enabled device we add extra
  3218. // empty mouseover listeners to the body's immediate children;
  3219. // only needed because of broken event delegation on iOS
  3220. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3221. if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {
  3222. for (const element of [].concat(...document.body.children)) {
  3223. EventHandler.on(element, 'mouseover', noop);
  3224. }
  3225. }
  3226. this._element.focus();
  3227. this._element.setAttribute('aria-expanded', true);
  3228. this._menu.classList.add(CLASS_NAME_SHOW$6);
  3229. this._element.classList.add(CLASS_NAME_SHOW$6);
  3230. EventHandler.trigger(this._element, EVENT_SHOWN$5, relatedTarget);
  3231. }
  3232. hide() {
  3233. if (isDisabled(this._element) || !this._isShown()) {
  3234. return;
  3235. }
  3236. const relatedTarget = {
  3237. relatedTarget: this._element
  3238. };
  3239. this._completeHide(relatedTarget);
  3240. }
  3241. dispose() {
  3242. if (this._popper) {
  3243. this._popper.destroy();
  3244. }
  3245. super.dispose();
  3246. }
  3247. update() {
  3248. this._inNavbar = this._detectNavbar();
  3249. if (this._popper) {
  3250. this._popper.update();
  3251. }
  3252. }
  3253. // Private
  3254. _completeHide(relatedTarget) {
  3255. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$5, relatedTarget);
  3256. if (hideEvent.defaultPrevented) {
  3257. return;
  3258. }
  3259. // If this is a touch-enabled device we remove the extra
  3260. // empty mouseover listeners we added for iOS support
  3261. if ('ontouchstart' in document.documentElement) {
  3262. for (const element of [].concat(...document.body.children)) {
  3263. EventHandler.off(element, 'mouseover', noop);
  3264. }
  3265. }
  3266. if (this._popper) {
  3267. this._popper.destroy();
  3268. }
  3269. this._menu.classList.remove(CLASS_NAME_SHOW$6);
  3270. this._element.classList.remove(CLASS_NAME_SHOW$6);
  3271. this._element.setAttribute('aria-expanded', 'false');
  3272. Manipulator.removeDataAttribute(this._menu, 'popper');
  3273. EventHandler.trigger(this._element, EVENT_HIDDEN$5, relatedTarget);
  3274. }
  3275. _getConfig(config) {
  3276. config = super._getConfig(config);
  3277. if (typeof config.reference === 'object' && !isElement$1(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
  3278. // Popper virtual elements require a getBoundingClientRect method
  3279. throw new TypeError(`${NAME$a.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
  3280. }
  3281. return config;
  3282. }
  3283. _createPopper() {
  3284. if (typeof Popper === 'undefined') {
  3285. throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org/docs/v2/)');
  3286. }
  3287. let referenceElement = this._element;
  3288. if (this._config.reference === 'parent') {
  3289. referenceElement = this._parent;
  3290. } else if (isElement$1(this._config.reference)) {
  3291. referenceElement = getElement(this._config.reference);
  3292. } else if (typeof this._config.reference === 'object') {
  3293. referenceElement = this._config.reference;
  3294. }
  3295. const popperConfig = this._getPopperConfig();
  3296. this._popper = createPopper(referenceElement, this._menu, popperConfig);
  3297. }
  3298. _isShown() {
  3299. return this._menu.classList.contains(CLASS_NAME_SHOW$6);
  3300. }
  3301. _getPlacement() {
  3302. const parentDropdown = this._parent;
  3303. if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
  3304. return PLACEMENT_RIGHT;
  3305. }
  3306. if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
  3307. return PLACEMENT_LEFT;
  3308. }
  3309. if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) {
  3310. return PLACEMENT_TOPCENTER;
  3311. }
  3312. if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) {
  3313. return PLACEMENT_BOTTOMCENTER;
  3314. }
  3315. // We need to trim the value because custom properties can also include spaces
  3316. const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
  3317. if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
  3318. return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
  3319. }
  3320. return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
  3321. }
  3322. _detectNavbar() {
  3323. return this._element.closest(SELECTOR_NAVBAR) !== null;
  3324. }
  3325. _getOffset() {
  3326. const {
  3327. offset
  3328. } = this._config;
  3329. if (typeof offset === 'string') {
  3330. return offset.split(',').map(value => Number.parseInt(value, 10));
  3331. }
  3332. if (typeof offset === 'function') {
  3333. return popperData => offset(popperData, this._element);
  3334. }
  3335. return offset;
  3336. }
  3337. _getPopperConfig() {
  3338. const defaultBsPopperConfig = {
  3339. placement: this._getPlacement(),
  3340. modifiers: [{
  3341. name: 'preventOverflow',
  3342. options: {
  3343. boundary: this._config.boundary
  3344. }
  3345. }, {
  3346. name: 'offset',
  3347. options: {
  3348. offset: this._getOffset()
  3349. }
  3350. }]
  3351. };
  3352. // Disable Popper if we have a static display or Dropdown is in Navbar
  3353. if (this._inNavbar || this._config.display === 'static') {
  3354. Manipulator.setDataAttribute(this._menu, 'popper', 'static'); // TODO: v6 remove
  3355. defaultBsPopperConfig.modifiers = [{
  3356. name: 'applyStyles',
  3357. enabled: false
  3358. }];
  3359. }
  3360. return {
  3361. ...defaultBsPopperConfig,
  3362. ...execute(this._config.popperConfig, [undefined, defaultBsPopperConfig])
  3363. };
  3364. }
  3365. _selectMenuItem({
  3366. key,
  3367. target
  3368. }) {
  3369. const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => isVisible(element));
  3370. if (!items.length) {
  3371. return;
  3372. }
  3373. // if target isn't included in items (e.g. when expanding the dropdown)
  3374. // allow cycling to get the last item in case key equals ARROW_UP_KEY
  3375. getNextActiveElement(items, target, key === ARROW_DOWN_KEY$1, !items.includes(target)).focus();
  3376. }
  3377. // Static
  3378. static jQueryInterface(config) {
  3379. return this.each(function () {
  3380. const data = Dropdown.getOrCreateInstance(this, config);
  3381. if (typeof config !== 'string') {
  3382. return;
  3383. }
  3384. if (typeof data[config] === 'undefined') {
  3385. throw new TypeError(`No method named "${config}"`);
  3386. }
  3387. data[config]();
  3388. });
  3389. }
  3390. static clearMenus(event) {
  3391. if (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY$1) {
  3392. return;
  3393. }
  3394. const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN);
  3395. for (const toggle of openToggles) {
  3396. const context = Dropdown.getInstance(toggle);
  3397. if (!context || context._config.autoClose === false) {
  3398. continue;
  3399. }
  3400. const composedPath = event.composedPath();
  3401. const isMenuTarget = composedPath.includes(context._menu);
  3402. if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
  3403. continue;
  3404. }
  3405. // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
  3406. if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY$1 || /input|select|option|textarea|form/i.test(event.target.tagName))) {
  3407. continue;
  3408. }
  3409. const relatedTarget = {
  3410. relatedTarget: context._element
  3411. };
  3412. if (event.type === 'click') {
  3413. relatedTarget.clickEvent = event;
  3414. }
  3415. context._completeHide(relatedTarget);
  3416. }
  3417. }
  3418. static dataApiKeydownHandler(event) {
  3419. // If not an UP | DOWN | ESCAPE key => not a dropdown command
  3420. // If input/textarea && if key is other than ESCAPE => not a dropdown command
  3421. const isInput = /input|textarea/i.test(event.target.tagName);
  3422. const isEscapeEvent = event.key === ESCAPE_KEY$2;
  3423. const isUpOrDownEvent = [ARROW_UP_KEY$1, ARROW_DOWN_KEY$1].includes(event.key);
  3424. if (!isUpOrDownEvent && !isEscapeEvent) {
  3425. return;
  3426. }
  3427. if (isInput && !isEscapeEvent) {
  3428. return;
  3429. }
  3430. event.preventDefault();
  3431. // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/
  3432. const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.next(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$3, event.delegateTarget.parentNode);
  3433. const instance = Dropdown.getOrCreateInstance(getToggleButton);
  3434. if (isUpOrDownEvent) {
  3435. event.stopPropagation();
  3436. instance.show();
  3437. instance._selectMenuItem(event);
  3438. return;
  3439. }
  3440. if (instance._isShown()) {
  3441. // else is escape and we check if it is shown
  3442. event.stopPropagation();
  3443. instance.hide();
  3444. getToggleButton.focus();
  3445. }
  3446. }
  3447. }
  3448. /**
  3449. * Data API implementation
  3450. */
  3451. EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler);
  3452. EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
  3453. EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus);
  3454. EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
  3455. EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) {
  3456. event.preventDefault();
  3457. Dropdown.getOrCreateInstance(this).toggle();
  3458. });
  3459. /**
  3460. * jQuery
  3461. */
  3462. defineJQueryPlugin(Dropdown);
  3463. /**
  3464. * --------------------------------------------------------------------------
  3465. * Bootstrap util/backdrop.js
  3466. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3467. * --------------------------------------------------------------------------
  3468. */
  3469. /**
  3470. * Constants
  3471. */
  3472. const NAME$9 = 'backdrop';
  3473. const CLASS_NAME_FADE$4 = 'fade';
  3474. const CLASS_NAME_SHOW$5 = 'show';
  3475. const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`;
  3476. const Default$8 = {
  3477. className: 'modal-backdrop',
  3478. clickCallback: null,
  3479. isAnimated: false,
  3480. isVisible: true,
  3481. // if false, we use the backdrop helper without adding any element to the dom
  3482. rootElement: 'body' // give the choice to place backdrop under different elements
  3483. };
  3484. const DefaultType$8 = {
  3485. className: 'string',
  3486. clickCallback: '(function|null)',
  3487. isAnimated: 'boolean',
  3488. isVisible: 'boolean',
  3489. rootElement: '(element|string)'
  3490. };
  3491. /**
  3492. * Class definition
  3493. */
  3494. class Backdrop extends Config {
  3495. constructor(config) {
  3496. super();
  3497. this._config = this._getConfig(config);
  3498. this._isAppended = false;
  3499. this._element = null;
  3500. }
  3501. // Getters
  3502. static get Default() {
  3503. return Default$8;
  3504. }
  3505. static get DefaultType() {
  3506. return DefaultType$8;
  3507. }
  3508. static get NAME() {
  3509. return NAME$9;
  3510. }
  3511. // Public
  3512. show(callback) {
  3513. if (!this._config.isVisible) {
  3514. execute(callback);
  3515. return;
  3516. }
  3517. this._append();
  3518. const element = this._getElement();
  3519. if (this._config.isAnimated) {
  3520. reflow(element);
  3521. }
  3522. element.classList.add(CLASS_NAME_SHOW$5);
  3523. this._emulateAnimation(() => {
  3524. execute(callback);
  3525. });
  3526. }
  3527. hide(callback) {
  3528. if (!this._config.isVisible) {
  3529. execute(callback);
  3530. return;
  3531. }
  3532. this._getElement().classList.remove(CLASS_NAME_SHOW$5);
  3533. this._emulateAnimation(() => {
  3534. this.dispose();
  3535. execute(callback);
  3536. });
  3537. }
  3538. dispose() {
  3539. if (!this._isAppended) {
  3540. return;
  3541. }
  3542. EventHandler.off(this._element, EVENT_MOUSEDOWN);
  3543. this._element.remove();
  3544. this._isAppended = false;
  3545. }
  3546. // Private
  3547. _getElement() {
  3548. if (!this._element) {
  3549. const backdrop = document.createElement('div');
  3550. backdrop.className = this._config.className;
  3551. if (this._config.isAnimated) {
  3552. backdrop.classList.add(CLASS_NAME_FADE$4);
  3553. }
  3554. this._element = backdrop;
  3555. }
  3556. return this._element;
  3557. }
  3558. _configAfterMerge(config) {
  3559. // use getElement() with the default "body" to get a fresh Element on each instantiation
  3560. config.rootElement = getElement(config.rootElement);
  3561. return config;
  3562. }
  3563. _append() {
  3564. if (this._isAppended) {
  3565. return;
  3566. }
  3567. const element = this._getElement();
  3568. this._config.rootElement.append(element);
  3569. EventHandler.on(element, EVENT_MOUSEDOWN, () => {
  3570. execute(this._config.clickCallback);
  3571. });
  3572. this._isAppended = true;
  3573. }
  3574. _emulateAnimation(callback) {
  3575. executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
  3576. }
  3577. }
  3578. /**
  3579. * --------------------------------------------------------------------------
  3580. * Bootstrap util/focustrap.js
  3581. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3582. * --------------------------------------------------------------------------
  3583. */
  3584. /**
  3585. * Constants
  3586. */
  3587. const NAME$8 = 'focustrap';
  3588. const DATA_KEY$5 = 'bs.focustrap';
  3589. const EVENT_KEY$5 = `.${DATA_KEY$5}`;
  3590. const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$5}`;
  3591. const EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY$5}`;
  3592. const TAB_KEY = 'Tab';
  3593. const TAB_NAV_FORWARD = 'forward';
  3594. const TAB_NAV_BACKWARD = 'backward';
  3595. const Default$7 = {
  3596. autofocus: true,
  3597. trapElement: null // The element to trap focus inside of
  3598. };
  3599. const DefaultType$7 = {
  3600. autofocus: 'boolean',
  3601. trapElement: 'element'
  3602. };
  3603. /**
  3604. * Class definition
  3605. */
  3606. class FocusTrap extends Config {
  3607. constructor(config) {
  3608. super();
  3609. this._config = this._getConfig(config);
  3610. this._isActive = false;
  3611. this._lastTabNavDirection = null;
  3612. }
  3613. // Getters
  3614. static get Default() {
  3615. return Default$7;
  3616. }
  3617. static get DefaultType() {
  3618. return DefaultType$7;
  3619. }
  3620. static get NAME() {
  3621. return NAME$8;
  3622. }
  3623. // Public
  3624. activate() {
  3625. if (this._isActive) {
  3626. return;
  3627. }
  3628. if (this._config.autofocus) {
  3629. this._config.trapElement.focus();
  3630. }
  3631. EventHandler.off(document, EVENT_KEY$5); // guard against infinite focus loop
  3632. EventHandler.on(document, EVENT_FOCUSIN$2, event => this._handleFocusin(event));
  3633. EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event));
  3634. this._isActive = true;
  3635. }
  3636. deactivate() {
  3637. if (!this._isActive) {
  3638. return;
  3639. }
  3640. this._isActive = false;
  3641. EventHandler.off(document, EVENT_KEY$5);
  3642. }
  3643. // Private
  3644. _handleFocusin(event) {
  3645. const {
  3646. trapElement
  3647. } = this._config;
  3648. if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
  3649. return;
  3650. }
  3651. const elements = SelectorEngine.focusableChildren(trapElement);
  3652. if (elements.length === 0) {
  3653. trapElement.focus();
  3654. } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
  3655. elements[elements.length - 1].focus();
  3656. } else {
  3657. elements[0].focus();
  3658. }
  3659. }
  3660. _handleKeydown(event) {
  3661. if (event.key !== TAB_KEY) {
  3662. return;
  3663. }
  3664. this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
  3665. }
  3666. }
  3667. /**
  3668. * --------------------------------------------------------------------------
  3669. * Bootstrap util/scrollBar.js
  3670. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3671. * --------------------------------------------------------------------------
  3672. */
  3673. /**
  3674. * Constants
  3675. */
  3676. const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  3677. const SELECTOR_STICKY_CONTENT = '.sticky-top';
  3678. const PROPERTY_PADDING = 'padding-right';
  3679. const PROPERTY_MARGIN = 'margin-right';
  3680. /**
  3681. * Class definition
  3682. */
  3683. class ScrollBarHelper {
  3684. constructor() {
  3685. this._element = document.body;
  3686. }
  3687. // Public
  3688. getWidth() {
  3689. // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
  3690. const documentWidth = document.documentElement.clientWidth;
  3691. return Math.abs(window.innerWidth - documentWidth);
  3692. }
  3693. hide() {
  3694. const width = this.getWidth();
  3695. this._disableOverFlow();
  3696. // give padding to element to balance the hidden scrollbar width
  3697. this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
  3698. // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
  3699. this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width);
  3700. this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width);
  3701. }
  3702. reset() {
  3703. this._resetElementAttributes(this._element, 'overflow');
  3704. this._resetElementAttributes(this._element, PROPERTY_PADDING);
  3705. this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING);
  3706. this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN);
  3707. }
  3708. isOverflowing() {
  3709. return this.getWidth() > 0;
  3710. }
  3711. // Private
  3712. _disableOverFlow() {
  3713. this._saveInitialAttribute(this._element, 'overflow');
  3714. this._element.style.overflow = 'hidden';
  3715. }
  3716. _setElementAttributes(selector, styleProperty, callback) {
  3717. const scrollbarWidth = this.getWidth();
  3718. const manipulationCallBack = element => {
  3719. if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
  3720. return;
  3721. }
  3722. this._saveInitialAttribute(element, styleProperty);
  3723. const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty);
  3724. element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`);
  3725. };
  3726. this._applyManipulationCallback(selector, manipulationCallBack);
  3727. }
  3728. _saveInitialAttribute(element, styleProperty) {
  3729. const actualValue = element.style.getPropertyValue(styleProperty);
  3730. if (actualValue) {
  3731. Manipulator.setDataAttribute(element, styleProperty, actualValue);
  3732. }
  3733. }
  3734. _resetElementAttributes(selector, styleProperty) {
  3735. const manipulationCallBack = element => {
  3736. const value = Manipulator.getDataAttribute(element, styleProperty);
  3737. // We only want to remove the property if the value is `null`; the value can also be zero
  3738. if (value === null) {
  3739. element.style.removeProperty(styleProperty);
  3740. return;
  3741. }
  3742. Manipulator.removeDataAttribute(element, styleProperty);
  3743. element.style.setProperty(styleProperty, value);
  3744. };
  3745. this._applyManipulationCallback(selector, manipulationCallBack);
  3746. }
  3747. _applyManipulationCallback(selector, callBack) {
  3748. if (isElement$1(selector)) {
  3749. callBack(selector);
  3750. return;
  3751. }
  3752. for (const sel of SelectorEngine.find(selector, this._element)) {
  3753. callBack(sel);
  3754. }
  3755. }
  3756. }
  3757. /**
  3758. * --------------------------------------------------------------------------
  3759. * Bootstrap modal.js
  3760. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3761. * --------------------------------------------------------------------------
  3762. */
  3763. /**
  3764. * Constants
  3765. */
  3766. const NAME$7 = 'modal';
  3767. const DATA_KEY$4 = 'bs.modal';
  3768. const EVENT_KEY$4 = `.${DATA_KEY$4}`;
  3769. const DATA_API_KEY$2 = '.data-api';
  3770. const ESCAPE_KEY$1 = 'Escape';
  3771. const EVENT_HIDE$4 = `hide${EVENT_KEY$4}`;
  3772. const EVENT_HIDE_PREVENTED$1 = `hidePrevented${EVENT_KEY$4}`;
  3773. const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`;
  3774. const EVENT_SHOW$4 = `show${EVENT_KEY$4}`;
  3775. const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`;
  3776. const EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`;
  3777. const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`;
  3778. const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`;
  3779. const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`;
  3780. const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`;
  3781. const CLASS_NAME_OPEN = 'modal-open';
  3782. const CLASS_NAME_FADE$3 = 'fade';
  3783. const CLASS_NAME_SHOW$4 = 'show';
  3784. const CLASS_NAME_STATIC = 'modal-static';
  3785. const OPEN_SELECTOR$1 = '.modal.show';
  3786. const SELECTOR_DIALOG = '.modal-dialog';
  3787. const SELECTOR_MODAL_BODY = '.modal-body';
  3788. const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
  3789. const Default$6 = {
  3790. backdrop: true,
  3791. focus: true,
  3792. keyboard: true
  3793. };
  3794. const DefaultType$6 = {
  3795. backdrop: '(boolean|string)',
  3796. focus: 'boolean',
  3797. keyboard: 'boolean'
  3798. };
  3799. /**
  3800. * Class definition
  3801. */
  3802. class Modal extends BaseComponent {
  3803. constructor(element, config) {
  3804. super(element, config);
  3805. this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
  3806. this._backdrop = this._initializeBackDrop();
  3807. this._focustrap = this._initializeFocusTrap();
  3808. this._isShown = false;
  3809. this._isTransitioning = false;
  3810. this._scrollBar = new ScrollBarHelper();
  3811. this._addEventListeners();
  3812. }
  3813. // Getters
  3814. static get Default() {
  3815. return Default$6;
  3816. }
  3817. static get DefaultType() {
  3818. return DefaultType$6;
  3819. }
  3820. static get NAME() {
  3821. return NAME$7;
  3822. }
  3823. // Public
  3824. toggle(relatedTarget) {
  3825. return this._isShown ? this.hide() : this.show(relatedTarget);
  3826. }
  3827. show(relatedTarget) {
  3828. if (this._isShown || this._isTransitioning) {
  3829. return;
  3830. }
  3831. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, {
  3832. relatedTarget
  3833. });
  3834. if (showEvent.defaultPrevented) {
  3835. return;
  3836. }
  3837. this._isShown = true;
  3838. this._isTransitioning = true;
  3839. this._scrollBar.hide();
  3840. document.body.classList.add(CLASS_NAME_OPEN);
  3841. this._adjustDialog();
  3842. this._backdrop.show(() => this._showElement(relatedTarget));
  3843. }
  3844. hide() {
  3845. if (!this._isShown || this._isTransitioning) {
  3846. return;
  3847. }
  3848. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4);
  3849. if (hideEvent.defaultPrevented) {
  3850. return;
  3851. }
  3852. this._isShown = false;
  3853. this._isTransitioning = true;
  3854. this._focustrap.deactivate();
  3855. this._element.classList.remove(CLASS_NAME_SHOW$4);
  3856. this._queueCallback(() => this._hideModal(), this._element, this._isAnimated());
  3857. }
  3858. dispose() {
  3859. EventHandler.off(window, EVENT_KEY$4);
  3860. EventHandler.off(this._dialog, EVENT_KEY$4);
  3861. this._backdrop.dispose();
  3862. this._focustrap.deactivate();
  3863. super.dispose();
  3864. }
  3865. handleUpdate() {
  3866. this._adjustDialog();
  3867. }
  3868. // Private
  3869. _initializeBackDrop() {
  3870. return new Backdrop({
  3871. isVisible: Boolean(this._config.backdrop),
  3872. // 'static' option will be translated to true, and booleans will keep their value,
  3873. isAnimated: this._isAnimated()
  3874. });
  3875. }
  3876. _initializeFocusTrap() {
  3877. return new FocusTrap({
  3878. trapElement: this._element
  3879. });
  3880. }
  3881. _showElement(relatedTarget) {
  3882. // try to append dynamic modal
  3883. if (!document.body.contains(this._element)) {
  3884. document.body.append(this._element);
  3885. }
  3886. this._element.style.display = 'block';
  3887. this._element.removeAttribute('aria-hidden');
  3888. this._element.setAttribute('aria-modal', true);
  3889. this._element.setAttribute('role', 'dialog');
  3890. this._element.scrollTop = 0;
  3891. const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
  3892. if (modalBody) {
  3893. modalBody.scrollTop = 0;
  3894. }
  3895. reflow(this._element);
  3896. this._element.classList.add(CLASS_NAME_SHOW$4);
  3897. const transitionComplete = () => {
  3898. if (this._config.focus) {
  3899. this._focustrap.activate();
  3900. }
  3901. this._isTransitioning = false;
  3902. EventHandler.trigger(this._element, EVENT_SHOWN$4, {
  3903. relatedTarget
  3904. });
  3905. };
  3906. this._queueCallback(transitionComplete, this._dialog, this._isAnimated());
  3907. }
  3908. _addEventListeners() {
  3909. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
  3910. if (event.key !== ESCAPE_KEY$1) {
  3911. return;
  3912. }
  3913. if (this._config.keyboard) {
  3914. this.hide();
  3915. return;
  3916. }
  3917. this._triggerBackdropTransition();
  3918. });
  3919. EventHandler.on(window, EVENT_RESIZE$1, () => {
  3920. if (this._isShown && !this._isTransitioning) {
  3921. this._adjustDialog();
  3922. }
  3923. });
  3924. EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
  3925. // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks
  3926. EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => {
  3927. if (this._element !== event.target || this._element !== event2.target) {
  3928. return;
  3929. }
  3930. if (this._config.backdrop === 'static') {
  3931. this._triggerBackdropTransition();
  3932. return;
  3933. }
  3934. if (this._config.backdrop) {
  3935. this.hide();
  3936. }
  3937. });
  3938. });
  3939. }
  3940. _hideModal() {
  3941. this._element.style.display = 'none';
  3942. this._element.setAttribute('aria-hidden', true);
  3943. this._element.removeAttribute('aria-modal');
  3944. this._element.removeAttribute('role');
  3945. this._isTransitioning = false;
  3946. this._backdrop.hide(() => {
  3947. document.body.classList.remove(CLASS_NAME_OPEN);
  3948. this._resetAdjustments();
  3949. this._scrollBar.reset();
  3950. EventHandler.trigger(this._element, EVENT_HIDDEN$4);
  3951. });
  3952. }
  3953. _isAnimated() {
  3954. return this._element.classList.contains(CLASS_NAME_FADE$3);
  3955. }
  3956. _triggerBackdropTransition() {
  3957. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1);
  3958. if (hideEvent.defaultPrevented) {
  3959. return;
  3960. }
  3961. const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3962. const initialOverflowY = this._element.style.overflowY;
  3963. // return if the following background transition hasn't yet completed
  3964. if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) {
  3965. return;
  3966. }
  3967. if (!isModalOverflowing) {
  3968. this._element.style.overflowY = 'hidden';
  3969. }
  3970. this._element.classList.add(CLASS_NAME_STATIC);
  3971. this._queueCallback(() => {
  3972. this._element.classList.remove(CLASS_NAME_STATIC);
  3973. this._queueCallback(() => {
  3974. this._element.style.overflowY = initialOverflowY;
  3975. }, this._dialog);
  3976. }, this._dialog);
  3977. this._element.focus();
  3978. }
  3979. /**
  3980. * The following methods are used to handle overflowing modals
  3981. */
  3982. _adjustDialog() {
  3983. const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  3984. const scrollbarWidth = this._scrollBar.getWidth();
  3985. const isBodyOverflowing = scrollbarWidth > 0;
  3986. if (isBodyOverflowing && !isModalOverflowing) {
  3987. const property = isRTL() ? 'paddingLeft' : 'paddingRight';
  3988. this._element.style[property] = `${scrollbarWidth}px`;
  3989. }
  3990. if (!isBodyOverflowing && isModalOverflowing) {
  3991. const property = isRTL() ? 'paddingRight' : 'paddingLeft';
  3992. this._element.style[property] = `${scrollbarWidth}px`;
  3993. }
  3994. }
  3995. _resetAdjustments() {
  3996. this._element.style.paddingLeft = '';
  3997. this._element.style.paddingRight = '';
  3998. }
  3999. // Static
  4000. static jQueryInterface(config, relatedTarget) {
  4001. return this.each(function () {
  4002. const data = Modal.getOrCreateInstance(this, config);
  4003. if (typeof config !== 'string') {
  4004. return;
  4005. }
  4006. if (typeof data[config] === 'undefined') {
  4007. throw new TypeError(`No method named "${config}"`);
  4008. }
  4009. data[config](relatedTarget);
  4010. });
  4011. }
  4012. }
  4013. /**
  4014. * Data API implementation
  4015. */
  4016. EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
  4017. const target = SelectorEngine.getElementFromSelector(this);
  4018. if (['A', 'AREA'].includes(this.tagName)) {
  4019. event.preventDefault();
  4020. }
  4021. EventHandler.one(target, EVENT_SHOW$4, showEvent => {
  4022. if (showEvent.defaultPrevented) {
  4023. // only register focus restorer if modal will actually get shown
  4024. return;
  4025. }
  4026. EventHandler.one(target, EVENT_HIDDEN$4, () => {
  4027. if (isVisible(this)) {
  4028. this.focus();
  4029. }
  4030. });
  4031. });
  4032. // avoid conflict when clicking modal toggler while another one is open
  4033. const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
  4034. if (alreadyOpen) {
  4035. Modal.getInstance(alreadyOpen).hide();
  4036. }
  4037. const data = Modal.getOrCreateInstance(target);
  4038. data.toggle(this);
  4039. });
  4040. enableDismissTrigger(Modal);
  4041. /**
  4042. * jQuery
  4043. */
  4044. defineJQueryPlugin(Modal);
  4045. /**
  4046. * --------------------------------------------------------------------------
  4047. * Bootstrap offcanvas.js
  4048. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  4049. * --------------------------------------------------------------------------
  4050. */
  4051. /**
  4052. * Constants
  4053. */
  4054. const NAME$6 = 'offcanvas';
  4055. const DATA_KEY$3 = 'bs.offcanvas';
  4056. const EVENT_KEY$3 = `.${DATA_KEY$3}`;
  4057. const DATA_API_KEY$1 = '.data-api';
  4058. const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`;
  4059. const ESCAPE_KEY = 'Escape';
  4060. const CLASS_NAME_SHOW$3 = 'show';
  4061. const CLASS_NAME_SHOWING$1 = 'showing';
  4062. const CLASS_NAME_HIDING = 'hiding';
  4063. const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
  4064. const OPEN_SELECTOR = '.offcanvas.show';
  4065. const EVENT_SHOW$3 = `show${EVENT_KEY$3}`;
  4066. const EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`;
  4067. const EVENT_HIDE$3 = `hide${EVENT_KEY$3}`;
  4068. const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`;
  4069. const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`;
  4070. const EVENT_RESIZE = `resize${EVENT_KEY$3}`;
  4071. const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`;
  4072. const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`;
  4073. const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
  4074. const Default$5 = {
  4075. backdrop: true,
  4076. keyboard: true,
  4077. scroll: false
  4078. };
  4079. const DefaultType$5 = {
  4080. backdrop: '(boolean|string)',
  4081. keyboard: 'boolean',
  4082. scroll: 'boolean'
  4083. };
  4084. /**
  4085. * Class definition
  4086. */
  4087. class Offcanvas extends BaseComponent {
  4088. constructor(element, config) {
  4089. super(element, config);
  4090. this._isShown = false;
  4091. this._backdrop = this._initializeBackDrop();
  4092. this._focustrap = this._initializeFocusTrap();
  4093. this._addEventListeners();
  4094. }
  4095. // Getters
  4096. static get Default() {
  4097. return Default$5;
  4098. }
  4099. static get DefaultType() {
  4100. return DefaultType$5;
  4101. }
  4102. static get NAME() {
  4103. return NAME$6;
  4104. }
  4105. // Public
  4106. toggle(relatedTarget) {
  4107. return this._isShown ? this.hide() : this.show(relatedTarget);
  4108. }
  4109. show(relatedTarget) {
  4110. if (this._isShown) {
  4111. return;
  4112. }
  4113. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
  4114. relatedTarget
  4115. });
  4116. if (showEvent.defaultPrevented) {
  4117. return;
  4118. }
  4119. this._isShown = true;
  4120. this._backdrop.show();
  4121. if (!this._config.scroll) {
  4122. new ScrollBarHelper().hide();
  4123. }
  4124. this._element.setAttribute('aria-modal', true);
  4125. this._element.setAttribute('role', 'dialog');
  4126. this._element.classList.add(CLASS_NAME_SHOWING$1);
  4127. const completeCallBack = () => {
  4128. if (!this._config.scroll || this._config.backdrop) {
  4129. this._focustrap.activate();
  4130. }
  4131. this._element.classList.add(CLASS_NAME_SHOW$3);
  4132. this._element.classList.remove(CLASS_NAME_SHOWING$1);
  4133. EventHandler.trigger(this._element, EVENT_SHOWN$3, {
  4134. relatedTarget
  4135. });
  4136. };
  4137. this._queueCallback(completeCallBack, this._element, true);
  4138. }
  4139. hide() {
  4140. if (!this._isShown) {
  4141. return;
  4142. }
  4143. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
  4144. if (hideEvent.defaultPrevented) {
  4145. return;
  4146. }
  4147. this._focustrap.deactivate();
  4148. this._element.blur();
  4149. this._isShown = false;
  4150. this._element.classList.add(CLASS_NAME_HIDING);
  4151. this._backdrop.hide();
  4152. const completeCallback = () => {
  4153. this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING);
  4154. this._element.removeAttribute('aria-modal');
  4155. this._element.removeAttribute('role');
  4156. if (!this._config.scroll) {
  4157. new ScrollBarHelper().reset();
  4158. }
  4159. EventHandler.trigger(this._element, EVENT_HIDDEN$3);
  4160. };
  4161. this._queueCallback(completeCallback, this._element, true);
  4162. }
  4163. dispose() {
  4164. this._backdrop.dispose();
  4165. this._focustrap.deactivate();
  4166. super.dispose();
  4167. }
  4168. // Private
  4169. _initializeBackDrop() {
  4170. const clickCallback = () => {
  4171. if (this._config.backdrop === 'static') {
  4172. EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
  4173. return;
  4174. }
  4175. this.hide();
  4176. };
  4177. // 'static' option will be translated to true, and booleans will keep their value
  4178. const isVisible = Boolean(this._config.backdrop);
  4179. return new Backdrop({
  4180. className: CLASS_NAME_BACKDROP,
  4181. isVisible,
  4182. isAnimated: true,
  4183. rootElement: this._element.parentNode,
  4184. clickCallback: isVisible ? clickCallback : null
  4185. });
  4186. }
  4187. _initializeFocusTrap() {
  4188. return new FocusTrap({
  4189. trapElement: this._element
  4190. });
  4191. }
  4192. _addEventListeners() {
  4193. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
  4194. if (event.key !== ESCAPE_KEY) {
  4195. return;
  4196. }
  4197. if (this._config.keyboard) {
  4198. this.hide();
  4199. return;
  4200. }
  4201. EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
  4202. });
  4203. }
  4204. // Static
  4205. static jQueryInterface(config) {
  4206. return this.each(function () {
  4207. const data = Offcanvas.getOrCreateInstance(this, config);
  4208. if (typeof config !== 'string') {
  4209. return;
  4210. }
  4211. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  4212. throw new TypeError(`No method named "${config}"`);
  4213. }
  4214. data[config](this);
  4215. });
  4216. }
  4217. }
  4218. /**
  4219. * Data API implementation
  4220. */
  4221. EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) {
  4222. const target = SelectorEngine.getElementFromSelector(this);
  4223. if (['A', 'AREA'].includes(this.tagName)) {
  4224. event.preventDefault();
  4225. }
  4226. if (isDisabled(this)) {
  4227. return;
  4228. }
  4229. EventHandler.one(target, EVENT_HIDDEN$3, () => {
  4230. // focus on trigger when it is closed
  4231. if (isVisible(this)) {
  4232. this.focus();
  4233. }
  4234. });
  4235. // avoid conflict when clicking a toggler of an offcanvas, while another is open
  4236. const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
  4237. if (alreadyOpen && alreadyOpen !== target) {
  4238. Offcanvas.getInstance(alreadyOpen).hide();
  4239. }
  4240. const data = Offcanvas.getOrCreateInstance(target);
  4241. data.toggle(this);
  4242. });
  4243. EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
  4244. for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {
  4245. Offcanvas.getOrCreateInstance(selector).show();
  4246. }
  4247. });
  4248. EventHandler.on(window, EVENT_RESIZE, () => {
  4249. for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) {
  4250. if (getComputedStyle(element).position !== 'fixed') {
  4251. Offcanvas.getOrCreateInstance(element).hide();
  4252. }
  4253. }
  4254. });
  4255. enableDismissTrigger(Offcanvas);
  4256. /**
  4257. * jQuery
  4258. */
  4259. defineJQueryPlugin(Offcanvas);
  4260. /**
  4261. * --------------------------------------------------------------------------
  4262. * Bootstrap util/sanitizer.js
  4263. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  4264. * --------------------------------------------------------------------------
  4265. */
  4266. // js-docs-start allow-list
  4267. const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  4268. const DefaultAllowlist = {
  4269. // Global attributes allowed on any supplied element below.
  4270. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  4271. a: ['target', 'href', 'title', 'rel'],
  4272. area: [],
  4273. b: [],
  4274. br: [],
  4275. col: [],
  4276. code: [],
  4277. dd: [],
  4278. div: [],
  4279. dl: [],
  4280. dt: [],
  4281. em: [],
  4282. hr: [],
  4283. h1: [],
  4284. h2: [],
  4285. h3: [],
  4286. h4: [],
  4287. h5: [],
  4288. h6: [],
  4289. i: [],
  4290. img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
  4291. li: [],
  4292. ol: [],
  4293. p: [],
  4294. pre: [],
  4295. s: [],
  4296. small: [],
  4297. span: [],
  4298. sub: [],
  4299. sup: [],
  4300. strong: [],
  4301. u: [],
  4302. ul: []
  4303. };
  4304. // js-docs-end allow-list
  4305. const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
  4306. /**
  4307. * A pattern that recognizes URLs that are safe wrt. XSS in URL navigation
  4308. * contexts.
  4309. *
  4310. * Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L38
  4311. */
  4312. const SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i;
  4313. const allowedAttribute = (attribute, allowedAttributeList) => {
  4314. const attributeName = attribute.nodeName.toLowerCase();
  4315. if (allowedAttributeList.includes(attributeName)) {
  4316. if (uriAttributes.has(attributeName)) {
  4317. return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue));
  4318. }
  4319. return true;
  4320. }
  4321. // Check if a regular expression validates the attribute.
  4322. return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName));
  4323. };
  4324. function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
  4325. if (!unsafeHtml.length) {
  4326. return unsafeHtml;
  4327. }
  4328. if (sanitizeFunction && typeof sanitizeFunction === 'function') {
  4329. return sanitizeFunction(unsafeHtml);
  4330. }
  4331. const domParser = new window.DOMParser();
  4332. const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  4333. const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
  4334. for (const element of elements) {
  4335. const elementName = element.nodeName.toLowerCase();
  4336. if (!Object.keys(allowList).includes(elementName)) {
  4337. element.remove();
  4338. continue;
  4339. }
  4340. const attributeList = [].concat(...element.attributes);
  4341. const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
  4342. for (const attribute of attributeList) {
  4343. if (!allowedAttribute(attribute, allowedAttributes)) {
  4344. element.removeAttribute(attribute.nodeName);
  4345. }
  4346. }
  4347. }
  4348. return createdDocument.body.innerHTML;
  4349. }
  4350. /**
  4351. * --------------------------------------------------------------------------
  4352. * Bootstrap util/template-factory.js
  4353. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  4354. * --------------------------------------------------------------------------
  4355. */
  4356. /**
  4357. * Constants
  4358. */
  4359. const NAME$5 = 'TemplateFactory';
  4360. const Default$4 = {
  4361. allowList: DefaultAllowlist,
  4362. content: {},
  4363. // { selector : text , selector2 : text2 , }
  4364. extraClass: '',
  4365. html: false,
  4366. sanitize: true,
  4367. sanitizeFn: null,
  4368. template: '<div></div>'
  4369. };
  4370. const DefaultType$4 = {
  4371. allowList: 'object',
  4372. content: 'object',
  4373. extraClass: '(string|function)',
  4374. html: 'boolean',
  4375. sanitize: 'boolean',
  4376. sanitizeFn: '(null|function)',
  4377. template: 'string'
  4378. };
  4379. const DefaultContentType = {
  4380. entry: '(string|element|function|null)',
  4381. selector: '(string|element)'
  4382. };
  4383. /**
  4384. * Class definition
  4385. */
  4386. class TemplateFactory extends Config {
  4387. constructor(config) {
  4388. super();
  4389. this._config = this._getConfig(config);
  4390. }
  4391. // Getters
  4392. static get Default() {
  4393. return Default$4;
  4394. }
  4395. static get DefaultType() {
  4396. return DefaultType$4;
  4397. }
  4398. static get NAME() {
  4399. return NAME$5;
  4400. }
  4401. // Public
  4402. getContent() {
  4403. return Object.values(this._config.content).map(config => this._resolvePossibleFunction(config)).filter(Boolean);
  4404. }
  4405. hasContent() {
  4406. return this.getContent().length > 0;
  4407. }
  4408. changeContent(content) {
  4409. this._checkContent(content);
  4410. this._config.content = {
  4411. ...this._config.content,
  4412. ...content
  4413. };
  4414. return this;
  4415. }
  4416. toHtml() {
  4417. const templateWrapper = document.createElement('div');
  4418. templateWrapper.innerHTML = this._maybeSanitize(this._config.template);
  4419. for (const [selector, text] of Object.entries(this._config.content)) {
  4420. this._setContent(templateWrapper, text, selector);
  4421. }
  4422. const template = templateWrapper.children[0];
  4423. const extraClass = this._resolvePossibleFunction(this._config.extraClass);
  4424. if (extraClass) {
  4425. template.classList.add(...extraClass.split(' '));
  4426. }
  4427. return template;
  4428. }
  4429. // Private
  4430. _typeCheckConfig(config) {
  4431. super._typeCheckConfig(config);
  4432. this._checkContent(config.content);
  4433. }
  4434. _checkContent(arg) {
  4435. for (const [selector, content] of Object.entries(arg)) {
  4436. super._typeCheckConfig({
  4437. selector,
  4438. entry: content
  4439. }, DefaultContentType);
  4440. }
  4441. }
  4442. _setContent(template, content, selector) {
  4443. const templateElement = SelectorEngine.findOne(selector, template);
  4444. if (!templateElement) {
  4445. return;
  4446. }
  4447. content = this._resolvePossibleFunction(content);
  4448. if (!content) {
  4449. templateElement.remove();
  4450. return;
  4451. }
  4452. if (isElement$1(content)) {
  4453. this._putElementInTemplate(getElement(content), templateElement);
  4454. return;
  4455. }
  4456. if (this._config.html) {
  4457. templateElement.innerHTML = this._maybeSanitize(content);
  4458. return;
  4459. }
  4460. templateElement.textContent = content;
  4461. }
  4462. _maybeSanitize(arg) {
  4463. return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg;
  4464. }
  4465. _resolvePossibleFunction(arg) {
  4466. return execute(arg, [undefined, this]);
  4467. }
  4468. _putElementInTemplate(element, templateElement) {
  4469. if (this._config.html) {
  4470. templateElement.innerHTML = '';
  4471. templateElement.append(element);
  4472. return;
  4473. }
  4474. templateElement.textContent = element.textContent;
  4475. }
  4476. }
  4477. /**
  4478. * --------------------------------------------------------------------------
  4479. * Bootstrap tooltip.js
  4480. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  4481. * --------------------------------------------------------------------------
  4482. */
  4483. /**
  4484. * Constants
  4485. */
  4486. const NAME$4 = 'tooltip';
  4487. const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
  4488. const CLASS_NAME_FADE$2 = 'fade';
  4489. const CLASS_NAME_MODAL = 'modal';
  4490. const CLASS_NAME_SHOW$2 = 'show';
  4491. const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  4492. const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
  4493. const EVENT_MODAL_HIDE = 'hide.bs.modal';
  4494. const TRIGGER_HOVER = 'hover';
  4495. const TRIGGER_FOCUS = 'focus';
  4496. const TRIGGER_CLICK = 'click';
  4497. const TRIGGER_MANUAL = 'manual';
  4498. const EVENT_HIDE$2 = 'hide';
  4499. const EVENT_HIDDEN$2 = 'hidden';
  4500. const EVENT_SHOW$2 = 'show';
  4501. const EVENT_SHOWN$2 = 'shown';
  4502. const EVENT_INSERTED = 'inserted';
  4503. const EVENT_CLICK$1 = 'click';
  4504. const EVENT_FOCUSIN$1 = 'focusin';
  4505. const EVENT_FOCUSOUT$1 = 'focusout';
  4506. const EVENT_MOUSEENTER = 'mouseenter';
  4507. const EVENT_MOUSELEAVE = 'mouseleave';
  4508. const AttachmentMap = {
  4509. AUTO: 'auto',
  4510. TOP: 'top',
  4511. RIGHT: isRTL() ? 'left' : 'right',
  4512. BOTTOM: 'bottom',
  4513. LEFT: isRTL() ? 'right' : 'left'
  4514. };
  4515. const Default$3 = {
  4516. allowList: DefaultAllowlist,
  4517. animation: true,
  4518. boundary: 'clippingParents',
  4519. container: false,
  4520. customClass: '',
  4521. delay: 0,
  4522. fallbackPlacements: ['top', 'right', 'bottom', 'left'],
  4523. html: false,
  4524. offset: [0, 6],
  4525. placement: 'top',
  4526. popperConfig: null,
  4527. sanitize: true,
  4528. sanitizeFn: null,
  4529. selector: false,
  4530. template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
  4531. title: '',
  4532. trigger: 'hover focus'
  4533. };
  4534. const DefaultType$3 = {
  4535. allowList: 'object',
  4536. animation: 'boolean',
  4537. boundary: '(string|element)',
  4538. container: '(string|element|boolean)',
  4539. customClass: '(string|function)',
  4540. delay: '(number|object)',
  4541. fallbackPlacements: 'array',
  4542. html: 'boolean',
  4543. offset: '(array|string|function)',
  4544. placement: '(string|function)',
  4545. popperConfig: '(null|object|function)',
  4546. sanitize: 'boolean',
  4547. sanitizeFn: '(null|function)',
  4548. selector: '(string|boolean)',
  4549. template: 'string',
  4550. title: '(string|element|function)',
  4551. trigger: 'string'
  4552. };
  4553. /**
  4554. * Class definition
  4555. */
  4556. class Tooltip extends BaseComponent {
  4557. constructor(element, config) {
  4558. if (typeof Popper === 'undefined') {
  4559. throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org/docs/v2/)');
  4560. }
  4561. super(element, config);
  4562. // Private
  4563. this._isEnabled = true;
  4564. this._timeout = 0;
  4565. this._isHovered = null;
  4566. this._activeTrigger = {};
  4567. this._popper = null;
  4568. this._templateFactory = null;
  4569. this._newContent = null;
  4570. // Protected
  4571. this.tip = null;
  4572. this._setListeners();
  4573. if (!this._config.selector) {
  4574. this._fixTitle();
  4575. }
  4576. }
  4577. // Getters
  4578. static get Default() {
  4579. return Default$3;
  4580. }
  4581. static get DefaultType() {
  4582. return DefaultType$3;
  4583. }
  4584. static get NAME() {
  4585. return NAME$4;
  4586. }
  4587. // Public
  4588. enable() {
  4589. this._isEnabled = true;
  4590. }
  4591. disable() {
  4592. this._isEnabled = false;
  4593. }
  4594. toggleEnabled() {
  4595. this._isEnabled = !this._isEnabled;
  4596. }
  4597. toggle() {
  4598. if (!this._isEnabled) {
  4599. return;
  4600. }
  4601. if (this._isShown()) {
  4602. this._leave();
  4603. return;
  4604. }
  4605. this._enter();
  4606. }
  4607. dispose() {
  4608. clearTimeout(this._timeout);
  4609. EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
  4610. if (this._element.getAttribute('data-bs-original-title')) {
  4611. this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'));
  4612. }
  4613. this._disposePopper();
  4614. super.dispose();
  4615. }
  4616. show() {
  4617. if (this._element.style.display === 'none') {
  4618. throw new Error('Please use show on visible elements');
  4619. }
  4620. if (!(this._isWithContent() && this._isEnabled)) {
  4621. return;
  4622. }
  4623. const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2));
  4624. const shadowRoot = findShadowRoot(this._element);
  4625. const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
  4626. if (showEvent.defaultPrevented || !isInTheDom) {
  4627. return;
  4628. }
  4629. // TODO: v6 remove this or make it optional
  4630. this._disposePopper();
  4631. const tip = this._getTipElement();
  4632. this._element.setAttribute('aria-describedby', tip.getAttribute('id'));
  4633. const {
  4634. container
  4635. } = this._config;
  4636. if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
  4637. container.append(tip);
  4638. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED));
  4639. }
  4640. this._popper = this._createPopper(tip);
  4641. tip.classList.add(CLASS_NAME_SHOW$2);
  4642. // If this is a touch-enabled device we add extra
  4643. // empty mouseover listeners to the body's immediate children;
  4644. // only needed because of broken event delegation on iOS
  4645. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  4646. if ('ontouchstart' in document.documentElement) {
  4647. for (const element of [].concat(...document.body.children)) {
  4648. EventHandler.on(element, 'mouseover', noop);
  4649. }
  4650. }
  4651. const complete = () => {
  4652. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2));
  4653. if (this._isHovered === false) {
  4654. this._leave();
  4655. }
  4656. this._isHovered = false;
  4657. };
  4658. this._queueCallback(complete, this.tip, this._isAnimated());
  4659. }
  4660. hide() {
  4661. if (!this._isShown()) {
  4662. return;
  4663. }
  4664. const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2));
  4665. if (hideEvent.defaultPrevented) {
  4666. return;
  4667. }
  4668. const tip = this._getTipElement();
  4669. tip.classList.remove(CLASS_NAME_SHOW$2);
  4670. // If this is a touch-enabled device we remove the extra
  4671. // empty mouseover listeners we added for iOS support
  4672. if ('ontouchstart' in document.documentElement) {
  4673. for (const element of [].concat(...document.body.children)) {
  4674. EventHandler.off(element, 'mouseover', noop);
  4675. }
  4676. }
  4677. this._activeTrigger[TRIGGER_CLICK] = false;
  4678. this._activeTrigger[TRIGGER_FOCUS] = false;
  4679. this._activeTrigger[TRIGGER_HOVER] = false;
  4680. this._isHovered = null; // it is a trick to support manual triggering
  4681. const complete = () => {
  4682. if (this._isWithActiveTrigger()) {
  4683. return;
  4684. }
  4685. if (!this._isHovered) {
  4686. this._disposePopper();
  4687. }
  4688. this._element.removeAttribute('aria-describedby');
  4689. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN$2));
  4690. };
  4691. this._queueCallback(complete, this.tip, this._isAnimated());
  4692. }
  4693. update() {
  4694. if (this._popper) {
  4695. this._popper.update();
  4696. }
  4697. }
  4698. // Protected
  4699. _isWithContent() {
  4700. return Boolean(this._getTitle());
  4701. }
  4702. _getTipElement() {
  4703. if (!this.tip) {
  4704. this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
  4705. }
  4706. return this.tip;
  4707. }
  4708. _createTipElement(content) {
  4709. const tip = this._getTemplateFactory(content).toHtml();
  4710. // TODO: remove this check in v6
  4711. if (!tip) {
  4712. return null;
  4713. }
  4714. tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
  4715. // TODO: v6 the following can be achieved with CSS only
  4716. tip.classList.add(`bs-${this.constructor.NAME}-auto`);
  4717. const tipId = getUID(this.constructor.NAME).toString();
  4718. tip.setAttribute('id', tipId);
  4719. if (this._isAnimated()) {
  4720. tip.classList.add(CLASS_NAME_FADE$2);
  4721. }
  4722. return tip;
  4723. }
  4724. setContent(content) {
  4725. this._newContent = content;
  4726. if (this._isShown()) {
  4727. this._disposePopper();
  4728. this.show();
  4729. }
  4730. }
  4731. _getTemplateFactory(content) {
  4732. if (this._templateFactory) {
  4733. this._templateFactory.changeContent(content);
  4734. } else {
  4735. this._templateFactory = new TemplateFactory({
  4736. ...this._config,
  4737. // the `content` var has to be after `this._config`
  4738. // to override config.content in case of popover
  4739. content,
  4740. extraClass: this._resolvePossibleFunction(this._config.customClass)
  4741. });
  4742. }
  4743. return this._templateFactory;
  4744. }
  4745. _getContentForTemplate() {
  4746. return {
  4747. [SELECTOR_TOOLTIP_INNER]: this._getTitle()
  4748. };
  4749. }
  4750. _getTitle() {
  4751. return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title');
  4752. }
  4753. // Private
  4754. _initializeOnDelegatedTarget(event) {
  4755. return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
  4756. }
  4757. _isAnimated() {
  4758. return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE$2);
  4759. }
  4760. _isShown() {
  4761. return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW$2);
  4762. }
  4763. _createPopper(tip) {
  4764. const placement = execute(this._config.placement, [this, tip, this._element]);
  4765. const attachment = AttachmentMap[placement.toUpperCase()];
  4766. return createPopper(this._element, tip, this._getPopperConfig(attachment));
  4767. }
  4768. _getOffset() {
  4769. const {
  4770. offset
  4771. } = this._config;
  4772. if (typeof offset === 'string') {
  4773. return offset.split(',').map(value => Number.parseInt(value, 10));
  4774. }
  4775. if (typeof offset === 'function') {
  4776. return popperData => offset(popperData, this._element);
  4777. }
  4778. return offset;
  4779. }
  4780. _resolvePossibleFunction(arg) {
  4781. return execute(arg, [this._element, this._element]);
  4782. }
  4783. _getPopperConfig(attachment) {
  4784. const defaultBsPopperConfig = {
  4785. placement: attachment,
  4786. modifiers: [{
  4787. name: 'flip',
  4788. options: {
  4789. fallbackPlacements: this._config.fallbackPlacements
  4790. }
  4791. }, {
  4792. name: 'offset',
  4793. options: {
  4794. offset: this._getOffset()
  4795. }
  4796. }, {
  4797. name: 'preventOverflow',
  4798. options: {
  4799. boundary: this._config.boundary
  4800. }
  4801. }, {
  4802. name: 'arrow',
  4803. options: {
  4804. element: `.${this.constructor.NAME}-arrow`
  4805. }
  4806. }, {
  4807. name: 'preSetPlacement',
  4808. enabled: true,
  4809. phase: 'beforeMain',
  4810. fn: data => {
  4811. // Pre-set Popper's placement attribute in order to read the arrow sizes properly.
  4812. // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement
  4813. this._getTipElement().setAttribute('data-popper-placement', data.state.placement);
  4814. }
  4815. }]
  4816. };
  4817. return {
  4818. ...defaultBsPopperConfig,
  4819. ...execute(this._config.popperConfig, [undefined, defaultBsPopperConfig])
  4820. };
  4821. }
  4822. _setListeners() {
  4823. const triggers = this._config.trigger.split(' ');
  4824. for (const trigger of triggers) {
  4825. if (trigger === 'click') {
  4826. EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, event => {
  4827. const context = this._initializeOnDelegatedTarget(event);
  4828. context._activeTrigger[TRIGGER_CLICK] = !(context._isShown() && context._activeTrigger[TRIGGER_CLICK]);
  4829. context.toggle();
  4830. });
  4831. } else if (trigger !== TRIGGER_MANUAL) {
  4832. const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN$1);
  4833. const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT$1);
  4834. EventHandler.on(this._element, eventIn, this._config.selector, event => {
  4835. const context = this._initializeOnDelegatedTarget(event);
  4836. context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
  4837. context._enter();
  4838. });
  4839. EventHandler.on(this._element, eventOut, this._config.selector, event => {
  4840. const context = this._initializeOnDelegatedTarget(event);
  4841. context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
  4842. context._leave();
  4843. });
  4844. }
  4845. }
  4846. this._hideModalHandler = () => {
  4847. if (this._element) {
  4848. this.hide();
  4849. }
  4850. };
  4851. EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
  4852. }
  4853. _fixTitle() {
  4854. const title = this._element.getAttribute('title');
  4855. if (!title) {
  4856. return;
  4857. }
  4858. if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
  4859. this._element.setAttribute('aria-label', title);
  4860. }
  4861. this._element.setAttribute('data-bs-original-title', title); // DO NOT USE IT. Is only for backwards compatibility
  4862. this._element.removeAttribute('title');
  4863. }
  4864. _enter() {
  4865. if (this._isShown() || this._isHovered) {
  4866. this._isHovered = true;
  4867. return;
  4868. }
  4869. this._isHovered = true;
  4870. this._setTimeout(() => {
  4871. if (this._isHovered) {
  4872. this.show();
  4873. }
  4874. }, this._config.delay.show);
  4875. }
  4876. _leave() {
  4877. if (this._isWithActiveTrigger()) {
  4878. return;
  4879. }
  4880. this._isHovered = false;
  4881. this._setTimeout(() => {
  4882. if (!this._isHovered) {
  4883. this.hide();
  4884. }
  4885. }, this._config.delay.hide);
  4886. }
  4887. _setTimeout(handler, timeout) {
  4888. clearTimeout(this._timeout);
  4889. this._timeout = setTimeout(handler, timeout);
  4890. }
  4891. _isWithActiveTrigger() {
  4892. return Object.values(this._activeTrigger).includes(true);
  4893. }
  4894. _getConfig(config) {
  4895. const dataAttributes = Manipulator.getDataAttributes(this._element);
  4896. for (const dataAttribute of Object.keys(dataAttributes)) {
  4897. if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
  4898. delete dataAttributes[dataAttribute];
  4899. }
  4900. }
  4901. config = {
  4902. ...dataAttributes,
  4903. ...(typeof config === 'object' && config ? config : {})
  4904. };
  4905. config = this._mergeConfigObj(config);
  4906. config = this._configAfterMerge(config);
  4907. this._typeCheckConfig(config);
  4908. return config;
  4909. }
  4910. _configAfterMerge(config) {
  4911. config.container = config.container === false ? document.body : getElement(config.container);
  4912. if (typeof config.delay === 'number') {
  4913. config.delay = {
  4914. show: config.delay,
  4915. hide: config.delay
  4916. };
  4917. }
  4918. if (typeof config.title === 'number') {
  4919. config.title = config.title.toString();
  4920. }
  4921. if (typeof config.content === 'number') {
  4922. config.content = config.content.toString();
  4923. }
  4924. return config;
  4925. }
  4926. _getDelegateConfig() {
  4927. const config = {};
  4928. for (const [key, value] of Object.entries(this._config)) {
  4929. if (this.constructor.Default[key] !== value) {
  4930. config[key] = value;
  4931. }
  4932. }
  4933. config.selector = false;
  4934. config.trigger = 'manual';
  4935. // In the future can be replaced with:
  4936. // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
  4937. // `Object.fromEntries(keysWithDifferentValues)`
  4938. return config;
  4939. }
  4940. _disposePopper() {
  4941. if (this._popper) {
  4942. this._popper.destroy();
  4943. this._popper = null;
  4944. }
  4945. if (this.tip) {
  4946. this.tip.remove();
  4947. this.tip = null;
  4948. }
  4949. }
  4950. // Static
  4951. static jQueryInterface(config) {
  4952. return this.each(function () {
  4953. const data = Tooltip.getOrCreateInstance(this, config);
  4954. if (typeof config !== 'string') {
  4955. return;
  4956. }
  4957. if (typeof data[config] === 'undefined') {
  4958. throw new TypeError(`No method named "${config}"`);
  4959. }
  4960. data[config]();
  4961. });
  4962. }
  4963. }
  4964. /**
  4965. * jQuery
  4966. */
  4967. defineJQueryPlugin(Tooltip);
  4968. /**
  4969. * --------------------------------------------------------------------------
  4970. * Bootstrap popover.js
  4971. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  4972. * --------------------------------------------------------------------------
  4973. */
  4974. /**
  4975. * Constants
  4976. */
  4977. const NAME$3 = 'popover';
  4978. const SELECTOR_TITLE = '.popover-header';
  4979. const SELECTOR_CONTENT = '.popover-body';
  4980. const Default$2 = {
  4981. ...Tooltip.Default,
  4982. content: '',
  4983. offset: [0, 8],
  4984. placement: 'right',
  4985. template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>',
  4986. trigger: 'click'
  4987. };
  4988. const DefaultType$2 = {
  4989. ...Tooltip.DefaultType,
  4990. content: '(null|string|element|function)'
  4991. };
  4992. /**
  4993. * Class definition
  4994. */
  4995. class Popover extends Tooltip {
  4996. // Getters
  4997. static get Default() {
  4998. return Default$2;
  4999. }
  5000. static get DefaultType() {
  5001. return DefaultType$2;
  5002. }
  5003. static get NAME() {
  5004. return NAME$3;
  5005. }
  5006. // Overrides
  5007. _isWithContent() {
  5008. return this._getTitle() || this._getContent();
  5009. }
  5010. // Private
  5011. _getContentForTemplate() {
  5012. return {
  5013. [SELECTOR_TITLE]: this._getTitle(),
  5014. [SELECTOR_CONTENT]: this._getContent()
  5015. };
  5016. }
  5017. _getContent() {
  5018. return this._resolvePossibleFunction(this._config.content);
  5019. }
  5020. // Static
  5021. static jQueryInterface(config) {
  5022. return this.each(function () {
  5023. const data = Popover.getOrCreateInstance(this, config);
  5024. if (typeof config !== 'string') {
  5025. return;
  5026. }
  5027. if (typeof data[config] === 'undefined') {
  5028. throw new TypeError(`No method named "${config}"`);
  5029. }
  5030. data[config]();
  5031. });
  5032. }
  5033. }
  5034. /**
  5035. * jQuery
  5036. */
  5037. defineJQueryPlugin(Popover);
  5038. /**
  5039. * --------------------------------------------------------------------------
  5040. * Bootstrap scrollspy.js
  5041. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5042. * --------------------------------------------------------------------------
  5043. */
  5044. /**
  5045. * Constants
  5046. */
  5047. const NAME$2 = 'scrollspy';
  5048. const DATA_KEY$2 = 'bs.scrollspy';
  5049. const EVENT_KEY$2 = `.${DATA_KEY$2}`;
  5050. const DATA_API_KEY = '.data-api';
  5051. const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`;
  5052. const EVENT_CLICK = `click${EVENT_KEY$2}`;
  5053. const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`;
  5054. const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  5055. const CLASS_NAME_ACTIVE$1 = 'active';
  5056. const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
  5057. const SELECTOR_TARGET_LINKS = '[href]';
  5058. const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  5059. const SELECTOR_NAV_LINKS = '.nav-link';
  5060. const SELECTOR_NAV_ITEMS = '.nav-item';
  5061. const SELECTOR_LIST_ITEMS = '.list-group-item';
  5062. const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`;
  5063. const SELECTOR_DROPDOWN = '.dropdown';
  5064. const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  5065. const Default$1 = {
  5066. offset: null,
  5067. // TODO: v6 @deprecated, keep it for backwards compatibility reasons
  5068. rootMargin: '0px 0px -25%',
  5069. smoothScroll: false,
  5070. target: null,
  5071. threshold: [0.1, 0.5, 1]
  5072. };
  5073. const DefaultType$1 = {
  5074. offset: '(number|null)',
  5075. // TODO v6 @deprecated, keep it for backwards compatibility reasons
  5076. rootMargin: 'string',
  5077. smoothScroll: 'boolean',
  5078. target: 'element',
  5079. threshold: 'array'
  5080. };
  5081. /**
  5082. * Class definition
  5083. */
  5084. class ScrollSpy extends BaseComponent {
  5085. constructor(element, config) {
  5086. super(element, config);
  5087. // this._element is the observablesContainer and config.target the menu links wrapper
  5088. this._targetLinks = new Map();
  5089. this._observableSections = new Map();
  5090. this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element;
  5091. this._activeTarget = null;
  5092. this._observer = null;
  5093. this._previousScrollData = {
  5094. visibleEntryTop: 0,
  5095. parentScrollTop: 0
  5096. };
  5097. this.refresh(); // initialize
  5098. }
  5099. // Getters
  5100. static get Default() {
  5101. return Default$1;
  5102. }
  5103. static get DefaultType() {
  5104. return DefaultType$1;
  5105. }
  5106. static get NAME() {
  5107. return NAME$2;
  5108. }
  5109. // Public
  5110. refresh() {
  5111. this._initializeTargetsAndObservables();
  5112. this._maybeEnableSmoothScroll();
  5113. if (this._observer) {
  5114. this._observer.disconnect();
  5115. } else {
  5116. this._observer = this._getNewObserver();
  5117. }
  5118. for (const section of this._observableSections.values()) {
  5119. this._observer.observe(section);
  5120. }
  5121. }
  5122. dispose() {
  5123. this._observer.disconnect();
  5124. super.dispose();
  5125. }
  5126. // Private
  5127. _configAfterMerge(config) {
  5128. // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
  5129. config.target = getElement(config.target) || document.body;
  5130. // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
  5131. config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin;
  5132. if (typeof config.threshold === 'string') {
  5133. config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value));
  5134. }
  5135. return config;
  5136. }
  5137. _maybeEnableSmoothScroll() {
  5138. if (!this._config.smoothScroll) {
  5139. return;
  5140. }
  5141. // unregister any previous listeners
  5142. EventHandler.off(this._config.target, EVENT_CLICK);
  5143. EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {
  5144. const observableSection = this._observableSections.get(event.target.hash);
  5145. if (observableSection) {
  5146. event.preventDefault();
  5147. const root = this._rootElement || window;
  5148. const height = observableSection.offsetTop - this._element.offsetTop;
  5149. if (root.scrollTo) {
  5150. root.scrollTo({
  5151. top: height,
  5152. behavior: 'smooth'
  5153. });
  5154. return;
  5155. }
  5156. // Chrome 60 doesn't support `scrollTo`
  5157. root.scrollTop = height;
  5158. }
  5159. });
  5160. }
  5161. _getNewObserver() {
  5162. const options = {
  5163. root: this._rootElement,
  5164. threshold: this._config.threshold,
  5165. rootMargin: this._config.rootMargin
  5166. };
  5167. return new IntersectionObserver(entries => this._observerCallback(entries), options);
  5168. }
  5169. // The logic of selection
  5170. _observerCallback(entries) {
  5171. const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`);
  5172. const activate = entry => {
  5173. this._previousScrollData.visibleEntryTop = entry.target.offsetTop;
  5174. this._process(targetElement(entry));
  5175. };
  5176. const parentScrollTop = (this._rootElement || document.documentElement).scrollTop;
  5177. const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop;
  5178. this._previousScrollData.parentScrollTop = parentScrollTop;
  5179. for (const entry of entries) {
  5180. if (!entry.isIntersecting) {
  5181. this._activeTarget = null;
  5182. this._clearActiveClass(targetElement(entry));
  5183. continue;
  5184. }
  5185. const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop;
  5186. // if we are scrolling down, pick the bigger offsetTop
  5187. if (userScrollsDown && entryIsLowerThanPrevious) {
  5188. activate(entry);
  5189. // if parent isn't scrolled, let's keep the first visible item, breaking the iteration
  5190. if (!parentScrollTop) {
  5191. return;
  5192. }
  5193. continue;
  5194. }
  5195. // if we are scrolling up, pick the smallest offsetTop
  5196. if (!userScrollsDown && !entryIsLowerThanPrevious) {
  5197. activate(entry);
  5198. }
  5199. }
  5200. }
  5201. _initializeTargetsAndObservables() {
  5202. this._targetLinks = new Map();
  5203. this._observableSections = new Map();
  5204. const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target);
  5205. for (const anchor of targetLinks) {
  5206. // ensure that the anchor has an id and is not disabled
  5207. if (!anchor.hash || isDisabled(anchor)) {
  5208. continue;
  5209. }
  5210. const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element);
  5211. // ensure that the observableSection exists & is visible
  5212. if (isVisible(observableSection)) {
  5213. this._targetLinks.set(decodeURI(anchor.hash), anchor);
  5214. this._observableSections.set(anchor.hash, observableSection);
  5215. }
  5216. }
  5217. }
  5218. _process(target) {
  5219. if (this._activeTarget === target) {
  5220. return;
  5221. }
  5222. this._clearActiveClass(this._config.target);
  5223. this._activeTarget = target;
  5224. target.classList.add(CLASS_NAME_ACTIVE$1);
  5225. this._activateParents(target);
  5226. EventHandler.trigger(this._element, EVENT_ACTIVATE, {
  5227. relatedTarget: target
  5228. });
  5229. }
  5230. _activateParents(target) {
  5231. // Activate dropdown parents
  5232. if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
  5233. SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1);
  5234. return;
  5235. }
  5236. for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {
  5237. // Set triggered links parents as active
  5238. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  5239. for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) {
  5240. item.classList.add(CLASS_NAME_ACTIVE$1);
  5241. }
  5242. }
  5243. }
  5244. _clearActiveClass(parent) {
  5245. parent.classList.remove(CLASS_NAME_ACTIVE$1);
  5246. const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE$1}`, parent);
  5247. for (const node of activeNodes) {
  5248. node.classList.remove(CLASS_NAME_ACTIVE$1);
  5249. }
  5250. }
  5251. // Static
  5252. static jQueryInterface(config) {
  5253. return this.each(function () {
  5254. const data = ScrollSpy.getOrCreateInstance(this, config);
  5255. if (typeof config !== 'string') {
  5256. return;
  5257. }
  5258. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  5259. throw new TypeError(`No method named "${config}"`);
  5260. }
  5261. data[config]();
  5262. });
  5263. }
  5264. }
  5265. /**
  5266. * Data API implementation
  5267. */
  5268. EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => {
  5269. for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
  5270. ScrollSpy.getOrCreateInstance(spy);
  5271. }
  5272. });
  5273. /**
  5274. * jQuery
  5275. */
  5276. defineJQueryPlugin(ScrollSpy);
  5277. /**
  5278. * --------------------------------------------------------------------------
  5279. * Bootstrap tab.js
  5280. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5281. * --------------------------------------------------------------------------
  5282. */
  5283. /**
  5284. * Constants
  5285. */
  5286. const NAME$1 = 'tab';
  5287. const DATA_KEY$1 = 'bs.tab';
  5288. const EVENT_KEY$1 = `.${DATA_KEY$1}`;
  5289. const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`;
  5290. const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`;
  5291. const EVENT_SHOW$1 = `show${EVENT_KEY$1}`;
  5292. const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`;
  5293. const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`;
  5294. const EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`;
  5295. const EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`;
  5296. const ARROW_LEFT_KEY = 'ArrowLeft';
  5297. const ARROW_RIGHT_KEY = 'ArrowRight';
  5298. const ARROW_UP_KEY = 'ArrowUp';
  5299. const ARROW_DOWN_KEY = 'ArrowDown';
  5300. const HOME_KEY = 'Home';
  5301. const END_KEY = 'End';
  5302. const CLASS_NAME_ACTIVE = 'active';
  5303. const CLASS_NAME_FADE$1 = 'fade';
  5304. const CLASS_NAME_SHOW$1 = 'show';
  5305. const CLASS_DROPDOWN = 'dropdown';
  5306. const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
  5307. const SELECTOR_DROPDOWN_MENU = '.dropdown-menu';
  5308. const NOT_SELECTOR_DROPDOWN_TOGGLE = `:not(${SELECTOR_DROPDOWN_TOGGLE})`;
  5309. const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
  5310. const SELECTOR_OUTER = '.nav-item, .list-group-item';
  5311. const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`;
  5312. const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; // TODO: could only be `tab` in v6
  5313. const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`;
  5314. const SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`;
  5315. /**
  5316. * Class definition
  5317. */
  5318. class Tab extends BaseComponent {
  5319. constructor(element) {
  5320. super(element);
  5321. this._parent = this._element.closest(SELECTOR_TAB_PANEL);
  5322. if (!this._parent) {
  5323. return;
  5324. // TODO: should throw exception in v6
  5325. // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`)
  5326. }
  5327. // Set up initial aria attributes
  5328. this._setInitialAttributes(this._parent, this._getChildren());
  5329. EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
  5330. }
  5331. // Getters
  5332. static get NAME() {
  5333. return NAME$1;
  5334. }
  5335. // Public
  5336. show() {
  5337. // Shows this elem and deactivate the active sibling if exists
  5338. const innerElem = this._element;
  5339. if (this._elemIsActive(innerElem)) {
  5340. return;
  5341. }
  5342. // Search for active tab on same parent to deactivate it
  5343. const active = this._getActiveElem();
  5344. const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, {
  5345. relatedTarget: innerElem
  5346. }) : null;
  5347. const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW$1, {
  5348. relatedTarget: active
  5349. });
  5350. if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) {
  5351. return;
  5352. }
  5353. this._deactivate(active, innerElem);
  5354. this._activate(innerElem, active);
  5355. }
  5356. // Private
  5357. _activate(element, relatedElem) {
  5358. if (!element) {
  5359. return;
  5360. }
  5361. element.classList.add(CLASS_NAME_ACTIVE);
  5362. this._activate(SelectorEngine.getElementFromSelector(element)); // Search and activate/show the proper section
  5363. const complete = () => {
  5364. if (element.getAttribute('role') !== 'tab') {
  5365. element.classList.add(CLASS_NAME_SHOW$1);
  5366. return;
  5367. }
  5368. element.removeAttribute('tabindex');
  5369. element.setAttribute('aria-selected', true);
  5370. this._toggleDropDown(element, true);
  5371. EventHandler.trigger(element, EVENT_SHOWN$1, {
  5372. relatedTarget: relatedElem
  5373. });
  5374. };
  5375. this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
  5376. }
  5377. _deactivate(element, relatedElem) {
  5378. if (!element) {
  5379. return;
  5380. }
  5381. element.classList.remove(CLASS_NAME_ACTIVE);
  5382. element.blur();
  5383. this._deactivate(SelectorEngine.getElementFromSelector(element)); // Search and deactivate the shown section too
  5384. const complete = () => {
  5385. if (element.getAttribute('role') !== 'tab') {
  5386. element.classList.remove(CLASS_NAME_SHOW$1);
  5387. return;
  5388. }
  5389. element.setAttribute('aria-selected', false);
  5390. element.setAttribute('tabindex', '-1');
  5391. this._toggleDropDown(element, false);
  5392. EventHandler.trigger(element, EVENT_HIDDEN$1, {
  5393. relatedTarget: relatedElem
  5394. });
  5395. };
  5396. this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
  5397. }
  5398. _keydown(event) {
  5399. if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key)) {
  5400. return;
  5401. }
  5402. event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page
  5403. event.preventDefault();
  5404. const children = this._getChildren().filter(element => !isDisabled(element));
  5405. let nextActiveElement;
  5406. if ([HOME_KEY, END_KEY].includes(event.key)) {
  5407. nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1];
  5408. } else {
  5409. const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
  5410. nextActiveElement = getNextActiveElement(children, event.target, isNext, true);
  5411. }
  5412. if (nextActiveElement) {
  5413. nextActiveElement.focus({
  5414. preventScroll: true
  5415. });
  5416. Tab.getOrCreateInstance(nextActiveElement).show();
  5417. }
  5418. }
  5419. _getChildren() {
  5420. // collection of inner elements
  5421. return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent);
  5422. }
  5423. _getActiveElem() {
  5424. return this._getChildren().find(child => this._elemIsActive(child)) || null;
  5425. }
  5426. _setInitialAttributes(parent, children) {
  5427. this._setAttributeIfNotExists(parent, 'role', 'tablist');
  5428. for (const child of children) {
  5429. this._setInitialAttributesOnChild(child);
  5430. }
  5431. }
  5432. _setInitialAttributesOnChild(child) {
  5433. child = this._getInnerElement(child);
  5434. const isActive = this._elemIsActive(child);
  5435. const outerElem = this._getOuterElement(child);
  5436. child.setAttribute('aria-selected', isActive);
  5437. if (outerElem !== child) {
  5438. this._setAttributeIfNotExists(outerElem, 'role', 'presentation');
  5439. }
  5440. if (!isActive) {
  5441. child.setAttribute('tabindex', '-1');
  5442. }
  5443. this._setAttributeIfNotExists(child, 'role', 'tab');
  5444. // set attributes to the related panel too
  5445. this._setInitialAttributesOnTargetPanel(child);
  5446. }
  5447. _setInitialAttributesOnTargetPanel(child) {
  5448. const target = SelectorEngine.getElementFromSelector(child);
  5449. if (!target) {
  5450. return;
  5451. }
  5452. this._setAttributeIfNotExists(target, 'role', 'tabpanel');
  5453. if (child.id) {
  5454. this._setAttributeIfNotExists(target, 'aria-labelledby', `${child.id}`);
  5455. }
  5456. }
  5457. _toggleDropDown(element, open) {
  5458. const outerElem = this._getOuterElement(element);
  5459. if (!outerElem.classList.contains(CLASS_DROPDOWN)) {
  5460. return;
  5461. }
  5462. const toggle = (selector, className) => {
  5463. const element = SelectorEngine.findOne(selector, outerElem);
  5464. if (element) {
  5465. element.classList.toggle(className, open);
  5466. }
  5467. };
  5468. toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE);
  5469. toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1);
  5470. outerElem.setAttribute('aria-expanded', open);
  5471. }
  5472. _setAttributeIfNotExists(element, attribute, value) {
  5473. if (!element.hasAttribute(attribute)) {
  5474. element.setAttribute(attribute, value);
  5475. }
  5476. }
  5477. _elemIsActive(elem) {
  5478. return elem.classList.contains(CLASS_NAME_ACTIVE);
  5479. }
  5480. // Try to get the inner element (usually the .nav-link)
  5481. _getInnerElement(elem) {
  5482. return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem);
  5483. }
  5484. // Try to get the outer element (usually the .nav-item)
  5485. _getOuterElement(elem) {
  5486. return elem.closest(SELECTOR_OUTER) || elem;
  5487. }
  5488. // Static
  5489. static jQueryInterface(config) {
  5490. return this.each(function () {
  5491. const data = Tab.getOrCreateInstance(this);
  5492. if (typeof config !== 'string') {
  5493. return;
  5494. }
  5495. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  5496. throw new TypeError(`No method named "${config}"`);
  5497. }
  5498. data[config]();
  5499. });
  5500. }
  5501. }
  5502. /**
  5503. * Data API implementation
  5504. */
  5505. EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
  5506. if (['A', 'AREA'].includes(this.tagName)) {
  5507. event.preventDefault();
  5508. }
  5509. if (isDisabled(this)) {
  5510. return;
  5511. }
  5512. Tab.getOrCreateInstance(this).show();
  5513. });
  5514. /**
  5515. * Initialize on focus
  5516. */
  5517. EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
  5518. for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
  5519. Tab.getOrCreateInstance(element);
  5520. }
  5521. });
  5522. /**
  5523. * jQuery
  5524. */
  5525. defineJQueryPlugin(Tab);
  5526. /**
  5527. * --------------------------------------------------------------------------
  5528. * Bootstrap toast.js
  5529. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5530. * --------------------------------------------------------------------------
  5531. */
  5532. /**
  5533. * Constants
  5534. */
  5535. const NAME = 'toast';
  5536. const DATA_KEY = 'bs.toast';
  5537. const EVENT_KEY = `.${DATA_KEY}`;
  5538. const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
  5539. const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
  5540. const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
  5541. const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
  5542. const EVENT_HIDE = `hide${EVENT_KEY}`;
  5543. const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
  5544. const EVENT_SHOW = `show${EVENT_KEY}`;
  5545. const EVENT_SHOWN = `shown${EVENT_KEY}`;
  5546. const CLASS_NAME_FADE = 'fade';
  5547. const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
  5548. const CLASS_NAME_SHOW = 'show';
  5549. const CLASS_NAME_SHOWING = 'showing';
  5550. const DefaultType = {
  5551. animation: 'boolean',
  5552. autohide: 'boolean',
  5553. delay: 'number'
  5554. };
  5555. const Default = {
  5556. animation: true,
  5557. autohide: true,
  5558. delay: 5000
  5559. };
  5560. /**
  5561. * Class definition
  5562. */
  5563. class Toast extends BaseComponent {
  5564. constructor(element, config) {
  5565. super(element, config);
  5566. this._timeout = null;
  5567. this._hasMouseInteraction = false;
  5568. this._hasKeyboardInteraction = false;
  5569. this._setListeners();
  5570. }
  5571. // Getters
  5572. static get Default() {
  5573. return Default;
  5574. }
  5575. static get DefaultType() {
  5576. return DefaultType;
  5577. }
  5578. static get NAME() {
  5579. return NAME;
  5580. }
  5581. // Public
  5582. show() {
  5583. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
  5584. if (showEvent.defaultPrevented) {
  5585. return;
  5586. }
  5587. this._clearTimeout();
  5588. if (this._config.animation) {
  5589. this._element.classList.add(CLASS_NAME_FADE);
  5590. }
  5591. const complete = () => {
  5592. this._element.classList.remove(CLASS_NAME_SHOWING);
  5593. EventHandler.trigger(this._element, EVENT_SHOWN);
  5594. this._maybeScheduleHide();
  5595. };
  5596. this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
  5597. reflow(this._element);
  5598. this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING);
  5599. this._queueCallback(complete, this._element, this._config.animation);
  5600. }
  5601. hide() {
  5602. if (!this.isShown()) {
  5603. return;
  5604. }
  5605. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
  5606. if (hideEvent.defaultPrevented) {
  5607. return;
  5608. }
  5609. const complete = () => {
  5610. this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
  5611. this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW);
  5612. EventHandler.trigger(this._element, EVENT_HIDDEN);
  5613. };
  5614. this._element.classList.add(CLASS_NAME_SHOWING);
  5615. this._queueCallback(complete, this._element, this._config.animation);
  5616. }
  5617. dispose() {
  5618. this._clearTimeout();
  5619. if (this.isShown()) {
  5620. this._element.classList.remove(CLASS_NAME_SHOW);
  5621. }
  5622. super.dispose();
  5623. }
  5624. isShown() {
  5625. return this._element.classList.contains(CLASS_NAME_SHOW);
  5626. }
  5627. // Private
  5628. _maybeScheduleHide() {
  5629. if (!this._config.autohide) {
  5630. return;
  5631. }
  5632. if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
  5633. return;
  5634. }
  5635. this._timeout = setTimeout(() => {
  5636. this.hide();
  5637. }, this._config.delay);
  5638. }
  5639. _onInteraction(event, isInteracting) {
  5640. switch (event.type) {
  5641. case 'mouseover':
  5642. case 'mouseout':
  5643. {
  5644. this._hasMouseInteraction = isInteracting;
  5645. break;
  5646. }
  5647. case 'focusin':
  5648. case 'focusout':
  5649. {
  5650. this._hasKeyboardInteraction = isInteracting;
  5651. break;
  5652. }
  5653. }
  5654. if (isInteracting) {
  5655. this._clearTimeout();
  5656. return;
  5657. }
  5658. const nextElement = event.relatedTarget;
  5659. if (this._element === nextElement || this._element.contains(nextElement)) {
  5660. return;
  5661. }
  5662. this._maybeScheduleHide();
  5663. }
  5664. _setListeners() {
  5665. EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
  5666. EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
  5667. EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
  5668. EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
  5669. }
  5670. _clearTimeout() {
  5671. clearTimeout(this._timeout);
  5672. this._timeout = null;
  5673. }
  5674. // Static
  5675. static jQueryInterface(config) {
  5676. return this.each(function () {
  5677. const data = Toast.getOrCreateInstance(this, config);
  5678. if (typeof config === 'string') {
  5679. if (typeof data[config] === 'undefined') {
  5680. throw new TypeError(`No method named "${config}"`);
  5681. }
  5682. data[config](this);
  5683. }
  5684. });
  5685. }
  5686. }
  5687. /**
  5688. * Data API implementation
  5689. */
  5690. enableDismissTrigger(Toast);
  5691. /**
  5692. * jQuery
  5693. */
  5694. defineJQueryPlugin(Toast);
  5695. /**
  5696. * --------------------------------------------------------------------------
  5697. * Bootstrap index.umd.js
  5698. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5699. * --------------------------------------------------------------------------
  5700. */
  5701. const index_umd = {
  5702. Alert,
  5703. Button,
  5704. Carousel,
  5705. Collapse,
  5706. Dropdown,
  5707. Modal,
  5708. Offcanvas,
  5709. Popover,
  5710. ScrollSpy,
  5711. Tab,
  5712. Toast,
  5713. Tooltip
  5714. };
  5715. return index_umd;
  5716. }));
  5717. //# sourceMappingURL=bootstrap.bundle.js.map