bootstrap.js 142 KB

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