bootstrap.esm.js 133 KB

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