bootstrap.js 142 KB

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