1var g=Object.defineProperty;var $=(l,t,e)=>t in l?g(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e;var d=(l,t)=>g(l,"name",{value:t,configurable:!0});var c=(l,t,e)=>$(l,typeof t!="symbol"?t+"":t,e);import{f as p}from"./site-B0JexaGd.js";const s=class s{static _handleClick(t){const e=t.target.closest(`[${s.Attributes.TRIGGER}]`);if(!e)return;const i=e.closest(`[${p.Attributes.MODULE}="${s.name}"]`);if(!i)return;const n=s._instances.get(i.id);n?.enabled&&n.onTriggerClick(e)}static _handleKeydown(t){const e=t.target.closest(`[${s.Attributes.TRIGGER}]`);if(!e)return;const i=e.closest(`[${p.Attributes.MODULE}="${s.name}"]`);if(!i)return;const n=s._instances.get(i.id);n?.enabled&&n.onTriggerKeydown(t,e)}static _registerInstance(t,e){s._instances.set(t,e)}static _unregisterInstance(t){s._instances.delete(t)}constructor(t,e={}){this.$element=t,this.options={...s.Options,...e},this.enabled=!0,this.options.id||(this.options.id=`how-it-works-${s._idCounter++}`),this.$element.id=this.options.id,s._registerInstance(this.options.id,this),this.init()}init(){if(this.$triggers=[...this.$element.querySelectorAll(`[${s.Attributes.TRIGGER}]`)],this.$panels=[...this.$element.querySelectorAll(`[${s.Attributes.PANEL}]`)],this.$triggers.length===0||this.$triggers.length!==this.$panels.length)return this.enabled=!1,console.warn("HowItWorks: trigger and panel counts must match and be non-zero."),this;const t=d(e=>parseInt(e.getAttribute("data-item-index"),10)||0,"byIndex");return this.$triggers.sort((e,i)=>t(e)-t(i)),this.$panels.sort((e,i)=>t(e)-t(i)),this.$triggers.forEach((e,i)=>{const n=e.getAttribute("data-item-index")||String(i+1),a=`${this.options.id}-tab-${n}`,r=`${this.options.id}-panel-${n}`;e.id=a,e.setAttribute("aria-controls",r);const o=this.$panels[i];o.id=r,o.setAttribute("role","tabpanel"),o.setAttribute("aria-labelledby",a)}),this.activeIndex=0,this._panelTransitioning=!1,this._panelTransitionFallbackTimer=null,this.activate(0,{focus:!1,initial:!0}),this}_prefersReducedMotion(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}activate(t,{focus:e=!0,initial:i=!1}={}){if(t<0||t>=this.$triggers.length||!i&&(t===this.activeIndex||this._panelTransitioning))return;const n=this.activeIndex;this.activeIndex=t,this.syncTriggers(),i||this._prefersReducedMotion()?this.applyInstantPanels(t):this.transitionPanels(n,t),e&&this.$triggers[t].focus()}syncTriggers(){this.$triggers.forEach((t,e)=>{const i=e===this.activeIndex;t.setAttribute("aria-selected",i?"true":"false"),t.tabIndex=i?0:-1})}applyInstantPanels(t){this._clearPanelTransitionFallback(),this._panelTransitioning=!1,this.$panels.forEach((e,i)=>{e.hidden=i!==t,e.style.zIndex="",e.style.opacity="",e.style.transition=""})}transitionPanels(t,e){const i=this.$panels[t],n=this.$panels[e],{PANEL_TRANSITION_MS:a}=s,r="ease-out";this._panelTransitioning=!0,this._clearPanelTransitionFallback(),i.style.zIndex="1",n.removeAttribute("hidden"),n.style.zIndex="2",n.style.opacity="0",n.style.transition=`opacity ${a}ms ${r}`,requestAnimationFrame(()=>{requestAnimationFrame(()=>{n.style.opacity="1"})});const o=d(()=>{this._panelTransitioning&&(this._clearPanelTransitionFallback(),n.removeEventListener("transitionend",h),i.setAttribute("hidden",""),i.style.zIndex="",i.style.opacity="",i.style.transition="",n.style.zIndex="",n.style.opacity="",n.style.transition="",this._panelTransitioning=!1)},"finish"),h=d(u=>{u.target!==n||u.propertyName!=="opacity"||o()},"onEnd");n.addEventListener("transitionend",h),this._panelTransitionFallbackTimer=window.setTimeout(o,a+50)}_clearPanelTransitionFallback(){this._panelTransitionFallbackTimer!==null&&(window.clearTimeout(this._panelTransitionFallbackTimer),this._panelTransitionFallbackTimer=null)}onTriggerClick(t){const e=this.$triggers.indexOf(t);e!==-1&&this.activate(e,{focus:!1})}onTriggerKeydown(t,e){const i=this.$triggers.indexOf(e);if(i===-1)return;const{key:n}=t,a=this.$triggers.length-1;if(n==="ArrowDown"){t.preventDefault();const r=i>=a?0:i+1;this.activate(r);return}if(n==="ArrowUp"){t.preventDefault();const r=i<=0?a:i-1;this.activate(r);return}if(n==="Home"){t.preventDefault(),this.activate(0);return}n==="End"&&(t.preventDefault(),this.activate(a))}destroy(){this._clearPanelTransitionFallback(),s._unregisterInstance(this.options.id)}};d(s,"HowItWorks"),c(s,"Attributes",{TRIGGER:"data-item-trigger",PANEL:"data-item-image"}),c(s,"Options",{id:void 0}),c(s,"_idCounter",0),c(s,"_instances",new Map),document.addEventListener("click",
1s._handleClick),document.addEventListener("keydown",s._handleKeydown),c(s,"PANEL_TRANSITION_MS",300);let f=s;export{f as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.