bootstrap.esm.js 139 KB

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