var _a;import{createStore}from"@stencil/store";import{speak}from"@wordpress/a11y";import{__}from"@wordpress/i18n";export const store=createStore((()=>({cart:{open:!1}})),((o,t)=>JSON.stringify(o)!==JSON.stringify(t)));export const toggleCart=(o=null)=>{if(!o)return;const t=new CustomEvent("scToggleCart",{bubbles:!0});document.dispatchEvent(t)};const{on:on}=store;on("set",((o,t)=>{"cart"===o&&((null==t?void 0:t.open)?speak(__("Cart Opened","surecart"),"assertive"):speak(__("Cart Closed","surecart"),"assertive"))})),window.sc={...(null===window||void 0===window?void 0:window.sc)||{},cart:{...(null===(_a=null===window||void 0===window?void 0:window.sc)||void 0===_a?void 0:_a.cart)||{},toggle:toggleCart}};export{on};export default store;