@wpmoo/ui 2.1.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +49 -2
  2. package/THIRD_PARTY_NOTICES.md +1 -1
  3. package/certification.json +3 -1
  4. package/dist/assets/css/moo-ui.css +429 -1
  5. package/dist/assets/css/moo-ui.min.css +2 -2
  6. package/dist/assets/css/moo.css +349 -1
  7. package/dist/assets/css/moo.min.css +2 -2
  8. package/dist/js/chart.js +1 -1
  9. package/dist/js/chart.min.js +1 -1
  10. package/dist/js/combobox.js +1 -1
  11. package/dist/js/consent.js +342 -0
  12. package/dist/js/context-menu.js +1 -1
  13. package/dist/js/datatable.js +1 -1
  14. package/dist/js/datepicker.js +1 -1
  15. package/dist/js/datepicker.min.js +1 -1
  16. package/dist/js/floating-panel.js +1 -1
  17. package/dist/js/image-gallery.js +247 -0
  18. package/dist/js/moo-ui.js +561 -4
  19. package/dist/js/moo-ui.min.js +2 -2
  20. package/dist/js/overlay-scrollbar.js +1 -1
  21. package/dist/js/password-requirements.js +1 -1
  22. package/dist/js/sheet.js +1 -1
  23. package/dist/js/sidebar.js +1 -1
  24. package/dist/js/slider.js +1 -1
  25. package/dist/js/state.js +1 -1
  26. package/dist/js/table-of-contents.js +1 -1
  27. package/dist/js/toc.js +1 -1
  28. package/dist/release-manifest.json +4 -4
  29. package/package.json +5 -1
  30. package/scss/_components.scss +2 -0
  31. package/scss/components/_gallery.scss +73 -0
  32. package/scss/components/_item.scss +96 -0
  33. package/scss/foundations/_globals.scss +1 -0
  34. package/scss/foundations/_scope.scss +2 -0
  35. package/scss/mixins/_banner.scss +1 -1
  36. package/scss/moo-core.scss +1 -0
  37. package/scss/moo-ui.scss +2 -0
  38. package/scss/settings/_component_variables.scss +8 -0
  39. package/scss/utilities/_gallery.scss +25 -0
  40. package/scss/utilities/_motion.scss +5 -0
  41. package/scss/utilities/_motion_primitives.scss +10 -0
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * Moo UI moo-ui.min.js v2.1.1 (https://wpmoo.org/)
2
+ * Moo UI moo-ui.min.js v2.3.0 (https://wpmoo.org/)
3
3
  * Copyright 2026 WPMoo Authors
4
4
  * Licensed under MIT (https://github.com/wpmoo-org/ui/blob/main/LICENSE)
5
5
  */
6
6
 
7
- var at=new WeakMap,nt=r=>r.trim().toLowerCase(),N=class r{static getInstance(t){return t?.nodeType===1&&at.get(t)||null}static getOrCreateInstance(t,e={}){return r.getInstance(t)||new r(t,e)}constructor(t,e={}){if(t?.nodeType!==1||!t.matches(".combobox"))throw new TypeError("Combobox requires a .combobox root element.");let i=at.get(t);if(i)return i;if(this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView,this._config={noResultsText:"No results found.",...e},this._input=t.querySelector(".combobox-input"),this._menu=t.querySelector(".combobox-menu"),this._options=Array.from(t.querySelectorAll(".combobox-option")),!this._input||!this._menu||this._options.length===0)throw new TypeError("Combobox requires an input, menu, and at least one option.");this._isMultiple=t.dataset.comboboxMultiple==="true",this._hidden=this._isMultiple?null:t.querySelector('input[type="hidden"]'),this._chipValue=t.querySelector(".combobox-value"),this._valueStore=t.querySelector("[data-combobox-value-store]"),this._chipIconTemplate=t.querySelector("[data-combobox-chip-icon]"),this._clearTrigger=t.querySelector("[data-combobox-clear]"),this._indicator=t.querySelector(".combobox-indicator"),this._groups=Array.from(t.querySelectorAll("[data-combobox-group]")),this._separators=Array.from(t.querySelectorAll("[data-combobox-separator]")),this._listeners=[],this._generated=[],this._startsOpen=this._menu.classList.contains("show"),this._empty=this._menu.querySelector("[data-combobox-empty]"),this._empty||(this._empty=this._document.createElement("li"),this._empty.className="combobox-empty",this._empty.hidden=!0,this._empty.dataset.comboboxEmpty="true",this._empty.textContent=this._config.noResultsText,this._menu.appendChild(this._empty),this._generated.push(this._empty)),this._liveRegion=t.querySelector("[data-combobox-live]"),this._liveRegion||(this._liveRegion=this._document.createElement("span"),this._liveRegion.className="visually-hidden",this._liveRegion.setAttribute("aria-live","polite"),this._liveRegion.dataset.comboboxLive="true",t.appendChild(this._liveRegion),this._generated.push(this._liveRegion)),at.set(t,this),this._bindEvents(),this._toggleClear(this._input.dataset.comboboxSelected==="true"||t.dataset.comboboxSelected==="true"),this._syncMultipleValue(),this._filterOptions({open:this._startsOpen,activate:this._startsOpen}),this._startsOpen||this._closeMenu(!1)}dispose(){this._listeners.forEach(({target:t,type:e,handler:i,options:s})=>{t.removeEventListener(e,i,s)}),this._listeners=[],this._closeMenu(!1),this._generated.forEach(t=>t.remove()),this._generated=[],this._chipValue?.querySelectorAll("[data-combobox-generated]").forEach(t=>t.remove()),this._valueStore?.querySelectorAll("[data-combobox-generated]").forEach(t=>t.remove()),at.delete(this._element)}_listen(t,e,i,s){t?.addEventListener(e,i,s),t&&this._listeners.push({target:t,type:e,handler:i,options:s})}_trigger(t,e={}){return this._element.dispatchEvent(new this._window.CustomEvent("".concat(t,".moo.combobox"),{bubbles:!0,cancelable:t==="show"||t==="hide",detail:e}))}_optionGroupIsHidden(t){return t.closest("[data-combobox-group]")?.hidden||!1}_visibleOptions(){return this._options.filter(t=>!t.hidden&&!t.disabled&&!this._optionGroupIsHidden(t))}_syncGroupVisibility(){if(this._groups.length===0)return;let t=0;this._groups.forEach(e=>{let i=Array.from(e.querySelectorAll(".combobox-option")).some(s=>!s.hidden);e.hidden=!i,t+=i?1:0}),this._separators.forEach(e=>{e.hidden=t<2})}_openMenu(t=!0){if(this._menu.classList.contains("show")){this._input.setAttribute("aria-expanded","true");return}t&&!this._trigger("show")||(this._menu.classList.add("show"),this._input.setAttribute("aria-expanded","true"),t&&this._trigger("shown"))}_closeMenu(t=!0){let e=this._menu.classList.contains("show");e&&t&&!this._trigger("hide")||(this._menu.classList.remove("show"),this._input.setAttribute("aria-expanded","false"),this._input.removeAttribute("aria-activedescendant"),this._options.forEach(i=>{i.removeAttribute("aria-current"),i.classList.remove("active")}),e&&t&&this._trigger("hidden"))}_optionLabel(t){return t?.querySelector(".combobox-option__label")?.textContent?.trim()||""}_selectedOptions(){return this._options.filter(t=>t.getAttribute("aria-selected")==="true")}_toggleClear(t){let e=t?"true":"false";this._element.dataset.comboboxSelected=e,this._input.dataset.comboboxSelected=e,this._clearTrigger&&(this._clearTrigger.hidden=!t,this._indicator&&(this._indicator.hidden=t))}_createChip(t){let e=t.dataset.value||"",i=this._optionLabel(t),s=this._document.createElement("span");s.className="badge text-bg-secondary combobox-chip",s.dataset.value=e,s.dataset.comboboxGenerated="true";let a=this._document.createElement("span");a.className="combobox-chip__label",a.textContent=i,s.appendChild(a);let n=this._document.createElement("button");return n.className="combobox-chip__remove",n.type="button",n.dataset.value=e,n.dataset.comboboxChipRemove="true",n.setAttribute("aria-label","Remove ".concat(i)),n.append(this._chipIconTemplate?.content.cloneNode(!0)||"x"),s.appendChild(n),s}_syncMultipleValue(){if(!this._isMultiple)return;let t=this._selectedOptions();if(this._chipValue&&this._chipValue.replaceChildren(...t.map(e=>this._createChip(e))),this._valueStore){this._valueStore.replaceChildren();let e=this._valueStore.dataset.comboboxName||"";t.forEach(i=>{let s=this._document.createElement("input");s.type="hidden",s.name=e,s.value=i.dataset.value||"",s.dataset.comboboxGenerated="true",this._valueStore.appendChild(s)})}this._toggleClear(t.length>0)}_emitChange(){let t=this._selectedOptions();this._trigger("change",{values:t.map(e=>e.dataset.value||"")})}_removeChip(t){let e=this._options.find(i=>i.dataset.value===t);e&&(e.setAttribute("aria-selected","false"),this._syncMultipleValue(),this._emitChange())}_clearSelection(t=!0){this._hidden&&(this._hidden.value=""),this._options.forEach(e=>e.setAttribute("aria-selected","false")),this._isMultiple?this._syncMultipleValue():this._toggleClear(!1),t&&this._emitChange()}_clearStaleSelection(){if(this._isMultiple){this._input.value="",this._showAllOptions();return}let t=this._selectedOptions()[0]||null,e=this._optionLabel(t);!this._input.value||e&&nt(this._input.value)===nt(e)||(this._clearSelection(),this._input.value="")}_showAllOptions(){this._options.forEach(t=>{t.hidden=!1}),this._syncGroupVisibility(),this._empty.hidden=!0,this._liveRegion.textContent=""}_activeOption(){let t=this._input.getAttribute("aria-activedescendant");return t&&this._visibleOptions().find(e=>e.id===t)||null}_selectedOption(){return this._isMultiple?null:this._visibleOptions().find(t=>t.getAttribute("aria-selected")==="true")||null}_preferredActiveOption(){return this._selectedOption()||this._visibleOptions()[0]||null}_activatePreferredOptionIfNeeded(){this._activeOption()||this._setActiveOption(this._preferredActiveOption())}_setActiveOption(t,{scroll:e=!0}={}){if(this._options.forEach(i=>{let s=i===t;s?i.setAttribute("aria-current","true"):i.removeAttribute("aria-current"),i.classList.toggle("active",s)}),!t){this._input.removeAttribute("aria-activedescendant");return}if(this._input.setAttribute("aria-activedescendant",t.id),e){let i=t.getBoundingClientRect(),s=this._menu.getBoundingClientRect();i.top<s.top?this._menu.scrollTop-=s.top-i.top:i.bottom>s.bottom&&(this._menu.scrollTop+=i.bottom-s.bottom)}}_activateOptionFromPointer(t,e){e.pointerType==="touch"||t.disabled||t.getAttribute("aria-disabled")==="true"||t===this._activeOption()||this._setActiveOption(t,{scroll:!1})}_restoreSelectedActiveOption(){if(!this._menu.classList.contains("show"))return;let t=this._selectedOption();t&&this._setActiveOption(t,{scroll:!1})}_chooseOption(t){if(!(!t||t.disabled)){if(this._isMultiple){t.setAttribute("aria-selected",t.getAttribute("aria-selected")==="true"?"false":"true"),this._input.value="",this._syncMultipleValue(),this._filterOptions(),this._setActiveOption(t),this._emitChange();return}this._options.forEach(e=>{e.setAttribute("aria-selected",e===t?"true":"false")}),this._input.value=this._optionLabel(t),this._hidden&&(this._hidden.value=t.dataset.value||""),this._showAllOptions(),this._toggleClear(!0),this._setActiveOption(t),this._emitChange()}}_filterOptions({open:t=!0,activate:e=!0,resetActive:i=!1}={}){t&&this._openMenu();let s=nt(this._input.value),a=0;this._options.forEach(n=>{let o=!s||nt(n.textContent).includes(s);n.hidden=!o,a+=o?1:0}),this._syncGroupVisibility(),this._empty.hidden=a!==0,this._liveRegion.textContent=a===0?"No results":"".concat(a," result").concat(a===1?"":"s"),i&&this._setActiveOption(null,{scroll:!1}),e&&this._activatePreferredOptionIfNeeded()}_bindEvents(){this._listen(this._input,"focus",()=>{this._openMenu(),!this._isMultiple&&this._input.dataset.comboboxSelected==="true"&&this._input.select(),this._activatePreferredOptionIfNeeded()}),this._listen(this._input,"input",()=>{this._isMultiple||this._clearSelection(),this._filterOptions({resetActive:!0})}),this._listen(this._input,"blur",t=>{let e=t.relatedTarget;e instanceof this._window.Node&&this._element.contains(e)||this._clearStaleSelection()}),this._listen(this._input,"click",()=>{this._openMenu(),this._setActiveOption(this._preferredActiveOption())}),this._listen(this._input,"keydown",t=>this._handleKeydown(t)),this._options.forEach(t=>{this._listen(t,"keydown",e=>this._handleKeydown(e)),this._listen(t,"pointerenter",e=>{this._activateOptionFromPointer(t,e)}),this._listen(t,"click",()=>{this._chooseOption(t),this._isMultiple?this._input.focus():this._closeMenu()})}),this._listen(this._clearTrigger,"click",t=>{t.preventDefault(),this._clearSelection(),this._input.value="",this._input.focus(),this._filterOptions({resetActive:!0})}),this._listen(this._menu,"pointerleave",()=>this._restoreSelectedActiveOption()),this._listen(this._element,"click",t=>this._handleRootClick(t)),this._listen(this._document,"click",t=>{t.target instanceof this._window.Node&&!this._element.contains(t.target)&&this._closeMenu()})}_handleRootClick(t){let e=t.target,i=e instanceof this._window.Element?e.closest("[data-combobox-chip-remove]"):null;i?(t.preventDefault(),this._removeChip(i.dataset.value||""),this._input.focus()):this._isMultiple&&e instanceof this._window.Element&&e.closest(".combobox-chips")&&this._input.focus()}_handleKeydown(t){if(t.isComposing||t.keyCode===229){t.key==="Tab"&&this._closeMenu();return}let e=this._visibleOptions(),i=e.findIndex(n=>n.id===this._input.getAttribute("aria-activedescendant")),s=t.key==="ArrowDown"||t.key==="Down",a=t.key==="ArrowUp"||t.key==="Up";if(this._isMultiple&&t.key==="Backspace"&&this._input.value===""){let n=this._selectedOptions(),o=n[n.length-1];o&&(t.preventDefault(),this._removeChip(o.dataset.value||""))}else if((s||a)&&e.length){t.preventDefault(),this._openMenu();let o=i===-1?0:(i+(s?1:-1)+e.length)%e.length;this._setActiveOption(e[o]),t.target!==this._input&&this._input.focus({preventScroll:!0})}else if(t.key==="Enter"){let n=e[i];n&&(t.preventDefault(),this._chooseOption(n),this._isMultiple||this._closeMenu())}else t.key==="Escape"?(this._closeMenu(),this._input.focus()):t.key==="Tab"&&this._closeMenu()}};var ot=new WeakMap;function Wt(r){let{clientX:t,clientY:e}=r;return{top:e,left:t,right:t,bottom:e,width:0,height:0,x:t,y:e}}function ft(r){return!!(r?.disabled||r?.getAttribute?.("aria-disabled")==="true")}function Yt(r){let t=r.target,e=t.closest?.(".dropdown-item");return e||t.closest?.("li")?.querySelector(":scope > .dropdown-item")||null}var B=class r{static getInstance(t){return t?.nodeType===1&&ot.get(t)||null}static getOrCreateInstance(t,e={}){return r.getInstance(t)||new r(t,e)}constructor(t,e={}){if(t?.nodeType!==1||!t.matches(".context-menu"))throw new TypeError("ContextMenu requires a .context-menu root element.");let i=ot.get(t);if(i)return i;if(this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView,this._menu=t.querySelector(":scope > .context-menu-menu"),this._fallback=t.querySelector(":scope > [data-context-menu-fallback]"),!this._menu)throw new TypeError("ContextMenu requires a .context-menu-menu element.");if(!this._fallback)throw new TypeError("ContextMenu requires an explicit fallback trigger.");let s=this._bootstrap("Dropdown");if(!s)throw new TypeError("ContextMenu requires bootstrap.Dropdown (bootstrap.bundle.js).");this._config={...e},this._listeners=[],this._invoker=null,this._pointerRect=null,this._openMethod=null,this._reference={getBoundingClientRect:()=>this._currentRect(),contextElement:this._fallback},this._dropdown=new s(this._fallback,{reference:this._reference,autoClose:"outside"}),ot.set(t,this),this._bindEvents()}dispose(){this._disposing||(this._disposing=!0,this._listeners.forEach(({target:t,type:e,handler:i,options:s})=>{t.removeEventListener(e,i,s)}),this._listeners=[],this._syncExpanded(!1),this._dropdown.hide(),this._dropdown.dispose(),this._invoker=null,this._pointerRect=null,ot.delete(this._element))}show(t=this._fallback){this._open(t,null)}hide(){this._dropdown.hide()}_listen(t,e,i,s){t.addEventListener(e,i,s),this._listeners.push({target:t,type:e,handler:i,options:s})}_bootstrap(t){return this._window.bootstrap?.[t]||null}_currentRect(){return this._pointerRect?this._pointerRect:(this._invoker||this._fallback).getBoundingClientRect()}_trigger(t,e=!1){return this._element.dispatchEvent(new this._window.CustomEvent("".concat(t,".moo.context-menu"),{bubbles:!0,cancelable:e}))}_triggers(){return Array.from(this._element.querySelectorAll(":scope > .context-menu-trigger"))}_syncExpanded(t){this._triggers().forEach(e=>{e.setAttribute("aria-expanded",String(t))})}_menuItems(){return Array.from(this._menu.querySelectorAll(".dropdown-item")).filter(t=>!ft(t)&&!t.classList.contains("disabled"))}_open(t,e,i){ft(t)||(this._menu.classList.contains("show")&&this._dropdown.hide(),this._invoker=t,this._pointerRect=e?Wt(e):null,this._openMethod=i,this._dropdown.show())}_handleContextMenu(t){let e=t.target.closest(".context-menu-trigger");!e||!this._element.contains(e)||(t.preventDefault(),this._open(e,t,"pointer"))}_handleKeydown(t){let e=t.target.closest(".context-menu-trigger");if(!e||!this._element.contains(e))return;let i=t.shiftKey&&t.key==="F10",s=t.key==="ContextMenu";!i&&!s||(t.preventDefault(),this._open(e,null,"keyboard"))}_handleFallbackClick(){this._invoker=this._fallback,this._pointerRect=null,this._openMethod="pointer"}_handleFallbackKeydown(t){if(!(t.key!==" "&&t.key!=="Spacebar")){if(t.preventDefault(),t.stopPropagation(),this._menu.classList.contains("show")){this._dropdown.hide();return}this._open(this._fallback,null,"fallback-keyboard")}}_handleMenuClick(t){let e=Yt(t);if(!e)return;let i=e.matches(".dropdown-item-check, [data-context-menu-persistent]");if(e.matches('.dropdown-item.disabled, .dropdown-item[aria-disabled="true"], .dropdown-item:disabled')||ft(e)){t.preventDefault(),t.stopPropagation();return}let a=e.matches("[data-context-menu-radio-group]")?e:null;if(a){t.preventDefault(),t.stopPropagation();let n=a.dataset.contextMenuRadioGroup;this._menu.querySelectorAll('[data-context-menu-radio-group="'.concat(CSS.escape(String(n)),'"]')).forEach(o=>{let c=o===a;o.classList.toggle("active",c),o.setAttribute("aria-pressed",String(c))});return}i||this._dropdown.hide()}_bindEvents(){this._listen(this._element,"contextmenu",t=>this._handleContextMenu(t)),this._listen(this._element,"keydown",t=>this._handleKeydown(t)),this._listen(this._fallback,"click",()=>this._handleFallbackClick()),this._listen(this._fallback,"keydown",t=>this._handleFallbackKeydown(t)),this._listen(this._menu,"click",t=>this._handleMenuClick(t)),this._listen(this._fallback,"show.bs.dropdown",t=>{this._trigger("show",!0)||t.preventDefault()}),this._listen(this._fallback,"shown.bs.dropdown",()=>{this._syncExpanded(!0),this._openMethod==="fallback-keyboard"?this._fallback.focus():this._openMethod==="keyboard"?this._menuItems()[0]?.focus():this._menu.focus(),this._trigger("shown")}),this._listen(this._fallback,"hide.bs.dropdown",t=>{this._trigger("hide",!0)||t.preventDefault()}),this._listen(this._fallback,"hidden.bs.dropdown",()=>{this._syncExpanded(!1);let t=this._invoker;this._pointerRect=null,this._invoker=null,this._openMethod=null,this._trigger("hidden"),queueMicrotask(()=>{t&&t!==this._fallback&&this._document.activeElement===this._fallback&&t.focus()})})}};var Ct='.moo-ui[data-bs-theme="light"], .moo-ui[data-bs-theme="dark"]',Ut="[data-moo-overlay-host]";function Gt(r){return r?.nodeType===9?r:r?.ownerDocument?r.ownerDocument:typeof document>"u"?null:document}function jt(r){return!!r?.matches?.(Ct)}function Xt(r){let t=Gt(r);return r?.nodeType===9||r===t?.body?t?.body?.firstElementChild||null:r}function E(r=typeof document>"u"?null:document){let t=Xt(r);return t?jt(t)?t:t.closest?.(Ct)||null:null}function F(r){return r?Array.from(r.children||[]).find(t=>t.matches?.(Ut))||r:null}var lt=new WeakMap,Jt=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),Qt=/^[-+]?(?:\d+\.?\d*|\.\d+)$/;function xt(r){return Qt.test(r)?Number(r):null}function Zt(r,t){let e=xt(r),i=xt(t);return e!==null&&i!==null?Math.sign(e-i):e!==null||i!==null?e!==null?-1:1:Jt.compare(r,t)}function M(r){return(r??"").toString().trim().toLowerCase()}var te=".modal, .offcanvas, .dropdown-menu, .popover, [role='dialog'], [role='menu'], [role='listbox']";function ee(r){let t=r.target;return typeof t?.closest=="function"&&(!!t.closest(te)||t.getAttribute("aria-expanded")==="true")}var $=class r{static getInstance(t){return t?.nodeType===1&&lt.get(t)||null}static getOrCreateInstance(t,e={}){return r.getInstance(t)||new r(t,e)}constructor(t,e={}){if(t?.nodeType!==1||!t.matches(".datatable"))throw new TypeError("DataTable requires a .datatable root element.");let i=lt.get(t);if(i)return i;if(this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView,this._table=t.querySelector(":scope .datatable-table"),this._tbody=this._table?.querySelector(":scope > tbody"),!this._table||!this._tbody)throw new TypeError("DataTable requires a .datatable-table with a tbody.");this._cards=t.querySelector("[data-datatable-cards]");let s=new Map(Array.from(t.querySelectorAll("[data-datatable-card]")).map(a=>[a.dataset.datatableCardFor,a]));this._config={...e},this._listeners=[],this._pageSize=Number(t.dataset.datatablePageSize)||10,this._currentPage=1,this._sortKey=null,this._sortDirection=null,this._selectedIds=new Set,this._facetSelections=new Map,this._visibleFacets=new Map,this._searchTerm="",this._tooltips=[],this._filterMode=t.dataset.datatableFilterMode||"inline",this._reparentedRowMenus=new Map,this._reparentedRowMenuByTrigger=new WeakMap,this._reparentedSortMenus=new Map,this._reparentedSortMenuByTrigger=new WeakMap,this._rows=Array.from(this._tbody.querySelectorAll(":scope > tr[data-datatable-row]")).map((a,n)=>({element:a,cardElement:s.get(a.id)||null,index:n,search:M(a.dataset.datatableSearch),facets:this._readFacets(a)})),this._readInitialFacetVisibility(),this._readInitialSort(),lt.set(t,this),this._bindEvents(),this._render(),this._initBulkTooltips(),this._initViewToggle(),this._initRowActionDropdowns(),this._initSortDropdowns()}dispose(){this._disposeRowActionDropdowns(),this._disposeSortDropdowns(),this._restoreRowActionMenus(),this._restoreSortMenus(),this._listeners.forEach(({target:t,type:e,handler:i,options:s})=>{t.removeEventListener(e,i,s)}),this._listeners=[],this._tooltips.forEach(t=>t.dispose()),this._tooltips=[],lt.delete(this._element)}getSelectedIds(){return Array.from(this._selectedIds)}_listen(t,e,i,s){t&&(t.addEventListener(e,i,s),this._listeners.push({target:t,type:e,handler:i,options:s}))}_rowActionTriggers(){return this._element.querySelectorAll('tr[data-datatable-row] .dropdown [data-bs-toggle="dropdown"], [data-datatable-card] .dropdown [data-bs-toggle="dropdown"]')}_initRowActionDropdowns(){let t=this._bootstrap("Dropdown");t&&this._rowActionTriggers().forEach(e=>{t.getOrCreateInstance(e,{popperConfig:i=>this._clippingSafePopperConfig(i)})})}_sortTriggers(){return this._element.querySelectorAll('.datatable-sort [data-bs-toggle="dropdown"]')}_initSortDropdowns(){let t=this._bootstrap("Dropdown");t&&this._sortTriggers().forEach(e=>{t.getOrCreateInstance(e,{popperConfig:i=>this._clippingSafePopperConfig(i)})})}_clippingSafePopperConfig(t){return{...t,strategy:"fixed",modifiers:[...t.modifiers||[],{name:"flip",options:{fallbackPlacements:["top-end","top-start","bottom-end","bottom-start"]}},{name:"preventOverflow",options:{boundary:"viewport",padding:8}}]}}_disposeRowActionDropdowns(){let t=this._bootstrap("Dropdown");t&&this._rowActionTriggers().forEach(e=>{let i=t.getInstance(e);i&&(i.hide(),i.dispose())})}_disposeSortDropdowns(){let t=this._bootstrap("Dropdown");t&&this._sortTriggers().forEach(e=>{let i=t.getInstance(e);i&&(i.hide(),i.dispose())})}_rowActionMenuForTrigger(t){return t?.closest?.("tr[data-datatable-row], [data-datatable-card]")&&t.closest(".dropdown")?.querySelector(":scope > .dropdown-menu")||null}_rowActionOwnerIdForTrigger(t){let e=t?.closest?.("tr[data-datatable-row]")?.id;return e||t?.closest?.("[data-datatable-card]")?.getAttribute("data-datatable-card-for")||""}_reparentRowActionMenu(t){let e=this._rowActionMenuForTrigger(t);if(!e||this._reparentedRowMenus.has(e))return;let i=this._rowActionOwnerIdForTrigger(t);i&&e.setAttribute("data-datatable-row-action-owner",i),t.id&&e.setAttribute("data-datatable-row-action-trigger",t.id),this._reparentedRowMenus.set(e,{parent:e.parentNode,nextSibling:e.nextSibling,trigger:t,owner:E(t)}),this._reparentedRowMenuByTrigger.set(t,e),this._portalRoot(t).appendChild(e)}_restoreRowActionMenuForTrigger(t){let e=this._reparentedRowMenuByTrigger.get(t)||this._rowActionMenuForTrigger(t);e&&this._restoreRowActionMenu(e)}_restoreRowActionMenu(t){let e=this._reparentedRowMenus.get(t);if(!e)return;let{parent:i,nextSibling:s,trigger:a,owner:n}=e;n?.isConnected===!1?t.remove():i?.isConnected?s?.parentNode===i?i.insertBefore(t,s):i.appendChild(t):t.remove(),a&&this._reparentedRowMenuByTrigger.delete(a),t.removeAttribute("data-datatable-row-action-owner"),t.removeAttribute("data-datatable-row-action-trigger"),this._reparentedRowMenus.delete(t)}_restoreRowActionMenus(){Array.from(this._reparentedRowMenus.keys()).forEach(t=>{this._restoreRowActionMenu(t)})}_sortMenuForTrigger(t){return t?.closest?.(".datatable-sort")&&(this._reparentedSortMenuByTrigger.get(t)||t?.closest?.(".dropdown")?.querySelector(":scope > .dropdown-menu"))||null}_reparentSortMenu(t){let e=this._sortMenuForTrigger(t);!e||this._reparentedSortMenus.has(e)||(this._reparentedSortMenus.set(e,{parent:e.parentNode,nextSibling:e.nextSibling,trigger:t,owner:t.closest(".datatable-sort"),themeOwner:E(t)}),this._reparentedSortMenuByTrigger.set(t,e),this._portalRoot(t).appendChild(e))}_restoreSortMenuForTrigger(t){let e=this._reparentedSortMenuByTrigger.get(t)||this._sortMenuForTrigger(t);e&&this._restoreSortMenu(e)}_restoreSortMenu(t){let e=this._reparentedSortMenus.get(t);if(!e)return;let{parent:i,nextSibling:s,trigger:a,themeOwner:n}=e;n?.isConnected===!1?t.remove():i?.isConnected?s?.parentNode===i?i.insertBefore(t,s):i.appendChild(t):t.remove(),a&&this._reparentedSortMenuByTrigger.delete(a),this._reparentedSortMenus.delete(t)}_restoreSortMenus(){Array.from(this._reparentedSortMenus.keys()).forEach(t=>{this._restoreSortMenu(t)})}_bootstrap(t){return this._window.bootstrap?.[t]||null}_portalRoot(t=this._element){return F(E(t))||this._document.body||this._document.documentElement}_initBulkTooltips(){let t=this._bootstrap("Tooltip");t&&this._element.querySelectorAll('[data-datatable-bulk-actions] [data-bs-title]:not([data-bs-toggle="dropdown"])').forEach(e=>{this._tooltips.push(t.getOrCreateInstance(e,{animation:!1,container:this._portalRoot(e)}))})}_hideBulkTooltips({blur:t=!1}={}){if(this._tooltips.forEach(i=>{i.hide()}),!t)return;let e=this._document.activeElement;e?.closest?.("[data-datatable-bulk-actions]")&&e.blur()}_initViewToggle(){let t=Array.from(this._element.querySelectorAll(".datatable-view-toggle"));if(!t.length)return;let e=t.flatMap(h=>Array.from(h.querySelectorAll("input"))),i=this._window.getComputedStyle(this._element).getPropertyValue("--moo-datatable-responsive-breakpoint").trim(),s=this._element.hasAttribute("data-datatable-responsive-breakpoint"),a=s&&i?this._window.matchMedia("(min-width: ".concat(i,")")):null,n=new Map,o=()=>"moo-datatable-view:".concat(this._element.id).concat(a?a.matches?":wide":":narrow":""),c=(h,{persist:_=!1}={})=>{if(this._element.dataset.datatableView!==h){let m=this._bootstrap("Dropdown");[...this._rowActionTriggers(),...this._sortTriggers()].forEach(p=>{m?.getInstance(p)?.hide()})}if(this._element.dataset.datatableView=h,e.forEach(m=>{m.checked=m.value===h}),_){n.set(o(),h);try{this._window.localStorage.setItem(o(),h)}catch{}}},l=()=>{let h=n.get(o());try{h??(h=this._window.localStorage.getItem(o()))}catch{}c(h==="table"||h==="cards"?h:a?a.matches?"table":"cards":this._element.dataset.datatableView)};!s||a?l():e.forEach(h=>{h.checked=!1}),a&&this._listen(a,"change",l),t.forEach(h=>{this._listen(h,"change",_=>{let m=_.target.value;m!=="table"&&m!=="cards"||c(m,{persist:!0})})})}_readFacets(t){let e={};return Array.from(t.attributes).forEach(i=>{let s=/^data-datatable-facet-(.+)$/.exec(i.name);s&&(e[s[1]]=i.value)}),e}_readInitialFacetVisibility(){this._element.querySelectorAll("[data-datatable-facet]").forEach(t=>{let e=t.dataset.datatableFacet;e&&this._visibleFacets.set(e,!t.hidden)}),this._element.querySelectorAll("[data-datatable-filter-group]").forEach(t=>{let e=t.dataset.datatableFilterGroup;e&&!this._visibleFacets.has(e)&&this._visibleFacets.set(e,!1)}),this._element.querySelectorAll("[data-datatable-filter-option-key]").forEach(t=>{let e=t.dataset.datatableFilterOptionKey;e&&!this._visibleFacets.has(e)&&this._visibleFacets.set(e,!1)})}_readInitialSort(){let t=this._element.querySelector("th[data-datatable-initial-sort][data-datatable-column]"),e=t?.dataset.datatableInitialSort;e!=="asc"&&e!=="desc"||(this._sortKey=t.dataset.datatableColumn||null,this._sortDirection=this._sortKey?e:null)}_trigger(t,e={}){this._element.dispatchEvent(new this._window.CustomEvent("".concat(t,".moo.datatable"),{bubbles:!0,detail:e}))}_sortValue(t,e){let i=t.element.querySelector(':scope > [data-datatable-column="'.concat(CSS.escape(String(e)),'"]'));return i?M(i.dataset.datatableSortValue??i.textContent):""}_matchesFilters(t){if(this._searchTerm&&!t.search.includes(this._searchTerm))return!1;for(let[e,i]of this._facetSelections)if(i.size!==0&&!i.has(t.facets[e]))return!1;return!0}_visibleRows(){let t=this._rows.filter(e=>this._matchesFilters(e));if(this._sortKey){let e=this._sortDirection==="desc"?-1:1;t.sort((i,s)=>{let a=this._sortValue(i,this._sortKey),n=this._sortValue(s,this._sortKey),o=Zt(a,n);return o?o*e:i.index-s.index})}else t.sort((e,i)=>e.index-i.index);return t}_pageCount(t){return Math.max(1,Math.ceil(t/this._pageSize))}_render(){let t=this._visibleRows(),e=this._pageCount(t.length);this._currentPage=Math.min(Math.max(1,this._currentPage),e);let i=(this._currentPage-1)*this._pageSize,s=t.slice(i,i+this._pageSize),a=new Set(s.map(l=>l.element.id));this._rows.forEach(l=>{let h=a.has(l.element.id);l.element.hidden=!h,l.cardElement&&(l.cardElement.hidden=!h)});let n=Array.from(this._tbody.children).filter(l=>a.has(l.id)).map(l=>l.id),o=s.map(l=>l.element.id);(n.length!==o.length||n.some((l,h)=>l!==o[h]))&&s.forEach(l=>{this._tbody.appendChild(l.element),this._cards&&l.cardElement&&this._cards.appendChild(l.cardElement)}),this._renderToolbarState(),this._renderSortHeaders(),this._renderSelection(s),this._renderFrameState(t.length),this._renderEmptyState(t.length),this._renderPagination(t.length,e),this._renderPageSize(),this._renderBulkActions()}_renderToolbarState(){let t=!!this._searchTerm,e=Array.from(this._facetSelections.values()).some(s=>s.size>0),i=this._element.querySelector("[data-datatable-reset]");i&&(i.hidden=!(t||e)),this._element.querySelectorAll("[data-datatable-facet]").forEach(s=>{let a=s.dataset.datatableFacet,n=this._facetSelections.get(a)||new Set;this._visibleFacets.has(a)&&(s.hidden=!this._visibleFacets.get(a)),s.querySelector(".datatable-facet-trigger")?.classList.toggle("datatable-facet-trigger-active",n.size>0);let c=s.querySelector("[data-datatable-facet-summary]");c&&(c.hidden=n.size===0,c.replaceChildren(),n.size>2?c.appendChild(this._createFacetBadge("".concat(n.size," selected"))):n.forEach(l=>{let _=s.querySelector('[data-datatable-facet-option="'.concat(CSS.escape(String(l)),'"]'))?.querySelector("[data-datatable-facet-option-label]")?.textContent??l;c.appendChild(this._createFacetBadge(_))})),s.querySelectorAll("[data-datatable-facet-option]").forEach(l=>{let h=n.has(l.dataset.datatableFacetOption);l.classList.toggle("active",h),l.setAttribute("aria-pressed",String(h))})}),this._element.querySelectorAll("[data-datatable-filter-toggle]").forEach(s=>{let a=s.dataset.datatableFilterToggle,n=this._visibleFacets.get(a)??!0;s.classList.toggle("active",n),s.setAttribute("aria-pressed",n?"true":"false")}),this._element.querySelectorAll("[data-datatable-filter-option]").forEach(s=>{let a=s.dataset.datatableFilterOptionKey,o=(this._facetSelections.get(a)||new Set).has(s.dataset.datatableFilterOption);s.classList.toggle("active",o),s.setAttribute("aria-pressed",o?"true":"false")}),this._element.querySelectorAll("[data-datatable-filter-group-summary]").forEach(s=>{let a=this._facetSelections.get(s.dataset.datatableFilterGroupSummary)||new Set;s.hidden=a.size===0,s.textContent=a.size>0?"".concat(a.size," selected"):""})}_createFacetBadge(t){let e=this._document.createElement("span");return e.className="datatable-facet-badge",e.textContent=t,e}_renderSelection(t){let e=Array.from(this._element.querySelectorAll("[data-datatable-select-all]"));t.forEach(a=>{[a.element,a.cardElement].forEach(n=>{let o=n?.querySelector("[data-datatable-select-row]");o&&(o.checked=this._selectedIds.has(a.element.id)),n?.classList.toggle("datatable-row-selected",this._selectedIds.has(a.element.id))})});let i=t.length,s=t.filter(a=>this._selectedIds.has(a.element.id)).length;e.forEach(a=>{a.checked=i>0&&s===i,a.indeterminate=s>0&&s<i})}_renderBulkActions(){let t=this._element.querySelector("[data-datatable-bulk-actions]");if(!t)return;t.hidden=this._selectedIds.size===0;let e=t.querySelector("[data-datatable-bulk-count]");e&&(e.textContent=String(this._selectedIds.size))}_renderFrameState(t){let e=t===0;this._element.querySelectorAll(".datatable-frame, .datatable-card-frame").forEach(i=>{i.hidden=e})}_renderEmptyState(t){let e=this._element.querySelector("[data-datatable-empty]");if(!e)return;let i=this._rows.length>0;e.hidden=t!==0,e.querySelector(".empty-state-title, .datatable-empty-title")?.replaceChildren(this._document.createTextNode(i?"No matching results":"No rows to display"));let s=e.querySelector(".empty-state-description, .datatable-empty-copy");s&&(s.hidden=!i);let a=e.querySelector("[data-datatable-empty-reset]");if(a){a.hidden=!i;let n=a.closest(".empty-state-actions");n&&(n.hidden=!i)}}_sortAriaValue(t){return t==="asc"?"ascending":t==="desc"?"descending":"none"}_renderSortHeaders(){this._element.querySelectorAll("th[data-datatable-column]").forEach(t=>{if(!t.querySelector("[data-datatable-sort-key]")){delete t.dataset.datatableSortState,delete t.dataset.datatableSortDirection,t.removeAttribute("aria-sort");return}let i=t.dataset.datatableColumn,s=i&&i===this._sortKey?this._sortDirection:"none";t.dataset.datatableSortState=s||"none",t.setAttribute("aria-sort",this._sortAriaValue(s)),s==="asc"||s==="desc"?t.dataset.datatableSortDirection=s:delete t.dataset.datatableSortDirection})}_renderPagination(t,e){let i=this._element.querySelector("[data-datatable-page-first]"),s=this._element.querySelector("[data-datatable-page-prev]"),a=this._element.querySelector("[data-datatable-page-next]"),n=this._element.querySelector("[data-datatable-page-last]"),o=this._currentPage<=1,c=this._currentPage>=e;[i,s].forEach(u=>this._setPageItemDisabled(u,o)),[a,n].forEach(u=>this._setPageItemDisabled(u,c));let l=this._element.querySelector("[data-datatable-results-summary]");if(l)if(t===0)l.textContent="No results";else{let u=(this._currentPage-1)*this._pageSize+1,d=Math.min(this._currentPage*this._pageSize,t);l.textContent="Showing ".concat(u,"-").concat(d," of ").concat(t)}let h=this._element.querySelector("template[data-datatable-page-numbers]");if(!h)return;let _=this._pageWindow(this._currentPage,e),m=Array.from(h.parentNode.querySelectorAll("[data-datatable-page-number], [data-datatable-page-ellipsis]")),p=m.map(u=>u.dataset.datatablePageEllipsis===void 0?Number(u.dataset.datatablePageNumber):"\u2026");if(p.length!==_.length||p.some((u,d)=>u!==_[d])){m.forEach(d=>d.remove());let u=this._document.createDocumentFragment();_.forEach(d=>{let D=this._document.createElement("li");if(D.className="page-item",d==="\u2026")D.dataset.datatablePageEllipsis="",D.innerHTML='<span class="page-link">\u2026</span>';else{D.dataset.datatablePageNumber=String(d);let w=this._document.createElement("button");w.type="button",w.className="page-link",w.textContent=String(d),w.setAttribute("aria-label","Go to page ".concat(d)),w.dataset.datatablePageGo=String(d),D.appendChild(w)}u.appendChild(D)}),h.parentNode.insertBefore(u,h)}h.parentNode.querySelectorAll("[data-datatable-page-number]").forEach(u=>{let d=Number(u.dataset.datatablePageNumber)===this._currentPage;u.classList.toggle("active",d),d?u.setAttribute("aria-current","page"):u.removeAttribute("aria-current")})}_renderPageSize(){let t=String(this._pageSize),e=this._element.querySelector("[data-datatable-page-size-value]");e&&(e.textContent=t);let i=this._element.querySelector("[data-datatable-page-size-select]");i&&(i.value=t),this._element.querySelectorAll("[data-datatable-page-size-option]").forEach(s=>{let a=s.dataset.datatablePageSizeOption===t;s.classList.toggle("active",a),s.setAttribute("aria-pressed",a?"true":"false")})}_setPageItemDisabled(t,e){t&&(t.disabled=e,t.closest(".page-item")?.classList.toggle("disabled",e))}_pageWindow(t,e){if(e<=7)return Array.from({length:e},(n,o)=>o+1);let i=new Set([1,e,t-1,t,t+1]),s=Array.from(i).filter(n=>n>=1&&n<=e).sort((n,o)=>n-o),a=[];return s.forEach((n,o)=>{o>0&&n-s[o-1]>1&&a.push("\u2026"),a.push(n)}),a}_isColumnFixed(t){return this._element.querySelector('th[data-datatable-column="'.concat(CSS.escape(String(t)),'"]'))?.hasAttribute("data-datatable-column-fixed")||!1}_setColumnVisible(t,e,{syncViewToggle:i=!0}={}){!e&&this._isColumnFixed(t)||(this._element.querySelectorAll('[data-datatable-column="'.concat(CSS.escape(String(t)),'"], [data-datatable-detail-column="').concat(CSS.escape(String(t)),'"]')).forEach(s=>{s.classList.toggle("datatable-col-hidden",!e)}),i&&this._element.querySelectorAll('[data-datatable-column-toggle="'.concat(CSS.escape(String(t)),'"]')).forEach(s=>{s.classList.toggle("active",e),s.setAttribute("aria-pressed",String(e))}))}_setSort(t,e){let i=e==="asc"||e==="desc"?e:null;this._sortKey=i?t:null,this._sortDirection=i,this._render(),this._trigger("sort",{key:this._sortKey,direction:this._sortDirection})}_handleSortAction(t){let e=t.target.closest("[data-datatable-sort-action]");if(!e)return;let i=e.closest(".dropdown-menu"),s=i?.closest(".datatable-sort")||this._reparentedSortMenus.get(i)?.owner;if(!s||!this._element.contains(s))return;let a=s.querySelector("[data-datatable-sort-key]")?.dataset.datatableSortKey;if(!a)return;let n=e.dataset.datatableSortAction;if(n==="hide"){this._setColumnVisible(a,!1);return}this._setSort(a,n)}_handleFacetClick(t){let e=t.target.closest("[data-datatable-facet-option]"),i=t.target.closest("[data-datatable-facet-clear]");if(!e&&!i)return;let a=t.target.closest("[data-datatable-facet]")?.dataset.datatableFacet;if(!a)return;let n=this._facetSelections.get(a)||new Set;if(i)n.clear();else{let o=e.dataset.datatableFacetOption;n.has(o)?n.delete(o):n.add(o)}this._facetSelections.set(a,n),this._filterMode==="picker"&&n.size===0&&this._visibleFacets.set(a,!1),this._currentPage=1,this._render(),this._trigger("filter")}_handleFacetSearch(t){let e=t.target.closest("[data-datatable-facet-search]");if(!e)return;let i=e.closest("[data-datatable-facet]"),s=M(e.value);i?.querySelectorAll("[data-datatable-facet-option]").forEach(a=>{let n=M(a.querySelector("[data-datatable-facet-option-label]")?.textContent||a.textContent);a.closest("li")?.classList.toggle("datatable-facet-search-hidden",s.length>0&&!n.includes(s))})}_handleFacetSearchKeydown(t){if(t.key!=="ArrowDown")return;let e=t.target.closest("[data-datatable-facet-search]");if(!e)return;let i=e.closest("[data-datatable-facet]"),a=Array.from(i?.querySelectorAll("[data-datatable-facet-option]")||[]).find(n=>!n.closest("li")?.classList.contains("datatable-facet-search-hidden"));a&&(t.preventDefault(),a.focus())}_handleFilterOptionClick(t){let e=t.target.closest("[data-datatable-filter-option]");if(!e)return;let i=e.dataset.datatableFilterOptionKey,s=e.dataset.datatableFilterOption;if(!i||!this._visibleFacets.has(i))return;this._visibleFacets.set(i,!0);let a=this._facetSelections.get(i)||new Set;a.has(s)?a.delete(s):a.add(s),this._facetSelections.set(i,a),a.size===0&&this._visibleFacets.set(i,!1),this._currentPage=1,this._render(),this._trigger("filter")}_showFilterPickerPanel(t=null){this._element.querySelectorAll("[data-datatable-filter-panel]").forEach(e=>{let i=e.dataset.datatableFilterPanel==="facets",s=e.dataset.datatableFilterPanelKey===t;e.hidden=t?!s:!i}),this._element.querySelector(".datatable-search-filter-menu")?.setAttribute("data-datatable-filter-menu-panel",t?"options":"facets")}_handleFilterPickerClick(t){let e=t.target.closest("[data-datatable-filter-group]");if(e){let i=e.dataset.datatableFilterGroup;this._showFilterPickerPanel(i);let s=this._element.querySelector('[data-datatable-filter-option-search="'.concat(CSS.escape(String(i)),'"]')),a=this._element.querySelector('[data-datatable-filter-option-key="'.concat(CSS.escape(String(i)),'"]'));(s||a)?.focus({preventScroll:!0});return}t.target.closest("[data-datatable-filter-back]")&&this._showFilterPickerPanel()}_handleFilterOptionSearch(t){let e=t.target.closest("[data-datatable-filter-option-search]");if(!e)return;let i=e.dataset.datatableFilterOptionSearch,s=M(e.value);this._element.querySelectorAll('[data-datatable-filter-option-key="'.concat(CSS.escape(String(i)),'"]')).forEach(a=>{let n=M(a.querySelector("[data-datatable-filter-option-label]")?.textContent||a.textContent);a.closest("li")?.classList.toggle("datatable-filter-option-search-hidden",s.length>0&&!n.includes(s))})}_handleFilterOptionSearchKeydown(t){if(t.key!=="ArrowDown")return;let e=t.target.closest("[data-datatable-filter-option-search]");if(!e)return;let i=e.dataset.datatableFilterOptionSearch,a=Array.from(this._element.querySelectorAll('[data-datatable-filter-option-key="'.concat(CSS.escape(String(i)),'"]'))).find(n=>!n.closest("li")?.classList.contains("datatable-filter-option-search-hidden"));a&&(t.preventDefault(),a.focus())}_handleFilterToggleClick(t){let e=t.target.closest("[data-datatable-filter-toggle]");if(!e)return;let i=e.dataset.datatableFilterToggle;if(!i||!this._visibleFacets.has(i))return;let s=!this._visibleFacets.get(i);this._visibleFacets.set(i,s),s||(this._facetSelections.get(i)?.clear(),this._currentPage=1,this._trigger("filter")),this._render()}_handleColumnToggleClick(t){let e=t.target.closest("[data-datatable-column-toggle]");if(!e)return;let i=e.dataset.datatableColumnToggle,s=e.getAttribute("aria-pressed")==="true";this._setColumnVisible(i,s,{syncViewToggle:!1})}_handleReset(){let t=this._element.querySelector("[data-datatable-search]");t&&(t.value=""),this._searchTerm="",this._facetSelections.forEach(e=>e.clear()),this._filterMode==="picker"&&this._visibleFacets.forEach((e,i)=>{this._visibleFacets.set(i,!1)}),this._currentPage=1,this._render(),this._trigger("filter")}_handleSelectAll(t){let e=t.target.checked,i=this._visibleRows(),s=(this._currentPage-1)*this._pageSize;i.slice(s,s+this._pageSize).forEach(n=>{e?this._selectedIds.add(n.element.id):this._selectedIds.delete(n.element.id)}),this._render(),this._trigger("select")}_handleSelectRow(t){let e=t.target.closest("[data-datatable-select-row]");if(!e)return;let i=e.closest("[data-datatable-row]"),s=e.closest("[data-datatable-card]"),a=i?.id||s?.dataset.datatableCardFor;a&&(e.checked?this._selectedIds.add(a):this._selectedIds.delete(a),this._render(),this._trigger("select"))}_handleBulkClick(t){if(t.target.closest("[data-datatable-bulk-clear]")){this._clearSelection();return}let e=t.target.closest("[data-datatable-bulk-update]");if(e){let s=e.dataset.datatableBulkUpdate,a=e.dataset.datatableBulkUpdateValue;this._applyBulkUpdate(s,a,e);return}let i=t.target.closest("[data-datatable-bulk-action]");if(i){let s=i.dataset.datatableBulkAction;if(s==="delete"){this._applyBulkDelete();return}this._trigger("bulk-".concat(s),{ids:this.getSelectedIds()})}}_clearSelection(){this._hideBulkTooltips({blur:!0}),this._selectedIds.clear(),this._render(),this._trigger("select")}_applyBulkUpdate(t,e,i){let s=i.querySelector("svg")?.cloneNode(!0),a=i.querySelector("span")?.textContent?.trim()??e;this._selectedIds.forEach(n=>{let o=this._rows.find(m=>m.element.id===n);if(!o)return;o.element.setAttribute("data-datatable-facet-".concat(t),e),o.facets[t]=e;let c=o.element.querySelector('[data-datatable-column="'.concat(CSS.escape(String(t)),'"]'));if(!c)return;let l=c.querySelector("[data-datatable-cell-label]");l?l.textContent=a:c.textContent=a;let h=c.querySelector("svg");h&&s&&h.replaceWith(s.cloneNode(!0));let _=o.cardElement?.querySelector('[data-datatable-detail-column="'.concat(CSS.escape(String(t)),'"] .datatable-card-value'));_&&(_.innerHTML=c.innerHTML)}),this._render(),this._trigger("bulk-update",{key:t,value:e,ids:this.getSelectedIds()})}_applyBulkDelete(){let t=this.getSelectedIds();t.forEach(e=>{let i=this._rows.findIndex(s=>s.element.id===e);i!==-1&&(this._rows[i].element.remove(),this._rows[i].cardElement?.remove(),this._rows.splice(i,1))}),this._selectedIds.clear(),this._render(),this._trigger("bulk-delete",{ids:t})}_handlePageClick(t){let e=t.target.closest("[data-datatable-page-go]");if(e){this._currentPage=Number(e.dataset.datatablePageGo),this._render();return}if(t.target.closest("[data-datatable-page-first]")){this._currentPage=1,this._render();return}if(t.target.closest("[data-datatable-page-prev]")){this._currentPage-=1,this._render();return}if(t.target.closest("[data-datatable-page-next]")){this._currentPage+=1,this._render();return}t.target.closest("[data-datatable-page-last]")&&(this._currentPage=this._pageCount(this._visibleRows().length),this._render())}_setPageSize(t){let e=Number(t);!Number.isFinite(e)||e<=0||(this._pageSize=e,this._element.dataset.datatablePageSize=String(e),this._currentPage=1,this._render())}_bindEvents(){let t=this._element.querySelector("[data-datatable-search]");this._listen(t,"input",s=>{this._searchTerm=M(s.target.value),this._currentPage=1,this._render(),this._trigger("filter")}),this._listen(t,"keydown",s=>{if(s.key!=="Enter")return;s.preventDefault();let a=this._element.querySelector("[data-datatable-filter-menu-trigger]"),n=this._bootstrap("Dropdown");a&&n&&n.getOrCreateInstance(a).hide()}),this._listen(this._element,"click",s=>{this._handleFilterPickerClick(s),this._handleFilterOptionClick(s),this._handleFilterToggleClick(s),this._handleFacetClick(s),this._handleColumnToggleClick(s),this._handlePageClick(s),this._handleBulkClick(s),s.target.closest("[data-datatable-empty-reset]")&&this._handleReset(),s.target.closest("[data-datatable-select-row]")&&this._handleSelectRow(s)}),this._listen(this._document,"click",s=>this._handleSortAction(s)),this._listen(this._window,"keydown",s=>{s.key==="Escape"&&this._selectedIds.size>0&&!ee(s)&&this._clearSelection()},{capture:!0}),this._listen(this._element,"show.bs.dropdown",s=>{this._reparentRowActionMenu(s.target),this._reparentSortMenu(s.target);let a=this._bootstrap("Tooltip")?.getInstance(s.target);a?.hide(),a?.disable()}),this._listen(this._element,"hidden.bs.dropdown",s=>{this._restoreRowActionMenuForTrigger(s.target),this._restoreSortMenuForTrigger(s.target),this._bootstrap("Tooltip")?.getInstance(s.target)?.enable(),s.target.matches("[data-datatable-filter-menu-trigger]")&&this._showFilterPickerPanel()}),this._element.querySelectorAll("[data-datatable-filter-option-search]").forEach(s=>{this._listen(s,"input",a=>this._handleFilterOptionSearch(a)),this._listen(s,"keydown",a=>this._handleFilterOptionSearchKeydown(a))}),this._element.querySelectorAll("[data-datatable-facet-search]").forEach(s=>{this._listen(s,"input",a=>this._handleFacetSearch(a)),this._listen(s,"keydown",a=>this._handleFacetSearchKeydown(a))});let e=this._element.querySelector("[data-datatable-reset]");this._listen(e,"click",()=>this._handleReset()),this._element.querySelectorAll("[data-datatable-select-all]").forEach(s=>{this._listen(s,"change",a=>this._handleSelectAll(a))});let i=this._element.querySelector("[data-datatable-page-size-select]");this._listen(i,"change",s=>this._setPageSize(s.target.value)),this._element.querySelectorAll("[data-datatable-page-size-option]").forEach(s=>{this._listen(s,"click",()=>{this._setPageSize(s.dataset.datatablePageSizeOption)})})}};var z=new WeakMap,K=new WeakMap,H=new WeakMap,A="en",ke=1440*60*1e3,ie=new Date(2026,7,16),O=8;function wt(r,t){return r?.nodeType===1&&!!r.matches?.(t)}function b(r,t,e,i,s){t&&(t.addEventListener(e,i,s),r.push({target:t,type:e,handler:i,options:s}))}function P(r){r.forEach(({target:t,type:e,handler:i,options:s})=>{t.removeEventListener(e,i,s)}),r.length=0}function g(r){if(!r)return null;if(r instanceof Date)return Number.isNaN(r.getTime())?null:new Date(r.getFullYear(),r.getMonth(),r.getDate());if(typeof r=="number")return g(new Date(r));let t=String(r).trim(),e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t);if(e){let i=new Date(Number(e[1]),Number(e[2])-1,Number(e[3]));return i.getFullYear()===Number(e[1])&&i.getMonth()===Number(e[2])-1&&i.getDate()===Number(e[3])?i:null}return null}function Mt(r){return String(r).padStart(2,"0")}function y(r){return"".concat(r.getFullYear(),"-").concat(Mt(r.getMonth()+1),"-").concat(Mt(r.getDate()))}function v(r,t){return!r||!t?0:r.getTime()-t.getTime()}function T(r,t){return!!(r&&t&&y(r)===y(t))}function x(r,t){return new Date(r.getFullYear(),r.getMonth(),r.getDate()+t)}function Tt(r,t){let e=new Date(r.getFullYear(),r.getMonth()+t,1),i=Math.min(r.getDate(),gt(e.getFullYear(),e.getMonth()));return new Date(e.getFullYear(),e.getMonth(),i)}function ct(r=A){try{if(typeof Intl<"u"&&typeof Intl.Locale=="function"){let t=new Intl.Locale(r||A),e=t.weekInfo||t.getWeekInfo?.();if(Number.isInteger(e?.firstDay))return e.firstDay%7}}catch{}return 0}function se(r=A){let t=ct(r);return Array.from({length:7},(e,i)=>x(ie,(t+i)%7))}function C(r){return new Date(r.getFullYear(),r.getMonth(),1)}function gt(r,t){return new Date(r,t+1,0).getDate()}function Pt(r,t,e){return t&&v(r,t)<0?new Date(t):e&&v(r,e)>0?new Date(e):r}function re(r){if(Array.isArray(r))return r.map(g).filter(Boolean).map(y);if(!r)return[];let t=String(r).trim();if(!t)return[];try{let e=JSON.parse(t);if(Array.isArray(e))return e.map(g).filter(Boolean).map(y)}catch{}return t.split(",").map(g).filter(Boolean).map(y)}function q(r,t=A){return r?new Intl.DateTimeFormat(t||A,{month:"short",day:"numeric",year:"numeric"}).format(r):""}function It(r,t=A){return new Intl.DateTimeFormat(t||A,{month:"long",year:"numeric"}).format(r)}function mt(r,t,e=A){if(r)return t==="yyyy-mm-dd"?y(r):t?q(r,e):new Date(r)}function St(r,t={}){let e=r.dataset||{},i=t.locale||e.datepickerLocale||e.calendarLocale||A,s=g(t.minDate||e.calendarMinDate||e.datepickerMinDate),a=g(t.maxDate||e.calendarMaxDate||e.datepickerMaxDate);return{locale:i,mode:t.mode||e.calendarMode||e.datepickerMode||"single",placeholder:t.placeholder||e.datepickerPlaceholder||"Pick a date",value:t.value||e.calendarValue||e.datepickerValue||"",startValue:t.startValue||e.calendarStartValue||e.datepickerStartValue||"",endValue:t.endValue||e.calendarEndValue||e.datepickerEndValue||"",minDate:s,maxDate:a,disabledDates:re(t.disabledDates||e.calendarDisabledDates||e.datepickerDisabledDates),captionLayout:t.captionLayout||e.calendarCaptionLayout||"",showPresets:t.showPresets??(e.calendarShowPresets==="true"||e.datepickerShowPresets==="true")}}function k(r,t,e,i={},s=!1){return r.dispatchEvent(new t.CustomEvent(e,{bubbles:!0,cancelable:s,detail:i}))}function bt(r){return r?("datepickerFormDefault"in r.dataset||(r.dataset.datepickerFormDefault=r.getAttribute("value")||""),r.dataset.datepickerFormDefault):""}function yt(r,t){r&&(r.value=t||"")}function Lt(r,t){r&&(r.value=t||"")}function vt(r,t,e){if(e){r.dataset.invalid="true",t.classList.add("is-invalid"),t.setAttribute("aria-invalid","true");return}delete r.dataset.invalid,t.classList.remove("is-invalid"),t.removeAttribute("aria-invalid")}function Rt(r,t,e){e?.required&&e.checkValidity()&&vt(r,t,!1)}function Ft(r,t,e){return e<t?t:Math.min(Math.max(r,t),e)}function ae(r,t,e){let i=r?.ownerDocument?.defaultView||window,s=r?i.getComputedStyle(r).getPropertyValue(t).trim():"",a=Number.parseFloat(s);if(!Number.isFinite(a))return e;if(s.endsWith("rem")){let n=r.ownerDocument.documentElement,o=Number.parseFloat(i.getComputedStyle(n).fontSize);return Number.isFinite(o)?a*o:e}if(s.endsWith("em")){let n=Number.parseFloat(i.getComputedStyle(r).fontSize);return Number.isFinite(n)?a*n:e}return Number.isFinite(a)?a:e}function W(r,t){return!!(t&&(r._element.contains(t)||r._popover.contains(t)))}function Ot(r){let e=E(r._trigger)?.getAttribute("data-bs-theme")||null,i=r._document.defaultView?.getComputedStyle(r._trigger).direction;e?r._popover.setAttribute("data-bs-theme",e):r._popover.removeAttribute("data-bs-theme"),i==="ltr"||i==="rtl"?r._popover.setAttribute("dir",i):r._popover.removeAttribute("dir")}function ne(r){let t=r._popover,e=E(r._trigger),i=F(e)||r._document.body||r._document.documentElement;if(i){if(r._popoverPortal?.portal===i&&t.parentElement===i){Ot(r);return}ut(r),r._popoverPortal={parent:t.parentNode,nextSibling:t.nextSibling,owner:e,portal:i,hadTheme:t.hasAttribute("data-bs-theme"),theme:t.getAttribute("data-bs-theme"),hadDirection:t.hasAttribute("dir"),direction:t.getAttribute("dir")},i.appendChild(t),Ot(r)}}function ut(r){let t=r._popoverPortal;if(!t)return;let e=r._popover;t.owner?.isConnected===!1?e.remove():t.parent?.isConnected?t.nextSibling?.parentNode===t.parent?t.parent.insertBefore(e,t.nextSibling):t.parent.appendChild(e):e.remove(),t.hadTheme?e.setAttribute("data-bs-theme",t.theme):e.removeAttribute("data-bs-theme"),t.hadDirection?e.setAttribute("dir",t.direction):e.removeAttribute("dir"),r._popoverPortal=null}function oe(r,t,e,i){let s=ae(e,"--moo-datepicker-popover-offset",6),a=getComputedStyle(r).direction;t.style.position="fixed",t.style.inset="auto",t.style.right="auto",t.style.bottom="auto",t.style.maxHeight="",t.style.overflowY="";let n=r.getBoundingClientRect(),o=t.getBoundingClientRect(),c=i.innerWidth,l=i.innerHeight,h=a==="rtl"?n.right-o.width:n.left,_=Ft(h,O,c-o.width-O),m=n.bottom+s<=l?l-n.bottom-s-O:0,p=n.top-s-O,f=o.height>m&&p>m,u=f?"top":"bottom",d=Math.max(0,f?p:m),D=Math.min(o.height,d),w=f?n.top-s-D:n.bottom+s;t.style.left="".concat(Math.round(_),"px"),t.style.top="".concat(Math.round(Ft(w,O,l-D-O)),"px"),d>0&&(t.style.maxHeight="".concat(Math.floor(d),"px"),t.style.overflowY="auto"),t.dataset.datepickerPlacement=u}function le(r){r.style.position="",r.style.inset="",r.style.right="",r.style.bottom="",r.style.left="",r.style.top="",r.style.maxHeight="",r.style.overflowY="",delete r.dataset.datepickerPlacement}function Vt(r){P(r._floatingListeners),ne(r);let t=()=>{r.isOpen()&&oe(r._trigger,r._popover,r._element,r._window)};r._positionPopover=t,t(),b(r._floatingListeners,r._window,"resize",t),b(r._floatingListeners,r._window,"scroll",t,!0),b(r._floatingListeners,r._document,"scroll",t,!0)}function ht(r){P(r._floatingListeners),r._positionPopover=null,le(r._popover),ut(r)}function ce(r,t){return new Intl.DateTimeFormat(t||A,{month:"short"}).format(new Date(2026,r,1))}function he(r,t,e){let i=r?r.getFullYear():e.getFullYear()-100,s=t?t.getFullYear():e.getFullYear()+20,a=[];for(let n=i;n<=s;n+=1)a.push(n);return a}function qt(r,t,e=""){let i=r.createElement("span");return i.className=e,i.setAttribute("aria-hidden","true"),i.textContent=t,i}var L=class r{static getInstance(t){return t?.nodeType===1&&K.get(t)||null}static getOrCreateInstance(t,e={}){return r.getInstance(t)||new r(t,e)}constructor(t,e={}){if(!wt(t,"[data-calendar]"))throw new TypeError("MooCalendar requires a [data-calendar] root element.");let i=K.get(t);if(i)return i;this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView||window,this._listeners=[],this._disposed=!1,this._config=St(t,e),this._mode=this._config.mode==="range"?"range":"single",this._disabledDates=new Set(this._config.disabledDates),this._selectedDate=g(this._config.value),this._rangeStart=g(this._config.startValue),this._rangeEnd=g(this._config.endValue),this._activeDate=this._nearestEnabledDate(this._rangeStart||this._selectedDate||new Date),this._viewDate=C(this._activeDate),this._captionId=this._element.id?"".concat(this._element.id,"-caption"):"moo-calendar-caption-".concat(Math.random().toString(36).slice(2)),this._labelId=this._element.id?"".concat(this._element.id,"-label"):"moo-calendar-label-".concat(Math.random().toString(36).slice(2)),K.set(t,this),this._bindEvents(),this._render()}dispose(){this._disposed||(this._disposed=!0,P(this._listeners),this._element.replaceChildren(),K.get(this._element)===this&&K.delete(this._element))}getDate(t=void 0){return this._mode==="range"?this.getDates(t):mt(this._selectedDate,t,this._config.locale)}getDates(t=void 0){return[mt(this._rangeStart,t,this._config.locale),mt(this._rangeEnd,t,this._config.locale)]}setDate(t,e={}){if(this._mode!=="single")return!1;let i=g(t);return!i||this._isDisabled(i)?!1:(this._selectedDate=i,this._activeDate=i,this._viewDate=C(i),this._render(),e.emit!==!1&&this._emitChange(!0),!0)}setDates(t,e,i={}){if(this._mode!=="range")return!1;let s=g(t),a=g(e);return s&&this._isDisabled(s)||a&&this._isDisabled(a)?!1:(this._rangeStart=s,this._rangeEnd=a,this._rangeStart&&this._rangeEnd&&v(this._rangeStart,this._rangeEnd)>0&&([this._rangeStart,this._rangeEnd]=[this._rangeEnd,this._rangeStart]),this._activeDate=this._rangeEnd||this._rangeStart||this._activeDate,this._viewDate=C(this._activeDate),this._render(),i.emit!==!1&&this._emitChange(!!(this._rangeStart&&this._rangeEnd)),!0)}clear(t={}){this._selectedDate=null,this._rangeStart=null,this._rangeEnd=null,this._render(),t.emit!==!1&&this._emitChange(!1)}focusActiveDay(){this._dayButton(this._activeDate)?.focus()}_bindEvents(){b(this._listeners,this._element,"click",t=>{let e=t.target,i=e.closest?.("[data-calendar-day]"),s=e.closest?.("[data-calendar-prev]"),a=e.closest?.("[data-calendar-next]"),n=e.closest?.("[data-calendar-preset]");s?this._changeMonth(-1,!0):a?this._changeMonth(1,!0):n?this._selectPreset(n.dataset.calendarPreset):i&&this._selectDate(g(i.dataset.calendarDay),!0)}),b(this._listeners,this._element,"keydown",t=>{t.target.closest?.("[data-calendar-day]")&&this._handleDayKeydown(t)}),b(this._listeners,this._element,"change",t=>{t.target.matches?.("[data-calendar-month]")&&this._setActiveMonth(this._viewDate.getFullYear(),Number(t.target.value),!0),t.target.matches?.("[data-calendar-year]")&&this._setActiveMonth(Number(t.target.value),this._viewDate.getMonth(),!0)})}_emitChange(t){k(this._element,this._window,"change.moo.calendar",{date:this._selectedDate?new Date(this._selectedDate):void 0,value:this._selectedDate?y(this._selectedDate):"",startDate:this._rangeStart?new Date(this._rangeStart):void 0,endDate:this._rangeEnd?new Date(this._rangeEnd):void 0,startValue:this._rangeStart?y(this._rangeStart):"",endValue:this._rangeEnd?y(this._rangeEnd):"",complete:t})}_changeMonth(t,e){let i=C(Tt(this._viewDate,t));this._setActiveMonth(i.getFullYear(),i.getMonth(),e)}_setActiveMonth(t,e,i=!1){let s=Math.min(this._activeDate.getDate(),gt(t,e));this._activeDate=this._nearestEnabledDate(new Date(t,e,s)),this._viewDate=C(this._activeDate),this._render(),i&&this.focusActiveDay()}_selectPreset(t){if(!t)return;let e=new Date,i={today:0,tomorrow:1,"in-3-days":3,"in-a-week":7,"in-2-weeks":14};t in i&&this._selectDate(x(e,i[t]),!0)}_handleDayKeydown(t){let e=t.target.closest?.("[data-calendar-day]"),i=g(e?.dataset?.calendarDay);i&&v(i,this._activeDate)!==0&&(this._activeDate=i);let s={ArrowRight:1,ArrowLeft:-1,ArrowDown:7,ArrowUp:-7},a=null,n=!1;if(t.key in s)a=x(this._activeDate,s[t.key]);else if(t.key==="Home"){let c=ct(this._config.locale),l=(this._activeDate.getDay()-c+7)%7;a=x(this._activeDate,-l)}else if(t.key==="End"){let c=ct(this._config.locale),l=(this._activeDate.getDay()-c+7)%7;a=x(this._activeDate,6-l)}else if(t.key==="PageUp"||t.key==="PageDown"){let c=Tt(this._activeDate,t.key==="PageUp"?-1:1),{minDate:l,maxDate:h}=this._config;a=Pt(c,l,h),n=[l,h].some(_=>_&&v(a,_)===0)}else if(t.key==="Enter"||t.key===" "||t.key==="Spacebar"){t.preventDefault(),this._selectDate(this._activeDate,!0);return}else return;t.preventDefault();let o=v(a,this._activeDate)<0;this._setActiveDate(a,!0,o!==n?-1:1)}_setActiveDate(t,e=!1,i=0){let s=i===0?this._nearestEnabledDate(t):this._nextEnabledDate(t,i);this._activeDate=s,this._viewDate=C(s),this._render(),e&&this.focusActiveDay()}_nextEnabledDate(t,e){let i=g(t);if(!i)return this._activeDate;let s=e<0?-1:1;for(let a=0;a<366&&!(this._config.minDate&&v(i,this._config.minDate)<0||this._config.maxDate&&v(i,this._config.maxDate)>0);a+=1){if(!this._isDisabled(i))return i;i=x(i,s)}return this._activeDate}_nearestEnabledDate(t){let e=Pt(g(t)||new Date,this._config.minDate,this._config.maxDate);if(!this._isDisabled(e))return e;let i=C(e),s=gt(i.getFullYear(),i.getMonth());for(let a=1;a<=s;a+=1){let n=new Date(i.getFullYear(),i.getMonth(),a);if(!this._isDisabled(n))return n}return e}_selectDate(t,e){if(!(!t||this._isDisabled(t))){if(this._activeDate=t,this._viewDate=C(t),this._mode==="range"){!this._rangeStart||this._rangeEnd||v(t,this._rangeStart)<0?(this._rangeStart=t,this._rangeEnd=null):this._rangeEnd=t,this._render(),e&&this._emitChange(!!(this._rangeStart&&this._rangeEnd));return}this._selectedDate=t,this._render(),e&&this._emitChange(!0)}}_isDisabled(t){return!t||this._config.minDate&&v(t,this._config.minDate)<0||this._config.maxDate&&v(t,this._config.maxDate)>0?!0:this._disabledDates.has(y(t))}_isSelected(t){return this._mode==="range"?T(t,this._rangeStart)||T(t,this._rangeEnd):T(t,this._selectedDate)}_rangeState(t){return this._mode!=="range"||!this._rangeStart?"":T(t,this._rangeStart)?"start":T(t,this._rangeEnd)?"end":this._rangeStart&&this._rangeEnd&&v(t,this._rangeStart)>0&&v(t,this._rangeEnd)<0?"middle":""}_dayButton(t){return this._element.querySelector('[data-calendar-day="'.concat(y(t),'"]'))}_render(){let t=this._document,e=t.createDocumentFragment(),i=t.createElement("div");i.className="moo-calendar__header";let s=t.createElement("button");s.className="btn btn-ghost btn-icon-sm moo-calendar__nav",s.type="button",s.dataset.calendarPrev="true",s.setAttribute("aria-label","Previous month"),s.appendChild(qt(t,"\u2039","moo-calendar__nav-icon"));let a=t.createElement("button");a.className="btn btn-ghost btn-icon-sm moo-calendar__nav",a.type="button",a.dataset.calendarNext="true",a.setAttribute("aria-label","Next month"),a.appendChild(qt(t,"\u203A","moo-calendar__nav-icon"));let n=t.createElement("div");if(n.className="moo-calendar__caption",n.id=this._captionId,n.setAttribute("aria-live","polite"),this._config.captionLayout==="dropdown"){let p=t.createElement("select");p.className="moo-calendar__select",p.dataset.calendarMonth="true",p.setAttribute("aria-label","Month");for(let u=0;u<12;u+=1){let d=t.createElement("option");d.value=String(u),d.textContent=ce(u,this._config.locale),d.selected=u===this._viewDate.getMonth(),p.appendChild(d)}let f=t.createElement("select");f.className="moo-calendar__select",f.dataset.calendarYear="true",f.setAttribute("aria-label","Year"),he(this._config.minDate,this._config.maxDate,this._viewDate).forEach(u=>{let d=t.createElement("option");d.value=String(u),d.textContent=String(u),d.selected=u===this._viewDate.getFullYear(),f.appendChild(d)}),n.append(p,f)}else n.textContent=It(this._viewDate,this._config.locale);i.append(s,n,a),e.appendChild(i);let o=t.createElement("div");o.id=this._labelId,o.className="visually-hidden",o.textContent=this._element.getAttribute("aria-label")||It(this._viewDate,this._config.locale),e.appendChild(o);let c=t.createElement("div");c.className="moo-calendar__weekdays",c.setAttribute("role","row"),se(this._config.locale).forEach(p=>{let f=t.createElement("span");f.className="moo-calendar__weekday",f.setAttribute("role","columnheader"),f.textContent=new Intl.DateTimeFormat(this._config.locale,{weekday:"narrow"}).format(p),c.appendChild(f)});let l=t.createElement("div");l.className="moo-calendar__grid",l.setAttribute("role","grid"),l.setAttribute("aria-labelledby",this._labelId),l.appendChild(c);let h=C(this._viewDate),_=ct(this._config.locale),m=x(h,-((h.getDay()-_+7)%7));for(let p=0;p<6;p+=1){let f=t.createElement("div");f.className="moo-calendar__week",f.setAttribute("role","row");for(let u=0;u<7;u+=1){let d=x(m,p*7+u),D=y(d),w=t.createElement("div");w.className="moo-calendar__cell",w.setAttribute("role","gridcell");let S=t.createElement("button");S.className="moo-calendar__day",S.type="button",S.dataset.calendarDay=D,S.textContent=String(d.getDate()),S.tabIndex=T(d,this._activeDate)?0:-1,S.setAttribute("aria-label",q(d,this._config.locale));let Et=this._isSelected(d);S.dataset.calendarSelected=String(Et),w.setAttribute("aria-selected",Et?"true":"false"),d.getMonth()!==this._viewDate.getMonth()&&(S.dataset.calendarOutside="true"),T(d,new Date)&&(S.dataset.calendarToday="true",S.setAttribute("aria-current","date"));let At=this._rangeState(d);At&&(S.dataset.calendarRange=At),this._isDisabled(d)&&(S.disabled=!0,S.setAttribute("aria-disabled","true")),w.appendChild(S),f.appendChild(w)}l.appendChild(f)}if(e.appendChild(l),this._config.showPresets){let p=t.createElement("div");p.className="moo-calendar__presets",[["today","Today"],["tomorrow","Tomorrow"],["in-3-days","In 3 days"],["in-a-week","In a week"],["in-2-weeks","In 2 weeks"]].forEach(([f,u])=>{let d=t.createElement("button");d.className="btn btn-outline-secondary btn-sm moo-calendar__preset",d.type="button",d.dataset.calendarPreset=f,d.textContent=u,p.appendChild(d)}),e.appendChild(p)}this._element.classList.add("moo-calendar"),this._element.dataset.calendar=this._element.dataset.calendar||"",this._element.dataset.calendarMode=this._mode,this._element.dataset.calendarActiveDate=y(this._activeDate),this._mode==="single"&&this._selectedDate?this._element.dataset.calendarValue=y(this._selectedDate):delete this._element.dataset.calendarValue,this._mode==="range"?(this._element.dataset.calendarStartValue=this._rangeStart?y(this._rangeStart):"",this._element.dataset.calendarEndValue=this._rangeEnd?y(this._rangeEnd):""):(delete this._element.dataset.calendarStartValue,delete this._element.dataset.calendarEndValue),this._element.replaceChildren(e)}},Y=class r{static getInstance(t){return t?.nodeType===1&&z.get(t)||null}static getOrCreateInstance(t,e={}){return r.getInstance(t)||new r(t,e)}constructor(t,e={}){if(!wt(t,"[data-datepicker]"))throw new TypeError("MooDatepicker requires a [data-datepicker] root element.");let i=z.get(t);if(i)return i;if(this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView||window,this._listeners=[],this._floatingListeners=[],this._disposed=!1,this._positionPopover=null,this._popoverPortal=null,this._trigger=t.querySelector("[data-datepicker-trigger]"),this._popover=t.querySelector("[data-datepicker-popover]"),this._label=t.querySelector("[data-datepicker-label]"),this._input=t.querySelector("[data-datepicker-input]")||t.querySelector('input[type="hidden"]'),this._validationInput=t.querySelector("[data-datepicker-validation]"),this._calendarRoot=t.querySelector("[data-calendar]"),!this._trigger||!this._popover||!this._label||!this._input||!this._calendarRoot)throw new TypeError("MooDatepicker requires a trigger, popover, calendar, and hidden input.");this._config=St(t,{...e,value:e.value||this._input.value||t.dataset.datepickerValue}),this._placeholder=this._config.placeholder,this._defaultValue=bt(this._input),this.calendar=L.getOrCreateInstance(this._calendarRoot,{...this._config,mode:"single",value:this._input.value||this._config.value}),z.set(t,this),this._syncFromCalendar(),this._bindEvents()}dispose(){this._disposed||(this._disposed=!0,P(this._listeners),this.hide(!1),ht(this),ut(this),P(this._floatingListeners),this.calendar?.dispose(),z.get(this._element)===this&&z.delete(this._element))}show(){this._trigger.disabled||this._element.dataset.datepickerDisabled==="true"||this.isOpen()||k(this._element,this._window,"show.moo.datepicker",{},!0)&&(this._popover.hidden=!1,this._popover.classList.add("show"),Vt(this),this._trigger.setAttribute("aria-expanded","true"),this.calendar.focusActiveDay(),k(this._element,this._window,"shown.moo.datepicker"))}hide(t=!0){this.isOpen()&&k(this._element,this._window,"hide.moo.datepicker",{},!0)&&(this._popover.hidden=!0,this._popover.classList.remove("show"),ht(this),this._trigger.setAttribute("aria-expanded","false"),t&&this._trigger.focus({preventScroll:!0}),k(this._element,this._window,"hidden.moo.datepicker"))}toggle(){this.isOpen()?this.hide():this.show()}isOpen(){return!this._popover.hidden}getDate(t=void 0){return this.calendar.getDate(t)}setDate(t,e={}){let i=this.calendar.setDate(t,{emit:!1});return i&&(this._syncFromCalendar(),e.emit!==!1&&this._emitChange()),i}clear(t={}){this.calendar.clear({emit:!1}),this._syncFromCalendar(),t.emit!==!1&&this._emitChange()}_bindEvents(){b(this._listeners,this._trigger,"click",()=>this.toggle()),b(this._listeners,this._popover,"keydown",e=>{e.key==="Escape"&&(e.preventDefault(),this.hide())}),b(this._listeners,this._document,"pointerdown",e=>{this.isOpen()&&!W(this,e.target)&&this._window.setTimeout(()=>{this.isOpen()&&!W(this,e.target)&&this.hide()},0)}),b(this._listeners,this._calendarRoot,"change.moo.calendar",e=>{this._syncFromCalendar(),this._emitChange(),e.detail.complete&&this.hide()});let t=this._input.form||this._element.closest("form");b(this._listeners,this._validationInput,"invalid",e=>{e.preventDefault(),vt(this._element,this._trigger,!0),this._trigger.focus({preventScroll:!0})}),b(this._listeners,t,"reset",()=>{this._window.setTimeout(()=>{this._defaultValue?this.setDate(this._defaultValue,{emit:!1}):this.clear({emit:!1})},0)})}_syncFromCalendar(){let t=this.calendar.getDate("yyyy-mm-dd")||"";yt(this._input,t),Lt(this._validationInput,t),Rt(this._element,this._trigger,this._validationInput),this._element.dataset.datepickerValue=t,this._label.dataset.datepickerEmpty=t?"false":"true",this._label.textContent=t?q(g(t),this._config.locale):this._placeholder}_emitChange(){k(this._element,this._window,"change.moo.datepicker",{date:this.getDate(),value:this.getDate("yyyy-mm-dd")||""})}},dt=class r{static getInstance(t){return t?.nodeType===1&&H.get(t)||null}static getOrCreateInstance(t,e={}){return r.getInstance(t)||new r(t,e)}constructor(t,e={}){if(!wt(t,"[data-datepicker-range]"))throw new TypeError("MooDateRangePicker requires a [data-datepicker-range] root element.");let i=H.get(t);if(i)return i;if(this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView||window,this._listeners=[],this._floatingListeners=[],this._disposed=!1,this._positionPopover=null,this._popoverPortal=null,this._trigger=t.querySelector("[data-datepicker-trigger]"),this._popover=t.querySelector("[data-datepicker-popover]"),this._label=t.querySelector("[data-datepicker-label]"),this._startInput=t.querySelector("[data-datepicker-range-start]"),this._endInput=t.querySelector("[data-datepicker-range-end]"),this._validationInput=t.querySelector("[data-datepicker-validation]"),this._calendarRoot=t.querySelector("[data-calendar]"),!this._trigger||!this._popover||!this._label||!this._startInput||!this._endInput||!this._calendarRoot)throw new TypeError("MooDateRangePicker requires a trigger, popover, calendar, and start/end hidden inputs.");this._config=St(t,{...e,mode:"range",startValue:e.startValue||this._startInput.value||t.dataset.datepickerStartValue,endValue:e.endValue||this._endInput.value||t.dataset.datepickerEndValue}),this._placeholder=this._config.placeholder,this._defaultStartValue=bt(this._startInput),this._defaultEndValue=bt(this._endInput),this.calendar=L.getOrCreateInstance(this._calendarRoot,this._config),H.set(t,this),this._syncFromCalendar(),this._bindEvents()}dispose(){this._disposed||(this._disposed=!0,P(this._listeners),this.hide(!1),ht(this),ut(this),P(this._floatingListeners),this.calendar?.dispose(),H.get(this._element)===this&&H.delete(this._element))}show(){this._trigger.disabled||this._element.dataset.datepickerDisabled==="true"||this.isOpen()||k(this._element,this._window,"show.moo.datepicker",{},!0)&&(this._popover.hidden=!1,this._popover.classList.add("show"),Vt(this),this._trigger.setAttribute("aria-expanded","true"),this.calendar.focusActiveDay(),k(this._element,this._window,"shown.moo.datepicker"))}hide(t=!0){this.isOpen()&&k(this._element,this._window,"hide.moo.datepicker",{},!0)&&(this._popover.hidden=!0,this._popover.classList.remove("show"),ht(this),this._trigger.setAttribute("aria-expanded","false"),t&&this._trigger.focus({preventScroll:!0}),k(this._element,this._window,"hidden.moo.datepicker"))}toggle(){this.isOpen()?this.hide():this.show()}isOpen(){return!this._popover.hidden}getDates(t=void 0){return this.calendar.getDates(t)}setDates(t,e,i={}){let s=this.calendar.setDates(t,e,{emit:!1});return s&&(this._syncFromCalendar(),i.emit!==!1&&this._emitChange()),s}clear(t={}){this.calendar.clear({emit:!1}),this._syncFromCalendar(),t.emit!==!1&&this._emitChange()}_bindEvents(){b(this._listeners,this._trigger,"click",()=>this.toggle()),b(this._listeners,this._popover,"keydown",i=>{i.key==="Escape"&&(i.preventDefault(),this.hide())}),b(this._listeners,this._document,"pointerdown",i=>{this.isOpen()&&!W(this,i.target)&&this._window.setTimeout(()=>{this.isOpen()&&!W(this,i.target)&&this.hide()},0)});let t=()=>{this._window.setTimeout(()=>{this.isOpen()&&!W(this,this._document.activeElement)&&this.hide(!1)},0)};b(this._listeners,this._element,"focusout",t),b(this._listeners,this._popover,"focusout",t),b(this._listeners,this._calendarRoot,"change.moo.calendar",i=>{this._syncFromCalendar(),this._emitChange(),i.detail.complete?this.hide():this.calendar.focusActiveDay()});let e=this._startInput.form||this._element.closest("form");b(this._listeners,this._validationInput,"invalid",i=>{i.preventDefault(),vt(this._element,this._trigger,!0),this._trigger.focus({preventScroll:!0})}),b(this._listeners,e,"reset",()=>{this._window.setTimeout(()=>{this.setDates(this._defaultStartValue,this._defaultEndValue,{emit:!1})},0)})}_syncFromCalendar(){let[t="",e=""]=this.calendar.getDates("yyyy-mm-dd");yt(this._startInput,t||""),yt(this._endInput,e||""),Lt(this._validationInput,t&&e?"".concat(t," - ").concat(e):""),Rt(this._element,this._trigger,this._validationInput),this._element.dataset.datepickerStartValue=t||"",this._element.dataset.datepickerEndValue=e||"",this._label.dataset.datepickerEmpty=t?"false":"true",t&&e?this._label.textContent="".concat(q(g(t),this._config.locale)," - ").concat(q(g(e),this._config.locale)):t?this._label.textContent=q(g(t),this._config.locale):this._label.textContent=this._placeholder}_emitChange(){let[t,e]=this.getDates(),[i="",s=""]=this.getDates("yyyy-mm-dd");k(this._element,this._window,"change.moo.datepicker",{startDate:t,endDate:e,startValue:i,endValue:s})}};var _t=new WeakMap,de="a[href], button, input, select, textarea, [tabindex]";function Nt(r){let t=r.ownerDocument.defaultView;return[...r.querySelectorAll(de)].filter(e=>!e.matches(":disabled")&&e.tabIndex>=0&&!e.closest("[hidden], [inert]")&&e.getClientRects().length>0&&t.getComputedStyle(e).visibility==="visible")}var U=class r{static getInstance(t){return t?.nodeType===1&&_t.get(t)||null}static getOrCreateInstance(t,e={}){return r.getInstance(t)||new r(t,e)}constructor(t,e={}){if(t?.nodeType!==1||!t.matches('[data-slot="sidebar-wrapper"]'))throw new TypeError("Sidebar requires a [data-slot=sidebar-wrapper] root.");let i=_t.get(t);if(i)return i;this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView,this._documentElement=this._document.documentElement,this._root=E(t)||this._document.body||this._documentElement,this._sidebar=t.querySelector('[data-slot="sidebar"]'),this._config={breakpoint:"(min-width: 992px)",storagePrefix:"moo-sidebar:",keyboard:!0,...e},this._listeners=[],this._tooltipAnchors=new Set,this._flyout=null,this._flyoutOwner=null,this._offcanvas=null,this._offcanvasTrigger=null,_t.set(t,this),this._bindEvents(),this._restoreState(),this._scrollActiveItemIntoView(),this._element.setAttribute("data-sidebar-ready",""),this._observeDirection()}dispose(){this._listeners.forEach(({target:t,type:e,handler:i,options:s})=>{t.removeEventListener(e,i,s)}),this._listeners=[],this._directionObserver?.disconnect(),this._closeFlyouts(),this._element.querySelectorAll("[data-sidebar-dropdown-positioned]").forEach(t=>this._clearDropdownPosition(t)),this._element.querySelectorAll("[data-sidebar-tooltip]").forEach(t=>this._disposeTooltip(t)),this._offcanvas?.dispose(),this._offcanvas=null,this._offcanvasTrigger=null,this._element.removeAttribute("data-sidebar-ready"),_t.delete(this._element)}_listen(t,e,i,s){t?.addEventListener(e,i,s),t&&this._listeners.push({target:t,type:e,handler:i,options:s})}_bootstrap(t){return this._window.bootstrap?.[t]||null}_portalRoot(t=this._element){return F(E(t))||this._document.body||this._documentElement}_isDesktop(){return this._window.matchMedia(this._config.breakpoint).matches}_isCollapsed(){return this._isDesktop()&&this._sidebar?.dataset?.collapsible==="icon"&&this._element.dataset.sidebarState==="collapsed"}_trigger(t,e={}){return this._element.dispatchEvent(new this._window.CustomEvent("".concat(t,".moo.sidebar"),{bubbles:!0,cancelable:t==="show"||t==="hide",detail:e}))}_observeDirection(){let t=this._window.MutationObserver;t&&(this._directionObserver=new t(()=>{this._closeFlyouts(),this._syncTooltips()}),this._directionObserver.observe(this._documentElement,{attributes:!0,attributeFilter:["dir"]}))}_restoreState(){let t=this._element.dataset.sidebarKey,e=null;if(t)try{e=this._window.localStorage.getItem(this._config.storagePrefix+t)}catch{e=null}let i=e==="collapsed"||e==="expanded"?e:this._element.dataset.sidebarState==="collapsed"?"collapsed":"expanded";this._setState(i,!1,!1)}_scrollActiveItemIntoView(){let e=this._element.querySelector('[data-slot="sidebar-content"] a[data-slot="sidebar-menu-button"][aria-current="page"], [data-slot="sidebar-content"] a.sidebar-menu-button[aria-current="page"], [data-slot="sidebar-content"] a.sidebar-menu-button.active')||this._element.querySelector('[data-slot="sidebar-content"] [data-slot="sidebar-menu-button"][aria-current="page"], [data-slot="sidebar-content"] .sidebar-menu-button[aria-current="page"], [data-slot="sidebar-content"] .sidebar-menu-button.active'),i=e?.closest?.('[data-slot="sidebar-content"]');if(!e||!i||i.clientHeight<=0)return;let s=i.scrollHeight-i.clientHeight;if(s<=0)return;let a=i.getBoundingClientRect(),n=e.getBoundingClientRect();if(a.height<=0||n.height<=0)return;let o=i.scrollTop+n.top-a.top-(i.clientHeight-n.height)/2;i.scrollTop=Math.round(Math.min(Math.max(o,0),s))}_setState(t,e=!0,i=!0){let s=t==="collapsed"?"collapsed":"expanded",a=this._element.dataset.sidebarState;this._element.dataset.sidebarState=s;let n=this._element.dataset.sidebarKey;if(n==="catalog-shell"&&(this._root.dataset.sidebarCatalogState=s),e&&n)try{this._window.localStorage.setItem(this._config.storagePrefix+n,s)}catch{}this._syncControls(),s==="expanded"&&this._element.querySelectorAll(".sidebar-menu-item").forEach(o=>this._resetFlyoutTrigger(o)),this._syncTooltips(),i&&a!==s&&this._trigger("change",{state:s,previousState:a||null})}_toggle(){this._setState(this._element.dataset.sidebarState==="collapsed"?"expanded":"collapsed")}_syncControls(){let t=this._isDesktop()?this._element.dataset.sidebarState==="expanded":this._sidebar?.classList.contains("show")||!1;this._element.querySelectorAll("[data-sidebar-trigger], [data-sidebar-rail]").forEach(e=>e.setAttribute("aria-expanded",String(t)))}_resetFlyoutTrigger(t,e=null){let i=t?.querySelector(":scope > .sidebar-menu-sub-trigger"),s=t?.querySelector(":scope > .sidebar-menu-sub");i&&s&&i.setAttribute("aria-expanded",String(e??s.classList.contains("show")))}_clearDropdownPosition(t){let e=t?.matches?.(".sidebar-menu-item")?t:t?.closest?.(".sidebar-menu-item");e&&(delete e.dataset.sidebarDropdownPositioned,e.style.removeProperty("--moo-sidebar-dropdown-block-start"),e.style.removeProperty("--moo-sidebar-dropdown-block-end"),e.style.removeProperty("--moo-sidebar-dropdown-left"),e.style.removeProperty("--moo-sidebar-dropdown-right"))}_closeDropdowns(t=null){let e=this._bootstrap("Dropdown");this._element.querySelectorAll('[data-bs-toggle="dropdown"][aria-expanded="true"]').forEach(i=>{i!==t&&(e?e.getOrCreateInstance(i).hide():(i.setAttribute("aria-expanded","false"),i.closest(".dropdown")?.querySelector(".dropdown-menu.show")?.classList.remove("show"),this._clearDropdownPosition(i)))})}_positionDropdown(t){let e=t?.closest?.(".sidebar-menu-item"),i=t?.classList.contains("sidebar-menu-button--workspace")&&t.closest('[data-slot="sidebar-header"]'),s=t?.closest(".sidebar-menu-item--account")&&t.closest('[data-slot="sidebar-footer"]');if(!t||!e||!(i||s)||!this._isDesktop()){this._clearDropdownPosition(t);return}this._closeFlyouts();let a=t.getBoundingClientRect(),n=4;if((t.closest('[data-slot="sidebar"]')?.dataset.side||"left")==="right"){let l=this._window.innerWidth-a.left+n;e.style.setProperty("--moo-sidebar-dropdown-right","".concat(Math.round(l),"px")),e.style.removeProperty("--moo-sidebar-dropdown-left")}else{let l=a.right+n;e.style.setProperty("--moo-sidebar-dropdown-left","".concat(Math.round(l),"px")),e.style.removeProperty("--moo-sidebar-dropdown-right")}i?(e.style.setProperty("--moo-sidebar-dropdown-block-start","".concat(Math.round(a.bottom+n),"px")),e.style.removeProperty("--moo-sidebar-dropdown-block-end")):(e.style.setProperty("--moo-sidebar-dropdown-block-end","".concat(Math.round(this._window.innerHeight-a.top+n),"px")),e.style.removeProperty("--moo-sidebar-dropdown-block-start")),e.dataset.sidebarDropdownPositioned=""}_removeFlyoutPortal(){this._flyout?.remove(),this._flyoutOwner&&this._resetFlyoutTrigger(this._flyoutOwner,!1),this._flyout=null,this._flyoutOwner=null}_closeFlyouts(){this._removeFlyoutPortal(),this._element.querySelectorAll(".sidebar-menu-item--flyout-open").forEach(t=>{t.classList.remove("sidebar-menu-item--flyout-open"),t.style.removeProperty("--moo-sidebar-flyout-block-start"),t.style.removeProperty("--moo-sidebar-flyout-left"),this._resetFlyoutTrigger(t,!1)})}_openFlyout(t){let e=t?.querySelector(":scope > .sidebar-menu-sub"),i=t?.querySelector(":scope > .sidebar-menu-sub-trigger");if(!t||!e||!this._isCollapsed()||this._flyoutOwner===t&&this._flyout)return;this._closeDropdowns(),this._closeFlyouts();let s=t.getBoundingClientRect(),a=this._sidebar,n=a?.getBoundingClientRect()||s,o=4,c=e.cloneNode(!0);c.removeAttribute("id"),c.classList.remove("collapse","show","collapsing"),c.classList.add("sidebar-menu-flyout"),c.dataset.sidebarFlyout="",c.removeAttribute("style"),c.style.setProperty("--moo-sidebar-flyout-block-start","".concat(Math.round(s.top),"px"));let l=a?.dataset.side||"left";this._portalRoot(t).appendChild(c);let h=c.getBoundingClientRect().width,_=l==="right"?n.left-h-o:n.right+o,m=Math.max(0,Math.min(this._window.innerWidth-h,_));c.style.setProperty("--moo-sidebar-flyout-left","".concat(Math.round(m),"px")),this._flyout=c,this._flyoutOwner=t,t.classList.add("sidebar-menu-item--flyout-open"),i?.setAttribute("aria-expanded","true")}_tooltipAnchor(t){return t.closest("li")||t}_isIdentityTrigger(t){return t.closest(".sidebar-menu-item--account")||t.classList.contains("sidebar-menu-button--workspace")}_disposeTooltip(t){let e=this._bootstrap("Tooltip");if(!e||!t)return;let i=this._tooltipAnchor(t);e.getInstance(i)?.dispose(),this._tooltipAnchors.delete(i),i.removeAttribute("title"),i.removeAttribute("data-bs-title"),i.removeAttribute("data-bs-original-title"),i.removeAttribute("aria-describedby")}_syncTooltips(){let t=this._bootstrap("Tooltip");if(!t)return;let e=this._isCollapsed(),s=(this._sidebar?.dataset.side||"left")==="right"?"left":"right";this._element.querySelectorAll("[data-sidebar-tooltip]").forEach(a=>{if(this._disposeTooltip(a),!e||this._isIdentityTrigger(a)||a.closest(".sidebar-menu-item")?.querySelector(":scope > .sidebar-menu-sub"))return;let n=this._tooltipAnchor(a);new t(n,{title:a.getAttribute("data-sidebar-tooltip"),placement:s,offset:[0,8],container:this._portalRoot(a),trigger:"hover focus"}),this._tooltipAnchors.add(n)})}_bindEvents(){this._listen(this._sidebar,"shown.bs.offcanvas",()=>this._syncControls()),this._listen(this._sidebar,"hidden.bs.offcanvas",()=>{this._syncControls();let t=this._offcanvasTrigger;this._offcanvasTrigger=null,t?.isConnected&&t.focus()}),this._listen(this._document,"show.bs.dropdown",t=>{let e=this._dropdownControl(t.target);e&&(this._closeDropdowns(e),this._disposeTooltip(e),this._positionDropdown(e))}),this._listen(this._document,"hidden.bs.dropdown",t=>{let e=this._dropdownControl(t.target);e&&(this._clearDropdownPosition(e),this._syncTooltips())}),this._listen(this._element,"click",t=>this._handleControlClick(t)),this._listen(this._window,"click",t=>this._handleSubmenuClick(t),!0),this._listen(this._document,"click",t=>this._handleOutsideFlyoutClick(t)),this._listen(this._document,"keydown",t=>this._handleShortcut(t)),this._listen(this._window,"resize",()=>{this._closeFlyouts(),this._element.querySelectorAll("[data-sidebar-dropdown-positioned]").forEach(t=>this._clearDropdownPosition(t)),this._syncControls(),this._syncTooltips()})}_dropdownControl(t){return!(t instanceof this._window.Element)||!this._element.contains(t)?null:t.matches('[data-bs-toggle="dropdown"][data-sidebar-tooltip]')?t:t.querySelector?.('[data-bs-toggle="dropdown"][data-sidebar-tooltip]')||null}_handleControlClick(t){let e=t.target,i=e instanceof this._window.Element?e.closest("[data-sidebar-trigger], [data-sidebar-rail]"):null;if(!i||!this._element.contains(i))return;if(this._isDesktop()){t.preventDefault(),this._closeFlyouts(),this._toggle();return}if(!i.matches("[data-sidebar-trigger]"))return;let s=this._document.getElementById(i.getAttribute("aria-controls")),a=this._bootstrap("Offcanvas");s&&a&&(this._offcanvasTrigger=i,this._offcanvas=a.getOrCreateInstance(s),this._offcanvas.toggle())}_handleSubmenuClick(t){let e=t.target,i=e instanceof this._window.Element?e.closest(".sidebar-menu-sub-trigger"):null,s=i?.closest(".sidebar-menu-item");!i||!s||!this._element.contains(s)||!this._isCollapsed()||(t.preventDefault(),t.stopImmediatePropagation(),this._flyoutOwner===s&&this._flyout?this._closeFlyouts():(this._openFlyout(s),t.detail===0&&this._flyout&&Nt(this._flyout)[0]?.focus()))}_handleFlyoutKeydown(t){let e=this._flyoutOwner;if(t.defaultPrevented||!this._flyout||!e||!(t.key==="Escape"||t.key==="Tab")||!this._flyout.contains(t.target)&&!(t.key==="Escape"&&e.contains(t.target)))return!1;if(t.key==="Tab"){let a=Nt(this._flyout),n=t.shiftKey?a[0]:a[a.length-1];if(n&&t.target!==n)return!1}t.preventDefault();let s=e.querySelector(":scope > .sidebar-menu-sub-trigger");return this._closeFlyouts(),s?.focus(),!0}_handleOutsideFlyoutClick(t){this._flyout&&(this._flyout.contains(t.target)?this._closeFlyouts():this._flyoutOwner?.contains(t.target)||this._closeFlyouts())}_handleShortcut(t){if(this._handleFlyoutKeydown(t))return;let e=t.target,i=e instanceof this._window.Element&&(e.matches("input, textarea, select")||e.isContentEditable);t.defaultPrevented||t.isComposing||i||!this._config.keyboard||!(t.metaKey||t.ctrlKey)||t.key.toLowerCase()!=="b"||!this._isDesktop()||(this._document.querySelector('[data-slot="sidebar-wrapper"][data-sidebar-key]')||this._document.querySelector('[data-slot="sidebar-wrapper"]'))!==this._element||(t.preventDefault(),this._closeFlyouts(),this._toggle())}};var G=new WeakMap;function J(r,t){let e=Number(r);return Number.isFinite(e)?e:t}function V(r){return J(r.min,0)}function X(r){return J(r.max,100)}function ue(r){if(!r.step||r.step==="any")return 1;let t=Number(r.step);return Number.isFinite(t)&&t>0?t:1}function R(r,t,e){return Math.min(Math.max(r,t),e)}function Bt(r){let t=String(r);return t.includes(".")?t.split(".").at(-1).length:0}function _e(r,t){let e=V(t),i=X(t);if(t.step==="any")return Number(R(r,e,i).toFixed(4));let s=ue(t),a=e+Math.round((r-e)/s)*s,n=Math.max(Bt(s),Bt(e));return R(Number(a.toFixed(n)),e,i)}function j(r){let t=V(r),e=X(r);return e<=t?0:(J(r.value,t)-t)/(e-t)*100}function pt(r){return r.value||String(V(r))}var Q=class r{static getInstance(t){return t?.nodeType===1&&G.get(t)||null}static getOrCreateInstance(t,e={}){return r.getInstance(t)||new r(t,e)}constructor(t,e={}){if(t?.nodeType!==1||!t.matches("[data-slider]"))throw new TypeError("MooSlider requires a [data-slider] root element.");let i=G.get(t);if(i)return i;if(this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView,this._config={...e},this._listeners=[],this._dragListeners=[],this._draggingInput=null,this._disposed=!1,this._inputs=Array.from(t.querySelectorAll(':scope input[type="range"][data-slider-input]')),this._track=t.querySelector("[data-slider-track]"),this._output=t.querySelector("[data-slider-output]"),this._inputs.length<1||this._inputs.length>2)throw new TypeError("MooSlider requires one or two native range inputs.");if(!this._track)throw new TypeError("MooSlider requires a [data-slider-track] element.");G.set(t,this),this._bindEvents(),this._sync()}dispose(){this._disposed||(this._disposed=!0,this._clearDragListeners(),this._clearPointerFocus(),this._listeners.forEach(({target:t,type:e,handler:i,options:s})=>{t.removeEventListener(e,i,s)}),this._listeners=[],G.get(this._element)===this&&G.delete(this._element))}_listen(t,e,i,s){t&&(t.addEventListener(e,i,s),this._listeners.push({target:t,type:e,handler:i,options:s}))}_listenDuringDrag(t,e,i,s){t&&(t.addEventListener(e,i,s),this._dragListeners.push({target:t,type:e,handler:i,options:s}))}_clearDragListeners(){this._dragListeners.forEach(({target:t,type:e,handler:i,options:s})=>{t.removeEventListener(e,i,s)}),this._dragListeners=[],this._draggingInput=null,this._element.removeAttribute("data-slider-dragging")}_bindEvents(){this._inputs.forEach(e=>{this._listen(e,"input",()=>this._sync(e)),this._listen(e,"change",()=>{this._sync(e),this._trigger("change")}),this._listen(e,"keydown",()=>this._clearPointerFocus()),this._listen(e,"focusout",()=>this._clearPointerFocus())}),new Set(this._inputs.map(e=>e.form||e.closest?.("form")).filter(Boolean)).forEach(e=>{this._listen(e,"reset",()=>{this._window.setTimeout(()=>this._sync(),0)})}),this._listen(this._track,"pointerdown",e=>this._handleTrackPointer(e))}_trigger(t){this._element.dispatchEvent(new this._window.CustomEvent("".concat(t,".moo.slider"),{bubbles:!0}))}_isRange(){return this._inputs.length===2}_sync(t=null){if(this._isRange()){let[i,s]=this._inputs,a=J(i.value,V(i)),n=J(s.value,X(s));a>n&&(t===s?s.value=i.value:i.value=s.value),this._writeFill(j(i),j(s)),this._writeOutput("".concat(pt(i)," - ").concat(pt(s))),this._syncAria(i),this._syncAria(s);return}let e=this._inputs[0];this._writeFill(0,j(e)),this._writeOutput(pt(e)),this._syncAria(e)}_syncAria(t){t.setAttribute("aria-valuemin",String(V(t))),t.setAttribute("aria-valuemax",String(X(t))),t.setAttribute("aria-valuenow",pt(t))}_writeFill(t,e){let i=R(t,0,100),s=R(e,0,100);this._element.style.setProperty("--moo-slider-start","".concat(Math.min(i,s),"%")),this._element.style.setProperty("--moo-slider-end","".concat(Math.max(i,s),"%"))}_writeOutput(t){this._output&&(this._output.textContent=t)}_handleTrackPointer(t){if(t.button!==void 0&&t.button!==0)return;let e=this._inputs.filter(a=>!a.disabled);if(!e.length)return;t.preventDefault?.();let i=this._pointerPercent(t),s=this._nearestInput(i*100,e);this._setPointerFocus(),this._startDrag(s,t),this._setInputFromPointer(s,t)}_setPointerFocus(){this._element.setAttribute("data-slider-pointer-focus","true")}_clearPointerFocus(){this._element.removeAttribute("data-slider-pointer-focus")}_startDrag(t,e){this._clearDragListeners(),this._draggingInput=t,this._element.setAttribute("data-slider-dragging","true"),this._track.setPointerCapture?.(e.pointerId);let i=e.pointerId,s=o=>i===void 0||o.pointerId===i,a=o=>{!s(o)||this._draggingInput!==t||(o.preventDefault?.(),this._setInputFromPointer(t,o))},n=o=>{!s(o)||this._draggingInput!==t||(o.preventDefault?.(),this._setInputFromPointer(t,o,!1),t.dispatchEvent(new this._window.Event("change",{bubbles:!0})),this._track.releasePointerCapture?.(i),this._clearDragListeners())};this._listenDuringDrag(this._document,"pointermove",a),this._listenDuringDrag(this._document,"pointerup",n),this._listenDuringDrag(this._document,"pointercancel",n)}_setInputFromPointer(t,e,i=!0){let s=this._pointerPercent(e),a=V(t),n=X(t);t.value=String(_e(a+s*(n-a),t)),t.focus({preventScroll:!0}),this._sync(t),i&&t.dispatchEvent(new this._window.Event("input",{bubbles:!0}))}_pointerPercent(t){let e=this._track.getBoundingClientRect();return(this._element.dataset.sliderOrientation||"horizontal")==="vertical"?R((e.bottom-t.clientY)/(e.height||1),0,1):this._horizontalPointerPercent(t,e)}_horizontalPointerPercent(t,e){let s=this._window.getComputedStyle?.(this._element).direction==="rtl"?e.right-t.clientX:t.clientX-e.left;return R(s/(e.width||1),0,1)}_nearestInput(t,e){if(e.length===1)return e[0];let[i,s]=e,a=j(i),n=j(s),o=Math.abs(a-t),c=Math.abs(n-t);return o===c?t>=a?s:i:c<o?s:i}};var Z=new WeakMap,Dt='.moo-ui[data-bs-theme="light"], .moo-ui[data-bs-theme="dark"]';function $t(r,t=0){if(!r||typeof r!="object"||Array.isArray(r))throw new TypeError("TableOfContents options must be an object.");let e=r.activationOffset===void 0?t:r.activationOffset;if(typeof e!="number"||!Number.isFinite(e)||e<0)throw new TypeError("TableOfContents activationOffset must be a finite nonnegative number.");return e}function zt(r){if(!r?.startsWith("#")||r.length===1)return null;try{return decodeURIComponent(r.slice(1))}catch{return null}}var tt=class r{static getInstance(t){return t?.nodeType===1&&Z.get(t)||null}static getOrCreateInstance(t,e={}){return r.getInstance(t)||new r(t,e)}constructor(t,e={}){if(t?.nodeType!==1||!t.matches("[data-toc]"))throw new TypeError("TableOfContents requires a [data-toc] root element.");let i=Z.get(t);if(i)return i;this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView,this._offset=$t(e),this._listeners=[],this._originalLinks=new Map,this._originalStatus=new Map,this._originalMarker={attribute:t.getAttribute("data-toc-marker"),properties:["--moo-toc-marker-offset","--moo-toc-marker-height"].map(s=>({name:s,value:t.style.getPropertyValue(s),priority:t.style.getPropertyPriority(s)}))},this._links=[],this._targets=[],this._frame=0,this._disposed=!1,Z.set(t,this),this.refresh()}refresh(t={}){if(this._disposed)return this;let e=$t(t,this._offset);this._clearListeners(),this._offset=e;let i=this._element.closest(Dt),s=this._element.getAttribute("data-toc-content"),a=s?this._document.getElementById(s):i,n=this._element.getAttribute("data-toc-scroll-root");if(this._scrollElement=n?this._document.getElementById(n):null,this._status=Array.from(this._element.querySelectorAll("[data-toc-current]")).find(l=>l.closest("[data-toc]")===this._element)||null,this._status&&!this._originalStatus.has(this._status)&&this._originalStatus.set(this._status,this._status.textContent),this._overview=this._status?this._originalStatus.get(this._status):"",this._links=Array.from(this._element.querySelectorAll('a[href^="#"]')).filter(l=>l.closest("[data-toc]")===this._element).map(l=>({link:l,id:zt(l.getAttribute("href"))})),this._links.forEach(({link:l})=>{this._originalLinks.has(l)||this._originalLinks.set(l,{active:l.classList.contains("active"),current:l.getAttribute("aria-current")})}),this._targets=[],this._activate(null),!i||!a||a.closest(Dt)!==i||n&&(!this._scrollElement||!this._scrollElement.contains(a)))return this;let o=new Set;if(this._links.forEach(({id:l,link:h})=>{let _=l?this._document.getElementById(l):null;!_||o.has(l)||!a.contains(_)||_.closest(Dt)!==i||(o.add(l),this._targets.push({id:l,target:_,label:h.textContent.trim()}))}),!this._targets.length)return this;let c=()=>this._requestUpdate();return this._listen(this._scrollElement||this._window,"scroll",c,{passive:!0}),this._listen(this._window,"resize",c),this._listen(this._window,"hashchange",c),this._listen(this._element,"click",c),this._update(),this}dispose(){if(this._disposed)return;this._disposed=!0,this._clearListeners(),this._originalLinks.forEach(({active:i,current:s},a)=>{a.classList.toggle("active",i),s===null?a.removeAttribute("aria-current"):a.setAttribute("aria-current",s)}),this._originalStatus.forEach((i,s)=>{s.textContent=i});let{attribute:t,properties:e}=this._originalMarker;t===null?this._element.removeAttribute("data-toc-marker"):this._element.setAttribute("data-toc-marker",t),e.forEach(({name:i,value:s,priority:a})=>{s?this._element.style.setProperty(i,s,a):this._element.style.removeProperty(i)}),this._originalLinks.clear(),this._originalStatus.clear(),this._targets=[],this._links=[],Z.get(this._element)===this&&Z.delete(this._element)}_listen(t,e,i,s){t.addEventListener(e,i,s),this._listeners.push({target:t,type:e,handler:i,options:s})}_clearListeners(){this._listeners.forEach(({target:t,type:e,handler:i,options:s})=>t.removeEventListener(e,i,s)),this._listeners=[],this._frame&&this._window.cancelAnimationFrame(this._frame),this._frame=0}_requestUpdate(){this._disposed||this._frame||(this._frame=this._window.requestAnimationFrame(()=>{this._frame=0,this._update()}))}_update(){if(this._disposed)return;let t=this._targets.filter(({target:n})=>n.isConnected&&n.getClientRects().length>0),e=this._scrollElement||this._document.scrollingElement,i=(this._scrollElement?this._scrollElement.getBoundingClientRect().top+this._scrollElement.clientTop:0)+this._offset,s=null;t.forEach(n=>{n.target.getBoundingClientRect().top<=i+1&&(s=n)});let a=e&&e.scrollHeight>e.clientHeight+1;if(!a){let n=zt(this._window.location.hash);s=t.find(({id:o})=>o===n)||s}t.length&&a&&e.scrollTop+e.clientHeight>=e.scrollHeight-1&&(s=t[t.length-1]),this._activate(s)}_activate(t){let e=null;this._links.forEach(({link:i,id:s})=>{let a=t!==null&&s===t.id;i.classList.toggle("active",a),a?(i.setAttribute("aria-current","location"),e||(e=i)):i.removeAttribute("aria-current")}),this._status&&(this._status.textContent=t?t.label:this._overview),this._updateMarker(e)}_updateMarker(t){let e=this._element.querySelector(":scope > .nav"),i=t?.querySelector("span");if(!e?.contains(t)||!i?.offsetHeight||!this._element.getClientRects().length){this._element.removeAttribute("data-toc-marker");return}this._element.style.setProperty("--moo-toc-marker-offset","".concat(t.offsetTop+i.offsetTop,"px")),this._element.style.setProperty("--moo-toc-marker-height","".concat(i.offsetHeight,"px")),this._element.setAttribute("data-toc-marker","")}};var et=new WeakMap,pe=0,it=class r{static getInstance(t,e=t?.ownerDocument?.scrollingElement){let i=e&&et.get(e);return i?._owner===t?i:null}static getOrCreateInstance(t,e={}){return r.getInstance(t,e.scrollElement)||new r(t,e)}constructor(t,{scrollElement:e=null,hideDelay:i=900,label:s="Page scroll position"}={}){if(!t?.matches?.('.moo-ui[data-bs-theme="light"], .moo-ui[data-bs-theme="dark"]')||!t.isConnected)throw new TypeError("OverlayScrollbar requires a connected, resolved .moo-ui theme owner.");if(!Number.isFinite(i)||i<0||typeof s!="string"||!s.trim())throw new TypeError("OverlayScrollbar requires a nonnegative hideDelay and a nonempty label.");let a=t.ownerDocument,n=e??a.scrollingElement,o=n===a.scrollingElement;if(n?.nodeType!==1||!n.isConnected||n.ownerDocument!==a||!o&&(!t.contains(n)||n.closest('.moo-ui[data-bs-theme="light"], .moo-ui[data-bs-theme="dark"]')!==t))throw new TypeError("OverlayScrollbar scrollElement must belong to the same resolved theme owner.");let c=et.get(n);if(c){if(c._owner===t)return c;throw new Error("Only one OverlayScrollbar theme owner may control a scroll element.")}if(this._owner=t,this._document=a,this._window=a.defaultView,this._root=n,this._isDocument=o,o&&n!==a.documentElement)throw new TypeError("OverlayScrollbar requires a standards-mode document scroll root.");if(this._hideDelay=i,this._listeners=[],this._frame=0,this._timer=0,this._disposed=!1,this._originalNativeClass=o&&typeof t.__mooNativeScrollbarBaseline=="boolean"?t.__mooNativeScrollbarBaseline:this._root.classList.contains("scrollbar-overlay-native"),this._originalId=this._root.getAttribute("id"),this._forcedColors=this._window.matchMedia("(forced-colors: active)"),this._bar=a.createElement("div"),this._bar.className="scrollbar-overlay",this._bar.tabIndex=0,this._bar.setAttribute("role","scrollbar"),this._bar.setAttribute("aria-label",s),this._bar.setAttribute("aria-orientation","vertical"),this._bar.setAttribute("aria-valuemin","0"),this._thumb=a.createElement("div"),this._thumb.className="scrollbar-overlay-thumb",this._thumb.setAttribute("aria-hidden","true"),this._bar.append(this._thumb),t.append(this._bar),this._window.getComputedStyle(this._bar).position!=="fixed")throw this._bar.remove(),new Error("OverlayScrollbar requires the Moo UI overlay scrollbar stylesheet.");if(!this._originalId){do this._generatedId="scrollbar-overlay-page-".concat(++pe);while(a.getElementById(this._generatedId));this._root.id=this._generatedId}this._bar.setAttribute("aria-controls",this._root.id),et.set(n,this);try{this._listen(o?this._window:n,"scroll",()=>{this._reveal(),this._queue()},{passive:!0}),o||this._listen(a,"scroll",()=>this._queue(),{passive:!0,capture:!0}),this._listen(this._window,"resize",()=>this._queue()),this._listen(a,"pointermove",l=>this._onPointerMove(l),{passive:!0}),this._listen(a,"pointerout",l=>{l.pointerType==="mouse"&&!l.relatedTarget&&(this._nearEdge=!1,this._drag||delete this._bar.dataset.scrollbarInteractive,this._hideLater())}),this._listen(this._bar,"pointerdown",l=>this._onPointerDown(l)),this._listen(this._bar,"pointerup",()=>this._finishDrag()),this._listen(this._bar,"pointercancel",()=>this._finishDrag()),this._listen(this._bar,"lostpointercapture",()=>this._finishDrag()),this._listen(this._bar,"focus",()=>this._reveal()),this._listen(this._bar,"blur",()=>this._hideLater()),this._listen(this._bar,"keydown",l=>this._onKeyDown(l)),this._listen(this._forcedColors,"change",()=>this.refresh()),this._listen(this._window,"beforeprint",()=>{this._printing=!0,this.refresh()}),this._listen(this._window,"afterprint",()=>{this._printing=!1,this.refresh()}),this._resize=new this._window.ResizeObserver(()=>this._queue()),this._resize.observe(this._root),this._resize.observe(a.body),this._mutations=new this._window.MutationObserver(()=>this._queue()),this._mutations.observe(this._root,{attributes:!0,attributeFilter:["class","style","dir"]}),o||this._mutations.observe(a.documentElement,{attributes:!0,attributeFilter:["class","style","dir"]}),this._mutations.observe(a.body,{attributes:!0,attributeFilter:["class","style"]}),this._mutations.observe(t,{attributes:!0,attributeFilter:["class","style","dir","data-bs-theme"]}),this._contentMutations=new this._window.MutationObserver(l=>{l.some(h=>h.target!==this._bar&&!this._bar.contains(h.target))&&this._queue()}),this._contentMutations.observe(o?a.body:n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden"]}),this._listen(n,"load",()=>this._queue(),{capture:!0}),a.fonts&&this._listen(a.fonts,"loadingdone",()=>this._queue()),this.refresh()}catch(l){throw this.dispose(),l}}refresh(){if(this._disposed)return this;let t=this._window,e=this._root,i=!this._forcedColors.matches&&!this._printing;i&&e.classList.add("scrollbar-overlay-native");let s=i&&e.scrollWidth<=e.clientWidth+1;e.classList.toggle("scrollbar-overlay-native",this._originalNativeClass||s),this._mutations?.takeRecords(),this._contentMutations?.takeRecords();let a=(this._isDocument?[e,this._document.body]:[e]).some(_=>["hidden","clip"].includes(t.getComputedStyle(_).overflowY));this._maximum=Math.max(0,e.scrollHeight-e.clientHeight);let n=this._position();if(this._bar.hidden=!s||a||!n||this._maximum<=0,this._bar.hidden)return this._document.activeElement===this._bar&&this._bar.blur(),delete this._bar.dataset.scrollbarVisible,delete this._bar.dataset.scrollbarInteractive,this;let o=this._bar.clientWidth,c=this._bar.clientHeight,l=Math.min(c,Math.max(o,c*e.clientHeight/e.scrollHeight));this._travel=Math.max(0,c-l);let h=Math.min(this._maximum,Math.max(0,e.scrollTop));return this._thumb.style.height="".concat(l,"px"),this._thumb.style.transform="translateY(".concat(this._travel*h/this._maximum,"px)"),this._bar.setAttribute("aria-valuemax",String(Math.round(this._maximum))),this._bar.setAttribute("aria-valuenow",String(Math.round(h))),this}_position(){if(this._isDocument)return!0;let t=this._root,e=t.getBoundingClientRect(),i=Math.max(0,e.top+t.clientTop),s=Math.min(this._window.innerHeight,e.top+t.clientTop+t.clientHeight),a=parseFloat(this._window.getComputedStyle(this._bar).inlineSize),n=this._window.getComputedStyle(t).direction==="rtl",o=e.left+t.clientLeft+(n?0:t.clientWidth-a);return Object.assign(this._bar.style,{insetInlineEnd:"auto",bottom:"auto",top:"".concat(i,"px"),height:"".concat(Math.max(0,s-i),"px"),left:"".concat(Math.max(0,Math.min(this._window.innerWidth-a,o)),"px"),direction:n?"rtl":"ltr"}),e.width>0&&s>i&&o<this._window.innerWidth&&o+a>0}dispose(){if(!this._disposed){this._disposed=!0;for(let[t,e,i,s]of this._listeners)t.removeEventListener(e,i,s);this._listeners=[],this._resize?.disconnect(),this._mutations?.disconnect(),this._contentMutations?.disconnect(),this._window.cancelAnimationFrame(this._frame),this._window.clearTimeout(this._timer),this._drag&&this._bar.hasPointerCapture(this._drag.id)&&this._bar.releasePointerCapture(this._drag.id),this._drag=null,this._bar.remove(),this._root.classList.toggle("scrollbar-overlay-native",this._originalNativeClass),this._generatedId&&this._root.id===this._generatedId&&(this._originalId===null?this._root.removeAttribute("id"):this._root.setAttribute("id",this._originalId)),et.get(this._root)===this&&et.delete(this._root)}}_listen(t,e,i,s){t.addEventListener(e,i,s),this._listeners.push([t,e,i,s])}_queue(){this._disposed||this._frame||(this._frame=this._window.requestAnimationFrame(()=>{this._frame=0,this.refresh()}))}_reveal(){this._disposed||this._bar.hidden||(this._bar.dataset.scrollbarVisible="true",this._hideLater())}_hideLater(){this._window.clearTimeout(this._timer),this._timer=0,!this._disposed&&this._bar.hasAttribute("data-scrollbar-visible")&&(this._timer=this._window.setTimeout(()=>{this._timer=0,!(this._disposed||this._nearEdge||this._drag||this._bar.matches(":focus-visible"))&&delete this._bar.dataset.scrollbarVisible},this._hideDelay))}_onPointerMove(t){if(this._disposed)return;if(this._drag?.id===t.pointerId){this._travel&&this._scroll(this._drag.top+(t.clientY-this._drag.y)*this._maximum/this._travel);return}if(t.pointerType!=="mouse"){this._nearEdge=!1,this._drag||delete this._bar.dataset.scrollbarInteractive;return}let e=this._bar.getBoundingClientRect();!this._bar.hidden&&t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom?(this._nearEdge=!0,this._bar.dataset.scrollbarInteractive="true",this._reveal()):this._nearEdge&&(this._nearEdge=!1,this._drag||delete this._bar.dataset.scrollbarInteractive,this._hideLater())}_onPointerDown(t){if(t.button!==0||this._bar.hidden||t.pointerType==="touch")return;t.preventDefault(),this._reveal();let e=this._thumb.getBoundingClientRect();if(t.clientY>=e.top&&t.clientY<=e.bottom)this._drag={id:t.pointerId,y:t.clientY,top:this._root.scrollTop},this._bar.setPointerCapture(t.pointerId);else{let i=t.clientY<this._thumb.getBoundingClientRect().top?-1:1;this._scroll(this._root.scrollTop+i*this._root.clientHeight)}}_finishDrag(){if(!this._drag||this._disposed)return;let t=this._drag.id;this._drag=null,this._nearEdge||delete this._bar.dataset.scrollbarInteractive,this._bar.hasPointerCapture(t)&&this._bar.releasePointerCapture(t),this._hideLater()}_onKeyDown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;this.refresh();let e=parseFloat(this._window.getComputedStyle(this._root).lineHeight)||16,i=this._root.clientHeight,s={ArrowUp:this._root.scrollTop-e,ArrowDown:this._root.scrollTop+e,PageUp:this._root.scrollTop-i,PageDown:this._root.scrollTop+i,Home:0,End:this._maximum," ":this._root.scrollTop+(t.shiftKey?-i:i)};Object.hasOwn(s,t.key)&&(t.preventDefault(),this._scroll(s[t.key]),this._reveal())}_scroll(t){(this._isDocument?this._window:this._root).scrollTo({top:Math.min(this._maximum,Math.max(0,t)),behavior:"instant"}),this._queue()}};var st=new WeakMap;function Kt(r=document){if(st.has(r))return st.get(r);let e=(r.nodeType===9?r:r.ownerDocument)?.defaultView?.bootstrap?.Offcanvas;if(!e)return()=>{};let i=Array.from(r.querySelectorAll(".offcanvas.sheet")),s=n=>{n.target===n.currentTarget&&n.currentTarget.querySelector("[autofocus]:not(:disabled)")?.focus()},a=()=>{st.get(r)===a&&(i.forEach(n=>{n.removeEventListener("shown.bs.offcanvas",s)}),st.delete(r))};return st.set(r,a),i.forEach(n=>{n.addEventListener("shown.bs.offcanvas",s),n.dataset.sheetOpenOnLoad==="true"&&(n.removeAttribute("data-sheet-open-on-load"),e.getOrCreateInstance(n).show())}),a}var I=new WeakMap,kt=new WeakMap;function Ht(r){return r.isConnected&&!r.matches(":disabled")&&r.getClientRects().length>0&&!r.closest("[hidden], [inert]")&&r.ownerDocument.defaultView.getComputedStyle(r).visibility==="visible"}var rt=class r{static getInstance(t){return I.get(t)||null}static getOrCreateInstance(t){return I.get(t)||new r(t)}constructor(t){if(I.has(t))return I.get(t);if(!t?.matches?.("[data-floating-panel]")||!t.id)throw new TypeError("FloatingPanel requires a named panel");this.panel=t,this.document=t.ownerDocument,this.owner=t.closest(".moo-ui"),this.initialHidden=t.hidden,this.controls=new Map,this.launcher=null,this.key=t.dataset.floatingPanelKey?"moo-floating-panel:".concat(t.dataset.floatingPanelKey):"";let e=this.document.defaultView;kt.has(e)||kt.set(e,new Map),this.memory=kt.get(e),this.onClick=s=>this.handleControl(s),this.document.addEventListener("click",this.onClick),I.set(t,this);let i=this.memory.get(this.key)||!1;if(this.key&&!this.memory.has(this.key))try{i=e.localStorage.getItem(this.key)==="dismissed"}catch{}this.setVisible(!i),t.dataset.floatingPanelReady="true"}launchers(){return[...this.document.querySelectorAll("[data-floating-panel-open]")].filter(t=>t.dataset.floatingPanelOpen===this.panel.id&&t.closest(".moo-ui")===this.owner)}setVisible(t){this.panel.hidden=!t,this.panel.dataset.floatingPanelState=t?"visible":"dismissed",this.launchers().forEach(e=>{this.controls.has(e)||this.controls.set(e,{controls:e.getAttribute("aria-controls"),expanded:e.getAttribute("aria-expanded")}),e.setAttribute("aria-controls",this.panel.id),e.setAttribute("aria-expanded",String(t))})}handleControl(t){let e=t.target.closest?.("[data-floating-panel-open], [data-floating-panel-dismiss]");if(!e||e.matches(":disabled")||e.closest(".moo-ui")!==this.owner)return;let i=e.hasAttribute("data-floating-panel-open");if((i?e.dataset.floatingPanelOpen:e.dataset.floatingPanelDismiss)===this.panel.id&&!(!i&&!this.panel.contains(e))){if(t.preventDefault(),i&&(this.launcher=e),this.key)try{let s=this.document.defaultView.localStorage;i?s.removeItem(this.key):s.setItem(this.key,"dismissed"),this.memory.delete(this.key)}catch{this.memory.set(this.key,!i)}if(this.setVisible(i),i)[...this.panel.querySelectorAll("button, a[href], input:not([type='hidden']), select, textarea, [tabindex]")].find(s=>s.tabIndex>=0&&Ht(s))?.focus({preventScroll:!0});else{let s=this.launchers().filter(Ht);(s.includes(this.launcher)?this.launcher:s[0])?.focus({preventScroll:!0})}}}dispose(){I.get(this.panel)===this&&(this.document.removeEventListener("click",this.onClick),this.panel.hidden=this.initialHidden,delete this.panel.dataset.floatingPanelReady,delete this.panel.dataset.floatingPanelState,this.controls.forEach((t,e)=>{for(let[i,s]of[["aria-controls",t.controls],["aria-expanded",t.expanded]])s===null?e.removeAttribute(i):e.setAttribute(i,s)}),I.delete(this.panel))}};import fe from"./password-requirements.js";async function me(){let{default:r}=await import("./chart.js");return r}var ge={PasswordRequirements:fe,FloatingPanel:rt,loadChart:me,Combobox:N,ContextMenu:B,DataTable:$,Datepicker:Y,MooCalendar:L,MooDateRangePicker:dt,Sidebar:U,Slider:Q,TableOfContents:tt,OverlayScrollbar:it,initSheets:Kt};var He=ge;export{N as Combobox,B as ContextMenu,$ as DataTable,Y as Datepicker,rt as FloatingPanel,L as MooCalendar,dt as MooDateRangePicker,it as OverlayScrollbar,fe as PasswordRequirements,U as Sidebar,Q as Slider,tt as TableOfContents,He as default,Kt as initSheets,me as loadChart};
7
+ var lt=new WeakMap,ct=a=>a.trim().toLowerCase(),N=class a{static getInstance(t){return t?.nodeType===1&&lt.get(t)||null}static getOrCreateInstance(t,e={}){return a.getInstance(t)||new a(t,e)}constructor(t,e={}){if(t?.nodeType!==1||!t.matches(".combobox"))throw new TypeError("Combobox requires a .combobox root element.");let i=lt.get(t);if(i)return i;if(this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView,this._config={noResultsText:"No results found.",...e},this._input=t.querySelector(".combobox-input"),this._menu=t.querySelector(".combobox-menu"),this._options=Array.from(t.querySelectorAll(".combobox-option")),!this._input||!this._menu||this._options.length===0)throw new TypeError("Combobox requires an input, menu, and at least one option.");this._isMultiple=t.dataset.comboboxMultiple==="true",this._hidden=this._isMultiple?null:t.querySelector('input[type="hidden"]'),this._chipValue=t.querySelector(".combobox-value"),this._valueStore=t.querySelector("[data-combobox-value-store]"),this._chipIconTemplate=t.querySelector("[data-combobox-chip-icon]"),this._clearTrigger=t.querySelector("[data-combobox-clear]"),this._indicator=t.querySelector(".combobox-indicator"),this._groups=Array.from(t.querySelectorAll("[data-combobox-group]")),this._separators=Array.from(t.querySelectorAll("[data-combobox-separator]")),this._listeners=[],this._generated=[],this._startsOpen=this._menu.classList.contains("show"),this._empty=this._menu.querySelector("[data-combobox-empty]"),this._empty||(this._empty=this._document.createElement("li"),this._empty.className="combobox-empty",this._empty.hidden=!0,this._empty.dataset.comboboxEmpty="true",this._empty.textContent=this._config.noResultsText,this._menu.appendChild(this._empty),this._generated.push(this._empty)),this._liveRegion=t.querySelector("[data-combobox-live]"),this._liveRegion||(this._liveRegion=this._document.createElement("span"),this._liveRegion.className="visually-hidden",this._liveRegion.setAttribute("aria-live","polite"),this._liveRegion.dataset.comboboxLive="true",t.appendChild(this._liveRegion),this._generated.push(this._liveRegion)),lt.set(t,this),this._bindEvents(),this._toggleClear(this._input.dataset.comboboxSelected==="true"||t.dataset.comboboxSelected==="true"),this._syncMultipleValue(),this._filterOptions({open:this._startsOpen,activate:this._startsOpen}),this._startsOpen||this._closeMenu(!1)}dispose(){this._listeners.forEach(({target:t,type:e,handler:i,options:s})=>{t.removeEventListener(e,i,s)}),this._listeners=[],this._closeMenu(!1),this._generated.forEach(t=>t.remove()),this._generated=[],this._chipValue?.querySelectorAll("[data-combobox-generated]").forEach(t=>t.remove()),this._valueStore?.querySelectorAll("[data-combobox-generated]").forEach(t=>t.remove()),lt.delete(this._element)}_listen(t,e,i,s){t?.addEventListener(e,i,s),t&&this._listeners.push({target:t,type:e,handler:i,options:s})}_trigger(t,e={}){return this._element.dispatchEvent(new this._window.CustomEvent("".concat(t,".moo.combobox"),{bubbles:!0,cancelable:t==="show"||t==="hide",detail:e}))}_optionGroupIsHidden(t){return t.closest("[data-combobox-group]")?.hidden||!1}_visibleOptions(){return this._options.filter(t=>!t.hidden&&!t.disabled&&!this._optionGroupIsHidden(t))}_syncGroupVisibility(){if(this._groups.length===0)return;let t=0;this._groups.forEach(e=>{let i=Array.from(e.querySelectorAll(".combobox-option")).some(s=>!s.hidden);e.hidden=!i,t+=i?1:0}),this._separators.forEach(e=>{e.hidden=t<2})}_openMenu(t=!0){if(this._menu.classList.contains("show")){this._input.setAttribute("aria-expanded","true");return}t&&!this._trigger("show")||(this._menu.classList.add("show"),this._input.setAttribute("aria-expanded","true"),t&&this._trigger("shown"))}_closeMenu(t=!0){let e=this._menu.classList.contains("show");e&&t&&!this._trigger("hide")||(this._menu.classList.remove("show"),this._input.setAttribute("aria-expanded","false"),this._input.removeAttribute("aria-activedescendant"),this._options.forEach(i=>{i.removeAttribute("aria-current"),i.classList.remove("active")}),e&&t&&this._trigger("hidden"))}_optionLabel(t){return t?.querySelector(".combobox-option__label")?.textContent?.trim()||""}_selectedOptions(){return this._options.filter(t=>t.getAttribute("aria-selected")==="true")}_toggleClear(t){let e=t?"true":"false";this._element.dataset.comboboxSelected=e,this._input.dataset.comboboxSelected=e,this._clearTrigger&&(this._clearTrigger.hidden=!t,this._indicator&&(this._indicator.hidden=t))}_createChip(t){let e=t.dataset.value||"",i=this._optionLabel(t),s=this._document.createElement("span");s.className="badge text-bg-secondary combobox-chip",s.dataset.value=e,s.dataset.comboboxGenerated="true";let r=this._document.createElement("span");r.className="combobox-chip__label",r.textContent=i,s.appendChild(r);let n=this._document.createElement("button");return n.className="combobox-chip__remove",n.type="button",n.dataset.value=e,n.dataset.comboboxChipRemove="true",n.setAttribute("aria-label","Remove ".concat(i)),n.append(this._chipIconTemplate?.content.cloneNode(!0)||"x"),s.appendChild(n),s}_syncMultipleValue(){if(!this._isMultiple)return;let t=this._selectedOptions();if(this._chipValue&&this._chipValue.replaceChildren(...t.map(e=>this._createChip(e))),this._valueStore){this._valueStore.replaceChildren();let e=this._valueStore.dataset.comboboxName||"";t.forEach(i=>{let s=this._document.createElement("input");s.type="hidden",s.name=e,s.value=i.dataset.value||"",s.dataset.comboboxGenerated="true",this._valueStore.appendChild(s)})}this._toggleClear(t.length>0)}_emitChange(){let t=this._selectedOptions();this._trigger("change",{values:t.map(e=>e.dataset.value||"")})}_removeChip(t){let e=this._options.find(i=>i.dataset.value===t);e&&(e.setAttribute("aria-selected","false"),this._syncMultipleValue(),this._emitChange())}_clearSelection(t=!0){this._hidden&&(this._hidden.value=""),this._options.forEach(e=>e.setAttribute("aria-selected","false")),this._isMultiple?this._syncMultipleValue():this._toggleClear(!1),t&&this._emitChange()}_clearStaleSelection(){if(this._isMultiple){this._input.value="",this._showAllOptions();return}let t=this._selectedOptions()[0]||null,e=this._optionLabel(t);!this._input.value||e&&ct(this._input.value)===ct(e)||(this._clearSelection(),this._input.value="")}_showAllOptions(){this._options.forEach(t=>{t.hidden=!1}),this._syncGroupVisibility(),this._empty.hidden=!0,this._liveRegion.textContent=""}_activeOption(){let t=this._input.getAttribute("aria-activedescendant");return t&&this._visibleOptions().find(e=>e.id===t)||null}_selectedOption(){return this._isMultiple?null:this._visibleOptions().find(t=>t.getAttribute("aria-selected")==="true")||null}_preferredActiveOption(){return this._selectedOption()||this._visibleOptions()[0]||null}_activatePreferredOptionIfNeeded(){this._activeOption()||this._setActiveOption(this._preferredActiveOption())}_setActiveOption(t,{scroll:e=!0}={}){if(this._options.forEach(i=>{let s=i===t;s?i.setAttribute("aria-current","true"):i.removeAttribute("aria-current"),i.classList.toggle("active",s)}),!t){this._input.removeAttribute("aria-activedescendant");return}if(this._input.setAttribute("aria-activedescendant",t.id),e){let i=t.getBoundingClientRect(),s=this._menu.getBoundingClientRect();i.top<s.top?this._menu.scrollTop-=s.top-i.top:i.bottom>s.bottom&&(this._menu.scrollTop+=i.bottom-s.bottom)}}_activateOptionFromPointer(t,e){e.pointerType==="touch"||t.disabled||t.getAttribute("aria-disabled")==="true"||t===this._activeOption()||this._setActiveOption(t,{scroll:!1})}_restoreSelectedActiveOption(){if(!this._menu.classList.contains("show"))return;let t=this._selectedOption();t&&this._setActiveOption(t,{scroll:!1})}_chooseOption(t){if(!(!t||t.disabled)){if(this._isMultiple){t.setAttribute("aria-selected",t.getAttribute("aria-selected")==="true"?"false":"true"),this._input.value="",this._syncMultipleValue(),this._filterOptions(),this._setActiveOption(t),this._emitChange();return}this._options.forEach(e=>{e.setAttribute("aria-selected",e===t?"true":"false")}),this._input.value=this._optionLabel(t),this._hidden&&(this._hidden.value=t.dataset.value||""),this._showAllOptions(),this._toggleClear(!0),this._setActiveOption(t),this._emitChange()}}_filterOptions({open:t=!0,activate:e=!0,resetActive:i=!1}={}){t&&this._openMenu();let s=ct(this._input.value),r=0;this._options.forEach(n=>{let o=!s||ct(n.textContent).includes(s);n.hidden=!o,r+=o?1:0}),this._syncGroupVisibility(),this._empty.hidden=r!==0,this._liveRegion.textContent=r===0?"No results":"".concat(r," result").concat(r===1?"":"s"),i&&this._setActiveOption(null,{scroll:!1}),e&&this._activatePreferredOptionIfNeeded()}_bindEvents(){this._listen(this._input,"focus",()=>{this._openMenu(),!this._isMultiple&&this._input.dataset.comboboxSelected==="true"&&this._input.select(),this._activatePreferredOptionIfNeeded()}),this._listen(this._input,"input",()=>{this._isMultiple||this._clearSelection(),this._filterOptions({resetActive:!0})}),this._listen(this._input,"blur",t=>{let e=t.relatedTarget;e instanceof this._window.Node&&this._element.contains(e)||this._clearStaleSelection()}),this._listen(this._input,"click",()=>{this._openMenu(),this._setActiveOption(this._preferredActiveOption())}),this._listen(this._input,"keydown",t=>this._handleKeydown(t)),this._options.forEach(t=>{this._listen(t,"keydown",e=>this._handleKeydown(e)),this._listen(t,"pointerenter",e=>{this._activateOptionFromPointer(t,e)}),this._listen(t,"click",()=>{this._chooseOption(t),this._isMultiple?this._input.focus():this._closeMenu()})}),this._listen(this._clearTrigger,"click",t=>{t.preventDefault(),this._clearSelection(),this._input.value="",this._input.focus(),this._filterOptions({resetActive:!0})}),this._listen(this._menu,"pointerleave",()=>this._restoreSelectedActiveOption()),this._listen(this._element,"click",t=>this._handleRootClick(t)),this._listen(this._document,"click",t=>{t.target instanceof this._window.Node&&!this._element.contains(t.target)&&this._closeMenu()})}_handleRootClick(t){let e=t.target,i=e instanceof this._window.Element?e.closest("[data-combobox-chip-remove]"):null;i?(t.preventDefault(),this._removeChip(i.dataset.value||""),this._input.focus()):this._isMultiple&&e instanceof this._window.Element&&e.closest(".combobox-chips")&&this._input.focus()}_handleKeydown(t){if(t.isComposing||t.keyCode===229){t.key==="Tab"&&this._closeMenu();return}let e=this._visibleOptions(),i=e.findIndex(n=>n.id===this._input.getAttribute("aria-activedescendant")),s=t.key==="ArrowDown"||t.key==="Down",r=t.key==="ArrowUp"||t.key==="Up";if(this._isMultiple&&t.key==="Backspace"&&this._input.value===""){let n=this._selectedOptions(),o=n[n.length-1];o&&(t.preventDefault(),this._removeChip(o.dataset.value||""))}else if((s||r)&&e.length){t.preventDefault(),this._openMenu();let o=i===-1?0:(i+(s?1:-1)+e.length)%e.length;this._setActiveOption(e[o]),t.target!==this._input&&this._input.focus({preventScroll:!0})}else if(t.key==="Enter"){let n=e[i];n&&(t.preventDefault(),this._chooseOption(n),this._isMultiple||this._closeMenu())}else t.key==="Escape"?(this._closeMenu(),this._input.focus()):t.key==="Tab"&&this._closeMenu()}};var ht=new WeakMap;function te(a){let{clientX:t,clientY:e}=a;return{top:e,left:t,right:t,bottom:e,width:0,height:0,x:t,y:e}}function wt(a){return!!(a?.disabled||a?.getAttribute?.("aria-disabled")==="true")}function ee(a){let t=a.target,e=t.closest?.(".dropdown-item");return e||t.closest?.("li")?.querySelector(":scope > .dropdown-item")||null}var B=class a{static getInstance(t){return t?.nodeType===1&&ht.get(t)||null}static getOrCreateInstance(t,e={}){return a.getInstance(t)||new a(t,e)}constructor(t,e={}){if(t?.nodeType!==1||!t.matches(".context-menu"))throw new TypeError("ContextMenu requires a .context-menu root element.");let i=ht.get(t);if(i)return i;if(this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView,this._menu=t.querySelector(":scope > .context-menu-menu"),this._fallback=t.querySelector(":scope > [data-context-menu-fallback]"),!this._menu)throw new TypeError("ContextMenu requires a .context-menu-menu element.");if(!this._fallback)throw new TypeError("ContextMenu requires an explicit fallback trigger.");let s=this._bootstrap("Dropdown");if(!s)throw new TypeError("ContextMenu requires bootstrap.Dropdown (bootstrap.bundle.js).");this._config={...e},this._listeners=[],this._invoker=null,this._pointerRect=null,this._openMethod=null,this._reference={getBoundingClientRect:()=>this._currentRect(),contextElement:this._fallback},this._dropdown=new s(this._fallback,{reference:this._reference,autoClose:"outside"}),ht.set(t,this),this._bindEvents()}dispose(){this._disposing||(this._disposing=!0,this._listeners.forEach(({target:t,type:e,handler:i,options:s})=>{t.removeEventListener(e,i,s)}),this._listeners=[],this._syncExpanded(!1),this._dropdown.hide(),this._dropdown.dispose(),this._invoker=null,this._pointerRect=null,ht.delete(this._element))}show(t=this._fallback){this._open(t,null)}hide(){this._dropdown.hide()}_listen(t,e,i,s){t.addEventListener(e,i,s),this._listeners.push({target:t,type:e,handler:i,options:s})}_bootstrap(t){return this._window.bootstrap?.[t]||null}_currentRect(){return this._pointerRect?this._pointerRect:(this._invoker||this._fallback).getBoundingClientRect()}_trigger(t,e=!1){return this._element.dispatchEvent(new this._window.CustomEvent("".concat(t,".moo.context-menu"),{bubbles:!0,cancelable:e}))}_triggers(){return Array.from(this._element.querySelectorAll(":scope > .context-menu-trigger"))}_syncExpanded(t){this._triggers().forEach(e=>{e.setAttribute("aria-expanded",String(t))})}_menuItems(){return Array.from(this._menu.querySelectorAll(".dropdown-item")).filter(t=>!wt(t)&&!t.classList.contains("disabled"))}_open(t,e,i){wt(t)||(this._menu.classList.contains("show")&&this._dropdown.hide(),this._invoker=t,this._pointerRect=e?te(e):null,this._openMethod=i,this._dropdown.show())}_handleContextMenu(t){let e=t.target.closest(".context-menu-trigger");!e||!this._element.contains(e)||(t.preventDefault(),this._open(e,t,"pointer"))}_handleKeydown(t){let e=t.target.closest(".context-menu-trigger");if(!e||!this._element.contains(e))return;let i=t.shiftKey&&t.key==="F10",s=t.key==="ContextMenu";!i&&!s||(t.preventDefault(),this._open(e,null,"keyboard"))}_handleFallbackClick(){this._invoker=this._fallback,this._pointerRect=null,this._openMethod="pointer"}_handleFallbackKeydown(t){if(!(t.key!==" "&&t.key!=="Spacebar")){if(t.preventDefault(),t.stopPropagation(),this._menu.classList.contains("show")){this._dropdown.hide();return}this._open(this._fallback,null,"fallback-keyboard")}}_handleMenuClick(t){let e=ee(t);if(!e)return;let i=e.matches(".dropdown-item-check, [data-context-menu-persistent]");if(e.matches('.dropdown-item.disabled, .dropdown-item[aria-disabled="true"], .dropdown-item:disabled')||wt(e)){t.preventDefault(),t.stopPropagation();return}let r=e.matches("[data-context-menu-radio-group]")?e:null;if(r){t.preventDefault(),t.stopPropagation();let n=r.dataset.contextMenuRadioGroup;this._menu.querySelectorAll('[data-context-menu-radio-group="'.concat(CSS.escape(String(n)),'"]')).forEach(o=>{let c=o===r;o.classList.toggle("active",c),o.setAttribute("aria-pressed",String(c))});return}i||this._dropdown.hide()}_bindEvents(){this._listen(this._element,"contextmenu",t=>this._handleContextMenu(t)),this._listen(this._element,"keydown",t=>this._handleKeydown(t)),this._listen(this._fallback,"click",()=>this._handleFallbackClick()),this._listen(this._fallback,"keydown",t=>this._handleFallbackKeydown(t)),this._listen(this._menu,"click",t=>this._handleMenuClick(t)),this._listen(this._fallback,"show.bs.dropdown",t=>{this._trigger("show",!0)||t.preventDefault()}),this._listen(this._fallback,"shown.bs.dropdown",()=>{this._syncExpanded(!0),this._openMethod==="fallback-keyboard"?this._fallback.focus():this._openMethod==="keyboard"?this._menuItems()[0]?.focus():this._menu.focus(),this._trigger("shown")}),this._listen(this._fallback,"hide.bs.dropdown",t=>{this._trigger("hide",!0)||t.preventDefault()}),this._listen(this._fallback,"hidden.bs.dropdown",()=>{this._syncExpanded(!1);let t=this._invoker;this._pointerRect=null,this._invoker=null,this._openMethod=null,this._trigger("hidden"),queueMicrotask(()=>{t&&t!==this._fallback&&this._document.activeElement===this._fallback&&t.focus()})})}};var Ot='.moo-ui[data-bs-theme="light"], .moo-ui[data-bs-theme="dark"]',ie="[data-moo-overlay-host]";function se(a){return a?.nodeType===9?a:a?.ownerDocument?a.ownerDocument:typeof document>"u"?null:document}function re(a){return!!a?.matches?.(Ot)}function ae(a){let t=se(a);return a?.nodeType===9||a===t?.body?t?.body?.firstElementChild||null:a}function E(a=typeof document>"u"?null:document){let t=ae(a);return t?re(t)?t:t.closest?.(Ot)||null:null}function P(a){return a?Array.from(a.children||[]).find(t=>t.matches?.(ie))||a:null}var dt=new WeakMap,ne=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),oe=/^[-+]?(?:\d+\.?\d*|\.\d+)$/;function Pt(a){return oe.test(a)?Number(a):null}function le(a,t){let e=Pt(a),i=Pt(t);return e!==null&&i!==null?Math.sign(e-i):e!==null||i!==null?e!==null?-1:1:ne.compare(a,t)}function M(a){return(a??"").toString().trim().toLowerCase()}var ce=".modal, .offcanvas, .dropdown-menu, .popover, [role='dialog'], [role='menu'], [role='listbox']";function he(a){let t=a.target;return typeof t?.closest=="function"&&(!!t.closest(ce)||t.getAttribute("aria-expanded")==="true")}var $=class a{static getInstance(t){return t?.nodeType===1&&dt.get(t)||null}static getOrCreateInstance(t,e={}){return a.getInstance(t)||new a(t,e)}constructor(t,e={}){if(t?.nodeType!==1||!t.matches(".datatable"))throw new TypeError("DataTable requires a .datatable root element.");let i=dt.get(t);if(i)return i;if(this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView,this._table=t.querySelector(":scope .datatable-table"),this._tbody=this._table?.querySelector(":scope > tbody"),!this._table||!this._tbody)throw new TypeError("DataTable requires a .datatable-table with a tbody.");this._cards=t.querySelector("[data-datatable-cards]");let s=new Map(Array.from(t.querySelectorAll("[data-datatable-card]")).map(r=>[r.dataset.datatableCardFor,r]));this._config={...e},this._listeners=[],this._pageSize=Number(t.dataset.datatablePageSize)||10,this._currentPage=1,this._sortKey=null,this._sortDirection=null,this._selectedIds=new Set,this._facetSelections=new Map,this._visibleFacets=new Map,this._searchTerm="",this._tooltips=[],this._filterMode=t.dataset.datatableFilterMode||"inline",this._reparentedRowMenus=new Map,this._reparentedRowMenuByTrigger=new WeakMap,this._reparentedSortMenus=new Map,this._reparentedSortMenuByTrigger=new WeakMap,this._rows=Array.from(this._tbody.querySelectorAll(":scope > tr[data-datatable-row]")).map((r,n)=>({element:r,cardElement:s.get(r.id)||null,index:n,search:M(r.dataset.datatableSearch),facets:this._readFacets(r)})),this._readInitialFacetVisibility(),this._readInitialSort(),dt.set(t,this),this._bindEvents(),this._render(),this._initBulkTooltips(),this._initViewToggle(),this._initRowActionDropdowns(),this._initSortDropdowns()}dispose(){this._disposeRowActionDropdowns(),this._disposeSortDropdowns(),this._restoreRowActionMenus(),this._restoreSortMenus(),this._listeners.forEach(({target:t,type:e,handler:i,options:s})=>{t.removeEventListener(e,i,s)}),this._listeners=[],this._tooltips.forEach(t=>t.dispose()),this._tooltips=[],dt.delete(this._element)}getSelectedIds(){return Array.from(this._selectedIds)}_listen(t,e,i,s){t&&(t.addEventListener(e,i,s),this._listeners.push({target:t,type:e,handler:i,options:s}))}_rowActionTriggers(){return this._element.querySelectorAll('tr[data-datatable-row] .dropdown [data-bs-toggle="dropdown"], [data-datatable-card] .dropdown [data-bs-toggle="dropdown"]')}_initRowActionDropdowns(){let t=this._bootstrap("Dropdown");t&&this._rowActionTriggers().forEach(e=>{t.getOrCreateInstance(e,{popperConfig:i=>this._clippingSafePopperConfig(i)})})}_sortTriggers(){return this._element.querySelectorAll('.datatable-sort [data-bs-toggle="dropdown"]')}_initSortDropdowns(){let t=this._bootstrap("Dropdown");t&&this._sortTriggers().forEach(e=>{t.getOrCreateInstance(e,{popperConfig:i=>this._clippingSafePopperConfig(i)})})}_clippingSafePopperConfig(t){return{...t,strategy:"fixed",modifiers:[...t.modifiers||[],{name:"flip",options:{fallbackPlacements:["top-end","top-start","bottom-end","bottom-start"]}},{name:"preventOverflow",options:{boundary:"viewport",padding:8}}]}}_disposeRowActionDropdowns(){let t=this._bootstrap("Dropdown");t&&this._rowActionTriggers().forEach(e=>{let i=t.getInstance(e);i&&(i.hide(),i.dispose())})}_disposeSortDropdowns(){let t=this._bootstrap("Dropdown");t&&this._sortTriggers().forEach(e=>{let i=t.getInstance(e);i&&(i.hide(),i.dispose())})}_rowActionMenuForTrigger(t){return t?.closest?.("tr[data-datatable-row], [data-datatable-card]")&&t.closest(".dropdown")?.querySelector(":scope > .dropdown-menu")||null}_rowActionOwnerIdForTrigger(t){let e=t?.closest?.("tr[data-datatable-row]")?.id;return e||t?.closest?.("[data-datatable-card]")?.getAttribute("data-datatable-card-for")||""}_reparentRowActionMenu(t){let e=this._rowActionMenuForTrigger(t);if(!e||this._reparentedRowMenus.has(e))return;let i=this._rowActionOwnerIdForTrigger(t);i&&e.setAttribute("data-datatable-row-action-owner",i),t.id&&e.setAttribute("data-datatable-row-action-trigger",t.id),this._reparentedRowMenus.set(e,{parent:e.parentNode,nextSibling:e.nextSibling,trigger:t,owner:E(t)}),this._reparentedRowMenuByTrigger.set(t,e),this._portalRoot(t).appendChild(e)}_restoreRowActionMenuForTrigger(t){let e=this._reparentedRowMenuByTrigger.get(t)||this._rowActionMenuForTrigger(t);e&&this._restoreRowActionMenu(e)}_restoreRowActionMenu(t){let e=this._reparentedRowMenus.get(t);if(!e)return;let{parent:i,nextSibling:s,trigger:r,owner:n}=e;n?.isConnected===!1?t.remove():i?.isConnected?s?.parentNode===i?i.insertBefore(t,s):i.appendChild(t):t.remove(),r&&this._reparentedRowMenuByTrigger.delete(r),t.removeAttribute("data-datatable-row-action-owner"),t.removeAttribute("data-datatable-row-action-trigger"),this._reparentedRowMenus.delete(t)}_restoreRowActionMenus(){Array.from(this._reparentedRowMenus.keys()).forEach(t=>{this._restoreRowActionMenu(t)})}_sortMenuForTrigger(t){return t?.closest?.(".datatable-sort")&&(this._reparentedSortMenuByTrigger.get(t)||t?.closest?.(".dropdown")?.querySelector(":scope > .dropdown-menu"))||null}_reparentSortMenu(t){let e=this._sortMenuForTrigger(t);!e||this._reparentedSortMenus.has(e)||(this._reparentedSortMenus.set(e,{parent:e.parentNode,nextSibling:e.nextSibling,trigger:t,owner:t.closest(".datatable-sort"),themeOwner:E(t)}),this._reparentedSortMenuByTrigger.set(t,e),this._portalRoot(t).appendChild(e))}_restoreSortMenuForTrigger(t){let e=this._reparentedSortMenuByTrigger.get(t)||this._sortMenuForTrigger(t);e&&this._restoreSortMenu(e)}_restoreSortMenu(t){let e=this._reparentedSortMenus.get(t);if(!e)return;let{parent:i,nextSibling:s,trigger:r,themeOwner:n}=e;n?.isConnected===!1?t.remove():i?.isConnected?s?.parentNode===i?i.insertBefore(t,s):i.appendChild(t):t.remove(),r&&this._reparentedSortMenuByTrigger.delete(r),this._reparentedSortMenus.delete(t)}_restoreSortMenus(){Array.from(this._reparentedSortMenus.keys()).forEach(t=>{this._restoreSortMenu(t)})}_bootstrap(t){return this._window.bootstrap?.[t]||null}_portalRoot(t=this._element){return P(E(t))||this._document.body||this._document.documentElement}_initBulkTooltips(){let t=this._bootstrap("Tooltip");t&&this._element.querySelectorAll('[data-datatable-bulk-actions] [data-bs-title]:not([data-bs-toggle="dropdown"])').forEach(e=>{this._tooltips.push(t.getOrCreateInstance(e,{animation:!1,container:this._portalRoot(e)}))})}_hideBulkTooltips({blur:t=!1}={}){if(this._tooltips.forEach(i=>{i.hide()}),!t)return;let e=this._document.activeElement;e?.closest?.("[data-datatable-bulk-actions]")&&e.blur()}_initViewToggle(){let t=Array.from(this._element.querySelectorAll(".datatable-view-toggle"));if(!t.length)return;let e=t.flatMap(h=>Array.from(h.querySelectorAll("input"))),i=this._window.getComputedStyle(this._element).getPropertyValue("--moo-datatable-responsive-breakpoint").trim(),s=this._element.hasAttribute("data-datatable-responsive-breakpoint"),r=s&&i?this._window.matchMedia("(min-width: ".concat(i,")")):null,n=new Map,o=()=>"moo-datatable-view:".concat(this._element.id).concat(r?r.matches?":wide":":narrow":""),c=(h,{persist:_=!1}={})=>{if(this._element.dataset.datatableView!==h){let g=this._bootstrap("Dropdown");[...this._rowActionTriggers(),...this._sortTriggers()].forEach(f=>{g?.getInstance(f)?.hide()})}if(this._element.dataset.datatableView=h,e.forEach(g=>{g.checked=g.value===h}),_){n.set(o(),h);try{this._window.localStorage.setItem(o(),h)}catch{}}},l=()=>{let h=n.get(o());try{h??(h=this._window.localStorage.getItem(o()))}catch{}c(h==="table"||h==="cards"?h:r?r.matches?"table":"cards":this._element.dataset.datatableView)};!s||r?l():e.forEach(h=>{h.checked=!1}),r&&this._listen(r,"change",l),t.forEach(h=>{this._listen(h,"change",_=>{let g=_.target.value;g!=="table"&&g!=="cards"||c(g,{persist:!0})})})}_readFacets(t){let e={};return Array.from(t.attributes).forEach(i=>{let s=/^data-datatable-facet-(.+)$/.exec(i.name);s&&(e[s[1]]=i.value)}),e}_readInitialFacetVisibility(){this._element.querySelectorAll("[data-datatable-facet]").forEach(t=>{let e=t.dataset.datatableFacet;e&&this._visibleFacets.set(e,!t.hidden)}),this._element.querySelectorAll("[data-datatable-filter-group]").forEach(t=>{let e=t.dataset.datatableFilterGroup;e&&!this._visibleFacets.has(e)&&this._visibleFacets.set(e,!1)}),this._element.querySelectorAll("[data-datatable-filter-option-key]").forEach(t=>{let e=t.dataset.datatableFilterOptionKey;e&&!this._visibleFacets.has(e)&&this._visibleFacets.set(e,!1)})}_readInitialSort(){let t=this._element.querySelector("th[data-datatable-initial-sort][data-datatable-column]"),e=t?.dataset.datatableInitialSort;e!=="asc"&&e!=="desc"||(this._sortKey=t.dataset.datatableColumn||null,this._sortDirection=this._sortKey?e:null)}_trigger(t,e={}){this._element.dispatchEvent(new this._window.CustomEvent("".concat(t,".moo.datatable"),{bubbles:!0,detail:e}))}_sortValue(t,e){let i=t.element.querySelector(':scope > [data-datatable-column="'.concat(CSS.escape(String(e)),'"]'));return i?M(i.dataset.datatableSortValue??i.textContent):""}_matchesFilters(t){if(this._searchTerm&&!t.search.includes(this._searchTerm))return!1;for(let[e,i]of this._facetSelections)if(i.size!==0&&!i.has(t.facets[e]))return!1;return!0}_visibleRows(){let t=this._rows.filter(e=>this._matchesFilters(e));if(this._sortKey){let e=this._sortDirection==="desc"?-1:1;t.sort((i,s)=>{let r=this._sortValue(i,this._sortKey),n=this._sortValue(s,this._sortKey),o=le(r,n);return o?o*e:i.index-s.index})}else t.sort((e,i)=>e.index-i.index);return t}_pageCount(t){return Math.max(1,Math.ceil(t/this._pageSize))}_render(){let t=this._visibleRows(),e=this._pageCount(t.length);this._currentPage=Math.min(Math.max(1,this._currentPage),e);let i=(this._currentPage-1)*this._pageSize,s=t.slice(i,i+this._pageSize),r=new Set(s.map(l=>l.element.id));this._rows.forEach(l=>{let h=r.has(l.element.id);l.element.hidden=!h,l.cardElement&&(l.cardElement.hidden=!h)});let n=Array.from(this._tbody.children).filter(l=>r.has(l.id)).map(l=>l.id),o=s.map(l=>l.element.id);(n.length!==o.length||n.some((l,h)=>l!==o[h]))&&s.forEach(l=>{this._tbody.appendChild(l.element),this._cards&&l.cardElement&&this._cards.appendChild(l.cardElement)}),this._renderToolbarState(),this._renderSortHeaders(),this._renderSelection(s),this._renderFrameState(t.length),this._renderEmptyState(t.length),this._renderPagination(t.length,e),this._renderPageSize(),this._renderBulkActions()}_renderToolbarState(){let t=!!this._searchTerm,e=Array.from(this._facetSelections.values()).some(s=>s.size>0),i=this._element.querySelector("[data-datatable-reset]");i&&(i.hidden=!(t||e)),this._element.querySelectorAll("[data-datatable-facet]").forEach(s=>{let r=s.dataset.datatableFacet,n=this._facetSelections.get(r)||new Set;this._visibleFacets.has(r)&&(s.hidden=!this._visibleFacets.get(r)),s.querySelector(".datatable-facet-trigger")?.classList.toggle("datatable-facet-trigger-active",n.size>0);let c=s.querySelector("[data-datatable-facet-summary]");c&&(c.hidden=n.size===0,c.replaceChildren(),n.size>2?c.appendChild(this._createFacetBadge("".concat(n.size," selected"))):n.forEach(l=>{let _=s.querySelector('[data-datatable-facet-option="'.concat(CSS.escape(String(l)),'"]'))?.querySelector("[data-datatable-facet-option-label]")?.textContent??l;c.appendChild(this._createFacetBadge(_))})),s.querySelectorAll("[data-datatable-facet-option]").forEach(l=>{let h=n.has(l.dataset.datatableFacetOption);l.classList.toggle("active",h),l.setAttribute("aria-pressed",String(h))})}),this._element.querySelectorAll("[data-datatable-filter-toggle]").forEach(s=>{let r=s.dataset.datatableFilterToggle,n=this._visibleFacets.get(r)??!0;s.classList.toggle("active",n),s.setAttribute("aria-pressed",n?"true":"false")}),this._element.querySelectorAll("[data-datatable-filter-option]").forEach(s=>{let r=s.dataset.datatableFilterOptionKey,o=(this._facetSelections.get(r)||new Set).has(s.dataset.datatableFilterOption);s.classList.toggle("active",o),s.setAttribute("aria-pressed",o?"true":"false")}),this._element.querySelectorAll("[data-datatable-filter-group-summary]").forEach(s=>{let r=this._facetSelections.get(s.dataset.datatableFilterGroupSummary)||new Set;s.hidden=r.size===0,s.textContent=r.size>0?"".concat(r.size," selected"):""})}_createFacetBadge(t){let e=this._document.createElement("span");return e.className="datatable-facet-badge",e.textContent=t,e}_renderSelection(t){let e=Array.from(this._element.querySelectorAll("[data-datatable-select-all]"));t.forEach(r=>{[r.element,r.cardElement].forEach(n=>{let o=n?.querySelector("[data-datatable-select-row]");o&&(o.checked=this._selectedIds.has(r.element.id)),n?.classList.toggle("datatable-row-selected",this._selectedIds.has(r.element.id))})});let i=t.length,s=t.filter(r=>this._selectedIds.has(r.element.id)).length;e.forEach(r=>{r.checked=i>0&&s===i,r.indeterminate=s>0&&s<i})}_renderBulkActions(){let t=this._element.querySelector("[data-datatable-bulk-actions]");if(!t)return;t.hidden=this._selectedIds.size===0;let e=t.querySelector("[data-datatable-bulk-count]");e&&(e.textContent=String(this._selectedIds.size))}_renderFrameState(t){let e=t===0;this._element.querySelectorAll(".datatable-frame, .datatable-card-frame").forEach(i=>{i.hidden=e})}_renderEmptyState(t){let e=this._element.querySelector("[data-datatable-empty]");if(!e)return;let i=this._rows.length>0;e.hidden=t!==0,e.querySelector(".empty-state-title, .datatable-empty-title")?.replaceChildren(this._document.createTextNode(i?"No matching results":"No rows to display"));let s=e.querySelector(".empty-state-description, .datatable-empty-copy");s&&(s.hidden=!i);let r=e.querySelector("[data-datatable-empty-reset]");if(r){r.hidden=!i;let n=r.closest(".empty-state-actions");n&&(n.hidden=!i)}}_sortAriaValue(t){return t==="asc"?"ascending":t==="desc"?"descending":"none"}_renderSortHeaders(){this._element.querySelectorAll("th[data-datatable-column]").forEach(t=>{if(!t.querySelector("[data-datatable-sort-key]")){delete t.dataset.datatableSortState,delete t.dataset.datatableSortDirection,t.removeAttribute("aria-sort");return}let i=t.dataset.datatableColumn,s=i&&i===this._sortKey?this._sortDirection:"none";t.dataset.datatableSortState=s||"none",t.setAttribute("aria-sort",this._sortAriaValue(s)),s==="asc"||s==="desc"?t.dataset.datatableSortDirection=s:delete t.dataset.datatableSortDirection})}_renderPagination(t,e){let i=this._element.querySelector("[data-datatable-page-first]"),s=this._element.querySelector("[data-datatable-page-prev]"),r=this._element.querySelector("[data-datatable-page-next]"),n=this._element.querySelector("[data-datatable-page-last]"),o=this._currentPage<=1,c=this._currentPage>=e;[i,s].forEach(u=>this._setPageItemDisabled(u,o)),[r,n].forEach(u=>this._setPageItemDisabled(u,c));let l=this._element.querySelector("[data-datatable-results-summary]");if(l)if(t===0)l.textContent="No results";else{let u=(this._currentPage-1)*this._pageSize+1,d=Math.min(this._currentPage*this._pageSize,t);l.textContent="Showing ".concat(u,"-").concat(d," of ").concat(t)}let h=this._element.querySelector("template[data-datatable-page-numbers]");if(!h)return;let _=this._pageWindow(this._currentPage,e),g=Array.from(h.parentNode.querySelectorAll("[data-datatable-page-number], [data-datatable-page-ellipsis]")),f=g.map(u=>u.dataset.datatablePageEllipsis===void 0?Number(u.dataset.datatablePageNumber):"\u2026");if(f.length!==_.length||f.some((u,d)=>u!==_[d])){g.forEach(d=>d.remove());let u=this._document.createDocumentFragment();_.forEach(d=>{let k=this._document.createElement("li");if(k.className="page-item",d==="\u2026")k.dataset.datatablePageEllipsis="",k.innerHTML='<span class="page-link">\u2026</span>';else{k.dataset.datatablePageNumber=String(d);let w=this._document.createElement("button");w.type="button",w.className="page-link",w.textContent=String(d),w.setAttribute("aria-label","Go to page ".concat(d)),w.dataset.datatablePageGo=String(d),k.appendChild(w)}u.appendChild(k)}),h.parentNode.insertBefore(u,h)}h.parentNode.querySelectorAll("[data-datatable-page-number]").forEach(u=>{let d=Number(u.dataset.datatablePageNumber)===this._currentPage;u.classList.toggle("active",d),d?u.setAttribute("aria-current","page"):u.removeAttribute("aria-current")})}_renderPageSize(){let t=String(this._pageSize),e=this._element.querySelector("[data-datatable-page-size-value]");e&&(e.textContent=t);let i=this._element.querySelector("[data-datatable-page-size-select]");i&&(i.value=t),this._element.querySelectorAll("[data-datatable-page-size-option]").forEach(s=>{let r=s.dataset.datatablePageSizeOption===t;s.classList.toggle("active",r),s.setAttribute("aria-pressed",r?"true":"false")})}_setPageItemDisabled(t,e){t&&(t.disabled=e,t.closest(".page-item")?.classList.toggle("disabled",e))}_pageWindow(t,e){if(e<=7)return Array.from({length:e},(n,o)=>o+1);let i=new Set([1,e,t-1,t,t+1]),s=Array.from(i).filter(n=>n>=1&&n<=e).sort((n,o)=>n-o),r=[];return s.forEach((n,o)=>{o>0&&n-s[o-1]>1&&r.push("\u2026"),r.push(n)}),r}_isColumnFixed(t){return this._element.querySelector('th[data-datatable-column="'.concat(CSS.escape(String(t)),'"]'))?.hasAttribute("data-datatable-column-fixed")||!1}_setColumnVisible(t,e,{syncViewToggle:i=!0}={}){!e&&this._isColumnFixed(t)||(this._element.querySelectorAll('[data-datatable-column="'.concat(CSS.escape(String(t)),'"], [data-datatable-detail-column="').concat(CSS.escape(String(t)),'"]')).forEach(s=>{s.classList.toggle("datatable-col-hidden",!e)}),i&&this._element.querySelectorAll('[data-datatable-column-toggle="'.concat(CSS.escape(String(t)),'"]')).forEach(s=>{s.classList.toggle("active",e),s.setAttribute("aria-pressed",String(e))}))}_setSort(t,e){let i=e==="asc"||e==="desc"?e:null;this._sortKey=i?t:null,this._sortDirection=i,this._render(),this._trigger("sort",{key:this._sortKey,direction:this._sortDirection})}_handleSortAction(t){let e=t.target.closest("[data-datatable-sort-action]");if(!e)return;let i=e.closest(".dropdown-menu"),s=i?.closest(".datatable-sort")||this._reparentedSortMenus.get(i)?.owner;if(!s||!this._element.contains(s))return;let r=s.querySelector("[data-datatable-sort-key]")?.dataset.datatableSortKey;if(!r)return;let n=e.dataset.datatableSortAction;if(n==="hide"){this._setColumnVisible(r,!1);return}this._setSort(r,n)}_handleFacetClick(t){let e=t.target.closest("[data-datatable-facet-option]"),i=t.target.closest("[data-datatable-facet-clear]");if(!e&&!i)return;let r=t.target.closest("[data-datatable-facet]")?.dataset.datatableFacet;if(!r)return;let n=this._facetSelections.get(r)||new Set;if(i)n.clear();else{let o=e.dataset.datatableFacetOption;n.has(o)?n.delete(o):n.add(o)}this._facetSelections.set(r,n),this._filterMode==="picker"&&n.size===0&&this._visibleFacets.set(r,!1),this._currentPage=1,this._render(),this._trigger("filter")}_handleFacetSearch(t){let e=t.target.closest("[data-datatable-facet-search]");if(!e)return;let i=e.closest("[data-datatable-facet]"),s=M(e.value);i?.querySelectorAll("[data-datatable-facet-option]").forEach(r=>{let n=M(r.querySelector("[data-datatable-facet-option-label]")?.textContent||r.textContent);r.closest("li")?.classList.toggle("datatable-facet-search-hidden",s.length>0&&!n.includes(s))})}_handleFacetSearchKeydown(t){if(t.key!=="ArrowDown")return;let e=t.target.closest("[data-datatable-facet-search]");if(!e)return;let i=e.closest("[data-datatable-facet]"),r=Array.from(i?.querySelectorAll("[data-datatable-facet-option]")||[]).find(n=>!n.closest("li")?.classList.contains("datatable-facet-search-hidden"));r&&(t.preventDefault(),r.focus())}_handleFilterOptionClick(t){let e=t.target.closest("[data-datatable-filter-option]");if(!e)return;let i=e.dataset.datatableFilterOptionKey,s=e.dataset.datatableFilterOption;if(!i||!this._visibleFacets.has(i))return;this._visibleFacets.set(i,!0);let r=this._facetSelections.get(i)||new Set;r.has(s)?r.delete(s):r.add(s),this._facetSelections.set(i,r),r.size===0&&this._visibleFacets.set(i,!1),this._currentPage=1,this._render(),this._trigger("filter")}_showFilterPickerPanel(t=null){this._element.querySelectorAll("[data-datatable-filter-panel]").forEach(e=>{let i=e.dataset.datatableFilterPanel==="facets",s=e.dataset.datatableFilterPanelKey===t;e.hidden=t?!s:!i}),this._element.querySelector(".datatable-search-filter-menu")?.setAttribute("data-datatable-filter-menu-panel",t?"options":"facets")}_handleFilterPickerClick(t){let e=t.target.closest("[data-datatable-filter-group]");if(e){let i=e.dataset.datatableFilterGroup;this._showFilterPickerPanel(i);let s=this._element.querySelector('[data-datatable-filter-option-search="'.concat(CSS.escape(String(i)),'"]')),r=this._element.querySelector('[data-datatable-filter-option-key="'.concat(CSS.escape(String(i)),'"]'));(s||r)?.focus({preventScroll:!0});return}t.target.closest("[data-datatable-filter-back]")&&this._showFilterPickerPanel()}_handleFilterOptionSearch(t){let e=t.target.closest("[data-datatable-filter-option-search]");if(!e)return;let i=e.dataset.datatableFilterOptionSearch,s=M(e.value);this._element.querySelectorAll('[data-datatable-filter-option-key="'.concat(CSS.escape(String(i)),'"]')).forEach(r=>{let n=M(r.querySelector("[data-datatable-filter-option-label]")?.textContent||r.textContent);r.closest("li")?.classList.toggle("datatable-filter-option-search-hidden",s.length>0&&!n.includes(s))})}_handleFilterOptionSearchKeydown(t){if(t.key!=="ArrowDown")return;let e=t.target.closest("[data-datatable-filter-option-search]");if(!e)return;let i=e.dataset.datatableFilterOptionSearch,r=Array.from(this._element.querySelectorAll('[data-datatable-filter-option-key="'.concat(CSS.escape(String(i)),'"]'))).find(n=>!n.closest("li")?.classList.contains("datatable-filter-option-search-hidden"));r&&(t.preventDefault(),r.focus())}_handleFilterToggleClick(t){let e=t.target.closest("[data-datatable-filter-toggle]");if(!e)return;let i=e.dataset.datatableFilterToggle;if(!i||!this._visibleFacets.has(i))return;let s=!this._visibleFacets.get(i);this._visibleFacets.set(i,s),s||(this._facetSelections.get(i)?.clear(),this._currentPage=1,this._trigger("filter")),this._render()}_handleColumnToggleClick(t){let e=t.target.closest("[data-datatable-column-toggle]");if(!e)return;let i=e.dataset.datatableColumnToggle,s=e.getAttribute("aria-pressed")==="true";this._setColumnVisible(i,s,{syncViewToggle:!1})}_handleReset(){let t=this._element.querySelector("[data-datatable-search]");t&&(t.value=""),this._searchTerm="",this._facetSelections.forEach(e=>e.clear()),this._filterMode==="picker"&&this._visibleFacets.forEach((e,i)=>{this._visibleFacets.set(i,!1)}),this._currentPage=1,this._render(),this._trigger("filter")}_handleSelectAll(t){let e=t.target.checked,i=this._visibleRows(),s=(this._currentPage-1)*this._pageSize;i.slice(s,s+this._pageSize).forEach(n=>{e?this._selectedIds.add(n.element.id):this._selectedIds.delete(n.element.id)}),this._render(),this._trigger("select")}_handleSelectRow(t){let e=t.target.closest("[data-datatable-select-row]");if(!e)return;let i=e.closest("[data-datatable-row]"),s=e.closest("[data-datatable-card]"),r=i?.id||s?.dataset.datatableCardFor;r&&(e.checked?this._selectedIds.add(r):this._selectedIds.delete(r),this._render(),this._trigger("select"))}_handleBulkClick(t){if(t.target.closest("[data-datatable-bulk-clear]")){this._clearSelection();return}let e=t.target.closest("[data-datatable-bulk-update]");if(e){let s=e.dataset.datatableBulkUpdate,r=e.dataset.datatableBulkUpdateValue;this._applyBulkUpdate(s,r,e);return}let i=t.target.closest("[data-datatable-bulk-action]");if(i){let s=i.dataset.datatableBulkAction;if(s==="delete"){this._applyBulkDelete();return}this._trigger("bulk-".concat(s),{ids:this.getSelectedIds()})}}_clearSelection(){this._hideBulkTooltips({blur:!0}),this._selectedIds.clear(),this._render(),this._trigger("select")}_applyBulkUpdate(t,e,i){let s=i.querySelector("svg")?.cloneNode(!0),r=i.querySelector("span")?.textContent?.trim()??e;this._selectedIds.forEach(n=>{let o=this._rows.find(g=>g.element.id===n);if(!o)return;o.element.setAttribute("data-datatable-facet-".concat(t),e),o.facets[t]=e;let c=o.element.querySelector('[data-datatable-column="'.concat(CSS.escape(String(t)),'"]'));if(!c)return;let l=c.querySelector("[data-datatable-cell-label]");l?l.textContent=r:c.textContent=r;let h=c.querySelector("svg");h&&s&&h.replaceWith(s.cloneNode(!0));let _=o.cardElement?.querySelector('[data-datatable-detail-column="'.concat(CSS.escape(String(t)),'"] .datatable-card-value'));_&&(_.innerHTML=c.innerHTML)}),this._render(),this._trigger("bulk-update",{key:t,value:e,ids:this.getSelectedIds()})}_applyBulkDelete(){let t=this.getSelectedIds();t.forEach(e=>{let i=this._rows.findIndex(s=>s.element.id===e);i!==-1&&(this._rows[i].element.remove(),this._rows[i].cardElement?.remove(),this._rows.splice(i,1))}),this._selectedIds.clear(),this._render(),this._trigger("bulk-delete",{ids:t})}_handlePageClick(t){let e=t.target.closest("[data-datatable-page-go]");if(e){this._currentPage=Number(e.dataset.datatablePageGo),this._render();return}if(t.target.closest("[data-datatable-page-first]")){this._currentPage=1,this._render();return}if(t.target.closest("[data-datatable-page-prev]")){this._currentPage-=1,this._render();return}if(t.target.closest("[data-datatable-page-next]")){this._currentPage+=1,this._render();return}t.target.closest("[data-datatable-page-last]")&&(this._currentPage=this._pageCount(this._visibleRows().length),this._render())}_setPageSize(t){let e=Number(t);!Number.isFinite(e)||e<=0||(this._pageSize=e,this._element.dataset.datatablePageSize=String(e),this._currentPage=1,this._render())}_bindEvents(){let t=this._element.querySelector("[data-datatable-search]");this._listen(t,"input",s=>{this._searchTerm=M(s.target.value),this._currentPage=1,this._render(),this._trigger("filter")}),this._listen(t,"keydown",s=>{if(s.key!=="Enter")return;s.preventDefault();let r=this._element.querySelector("[data-datatable-filter-menu-trigger]"),n=this._bootstrap("Dropdown");r&&n&&n.getOrCreateInstance(r).hide()}),this._listen(this._element,"click",s=>{this._handleFilterPickerClick(s),this._handleFilterOptionClick(s),this._handleFilterToggleClick(s),this._handleFacetClick(s),this._handleColumnToggleClick(s),this._handlePageClick(s),this._handleBulkClick(s),s.target.closest("[data-datatable-empty-reset]")&&this._handleReset(),s.target.closest("[data-datatable-select-row]")&&this._handleSelectRow(s)}),this._listen(this._document,"click",s=>this._handleSortAction(s)),this._listen(this._window,"keydown",s=>{s.key==="Escape"&&this._selectedIds.size>0&&!he(s)&&this._clearSelection()},{capture:!0}),this._listen(this._element,"show.bs.dropdown",s=>{this._reparentRowActionMenu(s.target),this._reparentSortMenu(s.target);let r=this._bootstrap("Tooltip")?.getInstance(s.target);r?.hide(),r?.disable()}),this._listen(this._element,"hidden.bs.dropdown",s=>{this._restoreRowActionMenuForTrigger(s.target),this._restoreSortMenuForTrigger(s.target),this._bootstrap("Tooltip")?.getInstance(s.target)?.enable(),s.target.matches("[data-datatable-filter-menu-trigger]")&&this._showFilterPickerPanel()}),this._element.querySelectorAll("[data-datatable-filter-option-search]").forEach(s=>{this._listen(s,"input",r=>this._handleFilterOptionSearch(r)),this._listen(s,"keydown",r=>this._handleFilterOptionSearchKeydown(r))}),this._element.querySelectorAll("[data-datatable-facet-search]").forEach(s=>{this._listen(s,"input",r=>this._handleFacetSearch(r)),this._listen(s,"keydown",r=>this._handleFacetSearchKeydown(r))});let e=this._element.querySelector("[data-datatable-reset]");this._listen(e,"click",()=>this._handleReset()),this._element.querySelectorAll("[data-datatable-select-all]").forEach(s=>{this._listen(s,"change",r=>this._handleSelectAll(r))});let i=this._element.querySelector("[data-datatable-page-size-select]");this._listen(i,"change",s=>this._setPageSize(s.target.value)),this._element.querySelectorAll("[data-datatable-page-size-option]").forEach(s=>{this._listen(s,"click",()=>{this._setPageSize(s.dataset.datatablePageSizeOption)})})}};var z=new WeakMap,K=new WeakMap,W=new WeakMap,A="en",Le=1440*60*1e3,de=new Date(2026,7,16),q=8;function Et(a,t){return a?.nodeType===1&&!!a.matches?.(t)}function b(a,t,e,i,s){t&&(t.addEventListener(e,i,s),a.push({target:t,type:e,handler:i,options:s}))}function I(a){a.forEach(({target:t,type:e,handler:i,options:s})=>{t.removeEventListener(e,i,s)}),a.length=0}function m(a){if(!a)return null;if(a instanceof Date)return Number.isNaN(a.getTime())?null:new Date(a.getFullYear(),a.getMonth(),a.getDate());if(typeof a=="number")return m(new Date(a));let t=String(a).trim(),e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t);if(e){let i=new Date(Number(e[1]),Number(e[2])-1,Number(e[3]));return i.getFullYear()===Number(e[1])&&i.getMonth()===Number(e[2])-1&&i.getDate()===Number(e[3])?i:null}return null}function qt(a){return String(a).padStart(2,"0")}function y(a){return"".concat(a.getFullYear(),"-").concat(qt(a.getMonth()+1),"-").concat(qt(a.getDate()))}function v(a,t){return!a||!t?0:a.getTime()-t.getTime()}function T(a,t){return!!(a&&t&&y(a)===y(t))}function x(a,t){return new Date(a.getFullYear(),a.getMonth(),a.getDate()+t)}function Ft(a,t){let e=new Date(a.getFullYear(),a.getMonth()+t,1),i=Math.min(a.getDate(),vt(e.getFullYear(),e.getMonth()));return new Date(e.getFullYear(),e.getMonth(),i)}function ut(a=A){try{if(typeof Intl<"u"&&typeof Intl.Locale=="function"){let t=new Intl.Locale(a||A),e=t.weekInfo||t.getWeekInfo?.();if(Number.isInteger(e?.firstDay))return e.firstDay%7}}catch{}return 0}function ue(a=A){let t=ut(a);return Array.from({length:7},(e,i)=>x(de,(t+i)%7))}function C(a){return new Date(a.getFullYear(),a.getMonth(),1)}function vt(a,t){return new Date(a,t+1,0).getDate()}function Lt(a,t,e){return t&&v(a,t)<0?new Date(t):e&&v(a,e)>0?new Date(e):a}function _e(a){if(Array.isArray(a))return a.map(m).filter(Boolean).map(y);if(!a)return[];let t=String(a).trim();if(!t)return[];try{let e=JSON.parse(t);if(Array.isArray(e))return e.map(m).filter(Boolean).map(y)}catch{}return t.split(",").map(m).filter(Boolean).map(y)}function F(a,t=A){return a?new Intl.DateTimeFormat(t||A,{month:"short",day:"numeric",year:"numeric"}).format(a):""}function Rt(a,t=A){return new Intl.DateTimeFormat(t||A,{month:"long",year:"numeric"}).format(a)}function St(a,t,e=A){if(a)return t==="yyyy-mm-dd"?y(a):t?F(a,e):new Date(a)}function At(a,t={}){let e=a.dataset||{},i=t.locale||e.datepickerLocale||e.calendarLocale||A,s=m(t.minDate||e.calendarMinDate||e.datepickerMinDate),r=m(t.maxDate||e.calendarMaxDate||e.datepickerMaxDate);return{locale:i,mode:t.mode||e.calendarMode||e.datepickerMode||"single",placeholder:t.placeholder||e.datepickerPlaceholder||"Pick a date",value:t.value||e.calendarValue||e.datepickerValue||"",startValue:t.startValue||e.calendarStartValue||e.datepickerStartValue||"",endValue:t.endValue||e.calendarEndValue||e.datepickerEndValue||"",minDate:s,maxDate:r,disabledDates:_e(t.disabledDates||e.calendarDisabledDates||e.datepickerDisabledDates),captionLayout:t.captionLayout||e.calendarCaptionLayout||"",showPresets:t.showPresets??(e.calendarShowPresets==="true"||e.datepickerShowPresets==="true")}}function D(a,t,e,i={},s=!1){return a.dispatchEvent(new t.CustomEvent(e,{bubbles:!0,cancelable:s,detail:i}))}function kt(a){return a?("datepickerFormDefault"in a.dataset||(a.dataset.datepickerFormDefault=a.getAttribute("value")||""),a.dataset.datepickerFormDefault):""}function Dt(a,t){a&&(a.value=t||"")}function $t(a,t){a&&(a.value=t||"")}function Ct(a,t,e){if(e){a.dataset.invalid="true",t.classList.add("is-invalid"),t.setAttribute("aria-invalid","true");return}delete a.dataset.invalid,t.classList.remove("is-invalid"),t.removeAttribute("aria-invalid")}function zt(a,t,e){e?.required&&e.checkValidity()&&Ct(a,t,!1)}function Vt(a,t,e){return e<t?t:Math.min(Math.max(a,t),e)}function fe(a,t,e){let i=a?.ownerDocument?.defaultView||window,s=a?i.getComputedStyle(a).getPropertyValue(t).trim():"",r=Number.parseFloat(s);if(!Number.isFinite(r))return e;if(s.endsWith("rem")){let n=a.ownerDocument.documentElement,o=Number.parseFloat(i.getComputedStyle(n).fontSize);return Number.isFinite(o)?r*o:e}if(s.endsWith("em")){let n=Number.parseFloat(i.getComputedStyle(a).fontSize);return Number.isFinite(n)?r*n:e}return Number.isFinite(r)?r:e}function H(a,t){return!!(t&&(a._element.contains(t)||a._popover.contains(t)))}function Nt(a){let e=E(a._trigger)?.getAttribute("data-bs-theme")||null,i=a._document.defaultView?.getComputedStyle(a._trigger).direction;e?a._popover.setAttribute("data-bs-theme",e):a._popover.removeAttribute("data-bs-theme"),i==="ltr"||i==="rtl"?a._popover.setAttribute("dir",i):a._popover.removeAttribute("dir")}function pe(a){let t=a._popover,e=E(a._trigger),i=P(e)||a._document.body||a._document.documentElement;if(i){if(a._popoverPortal?.portal===i&&t.parentElement===i){Nt(a);return}pt(a),a._popoverPortal={parent:t.parentNode,nextSibling:t.nextSibling,owner:e,portal:i,hadTheme:t.hasAttribute("data-bs-theme"),theme:t.getAttribute("data-bs-theme"),hadDirection:t.hasAttribute("dir"),direction:t.getAttribute("dir")},i.appendChild(t),Nt(a)}}function pt(a){let t=a._popoverPortal;if(!t)return;let e=a._popover;t.owner?.isConnected===!1?e.remove():t.parent?.isConnected?t.nextSibling?.parentNode===t.parent?t.parent.insertBefore(e,t.nextSibling):t.parent.appendChild(e):e.remove(),t.hadTheme?e.setAttribute("data-bs-theme",t.theme):e.removeAttribute("data-bs-theme"),t.hadDirection?e.setAttribute("dir",t.direction):e.removeAttribute("dir"),a._popoverPortal=null}function ge(a,t,e,i){let s=fe(e,"--moo-datepicker-popover-offset",6),r=getComputedStyle(a).direction;t.style.position="fixed",t.style.inset="auto",t.style.right="auto",t.style.bottom="auto",t.style.maxHeight="",t.style.overflowY="";let n=a.getBoundingClientRect(),o=t.getBoundingClientRect(),c=i.innerWidth,l=i.innerHeight,h=r==="rtl"?n.right-o.width:n.left,_=Vt(h,q,c-o.width-q),g=n.bottom+s<=l?l-n.bottom-s-q:0,f=n.top-s-q,p=o.height>g&&f>g,u=p?"top":"bottom",d=Math.max(0,p?f:g),k=Math.min(o.height,d),w=p?n.top-s-k:n.bottom+s;t.style.left="".concat(Math.round(_),"px"),t.style.top="".concat(Math.round(Vt(w,q,l-k-q)),"px"),d>0&&(t.style.maxHeight="".concat(Math.floor(d),"px"),t.style.overflowY="auto"),t.dataset.datepickerPlacement=u}function me(a){a.style.position="",a.style.inset="",a.style.right="",a.style.bottom="",a.style.left="",a.style.top="",a.style.maxHeight="",a.style.overflowY="",delete a.dataset.datepickerPlacement}function Kt(a){I(a._floatingListeners),pe(a);let t=()=>{a.isOpen()&&ge(a._trigger,a._popover,a._element,a._window)};a._positionPopover=t,t(),b(a._floatingListeners,a._window,"resize",t),b(a._floatingListeners,a._window,"scroll",t,!0),b(a._floatingListeners,a._document,"scroll",t,!0)}function _t(a){I(a._floatingListeners),a._positionPopover=null,me(a._popover),pt(a)}function be(a,t){return new Intl.DateTimeFormat(t||A,{month:"short"}).format(new Date(2026,a,1))}function ye(a,t,e){let i=a?a.getFullYear():e.getFullYear()-100,s=t?t.getFullYear():e.getFullYear()+20,r=[];for(let n=i;n<=s;n+=1)r.push(n);return r}function Bt(a,t,e=""){let i=a.createElement("span");return i.className=e,i.setAttribute("aria-hidden","true"),i.textContent=t,i}var L=class a{static getInstance(t){return t?.nodeType===1&&K.get(t)||null}static getOrCreateInstance(t,e={}){return a.getInstance(t)||new a(t,e)}constructor(t,e={}){if(!Et(t,"[data-calendar]"))throw new TypeError("MooCalendar requires a [data-calendar] root element.");let i=K.get(t);if(i)return i;this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView||window,this._listeners=[],this._disposed=!1,this._config=At(t,e),this._mode=this._config.mode==="range"?"range":"single",this._disabledDates=new Set(this._config.disabledDates),this._selectedDate=m(this._config.value),this._rangeStart=m(this._config.startValue),this._rangeEnd=m(this._config.endValue),this._activeDate=this._nearestEnabledDate(this._rangeStart||this._selectedDate||new Date),this._viewDate=C(this._activeDate),this._captionId=this._element.id?"".concat(this._element.id,"-caption"):"moo-calendar-caption-".concat(Math.random().toString(36).slice(2)),this._labelId=this._element.id?"".concat(this._element.id,"-label"):"moo-calendar-label-".concat(Math.random().toString(36).slice(2)),K.set(t,this),this._bindEvents(),this._render()}dispose(){this._disposed||(this._disposed=!0,I(this._listeners),this._element.replaceChildren(),K.get(this._element)===this&&K.delete(this._element))}getDate(t=void 0){return this._mode==="range"?this.getDates(t):St(this._selectedDate,t,this._config.locale)}getDates(t=void 0){return[St(this._rangeStart,t,this._config.locale),St(this._rangeEnd,t,this._config.locale)]}setDate(t,e={}){if(this._mode!=="single")return!1;let i=m(t);return!i||this._isDisabled(i)?!1:(this._selectedDate=i,this._activeDate=i,this._viewDate=C(i),this._render(),e.emit!==!1&&this._emitChange(!0),!0)}setDates(t,e,i={}){if(this._mode!=="range")return!1;let s=m(t),r=m(e);return s&&this._isDisabled(s)||r&&this._isDisabled(r)?!1:(this._rangeStart=s,this._rangeEnd=r,this._rangeStart&&this._rangeEnd&&v(this._rangeStart,this._rangeEnd)>0&&([this._rangeStart,this._rangeEnd]=[this._rangeEnd,this._rangeStart]),this._activeDate=this._rangeEnd||this._rangeStart||this._activeDate,this._viewDate=C(this._activeDate),this._render(),i.emit!==!1&&this._emitChange(!!(this._rangeStart&&this._rangeEnd)),!0)}clear(t={}){this._selectedDate=null,this._rangeStart=null,this._rangeEnd=null,this._render(),t.emit!==!1&&this._emitChange(!1)}focusActiveDay(){this._dayButton(this._activeDate)?.focus()}_bindEvents(){b(this._listeners,this._element,"click",t=>{let e=t.target,i=e.closest?.("[data-calendar-day]"),s=e.closest?.("[data-calendar-prev]"),r=e.closest?.("[data-calendar-next]"),n=e.closest?.("[data-calendar-preset]");s?this._changeMonth(-1,!0):r?this._changeMonth(1,!0):n?this._selectPreset(n.dataset.calendarPreset):i&&this._selectDate(m(i.dataset.calendarDay),!0)}),b(this._listeners,this._element,"keydown",t=>{t.target.closest?.("[data-calendar-day]")&&this._handleDayKeydown(t)}),b(this._listeners,this._element,"change",t=>{t.target.matches?.("[data-calendar-month]")&&this._setActiveMonth(this._viewDate.getFullYear(),Number(t.target.value),!0),t.target.matches?.("[data-calendar-year]")&&this._setActiveMonth(Number(t.target.value),this._viewDate.getMonth(),!0)})}_emitChange(t){D(this._element,this._window,"change.moo.calendar",{date:this._selectedDate?new Date(this._selectedDate):void 0,value:this._selectedDate?y(this._selectedDate):"",startDate:this._rangeStart?new Date(this._rangeStart):void 0,endDate:this._rangeEnd?new Date(this._rangeEnd):void 0,startValue:this._rangeStart?y(this._rangeStart):"",endValue:this._rangeEnd?y(this._rangeEnd):"",complete:t})}_changeMonth(t,e){let i=C(Ft(this._viewDate,t));this._setActiveMonth(i.getFullYear(),i.getMonth(),e)}_setActiveMonth(t,e,i=!1){let s=Math.min(this._activeDate.getDate(),vt(t,e));this._activeDate=this._nearestEnabledDate(new Date(t,e,s)),this._viewDate=C(this._activeDate),this._render(),i&&this.focusActiveDay()}_selectPreset(t){if(!t)return;let e=new Date,i={today:0,tomorrow:1,"in-3-days":3,"in-a-week":7,"in-2-weeks":14};t in i&&this._selectDate(x(e,i[t]),!0)}_handleDayKeydown(t){let e=t.target.closest?.("[data-calendar-day]"),i=m(e?.dataset?.calendarDay);i&&v(i,this._activeDate)!==0&&(this._activeDate=i);let s={ArrowRight:1,ArrowLeft:-1,ArrowDown:7,ArrowUp:-7},r=null,n=!1;if(t.key in s)r=x(this._activeDate,s[t.key]);else if(t.key==="Home"){let c=ut(this._config.locale),l=(this._activeDate.getDay()-c+7)%7;r=x(this._activeDate,-l)}else if(t.key==="End"){let c=ut(this._config.locale),l=(this._activeDate.getDay()-c+7)%7;r=x(this._activeDate,6-l)}else if(t.key==="PageUp"||t.key==="PageDown"){let c=Ft(this._activeDate,t.key==="PageUp"?-1:1),{minDate:l,maxDate:h}=this._config;r=Lt(c,l,h),n=[l,h].some(_=>_&&v(r,_)===0)}else if(t.key==="Enter"||t.key===" "||t.key==="Spacebar"){t.preventDefault(),this._selectDate(this._activeDate,!0);return}else return;t.preventDefault();let o=v(r,this._activeDate)<0;this._setActiveDate(r,!0,o!==n?-1:1)}_setActiveDate(t,e=!1,i=0){let s=i===0?this._nearestEnabledDate(t):this._nextEnabledDate(t,i);this._activeDate=s,this._viewDate=C(s),this._render(),e&&this.focusActiveDay()}_nextEnabledDate(t,e){let i=m(t);if(!i)return this._activeDate;let s=e<0?-1:1;for(let r=0;r<366&&!(this._config.minDate&&v(i,this._config.minDate)<0||this._config.maxDate&&v(i,this._config.maxDate)>0);r+=1){if(!this._isDisabled(i))return i;i=x(i,s)}return this._activeDate}_nearestEnabledDate(t){let e=Lt(m(t)||new Date,this._config.minDate,this._config.maxDate);if(!this._isDisabled(e))return e;let i=C(e),s=vt(i.getFullYear(),i.getMonth());for(let r=1;r<=s;r+=1){let n=new Date(i.getFullYear(),i.getMonth(),r);if(!this._isDisabled(n))return n}return e}_selectDate(t,e){if(!(!t||this._isDisabled(t))){if(this._activeDate=t,this._viewDate=C(t),this._mode==="range"){!this._rangeStart||this._rangeEnd||v(t,this._rangeStart)<0?(this._rangeStart=t,this._rangeEnd=null):this._rangeEnd=t,this._render(),e&&this._emitChange(!!(this._rangeStart&&this._rangeEnd));return}this._selectedDate=t,this._render(),e&&this._emitChange(!0)}}_isDisabled(t){return!t||this._config.minDate&&v(t,this._config.minDate)<0||this._config.maxDate&&v(t,this._config.maxDate)>0?!0:this._disabledDates.has(y(t))}_isSelected(t){return this._mode==="range"?T(t,this._rangeStart)||T(t,this._rangeEnd):T(t,this._selectedDate)}_rangeState(t){return this._mode!=="range"||!this._rangeStart?"":T(t,this._rangeStart)?"start":T(t,this._rangeEnd)?"end":this._rangeStart&&this._rangeEnd&&v(t,this._rangeStart)>0&&v(t,this._rangeEnd)<0?"middle":""}_dayButton(t){return this._element.querySelector('[data-calendar-day="'.concat(y(t),'"]'))}_render(){let t=this._document,e=t.createDocumentFragment(),i=t.createElement("div");i.className="moo-calendar__header";let s=t.createElement("button");s.className="btn btn-ghost btn-icon-sm moo-calendar__nav",s.type="button",s.dataset.calendarPrev="true",s.setAttribute("aria-label","Previous month"),s.appendChild(Bt(t,"\u2039","moo-calendar__nav-icon"));let r=t.createElement("button");r.className="btn btn-ghost btn-icon-sm moo-calendar__nav",r.type="button",r.dataset.calendarNext="true",r.setAttribute("aria-label","Next month"),r.appendChild(Bt(t,"\u203A","moo-calendar__nav-icon"));let n=t.createElement("div");if(n.className="moo-calendar__caption",n.id=this._captionId,n.setAttribute("aria-live","polite"),this._config.captionLayout==="dropdown"){let f=t.createElement("select");f.className="moo-calendar__select",f.dataset.calendarMonth="true",f.setAttribute("aria-label","Month");for(let u=0;u<12;u+=1){let d=t.createElement("option");d.value=String(u),d.textContent=be(u,this._config.locale),d.selected=u===this._viewDate.getMonth(),f.appendChild(d)}let p=t.createElement("select");p.className="moo-calendar__select",p.dataset.calendarYear="true",p.setAttribute("aria-label","Year"),ye(this._config.minDate,this._config.maxDate,this._viewDate).forEach(u=>{let d=t.createElement("option");d.value=String(u),d.textContent=String(u),d.selected=u===this._viewDate.getFullYear(),p.appendChild(d)}),n.append(f,p)}else n.textContent=Rt(this._viewDate,this._config.locale);i.append(s,n,r),e.appendChild(i);let o=t.createElement("div");o.id=this._labelId,o.className="visually-hidden",o.textContent=this._element.getAttribute("aria-label")||Rt(this._viewDate,this._config.locale),e.appendChild(o);let c=t.createElement("div");c.className="moo-calendar__weekdays",c.setAttribute("role","row"),ue(this._config.locale).forEach(f=>{let p=t.createElement("span");p.className="moo-calendar__weekday",p.setAttribute("role","columnheader"),p.textContent=new Intl.DateTimeFormat(this._config.locale,{weekday:"narrow"}).format(f),c.appendChild(p)});let l=t.createElement("div");l.className="moo-calendar__grid",l.setAttribute("role","grid"),l.setAttribute("aria-labelledby",this._labelId),l.appendChild(c);let h=C(this._viewDate),_=ut(this._config.locale),g=x(h,-((h.getDay()-_+7)%7));for(let f=0;f<6;f+=1){let p=t.createElement("div");p.className="moo-calendar__week",p.setAttribute("role","row");for(let u=0;u<7;u+=1){let d=x(g,f*7+u),k=y(d),w=t.createElement("div");w.className="moo-calendar__cell",w.setAttribute("role","gridcell");let S=t.createElement("button");S.className="moo-calendar__day",S.type="button",S.dataset.calendarDay=k,S.textContent=String(d.getDate()),S.tabIndex=T(d,this._activeDate)?0:-1,S.setAttribute("aria-label",F(d,this._config.locale));let Tt=this._isSelected(d);S.dataset.calendarSelected=String(Tt),w.setAttribute("aria-selected",Tt?"true":"false"),d.getMonth()!==this._viewDate.getMonth()&&(S.dataset.calendarOutside="true"),T(d,new Date)&&(S.dataset.calendarToday="true",S.setAttribute("aria-current","date"));let It=this._rangeState(d);It&&(S.dataset.calendarRange=It),this._isDisabled(d)&&(S.disabled=!0,S.setAttribute("aria-disabled","true")),w.appendChild(S),p.appendChild(w)}l.appendChild(p)}if(e.appendChild(l),this._config.showPresets){let f=t.createElement("div");f.className="moo-calendar__presets",[["today","Today"],["tomorrow","Tomorrow"],["in-3-days","In 3 days"],["in-a-week","In a week"],["in-2-weeks","In 2 weeks"]].forEach(([p,u])=>{let d=t.createElement("button");d.className="btn btn-outline-secondary btn-sm moo-calendar__preset",d.type="button",d.dataset.calendarPreset=p,d.textContent=u,f.appendChild(d)}),e.appendChild(f)}this._element.classList.add("moo-calendar"),this._element.dataset.calendar=this._element.dataset.calendar||"",this._element.dataset.calendarMode=this._mode,this._element.dataset.calendarActiveDate=y(this._activeDate),this._mode==="single"&&this._selectedDate?this._element.dataset.calendarValue=y(this._selectedDate):delete this._element.dataset.calendarValue,this._mode==="range"?(this._element.dataset.calendarStartValue=this._rangeStart?y(this._rangeStart):"",this._element.dataset.calendarEndValue=this._rangeEnd?y(this._rangeEnd):""):(delete this._element.dataset.calendarStartValue,delete this._element.dataset.calendarEndValue),this._element.replaceChildren(e)}},Y=class a{static getInstance(t){return t?.nodeType===1&&z.get(t)||null}static getOrCreateInstance(t,e={}){return a.getInstance(t)||new a(t,e)}constructor(t,e={}){if(!Et(t,"[data-datepicker]"))throw new TypeError("MooDatepicker requires a [data-datepicker] root element.");let i=z.get(t);if(i)return i;if(this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView||window,this._listeners=[],this._floatingListeners=[],this._disposed=!1,this._positionPopover=null,this._popoverPortal=null,this._trigger=t.querySelector("[data-datepicker-trigger]"),this._popover=t.querySelector("[data-datepicker-popover]"),this._label=t.querySelector("[data-datepicker-label]"),this._input=t.querySelector("[data-datepicker-input]")||t.querySelector('input[type="hidden"]'),this._validationInput=t.querySelector("[data-datepicker-validation]"),this._calendarRoot=t.querySelector("[data-calendar]"),!this._trigger||!this._popover||!this._label||!this._input||!this._calendarRoot)throw new TypeError("MooDatepicker requires a trigger, popover, calendar, and hidden input.");this._config=At(t,{...e,value:e.value||this._input.value||t.dataset.datepickerValue}),this._placeholder=this._config.placeholder,this._defaultValue=kt(this._input),this.calendar=L.getOrCreateInstance(this._calendarRoot,{...this._config,mode:"single",value:this._input.value||this._config.value}),z.set(t,this),this._syncFromCalendar(),this._bindEvents()}dispose(){this._disposed||(this._disposed=!0,I(this._listeners),this.hide(!1),_t(this),pt(this),I(this._floatingListeners),this.calendar?.dispose(),z.get(this._element)===this&&z.delete(this._element))}show(){this._trigger.disabled||this._element.dataset.datepickerDisabled==="true"||this.isOpen()||D(this._element,this._window,"show.moo.datepicker",{},!0)&&(this._popover.hidden=!1,this._popover.classList.add("show"),Kt(this),this._trigger.setAttribute("aria-expanded","true"),this.calendar.focusActiveDay(),D(this._element,this._window,"shown.moo.datepicker"))}hide(t=!0){this.isOpen()&&D(this._element,this._window,"hide.moo.datepicker",{},!0)&&(this._popover.hidden=!0,this._popover.classList.remove("show"),_t(this),this._trigger.setAttribute("aria-expanded","false"),t&&this._trigger.focus({preventScroll:!0}),D(this._element,this._window,"hidden.moo.datepicker"))}toggle(){this.isOpen()?this.hide():this.show()}isOpen(){return!this._popover.hidden}getDate(t=void 0){return this.calendar.getDate(t)}setDate(t,e={}){let i=this.calendar.setDate(t,{emit:!1});return i&&(this._syncFromCalendar(),e.emit!==!1&&this._emitChange()),i}clear(t={}){this.calendar.clear({emit:!1}),this._syncFromCalendar(),t.emit!==!1&&this._emitChange()}_bindEvents(){b(this._listeners,this._trigger,"click",()=>this.toggle()),b(this._listeners,this._popover,"keydown",e=>{e.key==="Escape"&&(e.preventDefault(),this.hide())}),b(this._listeners,this._document,"pointerdown",e=>{this.isOpen()&&!H(this,e.target)&&this._window.setTimeout(()=>{this.isOpen()&&!H(this,e.target)&&this.hide()},0)}),b(this._listeners,this._calendarRoot,"change.moo.calendar",e=>{this._syncFromCalendar(),this._emitChange(),e.detail.complete&&this.hide()});let t=this._input.form||this._element.closest("form");b(this._listeners,this._validationInput,"invalid",e=>{e.preventDefault(),Ct(this._element,this._trigger,!0),this._trigger.focus({preventScroll:!0})}),b(this._listeners,t,"reset",()=>{this._window.setTimeout(()=>{this._defaultValue?this.setDate(this._defaultValue,{emit:!1}):this.clear({emit:!1})},0)})}_syncFromCalendar(){let t=this.calendar.getDate("yyyy-mm-dd")||"";Dt(this._input,t),$t(this._validationInput,t),zt(this._element,this._trigger,this._validationInput),this._element.dataset.datepickerValue=t,this._label.dataset.datepickerEmpty=t?"false":"true",this._label.textContent=t?F(m(t),this._config.locale):this._placeholder}_emitChange(){D(this._element,this._window,"change.moo.datepicker",{date:this.getDate(),value:this.getDate("yyyy-mm-dd")||""})}},ft=class a{static getInstance(t){return t?.nodeType===1&&W.get(t)||null}static getOrCreateInstance(t,e={}){return a.getInstance(t)||new a(t,e)}constructor(t,e={}){if(!Et(t,"[data-datepicker-range]"))throw new TypeError("MooDateRangePicker requires a [data-datepicker-range] root element.");let i=W.get(t);if(i)return i;if(this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView||window,this._listeners=[],this._floatingListeners=[],this._disposed=!1,this._positionPopover=null,this._popoverPortal=null,this._trigger=t.querySelector("[data-datepicker-trigger]"),this._popover=t.querySelector("[data-datepicker-popover]"),this._label=t.querySelector("[data-datepicker-label]"),this._startInput=t.querySelector("[data-datepicker-range-start]"),this._endInput=t.querySelector("[data-datepicker-range-end]"),this._validationInput=t.querySelector("[data-datepicker-validation]"),this._calendarRoot=t.querySelector("[data-calendar]"),!this._trigger||!this._popover||!this._label||!this._startInput||!this._endInput||!this._calendarRoot)throw new TypeError("MooDateRangePicker requires a trigger, popover, calendar, and start/end hidden inputs.");this._config=At(t,{...e,mode:"range",startValue:e.startValue||this._startInput.value||t.dataset.datepickerStartValue,endValue:e.endValue||this._endInput.value||t.dataset.datepickerEndValue}),this._placeholder=this._config.placeholder,this._defaultStartValue=kt(this._startInput),this._defaultEndValue=kt(this._endInput),this.calendar=L.getOrCreateInstance(this._calendarRoot,this._config),W.set(t,this),this._syncFromCalendar(),this._bindEvents()}dispose(){this._disposed||(this._disposed=!0,I(this._listeners),this.hide(!1),_t(this),pt(this),I(this._floatingListeners),this.calendar?.dispose(),W.get(this._element)===this&&W.delete(this._element))}show(){this._trigger.disabled||this._element.dataset.datepickerDisabled==="true"||this.isOpen()||D(this._element,this._window,"show.moo.datepicker",{},!0)&&(this._popover.hidden=!1,this._popover.classList.add("show"),Kt(this),this._trigger.setAttribute("aria-expanded","true"),this.calendar.focusActiveDay(),D(this._element,this._window,"shown.moo.datepicker"))}hide(t=!0){this.isOpen()&&D(this._element,this._window,"hide.moo.datepicker",{},!0)&&(this._popover.hidden=!0,this._popover.classList.remove("show"),_t(this),this._trigger.setAttribute("aria-expanded","false"),t&&this._trigger.focus({preventScroll:!0}),D(this._element,this._window,"hidden.moo.datepicker"))}toggle(){this.isOpen()?this.hide():this.show()}isOpen(){return!this._popover.hidden}getDates(t=void 0){return this.calendar.getDates(t)}setDates(t,e,i={}){let s=this.calendar.setDates(t,e,{emit:!1});return s&&(this._syncFromCalendar(),i.emit!==!1&&this._emitChange()),s}clear(t={}){this.calendar.clear({emit:!1}),this._syncFromCalendar(),t.emit!==!1&&this._emitChange()}_bindEvents(){b(this._listeners,this._trigger,"click",()=>this.toggle()),b(this._listeners,this._popover,"keydown",i=>{i.key==="Escape"&&(i.preventDefault(),this.hide())}),b(this._listeners,this._document,"pointerdown",i=>{this.isOpen()&&!H(this,i.target)&&this._window.setTimeout(()=>{this.isOpen()&&!H(this,i.target)&&this.hide()},0)});let t=()=>{this._window.setTimeout(()=>{this.isOpen()&&!H(this,this._document.activeElement)&&this.hide(!1)},0)};b(this._listeners,this._element,"focusout",t),b(this._listeners,this._popover,"focusout",t),b(this._listeners,this._calendarRoot,"change.moo.calendar",i=>{this._syncFromCalendar(),this._emitChange(),i.detail.complete?this.hide():this.calendar.focusActiveDay()});let e=this._startInput.form||this._element.closest("form");b(this._listeners,this._validationInput,"invalid",i=>{i.preventDefault(),Ct(this._element,this._trigger,!0),this._trigger.focus({preventScroll:!0})}),b(this._listeners,e,"reset",()=>{this._window.setTimeout(()=>{this.setDates(this._defaultStartValue,this._defaultEndValue,{emit:!1})},0)})}_syncFromCalendar(){let[t="",e=""]=this.calendar.getDates("yyyy-mm-dd");Dt(this._startInput,t||""),Dt(this._endInput,e||""),$t(this._validationInput,t&&e?"".concat(t," - ").concat(e):""),zt(this._element,this._trigger,this._validationInput),this._element.dataset.datepickerStartValue=t||"",this._element.dataset.datepickerEndValue=e||"",this._label.dataset.datepickerEmpty=t?"false":"true",t&&e?this._label.textContent="".concat(F(m(t),this._config.locale)," - ").concat(F(m(e),this._config.locale)):t?this._label.textContent=F(m(t),this._config.locale):this._label.textContent=this._placeholder}_emitChange(){let[t,e]=this.getDates(),[i="",s=""]=this.getDates("yyyy-mm-dd");D(this._element,this._window,"change.moo.datepicker",{startDate:t,endDate:e,startValue:i,endValue:s})}};var gt=new WeakMap,we="a[href], button, input, select, textarea, [tabindex]";function Wt(a){let t=a.ownerDocument.defaultView;return[...a.querySelectorAll(we)].filter(e=>!e.matches(":disabled")&&e.tabIndex>=0&&!e.closest("[hidden], [inert]")&&e.getClientRects().length>0&&t.getComputedStyle(e).visibility==="visible")}var U=class a{static getInstance(t){return t?.nodeType===1&&gt.get(t)||null}static getOrCreateInstance(t,e={}){return a.getInstance(t)||new a(t,e)}constructor(t,e={}){if(t?.nodeType!==1||!t.matches('[data-slot="sidebar-wrapper"]'))throw new TypeError("Sidebar requires a [data-slot=sidebar-wrapper] root.");let i=gt.get(t);if(i)return i;this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView,this._documentElement=this._document.documentElement,this._root=E(t)||this._document.body||this._documentElement,this._sidebar=t.querySelector('[data-slot="sidebar"]'),this._config={breakpoint:"(min-width: 992px)",storagePrefix:"moo-sidebar:",keyboard:!0,...e},this._listeners=[],this._tooltipAnchors=new Set,this._flyout=null,this._flyoutOwner=null,this._offcanvas=null,this._offcanvasTrigger=null,gt.set(t,this),this._bindEvents(),this._restoreState(),this._scrollActiveItemIntoView(),this._element.setAttribute("data-sidebar-ready",""),this._observeDirection()}dispose(){this._listeners.forEach(({target:t,type:e,handler:i,options:s})=>{t.removeEventListener(e,i,s)}),this._listeners=[],this._directionObserver?.disconnect(),this._closeFlyouts(),this._element.querySelectorAll("[data-sidebar-dropdown-positioned]").forEach(t=>this._clearDropdownPosition(t)),this._element.querySelectorAll("[data-sidebar-tooltip]").forEach(t=>this._disposeTooltip(t)),this._offcanvas?.dispose(),this._offcanvas=null,this._offcanvasTrigger=null,this._element.removeAttribute("data-sidebar-ready"),gt.delete(this._element)}_listen(t,e,i,s){t?.addEventListener(e,i,s),t&&this._listeners.push({target:t,type:e,handler:i,options:s})}_bootstrap(t){return this._window.bootstrap?.[t]||null}_portalRoot(t=this._element){return P(E(t))||this._document.body||this._documentElement}_isDesktop(){return this._window.matchMedia(this._config.breakpoint).matches}_isCollapsed(){return this._isDesktop()&&this._sidebar?.dataset?.collapsible==="icon"&&this._element.dataset.sidebarState==="collapsed"}_trigger(t,e={}){return this._element.dispatchEvent(new this._window.CustomEvent("".concat(t,".moo.sidebar"),{bubbles:!0,cancelable:t==="show"||t==="hide",detail:e}))}_observeDirection(){let t=this._window.MutationObserver;t&&(this._directionObserver=new t(()=>{this._closeFlyouts(),this._syncTooltips()}),this._directionObserver.observe(this._documentElement,{attributes:!0,attributeFilter:["dir"]}))}_restoreState(){let t=this._element.dataset.sidebarKey,e=null;if(t)try{e=this._window.localStorage.getItem(this._config.storagePrefix+t)}catch{e=null}let i=e==="collapsed"||e==="expanded"?e:this._element.dataset.sidebarState==="collapsed"?"collapsed":"expanded";this._setState(i,!1,!1)}_scrollActiveItemIntoView(){let e=this._element.querySelector('[data-slot="sidebar-content"] a[data-slot="sidebar-menu-button"][aria-current="page"], [data-slot="sidebar-content"] a.sidebar-menu-button[aria-current="page"], [data-slot="sidebar-content"] a.sidebar-menu-button.active')||this._element.querySelector('[data-slot="sidebar-content"] [data-slot="sidebar-menu-button"][aria-current="page"], [data-slot="sidebar-content"] .sidebar-menu-button[aria-current="page"], [data-slot="sidebar-content"] .sidebar-menu-button.active'),i=e?.closest?.('[data-slot="sidebar-content"]');if(!e||!i||i.clientHeight<=0)return;let s=i.scrollHeight-i.clientHeight;if(s<=0)return;let r=i.getBoundingClientRect(),n=e.getBoundingClientRect();if(r.height<=0||n.height<=0)return;let o=i.scrollTop+n.top-r.top-(i.clientHeight-n.height)/2;i.scrollTop=Math.round(Math.min(Math.max(o,0),s))}_setState(t,e=!0,i=!0){let s=t==="collapsed"?"collapsed":"expanded",r=this._element.dataset.sidebarState;this._element.dataset.sidebarState=s;let n=this._element.dataset.sidebarKey;if(n==="catalog-shell"&&(this._root.dataset.sidebarCatalogState=s),e&&n)try{this._window.localStorage.setItem(this._config.storagePrefix+n,s)}catch{}this._syncControls(),s==="expanded"&&this._element.querySelectorAll(".sidebar-menu-item").forEach(o=>this._resetFlyoutTrigger(o)),this._syncTooltips(),i&&r!==s&&this._trigger("change",{state:s,previousState:r||null})}_toggle(){this._setState(this._element.dataset.sidebarState==="collapsed"?"expanded":"collapsed")}_syncControls(){let t=this._isDesktop()?this._element.dataset.sidebarState==="expanded":this._sidebar?.classList.contains("show")||!1;this._element.querySelectorAll("[data-sidebar-trigger], [data-sidebar-rail]").forEach(e=>e.setAttribute("aria-expanded",String(t)))}_resetFlyoutTrigger(t,e=null){let i=t?.querySelector(":scope > .sidebar-menu-sub-trigger"),s=t?.querySelector(":scope > .sidebar-menu-sub");i&&s&&i.setAttribute("aria-expanded",String(e??s.classList.contains("show")))}_clearDropdownPosition(t){let e=t?.matches?.(".sidebar-menu-item")?t:t?.closest?.(".sidebar-menu-item");e&&(delete e.dataset.sidebarDropdownPositioned,e.style.removeProperty("--moo-sidebar-dropdown-block-start"),e.style.removeProperty("--moo-sidebar-dropdown-block-end"),e.style.removeProperty("--moo-sidebar-dropdown-left"),e.style.removeProperty("--moo-sidebar-dropdown-right"))}_closeDropdowns(t=null){let e=this._bootstrap("Dropdown");this._element.querySelectorAll('[data-bs-toggle="dropdown"][aria-expanded="true"]').forEach(i=>{i!==t&&(e?e.getOrCreateInstance(i).hide():(i.setAttribute("aria-expanded","false"),i.closest(".dropdown")?.querySelector(".dropdown-menu.show")?.classList.remove("show"),this._clearDropdownPosition(i)))})}_positionDropdown(t){let e=t?.closest?.(".sidebar-menu-item"),i=t?.classList.contains("sidebar-menu-button--workspace")&&t.closest('[data-slot="sidebar-header"]'),s=t?.closest(".sidebar-menu-item--account")&&t.closest('[data-slot="sidebar-footer"]');if(!t||!e||!(i||s)||!this._isDesktop()){this._clearDropdownPosition(t);return}this._closeFlyouts();let r=t.getBoundingClientRect(),n=4;if((t.closest('[data-slot="sidebar"]')?.dataset.side||"left")==="right"){let l=this._window.innerWidth-r.left+n;e.style.setProperty("--moo-sidebar-dropdown-right","".concat(Math.round(l),"px")),e.style.removeProperty("--moo-sidebar-dropdown-left")}else{let l=r.right+n;e.style.setProperty("--moo-sidebar-dropdown-left","".concat(Math.round(l),"px")),e.style.removeProperty("--moo-sidebar-dropdown-right")}i?(e.style.setProperty("--moo-sidebar-dropdown-block-start","".concat(Math.round(r.bottom+n),"px")),e.style.removeProperty("--moo-sidebar-dropdown-block-end")):(e.style.setProperty("--moo-sidebar-dropdown-block-end","".concat(Math.round(this._window.innerHeight-r.top+n),"px")),e.style.removeProperty("--moo-sidebar-dropdown-block-start")),e.dataset.sidebarDropdownPositioned=""}_removeFlyoutPortal(){this._flyout?.remove(),this._flyoutOwner&&this._resetFlyoutTrigger(this._flyoutOwner,!1),this._flyout=null,this._flyoutOwner=null}_closeFlyouts(){this._removeFlyoutPortal(),this._element.querySelectorAll(".sidebar-menu-item--flyout-open").forEach(t=>{t.classList.remove("sidebar-menu-item--flyout-open"),t.style.removeProperty("--moo-sidebar-flyout-block-start"),t.style.removeProperty("--moo-sidebar-flyout-left"),this._resetFlyoutTrigger(t,!1)})}_openFlyout(t){let e=t?.querySelector(":scope > .sidebar-menu-sub"),i=t?.querySelector(":scope > .sidebar-menu-sub-trigger");if(!t||!e||!this._isCollapsed()||this._flyoutOwner===t&&this._flyout)return;this._closeDropdowns(),this._closeFlyouts();let s=t.getBoundingClientRect(),r=this._sidebar,n=r?.getBoundingClientRect()||s,o=4,c=e.cloneNode(!0);c.removeAttribute("id"),c.classList.remove("collapse","show","collapsing"),c.classList.add("sidebar-menu-flyout"),c.dataset.sidebarFlyout="",c.removeAttribute("style"),c.style.setProperty("--moo-sidebar-flyout-block-start","".concat(Math.round(s.top),"px"));let l=r?.dataset.side||"left";this._portalRoot(t).appendChild(c);let h=c.getBoundingClientRect().width,_=l==="right"?n.left-h-o:n.right+o,g=Math.max(0,Math.min(this._window.innerWidth-h,_));c.style.setProperty("--moo-sidebar-flyout-left","".concat(Math.round(g),"px")),this._flyout=c,this._flyoutOwner=t,t.classList.add("sidebar-menu-item--flyout-open"),i?.setAttribute("aria-expanded","true")}_tooltipAnchor(t){return t.closest("li")||t}_isIdentityTrigger(t){return t.closest(".sidebar-menu-item--account")||t.classList.contains("sidebar-menu-button--workspace")}_disposeTooltip(t){let e=this._bootstrap("Tooltip");if(!e||!t)return;let i=this._tooltipAnchor(t);e.getInstance(i)?.dispose(),this._tooltipAnchors.delete(i),i.removeAttribute("title"),i.removeAttribute("data-bs-title"),i.removeAttribute("data-bs-original-title"),i.removeAttribute("aria-describedby")}_syncTooltips(){let t=this._bootstrap("Tooltip");if(!t)return;let e=this._isCollapsed(),s=(this._sidebar?.dataset.side||"left")==="right"?"left":"right";this._element.querySelectorAll("[data-sidebar-tooltip]").forEach(r=>{if(this._disposeTooltip(r),!e||this._isIdentityTrigger(r)||r.closest(".sidebar-menu-item")?.querySelector(":scope > .sidebar-menu-sub"))return;let n=this._tooltipAnchor(r);new t(n,{title:r.getAttribute("data-sidebar-tooltip"),placement:s,offset:[0,8],container:this._portalRoot(r),trigger:"hover focus"}),this._tooltipAnchors.add(n)})}_bindEvents(){this._listen(this._sidebar,"shown.bs.offcanvas",()=>this._syncControls()),this._listen(this._sidebar,"hidden.bs.offcanvas",()=>{this._syncControls();let t=this._offcanvasTrigger;this._offcanvasTrigger=null,t?.isConnected&&t.focus()}),this._listen(this._document,"show.bs.dropdown",t=>{let e=this._dropdownControl(t.target);e&&(this._closeDropdowns(e),this._disposeTooltip(e),this._positionDropdown(e))}),this._listen(this._document,"hidden.bs.dropdown",t=>{let e=this._dropdownControl(t.target);e&&(this._clearDropdownPosition(e),this._syncTooltips())}),this._listen(this._element,"click",t=>this._handleControlClick(t)),this._listen(this._window,"click",t=>this._handleSubmenuClick(t),!0),this._listen(this._document,"click",t=>this._handleOutsideFlyoutClick(t)),this._listen(this._document,"keydown",t=>this._handleShortcut(t)),this._listen(this._window,"resize",()=>{this._closeFlyouts(),this._element.querySelectorAll("[data-sidebar-dropdown-positioned]").forEach(t=>this._clearDropdownPosition(t)),this._syncControls(),this._syncTooltips()})}_dropdownControl(t){return!(t instanceof this._window.Element)||!this._element.contains(t)?null:t.matches('[data-bs-toggle="dropdown"][data-sidebar-tooltip]')?t:t.querySelector?.('[data-bs-toggle="dropdown"][data-sidebar-tooltip]')||null}_handleControlClick(t){let e=t.target,i=e instanceof this._window.Element?e.closest("[data-sidebar-trigger], [data-sidebar-rail]"):null;if(!i||!this._element.contains(i))return;if(this._isDesktop()){t.preventDefault(),this._closeFlyouts(),this._toggle();return}if(!i.matches("[data-sidebar-trigger]"))return;let s=this._document.getElementById(i.getAttribute("aria-controls")),r=this._bootstrap("Offcanvas");s&&r&&(this._offcanvasTrigger=i,this._offcanvas=r.getOrCreateInstance(s),this._offcanvas.toggle())}_handleSubmenuClick(t){let e=t.target,i=e instanceof this._window.Element?e.closest(".sidebar-menu-sub-trigger"):null,s=i?.closest(".sidebar-menu-item");!i||!s||!this._element.contains(s)||!this._isCollapsed()||(t.preventDefault(),t.stopImmediatePropagation(),this._flyoutOwner===s&&this._flyout?this._closeFlyouts():(this._openFlyout(s),t.detail===0&&this._flyout&&Wt(this._flyout)[0]?.focus()))}_handleFlyoutKeydown(t){let e=this._flyoutOwner;if(t.defaultPrevented||!this._flyout||!e||!(t.key==="Escape"||t.key==="Tab")||!this._flyout.contains(t.target)&&!(t.key==="Escape"&&e.contains(t.target)))return!1;if(t.key==="Tab"){let r=Wt(this._flyout),n=t.shiftKey?r[0]:r[r.length-1];if(n&&t.target!==n)return!1}t.preventDefault();let s=e.querySelector(":scope > .sidebar-menu-sub-trigger");return this._closeFlyouts(),s?.focus(),!0}_handleOutsideFlyoutClick(t){this._flyout&&(this._flyout.contains(t.target)?this._closeFlyouts():this._flyoutOwner?.contains(t.target)||this._closeFlyouts())}_handleShortcut(t){if(this._handleFlyoutKeydown(t))return;let e=t.target,i=e instanceof this._window.Element&&(e.matches("input, textarea, select")||e.isContentEditable);t.defaultPrevented||t.isComposing||i||!this._config.keyboard||!(t.metaKey||t.ctrlKey)||t.key.toLowerCase()!=="b"||!this._isDesktop()||(this._document.querySelector('[data-slot="sidebar-wrapper"][data-sidebar-key]')||this._document.querySelector('[data-slot="sidebar-wrapper"]'))!==this._element||(t.preventDefault(),this._closeFlyouts(),this._toggle())}};var G=new WeakMap;function J(a,t){let e=Number(a);return Number.isFinite(e)?e:t}function V(a){return J(a.min,0)}function X(a){return J(a.max,100)}function Se(a){if(!a.step||a.step==="any")return 1;let t=Number(a.step);return Number.isFinite(t)&&t>0?t:1}function R(a,t,e){return Math.min(Math.max(a,t),e)}function Ht(a){let t=String(a);return t.includes(".")?t.split(".").at(-1).length:0}function ve(a,t){let e=V(t),i=X(t);if(t.step==="any")return Number(R(a,e,i).toFixed(4));let s=Se(t),r=e+Math.round((a-e)/s)*s,n=Math.max(Ht(s),Ht(e));return R(Number(r.toFixed(n)),e,i)}function j(a){let t=V(a),e=X(a);return e<=t?0:(J(a.value,t)-t)/(e-t)*100}function mt(a){return a.value||String(V(a))}var Z=class a{static getInstance(t){return t?.nodeType===1&&G.get(t)||null}static getOrCreateInstance(t,e={}){return a.getInstance(t)||new a(t,e)}constructor(t,e={}){if(t?.nodeType!==1||!t.matches("[data-slider]"))throw new TypeError("MooSlider requires a [data-slider] root element.");let i=G.get(t);if(i)return i;if(this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView,this._config={...e},this._listeners=[],this._dragListeners=[],this._draggingInput=null,this._disposed=!1,this._inputs=Array.from(t.querySelectorAll(':scope input[type="range"][data-slider-input]')),this._track=t.querySelector("[data-slider-track]"),this._output=t.querySelector("[data-slider-output]"),this._inputs.length<1||this._inputs.length>2)throw new TypeError("MooSlider requires one or two native range inputs.");if(!this._track)throw new TypeError("MooSlider requires a [data-slider-track] element.");G.set(t,this),this._bindEvents(),this._sync()}dispose(){this._disposed||(this._disposed=!0,this._clearDragListeners(),this._clearPointerFocus(),this._listeners.forEach(({target:t,type:e,handler:i,options:s})=>{t.removeEventListener(e,i,s)}),this._listeners=[],G.get(this._element)===this&&G.delete(this._element))}_listen(t,e,i,s){t&&(t.addEventListener(e,i,s),this._listeners.push({target:t,type:e,handler:i,options:s}))}_listenDuringDrag(t,e,i,s){t&&(t.addEventListener(e,i,s),this._dragListeners.push({target:t,type:e,handler:i,options:s}))}_clearDragListeners(){this._dragListeners.forEach(({target:t,type:e,handler:i,options:s})=>{t.removeEventListener(e,i,s)}),this._dragListeners=[],this._draggingInput=null,this._element.removeAttribute("data-slider-dragging")}_bindEvents(){this._inputs.forEach(e=>{this._listen(e,"input",()=>this._sync(e)),this._listen(e,"change",()=>{this._sync(e),this._trigger("change")}),this._listen(e,"keydown",()=>this._clearPointerFocus()),this._listen(e,"focusout",()=>this._clearPointerFocus())}),new Set(this._inputs.map(e=>e.form||e.closest?.("form")).filter(Boolean)).forEach(e=>{this._listen(e,"reset",()=>{this._window.setTimeout(()=>this._sync(),0)})}),this._listen(this._track,"pointerdown",e=>this._handleTrackPointer(e))}_trigger(t){this._element.dispatchEvent(new this._window.CustomEvent("".concat(t,".moo.slider"),{bubbles:!0}))}_isRange(){return this._inputs.length===2}_sync(t=null){if(this._isRange()){let[i,s]=this._inputs,r=J(i.value,V(i)),n=J(s.value,X(s));r>n&&(t===s?s.value=i.value:i.value=s.value),this._writeFill(j(i),j(s)),this._writeOutput("".concat(mt(i)," - ").concat(mt(s))),this._syncAria(i),this._syncAria(s);return}let e=this._inputs[0];this._writeFill(0,j(e)),this._writeOutput(mt(e)),this._syncAria(e)}_syncAria(t){t.setAttribute("aria-valuemin",String(V(t))),t.setAttribute("aria-valuemax",String(X(t))),t.setAttribute("aria-valuenow",mt(t))}_writeFill(t,e){let i=R(t,0,100),s=R(e,0,100);this._element.style.setProperty("--moo-slider-start","".concat(Math.min(i,s),"%")),this._element.style.setProperty("--moo-slider-end","".concat(Math.max(i,s),"%"))}_writeOutput(t){this._output&&(this._output.textContent=t)}_handleTrackPointer(t){if(t.button!==void 0&&t.button!==0)return;let e=this._inputs.filter(r=>!r.disabled);if(!e.length)return;t.preventDefault?.();let i=this._pointerPercent(t),s=this._nearestInput(i*100,e);this._setPointerFocus(),this._startDrag(s,t),this._setInputFromPointer(s,t)}_setPointerFocus(){this._element.setAttribute("data-slider-pointer-focus","true")}_clearPointerFocus(){this._element.removeAttribute("data-slider-pointer-focus")}_startDrag(t,e){this._clearDragListeners(),this._draggingInput=t,this._element.setAttribute("data-slider-dragging","true"),this._track.setPointerCapture?.(e.pointerId);let i=e.pointerId,s=o=>i===void 0||o.pointerId===i,r=o=>{!s(o)||this._draggingInput!==t||(o.preventDefault?.(),this._setInputFromPointer(t,o))},n=o=>{!s(o)||this._draggingInput!==t||(o.preventDefault?.(),this._setInputFromPointer(t,o,!1),t.dispatchEvent(new this._window.Event("change",{bubbles:!0})),this._track.releasePointerCapture?.(i),this._clearDragListeners())};this._listenDuringDrag(this._document,"pointermove",r),this._listenDuringDrag(this._document,"pointerup",n),this._listenDuringDrag(this._document,"pointercancel",n)}_setInputFromPointer(t,e,i=!0){let s=this._pointerPercent(e),r=V(t),n=X(t);t.value=String(ve(r+s*(n-r),t)),t.focus({preventScroll:!0}),this._sync(t),i&&t.dispatchEvent(new this._window.Event("input",{bubbles:!0}))}_pointerPercent(t){let e=this._track.getBoundingClientRect();return(this._element.dataset.sliderOrientation||"horizontal")==="vertical"?R((e.bottom-t.clientY)/(e.height||1),0,1):this._horizontalPointerPercent(t,e)}_horizontalPointerPercent(t,e){let s=this._window.getComputedStyle?.(this._element).direction==="rtl"?e.right-t.clientX:t.clientX-e.left;return R(s/(e.width||1),0,1)}_nearestInput(t,e){if(e.length===1)return e[0];let[i,s]=e,r=j(i),n=j(s),o=Math.abs(r-t),c=Math.abs(n-t);return o===c?t>=r?s:i:c<o?s:i}};var Q=new WeakMap,xt='.moo-ui[data-bs-theme="light"], .moo-ui[data-bs-theme="dark"]';function Yt(a,t=0){if(!a||typeof a!="object"||Array.isArray(a))throw new TypeError("TableOfContents options must be an object.");let e=a.activationOffset===void 0?t:a.activationOffset;if(typeof e!="number"||!Number.isFinite(e)||e<0)throw new TypeError("TableOfContents activationOffset must be a finite nonnegative number.");return e}function Ut(a){if(!a?.startsWith("#")||a.length===1)return null;try{return decodeURIComponent(a.slice(1))}catch{return null}}var tt=class a{static getInstance(t){return t?.nodeType===1&&Q.get(t)||null}static getOrCreateInstance(t,e={}){return a.getInstance(t)||new a(t,e)}constructor(t,e={}){if(t?.nodeType!==1||!t.matches("[data-toc]"))throw new TypeError("TableOfContents requires a [data-toc] root element.");let i=Q.get(t);if(i)return i;this._element=t,this._document=t.ownerDocument,this._window=this._document.defaultView,this._offset=Yt(e),this._listeners=[],this._originalLinks=new Map,this._originalStatus=new Map,this._originalMarker={attribute:t.getAttribute("data-toc-marker"),properties:["--moo-toc-marker-offset","--moo-toc-marker-height"].map(s=>({name:s,value:t.style.getPropertyValue(s),priority:t.style.getPropertyPriority(s)}))},this._links=[],this._targets=[],this._frame=0,this._disposed=!1,Q.set(t,this),this.refresh()}refresh(t={}){if(this._disposed)return this;let e=Yt(t,this._offset);this._clearListeners(),this._offset=e;let i=this._element.closest(xt),s=this._element.getAttribute("data-toc-content"),r=s?this._document.getElementById(s):i,n=this._element.getAttribute("data-toc-scroll-root");if(this._scrollElement=n?this._document.getElementById(n):null,this._status=Array.from(this._element.querySelectorAll("[data-toc-current]")).find(l=>l.closest("[data-toc]")===this._element)||null,this._status&&!this._originalStatus.has(this._status)&&this._originalStatus.set(this._status,this._status.textContent),this._overview=this._status?this._originalStatus.get(this._status):"",this._links=Array.from(this._element.querySelectorAll('a[href^="#"]')).filter(l=>l.closest("[data-toc]")===this._element).map(l=>({link:l,id:Ut(l.getAttribute("href"))})),this._links.forEach(({link:l})=>{this._originalLinks.has(l)||this._originalLinks.set(l,{active:l.classList.contains("active"),current:l.getAttribute("aria-current")})}),this._targets=[],this._activate(null),!i||!r||r.closest(xt)!==i||n&&(!this._scrollElement||!this._scrollElement.contains(r)))return this;let o=new Set;if(this._links.forEach(({id:l,link:h})=>{let _=l?this._document.getElementById(l):null;!_||o.has(l)||!r.contains(_)||_.closest(xt)!==i||(o.add(l),this._targets.push({id:l,target:_,label:h.textContent.trim()}))}),!this._targets.length)return this;let c=()=>this._requestUpdate();return this._listen(this._scrollElement||this._window,"scroll",c,{passive:!0}),this._listen(this._window,"resize",c),this._listen(this._window,"hashchange",c),this._listen(this._element,"click",c),this._update(),this}dispose(){if(this._disposed)return;this._disposed=!0,this._clearListeners(),this._originalLinks.forEach(({active:i,current:s},r)=>{r.classList.toggle("active",i),s===null?r.removeAttribute("aria-current"):r.setAttribute("aria-current",s)}),this._originalStatus.forEach((i,s)=>{s.textContent=i});let{attribute:t,properties:e}=this._originalMarker;t===null?this._element.removeAttribute("data-toc-marker"):this._element.setAttribute("data-toc-marker",t),e.forEach(({name:i,value:s,priority:r})=>{s?this._element.style.setProperty(i,s,r):this._element.style.removeProperty(i)}),this._originalLinks.clear(),this._originalStatus.clear(),this._targets=[],this._links=[],Q.get(this._element)===this&&Q.delete(this._element)}_listen(t,e,i,s){t.addEventListener(e,i,s),this._listeners.push({target:t,type:e,handler:i,options:s})}_clearListeners(){this._listeners.forEach(({target:t,type:e,handler:i,options:s})=>t.removeEventListener(e,i,s)),this._listeners=[],this._frame&&this._window.cancelAnimationFrame(this._frame),this._frame=0}_requestUpdate(){this._disposed||this._frame||(this._frame=this._window.requestAnimationFrame(()=>{this._frame=0,this._update()}))}_update(){if(this._disposed)return;let t=this._targets.filter(({target:n})=>n.isConnected&&n.getClientRects().length>0),e=this._scrollElement||this._document.scrollingElement,i=(this._scrollElement?this._scrollElement.getBoundingClientRect().top+this._scrollElement.clientTop:0)+this._offset,s=null;t.forEach(n=>{n.target.getBoundingClientRect().top<=i+1&&(s=n)});let r=e&&e.scrollHeight>e.clientHeight+1;if(!r){let n=Ut(this._window.location.hash);s=t.find(({id:o})=>o===n)||s}t.length&&r&&e.scrollTop+e.clientHeight>=e.scrollHeight-1&&(s=t[t.length-1]),this._activate(s)}_activate(t){let e=null;this._links.forEach(({link:i,id:s})=>{let r=t!==null&&s===t.id;i.classList.toggle("active",r),r?(i.setAttribute("aria-current","location"),e||(e=i)):i.removeAttribute("aria-current")}),this._status&&(this._status.textContent=t?t.label:this._overview),this._updateMarker(e)}_updateMarker(t){let e=this._element.querySelector(":scope > .nav"),i=t?.querySelector("span");if(!e?.contains(t)||!i?.offsetHeight||!this._element.getClientRects().length){this._element.removeAttribute("data-toc-marker");return}this._element.style.setProperty("--moo-toc-marker-offset","".concat(t.offsetTop+i.offsetTop,"px")),this._element.style.setProperty("--moo-toc-marker-height","".concat(i.offsetHeight,"px")),this._element.setAttribute("data-toc-marker","")}};var et=new WeakMap,ke=0,it=class a{static getInstance(t,e=t?.ownerDocument?.scrollingElement){let i=e&&et.get(e);return i?._owner===t?i:null}static getOrCreateInstance(t,e={}){return a.getInstance(t,e.scrollElement)||new a(t,e)}constructor(t,{scrollElement:e=null,hideDelay:i=900,label:s="Page scroll position"}={}){if(!t?.matches?.('.moo-ui[data-bs-theme="light"], .moo-ui[data-bs-theme="dark"]')||!t.isConnected)throw new TypeError("OverlayScrollbar requires a connected, resolved .moo-ui theme owner.");if(!Number.isFinite(i)||i<0||typeof s!="string"||!s.trim())throw new TypeError("OverlayScrollbar requires a nonnegative hideDelay and a nonempty label.");let r=t.ownerDocument,n=e??r.scrollingElement,o=n===r.scrollingElement;if(n?.nodeType!==1||!n.isConnected||n.ownerDocument!==r||!o&&(!t.contains(n)||n.closest('.moo-ui[data-bs-theme="light"], .moo-ui[data-bs-theme="dark"]')!==t))throw new TypeError("OverlayScrollbar scrollElement must belong to the same resolved theme owner.");let c=et.get(n);if(c){if(c._owner===t)return c;throw new Error("Only one OverlayScrollbar theme owner may control a scroll element.")}if(this._owner=t,this._document=r,this._window=r.defaultView,this._root=n,this._isDocument=o,o&&n!==r.documentElement)throw new TypeError("OverlayScrollbar requires a standards-mode document scroll root.");if(this._hideDelay=i,this._listeners=[],this._frame=0,this._timer=0,this._disposed=!1,this._originalNativeClass=o&&typeof t.__mooNativeScrollbarBaseline=="boolean"?t.__mooNativeScrollbarBaseline:this._root.classList.contains("scrollbar-overlay-native"),this._originalId=this._root.getAttribute("id"),this._forcedColors=this._window.matchMedia("(forced-colors: active)"),this._bar=r.createElement("div"),this._bar.className="scrollbar-overlay",this._bar.tabIndex=0,this._bar.setAttribute("role","scrollbar"),this._bar.setAttribute("aria-label",s),this._bar.setAttribute("aria-orientation","vertical"),this._bar.setAttribute("aria-valuemin","0"),this._thumb=r.createElement("div"),this._thumb.className="scrollbar-overlay-thumb",this._thumb.setAttribute("aria-hidden","true"),this._bar.append(this._thumb),t.append(this._bar),this._window.getComputedStyle(this._bar).position!=="fixed")throw this._bar.remove(),new Error("OverlayScrollbar requires the Moo UI overlay scrollbar stylesheet.");if(!this._originalId){do this._generatedId="scrollbar-overlay-page-".concat(++ke);while(r.getElementById(this._generatedId));this._root.id=this._generatedId}this._bar.setAttribute("aria-controls",this._root.id),et.set(n,this);try{this._listen(o?this._window:n,"scroll",()=>{this._reveal(),this._queue()},{passive:!0}),o||this._listen(r,"scroll",()=>this._queue(),{passive:!0,capture:!0}),this._listen(this._window,"resize",()=>this._queue()),this._listen(r,"pointermove",l=>this._onPointerMove(l),{passive:!0}),this._listen(r,"pointerout",l=>{l.pointerType==="mouse"&&!l.relatedTarget&&(this._nearEdge=!1,this._drag||delete this._bar.dataset.scrollbarInteractive,this._hideLater())}),this._listen(this._bar,"pointerdown",l=>this._onPointerDown(l)),this._listen(this._bar,"pointerup",()=>this._finishDrag()),this._listen(this._bar,"pointercancel",()=>this._finishDrag()),this._listen(this._bar,"lostpointercapture",()=>this._finishDrag()),this._listen(this._bar,"focus",()=>this._reveal()),this._listen(this._bar,"blur",()=>this._hideLater()),this._listen(this._bar,"keydown",l=>this._onKeyDown(l)),this._listen(this._forcedColors,"change",()=>this.refresh()),this._listen(this._window,"beforeprint",()=>{this._printing=!0,this.refresh()}),this._listen(this._window,"afterprint",()=>{this._printing=!1,this.refresh()}),this._resize=new this._window.ResizeObserver(()=>this._queue()),this._resize.observe(this._root),this._resize.observe(r.body),this._mutations=new this._window.MutationObserver(()=>this._queue()),this._mutations.observe(this._root,{attributes:!0,attributeFilter:["class","style","dir"]}),o||this._mutations.observe(r.documentElement,{attributes:!0,attributeFilter:["class","style","dir"]}),this._mutations.observe(r.body,{attributes:!0,attributeFilter:["class","style"]}),this._mutations.observe(t,{attributes:!0,attributeFilter:["class","style","dir","data-bs-theme"]}),this._contentMutations=new this._window.MutationObserver(l=>{l.some(h=>h.target!==this._bar&&!this._bar.contains(h.target))&&this._queue()}),this._contentMutations.observe(o?r.body:n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style","hidden"]}),this._listen(n,"load",()=>this._queue(),{capture:!0}),r.fonts&&this._listen(r.fonts,"loadingdone",()=>this._queue()),this.refresh()}catch(l){throw this.dispose(),l}}refresh(){if(this._disposed)return this;let t=this._window,e=this._root,i=!this._forcedColors.matches&&!this._printing;i&&e.classList.add("scrollbar-overlay-native");let s=i&&e.scrollWidth<=e.clientWidth+1;e.classList.toggle("scrollbar-overlay-native",this._originalNativeClass||s),this._mutations?.takeRecords(),this._contentMutations?.takeRecords();let r=(this._isDocument?[e,this._document.body]:[e]).some(_=>["hidden","clip"].includes(t.getComputedStyle(_).overflowY));this._maximum=Math.max(0,e.scrollHeight-e.clientHeight);let n=this._position();if(this._bar.hidden=!s||r||!n||this._maximum<=0,this._bar.hidden)return this._document.activeElement===this._bar&&this._bar.blur(),delete this._bar.dataset.scrollbarVisible,delete this._bar.dataset.scrollbarInteractive,this;let o=this._bar.clientWidth,c=this._bar.clientHeight,l=Math.min(c,Math.max(o,c*e.clientHeight/e.scrollHeight));this._travel=Math.max(0,c-l);let h=Math.min(this._maximum,Math.max(0,e.scrollTop));return this._thumb.style.height="".concat(l,"px"),this._thumb.style.transform="translateY(".concat(this._travel*h/this._maximum,"px)"),this._bar.setAttribute("aria-valuemax",String(Math.round(this._maximum))),this._bar.setAttribute("aria-valuenow",String(Math.round(h))),this}_position(){if(this._isDocument)return!0;let t=this._root,e=t.getBoundingClientRect(),i=Math.max(0,e.top+t.clientTop),s=Math.min(this._window.innerHeight,e.top+t.clientTop+t.clientHeight),r=parseFloat(this._window.getComputedStyle(this._bar).inlineSize),n=this._window.getComputedStyle(t).direction==="rtl",o=e.left+t.clientLeft+(n?0:t.clientWidth-r);return Object.assign(this._bar.style,{insetInlineEnd:"auto",bottom:"auto",top:"".concat(i,"px"),height:"".concat(Math.max(0,s-i),"px"),left:"".concat(Math.max(0,Math.min(this._window.innerWidth-r,o)),"px"),direction:n?"rtl":"ltr"}),e.width>0&&s>i&&o<this._window.innerWidth&&o+r>0}dispose(){if(!this._disposed){this._disposed=!0;for(let[t,e,i,s]of this._listeners)t.removeEventListener(e,i,s);this._listeners=[],this._resize?.disconnect(),this._mutations?.disconnect(),this._contentMutations?.disconnect(),this._window.cancelAnimationFrame(this._frame),this._window.clearTimeout(this._timer),this._drag&&this._bar.hasPointerCapture(this._drag.id)&&this._bar.releasePointerCapture(this._drag.id),this._drag=null,this._bar.remove(),this._root.classList.toggle("scrollbar-overlay-native",this._originalNativeClass),this._generatedId&&this._root.id===this._generatedId&&(this._originalId===null?this._root.removeAttribute("id"):this._root.setAttribute("id",this._originalId)),et.get(this._root)===this&&et.delete(this._root)}}_listen(t,e,i,s){t.addEventListener(e,i,s),this._listeners.push([t,e,i,s])}_queue(){this._disposed||this._frame||(this._frame=this._window.requestAnimationFrame(()=>{this._frame=0,this.refresh()}))}_reveal(){this._disposed||this._bar.hidden||(this._bar.dataset.scrollbarVisible="true",this._hideLater())}_hideLater(){this._window.clearTimeout(this._timer),this._timer=0,!this._disposed&&this._bar.hasAttribute("data-scrollbar-visible")&&(this._timer=this._window.setTimeout(()=>{this._timer=0,!(this._disposed||this._nearEdge||this._drag||this._bar.matches(":focus-visible"))&&delete this._bar.dataset.scrollbarVisible},this._hideDelay))}_onPointerMove(t){if(this._disposed)return;if(this._drag?.id===t.pointerId){this._travel&&this._scroll(this._drag.top+(t.clientY-this._drag.y)*this._maximum/this._travel);return}if(t.pointerType!=="mouse"){this._nearEdge=!1,this._drag||delete this._bar.dataset.scrollbarInteractive;return}let e=this._bar.getBoundingClientRect();!this._bar.hidden&&t.clientX>=e.left&&t.clientX<=e.right&&t.clientY>=e.top&&t.clientY<=e.bottom?(this._nearEdge=!0,this._bar.dataset.scrollbarInteractive="true",this._reveal()):this._nearEdge&&(this._nearEdge=!1,this._drag||delete this._bar.dataset.scrollbarInteractive,this._hideLater())}_onPointerDown(t){if(t.button!==0||this._bar.hidden||t.pointerType==="touch")return;t.preventDefault(),this._reveal();let e=this._thumb.getBoundingClientRect();if(t.clientY>=e.top&&t.clientY<=e.bottom)this._drag={id:t.pointerId,y:t.clientY,top:this._root.scrollTop},this._bar.setPointerCapture(t.pointerId);else{let i=t.clientY<this._thumb.getBoundingClientRect().top?-1:1;this._scroll(this._root.scrollTop+i*this._root.clientHeight)}}_finishDrag(){if(!this._drag||this._disposed)return;let t=this._drag.id;this._drag=null,this._nearEdge||delete this._bar.dataset.scrollbarInteractive,this._bar.hasPointerCapture(t)&&this._bar.releasePointerCapture(t),this._hideLater()}_onKeyDown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;this.refresh();let e=parseFloat(this._window.getComputedStyle(this._root).lineHeight)||16,i=this._root.clientHeight,s={ArrowUp:this._root.scrollTop-e,ArrowDown:this._root.scrollTop+e,PageUp:this._root.scrollTop-i,PageDown:this._root.scrollTop+i,Home:0,End:this._maximum," ":this._root.scrollTop+(t.shiftKey?-i:i)};Object.hasOwn(s,t.key)&&(t.preventDefault(),this._scroll(s[t.key]),this._reveal())}_scroll(t){(this._isDocument?this._window:this._root).scrollTo({top:Math.min(this._maximum,Math.max(0,t)),behavior:"instant"}),this._queue()}};var st=new WeakMap;function Gt(a=document){if(st.has(a))return st.get(a);let e=(a.nodeType===9?a:a.ownerDocument)?.defaultView?.bootstrap?.Offcanvas;if(!e)return()=>{};let i=Array.from(a.querySelectorAll(".offcanvas.sheet")),s=n=>{n.target===n.currentTarget&&n.currentTarget.querySelector("[autofocus]:not(:disabled)")?.focus()},r=()=>{st.get(a)===r&&(i.forEach(n=>{n.removeEventListener("shown.bs.offcanvas",s)}),st.delete(a))};return st.set(a,r),i.forEach(n=>{n.addEventListener("shown.bs.offcanvas",s),n.dataset.sheetOpenOnLoad==="true"&&(n.removeAttribute("data-sheet-open-on-load"),e.getOrCreateInstance(n).show())}),r}var O=new WeakMap,Mt=new WeakMap;function jt(a){return a.isConnected&&!a.matches(":disabled")&&a.getClientRects().length>0&&!a.closest("[hidden], [inert]")&&a.ownerDocument.defaultView.getComputedStyle(a).visibility==="visible"}var rt=class a{static getInstance(t){return O.get(t)||null}static getOrCreateInstance(t){return O.get(t)||new a(t)}constructor(t){if(O.has(t))return O.get(t);if(!t?.matches?.("[data-floating-panel]")||!t.id)throw new TypeError("FloatingPanel requires a named panel");this.panel=t,this.document=t.ownerDocument,this.owner=t.closest(".moo-ui"),this.initialHidden=t.hidden,this.controls=new Map,this.launcher=null,this.key=t.dataset.floatingPanelKey?"moo-floating-panel:".concat(t.dataset.floatingPanelKey):"";let e=this.document.defaultView;Mt.has(e)||Mt.set(e,new Map),this.memory=Mt.get(e),this.onClick=s=>this.handleControl(s),this.document.addEventListener("click",this.onClick),O.set(t,this);let i=this.memory.get(this.key)||!1;if(this.key&&!this.memory.has(this.key))try{i=e.localStorage.getItem(this.key)==="dismissed"}catch{}this.setVisible(!i),t.dataset.floatingPanelReady="true"}launchers(){return[...this.document.querySelectorAll("[data-floating-panel-open]")].filter(t=>t.dataset.floatingPanelOpen===this.panel.id&&t.closest(".moo-ui")===this.owner)}setVisible(t){this.panel.hidden=!t,this.panel.dataset.floatingPanelState=t?"visible":"dismissed",this.launchers().forEach(e=>{this.controls.has(e)||this.controls.set(e,{controls:e.getAttribute("aria-controls"),expanded:e.getAttribute("aria-expanded")}),e.setAttribute("aria-controls",this.panel.id),e.setAttribute("aria-expanded",String(t))})}handleControl(t){let e=t.target.closest?.("[data-floating-panel-open], [data-floating-panel-dismiss]");if(!e||e.matches(":disabled")||e.closest(".moo-ui")!==this.owner)return;let i=e.hasAttribute("data-floating-panel-open");if((i?e.dataset.floatingPanelOpen:e.dataset.floatingPanelDismiss)===this.panel.id&&!(!i&&!this.panel.contains(e))){if(t.preventDefault(),i&&(this.launcher=e),this.key)try{let s=this.document.defaultView.localStorage;i?s.removeItem(this.key):s.setItem(this.key,"dismissed"),this.memory.delete(this.key)}catch{this.memory.set(this.key,!i)}if(this.setVisible(i),i)[...this.panel.querySelectorAll("button, a[href], input:not([type='hidden']), select, textarea, [tabindex]")].find(s=>s.tabIndex>=0&&jt(s))?.focus({preventScroll:!0});else{let s=this.launchers().filter(jt);(s.includes(this.launcher)?this.launcher:s[0])?.focus({preventScroll:!0})}}}dispose(){O.get(this.panel)===this&&(this.document.removeEventListener("click",this.onClick),this.panel.hidden=this.initialHidden,delete this.panel.dataset.floatingPanelReady,delete this.panel.dataset.floatingPanelState,this.controls.forEach((t,e)=>{for(let[i,s]of[["aria-controls",t.controls],["aria-expanded",t.expanded]])s===null?e.removeAttribute(i):e.setAttribute(i,s)}),O.delete(this.panel))}};var bt=new WeakMap,Xt=5e3,De=250,at=class a{static getInstance(t){return t?.nodeType===1&&bt.get(t)||null}static getOrCreateInstance(t){return a.getInstance(t)||new a(t)}constructor(t){if(t?.nodeType!==1||!t.matches("[data-image-gallery]"))throw new TypeError("ImageGallery requires a [data-image-gallery] root element.");let e=bt.get(t);if(e)return e;if(this._element=t,this._window=t.ownerDocument.defaultView,this._dialog=t.querySelector(".modal"),this._carousel=this._dialog?.querySelector(".carousel"),!this._dialog||!this._carousel)throw new TypeError("ImageGallery requires a lightbox Dialog with a Carousel.");this._slides=Array.from(this._carousel.querySelectorAll(".carousel-item")),this._counter=this._dialog.querySelector("[data-gallery-counter]"),this._caption=this._dialog.querySelector("[data-gallery-caption]"),this._credit=this._dialog.querySelector("[data-gallery-credit]"),this._stage=this._dialog.querySelector("[data-gallery-stage]"),this._frame=this._dialog.querySelector(".modal-dialog"),this._progress=this._dialog.querySelector(".progress"),this._progressBar=this._progress?.querySelector(".progress-bar"),this._progress?.setAttribute("aria-hidden","true");let i=r=>this._dialog.id?t.ownerDocument.getElementById("".concat(this._dialog.id,"-").concat(r)):null;this._enterButton=i("fullscreen"),this._exitButton=i("windowed"),this._playButton=i("play"),this._pauseButton=i("pause"),this._listeners=[],this._listen(this._dialog,"show.bs.modal",r=>this._onShow(r)),this._listen(this._window,"resize",()=>this._layoutStage()),this._listen(this._dialog,"shown.bs.modal",()=>this._carouselInstance()),this._listen(this._carousel,"slide.bs.carousel",r=>this.show(r.to,!1)),this._listen(this._carousel,"slid.bs.carousel",()=>this._restartTimer()),this._listen(this._dialog,"keydown",r=>this._onKeydown(r)),this._listen(this._dialog,"hidden.bs.modal",()=>{this.play(!1),this.fullscreen(!1)});let s=[[i("previous"),()=>this._step(!1)],[i("next"),()=>this._step(!0)],[this._playButton,()=>this.play(!0,!0)],[this._pauseButton,()=>this.play(!1,!0)],[this._enterButton,()=>this.fullscreen(!0,!0)],[this._exitButton,()=>this.fullscreen(!1,!0)]];for(let[r,n]of s)r&&this._listen(r,"click",n);bt.set(t,this)}get index(){let t=this._slides.findIndex(e=>e.classList.contains("active"));return Math.max(t,0)}show(t,e=!0){let i=this._slides.length;if(!i)return this;let s=(Number(t)%i+i)%i;e&&this._slides.forEach((n,o)=>{n.classList.toggle("active",o===s)});for(let n of[0,1,-1])this._load(this._slides[(s+n+i)%i]);let r=this._slides[s];if(this._caption&&(this._caption.textContent=r.getAttribute("data-gallery-slide-title")||r.querySelector("img")?.alt||""),this._credit){let n=r.getAttribute("data-gallery-slide-credit")||"";this._credit.textContent=n,this._credit.classList.toggle("d-none",!n)}if(this._counter){let n=this._counter.getAttribute("data-gallery-counter")||"{current} / {total}";this._counter.textContent=n.replaceAll("{current}",String(s+1)).replaceAll("{total}",String(i))}return this}play(t=!0,e=!1){return this._playing=!!t&&!!this._carouselInstance(),this._progress?.classList.toggle("d-none",!this._playing),this._restartTimer(),this._playButton?.classList.toggle("d-none",this._playing),this._pauseButton?.classList.toggle("d-none",!this._playing),this._counter?.setAttribute("aria-live",this._playing?"off":"polite"),e&&(this._playing?this._pauseButton:this._playButton)?.focus(),this}get isFullscreen(){return!!this._frame?.classList.contains("modal-fullscreen")}fullscreen(t=!0,e=!1){if(!this._frame)return this;let i=!!t;return this._resize(()=>{this._frame.classList.toggle("modal-fullscreen",i),this._layoutStage()}),e&&(i?this._exitButton:this._enterButton)?.focus(),this}dispose(){this._stopTimer();for(let[t,e,i]of this._listeners)t.removeEventListener(e,i);this._listeners=[],bt.delete(this._element)}_listen(t,e,i){t.addEventListener(e,i),this._listeners.push([t,e,i])}_fillsScreen(){if(this.isFullscreen)return!0;let t=this._frame?.className.match(/\bmodal-fullscreen-(\w+)-down\b/)?.[1];if(!t)return!1;let e=Number.parseFloat(this._window.getComputedStyle(this._element.ownerDocument.documentElement).getPropertyValue("--bs-breakpoint-".concat(t)));return Number.isFinite(e)&&this._window.matchMedia("(max-width: ".concat(e-.02,"px)")).matches}_restartTimer(){if(this._stopTimer(),!this._playing)return;let t=()=>{this._playing&&this._step(!0)};if(typeof this._progressBar?.animate=="function"){let e=this._progressBar.animate([{width:"0%"},{width:"100%"}],{duration:Xt,easing:"linear",fill:"forwards"});e.addEventListener("finish",()=>{this._timer===e&&t()}),this._timer=e}else this._timeout=this._window.setTimeout(t,Xt)}_stopTimer(){this._timer?.cancel(),this._timer=null,this._window.clearTimeout(this._timeout)}_resize(t){let e=this._frame.querySelector(".modal-content"),i=this._window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;if(!e||typeof e.animate!="function"||i||!this._dialog.classList.contains("show")){t();return}this._resizing?.cancel();let s=e.getBoundingClientRect();t();let r=e.getBoundingClientRect();!s.width||!s.height||!r.width||!r.height||(this._resizing=e.animate([{transformOrigin:"0 0",transform:"translate(".concat(s.left-r.left,"px, ").concat(s.top-r.top,"px) ")+"scale(".concat(s.width/r.width,", ").concat(s.height/r.height,")")},{transformOrigin:"0 0",transform:"none"}],{duration:De,easing:"cubic-bezier(0.2, 0, 0, 1)"}))}_layoutStage(){let t=this._fillsScreen();this._stage?.classList.toggle("gallery-stage",!t),this._enterButton?.classList.toggle("d-none",t),this._exitButton?.classList.toggle("d-none",!this.isFullscreen)}_onShow(t){this._layoutStage();let i=t.relatedTarget?.closest?.("[data-gallery-index]")?.getAttribute("data-gallery-index");this.show(i==null?0:Number.parseInt(i,10)||0)}_onKeydown(t){if(!["ArrowLeft","ArrowRight"].includes(t.key)||this._carousel.contains(t.target))return;t.preventDefault();let e=this._element.ownerDocument.documentElement.dir==="rtl";this._step(t.key==="ArrowRight"!==e)}_step(t){let e=this._carouselInstance();e&&(t?e.next():e.prev())}_carouselInstance(t=!0){let e=this._window.bootstrap?.Carousel;return e?t?e.getOrCreateInstance(this._carousel,{interval:!1,pause:!1,ride:!1,keyboard:!0,touch:!0,wrap:!0}):e.getInstance(this._carousel):null}_load(t){let e=t?.querySelector("img[data-gallery-src]");if(!e||e.hasAttribute("src"))return;let i=e.getAttribute("data-gallery-srcset");i&&e.setAttribute("srcset",i),e.setAttribute("src",e.getAttribute("data-gallery-src"))}};var nt=new WeakMap,yt=new WeakMap,Jt=1,Zt=86400,Ee="button, a[href], input:not([type='hidden']), select, textarea, [tabindex]:not([tabindex='-1'])";function Ae(a,t){if(!a)return"";try{let e=new URL(a,t);return e.protocol==="https:"||e.protocol==="http:"?e.href:""}catch{return""}}function Qt(a,t){return a.endsWith("*")?t.startsWith(a.slice(0,-1)):t===a}var ot=class a{static getInstance(t){return t?.nodeType===9?yt.get(t)||null:t?.nodeType===1&&nt.get(t)||null}static getOrCreateInstance(t,e){return a.getInstance(t)||new a(t,e)}constructor(t,{reload:e}={}){if(t?.nodeType!==1||!t.matches("[data-consent]")||!t.id)throw new TypeError("ConsentManager requires a named [data-consent] element.");let i=nt.get(t);if(i)return i;if(this._element=t,this._document=t.ownerDocument,yt.has(this._document))throw new TypeError("ConsentManager allows one consent card per document.");this._window=this._document.defaultView;let s=t.querySelector("script[data-consent-config]");if(!s)throw new TypeError("ConsentManager requires a [data-consent-config] script.");this._config=JSON.parse(s.textContent),this._cookie={name:"moo_consent",days:365,...this._config.cookie||{}},this._categories=this._config.categories||[],this._optional=this._categories.filter(c=>!c.required).map(c=>c.id),this._reload=e||(()=>this._window.location.reload()),this._waiting=new Map,this._listeners=[],this._trapping=!1,this._returnFocus=null;let r=this._read();this._valid=!!r,this._choices=this._normalize(r?r.c:{});let n=c=>this._document.getElementById("".concat(t.id,"-").concat(c)),o=[[n("accept"),()=>this.acceptAll()],[n("decline"),()=>this.declineAll()],[n("save"),()=>this.save(this._switchChoices(),"save")]];for(let[c,l]of o)c&&this._listen(c,"click",l);this._listen(this._document,"click",c=>this._onDocumentClick(c)),this._listen(t,"keydown",c=>this._onKeydown(c)),nt.set(t,this),yt.set(this._document,this),this.activate(this._document),this._valid||this._show(),this.ready=Promise.resolve(this),queueMicrotask(()=>this._emit("ready",{choices:this.choices,valid:this._valid,revision:this.revision}))}get revision(){return String(this._config.revision)}get valid(){return this._valid}get choices(){return{...this._choices}}get isOpen(){return!this._element.hidden}granted(t){let e=this._categories.find(i=>i.id===t);return e?e.required?!0:this._valid&&this._choices[t]===!0:!1}whenGranted(t,e){return this.granted(t)?(this._run(e),()=>{}):(this._waiting.has(t)||this._waiting.set(t,new Set),this._waiting.get(t).add(e),()=>this._waiting.get(t)?.delete(e))}acceptAll(){return this.save(Object.fromEntries(this._optional.map(t=>[t,!0])),"accept-all")}declineAll(){return this.save({},"decline")}grant(t){return this.save({...this._choices,[t]:!0},"grant")}deny(t){return this.save({...this._choices,[t]:!1},"deny")}save(t,e="save"){let i=this._valid?this.choices:this._normalize({}),s=this._valid,r=this._normalize(t);this._write(r),this._valid=!0,this._choices=r;let n=this._optional.filter(c=>r[c]&&!i[c]),o=s?this._optional.filter(c=>i[c]&&!r[c]):[];this.close(),this.activate(this._document);for(let c of n){let l=this._waiting.get(c);this._waiting.delete(c),l?.forEach(h=>this._run(h))}return this._emit("change",{choices:this.choices,previous:i,granted:n,revoked:o,source:e}),o.length&&(o.forEach(c=>this._forget(c)),this._reload()),this.choices}open(t=null){this._returnFocus=t,this._trapping=!0,this._show(),this._document.getElementById("".concat(this._element.id,"-title"))?.focus({preventScroll:!0}),this._emit("open",{})}close(){if(!this._valid)return!1;let t=this.isOpen,e=this._trapping?this._returnFocus:null;return this._element.hidden=!0,this._trapping=!1,this._returnFocus=null,e?.isConnected&&e.focus({preventScroll:!0}),t&&this._emit("close",{}),!0}activate(t=this._document){this._activateWhere(t,e=>this.granted(e))}dispose(){nt.get(this._element)===this&&(this._listeners.forEach(([t,e,i])=>t.removeEventListener(e,i)),this._listeners=[],this._waiting.clear(),nt.delete(this._element),yt.delete(this._document))}_run(t){try{t(this)}catch(e){typeof this._window.reportError=="function"?this._window.reportError(e):this._window.console?.error(e)}}_activateWhere(t,e){for(let i of t.querySelectorAll("[data-consent-category]"))e(i.getAttribute("data-consent-category"))&&this._activateElement(i);for(let i of t.querySelectorAll("[data-consent-placeholder]"))e(i.getAttribute("data-consent-placeholder"))&&(i.hidden=!0)}_listen(t,e,i){t.addEventListener(e,i),this._listeners.push([t,e,i])}_emit(t,e){this._document.dispatchEvent(new this._window.CustomEvent("moo:consent:".concat(t),{bubbles:!0,detail:e}))}_normalize(t){return Object.fromEntries(this._optional.map(e=>[e,t?.[e]===!0||t?.[e]===1]))}_switch(t){return this._document.getElementById("".concat(this._element.id,"-category-").concat(t))}_switchChoices(){return Object.fromEntries(this._optional.map(t=>[t,!!this._switch(t)?.checked]))}_show(){for(let t of this._optional){let e=this._switch(t);e&&(e.checked=this.granted(t))}this._element.hidden=!1}_read(){let t="".concat(this._cookie.name,"="),e=this._document.cookie.split("; ").find(i=>i.startsWith(t));if(!e)return null;try{let i=JSON.parse(decodeURIComponent(e.slice(t.length))),s=Date.now()/1e3-Number(i.t);return i.v!==Jt||i.r!==this.revision||!(s>=0&&s<this._cookie.days*Zt)?null:i}catch{return null}}_write(t){let e={v:Jt,r:this.revision,t:Math.floor(Date.now()/1e3),c:Object.fromEntries(Object.entries(t).map(([s,r])=>[s,r?1:0]))},i=this._window.location.protocol==="https:"?"; Secure":"";this._document.cookie="".concat(this._cookie.name,"=").concat(encodeURIComponent(JSON.stringify(e)),"; Path=/; Max-Age=").concat(this._cookie.days*Zt,"; SameSite=Lax").concat(i)}_forget(t){let e=this._categories.find(o=>o.id===t),s=this._window.location.hostname.split("."),r=[""];for(let o=0;o<s.length-1;o+=1)r.push("; Domain=".concat(s.slice(o).join(".")));let n=this._document.cookie.split("; ").map(o=>o.split("=")[0]).filter(Boolean);for(let o of e?.storage||[])if(o.type==="cookie")for(let c of n.filter(l=>Qt(o.name,l)))for(let l of r)this._document.cookie="".concat(c,"=; Path=/; Max-Age=0").concat(l);else try{let c=o.type==="local"?this._window.localStorage:this._window.sessionStorage;Object.keys(c).filter(l=>Qt(o.name,l)).forEach(l=>c.removeItem(l))}catch{}}_activateElement(t){if(t.hasAttribute("data-consent-active"))return;let e=t.getAttribute("data-consent-src"),i=Ae(e,this._document.baseURI);if(!(e&&!i)){if(t.localName==="script"){let s=this._document.createElement("script");for(let{name:n,value:o}of t.attributes)n!=="type"&&!n.startsWith("data-consent-")&&s.setAttribute(n,o);let r=t.getAttribute("data-consent-type");r&&(s.type=r),i?s.src=i:s.textContent=t.textContent,s.setAttribute("data-consent-category",t.getAttribute("data-consent-category")),s.setAttribute("data-consent-active",""),t.replaceWith(s);return}t.setAttribute("data-consent-active",""),i&&t.setAttribute("src",i),t.hidden=!1}}_onDocumentClick(t){let e=t.target.closest?.("[data-consent-open], [data-consent-grant]");if(!e||e.matches(":disabled"))return;if(e.hasAttribute("data-consent-open")){if(e.getAttribute("data-consent-open")!==this._element.id)return;t.preventDefault(),this.open(e);return}let i=e.getAttribute("data-consent-grant");if(!this._categories.some(n=>n.id===i))return;t.preventDefault();let s=e.closest("[data-consent-placeholder]"),r=e.closest("[data-consent-embed]")||s?.parentElement;s?.querySelector("[data-consent-remember]")?.checked||!r?this.grant(i):this._activateWhere(r,n=>n===i)}_onKeydown(t){if(!this._trapping)return;if(t.key==="Escape"){this.close()&&t.preventDefault();return}if(t.key!=="Tab")return;let e=Array.from(this._element.querySelectorAll(Ee)).filter(n=>!n.matches(":disabled")&&n.getClientRects().length>0);if(!e.length)return;let i=e[0],s=e[e.length-1],r=this._document.activeElement;t.shiftKey&&(r===i||!this._element.contains(r)||r.id==="".concat(this._element.id,"-title"))?(t.preventDefault(),s.focus()):!t.shiftKey&&r===s&&(t.preventDefault(),i.focus())}};import Ce from"./password-requirements.js";async function xe(){let{default:a}=await import("./chart.js");return a}var Me={PasswordRequirements:Ce,FloatingPanel:rt,ImageGallery:at,ConsentManager:ot,loadChart:xe,Combobox:N,ContextMenu:B,DataTable:$,Datepicker:Y,MooCalendar:L,MooDateRangePicker:ft,Sidebar:U,Slider:Z,TableOfContents:tt,OverlayScrollbar:it,initSheets:Gt};var ni=Me;export{N as Combobox,ot as ConsentManager,B as ContextMenu,$ as DataTable,Y as Datepicker,rt as FloatingPanel,at as ImageGallery,L as MooCalendar,ft as MooDateRangePicker,it as OverlayScrollbar,Ce as PasswordRequirements,U as Sidebar,Z as Slider,tt as TableOfContents,ni as default,Gt as initSheets,xe as loadChart};