import{Component}from"@theme/component";import{StandardEvents}from"@shopify/events";import{DrawerOpenEvent,DrawerCloseEvent}from"@theme/theme-drawer";class HeaderActions extends Component{requiredRefs=["liveRegion"];connectedCallback(){super.connectedCallback(),document.addEventListener(StandardEvents.cartLinesUpdate,this.#onCartUpdate),document.addEventListener(DrawerOpenEvent.eventName,this.#onDrawerStateChange),document.addEventListener(DrawerCloseEvent.eventName,this.#onDrawerStateChange),this.#syncCartTriggerAriaExpanded()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(StandardEvents.cartLinesUpdate,this.#onCartUpdate),document.removeEventListener(DrawerOpenEvent.eventName,this.#onDrawerStateChange),document.removeEventListener(DrawerCloseEvent.eventName,this.#onDrawerStateChange)}#syncCartTriggerAriaExpanded=()=>{const cartDrawer=document.getElementById("cart-drawer");if(!cartDrawer)return;const trigger=this.querySelector('[aria-controls="cart-drawer"]');trigger&&trigger.setAttribute("aria-expanded",cartDrawer.hasAttribute("open")?"true":"false")};#onDrawerStateChange=event=>{event.target?.id==="cart-drawer"&&this.#syncCartTriggerAriaExpanded()};#onCartUpdate=event=>{event.promise?.then(({cart})=>{const cartCount=cart?.totalQuantity;cartCount!==void 0&&(this.refs.liveRegion.textContent=`${Theme.translations.cart_count}: ${cartCount}`)}).catch(error=>{error?.name!=="AbortError"&&console.warn("[header-actions] Event promise rejected:",error)})}}customElements.get("header-actions")||customElements.define("header-actions",HeaderActions);
//# sourceMappingURL=/s/files/1/0677/1399/0759/t/1/assets/header-actions.js.map?v=1783078800
