admin-lte
Version:
Responsive open source admin dashboard and control panel.
7 lines • 24.8 kB
JavaScript
/*!
* AdminLTE v4.1.0 (https://adminlte.io)
* Copyright 2014-2026 Colorlib <https://colorlib.com>
* Licensed under MIT (https://github.com/ColorlibHQ/AdminLTE/blob/master/LICENSE)
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).adminlte={})}(this,function(e){"use strict";const t=[],n={controller:new AbortController,hasInitialized:!1},i=()=>n.controller.signal,s=()=>{if(!n.hasInitialized){n.hasInitialized=!0;for(const e of t)e()}},a=e=>{t.push(e),n.hasInitialized&&e()};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",s,{once:!0}):s(),document.addEventListener("turbo:before-render",()=>{n.controller.abort(),n.controller=new AbortController,n.hasInitialized=!1}),document.addEventListener("turbo:load",s);const o=new WeakMap,r=e=>{const t=o.get(e)??[];for(const e of t)globalThis.clearTimeout(e);o.delete(e)},c=e=>{for(const t of["height","padding-top","padding-bottom","margin-top","margin-bottom","overflow","transition-duration","transition-property"])e.style.removeProperty(t)},l=(e,t=500)=>{if(r(e),t<=1)return e.style.display="none",void c(e);e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=`${t}ms`,e.style.boxSizing="border-box",e.style.height=`${e.offsetHeight}px`,e.style.overflow="hidden";const n=globalThis.setTimeout(()=>{e.style.height="0",e.style.paddingTop="0",e.style.paddingBottom="0",e.style.marginTop="0",e.style.marginBottom="0"},1),i=globalThis.setTimeout(()=>{e.style.display="none",c(e),o.delete(e)},t);o.set(e,[n,i])},d=(e,t=500)=>{r(e),c(e),e.style.removeProperty("display");let{display:n}=globalThis.getComputedStyle(e);if("none"===n&&(n="block"),e.style.display=n,t<=1)return;const i=e.offsetHeight;e.style.overflow="hidden",e.style.height="0",e.style.paddingTop="0",e.style.paddingBottom="0",e.style.marginTop="0",e.style.marginBottom="0";const s=globalThis.setTimeout(()=>{e.style.boxSizing="border-box",e.style.transitionProperty="height, margin, padding",e.style.transitionDuration=`${t}ms`,e.style.height=`${i}px`,e.style.removeProperty("padding-top"),e.style.removeProperty("padding-bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom")},1),a=globalThis.setTimeout(()=>{c(e),o.delete(e)},t);o.set(e,[s,a])},u="hold-transition";class h{_element;_holdTransitionTimer;constructor(e){this._element=e,this._holdTransitionTimer=void 0}holdTransition(e=100){this._holdTransitionTimer&&clearTimeout(this._holdTransitionTimer),document.body.classList.add(u),this._holdTransitionTimer=setTimeout(()=>{document.body.classList.remove(u)},e)}}a(()=>{const e=new h(document.body);window.addEventListener("resize",()=>e.holdTransition(200),{signal:i()}),setTimeout(()=>{document.body.classList.add("app-loaded")},400)});const m=new WeakMap;class p{static get NAME(){throw new Error("Component subclasses must override the static NAME getter.")}static get DATA_KEY(){return`lte.${this.NAME}`}static _getInstance(e){return e?m.get(e)?.get(this.DATA_KEY)??null:null}_element;constructor(e){this._element=e;const t=m.get(e)??new Map;m.set(e,t),t.set(this.constructor.DATA_KEY,this)}dispose(){const e=m.get(this._element);e?.delete(this.constructor.DATA_KEY),0===e?.size&&m.delete(this._element)}}const g=(e,t,n={})=>{const i=new CustomEvent(t,{bubbles:!0,cancelable:n.cancelable??!1,detail:n.detail});return e.dispatchEvent(i),i},b="card-widget",f=`.lte.${b}`,v=`collapse${f}`,y=`expand${f}`,_=`remove${f}`,S=`collapsed${f}`,E=`expanded${f}`,L=`removed${f}`,A=`maximized${f}`,T=`minimized${f}`,k="card",x="collapsed-card",w="collapsing-card",M="expanding-card",q="was-collapsed",$="maximized-card",I='[data-lte-toggle="card-remove"]',C='[data-lte-toggle="card-collapse"]',N='[data-lte-toggle="card-maximize"]',P=`.${k}`,z=".card-body",D=".card-footer",R={animationSpeed:500,collapseTrigger:C,removeTrigger:I,maximizeTrigger:N};class B extends p{static get NAME(){return b}static getInstance(e){return this._getInstance(e)}static getOrCreateInstance(e,t={}){return this.getInstance(e)??new this(e,t)}_parent;_config;constructor(e,t={}){super(e),this._parent=e.closest(P),e.classList.contains(k)&&(this._parent=e),this._config={...R,...t}}collapse(){this._parent&&(g(this._parent,v,{cancelable:!0}).defaultPrevented||(this._parent.classList.add(w),this._parent.classList.remove(M),this._parent.querySelectorAll(`:scope > ${z}, :scope > ${D}`).forEach(e=>{e instanceof HTMLElement&&l(e,this._config.animationSpeed)}),setTimeout(()=>{this._parent?.classList.contains(w)&&(this._parent.classList.add(x),this._parent.classList.remove(w),g(this._parent,S))},this._config.animationSpeed)))}expand(){this._parent&&(g(this._parent,y,{cancelable:!0}).defaultPrevented||(this._parent.classList.add(M),this._parent.classList.remove(w,x),this._parent.querySelectorAll(`:scope > ${z}, :scope > ${D}`).forEach(e=>{e instanceof HTMLElement&&d(e,this._config.animationSpeed)}),setTimeout(()=>{this._parent?.classList.contains(M)&&(this._parent.classList.remove(M),g(this._parent,E))},this._config.animationSpeed)))}remove(){if(!this._parent)return;if(g(this._parent,_,{cancelable:!0}).defaultPrevented)return;const e=this._parent;l(e,this._config.animationSpeed),setTimeout(()=>{g(e,L),e.remove(),this.dispose()},this._config.animationSpeed)}toggle(){this._parent?.classList.contains(x)||this._parent?.classList.contains(w)?this.expand():this.collapse()}maximize(){this._parent&&(this._parent.style.height=`${this._parent.offsetHeight}px`,this._parent.style.width=`${this._parent.offsetWidth}px`,this._parent.style.transition="all .15s",setTimeout(()=>{const e=document.querySelector("html");e&&e.classList.add($),this._parent&&(this._parent.classList.add($),this._parent.classList.contains(x)&&this._parent.classList.add(q),g(this._parent,A))},150))}minimize(){this._parent&&(this._parent.style.height="auto",this._parent.style.width="auto",this._parent.style.transition="all .15s",setTimeout(()=>{const e=document.querySelector("html");e&&e.classList.remove($),this._parent&&(this._parent.classList.remove($),this._parent?.classList.contains(q)&&this._parent.classList.remove(q),g(this._parent,T),setTimeout(()=>{this._parent?.style.removeProperty("height"),this._parent?.style.removeProperty("width"),this._parent?.style.removeProperty("transition")},150))},10))}toggleMaximize(){this._parent?.classList.contains($)?this.minimize():this.maximize()}}document.addEventListener("click",e=>{const t=e.target;if(!(t instanceof Element))return;const n=t.closest(C),i=t.closest(I),s=t.closest(N),a=n??i??s;if(!a)return;e.preventDefault();const o=a.closest(P);if(!o)return;const r=B.getOrCreateInstance(o);n?r.toggle():i?r.remove():r.toggleMaximize()});const F="treeview",O=`.lte.${F}`,H=`expand${O}`,K=`collapse${O}`,W=`expanded${O}`,Y=`collapsed${O}`,j=`load${O}`,U="menu-open",V=".nav-item",G=".nav-link",J=".nav-treeview",Q='[data-lte-toggle="treeview"]',X={animationSpeed:300,accordion:!0},Z=(e,t)=>{const n=e.querySelector(`:scope > ${G}`);n?.setAttribute("aria-expanded",String(t))};class ee extends p{static get NAME(){return F}static getInstance(e){return this._getInstance(e)}static getOrCreateInstance(e,t={}){return this.getInstance(e)??new this(e,t)}_config;constructor(e,t={}){super(e),this._config={...X,...t}}open(){if(g(this._element,H,{cancelable:!0}).defaultPrevented)return;if(this._config.accordion){const e=this._element.parentElement?.querySelectorAll(`${V}.${U}`);e?.forEach(e=>{if(!this._element.contains(e)){e.classList.remove(U),Z(e,!1);const t=e?.querySelector(J);t&&l(t,this._config.animationSpeed)}})}this._element.classList.add(U),Z(this._element,!0);const e=this._element.querySelector(J);e&&d(e,this._config.animationSpeed),setTimeout(()=>{this._element.classList.contains(U)&&g(this._element,W)},this._config.animationSpeed)}close(){if(g(this._element,K,{cancelable:!0}).defaultPrevented)return;this._element.classList.remove(U),Z(this._element,!1);const e=this._element.querySelector(J);e&&l(e,this._config.animationSpeed),setTimeout(()=>{this._element.classList.contains(U)||g(this._element,Y)},this._config.animationSpeed)}toggle(){this._element.classList.contains(U)?this.close():this.open()}}document.addEventListener("click",e=>{const t=e.target;if(!(t instanceof Element))return;const n=t.closest(Q);if(!n)return;const i=t.closest(V),s=t.closest(G);if(!i?.querySelector(J))return;"#"!==t.getAttribute("href")&&"#"!==s?.getAttribute("href")||e.preventDefault();const a=n.dataset.accordion,o=n.dataset.animationSpeed,r={accordion:void 0===a?X.accordion:"true"===a,animationSpeed:void 0===o?X.animationSpeed:Number(o)};ee.getOrCreateInstance(i,r).toggle()}),a(()=>{document.querySelectorAll(`${V}.${U}`).forEach(e=>{const t=e.querySelector(J);if(t){d(t,0);const n=new Event(j);e.dispatchEvent(n)}}),document.querySelectorAll(Q).forEach(e=>{e.querySelectorAll(V).forEach(e=>{e.querySelector(`:scope > ${J}`)&&Z(e,e.classList.contains(U))})})});const te="direct-chat",ne=`.lte.${te}`,ie=`expanded${ne}`,se=`collapsed${ne}`,ae="direct-chat-contacts-open";class oe extends p{static get NAME(){return te}static getInstance(e){return this._getInstance(e)}static getOrCreateInstance(e){return this.getInstance(e)??new this(e)}toggle(){this._element.classList.contains(ae)?(this._element.classList.remove(ae),g(this._element,se)):(this._element.classList.add(ae),g(this._element,ie))}}document.addEventListener("click",e=>{const t=e.target;if(!(t instanceof Element))return;const n=t.closest('[data-lte-toggle="chat-pane"]');if(!n)return;e.preventDefault();const i=n.closest(".direct-chat");i&&oe.getOrCreateInstance(i).toggle()});const re="fullscreen",ce=`.lte.${re}`,le=`maximized${ce}`,de=`minimized${ce}`,ue='[data-lte-toggle="fullscreen"]';function he(){const e=document.querySelector('[data-lte-icon="maximize"]'),t=document.querySelector('[data-lte-icon="minimize"]'),n=Boolean(document.fullscreenElement);e?.classList.toggle("d-none",n),t?.classList.toggle("d-none",!n);const i=n?le:de;document.querySelectorAll(ue).forEach(e=>{g(e,i)})}class me extends p{static get NAME(){return re}static getInstance(e){return this._getInstance(e)}static getOrCreateInstance(e){return this.getInstance(e)??new this(e)}inFullScreen(){document.documentElement.requestFullscreen().catch(()=>{})}outFullscreen(){document.exitFullscreen().catch(()=>{})}toggleFullScreen(){document.fullscreenEnabled&&(document.fullscreenElement?this.outFullscreen():this.inFullScreen())}}document.addEventListener("click",e=>{const t=e.target;if(!(t instanceof Element))return;const n=t.closest(ue);n&&(e.preventDefault(),me.getOrCreateInstance(n).toggleFullScreen())}),a(()=>{document.addEventListener("fullscreenchange",he,{signal:i()})});const pe="push-menu",ge=`.lte.${pe}`,be=`open${ge}`,fe=`collapse${ge}`,ve=`opened${ge}`,ye=`collapsed${ge}`,_e="sidebar-overlay",Se="sidebar-collapse",Ee="sidebar-open",Le=".app-sidebar",Ae="lte.sidebar.state",Te={sidebarBreakpoint:991.98,enablePersistence:!1};class ke extends p{static get NAME(){return pe}static getInstance(e){return this._getInstance(e)}static getOrCreateInstance(e,t={}){return this.getInstance(e)??new this(e,t)}_config;constructor(e,t={}){super(e),this._config={...Te,...t}}isCollapsed(){return document.body.classList.contains(Se)}isExplicitlyOpen(){return document.body.classList.contains(Ee)}isMiniMode(){return document.body.classList.contains("sidebar-mini")}isMobileSize(){return globalThis.innerWidth<=this._config.sidebarBreakpoint}expand(){g(this._element,be,{cancelable:!0}).defaultPrevented||(document.body.classList.remove(Se),this.isMobileSize()&&document.body.classList.add(Ee),g(this._element,ve))}collapse(){g(this._element,fe,{cancelable:!0}).defaultPrevented||(document.body.classList.remove(Ee),document.body.classList.add(Se),g(this._element,ye))}toggle(){const e=this.isCollapsed();e?this.expand():this.collapse(),this._config.enablePersistence&&this.saveSidebarState(e?Ee:Se)}setupSidebarBreakPoint(){const e=document.querySelector('[class*="sidebar-expand"]');if(!e)return;const t=globalThis.getComputedStyle(e,"::before").getPropertyValue("content");if(!t||"none"===t)return;const n=Number(t.replace(/[^\d.-]/g,""));Number.isNaN(n)||(this._config={...this._config,sidebarBreakpoint:n})}updateStateByResponsiveLogic(){this.isMobileSize()?this.isExplicitlyOpen()||this.collapse():this.isMiniMode()&&this.isCollapsed()||this.expand()}saveSidebarState(e){if(void 0!==globalThis.localStorage)try{localStorage.setItem(Ae,e)}catch{}}loadSidebarState(){if(void 0!==globalThis.localStorage)try{const e=localStorage.getItem(Ae);e===Se?this.collapse():e===Ee?this.expand():this.updateStateByResponsiveLogic()}catch{this.updateStateByResponsiveLogic()}}clearSidebarState(){if(void 0!==globalThis.localStorage)try{localStorage.removeItem(Ae)}catch{}}init(){this.setupSidebarBreakPoint(),this._config.enablePersistence||this.clearSidebarState(),this._config.enablePersistence&&!this.isMobileSize()?this.loadSidebarState():this.updateStateByResponsiveLogic()}}document.addEventListener("click",e=>{const t=e.target;if(!(t instanceof Element))return;if(!t.closest('[data-lte-toggle="sidebar"]'))return;e.preventDefault();const n=document.querySelector(Le);n&&ke.getOrCreateInstance(n).toggle()}),a(()=>{const e=document.querySelector(Le);if(!e)return;const t=e.dataset.sidebarBreakpoint,n=e.dataset.enablePersistence,s={sidebarBreakpoint:void 0===t?Te.sidebarBreakpoint:Number(t),enablePersistence:void 0===n?Te.enablePersistence:"true"===n},a=ke.getOrCreateInstance(e,s);a.init(),globalThis.matchMedia(`(max-width: ${a._config.sidebarBreakpoint}px)`).addEventListener("change",()=>{a.updateStateByResponsiveLogic()},{signal:i()});const o=document.querySelector(".app-wrapper");let r=o?.querySelector(`:scope > .${_e}`);r||(r=document.createElement("div"),r.className=_e,o?.append(r));let c=!1;r.addEventListener("touchstart",()=>{c=!1},{passive:!0}),r.addEventListener("touchmove",()=>{c=!0},{passive:!0}),r.addEventListener("touchend",e=>{c||(e.preventDefault(),a.collapse()),c=!1},{passive:!1}),r.addEventListener("click",e=>{e.preventDefault(),a.collapse()})});const xe="lte-theme",we="[data-bs-theme-value]";class Me{getStoredTheme(){try{const e=localStorage.getItem(xe);return e&&["light","dark","auto"].includes(e)?e:null}catch{return null}}getPreferredTheme(){return this.getStoredTheme()||(this._prefersDark()?"dark":"light")}resolveTheme(e){return"auto"===e?this._prefersDark()?"dark":"light":e}setTheme(e){try{localStorage.setItem(xe,e)}catch{}this._applyTheme(e),this._showActiveTheme(e),document.dispatchEvent(new CustomEvent("changed.lte.color-mode",{detail:{theme:e,resolved:this.resolveTheme(e)}}))}_applyTheme(e){const t=this.resolveTheme(e);document.documentElement.setAttribute("data-bs-theme",t),document.documentElement.style.colorScheme=t}_prefersDark(){return globalThis.matchMedia("(prefers-color-scheme: dark)").matches}_showActiveTheme(e){document.querySelectorAll(we).forEach(t=>{const n=t.getAttribute("data-bs-theme-value")===e;t.classList.toggle("active",n),t.setAttribute("aria-pressed",String(n)),t.querySelector(".bi-check-lg")?.classList.toggle("d-none",!n)}),document.querySelectorAll("[data-lte-theme-icon]").forEach(t=>{t.classList.toggle("d-none",t.dataset.lteThemeIcon!==e)})}init(){const e=this.getPreferredTheme();this._applyTheme(e),this._showActiveTheme(e)}}document.addEventListener("click",e=>{const t=e.target;if(!(t instanceof Element))return;const n=t.closest(we),i=n?.getAttribute("data-bs-theme-value");i&&(new Me).setTheme(i)}),a(()=>{const e=new Me;e.init(),globalThis.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{const t=e.getStoredTheme();t&&"auto"!==t||(e._applyTheme("auto"),e._showActiveTheme(t??"auto"))},{signal:i()})});class qe{config;liveRegion=null;focusHistory=[];signal=i();constructor(e={}){this.config={announcements:!0,skipLinks:!0,focusManagement:!0,keyboardNavigation:!0,reducedMotion:!0,...e},this.init()}init(){this.config.announcements&&this.createLiveRegion(),this.config.skipLinks&&this.addSkipLinks(),this.config.focusManagement&&this.initFocusManagement(),this.config.keyboardNavigation&&this.initKeyboardNavigation(),this.config.reducedMotion&&this.respectReducedMotion(),this.initErrorAnnouncements(),this.initTableAccessibility(),this.initFormAccessibility()}createLiveRegion(){if(this.liveRegion)return;const e=document.getElementById("live-region");e?this.liveRegion=e:(this.liveRegion=document.createElement("div"),this.liveRegion.id="live-region",this.liveRegion.className="live-region",this.liveRegion.setAttribute("aria-live","polite"),this.liveRegion.setAttribute("aria-atomic","true"),this.liveRegion.setAttribute("role","status"),document.body.append(this.liveRegion))}addSkipLinks(){if(document.querySelector(".skip-links"))return void this.ensureSkipTargets();const e=document.createElement("div");e.className="skip-links";const t=document.createElement("a");t.href="#main",t.className="skip-link",t.textContent="Skip to main content";const n=document.createElement("a");n.href="#navigation",n.className="skip-link",n.textContent="Skip to navigation",e.append(t),e.append(n),document.body.insertBefore(e,document.body.firstChild),this.ensureSkipTargets()}ensureSkipTargets(){const e=document.querySelector('#main, main, [role="main"]');e&&!e.id&&(e.id="main"),e&&!e.hasAttribute("tabindex")&&e.setAttribute("tabindex","-1");const t=document.querySelector('#navigation, nav, [role="navigation"]');t&&!t.id&&(t.id="navigation"),t&&!t.hasAttribute("tabindex")&&t.setAttribute("tabindex","-1")}initFocusManagement(){document.addEventListener("keydown",e=>{"Escape"===e.key&&this.handleEscapeKey(e)},{signal:this.signal}),this.initModalFocusManagement(),this.initDropdownFocusManagement()}handleEscapeKey(e){if(!document.querySelector(".modal.show")&&document.querySelector(".dropdown-menu.show")){const t=document.querySelector('[data-bs-toggle="dropdown"][aria-expanded="true"]');t?.click(),e.preventDefault()}}initKeyboardNavigation(){document.addEventListener("keydown",e=>{const t=e.target;t.matches("input, textarea, select, [contenteditable], [contenteditable] *")||(t.closest(".nav, .navbar-nav, .dropdown-menu")&&this.handleMenuNavigation(e),"Enter"!==e.key&&" "!==e.key||!t.hasAttribute("role")||"button"!==t.getAttribute("role")||t.matches('button, input[type="button"], input[type="submit"]')||(e.preventDefault(),t.click()))},{signal:this.signal})}handleMenuNavigation(e){if(!["ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End"].includes(e.key))return;const t=e.target,n=Array.from(t.closest(".nav, .navbar-nav, .dropdown-menu")?.querySelectorAll("a, button")||[]).filter(e=>null!==e.offsetParent),i=n.indexOf(t);if(-1===i)return;let s;switch(e.key){case"ArrowDown":case"ArrowRight":s=i<n.length-1?i+1:0;break;case"ArrowUp":case"ArrowLeft":s=i>0?i-1:n.length-1;break;case"Home":s=0;break;case"End":s=n.length-1;break;default:return}e.preventDefault(),n[s]?.focus()}respectReducedMotion(){if(globalThis.matchMedia("(prefers-reduced-motion: reduce)").matches&&(document.body.classList.add("reduce-motion"),document.documentElement.style.scrollBehavior="auto",!document.getElementById("adminlte-reduce-motion"))){const e=document.createElement("style");e.id="adminlte-reduce-motion",e.textContent="\n *, *::before, *::after {\n animation-duration: 0.01ms !important;\n animation-iteration-count: 1 !important;\n transition-duration: 0.01ms !important;\n }\n ",document.head.append(e)}}initErrorAnnouncements(){const e=new MutationObserver(e=>{e.forEach(e=>{e.addedNodes.forEach(e=>{if(e.nodeType===Node.ELEMENT_NODE){const t=e;t.matches(".alert-danger, .invalid-feedback, .error")&&this.announce(t.textContent||"Error occurred","assertive"),t.matches(".alert-success, .success")&&this.announce(t.textContent||"Success","polite")}})})});e.observe(document.body,{childList:!0,subtree:!0}),this.signal.addEventListener("abort",()=>{e.disconnect()},{once:!0})}initTableAccessibility(){document.querySelectorAll("table").forEach(e=>{if(e.hasAttribute("role")||e.setAttribute("role","table"),e.querySelectorAll("th").forEach(e=>{if(!e.hasAttribute("scope")){const t=e.closest("thead"),n=0===e.cellIndex;t?e.setAttribute("scope","col"):n&&e.setAttribute("scope","row")}}),!e.querySelector("caption")&&e.hasAttribute("title")){const t=document.createElement("caption");t.textContent=e.getAttribute("title")||"",e.insertBefore(t,e.firstChild)}})}initFormAccessibility(){document.querySelectorAll("input, select, textarea").forEach(e=>{const t=e;if(!t.labels?.length&&!t.hasAttribute("aria-label")&&!t.hasAttribute("aria-labelledby")){const e=t.getAttribute("placeholder");e&&t.setAttribute("aria-label",e)}if(t.hasAttribute("required")){const e=t.labels?.[0];if(e&&!e.querySelector(".required-indicator")){const t=document.createElement("span");t.className="required-indicator sr-only",t.textContent=" (required)",e.append(t)}}t.classList.contains("disable-adminlte-validations")||t.addEventListener("invalid",()=>{this.handleFormError(t)})})}handleFormError(e){e.id||e.name||(e.id=Ce.generateId("field"));const t=`${e.id||e.name}-error`;let n=document.getElementById(t);n||(n=document.createElement("div"),n.id=t,n.className="invalid-feedback",n.setAttribute("role","alert"),e.parentNode?.append(n)),n.textContent=e.validationMessage;const i=(e.getAttribute("aria-describedby")||"").split(/\s+/).filter(Boolean);i.includes(t)||i.push(t),e.setAttribute("aria-describedby",i.join(" ")),e.classList.add("is-invalid"),this.announce(`Error in ${e.labels?.[0]?.textContent||e.name}: ${e.validationMessage}`,"assertive")}initModalFocusManagement(){document.addEventListener("show.bs.modal",()=>{this.focusHistory.push(document.activeElement)},{signal:this.signal}),document.addEventListener("shown.bs.modal",e=>{const t=e.target,n=t.querySelector("[autofocus]")||t.querySelector('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');n?.focus()},{signal:this.signal}),document.addEventListener("hidden.bs.modal",()=>{const e=this.focusHistory.pop();e?.isConnected&&e.focus()},{signal:this.signal})}initDropdownFocusManagement(){document.addEventListener("shown.bs.dropdown",e=>{const t=e.target.querySelector(".dropdown-menu"),n=t?.querySelector("a, button");n&&n.focus()},{signal:this.signal})}announce(e,t="polite"){this.liveRegion||this.createLiveRegion(),this.liveRegion&&(this.liveRegion.setAttribute("aria-live",t),this.liveRegion.textContent=e,setTimeout(()=>{this.liveRegion&&(this.liveRegion.textContent="")},1e3))}focusElement(e){const t=document.querySelector(e);t&&(t.focus(),t.scrollIntoView({behavior:"smooth",block:"center"}))}trapFocus(e){const t=e.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),n=Array.from(t),i=n[0],s=n.at(-1);e.addEventListener("keydown",e=>{"Tab"===e.key&&(e.shiftKey?document.activeElement===i&&(s?.focus(),e.preventDefault()):document.activeElement===s&&(i.focus(),e.preventDefault()))},{signal:this.signal})}addLandmarks(){if(!document.querySelector("main")){const e=document.querySelector(".app-main");e&&(e.setAttribute("role","main"),e.id||(e.id="main"))}document.querySelectorAll(".navbar-nav, .nav").forEach((e,t)=>{"UL"!==e.tagName&&"OL"!==e.tagName&&(e.hasAttribute("role")||e.setAttribute("role","navigation"),e.hasAttribute("aria-label")||e.setAttribute("aria-label",`Navigation ${t+1}`))});const e=document.querySelector('form[role="search"], .navbar-search');e&&!e.hasAttribute("role")&&e.setAttribute("role","search")}}const $e=e=>new qe(e),Ie=e=>{const[t,n,i]=(e=>{const t=/^#([\da-f]{3}|[\da-f]{6})$/i.exec(e.trim());if(t){let e=t[1];return 3===e.length&&(e=[...e].map(e=>e+e).join("")),[Number.parseInt(e.slice(0,2),16),Number.parseInt(e.slice(2,4),16),Number.parseInt(e.slice(4,6),16)]}return e.match(/\d+/g)?.map(Number)||[0,0,0]})(e).map(e=>(e/=255)<=.03928?e/12.92:(e+.055)**2.4/1.055**2.4);return.2126*t+.7152*n+.0722*i},Ce={checkColorContrast:(e,t)=>{const n=Ie(e),i=Ie(t),s=(Math.max(n,i)+.05)/(Math.min(n,i)+.05);return{ratio:Math.round(100*s)/100,passes:s>=4.5}},generateId:(e="a11y")=>`${e}-${Math.random().toString(36).slice(2,11)}`,isFocusable:e=>["a[href]","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])",'[tabindex]:not([tabindex="-1"])','[contenteditable="true"]'].some(t=>e.matches(t))};a(()=>{$e({announcements:!0,skipLinks:!0,focusManagement:!0,keyboardNavigation:!0,reducedMotion:!0}).addLandmarks()}),e.CardWidget=B,e.ColorMode=Me,e.DirectChat=oe,e.FullScreen=me,e.Layout=h,e.PushMenu=ke,e.Treeview=ee,e.initAccessibility=$e});
//# sourceMappingURL=adminlte.min.js.map