AgPerry's picture
Add files using upload-large-folder tool
d276c3c verified
Raw History Blame Contribute Delete
27.1 kB
const app=document.querySelector('#app');
let catalog=[],cart={items:[],addons:[],plan:{servings:2,meals:3,preference:'All'},selected_meals:0,total:0},filters={q:'',category:'All',calories:0};
const money=n=>'$'+Number(n||0).toFixed(2);
const esc=s=>String(s??'').replace(/[&<>"']/g,c=>({'&':'&amp;','<':'&lt;','>':'&gt;','"':'&quot;',"'":'&#39;'}[c]));
function route(path){history.pushState({},'',path);boot()}
window.onpopstate=boot;
function shell(content,{simple=false}={}){document.body.className=simple?'simple':'';app.innerHTML=`<header class=site-header><nav><a onclick="route('/menu')">Menu</a><a onclick="route('/plans')">Blue Apron+</a><a onclick="route('/plans')">Subscribe & Save</a></nav><a class=brand onclick="route('/')">Blue Apron</a><div class=header-actions><button class=ghost onclick="route('/users/sign_in')">Login</button><button class=ghost onclick="route('/users/sign_up')">Sign Up</button></div></header><main>${content}</main><footer><div><b>BLUE APRON</b><a onclick="route('/menu')">Menu</a><a onclick="route('/plans')">Blue Apron+</a><a onclick="route('/plans')">Subscribe & Save</a><a onclick="route('/pages/vision')">About us</a><a onclick="route('/gift-cards')">Gift Cards</a><a onclick="route('/cookbook')">Recipe Book</a></div><div><b>SUPPORT & SERVICES</b><a onclick="route('/help')">Help Center & FAQ</a><a>Supply Chains Act</a><a>Terms & Conditions</a><a>Privacy Policy</a><a>Do Not Sell or Share My Personal Information</a></div><div><b>Account</b><a onclick="route('/users/sign_in')">Log In</a><a onclick="route('/account/upcoming')">Upcoming Deliveries</a></div><div><b>© Blue Apron 2026</b><span>Offline review sandbox</span><span>No real purchase, payment, or delivery</span></div></footer>`}
function img(item){return item.image?`<img src="${item.image}" alt="${esc(item.name)}">`:`<div class=placeholder>Blue Apron</div>`}
function card(item,weekly=false){return `<article class=meal-card data-id="${item.id}">${img(item)}<div class=meal-copy><div class=eyebrow>${esc(item.category)}</div><h3><a onclick="route('/recipes/${item.path.split('/').slice(1).join('/')}')">${esc(item.name)}</a></h3><p>${esc((item.description||'').slice(0,95))}</p><div class=facts>${item.menuFacts?`<span>${esc(item.menuFacts)}</span>`:`<span>${esc(item.calories||'Chef curated')}</span><span>${weekly?'From $11.99 / serving':'View recipe'}</span>`}</div>${weekly?`<div class=card-actions><button class=outline onclick="openMeal('${item.id}')">View Details</button><button onclick="addMeal('${item.id}')">Add to cart</button></div>`:''}</div></article>`}
async function getCart(){cart=await(await fetch('/api/cart')).json();return cart}
async function getCatalog(params=''){let result=await(await fetch('/api/recipes'+params)).json();catalog=result.recipes;return result}
function privacyBanner(){return `<aside class=privacy-banner><button class=privacy-close onclick="this.parentElement.remove()">×</button><p>Blue Apron is now part of Wonder. Read our Privacy Policy, linked below, to learn more about our data practices. If you made cookie-based privacy choices in the past with Blue Apron, you will have to update those choices by selecting <b>“Do Not Sell or Share My Personal Information”.</b> By continuing to use the service, you agree to our processing of your information in accordance with our Privacy Policy and your privacy choices. <a>Privacy Policy</a></p><div><button class=privacy-outline onclick="this.closest('aside').remove()">Do Not Sell or Share My Personal Information</button><button onclick="this.closest('aside').remove()">Accept</button></div></aside>`}
function home(){let picks=catalog.slice(0,4);shell(`<nav class=category-nav>${['20 Min Meals','Meal Kits','Assemble & Bake','Family Style','Dish by Blue Apron','Quick Bites'].map(x=>`<a onclick="route('/menu')">${x}</a>`).join('')}</nav><section class=home-hero><div class=hero-copy><div class=hero-badge>NO SUBSCRIPTION NEEDED</div><h1>Dinner's Back on the Calendar</h1><p>Your week has enough on its plate. Let us handle what's on yours.</p><button onclick="route('/menu')">See All Recipes</button></div><div class=home-hero-photo></div></section><section class=ways><h2>More Ways to Blue Apron</h2><div class=way-grid>${[['20 MIN OR LESS','Fast, flavorful recipes ready in 20 minutes or less.'],['ASSEMBLE & BAKE','One-pan meals. Minimal effort, maximum reward.'],['MEAL KITS','Easy recipes. Pre-portioned ingredients.'],['FAMILY STYLE','Mix & match, family-sized mains & sides.']].map((x,i)=>`<article><b>${x[0]}</b><div class=way-photo>${img(picks[i])}</div><p>${x[1]}</p><button onclick="route('/menu')">Shop Now</button></article>`).join('')}</div></section><section class=section><div class=section-head><div><div class=eyebrow>ON THE MENU</div><h2>Something delicious for every night</h2></div><a onclick="route('/menu')">View all meals →</a></div><div class=meal-grid>${picks.map(x=>card(x)).join('')}</div></section>${privacyBanner()}`)}
function plans(){shell(`<section class="section plans"><div class=eyebrow>SUBSCRIBE & SAVE</div><h1>Build a plan for your week</h1><p class=lead>Choose the number of people, meals, and preferences. Your estimate updates instantly.</p><div class=plan-panel><label>Number of people<select id=servings onchange=estimate()><option value=2 ${cart.plan.servings==2?'selected':''}>2 people</option><option value=4 ${cart.plan.servings==4?'selected':''}>4 people</option></select></label><label>Meals per week<select id=meals onchange=estimate()>${[2,3,4,5].map(n=>`<option ${cart.plan.meals==n?'selected':''} value=${n}>${n} meals</option>`).join('')}</select></label><label>Dietary preference<select id=preference onchange=estimate()>${['All','Signature','Vegetarian','Pescatarian','Carb Conscious','30g+ Protein','600 Calories or Less','Family Friendly'].map(x=>`<option ${cart.plan.preference==x?'selected':''}>${x}</option>`).join('')}</select></label><aside class=estimate><span>Estimated weekly subtotal</span><b id=estimate>${money(cart.plan.servings*cart.plan.meals*11.99)}</b><small>Before discounts, shipping, and tax</small></aside><button onclick=savePlan()>Save plan & choose meals</button></div><div class=rules><h2>Flexible by design</h2><p>Change your menu or delivery date before the weekly cutoff. Skip a week, pause, or cancel from your local account.</p></div></section>`)}
function estimate(){document.querySelector('#estimate').textContent=money(servings.value*meals.value*11.99)}
async function savePlan(){let r=await fetch('/api/plan',{method:'PUT',headers:{'Content-Type':'application/json'},body:JSON.stringify({servings:servings.value,meals:meals.value,preference:preference.value})});let x=await r.json();if(!r.ok)return alert(x.error);cart=x;route('/menu')}
function menu(){let weekly=catalog.slice(0,48);let current=new URLSearchParams(location.search).get('cycle_date')==='2026-09-14';shell(`<section class="menu-promo ${current?'menu-promo-sep14':''}"><div><span>NEW!<br>LIMITED<br>EDITION</span><p>THE LABOR DAY COLLECTION</p><h2>Summer’s Last Hurrah</h2><b>ORDER THE WEEK OF AUG. 31</b></div></section><div class="date-tabs source-tabs"><button class=active>THIS WEEK</button><button>NEXT WEEK</button><button>SEP 14–20</button><button>SEP 21–27</button><button>SEP 28–OCT 4</button><button>OCT 5–11</button></div><section class=menu-layout><aside class=category-rail><div>🍔<b>LABOR DAY</b></div><div>🍝<b>20 MINUTES<br>OR LESS</b></div><div>🥗<b>MEAL KITS</b></div><div>🍲<b>ASSEMBLE<br>& BAKE</b></div><div>🍽<b>FAMILY STYLE</b></div></aside><div class=menu-content><div class=menu-tools><button class=zip-button>● &nbsp; Enter zip code</button><div><button class=filter-circle>⚙</button><button class=filter-pill>30g+ Protein</button><button class=filter-pill onclick="calorieFilter(true)">600 Calories or Less</button><button class=filter-pill>30 Minutes or Less</button></div></div><div class=collection-title><h1>Labor Day</h1><p>More Cookout. Less Cooking.</p></div><div class=menu-toolbar><b>${weekly.length} meals available</b><span>${cart.selected_meals} of ${cart.plan.meals} selected</span><button onclick="route('/cart')">Review your box</button></div><div class=meal-grid>${weekly.map(x=>card(x,true)).join('')}</div></div></section>${privacyBanner()}`)}
async function menuFilter(value){filters.category=value;await refreshMenu()}
async function calorieFilter(on){filters.calories=on?600:0;await refreshMenu()}
async function refreshMenu(){let p=new URLSearchParams();if(filters.category!=='All')p.set('category',filters.category);if(filters.calories)p.set('calories',filters.calories);p.set('limit','48');await getCatalog('?'+p);menu()}
async function addMeal(id,upgrade=''){let r=await fetch('/api/cart',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({recipe_id:id,upgrade})});let x=await r.json();if(!r.ok)return alert(x.error);cart=x;let bag=document.querySelector('#bagCount');if(bag)bag.textContent=cart.selected_meals;let msg=document.createElement('div');msg.className='toast';msg.textContent=`Added — ${cart.selected_meals} of ${cart.plan.meals} meals selected`;document.body.append(msg);setTimeout(()=>msg.remove(),1800)}
function openMeal(id){let item=catalog.find(x=>x.id===id);if(item)route('/recipes/'+item.path.split('/').slice(1).join('/'))}
function cookbook(){shell(`<section class=cookbook-hero><div class=eyebrow>THE BLUE APRON COOKBOOK</div><h1>Recipes worth returning to</h1><p>Explore hundreds of chef-designed meals, techniques, and seasonal ideas.</p><form onsubmit="searchRecipes(event)"><input id=recipeSearch value="${esc(filters.q)}" placeholder="Search recipes and ingredients"><button>Search</button></form></section><section class=section><div class=chip-row><button class=active onclick="bookFilter('All')">All recipes</button>${['Standard Meal Kit','Assemble And Bake Meal Kit','15 Minute Meal Kit','Lunch Meal Kit'].map(x=>`<button onclick="bookFilter('${x}')">${x}</button>`).join('')}</div><div id=resultSummary>${catalog.length?`${catalog.length} recipes`:'No recipes found'}</div>${catalog.length?`<div class=meal-grid>${catalog.map(x=>card(x)).join('')}</div>`:`<div class=empty><h2>No recipes match “${esc(filters.q)}”</h2><p>Try another search or clear your filters.</p><button onclick=clearSearch()>View all recipes</button></div>`}</section>`)}
async function searchRecipes(e){e.preventDefault();filters.q=recipeSearch.value.trim();let x=await getCatalog('?q='+encodeURIComponent(filters.q));cookbook()}
async function bookFilter(cat){filters.category=cat;await getCatalog(cat==='All'?'':'?category='+encodeURIComponent(cat));cookbook()}
async function clearSearch(){filters={q:'',category:'All',calories:0};await getCatalog();cookbook()}
function detail(item){let ingredients=(item.ingredients||[]).map(x=>`<li>${esc(x)}</li>`).join('');let steps=(item.instructions||[]).map((x,i)=>`<li><b>${i+1}</b><p>${esc(x)}</p></li>`).join('');shell(`<section class=detail><div class=detail-image>${img(item)}</div><div class=detail-copy><h1>${esc(item.name)}</h1><p class=detail-subtitle>${esc(item.subtitle||item.category)}</p><p class=lead>${esc(item.description)}</p><div class=nutrition><b>NUTRITION PER SERVING</b><a>${esc(item.calories||'Nutrition varies')}</a></div><aside class=subscribe-note><b>Get 5% off your order with Subscribe & Save.</b><span>Skip, update, or cancel anytime. <a onclick="route('/plans')">Learn more</a></span></aside></div></section><section class=ingredient-showcase><h2>Ingredients</h2><div class=ingredient-photo></div></section><section class="section recipe-body"><div><h2>Ingredient list</h2><ul class=ingredients>${ingredients||'<li>Chef-selected seasonal ingredients</li>'}</ul></div><div><h2>Cooking instructions</h2><ol class=steps>${steps}</ol></div></section>`)}
function cartPage(){let items=cart.items.map(x=>`<article class=cart-line>${x.image?`<img src=${x.image}>`:''}<div><b>${esc(x.name)}</b><span>${cart.plan.servings} servings ${x.upgrade?'· '+esc(x.upgrade):''}</span><div><button onclick="qty('${x.recipe_id}',${x.qty-1})">−</button><b>${x.qty}</b><button onclick="qty('${x.recipe_id}',${x.qty+1})">+</button></div></div><strong>${money(x.line_total)}</strong></article>`).join('');let addons=cart.addons.map(x=>`<div class="summary-row addon-line" data-addon="${x.addon_id}"><span>${x.qty} × ${esc(x.name)}</span><b>${money(x.line_total)}</b><button onclick="addonQty('${x.addon_id}',${x.qty-1})" aria-label="Reduce ${esc(x.name)}">−</button><button onclick="addonQty('${x.addon_id}',0)" aria-label="Remove ${esc(x.name)}">Remove</button></div>`).join('');shell(`<section class="section cart-page"><h1>Review your box</h1><div class=cart-layout><div><div class=plan-strip><b>${cart.plan.servings} people · ${cart.plan.meals} meals</b><a onclick="route('/plans')">Edit plan</a></div>${items||`<div class=empty><h2>Your box is empty</h2><p>Choose meals from this week's menu.</p><button onclick="route('/menu')">Browse weekly menu</button></div>`}<section class=addons><h2>Add something extra</h2><div class=addon-grid>${Object.entries({breakfast:['Blueberry Overnight Oats',8.99],snack:['Chocolate Chip Oat Cookies',6.99],protein:['Extra Garlic-Herb Chicken',11.99]}).map(([id,x])=>`<div><b>${x[0]}</b><span>${money(x[1])}</span><button onclick="addAddon('${id}')">Add</button></div>`).join('')}</div></section></div><aside class=order-summary><h2>Order summary</h2><div class=summary-row><span>Meals selected</span><b>${cart.selected_meals} / ${cart.plan.meals}</b></div>${addons}<div class=summary-row><span>Subtotal</span><b>${money(cart.subtotal)}</b></div><div class=summary-row discount><span>Subscribe & Save</span><b>−${money(cart.discount)}</b></div><div class=summary-row><span>Shipping</span><b>${cart.shipping?money(cart.shipping):'FREE'}</b></div><div class=summary-row><span>Estimated tax</span><b>${money(cart.tax)}</b></div><div class="summary-row total"><span>Total</span><b>${money(cart.total)}</b></div>${cart.minimum_met?'':`<p class=error>Select ${cart.plan.meals-cart.selected_meals} more meal(s) to meet your plan.</p>`}<button ${cart.minimum_met?'':'disabled'} onclick="route('/checkout')">Continue to delivery</button><button class=outline onclick="route('/menu')">Back to menu</button></aside></div></section>`)}
async function qty(id,n){cart=await(await fetch('/api/cart/'+id,{method:'PATCH',headers:{'Content-Type':'application/json'},body:JSON.stringify({qty:n})})).json();cartPage()}
async function addAddon(id){let r=await fetch('/api/addons',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({addon_id:id})});let x=await r.json();if(!r.ok)return alert(x.error);cart=x;cartPage()}
async function addonQty(id,qty){let r=await fetch('/api/addons/'+id,{method:'PATCH',headers:{'Content-Type':'application/json'},body:JSON.stringify({qty})});let x=await r.json();if(!r.ok)return alert(x.error);cart=x;cartPage()}
function checkout(){let d=cart.delivery||{};shell(`<section class="section checkout"><h1>Delivery & payment</h1><div class=checkout-grid><form onsubmit="saveDelivery(event)"><h2>Delivery address</h2>${[['name','Full name'],['address','Street address'],['city','City'],['state','State'],['zip','ZIP code'],['phone','Mobile phone number']].map(([id,label])=>`<label>${label}<input id=${id} value="${esc(d[id]||'')}" required></label>`).join('')}<label>Delivery date<select id=date><option ${d.date==='September 21, 2026'?'selected':''}>September 21, 2026</option><option ${d.date==='September 28, 2026'?'selected':''}>September 28, 2026</option></select></label><div id=deliveryError class=error role=alert></div><button>Save & review payment</button></form><aside class=payment-box><h2>Payment</h2><label>Card number<input disabled placeholder="•••• •••• •••• ••••"></label><div class=split><label>Expiration<input disabled placeholder="MM / YY"></label><label>Security code<input disabled placeholder="CVV"></label></div><p class=notice>Offline review only. Payment fields are shown for flow verification; no card data is accepted or stored.</p><button onclick=reviewOrder()>Review order</button><div id=reviewMessage></div><hr><div class="summary-row total"><span>Estimated total</span><b>${money(cart.total)}</b></div></aside></div></section>`)}
async function saveDelivery(e){e.preventDefault();let value=id=>document.getElementById(id).value;let data={name:value('name'),address:value('address'),city:value('city'),state:value('state'),zip:value('zip'),phone:value('phone'),date:value('date')};let r=await fetch('/api/delivery',{method:'PUT',headers:{'Content-Type':'application/json'},body:JSON.stringify(data)});let x=await r.json();if(!r.ok){deliveryError.textContent=x.error;return}cart=x;deliveryError.className='success';deliveryError.textContent='Delivery information saved.'}
async function reviewOrder(){let r=await fetch('/api/checkout/review',{method:'POST'});let x=await r.json();reviewMessage.className=r.ok?'success':'error';reviewMessage.textContent=r.ok?'Ready for final review. No purchase has been submitted.':x.error}
function authPage(kind){let signin=kind==='signin';shell(`<section class=auth><div class=auth-card><h1>${signin?'Welcome back!':'Create an account'}</h1><p>${signin?`Don’t have an account? <a onclick="route('/users/sign_up')">Get started</a>`:`Have an account? <a onclick="route('/users/sign_in')">Login</a>`}</p>${signin?`<div class=social-row><button type=button aria-label=Google>G</button><button type=button aria-label=Apple>●</button><button type=button aria-label=Facebook>f</button></div><div class=auth-or><span>or</span></div><form onsubmit="signIn(event)"><label>Email<input id=loginEmail type=email placeholder="Enter email address" required></label><label>Password<input id=loginPassword type=password placeholder="Enter password" required></label><small>Forgot your password? Reset it <a onclick="route('/users/password/new')">here.</a></small><button>Login</button></form><a class=phone-login>Login with phone number</a>`:`<form onsubmit="registerStart(event)"><label>First Name<input id=firstName placeholder="Enter your first name" required></label><label>Last Name<input id=lastName placeholder="Enter your last name" required></label><label>Email<input id=registerEmail type=email placeholder="Enter your email address" required></label><label>Password<input id=registerPassword type=password placeholder="Enter your password" minlength=8 maxlength=25 required></label><small>Password must be 8 to 25 characters and include numbers and letters.</small><label>Mobile phone number<input id=registerPhone placeholder="Enter your mobile phone number" required></label><p>By creating an account, you agree to the <a>Terms of Service</a> and <a>Privacy Policy</a>.</p><button>Continue</button></form>`}<div id=authMessage class=error role=alert></div></div></section>${privacyBanner()}`,{simple:true})}
async function registerStart(e){e.preventDefault();let r=await fetch('/api/auth/register/start',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({first_name:firstName.value,last_name:lastName.value,email:registerEmail.value,password:registerPassword.value,phone:registerPhone.value})});let x=await r.json();if(!r.ok)return authMessage.textContent=x.error;authMessage.className='sandbox-code';authMessage.innerHTML=`Offline verification code: <b>${x.verification_code}</b><label>Verification code<input id=verifyCode></label><div id=verificationError class=error role=alert></div><button onclick=registerFinish()>Verify & create account</button>`}
async function registerFinish(){let r=await fetch('/api/auth/register/verify',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({code:verifyCode.value})});let x=await r.json();if(!r.ok){verificationError.textContent=x.error;return}route('/account/upcoming')}
async function signIn(e){e.preventDefault();let r=await fetch('/api/auth/signin',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({email:loginEmail.value,password:loginPassword.value})});let x=await r.json();if(!r.ok)return authMessage.textContent=x.error;route('/account/upcoming')}
function resetPage(){shell(`<section class=auth><div class=auth-card><h1>Reset your password</h1><p>Enter the email address associated with your account.</p><form onsubmit="resetRequest(event)"><label>Email address<input id=resetEmail type=email required></label><button>Continue</button></form><div id=resetMessage></div><a onclick="route('/user/sign-in')">Return to sign in</a></div></section>`,{simple:true})}
async function resetRequest(e){e.preventDefault();let r=await fetch('/api/reset-request',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({email:resetEmail.value})});let x=await r.json();resetMessage.className=r.ok?'notice':'error';resetMessage.textContent=x.message||x.error}
async function accountPage(){let s=await(await fetch('/api/auth/session')).json();if(!s.authenticated){authPage('signin');authMessage.textContent='Sign in to manage your deliveries.';return}let r=await fetch('/api/subscription');let sub=await r.json();shell(`<section class="section account"><div class=account-head><div><div class=eyebrow>MY ACCOUNT</div><h1>Upcoming deliveries</h1><p>${esc(s.account.display_name)} · ${esc(s.account.email_normalized)}</p></div><button class=outline onclick=logout()>Sign Out</button></div><article class=delivery-card><div><span class=status>${esc(sub.status)}</span><h2>${sub.skipped?'Week skipped':'Delivery '+esc(sub.next_date)}</h2><p>${esc(sub.address)}</p><p>${cart.plan.servings} people · ${cart.plan.meals} meals</p></div><div class=account-actions><button onclick="subAction('skip')">Skip this week</button><button onclick="editSub('date')">Change date</button><button onclick="editSub('address')">Edit address</button><button onclick="subAction('${sub.status==='paused'?'resume':'pause'}')">${sub.status==='paused'?'Resume':'Pause'} subscription</button><button class=danger onclick="confirmCancel()">Cancel subscription</button></div></article><div id=subMessage></div><h2>Order history</h2><div class=history><b>September 14, 2026</b><span>Delivered · ${cart.plan.meals} meals · ${money(cart.total||78.42)}</span><a onclick="route('/cookbook')">View recipes</a></div></section>`)}
async function subAction(action){let r=await fetch('/api/subscription',{method:'PATCH',headers:{'Content-Type':'application/json'},body:JSON.stringify({action})});let x=await r.json();if(!r.ok)return alert(x.error);accountPage()}
async function editSub(kind){let value=prompt(kind==='date'?'Enter a new delivery date':'Enter a new delivery address');if(!value)return;let r=await fetch('/api/subscription',{method:'PATCH',headers:{'Content-Type':'application/json'},body:JSON.stringify({action:kind,[kind]:value})});let x=await r.json();if(!r.ok)return alert(x.error);accountPage()}
function confirmCancel(){if(confirm('Cancel your local offline subscription? This has no effect on Blue Apron.'))subAction('cancel')}
async function logout(){await fetch('/api/auth/signout',{method:'POST'});route('/')}
function infoPage(kind){if(kind==='gifts'){shell(`<section class=gift-hero><div><h1>Give a Blue Apron<br>gift card</h1><p><b>A gift that never expires.</b><br>Customized to their favorite Blue Apron meal.</p><button class=gift-outline>Redeem gift card</button><button onclick="route('/plans')">Buy gift card</button></div><div class=gift-visual></div></section><section class=gift-gallery>${['A delicious week','Meals made easy','Fresh ingredients','Cook together'].map(x=>`<article><div></div><b>Blue Apron</b><span>${x}</span></article>`).join('')}</section><section class=gift-faq><h2>FAQs</h2><p>For more information on gift cards, view our full list of FAQs <a>here.</a></p></section>${privacyBanner()}`,{simple:true});return}if(kind==='about'){shell(`<section class=vision-photo aria-label="Cooking with Blue Apron"></section><section class=vision-story><h1>Helping everyone get<br>amazing food on the table</h1><div class=vision-chef><div><div class=eyebrow>WHY WE'RE HERE</div><h2>We believe that a great meal can change your day.</h2><p>But with everything life throws at you during the week, getting great meals on the table is not always easy.</p><p>You need a helping hand in the kitchen. That’s where Blue Apron comes in.</p></div><aside><b>FROM OUR HEAD CHEF</b><h2>John Adler</h2><span>SVP/GM</span></aside></div></section>${privacyBanner()}`);return}let content={help:['Help Center & FAQ','How can we help?','Find guidance for orders, deliveries, account access, failed actions, and subscription changes without exposing private account data.']}[kind];shell(`<section class="info-hero ${kind}"><div class=eyebrow>BLUE APRON</div><h1>${content[0]}</h1><h2>${content[1]}</h2><p>${content[2]}</p><button onclick="route('/menu')">Browse meals</button></section>`)}
function notFound(){shell(`<section class=not-found><div class=mark>BA</div><h1>Page not found</h1><p>We couldn't find the page you requested.</p><button onclick="route('/menu')">Return to the weekly menu</button></section>`)}
async function boot(){await getCart();let path=decodeURIComponent(location.pathname);if(!catalog.length)await getCatalog();if(path==='/')home();else if(path==='/menu'){await refreshMenu()}else if(path==='/plans')plans();else if(path==='/cookbook'){await getCatalog(filters.q?'?q='+encodeURIComponent(filters.q):'');cookbook()}else if(path.startsWith('/recipes/')){let slug=path.split('/').pop();let r=await fetch('/api/recipes/'+encodeURIComponent(slug));r.ok?detail(await r.json()):notFound()}else if(path==='/cart')cartPage();else if(path==='/checkout')checkout();else if(path==='/user/sign-in'||path==='/users/sign_in')authPage('signin');else if(path==='/user/sign-up'||path==='/users/sign_up')authPage('signup');else if(path==='/user/password-reset'||path==='/users/password/new')resetPage();else if(path==='/account/upcoming')await accountPage();else if(path==='/gifts'||path==='/gift-cards')infoPage('gifts');else if(path==='/help')infoPage('help');else if(path==='/about'||path==='/pages/vision')infoPage('about');else if(path==='/pages/blue-apron-plus'||path==='/pages/subscribe-and-save')notFound();else notFound()}
const _shell=shell; shell=function(content,opts={}){_shell(content,opts);const actions=document.querySelector('.header-actions');if(actions&&!document.querySelector('#bagCount')){const b=document.createElement('button');b.className='cart-button';b.onclick=()=>route('/cart');b.innerHTML=`Bag <b id=bagCount>${cart.selected_meals||0}</b>`;actions.append(b)}}
const _menuVisual=menu;menu=function(){_menuVisual();if(new URLSearchParams(location.search).get('cycle_date')==='2026-09-14'){let rail=document.querySelector('.category-rail');if(rail)rail.innerHTML=[['01','LABOR DAY'],['02','20 MINUTES<br>OR LESS'],['03','MEAL KITS'],['04','ASSEMBLE &<br>BAKE'],['03','FAMILY STYLE']].map(x=>`<div><img src="/static/menu-side-${x[0]}.png" alt=""><b>${x[1]}</b></div>`).join('')}}
boot();