bootstrap.js 145 KB

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