import{viewportObserver}from"@dna/utils";export const FocusTrapMixin=superClass=>class extends superClass{firstUpdated(){super.firstUpdated(),this._setupFocusTrap()}_setupFocusTrap(){const focusableElements=this.shadowRoot.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'),firstFocusableElement=focusableElements[0],lastFocusableElement=focusableElements[focusableElements.length-1];this.addEventListener("keydown",e=>{console.log(e.key),e.key==="Tab"&&(e.shiftKey?document.activeElement===firstFocusableElement&&(e.preventDefault(),lastFocusableElement.focus()):document.activeElement===lastFocusableElement&&(e.preventDefault(),firstFocusableElement.focus()))})}},WithProfiler=superClass=>class ProfiledElement extends superClass{static instanceNumber=0;constructor(){super(),this.instanceId=ProfiledElement.instanceNumber++,this.profiler_fields=[]}willUpdate(changedProperties){return window?.performance?.mark&&window?.performance?.measure&&(window.performance.mark(`${this.constructor.name}:${this.instanceId}:start`),this.updateComplete.then(()=>{window.requestAnimationFrame(()=>{try{window.performance.measure(`${this.constructor.name}:${this.instanceId}`,{start:`${this.constructor.name}:${this.instanceId}:start`,detail:{devtools:{trackGroup:"Rothys",track:"Lit Render",properties:[["Component",`${this.constructor.name}`],["Render Reasons",Array.from(changedProperties.keys()).join(", ")],...this.profiler_fields.map(field=>[field,JSON.stringify(this[field])])]}}})}catch(e){console.error(e)}})})),super.willUpdate()}},RespondToViewport=superClass=>class extends superClass{static properties={isMobile:{type:Boolean},viewport:{type:String}};constructor(){super(),this.isMobile=!1,this.mobileBreakpoints=["mobile"],this.viewport=viewportObserver.currentViewport,this._setMobileBreakpoints(["mobile"]),this._handleViewportChange=this._handleViewportChange.bind(this)}connectedCallback(){super.connectedCallback(),viewportObserver.addListener(this._handleViewportChange)}disconnectedCallback(){super.disconnectedCallback(),viewportObserver.removeListener(this._handleViewportChange)}_handleViewportChange(newViewport){this.viewport=newViewport,this.isMobile=this.mobileBreakpoints.includes(newViewport)}_setMobileBreakpoints(breakpoints){breakpoints.length&&(this.mobileBreakpoints=breakpoints),this._handleViewportChange(this.viewport)}}; //# sourceMappingURL=/cdn/shop/t/1163/assets/lib-mixins.js.map?v=107742119456512108201760566306