bootstrap.esm.js 136 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967
  1. /*!
  2. * Bootstrap v5.0.2 (https://getbootstrap.com/)
  3. * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5. */
  6. import * as Popper from '@popperjs/core';
  7. /**
  8. * --------------------------------------------------------------------------
  9. * Bootstrap (v5.0.2): dom/selector-engine.js
  10. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  11. * --------------------------------------------------------------------------
  12. */
  13. /**
  14. * ------------------------------------------------------------------------
  15. * Constants
  16. * ------------------------------------------------------------------------
  17. */
  18. const NODE_TEXT = 3;
  19. const SelectorEngine = {
  20. find(selector, element = document.documentElement) {
  21. return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
  22. },
  23. findOne(selector, element = document.documentElement) {
  24. return Element.prototype.querySelector.call(element, selector);
  25. },
  26. children(element, selector) {
  27. return [].concat(...element.children).filter(child => child.matches(selector));
  28. },
  29. parents(element, selector) {
  30. const parents = [];
  31. let ancestor = element.parentNode;
  32. while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) {
  33. if (ancestor.matches(selector)) {
  34. parents.push(ancestor);
  35. }
  36. ancestor = ancestor.parentNode;
  37. }
  38. return parents;
  39. },
  40. prev(element, selector) {
  41. let previous = element.previousElementSibling;
  42. while (previous) {
  43. if (previous.matches(selector)) {
  44. return [previous];
  45. }
  46. previous = previous.previousElementSibling;
  47. }
  48. return [];
  49. },
  50. next(element, selector) {
  51. let next = element.nextElementSibling;
  52. while (next) {
  53. if (next.matches(selector)) {
  54. return [next];
  55. }
  56. next = next.nextElementSibling;
  57. }
  58. return [];
  59. }
  60. };
  61. /**
  62. * --------------------------------------------------------------------------
  63. * Bootstrap (v5.0.2): util/index.js
  64. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  65. * --------------------------------------------------------------------------
  66. */
  67. const MAX_UID = 1000000;
  68. const MILLISECONDS_MULTIPLIER = 1000;
  69. const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
  70. const toType = obj => {
  71. if (obj === null || obj === undefined) {
  72. return `${obj}`;
  73. }
  74. return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase();
  75. };
  76. /**
  77. * --------------------------------------------------------------------------
  78. * Public Util Api
  79. * --------------------------------------------------------------------------
  80. */
  81. const getUID = prefix => {
  82. do {
  83. prefix += Math.floor(Math.random() * MAX_UID);
  84. } while (document.getElementById(prefix));
  85. return prefix;
  86. };
  87. const getSelector = element => {
  88. let selector = element.getAttribute('data-bs-target');
  89. if (!selector || selector === '#') {
  90. let hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes,
  91. // so everything starting with `#` or `.`. If a "real" URL is used as the selector,
  92. // `document.querySelector` will rightfully complain it is invalid.
  93. // See https://github.com/twbs/bootstrap/issues/32273
  94. if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) {
  95. return null;
  96. } // Just in case some CMS puts out a full URL with the anchor appended
  97. if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) {
  98. hrefAttr = `#${hrefAttr.split('#')[1]}`;
  99. }
  100. selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null;
  101. }
  102. return selector;
  103. };
  104. const getSelectorFromElement = element => {
  105. const selector = getSelector(element);
  106. if (selector) {
  107. return document.querySelector(selector) ? selector : null;
  108. }
  109. return null;
  110. };
  111. const getElementFromSelector = element => {
  112. const selector = getSelector(element);
  113. return selector ? document.querySelector(selector) : null;
  114. };
  115. const getTransitionDurationFromElement = element => {
  116. if (!element) {
  117. return 0;
  118. } // Get transition-duration of the element
  119. let {
  120. transitionDuration,
  121. transitionDelay
  122. } = window.getComputedStyle(element);
  123. const floatTransitionDuration = Number.parseFloat(transitionDuration);
  124. const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
  125. if (!floatTransitionDuration && !floatTransitionDelay) {
  126. return 0;
  127. } // If multiple durations are defined, take the first
  128. transitionDuration = transitionDuration.split(',')[0];
  129. transitionDelay = transitionDelay.split(',')[0];
  130. return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
  131. };
  132. const triggerTransitionEnd = element => {
  133. element.dispatchEvent(new Event(TRANSITION_END));
  134. };
  135. const isElement = obj => {
  136. if (!obj || typeof obj !== 'object') {
  137. return false;
  138. }
  139. if (typeof obj.jquery !== 'undefined') {
  140. obj = obj[0];
  141. }
  142. return typeof obj.nodeType !== 'undefined';
  143. };
  144. const getElement = obj => {
  145. if (isElement(obj)) {
  146. // it's a jQuery object or a node element
  147. return obj.jquery ? obj[0] : obj;
  148. }
  149. if (typeof obj === 'string' && obj.length > 0) {
  150. return SelectorEngine.findOne(obj);
  151. }
  152. return null;
  153. };
  154. const typeCheckConfig = (componentName, config, configTypes) => {
  155. Object.keys(configTypes).forEach(property => {
  156. const expectedTypes = configTypes[property];
  157. const value = config[property];
  158. const valueType = value && isElement(value) ? 'element' : toType(value);
  159. if (!new RegExp(expectedTypes).test(valueType)) {
  160. throw new TypeError(`${componentName.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`);
  161. }
  162. });
  163. };
  164. const isVisible = element => {
  165. if (!isElement(element) || element.getClientRects().length === 0) {
  166. return false;
  167. }
  168. return getComputedStyle(element).getPropertyValue('visibility') === 'visible';
  169. };
  170. const isDisabled = element => {
  171. if (!element || element.nodeType !== Node.ELEMENT_NODE) {
  172. return true;
  173. }
  174. if (element.classList.contains('disabled')) {
  175. return true;
  176. }
  177. if (typeof element.disabled !== 'undefined') {
  178. return element.disabled;
  179. }
  180. return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false';
  181. };
  182. const findShadowRoot = element => {
  183. if (!document.documentElement.attachShadow) {
  184. return null;
  185. } // Can find the shadow root otherwise it'll return the document
  186. if (typeof element.getRootNode === 'function') {
  187. const root = element.getRootNode();
  188. return root instanceof ShadowRoot ? root : null;
  189. }
  190. if (element instanceof ShadowRoot) {
  191. return element;
  192. } // when we don't find a shadow root
  193. if (!element.parentNode) {
  194. return null;
  195. }
  196. return findShadowRoot(element.parentNode);
  197. };
  198. const noop = () => {};
  199. const reflow = element => element.offsetHeight;
  200. const getjQuery = () => {
  201. const {
  202. jQuery
  203. } = window;
  204. if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
  205. return jQuery;
  206. }
  207. return null;
  208. };
  209. const DOMContentLoadedCallbacks = [];
  210. const onDOMContentLoaded = callback => {
  211. if (document.readyState === 'loading') {
  212. // add listener on the first call when the document is in loading state
  213. if (!DOMContentLoadedCallbacks.length) {
  214. document.addEventListener('DOMContentLoaded', () => {
  215. DOMContentLoadedCallbacks.forEach(callback => callback());
  216. });
  217. }
  218. DOMContentLoadedCallbacks.push(callback);
  219. } else {
  220. callback();
  221. }
  222. };
  223. const isRTL = () => document.documentElement.dir === 'rtl';
  224. const defineJQueryPlugin = plugin => {
  225. onDOMContentLoaded(() => {
  226. const $ = getjQuery();
  227. /* istanbul ignore if */
  228. if ($) {
  229. const name = plugin.NAME;
  230. const JQUERY_NO_CONFLICT = $.fn[name];
  231. $.fn[name] = plugin.jQueryInterface;
  232. $.fn[name].Constructor = plugin;
  233. $.fn[name].noConflict = () => {
  234. $.fn[name] = JQUERY_NO_CONFLICT;
  235. return plugin.jQueryInterface;
  236. };
  237. }
  238. });
  239. };
  240. const execute = callback => {
  241. if (typeof callback === 'function') {
  242. callback();
  243. }
  244. };
  245. const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
  246. if (!waitForTransition) {
  247. execute(callback);
  248. return;
  249. }
  250. const durationPadding = 5;
  251. const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
  252. let called = false;
  253. const handler = ({
  254. target
  255. }) => {
  256. if (target !== transitionElement) {
  257. return;
  258. }
  259. called = true;
  260. transitionElement.removeEventListener(TRANSITION_END, handler);
  261. execute(callback);
  262. };
  263. transitionElement.addEventListener(TRANSITION_END, handler);
  264. setTimeout(() => {
  265. if (!called) {
  266. triggerTransitionEnd(transitionElement);
  267. }
  268. }, emulatedDuration);
  269. };
  270. /**
  271. * Return the previous/next element of a list.
  272. *
  273. * @param {array} list The list of elements
  274. * @param activeElement The active element
  275. * @param shouldGetNext Choose to get next or previous element
  276. * @param isCycleAllowed
  277. * @return {Element|elem} The proper element
  278. */
  279. const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
  280. let index = list.indexOf(activeElement); // if the element does not exist in the list return an element depending on the direction and if cycle is allowed
  281. if (index === -1) {
  282. return list[!shouldGetNext && isCycleAllowed ? list.length - 1 : 0];
  283. }
  284. const listLength = list.length;
  285. index += shouldGetNext ? 1 : -1;
  286. if (isCycleAllowed) {
  287. index = (index + listLength) % listLength;
  288. }
  289. return list[Math.max(0, Math.min(index, listLength - 1))];
  290. };
  291. /**
  292. * --------------------------------------------------------------------------
  293. * Bootstrap (v5.0.2): dom/event-handler.js
  294. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  295. * --------------------------------------------------------------------------
  296. */
  297. /**
  298. * ------------------------------------------------------------------------
  299. * Constants
  300. * ------------------------------------------------------------------------
  301. */
  302. const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
  303. const stripNameRegex = /\..*/;
  304. const stripUidRegex = /::\d+$/;
  305. const eventRegistry = {}; // Events storage
  306. let uidEvent = 1;
  307. const customEvents = {
  308. mouseenter: 'mouseover',
  309. mouseleave: 'mouseout'
  310. };
  311. const customEventsRegex = /^(mouseenter|mouseleave)/i;
  312. 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']);
  313. /**
  314. * ------------------------------------------------------------------------
  315. * Private methods
  316. * ------------------------------------------------------------------------
  317. */
  318. function getUidEvent(element, uid) {
  319. return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
  320. }
  321. function getEvent(element) {
  322. const uid = getUidEvent(element);
  323. element.uidEvent = uid;
  324. eventRegistry[uid] = eventRegistry[uid] || {};
  325. return eventRegistry[uid];
  326. }
  327. function bootstrapHandler(element, fn) {
  328. return function handler(event) {
  329. event.delegateTarget = element;
  330. if (handler.oneOff) {
  331. EventHandler.off(element, event.type, fn);
  332. }
  333. return fn.apply(element, [event]);
  334. };
  335. }
  336. function bootstrapDelegationHandler(element, selector, fn) {
  337. return function handler(event) {
  338. const domElements = element.querySelectorAll(selector);
  339. for (let {
  340. target
  341. } = event; target && target !== this; target = target.parentNode) {
  342. for (let i = domElements.length; i--;) {
  343. if (domElements[i] === target) {
  344. event.delegateTarget = target;
  345. if (handler.oneOff) {
  346. // eslint-disable-next-line unicorn/consistent-destructuring
  347. EventHandler.off(element, event.type, selector, fn);
  348. }
  349. return fn.apply(target, [event]);
  350. }
  351. }
  352. } // To please ESLint
  353. return null;
  354. };
  355. }
  356. function findHandler(events, handler, delegationSelector = null) {
  357. const uidEventList = Object.keys(events);
  358. for (let i = 0, len = uidEventList.length; i < len; i++) {
  359. const event = events[uidEventList[i]];
  360. if (event.originalHandler === handler && event.delegationSelector === delegationSelector) {
  361. return event;
  362. }
  363. }
  364. return null;
  365. }
  366. function normalizeParams(originalTypeEvent, handler, delegationFn) {
  367. const delegation = typeof handler === 'string';
  368. const originalHandler = delegation ? delegationFn : handler;
  369. let typeEvent = getTypeEvent(originalTypeEvent);
  370. const isNative = nativeEvents.has(typeEvent);
  371. if (!isNative) {
  372. typeEvent = originalTypeEvent;
  373. }
  374. return [delegation, originalHandler, typeEvent];
  375. }
  376. function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) {
  377. if (typeof originalTypeEvent !== 'string' || !element) {
  378. return;
  379. }
  380. if (!handler) {
  381. handler = delegationFn;
  382. delegationFn = null;
  383. } // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
  384. // this prevents the handler from being dispatched the same way as mouseover or mouseout does
  385. if (customEventsRegex.test(originalTypeEvent)) {
  386. const wrapFn = fn => {
  387. return function (event) {
  388. if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
  389. return fn.call(this, event);
  390. }
  391. };
  392. };
  393. if (delegationFn) {
  394. delegationFn = wrapFn(delegationFn);
  395. } else {
  396. handler = wrapFn(handler);
  397. }
  398. }
  399. const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
  400. const events = getEvent(element);
  401. const handlers = events[typeEvent] || (events[typeEvent] = {});
  402. const previousFn = findHandler(handlers, originalHandler, delegation ? handler : null);
  403. if (previousFn) {
  404. previousFn.oneOff = previousFn.oneOff && oneOff;
  405. return;
  406. }
  407. const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, ''));
  408. const fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler);
  409. fn.delegationSelector = delegation ? handler : null;
  410. fn.originalHandler = originalHandler;
  411. fn.oneOff = oneOff;
  412. fn.uidEvent = uid;
  413. handlers[uid] = fn;
  414. element.addEventListener(typeEvent, fn, delegation);
  415. }
  416. function removeHandler(element, events, typeEvent, handler, delegationSelector) {
  417. const fn = findHandler(events[typeEvent], handler, delegationSelector);
  418. if (!fn) {
  419. return;
  420. }
  421. element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
  422. delete events[typeEvent][fn.uidEvent];
  423. }
  424. function removeNamespacedHandlers(element, events, typeEvent, namespace) {
  425. const storeElementEvent = events[typeEvent] || {};
  426. Object.keys(storeElementEvent).forEach(handlerKey => {
  427. if (handlerKey.includes(namespace)) {
  428. const event = storeElementEvent[handlerKey];
  429. removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
  430. }
  431. });
  432. }
  433. function getTypeEvent(event) {
  434. // allow to get the native events from namespaced events ('click.bs.button' --> 'click')
  435. event = event.replace(stripNameRegex, '');
  436. return customEvents[event] || event;
  437. }
  438. const EventHandler = {
  439. on(element, event, handler, delegationFn) {
  440. addHandler(element, event, handler, delegationFn, false);
  441. },
  442. one(element, event, handler, delegationFn) {
  443. addHandler(element, event, handler, delegationFn, true);
  444. },
  445. off(element, originalTypeEvent, handler, delegationFn) {
  446. if (typeof originalTypeEvent !== 'string' || !element) {
  447. return;
  448. }
  449. const [delegation, originalHandler, typeEvent] = normalizeParams(originalTypeEvent, handler, delegationFn);
  450. const inNamespace = typeEvent !== originalTypeEvent;
  451. const events = getEvent(element);
  452. const isNamespace = originalTypeEvent.startsWith('.');
  453. if (typeof originalHandler !== 'undefined') {
  454. // Simplest case: handler is passed, remove that listener ONLY.
  455. if (!events || !events[typeEvent]) {
  456. return;
  457. }
  458. removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null);
  459. return;
  460. }
  461. if (isNamespace) {
  462. Object.keys(events).forEach(elementEvent => {
  463. removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
  464. });
  465. }
  466. const storeElementEvent = events[typeEvent] || {};
  467. Object.keys(storeElementEvent).forEach(keyHandlers => {
  468. const handlerKey = keyHandlers.replace(stripUidRegex, '');
  469. if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
  470. const event = storeElementEvent[keyHandlers];
  471. removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector);
  472. }
  473. });
  474. },
  475. trigger(element, event, args) {
  476. if (typeof event !== 'string' || !element) {
  477. return null;
  478. }
  479. const $ = getjQuery();
  480. const typeEvent = getTypeEvent(event);
  481. const inNamespace = event !== typeEvent;
  482. const isNative = nativeEvents.has(typeEvent);
  483. let jQueryEvent;
  484. let bubbles = true;
  485. let nativeDispatch = true;
  486. let defaultPrevented = false;
  487. let evt = null;
  488. if (inNamespace && $) {
  489. jQueryEvent = $.Event(event, args);
  490. $(element).trigger(jQueryEvent);
  491. bubbles = !jQueryEvent.isPropagationStopped();
  492. nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
  493. defaultPrevented = jQueryEvent.isDefaultPrevented();
  494. }
  495. if (isNative) {
  496. evt = document.createEvent('HTMLEvents');
  497. evt.initEvent(typeEvent, bubbles, true);
  498. } else {
  499. evt = new CustomEvent(event, {
  500. bubbles,
  501. cancelable: true
  502. });
  503. } // merge custom information in our event
  504. if (typeof args !== 'undefined') {
  505. Object.keys(args).forEach(key => {
  506. Object.defineProperty(evt, key, {
  507. get() {
  508. return args[key];
  509. }
  510. });
  511. });
  512. }
  513. if (defaultPrevented) {
  514. evt.preventDefault();
  515. }
  516. if (nativeDispatch) {
  517. element.dispatchEvent(evt);
  518. }
  519. if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') {
  520. jQueryEvent.preventDefault();
  521. }
  522. return evt;
  523. }
  524. };
  525. /**
  526. * --------------------------------------------------------------------------
  527. * Bootstrap (v5.0.2): dom/data.js
  528. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  529. * --------------------------------------------------------------------------
  530. */
  531. /**
  532. * ------------------------------------------------------------------------
  533. * Constants
  534. * ------------------------------------------------------------------------
  535. */
  536. const elementMap = new Map();
  537. var Data = {
  538. set(element, key, instance) {
  539. if (!elementMap.has(element)) {
  540. elementMap.set(element, new Map());
  541. }
  542. const instanceMap = elementMap.get(element); // make it clear we only want one instance per element
  543. // can be removed later when multiple key/instances are fine to be used
  544. if (!instanceMap.has(key) && instanceMap.size !== 0) {
  545. // eslint-disable-next-line no-console
  546. console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
  547. return;
  548. }
  549. instanceMap.set(key, instance);
  550. },
  551. get(element, key) {
  552. if (elementMap.has(element)) {
  553. return elementMap.get(element).get(key) || null;
  554. }
  555. return null;
  556. },
  557. remove(element, key) {
  558. if (!elementMap.has(element)) {
  559. return;
  560. }
  561. const instanceMap = elementMap.get(element);
  562. instanceMap.delete(key); // free up element references if there are no instances left for an element
  563. if (instanceMap.size === 0) {
  564. elementMap.delete(element);
  565. }
  566. }
  567. };
  568. /**
  569. * --------------------------------------------------------------------------
  570. * Bootstrap (v5.0.2): base-component.js
  571. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  572. * --------------------------------------------------------------------------
  573. */
  574. /**
  575. * ------------------------------------------------------------------------
  576. * Constants
  577. * ------------------------------------------------------------------------
  578. */
  579. const VERSION = '5.0.2';
  580. class BaseComponent {
  581. constructor(element) {
  582. element = getElement(element);
  583. if (!element) {
  584. return;
  585. }
  586. this._element = element;
  587. Data.set(this._element, this.constructor.DATA_KEY, this);
  588. }
  589. dispose() {
  590. Data.remove(this._element, this.constructor.DATA_KEY);
  591. EventHandler.off(this._element, this.constructor.EVENT_KEY);
  592. Object.getOwnPropertyNames(this).forEach(propertyName => {
  593. this[propertyName] = null;
  594. });
  595. }
  596. _queueCallback(callback, element, isAnimated = true) {
  597. executeAfterTransition(callback, element, isAnimated);
  598. }
  599. /** Static */
  600. static getInstance(element) {
  601. return Data.get(element, this.DATA_KEY);
  602. }
  603. static getOrCreateInstance(element, config = {}) {
  604. return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null);
  605. }
  606. static get VERSION() {
  607. return VERSION;
  608. }
  609. static get NAME() {
  610. throw new Error('You have to implement the static method "NAME", for each component!');
  611. }
  612. static get DATA_KEY() {
  613. return `bs.${this.NAME}`;
  614. }
  615. static get EVENT_KEY() {
  616. return `.${this.DATA_KEY}`;
  617. }
  618. }
  619. /**
  620. * --------------------------------------------------------------------------
  621. * Bootstrap (v5.0.2): alert.js
  622. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  623. * --------------------------------------------------------------------------
  624. */
  625. /**
  626. * ------------------------------------------------------------------------
  627. * Constants
  628. * ------------------------------------------------------------------------
  629. */
  630. const NAME$c = 'alert';
  631. const DATA_KEY$b = 'bs.alert';
  632. const EVENT_KEY$b = `.${DATA_KEY$b}`;
  633. const DATA_API_KEY$8 = '.data-api';
  634. const SELECTOR_DISMISS = '[data-bs-dismiss="alert"]';
  635. const EVENT_CLOSE = `close${EVENT_KEY$b}`;
  636. const EVENT_CLOSED = `closed${EVENT_KEY$b}`;
  637. const EVENT_CLICK_DATA_API$7 = `click${EVENT_KEY$b}${DATA_API_KEY$8}`;
  638. const CLASS_NAME_ALERT = 'alert';
  639. const CLASS_NAME_FADE$6 = 'fade';
  640. const CLASS_NAME_SHOW$9 = 'show';
  641. /**
  642. * ------------------------------------------------------------------------
  643. * Class Definition
  644. * ------------------------------------------------------------------------
  645. */
  646. class Alert extends BaseComponent {
  647. // Getters
  648. static get NAME() {
  649. return NAME$c;
  650. } // Public
  651. close(element) {
  652. const rootElement = element ? this._getRootElement(element) : this._element;
  653. const customEvent = this._triggerCloseEvent(rootElement);
  654. if (customEvent === null || customEvent.defaultPrevented) {
  655. return;
  656. }
  657. this._removeElement(rootElement);
  658. } // Private
  659. _getRootElement(element) {
  660. return getElementFromSelector(element) || element.closest(`.${CLASS_NAME_ALERT}`);
  661. }
  662. _triggerCloseEvent(element) {
  663. return EventHandler.trigger(element, EVENT_CLOSE);
  664. }
  665. _removeElement(element) {
  666. element.classList.remove(CLASS_NAME_SHOW$9);
  667. const isAnimated = element.classList.contains(CLASS_NAME_FADE$6);
  668. this._queueCallback(() => this._destroyElement(element), element, isAnimated);
  669. }
  670. _destroyElement(element) {
  671. element.remove();
  672. EventHandler.trigger(element, EVENT_CLOSED);
  673. } // Static
  674. static jQueryInterface(config) {
  675. return this.each(function () {
  676. const data = Alert.getOrCreateInstance(this);
  677. if (config === 'close') {
  678. data[config](this);
  679. }
  680. });
  681. }
  682. static handleDismiss(alertInstance) {
  683. return function (event) {
  684. if (event) {
  685. event.preventDefault();
  686. }
  687. alertInstance.close(this);
  688. };
  689. }
  690. }
  691. /**
  692. * ------------------------------------------------------------------------
  693. * Data Api implementation
  694. * ------------------------------------------------------------------------
  695. */
  696. EventHandler.on(document, EVENT_CLICK_DATA_API$7, SELECTOR_DISMISS, Alert.handleDismiss(new Alert()));
  697. /**
  698. * ------------------------------------------------------------------------
  699. * jQuery
  700. * ------------------------------------------------------------------------
  701. * add .Alert to jQuery only if jQuery is present
  702. */
  703. defineJQueryPlugin(Alert);
  704. /**
  705. * --------------------------------------------------------------------------
  706. * Bootstrap (v5.0.2): button.js
  707. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  708. * --------------------------------------------------------------------------
  709. */
  710. /**
  711. * ------------------------------------------------------------------------
  712. * Constants
  713. * ------------------------------------------------------------------------
  714. */
  715. const NAME$b = 'button';
  716. const DATA_KEY$a = 'bs.button';
  717. const EVENT_KEY$a = `.${DATA_KEY$a}`;
  718. const DATA_API_KEY$7 = '.data-api';
  719. const CLASS_NAME_ACTIVE$3 = 'active';
  720. const SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]';
  721. const EVENT_CLICK_DATA_API$6 = `click${EVENT_KEY$a}${DATA_API_KEY$7}`;
  722. /**
  723. * ------------------------------------------------------------------------
  724. * Class Definition
  725. * ------------------------------------------------------------------------
  726. */
  727. class Button extends BaseComponent {
  728. // Getters
  729. static get NAME() {
  730. return NAME$b;
  731. } // Public
  732. toggle() {
  733. // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method
  734. this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3));
  735. } // Static
  736. static jQueryInterface(config) {
  737. return this.each(function () {
  738. const data = Button.getOrCreateInstance(this);
  739. if (config === 'toggle') {
  740. data[config]();
  741. }
  742. });
  743. }
  744. }
  745. /**
  746. * ------------------------------------------------------------------------
  747. * Data Api implementation
  748. * ------------------------------------------------------------------------
  749. */
  750. EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, event => {
  751. event.preventDefault();
  752. const button = event.target.closest(SELECTOR_DATA_TOGGLE$5);
  753. const data = Button.getOrCreateInstance(button);
  754. data.toggle();
  755. });
  756. /**
  757. * ------------------------------------------------------------------------
  758. * jQuery
  759. * ------------------------------------------------------------------------
  760. * add .Button to jQuery only if jQuery is present
  761. */
  762. defineJQueryPlugin(Button);
  763. /**
  764. * --------------------------------------------------------------------------
  765. * Bootstrap (v5.0.2): dom/manipulator.js
  766. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  767. * --------------------------------------------------------------------------
  768. */
  769. function normalizeData(val) {
  770. if (val === 'true') {
  771. return true;
  772. }
  773. if (val === 'false') {
  774. return false;
  775. }
  776. if (val === Number(val).toString()) {
  777. return Number(val);
  778. }
  779. if (val === '' || val === 'null') {
  780. return null;
  781. }
  782. return val;
  783. }
  784. function normalizeDataKey(key) {
  785. return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`);
  786. }
  787. const Manipulator = {
  788. setDataAttribute(element, key, value) {
  789. element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
  790. },
  791. removeDataAttribute(element, key) {
  792. element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
  793. },
  794. getDataAttributes(element) {
  795. if (!element) {
  796. return {};
  797. }
  798. const attributes = {};
  799. Object.keys(element.dataset).filter(key => key.startsWith('bs')).forEach(key => {
  800. let pureKey = key.replace(/^bs/, '');
  801. pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
  802. attributes[pureKey] = normalizeData(element.dataset[key]);
  803. });
  804. return attributes;
  805. },
  806. getDataAttribute(element, key) {
  807. return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
  808. },
  809. offset(element) {
  810. const rect = element.getBoundingClientRect();
  811. return {
  812. top: rect.top + document.body.scrollTop,
  813. left: rect.left + document.body.scrollLeft
  814. };
  815. },
  816. position(element) {
  817. return {
  818. top: element.offsetTop,
  819. left: element.offsetLeft
  820. };
  821. }
  822. };
  823. /**
  824. * --------------------------------------------------------------------------
  825. * Bootstrap (v5.0.2): carousel.js
  826. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  827. * --------------------------------------------------------------------------
  828. */
  829. /**
  830. * ------------------------------------------------------------------------
  831. * Constants
  832. * ------------------------------------------------------------------------
  833. */
  834. const NAME$a = 'carousel';
  835. const DATA_KEY$9 = 'bs.carousel';
  836. const EVENT_KEY$9 = `.${DATA_KEY$9}`;
  837. const DATA_API_KEY$6 = '.data-api';
  838. const ARROW_LEFT_KEY = 'ArrowLeft';
  839. const ARROW_RIGHT_KEY = 'ArrowRight';
  840. const TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
  841. const SWIPE_THRESHOLD = 40;
  842. const Default$9 = {
  843. interval: 5000,
  844. keyboard: true,
  845. slide: false,
  846. pause: 'hover',
  847. wrap: true,
  848. touch: true
  849. };
  850. const DefaultType$9 = {
  851. interval: '(number|boolean)',
  852. keyboard: 'boolean',
  853. slide: '(boolean|string)',
  854. pause: '(string|boolean)',
  855. wrap: 'boolean',
  856. touch: 'boolean'
  857. };
  858. const ORDER_NEXT = 'next';
  859. const ORDER_PREV = 'prev';
  860. const DIRECTION_LEFT = 'left';
  861. const DIRECTION_RIGHT = 'right';
  862. const KEY_TO_DIRECTION = {
  863. [ARROW_LEFT_KEY]: DIRECTION_RIGHT,
  864. [ARROW_RIGHT_KEY]: DIRECTION_LEFT
  865. };
  866. const EVENT_SLIDE = `slide${EVENT_KEY$9}`;
  867. const EVENT_SLID = `slid${EVENT_KEY$9}`;
  868. const EVENT_KEYDOWN = `keydown${EVENT_KEY$9}`;
  869. const EVENT_MOUSEENTER = `mouseenter${EVENT_KEY$9}`;
  870. const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY$9}`;
  871. const EVENT_TOUCHSTART = `touchstart${EVENT_KEY$9}`;
  872. const EVENT_TOUCHMOVE = `touchmove${EVENT_KEY$9}`;
  873. const EVENT_TOUCHEND = `touchend${EVENT_KEY$9}`;
  874. const EVENT_POINTERDOWN = `pointerdown${EVENT_KEY$9}`;
  875. const EVENT_POINTERUP = `pointerup${EVENT_KEY$9}`;
  876. const EVENT_DRAG_START = `dragstart${EVENT_KEY$9}`;
  877. const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$9}${DATA_API_KEY$6}`;
  878. const EVENT_CLICK_DATA_API$5 = `click${EVENT_KEY$9}${DATA_API_KEY$6}`;
  879. const CLASS_NAME_CAROUSEL = 'carousel';
  880. const CLASS_NAME_ACTIVE$2 = 'active';
  881. const CLASS_NAME_SLIDE = 'slide';
  882. const CLASS_NAME_END = 'carousel-item-end';
  883. const CLASS_NAME_START = 'carousel-item-start';
  884. const CLASS_NAME_NEXT = 'carousel-item-next';
  885. const CLASS_NAME_PREV = 'carousel-item-prev';
  886. const CLASS_NAME_POINTER_EVENT = 'pointer-event';
  887. const SELECTOR_ACTIVE$1 = '.active';
  888. const SELECTOR_ACTIVE_ITEM = '.active.carousel-item';
  889. const SELECTOR_ITEM = '.carousel-item';
  890. const SELECTOR_ITEM_IMG = '.carousel-item img';
  891. const SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev';
  892. const SELECTOR_INDICATORS = '.carousel-indicators';
  893. const SELECTOR_INDICATOR = '[data-bs-target]';
  894. const SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]';
  895. const SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]';
  896. const POINTER_TYPE_TOUCH = 'touch';
  897. const POINTER_TYPE_PEN = 'pen';
  898. /**
  899. * ------------------------------------------------------------------------
  900. * Class Definition
  901. * ------------------------------------------------------------------------
  902. */
  903. class Carousel extends BaseComponent {
  904. constructor(element, config) {
  905. super(element);
  906. this._items = null;
  907. this._interval = null;
  908. this._activeElement = null;
  909. this._isPaused = false;
  910. this._isSliding = false;
  911. this.touchTimeout = null;
  912. this.touchStartX = 0;
  913. this.touchDeltaX = 0;
  914. this._config = this._getConfig(config);
  915. this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element);
  916. this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
  917. this._pointerEvent = Boolean(window.PointerEvent);
  918. this._addEventListeners();
  919. } // Getters
  920. static get Default() {
  921. return Default$9;
  922. }
  923. static get NAME() {
  924. return NAME$a;
  925. } // Public
  926. next() {
  927. this._slide(ORDER_NEXT);
  928. }
  929. nextWhenVisible() {
  930. // Don't call next when the page isn't visible
  931. // or the carousel or its parent isn't visible
  932. if (!document.hidden && isVisible(this._element)) {
  933. this.next();
  934. }
  935. }
  936. prev() {
  937. this._slide(ORDER_PREV);
  938. }
  939. pause(event) {
  940. if (!event) {
  941. this._isPaused = true;
  942. }
  943. if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) {
  944. triggerTransitionEnd(this._element);
  945. this.cycle(true);
  946. }
  947. clearInterval(this._interval);
  948. this._interval = null;
  949. }
  950. cycle(event) {
  951. if (!event) {
  952. this._isPaused = false;
  953. }
  954. if (this._interval) {
  955. clearInterval(this._interval);
  956. this._interval = null;
  957. }
  958. if (this._config && this._config.interval && !this._isPaused) {
  959. this._updateInterval();
  960. this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
  961. }
  962. }
  963. to(index) {
  964. this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
  965. const activeIndex = this._getItemIndex(this._activeElement);
  966. if (index > this._items.length - 1 || index < 0) {
  967. return;
  968. }
  969. if (this._isSliding) {
  970. EventHandler.one(this._element, EVENT_SLID, () => this.to(index));
  971. return;
  972. }
  973. if (activeIndex === index) {
  974. this.pause();
  975. this.cycle();
  976. return;
  977. }
  978. const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
  979. this._slide(order, this._items[index]);
  980. } // Private
  981. _getConfig(config) {
  982. config = { ...Default$9,
  983. ...Manipulator.getDataAttributes(this._element),
  984. ...(typeof config === 'object' ? config : {})
  985. };
  986. typeCheckConfig(NAME$a, config, DefaultType$9);
  987. return config;
  988. }
  989. _handleSwipe() {
  990. const absDeltax = Math.abs(this.touchDeltaX);
  991. if (absDeltax <= SWIPE_THRESHOLD) {
  992. return;
  993. }
  994. const direction = absDeltax / this.touchDeltaX;
  995. this.touchDeltaX = 0;
  996. if (!direction) {
  997. return;
  998. }
  999. this._slide(direction > 0 ? DIRECTION_RIGHT : DIRECTION_LEFT);
  1000. }
  1001. _addEventListeners() {
  1002. if (this._config.keyboard) {
  1003. EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
  1004. }
  1005. if (this._config.pause === 'hover') {
  1006. EventHandler.on(this._element, EVENT_MOUSEENTER, event => this.pause(event));
  1007. EventHandler.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event));
  1008. }
  1009. if (this._config.touch && this._touchSupported) {
  1010. this._addTouchEventListeners();
  1011. }
  1012. }
  1013. _addTouchEventListeners() {
  1014. const start = event => {
  1015. if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
  1016. this.touchStartX = event.clientX;
  1017. } else if (!this._pointerEvent) {
  1018. this.touchStartX = event.touches[0].clientX;
  1019. }
  1020. };
  1021. const move = event => {
  1022. // ensure swiping with one touch and not pinching
  1023. this.touchDeltaX = event.touches && event.touches.length > 1 ? 0 : event.touches[0].clientX - this.touchStartX;
  1024. };
  1025. const end = event => {
  1026. if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) {
  1027. this.touchDeltaX = event.clientX - this.touchStartX;
  1028. }
  1029. this._handleSwipe();
  1030. if (this._config.pause === 'hover') {
  1031. // If it's a touch-enabled device, mouseenter/leave are fired as
  1032. // part of the mouse compatibility events on first tap - the carousel
  1033. // would stop cycling until user tapped out of it;
  1034. // here, we listen for touchend, explicitly pause the carousel
  1035. // (as if it's the second time we tap on it, mouseenter compat event
  1036. // is NOT fired) and after a timeout (to allow for mouse compatibility
  1037. // events to fire) we explicitly restart cycling
  1038. this.pause();
  1039. if (this.touchTimeout) {
  1040. clearTimeout(this.touchTimeout);
  1041. }
  1042. this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval);
  1043. }
  1044. };
  1045. SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => {
  1046. EventHandler.on(itemImg, EVENT_DRAG_START, e => e.preventDefault());
  1047. });
  1048. if (this._pointerEvent) {
  1049. EventHandler.on(this._element, EVENT_POINTERDOWN, event => start(event));
  1050. EventHandler.on(this._element, EVENT_POINTERUP, event => end(event));
  1051. this._element.classList.add(CLASS_NAME_POINTER_EVENT);
  1052. } else {
  1053. EventHandler.on(this._element, EVENT_TOUCHSTART, event => start(event));
  1054. EventHandler.on(this._element, EVENT_TOUCHMOVE, event => move(event));
  1055. EventHandler.on(this._element, EVENT_TOUCHEND, event => end(event));
  1056. }
  1057. }
  1058. _keydown(event) {
  1059. if (/input|textarea/i.test(event.target.tagName)) {
  1060. return;
  1061. }
  1062. const direction = KEY_TO_DIRECTION[event.key];
  1063. if (direction) {
  1064. event.preventDefault();
  1065. this._slide(direction);
  1066. }
  1067. }
  1068. _getItemIndex(element) {
  1069. this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : [];
  1070. return this._items.indexOf(element);
  1071. }
  1072. _getItemByOrder(order, activeElement) {
  1073. const isNext = order === ORDER_NEXT;
  1074. return getNextActiveElement(this._items, activeElement, isNext, this._config.wrap);
  1075. }
  1076. _triggerSlideEvent(relatedTarget, eventDirectionName) {
  1077. const targetIndex = this._getItemIndex(relatedTarget);
  1078. const fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element));
  1079. return EventHandler.trigger(this._element, EVENT_SLIDE, {
  1080. relatedTarget,
  1081. direction: eventDirectionName,
  1082. from: fromIndex,
  1083. to: targetIndex
  1084. });
  1085. }
  1086. _setActiveIndicatorElement(element) {
  1087. if (this._indicatorsElement) {
  1088. const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE$1, this._indicatorsElement);
  1089. activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2);
  1090. activeIndicator.removeAttribute('aria-current');
  1091. const indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement);
  1092. for (let i = 0; i < indicators.length; i++) {
  1093. if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) {
  1094. indicators[i].classList.add(CLASS_NAME_ACTIVE$2);
  1095. indicators[i].setAttribute('aria-current', 'true');
  1096. break;
  1097. }
  1098. }
  1099. }
  1100. }
  1101. _updateInterval() {
  1102. const element = this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
  1103. if (!element) {
  1104. return;
  1105. }
  1106. const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10);
  1107. if (elementInterval) {
  1108. this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
  1109. this._config.interval = elementInterval;
  1110. } else {
  1111. this._config.interval = this._config.defaultInterval || this._config.interval;
  1112. }
  1113. }
  1114. _slide(directionOrOrder, element) {
  1115. const order = this._directionToOrder(directionOrOrder);
  1116. const activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element);
  1117. const activeElementIndex = this._getItemIndex(activeElement);
  1118. const nextElement = element || this._getItemByOrder(order, activeElement);
  1119. const nextElementIndex = this._getItemIndex(nextElement);
  1120. const isCycling = Boolean(this._interval);
  1121. const isNext = order === ORDER_NEXT;
  1122. const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END;
  1123. const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV;
  1124. const eventDirectionName = this._orderToDirection(order);
  1125. if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$2)) {
  1126. this._isSliding = false;
  1127. return;
  1128. }
  1129. if (this._isSliding) {
  1130. return;
  1131. }
  1132. const slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
  1133. if (slideEvent.defaultPrevented) {
  1134. return;
  1135. }
  1136. if (!activeElement || !nextElement) {
  1137. // Some weirdness is happening, so we bail
  1138. return;
  1139. }
  1140. this._isSliding = true;
  1141. if (isCycling) {
  1142. this.pause();
  1143. }
  1144. this._setActiveIndicatorElement(nextElement);
  1145. this._activeElement = nextElement;
  1146. const triggerSlidEvent = () => {
  1147. EventHandler.trigger(this._element, EVENT_SLID, {
  1148. relatedTarget: nextElement,
  1149. direction: eventDirectionName,
  1150. from: activeElementIndex,
  1151. to: nextElementIndex
  1152. });
  1153. };
  1154. if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
  1155. nextElement.classList.add(orderClassName);
  1156. reflow(nextElement);
  1157. activeElement.classList.add(directionalClassName);
  1158. nextElement.classList.add(directionalClassName);
  1159. const completeCallBack = () => {
  1160. nextElement.classList.remove(directionalClassName, orderClassName);
  1161. nextElement.classList.add(CLASS_NAME_ACTIVE$2);
  1162. activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName);
  1163. this._isSliding = false;
  1164. setTimeout(triggerSlidEvent, 0);
  1165. };
  1166. this._queueCallback(completeCallBack, activeElement, true);
  1167. } else {
  1168. activeElement.classList.remove(CLASS_NAME_ACTIVE$2);
  1169. nextElement.classList.add(CLASS_NAME_ACTIVE$2);
  1170. this._isSliding = false;
  1171. triggerSlidEvent();
  1172. }
  1173. if (isCycling) {
  1174. this.cycle();
  1175. }
  1176. }
  1177. _directionToOrder(direction) {
  1178. if (![DIRECTION_RIGHT, DIRECTION_LEFT].includes(direction)) {
  1179. return direction;
  1180. }
  1181. if (isRTL()) {
  1182. return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT;
  1183. }
  1184. return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV;
  1185. }
  1186. _orderToDirection(order) {
  1187. if (![ORDER_NEXT, ORDER_PREV].includes(order)) {
  1188. return order;
  1189. }
  1190. if (isRTL()) {
  1191. return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT;
  1192. }
  1193. return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT;
  1194. } // Static
  1195. static carouselInterface(element, config) {
  1196. const data = Carousel.getOrCreateInstance(element, config);
  1197. let {
  1198. _config
  1199. } = data;
  1200. if (typeof config === 'object') {
  1201. _config = { ..._config,
  1202. ...config
  1203. };
  1204. }
  1205. const action = typeof config === 'string' ? config : _config.slide;
  1206. if (typeof config === 'number') {
  1207. data.to(config);
  1208. } else if (typeof action === 'string') {
  1209. if (typeof data[action] === 'undefined') {
  1210. throw new TypeError(`No method named "${action}"`);
  1211. }
  1212. data[action]();
  1213. } else if (_config.interval && _config.ride) {
  1214. data.pause();
  1215. data.cycle();
  1216. }
  1217. }
  1218. static jQueryInterface(config) {
  1219. return this.each(function () {
  1220. Carousel.carouselInterface(this, config);
  1221. });
  1222. }
  1223. static dataApiClickHandler(event) {
  1224. const target = getElementFromSelector(this);
  1225. if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {
  1226. return;
  1227. }
  1228. const config = { ...Manipulator.getDataAttributes(target),
  1229. ...Manipulator.getDataAttributes(this)
  1230. };
  1231. const slideIndex = this.getAttribute('data-bs-slide-to');
  1232. if (slideIndex) {
  1233. config.interval = false;
  1234. }
  1235. Carousel.carouselInterface(target, config);
  1236. if (slideIndex) {
  1237. Carousel.getInstance(target).to(slideIndex);
  1238. }
  1239. event.preventDefault();
  1240. }
  1241. }
  1242. /**
  1243. * ------------------------------------------------------------------------
  1244. * Data Api implementation
  1245. * ------------------------------------------------------------------------
  1246. */
  1247. EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler);
  1248. EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
  1249. const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE);
  1250. for (let i = 0, len = carousels.length; i < len; i++) {
  1251. Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i]));
  1252. }
  1253. });
  1254. /**
  1255. * ------------------------------------------------------------------------
  1256. * jQuery
  1257. * ------------------------------------------------------------------------
  1258. * add .Carousel to jQuery only if jQuery is present
  1259. */
  1260. defineJQueryPlugin(Carousel);
  1261. /**
  1262. * --------------------------------------------------------------------------
  1263. * Bootstrap (v5.0.2): collapse.js
  1264. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1265. * --------------------------------------------------------------------------
  1266. */
  1267. /**
  1268. * ------------------------------------------------------------------------
  1269. * Constants
  1270. * ------------------------------------------------------------------------
  1271. */
  1272. const NAME$9 = 'collapse';
  1273. const DATA_KEY$8 = 'bs.collapse';
  1274. const EVENT_KEY$8 = `.${DATA_KEY$8}`;
  1275. const DATA_API_KEY$5 = '.data-api';
  1276. const Default$8 = {
  1277. toggle: true,
  1278. parent: ''
  1279. };
  1280. const DefaultType$8 = {
  1281. toggle: 'boolean',
  1282. parent: '(string|element)'
  1283. };
  1284. const EVENT_SHOW$5 = `show${EVENT_KEY$8}`;
  1285. const EVENT_SHOWN$5 = `shown${EVENT_KEY$8}`;
  1286. const EVENT_HIDE$5 = `hide${EVENT_KEY$8}`;
  1287. const EVENT_HIDDEN$5 = `hidden${EVENT_KEY$8}`;
  1288. const EVENT_CLICK_DATA_API$4 = `click${EVENT_KEY$8}${DATA_API_KEY$5}`;
  1289. const CLASS_NAME_SHOW$8 = 'show';
  1290. const CLASS_NAME_COLLAPSE = 'collapse';
  1291. const CLASS_NAME_COLLAPSING = 'collapsing';
  1292. const CLASS_NAME_COLLAPSED = 'collapsed';
  1293. const WIDTH = 'width';
  1294. const HEIGHT = 'height';
  1295. const SELECTOR_ACTIVES = '.show, .collapsing';
  1296. const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
  1297. /**
  1298. * ------------------------------------------------------------------------
  1299. * Class Definition
  1300. * ------------------------------------------------------------------------
  1301. */
  1302. class Collapse extends BaseComponent {
  1303. constructor(element, config) {
  1304. super(element);
  1305. this._isTransitioning = false;
  1306. this._config = this._getConfig(config);
  1307. this._triggerArray = SelectorEngine.find(`${SELECTOR_DATA_TOGGLE$4}[href="#${this._element.id}"],` + `${SELECTOR_DATA_TOGGLE$4}[data-bs-target="#${this._element.id}"]`);
  1308. const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4);
  1309. for (let i = 0, len = toggleList.length; i < len; i++) {
  1310. const elem = toggleList[i];
  1311. const selector = getSelectorFromElement(elem);
  1312. const filterElement = SelectorEngine.find(selector).filter(foundElem => foundElem === this._element);
  1313. if (selector !== null && filterElement.length) {
  1314. this._selector = selector;
  1315. this._triggerArray.push(elem);
  1316. }
  1317. }
  1318. this._parent = this._config.parent ? this._getParent() : null;
  1319. if (!this._config.parent) {
  1320. this._addAriaAndCollapsedClass(this._element, this._triggerArray);
  1321. }
  1322. if (this._config.toggle) {
  1323. this.toggle();
  1324. }
  1325. } // Getters
  1326. static get Default() {
  1327. return Default$8;
  1328. }
  1329. static get NAME() {
  1330. return NAME$9;
  1331. } // Public
  1332. toggle() {
  1333. if (this._element.classList.contains(CLASS_NAME_SHOW$8)) {
  1334. this.hide();
  1335. } else {
  1336. this.show();
  1337. }
  1338. }
  1339. show() {
  1340. if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$8)) {
  1341. return;
  1342. }
  1343. let actives;
  1344. let activesData;
  1345. if (this._parent) {
  1346. actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(elem => {
  1347. if (typeof this._config.parent === 'string') {
  1348. return elem.getAttribute('data-bs-parent') === this._config.parent;
  1349. }
  1350. return elem.classList.contains(CLASS_NAME_COLLAPSE);
  1351. });
  1352. if (actives.length === 0) {
  1353. actives = null;
  1354. }
  1355. }
  1356. const container = SelectorEngine.findOne(this._selector);
  1357. if (actives) {
  1358. const tempActiveData = actives.find(elem => container !== elem);
  1359. activesData = tempActiveData ? Collapse.getInstance(tempActiveData) : null;
  1360. if (activesData && activesData._isTransitioning) {
  1361. return;
  1362. }
  1363. }
  1364. const startEvent = EventHandler.trigger(this._element, EVENT_SHOW$5);
  1365. if (startEvent.defaultPrevented) {
  1366. return;
  1367. }
  1368. if (actives) {
  1369. actives.forEach(elemActive => {
  1370. if (container !== elemActive) {
  1371. Collapse.collapseInterface(elemActive, 'hide');
  1372. }
  1373. if (!activesData) {
  1374. Data.set(elemActive, DATA_KEY$8, null);
  1375. }
  1376. });
  1377. }
  1378. const dimension = this._getDimension();
  1379. this._element.classList.remove(CLASS_NAME_COLLAPSE);
  1380. this._element.classList.add(CLASS_NAME_COLLAPSING);
  1381. this._element.style[dimension] = 0;
  1382. if (this._triggerArray.length) {
  1383. this._triggerArray.forEach(element => {
  1384. element.classList.remove(CLASS_NAME_COLLAPSED);
  1385. element.setAttribute('aria-expanded', true);
  1386. });
  1387. }
  1388. this.setTransitioning(true);
  1389. const complete = () => {
  1390. this._element.classList.remove(CLASS_NAME_COLLAPSING);
  1391. this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$8);
  1392. this._element.style[dimension] = '';
  1393. this.setTransitioning(false);
  1394. EventHandler.trigger(this._element, EVENT_SHOWN$5);
  1395. };
  1396. const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
  1397. const scrollSize = `scroll${capitalizedDimension}`;
  1398. this._queueCallback(complete, this._element, true);
  1399. this._element.style[dimension] = `${this._element[scrollSize]}px`;
  1400. }
  1401. hide() {
  1402. if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$8)) {
  1403. return;
  1404. }
  1405. const startEvent = EventHandler.trigger(this._element, EVENT_HIDE$5);
  1406. if (startEvent.defaultPrevented) {
  1407. return;
  1408. }
  1409. const dimension = this._getDimension();
  1410. this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
  1411. reflow(this._element);
  1412. this._element.classList.add(CLASS_NAME_COLLAPSING);
  1413. this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$8);
  1414. const triggerArrayLength = this._triggerArray.length;
  1415. if (triggerArrayLength > 0) {
  1416. for (let i = 0; i < triggerArrayLength; i++) {
  1417. const trigger = this._triggerArray[i];
  1418. const elem = getElementFromSelector(trigger);
  1419. if (elem && !elem.classList.contains(CLASS_NAME_SHOW$8)) {
  1420. trigger.classList.add(CLASS_NAME_COLLAPSED);
  1421. trigger.setAttribute('aria-expanded', false);
  1422. }
  1423. }
  1424. }
  1425. this.setTransitioning(true);
  1426. const complete = () => {
  1427. this.setTransitioning(false);
  1428. this._element.classList.remove(CLASS_NAME_COLLAPSING);
  1429. this._element.classList.add(CLASS_NAME_COLLAPSE);
  1430. EventHandler.trigger(this._element, EVENT_HIDDEN$5);
  1431. };
  1432. this._element.style[dimension] = '';
  1433. this._queueCallback(complete, this._element, true);
  1434. }
  1435. setTransitioning(isTransitioning) {
  1436. this._isTransitioning = isTransitioning;
  1437. } // Private
  1438. _getConfig(config) {
  1439. config = { ...Default$8,
  1440. ...config
  1441. };
  1442. config.toggle = Boolean(config.toggle); // Coerce string values
  1443. typeCheckConfig(NAME$9, config, DefaultType$8);
  1444. return config;
  1445. }
  1446. _getDimension() {
  1447. return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT;
  1448. }
  1449. _getParent() {
  1450. let {
  1451. parent
  1452. } = this._config;
  1453. parent = getElement(parent);
  1454. const selector = `${SELECTOR_DATA_TOGGLE$4}[data-bs-parent="${parent}"]`;
  1455. SelectorEngine.find(selector, parent).forEach(element => {
  1456. const selected = getElementFromSelector(element);
  1457. this._addAriaAndCollapsedClass(selected, [element]);
  1458. });
  1459. return parent;
  1460. }
  1461. _addAriaAndCollapsedClass(element, triggerArray) {
  1462. if (!element || !triggerArray.length) {
  1463. return;
  1464. }
  1465. const isOpen = element.classList.contains(CLASS_NAME_SHOW$8);
  1466. triggerArray.forEach(elem => {
  1467. if (isOpen) {
  1468. elem.classList.remove(CLASS_NAME_COLLAPSED);
  1469. } else {
  1470. elem.classList.add(CLASS_NAME_COLLAPSED);
  1471. }
  1472. elem.setAttribute('aria-expanded', isOpen);
  1473. });
  1474. } // Static
  1475. static collapseInterface(element, config) {
  1476. let data = Collapse.getInstance(element);
  1477. const _config = { ...Default$8,
  1478. ...Manipulator.getDataAttributes(element),
  1479. ...(typeof config === 'object' && config ? config : {})
  1480. };
  1481. if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) {
  1482. _config.toggle = false;
  1483. }
  1484. if (!data) {
  1485. data = new Collapse(element, _config);
  1486. }
  1487. if (typeof config === 'string') {
  1488. if (typeof data[config] === 'undefined') {
  1489. throw new TypeError(`No method named "${config}"`);
  1490. }
  1491. data[config]();
  1492. }
  1493. }
  1494. static jQueryInterface(config) {
  1495. return this.each(function () {
  1496. Collapse.collapseInterface(this, config);
  1497. });
  1498. }
  1499. }
  1500. /**
  1501. * ------------------------------------------------------------------------
  1502. * Data Api implementation
  1503. * ------------------------------------------------------------------------
  1504. */
  1505. EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function (event) {
  1506. // preventDefault only for <a> elements (which change the URL) not inside the collapsible element
  1507. if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') {
  1508. event.preventDefault();
  1509. }
  1510. const triggerData = Manipulator.getDataAttributes(this);
  1511. const selector = getSelectorFromElement(this);
  1512. const selectorElements = SelectorEngine.find(selector);
  1513. selectorElements.forEach(element => {
  1514. const data = Collapse.getInstance(element);
  1515. let config;
  1516. if (data) {
  1517. // update parent attribute
  1518. if (data._parent === null && typeof triggerData.parent === 'string') {
  1519. data._config.parent = triggerData.parent;
  1520. data._parent = data._getParent();
  1521. }
  1522. config = 'toggle';
  1523. } else {
  1524. config = triggerData;
  1525. }
  1526. Collapse.collapseInterface(element, config);
  1527. });
  1528. });
  1529. /**
  1530. * ------------------------------------------------------------------------
  1531. * jQuery
  1532. * ------------------------------------------------------------------------
  1533. * add .Collapse to jQuery only if jQuery is present
  1534. */
  1535. defineJQueryPlugin(Collapse);
  1536. /**
  1537. * --------------------------------------------------------------------------
  1538. * Bootstrap (v5.0.2): dropdown.js
  1539. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1540. * --------------------------------------------------------------------------
  1541. */
  1542. /**
  1543. * ------------------------------------------------------------------------
  1544. * Constants
  1545. * ------------------------------------------------------------------------
  1546. */
  1547. const NAME$8 = 'dropdown';
  1548. const DATA_KEY$7 = 'bs.dropdown';
  1549. const EVENT_KEY$7 = `.${DATA_KEY$7}`;
  1550. const DATA_API_KEY$4 = '.data-api';
  1551. const ESCAPE_KEY$2 = 'Escape';
  1552. const SPACE_KEY = 'Space';
  1553. const TAB_KEY = 'Tab';
  1554. const ARROW_UP_KEY = 'ArrowUp';
  1555. const ARROW_DOWN_KEY = 'ArrowDown';
  1556. const RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button
  1557. const REGEXP_KEYDOWN = new RegExp(`${ARROW_UP_KEY}|${ARROW_DOWN_KEY}|${ESCAPE_KEY$2}`);
  1558. const EVENT_HIDE$4 = `hide${EVENT_KEY$7}`;
  1559. const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$7}`;
  1560. const EVENT_SHOW$4 = `show${EVENT_KEY$7}`;
  1561. const EVENT_SHOWN$4 = `shown${EVENT_KEY$7}`;
  1562. const EVENT_CLICK = `click${EVENT_KEY$7}`;
  1563. const EVENT_CLICK_DATA_API$3 = `click${EVENT_KEY$7}${DATA_API_KEY$4}`;
  1564. const EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY$7}${DATA_API_KEY$4}`;
  1565. const EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY$7}${DATA_API_KEY$4}`;
  1566. const CLASS_NAME_SHOW$7 = 'show';
  1567. const CLASS_NAME_DROPUP = 'dropup';
  1568. const CLASS_NAME_DROPEND = 'dropend';
  1569. const CLASS_NAME_DROPSTART = 'dropstart';
  1570. const CLASS_NAME_NAVBAR = 'navbar';
  1571. const SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]';
  1572. const SELECTOR_MENU = '.dropdown-menu';
  1573. const SELECTOR_NAVBAR_NAV = '.navbar-nav';
  1574. const SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)';
  1575. const PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start';
  1576. const PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end';
  1577. const PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start';
  1578. const PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end';
  1579. const PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start';
  1580. const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
  1581. const Default$7 = {
  1582. offset: [0, 2],
  1583. boundary: 'clippingParents',
  1584. reference: 'toggle',
  1585. display: 'dynamic',
  1586. popperConfig: null,
  1587. autoClose: true
  1588. };
  1589. const DefaultType$7 = {
  1590. offset: '(array|string|function)',
  1591. boundary: '(string|element)',
  1592. reference: '(string|element|object)',
  1593. display: 'string',
  1594. popperConfig: '(null|object|function)',
  1595. autoClose: '(boolean|string)'
  1596. };
  1597. /**
  1598. * ------------------------------------------------------------------------
  1599. * Class Definition
  1600. * ------------------------------------------------------------------------
  1601. */
  1602. class Dropdown extends BaseComponent {
  1603. constructor(element, config) {
  1604. super(element);
  1605. this._popper = null;
  1606. this._config = this._getConfig(config);
  1607. this._menu = this._getMenuElement();
  1608. this._inNavbar = this._detectNavbar();
  1609. this._addEventListeners();
  1610. } // Getters
  1611. static get Default() {
  1612. return Default$7;
  1613. }
  1614. static get DefaultType() {
  1615. return DefaultType$7;
  1616. }
  1617. static get NAME() {
  1618. return NAME$8;
  1619. } // Public
  1620. toggle() {
  1621. if (isDisabled(this._element)) {
  1622. return;
  1623. }
  1624. const isActive = this._element.classList.contains(CLASS_NAME_SHOW$7);
  1625. if (isActive) {
  1626. this.hide();
  1627. return;
  1628. }
  1629. this.show();
  1630. }
  1631. show() {
  1632. if (isDisabled(this._element) || this._menu.classList.contains(CLASS_NAME_SHOW$7)) {
  1633. return;
  1634. }
  1635. const parent = Dropdown.getParentFromElement(this._element);
  1636. const relatedTarget = {
  1637. relatedTarget: this._element
  1638. };
  1639. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, relatedTarget);
  1640. if (showEvent.defaultPrevented) {
  1641. return;
  1642. } // Totally disable Popper for Dropdowns in Navbar
  1643. if (this._inNavbar) {
  1644. Manipulator.setDataAttribute(this._menu, 'popper', 'none');
  1645. } else {
  1646. if (typeof Popper === 'undefined') {
  1647. throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)');
  1648. }
  1649. let referenceElement = this._element;
  1650. if (this._config.reference === 'parent') {
  1651. referenceElement = parent;
  1652. } else if (isElement(this._config.reference)) {
  1653. referenceElement = getElement(this._config.reference);
  1654. } else if (typeof this._config.reference === 'object') {
  1655. referenceElement = this._config.reference;
  1656. }
  1657. const popperConfig = this._getPopperConfig();
  1658. const isDisplayStatic = popperConfig.modifiers.find(modifier => modifier.name === 'applyStyles' && modifier.enabled === false);
  1659. this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig);
  1660. if (isDisplayStatic) {
  1661. Manipulator.setDataAttribute(this._menu, 'popper', 'static');
  1662. }
  1663. } // If this is a touch-enabled device we add extra
  1664. // empty mouseover listeners to the body's immediate children;
  1665. // only needed because of broken event delegation on iOS
  1666. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  1667. if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) {
  1668. [].concat(...document.body.children).forEach(elem => EventHandler.on(elem, 'mouseover', noop));
  1669. }
  1670. this._element.focus();
  1671. this._element.setAttribute('aria-expanded', true);
  1672. this._menu.classList.toggle(CLASS_NAME_SHOW$7);
  1673. this._element.classList.toggle(CLASS_NAME_SHOW$7);
  1674. EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget);
  1675. }
  1676. hide() {
  1677. if (isDisabled(this._element) || !this._menu.classList.contains(CLASS_NAME_SHOW$7)) {
  1678. return;
  1679. }
  1680. const relatedTarget = {
  1681. relatedTarget: this._element
  1682. };
  1683. this._completeHide(relatedTarget);
  1684. }
  1685. dispose() {
  1686. if (this._popper) {
  1687. this._popper.destroy();
  1688. }
  1689. super.dispose();
  1690. }
  1691. update() {
  1692. this._inNavbar = this._detectNavbar();
  1693. if (this._popper) {
  1694. this._popper.update();
  1695. }
  1696. } // Private
  1697. _addEventListeners() {
  1698. EventHandler.on(this._element, EVENT_CLICK, event => {
  1699. event.preventDefault();
  1700. this.toggle();
  1701. });
  1702. }
  1703. _completeHide(relatedTarget) {
  1704. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget);
  1705. if (hideEvent.defaultPrevented) {
  1706. return;
  1707. } // If this is a touch-enabled device we remove the extra
  1708. // empty mouseover listeners we added for iOS support
  1709. if ('ontouchstart' in document.documentElement) {
  1710. [].concat(...document.body.children).forEach(elem => EventHandler.off(elem, 'mouseover', noop));
  1711. }
  1712. if (this._popper) {
  1713. this._popper.destroy();
  1714. }
  1715. this._menu.classList.remove(CLASS_NAME_SHOW$7);
  1716. this._element.classList.remove(CLASS_NAME_SHOW$7);
  1717. this._element.setAttribute('aria-expanded', 'false');
  1718. Manipulator.removeDataAttribute(this._menu, 'popper');
  1719. EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget);
  1720. }
  1721. _getConfig(config) {
  1722. config = { ...this.constructor.Default,
  1723. ...Manipulator.getDataAttributes(this._element),
  1724. ...config
  1725. };
  1726. typeCheckConfig(NAME$8, config, this.constructor.DefaultType);
  1727. if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') {
  1728. // Popper virtual elements require a getBoundingClientRect method
  1729. throw new TypeError(`${NAME$8.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
  1730. }
  1731. return config;
  1732. }
  1733. _getMenuElement() {
  1734. return SelectorEngine.next(this._element, SELECTOR_MENU)[0];
  1735. }
  1736. _getPlacement() {
  1737. const parentDropdown = this._element.parentNode;
  1738. if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
  1739. return PLACEMENT_RIGHT;
  1740. }
  1741. if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
  1742. return PLACEMENT_LEFT;
  1743. } // We need to trim the value because custom properties can also include spaces
  1744. const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end';
  1745. if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
  1746. return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
  1747. }
  1748. return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
  1749. }
  1750. _detectNavbar() {
  1751. return this._element.closest(`.${CLASS_NAME_NAVBAR}`) !== null;
  1752. }
  1753. _getOffset() {
  1754. const {
  1755. offset
  1756. } = this._config;
  1757. if (typeof offset === 'string') {
  1758. return offset.split(',').map(val => Number.parseInt(val, 10));
  1759. }
  1760. if (typeof offset === 'function') {
  1761. return popperData => offset(popperData, this._element);
  1762. }
  1763. return offset;
  1764. }
  1765. _getPopperConfig() {
  1766. const defaultBsPopperConfig = {
  1767. placement: this._getPlacement(),
  1768. modifiers: [{
  1769. name: 'preventOverflow',
  1770. options: {
  1771. boundary: this._config.boundary
  1772. }
  1773. }, {
  1774. name: 'offset',
  1775. options: {
  1776. offset: this._getOffset()
  1777. }
  1778. }]
  1779. }; // Disable Popper if we have a static display
  1780. if (this._config.display === 'static') {
  1781. defaultBsPopperConfig.modifiers = [{
  1782. name: 'applyStyles',
  1783. enabled: false
  1784. }];
  1785. }
  1786. return { ...defaultBsPopperConfig,
  1787. ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
  1788. };
  1789. }
  1790. _selectMenuItem({
  1791. key,
  1792. target
  1793. }) {
  1794. const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(isVisible);
  1795. if (!items.length) {
  1796. return;
  1797. } // if target isn't included in items (e.g. when expanding the dropdown)
  1798. // allow cycling to get the last item in case key equals ARROW_UP_KEY
  1799. getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
  1800. } // Static
  1801. static dropdownInterface(element, config) {
  1802. const data = Dropdown.getOrCreateInstance(element, config);
  1803. if (typeof config === 'string') {
  1804. if (typeof data[config] === 'undefined') {
  1805. throw new TypeError(`No method named "${config}"`);
  1806. }
  1807. data[config]();
  1808. }
  1809. }
  1810. static jQueryInterface(config) {
  1811. return this.each(function () {
  1812. Dropdown.dropdownInterface(this, config);
  1813. });
  1814. }
  1815. static clearMenus(event) {
  1816. if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY)) {
  1817. return;
  1818. }
  1819. const toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3);
  1820. for (let i = 0, len = toggles.length; i < len; i++) {
  1821. const context = Dropdown.getInstance(toggles[i]);
  1822. if (!context || context._config.autoClose === false) {
  1823. continue;
  1824. }
  1825. if (!context._element.classList.contains(CLASS_NAME_SHOW$7)) {
  1826. continue;
  1827. }
  1828. const relatedTarget = {
  1829. relatedTarget: context._element
  1830. };
  1831. if (event) {
  1832. const composedPath = event.composedPath();
  1833. const isMenuTarget = composedPath.includes(context._menu);
  1834. if (composedPath.includes(context._element) || context._config.autoClose === 'inside' && !isMenuTarget || context._config.autoClose === 'outside' && isMenuTarget) {
  1835. continue;
  1836. } // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu
  1837. if (context._menu.contains(event.target) && (event.type === 'keyup' && event.key === TAB_KEY || /input|select|option|textarea|form/i.test(event.target.tagName))) {
  1838. continue;
  1839. }
  1840. if (event.type === 'click') {
  1841. relatedTarget.clickEvent = event;
  1842. }
  1843. }
  1844. context._completeHide(relatedTarget);
  1845. }
  1846. }
  1847. static getParentFromElement(element) {
  1848. return getElementFromSelector(element) || element.parentNode;
  1849. }
  1850. static dataApiKeydownHandler(event) {
  1851. // If not input/textarea:
  1852. // - And not a key in REGEXP_KEYDOWN => not a dropdown command
  1853. // If input/textarea:
  1854. // - If space key => not a dropdown command
  1855. // - If key is other than escape
  1856. // - If key is not up or down => not a dropdown command
  1857. // - If trigger inside the menu => not a dropdown command
  1858. if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY$2 && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) {
  1859. return;
  1860. }
  1861. const isActive = this.classList.contains(CLASS_NAME_SHOW$7);
  1862. if (!isActive && event.key === ESCAPE_KEY$2) {
  1863. return;
  1864. }
  1865. event.preventDefault();
  1866. event.stopPropagation();
  1867. if (isDisabled(this)) {
  1868. return;
  1869. }
  1870. const getToggleButton = () => this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0];
  1871. if (event.key === ESCAPE_KEY$2) {
  1872. getToggleButton().focus();
  1873. Dropdown.clearMenus();
  1874. return;
  1875. }
  1876. if (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY) {
  1877. if (!isActive) {
  1878. getToggleButton().click();
  1879. }
  1880. Dropdown.getInstance(getToggleButton())._selectMenuItem(event);
  1881. return;
  1882. }
  1883. if (!isActive || event.key === SPACE_KEY) {
  1884. Dropdown.clearMenus();
  1885. }
  1886. }
  1887. }
  1888. /**
  1889. * ------------------------------------------------------------------------
  1890. * Data Api implementation
  1891. * ------------------------------------------------------------------------
  1892. */
  1893. EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler);
  1894. EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
  1895. EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus);
  1896. EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
  1897. EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) {
  1898. event.preventDefault();
  1899. Dropdown.dropdownInterface(this);
  1900. });
  1901. /**
  1902. * ------------------------------------------------------------------------
  1903. * jQuery
  1904. * ------------------------------------------------------------------------
  1905. * add .Dropdown to jQuery only if jQuery is present
  1906. */
  1907. defineJQueryPlugin(Dropdown);
  1908. /**
  1909. * --------------------------------------------------------------------------
  1910. * Bootstrap (v5.0.2): util/scrollBar.js
  1911. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  1912. * --------------------------------------------------------------------------
  1913. */
  1914. const SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
  1915. const SELECTOR_STICKY_CONTENT = '.sticky-top';
  1916. class ScrollBarHelper {
  1917. constructor() {
  1918. this._element = document.body;
  1919. }
  1920. getWidth() {
  1921. // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes
  1922. const documentWidth = document.documentElement.clientWidth;
  1923. return Math.abs(window.innerWidth - documentWidth);
  1924. }
  1925. hide() {
  1926. const width = this.getWidth();
  1927. this._disableOverFlow(); // give padding to element to balance the hidden scrollbar width
  1928. this._setElementAttributes(this._element, 'paddingRight', calculatedValue => calculatedValue + width); // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth
  1929. this._setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', calculatedValue => calculatedValue + width);
  1930. this._setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', calculatedValue => calculatedValue - width);
  1931. }
  1932. _disableOverFlow() {
  1933. this._saveInitialAttribute(this._element, 'overflow');
  1934. this._element.style.overflow = 'hidden';
  1935. }
  1936. _setElementAttributes(selector, styleProp, callback) {
  1937. const scrollbarWidth = this.getWidth();
  1938. const manipulationCallBack = element => {
  1939. if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
  1940. return;
  1941. }
  1942. this._saveInitialAttribute(element, styleProp);
  1943. const calculatedValue = window.getComputedStyle(element)[styleProp];
  1944. element.style[styleProp] = `${callback(Number.parseFloat(calculatedValue))}px`;
  1945. };
  1946. this._applyManipulationCallback(selector, manipulationCallBack);
  1947. }
  1948. reset() {
  1949. this._resetElementAttributes(this._element, 'overflow');
  1950. this._resetElementAttributes(this._element, 'paddingRight');
  1951. this._resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight');
  1952. this._resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight');
  1953. }
  1954. _saveInitialAttribute(element, styleProp) {
  1955. const actualValue = element.style[styleProp];
  1956. if (actualValue) {
  1957. Manipulator.setDataAttribute(element, styleProp, actualValue);
  1958. }
  1959. }
  1960. _resetElementAttributes(selector, styleProp) {
  1961. const manipulationCallBack = element => {
  1962. const value = Manipulator.getDataAttribute(element, styleProp);
  1963. if (typeof value === 'undefined') {
  1964. element.style.removeProperty(styleProp);
  1965. } else {
  1966. Manipulator.removeDataAttribute(element, styleProp);
  1967. element.style[styleProp] = value;
  1968. }
  1969. };
  1970. this._applyManipulationCallback(selector, manipulationCallBack);
  1971. }
  1972. _applyManipulationCallback(selector, callBack) {
  1973. if (isElement(selector)) {
  1974. callBack(selector);
  1975. } else {
  1976. SelectorEngine.find(selector, this._element).forEach(callBack);
  1977. }
  1978. }
  1979. isOverflowing() {
  1980. return this.getWidth() > 0;
  1981. }
  1982. }
  1983. /**
  1984. * --------------------------------------------------------------------------
  1985. * Bootstrap (v5.0.2): util/backdrop.js
  1986. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  1987. * --------------------------------------------------------------------------
  1988. */
  1989. const Default$6 = {
  1990. isVisible: true,
  1991. // if false, we use the backdrop helper without adding any element to the dom
  1992. isAnimated: false,
  1993. rootElement: 'body',
  1994. // give the choice to place backdrop under different elements
  1995. clickCallback: null
  1996. };
  1997. const DefaultType$6 = {
  1998. isVisible: 'boolean',
  1999. isAnimated: 'boolean',
  2000. rootElement: '(element|string)',
  2001. clickCallback: '(function|null)'
  2002. };
  2003. const NAME$7 = 'backdrop';
  2004. const CLASS_NAME_BACKDROP = 'modal-backdrop';
  2005. const CLASS_NAME_FADE$5 = 'fade';
  2006. const CLASS_NAME_SHOW$6 = 'show';
  2007. const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$7}`;
  2008. class Backdrop {
  2009. constructor(config) {
  2010. this._config = this._getConfig(config);
  2011. this._isAppended = false;
  2012. this._element = null;
  2013. }
  2014. show(callback) {
  2015. if (!this._config.isVisible) {
  2016. execute(callback);
  2017. return;
  2018. }
  2019. this._append();
  2020. if (this._config.isAnimated) {
  2021. reflow(this._getElement());
  2022. }
  2023. this._getElement().classList.add(CLASS_NAME_SHOW$6);
  2024. this._emulateAnimation(() => {
  2025. execute(callback);
  2026. });
  2027. }
  2028. hide(callback) {
  2029. if (!this._config.isVisible) {
  2030. execute(callback);
  2031. return;
  2032. }
  2033. this._getElement().classList.remove(CLASS_NAME_SHOW$6);
  2034. this._emulateAnimation(() => {
  2035. this.dispose();
  2036. execute(callback);
  2037. });
  2038. } // Private
  2039. _getElement() {
  2040. if (!this._element) {
  2041. const backdrop = document.createElement('div');
  2042. backdrop.className = CLASS_NAME_BACKDROP;
  2043. if (this._config.isAnimated) {
  2044. backdrop.classList.add(CLASS_NAME_FADE$5);
  2045. }
  2046. this._element = backdrop;
  2047. }
  2048. return this._element;
  2049. }
  2050. _getConfig(config) {
  2051. config = { ...Default$6,
  2052. ...(typeof config === 'object' ? config : {})
  2053. }; // use getElement() with the default "body" to get a fresh Element on each instantiation
  2054. config.rootElement = getElement(config.rootElement);
  2055. typeCheckConfig(NAME$7, config, DefaultType$6);
  2056. return config;
  2057. }
  2058. _append() {
  2059. if (this._isAppended) {
  2060. return;
  2061. }
  2062. this._config.rootElement.appendChild(this._getElement());
  2063. EventHandler.on(this._getElement(), EVENT_MOUSEDOWN, () => {
  2064. execute(this._config.clickCallback);
  2065. });
  2066. this._isAppended = true;
  2067. }
  2068. dispose() {
  2069. if (!this._isAppended) {
  2070. return;
  2071. }
  2072. EventHandler.off(this._element, EVENT_MOUSEDOWN);
  2073. this._element.remove();
  2074. this._isAppended = false;
  2075. }
  2076. _emulateAnimation(callback) {
  2077. executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
  2078. }
  2079. }
  2080. /**
  2081. * --------------------------------------------------------------------------
  2082. * Bootstrap (v5.0.2): modal.js
  2083. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2084. * --------------------------------------------------------------------------
  2085. */
  2086. /**
  2087. * ------------------------------------------------------------------------
  2088. * Constants
  2089. * ------------------------------------------------------------------------
  2090. */
  2091. const NAME$6 = 'modal';
  2092. const DATA_KEY$6 = 'bs.modal';
  2093. const EVENT_KEY$6 = `.${DATA_KEY$6}`;
  2094. const DATA_API_KEY$3 = '.data-api';
  2095. const ESCAPE_KEY$1 = 'Escape';
  2096. const Default$5 = {
  2097. backdrop: true,
  2098. keyboard: true,
  2099. focus: true
  2100. };
  2101. const DefaultType$5 = {
  2102. backdrop: '(boolean|string)',
  2103. keyboard: 'boolean',
  2104. focus: 'boolean'
  2105. };
  2106. const EVENT_HIDE$3 = `hide${EVENT_KEY$6}`;
  2107. const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$6}`;
  2108. const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$6}`;
  2109. const EVENT_SHOW$3 = `show${EVENT_KEY$6}`;
  2110. const EVENT_SHOWN$3 = `shown${EVENT_KEY$6}`;
  2111. const EVENT_FOCUSIN$2 = `focusin${EVENT_KEY$6}`;
  2112. const EVENT_RESIZE = `resize${EVENT_KEY$6}`;
  2113. const EVENT_CLICK_DISMISS$2 = `click.dismiss${EVENT_KEY$6}`;
  2114. const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$6}`;
  2115. const EVENT_MOUSEUP_DISMISS = `mouseup.dismiss${EVENT_KEY$6}`;
  2116. const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$6}`;
  2117. const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$6}${DATA_API_KEY$3}`;
  2118. const CLASS_NAME_OPEN = 'modal-open';
  2119. const CLASS_NAME_FADE$4 = 'fade';
  2120. const CLASS_NAME_SHOW$5 = 'show';
  2121. const CLASS_NAME_STATIC = 'modal-static';
  2122. const SELECTOR_DIALOG = '.modal-dialog';
  2123. const SELECTOR_MODAL_BODY = '.modal-body';
  2124. const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
  2125. const SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]';
  2126. /**
  2127. * ------------------------------------------------------------------------
  2128. * Class Definition
  2129. * ------------------------------------------------------------------------
  2130. */
  2131. class Modal extends BaseComponent {
  2132. constructor(element, config) {
  2133. super(element);
  2134. this._config = this._getConfig(config);
  2135. this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element);
  2136. this._backdrop = this._initializeBackDrop();
  2137. this._isShown = false;
  2138. this._ignoreBackdropClick = false;
  2139. this._isTransitioning = false;
  2140. this._scrollBar = new ScrollBarHelper();
  2141. } // Getters
  2142. static get Default() {
  2143. return Default$5;
  2144. }
  2145. static get NAME() {
  2146. return NAME$6;
  2147. } // Public
  2148. toggle(relatedTarget) {
  2149. return this._isShown ? this.hide() : this.show(relatedTarget);
  2150. }
  2151. show(relatedTarget) {
  2152. if (this._isShown || this._isTransitioning) {
  2153. return;
  2154. }
  2155. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
  2156. relatedTarget
  2157. });
  2158. if (showEvent.defaultPrevented) {
  2159. return;
  2160. }
  2161. this._isShown = true;
  2162. if (this._isAnimated()) {
  2163. this._isTransitioning = true;
  2164. }
  2165. this._scrollBar.hide();
  2166. document.body.classList.add(CLASS_NAME_OPEN);
  2167. this._adjustDialog();
  2168. this._setEscapeEvent();
  2169. this._setResizeEvent();
  2170. EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, SELECTOR_DATA_DISMISS$2, event => this.hide(event));
  2171. EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, () => {
  2172. EventHandler.one(this._element, EVENT_MOUSEUP_DISMISS, event => {
  2173. if (event.target === this._element) {
  2174. this._ignoreBackdropClick = true;
  2175. }
  2176. });
  2177. });
  2178. this._showBackdrop(() => this._showElement(relatedTarget));
  2179. }
  2180. hide(event) {
  2181. if (event && ['A', 'AREA'].includes(event.target.tagName)) {
  2182. event.preventDefault();
  2183. }
  2184. if (!this._isShown || this._isTransitioning) {
  2185. return;
  2186. }
  2187. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
  2188. if (hideEvent.defaultPrevented) {
  2189. return;
  2190. }
  2191. this._isShown = false;
  2192. const isAnimated = this._isAnimated();
  2193. if (isAnimated) {
  2194. this._isTransitioning = true;
  2195. }
  2196. this._setEscapeEvent();
  2197. this._setResizeEvent();
  2198. EventHandler.off(document, EVENT_FOCUSIN$2);
  2199. this._element.classList.remove(CLASS_NAME_SHOW$5);
  2200. EventHandler.off(this._element, EVENT_CLICK_DISMISS$2);
  2201. EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS);
  2202. this._queueCallback(() => this._hideModal(), this._element, isAnimated);
  2203. }
  2204. dispose() {
  2205. [window, this._dialog].forEach(htmlElement => EventHandler.off(htmlElement, EVENT_KEY$6));
  2206. this._backdrop.dispose();
  2207. super.dispose();
  2208. /**
  2209. * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
  2210. * Do not move `document` in `htmlElements` array
  2211. * It will remove `EVENT_CLICK_DATA_API` event that should remain
  2212. */
  2213. EventHandler.off(document, EVENT_FOCUSIN$2);
  2214. }
  2215. handleUpdate() {
  2216. this._adjustDialog();
  2217. } // Private
  2218. _initializeBackDrop() {
  2219. return new Backdrop({
  2220. isVisible: Boolean(this._config.backdrop),
  2221. // 'static' option will be translated to true, and booleans will keep their value
  2222. isAnimated: this._isAnimated()
  2223. });
  2224. }
  2225. _getConfig(config) {
  2226. config = { ...Default$5,
  2227. ...Manipulator.getDataAttributes(this._element),
  2228. ...(typeof config === 'object' ? config : {})
  2229. };
  2230. typeCheckConfig(NAME$6, config, DefaultType$5);
  2231. return config;
  2232. }
  2233. _showElement(relatedTarget) {
  2234. const isAnimated = this._isAnimated();
  2235. const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog);
  2236. if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
  2237. // Don't move modal's DOM position
  2238. document.body.appendChild(this._element);
  2239. }
  2240. this._element.style.display = 'block';
  2241. this._element.removeAttribute('aria-hidden');
  2242. this._element.setAttribute('aria-modal', true);
  2243. this._element.setAttribute('role', 'dialog');
  2244. this._element.scrollTop = 0;
  2245. if (modalBody) {
  2246. modalBody.scrollTop = 0;
  2247. }
  2248. if (isAnimated) {
  2249. reflow(this._element);
  2250. }
  2251. this._element.classList.add(CLASS_NAME_SHOW$5);
  2252. if (this._config.focus) {
  2253. this._enforceFocus();
  2254. }
  2255. const transitionComplete = () => {
  2256. if (this._config.focus) {
  2257. this._element.focus();
  2258. }
  2259. this._isTransitioning = false;
  2260. EventHandler.trigger(this._element, EVENT_SHOWN$3, {
  2261. relatedTarget
  2262. });
  2263. };
  2264. this._queueCallback(transitionComplete, this._dialog, isAnimated);
  2265. }
  2266. _enforceFocus() {
  2267. EventHandler.off(document, EVENT_FOCUSIN$2); // guard against infinite focus loop
  2268. EventHandler.on(document, EVENT_FOCUSIN$2, event => {
  2269. if (document !== event.target && this._element !== event.target && !this._element.contains(event.target)) {
  2270. this._element.focus();
  2271. }
  2272. });
  2273. }
  2274. _setEscapeEvent() {
  2275. if (this._isShown) {
  2276. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS$1, event => {
  2277. if (this._config.keyboard && event.key === ESCAPE_KEY$1) {
  2278. event.preventDefault();
  2279. this.hide();
  2280. } else if (!this._config.keyboard && event.key === ESCAPE_KEY$1) {
  2281. this._triggerBackdropTransition();
  2282. }
  2283. });
  2284. } else {
  2285. EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS$1);
  2286. }
  2287. }
  2288. _setResizeEvent() {
  2289. if (this._isShown) {
  2290. EventHandler.on(window, EVENT_RESIZE, () => this._adjustDialog());
  2291. } else {
  2292. EventHandler.off(window, EVENT_RESIZE);
  2293. }
  2294. }
  2295. _hideModal() {
  2296. this._element.style.display = 'none';
  2297. this._element.setAttribute('aria-hidden', true);
  2298. this._element.removeAttribute('aria-modal');
  2299. this._element.removeAttribute('role');
  2300. this._isTransitioning = false;
  2301. this._backdrop.hide(() => {
  2302. document.body.classList.remove(CLASS_NAME_OPEN);
  2303. this._resetAdjustments();
  2304. this._scrollBar.reset();
  2305. EventHandler.trigger(this._element, EVENT_HIDDEN$3);
  2306. });
  2307. }
  2308. _showBackdrop(callback) {
  2309. EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, event => {
  2310. if (this._ignoreBackdropClick) {
  2311. this._ignoreBackdropClick = false;
  2312. return;
  2313. }
  2314. if (event.target !== event.currentTarget) {
  2315. return;
  2316. }
  2317. if (this._config.backdrop === true) {
  2318. this.hide();
  2319. } else if (this._config.backdrop === 'static') {
  2320. this._triggerBackdropTransition();
  2321. }
  2322. });
  2323. this._backdrop.show(callback);
  2324. }
  2325. _isAnimated() {
  2326. return this._element.classList.contains(CLASS_NAME_FADE$4);
  2327. }
  2328. _triggerBackdropTransition() {
  2329. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
  2330. if (hideEvent.defaultPrevented) {
  2331. return;
  2332. }
  2333. const {
  2334. classList,
  2335. scrollHeight,
  2336. style
  2337. } = this._element;
  2338. const isModalOverflowing = scrollHeight > document.documentElement.clientHeight; // return if the following background transition hasn't yet completed
  2339. if (!isModalOverflowing && style.overflowY === 'hidden' || classList.contains(CLASS_NAME_STATIC)) {
  2340. return;
  2341. }
  2342. if (!isModalOverflowing) {
  2343. style.overflowY = 'hidden';
  2344. }
  2345. classList.add(CLASS_NAME_STATIC);
  2346. this._queueCallback(() => {
  2347. classList.remove(CLASS_NAME_STATIC);
  2348. if (!isModalOverflowing) {
  2349. this._queueCallback(() => {
  2350. style.overflowY = '';
  2351. }, this._dialog);
  2352. }
  2353. }, this._dialog);
  2354. this._element.focus();
  2355. } // ----------------------------------------------------------------------
  2356. // the following methods are used to handle overflowing modals
  2357. // ----------------------------------------------------------------------
  2358. _adjustDialog() {
  2359. const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  2360. const scrollbarWidth = this._scrollBar.getWidth();
  2361. const isBodyOverflowing = scrollbarWidth > 0;
  2362. if (!isBodyOverflowing && isModalOverflowing && !isRTL() || isBodyOverflowing && !isModalOverflowing && isRTL()) {
  2363. this._element.style.paddingLeft = `${scrollbarWidth}px`;
  2364. }
  2365. if (isBodyOverflowing && !isModalOverflowing && !isRTL() || !isBodyOverflowing && isModalOverflowing && isRTL()) {
  2366. this._element.style.paddingRight = `${scrollbarWidth}px`;
  2367. }
  2368. }
  2369. _resetAdjustments() {
  2370. this._element.style.paddingLeft = '';
  2371. this._element.style.paddingRight = '';
  2372. } // Static
  2373. static jQueryInterface(config, relatedTarget) {
  2374. return this.each(function () {
  2375. const data = Modal.getOrCreateInstance(this, config);
  2376. if (typeof config !== 'string') {
  2377. return;
  2378. }
  2379. if (typeof data[config] === 'undefined') {
  2380. throw new TypeError(`No method named "${config}"`);
  2381. }
  2382. data[config](relatedTarget);
  2383. });
  2384. }
  2385. }
  2386. /**
  2387. * ------------------------------------------------------------------------
  2388. * Data Api implementation
  2389. * ------------------------------------------------------------------------
  2390. */
  2391. EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
  2392. const target = getElementFromSelector(this);
  2393. if (['A', 'AREA'].includes(this.tagName)) {
  2394. event.preventDefault();
  2395. }
  2396. EventHandler.one(target, EVENT_SHOW$3, showEvent => {
  2397. if (showEvent.defaultPrevented) {
  2398. // only register focus restorer if modal will actually get shown
  2399. return;
  2400. }
  2401. EventHandler.one(target, EVENT_HIDDEN$3, () => {
  2402. if (isVisible(this)) {
  2403. this.focus();
  2404. }
  2405. });
  2406. });
  2407. const data = Modal.getOrCreateInstance(target);
  2408. data.toggle(this);
  2409. });
  2410. /**
  2411. * ------------------------------------------------------------------------
  2412. * jQuery
  2413. * ------------------------------------------------------------------------
  2414. * add .Modal to jQuery only if jQuery is present
  2415. */
  2416. defineJQueryPlugin(Modal);
  2417. /**
  2418. * --------------------------------------------------------------------------
  2419. * Bootstrap (v5.0.2): offcanvas.js
  2420. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
  2421. * --------------------------------------------------------------------------
  2422. */
  2423. /**
  2424. * ------------------------------------------------------------------------
  2425. * Constants
  2426. * ------------------------------------------------------------------------
  2427. */
  2428. const NAME$5 = 'offcanvas';
  2429. const DATA_KEY$5 = 'bs.offcanvas';
  2430. const EVENT_KEY$5 = `.${DATA_KEY$5}`;
  2431. const DATA_API_KEY$2 = '.data-api';
  2432. const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$5}${DATA_API_KEY$2}`;
  2433. const ESCAPE_KEY = 'Escape';
  2434. const Default$4 = {
  2435. backdrop: true,
  2436. keyboard: true,
  2437. scroll: false
  2438. };
  2439. const DefaultType$4 = {
  2440. backdrop: 'boolean',
  2441. keyboard: 'boolean',
  2442. scroll: 'boolean'
  2443. };
  2444. const CLASS_NAME_SHOW$4 = 'show';
  2445. const OPEN_SELECTOR = '.offcanvas.show';
  2446. const EVENT_SHOW$2 = `show${EVENT_KEY$5}`;
  2447. const EVENT_SHOWN$2 = `shown${EVENT_KEY$5}`;
  2448. const EVENT_HIDE$2 = `hide${EVENT_KEY$5}`;
  2449. const EVENT_HIDDEN$2 = `hidden${EVENT_KEY$5}`;
  2450. const EVENT_FOCUSIN$1 = `focusin${EVENT_KEY$5}`;
  2451. const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$5}${DATA_API_KEY$2}`;
  2452. const EVENT_CLICK_DISMISS$1 = `click.dismiss${EVENT_KEY$5}`;
  2453. const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$5}`;
  2454. const SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]';
  2455. const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
  2456. /**
  2457. * ------------------------------------------------------------------------
  2458. * Class Definition
  2459. * ------------------------------------------------------------------------
  2460. */
  2461. class Offcanvas extends BaseComponent {
  2462. constructor(element, config) {
  2463. super(element);
  2464. this._config = this._getConfig(config);
  2465. this._isShown = false;
  2466. this._backdrop = this._initializeBackDrop();
  2467. this._addEventListeners();
  2468. } // Getters
  2469. static get NAME() {
  2470. return NAME$5;
  2471. }
  2472. static get Default() {
  2473. return Default$4;
  2474. } // Public
  2475. toggle(relatedTarget) {
  2476. return this._isShown ? this.hide() : this.show(relatedTarget);
  2477. }
  2478. show(relatedTarget) {
  2479. if (this._isShown) {
  2480. return;
  2481. }
  2482. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, {
  2483. relatedTarget
  2484. });
  2485. if (showEvent.defaultPrevented) {
  2486. return;
  2487. }
  2488. this._isShown = true;
  2489. this._element.style.visibility = 'visible';
  2490. this._backdrop.show();
  2491. if (!this._config.scroll) {
  2492. new ScrollBarHelper().hide();
  2493. this._enforceFocusOnElement(this._element);
  2494. }
  2495. this._element.removeAttribute('aria-hidden');
  2496. this._element.setAttribute('aria-modal', true);
  2497. this._element.setAttribute('role', 'dialog');
  2498. this._element.classList.add(CLASS_NAME_SHOW$4);
  2499. const completeCallBack = () => {
  2500. EventHandler.trigger(this._element, EVENT_SHOWN$2, {
  2501. relatedTarget
  2502. });
  2503. };
  2504. this._queueCallback(completeCallBack, this._element, true);
  2505. }
  2506. hide() {
  2507. if (!this._isShown) {
  2508. return;
  2509. }
  2510. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2);
  2511. if (hideEvent.defaultPrevented) {
  2512. return;
  2513. }
  2514. EventHandler.off(document, EVENT_FOCUSIN$1);
  2515. this._element.blur();
  2516. this._isShown = false;
  2517. this._element.classList.remove(CLASS_NAME_SHOW$4);
  2518. this._backdrop.hide();
  2519. const completeCallback = () => {
  2520. this._element.setAttribute('aria-hidden', true);
  2521. this._element.removeAttribute('aria-modal');
  2522. this._element.removeAttribute('role');
  2523. this._element.style.visibility = 'hidden';
  2524. if (!this._config.scroll) {
  2525. new ScrollBarHelper().reset();
  2526. }
  2527. EventHandler.trigger(this._element, EVENT_HIDDEN$2);
  2528. };
  2529. this._queueCallback(completeCallback, this._element, true);
  2530. }
  2531. dispose() {
  2532. this._backdrop.dispose();
  2533. super.dispose();
  2534. EventHandler.off(document, EVENT_FOCUSIN$1);
  2535. } // Private
  2536. _getConfig(config) {
  2537. config = { ...Default$4,
  2538. ...Manipulator.getDataAttributes(this._element),
  2539. ...(typeof config === 'object' ? config : {})
  2540. };
  2541. typeCheckConfig(NAME$5, config, DefaultType$4);
  2542. return config;
  2543. }
  2544. _initializeBackDrop() {
  2545. return new Backdrop({
  2546. isVisible: this._config.backdrop,
  2547. isAnimated: true,
  2548. rootElement: this._element.parentNode,
  2549. clickCallback: () => this.hide()
  2550. });
  2551. }
  2552. _enforceFocusOnElement(element) {
  2553. EventHandler.off(document, EVENT_FOCUSIN$1); // guard against infinite focus loop
  2554. EventHandler.on(document, EVENT_FOCUSIN$1, event => {
  2555. if (document !== event.target && element !== event.target && !element.contains(event.target)) {
  2556. element.focus();
  2557. }
  2558. });
  2559. element.focus();
  2560. }
  2561. _addEventListeners() {
  2562. EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, () => this.hide());
  2563. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
  2564. if (this._config.keyboard && event.key === ESCAPE_KEY) {
  2565. this.hide();
  2566. }
  2567. });
  2568. } // Static
  2569. static jQueryInterface(config) {
  2570. return this.each(function () {
  2571. const data = Offcanvas.getOrCreateInstance(this, config);
  2572. if (typeof config !== 'string') {
  2573. return;
  2574. }
  2575. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  2576. throw new TypeError(`No method named "${config}"`);
  2577. }
  2578. data[config](this);
  2579. });
  2580. }
  2581. }
  2582. /**
  2583. * ------------------------------------------------------------------------
  2584. * Data Api implementation
  2585. * ------------------------------------------------------------------------
  2586. */
  2587. EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) {
  2588. const target = getElementFromSelector(this);
  2589. if (['A', 'AREA'].includes(this.tagName)) {
  2590. event.preventDefault();
  2591. }
  2592. if (isDisabled(this)) {
  2593. return;
  2594. }
  2595. EventHandler.one(target, EVENT_HIDDEN$2, () => {
  2596. // focus on trigger when it is closed
  2597. if (isVisible(this)) {
  2598. this.focus();
  2599. }
  2600. }); // avoid conflict when clicking a toggler of an offcanvas, while another is open
  2601. const allReadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
  2602. if (allReadyOpen && allReadyOpen !== target) {
  2603. Offcanvas.getInstance(allReadyOpen).hide();
  2604. }
  2605. const data = Offcanvas.getOrCreateInstance(target);
  2606. data.toggle(this);
  2607. });
  2608. EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => SelectorEngine.find(OPEN_SELECTOR).forEach(el => Offcanvas.getOrCreateInstance(el).show()));
  2609. /**
  2610. * ------------------------------------------------------------------------
  2611. * jQuery
  2612. * ------------------------------------------------------------------------
  2613. */
  2614. defineJQueryPlugin(Offcanvas);
  2615. /**
  2616. * --------------------------------------------------------------------------
  2617. * Bootstrap (v5.0.2): util/sanitizer.js
  2618. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2619. * --------------------------------------------------------------------------
  2620. */
  2621. const uriAttrs = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
  2622. const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  2623. /**
  2624. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  2625. *
  2626. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  2627. */
  2628. const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i;
  2629. /**
  2630. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  2631. *
  2632. * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts
  2633. */
  2634. 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;
  2635. const allowedAttribute = (attr, allowedAttributeList) => {
  2636. const attrName = attr.nodeName.toLowerCase();
  2637. if (allowedAttributeList.includes(attrName)) {
  2638. if (uriAttrs.has(attrName)) {
  2639. return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue));
  2640. }
  2641. return true;
  2642. }
  2643. const regExp = allowedAttributeList.filter(attrRegex => attrRegex instanceof RegExp); // Check if a regular expression validates the attribute.
  2644. for (let i = 0, len = regExp.length; i < len; i++) {
  2645. if (regExp[i].test(attrName)) {
  2646. return true;
  2647. }
  2648. }
  2649. return false;
  2650. };
  2651. const DefaultAllowlist = {
  2652. // Global attributes allowed on any supplied element below.
  2653. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  2654. a: ['target', 'href', 'title', 'rel'],
  2655. area: [],
  2656. b: [],
  2657. br: [],
  2658. col: [],
  2659. code: [],
  2660. div: [],
  2661. em: [],
  2662. hr: [],
  2663. h1: [],
  2664. h2: [],
  2665. h3: [],
  2666. h4: [],
  2667. h5: [],
  2668. h6: [],
  2669. i: [],
  2670. img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
  2671. li: [],
  2672. ol: [],
  2673. p: [],
  2674. pre: [],
  2675. s: [],
  2676. small: [],
  2677. span: [],
  2678. sub: [],
  2679. sup: [],
  2680. strong: [],
  2681. u: [],
  2682. ul: []
  2683. };
  2684. function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) {
  2685. if (!unsafeHtml.length) {
  2686. return unsafeHtml;
  2687. }
  2688. if (sanitizeFn && typeof sanitizeFn === 'function') {
  2689. return sanitizeFn(unsafeHtml);
  2690. }
  2691. const domParser = new window.DOMParser();
  2692. const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  2693. const allowlistKeys = Object.keys(allowList);
  2694. const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
  2695. for (let i = 0, len = elements.length; i < len; i++) {
  2696. const el = elements[i];
  2697. const elName = el.nodeName.toLowerCase();
  2698. if (!allowlistKeys.includes(elName)) {
  2699. el.remove();
  2700. continue;
  2701. }
  2702. const attributeList = [].concat(...el.attributes);
  2703. const allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []);
  2704. attributeList.forEach(attr => {
  2705. if (!allowedAttribute(attr, allowedAttributes)) {
  2706. el.removeAttribute(attr.nodeName);
  2707. }
  2708. });
  2709. }
  2710. return createdDocument.body.innerHTML;
  2711. }
  2712. /**
  2713. * --------------------------------------------------------------------------
  2714. * Bootstrap (v5.0.2): tooltip.js
  2715. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2716. * --------------------------------------------------------------------------
  2717. */
  2718. /**
  2719. * ------------------------------------------------------------------------
  2720. * Constants
  2721. * ------------------------------------------------------------------------
  2722. */
  2723. const NAME$4 = 'tooltip';
  2724. const DATA_KEY$4 = 'bs.tooltip';
  2725. const EVENT_KEY$4 = `.${DATA_KEY$4}`;
  2726. const CLASS_PREFIX$1 = 'bs-tooltip';
  2727. const BSCLS_PREFIX_REGEX$1 = new RegExp(`(^|\\s)${CLASS_PREFIX$1}\\S+`, 'g');
  2728. const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
  2729. const DefaultType$3 = {
  2730. animation: 'boolean',
  2731. template: 'string',
  2732. title: '(string|element|function)',
  2733. trigger: 'string',
  2734. delay: '(number|object)',
  2735. html: 'boolean',
  2736. selector: '(string|boolean)',
  2737. placement: '(string|function)',
  2738. offset: '(array|string|function)',
  2739. container: '(string|element|boolean)',
  2740. fallbackPlacements: 'array',
  2741. boundary: '(string|element)',
  2742. customClass: '(string|function)',
  2743. sanitize: 'boolean',
  2744. sanitizeFn: '(null|function)',
  2745. allowList: 'object',
  2746. popperConfig: '(null|object|function)'
  2747. };
  2748. const AttachmentMap = {
  2749. AUTO: 'auto',
  2750. TOP: 'top',
  2751. RIGHT: isRTL() ? 'left' : 'right',
  2752. BOTTOM: 'bottom',
  2753. LEFT: isRTL() ? 'right' : 'left'
  2754. };
  2755. const Default$3 = {
  2756. animation: true,
  2757. template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
  2758. trigger: 'hover focus',
  2759. title: '',
  2760. delay: 0,
  2761. html: false,
  2762. selector: false,
  2763. placement: 'top',
  2764. offset: [0, 0],
  2765. container: false,
  2766. fallbackPlacements: ['top', 'right', 'bottom', 'left'],
  2767. boundary: 'clippingParents',
  2768. customClass: '',
  2769. sanitize: true,
  2770. sanitizeFn: null,
  2771. allowList: DefaultAllowlist,
  2772. popperConfig: null
  2773. };
  2774. const Event$2 = {
  2775. HIDE: `hide${EVENT_KEY$4}`,
  2776. HIDDEN: `hidden${EVENT_KEY$4}`,
  2777. SHOW: `show${EVENT_KEY$4}`,
  2778. SHOWN: `shown${EVENT_KEY$4}`,
  2779. INSERTED: `inserted${EVENT_KEY$4}`,
  2780. CLICK: `click${EVENT_KEY$4}`,
  2781. FOCUSIN: `focusin${EVENT_KEY$4}`,
  2782. FOCUSOUT: `focusout${EVENT_KEY$4}`,
  2783. MOUSEENTER: `mouseenter${EVENT_KEY$4}`,
  2784. MOUSELEAVE: `mouseleave${EVENT_KEY$4}`
  2785. };
  2786. const CLASS_NAME_FADE$3 = 'fade';
  2787. const CLASS_NAME_MODAL = 'modal';
  2788. const CLASS_NAME_SHOW$3 = 'show';
  2789. const HOVER_STATE_SHOW = 'show';
  2790. const HOVER_STATE_OUT = 'out';
  2791. const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  2792. const TRIGGER_HOVER = 'hover';
  2793. const TRIGGER_FOCUS = 'focus';
  2794. const TRIGGER_CLICK = 'click';
  2795. const TRIGGER_MANUAL = 'manual';
  2796. /**
  2797. * ------------------------------------------------------------------------
  2798. * Class Definition
  2799. * ------------------------------------------------------------------------
  2800. */
  2801. class Tooltip extends BaseComponent {
  2802. constructor(element, config) {
  2803. if (typeof Popper === 'undefined') {
  2804. throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
  2805. }
  2806. super(element); // private
  2807. this._isEnabled = true;
  2808. this._timeout = 0;
  2809. this._hoverState = '';
  2810. this._activeTrigger = {};
  2811. this._popper = null; // Protected
  2812. this._config = this._getConfig(config);
  2813. this.tip = null;
  2814. this._setListeners();
  2815. } // Getters
  2816. static get Default() {
  2817. return Default$3;
  2818. }
  2819. static get NAME() {
  2820. return NAME$4;
  2821. }
  2822. static get Event() {
  2823. return Event$2;
  2824. }
  2825. static get DefaultType() {
  2826. return DefaultType$3;
  2827. } // Public
  2828. enable() {
  2829. this._isEnabled = true;
  2830. }
  2831. disable() {
  2832. this._isEnabled = false;
  2833. }
  2834. toggleEnabled() {
  2835. this._isEnabled = !this._isEnabled;
  2836. }
  2837. toggle(event) {
  2838. if (!this._isEnabled) {
  2839. return;
  2840. }
  2841. if (event) {
  2842. const context = this._initializeOnDelegatedTarget(event);
  2843. context._activeTrigger.click = !context._activeTrigger.click;
  2844. if (context._isWithActiveTrigger()) {
  2845. context._enter(null, context);
  2846. } else {
  2847. context._leave(null, context);
  2848. }
  2849. } else {
  2850. if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) {
  2851. this._leave(null, this);
  2852. return;
  2853. }
  2854. this._enter(null, this);
  2855. }
  2856. }
  2857. dispose() {
  2858. clearTimeout(this._timeout);
  2859. EventHandler.off(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
  2860. if (this.tip) {
  2861. this.tip.remove();
  2862. }
  2863. if (this._popper) {
  2864. this._popper.destroy();
  2865. }
  2866. super.dispose();
  2867. }
  2868. show() {
  2869. if (this._element.style.display === 'none') {
  2870. throw new Error('Please use show on visible elements');
  2871. }
  2872. if (!(this.isWithContent() && this._isEnabled)) {
  2873. return;
  2874. }
  2875. const showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW);
  2876. const shadowRoot = findShadowRoot(this._element);
  2877. const isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element);
  2878. if (showEvent.defaultPrevented || !isInTheDom) {
  2879. return;
  2880. }
  2881. const tip = this.getTipElement();
  2882. const tipId = getUID(this.constructor.NAME);
  2883. tip.setAttribute('id', tipId);
  2884. this._element.setAttribute('aria-describedby', tipId);
  2885. this.setContent();
  2886. if (this._config.animation) {
  2887. tip.classList.add(CLASS_NAME_FADE$3);
  2888. }
  2889. const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
  2890. const attachment = this._getAttachment(placement);
  2891. this._addAttachmentClass(attachment);
  2892. const {
  2893. container
  2894. } = this._config;
  2895. Data.set(tip, this.constructor.DATA_KEY, this);
  2896. if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
  2897. container.appendChild(tip);
  2898. EventHandler.trigger(this._element, this.constructor.Event.INSERTED);
  2899. }
  2900. if (this._popper) {
  2901. this._popper.update();
  2902. } else {
  2903. this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
  2904. }
  2905. tip.classList.add(CLASS_NAME_SHOW$3);
  2906. const customClass = typeof this._config.customClass === 'function' ? this._config.customClass() : this._config.customClass;
  2907. if (customClass) {
  2908. tip.classList.add(...customClass.split(' '));
  2909. } // If this is a touch-enabled device we add extra
  2910. // empty mouseover listeners to the body's immediate children;
  2911. // only needed because of broken event delegation on iOS
  2912. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  2913. if ('ontouchstart' in document.documentElement) {
  2914. [].concat(...document.body.children).forEach(element => {
  2915. EventHandler.on(element, 'mouseover', noop);
  2916. });
  2917. }
  2918. const complete = () => {
  2919. const prevHoverState = this._hoverState;
  2920. this._hoverState = null;
  2921. EventHandler.trigger(this._element, this.constructor.Event.SHOWN);
  2922. if (prevHoverState === HOVER_STATE_OUT) {
  2923. this._leave(null, this);
  2924. }
  2925. };
  2926. const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3);
  2927. this._queueCallback(complete, this.tip, isAnimated);
  2928. }
  2929. hide() {
  2930. if (!this._popper) {
  2931. return;
  2932. }
  2933. const tip = this.getTipElement();
  2934. const complete = () => {
  2935. if (this._isWithActiveTrigger()) {
  2936. return;
  2937. }
  2938. if (this._hoverState !== HOVER_STATE_SHOW) {
  2939. tip.remove();
  2940. }
  2941. this._cleanTipClass();
  2942. this._element.removeAttribute('aria-describedby');
  2943. EventHandler.trigger(this._element, this.constructor.Event.HIDDEN);
  2944. if (this._popper) {
  2945. this._popper.destroy();
  2946. this._popper = null;
  2947. }
  2948. };
  2949. const hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE);
  2950. if (hideEvent.defaultPrevented) {
  2951. return;
  2952. }
  2953. tip.classList.remove(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra
  2954. // empty mouseover listeners we added for iOS support
  2955. if ('ontouchstart' in document.documentElement) {
  2956. [].concat(...document.body.children).forEach(element => EventHandler.off(element, 'mouseover', noop));
  2957. }
  2958. this._activeTrigger[TRIGGER_CLICK] = false;
  2959. this._activeTrigger[TRIGGER_FOCUS] = false;
  2960. this._activeTrigger[TRIGGER_HOVER] = false;
  2961. const isAnimated = this.tip.classList.contains(CLASS_NAME_FADE$3);
  2962. this._queueCallback(complete, this.tip, isAnimated);
  2963. this._hoverState = '';
  2964. }
  2965. update() {
  2966. if (this._popper !== null) {
  2967. this._popper.update();
  2968. }
  2969. } // Protected
  2970. isWithContent() {
  2971. return Boolean(this.getTitle());
  2972. }
  2973. getTipElement() {
  2974. if (this.tip) {
  2975. return this.tip;
  2976. }
  2977. const element = document.createElement('div');
  2978. element.innerHTML = this._config.template;
  2979. this.tip = element.children[0];
  2980. return this.tip;
  2981. }
  2982. setContent() {
  2983. const tip = this.getTipElement();
  2984. this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle());
  2985. tip.classList.remove(CLASS_NAME_FADE$3, CLASS_NAME_SHOW$3);
  2986. }
  2987. setElementContent(element, content) {
  2988. if (element === null) {
  2989. return;
  2990. }
  2991. if (isElement(content)) {
  2992. content = getElement(content); // content is a DOM node or a jQuery
  2993. if (this._config.html) {
  2994. if (content.parentNode !== element) {
  2995. element.innerHTML = '';
  2996. element.appendChild(content);
  2997. }
  2998. } else {
  2999. element.textContent = content.textContent;
  3000. }
  3001. return;
  3002. }
  3003. if (this._config.html) {
  3004. if (this._config.sanitize) {
  3005. content = sanitizeHtml(content, this._config.allowList, this._config.sanitizeFn);
  3006. }
  3007. element.innerHTML = content;
  3008. } else {
  3009. element.textContent = content;
  3010. }
  3011. }
  3012. getTitle() {
  3013. let title = this._element.getAttribute('data-bs-original-title');
  3014. if (!title) {
  3015. title = typeof this._config.title === 'function' ? this._config.title.call(this._element) : this._config.title;
  3016. }
  3017. return title;
  3018. }
  3019. updateAttachment(attachment) {
  3020. if (attachment === 'right') {
  3021. return 'end';
  3022. }
  3023. if (attachment === 'left') {
  3024. return 'start';
  3025. }
  3026. return attachment;
  3027. } // Private
  3028. _initializeOnDelegatedTarget(event, context) {
  3029. const dataKey = this.constructor.DATA_KEY;
  3030. context = context || Data.get(event.delegateTarget, dataKey);
  3031. if (!context) {
  3032. context = new this.constructor(event.delegateTarget, this._getDelegateConfig());
  3033. Data.set(event.delegateTarget, dataKey, context);
  3034. }
  3035. return context;
  3036. }
  3037. _getOffset() {
  3038. const {
  3039. offset
  3040. } = this._config;
  3041. if (typeof offset === 'string') {
  3042. return offset.split(',').map(val => Number.parseInt(val, 10));
  3043. }
  3044. if (typeof offset === 'function') {
  3045. return popperData => offset(popperData, this._element);
  3046. }
  3047. return offset;
  3048. }
  3049. _getPopperConfig(attachment) {
  3050. const defaultBsPopperConfig = {
  3051. placement: attachment,
  3052. modifiers: [{
  3053. name: 'flip',
  3054. options: {
  3055. fallbackPlacements: this._config.fallbackPlacements
  3056. }
  3057. }, {
  3058. name: 'offset',
  3059. options: {
  3060. offset: this._getOffset()
  3061. }
  3062. }, {
  3063. name: 'preventOverflow',
  3064. options: {
  3065. boundary: this._config.boundary
  3066. }
  3067. }, {
  3068. name: 'arrow',
  3069. options: {
  3070. element: `.${this.constructor.NAME}-arrow`
  3071. }
  3072. }, {
  3073. name: 'onChange',
  3074. enabled: true,
  3075. phase: 'afterWrite',
  3076. fn: data => this._handlePopperPlacementChange(data)
  3077. }],
  3078. onFirstUpdate: data => {
  3079. if (data.options.placement !== data.placement) {
  3080. this._handlePopperPlacementChange(data);
  3081. }
  3082. }
  3083. };
  3084. return { ...defaultBsPopperConfig,
  3085. ...(typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig)
  3086. };
  3087. }
  3088. _addAttachmentClass(attachment) {
  3089. this.getTipElement().classList.add(`${CLASS_PREFIX$1}-${this.updateAttachment(attachment)}`);
  3090. }
  3091. _getAttachment(placement) {
  3092. return AttachmentMap[placement.toUpperCase()];
  3093. }
  3094. _setListeners() {
  3095. const triggers = this._config.trigger.split(' ');
  3096. triggers.forEach(trigger => {
  3097. if (trigger === 'click') {
  3098. EventHandler.on(this._element, this.constructor.Event.CLICK, this._config.selector, event => this.toggle(event));
  3099. } else if (trigger !== TRIGGER_MANUAL) {
  3100. const eventIn = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSEENTER : this.constructor.Event.FOCUSIN;
  3101. const eventOut = trigger === TRIGGER_HOVER ? this.constructor.Event.MOUSELEAVE : this.constructor.Event.FOCUSOUT;
  3102. EventHandler.on(this._element, eventIn, this._config.selector, event => this._enter(event));
  3103. EventHandler.on(this._element, eventOut, this._config.selector, event => this._leave(event));
  3104. }
  3105. });
  3106. this._hideModalHandler = () => {
  3107. if (this._element) {
  3108. this.hide();
  3109. }
  3110. };
  3111. EventHandler.on(this._element.closest(`.${CLASS_NAME_MODAL}`), 'hide.bs.modal', this._hideModalHandler);
  3112. if (this._config.selector) {
  3113. this._config = { ...this._config,
  3114. trigger: 'manual',
  3115. selector: ''
  3116. };
  3117. } else {
  3118. this._fixTitle();
  3119. }
  3120. }
  3121. _fixTitle() {
  3122. const title = this._element.getAttribute('title');
  3123. const originalTitleType = typeof this._element.getAttribute('data-bs-original-title');
  3124. if (title || originalTitleType !== 'string') {
  3125. this._element.setAttribute('data-bs-original-title', title || '');
  3126. if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) {
  3127. this._element.setAttribute('aria-label', title);
  3128. }
  3129. this._element.setAttribute('title', '');
  3130. }
  3131. }
  3132. _enter(event, context) {
  3133. context = this._initializeOnDelegatedTarget(event, context);
  3134. if (event) {
  3135. context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
  3136. }
  3137. if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) {
  3138. context._hoverState = HOVER_STATE_SHOW;
  3139. return;
  3140. }
  3141. clearTimeout(context._timeout);
  3142. context._hoverState = HOVER_STATE_SHOW;
  3143. if (!context._config.delay || !context._config.delay.show) {
  3144. context.show();
  3145. return;
  3146. }
  3147. context._timeout = setTimeout(() => {
  3148. if (context._hoverState === HOVER_STATE_SHOW) {
  3149. context.show();
  3150. }
  3151. }, context._config.delay.show);
  3152. }
  3153. _leave(event, context) {
  3154. context = this._initializeOnDelegatedTarget(event, context);
  3155. if (event) {
  3156. context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
  3157. }
  3158. if (context._isWithActiveTrigger()) {
  3159. return;
  3160. }
  3161. clearTimeout(context._timeout);
  3162. context._hoverState = HOVER_STATE_OUT;
  3163. if (!context._config.delay || !context._config.delay.hide) {
  3164. context.hide();
  3165. return;
  3166. }
  3167. context._timeout = setTimeout(() => {
  3168. if (context._hoverState === HOVER_STATE_OUT) {
  3169. context.hide();
  3170. }
  3171. }, context._config.delay.hide);
  3172. }
  3173. _isWithActiveTrigger() {
  3174. for (const trigger in this._activeTrigger) {
  3175. if (this._activeTrigger[trigger]) {
  3176. return true;
  3177. }
  3178. }
  3179. return false;
  3180. }
  3181. _getConfig(config) {
  3182. const dataAttributes = Manipulator.getDataAttributes(this._element);
  3183. Object.keys(dataAttributes).forEach(dataAttr => {
  3184. if (DISALLOWED_ATTRIBUTES.has(dataAttr)) {
  3185. delete dataAttributes[dataAttr];
  3186. }
  3187. });
  3188. config = { ...this.constructor.Default,
  3189. ...dataAttributes,
  3190. ...(typeof config === 'object' && config ? config : {})
  3191. };
  3192. config.container = config.container === false ? document.body : getElement(config.container);
  3193. if (typeof config.delay === 'number') {
  3194. config.delay = {
  3195. show: config.delay,
  3196. hide: config.delay
  3197. };
  3198. }
  3199. if (typeof config.title === 'number') {
  3200. config.title = config.title.toString();
  3201. }
  3202. if (typeof config.content === 'number') {
  3203. config.content = config.content.toString();
  3204. }
  3205. typeCheckConfig(NAME$4, config, this.constructor.DefaultType);
  3206. if (config.sanitize) {
  3207. config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn);
  3208. }
  3209. return config;
  3210. }
  3211. _getDelegateConfig() {
  3212. const config = {};
  3213. if (this._config) {
  3214. for (const key in this._config) {
  3215. if (this.constructor.Default[key] !== this._config[key]) {
  3216. config[key] = this._config[key];
  3217. }
  3218. }
  3219. }
  3220. return config;
  3221. }
  3222. _cleanTipClass() {
  3223. const tip = this.getTipElement();
  3224. const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1);
  3225. if (tabClass !== null && tabClass.length > 0) {
  3226. tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
  3227. }
  3228. }
  3229. _handlePopperPlacementChange(popperData) {
  3230. const {
  3231. state
  3232. } = popperData;
  3233. if (!state) {
  3234. return;
  3235. }
  3236. this.tip = state.elements.popper;
  3237. this._cleanTipClass();
  3238. this._addAttachmentClass(this._getAttachment(state.placement));
  3239. } // Static
  3240. static jQueryInterface(config) {
  3241. return this.each(function () {
  3242. const data = Tooltip.getOrCreateInstance(this, config);
  3243. if (typeof config === 'string') {
  3244. if (typeof data[config] === 'undefined') {
  3245. throw new TypeError(`No method named "${config}"`);
  3246. }
  3247. data[config]();
  3248. }
  3249. });
  3250. }
  3251. }
  3252. /**
  3253. * ------------------------------------------------------------------------
  3254. * jQuery
  3255. * ------------------------------------------------------------------------
  3256. * add .Tooltip to jQuery only if jQuery is present
  3257. */
  3258. defineJQueryPlugin(Tooltip);
  3259. /**
  3260. * --------------------------------------------------------------------------
  3261. * Bootstrap (v5.0.2): popover.js
  3262. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3263. * --------------------------------------------------------------------------
  3264. */
  3265. /**
  3266. * ------------------------------------------------------------------------
  3267. * Constants
  3268. * ------------------------------------------------------------------------
  3269. */
  3270. const NAME$3 = 'popover';
  3271. const DATA_KEY$3 = 'bs.popover';
  3272. const EVENT_KEY$3 = `.${DATA_KEY$3}`;
  3273. const CLASS_PREFIX = 'bs-popover';
  3274. const BSCLS_PREFIX_REGEX = new RegExp(`(^|\\s)${CLASS_PREFIX}\\S+`, 'g');
  3275. const Default$2 = { ...Tooltip.Default,
  3276. placement: 'right',
  3277. offset: [0, 8],
  3278. trigger: 'click',
  3279. content: '',
  3280. template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>'
  3281. };
  3282. const DefaultType$2 = { ...Tooltip.DefaultType,
  3283. content: '(string|element|function)'
  3284. };
  3285. const Event$1 = {
  3286. HIDE: `hide${EVENT_KEY$3}`,
  3287. HIDDEN: `hidden${EVENT_KEY$3}`,
  3288. SHOW: `show${EVENT_KEY$3}`,
  3289. SHOWN: `shown${EVENT_KEY$3}`,
  3290. INSERTED: `inserted${EVENT_KEY$3}`,
  3291. CLICK: `click${EVENT_KEY$3}`,
  3292. FOCUSIN: `focusin${EVENT_KEY$3}`,
  3293. FOCUSOUT: `focusout${EVENT_KEY$3}`,
  3294. MOUSEENTER: `mouseenter${EVENT_KEY$3}`,
  3295. MOUSELEAVE: `mouseleave${EVENT_KEY$3}`
  3296. };
  3297. const CLASS_NAME_FADE$2 = 'fade';
  3298. const CLASS_NAME_SHOW$2 = 'show';
  3299. const SELECTOR_TITLE = '.popover-header';
  3300. const SELECTOR_CONTENT = '.popover-body';
  3301. /**
  3302. * ------------------------------------------------------------------------
  3303. * Class Definition
  3304. * ------------------------------------------------------------------------
  3305. */
  3306. class Popover extends Tooltip {
  3307. // Getters
  3308. static get Default() {
  3309. return Default$2;
  3310. }
  3311. static get NAME() {
  3312. return NAME$3;
  3313. }
  3314. static get Event() {
  3315. return Event$1;
  3316. }
  3317. static get DefaultType() {
  3318. return DefaultType$2;
  3319. } // Overrides
  3320. isWithContent() {
  3321. return this.getTitle() || this._getContent();
  3322. }
  3323. getTipElement() {
  3324. if (this.tip) {
  3325. return this.tip;
  3326. }
  3327. this.tip = super.getTipElement();
  3328. if (!this.getTitle()) {
  3329. SelectorEngine.findOne(SELECTOR_TITLE, this.tip).remove();
  3330. }
  3331. if (!this._getContent()) {
  3332. SelectorEngine.findOne(SELECTOR_CONTENT, this.tip).remove();
  3333. }
  3334. return this.tip;
  3335. }
  3336. setContent() {
  3337. const tip = this.getTipElement(); // we use append for html objects to maintain js events
  3338. this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle());
  3339. let content = this._getContent();
  3340. if (typeof content === 'function') {
  3341. content = content.call(this._element);
  3342. }
  3343. this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content);
  3344. tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
  3345. } // Private
  3346. _addAttachmentClass(attachment) {
  3347. this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`);
  3348. }
  3349. _getContent() {
  3350. return this._element.getAttribute('data-bs-content') || this._config.content;
  3351. }
  3352. _cleanTipClass() {
  3353. const tip = this.getTipElement();
  3354. const tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX);
  3355. if (tabClass !== null && tabClass.length > 0) {
  3356. tabClass.map(token => token.trim()).forEach(tClass => tip.classList.remove(tClass));
  3357. }
  3358. } // Static
  3359. static jQueryInterface(config) {
  3360. return this.each(function () {
  3361. const data = Popover.getOrCreateInstance(this, config);
  3362. if (typeof config === 'string') {
  3363. if (typeof data[config] === 'undefined') {
  3364. throw new TypeError(`No method named "${config}"`);
  3365. }
  3366. data[config]();
  3367. }
  3368. });
  3369. }
  3370. }
  3371. /**
  3372. * ------------------------------------------------------------------------
  3373. * jQuery
  3374. * ------------------------------------------------------------------------
  3375. * add .Popover to jQuery only if jQuery is present
  3376. */
  3377. defineJQueryPlugin(Popover);
  3378. /**
  3379. * --------------------------------------------------------------------------
  3380. * Bootstrap (v5.0.2): scrollspy.js
  3381. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3382. * --------------------------------------------------------------------------
  3383. */
  3384. /**
  3385. * ------------------------------------------------------------------------
  3386. * Constants
  3387. * ------------------------------------------------------------------------
  3388. */
  3389. const NAME$2 = 'scrollspy';
  3390. const DATA_KEY$2 = 'bs.scrollspy';
  3391. const EVENT_KEY$2 = `.${DATA_KEY$2}`;
  3392. const DATA_API_KEY$1 = '.data-api';
  3393. const Default$1 = {
  3394. offset: 10,
  3395. method: 'auto',
  3396. target: ''
  3397. };
  3398. const DefaultType$1 = {
  3399. offset: 'number',
  3400. method: 'string',
  3401. target: '(string|element)'
  3402. };
  3403. const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`;
  3404. const EVENT_SCROLL = `scroll${EVENT_KEY$2}`;
  3405. const EVENT_LOAD_DATA_API = `load${EVENT_KEY$2}${DATA_API_KEY$1}`;
  3406. const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  3407. const CLASS_NAME_ACTIVE$1 = 'active';
  3408. const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
  3409. const SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group';
  3410. const SELECTOR_NAV_LINKS = '.nav-link';
  3411. const SELECTOR_NAV_ITEMS = '.nav-item';
  3412. const SELECTOR_LIST_ITEMS = '.list-group-item';
  3413. const SELECTOR_DROPDOWN$1 = '.dropdown';
  3414. const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  3415. const METHOD_OFFSET = 'offset';
  3416. const METHOD_POSITION = 'position';
  3417. /**
  3418. * ------------------------------------------------------------------------
  3419. * Class Definition
  3420. * ------------------------------------------------------------------------
  3421. */
  3422. class ScrollSpy extends BaseComponent {
  3423. constructor(element, config) {
  3424. super(element);
  3425. this._scrollElement = this._element.tagName === 'BODY' ? window : this._element;
  3426. this._config = this._getConfig(config);
  3427. this._selector = `${this._config.target} ${SELECTOR_NAV_LINKS}, ${this._config.target} ${SELECTOR_LIST_ITEMS}, ${this._config.target} .${CLASS_NAME_DROPDOWN_ITEM}`;
  3428. this._offsets = [];
  3429. this._targets = [];
  3430. this._activeTarget = null;
  3431. this._scrollHeight = 0;
  3432. EventHandler.on(this._scrollElement, EVENT_SCROLL, () => this._process());
  3433. this.refresh();
  3434. this._process();
  3435. } // Getters
  3436. static get Default() {
  3437. return Default$1;
  3438. }
  3439. static get NAME() {
  3440. return NAME$2;
  3441. } // Public
  3442. refresh() {
  3443. const autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION;
  3444. const offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method;
  3445. const offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0;
  3446. this._offsets = [];
  3447. this._targets = [];
  3448. this._scrollHeight = this._getScrollHeight();
  3449. const targets = SelectorEngine.find(this._selector);
  3450. targets.map(element => {
  3451. const targetSelector = getSelectorFromElement(element);
  3452. const target = targetSelector ? SelectorEngine.findOne(targetSelector) : null;
  3453. if (target) {
  3454. const targetBCR = target.getBoundingClientRect();
  3455. if (targetBCR.width || targetBCR.height) {
  3456. return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector];
  3457. }
  3458. }
  3459. return null;
  3460. }).filter(item => item).sort((a, b) => a[0] - b[0]).forEach(item => {
  3461. this._offsets.push(item[0]);
  3462. this._targets.push(item[1]);
  3463. });
  3464. }
  3465. dispose() {
  3466. EventHandler.off(this._scrollElement, EVENT_KEY$2);
  3467. super.dispose();
  3468. } // Private
  3469. _getConfig(config) {
  3470. config = { ...Default$1,
  3471. ...Manipulator.getDataAttributes(this._element),
  3472. ...(typeof config === 'object' && config ? config : {})
  3473. };
  3474. if (typeof config.target !== 'string' && isElement(config.target)) {
  3475. let {
  3476. id
  3477. } = config.target;
  3478. if (!id) {
  3479. id = getUID(NAME$2);
  3480. config.target.id = id;
  3481. }
  3482. config.target = `#${id}`;
  3483. }
  3484. typeCheckConfig(NAME$2, config, DefaultType$1);
  3485. return config;
  3486. }
  3487. _getScrollTop() {
  3488. return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop;
  3489. }
  3490. _getScrollHeight() {
  3491. return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
  3492. }
  3493. _getOffsetHeight() {
  3494. return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height;
  3495. }
  3496. _process() {
  3497. const scrollTop = this._getScrollTop() + this._config.offset;
  3498. const scrollHeight = this._getScrollHeight();
  3499. const maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight();
  3500. if (this._scrollHeight !== scrollHeight) {
  3501. this.refresh();
  3502. }
  3503. if (scrollTop >= maxScroll) {
  3504. const target = this._targets[this._targets.length - 1];
  3505. if (this._activeTarget !== target) {
  3506. this._activate(target);
  3507. }
  3508. return;
  3509. }
  3510. if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {
  3511. this._activeTarget = null;
  3512. this._clear();
  3513. return;
  3514. }
  3515. for (let i = this._offsets.length; i--;) {
  3516. const isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]);
  3517. if (isActiveTarget) {
  3518. this._activate(this._targets[i]);
  3519. }
  3520. }
  3521. }
  3522. _activate(target) {
  3523. this._activeTarget = target;
  3524. this._clear();
  3525. const queries = this._selector.split(',').map(selector => `${selector}[data-bs-target="${target}"],${selector}[href="${target}"]`);
  3526. const link = SelectorEngine.findOne(queries.join(','));
  3527. if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
  3528. SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1);
  3529. link.classList.add(CLASS_NAME_ACTIVE$1);
  3530. } else {
  3531. // Set triggered link as active
  3532. link.classList.add(CLASS_NAME_ACTIVE$1);
  3533. SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach(listGroup => {
  3534. // Set triggered links parents as active
  3535. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  3536. SelectorEngine.prev(listGroup, `${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1)); // Handle special case when .nav-link is inside .nav-item
  3537. SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(navItem => {
  3538. SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(item => item.classList.add(CLASS_NAME_ACTIVE$1));
  3539. });
  3540. });
  3541. }
  3542. EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, {
  3543. relatedTarget: target
  3544. });
  3545. }
  3546. _clear() {
  3547. SelectorEngine.find(this._selector).filter(node => node.classList.contains(CLASS_NAME_ACTIVE$1)).forEach(node => node.classList.remove(CLASS_NAME_ACTIVE$1));
  3548. } // Static
  3549. static jQueryInterface(config) {
  3550. return this.each(function () {
  3551. const data = ScrollSpy.getOrCreateInstance(this, config);
  3552. if (typeof config !== 'string') {
  3553. return;
  3554. }
  3555. if (typeof data[config] === 'undefined') {
  3556. throw new TypeError(`No method named "${config}"`);
  3557. }
  3558. data[config]();
  3559. });
  3560. }
  3561. }
  3562. /**
  3563. * ------------------------------------------------------------------------
  3564. * Data Api implementation
  3565. * ------------------------------------------------------------------------
  3566. */
  3567. EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
  3568. SelectorEngine.find(SELECTOR_DATA_SPY).forEach(spy => new ScrollSpy(spy));
  3569. });
  3570. /**
  3571. * ------------------------------------------------------------------------
  3572. * jQuery
  3573. * ------------------------------------------------------------------------
  3574. * add .ScrollSpy to jQuery only if jQuery is present
  3575. */
  3576. defineJQueryPlugin(ScrollSpy);
  3577. /**
  3578. * --------------------------------------------------------------------------
  3579. * Bootstrap (v5.0.2): tab.js
  3580. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3581. * --------------------------------------------------------------------------
  3582. */
  3583. /**
  3584. * ------------------------------------------------------------------------
  3585. * Constants
  3586. * ------------------------------------------------------------------------
  3587. */
  3588. const NAME$1 = 'tab';
  3589. const DATA_KEY$1 = 'bs.tab';
  3590. const EVENT_KEY$1 = `.${DATA_KEY$1}`;
  3591. const DATA_API_KEY = '.data-api';
  3592. const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`;
  3593. const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`;
  3594. const EVENT_SHOW$1 = `show${EVENT_KEY$1}`;
  3595. const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`;
  3596. const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}${DATA_API_KEY}`;
  3597. const CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu';
  3598. const CLASS_NAME_ACTIVE = 'active';
  3599. const CLASS_NAME_FADE$1 = 'fade';
  3600. const CLASS_NAME_SHOW$1 = 'show';
  3601. const SELECTOR_DROPDOWN = '.dropdown';
  3602. const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  3603. const SELECTOR_ACTIVE = '.active';
  3604. const SELECTOR_ACTIVE_UL = ':scope > li > .active';
  3605. const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]';
  3606. const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
  3607. const SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active';
  3608. /**
  3609. * ------------------------------------------------------------------------
  3610. * Class Definition
  3611. * ------------------------------------------------------------------------
  3612. */
  3613. class Tab extends BaseComponent {
  3614. // Getters
  3615. static get NAME() {
  3616. return NAME$1;
  3617. } // Public
  3618. show() {
  3619. if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE)) {
  3620. return;
  3621. }
  3622. let previous;
  3623. const target = getElementFromSelector(this._element);
  3624. const listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP);
  3625. if (listElement) {
  3626. const itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE;
  3627. previous = SelectorEngine.find(itemSelector, listElement);
  3628. previous = previous[previous.length - 1];
  3629. }
  3630. const hideEvent = previous ? EventHandler.trigger(previous, EVENT_HIDE$1, {
  3631. relatedTarget: this._element
  3632. }) : null;
  3633. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, {
  3634. relatedTarget: previous
  3635. });
  3636. if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) {
  3637. return;
  3638. }
  3639. this._activate(this._element, listElement);
  3640. const complete = () => {
  3641. EventHandler.trigger(previous, EVENT_HIDDEN$1, {
  3642. relatedTarget: this._element
  3643. });
  3644. EventHandler.trigger(this._element, EVENT_SHOWN$1, {
  3645. relatedTarget: previous
  3646. });
  3647. };
  3648. if (target) {
  3649. this._activate(target, target.parentNode, complete);
  3650. } else {
  3651. complete();
  3652. }
  3653. } // Private
  3654. _activate(element, container, callback) {
  3655. const activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE);
  3656. const active = activeElements[0];
  3657. const isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$1);
  3658. const complete = () => this._transitionComplete(element, active, callback);
  3659. if (active && isTransitioning) {
  3660. active.classList.remove(CLASS_NAME_SHOW$1);
  3661. this._queueCallback(complete, element, true);
  3662. } else {
  3663. complete();
  3664. }
  3665. }
  3666. _transitionComplete(element, active, callback) {
  3667. if (active) {
  3668. active.classList.remove(CLASS_NAME_ACTIVE);
  3669. const dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode);
  3670. if (dropdownChild) {
  3671. dropdownChild.classList.remove(CLASS_NAME_ACTIVE);
  3672. }
  3673. if (active.getAttribute('role') === 'tab') {
  3674. active.setAttribute('aria-selected', false);
  3675. }
  3676. }
  3677. element.classList.add(CLASS_NAME_ACTIVE);
  3678. if (element.getAttribute('role') === 'tab') {
  3679. element.setAttribute('aria-selected', true);
  3680. }
  3681. reflow(element);
  3682. if (element.classList.contains(CLASS_NAME_FADE$1)) {
  3683. element.classList.add(CLASS_NAME_SHOW$1);
  3684. }
  3685. let parent = element.parentNode;
  3686. if (parent && parent.nodeName === 'LI') {
  3687. parent = parent.parentNode;
  3688. }
  3689. if (parent && parent.classList.contains(CLASS_NAME_DROPDOWN_MENU)) {
  3690. const dropdownElement = element.closest(SELECTOR_DROPDOWN);
  3691. if (dropdownElement) {
  3692. SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE, dropdownElement).forEach(dropdown => dropdown.classList.add(CLASS_NAME_ACTIVE));
  3693. }
  3694. element.setAttribute('aria-expanded', true);
  3695. }
  3696. if (callback) {
  3697. callback();
  3698. }
  3699. } // Static
  3700. static jQueryInterface(config) {
  3701. return this.each(function () {
  3702. const data = Tab.getOrCreateInstance(this);
  3703. if (typeof config === 'string') {
  3704. if (typeof data[config] === 'undefined') {
  3705. throw new TypeError(`No method named "${config}"`);
  3706. }
  3707. data[config]();
  3708. }
  3709. });
  3710. }
  3711. }
  3712. /**
  3713. * ------------------------------------------------------------------------
  3714. * Data Api implementation
  3715. * ------------------------------------------------------------------------
  3716. */
  3717. EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
  3718. if (['A', 'AREA'].includes(this.tagName)) {
  3719. event.preventDefault();
  3720. }
  3721. if (isDisabled(this)) {
  3722. return;
  3723. }
  3724. const data = Tab.getOrCreateInstance(this);
  3725. data.show();
  3726. });
  3727. /**
  3728. * ------------------------------------------------------------------------
  3729. * jQuery
  3730. * ------------------------------------------------------------------------
  3731. * add .Tab to jQuery only if jQuery is present
  3732. */
  3733. defineJQueryPlugin(Tab);
  3734. /**
  3735. * --------------------------------------------------------------------------
  3736. * Bootstrap (v5.0.2): toast.js
  3737. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3738. * --------------------------------------------------------------------------
  3739. */
  3740. /**
  3741. * ------------------------------------------------------------------------
  3742. * Constants
  3743. * ------------------------------------------------------------------------
  3744. */
  3745. const NAME = 'toast';
  3746. const DATA_KEY = 'bs.toast';
  3747. const EVENT_KEY = `.${DATA_KEY}`;
  3748. const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`;
  3749. const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
  3750. const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
  3751. const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
  3752. const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
  3753. const EVENT_HIDE = `hide${EVENT_KEY}`;
  3754. const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
  3755. const EVENT_SHOW = `show${EVENT_KEY}`;
  3756. const EVENT_SHOWN = `shown${EVENT_KEY}`;
  3757. const CLASS_NAME_FADE = 'fade';
  3758. const CLASS_NAME_HIDE = 'hide';
  3759. const CLASS_NAME_SHOW = 'show';
  3760. const CLASS_NAME_SHOWING = 'showing';
  3761. const DefaultType = {
  3762. animation: 'boolean',
  3763. autohide: 'boolean',
  3764. delay: 'number'
  3765. };
  3766. const Default = {
  3767. animation: true,
  3768. autohide: true,
  3769. delay: 5000
  3770. };
  3771. const SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]';
  3772. /**
  3773. * ------------------------------------------------------------------------
  3774. * Class Definition
  3775. * ------------------------------------------------------------------------
  3776. */
  3777. class Toast extends BaseComponent {
  3778. constructor(element, config) {
  3779. super(element);
  3780. this._config = this._getConfig(config);
  3781. this._timeout = null;
  3782. this._hasMouseInteraction = false;
  3783. this._hasKeyboardInteraction = false;
  3784. this._setListeners();
  3785. } // Getters
  3786. static get DefaultType() {
  3787. return DefaultType;
  3788. }
  3789. static get Default() {
  3790. return Default;
  3791. }
  3792. static get NAME() {
  3793. return NAME;
  3794. } // Public
  3795. show() {
  3796. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
  3797. if (showEvent.defaultPrevented) {
  3798. return;
  3799. }
  3800. this._clearTimeout();
  3801. if (this._config.animation) {
  3802. this._element.classList.add(CLASS_NAME_FADE);
  3803. }
  3804. const complete = () => {
  3805. this._element.classList.remove(CLASS_NAME_SHOWING);
  3806. this._element.classList.add(CLASS_NAME_SHOW);
  3807. EventHandler.trigger(this._element, EVENT_SHOWN);
  3808. this._maybeScheduleHide();
  3809. };
  3810. this._element.classList.remove(CLASS_NAME_HIDE);
  3811. reflow(this._element);
  3812. this._element.classList.add(CLASS_NAME_SHOWING);
  3813. this._queueCallback(complete, this._element, this._config.animation);
  3814. }
  3815. hide() {
  3816. if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
  3817. return;
  3818. }
  3819. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
  3820. if (hideEvent.defaultPrevented) {
  3821. return;
  3822. }
  3823. const complete = () => {
  3824. this._element.classList.add(CLASS_NAME_HIDE);
  3825. EventHandler.trigger(this._element, EVENT_HIDDEN);
  3826. };
  3827. this._element.classList.remove(CLASS_NAME_SHOW);
  3828. this._queueCallback(complete, this._element, this._config.animation);
  3829. }
  3830. dispose() {
  3831. this._clearTimeout();
  3832. if (this._element.classList.contains(CLASS_NAME_SHOW)) {
  3833. this._element.classList.remove(CLASS_NAME_SHOW);
  3834. }
  3835. super.dispose();
  3836. } // Private
  3837. _getConfig(config) {
  3838. config = { ...Default,
  3839. ...Manipulator.getDataAttributes(this._element),
  3840. ...(typeof config === 'object' && config ? config : {})
  3841. };
  3842. typeCheckConfig(NAME, config, this.constructor.DefaultType);
  3843. return config;
  3844. }
  3845. _maybeScheduleHide() {
  3846. if (!this._config.autohide) {
  3847. return;
  3848. }
  3849. if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
  3850. return;
  3851. }
  3852. this._timeout = setTimeout(() => {
  3853. this.hide();
  3854. }, this._config.delay);
  3855. }
  3856. _onInteraction(event, isInteracting) {
  3857. switch (event.type) {
  3858. case 'mouseover':
  3859. case 'mouseout':
  3860. this._hasMouseInteraction = isInteracting;
  3861. break;
  3862. case 'focusin':
  3863. case 'focusout':
  3864. this._hasKeyboardInteraction = isInteracting;
  3865. break;
  3866. }
  3867. if (isInteracting) {
  3868. this._clearTimeout();
  3869. return;
  3870. }
  3871. const nextElement = event.relatedTarget;
  3872. if (this._element === nextElement || this._element.contains(nextElement)) {
  3873. return;
  3874. }
  3875. this._maybeScheduleHide();
  3876. }
  3877. _setListeners() {
  3878. EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide());
  3879. EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
  3880. EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
  3881. EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
  3882. EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
  3883. }
  3884. _clearTimeout() {
  3885. clearTimeout(this._timeout);
  3886. this._timeout = null;
  3887. } // Static
  3888. static jQueryInterface(config) {
  3889. return this.each(function () {
  3890. const data = Toast.getOrCreateInstance(this, config);
  3891. if (typeof config === 'string') {
  3892. if (typeof data[config] === 'undefined') {
  3893. throw new TypeError(`No method named "${config}"`);
  3894. }
  3895. data[config](this);
  3896. }
  3897. });
  3898. }
  3899. }
  3900. /**
  3901. * ------------------------------------------------------------------------
  3902. * jQuery
  3903. * ------------------------------------------------------------------------
  3904. * add .Toast to jQuery only if jQuery is present
  3905. */
  3906. defineJQueryPlugin(Toast);
  3907. export { Alert, Button, Carousel, Collapse, Dropdown, Modal, Offcanvas, Popover, ScrollSpy, Tab, Toast, Tooltip };
  3908. //# sourceMappingURL=bootstrap.esm.js.map