bootstrap.bundle.js 203 KB

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