bootstrap.js 142 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467
  1. /*!
  2. * Bootstrap v5.3.0-alpha2 (https://getbootstrap.com/)
  3. * Copyright 2011-2023 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  4. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  5. */
  6. (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 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 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 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 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 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 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-alpha2';
  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 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 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 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 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 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 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 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 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 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 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 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 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. this.hide();
  2387. return;
  2388. }
  2389. this._triggerBackdropTransition();
  2390. });
  2391. EventHandler.on(window, EVENT_RESIZE$1, () => {
  2392. if (this._isShown && !this._isTransitioning) {
  2393. this._adjustDialog();
  2394. }
  2395. });
  2396. EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
  2397. // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks
  2398. EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => {
  2399. if (this._element !== event.target || this._element !== event2.target) {
  2400. return;
  2401. }
  2402. if (this._config.backdrop === 'static') {
  2403. this._triggerBackdropTransition();
  2404. return;
  2405. }
  2406. if (this._config.backdrop) {
  2407. this.hide();
  2408. }
  2409. });
  2410. });
  2411. }
  2412. _hideModal() {
  2413. this._element.style.display = 'none';
  2414. this._element.setAttribute('aria-hidden', true);
  2415. this._element.removeAttribute('aria-modal');
  2416. this._element.removeAttribute('role');
  2417. this._isTransitioning = false;
  2418. this._backdrop.hide(() => {
  2419. document.body.classList.remove(CLASS_NAME_OPEN);
  2420. this._resetAdjustments();
  2421. this._scrollBar.reset();
  2422. EventHandler.trigger(this._element, EVENT_HIDDEN$4);
  2423. });
  2424. }
  2425. _isAnimated() {
  2426. return this._element.classList.contains(CLASS_NAME_FADE$3);
  2427. }
  2428. _triggerBackdropTransition() {
  2429. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED$1);
  2430. if (hideEvent.defaultPrevented) {
  2431. return;
  2432. }
  2433. const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  2434. const initialOverflowY = this._element.style.overflowY;
  2435. // return if the following background transition hasn't yet completed
  2436. if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) {
  2437. return;
  2438. }
  2439. if (!isModalOverflowing) {
  2440. this._element.style.overflowY = 'hidden';
  2441. }
  2442. this._element.classList.add(CLASS_NAME_STATIC);
  2443. this._queueCallback(() => {
  2444. this._element.classList.remove(CLASS_NAME_STATIC);
  2445. this._queueCallback(() => {
  2446. this._element.style.overflowY = initialOverflowY;
  2447. }, this._dialog);
  2448. }, this._dialog);
  2449. this._element.focus();
  2450. }
  2451. /**
  2452. * The following methods are used to handle overflowing modals
  2453. */
  2454. _adjustDialog() {
  2455. const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
  2456. const scrollbarWidth = this._scrollBar.getWidth();
  2457. const isBodyOverflowing = scrollbarWidth > 0;
  2458. if (isBodyOverflowing && !isModalOverflowing) {
  2459. const property = isRTL() ? 'paddingLeft' : 'paddingRight';
  2460. this._element.style[property] = `${scrollbarWidth}px`;
  2461. }
  2462. if (!isBodyOverflowing && isModalOverflowing) {
  2463. const property = isRTL() ? 'paddingRight' : 'paddingLeft';
  2464. this._element.style[property] = `${scrollbarWidth}px`;
  2465. }
  2466. }
  2467. _resetAdjustments() {
  2468. this._element.style.paddingLeft = '';
  2469. this._element.style.paddingRight = '';
  2470. }
  2471. // Static
  2472. static jQueryInterface(config, relatedTarget) {
  2473. return this.each(function () {
  2474. const data = Modal.getOrCreateInstance(this, config);
  2475. if (typeof config !== 'string') {
  2476. return;
  2477. }
  2478. if (typeof data[config] === 'undefined') {
  2479. throw new TypeError(`No method named "${config}"`);
  2480. }
  2481. data[config](relatedTarget);
  2482. });
  2483. }
  2484. }
  2485. /**
  2486. * Data API implementation
  2487. */
  2488. EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) {
  2489. const target = SelectorEngine.getElementFromSelector(this);
  2490. if (['A', 'AREA'].includes(this.tagName)) {
  2491. event.preventDefault();
  2492. }
  2493. EventHandler.one(target, EVENT_SHOW$4, showEvent => {
  2494. if (showEvent.defaultPrevented) {
  2495. // only register focus restorer if modal will actually get shown
  2496. return;
  2497. }
  2498. EventHandler.one(target, EVENT_HIDDEN$4, () => {
  2499. if (isVisible(this)) {
  2500. this.focus();
  2501. }
  2502. });
  2503. });
  2504. // avoid conflict when clicking modal toggler while another one is open
  2505. const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR$1);
  2506. if (alreadyOpen) {
  2507. Modal.getInstance(alreadyOpen).hide();
  2508. }
  2509. const data = Modal.getOrCreateInstance(target);
  2510. data.toggle(this);
  2511. });
  2512. enableDismissTrigger(Modal);
  2513. /**
  2514. * jQuery
  2515. */
  2516. defineJQueryPlugin(Modal);
  2517. /**
  2518. * --------------------------------------------------------------------------
  2519. * Bootstrap offcanvas.js
  2520. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2521. * --------------------------------------------------------------------------
  2522. */
  2523. /**
  2524. * Constants
  2525. */
  2526. const NAME$6 = 'offcanvas';
  2527. const DATA_KEY$3 = 'bs.offcanvas';
  2528. const EVENT_KEY$3 = `.${DATA_KEY$3}`;
  2529. const DATA_API_KEY$1 = '.data-api';
  2530. const EVENT_LOAD_DATA_API$2 = `load${EVENT_KEY$3}${DATA_API_KEY$1}`;
  2531. const ESCAPE_KEY = 'Escape';
  2532. const CLASS_NAME_SHOW$3 = 'show';
  2533. const CLASS_NAME_SHOWING$1 = 'showing';
  2534. const CLASS_NAME_HIDING = 'hiding';
  2535. const CLASS_NAME_BACKDROP = 'offcanvas-backdrop';
  2536. const OPEN_SELECTOR = '.offcanvas.show';
  2537. const EVENT_SHOW$3 = `show${EVENT_KEY$3}`;
  2538. const EVENT_SHOWN$3 = `shown${EVENT_KEY$3}`;
  2539. const EVENT_HIDE$3 = `hide${EVENT_KEY$3}`;
  2540. const EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY$3}`;
  2541. const EVENT_HIDDEN$3 = `hidden${EVENT_KEY$3}`;
  2542. const EVENT_RESIZE = `resize${EVENT_KEY$3}`;
  2543. const EVENT_CLICK_DATA_API$1 = `click${EVENT_KEY$3}${DATA_API_KEY$1}`;
  2544. const EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY$3}`;
  2545. const SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]';
  2546. const Default$5 = {
  2547. backdrop: true,
  2548. keyboard: true,
  2549. scroll: false
  2550. };
  2551. const DefaultType$5 = {
  2552. backdrop: '(boolean|string)',
  2553. keyboard: 'boolean',
  2554. scroll: 'boolean'
  2555. };
  2556. /**
  2557. * Class definition
  2558. */
  2559. class Offcanvas extends BaseComponent {
  2560. constructor(element, config) {
  2561. super(element, config);
  2562. this._isShown = false;
  2563. this._backdrop = this._initializeBackDrop();
  2564. this._focustrap = this._initializeFocusTrap();
  2565. this._addEventListeners();
  2566. }
  2567. // Getters
  2568. static get Default() {
  2569. return Default$5;
  2570. }
  2571. static get DefaultType() {
  2572. return DefaultType$5;
  2573. }
  2574. static get NAME() {
  2575. return NAME$6;
  2576. }
  2577. // Public
  2578. toggle(relatedTarget) {
  2579. return this._isShown ? this.hide() : this.show(relatedTarget);
  2580. }
  2581. show(relatedTarget) {
  2582. if (this._isShown) {
  2583. return;
  2584. }
  2585. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, {
  2586. relatedTarget
  2587. });
  2588. if (showEvent.defaultPrevented) {
  2589. return;
  2590. }
  2591. this._isShown = true;
  2592. this._backdrop.show();
  2593. if (!this._config.scroll) {
  2594. new ScrollBarHelper().hide();
  2595. }
  2596. this._element.setAttribute('aria-modal', true);
  2597. this._element.setAttribute('role', 'dialog');
  2598. this._element.classList.add(CLASS_NAME_SHOWING$1);
  2599. const completeCallBack = () => {
  2600. if (!this._config.scroll || this._config.backdrop) {
  2601. this._focustrap.activate();
  2602. }
  2603. this._element.classList.add(CLASS_NAME_SHOW$3);
  2604. this._element.classList.remove(CLASS_NAME_SHOWING$1);
  2605. EventHandler.trigger(this._element, EVENT_SHOWN$3, {
  2606. relatedTarget
  2607. });
  2608. };
  2609. this._queueCallback(completeCallBack, this._element, true);
  2610. }
  2611. hide() {
  2612. if (!this._isShown) {
  2613. return;
  2614. }
  2615. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3);
  2616. if (hideEvent.defaultPrevented) {
  2617. return;
  2618. }
  2619. this._focustrap.deactivate();
  2620. this._element.blur();
  2621. this._isShown = false;
  2622. this._element.classList.add(CLASS_NAME_HIDING);
  2623. this._backdrop.hide();
  2624. const completeCallback = () => {
  2625. this._element.classList.remove(CLASS_NAME_SHOW$3, CLASS_NAME_HIDING);
  2626. this._element.removeAttribute('aria-modal');
  2627. this._element.removeAttribute('role');
  2628. if (!this._config.scroll) {
  2629. new ScrollBarHelper().reset();
  2630. }
  2631. EventHandler.trigger(this._element, EVENT_HIDDEN$3);
  2632. };
  2633. this._queueCallback(completeCallback, this._element, true);
  2634. }
  2635. dispose() {
  2636. this._backdrop.dispose();
  2637. this._focustrap.deactivate();
  2638. super.dispose();
  2639. }
  2640. // Private
  2641. _initializeBackDrop() {
  2642. const clickCallback = () => {
  2643. if (this._config.backdrop === 'static') {
  2644. EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
  2645. return;
  2646. }
  2647. this.hide();
  2648. };
  2649. // 'static' option will be translated to true, and booleans will keep their value
  2650. const isVisible = Boolean(this._config.backdrop);
  2651. return new Backdrop({
  2652. className: CLASS_NAME_BACKDROP,
  2653. isVisible,
  2654. isAnimated: true,
  2655. rootElement: this._element.parentNode,
  2656. clickCallback: isVisible ? clickCallback : null
  2657. });
  2658. }
  2659. _initializeFocusTrap() {
  2660. return new FocusTrap({
  2661. trapElement: this._element
  2662. });
  2663. }
  2664. _addEventListeners() {
  2665. EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {
  2666. if (event.key !== ESCAPE_KEY) {
  2667. return;
  2668. }
  2669. if (this._config.keyboard) {
  2670. this.hide();
  2671. return;
  2672. }
  2673. EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED);
  2674. });
  2675. }
  2676. // Static
  2677. static jQueryInterface(config) {
  2678. return this.each(function () {
  2679. const data = Offcanvas.getOrCreateInstance(this, config);
  2680. if (typeof config !== 'string') {
  2681. return;
  2682. }
  2683. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  2684. throw new TypeError(`No method named "${config}"`);
  2685. }
  2686. data[config](this);
  2687. });
  2688. }
  2689. }
  2690. /**
  2691. * Data API implementation
  2692. */
  2693. EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) {
  2694. const target = SelectorEngine.getElementFromSelector(this);
  2695. if (['A', 'AREA'].includes(this.tagName)) {
  2696. event.preventDefault();
  2697. }
  2698. if (isDisabled(this)) {
  2699. return;
  2700. }
  2701. EventHandler.one(target, EVENT_HIDDEN$3, () => {
  2702. // focus on trigger when it is closed
  2703. if (isVisible(this)) {
  2704. this.focus();
  2705. }
  2706. });
  2707. // avoid conflict when clicking a toggler of an offcanvas, while another is open
  2708. const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR);
  2709. if (alreadyOpen && alreadyOpen !== target) {
  2710. Offcanvas.getInstance(alreadyOpen).hide();
  2711. }
  2712. const data = Offcanvas.getOrCreateInstance(target);
  2713. data.toggle(this);
  2714. });
  2715. EventHandler.on(window, EVENT_LOAD_DATA_API$2, () => {
  2716. for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {
  2717. Offcanvas.getOrCreateInstance(selector).show();
  2718. }
  2719. });
  2720. EventHandler.on(window, EVENT_RESIZE, () => {
  2721. for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) {
  2722. if (getComputedStyle(element).position !== 'fixed') {
  2723. Offcanvas.getOrCreateInstance(element).hide();
  2724. }
  2725. }
  2726. });
  2727. enableDismissTrigger(Offcanvas);
  2728. /**
  2729. * jQuery
  2730. */
  2731. defineJQueryPlugin(Offcanvas);
  2732. /**
  2733. * --------------------------------------------------------------------------
  2734. * Bootstrap util/sanitizer.js
  2735. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2736. * --------------------------------------------------------------------------
  2737. */
  2738. const uriAttributes = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']);
  2739. const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
  2740. /**
  2741. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  2742. *
  2743. * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
  2744. */
  2745. const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
  2746. /**
  2747. * A pattern that matches safe data URLs. Only matches image, video and audio types.
  2748. *
  2749. * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
  2750. */
  2751. 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;
  2752. const allowedAttribute = (attribute, allowedAttributeList) => {
  2753. const attributeName = attribute.nodeName.toLowerCase();
  2754. if (allowedAttributeList.includes(attributeName)) {
  2755. if (uriAttributes.has(attributeName)) {
  2756. return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue) || DATA_URL_PATTERN.test(attribute.nodeValue));
  2757. }
  2758. return true;
  2759. }
  2760. // Check if a regular expression validates the attribute.
  2761. return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp).some(regex => regex.test(attributeName));
  2762. };
  2763. const DefaultAllowlist = {
  2764. // Global attributes allowed on any supplied element below.
  2765. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
  2766. a: ['target', 'href', 'title', 'rel'],
  2767. area: [],
  2768. b: [],
  2769. br: [],
  2770. col: [],
  2771. code: [],
  2772. div: [],
  2773. em: [],
  2774. hr: [],
  2775. h1: [],
  2776. h2: [],
  2777. h3: [],
  2778. h4: [],
  2779. h5: [],
  2780. h6: [],
  2781. i: [],
  2782. img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
  2783. li: [],
  2784. ol: [],
  2785. p: [],
  2786. pre: [],
  2787. s: [],
  2788. small: [],
  2789. span: [],
  2790. sub: [],
  2791. sup: [],
  2792. strong: [],
  2793. u: [],
  2794. ul: []
  2795. };
  2796. function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
  2797. if (!unsafeHtml.length) {
  2798. return unsafeHtml;
  2799. }
  2800. if (sanitizeFunction && typeof sanitizeFunction === 'function') {
  2801. return sanitizeFunction(unsafeHtml);
  2802. }
  2803. const domParser = new window.DOMParser();
  2804. const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
  2805. const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
  2806. for (const element of elements) {
  2807. const elementName = element.nodeName.toLowerCase();
  2808. if (!Object.keys(allowList).includes(elementName)) {
  2809. element.remove();
  2810. continue;
  2811. }
  2812. const attributeList = [].concat(...element.attributes);
  2813. const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
  2814. for (const attribute of attributeList) {
  2815. if (!allowedAttribute(attribute, allowedAttributes)) {
  2816. element.removeAttribute(attribute.nodeName);
  2817. }
  2818. }
  2819. }
  2820. return createdDocument.body.innerHTML;
  2821. }
  2822. /**
  2823. * --------------------------------------------------------------------------
  2824. * Bootstrap util/template-factory.js
  2825. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2826. * --------------------------------------------------------------------------
  2827. */
  2828. /**
  2829. * Constants
  2830. */
  2831. const NAME$5 = 'TemplateFactory';
  2832. const Default$4 = {
  2833. allowList: DefaultAllowlist,
  2834. content: {},
  2835. // { selector : text , selector2 : text2 , }
  2836. extraClass: '',
  2837. html: false,
  2838. sanitize: true,
  2839. sanitizeFn: null,
  2840. template: '<div></div>'
  2841. };
  2842. const DefaultType$4 = {
  2843. allowList: 'object',
  2844. content: 'object',
  2845. extraClass: '(string|function)',
  2846. html: 'boolean',
  2847. sanitize: 'boolean',
  2848. sanitizeFn: '(null|function)',
  2849. template: 'string'
  2850. };
  2851. const DefaultContentType = {
  2852. entry: '(string|element|function|null)',
  2853. selector: '(string|element)'
  2854. };
  2855. /**
  2856. * Class definition
  2857. */
  2858. class TemplateFactory extends Config {
  2859. constructor(config) {
  2860. super();
  2861. this._config = this._getConfig(config);
  2862. }
  2863. // Getters
  2864. static get Default() {
  2865. return Default$4;
  2866. }
  2867. static get DefaultType() {
  2868. return DefaultType$4;
  2869. }
  2870. static get NAME() {
  2871. return NAME$5;
  2872. }
  2873. // Public
  2874. getContent() {
  2875. return Object.values(this._config.content).map(config => this._resolvePossibleFunction(config)).filter(Boolean);
  2876. }
  2877. hasContent() {
  2878. return this.getContent().length > 0;
  2879. }
  2880. changeContent(content) {
  2881. this._checkContent(content);
  2882. this._config.content = {
  2883. ...this._config.content,
  2884. ...content
  2885. };
  2886. return this;
  2887. }
  2888. toHtml() {
  2889. const templateWrapper = document.createElement('div');
  2890. templateWrapper.innerHTML = this._maybeSanitize(this._config.template);
  2891. for (const [selector, text] of Object.entries(this._config.content)) {
  2892. this._setContent(templateWrapper, text, selector);
  2893. }
  2894. const template = templateWrapper.children[0];
  2895. const extraClass = this._resolvePossibleFunction(this._config.extraClass);
  2896. if (extraClass) {
  2897. template.classList.add(...extraClass.split(' '));
  2898. }
  2899. return template;
  2900. }
  2901. // Private
  2902. _typeCheckConfig(config) {
  2903. super._typeCheckConfig(config);
  2904. this._checkContent(config.content);
  2905. }
  2906. _checkContent(arg) {
  2907. for (const [selector, content] of Object.entries(arg)) {
  2908. super._typeCheckConfig({
  2909. selector,
  2910. entry: content
  2911. }, DefaultContentType);
  2912. }
  2913. }
  2914. _setContent(template, content, selector) {
  2915. const templateElement = SelectorEngine.findOne(selector, template);
  2916. if (!templateElement) {
  2917. return;
  2918. }
  2919. content = this._resolvePossibleFunction(content);
  2920. if (!content) {
  2921. templateElement.remove();
  2922. return;
  2923. }
  2924. if (isElement(content)) {
  2925. this._putElementInTemplate(getElement(content), templateElement);
  2926. return;
  2927. }
  2928. if (this._config.html) {
  2929. templateElement.innerHTML = this._maybeSanitize(content);
  2930. return;
  2931. }
  2932. templateElement.textContent = content;
  2933. }
  2934. _maybeSanitize(arg) {
  2935. return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg;
  2936. }
  2937. _resolvePossibleFunction(arg) {
  2938. return execute(arg, [this]);
  2939. }
  2940. _putElementInTemplate(element, templateElement) {
  2941. if (this._config.html) {
  2942. templateElement.innerHTML = '';
  2943. templateElement.append(element);
  2944. return;
  2945. }
  2946. templateElement.textContent = element.textContent;
  2947. }
  2948. }
  2949. /**
  2950. * --------------------------------------------------------------------------
  2951. * Bootstrap tooltip.js
  2952. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  2953. * --------------------------------------------------------------------------
  2954. */
  2955. /**
  2956. * Constants
  2957. */
  2958. const NAME$4 = 'tooltip';
  2959. const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
  2960. const CLASS_NAME_FADE$2 = 'fade';
  2961. const CLASS_NAME_MODAL = 'modal';
  2962. const CLASS_NAME_SHOW$2 = 'show';
  2963. const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
  2964. const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
  2965. const EVENT_MODAL_HIDE = 'hide.bs.modal';
  2966. const TRIGGER_HOVER = 'hover';
  2967. const TRIGGER_FOCUS = 'focus';
  2968. const TRIGGER_CLICK = 'click';
  2969. const TRIGGER_MANUAL = 'manual';
  2970. const EVENT_HIDE$2 = 'hide';
  2971. const EVENT_HIDDEN$2 = 'hidden';
  2972. const EVENT_SHOW$2 = 'show';
  2973. const EVENT_SHOWN$2 = 'shown';
  2974. const EVENT_INSERTED = 'inserted';
  2975. const EVENT_CLICK$1 = 'click';
  2976. const EVENT_FOCUSIN$1 = 'focusin';
  2977. const EVENT_FOCUSOUT$1 = 'focusout';
  2978. const EVENT_MOUSEENTER = 'mouseenter';
  2979. const EVENT_MOUSELEAVE = 'mouseleave';
  2980. const AttachmentMap = {
  2981. AUTO: 'auto',
  2982. TOP: 'top',
  2983. RIGHT: isRTL() ? 'left' : 'right',
  2984. BOTTOM: 'bottom',
  2985. LEFT: isRTL() ? 'right' : 'left'
  2986. };
  2987. const Default$3 = {
  2988. allowList: DefaultAllowlist,
  2989. animation: true,
  2990. boundary: 'clippingParents',
  2991. container: false,
  2992. customClass: '',
  2993. delay: 0,
  2994. fallbackPlacements: ['top', 'right', 'bottom', 'left'],
  2995. html: false,
  2996. offset: [0, 0],
  2997. placement: 'top',
  2998. popperConfig: null,
  2999. sanitize: true,
  3000. sanitizeFn: null,
  3001. selector: false,
  3002. template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
  3003. title: '',
  3004. trigger: 'hover focus'
  3005. };
  3006. const DefaultType$3 = {
  3007. allowList: 'object',
  3008. animation: 'boolean',
  3009. boundary: '(string|element)',
  3010. container: '(string|element|boolean)',
  3011. customClass: '(string|function)',
  3012. delay: '(number|object)',
  3013. fallbackPlacements: 'array',
  3014. html: 'boolean',
  3015. offset: '(array|string|function)',
  3016. placement: '(string|function)',
  3017. popperConfig: '(null|object|function)',
  3018. sanitize: 'boolean',
  3019. sanitizeFn: '(null|function)',
  3020. selector: '(string|boolean)',
  3021. template: 'string',
  3022. title: '(string|element|function)',
  3023. trigger: 'string'
  3024. };
  3025. /**
  3026. * Class definition
  3027. */
  3028. class Tooltip extends BaseComponent {
  3029. constructor(element, config) {
  3030. if (typeof Popper__namespace === 'undefined') {
  3031. throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)');
  3032. }
  3033. super(element, config);
  3034. // Private
  3035. this._isEnabled = true;
  3036. this._timeout = 0;
  3037. this._isHovered = null;
  3038. this._activeTrigger = {};
  3039. this._popper = null;
  3040. this._templateFactory = null;
  3041. this._newContent = null;
  3042. // Protected
  3043. this.tip = null;
  3044. this._setListeners();
  3045. if (!this._config.selector) {
  3046. this._fixTitle();
  3047. }
  3048. }
  3049. // Getters
  3050. static get Default() {
  3051. return Default$3;
  3052. }
  3053. static get DefaultType() {
  3054. return DefaultType$3;
  3055. }
  3056. static get NAME() {
  3057. return NAME$4;
  3058. }
  3059. // Public
  3060. enable() {
  3061. this._isEnabled = true;
  3062. }
  3063. disable() {
  3064. this._isEnabled = false;
  3065. }
  3066. toggleEnabled() {
  3067. this._isEnabled = !this._isEnabled;
  3068. }
  3069. toggle() {
  3070. if (!this._isEnabled) {
  3071. return;
  3072. }
  3073. this._activeTrigger.click = !this._activeTrigger.click;
  3074. if (this._isShown()) {
  3075. this._leave();
  3076. return;
  3077. }
  3078. this._enter();
  3079. }
  3080. dispose() {
  3081. clearTimeout(this._timeout);
  3082. EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
  3083. if (this._element.getAttribute('data-bs-original-title')) {
  3084. this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'));
  3085. }
  3086. this._disposePopper();
  3087. super.dispose();
  3088. }
  3089. show() {
  3090. if (this._element.style.display === 'none') {
  3091. throw new Error('Please use show on visible elements');
  3092. }
  3093. if (!(this._isWithContent() && this._isEnabled)) {
  3094. return;
  3095. }
  3096. const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW$2));
  3097. const shadowRoot = findShadowRoot(this._element);
  3098. const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
  3099. if (showEvent.defaultPrevented || !isInTheDom) {
  3100. return;
  3101. }
  3102. // todo v6 remove this OR make it optional
  3103. this._disposePopper();
  3104. const tip = this._getTipElement();
  3105. this._element.setAttribute('aria-describedby', tip.getAttribute('id'));
  3106. const {
  3107. container
  3108. } = this._config;
  3109. if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
  3110. container.append(tip);
  3111. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED));
  3112. }
  3113. this._popper = this._createPopper(tip);
  3114. tip.classList.add(CLASS_NAME_SHOW$2);
  3115. // If this is a touch-enabled device we add extra
  3116. // empty mouseover listeners to the body's immediate children;
  3117. // only needed because of broken event delegation on iOS
  3118. // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
  3119. if ('ontouchstart' in document.documentElement) {
  3120. for (const element of [].concat(...document.body.children)) {
  3121. EventHandler.on(element, 'mouseover', noop);
  3122. }
  3123. }
  3124. const complete = () => {
  3125. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2));
  3126. if (this._isHovered === false) {
  3127. this._leave();
  3128. }
  3129. this._isHovered = false;
  3130. };
  3131. this._queueCallback(complete, this.tip, this._isAnimated());
  3132. }
  3133. hide() {
  3134. if (!this._isShown()) {
  3135. return;
  3136. }
  3137. const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE$2));
  3138. if (hideEvent.defaultPrevented) {
  3139. return;
  3140. }
  3141. const tip = this._getTipElement();
  3142. tip.classList.remove(CLASS_NAME_SHOW$2);
  3143. // If this is a touch-enabled device we remove the extra
  3144. // empty mouseover listeners we added for iOS support
  3145. if ('ontouchstart' in document.documentElement) {
  3146. for (const element of [].concat(...document.body.children)) {
  3147. EventHandler.off(element, 'mouseover', noop);
  3148. }
  3149. }
  3150. this._activeTrigger[TRIGGER_CLICK] = false;
  3151. this._activeTrigger[TRIGGER_FOCUS] = false;
  3152. this._activeTrigger[TRIGGER_HOVER] = false;
  3153. this._isHovered = null; // it is a trick to support manual triggering
  3154. const complete = () => {
  3155. if (this._isWithActiveTrigger()) {
  3156. return;
  3157. }
  3158. if (!this._isHovered) {
  3159. this._disposePopper();
  3160. }
  3161. this._element.removeAttribute('aria-describedby');
  3162. EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN$2));
  3163. };
  3164. this._queueCallback(complete, this.tip, this._isAnimated());
  3165. }
  3166. update() {
  3167. if (this._popper) {
  3168. this._popper.update();
  3169. }
  3170. }
  3171. // Protected
  3172. _isWithContent() {
  3173. return Boolean(this._getTitle());
  3174. }
  3175. _getTipElement() {
  3176. if (!this.tip) {
  3177. this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
  3178. }
  3179. return this.tip;
  3180. }
  3181. _createTipElement(content) {
  3182. const tip = this._getTemplateFactory(content).toHtml();
  3183. // todo: remove this check on v6
  3184. if (!tip) {
  3185. return null;
  3186. }
  3187. tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2);
  3188. // todo: on v6 the following can be achieved with CSS only
  3189. tip.classList.add(`bs-${this.constructor.NAME}-auto`);
  3190. const tipId = getUID(this.constructor.NAME).toString();
  3191. tip.setAttribute('id', tipId);
  3192. if (this._isAnimated()) {
  3193. tip.classList.add(CLASS_NAME_FADE$2);
  3194. }
  3195. return tip;
  3196. }
  3197. setContent(content) {
  3198. this._newContent = content;
  3199. if (this._isShown()) {
  3200. this._disposePopper();
  3201. this.show();
  3202. }
  3203. }
  3204. _getTemplateFactory(content) {
  3205. if (this._templateFactory) {
  3206. this._templateFactory.changeContent(content);
  3207. } else {
  3208. this._templateFactory = new TemplateFactory({
  3209. ...this._config,
  3210. // the `content` var has to be after `this._config`
  3211. // to override config.content in case of popover
  3212. content,
  3213. extraClass: this._resolvePossibleFunction(this._config.customClass)
  3214. });
  3215. }
  3216. return this._templateFactory;
  3217. }
  3218. _getContentForTemplate() {
  3219. return {
  3220. [SELECTOR_TOOLTIP_INNER]: this._getTitle()
  3221. };
  3222. }
  3223. _getTitle() {
  3224. return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title');
  3225. }
  3226. // Private
  3227. _initializeOnDelegatedTarget(event) {
  3228. return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig());
  3229. }
  3230. _isAnimated() {
  3231. return this._config.animation || this.tip && this.tip.classList.contains(CLASS_NAME_FADE$2);
  3232. }
  3233. _isShown() {
  3234. return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW$2);
  3235. }
  3236. _createPopper(tip) {
  3237. const placement = execute(this._config.placement, [this, tip, this._element]);
  3238. const attachment = AttachmentMap[placement.toUpperCase()];
  3239. return Popper__namespace.createPopper(this._element, tip, this._getPopperConfig(attachment));
  3240. }
  3241. _getOffset() {
  3242. const {
  3243. offset
  3244. } = this._config;
  3245. if (typeof offset === 'string') {
  3246. return offset.split(',').map(value => Number.parseInt(value, 10));
  3247. }
  3248. if (typeof offset === 'function') {
  3249. return popperData => offset(popperData, this._element);
  3250. }
  3251. return offset;
  3252. }
  3253. _resolvePossibleFunction(arg) {
  3254. return execute(arg, [this._element]);
  3255. }
  3256. _getPopperConfig(attachment) {
  3257. const defaultBsPopperConfig = {
  3258. placement: attachment,
  3259. modifiers: [{
  3260. name: 'flip',
  3261. options: {
  3262. fallbackPlacements: this._config.fallbackPlacements
  3263. }
  3264. }, {
  3265. name: 'offset',
  3266. options: {
  3267. offset: this._getOffset()
  3268. }
  3269. }, {
  3270. name: 'preventOverflow',
  3271. options: {
  3272. boundary: this._config.boundary
  3273. }
  3274. }, {
  3275. name: 'arrow',
  3276. options: {
  3277. element: `.${this.constructor.NAME}-arrow`
  3278. }
  3279. }, {
  3280. name: 'preSetPlacement',
  3281. enabled: true,
  3282. phase: 'beforeMain',
  3283. fn: data => {
  3284. // Pre-set Popper's placement attribute in order to read the arrow sizes properly.
  3285. // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement
  3286. this._getTipElement().setAttribute('data-popper-placement', data.state.placement);
  3287. }
  3288. }]
  3289. };
  3290. return {
  3291. ...defaultBsPopperConfig,
  3292. ...execute(this._config.popperConfig, [defaultBsPopperConfig])
  3293. };
  3294. }
  3295. _setListeners() {
  3296. const triggers = this._config.trigger.split(' ');
  3297. for (const trigger of triggers) {
  3298. if (trigger === 'click') {
  3299. EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK$1), this._config.selector, event => {
  3300. const context = this._initializeOnDelegatedTarget(event);
  3301. context.toggle();
  3302. });
  3303. } else if (trigger !== TRIGGER_MANUAL) {
  3304. const eventIn = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSEENTER) : this.constructor.eventName(EVENT_FOCUSIN$1);
  3305. const eventOut = trigger === TRIGGER_HOVER ? this.constructor.eventName(EVENT_MOUSELEAVE) : this.constructor.eventName(EVENT_FOCUSOUT$1);
  3306. EventHandler.on(this._element, eventIn, this._config.selector, event => {
  3307. const context = this._initializeOnDelegatedTarget(event);
  3308. context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
  3309. context._enter();
  3310. });
  3311. EventHandler.on(this._element, eventOut, this._config.selector, event => {
  3312. const context = this._initializeOnDelegatedTarget(event);
  3313. context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = context._element.contains(event.relatedTarget);
  3314. context._leave();
  3315. });
  3316. }
  3317. }
  3318. this._hideModalHandler = () => {
  3319. if (this._element) {
  3320. this.hide();
  3321. }
  3322. };
  3323. EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
  3324. }
  3325. _fixTitle() {
  3326. const title = this._element.getAttribute('title');
  3327. if (!title) {
  3328. return;
  3329. }
  3330. if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
  3331. this._element.setAttribute('aria-label', title);
  3332. }
  3333. this._element.setAttribute('data-bs-original-title', title); // DO NOT USE IT. Is only for backwards compatibility
  3334. this._element.removeAttribute('title');
  3335. }
  3336. _enter() {
  3337. if (this._isShown() || this._isHovered) {
  3338. this._isHovered = true;
  3339. return;
  3340. }
  3341. this._isHovered = true;
  3342. this._setTimeout(() => {
  3343. if (this._isHovered) {
  3344. this.show();
  3345. }
  3346. }, this._config.delay.show);
  3347. }
  3348. _leave() {
  3349. if (this._isWithActiveTrigger()) {
  3350. return;
  3351. }
  3352. this._isHovered = false;
  3353. this._setTimeout(() => {
  3354. if (!this._isHovered) {
  3355. this.hide();
  3356. }
  3357. }, this._config.delay.hide);
  3358. }
  3359. _setTimeout(handler, timeout) {
  3360. clearTimeout(this._timeout);
  3361. this._timeout = setTimeout(handler, timeout);
  3362. }
  3363. _isWithActiveTrigger() {
  3364. return Object.values(this._activeTrigger).includes(true);
  3365. }
  3366. _getConfig(config) {
  3367. const dataAttributes = Manipulator.getDataAttributes(this._element);
  3368. for (const dataAttribute of Object.keys(dataAttributes)) {
  3369. if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
  3370. delete dataAttributes[dataAttribute];
  3371. }
  3372. }
  3373. config = {
  3374. ...dataAttributes,
  3375. ...(typeof config === 'object' && config ? config : {})
  3376. };
  3377. config = this._mergeConfigObj(config);
  3378. config = this._configAfterMerge(config);
  3379. this._typeCheckConfig(config);
  3380. return config;
  3381. }
  3382. _configAfterMerge(config) {
  3383. config.container = config.container === false ? document.body : getElement(config.container);
  3384. if (typeof config.delay === 'number') {
  3385. config.delay = {
  3386. show: config.delay,
  3387. hide: config.delay
  3388. };
  3389. }
  3390. if (typeof config.title === 'number') {
  3391. config.title = config.title.toString();
  3392. }
  3393. if (typeof config.content === 'number') {
  3394. config.content = config.content.toString();
  3395. }
  3396. return config;
  3397. }
  3398. _getDelegateConfig() {
  3399. const config = {};
  3400. for (const [key, value] of Object.entries(this._config)) {
  3401. if (this.constructor.Default[key] !== value) {
  3402. config[key] = value;
  3403. }
  3404. }
  3405. config.selector = false;
  3406. config.trigger = 'manual';
  3407. // In the future can be replaced with:
  3408. // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
  3409. // `Object.fromEntries(keysWithDifferentValues)`
  3410. return config;
  3411. }
  3412. _disposePopper() {
  3413. if (this._popper) {
  3414. this._popper.destroy();
  3415. this._popper = null;
  3416. }
  3417. if (this.tip) {
  3418. this.tip.remove();
  3419. this.tip = null;
  3420. }
  3421. }
  3422. // Static
  3423. static jQueryInterface(config) {
  3424. return this.each(function () {
  3425. const data = Tooltip.getOrCreateInstance(this, config);
  3426. if (typeof config !== 'string') {
  3427. return;
  3428. }
  3429. if (typeof data[config] === 'undefined') {
  3430. throw new TypeError(`No method named "${config}"`);
  3431. }
  3432. data[config]();
  3433. });
  3434. }
  3435. }
  3436. /**
  3437. * jQuery
  3438. */
  3439. defineJQueryPlugin(Tooltip);
  3440. /**
  3441. * --------------------------------------------------------------------------
  3442. * Bootstrap popover.js
  3443. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3444. * --------------------------------------------------------------------------
  3445. */
  3446. /**
  3447. * Constants
  3448. */
  3449. const NAME$3 = 'popover';
  3450. const SELECTOR_TITLE = '.popover-header';
  3451. const SELECTOR_CONTENT = '.popover-body';
  3452. const Default$2 = {
  3453. ...Tooltip.Default,
  3454. content: '',
  3455. offset: [0, 8],
  3456. placement: 'right',
  3457. template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>',
  3458. trigger: 'click'
  3459. };
  3460. const DefaultType$2 = {
  3461. ...Tooltip.DefaultType,
  3462. content: '(null|string|element|function)'
  3463. };
  3464. /**
  3465. * Class definition
  3466. */
  3467. class Popover extends Tooltip {
  3468. // Getters
  3469. static get Default() {
  3470. return Default$2;
  3471. }
  3472. static get DefaultType() {
  3473. return DefaultType$2;
  3474. }
  3475. static get NAME() {
  3476. return NAME$3;
  3477. }
  3478. // Overrides
  3479. _isWithContent() {
  3480. return this._getTitle() || this._getContent();
  3481. }
  3482. // Private
  3483. _getContentForTemplate() {
  3484. return {
  3485. [SELECTOR_TITLE]: this._getTitle(),
  3486. [SELECTOR_CONTENT]: this._getContent()
  3487. };
  3488. }
  3489. _getContent() {
  3490. return this._resolvePossibleFunction(this._config.content);
  3491. }
  3492. // Static
  3493. static jQueryInterface(config) {
  3494. return this.each(function () {
  3495. const data = Popover.getOrCreateInstance(this, config);
  3496. if (typeof config !== 'string') {
  3497. return;
  3498. }
  3499. if (typeof data[config] === 'undefined') {
  3500. throw new TypeError(`No method named "${config}"`);
  3501. }
  3502. data[config]();
  3503. });
  3504. }
  3505. }
  3506. /**
  3507. * jQuery
  3508. */
  3509. defineJQueryPlugin(Popover);
  3510. /**
  3511. * --------------------------------------------------------------------------
  3512. * Bootstrap scrollspy.js
  3513. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3514. * --------------------------------------------------------------------------
  3515. */
  3516. /**
  3517. * Constants
  3518. */
  3519. const NAME$2 = 'scrollspy';
  3520. const DATA_KEY$2 = 'bs.scrollspy';
  3521. const EVENT_KEY$2 = `.${DATA_KEY$2}`;
  3522. const DATA_API_KEY = '.data-api';
  3523. const EVENT_ACTIVATE = `activate${EVENT_KEY$2}`;
  3524. const EVENT_CLICK = `click${EVENT_KEY$2}`;
  3525. const EVENT_LOAD_DATA_API$1 = `load${EVENT_KEY$2}${DATA_API_KEY}`;
  3526. const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item';
  3527. const CLASS_NAME_ACTIVE$1 = 'active';
  3528. const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
  3529. const SELECTOR_TARGET_LINKS = '[href]';
  3530. const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group';
  3531. const SELECTOR_NAV_LINKS = '.nav-link';
  3532. const SELECTOR_NAV_ITEMS = '.nav-item';
  3533. const SELECTOR_LIST_ITEMS = '.list-group-item';
  3534. const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`;
  3535. const SELECTOR_DROPDOWN = '.dropdown';
  3536. const SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle';
  3537. const Default$1 = {
  3538. offset: null,
  3539. // TODO: v6 @deprecated, keep it for backwards compatibility reasons
  3540. rootMargin: '0px 0px -25%',
  3541. smoothScroll: false,
  3542. target: null,
  3543. threshold: [0.1, 0.5, 1]
  3544. };
  3545. const DefaultType$1 = {
  3546. offset: '(number|null)',
  3547. // TODO v6 @deprecated, keep it for backwards compatibility reasons
  3548. rootMargin: 'string',
  3549. smoothScroll: 'boolean',
  3550. target: 'element',
  3551. threshold: 'array'
  3552. };
  3553. /**
  3554. * Class definition
  3555. */
  3556. class ScrollSpy extends BaseComponent {
  3557. constructor(element, config) {
  3558. super(element, config);
  3559. // this._element is the observablesContainer and config.target the menu links wrapper
  3560. this._targetLinks = new Map();
  3561. this._observableSections = new Map();
  3562. this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element;
  3563. this._activeTarget = null;
  3564. this._observer = null;
  3565. this._previousScrollData = {
  3566. visibleEntryTop: 0,
  3567. parentScrollTop: 0
  3568. };
  3569. this.refresh(); // initialize
  3570. }
  3571. // Getters
  3572. static get Default() {
  3573. return Default$1;
  3574. }
  3575. static get DefaultType() {
  3576. return DefaultType$1;
  3577. }
  3578. static get NAME() {
  3579. return NAME$2;
  3580. }
  3581. // Public
  3582. refresh() {
  3583. this._initializeTargetsAndObservables();
  3584. this._maybeEnableSmoothScroll();
  3585. if (this._observer) {
  3586. this._observer.disconnect();
  3587. } else {
  3588. this._observer = this._getNewObserver();
  3589. }
  3590. for (const section of this._observableSections.values()) {
  3591. this._observer.observe(section);
  3592. }
  3593. }
  3594. dispose() {
  3595. this._observer.disconnect();
  3596. super.dispose();
  3597. }
  3598. // Private
  3599. _configAfterMerge(config) {
  3600. // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
  3601. config.target = getElement(config.target) || document.body;
  3602. // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
  3603. config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin;
  3604. if (typeof config.threshold === 'string') {
  3605. config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value));
  3606. }
  3607. return config;
  3608. }
  3609. _maybeEnableSmoothScroll() {
  3610. if (!this._config.smoothScroll) {
  3611. return;
  3612. }
  3613. // unregister any previous listeners
  3614. EventHandler.off(this._config.target, EVENT_CLICK);
  3615. EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {
  3616. const observableSection = this._observableSections.get(event.target.hash);
  3617. if (observableSection) {
  3618. event.preventDefault();
  3619. const root = this._rootElement || window;
  3620. const height = observableSection.offsetTop - this._element.offsetTop;
  3621. if (root.scrollTo) {
  3622. root.scrollTo({
  3623. top: height,
  3624. behavior: 'smooth'
  3625. });
  3626. return;
  3627. }
  3628. // Chrome 60 doesn't support `scrollTo`
  3629. root.scrollTop = height;
  3630. }
  3631. });
  3632. }
  3633. _getNewObserver() {
  3634. const options = {
  3635. root: this._rootElement,
  3636. threshold: this._config.threshold,
  3637. rootMargin: this._config.rootMargin
  3638. };
  3639. return new IntersectionObserver(entries => this._observerCallback(entries), options);
  3640. }
  3641. // The logic of selection
  3642. _observerCallback(entries) {
  3643. const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`);
  3644. const activate = entry => {
  3645. this._previousScrollData.visibleEntryTop = entry.target.offsetTop;
  3646. this._process(targetElement(entry));
  3647. };
  3648. const parentScrollTop = (this._rootElement || document.documentElement).scrollTop;
  3649. const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop;
  3650. this._previousScrollData.parentScrollTop = parentScrollTop;
  3651. for (const entry of entries) {
  3652. if (!entry.isIntersecting) {
  3653. this._activeTarget = null;
  3654. this._clearActiveClass(targetElement(entry));
  3655. continue;
  3656. }
  3657. const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop;
  3658. // if we are scrolling down, pick the bigger offsetTop
  3659. if (userScrollsDown && entryIsLowerThanPrevious) {
  3660. activate(entry);
  3661. // if parent isn't scrolled, let's keep the first visible item, breaking the iteration
  3662. if (!parentScrollTop) {
  3663. return;
  3664. }
  3665. continue;
  3666. }
  3667. // if we are scrolling up, pick the smallest offsetTop
  3668. if (!userScrollsDown && !entryIsLowerThanPrevious) {
  3669. activate(entry);
  3670. }
  3671. }
  3672. }
  3673. _initializeTargetsAndObservables() {
  3674. this._targetLinks = new Map();
  3675. this._observableSections = new Map();
  3676. const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target);
  3677. for (const anchor of targetLinks) {
  3678. // ensure that the anchor has an id and is not disabled
  3679. if (!anchor.hash || isDisabled(anchor)) {
  3680. continue;
  3681. }
  3682. const observableSection = SelectorEngine.findOne(anchor.hash, this._element);
  3683. // ensure that the observableSection exists & is visible
  3684. if (isVisible(observableSection)) {
  3685. this._targetLinks.set(anchor.hash, anchor);
  3686. this._observableSections.set(anchor.hash, observableSection);
  3687. }
  3688. }
  3689. }
  3690. _process(target) {
  3691. if (this._activeTarget === target) {
  3692. return;
  3693. }
  3694. this._clearActiveClass(this._config.target);
  3695. this._activeTarget = target;
  3696. target.classList.add(CLASS_NAME_ACTIVE$1);
  3697. this._activateParents(target);
  3698. EventHandler.trigger(this._element, EVENT_ACTIVATE, {
  3699. relatedTarget: target
  3700. });
  3701. }
  3702. _activateParents(target) {
  3703. // Activate dropdown parents
  3704. if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
  3705. SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE$1);
  3706. return;
  3707. }
  3708. for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {
  3709. // Set triggered links parents as active
  3710. // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
  3711. for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) {
  3712. item.classList.add(CLASS_NAME_ACTIVE$1);
  3713. }
  3714. }
  3715. }
  3716. _clearActiveClass(parent) {
  3717. parent.classList.remove(CLASS_NAME_ACTIVE$1);
  3718. const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE$1}`, parent);
  3719. for (const node of activeNodes) {
  3720. node.classList.remove(CLASS_NAME_ACTIVE$1);
  3721. }
  3722. }
  3723. // Static
  3724. static jQueryInterface(config) {
  3725. return this.each(function () {
  3726. const data = ScrollSpy.getOrCreateInstance(this, config);
  3727. if (typeof config !== 'string') {
  3728. return;
  3729. }
  3730. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  3731. throw new TypeError(`No method named "${config}"`);
  3732. }
  3733. data[config]();
  3734. });
  3735. }
  3736. }
  3737. /**
  3738. * Data API implementation
  3739. */
  3740. EventHandler.on(window, EVENT_LOAD_DATA_API$1, () => {
  3741. for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
  3742. ScrollSpy.getOrCreateInstance(spy);
  3743. }
  3744. });
  3745. /**
  3746. * jQuery
  3747. */
  3748. defineJQueryPlugin(ScrollSpy);
  3749. /**
  3750. * --------------------------------------------------------------------------
  3751. * Bootstrap tab.js
  3752. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3753. * --------------------------------------------------------------------------
  3754. */
  3755. /**
  3756. * Constants
  3757. */
  3758. const NAME$1 = 'tab';
  3759. const DATA_KEY$1 = 'bs.tab';
  3760. const EVENT_KEY$1 = `.${DATA_KEY$1}`;
  3761. const EVENT_HIDE$1 = `hide${EVENT_KEY$1}`;
  3762. const EVENT_HIDDEN$1 = `hidden${EVENT_KEY$1}`;
  3763. const EVENT_SHOW$1 = `show${EVENT_KEY$1}`;
  3764. const EVENT_SHOWN$1 = `shown${EVENT_KEY$1}`;
  3765. const EVENT_CLICK_DATA_API = `click${EVENT_KEY$1}`;
  3766. const EVENT_KEYDOWN = `keydown${EVENT_KEY$1}`;
  3767. const EVENT_LOAD_DATA_API = `load${EVENT_KEY$1}`;
  3768. const ARROW_LEFT_KEY = 'ArrowLeft';
  3769. const ARROW_RIGHT_KEY = 'ArrowRight';
  3770. const ARROW_UP_KEY = 'ArrowUp';
  3771. const ARROW_DOWN_KEY = 'ArrowDown';
  3772. const CLASS_NAME_ACTIVE = 'active';
  3773. const CLASS_NAME_FADE$1 = 'fade';
  3774. const CLASS_NAME_SHOW$1 = 'show';
  3775. const CLASS_DROPDOWN = 'dropdown';
  3776. const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle';
  3777. const SELECTOR_DROPDOWN_MENU = '.dropdown-menu';
  3778. const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)';
  3779. const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]';
  3780. const SELECTOR_OUTER = '.nav-item, .list-group-item';
  3781. const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`;
  3782. const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; // todo:v6: could be only `tab`
  3783. const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`;
  3784. 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"]`;
  3785. /**
  3786. * Class definition
  3787. */
  3788. class Tab extends BaseComponent {
  3789. constructor(element) {
  3790. super(element);
  3791. this._parent = this._element.closest(SELECTOR_TAB_PANEL);
  3792. if (!this._parent) {
  3793. return;
  3794. // todo: should Throw exception on v6
  3795. // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`)
  3796. }
  3797. // Set up initial aria attributes
  3798. this._setInitialAttributes(this._parent, this._getChildren());
  3799. EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event));
  3800. }
  3801. // Getters
  3802. static get NAME() {
  3803. return NAME$1;
  3804. }
  3805. // Public
  3806. show() {
  3807. // Shows this elem and deactivate the active sibling if exists
  3808. const innerElem = this._element;
  3809. if (this._elemIsActive(innerElem)) {
  3810. return;
  3811. }
  3812. // Search for active tab on same parent to deactivate it
  3813. const active = this._getActiveElem();
  3814. const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE$1, {
  3815. relatedTarget: innerElem
  3816. }) : null;
  3817. const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW$1, {
  3818. relatedTarget: active
  3819. });
  3820. if (showEvent.defaultPrevented || hideEvent && hideEvent.defaultPrevented) {
  3821. return;
  3822. }
  3823. this._deactivate(active, innerElem);
  3824. this._activate(innerElem, active);
  3825. }
  3826. // Private
  3827. _activate(element, relatedElem) {
  3828. if (!element) {
  3829. return;
  3830. }
  3831. element.classList.add(CLASS_NAME_ACTIVE);
  3832. this._activate(SelectorEngine.getElementFromSelector(element)); // Search and activate/show the proper section
  3833. const complete = () => {
  3834. if (element.getAttribute('role') !== 'tab') {
  3835. element.classList.add(CLASS_NAME_SHOW$1);
  3836. return;
  3837. }
  3838. element.removeAttribute('tabindex');
  3839. element.setAttribute('aria-selected', true);
  3840. this._toggleDropDown(element, true);
  3841. EventHandler.trigger(element, EVENT_SHOWN$1, {
  3842. relatedTarget: relatedElem
  3843. });
  3844. };
  3845. this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
  3846. }
  3847. _deactivate(element, relatedElem) {
  3848. if (!element) {
  3849. return;
  3850. }
  3851. element.classList.remove(CLASS_NAME_ACTIVE);
  3852. element.blur();
  3853. this._deactivate(SelectorEngine.getElementFromSelector(element)); // Search and deactivate the shown section too
  3854. const complete = () => {
  3855. if (element.getAttribute('role') !== 'tab') {
  3856. element.classList.remove(CLASS_NAME_SHOW$1);
  3857. return;
  3858. }
  3859. element.setAttribute('aria-selected', false);
  3860. element.setAttribute('tabindex', '-1');
  3861. this._toggleDropDown(element, false);
  3862. EventHandler.trigger(element, EVENT_HIDDEN$1, {
  3863. relatedTarget: relatedElem
  3864. });
  3865. };
  3866. this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
  3867. }
  3868. _keydown(event) {
  3869. if (![ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)) {
  3870. return;
  3871. }
  3872. event.stopPropagation(); // stopPropagation/preventDefault both added to support up/down keys without scrolling the page
  3873. event.preventDefault();
  3874. const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key);
  3875. const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true);
  3876. if (nextActiveElement) {
  3877. nextActiveElement.focus({
  3878. preventScroll: true
  3879. });
  3880. Tab.getOrCreateInstance(nextActiveElement).show();
  3881. }
  3882. }
  3883. _getChildren() {
  3884. // collection of inner elements
  3885. return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent);
  3886. }
  3887. _getActiveElem() {
  3888. return this._getChildren().find(child => this._elemIsActive(child)) || null;
  3889. }
  3890. _setInitialAttributes(parent, children) {
  3891. this._setAttributeIfNotExists(parent, 'role', 'tablist');
  3892. for (const child of children) {
  3893. this._setInitialAttributesOnChild(child);
  3894. }
  3895. }
  3896. _setInitialAttributesOnChild(child) {
  3897. child = this._getInnerElement(child);
  3898. const isActive = this._elemIsActive(child);
  3899. const outerElem = this._getOuterElement(child);
  3900. child.setAttribute('aria-selected', isActive);
  3901. if (outerElem !== child) {
  3902. this._setAttributeIfNotExists(outerElem, 'role', 'presentation');
  3903. }
  3904. if (!isActive) {
  3905. child.setAttribute('tabindex', '-1');
  3906. }
  3907. this._setAttributeIfNotExists(child, 'role', 'tab');
  3908. // set attributes to the related panel too
  3909. this._setInitialAttributesOnTargetPanel(child);
  3910. }
  3911. _setInitialAttributesOnTargetPanel(child) {
  3912. const target = SelectorEngine.getElementFromSelector(child);
  3913. if (!target) {
  3914. return;
  3915. }
  3916. this._setAttributeIfNotExists(target, 'role', 'tabpanel');
  3917. if (child.id) {
  3918. this._setAttributeIfNotExists(target, 'aria-labelledby', `${child.id}`);
  3919. }
  3920. }
  3921. _toggleDropDown(element, open) {
  3922. const outerElem = this._getOuterElement(element);
  3923. if (!outerElem.classList.contains(CLASS_DROPDOWN)) {
  3924. return;
  3925. }
  3926. const toggle = (selector, className) => {
  3927. const element = SelectorEngine.findOne(selector, outerElem);
  3928. if (element) {
  3929. element.classList.toggle(className, open);
  3930. }
  3931. };
  3932. toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE);
  3933. toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW$1);
  3934. outerElem.setAttribute('aria-expanded', open);
  3935. }
  3936. _setAttributeIfNotExists(element, attribute, value) {
  3937. if (!element.hasAttribute(attribute)) {
  3938. element.setAttribute(attribute, value);
  3939. }
  3940. }
  3941. _elemIsActive(elem) {
  3942. return elem.classList.contains(CLASS_NAME_ACTIVE);
  3943. }
  3944. // Try to get the inner element (usually the .nav-link)
  3945. _getInnerElement(elem) {
  3946. return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem);
  3947. }
  3948. // Try to get the outer element (usually the .nav-item)
  3949. _getOuterElement(elem) {
  3950. return elem.closest(SELECTOR_OUTER) || elem;
  3951. }
  3952. // Static
  3953. static jQueryInterface(config) {
  3954. return this.each(function () {
  3955. const data = Tab.getOrCreateInstance(this);
  3956. if (typeof config !== 'string') {
  3957. return;
  3958. }
  3959. if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {
  3960. throw new TypeError(`No method named "${config}"`);
  3961. }
  3962. data[config]();
  3963. });
  3964. }
  3965. }
  3966. /**
  3967. * Data API implementation
  3968. */
  3969. EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
  3970. if (['A', 'AREA'].includes(this.tagName)) {
  3971. event.preventDefault();
  3972. }
  3973. if (isDisabled(this)) {
  3974. return;
  3975. }
  3976. Tab.getOrCreateInstance(this).show();
  3977. });
  3978. /**
  3979. * Initialize on focus
  3980. */
  3981. EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
  3982. for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
  3983. Tab.getOrCreateInstance(element);
  3984. }
  3985. });
  3986. /**
  3987. * jQuery
  3988. */
  3989. defineJQueryPlugin(Tab);
  3990. /**
  3991. * --------------------------------------------------------------------------
  3992. * Bootstrap toast.js
  3993. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  3994. * --------------------------------------------------------------------------
  3995. */
  3996. /**
  3997. * Constants
  3998. */
  3999. const NAME = 'toast';
  4000. const DATA_KEY = 'bs.toast';
  4001. const EVENT_KEY = `.${DATA_KEY}`;
  4002. const EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`;
  4003. const EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`;
  4004. const EVENT_FOCUSIN = `focusin${EVENT_KEY}`;
  4005. const EVENT_FOCUSOUT = `focusout${EVENT_KEY}`;
  4006. const EVENT_HIDE = `hide${EVENT_KEY}`;
  4007. const EVENT_HIDDEN = `hidden${EVENT_KEY}`;
  4008. const EVENT_SHOW = `show${EVENT_KEY}`;
  4009. const EVENT_SHOWN = `shown${EVENT_KEY}`;
  4010. const CLASS_NAME_FADE = 'fade';
  4011. const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
  4012. const CLASS_NAME_SHOW = 'show';
  4013. const CLASS_NAME_SHOWING = 'showing';
  4014. const DefaultType = {
  4015. animation: 'boolean',
  4016. autohide: 'boolean',
  4017. delay: 'number'
  4018. };
  4019. const Default = {
  4020. animation: true,
  4021. autohide: true,
  4022. delay: 5000
  4023. };
  4024. /**
  4025. * Class definition
  4026. */
  4027. class Toast extends BaseComponent {
  4028. constructor(element, config) {
  4029. super(element, config);
  4030. this._timeout = null;
  4031. this._hasMouseInteraction = false;
  4032. this._hasKeyboardInteraction = false;
  4033. this._setListeners();
  4034. }
  4035. // Getters
  4036. static get Default() {
  4037. return Default;
  4038. }
  4039. static get DefaultType() {
  4040. return DefaultType;
  4041. }
  4042. static get NAME() {
  4043. return NAME;
  4044. }
  4045. // Public
  4046. show() {
  4047. const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
  4048. if (showEvent.defaultPrevented) {
  4049. return;
  4050. }
  4051. this._clearTimeout();
  4052. if (this._config.animation) {
  4053. this._element.classList.add(CLASS_NAME_FADE);
  4054. }
  4055. const complete = () => {
  4056. this._element.classList.remove(CLASS_NAME_SHOWING);
  4057. EventHandler.trigger(this._element, EVENT_SHOWN);
  4058. this._maybeScheduleHide();
  4059. };
  4060. this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
  4061. reflow(this._element);
  4062. this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING);
  4063. this._queueCallback(complete, this._element, this._config.animation);
  4064. }
  4065. hide() {
  4066. if (!this.isShown()) {
  4067. return;
  4068. }
  4069. const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
  4070. if (hideEvent.defaultPrevented) {
  4071. return;
  4072. }
  4073. const complete = () => {
  4074. this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
  4075. this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW);
  4076. EventHandler.trigger(this._element, EVENT_HIDDEN);
  4077. };
  4078. this._element.classList.add(CLASS_NAME_SHOWING);
  4079. this._queueCallback(complete, this._element, this._config.animation);
  4080. }
  4081. dispose() {
  4082. this._clearTimeout();
  4083. if (this.isShown()) {
  4084. this._element.classList.remove(CLASS_NAME_SHOW);
  4085. }
  4086. super.dispose();
  4087. }
  4088. isShown() {
  4089. return this._element.classList.contains(CLASS_NAME_SHOW);
  4090. }
  4091. // Private
  4092. _maybeScheduleHide() {
  4093. if (!this._config.autohide) {
  4094. return;
  4095. }
  4096. if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
  4097. return;
  4098. }
  4099. this._timeout = setTimeout(() => {
  4100. this.hide();
  4101. }, this._config.delay);
  4102. }
  4103. _onInteraction(event, isInteracting) {
  4104. switch (event.type) {
  4105. case 'mouseover':
  4106. case 'mouseout':
  4107. {
  4108. this._hasMouseInteraction = isInteracting;
  4109. break;
  4110. }
  4111. case 'focusin':
  4112. case 'focusout':
  4113. {
  4114. this._hasKeyboardInteraction = isInteracting;
  4115. break;
  4116. }
  4117. }
  4118. if (isInteracting) {
  4119. this._clearTimeout();
  4120. return;
  4121. }
  4122. const nextElement = event.relatedTarget;
  4123. if (this._element === nextElement || this._element.contains(nextElement)) {
  4124. return;
  4125. }
  4126. this._maybeScheduleHide();
  4127. }
  4128. _setListeners() {
  4129. EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
  4130. EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
  4131. EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
  4132. EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
  4133. }
  4134. _clearTimeout() {
  4135. clearTimeout(this._timeout);
  4136. this._timeout = null;
  4137. }
  4138. // Static
  4139. static jQueryInterface(config) {
  4140. return this.each(function () {
  4141. const data = Toast.getOrCreateInstance(this, config);
  4142. if (typeof config === 'string') {
  4143. if (typeof data[config] === 'undefined') {
  4144. throw new TypeError(`No method named "${config}"`);
  4145. }
  4146. data[config](this);
  4147. }
  4148. });
  4149. }
  4150. }
  4151. /**
  4152. * Data API implementation
  4153. */
  4154. enableDismissTrigger(Toast);
  4155. /**
  4156. * jQuery
  4157. */
  4158. defineJQueryPlugin(Toast);
  4159. /**
  4160. * --------------------------------------------------------------------------
  4161. * Bootstrap index.umd.js
  4162. * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  4163. * --------------------------------------------------------------------------
  4164. */
  4165. const index_umd = {
  4166. Alert,
  4167. Button,
  4168. Carousel,
  4169. Collapse,
  4170. Dropdown,
  4171. Modal,
  4172. Offcanvas,
  4173. Popover,
  4174. ScrollSpy,
  4175. Tab,
  4176. Toast,
  4177. Tooltip
  4178. };
  4179. return index_umd;
  4180. }));
  4181. //# sourceMappingURL=bootstrap.js.map