UNPKG

flyonui

Version:

The easiest, free and open-source Tailwind CSS component library with semantic classes.

24 lines 41 kB
var e={68:(e,t,n)=>{n.d(t,{A:()=>o});const o=class{constructor(){this.components=[],this.currentlyOpenedComponents=[],this.activeComponent=null,this.initGlobalListeners()}initGlobalListeners(){document.addEventListener("keydown",e=>this.handleGlobalKeydown(e)),document.addEventListener("focusin",e=>this.handleGlobalFocusin(e))}getActiveComponent(e){if(!e)return null;const t=this.components.filter(t=>t.wrapper.contains(e)||t.context&&t.context.contains(e));if(0===t.length)return null;if(1===t.length)return t[0];let n=null,o=Number.MAX_SAFE_INTEGER;for(const i of t){let t=0,s=e;for(;s&&s!==i.wrapper&&s!==i.context;)t++,s=s.parentElement;t<o&&(o=t,n=i)}return n}handleGlobalFocusin(e){const t=e.target;this.activeComponent=this.getActiveComponent(t)}handleGlobalKeydown(e){const t=e.target;if(this.activeComponent=this.getActiveComponent(t),this.activeComponent)switch(e.key){case"Escape":if(this.activeComponent.isOpened)this.activeComponent.handlers.onEsc&&(this.activeComponent.handlers.onEsc(),e.preventDefault(),e.stopPropagation());else{const n=this.findClosestOpenParent(t);(null==n?void 0:n.handlers.onEsc)&&(n.handlers.onEsc(),e.preventDefault(),e.stopPropagation())}break;case"Enter":this.activeComponent.handlers.onEnter&&(this.activeComponent.handlers.onEnter(),e.preventDefault(),e.stopPropagation());break;case" ":case"Space":if("INPUT"===t.tagName||"TEXTAREA"===t.tagName)return;this.activeComponent.handlers.onSpace&&(this.activeComponent.handlers.onSpace(),e.preventDefault(),e.stopPropagation());break;case"ArrowDown":case"ArrowUp":case"ArrowLeft":case"ArrowRight":if(this.activeComponent.handlers.onArrow){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;this.activeComponent.handlers.onArrow(e),e.preventDefault(),e.stopPropagation()}break;case"Tab":if(!this.activeComponent.handlers.onTab)break;const n=e.shiftKey?this.activeComponent.handlers.onShiftTab:this.activeComponent.handlers.onTab;n&&n();break;case"Home":this.activeComponent.handlers.onHome&&(this.activeComponent.handlers.onHome(),e.preventDefault(),e.stopPropagation());break;case"End":this.activeComponent.handlers.onEnd&&(this.activeComponent.handlers.onEnd(),e.preventDefault(),e.stopPropagation());break;default:this.activeComponent.handlers.onFirstLetter&&1===e.key.length&&/^[a-zA-Z]$/.test(e.key)&&(this.activeComponent.handlers.onFirstLetter(e.key),e.preventDefault(),e.stopPropagation())}}findClosestOpenParent(e){let t=e.parentElement;for(;t;){const e=this.currentlyOpenedComponents.find(e=>e.wrapper===t&&e!==this.activeComponent);if(e)return e;t=t.parentElement}return null}registerComponent(e,t,n=!0,o="",i="",s){const l={wrapper:e,handlers:t,isOpened:n,name:o,selector:i,context:s,isRegistered:!0};return this.components.push(l),l}updateComponentState(e,t){e.isOpened=t,t?this.currentlyOpenedComponents.includes(e)||this.currentlyOpenedComponents.push(e):this.currentlyOpenedComponents=this.currentlyOpenedComponents.filter(t=>t!==e)}unregisterComponent(e){this.components=this.components.filter(t=>t!==e),this.currentlyOpenedComponents=this.currentlyOpenedComponents.filter(t=>t!==e)}}},179:(e,t,n)=>{n.d(t,{lP:()=>o});const o={auto:"auto","auto-start":"auto-start","auto-end":"auto-end",top:"top","top-start":"top-start","top-end":"top-end",bottom:"bottom","bottom-start":"bottom-start","bottom-end":"bottom-end",right:"right","right-start":"right-start","right-end":"right-end",left:"left","left-start":"left-start","left-end":"left-end"}},392:(e,t,n)=>{n.d(t,{BF:()=>s,JD:()=>c,PK:()=>o,gj:()=>i,un:()=>l,yd:()=>a,zG:()=>r}); /* * @version: 3.2.2 * @author: Preline Labs Ltd. * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html) * Copyright 2024 Preline Labs Ltd. */ const o=e=>"true"===e,i=(e,t,n="")=>(window.getComputedStyle(e).getPropertyValue(t)||n).replace(" ",""),s=(e,t,n="")=>{let o="";return e.classList.forEach(e=>{e.includes(t)&&(o=e)}),o.match(/:(.*)]/)?o.match(/:(.*)]/)[1]:n},l=()=>!!/iPad|iPhone|iPod/.test(navigator.platform)||navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),r=()=>navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),c=(e,t,n=null)=>{const o=new CustomEvent(e,{detail:{payload:n},bubbles:!0,cancelable:!0,composed:!1});t.dispatchEvent(o)},a=(e,t)=>{const n=()=>{t(),e.removeEventListener("transitionend",n,!0)},o=window.getComputedStyle(e),i=o.getPropertyValue("transition-duration");"none"!==o.getPropertyValue("transition-property")&&parseFloat(i)>0?e.addEventListener("transitionend",n,!0):t()}},479:(e,t,n)=>{n.d(t,{A:()=>a});var o=n(392),i=n(663),s=n(709),l=n(68),r=n(179); /* * HSDropdown * @version: 3.2.2 * @author: Preline Labs Ltd. * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html) * Copyright 2024 Preline Labs Ltd. */ class c extends s.A{constructor(e,t,n){super(e,t,n),this.longPressTimer=null,this.openedViaKeyboard=!1,this.onTouchStartListener=null,this.onTouchEndListener=null,this.toggle=this.el.querySelector(":scope > .dropdown-toggle")||this.el.querySelector(":scope > .dropdown-toggle-wrapper > .dropdown-toggle")||this.el.children[0],this.closers=Array.from(this.el.querySelectorAll(":scope .dropdown-close"))||null,this.menu=this.el.querySelector(":scope > .dropdown-menu"),this.eventMode=(0,o.gj)(this.el,"--trigger","click"),this.closeMode=(0,o.gj)(this.el,"--auto-close","true"),this.hasAutofocus=(0,o.PK)((0,o.gj)(this.el,"--has-autofocus","true")||"true"),this.autofocusOnKeyboardOnly=(0,o.PK)((0,o.gj)(this.el,"--autofocus-on-keyboard-only","true")||"true"),this.animationInProcess=!1,this.onCloserClickListener=[],this.toggle&&this.menu&&this.init()}elementMouseEnter(){this.onMouseEnterHandler()}elementMouseLeave(){this.onMouseLeaveHandler()}toggleClick(e){this.onClickHandler(e)}toggleContextMenu(e){e.preventDefault(),this.onContextMenuHandler(e)}handleTouchStart(e){this.longPressTimer=window.setTimeout(()=>{e.preventDefault();const t=e.touches[0],n=new MouseEvent("contextmenu",{bubbles:!0,cancelable:!0,view:window,clientX:t.clientX,clientY:t.clientY});this.toggle&&this.toggle.dispatchEvent(n)},400)}handleTouchEnd(e){this.longPressTimer&&(clearTimeout(this.longPressTimer),this.longPressTimer=null)}closerClick(){this.close()}init(){if(this.createCollection(window.$hsDropdownCollection,this),this.toggle.disabled)return!1;this.toggle&&this.buildToggle(),this.menu&&this.buildMenu(),this.closers&&this.buildClosers(),(0,o.un)()||(0,o.zG)()||(this.onElementMouseEnterListener=()=>this.elementMouseEnter(),this.onElementMouseLeaveListener=()=>this.elementMouseLeave(),this.el.addEventListener("mouseenter",this.onElementMouseEnterListener),this.el.addEventListener("mouseleave",this.onElementMouseLeaveListener)),"undefined"!=typeof window&&(window.HSAccessibilityObserver||(window.HSAccessibilityObserver=new l.A),this.setupAccessibility())}resizeHandler(){this.eventMode=(0,o.gj)(this.el,"--trigger","click"),this.closeMode=(0,o.gj)(this.el,"--auto-close","true"),this.hasAutofocus=(0,o.PK)((0,o.gj)(this.el,"--has-autofocus","true")||"true"),this.autofocusOnKeyboardOnly=(0,o.PK)((0,o.gj)(this.el,"--autofocus-on-keyboard-only","true")||"true")}isOpen(){return this.el.classList.contains("open")&&!this.menu.classList.contains("hidden")}buildToggle(){var e;(null===(e=null==this?void 0:this.toggle)||void 0===e?void 0:e.ariaExpanded)&&(this.el.classList.contains("open")?this.toggle.ariaExpanded="true":this.toggle.ariaExpanded="false"),"contextmenu"===this.eventMode?(this.onToggleContextMenuListener=e=>this.toggleContextMenu(e),this.onTouchStartListener=this.handleTouchStart.bind(this),this.onTouchEndListener=this.handleTouchEnd.bind(this),this.toggle.addEventListener("contextmenu",this.onToggleContextMenuListener),this.toggle.addEventListener("touchstart",this.onTouchStartListener,{passive:!1}),this.toggle.addEventListener("touchend",this.onTouchEndListener),this.toggle.addEventListener("touchmove",this.onTouchEndListener)):(this.onToggleClickListener=e=>this.toggleClick(e),this.toggle.addEventListener("click",this.onToggleClickListener))}buildMenu(){this.menu.role=this.menu.getAttribute("role")||"menu",this.menu.tabIndex=-1;const e=this.menu.querySelectorAll('[role="menuitemcheckbox"]'),t=this.menu.querySelectorAll('[role="menuitemradio"]');e.forEach(e=>e.addEventListener("click",()=>this.selectCheckbox(e))),t.forEach(e=>e.addEventListener("click",()=>this.selectRadio(e))),this.menu.addEventListener("click",()=>{this.menu.focus()})}buildClosers(){this.closers.forEach(e=>{this.onCloserClickListener.push({el:e,fn:()=>this.closerClick()}),e.addEventListener("click",this.onCloserClickListener.find(t=>t.el===e).fn)})}getScrollbarSize(){let e=document.createElement("div");e.style.overflow="scroll",e.style.width="100px",e.style.height="100px",document.body.appendChild(e);let t=e.offsetWidth-e.clientWidth;return document.body.removeChild(e),t}onContextMenuHandler(e){const t={getBoundingClientRect:(()=>new DOMRect,()=>new DOMRect(e.clientX,e.clientY,0,0))};c.closeCurrentlyOpened(),this.el.classList.contains("open")&&!this.menu.classList.contains("hidden")?(this.close(),document.body.style.overflow="",document.body.style.paddingRight=""):(document.body.style.overflow="hidden",document.body.style.paddingRight=`${this.getScrollbarSize()}px`,this.open(t))}onClickHandler(e){var t;if("hover"===(0,o.gj)(this.el,"--trigger","click")&&window.matchMedia("(hover: hover)").matches&&"mouse"===e.pointerType){const n=e.currentTarget;return"A"===n.tagName&&n.hasAttribute("href")&&"#"!==n.getAttribute("href")||(e.preventDefault(),e.stopPropagation(),null===(t=e.stopImmediatePropagation)||void 0===t||t.call(e)),!1}this.el.classList.contains("open")&&!this.menu.classList.contains("hidden")?this.close():this.open()}onMouseEnterHandler(){if("hover"!==(0,o.gj)(this.el,"--trigger","click"))return!1;(!this.el._floatingUI||this.el._floatingUI&&!this.el.classList.contains("open"))&&this.forceClearState(),!this.el.classList.contains("open")&&this.menu.classList.contains("hidden")&&this.open()}onMouseLeaveHandler(){if("hover"!==(0,o.gj)(this.el,"--trigger","click"))return!1;this.el.classList.contains("open")&&!this.menu.classList.contains("hidden")&&this.close()}destroyFloatingUI(){const e=(window.getComputedStyle(this.el).getPropertyValue("--scope")||"").trim();this.menu.classList.remove("block"),this.menu.classList.add("hidden"),this.menu.style.inset=null,this.menu.style.position=null,this.el&&this.el._floatingUI&&(this.el._floatingUI.destroy(),this.el._floatingUI=null),"window"===e&&this.el.appendChild(this.menu),this.animationInProcess=!1}focusElement(){const e=this.menu.querySelector("[autofocus]");if(e)return e.focus(),!0;const t=this.menu.querySelectorAll('a:not([hidden]), button:not([hidden]), [role="menuitem"]:not([hidden]), .dropdown-item');if(t.length>0){return t[0].focus(),!0}return!1}setupFloatingUI(e){const t=e||this.el,n=window.getComputedStyle(this.el),o=(n.getPropertyValue("--placement")||"").trim(),s=(n.getPropertyValue("--flip")||"true").trim(),l=(n.getPropertyValue("--strategy")||"fixed").trim(),c=(n.getPropertyValue("--offset")||"6").trim(),a=(n.getPropertyValue("--gpu-acceleration")||"true").trim(),d=(window.getComputedStyle(this.el).getPropertyValue("--adaptive")||"adaptive").replace(" ",""),h=l,u=parseInt(c,10),p=r.lP[o]||"bottom-start",m=[..."true"===s?[(0,i.UU)()]:[],(0,i.cY)(u)],f={placement:p,strategy:h,middleware:m},g=e=>{const t=this.menu.getBoundingClientRect(),n=window.innerWidth-(window.innerWidth-document.documentElement.clientWidth);return e+t.width>n&&(e=n-t.width),e<0&&(e=0),e},w=()=>{(0,i.rD)(t,this.menu,f).then(({x:e,y:t,placement:n})=>{const o=g(e);"absolute"===h&&"none"===d?Object.assign(this.menu.style,{position:h,margin:"0"}):"absolute"===h?Object.assign(this.menu.style,{position:h,transform:`translate3d(${e}px, ${t}px, 0px)`,margin:"0"}):"true"===a?Object.assign(this.menu.style,{position:h,left:"",top:"",inset:"0px auto auto 0px",margin:"0",transform:`translate3d(${"adaptive"===d?o:0}px, ${t}px, 0)`}):Object.assign(this.menu.style,{position:h,left:`${e}px`,top:`${t}px`,transform:""}),this.menu.setAttribute("data-placement",n)})};w();return{update:w,destroy:(0,i.ll)(t,this.menu,w)}}selectCheckbox(e){e.ariaChecked="true"===e.ariaChecked?"false":"true"}selectRadio(e){if("true"===e.ariaChecked)return!1;const t=e.closest(".group").querySelectorAll('[role="menuitemradio"]');Array.from(t).filter(t=>t!==e).forEach(e=>{e.ariaChecked="false"}),e.ariaChecked="true"}calculateFloatingUIPosition(e){const t=this.setupFloatingUI(e),n=this.menu.getAttribute("data-placement");return t.update(),t.destroy(),n}open(e,t=!1){if(this.el.classList.contains("open")||this.animationInProcess)return!1;this.openedViaKeyboard=t,this.animationInProcess=!0,this.menu.style.cssText="";const n=e||this.el,i=window.getComputedStyle(this.el),s=(i.getPropertyValue("--scope")||"").trim(),l=(i.getPropertyValue("--strategy")||"fixed").trim();"window"===s&&document.body.appendChild(this.menu),"static"!==l&&(this.el._floatingUI=this.setupFloatingUI(n)),this.menu.style.margin=null,this.menu.classList.remove("hidden"),this.menu.classList.add("block"),setTimeout(()=>{var e;(null===(e=null==this?void 0:this.toggle)||void 0===e?void 0:e.ariaExpanded)&&(this.toggle.ariaExpanded="true"),this.el.classList.add("open"),window.HSAccessibilityObserver&&this.accessibilityComponent&&window.HSAccessibilityObserver.updateComponentState(this.accessibilityComponent,!0),"window"===s&&this.menu.classList.add("open"),this.animationInProcess=!1,!this.hasAutofocus||this.autofocusOnKeyboardOnly&&!this.openedViaKeyboard||this.focusElement(),this.fireEvent("open",this.el),(0,o.JD)("open.dropdown",this.el,this.el)})}close(e=!0){if(this.animationInProcess||!this.el.classList.contains("open"))return!1;const t=(window.getComputedStyle(this.el).getPropertyValue("--scope")||"").trim();if(this.animationInProcess=!0,"window"===t&&this.menu.classList.remove("open"),window.HSAccessibilityObserver&&this.accessibilityComponent&&window.HSAccessibilityObserver.updateComponentState(this.accessibilityComponent,!1),e){const e=this.el.querySelector("[data-dropdown-transition]")||this.menu;let t=!1;const n=()=>{t||(t=!0,this.destroyFloatingUI())};(0,o.yd)(e,n);const i=window.getComputedStyle(e).getPropertyValue("transition-duration"),s=1e3*parseFloat(i)||150;setTimeout(n,s+50)}else this.destroyFloatingUI();(()=>{var e;this.menu.style.margin=null,(null===(e=null==this?void 0:this.toggle)||void 0===e?void 0:e.ariaExpanded)&&(this.toggle.ariaExpanded="false"),this.el.classList.remove("open"),this.openedViaKeyboard=!1,this.fireEvent("close",this.el),(0,o.JD)("close.dropdown",this.el,this.el)})()}forceClearState(){this.destroyFloatingUI(),this.menu.style.margin=null,this.el.classList.remove("open"),this.menu.classList.add("hidden"),this.openedViaKeyboard=!1}destroy(){(0,o.un)()||(0,o.zG)()||(this.el.removeEventListener("mouseenter",this.onElementMouseEnterListener),this.el.removeEventListener("mouseleave",()=>this.onElementMouseLeaveListener),this.onElementMouseEnterListener=null,this.onElementMouseLeaveListener=null),"contextmenu"===this.eventMode?(this.toggle&&(this.toggle.removeEventListener("contextmenu",this.onToggleContextMenuListener),this.toggle.removeEventListener("touchstart",this.onTouchStartListener),this.toggle.removeEventListener("touchend",this.onTouchEndListener),this.toggle.removeEventListener("touchmove",this.onTouchEndListener)),this.onToggleContextMenuListener=null,this.onTouchStartListener=null,this.onTouchEndListener=null):(this.toggle&&this.toggle.removeEventListener("click",this.onToggleClickListener),this.onToggleClickListener=null),this.closers.length&&(this.closers.forEach(e=>{e.removeEventListener("click",this.onCloserClickListener.find(t=>t.el===e).fn)}),this.onCloserClickListener=null),this.el.classList.remove("open"),this.destroyFloatingUI(),window.$hsDropdownCollection=window.$hsDropdownCollection.filter(({element:e})=>e.el!==this.el)}static findInCollection(e){return window.$hsDropdownCollection.find(t=>e instanceof c?t.element.el===e.el:"string"==typeof e?t.element.el===document.querySelector(e):t.element.el===e)||null}static getInstance(e,t){const n=window.$hsDropdownCollection.find(t=>t.element.el===("string"==typeof e?document.querySelector(e):e));return n?t?n:n.element:null}static autoInit(){if(!window.$hsDropdownCollection){window.$hsDropdownCollection=[],window.addEventListener("click",e=>{const t=e.target;c.closeCurrentlyOpened(t)});let e=window.innerWidth;window.addEventListener("resize",()=>{window.innerWidth!==e&&(e=innerWidth,c.closeCurrentlyOpened(null,!1))})}window.$hsDropdownCollection&&(window.$hsDropdownCollection=window.$hsDropdownCollection.filter(({element:e})=>document.contains(e.el))),document.querySelectorAll(".dropdown:not(.--prevent-on-load-init)").forEach(e=>{window.$hsDropdownCollection.find(t=>{var n;return(null===(n=null==t?void 0:t.element)||void 0===n?void 0:n.el)===e})||new c(e)})}static open(e,t=!1){const n=c.findInCollection(e);n&&n.element.menu.classList.contains("hidden")&&n.element.open(void 0,t)}static close(e){const t=c.findInCollection(e);t&&!t.element.menu.classList.contains("hidden")&&t.element.close()}static closeCurrentlyOpened(e=null,t=!0){const n=e&&e.closest(".dropdown")&&e.closest(".dropdown").parentElement.closest(".dropdown")?e.closest(".dropdown").parentElement.closest(".dropdown"):null;let i=n?window.$hsDropdownCollection.filter(e=>e.element.el.classList.contains("open")&&e.element.menu.closest(".dropdown").parentElement.closest(".dropdown")===n):window.$hsDropdownCollection.filter(e=>e.element.el.classList.contains("open"));if(e){const t=e.closest(".dropdown");if(t)"inside"===(0,o.BF)(t,"--auto-close")&&(i=i.filter(e=>e.element.el!==t));else{const t=e.closest(".dropdown-menu");if(t){const e=window.$hsDropdownCollection.find(e=>e.element.menu===t);e&&"inside"===(0,o.BF)(e.element.el,"--auto-close")&&(i=i.filter(t=>t.element.el!==e.element.el))}}}e&&e.closest(".dropdown")&&"outside"===(0,o.BF)(e.closest(".dropdown"),"--auto-close")&&(i=i.filter(t=>t.element.el==e.closest(".dropdown")),i.forEach(e=>e.element.close(t))),i&&i.forEach(e=>{if("false"===e.element.closeMode||"outside"===e.element.closeMode)return!1;e.element.close(t)}),i&&i.forEach(e=>{if("contextmenu"!==(0,o.BF)(e.element.el,"--trigger"))return!1;document.body.style.overflow="",document.body.style.paddingRight=""})}setupAccessibility(){this.accessibilityComponent=window.HSAccessibilityObserver.registerComponent(this.el,{onEnter:()=>{this.isOpened()||this.open(void 0,!0)},onSpace:()=>{this.isOpened()||this.open(void 0,!0)},onEsc:()=>{this.isOpened()&&(this.close(),this.toggle&&this.toggle.focus())},onArrow:e=>{if(!e.metaKey)switch(e.key){case"ArrowDown":this.isOpened()?this.focusMenuItem("next"):this.open(void 0,!0);break;case"ArrowUp":this.isOpened()&&this.focusMenuItem("prev");break;case"ArrowRight":this.onArrowX(e,"right");break;case"ArrowLeft":this.onArrowX(e,"left")}},onHome:()=>{this.isOpened()&&this.onStartEnd(!0)},onEnd:()=>{this.isOpened()&&this.onStartEnd(!1)},onTab:()=>{this.isOpened()&&this.close()},onFirstLetter:e=>{this.isOpened()&&this.onFirstLetter(e)}},this.isOpened(),"Dropdown",".dropdown",this.menu)}onFirstLetter(e){var t;if(!this.isOpened()||!this.menu)return;const n=this.menu.querySelectorAll('a:not([hidden]), button:not([hidden]), [role="menuitem"]:not([hidden]), .dropdown-item');if(0===n.length)return;const o=Array.from(n).indexOf(document.activeElement);for(let i=1;i<=n.length;i++){const s=(o+i)%n.length;if(((null===(t=n[s].textContent)||void 0===t?void 0:t.trim().toLowerCase())||"").startsWith(e.toLowerCase()))return void n[s].focus()}n[0].focus()}onArrowX(e,t){if(!this.isOpened())return;e.preventDefault(),e.stopImmediatePropagation();const n=this.menu.querySelectorAll('a:not([hidden]), button:not([hidden]), [role="menuitem"]:not([hidden]), .dropdown-item');if(!n.length)return;const o=Array.from(n).indexOf(document.activeElement);let i=-1;i="right"===t?(o+1)%n.length:o>0?o-1:n.length-1,n[i].focus()}onStartEnd(e=!0){if(!this.isOpened())return;const t=this.menu.querySelectorAll('a:not([hidden]), button:not([hidden]), [role="menuitem"]:not([hidden]), .dropdown-item');if(!t.length)return;t[e?0:t.length-1].focus()}focusMenuItem(e){const t=this.menu.querySelectorAll('a:not([hidden]), button:not([hidden]), [role="menuitem"]:not([hidden]), .dropdown-item');if(!t.length)return;const n=Array.from(t).indexOf(document.activeElement);t["next"===e?(n+1)%t.length:(n-1+t.length)%t.length].focus()}static on(e,t,n){const o=c.findInCollection(t);o&&(o.element.events[e]=n)}isOpened(){return this.isOpen()}containsElement(e){return this.el.contains(e)}}window.addEventListener("load",()=>{c.autoInit()}),window.addEventListener("resize",()=>{window.$hsDropdownCollection||(window.$hsDropdownCollection=[]),window.$hsDropdownCollection.forEach(e=>e.element.resizeHandler())}),"undefined"!=typeof window&&(window.HSDropdown=c);const a=c},663:(e,t,n)=>{n.d(t,{ll:()=>ve,rD:()=>Ce,UU:()=>be,cY:()=>ye});const o=Math.min,i=Math.max,s=Math.round,l=Math.floor,r=e=>({x:e,y:e}),c={left:"right",right:"left",bottom:"top",top:"bottom"},a={start:"end",end:"start"};function d(e,t){return"function"==typeof e?e(t):e}function h(e){return e.split("-")[0]}function u(e){return e.split("-")[1]}function p(e){return"y"===e?"height":"width"}const m=new Set(["top","bottom"]);function f(e){return m.has(h(e))?"y":"x"}function g(e){return"x"===f(e)?"y":"x"}function w(e){return e.replace(/start|end/g,e=>a[e])}const v=["left","right"],y=["right","left"],b=["top","bottom"],C=["bottom","top"];function x(e,t,n,o){const i=u(e);let s=function(e,t,n){switch(e){case"top":case"bottom":return n?t?y:v:t?v:y;case"left":case"right":return t?b:C;default:return[]}}(h(e),"start"===n,o);return i&&(s=s.map(e=>e+"-"+i),t&&(s=s.concat(s.map(w)))),s}function L(e){return e.replace(/left|right|bottom|top/g,e=>c[e])}function E(e){const{x:t,y:n,width:o,height:i}=e;return{width:o,height:i,top:n,left:t,right:t+o,bottom:n+i,x:t,y:n}}function A(e,t,n){let{reference:o,floating:i}=e;const s=f(t),l=g(t),r=p(l),c=h(t),a="y"===s,d=o.x+o.width/2-i.width/2,m=o.y+o.height/2-i.height/2,w=o[r]/2-i[r]/2;let v;switch(c){case"top":v={x:d,y:o.y-i.height};break;case"bottom":v={x:d,y:o.y+o.height};break;case"right":v={x:o.x+o.width,y:m};break;case"left":v={x:o.x-i.width,y:m};break;default:v={x:o.x,y:o.y}}switch(u(t)){case"start":v[l]-=w*(n&&a?-1:1);break;case"end":v[l]+=w*(n&&a?-1:1)}return v}async function S(e,t){var n;void 0===t&&(t={});const{x:o,y:i,platform:s,rects:l,elements:r,strategy:c}=e,{boundary:a="clippingAncestors",rootBoundary:h="viewport",elementContext:u="floating",altBoundary:p=!1,padding:m=0}=d(t,e),f=function(e){return"number"!=typeof e?function(e){return{top:0,right:0,bottom:0,left:0,...e}}(e):{top:e,right:e,bottom:e,left:e}}(m),g=r[p?"floating"===u?"reference":"floating":u],w=E(await s.getClippingRect({element:null==(n=await(null==s.isElement?void 0:s.isElement(g)))||n?g:g.contextElement||await(null==s.getDocumentElement?void 0:s.getDocumentElement(r.floating)),boundary:a,rootBoundary:h,strategy:c})),v="floating"===u?{x:o,y:i,width:l.floating.width,height:l.floating.height}:l.reference,y=await(null==s.getOffsetParent?void 0:s.getOffsetParent(r.floating)),b=await(null==s.isElement?void 0:s.isElement(y))&&await(null==s.getScale?void 0:s.getScale(y))||{x:1,y:1},C=E(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:r,rect:v,offsetParent:y,strategy:c}):v);return{top:(w.top-C.top+f.top)/b.y,bottom:(C.bottom-w.bottom+f.bottom)/b.y,left:(w.left-C.left+f.left)/b.x,right:(C.right-w.right+f.right)/b.x}}const T=new Set(["left","top"]);function P(){return"undefined"!=typeof window}function k(e){return I(e)?(e.nodeName||"").toLowerCase():"#document"}function O(e){var t;return(null==e||null==(t=e.ownerDocument)?void 0:t.defaultView)||window}function D(e){var t;return null==(t=(I(e)?e.ownerDocument:e.document)||window.document)?void 0:t.documentElement}function I(e){return!!P()&&(e instanceof Node||e instanceof O(e).Node)}function M(e){return!!P()&&(e instanceof Element||e instanceof O(e).Element)}function R(e){return!!P()&&(e instanceof HTMLElement||e instanceof O(e).HTMLElement)}function $(e){return!(!P()||"undefined"==typeof ShadowRoot)&&(e instanceof ShadowRoot||e instanceof O(e).ShadowRoot)}const F=new Set(["inline","contents"]);function H(e){const{overflow:t,overflowX:n,overflowY:o,display:i}=_(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!F.has(i)}const V=new Set(["table","td","th"]);function q(e){return V.has(k(e))}const U=[":popover-open",":modal"];function K(e){return U.some(t=>{try{return e.matches(t)}catch(e){return!1}})}const j=["transform","translate","scale","rotate","perspective"],W=["transform","translate","scale","rotate","perspective","filter"],B=["paint","layout","strict","content"];function z(e){const t=N(),n=M(e)?_(e):e;return j.some(e=>!!n[e]&&"none"!==n[e])||!!n.containerType&&"normal"!==n.containerType||!t&&!!n.backdropFilter&&"none"!==n.backdropFilter||!t&&!!n.filter&&"none"!==n.filter||W.some(e=>(n.willChange||"").includes(e))||B.some(e=>(n.contain||"").includes(e))}function N(){return!("undefined"==typeof CSS||!CSS.supports)&&CSS.supports("-webkit-backdrop-filter","none")}const G=new Set(["html","body","#document"]);function X(e){return G.has(k(e))}function _(e){return O(e).getComputedStyle(e)}function Y(e){return M(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function J(e){if("html"===k(e))return e;const t=e.assignedSlot||e.parentNode||$(e)&&e.host||D(e);return $(t)?t.host:t}function Z(e){const t=J(e);return X(t)?e.ownerDocument?e.ownerDocument.body:e.body:R(t)&&H(t)?t:Z(t)}function Q(e,t,n){var o;void 0===t&&(t=[]),void 0===n&&(n=!0);const i=Z(e),s=i===(null==(o=e.ownerDocument)?void 0:o.body),l=O(i);if(s){const e=ee(l);return t.concat(l,l.visualViewport||[],H(i)?i:[],e&&n?Q(e):[])}return t.concat(i,Q(i,[],n))}function ee(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function te(e){const t=_(e);let n=parseFloat(t.width)||0,o=parseFloat(t.height)||0;const i=R(e),l=i?e.offsetWidth:n,r=i?e.offsetHeight:o,c=s(n)!==l||s(o)!==r;return c&&(n=l,o=r),{width:n,height:o,$:c}}function ne(e){return M(e)?e:e.contextElement}function oe(e){const t=ne(e);if(!R(t))return r(1);const n=t.getBoundingClientRect(),{width:o,height:i,$:l}=te(t);let c=(l?s(n.width):n.width)/o,a=(l?s(n.height):n.height)/i;return c&&Number.isFinite(c)||(c=1),a&&Number.isFinite(a)||(a=1),{x:c,y:a}}const ie=r(0);function se(e){const t=O(e);return N()&&t.visualViewport?{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}:ie}function le(e,t,n,o){void 0===t&&(t=!1),void 0===n&&(n=!1);const i=e.getBoundingClientRect(),s=ne(e);let l=r(1);t&&(o?M(o)&&(l=oe(o)):l=oe(e));const c=function(e,t,n){return void 0===t&&(t=!1),!(!n||t&&n!==O(e))&&t}(s,n,o)?se(s):r(0);let a=(i.left+c.x)/l.x,d=(i.top+c.y)/l.y,h=i.width/l.x,u=i.height/l.y;if(s){const e=O(s),t=o&&M(o)?O(o):o;let n=e,i=ee(n);for(;i&&o&&t!==n;){const e=oe(i),t=i.getBoundingClientRect(),o=_(i),s=t.left+(i.clientLeft+parseFloat(o.paddingLeft))*e.x,l=t.top+(i.clientTop+parseFloat(o.paddingTop))*e.y;a*=e.x,d*=e.y,h*=e.x,u*=e.y,a+=s,d+=l,n=O(i),i=ee(n)}}return E({width:h,height:u,x:a,y:d})}function re(e,t){const n=Y(e).scrollLeft;return t?t.left+n:le(D(e)).left+n}function ce(e,t,n){void 0===n&&(n=!1);const o=e.getBoundingClientRect();return{x:o.left+t.scrollLeft-(n?0:re(e,o)),y:o.top+t.scrollTop}}const ae=new Set(["absolute","fixed"]);function de(e,t,n){let o;if("viewport"===t)o=function(e,t){const n=O(e),o=D(e),i=n.visualViewport;let s=o.clientWidth,l=o.clientHeight,r=0,c=0;if(i){s=i.width,l=i.height;const e=N();(!e||e&&"fixed"===t)&&(r=i.offsetLeft,c=i.offsetTop)}return{width:s,height:l,x:r,y:c}}(e,n);else if("document"===t)o=function(e){const t=D(e),n=Y(e),o=e.ownerDocument.body,s=i(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),l=i(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight);let r=-n.scrollLeft+re(e);const c=-n.scrollTop;return"rtl"===_(o).direction&&(r+=i(t.clientWidth,o.clientWidth)-s),{width:s,height:l,x:r,y:c}}(D(e));else if(M(t))o=function(e,t){const n=le(e,!0,"fixed"===t),o=n.top+e.clientTop,i=n.left+e.clientLeft,s=R(e)?oe(e):r(1);return{width:e.clientWidth*s.x,height:e.clientHeight*s.y,x:i*s.x,y:o*s.y}}(t,n);else{const n=se(e);o={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return E(o)}function he(e,t){const n=J(e);return!(n===t||!M(n)||X(n))&&("fixed"===_(n).position||he(n,t))}function ue(e,t,n){const o=R(t),i=D(t),s="fixed"===n,l=le(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const a=r(0);function d(){a.x=re(i)}if(o||!o&&!s)if(("body"!==k(t)||H(i))&&(c=Y(t)),o){const e=le(t,!0,s,t);a.x=e.x+t.clientLeft,a.y=e.y+t.clientTop}else i&&d();s&&!o&&i&&d();const h=!i||o||s?r(0):ce(i,c);return{x:l.left+c.scrollLeft-a.x-h.x,y:l.top+c.scrollTop-a.y-h.y,width:l.width,height:l.height}}function pe(e){return"static"===_(e).position}function me(e,t){if(!R(e)||"fixed"===_(e).position)return null;if(t)return t(e);let n=e.offsetParent;return D(e)===n&&(n=n.ownerDocument.body),n}function fe(e,t){const n=O(e);if(K(e))return n;if(!R(e)){let t=J(e);for(;t&&!X(t);){if(M(t)&&!pe(t))return t;t=J(t)}return n}let o=me(e,t);for(;o&&q(o)&&pe(o);)o=me(o,t);return o&&X(o)&&pe(o)&&!z(o)?n:o||function(e){let t=J(e);for(;R(t)&&!X(t);){if(z(t))return t;if(K(t))return null;t=J(t)}return null}(e)||n}const ge={convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e;const s="fixed"===i,l=D(o),c=!!t&&K(t.floating);if(o===l||c&&s)return n;let a={scrollLeft:0,scrollTop:0},d=r(1);const h=r(0),u=R(o);if((u||!u&&!s)&&(("body"!==k(o)||H(l))&&(a=Y(o)),R(o))){const e=le(o);d=oe(o),h.x=e.x+o.clientLeft,h.y=e.y+o.clientTop}const p=!l||u||s?r(0):ce(l,a,!0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-a.scrollLeft*d.x+h.x+p.x,y:n.y*d.y-a.scrollTop*d.y+h.y+p.y}},getDocumentElement:D,getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:s,strategy:l}=e;const r=[..."clippingAncestors"===n?K(t)?[]:function(e,t){const n=t.get(e);if(n)return n;let o=Q(e,[],!1).filter(e=>M(e)&&"body"!==k(e)),i=null;const s="fixed"===_(e).position;let l=s?J(e):e;for(;M(l)&&!X(l);){const t=_(l),n=z(l);n||"fixed"!==t.position||(i=null),(s?!n&&!i:!n&&"static"===t.position&&i&&ae.has(i.position)||H(l)&&!n&&he(e,l))?o=o.filter(e=>e!==l):i=t,l=J(l)}return t.set(e,o),o}(t,this._c):[].concat(n),s],c=r[0],a=r.reduce((e,n)=>{const s=de(t,n,l);return e.top=i(s.top,e.top),e.right=o(s.right,e.right),e.bottom=o(s.bottom,e.bottom),e.left=i(s.left,e.left),e},de(t,c,l));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}},getOffsetParent:fe,getElementRects:async function(e){const t=this.getOffsetParent||fe,n=this.getDimensions,o=await n(e.floating);return{reference:ue(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}},getClientRects:function(e){return Array.from(e.getClientRects())},getDimensions:function(e){const{width:t,height:n}=te(e);return{width:t,height:n}},getScale:oe,isElement:M,isRTL:function(e){return"rtl"===_(e).direction}};function we(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ve(e,t,n,s){void 0===s&&(s={});const{ancestorScroll:r=!0,ancestorResize:c=!0,elementResize:a="function"==typeof ResizeObserver,layoutShift:d="function"==typeof IntersectionObserver,animationFrame:h=!1}=s,u=ne(e),p=r||c?[...u?Q(u):[],...Q(t)]:[];p.forEach(e=>{r&&e.addEventListener("scroll",n,{passive:!0}),c&&e.addEventListener("resize",n)});const m=u&&d?function(e,t){let n,s=null;const r=D(e);function c(){var e;clearTimeout(n),null==(e=s)||e.disconnect(),s=null}return function a(d,h){void 0===d&&(d=!1),void 0===h&&(h=1),c();const u=e.getBoundingClientRect(),{left:p,top:m,width:f,height:g}=u;if(d||t(),!f||!g)return;const w={rootMargin:-l(m)+"px "+-l(r.clientWidth-(p+f))+"px "+-l(r.clientHeight-(m+g))+"px "+-l(p)+"px",threshold:i(0,o(1,h))||1};let v=!0;function y(t){const o=t[0].intersectionRatio;if(o!==h){if(!v)return a();o?a(!1,o):n=setTimeout(()=>{a(!1,1e-7)},1e3)}1!==o||we(u,e.getBoundingClientRect())||a(),v=!1}try{s=new IntersectionObserver(y,{...w,root:r.ownerDocument})}catch(e){s=new IntersectionObserver(y,w)}s.observe(e)}(!0),c}(u,n):null;let f,g=-1,w=null;a&&(w=new ResizeObserver(e=>{let[o]=e;o&&o.target===u&&w&&(w.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var e;null==(e=w)||e.observe(t)})),n()}),u&&!h&&w.observe(u),w.observe(t));let v=h?le(e):null;return h&&function t(){const o=le(e);v&&!we(v,o)&&n();v=o,f=requestAnimationFrame(t)}(),n(),()=>{var e;p.forEach(e=>{r&&e.removeEventListener("scroll",n),c&&e.removeEventListener("resize",n)}),null==m||m(),null==(e=w)||e.disconnect(),w=null,h&&cancelAnimationFrame(f)}}const ye=function(e){return void 0===e&&(e=0),{name:"offset",options:e,async fn(t){var n,o;const{x:i,y:s,placement:l,middlewareData:r}=t,c=await async function(e,t){const{placement:n,platform:o,elements:i}=e,s=await(null==o.isRTL?void 0:o.isRTL(i.floating)),l=h(n),r=u(n),c="y"===f(n),a=T.has(l)?-1:1,p=s&&c?-1:1,m=d(t,e);let{mainAxis:g,crossAxis:w,alignmentAxis:v}="number"==typeof m?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return r&&"number"==typeof v&&(w="end"===r?-1*v:v),c?{x:w*p,y:g*a}:{x:g*a,y:w*p}}(t,e);return l===(null==(n=r.offset)?void 0:n.placement)&&null!=(o=r.arrow)&&o.alignmentOffset?{}:{x:i+c.x,y:s+c.y,data:{...c,placement:l}}}}},be=function(e){return void 0===e&&(e={}),{name:"flip",options:e,async fn(t){var n,o;const{placement:i,middlewareData:s,rects:l,initialPlacement:r,platform:c,elements:a}=t,{mainAxis:m=!0,crossAxis:v=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:C="none",flipAlignment:E=!0,...A}=d(e,t);if(null!=(n=s.arrow)&&n.alignmentOffset)return{};const T=h(i),P=f(r),k=h(r)===r,O=await(null==c.isRTL?void 0:c.isRTL(a.floating)),D=y||(k||!E?[L(r)]:function(e){const t=L(e);return[w(e),t,w(t)]}(r)),I="none"!==C;!y&&I&&D.push(...x(r,E,C,O));const M=[r,...D],R=await S(t,A),$=[];let F=(null==(o=s.flip)?void 0:o.overflows)||[];if(m&&$.push(R[T]),v){const e=function(e,t,n){void 0===n&&(n=!1);const o=u(e),i=g(e),s=p(i);let l="x"===i?o===(n?"end":"start")?"right":"left":"start"===o?"bottom":"top";return t.reference[s]>t.floating[s]&&(l=L(l)),[l,L(l)]}(i,l,O);$.push(R[e[0]],R[e[1]])}if(F=[...F,{placement:i,overflows:$}],!$.every(e=>e<=0)){var H,V;const e=((null==(H=s.flip)?void 0:H.index)||0)+1,t=M[e];if(t){if(!("alignment"===v&&P!==f(t))||F.every(e=>f(e.placement)!==P||e.overflows[0]>0))return{data:{index:e,overflows:F},reset:{placement:t}}}let n=null==(V=F.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?void 0:V.placement;if(!n)switch(b){case"bestFit":{var q;const e=null==(q=F.filter(e=>{if(I){const t=f(e.placement);return t===P||"y"===t}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?void 0:q[0];e&&(n=e);break}case"initialPlacement":n=r}if(i!==n)return{reset:{placement:n}}}return{}}}},Ce=(e,t,n)=>{const o=new Map,i={platform:ge,...n},s={...i.platform,_c:o};return(async(e,t,n)=>{const{placement:o="bottom",strategy:i="absolute",middleware:s=[],platform:l}=n,r=s.filter(Boolean),c=await(null==l.isRTL?void 0:l.isRTL(t));let a=await l.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:h}=A(a,o,c),u=o,p={},m=0;for(let n=0;n<r.length;n++){const{name:s,fn:f}=r[n],{x:g,y:w,data:v,reset:y}=await f({x:d,y:h,initialPlacement:o,placement:u,strategy:i,middlewareData:p,rects:a,platform:l,elements:{reference:e,floating:t}});d=null!=g?g:d,h=null!=w?w:h,p={...p,[s]:{...p[s],...v}},y&&m<=50&&(m++,"object"==typeof y&&(y.placement&&(u=y.placement),y.rects&&(a=!0===y.rects?await l.getElementRects({reference:e,floating:t,strategy:i}):y.rects),({x:d,y:h}=A(a,u,c))),n=-1)}return{x:d,y:h,placement:u,strategy:i,middlewareData:p}})(e,t,{...i,platform:s})}},709:(e,t,n)=>{n.d(t,{A:()=>o});class o{constructor(e,t,n){this.el=e,this.options=t,this.events=n,this.el=e,this.options=t,this.events={}}createCollection(e,t){var n;e.push({id:(null===(n=null==t?void 0:t.el)||void 0===n?void 0:n.id)||e.length+1,element:t})}fireEvent(e,t=null){if(this.events.hasOwnProperty(e))return this.events[e](t)}on(e,t){this.events[e]=t}}}},t={};function n(o){var i=t[o];if(void 0!==i)return i.exports;var s=t[o]={exports:{}};return e[o](s,s.exports,n),s.exports}n.d=(e,t)=>{for(var o in t)n.o(t,o)&&!n.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var o={};n.d(o,{A:()=>c});var i=n(392),s=n(709),l=n(479); /* * HSCollapse * @version: 3.2.2 * @author: Preline Labs Ltd. * @license: Licensed under MIT and Preline UI Fair Use License (https://preline.co/docs/license.html) * Copyright 2024 Preline Labs Ltd. */ class r extends s.A{constructor(e,t,n){super(e,t,n),this.contentId=this.el.dataset.collapse,this.content=document.querySelector(this.contentId),this.animationInProcess=!1,this.content&&this.init()}elementClick(){this.content.classList.contains("open")?this.hide():this.show()}init(){var e;this.createCollection(window.$hsCollapseCollection,this),this.onElementClickListener=()=>this.elementClick(),(null===(e=null==this?void 0:this.el)||void 0===e?void 0:e.ariaExpanded)&&(this.el.classList.contains("open")?this.el.ariaExpanded="true":this.el.ariaExpanded="false"),this.el.addEventListener("click",this.onElementClickListener)}hideAllMegaMenuItems(){this.content.querySelectorAll(".mega-menu-content.block").forEach(e=>{e.classList.remove("block"),e.classList.add("hidden")})}closeDropdowns(){if(!this.content)return;this.content.querySelectorAll(".dropdown").forEach(e=>{try{const t=l.A.getInstance(e,!0);if(!(null==t?void 0:t.element))return;e instanceof HTMLElement&&e.classList.contains("open")&&t.element.close(!1)}catch(e){console.warn("Error closing dropdown:",e)}})}show(){var e;if(this.animationInProcess||this.el.classList.contains("open"))return!1;this.animationInProcess=!0,this.el.classList.add("open"),(null===(e=null==this?void 0:this.el)||void 0===e?void 0:e.ariaExpanded)&&(this.el.ariaExpanded="true"),this.content.classList.add("open"),this.content.classList.remove("hidden"),this.content.style.height="0",setTimeout(()=>{this.content.style.height=`${this.content.scrollHeight}px`,this.fireEvent("beforeOpen",this.el),(0,i.JD)("beforeOpen.collapse",this.el,this.el)}),(0,i.yd)(this.content,()=>{this.content.style.height="",this.fireEvent("open",this.el),(0,i.JD)("open.collapse",this.el,this.el),this.animationInProcess=!1})}hide(){var e;if(this.animationInProcess||!this.el.classList.contains("open"))return!1;this.animationInProcess=!0,this.el.classList.remove("open"),(null===(e=null==this?void 0:this.el)||void 0===e?void 0:e.ariaExpanded)&&(this.el.ariaExpanded="false"),this.content.style.height=`${this.content.scrollHeight}px`,setTimeout(()=>{this.content.style.height="0"}),this.content.classList.remove("open"),(0,i.yd)(this.content,()=>{this.content.classList.add("hidden"),this.content.style.height="",this.fireEvent("hide",this.el),(0,i.JD)("hide.collapse",this.el,this.el),this.animationInProcess=!1}),this.content.querySelectorAll(".mega-menu-content.block").length&&this.hideAllMegaMenuItems(),this.closeDropdowns()}destroy(){this.el.removeEventListener("click",this.onElementClickListener),this.content=null,this.animationInProcess=!1,window.$hsCollapseCollection=window.$hsCollapseCollection.filter(({element:e})=>e.el!==this.el)}static findInCollection(e){return window.$hsCollapseCollection.find(t=>e instanceof r?t.element.el===e.el:"string"==typeof e?t.element.el===document.querySelector(e):t.element.el===e)||null}static getInstance(e,t=!1){const n=window.$hsCollapseCollection.find(t=>t.element.el===("string"==typeof e?document.querySelector(e):e));return n?t?n:n.element.el:null}static autoInit(){window.$hsCollapseCollection||(window.$hsCollapseCollection=[]),window.$hsCollapseCollection&&(window.$hsCollapseCollection=window.$hsCollapseCollection.filter(({element:e})=>document.contains(e.el))),document.querySelectorAll(".collapse-toggle:not(.--prevent-on-load-init)").forEach(e=>{window.$hsCollapseCollection.find(t=>{var n;return(null===(n=null==t?void 0:t.element)||void 0===n?void 0:n.el)===e})||new r(e)})}static show(e){const t=r.findInCollection(e);t&&t.element.content.classList.contains("hidden")&&t.element.show()}static hide(e){const t=r.findInCollection(e);t&&!t.element.content.classList.contains("hidden")&&t.element.hide()}static on(e,t,n){const o=r.findInCollection(t);o&&(o.element.events[e]=n)}}window.addEventListener("load",()=>{r.autoInit()}),"undefined"!=typeof window&&(window.HSCollapse=r);const c=r,a=o.A;export{a as default};