1import{e as v,u as y,f,g as w,h as A,i,j as N,n as p,k as I,l as S,m as L,p as R}from"./C3wmcVjr.js";function _(t){return!!t&&String(t).startsWith("0|")}function b(t,o,e){if(!t||o)return null;if(!e.value)return{path:i("/checkout/cart"),log:{message:"no cart cookie, redirecting to cart"}};const a=String(e.value);if(!a.includes("|"))return null;const s=a.split("|"),n=Number.parseInt(s[0]??"",10),r=s[1]??"";return!r||n===0?{path:i("/checkout/cart"),log:{message:"cart cookie empty or invalid, redirecting to cart",data:{hasCartId:!!r,totalQty:n}}}:null}async function x(t,o,e,a){if(!(!t||!o)&&!(e.value&&!_(e.value))){a.info("app: loading cart from backend",{hadCookie:!!e.value});try{await R().loadCart(),a.info("app: cart loaded",{hasCookie:!!e.value})}catch{a.warn("app: loadCart threw â falling through to cookie guard")}}}const T=v(async t=>{let o,e;const a=y("checkout:middleware"),s=f(I),n=w(S),r=f(L),{isApp:u}=A(),h=!!s.value,C=!!n.value,d=h||C,g=i("/checkout/auth"),k=i("/checkout"),m=t.path===g,l=t.path===k;a.info("running",{path:t.path,isApp:u,hasCookie:!!r.value,isLoggedIn:h}),[o,e]=N(()=>x(l,u,r,a)),await o,e();const c=b(l,u,r);if(c)return a.info(c.log.message,c.log.data),p(c.path);if(!d&&l)return p(g);if(d&&m)return p(k)});export{T as default}; 2//# sourceMappingURL=DG14yHeN.js.map
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.