bootstrap.native
Advanced tools
Comparing version 5.0.4 to 5.0.5
@@ -37,5 +37,6 @@ /// <reference types="cypress" /> | ||
expect(instance.name).to.eq('Alert'); | ||
expect(instance.options).to.be.undefined; | ||
expect(instance.defaults).to.not.be.undefined; | ||
expect(instance.options).to.be.empty; | ||
expect(instance.defaults).to.be.empty; | ||
expect(instance.version).to.be.string; | ||
expect(Alert.getInstance(element)).to.be.instanceOf(Alert); | ||
}); | ||
@@ -42,0 +43,0 @@ }); |
@@ -31,5 +31,7 @@ /// <reference types="cypress" /> | ||
expect(instance.isActive, 'isActive').to.be.false; | ||
expect(instance.options, 'options').to.be.undefined; | ||
expect(instance.defaults, 'defaults').to.not.be.undefined; | ||
// expect(instance.version, 'version').to.be.string; | ||
expect(instance.options, 'options').to.be.empty; | ||
expect(instance.defaults, 'defaults').to.be.empty; | ||
expect(instance.version, 'version').to.be.string; | ||
expect(Button.getInstance(element)).to.be.instanceOf(Button); | ||
cy.wrap(instance).as('instance'); | ||
@@ -39,16 +41,7 @@ }); | ||
.invoke('toggle') | ||
.get('@instance') | ||
.its('isActive') | ||
.should('be.true') | ||
.get('@instance') | ||
.its('element') | ||
.should('have.class', 'active') | ||
.get('@instance') | ||
.invoke('toggle') | ||
.get('@instance') | ||
.its('isActive') | ||
.should('be.false') | ||
.get('@instance') | ||
.its('element') | ||
.should('not.have.class', 'active'); | ||
.get('@instance').its('isActive').should('be.true') | ||
.get('@instance').its('element').should('have.class', 'active') | ||
.get('@instance').invoke('toggle') | ||
.get('@instance').its('isActive').should('be.false') | ||
.get('@instance').its('element').should('not.have.class', 'active'); | ||
}); | ||
@@ -55,0 +48,0 @@ |
@@ -215,7 +215,7 @@ /// <reference types="cypress" /> | ||
}) | ||
.get('@instance').its('element').find('[data-bs-slide]').eq(0).click() | ||
.get('@instance').its('element').find('[data-bs-slide]').eq(0).click() // test SPAM protection | ||
cy.get('@instance').its('element').find('[data-bs-slide]').eq(0).click() | ||
cy.get('@instance').its('element').find('[data-bs-slide]').eq(0).click() // test SPAM protection | ||
.get('@instance').its('element').find('.carousel-item').eq(2).should('have.class', 'active') | ||
.get('@instance').its('element').find('[data-bs-slide]').eq(1).click() | ||
.get('@instance').its('element').find('[data-bs-slide]').eq(1).click() // test SPAM protection | ||
cy.get('@instance').its('element').find('[data-bs-slide]').eq(1).click() | ||
cy.get('@instance').its('element').find('[data-bs-slide]').eq(1).click() // test SPAM protection | ||
.get('@instance').its('element').find('.carousel-item').eq(0).should('have.class', 'active') | ||
@@ -474,13 +474,24 @@ .get('@instance').its('element').find('[data-bs-slide]').eq(1).click() | ||
cy.wrap(new Carousel($element[0], { interval: true })).as('instance'); | ||
}) | ||
.get('@instance').invoke('next') | ||
.wait(200) | ||
}); | ||
cy.get('@instance').invoke('next') | ||
cy.wait(200) | ||
// @ts-ignore | ||
.get('@instance').should('be.instanceOf', Carousel).should(instance => instance.dispose()) | ||
.get('@instance').its('element').should('be.undefined') | ||
.get('@instance').its('slides').should('be.undefined') | ||
.get('@instance').its('controls').should('be.undefined') | ||
.get('@instance').its('indicators').should('be.undefined') | ||
cy.get('@instance').should('be.instanceOf', Carousel).should(instance => instance.dispose()); | ||
cy.get('@instance').its('element').should('be.undefined') | ||
cy.get('@instance').its('slides').should('be.undefined') | ||
cy.get('@instance').its('controls').should('be.undefined') | ||
cy.get('@instance').its('indicators').should('be.undefined') | ||
}); | ||
}); | ||
it('Can re-init while animating', () => { | ||
cy.get('[data-cy="carousel"]').then(($element) => { | ||
cy.wrap(new Carousel($element[0], { interval: false })).then(e => { | ||
// console.log(e) | ||
e.next(); | ||
const newInstance = new Carousel($element[0]); | ||
expect(newInstance.element).not.to.be.undefined; | ||
expect(e.element).to.be.undefined; | ||
}) | ||
}) | ||
}); | ||
}); |
@@ -124,13 +124,15 @@ /// <reference types="cypress" /> | ||
cy.wrap(new Modal($element[0])).as('disposable'); | ||
cy.get('@disposable').invoke('show').then(() => { | ||
cy.wait(300) | ||
cy.get('[data-cy="modal"]').eq(0).should('exist').and('have.class', 'show').and('be.visible') | ||
}) | ||
cy.get('@disposable').invoke('dispose').then(() => { | ||
cy.wait(300) | ||
cy.get('@disposable').then(s => console.log(s)); | ||
cy.get('[data-cy="modal"]').eq(0).should('not.have.class', 'show').and('be.hidden') | ||
// cy.wrap(Modal.getInstance($element[0])).should('be.null') | ||
cy.get('@disposable').its('element').should('be.undefined') | ||
cy.get('@disposable').its('options').should('be.undefined') | ||
}) | ||
}) | ||
cy.get('@disposable').invoke('show').then(() => { | ||
cy.wait(300) | ||
cy.get('[data-cy="modal"]').eq(0).should('exist').and('have.class', 'show').and('be.visible') | ||
}) | ||
cy.get('@disposable').invoke('dispose').then(() => { | ||
cy.wait(300) | ||
cy.get('[data-cy="modal"]').eq(0).should('not.have.class', 'show').and('be.hidden') | ||
cy.get('@disposable').its('element').should('be.undefined') | ||
cy.get('@disposable').its('options').should('be.undefined') | ||
}) | ||
}); | ||
@@ -137,0 +139,0 @@ |
@@ -9,14 +9,2 @@ /// <reference types="cypress" /> | ||
it('Can do dispose()', () => { | ||
cy.get('[data-cy="offcanvas"]').eq(0).then(($element) => { | ||
cy.wrap(new Offcanvas($element[0])).as('disposable'); | ||
cy.get('@disposable').invoke('show') | ||
cy.get('@disposable').its('element').should('have.class', 'show').and('be.visible') | ||
cy.get('@disposable').invoke('dispose') | ||
cy.get('@disposable').its('element').should('be.undefined') | ||
cy.get('@disposable').its('options').should('be.undefined') | ||
cy.wait(500) | ||
}) | ||
}); | ||
it('Init without any parameters - throws error', () => { | ||
@@ -33,2 +21,19 @@ const args = []; | ||
it('Can be openeded / dismissed via click - backdrop', () => { | ||
cy.get('[data-cy="offcanvas"]').eq(0).then(($element) => { | ||
cy.wrap(new Offcanvas($element[0])).as('click_test'); | ||
}) | ||
cy.get('[href="#offcanvasExample"]').click() | ||
cy.get('[data-cy="offcanvas"]').eq(0).should('have.class', 'show').and('be.visible') | ||
cy.get('.offcanvas-backdrop').eq(0).trigger('mousedown', 990, 10) | ||
cy.get('.offcanvas-backdrop').eq(0).trigger('mouseup', 990, 10) | ||
cy.get('.offcanvas-backdrop').eq(0).trigger('click', 990, 10) | ||
cy.wait(100) | ||
cy.get('[data-cy="offcanvas"]').eq(0).should('not.have.class', 'show').and('be.hidden') | ||
cy.get('[href="#offcanvasExample"]').eq(0).click() | ||
cy.get('[data-cy="offcanvas"]').eq(0).should('have.class', 'show').and('be.visible') | ||
cy.get('[data-cy="offcanvas"]').eq(0).find('[data-bs-dismiss="offcanvas"]').eq(0).trigger('click', 'center') | ||
cy.get('[data-cy="offcanvas"]').eq(0).should('not.have.class', 'show').and('be.hidden') | ||
}); | ||
it('Init with target element', () => { | ||
@@ -72,19 +77,2 @@ cy.get('[data-cy="offcanvas"]').then(($element) => { | ||
it('Can be openeded / dismissed via click - backdrop', () => { | ||
cy.get('[data-cy="offcanvas"]').eq(0).then(($element) => { | ||
cy.wrap(new Offcanvas($element[0])).as('click_test'); | ||
}) | ||
cy.get('[href="#offcanvasExample"]').click() | ||
cy.get('[data-cy="offcanvas"]').eq(0).should('have.class', 'show').and('be.visible') | ||
cy.get('.offcanvas-backdrop').eq(0).trigger('mousedown', 990, 10) | ||
cy.get('.offcanvas-backdrop').eq(0).trigger('mouseup', 990, 10) | ||
cy.get('.offcanvas-backdrop').eq(0).trigger('click', 990, 10) | ||
cy.wait(100) | ||
cy.get('[data-cy="offcanvas"]').eq(0).should('not.have.class', 'show').and('be.hidden') | ||
cy.get('[href="#offcanvasExample"]').eq(0).click() | ||
cy.get('[data-cy="offcanvas"]').eq(0).should('have.class', 'show').and('be.visible') | ||
cy.get('[data-cy="offcanvas"]').eq(0).find('[data-bs-dismiss="offcanvas"]').eq(0).trigger('click', 'center') | ||
cy.get('[data-cy="offcanvas"]').eq(0).should('not.have.class', 'show').and('be.hidden') | ||
}); | ||
it('Can be openeded / dismissed via click - no backdrop', () => { | ||
@@ -134,2 +122,13 @@ cy.get('[data-cy="offcanvas"]').eq(1).then(($element) => { | ||
}); | ||
it('Can do dispose()', () => { | ||
cy.get('[data-cy="offcanvas"]').eq(0).then(($element) => { | ||
cy.wrap(new Offcanvas($element[0])).as('disposable'); | ||
cy.get('@disposable').invoke('show') | ||
cy.get('@disposable').its('element').should('have.class', 'show').and('be.visible') | ||
cy.get('@disposable').invoke('dispose') | ||
cy.get('@disposable').its('element').should('be.undefined') | ||
cy.get('@disposable').its('options').should('be.undefined') | ||
cy.wait(500) | ||
}) | ||
}); | ||
@@ -150,2 +149,3 @@ it('Can work with CustomEvent show', function() { | ||
}); | ||
}); |
@@ -43,3 +43,3 @@ /// <reference types="cypress" /> | ||
expect(instance.nav).to.be.instanceOf(win?.HTMLElement); | ||
expect(instance.options).to.be.undefined; | ||
expect(instance.options).to.be.empty; | ||
expect(instance.defaults).to.be.empty; | ||
@@ -46,0 +46,0 @@ expect(instance.name).to.equal('Tab'); |
@@ -429,8 +429,8 @@ /// <reference types="cypress" /> | ||
cy.wrap(new Tooltip($element[0])).as('instance1'); | ||
cy.get('@instance1').invoke('dispose') | ||
cy.get('@instance1').its('element').should('be.undefined') | ||
cy.get('@instance1').its('tooltip').should('be.undefined') | ||
cy.get('[data-cy="tooltip"]').eq(1).should('have.attr', 'title') | ||
cy.get('[data-cy="tooltip"]').eq(1).should('not.have.attr', 'data-original-title') | ||
}) | ||
cy.get('@instance1').invoke('dispose') | ||
cy.get('@instance1').its('element').should('be.undefined') | ||
cy.get('@instance1').its('tooltip').should('be.undefined') | ||
cy.get('[data-cy="tooltip"]').eq(1).should('have.attr', 'title') | ||
cy.get('[data-cy="tooltip"]').eq(1).should('not.have.attr', 'data-original-title') | ||
}) | ||
@@ -437,0 +437,0 @@ }); |
@@ -15,5 +15,3 @@ export interface BaseOptions { | ||
get defaults(): {}; | ||
/** | ||
* Removes component from target element; | ||
*/ | ||
/** Removes component from target element. */ | ||
dispose(): void; | ||
@@ -202,3 +200,3 @@ } | ||
options: ModalOptions; | ||
modalDialog: HTMLElement | null; | ||
modalDialog: HTMLElement; | ||
triggers: HTMLElement[]; | ||
@@ -228,9 +226,5 @@ isStatic: boolean; | ||
show(): void; | ||
/** Hide the modal from the user. */ | ||
hide(): void; | ||
/** | ||
* Hide the modal from the user. | ||
* | ||
* @param callback when defined it will skip animation | ||
*/ | ||
hide(callback?: () => void): void; | ||
/** | ||
* Updates the modal layout. | ||
@@ -275,8 +269,4 @@ */ | ||
show(): void; | ||
/** | ||
* Hides the offcanvas from the user. | ||
* | ||
* @param callback when `true` it will skip animation | ||
*/ | ||
hide(callback?: () => void): void; | ||
/** Hides the offcanvas from the user. */ | ||
hide(): void; | ||
/** Removes the `Offcanvas` from the target element. */ | ||
@@ -312,3 +302,2 @@ dispose(): void; | ||
id: string; | ||
onHideComplete?: () => void; | ||
/** | ||
@@ -327,7 +316,10 @@ * @param target the target element | ||
get defaults(): TooltipOptions; | ||
/** Handles the focus event on iOS. */ | ||
handleFocus: () => void; | ||
/** Shows the tooltip. */ | ||
show: () => void; | ||
_show(): void; | ||
handleShow: () => void; | ||
show(): void; | ||
/** Hides the tooltip. */ | ||
hide: () => void; | ||
handleHide: () => void; | ||
hide(): void; | ||
/** Updates the tooltip position. */ | ||
@@ -349,3 +341,3 @@ update: () => void; | ||
*/ | ||
handleTouch: (this: Tooltip, { target }: TouchEvent) => void; | ||
handleTouch: ({ target }: TouchEvent) => void; | ||
/** Removes the `Tooltip` from the target element. */ | ||
@@ -352,0 +344,0 @@ dispose(): void; |
@@ -1,2 +0,2 @@ | ||
var BSN=function(D){"use strict";var Oc=Object.defineProperty;var Bc=(D,b,e)=>b in D?Oc(D,b,{enumerable:!0,configurable:!0,writable:!0,value:e}):D[b]=e;var v=(D,b,e)=>(Bc(D,typeof b!="symbol"?b+"":b,e),e);var b={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const s={},n=d=>{const{type:u,currentTarget:h}=d;[...s[u]].forEach(([p,f])=>{h===p&&[...f].forEach(([y,A])=>{y.apply(p,[d]),typeof A=="object"&&A.once&&a(p,u,y,A)})})},o=(d,u,h,p)=>{s[u]||(s[u]=new Map);const f=s[u];f.has(d)||f.set(d,new Map);const y=f.get(d),{size:A}=y;y.set(h,p),A||d.addEventListener(u,n,p)},a=(d,u,h,p)=>{const f=s[u],y=f&&f.get(d),A=y&&y.get(h),z=A!==void 0?A:p;y&&y.has(h)&&y.delete(h),f&&(!y||!y.size)&&f.delete(d),(!f||!f.size)&&delete s[u],(!y||!y.size)&&d.removeEventListener(u,n,z)},r=o,l=a;t.addListener=o,t.globalListener=n,t.off=l,t.on=r,t.registry=s,t.removeListener=a})(b);var e={};(function(t){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"});const s="aria-checked",n="aria-description",o="aria-describedby",a="aria-expanded",r="aria-haspopup",l="aria-hidden",d="aria-label",u="aria-labelledby",h="aria-modal",p="aria-pressed",f="aria-selected",y="aria-valuemin",A="aria-valuemax",z="aria-valuenow",T="aria-valuetext",O="abort",W="beforeunload",le="blur",Y="change",$="contextmenu",G="DOMContentLoaded",K="DOMMouseScroll",I="error",B="focus",S="focusin",de="focusout",ee="gesturechange",H="gestureend",te="gesturestart",ae="keydown",be="keypress",ne="keyup",Je="load",ue="click",Be="dblclick",Ze="mousedown",re="mouseup",se="hover",xe="mouseenter",Ce="mouseleave",ye="mousein",Te="mouseout",we="mouseover",Re="mousemove",et="mousewheel",kt="move",oo="orientationchange",io="pointercancel",ao="pointerdown",ro="pointerleave",co="pointermove",lo="pointerup",uo="readystatechange",mo="reset",ho="resize",go="select",fo="selectend",vo="selectstart",po="scroll",Eo="submit",bo="touchstart",Co="touchmove",yo="touchcancel",To="touchend",wo="unload",Ma={DOMContentLoaded:G,DOMMouseScroll:K,abort:O,beforeunload:W,blur:le,change:Y,click:ue,contextmenu:$,dblclick:Be,error:I,focus:B,focusin:S,focusout:de,gesturechange:ee,gestureend:H,gesturestart:te,hover:se,keydown:ae,keypress:be,keyup:ne,load:Je,mousedown:Ze,mousemove:Re,mousein:ye,mouseout:Te,mouseenter:xe,mouseleave:Ce,mouseover:we,mouseup:re,mousewheel:et,move:kt,orientationchange:oo,pointercancel:io,pointerdown:ao,pointerleave:ro,pointermove:co,pointerup:lo,readystatechange:uo,reset:mo,resize:ho,scroll:po,select:go,selectend:fo,selectstart:vo,submit:Eo,touchcancel:yo,touchend:To,touchmove:Co,touchstart:bo,unload:wo},Pa="drag",Oa="dragstart",Ba="dragenter",Ra="dragleave",za="dragover",Wa="dragend",qa="loadstart",Fa={start:"mousedown",end:"mouseup",move:"mousemove",cancel:"mouseleave"},ja={down:"mousedown",up:"mouseup"},Va="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],Ua={start:"touchstart",end:"touchend",move:"touchmove",cancel:"touchcancel"},Ka={in:"focusin",out:"focusout"},Qa={Backspace:"Backspace",Tab:"Tab",Enter:"Enter",Shift:"Shift",Control:"Control",Alt:"Alt",Pause:"Pause",CapsLock:"CapsLock",Escape:"Escape",Scape:"Space",ArrowLeft:"ArrowLeft",ArrowUp:"ArrowUp",ArrowRight:"ArrowRight",ArrowDown:"ArrowDown",Insert:"Insert",Delete:"Delete",Meta:"Meta",ContextMenu:"ContextMenu",ScrollLock:"ScrollLock"},Xa="Alt",Ya="ArrowDown",Ga="ArrowUp",_a="ArrowLeft",Ja="ArrowRight",Za="Backspace",xa="CapsLock",er="Control",tr="Delete",nr="Enter",sr="Escape",or="Insert",ir="Meta",ar="Pause",rr="ScrollLock",cr="Shift",lr="Space",dr="Tab",So="animationDuration",Ao="animationDelay",rn="animationName",It="animationend",$o="transitionDuration",Do="transitionDelay",Nt="transitionend",cn="transitionProperty",ur="addEventListener",mr="removeEventListener",hr={linear:"linear",easingSinusoidalIn:"cubic-bezier(0.47,0,0.745,0.715)",easingSinusoidalOut:"cubic-bezier(0.39,0.575,0.565,1)",easingSinusoidalInOut:"cubic-bezier(0.445,0.05,0.55,0.95)",easingQuadraticIn:"cubic-bezier(0.550,0.085,0.680,0.530)",easingQuadraticOut:"cubic-bezier(0.250,0.460,0.450,0.940)",easingQuadraticInOut:"cubic-bezier(0.455,0.030,0.515,0.955)",easingCubicIn:"cubic-bezier(0.55,0.055,0.675,0.19)",easingCubicOut:"cubic-bezier(0.215,0.61,0.355,1)",easingCubicInOut:"cubic-bezier(0.645,0.045,0.355,1)",easingQuarticIn:"cubic-bezier(0.895,0.03,0.685,0.22)",easingQuarticOut:"cubic-bezier(0.165,0.84,0.44,1)",easingQuarticInOut:"cubic-bezier(0.77,0,0.175,1)",easingQuinticIn:"cubic-bezier(0.755,0.05,0.855,0.06)",easingQuinticOut:"cubic-bezier(0.23,1,0.32,1)",easingQuinticInOut:"cubic-bezier(0.86,0,0.07,1)",easingExponentialIn:"cubic-bezier(0.95,0.05,0.795,0.035)",easingExponentialOut:"cubic-bezier(0.19,1,0.22,1)",easingExponentialInOut:"cubic-bezier(1,0,0,1)",easingCircularIn:"cubic-bezier(0.6,0.04,0.98,0.335)",easingCircularOut:"cubic-bezier(0.075,0.82,0.165,1)",easingCircularInOut:"cubic-bezier(0.785,0.135,0.15,0.86)",easingBackIn:"cubic-bezier(0.6,-0.28,0.735,0.045)",easingBackOut:"cubic-bezier(0.175,0.885,0.32,1.275)",easingBackInOut:"cubic-bezier(0.68,-0.55,0.265,1.55)"},gr="offsetHeight",fr="offsetWidth",vr="scrollHeight",pr="scrollWidth",Er="tabindex",br=navigator.userAgentData,dt=br,{userAgent:Cr}=navigator,ut=Cr,Ho=/iPhone|iPad|iPod|Android/i;let ln=!1;dt?ln=dt.brands.some(i=>Ho.test(i.brand)):ln=Ho.test(ut);const yr=ln,Lo=/(iPhone|iPod|iPad)/,Tr=dt?dt.brands.some(i=>Lo.test(i.brand)):Lo.test(ut),wr=ut?ut.includes("Firefox"):!1,{head:mt}=document,Sr=["webkitPerspective","perspective"].some(i=>i in mt.style),ko=(i,c,m,g)=>{const E=g||!1;i.addEventListener(c,m,E)},Io=(i,c,m,g)=>{const E=g||!1;i.removeEventListener(c,m,E)},No=(i,c,m,g)=>{const E=M=>{(M.target===i||M.currentTarget===i)&&(m.apply(i,[M]),Io(i,c,E,g))};ko(i,c,E,g)},Mo=()=>{},Ar=(()=>{let i=!1;try{const c=Object.defineProperty({},"passive",{get:()=>(i=!0,i)});No(document,G,Mo,c)}catch{}return i})(),$r=["webkitTransform","transform"].some(i=>i in mt.style),Dr="ontouchstart"in window||"msMaxTouchPoints"in navigator,Hr=["webkitAnimation","animation"].some(i=>i in mt.style),Lr=["webkitTransition","transition"].some(i=>i in mt.style),Po=(i,c)=>i.getAttribute(c),kr=(i,c,m)=>c.getAttributeNS(i,m),Ir=(i,c)=>i.hasAttribute(c),Nr=(i,c,m)=>c.hasAttributeNS(i,m),Mr=(i,c,m)=>i.setAttribute(c,m),Pr=(i,c,m,g)=>c.setAttributeNS(i,m,g),Or=(i,c)=>i.removeAttribute(c),Br=(i,c,m)=>c.removeAttributeNS(i,m),Rr=(i,...c)=>{i.classList.add(...c)},zr=(i,...c)=>{i.classList.remove(...c)},Wr=(i,c)=>i.classList.contains(c),{body:qr}=document,{documentElement:Fr}=document,jr=i=>Array.from(i),me=i=>i!=null&&typeof i=="object"||!1,N=i=>me(i)&&typeof i.nodeType=="number"&&[1,2,3,4,5,6,7,8,9,10,11].some(c=>i.nodeType===c)||!1,q=i=>N(i)&&i.nodeType===1||!1,ht=new Map,Mt={set:(i,c,m)=>{q(i)&&(ht.has(c)||ht.set(c,new Map),ht.get(c).set(i,m))},getAllFor:i=>ht.get(i)||null,get:(i,c)=>{if(!q(i)||!c)return null;const m=Mt.getAllFor(c);return i&&m&&m.get(i)||null},remove:(i,c)=>{const m=Mt.getAllFor(c);!m||!q(i)||(m.delete(i),m.size===0&&ht.delete(c))}},Vr=(i,c)=>Mt.get(i,c),gt=i=>typeof i=="string"||!1,dn=i=>me(i)&&i.constructor.name==="Window"||!1,un=i=>N(i)&&i.nodeType===9||!1,oe=i=>dn(i)?i.document:un(i)?i:N(i)?i.ownerDocument:window.document,ft=(i,...c)=>Object.assign(i,...c),Oo=i=>{if(!i)return;if(gt(i))return oe().createElement(i);const{tagName:c}=i,m=Oo(c);if(!m)return;const g={...i};return delete g.tagName,ft(m,g)},Bo=(i,c)=>{if(!i||!c)return;if(gt(c))return oe().createElementNS(i,c);const{tagName:m}=c,g=Bo(i,m);if(!g)return;const E={...c};return delete E.tagName,ft(g,E)},mn=(i,c)=>i.dispatchEvent(c),Ur=(i,c,m)=>m.indexOf(i)===c,he=(i,c)=>{const m=getComputedStyle(i),g=c.replace("webkit","Webkit").replace(/([A-Z])/g,"-$1").toLowerCase();return m.getPropertyValue(g)},Ro=i=>{const c=he(i,rn),m=he(i,Ao),g=m.includes("ms")?1:1e3,E=c&&c!=="none"?parseFloat(m)*g:0;return Number.isNaN(E)?0:E},zo=i=>{const c=he(i,rn),m=he(i,So),g=m.includes("ms")?1:1e3,E=c&&c!=="none"?parseFloat(m)*g:0;return Number.isNaN(E)?0:E},Kr=(i,c)=>{let m=0;const g=new Event(It),E=zo(i),M=Ro(i);if(E){const R=_=>{_.target===i&&(c.apply(i,[_]),i.removeEventListener(It,R),m=1)};i.addEventListener(It,R),setTimeout(()=>{m||mn(i,g)},E+M+17)}else c.apply(i,[g])},Wo=i=>{const c=he(i,cn),m=he(i,Do),g=m.includes("ms")?1:1e3,E=c&&c!=="none"?parseFloat(m)*g:0;return Number.isNaN(E)?0:E},qo=i=>{const c=he(i,cn),m=he(i,$o),g=m.includes("ms")?1:1e3,E=c&&c!=="none"?parseFloat(m)*g:0;return Number.isNaN(E)?0:E},Qr=(i,c)=>{let m=0;const g=new Event(Nt),E=qo(i),M=Wo(i);if(E){const R=_=>{_.target===i&&(c.apply(i,[_]),i.removeEventListener(Nt,R),m=1)};i.addEventListener(Nt,R),setTimeout(()=>{m||mn(i,g)},E+M+17)}else c.apply(i,[g])},Xr=i=>Float32Array.from(Array.from(i)),Yr=i=>Float64Array.from(Array.from(i)),Gr=(i,c)=>i.focus(c),hn=i=>["true",!0].includes(i)?!0:["false",!1].includes(i)?!1:["null","",null,void 0].includes(i)?null:i!==""&&!Number.isNaN(+i)?+i:i,vt=i=>Object.entries(i),Fo=i=>i.toLowerCase(),_r=(i,c,m,g)=>{const E={...m},M={...i.dataset},R={...c},_={},Ae="title";return vt(M).forEach(([k,$e])=>{const Ot=g&&typeof k=="string"&&k.includes(g)?k.replace(g,"").replace(/[A-Z]/g,Pc=>Fo(Pc)):k;_[Ot]=hn($e)}),vt(E).forEach(([k,$e])=>{E[k]=hn($e)}),vt(c).forEach(([k,$e])=>{k in E?R[k]=E[k]:k in _?R[k]=_[k]:R[k]=k===Ae?Po(i,Ae):$e}),R},Jr=(i,c)=>me(i)&&(Object.hasOwn(i,c)||c in i),Zr=i=>Object.keys(i),xr=i=>Object.values(i),ec=(i,c)=>{const m=new CustomEvent(i,{cancelable:!0,bubbles:!0});return me(c)&&ft(m,c),m},tc={passive:!0},nc=i=>i.offsetHeight,sc=(i,c)=>{vt(c).forEach(([m,g])=>{if(g&>(m)&&m.includes("--"))i.style.setProperty(m,g);else{const E={};E[m]=g,ft(i.style,E)}})},Pt=i=>me(i)&&i.constructor.name==="Map"||!1,jo=i=>typeof i=="number"||!1,Se=new Map,oc={set:(i,c,m,g)=>{q(i)&&(g&&g.length?(Se.has(i)||Se.set(i,new Map),Se.get(i).set(g,setTimeout(c,m))):Se.set(i,setTimeout(c,m)))},get:(i,c)=>{if(!q(i))return null;const m=Se.get(i);return c&&m&&Pt(m)?m.get(c)||null:jo(m)?m:null},clear:(i,c)=>{if(!q(i))return;const m=Se.get(i);c&&c.length&&Pt(m)?(clearTimeout(m.get(c)),m.delete(c),m.size===0&&Se.delete(i)):(clearTimeout(m),Se.delete(i))}},ic=i=>i.toUpperCase(),tt=(i,c)=>{const{width:m,height:g,top:E,right:M,bottom:R,left:_}=i.getBoundingClientRect();let Ae=1,k=1;if(c&&q(i)){const{offsetWidth:$e,offsetHeight:Ot}=i;Ae=$e>0?Math.round(m)/$e:1,k=Ot>0?Math.round(g)/Ot:1}return{width:m/Ae,height:g/k,top:E/k,right:M/Ae,bottom:R/k,left:_/Ae,x:_/Ae,y:E/k}},ac=i=>oe(i).body,pt=i=>oe(i).documentElement,rc=i=>oe(i).head,cc=i=>{const c=dn(i),m=c?i.scrollX:i.scrollLeft,g=c?i.scrollY:i.scrollTop;return{x:m,y:g}},Vo=i=>N(i)&&i.constructor.name==="ShadowRoot"||!1,lc=i=>i.nodeName==="HTML"?i:q(i)&&i.assignedSlot||N(i)&&i.parentNode||Vo(i)&&i.host||pt(i),Uo=i=>{if(!q(i))return!1;const{width:c,height:m}=tt(i),{offsetWidth:g,offsetHeight:E}=i;return Math.round(c)!==g||Math.round(m)!==E},dc=(i,c,m)=>{const g=q(c),E=tt(i,g&&Uo(c)),M={x:0,y:0};if(g){const R=tt(c,!0);M.x=R.x+c.clientLeft,M.y=R.y+c.clientTop}return{x:E.left+m.x-M.x,y:E.top+m.y-M.y,width:E.width,height:E.height}};let Ko=0,Qo=0;const nt=new Map,Xo=(i,c)=>{let m=c?Ko:Qo;if(c){const g=Xo(i),E=nt.get(g)||new Map;nt.has(g)||nt.set(g,E),Pt(E)&&!E.has(c)?(E.set(c,m),Ko+=1):m=E.get(c)}else{const g=i.id||i;nt.has(g)?m=nt.get(g):(nt.set(g,m),Qo+=1)}return m},uc=i=>{var c;return i?un(i)?i.defaultView:N(i)?(c=i==null?void 0:i.ownerDocument)==null?void 0:c.defaultView:i:window},Yo=i=>Array.isArray(i)||!1,mc=i=>N(i)&&i.nodeName==="CANVAS"||!1,Go=i=>q(i)&&!!i.shadowRoot||!1,hc=i=>N(i)&&[1,2,3,4,5,6,7,8].some(c=>i.nodeType===c)||!1,gc=i=>{if(!N(i))return!1;const{top:c,bottom:m}=tt(i),{clientHeight:g}=pt(i);return c<=g&&m>=0},fc=i=>{if(!N(i))return!1;const{clientWidth:c,clientHeight:m}=pt(i),{top:g,left:E,bottom:M,right:R}=tt(i,!0);return g>=0&&E>=0&&M<=m&&R<=c},vc=i=>Yo(i)&&i.every(q)||!1,pc=i=>typeof i=="function"||!1,Ec=i=>me(i)&&i.constructor.name==="HTMLCollection"||!1,bc=i=>q(i)&&i.tagName==="IMG"||!1,Cc=i=>{if(!gt(i))return!1;try{JSON.parse(i)}catch{return!1}return!0},yc=i=>me(i)&&i.constructor.name==="WeakMap"||!1,Tc=i=>N(i)&&["SVG","Image","Video","Canvas"].some(c=>i.constructor.name.includes(c))||!1,wc=i=>me(i)&&i.constructor.name==="NodeList"||!1,Sc=i=>pt(i).dir==="rtl",Ac=i=>N(i)&&i.constructor.name.includes("SVG")||!1,$c=i=>N(i)&&["TABLE","TD","TH"].includes(i.nodeName)||!1,_o=(i,c)=>i?i.closest(c)||_o(i.getRootNode().host,c):null,Dc=(i,c)=>q(i)?i:(N(c)?c:oe()).querySelector(i),Jo=(i,c)=>(N(c)?c:oe()).getElementsByTagName(i),Hc=i=>[...Jo("*",i)].filter(Go),Lc=(i,c)=>oe(c).getElementById(i)||null,kc=(i,c)=>(N(c)?c:oe()).querySelectorAll(i),Ic=(i,c)=>(c&&N(c)?c:oe()).getElementsByClassName(i),Nc=(i,c)=>i.matches(c),Mc="2.0.0alpha12";t.ArrayFrom=jr,t.DOMContentLoadedEvent=G,t.DOMMouseScrollEvent=K,t.Data=Mt,t.Float32ArrayFrom=Xr,t.Float64ArrayFrom=Yr,t.ObjectAssign=ft,t.ObjectEntries=vt,t.ObjectHasOwn=Jr,t.ObjectKeys=Zr,t.ObjectValues=xr,t.Timer=oc,t.abortEvent=O,t.addClass=Rr,t.addEventListener=ur,t.animationDelay=Ao,t.animationDuration=So,t.animationEndEvent=It,t.animationName=rn,t.ariaChecked=s,t.ariaDescribedBy=o,t.ariaDescription=n,t.ariaExpanded=a,t.ariaHasPopup=r,t.ariaHidden=l,t.ariaLabel=d,t.ariaLabelledBy=u,t.ariaModal=h,t.ariaPressed=p,t.ariaSelected=f,t.ariaValueMax=A,t.ariaValueMin=y,t.ariaValueNow=z,t.ariaValueText=T,t.beforeunloadEvent=W,t.bezierEasings=hr,t.blurEvent=le,t.changeEvent=Y,t.closest=_o,t.contextmenuEvent=$,t.createCustomEvent=ec,t.createElement=Oo,t.createElementNS=Bo,t.dispatchEvent=mn,t.distinct=Ur,t.documentBody=qr,t.documentElement=Fr,t.documentHead=mt,t.dragEvent=Pa,t.dragendEvent=Wa,t.dragenterEvent=Ba,t.dragleaveEvent=Ra,t.dragoverEvent=za,t.dragstartEvent=Oa,t.emulateAnimationEnd=Kr,t.emulateTransitionEnd=Qr,t.errorEvent=I,t.focus=Gr,t.focusEvent=B,t.focusEvents=Ka,t.focusinEvent=S,t.focusoutEvent=de,t.gesturechangeEvent=ee,t.gestureendEvent=H,t.gesturestartEvent=te,t.getAttribute=Po,t.getAttributeNS=kr,t.getBoundingClientRect=tt,t.getCustomElements=Hc,t.getDocument=oe,t.getDocumentBody=ac,t.getDocumentElement=pt,t.getDocumentHead=rc,t.getElementAnimationDelay=Ro,t.getElementAnimationDuration=zo,t.getElementById=Lc,t.getElementStyle=he,t.getElementTransitionDelay=Wo,t.getElementTransitionDuration=qo,t.getElementsByClassName=Ic,t.getElementsByTagName=Jo,t.getInstance=Vr,t.getNodeScroll=cc,t.getParentNode=lc,t.getRectRelativeToOffsetParent=dc,t.getUID=Xo,t.getWindow=uc,t.hasAttribute=Ir,t.hasAttributeNS=Nr,t.hasClass=Wr,t.isApple=Tr,t.isArray=Yo,t.isCanvas=mc,t.isCustomElement=Go,t.isDocument=un,t.isElement=hc,t.isElementInScrollRange=gc,t.isElementInViewport=fc,t.isElementsArray=vc,t.isFirefox=wr,t.isFunction=pc,t.isHTMLCollection=Ec,t.isHTMLElement=q,t.isHTMLImageElement=bc,t.isJSON=Cc,t.isMap=Pt,t.isMedia=Tc,t.isMobile=yr,t.isNode=N,t.isNodeList=wc,t.isNumber=jo,t.isObject=me,t.isRTL=Sc,t.isSVGElement=Ac,t.isScaledElement=Uo,t.isShadowRoot=Vo,t.isString=gt,t.isTableElement=$c,t.isWeakMap=yc,t.isWindow=dn,t.keyAlt=Xa,t.keyArrowDown=Ya,t.keyArrowLeft=_a,t.keyArrowRight=Ja,t.keyArrowUp=Ga,t.keyBackspace=Za,t.keyCapsLock=xa,t.keyControl=er,t.keyDelete=tr,t.keyEnter=nr,t.keyEscape=sr,t.keyInsert=or,t.keyMeta=ir,t.keyPause=ar,t.keyScrollLock=rr,t.keyShift=cr,t.keySpace=lr,t.keyTab=dr,t.keyboardEventKeys=Qa,t.keydownEvent=ae,t.keypressEvent=be,t.keyupEvent=ne,t.loadEvent=Je,t.loadstartEvent=qa,t.matches=Nc,t.mouseClickEvents=ja,t.mouseHoverEvents=Va,t.mouseSwipeEvents=Fa,t.mouseclickEvent=ue,t.mousedblclickEvent=Be,t.mousedownEvent=Ze,t.mouseenterEvent=xe,t.mousehoverEvent=se,t.mouseinEvent=ye,t.mouseleaveEvent=Ce,t.mousemoveEvent=Re,t.mouseoutEvent=Te,t.mouseoverEvent=we,t.mouseupEvent=re,t.mousewheelEvent=et,t.moveEvent=kt,t.nativeEvents=Ma,t.noop=Mo,t.normalizeOptions=_r,t.normalizeValue=hn,t.off=Io,t.offsetHeight=gr,t.offsetWidth=fr,t.on=ko,t.one=No,t.orientationchangeEvent=oo,t.passiveHandler=tc,t.pointercancelEvent=io,t.pointerdownEvent=ao,t.pointerleaveEvent=ro,t.pointermoveEvent=co,t.pointerupEvent=lo,t.querySelector=Dc,t.querySelectorAll=kc,t.readystatechangeEvent=uo,t.reflow=nc,t.removeAttribute=Or,t.removeAttributeNS=Br,t.removeClass=zr,t.removeEventListener=mr,t.resetEvent=mo,t.resizeEvent=ho,t.scrollEvent=po,t.scrollHeight=vr,t.scrollWidth=pr,t.selectEvent=go,t.selectendEvent=fo,t.selectstartEvent=vo,t.setAttribute=Mr,t.setAttributeNS=Pr,t.setElementStyle=sc,t.submitEvent=Eo,t.support3DTransform=Sr,t.supportAnimation=Hr,t.supportPassive=Ar,t.supportTouch=Dr,t.supportTransform=$r,t.supportTransition=Lr,t.tabindex=Er,t.toLowerCase=Fo,t.toUpperCase=ic,t.touchEvents=Ua,t.touchcancelEvent=yo,t.touchendEvent=To,t.touchmoveEvent=Co,t.touchstartEvent=bo,t.transitionDelay=Do,t.transitionDuration=$o,t.transitionEndEvent=Nt,t.transitionProperty=cn,t.unloadEvent=wo,t.userAgent=ut,t.userAgentData=dt,t.version=Mc})(e);const P="fade",C="show",Et="data-bs-dismiss",bt="alert",gn="Alert",Zo="5.0.4";class J{constructor(s,n){v(this,"element");v(this,"options");const o=e.querySelector(s);if(!o)throw e.isString(s)?Error(`${this.name} Error: "${s}" is not a valid selector.`):Error(`${this.name} Error: your target is not an instance of HTMLElement.`);const a=e.Data.get(o,this.name);a&&a.dispose(),this.element=o,this.defaults&&e.ObjectKeys(this.defaults).length&&(this.options=e.normalizeOptions(o,this.defaults,n||{},"bs")),e.Data.set(o,this.name,this)}get version(){return Zo}get name(){return"BaseComponent"}get defaults(){return{}}dispose(){e.Data.remove(this.element,this.name),e.ObjectKeys(this).forEach(s=>{delete this[s]})}}const xo=`.${bt}`,ei=`[${Et}="${bt}"]`,ti=t=>e.getInstance(t,gn),ni=t=>new ze(t),fn=e.createCustomEvent(`close.bs.${bt}`),si=e.createCustomEvent(`closed.bs.${bt}`),vn=t=>{const{element:s}=t;Bt(t),e.dispatchEvent(s,si),t.dispose(),s.remove()},Bt=(t,s)=>{const n=s?b.addListener:b.removeListener,{dismiss:o,close:a}=t;o&&n(o,e.mouseclickEvent,a)};class ze extends J{constructor(n){super(n);v(this,"dismiss");v(this,"close",()=>{const{element:n}=this;if(n&&e.hasClass(n,C)){if(e.dispatchEvent(n,fn),fn.defaultPrevented)return;e.removeClass(n,C),e.hasClass(n,P)?e.emulateTransitionEnd(n,()=>vn(this)):vn(this)}});this.dismiss=e.querySelector(ei,this.element),Bt(this,!0)}get name(){return gn}dispose(){Bt(this),super.dispose()}}v(ze,"selector",xo),v(ze,"init",ni),v(ze,"getInstance",ti);const w="active",V="data-bs-toggle",oi="button",pn="Button",ii=`[${V}="${oi}"]`,ai=t=>e.getInstance(t,pn),ri=t=>new We(t),En=(t,s)=>{(s?b.addListener:b.removeListener)(t.element,e.mouseclickEvent,t.toggle)};class We extends J{constructor(n){super(n);v(this,"isActive",!1);v(this,"toggle",n=>{n&&n.preventDefault();const{element:o,isActive:a}=this;if(e.hasClass(o,"disabled"))return;(a?e.removeClass:e.addClass)(o,w),e.setAttribute(o,e.ariaPressed,a?"false":"true"),this.isActive=e.hasClass(o,w)});const{element:o}=this;this.isActive=e.hasClass(o,w),e.setAttribute(o,e.ariaPressed,String(!!this.isActive)),En(this,!0)}get name(){return pn}dispose(){En(this),super.dispose()}}v(We,"selector",ii),v(We,"init",ri),v(We,"getInstance",ai);const Rt="data-bs-target",De="carousel",bn="Carousel",Cn="data-bs-parent",ci="data-bs-container",F=t=>{const s=[Rt,Cn,ci,"href"],n=e.getDocument(t);return s.map(o=>{const a=e.getAttribute(t,o);return a?o===Cn?e.closest(t,a):e.querySelector(a,n):null}).filter(o=>o)[0]},st=`[data-bs-ride="${De}"]`,Z=`${De}-item`,zt="data-bs-slide-to",ge="data-bs-slide",fe="paused",yn={pause:"hover",keyboard:!1,touch:!0,interval:5e3},ie=t=>e.getInstance(t,bn),li=t=>new Fe(t);let He=0,qe=0,ot=0;const Wt=e.createCustomEvent(`slide.bs.${De}`),qt=e.createCustomEvent(`slid.bs.${De}`),di=t=>{const{index:s,direction:n,element:o,slides:a,options:r}=t;if(t.isAnimating&&ie(o)){const l=jt(t),d=n==="left"?"next":"prev",u=n==="left"?"start":"end";e.addClass(a[s],w),e.removeClass(a[s],`${Z}-${d}`),e.removeClass(a[s],`${Z}-${u}`),e.removeClass(a[l],w),e.removeClass(a[l],`${Z}-${u}`),e.dispatchEvent(o,qt),e.Timer.clear(o,ge),!e.getDocument(o).hidden&&r.interval&&!t.isPaused&&t.cycle()}};function ui(){const t=ie(this);t&&!t.isPaused&&!e.Timer.get(this,fe)&&e.addClass(this,fe)}function mi(){const t=ie(this);t&&t.isPaused&&!e.Timer.get(this,fe)&&t.cycle()}function hi(t){t.preventDefault();const s=e.closest(this,st)||F(this),n=ie(s);if(!n||n.isAnimating)return;const o=+(e.getAttribute(this,zt)||0);this&&!e.hasClass(this,w)&&!Number.isNaN(o)&&n.to(o)}function gi(t){t.preventDefault();const s=e.closest(this,st)||F(this),n=ie(s);if(!n||n.isAnimating)return;const o=e.getAttribute(this,ge);o==="next"?n.next():o==="prev"&&n.prev()}const fi=({code:t,target:s})=>{const n=e.getDocument(s),[o]=[...e.querySelectorAll(st,n)].filter(u=>e.isElementInScrollRange(u)),a=ie(o);if(!a||a.isAnimating||/textarea|input/i.test(s.nodeName))return;const r=e.isRTL(o),l=r?e.keyArrowLeft:e.keyArrowRight,d=r?e.keyArrowRight:e.keyArrowLeft;t===d?a.prev():t===l&&a.next()};function Tn(t){const{target:s}=t,n=ie(this);n&&n.isTouch&&(n.indicator&&!n.indicator.contains(s)||!n.controls.includes(s))&&(t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault())}function vi(t){const{target:s}=t,n=ie(this);if(!n||n.isAnimating||n.isTouch)return;const{controls:o,indicators:a}=n;[...o,...a].some(r=>r===s||r.contains(s))||(He=t.pageX,this.contains(s)&&(n.isTouch=!0,wn(n,!0)))}const pi=t=>{qe=t.pageX},Ei=t=>{var d;const{target:s}=t,n=e.getDocument(s),o=[...e.querySelectorAll(st,n)].map(u=>ie(u)).find(u=>u.isTouch);if(!o)return;const{element:a,index:r}=o,l=e.isRTL(a);if(o.isTouch=!1,wn(o),(d=n.getSelection())!=null&&d.toString().length){He=0,qe=0,ot=0;return}if(ot=t.pageX,!a.contains(s)||Math.abs(He-ot)<120){He=0,qe=0,ot=0;return}qe<He?o.to(r+(l?-1:1)):qe>He&&o.to(r+(l?1:-1)),He=0,qe=0,ot=0},Ft=(t,s)=>{const{indicators:n}=t;[...n].forEach(o=>e.removeClass(o,w)),t.indicators[s]&&e.addClass(n[s],w)},wn=(t,s)=>{const{element:n}=t,o=s?b.addListener:b.removeListener;o(e.getDocument(n),e.pointermoveEvent,pi,e.passiveHandler),o(e.getDocument(n),e.pointerupEvent,Ei,e.passiveHandler)},Sn=(t,s)=>{const{element:n,options:o,slides:a,controls:r,indicators:l}=t,{touch:d,pause:u,interval:h,keyboard:p}=o,f=s?b.addListener:b.removeListener;u&&h&&(f(n,e.mouseenterEvent,ui),f(n,e.mouseleaveEvent,mi)),d&&a.length>2&&(f(n,e.pointerdownEvent,vi,e.passiveHandler),f(n,e.touchstartEvent,Tn,{passive:!1}),f(n,e.dragstartEvent,Tn,{passive:!1})),r.length&&r.forEach(y=>{y&&f(y,e.mouseclickEvent,gi)}),l.length&&l.forEach(y=>{f(y,e.mouseclickEvent,hi)}),p&&f(e.getDocument(n),e.keydownEvent,fi)},jt=t=>{const{slides:s,element:n}=t,o=e.querySelector(`.${Z}.${w}`,n);return e.isHTMLElement(o)?[...s].indexOf(o):-1};class Fe extends J{constructor(s,n){super(s,n);const{element:o}=this;this.direction=e.isRTL(o)?"right":"left",this.index=0,this.isTouch=!1,this.slides=e.getElementsByClassName(Z,o);const{slides:a}=this;if(a.length<2)return;const r=e.getDocument(o);this.controls=[...e.querySelectorAll(`[${ge}]`,o),...e.querySelectorAll(`[${ge}][${Rt}="#${o.id}"]`,r)],this.indicator=e.querySelector(`.${De}-indicators`,o),this.indicators=[...this.indicator?e.querySelectorAll(`[${zt}]`,this.indicator):[],...e.querySelectorAll(`[${zt}][${Rt}="#${o.id}"]`,r)];const{options:l}=this;this.options.interval=l.interval===!0?yn.interval:l.interval,jt(this)<0&&(e.addClass(a[0],w),this.indicators.length&&Ft(this,0)),Sn(this,!0),l.interval&&this.cycle()}get name(){return bn}get defaults(){return yn}get isPaused(){return e.hasClass(this.element,fe)}get isAnimating(){return e.querySelector(`.${Z}-next,.${Z}-prev`,this.element)!==null}cycle(){const{element:s,options:n,isPaused:o,index:a}=this;e.Timer.clear(s,De),o&&(e.Timer.clear(s,fe),e.removeClass(s,fe)),e.Timer.set(s,()=>{this.element&&!this.isPaused&&!this.isTouch&&e.isElementInScrollRange(s)&&this.to(a+1)},n.interval,De)}pause(){const{element:s,options:n}=this;!this.isPaused&&n.interval&&(e.addClass(s,fe),e.Timer.set(s,()=>{},1,fe))}next(){this.isAnimating||this.to(this.index+1)}prev(){this.isAnimating||this.to(this.index-1)}to(s){const{element:n,slides:o,options:a}=this,r=jt(this),l=e.isRTL(n);let d=s;if(this.isAnimating||r===d||e.Timer.get(n,ge))return;r<d||r===0&&d===o.length-1?this.direction=l?"right":"left":(r>d||r===o.length-1&&d===0)&&(this.direction=l?"left":"right");const{direction:u}=this;d<0?d=o.length-1:d>=o.length&&(d=0);const h=u==="left"?"next":"prev",p=u==="left"?"start":"end",f={relatedTarget:o[d],from:r,to:d,direction:u};e.ObjectAssign(Wt,f),e.ObjectAssign(qt,f),e.dispatchEvent(n,Wt),!Wt.defaultPrevented&&(this.index=d,Ft(this,d),e.getElementTransitionDuration(o[d])&&e.hasClass(n,"slide")?e.Timer.set(n,()=>{e.addClass(o[d],`${Z}-${h}`),e.reflow(o[d]),e.addClass(o[d],`${Z}-${p}`),e.addClass(o[r],`${Z}-${p}`),e.emulateTransitionEnd(o[d],()=>di(this))},0,ge):(e.addClass(o[d],w),e.removeClass(o[r],w),e.Timer.set(n,()=>{e.Timer.clear(n,ge),n&&a.interval&&!this.isPaused&&this.cycle(),e.dispatchEvent(n,qt)},0,ge)))}dispose(){const{slides:s}=this,n=["start","end","prev","next"];[...s].forEach((o,a)=>{e.hasClass(o,w)&&Ft(this,a),n.forEach(r=>e.removeClass(o,`${Z}-${r}`))}),Sn(this),super.dispose()}}v(Fe,"selector",st),v(Fe,"init",li),v(Fe,"getInstance",ie);const Le="collapsing",j="collapse",An="Collapse",bi=`.${j}`,$n=`[${V}="${j}"]`,Ci={parent:null},Ct=t=>e.getInstance(t,An),yi=t=>new je(t),Dn=e.createCustomEvent(`show.bs.${j}`),Ti=e.createCustomEvent(`shown.bs.${j}`),Hn=e.createCustomEvent(`hide.bs.${j}`),wi=e.createCustomEvent(`hidden.bs.${j}`),Si=t=>{const{element:s,parent:n,triggers:o}=t;e.dispatchEvent(s,Dn),!Dn.defaultPrevented&&(e.Timer.set(s,e.noop,17),n&&e.Timer.set(n,e.noop,17),e.addClass(s,Le),e.removeClass(s,j),e.setElementStyle(s,{height:`${s.scrollHeight}px`}),e.emulateTransitionEnd(s,()=>{e.Timer.clear(s),n&&e.Timer.clear(n),o.forEach(a=>e.setAttribute(a,e.ariaExpanded,"true")),e.removeClass(s,Le),e.addClass(s,j),e.addClass(s,C),e.setElementStyle(s,{height:""}),e.dispatchEvent(s,Ti)}))},Ln=t=>{const{element:s,parent:n,triggers:o}=t;e.dispatchEvent(s,Hn),!Hn.defaultPrevented&&(e.Timer.set(s,e.noop,17),n&&e.Timer.set(n,e.noop,17),e.setElementStyle(s,{height:`${s.scrollHeight}px`}),e.removeClass(s,j),e.removeClass(s,C),e.addClass(s,Le),e.reflow(s),e.setElementStyle(s,{height:"0px"}),e.emulateTransitionEnd(s,()=>{e.Timer.clear(s),n&&e.Timer.clear(n),o.forEach(a=>e.setAttribute(a,e.ariaExpanded,"false")),e.removeClass(s,Le),e.addClass(s,j),e.setElementStyle(s,{height:""}),e.dispatchEvent(s,wi)}))},kn=(t,s)=>{const n=s?b.addListener:b.removeListener,{triggers:o}=t;o.length&&o.forEach(a=>n(a,e.mouseclickEvent,Ai))},Ai=t=>{const{target:s}=t,n=s&&e.closest(s,$n),o=n&&F(n),a=o&&Ct(o);a&&a.toggle(),n&&n.tagName==="A"&&t.preventDefault()};class je extends J{constructor(s,n){super(s,n);const{element:o,options:a}=this,r=e.getDocument(o);this.triggers=[...e.querySelectorAll($n,r)].filter(l=>F(l)===o),this.parent=e.isHTMLElement(a.parent)?a.parent:e.isString(a.parent)?F(o)||e.querySelector(a.parent,r):null,kn(this,!0)}get name(){return An}get defaults(){return Ci}toggle(){e.hasClass(this.element,C)?this.hide():this.show()}hide(){const{triggers:s,element:n}=this;e.Timer.get(n)||(Ln(this),s.length&&s.forEach(o=>e.addClass(o,`${j}d`)))}show(){const{element:s,parent:n,triggers:o}=this;let a,r;n&&(a=[...e.querySelectorAll(`.${j}.${C}`,n)].find(l=>Ct(l)),r=a&&Ct(a)),(!n||!e.Timer.get(n))&&!e.Timer.get(s)&&(r&&a!==s&&(Ln(r),r.triggers.forEach(l=>{e.addClass(l,`${j}d`)})),Si(this),o.length&&o.forEach(l=>e.removeClass(l,`${j}d`)))}dispose(){kn(this),super.dispose()}}v(je,"selector",bi),v(je,"init",yi),v(je,"getInstance",Ct);const ke=["dropdown","dropup","dropstart","dropend"],In="Dropdown",Nn="dropdown-menu",Mn=t=>{const s=e.closest(t,"A");return t.tagName==="A"&&e.hasAttribute(t,"href")&&t.href.slice(-1)==="#"||s&&e.hasAttribute(s,"href")&&s.href.slice(-1)==="#"},[x,yt,Tt,wt]=ke,Vt=`[${V}="${x}"],[${V}="${yt}"],[${V}="${wt}"],[${V}="${Tt}"]`,Ve=t=>e.getInstance(t,In),$i=t=>new Ue(t),Di=`${Nn}-end`,Pn=[x,yt],On=[Tt,wt],Bn=["A","BUTTON"],Hi={offset:5,display:"dynamic"},Ut=e.createCustomEvent(`show.bs.${x}`),Rn=e.createCustomEvent(`shown.bs.${x}`),Kt=e.createCustomEvent(`hide.bs.${x}`),zn=e.createCustomEvent(`hidden.bs.${x}`),Wn=e.createCustomEvent(`updated.bs.${x}`),qn=t=>{const{element:s,menu:n,parentElement:o,options:a}=t,{offset:r}=a;if(e.getElementStyle(n,"position")==="static")return;const l=e.isRTL(s),d=e.hasClass(n,Di);["margin","top","bottom","left","right"].forEach(H=>{const te={};te[H]="",e.setElementStyle(n,te)});let h=ke.find(H=>e.hasClass(o,H))||x;const p={dropdown:[r,0,0],dropup:[0,0,r],dropstart:l?[-1,0,0,r]:[-1,r,0],dropend:l?[-1,r,0]:[-1,0,0,r]},f={dropdown:{top:"100%"},dropup:{top:"auto",bottom:"100%"},dropstart:l?{left:"100%",right:"auto"}:{left:"auto",right:"100%"},dropend:l?{left:"auto",right:"100%"}:{left:"100%",right:"auto"},menuStart:l?{right:"0",left:"auto"}:{right:"auto",left:"0"},menuEnd:l?{right:"auto",left:"0"}:{right:"0",left:"auto"}},{offsetWidth:y,offsetHeight:A}=n,{clientWidth:z,clientHeight:T}=e.getDocumentElement(s),{left:O,top:W,width:le,height:Y}=e.getBoundingClientRect(s),$=O-y-r<0,G=O+y+le+r>=z,K=W+A+r>=T,I=W+A+Y+r>=T,B=W-A-r<0,S=(!l&&d||l&&!d)&&O+le-y<0,de=(l&&d||!l&&!d)&&O+y>=z;if(On.includes(h)&&$&&G&&(h=x),h===Tt&&(l?G:$)&&(h=wt),h===wt&&(l?$:G)&&(h=Tt),h===yt&&B&&!I&&(h=x),h===x&&I&&!B&&(h=yt),On.includes(h)&&K&&e.ObjectAssign(f[h],{top:"auto",bottom:0}),Pn.includes(h)&&(S||de)){let H={left:"auto",right:"auto"};!S&&de&&!l&&(H={left:"auto",right:0}),S&&!de&&l&&(H={left:0,right:"auto"}),H&&e.ObjectAssign(f[h],H)}const ee=p[h];if(e.setElementStyle(n,{...f[h],margin:`${ee.map(H=>H&&`${H}px`).join(" ")}`}),Pn.includes(h)&&d&&d){const H=!l&&S||l&&de?"menuStart":"menuEnd";e.setElementStyle(n,f[H])}e.dispatchEvent(o,Wn)},Li=t=>[...t.children].map(s=>{if(s&&Bn.includes(s.tagName))return s;const{firstElementChild:n}=s;return n&&Bn.includes(n.tagName)?n:null}).filter(s=>s),Fn=t=>{const{element:s,options:n}=t,o=t.open?b.addListener:b.removeListener,a=e.getDocument(s);o(a,e.mouseclickEvent,Vn),o(a,e.focusEvent,Vn),o(a,e.keydownEvent,Ii),o(a,e.keyupEvent,Ni),n.display==="dynamic"&&[e.scrollEvent,e.resizeEvent].forEach(r=>{o(e.getWindow(s),r,Mi,e.passiveHandler)})},jn=(t,s)=>{(s?b.addListener:b.removeListener)(t.element,e.mouseclickEvent,ki)},St=t=>{const s=[...ke,"btn-group","input-group"].map(n=>e.getElementsByClassName(`${n} ${C}`,e.getDocument(t))).find(n=>n.length);if(s&&s.length)return[...s[0].children].find(n=>ke.some(o=>o===e.getAttribute(n,V)))},Vn=t=>{const{target:s,type:n}=t;if(!s||!s.closest)return;const o=St(s),a=o&&Ve(o);if(!a)return;const{parentElement:r,menu:l}=a,d=e.closest(s,Vt)!==null,u=r&&r.contains(s)&&(s.tagName==="form"||e.closest(s,"form")!==null);n===e.mouseclickEvent&&Mn(s)&&t.preventDefault(),!(n===e.focusEvent&&(s===o||s===l||l.contains(s)))&&(u||d||a&&a.hide())},ki=t=>{const{target:s}=t,n=s&&e.closest(s,Vt),o=n&&Ve(n);o&&(t.stopImmediatePropagation(),o.toggle(),n&&Mn(n)&&t.preventDefault())},Ii=t=>{[e.keyArrowDown,e.keyArrowUp].includes(t.code)&&t.preventDefault()};function Ni(t){const{code:s}=t,n=St(this),o=n&&Ve(n),{activeElement:a}=n&&e.getDocument(n);if(!o||!a)return;const{menu:r,open:l}=o,d=Li(r);if(d&&d.length&&[e.keyArrowDown,e.keyArrowUp].includes(s)){let u=d.indexOf(a);a===n?u=0:s===e.keyArrowUp?u=u>1?u-1:0:s===e.keyArrowDown&&(u=u<d.length-1?u+1:u),d[u]&&e.focus(d[u])}e.keyEscape===s&&l&&(o.toggle(),e.focus(n))}function Mi(){const t=St(this),s=t&&Ve(t);s&&s.open&&qn(s)}class Ue extends J{constructor(s,n){super(s,n);const{parentElement:o}=this.element,a=e.querySelector(`.${Nn}`,o);a&&(this.parentElement=o,this.menu=a,jn(this,!0))}get name(){return In}get defaults(){return Hi}toggle(){this.open?this.hide():this.show()}show(){const{element:s,open:n,menu:o,parentElement:a}=this;if(n)return;const r=St(s),l=r&&Ve(r);l&&l.hide(),[Ut,Rn,Wn].forEach(d=>{d.relatedTarget=s}),e.dispatchEvent(a,Ut),!Ut.defaultPrevented&&(e.addClass(o,C),e.addClass(a,C),e.setAttribute(s,e.ariaExpanded,"true"),qn(this),this.open=!n,e.focus(s),Fn(this),e.dispatchEvent(a,Rn))}hide(){const{element:s,open:n,menu:o,parentElement:a}=this;n&&([Kt,zn].forEach(r=>{r.relatedTarget=s}),e.dispatchEvent(a,Kt),!Kt.defaultPrevented&&(e.removeClass(o,C),e.removeClass(a,C),e.setAttribute(s,e.ariaExpanded,"false"),this.open=!n,Fn(this),e.dispatchEvent(a,zn)))}dispose(){this.open&&this.hide(),jn(this),super.dispose()}}v(Ue,"selector",Vt),v(Ue,"init",$i),v(Ue,"getInstance",Ve);const U="modal",Qt="Modal",Xt="Offcanvas",Pi="fixed-top",Oi="fixed-bottom",Un="sticky-top",Kn="position-sticky",Qn=t=>[...e.getElementsByClassName(Pi,t),...e.getElementsByClassName(Oi,t),...e.getElementsByClassName(Un,t),...e.getElementsByClassName(Kn,t),...e.getElementsByClassName("is-fixed",t)],Bi=t=>{const s=e.getDocumentBody(t);e.setElementStyle(s,{paddingRight:"",overflow:""});const n=Qn(s);n.length&&n.forEach(o=>{e.setElementStyle(o,{paddingRight:"",marginRight:""})})},Xn=t=>{const{clientWidth:s}=e.getDocumentElement(t),{innerWidth:n}=e.getWindow(t);return Math.abs(n-s)},Yn=(t,s)=>{const n=e.getDocumentBody(t),o=parseInt(e.getElementStyle(n,"paddingRight"),10),r=e.getElementStyle(n,"overflow")==="hidden"&&o?0:Xn(t),l=Qn(n);s&&(e.setElementStyle(n,{overflow:"hidden",paddingRight:`${o+r}px`}),l.length&&l.forEach(d=>{const u=e.getElementStyle(d,"paddingRight");if(d.style.paddingRight=`${parseInt(u,10)+r}px`,[Un,Kn].some(h=>e.hasClass(d,h))){const h=e.getElementStyle(d,"marginRight");d.style.marginRight=`${parseInt(h,10)-r}px`}}))},Q="offcanvas",ve=e.createElement({tagName:"div",className:"popup-container"}),Gn=(t,s)=>{const n=e.isNode(s)&&s.nodeName==="BODY",o=e.isNode(s)&&!n?s:ve,a=n?s:e.getDocumentBody(t);e.isNode(t)&&(o===ve&&a.append(ve),o.append(t))},_n=(t,s)=>{const n=e.isNode(s)&&s.nodeName==="BODY",o=e.isNode(s)&&!n?s:ve;e.isNode(t)&&(t.remove(),o===ve&&!ve.children.length&&ve.remove())},Ie=(t,s)=>{const n=e.isNode(s)&&s.nodeName!=="BODY"?s:ve;return e.isNode(t)&&n.contains(t)},Jn="backdrop",Zn=`${U}-${Jn}`,xn=`${Q}-${Jn}`,es=`.${U}.${C}`,Yt=`.${Q}.${C}`,L=e.createElement("div"),Ne=t=>e.querySelector(`${es},${Yt}`,e.getDocument(t)),Gt=t=>{const s=t?Zn:xn;[Zn,xn].forEach(n=>{e.removeClass(L,n)}),e.addClass(L,s)},ts=(t,s,n)=>{Gt(n),Gn(L,e.getDocumentBody(t)),s&&e.addClass(L,P)},ns=()=>{e.hasClass(L,C)||(e.addClass(L,C),e.reflow(L))},At=()=>{e.removeClass(L,C)},ss=t=>{Ne(t)||(e.removeClass(L,P),_n(L,e.getDocumentBody(t)),Bi(t))},os=t=>e.isHTMLElement(t)&&e.getElementStyle(t,"visibility")!=="hidden"&&t.offsetParent!==null,Ri=`.${U}`,is=`[${V}="${U}"]`,zi=`[${Et}="${U}"]`,as=`${U}-static`,Wi={backdrop:!0,keyboard:!0},it=t=>e.getInstance(t,Qt),qi=t=>new Ke(t),$t=e.createCustomEvent(`show.bs.${U}`),rs=e.createCustomEvent(`shown.bs.${U}`),_t=e.createCustomEvent(`hide.bs.${U}`),cs=e.createCustomEvent(`hidden.bs.${U}`),ls=t=>{const{element:s}=t,n=Xn(s),{clientHeight:o,scrollHeight:a}=e.getDocumentElement(s),{clientHeight:r,scrollHeight:l}=s,d=r!==l;if(!d&&n){const u=e.isRTL(s)?"paddingLeft":"paddingRight",h={};h[u]=`${n}px`,e.setElementStyle(s,h)}Yn(s,d||o!==a)},ds=(t,s)=>{const n=s?b.addListener:b.removeListener,{element:o,update:a}=t;n(o,e.mouseclickEvent,Vi),n(e.getWindow(o),e.resizeEvent,a,e.passiveHandler),n(e.getDocument(o),e.keydownEvent,ji)},us=(t,s)=>{const n=s?b.addListener:b.removeListener,{triggers:o}=t;o.length&&o.forEach(a=>n(a,e.mouseclickEvent,Fi))},ms=(t,s)=>{const{triggers:n,element:o,relatedTarget:a}=t;ss(o),e.setElementStyle(o,{paddingRight:"",display:""}),ds(t);const r=$t.relatedTarget||n.find(os);r&&e.focus(r),e.isFunction(s)&&s(),cs.relatedTarget=a,e.dispatchEvent(o,cs)},hs=t=>{const{element:s,relatedTarget:n}=t;e.focus(s),ds(t,!0),rs.relatedTarget=n,e.dispatchEvent(s,rs)},gs=t=>{const{element:s,hasFade:n}=t;e.setElementStyle(s,{display:"block"}),ls(t),Ne(s)||e.setElementStyle(e.getDocumentBody(s),{overflow:"hidden"}),e.addClass(s,C),e.removeAttribute(s,e.ariaHidden),e.setAttribute(s,e.ariaModal,"true"),n?e.emulateTransitionEnd(s,()=>hs(t)):hs(t)},fs=(t,s)=>{const{element:n,options:o,hasFade:a}=t;o.backdrop&&!s&&a&&e.hasClass(L,C)&&!Ne(n)?(At(),e.emulateTransitionEnd(L,()=>ms(t))):ms(t,s)},Fi=t=>{const{target:s}=t,n=s&&e.closest(s,is),o=n&&F(n),a=o&&it(o);a&&(n&&n.tagName==="A"&&t.preventDefault(),a.relatedTarget=n,a.toggle())},ji=({code:t,target:s})=>{const n=e.querySelector(es,e.getDocument(s)),o=n&&it(n);if(!o)return;const{options:a}=o;a.keyboard&&t===e.keyEscape&&e.hasClass(n,C)&&(o.relatedTarget=null,o.hide())};function Vi(t){var p,f;const s=it(this);if(!s||e.Timer.get(this))return;const{options:n,isStatic:o,modalDialog:a}=s,{backdrop:r}=n,{target:l}=t,d=(f=(p=e.getDocument(this))==null?void 0:p.getSelection())==null?void 0:f.toString().length,u=a==null?void 0:a.contains(l),h=l&&e.closest(l,zi);o&&!u?e.Timer.set(this,()=>{e.addClass(this,as),e.emulateTransitionEnd(a,()=>Ui(s))},17):(h||!d&&!o&&!u&&r)&&(s.relatedTarget=h||null,s.hide(),t.preventDefault())}const Ui=t=>{const{element:s,modalDialog:n}=t,o=(e.isHTMLElement(n)?e.getElementTransitionDuration(n):0)+17;e.removeClass(s,as),e.Timer.set(s,()=>e.Timer.clear(s),o)};class Ke extends J{constructor(n,o){super(n,o);v(this,"update",()=>{e.hasClass(this.element,C)&&ls(this)});const{element:a}=this;this.modalDialog=e.querySelector(`.${U}-dialog`,a),this.triggers=[...e.querySelectorAll(is,e.getDocument(a))].filter(r=>F(r)===a),this.isStatic=this.options.backdrop==="static",this.hasFade=e.hasClass(a,P),this.relatedTarget=null,us(this,!0)}get name(){return Qt}get defaults(){return Wi}toggle(){e.hasClass(this.element,C)?this.hide():this.show()}show(){const{element:n,options:o,hasFade:a,relatedTarget:r}=this,{backdrop:l}=o;let d=0;if(e.hasClass(n,C)||($t.relatedTarget=r||void 0,e.dispatchEvent(n,$t),$t.defaultPrevented))return;const u=Ne(n);if(u&&u!==n){const h=it(u)||e.getInstance(u,Xt);h&&h.hide()}l?(Ie(L)?Gt(!0):ts(n,a,!0),d=e.getElementTransitionDuration(L),ns(),setTimeout(()=>gs(this),d)):(gs(this),u&&e.hasClass(L,C)&&At())}hide(n){const{element:o,hasFade:a,relatedTarget:r}=this;e.hasClass(o,C)&&(_t.relatedTarget=r||void 0,e.dispatchEvent(o,_t),!_t.defaultPrevented&&(e.removeClass(o,C),e.setAttribute(o,e.ariaHidden,"true"),e.removeAttribute(o,e.ariaModal),a?e.emulateTransitionEnd(o,()=>fs(this,n)):fs(this,n)))}dispose(){us(this),this.hide(()=>super.dispose())}}v(Ke,"selector",Ri),v(Ke,"init",qi),v(Ke,"getInstance",it);const Ki=`.${Q}`,Jt=`[${V}="${Q}"]`,Qi=`[${Et}="${Q}"]`,Dt=`${Q}-toggling`,Xi={backdrop:!0,keyboard:!0,scroll:!1},at=t=>e.getInstance(t,Xt),Yi=t=>new Qe(t),Ht=e.createCustomEvent(`show.bs.${Q}`),vs=e.createCustomEvent(`shown.bs.${Q}`),Zt=e.createCustomEvent(`hide.bs.${Q}`),ps=e.createCustomEvent(`hidden.bs.${Q}`),Gi=t=>{const{element:s}=t,{clientHeight:n,scrollHeight:o}=e.getDocumentElement(s);Yn(s,n!==o)},Es=(t,s)=>{const n=s?b.addListener:b.removeListener;t.triggers.forEach(o=>n(o,e.mouseclickEvent,_i))},bs=(t,s)=>{const n=s?b.addListener:b.removeListener,o=e.getDocument(t.element);n(o,e.keydownEvent,Zi),n(o,e.mouseclickEvent,Ji)},Cs=t=>{const{element:s,options:n}=t;n.scroll||(Gi(t),e.setElementStyle(e.getDocumentBody(s),{overflow:"hidden"})),e.addClass(s,Dt),e.addClass(s,C),e.setElementStyle(s,{visibility:"visible"}),e.emulateTransitionEnd(s,()=>xi(t))},ys=(t,s)=>{const{element:n,options:o}=t,a=Ne(n);n.blur(),!a&&o.backdrop&&e.hasClass(L,C)?(At(),e.emulateTransitionEnd(L,()=>Ts(t,s))):Ts(t,s)},_i=t=>{const s=e.closest(t.target,Jt),n=s&&F(s),o=n&&at(n);o&&(o.relatedTarget=s,o.toggle(),s&&s.tagName==="A"&&t.preventDefault())},Ji=t=>{const{target:s}=t,n=e.querySelector(Yt,e.getDocument(s)),o=e.querySelector(Qi,n),a=n&&at(n);if(!a)return;const{options:r,triggers:l}=a,{backdrop:d}=r,u=e.closest(s,Jt),h=e.getDocument(n).getSelection();L.contains(s)&&d==="static"||(!(h&&h.toString().length)&&(!n.contains(s)&&d&&(!u||l.includes(s))||o&&o.contains(s))&&(a.relatedTarget=o&&o.contains(s)?o:null,a.hide()),u&&u.tagName==="A"&&t.preventDefault())},Zi=({code:t,target:s})=>{const n=e.querySelector(Yt,e.getDocument(s)),o=n&&at(n);o&&o.options.keyboard&&t===e.keyEscape&&(o.relatedTarget=null,o.hide())},xi=t=>{const{element:s}=t;e.removeClass(s,Dt),e.removeAttribute(s,e.ariaHidden),e.setAttribute(s,e.ariaModal,"true"),e.setAttribute(s,"role","dialog"),e.dispatchEvent(s,vs),bs(t,!0),e.focus(s)},Ts=(t,s)=>{const{element:n,triggers:o}=t;e.setAttribute(n,e.ariaHidden,"true"),e.removeAttribute(n,e.ariaModal),e.removeAttribute(n,"role"),e.setElementStyle(n,{visibility:""});const a=Ht.relatedTarget||o.find(os);a&&e.focus(a),ss(n),e.dispatchEvent(n,ps),e.removeClass(n,Dt),Ne(n)||bs(t),e.isFunction(s)&&s()};class Qe extends J{constructor(s,n){super(s,n);const{element:o}=this;this.triggers=[...e.querySelectorAll(Jt,e.getDocument(o))].filter(a=>F(a)===o),this.relatedTarget=null,Es(this,!0)}get name(){return Xt}get defaults(){return Xi}toggle(){e.hasClass(this.element,C)?this.hide():this.show()}show(){const{element:s,options:n,relatedTarget:o}=this;let a=0;if(e.hasClass(s,C)||(Ht.relatedTarget=o||void 0,vs.relatedTarget=o||void 0,e.dispatchEvent(s,Ht),Ht.defaultPrevented))return;const r=Ne(s);if(r&&r!==s){const l=at(r)||e.getInstance(r,Qt);l&&l.hide()}n.backdrop?(Ie(L)?Gt():ts(s,!0),a=e.getElementTransitionDuration(L),ns(),setTimeout(()=>Cs(this),a)):(Cs(this),r&&e.hasClass(L,C)&&At())}hide(s){const{element:n,relatedTarget:o}=this;e.hasClass(n,C)&&(Zt.relatedTarget=o||void 0,ps.relatedTarget=o||void 0,e.dispatchEvent(n,Zt),!Zt.defaultPrevented&&(e.addClass(n,Dt),e.removeClass(n,C),s?ys(this,s):e.emulateTransitionEnd(n,()=>ys(this,s))))}dispose(){Es(this),this.hide(()=>super.dispose())}}v(Qe,"selector",Ki),v(Qe,"init",Yi),v(Qe,"getInstance",at);const Me="popover",Lt="Popover",ce="tooltip",ws=t=>{const s=t===ce,n=s?`${t}-inner`:`${t}-body`,o=s?"":`<h3 class="${t}-header"></h3>`,a=`<div class="${t}-arrow"></div>`,r=`<div class="${n}"></div>`;return`<div class="${t}" role="${ce}">${o+a+r}</div>`},Ss={top:"top",bottom:"bottom",left:"start",right:"end"},xt=t=>{const s=/\b(top|bottom|start|end)+/,{element:n,tooltip:o,container:a,options:r,arrow:l}=t;if(!o)return;const d={...Ss},u=e.isRTL(n);e.setElementStyle(o,{top:"",left:"",right:"",bottom:""});const h=t.name===Lt,{offsetWidth:p,offsetHeight:f}=o,{clientWidth:y,clientHeight:A,offsetWidth:z}=e.getDocumentElement(n);let{placement:T}=r;const{clientWidth:O,offsetWidth:W}=a,Y=e.getElementStyle(a,"position")==="fixed",$=Math.abs(Y?O-W:y-z),G=u&&Y?$:0,K=y-(u?0:$)-1,{width:I,height:B,left:S,right:de,top:ee}=e.getBoundingClientRect(n,!0),{x:H,y:te}={x:S,y:ee};e.setElementStyle(l,{top:"",left:"",right:"",bottom:""});let ae=0,be="",ne=0,Je="",ue="",Be="",Ze="";const re=l.offsetWidth||0,se=l.offsetHeight||0,xe=re/2;let Ce=ee-f-se<0,ye=ee+f+B+se>=A,Te=S-p-re<G,we=S+p+I+re>=K;const Re=["left","right"],et=["top","bottom"];Ce=Re.includes(T)?ee+B/2-f/2-se<0:Ce,ye=Re.includes(T)?ee+f/2+B/2+se>=A:ye,Te=et.includes(T)?S+I/2-p/2<G:Te,we=et.includes(T)?S+p/2+I/2>=K:we,T=Re.includes(T)&&Te&&we?"top":T,T=T==="top"&&Ce?"bottom":T,T=T==="bottom"&&ye?"top":T,T=T==="left"&&Te?"right":T,T=T==="right"&&we?"left":T,o.className.includes(T)||(o.className=o.className.replace(s,d[T])),Re.includes(T)?(T==="left"?ne=H-p-(h?re:0):ne=H+I+(h?re:0),Ce&&ye?(ae=0,be=0,ue=ee+B/2-se/2):Ce?(ae=te,be="",ue=B/2-re):ye?(ae=te-f+B,be="",ue=f-B/2-re):(ae=te-f/2+B/2,ue=f/2-se/2)):et.includes(T)&&(T==="top"?ae=te-f-(h?se:0):ae=te+B+(h?se:0),Te?(ne=0,Be=H+I/2-xe):we?(ne="auto",Je=0,Ze=I/2+K-de-xe):(ne=H-p/2+I/2,Be=p/2-xe)),e.setElementStyle(o,{top:`${ae}px`,bottom:be===""?"":`${be}px`,left:ne==="auto"?ne:`${ne}px`,right:Je!==""?`${Je}px`:""}),e.isHTMLElement(l)&&(ue!==""&&(l.style.top=`${ue}px`),Be!==""?l.style.left=`${Be}px`:Ze!==""&&(l.style.right=`${Ze}px`));const kt=e.createCustomEvent(`updated.bs.${e.toLowerCase(t.name)}`);e.dispatchEvent(n,kt)},en={template:ws(ce),title:"",customClass:"",trigger:"hover focus",placement:"top",sanitizeFn:void 0,animation:!0,delay:200,container:document.body,content:"",dismissible:!1,btnClose:""},As="data-original-title",Pe="Tooltip",pe=(t,s,n)=>{if(!(!e.isHTMLElement(t)||e.isString(s)&&!s.length))if(e.isString(s)){let o=s.trim();e.isFunction(n)&&(o=n(o));const r=new DOMParser().parseFromString(o,"text/html");t.append(...r.body.childNodes)}else e.isHTMLElement(s)?t.append(s):(e.isNodeList(s)||e.isArray(s)&&s.every(e.isNode))&&t.append(...s)},ea=t=>{const s=t.name===Pe,{id:n,element:o,options:a}=t,{title:r,placement:l,template:d,animation:u,customClass:h,sanitizeFn:p,dismissible:f,content:y,btnClose:A}=a,z=s?ce:Me,T={...Ss};let O=[],W=[];e.isRTL(o)&&(T.left="end",T.right="start");const le=`bs-${z}-${T[l]}`;let Y;if(e.isHTMLElement(d))Y=d;else{const S=e.createElement("div");pe(S,d,p),Y=S.firstChild}t.tooltip=e.isHTMLElement(Y)?Y.cloneNode(!0):void 0;const{tooltip:$}=t;if(!$)return;e.setAttribute($,"id",n),e.setAttribute($,"role",ce);const G=s?`${ce}-inner`:`${Me}-body`,K=s?null:e.querySelector(`.${Me}-header`,$),I=e.querySelector(`.${G}`,$);t.arrow=e.querySelector(`.${z}-arrow`,$);const{arrow:B}=t;if(e.isHTMLElement(r))O=[r.cloneNode(!0)];else{const S=e.createElement("div");pe(S,r,p),O=[...S.childNodes]}if(e.isHTMLElement(y))W=[y.cloneNode(!0)];else{const S=e.createElement("div");pe(S,y,p),W=[...S.childNodes]}if(f)if(r)if(e.isHTMLElement(A))O=[...O,A.cloneNode(!0)];else{const S=e.createElement("div");pe(S,A,p),O=[...O,S.firstChild]}else if(K&&K.remove(),e.isHTMLElement(A))W=[...W,A.cloneNode(!0)];else{const S=e.createElement("div");pe(S,A,p),W=[...W,S.firstChild]}s?r&&I&&pe(I,r,p):(r&&K&&pe(K,O,p),y&&I&&pe(I,W,p),t.btn=e.querySelector(".btn-close",$)||void 0),e.addClass($,"position-fixed"),e.addClass(B,"position-absolute"),e.hasClass($,z)||e.addClass($,z),u&&!e.hasClass($,P)&&e.addClass($,P),h&&!e.hasClass($,h)&&e.addClass($,h),e.hasClass($,le)||e.addClass($,le)},ta=t=>{const s=["HTML","BODY"],n=[];let{parentNode:o}=t;for(;o&&!s.includes(o.nodeName);)o=e.getParentNode(o),e.isShadowRoot(o)||e.isTableElement(o)||n.push(o);return n.find((a,r)=>e.getElementStyle(a,"position")!=="relative"&&n.slice(r+1).every(l=>e.getElementStyle(l,"position")==="static")?a:null)||e.getDocument(t).body},na=`[${V}="${ce}"],[data-tip="${ce}"]`,$s="title";let Ds=t=>e.getInstance(t,Pe);const sa=t=>new Ee(t),oa=t=>{const{element:s,tooltip:n,container:o,offsetParent:a}=t;e.removeAttribute(s,e.ariaDescribedBy),_n(n,o===a?o:a)},ia=(t,s)=>{const{element:n}=t;rt(t),e.hasAttribute(n,As)&&t.name===Pe&&Ns(t),s&&s()},Hs=(t,s)=>{const n=s?b.addListener:b.removeListener,{element:o}=t;n(e.getDocument(o),e.touchstartEvent,t.handleTouch,e.passiveHandler),[e.scrollEvent,e.resizeEvent].forEach(a=>{n(e.getWindow(o),a,t.update,e.passiveHandler)})},Ls=t=>{const{element:s}=t,n=e.createCustomEvent(`shown.bs.${e.toLowerCase(t.name)}`);Hs(t,!0),e.dispatchEvent(s,n),e.Timer.clear(s,"in")},ks=t=>{const{element:s,onHideComplete:n}=t,o=e.createCustomEvent(`hidden.bs.${e.toLowerCase(t.name)}`);Hs(t),oa(t),e.dispatchEvent(s,o),e.isFunction(n)&&(n(),t.onHideComplete=void 0),e.Timer.clear(s,"out")},rt=(t,s)=>{const n=s?b.addListener:b.removeListener,{element:o,options:a,btn:r}=t,{trigger:l}=a,u=!!(t.name!==Pe&&a.dismissible);if(l.includes("manual"))return;t.enabled=!!s,l.split(" ").forEach(p=>{p===e.mousehoverEvent?(n(o,e.mousedownEvent,t.show),n(o,e.mouseenterEvent,t.show),u&&r?n(r,e.mouseclickEvent,t.hide):(n(o,e.mouseleaveEvent,t.hide),n(e.getDocument(o),e.touchstartEvent,t.handleTouch,e.passiveHandler))):p===e.mouseclickEvent?n(o,p,u?t.show:t.toggle):p===e.focusEvent&&(n(o,e.focusinEvent,t.show),u||n(o,e.focusoutEvent,t.hide),e.isApple&&n(o,e.mouseclickEvent,()=>e.focus(o)))})},Is=(t,s)=>{const n=s?b.addListener:b.removeListener,{element:o,container:a,offsetParent:r}=t,{offsetHeight:l,scrollHeight:d}=a,u=e.closest(o,`.${U}`),h=e.closest(o,`.${Q}`),p=e.getWindow(o),y=a===r&&l!==d?a:p;n(y,e.resizeEvent,t.update,e.passiveHandler),n(y,e.scrollEvent,t.update,e.passiveHandler),u&&n(u,`hide.bs.${U}`,t.hide),h&&n(h,`hide.bs.${Q}`,t.hide)},Ns=(t,s)=>{const n=[As,$s],{element:o}=t;e.setAttribute(o,n[s?0:1],s||e.getAttribute(o,n[0])||""),e.removeAttribute(o,n[s?1:0])};class Ee extends J{constructor(n,o){super(n,o);v(this,"show",()=>this._show());v(this,"hide",()=>{const{options:n,tooltip:o,element:a,container:r,offsetParent:l}=this,{animation:d,delay:u}=n;e.Timer.clear(a,"in"),o&&Ie(o,r===l?r:l)&&e.Timer.set(a,()=>{const h=e.createCustomEvent(`hide.bs.${e.toLowerCase(this.name)}`);e.dispatchEvent(a,h),!h.defaultPrevented&&(this.update(),e.removeClass(o,C),Is(this),d?e.emulateTransitionEnd(o,()=>ks(this)):ks(this))},u+17,"out")});v(this,"update",()=>{xt(this)});v(this,"toggle",()=>{const{tooltip:n,container:o,offsetParent:a}=this;n&&!Ie(n,o===a?o:a)?this.show():this.hide()});v(this,"handleTouch",({target:n})=>{const{tooltip:o,element:a}=this;o&&o.contains(n)||n===a||n&&a.contains(n)||this.hide()});const{element:a}=this,r=this.name===Pe,l=r?ce:Me,d=r?Pe:Lt;Ds=h=>e.getInstance(h,d),this.enabled=!0,this.id=`${l}-${e.getUID(a,l)}`;const{options:u}=this;!u.title&&r||!r&&!u.content||(e.ObjectAssign(en,{titleAttr:""}),e.hasAttribute(a,$s)&&r&&typeof u.title=="string"&&Ns(this,u.title),this.container=ta(a),this.offsetParent=["sticky","fixed"].some(h=>e.getElementStyle(this.container,"position")===h)?this.container:e.getDocument(this.element).body,ea(this),rt(this,!0))}get name(){return Pe}get defaults(){return en}_show(){const{options:n,tooltip:o,element:a,container:r,offsetParent:l,id:d}=this,{animation:u}=n,h=e.Timer.get(a,"out"),p=r===l?r:l;e.Timer.clear(a,"out"),o&&!h&&!Ie(o,p)&&e.Timer.set(a,()=>{const f=e.createCustomEvent(`show.bs.${e.toLowerCase(this.name)}`);e.dispatchEvent(a,f),!f.defaultPrevented&&(Gn(o,p),e.setAttribute(a,e.ariaDescribedBy,`#${d}`),this.update(),Is(this,!0),e.hasClass(o,C)||e.addClass(o,C),u?e.emulateTransitionEnd(o,()=>Ls(this)):Ls(this))},17,"in")}enable(){const{enabled:n}=this;n||(rt(this,!0),this.enabled=!n)}disable(){const{tooltip:n,container:o,offsetParent:a,options:r,enabled:l}=this,{animation:d}=r;l&&(n&&Ie(n,o===a?o:a)&&d?(this.onHideComplete=()=>rt(this),this.hide()):rt(this),this.enabled=!l)}toggleEnabled(){this.enabled?this.disable():this.enable()}dispose(){const{tooltip:n,container:o,offsetParent:a,options:r}=this,l=()=>ia(this,()=>super.dispose());r.animation&&n&&Ie(n,o===a?o:a)?(this.options.delay=0,this.onHideComplete=l,this.hide()):l()}}v(Ee,"selector",na),v(Ee,"init",sa),v(Ee,"getInstance",Ds),v(Ee,"styleTip",xt);const aa=`[${V}="${Me}"],[data-tip="${Me}"]`,ra=e.ObjectAssign({},en,{template:ws(Me),content:"",dismissible:!1,btnClose:'<button class="btn-close" aria-label="Close"></button>'}),ca=t=>e.getInstance(t,Lt),la=t=>new Oe(t);class Oe extends Ee{constructor(n,o){super(n,o);v(this,"show",()=>{super._show();const{options:n,btn:o}=this;n.dismissible&&o&&setTimeout(()=>e.focus(o),17)})}get name(){return Lt}get defaults(){return ra}}v(Oe,"selector",aa),v(Oe,"init",la),v(Oe,"getInstance",ca),v(Oe,"styleTip",xt);const da="scrollspy",Ms="ScrollSpy",ua='[data-bs-spy="scroll"]',ma={offset:10,target:null},ha=t=>e.getInstance(t,Ms),ga=t=>new Xe(t),Ps=e.createCustomEvent(`activate.bs.${da}`),fa=t=>{const{target:s,scrollTarget:n,options:o,itemsLength:a,scrollHeight:r,element:l}=t,{offset:d}=o,u=e.isWindow(n),h=s&&e.getElementsByTagName("A",s),p=n?Os(n):r;if(t.scrollTop=u?n.scrollY:n.scrollTop,h&&(p!==r||a!==h.length)){let f,y,A;t.items=[],t.offsets=[],t.scrollHeight=p,t.maxScroll=t.scrollHeight-va(t),[...h].forEach(z=>{f=e.getAttribute(z,"href"),y=f&&f.charAt(0)==="#"&&f.slice(-1)!=="#"&&e.querySelector(f,e.getDocument(l)),y&&(t.items.push(z),A=e.getBoundingClientRect(y),t.offsets.push((u?A.top+t.scrollTop:y.offsetTop)-d))}),t.itemsLength=t.items.length}},Os=t=>e.isHTMLElement(t)?t.scrollHeight:e.getDocumentElement(t).scrollHeight,va=({element:t,scrollTarget:s})=>e.isWindow(s)?s.innerHeight:e.getBoundingClientRect(t).height,Bs=t=>{[...e.getElementsByTagName("A",t)].forEach(s=>{e.hasClass(s,w)&&e.removeClass(s,w)})},Rs=(t,s)=>{const{target:n,element:o}=t;e.isHTMLElement(n)&&Bs(n),t.activeItem=s,e.addClass(s,w);const a=[];let r=s;for(;r!==e.getDocumentBody(o);)r=r.parentElement,(e.hasClass(r,"nav")||e.hasClass(r,"dropdown-menu"))&&a.push(r);a.forEach(l=>{const d=l.previousElementSibling;d&&!e.hasClass(d,w)&&e.addClass(d,w)}),Ps.relatedTarget=s,e.dispatchEvent(o,Ps)},zs=(t,s)=>{(s?b.addListener:b.removeListener)(t.scrollTarget,e.scrollEvent,t.refresh,e.passiveHandler)};class Xe extends J{constructor(n,o){super(n,o);v(this,"refresh",()=>{const{target:n}=this;if((n==null?void 0:n.offsetHeight)===0)return;fa(this);const{scrollTop:o,maxScroll:a,itemsLength:r,items:l,activeItem:d}=this;if(o>=a){const h=l[r-1];d!==h&&Rs(this,h);return}const{offsets:u}=this;if(d&&o<u[0]&&u[0]>0){this.activeItem=null,n&&Bs(n);return}l.forEach((h,p)=>{d!==h&&o>=u[p]&&(typeof u[p+1]>"u"||o<u[p+1])&&Rs(this,h)})});const{element:a,options:r}=this;this.target=e.querySelector(r.target,e.getDocument(a)),this.target&&(this.scrollTarget=a.clientHeight<a.scrollHeight?a:e.getWindow(a),this.scrollHeight=Os(this.scrollTarget),zs(this,!0),this.refresh())}get name(){return Ms}get defaults(){return ma}dispose(){zs(this),super.dispose()}}v(Xe,"selector",ua),v(Xe,"init",ga),v(Xe,"getInstance",ha);const ct="tab",Ws="Tab",qs=`[${V}="${ct}"]`,Fs=t=>e.getInstance(t,Ws),pa=t=>new Ye(t),tn=e.createCustomEvent(`show.bs.${ct}`),js=e.createCustomEvent(`shown.bs.${ct}`),nn=e.createCustomEvent(`hide.bs.${ct}`),Vs=e.createCustomEvent(`hidden.bs.${ct}`),lt=new Map,Us=t=>{const{tabContent:s,nav:n}=t;s&&e.hasClass(s,Le)&&(s.style.height="",e.removeClass(s,Le)),n&&e.Timer.clear(n)},Ks=t=>{const{element:s,tabContent:n,content:o,nav:a}=t,{tab:r}=e.isHTMLElement(a)&<.get(a)||{tab:null};if(n&&o&&e.hasClass(o,P)){const{currentHeight:l,nextHeight:d}=lt.get(s)||{currentHeight:0,nextHeight:0};l===d?Us(t):setTimeout(()=>{n.style.height=`${d}px`,e.reflow(n),e.emulateTransitionEnd(n,()=>Us(t))},50)}else a&&e.Timer.clear(a);js.relatedTarget=r,e.dispatchEvent(s,js)},Qs=t=>{const{element:s,content:n,tabContent:o,nav:a}=t,{tab:r,content:l}=a&<.get(a)||{tab:null,content:null};let d=0;if(o&&n&&e.hasClass(n,P)&&([l,n].forEach(u=>{e.isHTMLElement(u)&&e.addClass(u,"overflow-hidden")}),d=e.isHTMLElement(l)?l.scrollHeight:0),tn.relatedTarget=r,Vs.relatedTarget=s,e.dispatchEvent(s,tn),!tn.defaultPrevented){if(n&&e.addClass(n,w),l&&e.removeClass(l,w),o&&n&&e.hasClass(n,P)){const u=n.scrollHeight;lt.set(s,{currentHeight:d,nextHeight:u,tab:null,content:null}),e.addClass(o,Le),o.style.height=`${d}px`,e.reflow(o),[l,n].forEach(h=>{h&&e.removeClass(h,"overflow-hidden")})}n&&n&&e.hasClass(n,P)?setTimeout(()=>{e.addClass(n,C),e.emulateTransitionEnd(n,()=>{Ks(t)})},1):(n&&e.addClass(n,C),Ks(t)),r&&e.dispatchEvent(r,Vs)}},Xs=t=>{const{nav:s}=t;if(!e.isHTMLElement(s))return{tab:null,content:null};const n=e.getElementsByClassName(w,s);let o=null;n.length===1&&!ke.some(r=>e.hasClass(n[0].parentElement,r))?[o]=n:n.length>1&&(o=n[n.length-1]);const a=e.isHTMLElement(o)?F(o):null;return{tab:o,content:a}},Ys=t=>{if(!e.isHTMLElement(t))return null;const s=e.closest(t,`.${ke.join(",.")}`);return s?e.querySelector(`.${ke[0]}-toggle`,s):null},Gs=(t,s)=>{(s?b.addListener:b.removeListener)(t.element,e.mouseclickEvent,Ea)},Ea=t=>{const s=Fs(t.target);s&&(t.preventDefault(),s.show())};class Ye extends J{constructor(s){super(s);const{element:n}=this,o=F(n);if(!o)return;const a=e.closest(n,".nav"),r=e.closest(o,".tab-content");this.nav=a,this.content=o,this.tabContent=r,this.dropdown=Ys(n);const{tab:l}=Xs(this);if(a&&!l){const d=e.querySelector(qs,a),u=d&&F(d);u&&(e.addClass(d,w),e.addClass(u,C),e.addClass(u,w),e.setAttribute(n,e.ariaSelected,"true"))}Gs(this,!0)}get name(){return Ws}show(){const{element:s,content:n,nav:o,dropdown:a}=this;if(!(o&&e.Timer.get(o))&&!e.hasClass(s,w)){const{tab:r,content:l}=Xs(this);if(o&<.set(o,{tab:r,content:l,currentHeight:0,nextHeight:0}),nn.relatedTarget=s,e.isHTMLElement(r)&&e.dispatchEvent(r,nn),nn.defaultPrevented)return;e.addClass(s,w),e.setAttribute(s,e.ariaSelected,"true");const d=e.isHTMLElement(r)&&Ys(r);if(d&&e.hasClass(d,w)&&e.removeClass(d,w),o){const u=()=>{r&&(e.removeClass(r,w),e.setAttribute(r,e.ariaSelected,"false")),a&&!e.hasClass(a,w)&&e.addClass(a,w)};l&&(e.hasClass(l,P)||n&&e.hasClass(n,P))?e.Timer.set(o,u,1):u()}l&&(e.removeClass(l,C),e.hasClass(l,P)?e.emulateTransitionEnd(l,()=>Qs(this)):Qs(this))}}dispose(){Gs(this),super.dispose()}}v(Ye,"selector",qs),v(Ye,"init",pa),v(Ye,"getInstance",Fs);const X="toast",_s="Toast",ba=`.${X}`,Ca=`[${Et}="${X}"]`,Js=`[${V}="${X}"]`,Ge="showing",Zs="hide",ya={animation:!0,autohide:!0,delay:5e3},sn=t=>e.getInstance(t,_s),Ta=t=>new _e(t),xs=e.createCustomEvent(`show.bs.${X}`),wa=e.createCustomEvent(`shown.bs.${X}`),eo=e.createCustomEvent(`hide.bs.${X}`),Sa=e.createCustomEvent(`hidden.bs.${X}`),to=t=>{const{element:s,options:n}=t;e.removeClass(s,Ge),e.Timer.clear(s,Ge),e.dispatchEvent(s,wa),n.autohide&&e.Timer.set(s,()=>t.hide(),n.delay,X)},no=t=>{const{element:s}=t;e.removeClass(s,Ge),e.removeClass(s,C),e.addClass(s,Zs),e.Timer.clear(s,X),e.dispatchEvent(s,Sa)},Aa=t=>{const{element:s,options:n}=t;e.addClass(s,Ge),n.animation?(e.reflow(s),e.emulateTransitionEnd(s,()=>no(t))):no(t)},$a=t=>{const{element:s,options:n}=t;e.Timer.set(s,()=>{e.removeClass(s,Zs),e.reflow(s),e.addClass(s,C),e.addClass(s,Ge),n.animation?e.emulateTransitionEnd(s,()=>to(t)):to(t)},17,Ge)},so=(t,s)=>{const n=s?b.addListener:b.removeListener,{element:o,triggers:a,dismiss:r,options:l,hide:d}=t;r&&n(r,e.mouseclickEvent,d),l.autohide&&[e.focusinEvent,e.focusoutEvent,e.mouseenterEvent,e.mouseleaveEvent].forEach(u=>n(o,u,La)),a.length&&a.forEach(u=>n(u,e.mouseclickEvent,Ha))},Da=t=>{e.Timer.clear(t.element,X),so(t)},Ha=t=>{const{target:s}=t,n=s&&e.closest(s,Js),o=n&&F(n),a=o&&sn(o);a&&(n&&n.tagName==="A"&&t.preventDefault(),a.relatedTarget=n,a.show())},La=t=>{const s=t.target,n=sn(s),{type:o,relatedTarget:a}=t;!n||s===a||s.contains(a)||([e.mouseenterEvent,e.focusinEvent].includes(o)?e.Timer.clear(s,X):e.Timer.set(s,()=>n.hide(),n.options.delay,X))};class _e extends J{constructor(n,o){super(n,o);v(this,"show",()=>{const{element:n,isShown:o}=this;if(n&&!o){if(e.dispatchEvent(n,xs),xs.defaultPrevented)return;$a(this)}});v(this,"hide",()=>{const{element:n,isShown:o}=this;if(n&&o){if(e.dispatchEvent(n,eo),eo.defaultPrevented)return;Aa(this)}});const{element:a,options:r}=this;r.animation&&!e.hasClass(a,P)?e.addClass(a,P):!r.animation&&e.hasClass(a,P)&&e.removeClass(a,P),this.dismiss=e.querySelector(Ca,a),this.triggers=[...e.querySelectorAll(Js,e.getDocument(a))].filter(l=>F(l)===a),so(this,!0)}get name(){return _s}get defaults(){return ya}get isShown(){return e.hasClass(this.element,C)}dispose(){const{element:n,isShown:o}=this;o&&e.removeClass(n,C),Da(this),super.dispose()}}v(_e,"selector",ba),v(_e,"init",Ta),v(_e,"getInstance",sn);const on=new Map;[ze,We,Fe,je,Ue,Ke,Qe,Oe,Xe,Ye,_e,Ee].forEach(t=>on.set(t.prototype.name,t));const ka=(t,s)=>{[...s].forEach(n=>t(n))},Ia=(t,s)=>{const n=e.Data.getAllFor(t);n&&[...n].forEach(([o,a])=>{s.contains(o)&&a.dispose()})},an=t=>{const s=t&&t.nodeName?t:document,n=[...e.getElementsByTagName("*",s)];on.forEach(o=>{const{init:a,selector:r}=o;ka(a,n.filter(l=>e.matches(l,r)))})},Na=t=>{const s=t&&t.nodeName?t:document;on.forEach(n=>{Ia(n.prototype.name,s)})};return document.body?an():b.addListener(document,"DOMContentLoaded",()=>an(),{once:!0}),D.Alert=ze,D.Button=We,D.Carousel=Fe,D.Collapse=je,D.Dropdown=Ue,D.Listener=b,D.Modal=Ke,D.Offcanvas=Qe,D.Popover=Oe,D.ScrollSpy=Xe,D.Tab=Ye,D.Toast=_e,D.Tooltip=Ee,D.initCallback=an,D.removeDataAPI=Na,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"}),D}({}); | ||
var BSN=function(H){"use strict";var sc=Object.defineProperty;var nc=(H,j,lt)=>j in H?sc(H,j,{enumerable:!0,configurable:!0,writable:!0,value:lt}):H[j]=lt;var h=(H,j,lt)=>(nc(H,typeof j!="symbol"?j+"":j,lt),lt);const j={},lt=t=>{const{type:e,currentTarget:s}=t;[...j[e]].forEach(([n,o])=>{s===n&&[...o].forEach(([i,a])=>{i.apply(n,[t]),typeof a=="object"&&a.once&&O(n,e,i,a)})})},N=(t,e,s,n)=>{j[e]||(j[e]=new Map);const o=j[e];o.has(t)||o.set(t,new Map);const i=o.get(t),{size:a}=i;i.set(s,n),a||t.addEventListener(e,lt,n)},O=(t,e,s,n)=>{const o=j[e],i=o&&o.get(t),a=i&&i.get(s),c=a!==void 0?a:n;i&&i.has(s)&&i.delete(s),o&&(!i||!i.size)&&o.delete(t),(!o||!o.size)&&delete j[e],(!i||!i.size)&&t.removeEventListener(e,lt,c)},qo=Object.freeze(Object.defineProperty({__proto__:null,addListener:N,globalListener:lt,off:O,on:N,registry:j,removeListener:O},Symbol.toStringTag,{value:"Module"})),Ws="aria-describedby",He="aria-expanded",Se="aria-hidden",Pe="aria-modal",Fs="aria-pressed",Ze="aria-selected",Go="DOMContentLoaded",qe="focus",Ge="focusin",js="focusout",De="keydown",Qo="keyup",M="click",zs="mousedown",Jo="hover",Ae="mouseenter",Qe="mouseleave",ti="pointerdown",ei="pointermove",si="pointerup",xe="resize",Ie="scroll",Je="touchstart",ni="dragstart",ts="ArrowDown",es="ArrowUp",Ks="ArrowLeft",Vs="ArrowRight",ss="Escape",oi="transitionDuration",ii="transitionDelay",ns="transitionend",Xs="transitionProperty",ai=navigator.userAgentData,ke=ai,{userAgent:ci}=navigator,Ne=ci,Ys=/iPhone|iPad|iPod|Android/i;ke?ke.brands.some(t=>Ys.test(t.brand)):Ys.test(Ne);const Us=/(iPhone|iPod|iPad)/,li=ke?ke.brands.some(t=>Us.test(t.brand)):Us.test(Ne);Ne&&Ne.includes("Firefox");const{head:Oe}=document;["webkitPerspective","perspective"].some(t=>t in Oe.style);const ri=(t,e,s,n)=>{const o=n||!1;t.addEventListener(e,s,o)},di=(t,e,s,n)=>{const o=n||!1;t.removeEventListener(e,s,o)},hi=(t,e,s,n)=>{const o=i=>{(i.target===t||i.currentTarget===t)&&(s.apply(t,[i]),di(t,e,o,n))};ri(t,e,o,n)},le=()=>{};(()=>{let t=!1;try{const e=Object.defineProperty({},"passive",{get:()=>(t=!0,t)});hi(document,Go,le,e)}catch{}return t})(),["webkitTransform","transform"].some(t=>t in Oe.style),["webkitAnimation","animation"].some(t=>t in Oe.style),["webkitTransition","transition"].some(t=>t in Oe.style);const mt=(t,e)=>t.getAttribute(e),Me=(t,e)=>t.hasAttribute(e),L=(t,e,s)=>t.setAttribute(e,s),xt=(t,e)=>t.removeAttribute(e),g=(t,...e)=>{t.classList.add(...e)},v=(t,...e)=>{t.classList.remove(...e)},f=(t,e)=>t.classList.contains(e),re=t=>t!=null&&typeof t=="object"||!1,I=t=>re(t)&&typeof t.nodeType=="number"&&[1,2,3,4,5,6,7,8,9,10,11].some(e=>t.nodeType===e)||!1,T=t=>I(t)&&t.nodeType===1||!1,zt=new Map,It={data:zt,set:(t,e,s)=>{T(t)&&(zt.has(e)||zt.set(e,new Map),zt.get(e).set(t,s))},getAllFor:t=>zt.get(t)||null,get:(t,e)=>{if(!T(t)||!e)return null;const s=It.getAllFor(e);return t&&s&&s.get(t)||null},remove:(t,e)=>{const s=It.getAllFor(e);!s||!T(t)||(s.delete(t),s.size===0&&zt.delete(e))}},z=(t,e)=>It.get(t,e),de=t=>typeof t=="string"||!1,os=t=>re(t)&&t.constructor.name==="Window"||!1,_s=t=>I(t)&&t.nodeType===9||!1,w=t=>os(t)?t.document:_s(t)?t:I(t)?t.ownerDocument:window.document,rt=(t,...e)=>Object.assign(t,...e),vt=t=>{if(!t)return;if(de(t))return w().createElement(t);const{tagName:e}=t,s=vt(e);if(!s)return;const n={...t};return delete n.tagName,rt(s,n)},b=(t,e)=>t.dispatchEvent(e),V=(t,e)=>{const s=getComputedStyle(t),n=e.replace("webkit","Webkit").replace(/([A-Z])/g,"-$1").toLowerCase();return s.getPropertyValue(n)},fi=t=>{const e=V(t,Xs),s=V(t,ii),n=s.includes("ms")?1:1e3,o=e&&e!=="none"?parseFloat(s)*n:0;return Number.isNaN(o)?0:o},Kt=t=>{const e=V(t,Xs),s=V(t,oi),n=s.includes("ms")?1:1e3,o=e&&e!=="none"?parseFloat(s)*n:0;return Number.isNaN(o)?0:o},P=(t,e)=>{let s=0;const n=new Event(ns),o=Kt(t),i=fi(t);if(o){const a=c=>{c.target===t&&(e.apply(t,[c]),t.removeEventListener(ns,a),s=1)};t.addEventListener(ns,a),setTimeout(()=>{s||b(t,n)},o+i+17)}else e.apply(t,[n])},dt=(t,e)=>t.focus(e),Zs=t=>["true",!0].includes(t)?!0:["false",!1].includes(t)?!1:["null","",null,void 0].includes(t)?null:t!==""&&!Number.isNaN(+t)?+t:t,Le=t=>Object.entries(t),Vt=t=>t.toLowerCase(),gi=(t,e,s,n)=>{const o={...s},i={...t.dataset},a={...e},c={},l="title";return Le(i).forEach(([r,d])=>{const p=n&&typeof r=="string"&&r.includes(n)?r.replace(n,"").replace(/[A-Z]/g,C=>Vt(C)):r;c[p]=Zs(d)}),Le(o).forEach(([r,d])=>{o[r]=Zs(d)}),Le(e).forEach(([r,d])=>{r in o?a[r]=o[r]:r in c?a[r]=c[r]:a[r]=r===l?mt(t,l):d}),a},qs=t=>Object.keys(t),$=(t,e)=>{const s=new CustomEvent(t,{cancelable:!0,bubbles:!0});return re(e)&&rt(s,e),s},et={passive:!0},kt=t=>t.offsetHeight,k=(t,e)=>{Le(e).forEach(([s,n])=>{if(n&&de(s)&&s.includes("--"))t.style.setProperty(s,n);else{const o={};o[s]=n,rt(t.style,o)}})},is=t=>re(t)&&t.constructor.name==="Map"||!1,pi=t=>typeof t=="number"||!1,bt=new Map,u={set:(t,e,s,n)=>{T(t)&&(n&&n.length?(bt.has(t)||bt.set(t,new Map),bt.get(t).set(n,setTimeout(e,s))):bt.set(t,setTimeout(e,s)))},get:(t,e)=>{if(!T(t))return null;const s=bt.get(t);return e&&s&&is(s)?s.get(e)||null:pi(s)?s:null},clear:(t,e)=>{if(!T(t))return;const s=bt.get(t);e&&e.length&&is(s)?(clearTimeout(s.get(e)),s.delete(e),s.size===0&&bt.delete(t)):(clearTimeout(s),bt.delete(t))}},he=(t,e)=>{const{width:s,height:n,top:o,right:i,bottom:a,left:c}=t.getBoundingClientRect();let l=1,r=1;if(e&&T(t)){const{offsetWidth:d,offsetHeight:p}=t;l=d>0?Math.round(s)/d:1,r=p>0?Math.round(n)/p:1}return{width:s/l,height:n/r,top:o/r,right:i/l,bottom:a/r,left:c/l,x:c/l,y:o/r}},wt=t=>w(t).body,ht=t=>w(t).documentElement,Gs=t=>I(t)&&t.constructor.name==="ShadowRoot"||!1,ui=t=>t.nodeName==="HTML"?t:T(t)&&t.assignedSlot||I(t)&&t.parentNode||Gs(t)&&t.host||ht(t);let Qs=0,Js=0;const Xt=new Map,tn=(t,e)=>{let s=e?Qs:Js;if(e){const n=tn(t),o=Xt.get(n)||new Map;Xt.has(n)||Xt.set(n,o),is(o)&&!o.has(e)?(o.set(e,s),Qs+=1):s=o.get(e)}else{const n=t.id||t;Xt.has(n)?s=Xt.get(n):(Xt.set(n,s),Js+=1)}return s},Yt=t=>{var e;return t?_s(t)?t.defaultView:I(t)?(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView:t:window},mi=t=>Array.isArray(t)||!1,en=t=>{if(!I(t))return!1;const{top:e,bottom:s}=he(t),{clientHeight:n}=ht(t);return e<=n&&s>=0},vi=t=>typeof t=="function"||!1,bi=t=>re(t)&&t.constructor.name==="NodeList"||!1,$t=t=>ht(t).dir==="rtl",wi=t=>I(t)&&["TABLE","TD","TH"].includes(t.nodeName)||!1,B=(t,e)=>t?t.closest(e)||B(t.getRootNode().host,e):null,D=(t,e)=>T(t)?t:(I(e)?e:w()).querySelector(t),as=(t,e)=>(I(e)?e:w()).getElementsByTagName(t),st=(t,e)=>(I(e)?e:w()).querySelectorAll(t),ft=(t,e)=>(e&&I(e)?e:w()).getElementsByClassName(t),sn=(t,e)=>t.matches(e),W="fade",m="show",Be="data-bs-dismiss",Re="alert",nn="Alert",$i="5.0.5";class nt{constructor(e,s){const n=D(e);if(!n)throw de(e)?Error(`${this.name} Error: "${e}" is not a valid selector.`):Error(`${this.name} Error: your target is not an instance of HTMLElement.`);const o=It.get(n,this.name);o&&o.dispose(),this.element=n,this.options=this.defaults&&qs(this.defaults).length?gi(n,this.defaults,s||{},"bs"):{},It.set(n,this.name,this)}get version(){return $i}get name(){return"BaseComponent"}get defaults(){return{}}dispose(){It.remove(this.element,this.name),qs(this).forEach(e=>{delete this[e]})}}const Ti=`.${Re}`,yi=`[${Be}="${Re}"]`,Ei=t=>z(t,nn),Ci=t=>new Ut(t),on=$(`close.bs.${Re}`),Hi=$(`closed.bs.${Re}`),an=t=>{const{element:e}=t;cs(t),b(e,Hi),t.dispose(),e.remove()},cs=(t,e)=>{const s=e?N:O,{dismiss:n,close:o}=t;n&&s(n,M,o)};class Ut extends nt{constructor(s){super(s);h(this,"dismiss");h(this,"close",()=>{const{element:s}=this;s&&f(s,m)&&(b(s,on),on.defaultPrevented||(v(s,m),f(s,W)?P(s,()=>an(this)):an(this)))});this.dismiss=D(yi,this.element),cs(this,!0)}get name(){return nn}dispose(){cs(this),super.dispose()}}h(Ut,"selector",Ti),h(Ut,"init",Ci),h(Ut,"getInstance",Ei);const E="active",at="data-bs-toggle",Si="button",cn="Button",Pi=`[${at}="${Si}"]`,Di=t=>z(t,cn),Ai=t=>new _t(t),ln=(t,e)=>{(e?N:O)(t.element,M,t.toggle)};class _t extends nt{constructor(s){super(s);h(this,"isActive",!1);h(this,"toggle",s=>{s&&s.preventDefault();const{element:n,isActive:o}=this;!f(n,"disabled")&&!mt(n,"disabled")&&((o?v:g)(n,E),L(n,Fs,o?"false":"true"),this.isActive=f(n,E))});const{element:n}=this;this.isActive=f(n,E),L(n,Fs,String(!!this.isActive)),ln(this,!0)}get name(){return cn}dispose(){ln(this),super.dispose()}}h(_t,"selector",Pi),h(_t,"init",Ai),h(_t,"getInstance",Di);const ls="data-bs-target",Nt="carousel",rn="Carousel",dn="data-bs-parent",xi="data-bs-container",X=t=>{const e=[ls,dn,xi,"href"],s=w(t);return e.map(n=>{const o=mt(t,n);return o?n===dn?B(t,o):D(o,s):null}).filter(n=>n)[0]},fe=`[data-bs-ride="${Nt}"]`,G=`${Nt}-item`,rs="data-bs-slide-to",Tt="data-bs-slide",yt="paused",hn={pause:"hover",keyboard:!1,touch:!0,interval:5e3},gt=t=>z(t,rn),Ii=t=>new Zt(t);let ge=0,We=0,ds=0;const hs=$(`slide.bs.${Nt}`),fs=$(`slid.bs.${Nt}`),fn=t=>{const{index:e,direction:s,element:n,slides:o,options:i}=t;if(t.isAnimating){const a=ps(t),c=s==="left"?"next":"prev",l=s==="left"?"start":"end";g(o[e],E),v(o[e],`${G}-${c}`),v(o[e],`${G}-${l}`),v(o[a],E),v(o[a],`${G}-${l}`),b(n,fs),u.clear(n,Tt),t.cycle&&!w(n).hidden&&i.interval&&!t.isPaused&&t.cycle()}};function ki(){const t=gt(this);t&&!t.isPaused&&!u.get(this,yt)&&g(this,yt)}function Ni(){const t=gt(this);t&&t.isPaused&&!u.get(this,yt)&&t.cycle()}function Oi(t){t.preventDefault();const e=B(this,fe)||X(this),s=gt(e);if(s&&!s.isAnimating){const n=+(mt(this,rs)||0);this&&!f(this,E)&&!Number.isNaN(n)&&s.to(n)}}function Mi(t){t.preventDefault();const e=B(this,fe)||X(this),s=gt(e);if(s&&!s.isAnimating){const n=mt(this,Tt);n==="next"?s.next():n==="prev"&&s.prev()}}const Li=({code:t,target:e})=>{const s=w(e),[n]=[...st(fe,s)].filter(i=>en(i)),o=gt(n);if(o&&!o.isAnimating&&!/textarea|input/i.test(e.nodeName)){const i=$t(n);t===(i?Vs:Ks)?o.prev():t===(i?Ks:Vs)&&o.next()}};function gn(t){const{target:e}=t,s=gt(this);s&&s.isTouch&&(s.indicator&&!s.indicator.contains(e)||!s.controls.includes(e))&&(t.stopImmediatePropagation(),t.stopPropagation(),t.preventDefault())}function Bi(t){const{target:e}=t,s=gt(this);if(s&&!s.isAnimating&&!s.isTouch){const{controls:n,indicators:o}=s;[...n,...o].every(i=>i===e||i.contains(e))||(ge=t.pageX,this.contains(e)&&(s.isTouch=!0,pn(s,!0)))}}const Ri=t=>{We=t.pageX},Wi=t=>{var o;const{target:e}=t,s=w(e),n=[...st(fe,s)].map(i=>gt(i)).find(i=>i.isTouch);if(n){const{element:i,index:a}=n,c=$t(i);ds=t.pageX,n.isTouch=!1,pn(n),!((o=s.getSelection())!=null&&o.toString().length)&&i.contains(e)&&Math.abs(ge-ds)>120&&(We<ge?n.to(a+(c?-1:1)):We>ge&&n.to(a+(c?1:-1))),ge=0,We=0,ds=0}},gs=(t,e)=>{const{indicators:s}=t;[...s].forEach(n=>v(n,E)),t.indicators[e]&&g(s[e],E)},pn=(t,e)=>{const{element:s}=t,n=e?N:O;n(w(s),ei,Ri,et),n(w(s),si,Wi,et)},un=(t,e)=>{const{element:s,options:n,slides:o,controls:i,indicators:a}=t,{touch:c,pause:l,interval:r,keyboard:d}=n,p=e?N:O;l&&r&&(p(s,Ae,ki),p(s,Qe,Ni)),c&&o.length>2&&(p(s,ti,Bi,et),p(s,Je,gn,{passive:!1}),p(s,ni,gn,{passive:!1})),i.length&&i.forEach(C=>{C&&p(C,M,Mi)}),a.length&&a.forEach(C=>{p(C,M,Oi)}),d&&p(w(s),De,Li)},ps=t=>{const{slides:e,element:s}=t,n=D(`.${G}.${E}`,s);return T(n)?[...e].indexOf(n):-1};class Zt extends nt{constructor(e,s){super(e,s);const{element:n}=this;this.direction=$t(n)?"right":"left",this.isTouch=!1,this.slides=ft(G,n);const{slides:o}=this;if(o.length>=2){const i=ps(this),a=[...o].find(r=>sn(r,`.${G}-next,.${G}-next`));this.index=i;const c=w(n);this.controls=[...st(`[${Tt}]`,n),...st(`[${Tt}][${ls}="#${n.id}"]`,c)].filter((r,d,p)=>d===p.indexOf(r)),this.indicator=D(`.${Nt}-indicators`,n),this.indicators=[...this.indicator?st(`[${rs}]`,this.indicator):[],...st(`[${rs}][${ls}="#${n.id}"]`,c)].filter((r,d,p)=>d===p.indexOf(r));const{options:l}=this;this.options.interval=l.interval===!0?hn.interval:l.interval,a?this.index=[...o].indexOf(a):i<0&&(this.index=0,g(o[0],E),this.indicators.length&&gs(this,0)),this.indicators.length&&gs(this,this.index),un(this,!0),l.interval&&this.cycle()}}get name(){return rn}get defaults(){return hn}get isPaused(){return f(this.element,yt)}get isAnimating(){return D(`.${G}-next,.${G}-prev`,this.element)!==null}cycle(){const{element:e,options:s,isPaused:n,index:o}=this;u.clear(e,Nt),n&&(u.clear(e,yt),v(e,yt)),u.set(e,()=>{this.element&&!this.isPaused&&!this.isTouch&&en(e)&&this.to(o+1)},s.interval,Nt)}pause(){const{element:e,options:s}=this;!this.isPaused&&s.interval&&(g(e,yt),u.set(e,()=>{},1,yt))}next(){this.isAnimating||this.to(this.index+1)}prev(){this.isAnimating||this.to(this.index-1)}to(e){const{element:s,slides:n,options:o}=this,i=ps(this),a=$t(s);let c=e;if(!this.isAnimating&&i!==c&&!u.get(s,Tt)){i<c||i===0&&c===n.length-1?this.direction=a?"right":"left":(i>c||i===n.length-1&&c===0)&&(this.direction=a?"left":"right");const{direction:l}=this;c<0?c=n.length-1:c>=n.length&&(c=0);const r=l==="left"?"next":"prev",d=l==="left"?"start":"end",p={relatedTarget:n[c],from:i,to:c,direction:l};rt(hs,p),rt(fs,p),b(s,hs),hs.defaultPrevented||(this.index=c,gs(this,c),Kt(n[c])&&f(s,"slide")?u.set(s,()=>{g(n[c],`${G}-${r}`),kt(n[c]),g(n[c],`${G}-${d}`),g(n[i],`${G}-${d}`),P(n[c],()=>this.slides&&this.slides.length&&fn(this))},0,Tt):(g(n[c],E),v(n[i],E),u.set(s,()=>{u.clear(s,Tt),s&&o.interval&&!this.isPaused&&this.cycle(),b(s,fs)},0,Tt)))}}dispose(){const{isAnimating:e}=this,s={...this,isAnimating:e};un(s),super.dispose(),s.isAnimating&&P(s.slides[s.index],()=>{fn(s)})}}h(Zt,"selector",fe),h(Zt,"init",Ii),h(Zt,"getInstance",gt);const Ot="collapsing",Y="collapse",mn="Collapse",Fi=`.${Y}`,vn=`[${at}="${Y}"]`,ji={parent:null},Fe=t=>z(t,mn),zi=t=>new qt(t),bn=$(`show.bs.${Y}`),Ki=$(`shown.bs.${Y}`),wn=$(`hide.bs.${Y}`),Vi=$(`hidden.bs.${Y}`),Xi=t=>{const{element:e,parent:s,triggers:n}=t;b(e,bn),bn.defaultPrevented||(u.set(e,le,17),s&&u.set(s,le,17),g(e,Ot),v(e,Y),k(e,{height:`${e.scrollHeight}px`}),P(e,()=>{u.clear(e),s&&u.clear(s),n.forEach(o=>L(o,He,"true")),v(e,Ot),g(e,Y),g(e,m),k(e,{height:""}),b(e,Ki)}))},$n=t=>{const{element:e,parent:s,triggers:n}=t;b(e,wn),wn.defaultPrevented||(u.set(e,le,17),s&&u.set(s,le,17),k(e,{height:`${e.scrollHeight}px`}),v(e,Y),v(e,m),g(e,Ot),kt(e),k(e,{height:"0px"}),P(e,()=>{u.clear(e),s&&u.clear(s),n.forEach(o=>L(o,He,"false")),v(e,Ot),g(e,Y),k(e,{height:""}),b(e,Vi)}))},Tn=(t,e)=>{const s=e?N:O,{triggers:n}=t;n.length&&n.forEach(o=>s(o,M,Yi))},Yi=t=>{const{target:e}=t,s=e&&B(e,vn),n=s&&X(s),o=n&&Fe(n);o&&o.toggle(),s&&s.tagName==="A"&&t.preventDefault()};class qt extends nt{constructor(e,s){super(e,s);const{element:n,options:o}=this,i=w(n);this.triggers=[...st(vn,i)].filter(a=>X(a)===n),this.parent=T(o.parent)?o.parent:de(o.parent)?X(n)||D(o.parent,i):null,Tn(this,!0)}get name(){return mn}get defaults(){return ji}toggle(){f(this.element,m)?this.hide():this.show()}hide(){const{triggers:e,element:s}=this;u.get(s)||($n(this),e.length&&e.forEach(n=>g(n,`${Y}d`)))}show(){const{element:e,parent:s,triggers:n}=this;let o,i;s&&(o=[...st(`.${Y}.${m}`,s)].find(a=>Fe(a)),i=o&&Fe(o)),(!s||!u.get(s))&&!u.get(e)&&(i&&o!==e&&($n(i),i.triggers.forEach(a=>{g(a,`${Y}d`)})),Xi(this),n.length&&n.forEach(a=>v(a,`${Y}d`)))}dispose(){Tn(this),super.dispose()}}h(qt,"selector",Fi),h(qt,"init",zi),h(qt,"getInstance",Fe);const Mt=["dropdown","dropup","dropstart","dropend"],yn="Dropdown",En="dropdown-menu",Cn=t=>{const e=B(t,"A");return t.tagName==="A"&&Me(t,"href")&&t.href.slice(-1)==="#"||e&&Me(e,"href")&&e.href.slice(-1)==="#"},[ot,us,ms,vs]=Mt,Hn=`[${at}="${ot}"]`,Gt=t=>z(t,yn),Ui=t=>new Qt(t),_i=`${En}-end`,Sn=[ot,us],Pn=[ms,vs],Dn=["A","BUTTON"],Zi={offset:5,display:"dynamic"},bs=$(`show.bs.${ot}`),An=$(`shown.bs.${ot}`),ws=$(`hide.bs.${ot}`),xn=$(`hidden.bs.${ot}`),In=$(`updated.bs.${ot}`),kn=t=>{const{element:e,menu:s,parentElement:n,options:o}=t,{offset:i}=o;if(V(s,"position")!=="static"){const a=$t(e),c=f(s,_i);["margin","top","bottom","left","right"].forEach(R=>{const Pt={};Pt[R]="",k(s,Pt)});let r=Mt.find(R=>f(n,R))||ot;const d={dropdown:[i,0,0],dropup:[0,0,i],dropstart:a?[-1,0,0,i]:[-1,i,0],dropend:a?[-1,i,0]:[-1,0,0,i]},p={dropdown:{top:"100%"},dropup:{top:"auto",bottom:"100%"},dropstart:a?{left:"100%",right:"auto"}:{left:"auto",right:"100%"},dropend:a?{left:"auto",right:"100%"}:{left:"100%",right:"auto"},menuStart:a?{right:"0",left:"auto"}:{right:"auto",left:"0"},menuEnd:a?{right:"auto",left:"0"}:{right:"0",left:"auto"}},{offsetWidth:C,offsetHeight:F}=s,{clientWidth:tt,clientHeight:y}=ht(e),{left:U,top:q,width:ie,height:ut}=he(e),S=U-C-i<0,it=U+C+ie+i>=tt,ct=q+F+i>=y,K=q+F+ut+i>=y,_=q-F-i<0,x=(!a&&c||a&&!c)&&U+ie-C<0,ae=(a&&c||!a&&!c)&&U+C>=tt;if(Pn.includes(r)&&S&&it&&(r=ot),r===ms&&(a?it:S)&&(r=vs),r===vs&&(a?S:it)&&(r=ms),r===us&&_&&!K&&(r=ot),r===ot&&K&&!_&&(r=us),Pn.includes(r)&&ct&&rt(p[r],{top:"auto",bottom:0}),Sn.includes(r)&&(x||ae)){let R={left:"auto",right:"auto"};!x&&ae&&!a&&(R={left:"auto",right:0}),x&&!ae&&a&&(R={left:0,right:"auto"}),R&&rt(p[r],R)}const St=d[r];k(s,{...p[r],margin:`${St.map(R=>R&&`${R}px`).join(" ")}`}),Sn.includes(r)&&c&&c&&k(s,p[!a&&x||a&&ae?"menuStart":"menuEnd"]),b(n,In)}},qi=t=>[...t.children].map(e=>{if(e&&Dn.includes(e.tagName))return e;const{firstElementChild:s}=e;return s&&Dn.includes(s.tagName)?s:null}).filter(e=>e),Nn=t=>{const{element:e,options:s}=t,n=t.open?N:O,o=w(e);n(o,M,Mn),n(o,qe,Mn),n(o,De,Qi),n(o,Qo,Ji),s.display==="dynamic"&&[Ie,xe].forEach(i=>{n(Yt(e),i,ta,et)})},On=(t,e)=>{(e?N:O)(t.element,M,Gi)},je=t=>{const e=[...Mt,"btn-group","input-group"].map(s=>ft(`${s} ${m}`,w(t))).find(s=>s.length);if(e&&e.length)return[...e[0].children].find(s=>Mt.some(n=>n===mt(s,at)))},Mn=t=>{const{target:e,type:s}=t;if(e&&T(e)){const n=je(e),o=n&&Gt(n);if(o){const{parentElement:i,menu:a}=o,c=i&&i.contains(e)&&(e.tagName==="form"||B(e,"form")!==null);[M,zs].includes(s)&&Cn(e)&&t.preventDefault(),!c&&s!==qe&&e!==n&&e!==a&&o.hide()}}},Gi=t=>{const{target:e}=t,s=e&&B(e,Hn),n=s&&Gt(s);n&&(n.toggle(),s&&Cn(s)&&t.preventDefault())},Qi=t=>{[ts,es].includes(t.code)&&t.preventDefault()};function Ji(t){const{code:e}=t,s=je(this),n=s&&Gt(s),{activeElement:o}=s&&w(s);if(n&&o){const{menu:i,open:a}=n,c=qi(i);if(c&&c.length&&[ts,es].includes(e)){let l=c.indexOf(o);o===s?l=0:e===es?l=l>1?l-1:0:e===ts&&(l=l<c.length-1?l+1:l),c[l]&&dt(c[l])}ss===e&&a&&(n.toggle(),dt(s))}}function ta(){const t=je(this),e=t&&Gt(t);e&&e.open&&kn(e)}class Qt extends nt{constructor(e,s){super(e,s);const{parentElement:n}=this.element,[o]=ft(En,n);o&&(this.parentElement=n,this.menu=o,On(this,!0))}get name(){return yn}get defaults(){return Zi}toggle(){this.open?this.hide():this.show()}show(){const{element:e,open:s,menu:n,parentElement:o}=this;if(!s){const i=je(e),a=i&&Gt(i);a&&a.hide(),[bs,An,In].forEach(c=>{c.relatedTarget=e}),b(o,bs),bs.defaultPrevented||(g(n,m),g(o,m),L(e,He,"true"),kn(this),this.open=!s,dt(e),Nn(this),b(o,An))}}hide(){const{element:e,open:s,menu:n,parentElement:o}=this;s&&([ws,xn].forEach(i=>{i.relatedTarget=e}),b(o,ws),ws.defaultPrevented||(v(n,m),v(o,m),L(e,He,"false"),this.open=!s,Nn(this),b(o,xn)))}dispose(){this.open&&this.hide(),On(this),super.dispose()}}h(Qt,"selector",Hn),h(Qt,"init",Ui),h(Qt,"getInstance",Gt);const Z="modal",$s="Modal",Ts="Offcanvas",ea="fixed-top",sa="fixed-bottom",Ln="sticky-top",Bn="position-sticky",Rn=t=>[...ft(ea,t),...ft(sa,t),...ft(Ln,t),...ft(Bn,t),...ft("is-fixed",t)],na=t=>{const e=wt(t);k(e,{paddingRight:"",overflow:""});const s=Rn(e);s.length&&s.forEach(n=>{k(n,{paddingRight:"",marginRight:""})})},Wn=t=>{const{clientWidth:e}=ht(t),{innerWidth:s}=Yt(t);return Math.abs(s-e)},Fn=(t,e)=>{const s=wt(t),n=parseInt(V(s,"paddingRight"),10),i=V(s,"overflow")==="hidden"&&n?0:Wn(t),a=Rn(s);e&&(k(s,{overflow:"hidden",paddingRight:`${n+i}px`}),a.length&&a.forEach(c=>{const l=V(c,"paddingRight");if(c.style.paddingRight=`${parseInt(l,10)+i}px`,[Ln,Bn].some(r=>f(c,r))){const r=V(c,"marginRight");c.style.marginRight=`${parseInt(r,10)-i}px`}}))},Q="offcanvas",Et=vt({tagName:"div",className:"popup-container"}),jn=(t,e)=>{const s=I(e)&&e.nodeName==="BODY",n=I(e)&&!s?e:Et,o=s?e:wt(t);I(t)&&(n===Et&&o.append(Et),n.append(t))},zn=(t,e)=>{const s=I(e)&&e.nodeName==="BODY",n=I(e)&&!s?e:Et;I(t)&&(t.remove(),n===Et&&!Et.children.length&&Et.remove())},ys=(t,e)=>{const s=I(e)&&e.nodeName!=="BODY"?e:Et;return I(t)&&s.contains(t)},Kn="backdrop",Vn=`${Z}-${Kn}`,Xn=`${Q}-${Kn}`,Yn=`.${Z}.${m}`,Es=`.${Q}.${m}`,A=vt("div"),Lt=t=>D(`${Yn},${Es}`,w(t)),Cs=t=>{const e=t?Vn:Xn;[Vn,Xn].forEach(s=>{v(A,s)}),g(A,e)},Un=(t,e,s)=>{Cs(s),jn(A,wt(t)),e&&g(A,W)},_n=()=>{f(A,m)||(g(A,m),kt(A))},ze=()=>{v(A,m)},Zn=t=>{Lt(t)||(v(A,W),zn(A,wt(t)),na(t))},qn=t=>T(t)&&V(t,"visibility")!=="hidden"&&t.offsetParent!==null,oa=`.${Z}`,Gn=`[${at}="${Z}"]`,ia=`[${Be}="${Z}"]`,Qn=`${Z}-static`,aa={backdrop:!0,keyboard:!0},pe=t=>z(t,$s),ca=t=>new Jt(t),Ke=$(`show.bs.${Z}`),Jn=$(`shown.bs.${Z}`),Hs=$(`hide.bs.${Z}`),to=$(`hidden.bs.${Z}`),eo=t=>{const{element:e}=t,s=Wn(e),{clientHeight:n,scrollHeight:o}=ht(e),{clientHeight:i,scrollHeight:a}=e,c=i!==a;if(!c&&s){const l=$t(e)?"paddingLeft":"paddingRight",r={};r[l]=`${s}px`,k(e,r)}Fn(e,c||n!==o)},so=(t,e)=>{const s=e?N:O,{element:n,update:o}=t;s(n,M,da),s(Yt(n),xe,o,et),s(w(n),De,ra)},no=(t,e)=>{const s=e?N:O,{triggers:n}=t;n.length&&n.forEach(o=>s(o,M,la))},oo=t=>{const{triggers:e,element:s,relatedTarget:n}=t;Zn(s),k(s,{paddingRight:"",display:""}),so(t);const o=Ke.relatedTarget||e.find(qn);o&&dt(o),to.relatedTarget=n,b(s,to)},io=t=>{const{element:e,relatedTarget:s}=t;dt(e),so(t,!0),Jn.relatedTarget=s,b(e,Jn)},ao=t=>{const{element:e,hasFade:s}=t;k(e,{display:"block"}),eo(t),Lt(e)||k(wt(e),{overflow:"hidden"}),g(e,m),xt(e,Se),L(e,Pe,"true"),s?P(e,()=>io(t)):io(t)},co=t=>{const{element:e,options:s,hasFade:n}=t;s.backdrop&&n&&f(A,m)&&!Lt(e)?(ze(),P(A,()=>oo(t))):oo(t)},la=t=>{const{target:e}=t,s=e&&B(e,Gn),n=s&&X(s),o=n&&pe(n);o&&(s&&s.tagName==="A"&&t.preventDefault(),o.relatedTarget=s,o.toggle())},ra=({code:t,target:e})=>{const s=D(Yn,w(e)),n=s&&pe(s);if(n){const{options:o}=n;o.keyboard&&t===ss&&f(s,m)&&(n.relatedTarget=null,n.hide())}};function da(t){var s,n;const e=pe(this);if(e&&!u.get(this)){const{options:o,isStatic:i,modalDialog:a}=e,{backdrop:c}=o,{target:l}=t,r=(n=(s=w(this))==null?void 0:s.getSelection())==null?void 0:n.toString().length,d=a.contains(l),p=l&&B(l,ia);i&&!d?u.set(this,()=>{g(this,Qn),P(a,()=>ha(e))},17):(p||!r&&!i&&!d&&c)&&(e.relatedTarget=p||null,e.hide(),t.preventDefault())}}const ha=t=>{const{element:e,modalDialog:s}=t,n=(Kt(s)||0)+17;v(e,Qn),u.set(e,()=>u.clear(e),n)};class Jt extends nt{constructor(s,n){super(s,n);h(this,"update",()=>{f(this.element,m)&&eo(this)});const{element:o}=this,i=D(`.${Z}-dialog`,o);i&&(this.modalDialog=i,this.triggers=[...st(Gn,w(o))].filter(a=>X(a)===o),this.isStatic=this.options.backdrop==="static",this.hasFade=f(o,W),this.relatedTarget=null,no(this,!0))}get name(){return $s}get defaults(){return aa}toggle(){f(this.element,m)?this.hide():this.show()}show(){const{element:s,options:n,hasFade:o,relatedTarget:i}=this,{backdrop:a}=n;let c=0;if(!f(s,m)&&(Ke.relatedTarget=i||void 0,b(s,Ke),!Ke.defaultPrevented)){const l=Lt(s);if(l&&l!==s){const r=pe(l)||z(l,Ts);r&&r.hide()}a?(ys(A)?Cs(!0):Un(s,o,!0),c=Kt(A),_n(),setTimeout(()=>ao(this),c)):(ao(this),l&&f(A,m)&&ze())}}hide(){const{element:s,hasFade:n,relatedTarget:o}=this;f(s,m)&&(Hs.relatedTarget=o||void 0,b(s,Hs),Hs.defaultPrevented||(v(s,m),L(s,Se,"true"),xt(s,Pe),n?P(s,()=>co(this)):co(this)))}dispose(){const s={...this},{element:n,modalDialog:o}=s,i=()=>setTimeout(()=>super.dispose(),17);no(s),this.hide(),f(n,"fade")?P(o,i):i()}}h(Jt,"selector",oa),h(Jt,"init",ca),h(Jt,"getInstance",pe);const fa=`.${Q}`,Ss=`[${at}="${Q}"]`,ga=`[${Be}="${Q}"]`,Ve=`${Q}-toggling`,pa={backdrop:!0,keyboard:!0,scroll:!1},ue=t=>z(t,Ts),ua=t=>new te(t),Xe=$(`show.bs.${Q}`),lo=$(`shown.bs.${Q}`),Ps=$(`hide.bs.${Q}`),ro=$(`hidden.bs.${Q}`),ma=t=>{const{element:e}=t,{clientHeight:s,scrollHeight:n}=ht(e);Fn(e,s!==n)},ho=(t,e)=>{const s=e?N:O;t.triggers.forEach(n=>s(n,M,ba))},fo=(t,e)=>{const s=e?N:O,n=w(t.element);s(n,De,$a),s(n,M,wa)},go=t=>{const{element:e,options:s}=t;s.scroll||(ma(t),k(wt(e),{overflow:"hidden"})),g(e,Ve),g(e,m),k(e,{visibility:"visible"}),P(e,()=>Ta(t))},va=t=>{const{element:e,options:s}=t,n=Lt(e);e.blur(),!n&&s.backdrop&&f(A,m)?(ze(),P(A,()=>po(t))):po(t)},ba=t=>{const e=B(t.target,Ss),s=e&&X(e),n=s&&ue(s);n&&(n.relatedTarget=e,n.toggle(),e&&e.tagName==="A"&&t.preventDefault())},wa=t=>{const{target:e}=t,s=D(Es,w(e)),n=D(ga,s),o=s&&ue(s);if(o){const{options:i,triggers:a}=o,{backdrop:c}=i,l=B(e,Ss),r=w(s).getSelection();(!A.contains(e)||c!=="static")&&(!(r&&r.toString().length)&&(!s.contains(e)&&c&&(!l||a.includes(e))||n&&n.contains(e))&&(o.relatedTarget=n&&n.contains(e)?n:null,o.hide()),l&&l.tagName==="A"&&t.preventDefault())}},$a=({code:t,target:e})=>{const s=D(Es,w(e)),n=s&&ue(s);n&&n.options.keyboard&&t===ss&&(n.relatedTarget=null,n.hide())},Ta=t=>{const{element:e}=t;v(e,Ve),xt(e,Se),L(e,Pe,"true"),L(e,"role","dialog"),b(e,lo),fo(t,!0),dt(e)},po=t=>{const{element:e,triggers:s}=t;L(e,Se,"true"),xt(e,Pe),xt(e,"role"),k(e,{visibility:""});const n=Xe.relatedTarget||s.find(qn);n&&dt(n),Zn(e),b(e,ro),v(e,Ve),Lt(e)||fo(t)};class te extends nt{constructor(e,s){super(e,s);const{element:n}=this;this.triggers=[...st(Ss,w(n))].filter(o=>X(o)===n),this.relatedTarget=null,ho(this,!0)}get name(){return Ts}get defaults(){return pa}toggle(){f(this.element,m)?this.hide():this.show()}show(){const{element:e,options:s,relatedTarget:n}=this;let o=0;if(!f(e,m)&&(Xe.relatedTarget=n||void 0,lo.relatedTarget=n||void 0,b(e,Xe),!Xe.defaultPrevented)){const i=Lt(e);if(i&&i!==e){const a=ue(i)||z(i,$s);a&&a.hide()}s.backdrop?(ys(A)?Cs():Un(e,!0),o=Kt(A),_n(),setTimeout(()=>go(this),o)):(go(this),i&&f(A,m)&&ze())}}hide(){const{element:e,relatedTarget:s}=this;f(e,m)&&(Ps.relatedTarget=s||void 0,ro.relatedTarget=s||void 0,b(e,Ps),Ps.defaultPrevented||(g(e,Ve),v(e,m),va(this)))}dispose(){const e={...this},{element:s,options:n}=e,o=n.backdrop?Kt(A):0,i=()=>setTimeout(()=>super.dispose(),o+17);ho(e),this.hide(),f(s,m)?P(s,i):i()}}h(te,"selector",fa),h(te,"init",ua),h(te,"getInstance",ue);const Bt="popover",Ye="Popover",pt="tooltip",uo=t=>{const e=t===pt,s=e?`${t}-inner`:`${t}-body`,n=e?"":`<h3 class="${t}-header"></h3>`,o=`<div class="${t}-arrow"></div>`,i=`<div class="${s}"></div>`;return`<div class="${t}" role="${pt}">${n+o+i}</div>`},mo={top:"top",bottom:"bottom",left:"start",right:"end"},Ds=t=>{const e=/\b(top|bottom|start|end)+/,{element:s,tooltip:n,container:o,options:i,arrow:a}=t;if(n){const c={...mo},l=$t(s);k(n,{top:"",left:"",right:"",bottom:""});const r=t.name===Ye,{offsetWidth:d,offsetHeight:p}=n,{clientWidth:C,clientHeight:F,offsetWidth:tt}=ht(s);let{placement:y}=i;const{clientWidth:U,offsetWidth:q}=o,ut=V(o,"position")==="fixed",S=Math.abs(ut?U-q:C-tt),it=l&&ut?S:0,ct=C-(l?0:S)-1,{width:K,height:_,left:x,right:ae,top:St}=he(s,!0),{x:R,y:Pt}={x,y:St};k(a,{top:"",left:"",right:"",bottom:""});let Ft=0,$e="",Dt=0,Ms="",ce="",Ue="",Ls="";const jt=a.offsetWidth||0,At=a.offsetHeight||0,Bs=jt/2;let Te=St-p-At<0,ye=St+p+_+At>=F,Ee=x-d-jt<it,Ce=x+d+K+jt>=ct;const _e=["left","right"],Rs=["top","bottom"];Te=_e.includes(y)?St+_/2-p/2-At<0:Te,ye=_e.includes(y)?St+p/2+_/2+At>=F:ye,Ee=Rs.includes(y)?x+K/2-d/2<it:Ee,Ce=Rs.includes(y)?x+d/2+K/2>=ct:Ce,y=_e.includes(y)&&Ee&&Ce?"top":y,y=y==="top"&&Te?"bottom":y,y=y==="bottom"&&ye?"top":y,y=y==="left"&&Ee?"right":y,y=y==="right"&&Ce?"left":y,n.className.includes(y)||(n.className=n.className.replace(e,c[y])),_e.includes(y)?(y==="left"?Dt=R-d-(r?jt:0):Dt=R+K+(r?jt:0),Te&&ye?(Ft=0,$e=0,ce=St+_/2-At/2):Te?(Ft=Pt,$e="",ce=_/2-jt):ye?(Ft=Pt-p+_,$e="",ce=p-_/2-jt):(Ft=Pt-p/2+_/2,ce=p/2-At/2)):Rs.includes(y)&&(y==="top"?Ft=Pt-p-(r?At:0):Ft=Pt+_+(r?At:0),Ee?(Dt=0,Ue=R+K/2-Bs):Ce?(Dt="auto",Ms=0,Ls=K/2+ct-ae-Bs):(Dt=R-d/2+K/2,Ue=d/2-Bs)),k(n,{top:`${Ft}px`,bottom:$e===""?"":`${$e}px`,left:Dt==="auto"?Dt:`${Dt}px`,right:Ms!==""?`${Ms}px`:""}),T(a)&&(ce!==""&&(a.style.top=`${ce}px`),Ue!==""?a.style.left=`${Ue}px`:Ls!==""&&(a.style.right=`${Ls}px`));const ec=$(`updated.bs.${Vt(t.name)}`);b(s,ec)}},As={template:uo(pt),title:"",customClass:"",trigger:"hover focus",placement:"top",sanitizeFn:void 0,animation:!0,delay:200,container:document.body,content:"",dismissible:!1,btnClose:""},vo="data-original-title",Rt="Tooltip",Ct=(t,e,s)=>{if(de(e)&&e.length){let n=e.trim();vi(s)&&(n=s(n));const i=new DOMParser().parseFromString(n,"text/html");t.append(...i.body.childNodes)}else T(e)?t.append(e):(bi(e)||mi(e)&&e.every(I))&&t.append(...e)},ya=t=>{const e=t.name===Rt,{id:s,element:n,options:o}=t,{title:i,placement:a,template:c,animation:l,customClass:r,sanitizeFn:d,dismissible:p,content:C,btnClose:F}=o,tt=e?pt:Bt,y={...mo};let U=[],q=[];$t(n)&&(y.left="end",y.right="start");const ie=`bs-${tt}-${y[a]}`;let ut;if(T(c))ut=c;else{const it=vt("div");Ct(it,c,d),ut=it.firstChild}t.tooltip=T(ut)?ut.cloneNode(!0):void 0;const{tooltip:S}=t;if(S){L(S,"id",s),L(S,"role",pt);const it=e?`${pt}-inner`:`${Bt}-body`,ct=e?null:D(`.${Bt}-header`,S),K=D(`.${it}`,S);t.arrow=D(`.${tt}-arrow`,S);const{arrow:_}=t;if(T(i))U=[i.cloneNode(!0)];else{const x=vt("div");Ct(x,i,d),U=[...x.childNodes]}if(T(C))q=[C.cloneNode(!0)];else{const x=vt("div");Ct(x,C,d),q=[...x.childNodes]}if(p)if(i)if(T(F))U=[...U,F.cloneNode(!0)];else{const x=vt("div");Ct(x,F,d),U=[...U,x.firstChild]}else if(ct&&ct.remove(),T(F))q=[...q,F.cloneNode(!0)];else{const x=vt("div");Ct(x,F,d),q=[...q,x.firstChild]}e?i&&K&&Ct(K,i,d):(i&&ct&&Ct(ct,U,d),C&&K&&Ct(K,q,d),t.btn=D(".btn-close",S)||void 0),g(S,"position-fixed"),g(_,"position-absolute"),f(S,tt)||g(S,tt),l&&!f(S,W)&&g(S,W),r&&!f(S,r)&&g(S,r),f(S,ie)||g(S,ie)}},Ea=t=>{const e=["HTML","BODY"],s=[];let{parentNode:n}=t;for(;n&&!e.includes(n.nodeName);)n=ui(n),Gs(n)||wi(n)||s.push(n);return s.find((o,i)=>V(o,"position")!=="relative"&&s.slice(i+1).every(a=>V(a,"position")==="static")?o:null)||w(t).body},Ca=`[${at}="${pt}"],[data-tip="${pt}"]`,bo="title";let wo=t=>z(t,Rt);const Ha=t=>new Ht(t),Sa=t=>{const{element:e,tooltip:s,container:n,offsetParent:o}=t;xt(e,Ws),zn(s,n===o?n:o)},me=t=>{const{tooltip:e,container:s,offsetParent:n}=t;return e&&ys(e,s===n?s:n)},Pa=(t,e)=>{const{element:s}=t;ve(t),Me(s,vo)&&t.name===Rt&&Co(t),e&&e()},$o=(t,e)=>{const s=e?N:O,{element:n}=t;s(w(n),Je,t.handleTouch,et),[Ie,xe].forEach(o=>{s(Yt(n),o,t.update,et)})},To=t=>{const{element:e}=t,s=$(`shown.bs.${Vt(t.name)}`);$o(t,!0),b(e,s),u.clear(e,"in")},yo=t=>{const{element:e}=t,s=$(`hidden.bs.${Vt(t.name)}`);$o(t),Sa(t),b(e,s),u.clear(e,"out")},ve=(t,e)=>{const s=e?N:O,{element:n,options:o,btn:i}=t,{trigger:a}=o,l=!!(t.name!==Rt&&o.dismissible);a.includes("manual")||(t.enabled=!!e,a.split(" ").forEach(d=>{d===Jo?(s(n,zs,t.handleShow),s(n,Ae,t.handleShow),l||(s(n,Qe,t.handleHide),s(w(n),Je,t.handleTouch,et))):d===M?s(n,d,l?t.handleShow:t.toggle):d===qe&&(s(n,Ge,t.handleShow),l||s(n,js,t.handleHide),li&&s(n,M,t.handleFocus)),l&&i&&s(i,M,t.handleHide)}))},Eo=(t,e)=>{const s=e?N:O,{element:n,container:o,offsetParent:i}=t,{offsetHeight:a,scrollHeight:c}=o,l=B(n,`.${Z}`),r=B(n,`.${Q}`),d=Yt(n),C=o===i&&a!==c?o:d;s(C,xe,t.update,et),s(C,Ie,t.update,et),l&&s(l,`hide.bs.${Z}`,t.handleHide),r&&s(r,`hide.bs.${Q}`,t.handleHide)},Co=(t,e)=>{const s=[vo,bo],{element:n}=t;L(n,s[e?0:1],e||mt(n,s[0])||""),xt(n,s[e?1:0])};class Ht extends nt{constructor(s,n){super(s,n);h(this,"handleFocus",()=>dt(this.element));h(this,"handleShow",()=>this.show());h(this,"handleHide",()=>this.hide());h(this,"update",()=>{Ds(this)});h(this,"toggle",()=>{const{tooltip:s}=this;s&&!me(this)?this.show():this.hide()});h(this,"handleTouch",({target:s})=>{const{tooltip:n,element:o}=this;n&&n.contains(s)||s===o||s&&o.contains(s)||this.hide()});const{element:o}=this,i=this.name===Rt,a=i?pt:Bt,c=i?Rt:Ye;wo=r=>z(r,c),this.enabled=!0,this.id=`${a}-${tn(o,a)}`;const{options:l}=this;!l.title&&i||!i&&!l.content||(rt(As,{titleAttr:""}),Me(o,bo)&&i&&typeof l.title=="string"&&Co(this,l.title),this.container=Ea(o),this.offsetParent=["sticky","fixed"].some(r=>V(this.container,"position")===r)?this.container:w(this.element).body,ya(this),ve(this,!0))}get name(){return Rt}get defaults(){return As}show(){const{options:s,tooltip:n,element:o,container:i,offsetParent:a,id:c}=this,{animation:l}=s,r=u.get(o,"out"),d=i===a?i:a;u.clear(o,"out"),n&&!r&&!me(this)&&u.set(o,()=>{const p=$(`show.bs.${Vt(this.name)}`);b(o,p),p.defaultPrevented||(jn(n,d),L(o,Ws,`#${c}`),this.update(),Eo(this,!0),f(n,m)||g(n,m),l?P(n,()=>To(this)):To(this))},17,"in")}hide(){const{options:s,tooltip:n,element:o}=this,{animation:i,delay:a}=s;u.clear(o,"in"),n&&me(this)&&u.set(o,()=>{const c=$(`hide.bs.${Vt(this.name)}`);b(o,c),c.defaultPrevented||(this.update(),v(n,m),Eo(this),i?P(n,()=>yo(this)):yo(this))},a+17,"out")}enable(){const{enabled:s}=this;s||(ve(this,!0),this.enabled=!s)}disable(){const{tooltip:s,options:n,enabled:o}=this,{animation:i}=n;o&&(s&&me(this)&&i?(this.hide(),P(s,()=>ve(this))):ve(this),this.enabled=!o)}toggleEnabled(){this.enabled?this.disable():this.enable()}dispose(){const{tooltip:s,options:n}=this,o={...this,name:this.name},i=()=>setTimeout(()=>Pa(o,()=>super.dispose()),17);n.animation&&me(o)?(this.options.delay=0,this.hide(),P(s,i)):i()}}h(Ht,"selector",Ca),h(Ht,"init",Ha),h(Ht,"getInstance",wo),h(Ht,"styleTip",Ds);const Da=`[${at}="${Bt}"],[data-tip="${Bt}"]`,Aa=rt({},As,{template:uo(Bt),content:"",dismissible:!1,btnClose:'<button class="btn-close" aria-label="Close"></button>'}),xa=t=>z(t,Ye),Ia=t=>new Wt(t);class Wt extends Ht{constructor(s,n){super(s,n);h(this,"show",()=>{super.show();const{options:s,btn:n}=this;s.dismissible&&n&&setTimeout(()=>dt(n),17)})}get name(){return Ye}get defaults(){return Aa}}h(Wt,"selector",Da),h(Wt,"init",Ia),h(Wt,"getInstance",xa),h(Wt,"styleTip",Ds);const ka="scrollspy",Ho="ScrollSpy",Na='[data-bs-spy="scroll"]',Oa={offset:10,target:null},Ma=t=>z(t,Ho),La=t=>new ee(t),So=$(`activate.bs.${ka}`),Ba=t=>{const{target:e,scrollTarget:s,options:n,itemsLength:o,scrollHeight:i,element:a}=t,{offset:c}=n,l=os(s),r=e&&as("A",e),d=s?Po(s):i;if(t.scrollTop=l?s.scrollY:s.scrollTop,r&&(d!==i||o!==r.length)){let p,C,F;t.items=[],t.offsets=[],t.scrollHeight=d,t.maxScroll=t.scrollHeight-Ra(t),[...r].forEach(tt=>{p=mt(tt,"href"),C=p&&p.charAt(0)==="#"&&p.slice(-1)!=="#"&&D(p,w(a)),C&&(t.items.push(tt),F=he(C),t.offsets.push((l?F.top+t.scrollTop:C.offsetTop)-c))}),t.itemsLength=t.items.length}},Po=t=>T(t)?t.scrollHeight:ht(t).scrollHeight,Ra=({element:t,scrollTarget:e})=>os(e)?e.innerHeight:he(t).height,Do=t=>{[...as("A",t)].forEach(e=>{f(e,E)&&v(e,E)})},Ao=(t,e)=>{const{target:s,element:n}=t;T(s)&&Do(s),t.activeItem=e,g(e,E);const o=[];let i=e;for(;i!==wt(n);)i=i.parentElement,(f(i,"nav")||f(i,"dropdown-menu"))&&o.push(i);o.forEach(a=>{const c=a.previousElementSibling;c&&!f(c,E)&&g(c,E)}),So.relatedTarget=e,b(n,So)},xo=(t,e)=>{(e?N:O)(t.scrollTarget,Ie,t.refresh,et)};class ee extends nt{constructor(s,n){super(s,n);h(this,"refresh",()=>{const{target:s}=this;if(T(s)&&s.offsetHeight>0){Ba(this);const{scrollTop:n,maxScroll:o,itemsLength:i,items:a,activeItem:c}=this;if(n>=o){const r=a[i-1];c!==r&&Ao(this,r);return}const{offsets:l}=this;if(c&&n<l[0]&&l[0]>0){this.activeItem=null,s&&Do(s);return}a.forEach((r,d)=>{c!==r&&n>=l[d]&&(typeof l[d+1]>"u"||n<l[d+1])&&Ao(this,r)})}});const{element:o,options:i}=this;this.target=D(i.target,w(o)),this.target&&(this.scrollTarget=o.clientHeight<o.scrollHeight?o:Yt(o),this.scrollHeight=Po(this.scrollTarget),xo(this,!0),this.refresh())}get name(){return Ho}get defaults(){return Oa}dispose(){xo(this),super.dispose()}}h(ee,"selector",Na),h(ee,"init",La),h(ee,"getInstance",Ma);const be="tab",Io="Tab",ko=`[${at}="${be}"]`,No=t=>z(t,Io),Wa=t=>new se(t),xs=$(`show.bs.${be}`),Oo=$(`shown.bs.${be}`),Is=$(`hide.bs.${be}`),Mo=$(`hidden.bs.${be}`),we=new Map,Lo=t=>{const{tabContent:e,nav:s}=t;e&&f(e,Ot)&&(e.style.height="",v(e,Ot)),s&&u.clear(s)},Bo=t=>{const{element:e,tabContent:s,content:n,nav:o}=t,{tab:i}=T(o)&&we.get(o)||{tab:null};if(s&&n&&f(n,W)){const{currentHeight:a,nextHeight:c}=we.get(e)||{currentHeight:0,nextHeight:0};a===c?Lo(t):setTimeout(()=>{s.style.height=`${c}px`,kt(s),P(s,()=>Lo(t))},50)}else o&&u.clear(o);Oo.relatedTarget=i,b(e,Oo)},Ro=t=>{const{element:e,content:s,tabContent:n,nav:o}=t,{tab:i,content:a}=o&&we.get(o)||{tab:null,content:null};let c=0;if(n&&s&&f(s,W)&&([a,s].forEach(l=>{T(l)&&g(l,"overflow-hidden")}),c=T(a)?a.scrollHeight:0),xs.relatedTarget=i,Mo.relatedTarget=e,b(e,xs),!xs.defaultPrevented){if(s&&g(s,E),a&&v(a,E),n&&s&&f(s,W)){const l=s.scrollHeight;we.set(e,{currentHeight:c,nextHeight:l,tab:null,content:null}),g(n,Ot),n.style.height=`${c}px`,kt(n),[a,s].forEach(r=>{r&&v(r,"overflow-hidden")})}s&&s&&f(s,W)?setTimeout(()=>{g(s,m),P(s,()=>{Bo(t)})},1):(s&&g(s,m),Bo(t)),i&&b(i,Mo)}},Wo=t=>{const{nav:e}=t;if(!T(e))return{tab:null,content:null};const s=ft(E,e);let n=null;s.length===1&&!Mt.some(i=>f(s[0].parentElement,i))?[n]=s:s.length>1&&(n=s[s.length-1]);const o=T(n)?X(n):null;return{tab:n,content:o}},Fo=t=>{if(!T(t))return null;const e=B(t,`.${Mt.join(",.")}`);return e?D(`.${Mt[0]}-toggle`,e):null},jo=(t,e)=>{(e?N:O)(t.element,M,Fa)},Fa=t=>{const e=No(t.target);e&&(t.preventDefault(),e.show())};class se extends nt{constructor(e){super(e);const{element:s}=this,n=X(s);if(n){const o=B(s,".nav"),i=B(n,".tab-content");this.nav=o,this.content=n,this.tabContent=i,this.dropdown=Fo(s);const{tab:a}=Wo(this);if(o&&!a){const c=D(ko,o),l=c&&X(c);l&&(g(c,E),g(l,m),g(l,E),L(s,Ze,"true"))}jo(this,!0)}}get name(){return Io}show(){const{element:e,content:s,nav:n,dropdown:o}=this;if(!(n&&u.get(n))&&!f(e,E)){const{tab:i,content:a}=Wo(this);if(n&&we.set(n,{tab:i,content:a,currentHeight:0,nextHeight:0}),Is.relatedTarget=e,T(i)&&(b(i,Is),!Is.defaultPrevented)){g(e,E),L(e,Ze,"true");const c=T(i)&&Fo(i);if(c&&f(c,E)&&v(c,E),n){const l=()=>{i&&(v(i,E),L(i,Ze,"false")),o&&!f(o,E)&&g(o,E)};a&&(f(a,W)||s&&f(s,W))?u.set(n,l,1):l()}a&&(v(a,m),f(a,W)?P(a,()=>Ro(this)):Ro(this))}}}dispose(){jo(this),super.dispose()}}h(se,"selector",ko),h(se,"init",Wa),h(se,"getInstance",No);const J="toast",zo="Toast",ja=`.${J}`,za=`[${Be}="${J}"]`,Ko=`[${at}="${J}"]`,ne="showing",Vo="hide",Ka={animation:!0,autohide:!0,delay:5e3},ks=t=>z(t,zo),Va=t=>new oe(t),Xo=$(`show.bs.${J}`),Xa=$(`shown.bs.${J}`),Yo=$(`hide.bs.${J}`),Ya=$(`hidden.bs.${J}`),Uo=t=>{const{element:e,options:s}=t;v(e,ne),u.clear(e,ne),b(e,Xa),s.autohide&&u.set(e,()=>t.hide(),s.delay,J)},_o=t=>{const{element:e}=t;v(e,ne),v(e,m),g(e,Vo),u.clear(e,J),b(e,Ya)},Ua=t=>{const{element:e,options:s}=t;g(e,ne),s.animation?(kt(e),P(e,()=>_o(t))):_o(t)},_a=t=>{const{element:e,options:s}=t;u.set(e,()=>{v(e,Vo),kt(e),g(e,m),g(e,ne),s.animation?P(e,()=>Uo(t)):Uo(t)},17,ne)},Zo=(t,e)=>{const s=e?N:O,{element:n,triggers:o,dismiss:i,options:a,hide:c}=t;i&&s(i,M,c),a.autohide&&[Ge,js,Ae,Qe].forEach(l=>s(n,l,Ga)),o.length&&o.forEach(l=>s(l,M,qa))},Za=t=>{u.clear(t.element,J),Zo(t)},qa=t=>{const{target:e}=t,s=e&&B(e,Ko),n=s&&X(s),o=n&&ks(n);o&&(s&&s.tagName==="A"&&t.preventDefault(),o.relatedTarget=s,o.show())},Ga=t=>{const e=t.target,s=ks(e),{type:n,relatedTarget:o}=t;s&&e!==o&&!e.contains(o)&&([Ae,Ge].includes(n)?u.clear(e,J):u.set(e,()=>s.hide(),s.options.delay,J))};class oe extends nt{constructor(s,n){super(s,n);h(this,"show",()=>{const{element:s,isShown:n}=this;s&&!n&&(b(s,Xo),Xo.defaultPrevented||_a(this))});h(this,"hide",()=>{const{element:s,isShown:n}=this;s&&n&&(b(s,Yo),Yo.defaultPrevented||Ua(this))});const{element:o,options:i}=this;i.animation&&!f(o,W)?g(o,W):!i.animation&&f(o,W)&&v(o,W),this.dismiss=D(za,o),this.triggers=[...st(Ko,w(o))].filter(a=>X(a)===o),Zo(this,!0)}get name(){return zo}get defaults(){return Ka}get isShown(){return f(this.element,m)}dispose(){const{element:s,isShown:n}=this;n&&v(s,m),Za(this),super.dispose()}}h(oe,"selector",ja),h(oe,"init",Va),h(oe,"getInstance",ks);const Ns=new Map;[Ut,_t,Zt,qt,Qt,Jt,te,Wt,ee,se,oe,Ht].forEach(t=>Ns.set(t.prototype.name,t));const Qa=(t,e)=>{[...e].forEach(s=>t(s))},Ja=(t,e)=>{const s=It.getAllFor(t);s&&[...s].forEach(([n,o])=>{e.contains(n)&&o.dispose()})},Os=t=>{const e=t&&t.nodeName?t:document,s=[...as("*",e)];Ns.forEach(n=>{const{init:o,selector:i}=n;Qa(o,s.filter(a=>sn(a,i)))})},tc=t=>{const e=t&&t.nodeName?t:document;Ns.forEach(s=>{Ja(s.prototype.name,e)})};return document.body?Os():N(document,"DOMContentLoaded",()=>Os(),{once:!0}),H.Alert=Ut,H.Button=_t,H.Carousel=Zt,H.Collapse=qt,H.Dropdown=Qt,H.Listener=qo,H.Modal=Jt,H.Offcanvas=te,H.Popover=Wt,H.ScrollSpy=ee,H.Tab=se,H.Toast=oe,H.Tooltip=Ht,H.initCallback=Os,H.removeDataAPI=tc,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"}),H}({}); | ||
//# sourceMappingURL=bootstrap-native.js.map |
{ | ||
"name": "bootstrap.native", | ||
"version": "5.0.4", | ||
"version": "5.0.5", | ||
"author": "thednp", | ||
@@ -8,7 +8,12 @@ "license": "MIT", | ||
"homepage": "https://thednp.github.io/bootstrap.native/", | ||
"source": "src/index.ts", | ||
"main": "dist/bootstrap-native.js", | ||
"module": "dist/bootstrap-native.cjs", | ||
"esnext": "dist/bootstrap-native.mjs", | ||
"types": "dist/bootstrap-native.d.ts", | ||
"source": "./src/index.ts", | ||
"main": "./dist/bootstrap-native.js", | ||
"module": "./dist/bootstrap-native.mjs", | ||
"types": "./dist/bootstrap-native.d.ts", | ||
"exports": { | ||
".": { | ||
"require": "./dist/bootstrap-native.cjs", | ||
"import": "./dist/bootstrap-native.mjs" | ||
} | ||
}, | ||
"scripts": { | ||
@@ -19,2 +24,3 @@ "format": "prettier --write \"src/**/*.ts\"", | ||
"test": "npm run pre-test && npx cypress run", | ||
"dev": "vite --open ./docs/index-dev.html --port 8577", | ||
"cypress": "npx cypress open", | ||
@@ -48,14 +54,14 @@ "coverage:report": "nyc report --reporter=lcov --reporter=json --reporter=text --reporter=json-summary", | ||
"@thednp/event-listener": "^2.0.0-alpha8", | ||
"@thednp/shorty": "^2.0.0-alpha12" | ||
"@thednp/shorty": "^2.0.0-alpha14" | ||
}, | ||
"devDependencies": { | ||
"@bahmutov/cypress-esbuild-preprocessor": "^2.1.5", | ||
"@bahmutov/cypress-esbuild-preprocessor": "^2.2.0", | ||
"@cypress/code-coverage": "^3.10.0", | ||
"@types/istanbul-lib-instrument": "^1.7.4", | ||
"@typescript-eslint/eslint-plugin": "^5.47.0", | ||
"@typescript-eslint/parser": "^5.47.0", | ||
"cypress": "^12.6.0", | ||
"@typescript-eslint/eslint-plugin": "^5.55.0", | ||
"@typescript-eslint/parser": "^5.55.0", | ||
"cypress": "^12.8.1", | ||
"dts-bundle-generator": "^7.2.0", | ||
"eslint": "^8.30.0", | ||
"eslint-plugin-jsdoc": "^39.6.4", | ||
"eslint": "^8.36.0", | ||
"eslint-plugin-jsdoc": "^40.0.3", | ||
"eslint-plugin-prefer-arrow": "^1.2.3", | ||
@@ -67,7 +73,7 @@ "eslint-plugin-prettier": "^4.2.1", | ||
"nyc": "^15.1.0", | ||
"prettier": "^2.8.3", | ||
"rimraf": "^3.0.2", | ||
"typescript": "^4.9.4", | ||
"vite": "^4.1.4" | ||
"prettier": "^2.8.4", | ||
"rimraf": "^4.4.0", | ||
"typescript": "^5.0.2", | ||
"vite": "^4.2.0" | ||
} | ||
} |
@@ -6,7 +6,7 @@ # BSN | ||
[![jsDeliver](https://img.shields.io/jsdelivr/npm/hw/bootstrap.native)](https://www.jsdelivr.com/package/npm/bootstrap.native) | ||
[![typescript version](https://img.shields.io/badge/typescript-4.9.4-brightgreen)](https://www.typescriptlang.org/) | ||
[![eslint version](https://img.shields.io/badge/eslint-8.30.0-brightgreen)](https://github.com/eslint) | ||
[![cypress version](https://img.shields.io/badge/cypress-12.6.0-brightgreen)](https://www.cypress.io/) | ||
[![vite version](https://img.shields.io/badge/vite-4.1.4-brightgreen)](https://vitejs.dev/) | ||
[![prettier version](https://img.shields.io/badge/prettier-2.8.3-brightgreen)](https://prettier.io/) | ||
[![typescript version](https://img.shields.io/badge/typescript-5.0.2-brightgreen)](https://www.typescriptlang.org/) | ||
[![eslint version](https://img.shields.io/badge/eslint-8.36.0-brightgreen)](https://github.com/eslint) | ||
[![cypress version](https://img.shields.io/badge/cypress-12.8.1-brightgreen)](https://www.cypress.io/) | ||
[![vite version](https://img.shields.io/badge/vite-4.2.0-brightgreen)](https://vitejs.dev/) | ||
[![prettier version](https://img.shields.io/badge/prettier-2.8.4-brightgreen)](https://prettier.io/) | ||
@@ -13,0 +13,0 @@ |
@@ -8,4 +8,2 @@ /* Native JavaScript for Bootstrap 5 | Alert | ||
querySelector, | ||
// closest, | ||
// ObjectAssign, | ||
hasClass, | ||
@@ -119,9 +117,10 @@ removeClass, | ||
dispatchEvent(element, closeAlertEvent); | ||
if (closeAlertEvent.defaultPrevented) return; | ||
removeClass(element, showClass); | ||
if (!closeAlertEvent.defaultPrevented) { | ||
removeClass(element, showClass); | ||
if (hasClass(element, fadeClass)) { | ||
emulateTransitionEnd(element, () => alertTransitionEnd(this)); | ||
} else alertTransitionEnd(this); | ||
if (hasClass(element, fadeClass)) { | ||
emulateTransitionEnd(element, () => alertTransitionEnd(this)); | ||
} else alertTransitionEnd(this); | ||
} | ||
} | ||
@@ -128,0 +127,0 @@ }; |
@@ -10,4 +10,4 @@ /* Native JavaScript for Bootstrap 5 | Base Component | ||
export default class BaseComponent { | ||
element: HTMLElement; | ||
options?: BaseOptions; | ||
declare element: HTMLElement; | ||
declare options?: BaseOptions; | ||
@@ -29,12 +29,14 @@ /** | ||
const prevInstance = Data.get<this>(element, this.name); | ||
if (prevInstance) prevInstance.dispose(); | ||
const prevInstance = Data.get<typeof this>(element, this.name); | ||
/* istanbul ignore else */ | ||
if (prevInstance) { | ||
prevInstance.dispose(); | ||
} | ||
this.element = element; | ||
this.options = | ||
this.defaults && ObjectKeys(this.defaults).length | ||
? normalizeOptions(element, this.defaults, config || {}, 'bs') | ||
: {}; | ||
/* istanbul ignore else */ | ||
if (this.defaults && ObjectKeys(this.defaults).length) { | ||
this.options = normalizeOptions(element, this.defaults, config || {}, 'bs'); | ||
} | ||
Data.set(element, this.name, this); | ||
@@ -58,5 +60,3 @@ } | ||
/** | ||
* Removes component from target element; | ||
*/ | ||
/** Removes component from target element. */ | ||
dispose() { | ||
@@ -63,0 +63,0 @@ Data.remove(this.element, this.name); |
@@ -11,2 +11,3 @@ /* Native JavaScript for Bootstrap 5 | Button | ||
ariaPressed, | ||
getAttribute, | ||
} from '@thednp/shorty'; | ||
@@ -94,8 +95,8 @@ | ||
const { element, isActive } = this; | ||
if (hasClass(element, 'disabled')) return; | ||
const action = isActive ? removeClass : addClass; | ||
action(element, activeClass); | ||
setAttribute(element, ariaPressed, isActive ? 'false' : 'true'); | ||
this.isActive = hasClass(element, activeClass); | ||
if (!hasClass(element, 'disabled') && !getAttribute(element, 'disabled')) { | ||
const action = isActive ? removeClass : addClass; | ||
action(element, activeClass); | ||
setAttribute(element, ariaPressed, isActive ? 'false' : 'true'); | ||
this.isActive = hasClass(element, activeClass); | ||
} | ||
}; | ||
@@ -102,0 +103,0 @@ |
@@ -36,2 +36,3 @@ /* Native JavaScript for Bootstrap 5 | Carousel | ||
removeClass, | ||
matches, | ||
} from '@thednp/shorty'; | ||
@@ -94,5 +95,4 @@ | ||
// discontinue disposed instances | ||
/* istanbul ignore else */ | ||
if (self.isAnimating && getCarouselInstance(element)) { | ||
if (self.isAnimating) { | ||
const activeItem = getActiveIndex(self); | ||
@@ -112,4 +112,4 @@ const orientation = direction === 'left' ? 'next' : 'prev'; | ||
// check for element, might have been disposed | ||
if (!getDocument(element).hidden && options.interval && !self.isPaused) { | ||
// must check if a previous instance is disposed | ||
if (self.cycle && !getDocument(element).hidden && options.interval && !self.isPaused) { | ||
self.cycle(); | ||
@@ -158,13 +158,13 @@ } | ||
if (!self || self.isAnimating) return; | ||
if (self && !self.isAnimating) { | ||
const newIndex = +(getAttribute(this, dataBsSlideTo) || /* istanbul ignore next */ 0); | ||
const newIndex = +(getAttribute(this, dataBsSlideTo) || /* istanbul ignore next */ 0); | ||
if ( | ||
this && | ||
!hasClass(this, activeClass) && // event target is not active | ||
!Number.isNaN(newIndex) | ||
) { | ||
// AND has the specific attribute | ||
self.to(newIndex); // do the slide | ||
if ( | ||
this && | ||
!hasClass(this, activeClass) && // event target is not active | ||
!Number.isNaN(newIndex) | ||
) { | ||
// AND has the specific attribute | ||
self.to(newIndex); // do the slide | ||
} | ||
} | ||
@@ -180,14 +180,14 @@ } | ||
e.preventDefault(); | ||
// const control = this; | ||
const element = closest(this, carouselSelector) || (getTargetElement(this) as HTMLElement); | ||
const self = getCarouselInstance(element); | ||
if (!self || self.isAnimating) return; | ||
const orientation = getAttribute(this, dataBsSlide); | ||
if (self && !self.isAnimating) { | ||
const orientation = getAttribute(this, dataBsSlide); | ||
/* istanbul ignore else */ | ||
if (orientation === 'next') { | ||
self.next(); | ||
} else if (orientation === 'prev') { | ||
self.prev(); | ||
/* istanbul ignore else */ | ||
if (orientation === 'next') { | ||
self.next(); | ||
} else if (orientation === 'prev') { | ||
self.prev(); | ||
} | ||
} | ||
@@ -207,10 +207,11 @@ } | ||
/* istanbul ignore next */ | ||
if (!self || self.isAnimating || /textarea|input/i.test(target.nodeName)) return; | ||
const RTL = isRTL(element); | ||
const arrowKeyNext = !RTL ? keyArrowRight : keyArrowLeft; | ||
const arrowKeyPrev = !RTL ? keyArrowLeft : keyArrowRight; | ||
if (self && !self.isAnimating && !/textarea|input/i.test(target.nodeName)) { | ||
const RTL = isRTL(element); | ||
const arrowKeyNext = !RTL ? keyArrowRight : keyArrowLeft; | ||
const arrowKeyPrev = !RTL ? keyArrowLeft : keyArrowRight; | ||
/* istanbul ignore else */ | ||
if (code === arrowKeyPrev) self.prev(); | ||
else if (code === arrowKeyNext) self.next(); | ||
/* istanbul ignore else */ | ||
if (code === arrowKeyPrev) self.prev(); | ||
else if (code === arrowKeyNext) self.next(); | ||
} | ||
}; | ||
@@ -252,19 +253,15 @@ | ||
if (!self || self.isAnimating || self.isTouch) { | ||
return; | ||
} | ||
if (self && !self.isAnimating && !self.isTouch) { | ||
// filter pointer event on controls & indicators | ||
const { controls, indicators } = self; | ||
if (![...controls, ...indicators].every(el => el === target || el.contains(target as Node))) { | ||
startX = e.pageX; | ||
// filter pointer event on controls & indicators | ||
const { controls, indicators } = self; | ||
if ([...controls, ...indicators].some(el => el === target || el.contains(target as Node))) { | ||
return; | ||
/* istanbul ignore else */ | ||
if (this.contains(target as Node)) { | ||
self.isTouch = true; | ||
toggleCarouselTouchHandlers(self, true); | ||
} | ||
} | ||
} | ||
startX = e.pageX; | ||
/* istanbul ignore else */ | ||
if (this.contains(target as Node)) { | ||
self.isTouch = true; | ||
toggleCarouselTouchHandlers(self, true); | ||
} | ||
} | ||
@@ -294,14 +291,25 @@ | ||
// impossible to satisfy | ||
/* istanbul ignore next */ | ||
if (!self) { | ||
return; | ||
} | ||
/* istanbul ignore else */ | ||
if (self) { | ||
const { element, index } = self; | ||
const RTL = isRTL(element); | ||
endX = e.pageX; | ||
const { element, index } = self; | ||
const RTL = isRTL(element); | ||
self.isTouch = false; | ||
toggleCarouselTouchHandlers(self); | ||
self.isTouch = false; | ||
toggleCarouselTouchHandlers(self); | ||
if ( | ||
!doc.getSelection()?.toString().length && | ||
element.contains(target as HTMLElement) && | ||
Math.abs(startX - endX) > 120 | ||
) { | ||
// determine next index to slide to | ||
/* istanbul ignore else */ | ||
if (currentX < startX) { | ||
self.to(index + (RTL ? -1 : 1)); | ||
} else if (currentX > startX) { | ||
self.to(index + (RTL ? 1 : -1)); | ||
} | ||
} | ||
if (doc.getSelection()?.toString().length) { | ||
// reset pointer position | ||
@@ -311,28 +319,3 @@ startX = 0; | ||
endX = 0; | ||
return; | ||
} | ||
endX = e.pageX; | ||
// the event target is outside the carousel context | ||
// OR swipe distance is less than 120px | ||
/* istanbul ignore else */ | ||
if (!element.contains(target as HTMLElement) || Math.abs(startX - endX) < 120) { | ||
// reset pointer position | ||
startX = 0; | ||
currentX = 0; | ||
endX = 0; | ||
return; | ||
} | ||
// OR determine next index to slide to | ||
/* istanbul ignore else */ | ||
if (currentX < startX) { | ||
self.to(index + (RTL ? -1 : 1)); | ||
} else if (currentX > startX) { | ||
self.to(index + (RTL ? 1 : -1)); | ||
} | ||
// reset pointer position | ||
startX = 0; | ||
currentX = 0; | ||
endX = 0; | ||
}; | ||
@@ -346,5 +329,5 @@ | ||
* @param self the `Carousel` instance | ||
* @param pageIndex the index of the new active indicator | ||
* @param index the index of the new active indicator | ||
*/ | ||
const activateCarouselIndicator = (self: Carousel, pageIndex: number) => { | ||
const activateCarouselIndicator = (self: Carousel, index: number) => { | ||
const { indicators } = self; | ||
@@ -354,3 +337,3 @@ [...indicators].forEach(x => removeClass(x, activeClass)); | ||
/* istanbul ignore else */ | ||
if (self.indicators[pageIndex]) addClass(indicators[pageIndex], activeClass); | ||
if (self.indicators[index]) addClass(indicators[index], activeClass); | ||
}; | ||
@@ -451,3 +434,2 @@ | ||
this.direction = isRTL(element) ? 'right' : 'left'; | ||
this.index = 0; | ||
this.isTouch = false; | ||
@@ -462,40 +444,49 @@ | ||
// no need to go further | ||
if (slides.length < 2) { | ||
return; | ||
} | ||
// external controls must be within same document context | ||
const doc = getDocument(element); | ||
if (slides.length >= 2) { | ||
const activeIndex = getActiveIndex(this); | ||
// recover item from disposed instance | ||
const transitionItem = [...slides].find(s => matches(s, `.${carouselItem}-next,.${carouselItem}-next`)); | ||
this.index = activeIndex; | ||
this.controls = [ | ||
...querySelectorAll(`[${dataBsSlide}]`, element), | ||
...querySelectorAll(`[${dataBsSlide}][${dataBsTarget}="#${element.id}"]`, doc), | ||
]; | ||
// external controls must be within same document context | ||
const doc = getDocument(element); | ||
this.indicator = querySelector(`.${carouselString}-indicators`, element); | ||
this.controls = [ | ||
...querySelectorAll(`[${dataBsSlide}]`, element), | ||
...querySelectorAll(`[${dataBsSlide}][${dataBsTarget}="#${element.id}"]`, doc), | ||
].filter((c, i, ar) => i === ar.indexOf(c)); | ||
// a LIVE collection is prefferable | ||
this.indicators = [ | ||
...(this.indicator ? querySelectorAll(`[${dataBsSlideTo}]`, this.indicator) : []), | ||
...querySelectorAll(`[${dataBsSlideTo}][${dataBsTarget}="#${element.id}"]`, doc), | ||
]; | ||
this.indicator = querySelector(`.${carouselString}-indicators`, element); | ||
// set JavaScript and DATA API options | ||
const { options } = this; | ||
// a LIVE collection is prefferable | ||
this.indicators = [ | ||
...(this.indicator ? querySelectorAll(`[${dataBsSlideTo}]`, this.indicator) : []), | ||
...querySelectorAll(`[${dataBsSlideTo}][${dataBsTarget}="#${element.id}"]`, doc), | ||
].filter((c, i, ar) => i === ar.indexOf(c)); | ||
// don't use TRUE as interval, it's actually 0, use the default 5000ms better | ||
this.options.interval = options.interval === true ? carouselDefaults.interval : options.interval; | ||
// set JavaScript and DATA API options | ||
const { options } = this; | ||
// set first slide active if none | ||
/* istanbul ignore else */ | ||
if (getActiveIndex(this) < 0) { | ||
addClass(slides[0], activeClass); | ||
// don't use TRUE as interval, it's actually 0, use the default 5000ms better | ||
this.options.interval = options.interval === true ? carouselDefaults.interval : options.interval; | ||
// set first slide active if none | ||
/* istanbul ignore next - impossible to test with cypress */ | ||
if (transitionItem) { | ||
this.index = [...slides].indexOf(transitionItem); | ||
} else if (activeIndex < 0) { | ||
this.index = 0; | ||
addClass(slides[0], activeClass); | ||
if (this.indicators.length) activateCarouselIndicator(this, 0); | ||
} | ||
/* istanbul ignore else */ | ||
if (this.indicators.length) activateCarouselIndicator(this, 0); | ||
} | ||
if (this.indicators.length) activateCarouselIndicator(this, this.index); | ||
// attach event handlers | ||
toggleCarouselHandlers(this, true); | ||
// attach event handlers | ||
toggleCarouselHandlers(this, true); | ||
// start to cycle if interval is set | ||
if (options.interval) this.cycle(); | ||
// start to cycle if interval is set | ||
if (options.interval) this.cycle(); | ||
} | ||
} | ||
@@ -604,76 +595,80 @@ | ||
// `to()` must be SPAM protected by Timer | ||
if (this.isAnimating || activeItem === next || Timer.get(element, dataBsSlide)) return; | ||
if (!this.isAnimating && activeItem !== next && !Timer.get(element, dataBsSlide)) { | ||
// determine transition direction | ||
/* istanbul ignore else */ | ||
if (activeItem < next || (activeItem === 0 && next === slides.length - 1)) { | ||
this.direction = RTL ? 'right' : 'left'; // next | ||
} else if (activeItem > next || (activeItem === slides.length - 1 && next === 0)) { | ||
this.direction = RTL ? 'left' : 'right'; // prev | ||
} | ||
const { direction } = this; | ||
// determine transition direction | ||
/* istanbul ignore else */ | ||
if (activeItem < next || (activeItem === 0 && next === slides.length - 1)) { | ||
this.direction = RTL ? 'right' : 'left'; // next | ||
} else if (activeItem > next || (activeItem === slides.length - 1 && next === 0)) { | ||
this.direction = RTL ? 'left' : 'right'; // prev | ||
} | ||
const { direction } = this; | ||
// find the right next index | ||
if (next < 0) { | ||
next = slides.length - 1; | ||
} else if (next >= slides.length) { | ||
next = 0; | ||
} | ||
// find the right next index | ||
if (next < 0) { | ||
next = slides.length - 1; | ||
} else if (next >= slides.length) { | ||
next = 0; | ||
} | ||
// orientation, class name, eventProperties | ||
const orientation = direction === 'left' ? 'next' : 'prev'; | ||
const directionClass = direction === 'left' ? 'start' : 'end'; | ||
// orientation, class name, eventProperties | ||
const orientation = direction === 'left' ? 'next' : 'prev'; | ||
const directionClass = direction === 'left' ? 'start' : 'end'; | ||
const eventProperties = { | ||
relatedTarget: slides[next], | ||
from: activeItem, | ||
to: next, | ||
direction, | ||
}; | ||
const eventProperties = { | ||
relatedTarget: slides[next], | ||
from: activeItem, | ||
to: next, | ||
direction, | ||
}; | ||
// update event properties | ||
ObjectAssign(carouselSlideEvent, eventProperties); | ||
ObjectAssign(carouselSlidEvent, eventProperties); | ||
// update event properties | ||
ObjectAssign(carouselSlideEvent, eventProperties); | ||
ObjectAssign(carouselSlidEvent, eventProperties); | ||
// discontinue when prevented | ||
dispatchEvent(element, carouselSlideEvent); | ||
if (!carouselSlideEvent.defaultPrevented) { | ||
// update index | ||
this.index = next; | ||
activateCarouselIndicator(this, next); | ||
// discontinue when prevented | ||
dispatchEvent(element, carouselSlideEvent); | ||
if (carouselSlideEvent.defaultPrevented) return; | ||
if (getElementTransitionDuration(slides[next]) && hasClass(element, 'slide')) { | ||
Timer.set( | ||
element, | ||
() => { | ||
addClass(slides[next], `${carouselItem}-${orientation}`); | ||
reflow(slides[next]); | ||
addClass(slides[next], `${carouselItem}-${directionClass}`); | ||
addClass(slides[activeItem], `${carouselItem}-${directionClass}`); | ||
// update index | ||
this.index = next; | ||
activateCarouselIndicator(this, next); | ||
// the instance might get diposed mid-animation | ||
emulateTransitionEnd( | ||
slides[next], | ||
() => this.slides && this.slides.length && carouselTransitionEndHandler(this), | ||
); | ||
}, | ||
0, | ||
dataBsSlide, | ||
); | ||
} else { | ||
addClass(slides[next], activeClass); | ||
removeClass(slides[activeItem], activeClass); | ||
if (getElementTransitionDuration(slides[next]) && hasClass(element, 'slide')) { | ||
Timer.set( | ||
element, | ||
() => { | ||
addClass(slides[next], `${carouselItem}-${orientation}`); | ||
reflow(slides[next]); | ||
addClass(slides[next], `${carouselItem}-${directionClass}`); | ||
addClass(slides[activeItem], `${carouselItem}-${directionClass}`); | ||
Timer.set( | ||
element, | ||
() => { | ||
Timer.clear(element, dataBsSlide); | ||
// check for element, might have been disposed | ||
/* istanbul ignore else */ | ||
if (element && options.interval && !this.isPaused) { | ||
this.cycle(); | ||
} | ||
emulateTransitionEnd(slides[next], () => carouselTransitionEndHandler(this)); | ||
}, | ||
0, | ||
dataBsSlide, | ||
); | ||
} else { | ||
addClass(slides[next], activeClass); | ||
removeClass(slides[activeItem], activeClass); | ||
Timer.set( | ||
element, | ||
() => { | ||
Timer.clear(element, dataBsSlide); | ||
// check for element, might have been disposed | ||
/* istanbul ignore else */ | ||
if (element && options.interval && !this.isPaused) { | ||
this.cycle(); | ||
} | ||
dispatchEvent(element, carouselSlidEvent); | ||
}, | ||
0, | ||
dataBsSlide, | ||
); | ||
dispatchEvent(element, carouselSlidEvent); | ||
}, | ||
0, | ||
dataBsSlide, | ||
); | ||
} | ||
} | ||
} | ||
@@ -684,13 +679,18 @@ } | ||
dispose() { | ||
const { slides } = this; | ||
const itemClasses = ['start', 'end', 'prev', 'next']; | ||
const { isAnimating } = this; | ||
[...slides].forEach((slide, idx) => { | ||
if (hasClass(slide, activeClass)) activateCarouselIndicator(this, idx); | ||
itemClasses.forEach(c => removeClass(slide, `${carouselItem}-${c}`)); | ||
}); | ||
const clone = { | ||
...this, | ||
isAnimating, | ||
}; | ||
toggleCarouselHandlers(clone); | ||
super.dispose(); | ||
toggleCarouselHandlers(this); | ||
super.dispose(); | ||
// istanbul ignore next - impossible to test with cypress | ||
if (clone.isAnimating) { | ||
emulateTransitionEnd(clone.slides[clone.index], () => { | ||
carouselTransitionEndHandler(clone); | ||
}); | ||
} | ||
} | ||
} |
@@ -73,26 +73,26 @@ /* Native JavaScript for Bootstrap 5 | Collapse | ||
dispatchEvent(element, showCollapseEvent); | ||
if (showCollapseEvent.defaultPrevented) return; | ||
if (!showCollapseEvent.defaultPrevented) { | ||
Timer.set(element, noop, 17); | ||
if (parent) Timer.set(parent, noop, 17); | ||
Timer.set(element, noop, 17); | ||
if (parent) Timer.set(parent, noop, 17); | ||
addClass(element, collapsingClass); | ||
removeClass(element, collapseString); | ||
addClass(element, collapsingClass); | ||
removeClass(element, collapseString); | ||
setElementStyle(element, { height: `${element.scrollHeight}px` }); | ||
setElementStyle(element, { height: `${element.scrollHeight}px` }); | ||
emulateTransitionEnd(element, () => { | ||
Timer.clear(element); | ||
if (parent) Timer.clear(parent); | ||
emulateTransitionEnd(element, () => { | ||
Timer.clear(element); | ||
if (parent) Timer.clear(parent); | ||
triggers.forEach(btn => setAttribute(btn, ariaExpanded, 'true')); | ||
triggers.forEach(btn => setAttribute(btn, ariaExpanded, 'true')); | ||
removeClass(element, collapsingClass); | ||
addClass(element, collapseString); | ||
addClass(element, showClass); | ||
removeClass(element, collapsingClass); | ||
addClass(element, collapseString); | ||
addClass(element, showClass); | ||
setElementStyle(element, { height: '' }); | ||
setElementStyle(element, { height: '' }); | ||
dispatchEvent(element, shownCollapseEvent); | ||
}); | ||
dispatchEvent(element, shownCollapseEvent); | ||
}); | ||
} | ||
}; | ||
@@ -110,30 +110,30 @@ | ||
if (hideCollapseEvent.defaultPrevented) return; | ||
if (!hideCollapseEvent.defaultPrevented) { | ||
Timer.set(element, noop, 17); | ||
if (parent) Timer.set(parent, noop, 17); | ||
Timer.set(element, noop, 17); | ||
if (parent) Timer.set(parent, noop, 17); | ||
setElementStyle(element, { height: `${element.scrollHeight}px` }); | ||
setElementStyle(element, { height: `${element.scrollHeight}px` }); | ||
removeClass(element, collapseString); | ||
removeClass(element, showClass); | ||
addClass(element, collapsingClass); | ||
removeClass(element, collapseString); | ||
removeClass(element, showClass); | ||
addClass(element, collapsingClass); | ||
reflow(element); | ||
setElementStyle(element, { height: '0px' }); | ||
reflow(element); | ||
setElementStyle(element, { height: '0px' }); | ||
emulateTransitionEnd(element, () => { | ||
Timer.clear(element); | ||
/* istanbul ignore else */ | ||
if (parent) Timer.clear(parent); | ||
emulateTransitionEnd(element, () => { | ||
Timer.clear(element); | ||
/* istanbul ignore else */ | ||
if (parent) Timer.clear(parent); | ||
triggers.forEach(btn => setAttribute(btn, ariaExpanded, 'false')); | ||
triggers.forEach(btn => setAttribute(btn, ariaExpanded, 'false')); | ||
removeClass(element, collapsingClass); | ||
addClass(element, collapseString); | ||
removeClass(element, collapsingClass); | ||
addClass(element, collapseString); | ||
setElementStyle(element, { height: '' }); | ||
setElementStyle(element, { height: '' }); | ||
dispatchEvent(element, hiddenCollapseEvent); | ||
}); | ||
dispatchEvent(element, hiddenCollapseEvent); | ||
}); | ||
} | ||
}; | ||
@@ -237,8 +237,8 @@ | ||
const { triggers, element } = this; | ||
if (Timer.get(element)) return; | ||
collapseContent(this); | ||
/* istanbul ignore else */ | ||
if (triggers.length) { | ||
triggers.forEach(btn => addClass(btn, `${collapseString}d`)); | ||
if (!Timer.get(element)) { | ||
collapseContent(this); | ||
/* istanbul ignore else */ | ||
if (triggers.length) { | ||
triggers.forEach(btn => addClass(btn, `${collapseString}d`)); | ||
} | ||
} | ||
@@ -245,0 +245,0 @@ } |
@@ -21,3 +21,2 @@ /* Native JavaScript for Bootstrap 5 | Dropdown | ||
getElementsByClassName, | ||
querySelector, | ||
closest, | ||
@@ -37,2 +36,4 @@ getAttribute, | ||
CSS4Declaration, | ||
isHTMLElement, | ||
mousedownEvent, | ||
} from '@thednp/shorty'; | ||
@@ -55,3 +56,3 @@ | ||
const [dropdownString, dropupString, dropstartString, dropendString] = dropdownClasses; | ||
const dropdownSelector = `[${dataBsToggle}="${dropdownString}"],[${dataBsToggle}="${dropupString}"],[${dataBsToggle}="${dropendString}"],[${dataBsToggle}="${dropstartString}"]`; | ||
const dropdownSelector = `[${dataBsToggle}="${dropdownString}"]`; | ||
@@ -103,113 +104,118 @@ /** | ||
// don't apply any style on mobile view | ||
/* istanbul ignore next: this test requires a navbar */ | ||
if (getElementStyle(menu, 'position') === 'static') return; | ||
/* istanbul ignore else: this test requires a navbar */ | ||
if (getElementStyle(menu, 'position') !== 'static') { | ||
const RTL = isRTL(element); | ||
// const menuStart = hasClass(menu, dropdownMenuStartClass); | ||
const menuEnd = hasClass(menu, dropdownMenuEndClass); | ||
const RTL = isRTL(element); | ||
// const menuStart = hasClass(menu, dropdownMenuStartClass); | ||
const menuEnd = hasClass(menu, dropdownMenuEndClass); | ||
// reset menu offset and position | ||
const resetProps = ['margin', 'top', 'bottom', 'left', 'right']; | ||
resetProps.forEach(p => { | ||
// menu.style[p] = ''; | ||
const style: { [key: string]: string } = {}; | ||
style[p] = ''; | ||
setElementStyle(menu, style); | ||
}); | ||
// reset menu offset and position | ||
const resetProps = ['margin', 'top', 'bottom', 'left', 'right']; | ||
resetProps.forEach(p => { | ||
// menu.style[p] = ''; | ||
const style: { [key: string]: string } = {}; | ||
style[p] = ''; | ||
setElementStyle(menu, style); | ||
}); | ||
// set initial position class | ||
// take into account .btn-group parent as .dropdown | ||
// this requires navbar/btn-group/input-group | ||
let positionClass = | ||
dropdownClasses.find(c => hasClass(parentElement, c)) || | ||
/* istanbul ignore next: fallback position */ dropdownString; | ||
// set initial position class | ||
// take into account .btn-group parent as .dropdown | ||
// this requires navbar/btn-group/input-group | ||
let positionClass = | ||
dropdownClasses.find(c => hasClass(parentElement, c)) || | ||
/* istanbul ignore next: fallback position */ dropdownString; | ||
const dropdownMargin: { [key: string]: number[] } = { | ||
dropdown: [offset, 0, 0], | ||
dropup: [0, 0, offset], | ||
dropstart: RTL ? [-1, 0, 0, offset] : [-1, offset, 0], | ||
dropend: RTL ? [-1, offset, 0] : [-1, 0, 0, offset], | ||
}; | ||
const dropdownMargin: { [key: string]: number[] } = { | ||
dropdown: [offset, 0, 0], | ||
dropup: [0, 0, offset], | ||
dropstart: RTL ? [-1, 0, 0, offset] : [-1, offset, 0], | ||
dropend: RTL ? [-1, offset, 0] : [-1, 0, 0, offset], | ||
}; | ||
const dropdownPosition: { [key: string]: Partial<CSS4Declaration> } = { | ||
dropdown: { top: '100%' }, | ||
dropup: { top: 'auto', bottom: '100%' }, | ||
dropstart: RTL ? { left: '100%', right: 'auto' } : { left: 'auto', right: '100%' }, | ||
dropend: RTL ? { left: 'auto', right: '100%' } : { left: '100%', right: 'auto' }, | ||
menuStart: RTL ? { right: '0', left: 'auto' } : { right: 'auto', left: '0' }, | ||
menuEnd: RTL ? { right: 'auto', left: '0' } : { right: '0', left: 'auto' }, | ||
}; | ||
const dropdownPosition: { [key: string]: Partial<CSS4Declaration> } = { | ||
dropdown: { top: '100%' }, | ||
dropup: { top: 'auto', bottom: '100%' }, | ||
dropstart: RTL ? { left: '100%', right: 'auto' } : { left: 'auto', right: '100%' }, | ||
dropend: RTL ? { left: 'auto', right: '100%' } : { left: '100%', right: 'auto' }, | ||
menuStart: RTL ? { right: '0', left: 'auto' } : { right: 'auto', left: '0' }, | ||
menuEnd: RTL ? { right: 'auto', left: '0' } : { right: '0', left: 'auto' }, | ||
}; | ||
const { offsetWidth: menuWidth, offsetHeight: menuHeight } = menu; | ||
const { offsetWidth: menuWidth, offsetHeight: menuHeight } = menu; | ||
const { clientWidth, clientHeight } = getDocumentElement(element); | ||
const { | ||
left: targetLeft, | ||
top: targetTop, | ||
width: targetWidth, | ||
height: targetHeight, | ||
} = getBoundingClientRect(element); | ||
const { clientWidth, clientHeight } = getDocumentElement(element); | ||
const { left: targetLeft, top: targetTop, width: targetWidth, height: targetHeight } = getBoundingClientRect(element); | ||
// dropstart | dropend | ||
const leftFullExceed = targetLeft - menuWidth - offset < 0; | ||
// dropend | ||
const rightFullExceed = targetLeft + menuWidth + targetWidth + offset >= clientWidth; | ||
// dropstart | dropend | ||
const bottomExceed = targetTop + menuHeight + offset >= clientHeight; | ||
// dropdown | ||
const bottomFullExceed = targetTop + menuHeight + targetHeight + offset >= clientHeight; | ||
// dropup | ||
const topExceed = targetTop - menuHeight - offset < 0; | ||
// dropdown / dropup | ||
const leftExceed = ((!RTL && menuEnd) || (RTL && !menuEnd)) && targetLeft + targetWidth - menuWidth < 0; | ||
const rightExceed = ((RTL && menuEnd) || (!RTL && !menuEnd)) && targetLeft + menuWidth >= clientWidth; | ||
// dropstart | dropend | ||
const leftFullExceed = targetLeft - menuWidth - offset < 0; | ||
// dropend | ||
const rightFullExceed = targetLeft + menuWidth + targetWidth + offset >= clientWidth; | ||
// dropstart | dropend | ||
const bottomExceed = targetTop + menuHeight + offset >= clientHeight; | ||
// dropdown | ||
const bottomFullExceed = targetTop + menuHeight + targetHeight + offset >= clientHeight; | ||
// dropup | ||
const topExceed = targetTop - menuHeight - offset < 0; | ||
// dropdown / dropup | ||
const leftExceed = ((!RTL && menuEnd) || (RTL && !menuEnd)) && targetLeft + targetWidth - menuWidth < 0; | ||
const rightExceed = ((RTL && menuEnd) || (!RTL && !menuEnd)) && targetLeft + menuWidth >= clientWidth; | ||
// recompute position | ||
// handle RTL as well | ||
if (horizontalClass.includes(positionClass) && leftFullExceed && rightFullExceed) { | ||
positionClass = dropdownString; | ||
} | ||
if (positionClass === dropstartString && (!RTL ? leftFullExceed : rightFullExceed)) { | ||
positionClass = dropendString; | ||
} | ||
if (positionClass === dropendString && (RTL ? leftFullExceed : rightFullExceed)) { | ||
positionClass = dropstartString; | ||
} | ||
if (positionClass === dropupString && topExceed && !bottomFullExceed) { | ||
positionClass = dropdownString; | ||
} | ||
if (positionClass === dropdownString && bottomFullExceed && !topExceed) { | ||
positionClass = dropupString; | ||
} | ||
// recompute position | ||
// handle RTL as well | ||
if (horizontalClass.includes(positionClass) && leftFullExceed && rightFullExceed) { | ||
positionClass = dropdownString; | ||
} | ||
if (positionClass === dropstartString && (!RTL ? leftFullExceed : rightFullExceed)) { | ||
positionClass = dropendString; | ||
} | ||
if (positionClass === dropendString && (RTL ? leftFullExceed : rightFullExceed)) { | ||
positionClass = dropstartString; | ||
} | ||
if (positionClass === dropupString && topExceed && !bottomFullExceed) { | ||
positionClass = dropdownString; | ||
} | ||
if (positionClass === dropdownString && bottomFullExceed && !topExceed) { | ||
positionClass = dropupString; | ||
} | ||
// override position for horizontal classes | ||
if (horizontalClass.includes(positionClass) && bottomExceed) { | ||
ObjectAssign(dropdownPosition[positionClass], { | ||
top: 'auto', | ||
bottom: 0, | ||
}); | ||
} | ||
// override position for horizontal classes | ||
if (horizontalClass.includes(positionClass) && bottomExceed) { | ||
ObjectAssign(dropdownPosition[positionClass], { | ||
top: 'auto', | ||
bottom: 0, | ||
// override position for vertical classes | ||
if (verticalClass.includes(positionClass) && (leftExceed || rightExceed)) { | ||
// don't realign when menu is wider than window | ||
// in both RTL and non-RTL readability is KING | ||
let posAjust: { left: 'auto' | number; right: 'auto' | number } | undefined = { left: 'auto', right: 'auto' }; | ||
if (!leftExceed && rightExceed && !RTL) posAjust = { left: 'auto', right: 0 }; | ||
if (leftExceed && !rightExceed && RTL) posAjust = { left: 0, right: 'auto' }; | ||
if (posAjust) ObjectAssign(dropdownPosition[positionClass], posAjust); | ||
} | ||
const margins: number[] = dropdownMargin[positionClass]; | ||
setElementStyle(menu, { | ||
...dropdownPosition[positionClass], | ||
margin: `${margins.map(x => (x ? `${x}px` : x)).join(' ')}`, | ||
}); | ||
} | ||
// override position for vertical classes | ||
if (verticalClass.includes(positionClass) && (leftExceed || rightExceed)) { | ||
// don't realign when menu is wider than window | ||
// in both RTL and non-RTL readability is KING | ||
let posAjust: { left: 'auto' | number; right: 'auto' | number } | undefined = { left: 'auto', right: 'auto' }; | ||
if (!leftExceed && rightExceed && !RTL) posAjust = { left: 'auto', right: 0 }; | ||
if (leftExceed && !rightExceed && RTL) posAjust = { left: 0, right: 'auto' }; | ||
if (posAjust) ObjectAssign(dropdownPosition[positionClass], posAjust); | ||
} | ||
const margins: number[] = dropdownMargin[positionClass]; | ||
setElementStyle(menu, { | ||
...dropdownPosition[positionClass], | ||
margin: `${margins.map(x => (x ? `${x}px` : x)).join(' ')}`, | ||
}); | ||
// override dropdown-menu-start | dropdown-menu-end | ||
if (verticalClass.includes(positionClass) && menuEnd) { | ||
/* istanbul ignore else */ | ||
if (menuEnd) { | ||
const endAdjust = | ||
(!RTL && leftExceed) || (RTL && rightExceed) ? 'menuStart' : /* istanbul ignore next */ 'menuEnd'; | ||
setElementStyle(menu, dropdownPosition[endAdjust]); | ||
// override dropdown-menu-start | dropdown-menu-end | ||
if (verticalClass.includes(positionClass) && menuEnd) { | ||
/* istanbul ignore else */ | ||
if (menuEnd) { | ||
const endAdjust = | ||
(!RTL && leftExceed) || (RTL && rightExceed) ? 'menuStart' : /* istanbul ignore next */ 'menuEnd'; | ||
setElementStyle(menu, dropdownPosition[endAdjust]); | ||
} | ||
} | ||
// trigger updated event | ||
dispatchEvent(parentElement, updatedDropdownEvent); | ||
} | ||
// trigger updated event | ||
dispatchEvent(parentElement, updatedDropdownEvent); | ||
}; | ||
@@ -300,32 +306,27 @@ | ||
/* istanbul ignore next: impossible to satisfy */ | ||
if (!target || !(target as HTMLElement).closest) return; // some weird FF bug #409 | ||
/* istanbul ignore else */ | ||
if (target && isHTMLElement(target)) { | ||
// some weird FF bug #409 | ||
const element = getCurrentOpenDropdown(target); | ||
const self = element && getDropdownInstance(element); | ||
const element = getCurrentOpenDropdown(target as HTMLElement); | ||
const self = element && getDropdownInstance(element); | ||
/* istanbul ignore else */ | ||
if (self) { | ||
const { parentElement, menu } = self; | ||
/* istanbul ignore next */ | ||
if (!self) return; | ||
const isForm = | ||
parentElement && | ||
parentElement.contains(target) && | ||
(target.tagName === 'form' || closest(target, 'form') !== null); | ||
const { parentElement, menu } = self; | ||
if ([mouseclickEvent, mousedownEvent].includes(type) && isEmptyAnchor(target)) { | ||
e.preventDefault(); | ||
} | ||
const hasData = closest(target as HTMLElement, dropdownSelector) !== null; | ||
const isForm = | ||
parentElement && | ||
parentElement.contains(target as HTMLElement) && | ||
((target as HTMLElement).tagName === 'form' || closest(target as HTMLElement, 'form') !== null); | ||
if (type === mouseclickEvent && isEmptyAnchor(target as HTMLElement)) { | ||
e.preventDefault(); | ||
/* istanbul ignore else */ | ||
if (!isForm && type !== focusEvent && target !== element && target !== menu) { | ||
self.hide(); | ||
} | ||
} | ||
} | ||
if (type === focusEvent && (target === element || target === menu || menu.contains(target as HTMLElement))) { | ||
return; | ||
} | ||
/* istanbul ignore next */ | ||
if (isForm || hasData) { | ||
// smile to ESLint | ||
} else if (self) { | ||
self.hide(); | ||
} | ||
}; | ||
@@ -345,3 +346,2 @@ | ||
if (self) { | ||
e.stopImmediatePropagation(); | ||
self.toggle(); | ||
@@ -373,25 +373,27 @@ /* istanbul ignore else */ | ||
const { activeElement } = (element && getDocument(element)) as Document; | ||
/* istanbul ignore next: impossible to satisfy */ | ||
if (!self || !activeElement) return; | ||
const { menu, open } = self; | ||
const menuItems = getMenuItems(menu); | ||
// arrow up & down | ||
if (menuItems && menuItems.length && [keyArrowDown, keyArrowUp].includes(code)) { | ||
let idx = menuItems.indexOf(activeElement); | ||
/* istanbul ignore else */ | ||
if (activeElement === element) { | ||
idx = 0; | ||
} else if (code === keyArrowUp) { | ||
idx = idx > 1 ? idx - 1 : 0; | ||
} else if (code === keyArrowDown) { | ||
idx = idx < menuItems.length - 1 ? idx + 1 : idx; | ||
/* istanbul ignore else */ | ||
if (self && activeElement) { | ||
const { menu, open } = self; | ||
const menuItems = getMenuItems(menu); | ||
// arrow up & down | ||
if (menuItems && menuItems.length && [keyArrowDown, keyArrowUp].includes(code)) { | ||
let idx = menuItems.indexOf(activeElement); | ||
/* istanbul ignore else */ | ||
if (activeElement === element) { | ||
idx = 0; | ||
} else if (code === keyArrowUp) { | ||
idx = idx > 1 ? idx - 1 : 0; | ||
} else if (code === keyArrowDown) { | ||
idx = idx < menuItems.length - 1 ? idx + 1 : idx; | ||
} | ||
/* istanbul ignore else */ | ||
if (menuItems[idx]) focus(menuItems[idx] as HTMLElement); | ||
} | ||
/* istanbul ignore else */ | ||
if (menuItems[idx]) focus(menuItems[idx] as HTMLElement); | ||
} | ||
if (keyEscape === code && open) { | ||
self.toggle(); | ||
focus(element); | ||
if (keyEscape === code && open) { | ||
self.toggle(); | ||
focus(element); | ||
} | ||
} | ||
@@ -430,13 +432,13 @@ } | ||
const { parentElement } = this.element; | ||
const menu = querySelector(`.${dropdownMenuClass}`, parentElement as ParentNode); | ||
const [menu] = getElementsByClassName(dropdownMenuClass, parentElement as ParentNode); | ||
// invalidate when dropdown-menu is missing | ||
if (!menu) return; | ||
if (menu) { | ||
// set targets | ||
this.parentElement = parentElement as HTMLElement; | ||
this.menu = menu; | ||
// set targets | ||
this.parentElement = parentElement as HTMLElement; | ||
this.menu = menu; | ||
// add event listener | ||
toggleDropdownHandler(this, true); | ||
// add event listener | ||
toggleDropdownHandler(this, true); | ||
} | ||
} | ||
@@ -469,28 +471,29 @@ | ||
/* istanbul ignore next */ | ||
if (open) return; | ||
/* istanbul ignore else */ | ||
if (!open) { | ||
const currentElement = getCurrentOpenDropdown(element); | ||
const currentInstance = currentElement && getDropdownInstance(currentElement); | ||
if (currentInstance) currentInstance.hide(); | ||
const currentElement = getCurrentOpenDropdown(element); | ||
const currentInstance = currentElement && getDropdownInstance(currentElement); | ||
if (currentInstance) currentInstance.hide(); | ||
// dispatch event | ||
[showDropdownEvent, shownDropdownEvent, updatedDropdownEvent].forEach(e => { | ||
e.relatedTarget = element; | ||
}); | ||
// dispatch event | ||
[showDropdownEvent, shownDropdownEvent, updatedDropdownEvent].forEach(e => { | ||
e.relatedTarget = element; | ||
}); | ||
dispatchEvent(parentElement, showDropdownEvent); | ||
if (showDropdownEvent.defaultPrevented) return; | ||
dispatchEvent(parentElement, showDropdownEvent); | ||
if (!showDropdownEvent.defaultPrevented) { | ||
addClass(menu, showClass); | ||
addClass(parentElement, showClass); | ||
setAttribute(element, ariaExpanded, 'true'); | ||
addClass(menu, showClass); | ||
addClass(parentElement, showClass); | ||
setAttribute(element, ariaExpanded, 'true'); | ||
// change menu position | ||
styleDropdown(this); | ||
// change menu position | ||
styleDropdown(this); | ||
this.open = !open; | ||
this.open = !open; | ||
focus(element); // focus the element | ||
toggleDropdownDismiss(this); | ||
dispatchEvent(parentElement, shownDropdownEvent); | ||
focus(element); // focus the element | ||
toggleDropdownDismiss(this); | ||
dispatchEvent(parentElement, shownDropdownEvent); | ||
} | ||
} | ||
} | ||
@@ -502,19 +505,20 @@ | ||
/* istanbul ignore next */ | ||
if (!open) return; | ||
/* istanbul ignore else */ | ||
if (open) { | ||
[hideDropdownEvent, hiddenDropdownEvent].forEach(e => { | ||
e.relatedTarget = element; | ||
}); | ||
[hideDropdownEvent, hiddenDropdownEvent].forEach(e => { | ||
e.relatedTarget = element; | ||
}); | ||
dispatchEvent(parentElement, hideDropdownEvent); | ||
if (hideDropdownEvent.defaultPrevented) return; | ||
dispatchEvent(parentElement, hideDropdownEvent); | ||
if (!hideDropdownEvent.defaultPrevented) { | ||
removeClass(menu, showClass); | ||
removeClass(parentElement, showClass); | ||
setAttribute(element, ariaExpanded, 'false'); | ||
removeClass(menu, showClass); | ||
removeClass(parentElement, showClass); | ||
setAttribute(element, ariaExpanded, 'false'); | ||
this.open = !open; | ||
// only re-attach handler if the instance is not disposed | ||
toggleDropdownDismiss(this); | ||
dispatchEvent(parentElement, hiddenDropdownEvent); | ||
this.open = !open; | ||
// only re-attach handler if the instance is not disposed | ||
toggleDropdownDismiss(this); | ||
dispatchEvent(parentElement, hiddenDropdownEvent); | ||
} | ||
} | ||
} | ||
@@ -521,0 +525,0 @@ |
@@ -14,5 +14,3 @@ /* Native JavaScript for Bootstrap 5 | Modal | ||
getInstance, | ||
isHTMLElement, | ||
isRTL, | ||
isFunction, | ||
removeClass, | ||
@@ -154,5 +152,4 @@ hasClass, | ||
* @param self the `Modal` instance | ||
* @param callback the `Modal` instance | ||
*/ | ||
const afterModalHide = (self: Modal, callback?: () => void) => { | ||
const afterModalHide = (self: Modal) => { | ||
const { triggers, element, relatedTarget } = self; | ||
@@ -167,5 +164,2 @@ removeOverlay(element); | ||
/* istanbul ignore else */ | ||
if (isFunction(callback)) callback(); | ||
hiddenModalEvent.relatedTarget = relatedTarget as HTMLElement | undefined; | ||
@@ -216,5 +210,4 @@ dispatchEvent(element, hiddenModalEvent); | ||
* @param self the `Modal` instance | ||
* @param callback when `true` skip animation | ||
*/ | ||
const beforeModalHide = (self: Modal, callback?: () => void) => { | ||
const beforeModalHide = (self: Modal) => { | ||
const { element, options, hasFade } = self; | ||
@@ -224,3 +217,3 @@ | ||
// call is not forced and overlay is visible | ||
if (options.backdrop && !callback && hasFade && hasClass(overlay, showClass) && !getCurrentOpen(element)) { | ||
if (options.backdrop && hasFade && hasClass(overlay, showClass) && !getCurrentOpen(element)) { | ||
// AND no modal is visible | ||
@@ -230,3 +223,3 @@ hideOverlay(); | ||
} else { | ||
afterModalHide(self, callback); | ||
afterModalHide(self); | ||
} | ||
@@ -249,9 +242,9 @@ }; | ||
/* istanbul ignore next */ | ||
if (!self) return; | ||
/* istanbul ignore else */ | ||
if (trigger && trigger.tagName === 'A') e.preventDefault(); | ||
self.relatedTarget = trigger; | ||
self.toggle(); | ||
if (self) { | ||
/* istanbul ignore else */ | ||
if (trigger && trigger.tagName === 'A') e.preventDefault(); | ||
self.relatedTarget = trigger; | ||
self.toggle(); | ||
} | ||
}; | ||
@@ -269,15 +262,15 @@ | ||
/* istanbul ignore next */ | ||
if (!self) return; | ||
const { options } = self; | ||
/* istanbul ignore else */ | ||
if ( | ||
options.keyboard && | ||
code === keyEscape && // the keyboard option is enabled and the key is 27 | ||
hasClass(element, showClass) | ||
) { | ||
// the modal is not visible | ||
self.relatedTarget = null; | ||
self.hide(); | ||
if (self) { | ||
const { options } = self; | ||
/* istanbul ignore else */ | ||
if ( | ||
options.keyboard && | ||
code === keyEscape && // the keyboard option is enabled and the key is 27 | ||
hasClass(element, showClass) | ||
) { | ||
// the modal is not visible | ||
self.relatedTarget = null; | ||
self.hide(); | ||
} | ||
} | ||
@@ -295,27 +288,27 @@ }; | ||
// this timer is needed | ||
/* istanbul ignore next: must have a filter */ | ||
if (!self || Timer.get(this)) return; | ||
/* istanbul ignore else: must have a filter */ | ||
if (self && !Timer.get(this)) { | ||
const { options, isStatic, modalDialog } = self; | ||
const { backdrop } = options; | ||
const { target } = e; | ||
const { options, isStatic, modalDialog } = self; | ||
const { backdrop } = options; | ||
const { target } = e; | ||
const selectedText = getDocument(this)?.getSelection()?.toString().length; | ||
const targetInsideDialog = modalDialog.contains(target as HTMLElement); | ||
const dismiss = target && closest(target as HTMLElement, modalDismissSelector); | ||
const selectedText = getDocument(this)?.getSelection()?.toString().length; | ||
const targetInsideDialog = modalDialog?.contains(target as HTMLElement); | ||
const dismiss = target && closest(target as HTMLElement, modalDismissSelector); | ||
/* istanbul ignore else */ | ||
if (isStatic && !targetInsideDialog) { | ||
Timer.set( | ||
this, | ||
() => { | ||
addClass(this, modalStaticClass); | ||
emulateTransitionEnd(modalDialog as HTMLElement, () => staticTransitionEnd(self)); | ||
}, | ||
17, | ||
); | ||
} else if (dismiss || (!selectedText && !isStatic && !targetInsideDialog && backdrop)) { | ||
self.relatedTarget = dismiss || null; | ||
self.hide(); | ||
e.preventDefault(); | ||
/* istanbul ignore else */ | ||
if (isStatic && !targetInsideDialog) { | ||
Timer.set( | ||
this, | ||
() => { | ||
addClass(this, modalStaticClass); | ||
emulateTransitionEnd(modalDialog, () => staticTransitionEnd(self)); | ||
}, | ||
17, | ||
); | ||
} else if (dismiss || (!selectedText && !isStatic && !targetInsideDialog && backdrop)) { | ||
self.relatedTarget = dismiss || null; | ||
self.hide(); | ||
e.preventDefault(); | ||
} | ||
} | ||
@@ -331,4 +324,3 @@ } | ||
const { element, modalDialog } = self; | ||
const duration = | ||
(isHTMLElement(modalDialog) ? getElementTransitionDuration(modalDialog) : /* istanbul ignore next */ 0) + 17; | ||
const duration = (getElementTransitionDuration(modalDialog) || 0) + 17; | ||
removeClass(element, modalStaticClass); | ||
@@ -347,3 +339,3 @@ // user must wait for zoom out transition | ||
declare options: ModalOptions; | ||
declare modalDialog: HTMLElement | null; | ||
declare modalDialog: HTMLElement; | ||
declare triggers: HTMLElement[]; | ||
@@ -365,16 +357,20 @@ declare isStatic: boolean; | ||
// the modal-dialog | ||
this.modalDialog = querySelector(`.${modalString}-dialog`, element); | ||
const modalDialog = querySelector(`.${modalString}-dialog`, element); | ||
// modal can have multiple triggering elements | ||
this.triggers = [...querySelectorAll(modalToggleSelector, getDocument(element))].filter( | ||
btn => getTargetElement(btn) === element, | ||
); | ||
/* istanbul ignore else */ | ||
if (modalDialog) { | ||
this.modalDialog = modalDialog; | ||
// modal can have multiple triggering elements | ||
this.triggers = [...querySelectorAll(modalToggleSelector, getDocument(element))].filter( | ||
btn => getTargetElement(btn) === element, | ||
); | ||
// additional internals | ||
this.isStatic = this.options.backdrop === 'static'; | ||
this.hasFade = hasClass(element, fadeClass); | ||
this.relatedTarget = null; | ||
// additional internals | ||
this.isStatic = this.options.backdrop === 'static'; | ||
this.hasFade = hasClass(element, fadeClass); | ||
this.relatedTarget = null; | ||
// attach event listeners | ||
toggleModalHandler(this, true); | ||
// attach event listeners | ||
toggleModalHandler(this, true); | ||
} | ||
} | ||
@@ -409,60 +405,57 @@ | ||
if (hasClass(element, showClass)) return; | ||
if (!hasClass(element, showClass)) { | ||
showModalEvent.relatedTarget = relatedTarget || undefined; | ||
dispatchEvent(element, showModalEvent); | ||
if (!showModalEvent.defaultPrevented) { | ||
// we elegantly hide any opened modal/offcanvas | ||
const currentOpen = getCurrentOpen(element); | ||
showModalEvent.relatedTarget = relatedTarget || undefined; | ||
dispatchEvent(element, showModalEvent); | ||
if (showModalEvent.defaultPrevented) return; | ||
if (currentOpen && currentOpen !== element) { | ||
const that = | ||
getModalInstance(currentOpen) || | ||
/* istanbul ignore next */ | ||
getInstance<typeof BaseComponent & { hide: () => void }>(currentOpen, offcanvasComponent); | ||
if (that) that.hide(); | ||
} | ||
if (backdrop) { | ||
if (!hasPopup(overlay)) { | ||
appendOverlay(element, hasFade, true); | ||
} else { | ||
toggleOverlayType(true); | ||
} | ||
// we elegantly hide any opened modal/offcanvas | ||
const currentOpen = getCurrentOpen(element); | ||
if (currentOpen && currentOpen !== element) { | ||
const that = | ||
getModalInstance(currentOpen) || | ||
/* istanbul ignore next */ | ||
getInstance<typeof BaseComponent & { hide: () => void }>(currentOpen, offcanvasComponent); | ||
if (that) that.hide(); | ||
} | ||
if (backdrop) { | ||
if (!hasPopup(overlay)) { | ||
appendOverlay(element, hasFade, true); | ||
} else { | ||
toggleOverlayType(true); | ||
overlayDelay = getElementTransitionDuration(overlay); | ||
showOverlay(); | ||
setTimeout(() => beforeModalShow(this), overlayDelay); | ||
} else { | ||
beforeModalShow(this); | ||
/* istanbul ignore else */ | ||
if (currentOpen && hasClass(overlay, showClass)) { | ||
hideOverlay(); | ||
} | ||
} | ||
} | ||
overlayDelay = getElementTransitionDuration(overlay); | ||
showOverlay(); | ||
setTimeout(() => beforeModalShow(this), overlayDelay); | ||
} else { | ||
beforeModalShow(this); | ||
/* istanbul ignore else */ | ||
if (currentOpen && hasClass(overlay, showClass)) { | ||
hideOverlay(); | ||
} | ||
} | ||
} | ||
/** | ||
* Hide the modal from the user. | ||
* | ||
* @param callback when defined it will skip animation | ||
*/ | ||
hide(callback?: () => void) { | ||
/** Hide the modal from the user. */ | ||
hide() { | ||
const { element, hasFade, relatedTarget } = this; | ||
if (!hasClass(element, showClass)) return; | ||
if (hasClass(element, showClass)) { | ||
hideModalEvent.relatedTarget = relatedTarget || undefined; | ||
dispatchEvent(element, hideModalEvent); | ||
hideModalEvent.relatedTarget = relatedTarget || undefined; | ||
dispatchEvent(element, hideModalEvent); | ||
if (hideModalEvent.defaultPrevented) return; | ||
removeClass(element, showClass); | ||
setAttribute(element, ariaHidden, 'true'); | ||
removeAttribute(element, ariaModal); | ||
if (!hideModalEvent.defaultPrevented) { | ||
removeClass(element, showClass); | ||
setAttribute(element, ariaHidden, 'true'); | ||
removeAttribute(element, ariaModal); | ||
// if (hasFade && callback) { | ||
/* istanbul ignore else */ | ||
if (hasFade) { | ||
emulateTransitionEnd(element, () => beforeModalHide(this, callback)); | ||
} else { | ||
beforeModalHide(this, callback); | ||
/* istanbul ignore else */ | ||
if (hasFade) { | ||
emulateTransitionEnd(element, () => beforeModalHide(this)); | ||
} else { | ||
beforeModalHide(this); | ||
} | ||
} | ||
} | ||
@@ -481,6 +474,16 @@ } | ||
dispose() { | ||
toggleModalHandler(this); | ||
// use callback | ||
this.hide(() => super.dispose()); | ||
const clone = { ...this }; | ||
const { element, modalDialog } = clone; | ||
const callback = () => setTimeout(() => super.dispose(), 17); | ||
toggleModalHandler(clone); | ||
// use transitionend callback | ||
this.hide(); | ||
/* istanbul ignore else */ | ||
if (hasClass(element, 'fade')) { | ||
emulateTransitionEnd(modalDialog, callback); | ||
} else { | ||
callback(); | ||
} | ||
} | ||
} |
@@ -11,3 +11,2 @@ /* Native JavaScript for Bootstrap 5 | OffCanvas | ||
removeAttribute, | ||
isFunction, | ||
setAttribute, | ||
@@ -151,5 +150,4 @@ keyEscape, | ||
* @param self the `Offcanvas` instance | ||
* @param callback the hide callback | ||
*/ | ||
const beforeOffcanvasHide = (self: Offcanvas, callback?: () => void) => { | ||
const beforeOffcanvasHide = (self: Offcanvas) => { | ||
const { element, options } = self; | ||
@@ -162,4 +160,4 @@ const currentOpen = getCurrentOpen(element); | ||
hideOverlay(); | ||
emulateTransitionEnd(overlay, () => hideOffcanvasComplete(self, callback)); | ||
} else hideOffcanvasComplete(self, callback); | ||
emulateTransitionEnd(overlay, () => hideOffcanvasComplete(self)); | ||
} else hideOffcanvasComplete(self); | ||
}; | ||
@@ -201,27 +199,28 @@ | ||
/* istanbul ignore next: must have a filter */ | ||
if (!self) return; | ||
/* istanbul ignore else */ | ||
if (self) { | ||
const { options, triggers } = self; | ||
const { backdrop } = options; | ||
const trigger = closest(target as HTMLElement, offcanvasToggleSelector); | ||
const selection = getDocument(element).getSelection(); | ||
const { options, triggers } = self; | ||
const { backdrop } = options; | ||
const trigger = closest(target as HTMLElement, offcanvasToggleSelector); | ||
const selection = getDocument(element).getSelection(); | ||
/* istanbul ignore else: a filter is required here */ | ||
if (!overlay.contains(target as HTMLElement) || backdrop !== 'static') { | ||
/* istanbul ignore else */ | ||
if ( | ||
!(selection && selection.toString().length) && | ||
((!element.contains(target as HTMLElement) && | ||
backdrop && | ||
/* istanbul ignore next */ (!trigger || triggers.includes(target as HTMLElement))) || | ||
(offCanvasDismiss && offCanvasDismiss.contains(target as HTMLElement))) | ||
) { | ||
self.relatedTarget = | ||
offCanvasDismiss && offCanvasDismiss.contains(target as HTMLElement) ? offCanvasDismiss : null; | ||
self.hide(); | ||
} | ||
/* istanbul ignore next: a filter is required here */ | ||
if (overlay.contains(target as HTMLElement) && backdrop === 'static') return; | ||
/* istanbul ignore else */ | ||
if ( | ||
!(selection && selection.toString().length) && | ||
((!element.contains(target as HTMLElement) && | ||
backdrop && | ||
/* istanbul ignore next */ (!trigger || triggers.includes(target as HTMLElement))) || | ||
(offCanvasDismiss && offCanvasDismiss.contains(target as HTMLElement))) | ||
) { | ||
self.relatedTarget = offCanvasDismiss && offCanvasDismiss.contains(target as HTMLElement) ? offCanvasDismiss : null; | ||
self.hide(); | ||
/* istanbul ignore next */ | ||
if (trigger && trigger.tagName === 'A') e.preventDefault(); | ||
} | ||
} | ||
/* istanbul ignore next */ | ||
if (trigger && trigger.tagName === 'A') e.preventDefault(); | ||
}; | ||
@@ -239,9 +238,9 @@ | ||
/* istanbul ignore next: must filter */ | ||
if (!self) return; | ||
/* istanbul ignore else */ | ||
if (self.options.keyboard && code === keyEscape) { | ||
self.relatedTarget = null; | ||
self.hide(); | ||
if (self) { | ||
/* istanbul ignore else */ | ||
if (self.options.keyboard && code === keyEscape) { | ||
self.relatedTarget = null; | ||
self.hide(); | ||
} | ||
} | ||
@@ -273,5 +272,4 @@ }; | ||
* @param self the `Offcanvas` instance | ||
* @param callback the hide callback | ||
*/ | ||
const hideOffcanvasComplete = (self: Offcanvas, callback?: () => void) => { | ||
const hideOffcanvasComplete = (self: Offcanvas) => { | ||
const { element, triggers } = self; | ||
@@ -297,4 +295,2 @@ | ||
} | ||
// callback | ||
if (isFunction(callback)) callback(); | ||
}; | ||
@@ -361,35 +357,36 @@ | ||
if (hasClass(element, showClass)) return; | ||
if (!hasClass(element, showClass)) { | ||
showOffcanvasEvent.relatedTarget = relatedTarget || undefined; | ||
shownOffcanvasEvent.relatedTarget = relatedTarget || undefined; | ||
dispatchEvent(element, showOffcanvasEvent); | ||
showOffcanvasEvent.relatedTarget = relatedTarget || undefined; | ||
shownOffcanvasEvent.relatedTarget = relatedTarget || undefined; | ||
dispatchEvent(element, showOffcanvasEvent); | ||
if (showOffcanvasEvent.defaultPrevented) return; | ||
if (!showOffcanvasEvent.defaultPrevented) { | ||
// we elegantly hide any opened modal/offcanvas | ||
const currentOpen = getCurrentOpen(element); | ||
if (currentOpen && currentOpen !== element) { | ||
const that = | ||
getOffcanvasInstance(currentOpen) || | ||
/* istanbul ignore next */ | ||
getInstance<typeof BaseComponent & { hide: () => void }>(currentOpen, modalComponent); | ||
if (that) that.hide(); | ||
} | ||
// we elegantly hide any opened modal/offcanvas | ||
const currentOpen = getCurrentOpen(element); | ||
if (currentOpen && currentOpen !== element) { | ||
const that = | ||
getOffcanvasInstance(currentOpen) || | ||
/* istanbul ignore next */ | ||
getInstance<typeof BaseComponent & { hide: () => void }>(currentOpen, modalComponent); | ||
if (that) that.hide(); | ||
} | ||
if (options.backdrop) { | ||
if (!hasPopup(overlay)) { | ||
appendOverlay(element, true); | ||
} else { | ||
toggleOverlayType(); | ||
} | ||
if (options.backdrop) { | ||
if (!hasPopup(overlay)) { | ||
appendOverlay(element, true); | ||
} else { | ||
toggleOverlayType(); | ||
} | ||
overlayDelay = getElementTransitionDuration(overlay); | ||
showOverlay(); | ||
overlayDelay = getElementTransitionDuration(overlay); | ||
showOverlay(); | ||
setTimeout(() => beforeOffcanvasShow(this), overlayDelay); | ||
} else { | ||
beforeOffcanvasShow(this); | ||
/* istanbul ignore else */ | ||
if (currentOpen && hasClass(overlay, showClass)) { | ||
hideOverlay(); | ||
setTimeout(() => beforeOffcanvasShow(this), overlayDelay); | ||
} else { | ||
beforeOffcanvasShow(this); | ||
/* istanbul ignore next - this test was done on Modal */ | ||
if (currentOpen && hasClass(overlay, showClass)) { | ||
hideOverlay(); | ||
} | ||
} | ||
} | ||
@@ -399,23 +396,16 @@ } | ||
/** | ||
* Hides the offcanvas from the user. | ||
* | ||
* @param callback when `true` it will skip animation | ||
*/ | ||
hide(callback?: () => void) { | ||
/** Hides the offcanvas from the user. */ | ||
hide() { | ||
const { element, relatedTarget } = this; | ||
if (!hasClass(element, showClass)) return; | ||
hideOffcanvasEvent.relatedTarget = relatedTarget || undefined; | ||
hiddenOffcanvasEvent.relatedTarget = relatedTarget || undefined; | ||
dispatchEvent(element, hideOffcanvasEvent); | ||
if (hideOffcanvasEvent.defaultPrevented) return; | ||
addClass(element, offcanvasTogglingClass); | ||
removeClass(element, showClass); | ||
if (!callback) { | ||
emulateTransitionEnd(element, () => beforeOffcanvasHide(this, callback)); | ||
} else beforeOffcanvasHide(this, callback); | ||
if (hasClass(element, showClass)) { | ||
hideOffcanvasEvent.relatedTarget = relatedTarget || undefined; | ||
hiddenOffcanvasEvent.relatedTarget = relatedTarget || undefined; | ||
dispatchEvent(element, hideOffcanvasEvent); | ||
if (!hideOffcanvasEvent.defaultPrevented) { | ||
addClass(element, offcanvasTogglingClass); | ||
removeClass(element, showClass); | ||
beforeOffcanvasHide(this); | ||
} | ||
} | ||
} | ||
@@ -425,5 +415,16 @@ | ||
dispose() { | ||
toggleOffcanvasEvents(this); | ||
this.hide(() => super.dispose()); | ||
const clone = { ...this }; | ||
const { element, options } = clone; | ||
const delay = options.backdrop ? getElementTransitionDuration(overlay) : /* istanbul ignore next */ 0; | ||
const callback = () => setTimeout(() => super.dispose(), delay + 17); | ||
toggleOffcanvasEvents(clone); | ||
this.hide(); | ||
if (hasClass(element, showClass)) { | ||
emulateTransitionEnd(element, callback); | ||
/* istanbul ignore next */ | ||
} else { | ||
callback(); | ||
} | ||
} | ||
} |
@@ -71,3 +71,3 @@ /* Native JavaScript for Bootstrap 5 | Popover | ||
show = () => { | ||
super._show(); | ||
super.show(); | ||
// btn only exists within dismissible popover | ||
@@ -74,0 +74,0 @@ const { options, btn } = this; |
@@ -212,12 +212,12 @@ /* Native JavaScript for Bootstrap 5 | ScrollSpy | ||
// invalidate | ||
if (!this.target) return; | ||
if (this.target) { | ||
// set initial state | ||
this.scrollTarget = element.clientHeight < element.scrollHeight ? element : getWindow(element); | ||
this.scrollHeight = getScrollHeight(this.scrollTarget); | ||
// set initial state | ||
this.scrollTarget = element.clientHeight < element.scrollHeight ? element : getWindow(element); | ||
this.scrollHeight = getScrollHeight(this.scrollTarget); | ||
// add event handlers | ||
toggleSpyHandlers(this, true); | ||
// add event handlers | ||
toggleSpyHandlers(this, true); | ||
this.refresh(); | ||
this.refresh(); | ||
} | ||
} | ||
@@ -247,36 +247,36 @@ | ||
// check if target is visible and invalidate | ||
/* istanbul ignore next */ | ||
if (target?.offsetHeight === 0) return; | ||
/* istanbul ignore else */ | ||
if (isHTMLElement(target) && target.offsetHeight > 0) { | ||
updateSpyTargets(this); | ||
updateSpyTargets(this); | ||
const { scrollTop, maxScroll, itemsLength, items, activeItem } = this; | ||
const { scrollTop, maxScroll, itemsLength, items, activeItem } = this; | ||
if (scrollTop >= maxScroll) { | ||
const newActiveItem = items[itemsLength - 1]; | ||
if (scrollTop >= maxScroll) { | ||
const newActiveItem = items[itemsLength - 1]; | ||
/* istanbul ignore else */ | ||
if (activeItem !== newActiveItem) { | ||
activate(this, newActiveItem); | ||
} | ||
return; | ||
} | ||
/* istanbul ignore else */ | ||
if (activeItem !== newActiveItem) { | ||
activate(this, newActiveItem); | ||
const { offsets } = this; | ||
if (activeItem && scrollTop < offsets[0] && offsets[0] > 0) { | ||
this.activeItem = null; | ||
if (target) clear(target); | ||
return; | ||
} | ||
return; | ||
} | ||
const { offsets } = this; | ||
if (activeItem && scrollTop < offsets[0] && offsets[0] > 0) { | ||
this.activeItem = null; | ||
if (target) clear(target); | ||
return; | ||
items.forEach((item, i) => { | ||
if ( | ||
activeItem !== item && | ||
scrollTop >= offsets[i] && | ||
(typeof offsets[i + 1] === 'undefined' || scrollTop < offsets[i + 1]) | ||
) { | ||
activate(this, item); | ||
} | ||
}); | ||
} | ||
items.forEach((item, i) => { | ||
if ( | ||
activeItem !== item && | ||
scrollTop >= offsets[i] && | ||
(typeof offsets[i + 1] === 'undefined' || scrollTop < offsets[i + 1]) | ||
) { | ||
activate(this, item); | ||
} | ||
}); | ||
}; | ||
@@ -283,0 +283,0 @@ |
@@ -145,33 +145,34 @@ /* Native JavaScript for Bootstrap 5 | Tab | ||
dispatchEvent(element, showTabEvent); | ||
if (showTabEvent.defaultPrevented) return; | ||
if (nextContent) addClass(nextContent, activeClass); | ||
if (content) removeClass(content, activeClass); | ||
if (!showTabEvent.defaultPrevented) { | ||
if (nextContent) addClass(nextContent, activeClass); | ||
if (content) removeClass(content, activeClass); | ||
/* istanbul ignore else */ | ||
if (tabContent && nextContent && hasClass(nextContent, fadeClass)) { | ||
const nextHeight = nextContent.scrollHeight; | ||
tabPrivate.set(element, { currentHeight, nextHeight, tab: null, content: null }); | ||
/* istanbul ignore else */ | ||
if (tabContent && nextContent && hasClass(nextContent, fadeClass)) { | ||
const nextHeight = nextContent.scrollHeight; | ||
tabPrivate.set(element, { currentHeight, nextHeight, tab: null, content: null }); | ||
addClass(tabContent, collapsingClass); | ||
tabContent.style.height = `${currentHeight}px`; | ||
reflow(tabContent); | ||
[content, nextContent].forEach(c => { | ||
if (c) removeClass(c, 'overflow-hidden'); | ||
}); | ||
} | ||
addClass(tabContent, collapsingClass); | ||
tabContent.style.height = `${currentHeight}px`; | ||
reflow(tabContent); | ||
[content, nextContent].forEach(c => { | ||
if (c) removeClass(c, 'overflow-hidden'); | ||
}); | ||
} | ||
if (nextContent && nextContent && hasClass(nextContent, fadeClass)) { | ||
setTimeout(() => { | ||
addClass(nextContent, showClass); | ||
emulateTransitionEnd(nextContent, () => { | ||
triggerTabShow(self); | ||
}); | ||
}, 1); | ||
} else { | ||
if (nextContent) addClass(nextContent, showClass); | ||
triggerTabShow(self); | ||
if (nextContent && nextContent && hasClass(nextContent, fadeClass)) { | ||
setTimeout(() => { | ||
addClass(nextContent, showClass); | ||
emulateTransitionEnd(nextContent, () => { | ||
triggerTabShow(self); | ||
}); | ||
}, 1); | ||
} else { | ||
if (nextContent) addClass(nextContent, showClass); | ||
triggerTabShow(self); | ||
} | ||
if (tab) dispatchEvent(tab, hiddenTabEvent); | ||
} | ||
if (tab) dispatchEvent(tab, hiddenTabEvent); | ||
}; | ||
@@ -235,7 +236,8 @@ | ||
const self = getTabInstance(e.target as HTMLElement); | ||
/* istanbul ignore next: must filter */ | ||
if (!self) return; | ||
e.preventDefault(); | ||
self.show(); | ||
/* istanbul ignore else */ | ||
if (self) { | ||
e.preventDefault(); | ||
self.show(); | ||
} | ||
}; | ||
@@ -265,32 +267,33 @@ | ||
// no point initializing a tab without a corresponding content | ||
if (!content) return; | ||
/* istanbul ignore else */ | ||
if (content) { | ||
const nav = closest(element, '.nav'); | ||
const container = closest(content, '.tab-content'); | ||
const nav = closest(element, '.nav'); | ||
const container = closest(content, '.tab-content'); | ||
this.nav = nav; | ||
this.content = content; | ||
this.tabContent = container; | ||
this.nav = nav; | ||
this.content = content; | ||
this.tabContent = container; | ||
// event targets | ||
this.dropdown = getParentDropdown(element); | ||
// event targets | ||
this.dropdown = getParentDropdown(element); | ||
// show first Tab instance of none is shown | ||
// suggested on #432 | ||
const { tab } = getActiveTab(this); | ||
if (nav && !tab) { | ||
const firstTab = querySelector(tabSelector, nav); | ||
const firstTabContent = firstTab && getTargetElement(firstTab); | ||
// show first Tab instance of none is shown | ||
// suggested on #432 | ||
const { tab } = getActiveTab(this); | ||
if (nav && !tab) { | ||
const firstTab = querySelector(tabSelector, nav); | ||
const firstTabContent = firstTab && getTargetElement(firstTab); | ||
/* istanbul ignore else */ | ||
if (firstTabContent) { | ||
addClass(firstTab, activeClass); | ||
addClass(firstTabContent, showClass); | ||
addClass(firstTabContent, activeClass); | ||
setAttribute(element, ariaSelected, 'true'); | ||
} | ||
} | ||
/* istanbul ignore else */ | ||
if (firstTabContent) { | ||
addClass(firstTab, activeClass); | ||
addClass(firstTabContent, showClass); | ||
addClass(firstTabContent, activeClass); | ||
setAttribute(element, ariaSelected, 'true'); | ||
} | ||
// add event listener | ||
toggleTabHandler(this, true); | ||
} | ||
// add event listener | ||
toggleTabHandler(this, true); | ||
} | ||
@@ -321,34 +324,38 @@ | ||
if (isHTMLElement(tab as Node)) dispatchEvent(tab as EventTarget, hideTabEvent); | ||
if (hideTabEvent.defaultPrevented) return; | ||
/* istanbul ignore else */ | ||
if (isHTMLElement(tab)) { | ||
dispatchEvent(tab as EventTarget, hideTabEvent); | ||
/* istanbul ignore else */ | ||
if (!hideTabEvent.defaultPrevented) { | ||
addClass(element, activeClass); | ||
setAttribute(element, ariaSelected, 'true'); | ||
addClass(element, activeClass); | ||
setAttribute(element, ariaSelected, 'true'); | ||
const activeDropdown = isHTMLElement(tab) && getParentDropdown(tab); | ||
if (activeDropdown && hasClass(activeDropdown, activeClass)) { | ||
removeClass(activeDropdown, activeClass); | ||
} | ||
const activeDropdown = isHTMLElement(tab as HTMLElement) && getParentDropdown(tab as HTMLElement); | ||
if (activeDropdown && hasClass(activeDropdown, activeClass)) { | ||
removeClass(activeDropdown, activeClass); | ||
} | ||
/* istanbul ignore else */ | ||
if (nav) { | ||
const toggleTab = () => { | ||
if (tab) { | ||
removeClass(tab, activeClass); | ||
setAttribute(tab, ariaSelected, 'false'); | ||
} | ||
if (dropdown && !hasClass(dropdown, activeClass)) addClass(dropdown, activeClass); | ||
}; | ||
/* istanbul ignore else */ | ||
if (nav) { | ||
const toggleTab = () => { | ||
if (tab) { | ||
removeClass(tab, activeClass); | ||
setAttribute(tab, ariaSelected, 'false'); | ||
if (content && (hasClass(content, fadeClass) || (nextContent && hasClass(nextContent, fadeClass)))) { | ||
Timer.set(nav, toggleTab, 1); | ||
} else toggleTab(); | ||
} | ||
if (dropdown && !hasClass(dropdown, activeClass)) addClass(dropdown, activeClass); | ||
}; | ||
if (content && (hasClass(content, fadeClass) || (nextContent && hasClass(nextContent, fadeClass)))) { | ||
Timer.set(nav, toggleTab, 1); | ||
} else toggleTab(); | ||
} | ||
if (content) { | ||
removeClass(content, showClass); | ||
if (hasClass(content, fadeClass)) { | ||
emulateTransitionEnd(content, () => triggerTabHide(this)); | ||
} else { | ||
triggerTabHide(this); | ||
if (content) { | ||
removeClass(content, showClass); | ||
if (hasClass(content, fadeClass)) { | ||
emulateTransitionEnd(content, () => triggerTabHide(this)); | ||
} else { | ||
triggerTabHide(this); | ||
} | ||
} | ||
} | ||
@@ -355,0 +362,0 @@ } |
@@ -196,9 +196,10 @@ /* Native JavaScript for Bootstrap 5 | Toast | ||
const self = element && getToastInstance(element); | ||
/* istanbul ignore next */ | ||
if (!self) return; | ||
/* istanbul ignore else */ | ||
if (trigger && trigger.tagName === 'A') e.preventDefault(); | ||
self.relatedTarget = trigger; | ||
self.show(); | ||
if (self) { | ||
/* istanbul ignore else */ | ||
if (trigger && trigger.tagName === 'A') e.preventDefault(); | ||
self.relatedTarget = trigger; | ||
self.show(); | ||
} | ||
}; | ||
@@ -217,9 +218,9 @@ | ||
/* istanbul ignore next: a solid filter is required */ | ||
if (!self || element === relatedTarget || element.contains(relatedTarget as Node)) return; | ||
if ([mouseenterEvent, focusinEvent].includes(type)) { | ||
Timer.clear(element, toastString); | ||
} else { | ||
Timer.set(element, () => self.hide(), self.options.delay, toastString); | ||
/* istanbul ignore else: a solid filter is required */ | ||
if (self && element !== relatedTarget && !element.contains(relatedTarget as Node)) { | ||
if ([mouseenterEvent, focusinEvent].includes(type)) { | ||
Timer.clear(element, toastString); | ||
} else { | ||
Timer.set(element, () => self.hide(), self.options.delay, toastString); | ||
} | ||
} | ||
@@ -291,5 +292,5 @@ }; | ||
dispatchEvent(element, showToastEvent); | ||
if (showToastEvent.defaultPrevented) return; | ||
showToast(this); | ||
if (!showToastEvent.defaultPrevented) { | ||
showToast(this); | ||
} | ||
} | ||
@@ -305,4 +306,5 @@ }; | ||
dispatchEvent(element, hideToastEvent); | ||
if (hideToastEvent.defaultPrevented) return; | ||
hideToast(this); | ||
if (!hideToastEvent.defaultPrevented) { | ||
hideToast(this); | ||
} | ||
} | ||
@@ -309,0 +311,0 @@ }; |
@@ -31,3 +31,2 @@ /* Native JavaScript for Bootstrap 5 | Tooltip | ||
isApple, | ||
isFunction, | ||
getInstance, | ||
@@ -94,2 +93,13 @@ ObjectAssign, | ||
/** | ||
* Check if container contains the tooltip. | ||
* | ||
* @param self Tooltip | ||
*/ | ||
const hasTip = (self: Tooltip): boolean | undefined => { | ||
const { tooltip, container, offsetParent } = self; | ||
return tooltip && hasPopup(tooltip, container === offsetParent ? container : offsetParent); | ||
}; | ||
/** | ||
* Executes after the instance has been disposed. | ||
@@ -149,3 +159,3 @@ * | ||
const tooltipHiddenAction = (self: Tooltip) => { | ||
const { element, onHideComplete } = self; | ||
const { element } = self; | ||
const hiddenTooltipEvent = createCustomEvent<TooltipEvent | PopoverEvent>(`hidden.bs.${toLowerCase(self.name)}`); | ||
@@ -156,6 +166,3 @@ | ||
dispatchEvent(element, hiddenTooltipEvent); | ||
if (isFunction(onHideComplete)) { | ||
onHideComplete(); | ||
self.onHideComplete = undefined; | ||
} | ||
Timer.clear(element, 'out'); | ||
@@ -178,33 +185,36 @@ }; | ||
if (trigger.includes('manual')) return; | ||
/* istanbul ignore else */ | ||
if (!trigger.includes('manual')) { | ||
self.enabled = !!add; | ||
self.enabled = !!add; | ||
const triggerOptions = trigger.split(' '); | ||
const triggerOptions = trigger.split(' '); | ||
triggerOptions.forEach(tr => { | ||
/* istanbul ignore else */ | ||
if (tr === mousehoverEvent) { | ||
action(element, mousedownEvent, self.handleShow); | ||
action(element, mouseenterEvent, self.handleShow); | ||
triggerOptions.forEach(tr => { | ||
/* istanbul ignore else */ | ||
if (tr === mousehoverEvent) { | ||
action(element, mousedownEvent, self.show); | ||
action(element, mouseenterEvent, self.show); | ||
/* istanbul ignore else */ | ||
if (!dismissible) { | ||
action(element, mouseleaveEvent, self.handleHide); | ||
action(getDocument(element), touchstartEvent, self.handleTouch as EventListener, passiveHandler); | ||
} | ||
} else if (tr === mouseclickEvent) { | ||
action(element, tr, !dismissible ? self.toggle : self.handleShow); | ||
} else if (tr === focusEvent) { | ||
action(element, focusinEvent, self.handleShow); | ||
/* istanbul ignore else */ | ||
if (!dismissible) action(element, focusoutEvent, self.handleHide); | ||
/* istanbul ignore else */ | ||
if (isApple) { | ||
action(element, mouseclickEvent, self.handleFocus); | ||
} | ||
} | ||
/* istanbul ignore else */ | ||
if (dismissible && btn) { | ||
action(btn, mouseclickEvent, self.hide); | ||
} else { | ||
action(element, mouseleaveEvent, self.hide); | ||
action(getDocument(element), touchstartEvent, self.handleTouch as EventListener, passiveHandler); | ||
action(btn, mouseclickEvent, self.handleHide); | ||
} | ||
} else if (tr === mouseclickEvent) { | ||
action(element, tr, !dismissible ? self.toggle : self.show); | ||
} else if (tr === focusEvent) { | ||
action(element, focusinEvent, self.show); | ||
/* istanbul ignore else */ | ||
if (!dismissible) action(element, focusoutEvent, self.hide); | ||
/* istanbul ignore else */ | ||
if (isApple) { | ||
action(element, mouseclickEvent, () => focus(element)); | ||
} | ||
} | ||
}); | ||
}); | ||
} | ||
}; | ||
@@ -233,4 +243,4 @@ | ||
// dismiss tooltips inside modal / offcanvas | ||
if (parentModal) action(parentModal, `hide.bs.${modalString}`, self.hide); | ||
if (parentOffcanvas) action(parentOffcanvas, `hide.bs.${offcanvasString}`, self.hide); | ||
if (parentModal) action(parentModal, `hide.bs.${modalString}`, self.handleHide); | ||
if (parentOffcanvas) action(parentOffcanvas, `hide.bs.${offcanvasString}`, self.handleHide); | ||
}; | ||
@@ -273,3 +283,2 @@ | ||
declare id: string; | ||
declare onHideComplete?: () => void; | ||
@@ -300,29 +309,26 @@ /** | ||
// invalidate | ||
if ((!options.title && isTooltip) || (!isTooltip && !options.content)) { | ||
// throw Error(`${this.name} Error: target has no content set.`); | ||
return; | ||
} | ||
if (!((!options.title && isTooltip) || (!isTooltip && !options.content))) { | ||
// reset default options | ||
ObjectAssign(tooltipDefaults, { titleAttr: '' }); | ||
// reset default options | ||
ObjectAssign(tooltipDefaults, { titleAttr: '' }); | ||
// set title attributes and add event listeners | ||
/* istanbul ignore else */ | ||
if (hasAttribute(element, titleAttr) && isTooltip && typeof options.title === 'string') { | ||
toggleTooltipTitle(this, options.title); | ||
} | ||
// set title attributes and add event listeners | ||
/* istanbul ignore else */ | ||
if (hasAttribute(element, titleAttr) && isTooltip && typeof options.title === 'string') { | ||
toggleTooltipTitle(this, options.title); | ||
} | ||
// set containers | ||
this.container = getElementContainer(element); | ||
this.offsetParent = ['sticky', 'fixed'].some( | ||
position => getElementStyle(this.container as HTMLElement, 'position') === position, | ||
) | ||
? (this.container as HTMLElement) | ||
: getDocument(this.element).body; | ||
// set containers | ||
this.container = getElementContainer(element); | ||
this.offsetParent = ['sticky', 'fixed'].some( | ||
position => getElementStyle(this.container as HTMLElement, 'position') === position, | ||
) | ||
? (this.container as HTMLElement) | ||
: getDocument(this.element).body; | ||
// create tooltip here | ||
createTip(this); | ||
// create tooltip here | ||
createTip(this); | ||
// attach events | ||
toggleTooltipHandlers(this, true); | ||
// attach events | ||
toggleTooltipHandlers(this, true); | ||
} | ||
} | ||
@@ -345,5 +351,7 @@ | ||
// ====================== | ||
/** Handles the focus event on iOS. */ | ||
handleFocus = () => focus(this.element); | ||
/** Shows the tooltip. */ | ||
show = () => this._show(); | ||
_show() { | ||
handleShow = () => this.show(); | ||
show() { | ||
const { options, tooltip, element, container, offsetParent, id } = this; | ||
@@ -356,3 +364,3 @@ const { animation } = options; | ||
if (tooltip && !outTimer && !hasPopup(tooltip, tipContainer)) { | ||
if (tooltip && !outTimer && !hasTip(this)) { | ||
Timer.set( | ||
@@ -363,17 +371,17 @@ element, | ||
dispatchEvent(element, showTooltipEvent); | ||
if (showTooltipEvent.defaultPrevented) return; | ||
if (!showTooltipEvent.defaultPrevented) { | ||
// append to container | ||
appendPopup(tooltip, tipContainer); | ||
// append to container | ||
appendPopup(tooltip, tipContainer); | ||
setAttribute(element, ariaDescribedBy, `#${id}`); | ||
setAttribute(element, ariaDescribedBy, `#${id}`); | ||
this.update(); | ||
toggleTooltipOpenHandlers(this, true); | ||
this.update(); | ||
toggleTooltipOpenHandlers(this, true); | ||
/* istanbul ignore else */ | ||
if (!hasClass(tooltip, showClass)) addClass(tooltip, showClass); | ||
/* istanbul ignore else */ | ||
if (animation) emulateTransitionEnd(tooltip, () => tooltipShownAction(this)); | ||
else tooltipShownAction(this); | ||
/* istanbul ignore else */ | ||
if (!hasClass(tooltip, showClass)) addClass(tooltip, showClass); | ||
/* istanbul ignore else */ | ||
if (animation) emulateTransitionEnd(tooltip, () => tooltipShownAction(this)); | ||
else tooltipShownAction(this); | ||
} | ||
}, | ||
@@ -387,4 +395,5 @@ 17, | ||
/** Hides the tooltip. */ | ||
hide = () => { | ||
const { options, tooltip, element, container, offsetParent } = this; | ||
handleHide = () => this.hide(); | ||
hide() { | ||
const { options, tooltip, element } = this; | ||
const { animation, delay } = options; | ||
@@ -395,3 +404,3 @@ | ||
/* istanbul ignore else */ | ||
if (tooltip && hasPopup(tooltip, container === offsetParent ? container : offsetParent)) { | ||
if (tooltip && hasTip(this)) { | ||
Timer.set( | ||
@@ -403,11 +412,11 @@ element, | ||
if (hideTooltipEvent.defaultPrevented) return; | ||
if (!hideTooltipEvent.defaultPrevented) { | ||
this.update(); | ||
removeClass(tooltip, showClass); | ||
toggleTooltipOpenHandlers(this); | ||
this.update(); | ||
removeClass(tooltip, showClass); | ||
toggleTooltipOpenHandlers(this); | ||
/* istanbul ignore else */ | ||
if (animation) emulateTransitionEnd(tooltip, () => tooltipHiddenAction(this)); | ||
else tooltipHiddenAction(this); | ||
/* istanbul ignore else */ | ||
if (animation) emulateTransitionEnd(tooltip, () => tooltipHiddenAction(this)); | ||
else tooltipHiddenAction(this); | ||
} | ||
}, | ||
@@ -418,3 +427,3 @@ delay + 17, | ||
} | ||
}; | ||
} | ||
@@ -428,5 +437,5 @@ /** Updates the tooltip position. */ | ||
toggle = () => { | ||
const { tooltip, container, offsetParent } = this; | ||
const { tooltip } = this; | ||
if (tooltip && !hasPopup(tooltip, container === offsetParent ? container : offsetParent)) this.show(); | ||
if (tooltip && !hasTip(this)) this.show(); | ||
else this.hide(); | ||
@@ -447,9 +456,9 @@ }; | ||
disable() { | ||
const { tooltip, container, offsetParent, options, enabled } = this; | ||
const { tooltip, options, enabled } = this; | ||
const { animation } = options; | ||
/* istanbul ignore else */ | ||
if (enabled) { | ||
if (tooltip && hasPopup(tooltip, container === offsetParent ? container : offsetParent) && animation) { | ||
this.onHideComplete = () => toggleTooltipHandlers(this); | ||
if (tooltip && hasTip(this) && animation) { | ||
this.hide(); | ||
emulateTransitionEnd(tooltip, () => toggleTooltipHandlers(this)); | ||
} else { | ||
@@ -477,3 +486,3 @@ toggleTooltipHandlers(this); | ||
/* istanbul ignore next */ | ||
/* istanbul ignore else */ | ||
if ( | ||
@@ -492,9 +501,10 @@ (tooltip && tooltip.contains(target as HTMLElement)) || | ||
dispose() { | ||
const { tooltip, container, offsetParent, options } = this; | ||
const callback = () => disposeTooltipComplete(this, () => super.dispose()); | ||
const { tooltip, options } = this; | ||
const clone = { ...this, name: this.name }; | ||
const callback = () => setTimeout(() => disposeTooltipComplete(clone, () => super.dispose()), 17); | ||
if (options.animation && tooltip && hasPopup(tooltip, container === offsetParent ? container : offsetParent)) { | ||
if (options.animation && hasTip(clone)) { | ||
this.options.delay = 0; // reset delay | ||
this.onHideComplete = callback; | ||
this.hide(); | ||
emulateTransitionEnd(tooltip as HTMLElement, callback); | ||
} else { | ||
@@ -501,0 +511,0 @@ callback(); |
@@ -1,2 +0,2 @@ | ||
import Listener from '@thednp/event-listener'; | ||
import * as Listener from '@thednp/event-listener'; | ||
@@ -3,0 +3,0 @@ import Alert from './components/alert'; |
@@ -51,82 +51,82 @@ import { createElement, addClass, hasClass, setAttribute, querySelector, isRTL, isHTMLElement } from '@thednp/shorty'; | ||
const { tooltip } = self; | ||
/* istanbul ignore next */ | ||
if (!tooltip) return; | ||
/* istanbul ignore else */ | ||
if (tooltip) { | ||
// set id and role attributes | ||
setAttribute(tooltip, 'id', id); | ||
setAttribute(tooltip, 'role', tooltipString); | ||
// set id and role attributes | ||
setAttribute(tooltip, 'id', id); | ||
setAttribute(tooltip, 'role', tooltipString); | ||
const bodyClass = isTooltip ? `${tooltipString}-inner` : `${popoverString}-body`; | ||
const tooltipHeader = isTooltip ? null : querySelector(`.${popoverString}-header`, tooltip); | ||
const tooltipBody = querySelector(`.${bodyClass}`, tooltip); | ||
const bodyClass = isTooltip ? `${tooltipString}-inner` : `${popoverString}-body`; | ||
const tooltipHeader = isTooltip ? null : querySelector(`.${popoverString}-header`, tooltip); | ||
const tooltipBody = querySelector(`.${bodyClass}`, tooltip); | ||
// set arrow and enable access for styleTip | ||
self.arrow = querySelector(`.${tipString}-arrow`, tooltip) as HTMLElement; | ||
const { arrow } = self; | ||
// set arrow and enable access for styleTip | ||
self.arrow = querySelector(`.${tipString}-arrow`, tooltip) as HTMLElement; | ||
const { arrow } = self; | ||
if (isHTMLElement(title)) titleParts = [title.cloneNode(true)]; | ||
else { | ||
const tempTitle = createElement('div') as HTMLElement; | ||
setHtml(tempTitle, title, sanitizeFn); | ||
titleParts = [...[...tempTitle.childNodes]]; | ||
} | ||
if (isHTMLElement(title)) titleParts = [title.cloneNode(true)]; | ||
else { | ||
const tempTitle = createElement('div') as Node; | ||
setHtml(tempTitle, title, sanitizeFn); | ||
titleParts = [...[...tempTitle.childNodes]]; | ||
} | ||
if (isHTMLElement(content)) contentParts = [content.cloneNode(true)]; | ||
else { | ||
const tempContent = createElement('div') as HTMLElement; | ||
setHtml(tempContent, content, sanitizeFn); | ||
contentParts = [...[...tempContent.childNodes]]; | ||
} | ||
if (isHTMLElement(content)) contentParts = [content.cloneNode(true)]; | ||
else { | ||
const tempContent = createElement('div') as Node; | ||
setHtml(tempContent, content, sanitizeFn); | ||
contentParts = [...[...tempContent.childNodes]]; | ||
} | ||
// set dismissible button | ||
if (dismissible) { | ||
if (title) { | ||
if (isHTMLElement(btnClose)) titleParts = [...titleParts, btnClose.cloneNode(true)]; | ||
else { | ||
const tempBtn = createElement('div') as Node; | ||
setHtml(tempBtn, btnClose, sanitizeFn); | ||
titleParts = [...titleParts, tempBtn.firstChild as Node]; | ||
// set dismissible button | ||
if (dismissible) { | ||
if (title) { | ||
if (isHTMLElement(btnClose)) titleParts = [...titleParts, btnClose.cloneNode(true)]; | ||
else { | ||
const tempBtn = createElement('div') as HTMLElement; | ||
setHtml(tempBtn, btnClose, sanitizeFn); | ||
titleParts = [...titleParts, tempBtn.firstChild as Node]; | ||
} | ||
} else { | ||
/* istanbul ignore else */ | ||
if (tooltipHeader) tooltipHeader.remove(); | ||
if (isHTMLElement(btnClose)) contentParts = [...contentParts, btnClose.cloneNode(true)]; | ||
else { | ||
const tempBtn = createElement('div') as HTMLElement; | ||
setHtml(tempBtn, btnClose, sanitizeFn); | ||
contentParts = [...contentParts, tempBtn.firstChild as Node]; | ||
} | ||
} | ||
} else { | ||
/* istanbul ignore else */ | ||
if (tooltipHeader) tooltipHeader.remove(); | ||
if (isHTMLElement(btnClose)) contentParts = [...contentParts, btnClose.cloneNode(true)]; | ||
else { | ||
const tempBtn = createElement('div') as Node; | ||
setHtml(tempBtn, btnClose, sanitizeFn); | ||
contentParts = [...contentParts, tempBtn.firstChild as Node]; | ||
} | ||
} | ||
} | ||
// fill the template with content from options / data attributes | ||
// also sanitize title && content | ||
/* istanbul ignore else */ | ||
if (!isTooltip) { | ||
// fill the template with content from options / data attributes | ||
// also sanitize title && content | ||
/* istanbul ignore else */ | ||
if (title && tooltipHeader) setHtml(tooltipHeader, titleParts, sanitizeFn); | ||
/* istanbul ignore else */ | ||
if (content && tooltipBody) setHtml(tooltipBody, contentParts, sanitizeFn); | ||
// set btn | ||
self.btn = querySelector('.btn-close', tooltip) || undefined; | ||
} else if (title && tooltipBody) setHtml(tooltipBody, title, sanitizeFn); | ||
if (!isTooltip) { | ||
/* istanbul ignore else */ | ||
if (title && tooltipHeader) setHtml(tooltipHeader, titleParts, sanitizeFn); | ||
/* istanbul ignore else */ | ||
if (content && tooltipBody) setHtml(tooltipBody, contentParts, sanitizeFn); | ||
// set btn | ||
self.btn = querySelector('.btn-close', tooltip) || undefined; | ||
} else if (title && tooltipBody) setHtml(tooltipBody, title, sanitizeFn); | ||
// Bootstrap 5.2.x | ||
// addClass(tooltip, 'position-absolute'); | ||
addClass(tooltip, 'position-fixed'); | ||
addClass(arrow, 'position-absolute'); | ||
// Bootstrap 5.2.x | ||
// addClass(tooltip, 'position-absolute'); | ||
addClass(tooltip, 'position-fixed'); | ||
addClass(arrow, 'position-absolute'); | ||
// set popover animation and placement | ||
/* istanbul ignore else */ | ||
if (!hasClass(tooltip, tipString)) addClass(tooltip, tipString); | ||
/* istanbul ignore else */ | ||
if (animation && !hasClass(tooltip, fadeClass)) addClass(tooltip, fadeClass); | ||
/* istanbul ignore else */ | ||
if (customClass && !hasClass(tooltip, customClass)) { | ||
addClass(tooltip, customClass); | ||
// set popover animation and placement | ||
/* istanbul ignore else */ | ||
if (!hasClass(tooltip, tipString)) addClass(tooltip, tipString); | ||
/* istanbul ignore else */ | ||
if (animation && !hasClass(tooltip, fadeClass)) addClass(tooltip, fadeClass); | ||
/* istanbul ignore else */ | ||
if (customClass && !hasClass(tooltip, customClass)) { | ||
addClass(tooltip, customClass); | ||
} | ||
/* istanbul ignore else */ | ||
if (!hasClass(tooltip, placementClass)) addClass(tooltip, placementClass); | ||
} | ||
/* istanbul ignore else */ | ||
if (!hasClass(tooltip, placementClass)) addClass(tooltip, placementClass); | ||
}; | ||
export default createTip; |
@@ -11,8 +11,5 @@ import { isNode, isArray, isFunction, isString, isNodeList, isHTMLElement } from '@thednp/shorty'; | ||
*/ | ||
const setHtml = (element: Node, content: Node[] | Node | string, sanitizeFn?: (s: string) => string) => { | ||
/* istanbul ignore next */ | ||
if (!isHTMLElement(element) || (isString(content) && !content.length)) return; | ||
const setHtml = (element: HTMLElement, content: Node[] | Node | string, sanitizeFn?: (s: string) => string) => { | ||
/* istanbul ignore else */ | ||
if (isString(content)) { | ||
if (isString(content) && content.length) { | ||
let dirty = content.trim(); // fixing #233 | ||
@@ -19,0 +16,0 @@ if (isFunction(sanitizeFn)) dirty = sanitizeFn(dirty); |
@@ -27,164 +27,166 @@ import { | ||
const { element, tooltip, container, options, arrow } = self; | ||
/* istanbul ignore next */ | ||
if (!tooltip) return; | ||
const tipPositions = { ...tipClassPositions }; | ||
const RTL = isRTL(element); | ||
// reset tooltip style (top: 0, left: 0 works best) | ||
setElementStyle(tooltip, { | ||
// top: '0px', left: '0px', right: '', bottom: '', | ||
top: '', | ||
left: '', | ||
right: '', | ||
bottom: '', | ||
}); | ||
const isPopover = self.name === popoverComponent; | ||
const { offsetWidth: tipWidth, offsetHeight: tipHeight } = tooltip; | ||
const { clientWidth: htmlcw, clientHeight: htmlch, offsetWidth: htmlow } = getDocumentElement(element); | ||
let { placement } = options; | ||
const { clientWidth: parentCWidth, offsetWidth: parentOWidth } = container as HTMLElement; | ||
const parentPosition = getElementStyle(container as HTMLElement, 'position'); | ||
const fixedParent = parentPosition === 'fixed'; | ||
const scrollbarWidth = fixedParent ? Math.abs(parentCWidth - parentOWidth) : Math.abs(htmlcw - htmlow); | ||
const leftBoundry = RTL && fixedParent ? /* istanbul ignore next */ scrollbarWidth : 0; | ||
const rightBoundry = htmlcw - (!RTL ? scrollbarWidth : 0) - 1; | ||
const { | ||
width: elemWidth, | ||
height: elemHeight, | ||
left: elemRectLeft, | ||
right: elemRectRight, | ||
top: elemRectTop, | ||
} = getBoundingClientRect(element, true); | ||
const { x, y } = { | ||
x: elemRectLeft, | ||
y: elemRectTop, | ||
}; | ||
// reset arrow style | ||
setElementStyle(arrow as HTMLElement, { | ||
top: '', | ||
left: '', | ||
right: '', | ||
bottom: '', | ||
}); | ||
let topPosition: number | string = 0; | ||
let bottomPosition: number | string = ''; | ||
let leftPosition: number | string = 0; | ||
let rightPosition: number | string = ''; | ||
let arrowTop: number | string = ''; | ||
let arrowLeft: number | string = ''; | ||
let arrowRight: number | string = ''; | ||
/* istanbul ignore else */ | ||
if (tooltip) { | ||
const tipPositions = { ...tipClassPositions }; | ||
const RTL = isRTL(element); | ||
const arrowWidth = (arrow as HTMLElement).offsetWidth || 0; | ||
const arrowHeight = (arrow as HTMLElement).offsetHeight || 0; | ||
const arrowAdjust = arrowWidth / 2; | ||
// reset tooltip style (top: 0, left: 0 works best) | ||
setElementStyle(tooltip, { | ||
// top: '0px', left: '0px', right: '', bottom: '', | ||
top: '', | ||
left: '', | ||
right: '', | ||
bottom: '', | ||
}); | ||
const isPopover = self.name === popoverComponent; | ||
const { offsetWidth: tipWidth, offsetHeight: tipHeight } = tooltip; | ||
const { clientWidth: htmlcw, clientHeight: htmlch, offsetWidth: htmlow } = getDocumentElement(element); | ||
let { placement } = options; | ||
const { clientWidth: parentCWidth, offsetWidth: parentOWidth } = container as HTMLElement; | ||
const parentPosition = getElementStyle(container as HTMLElement, 'position'); | ||
const fixedParent = parentPosition === 'fixed'; | ||
const scrollbarWidth = fixedParent ? Math.abs(parentCWidth - parentOWidth) : Math.abs(htmlcw - htmlow); | ||
const leftBoundry = RTL && fixedParent ? /* istanbul ignore next */ scrollbarWidth : 0; | ||
const rightBoundry = htmlcw - (!RTL ? scrollbarWidth : 0) - 1; | ||
const { | ||
width: elemWidth, | ||
height: elemHeight, | ||
left: elemRectLeft, | ||
right: elemRectRight, | ||
top: elemRectTop, | ||
} = getBoundingClientRect(element, true); | ||
const { x, y } = { | ||
x: elemRectLeft, | ||
y: elemRectTop, | ||
}; | ||
// reset arrow style | ||
setElementStyle(arrow as HTMLElement, { | ||
top: '', | ||
left: '', | ||
right: '', | ||
bottom: '', | ||
}); | ||
let topPosition: number | string = 0; | ||
let bottomPosition: number | string = ''; | ||
let leftPosition: number | string = 0; | ||
let rightPosition: number | string = ''; | ||
let arrowTop: number | string = ''; | ||
let arrowLeft: number | string = ''; | ||
let arrowRight: number | string = ''; | ||
// check placement | ||
let topExceed = elemRectTop - tipHeight - arrowHeight < 0; | ||
let bottomExceed = elemRectTop + tipHeight + elemHeight + arrowHeight >= htmlch; | ||
let leftExceed = elemRectLeft - tipWidth - arrowWidth < leftBoundry; | ||
let rightExceed = elemRectLeft + tipWidth + elemWidth + arrowWidth >= rightBoundry; | ||
const arrowWidth = (arrow as HTMLElement).offsetWidth || 0; | ||
const arrowHeight = (arrow as HTMLElement).offsetHeight || 0; | ||
const arrowAdjust = arrowWidth / 2; | ||
const horizontals = ['left', 'right']; | ||
const verticals = ['top', 'bottom']; | ||
// check placement | ||
let topExceed = elemRectTop - tipHeight - arrowHeight < 0; | ||
let bottomExceed = elemRectTop + tipHeight + elemHeight + arrowHeight >= htmlch; | ||
let leftExceed = elemRectLeft - tipWidth - arrowWidth < leftBoundry; | ||
let rightExceed = elemRectLeft + tipWidth + elemWidth + arrowWidth >= rightBoundry; | ||
topExceed = horizontals.includes(placement) | ||
? elemRectTop + elemHeight / 2 - tipHeight / 2 - arrowHeight < 0 | ||
: topExceed; | ||
bottomExceed = horizontals.includes(placement) | ||
? elemRectTop + tipHeight / 2 + elemHeight / 2 + arrowHeight >= htmlch | ||
: bottomExceed; | ||
leftExceed = verticals.includes(placement) ? elemRectLeft + elemWidth / 2 - tipWidth / 2 < leftBoundry : leftExceed; | ||
rightExceed = verticals.includes(placement) | ||
? elemRectLeft + tipWidth / 2 + elemWidth / 2 >= rightBoundry | ||
: rightExceed; | ||
const horizontals = ['left', 'right']; | ||
const verticals = ['top', 'bottom']; | ||
// first remove side positions if both left and right limits are exceeded | ||
// we usually fall back to top|bottom | ||
placement = horizontals.includes(placement) && leftExceed && rightExceed ? 'top' : placement; | ||
// recompute placement | ||
placement = placement === 'top' && topExceed ? 'bottom' : placement; | ||
placement = placement === 'bottom' && bottomExceed ? 'top' : placement; | ||
placement = placement === 'left' && leftExceed ? 'right' : placement; | ||
placement = placement === 'right' && rightExceed ? 'left' : placement; | ||
topExceed = horizontals.includes(placement) | ||
? elemRectTop + elemHeight / 2 - tipHeight / 2 - arrowHeight < 0 | ||
: topExceed; | ||
bottomExceed = horizontals.includes(placement) | ||
? elemRectTop + tipHeight / 2 + elemHeight / 2 + arrowHeight >= htmlch | ||
: bottomExceed; | ||
leftExceed = verticals.includes(placement) ? elemRectLeft + elemWidth / 2 - tipWidth / 2 < leftBoundry : leftExceed; | ||
rightExceed = verticals.includes(placement) | ||
? elemRectLeft + tipWidth / 2 + elemWidth / 2 >= rightBoundry | ||
: rightExceed; | ||
// update tooltip/popover class | ||
if (!tooltip.className.includes(placement)) { | ||
tooltip.className = tooltip.className.replace(tipClasses, tipPositions[placement]); | ||
} | ||
// first remove side positions if both left and right limits are exceeded | ||
// we usually fall back to top|bottom | ||
placement = horizontals.includes(placement) && leftExceed && rightExceed ? 'top' : placement; | ||
// recompute placement | ||
placement = placement === 'top' && topExceed ? 'bottom' : placement; | ||
placement = placement === 'bottom' && bottomExceed ? 'top' : placement; | ||
placement = placement === 'left' && leftExceed ? 'right' : placement; | ||
placement = placement === 'right' && rightExceed ? /* istanbul ignore next */ 'left' : placement; | ||
// compute tooltip / popover coordinates | ||
/* istanbul ignore else */ | ||
if (horizontals.includes(placement)) { | ||
// secondary|side positions | ||
if (placement === 'left') { | ||
// LEFT | ||
leftPosition = x - tipWidth - (isPopover ? arrowWidth : 0); | ||
} else { | ||
// RIGHT | ||
leftPosition = x + elemWidth + (isPopover ? arrowWidth : 0); | ||
// update tooltip/popover class | ||
if (!tooltip.className.includes(placement)) { | ||
tooltip.className = tooltip.className.replace(tipClasses, tipPositions[placement]); | ||
} | ||
// adjust top and arrow | ||
if (topExceed && bottomExceed) { | ||
topPosition = 0; | ||
bottomPosition = 0; | ||
arrowTop = elemRectTop + elemHeight / 2 - arrowHeight / 2; | ||
} else if (topExceed) { | ||
topPosition = y; | ||
bottomPosition = ''; | ||
arrowTop = elemHeight / 2 - arrowWidth; | ||
} else if (bottomExceed) { | ||
topPosition = y - tipHeight + elemHeight; | ||
bottomPosition = ''; | ||
arrowTop = tipHeight - elemHeight / 2 - arrowWidth; | ||
} else { | ||
topPosition = y - tipHeight / 2 + elemHeight / 2; | ||
arrowTop = tipHeight / 2 - arrowHeight / 2; | ||
} | ||
} else if (verticals.includes(placement)) { | ||
if (placement === 'top') { | ||
topPosition = y - tipHeight - (isPopover ? arrowHeight : 0); | ||
} else { | ||
// BOTTOM | ||
topPosition = y + elemHeight + (isPopover ? arrowHeight : 0); | ||
} | ||
// compute tooltip / popover coordinates | ||
/* istanbul ignore else */ | ||
if (horizontals.includes(placement)) { | ||
// secondary|side positions | ||
if (placement === 'left') { | ||
// LEFT | ||
leftPosition = x - tipWidth - (isPopover ? arrowWidth : 0); | ||
} else { | ||
// RIGHT | ||
leftPosition = x + elemWidth + (isPopover ? arrowWidth : 0); | ||
} | ||
// adjust left | right and also the arrow | ||
if (leftExceed) { | ||
leftPosition = 0; | ||
arrowLeft = x + elemWidth / 2 - arrowAdjust; | ||
} else if (rightExceed) { | ||
leftPosition = 'auto'; | ||
rightPosition = 0; | ||
arrowRight = elemWidth / 2 + rightBoundry - elemRectRight - arrowAdjust; | ||
} else { | ||
leftPosition = x - tipWidth / 2 + elemWidth / 2; | ||
arrowLeft = tipWidth / 2 - arrowAdjust; | ||
// adjust top and arrow | ||
if (topExceed && bottomExceed) { | ||
topPosition = 0; | ||
bottomPosition = 0; | ||
arrowTop = elemRectTop + elemHeight / 2 - arrowHeight / 2; | ||
} else if (topExceed) { | ||
topPosition = y; | ||
bottomPosition = ''; | ||
arrowTop = elemHeight / 2 - arrowWidth; | ||
} else if (bottomExceed) { | ||
topPosition = y - tipHeight + elemHeight; | ||
bottomPosition = ''; | ||
arrowTop = tipHeight - elemHeight / 2 - arrowWidth; | ||
} else { | ||
topPosition = y - tipHeight / 2 + elemHeight / 2; | ||
arrowTop = tipHeight / 2 - arrowHeight / 2; | ||
} | ||
} else if (verticals.includes(placement)) { | ||
if (placement === 'top') { | ||
topPosition = y - tipHeight - (isPopover ? arrowHeight : 0); | ||
} else { | ||
// BOTTOM | ||
topPosition = y + elemHeight + (isPopover ? arrowHeight : 0); | ||
} | ||
// adjust left | right and also the arrow | ||
if (leftExceed) { | ||
leftPosition = 0; | ||
arrowLeft = x + elemWidth / 2 - arrowAdjust; | ||
} else if (rightExceed) { | ||
leftPosition = 'auto'; | ||
rightPosition = 0; | ||
arrowRight = elemWidth / 2 + rightBoundry - elemRectRight - arrowAdjust; | ||
} else { | ||
leftPosition = x - tipWidth / 2 + elemWidth / 2; | ||
arrowLeft = tipWidth / 2 - arrowAdjust; | ||
} | ||
} | ||
} | ||
// apply style to tooltip/popover | ||
setElementStyle(tooltip, { | ||
top: `${topPosition}px`, | ||
bottom: bottomPosition === '' ? '' : `${bottomPosition}px`, | ||
left: leftPosition === 'auto' ? leftPosition : `${leftPosition}px`, | ||
right: rightPosition !== '' ? `${rightPosition}px` : '', | ||
}); | ||
// apply style to tooltip/popover | ||
setElementStyle(tooltip, { | ||
top: `${topPosition}px`, | ||
bottom: bottomPosition === '' ? '' : `${bottomPosition}px`, | ||
left: leftPosition === 'auto' ? leftPosition : `${leftPosition}px`, | ||
right: rightPosition !== '' ? `${rightPosition}px` : '', | ||
}); | ||
// update arrow placement | ||
/* istanbul ignore else */ | ||
if (isHTMLElement(arrow)) { | ||
if (arrowTop !== '') { | ||
arrow.style.top = `${arrowTop}px`; | ||
// update arrow placement | ||
/* istanbul ignore else */ | ||
if (isHTMLElement(arrow)) { | ||
if (arrowTop !== '') { | ||
arrow.style.top = `${arrowTop}px`; | ||
} | ||
if (arrowLeft !== '') { | ||
arrow.style.left = `${arrowLeft}px`; | ||
} else if (arrowRight !== '') { | ||
arrow.style.right = `${arrowRight}px`; | ||
} | ||
} | ||
if (arrowLeft !== '') { | ||
arrow.style.left = `${arrowLeft}px`; | ||
} else if (arrowRight !== '') { | ||
arrow.style.right = `${arrowRight}px`; | ||
} | ||
const updatedTooltipEvent = createCustomEvent<TooltipEvent | PopoverEvent>(`updated.bs.${toLowerCase(self.name)}`); | ||
dispatchEvent(element, updatedTooltipEvent); | ||
} | ||
const updatedTooltipEvent = createCustomEvent<TooltipEvent | PopoverEvent>(`updated.bs.${toLowerCase(self.name)}`); | ||
dispatchEvent(element, updatedTooltipEvent); | ||
}; | ||
export default styleTip; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1314441
10306