1import{mediaQueryLarge,isMobileBreakpoint}from '@theme/utilities';class AccordionCustom extends HTMLElement{get details(){const details=this.querySelector('details');if(!(details instanceof HTMLDetailsElement))throw new Error('Details element not found');return details} 2get summary(){const summary=this.details.querySelector('summary');if(!(summary instanceof HTMLElement))throw new Error('Summary element not found');return summary} 3get #disableOnMobile(){return this.dataset.disableOnMobile==='true'} 4get #disableOnDesktop(){return this.dataset.disableOnDesktop==='true'} 5get #closeWithEscape(){return this.dataset.closeWithEscape==='true'} 6#controller=new AbortController();connectedCallback(){const{signal}=this.#controller;this.#setDefaultOpenState();this.addEventListener('keydown',this.#handleKeyDown,{signal});this.summary.addEventListener('click',this.handleClick,{signal});mediaQueryLarge.addEventListener('change',this.#handleMediaQueryChange,{signal})} 7disconnectedCallback(){this.#controller.abort()} 8handleClick=(event)=>{const isMobile=isMobileBreakpoint();const isDesktop=!isMobile;if((isMobile&&this.#disableOnMobile)||(isDesktop&&this.#disableOnDesktop)){event.preventDefault();return}};#handleMediaQueryChange=()=>{this.#setDefaultOpenState()};#setDefaultOpenState(){const isMobile=isMobileBreakpoint();this.details.open=(isMobile&&this.hasAttribute('open-by-default-on-mobile'))||(!isMobile&&this.hasAttribute('open-by-default-on-desktop'))} 9#handleKeyDown(event){if(event.key==='Escape'&&this.#closeWithEscape){event.preventDefault();this.details.open=!1;this.summary.focus()}}} 10if(!customElements.get('accordion-custom')){customElements.define('accordion-custom',AccordionCustom)}
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.